forked from KolibriOS/kolibrios
IconEdit 0.56: add crop tool, fix several issues
git-svn-id: svn://kolibrios.org@7275 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
c2149afa96
commit
06eafb0c92
Binary file not shown.
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
@ -79,12 +79,16 @@ void EventApplyClick()
|
|||||||
int new_rows = atoi(#text_rows);
|
int new_rows = atoi(#text_rows);
|
||||||
int new_columns = atoi(#text_columns);
|
int new_columns = atoi(#text_columns);
|
||||||
if (new_columns>MAX_CELL_SIZE) || (new_rows>MAX_CELL_SIZE) {
|
if (new_columns>MAX_CELL_SIZE) || (new_rows>MAX_CELL_SIZE) {
|
||||||
notify("'Maximum icon size exceeded!\nPlease, try something less or equal to 256x256.' -E");
|
sprintf(#param,
|
||||||
|
"'Maximum icon size exceeded! Please, try\nsomething less or equal to %ix%i.' -E",
|
||||||
|
MAX_CELL_SIZE, MAX_CELL_SIZE);
|
||||||
|
notify(#param);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
image.create(new_rows, new_columns);
|
image.create(new_rows, new_columns);
|
||||||
actionsHistory.init();
|
actionsHistory.init();
|
||||||
ActivateWindow(GetProcessSlot(Form.ID));
|
ActivateWindow(GetProcessSlot(Form.ID));
|
||||||
|
DrawEditArea();
|
||||||
ExitProcess();
|
ExitProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#define MAX_CELL_SIZE 256
|
#define MAX_CELL_SIZE 128
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////
|
||||||
// //
|
// //
|
||||||
|
@ -4,13 +4,6 @@
|
|||||||
* Licence: GPL v2
|
* Licence: GPL v2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
TODO:
|
|
||||||
window colors
|
|
||||||
enhance icon
|
|
||||||
pipet aside color view
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define MEMSIZE 4096*500
|
#define MEMSIZE 4096*500
|
||||||
|
|
||||||
#include "../lib/gui.h"
|
#include "../lib/gui.h"
|
||||||
@ -32,7 +25,7 @@ pipet aside color view
|
|||||||
// //
|
// //
|
||||||
//===================================================//
|
//===================================================//
|
||||||
|
|
||||||
#define T_TITLE "Icon Editor 0.55 Alpha"
|
#define T_TITLE "Icon Editor 0.56 Alpha"
|
||||||
|
|
||||||
#define TOPBAR_H 24+8
|
#define TOPBAR_H 24+8
|
||||||
#define LEFTBAR_W 16+5+5+3+3
|
#define LEFTBAR_W 16+5+5+3+3
|
||||||
@ -87,6 +80,7 @@ enum {
|
|||||||
BTN_ZOOM_IN,
|
BTN_ZOOM_IN,
|
||||||
BTN_ZOOM_OUT,
|
BTN_ZOOM_OUT,
|
||||||
BTN_CANVAS_RESIZE,
|
BTN_CANVAS_RESIZE,
|
||||||
|
BTN_CROP,
|
||||||
BTNS_PALETTE_COLOR_MAS = 100,
|
BTNS_PALETTE_COLOR_MAS = 100,
|
||||||
BTNS_LAST_USED_COLORS = 400
|
BTNS_LAST_USED_COLORS = 400
|
||||||
};
|
};
|
||||||
@ -300,6 +294,9 @@ void main()
|
|||||||
case BTN_CANVAS_RESIZE:
|
case BTN_CANVAS_RESIZE:
|
||||||
notify("Sorry, not implemented yet.");
|
notify("Sorry, not implemented yet.");
|
||||||
break;
|
break;
|
||||||
|
case BTN_CROP:
|
||||||
|
EventCrop();
|
||||||
|
break;
|
||||||
case CLOSE_BTN:
|
case CLOSE_BTN:
|
||||||
EventExitIconEdit();
|
EventExitIconEdit();
|
||||||
break;
|
break;
|
||||||
@ -334,7 +331,7 @@ void main()
|
|||||||
|
|
||||||
case evReDraw:
|
case evReDraw:
|
||||||
Window_CanvasReSize.thread_exists();
|
Window_CanvasReSize.thread_exists();
|
||||||
draw_window();
|
DrawWindow();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -362,19 +359,20 @@ void DrawStatusBar()
|
|||||||
{
|
{
|
||||||
zoom.draw(wrapper.x, wrapper.y + wrapper.h + 6);
|
zoom.draw(wrapper.x, wrapper.y + wrapper.h + 6);
|
||||||
|
|
||||||
|
sprintf(#param,"%i x %i", image.columns, image.rows);
|
||||||
DrawCaptButton(
|
DrawCaptButton(
|
||||||
wrapper.x+wrapper.w-calc(strlen(#param)*8) +6 - 1,
|
wrapper.x+wrapper.w-calc(strlen(#param)*8) -6 - 1,
|
||||||
zoom.y,
|
zoom.y,
|
||||||
calc(strlen(#param)*8)-6,
|
calc(strlen(#param)*8)+6,
|
||||||
18,
|
18,
|
||||||
BTN_CANVAS_RESIZE,
|
BTN_CANVAS_RESIZE,
|
||||||
system.color.work_button,
|
system.color.work_button,
|
||||||
system.color.work_button_text,
|
system.color.work_button_text,
|
||||||
sprintf(#param,"%i x %i", image.rows, image.columns)
|
#param
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw_window()
|
void DrawWindow()
|
||||||
{
|
{
|
||||||
#define GAP 27
|
#define GAP 27
|
||||||
#define BLOCK_SPACE 10
|
#define BLOCK_SPACE 10
|
||||||
@ -404,6 +402,8 @@ void draw_window()
|
|||||||
DrawTopPanelButton(BTN_FLIP_VER, tx.inc(GAP), 35);
|
DrawTopPanelButton(BTN_FLIP_VER, tx.inc(GAP), 35);
|
||||||
|
|
||||||
DrawTopPanelButton(BTN_TEST_ICON, tx.inc(GAP+BLOCK_SPACE), 12);
|
DrawTopPanelButton(BTN_TEST_ICON, tx.inc(GAP+BLOCK_SPACE), 12);
|
||||||
|
|
||||||
|
DrawTopPanelButton(BTN_CROP, tx.inc(GAP+BLOCK_SPACE), 46);
|
||||||
// DrawTopPanelButton(BTN_ROTATE_LEFT, tx.inc(GAP), 36); //not implemented
|
// DrawTopPanelButton(BTN_ROTATE_LEFT, tx.inc(GAP), 36); //not implemented
|
||||||
// DrawTopPanelButton(BTN_ROTATE_RIGHT, tx.inc(GAP), 37); //not implemented
|
// DrawTopPanelButton(BTN_ROTATE_RIGHT, tx.inc(GAP), 37); //not implemented
|
||||||
|
|
||||||
@ -689,6 +689,22 @@ void EventMove(dword _action)
|
|||||||
actionsHistory.saveCurrentState();
|
actionsHistory.saveCurrentState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EventCrop()
|
||||||
|
{
|
||||||
|
if (selection.state) {
|
||||||
|
EventSaveIconToFile();
|
||||||
|
image.create(selection.buf.rows, selection.buf.columns);
|
||||||
|
selection.move_to_point(0,0);
|
||||||
|
selection.apply_to_image();
|
||||||
|
selection.reset();
|
||||||
|
actionsHistory.init();
|
||||||
|
DrawWindow();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
notify("'You need to select something before usnig crop tool.' -W");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
stop:
|
stop:
|
||||||
|
|
||||||
char test_icon_stak[4096];
|
char test_icon_stak[4096];
|
||||||
|
@ -2,7 +2,7 @@ dword screen_copy;
|
|||||||
|
|
||||||
void ScreenCopy_activate() {
|
void ScreenCopy_activate() {
|
||||||
SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE);
|
SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE);
|
||||||
screen_copy = malloc(image.columns * image.rows * 3 );
|
screen_copy = malloc(image.columns * image.rows * 3 +4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenCopy_onMouseEvent(int mouseX, int mouseY, int lkm, int pkm) {
|
void ScreenCopy_onMouseEvent(int mouseX, int mouseY, int lkm, int pkm) {
|
||||||
|
@ -98,10 +98,10 @@ void ApplySelectionToImage() {
|
|||||||
if (STATE_SELECTED != selection.state) return;
|
if (STATE_SELECTED != selection.state) return;
|
||||||
|
|
||||||
selection.apply_to_image();
|
selection.apply_to_image();
|
||||||
|
selection.reset();
|
||||||
|
|
||||||
actionsHistory.saveCurrentState();
|
actionsHistory.saveCurrentState();
|
||||||
DrawCanvas();
|
DrawCanvas();
|
||||||
selection.reset();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_selection_moving() {
|
bool is_selection_moving() {
|
||||||
|
Loading…
Reference in New Issue
Block a user