diff --git a/data/common/icons16.png b/data/common/icons16.png index 95e1c512f3..62493dc27b 100644 Binary files a/data/common/icons16.png and b/data/common/icons16.png differ diff --git a/programs/cmm/iconedit/canvas_resize.h b/programs/cmm/iconedit/canvas_resize.h index 9db079dcfc..2899125cd2 100644 --- a/programs/cmm/iconedit/canvas_resize.h +++ b/programs/cmm/iconedit/canvas_resize.h @@ -79,12 +79,16 @@ void EventApplyClick() int new_rows = atoi(#text_rows); int new_columns = atoi(#text_columns); 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; } image.create(new_rows, new_columns); actionsHistory.init(); ActivateWindow(GetProcessSlot(Form.ID)); + DrawEditArea(); ExitProcess(); } diff --git a/programs/cmm/iconedit/colors_mas.h b/programs/cmm/iconedit/colors_mas.h index 0962eb3c6d..3efcb4edb8 100644 --- a/programs/cmm/iconedit/colors_mas.h +++ b/programs/cmm/iconedit/colors_mas.h @@ -1,4 +1,4 @@ -#define MAX_CELL_SIZE 256 +#define MAX_CELL_SIZE 128 ////////////////////////////////////////////////////////////////////////////////////// // // diff --git a/programs/cmm/iconedit/iconedit.c b/programs/cmm/iconedit/iconedit.c index 246c405621..48d62891bd 100644 --- a/programs/cmm/iconedit/iconedit.c +++ b/programs/cmm/iconedit/iconedit.c @@ -4,13 +4,6 @@ * Licence: GPL v2 */ -/* -TODO: -window colors -enhance icon -pipet aside color view -*/ - #define MEMSIZE 4096*500 #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 LEFTBAR_W 16+5+5+3+3 @@ -87,6 +80,7 @@ enum { BTN_ZOOM_IN, BTN_ZOOM_OUT, BTN_CANVAS_RESIZE, + BTN_CROP, BTNS_PALETTE_COLOR_MAS = 100, BTNS_LAST_USED_COLORS = 400 }; @@ -300,6 +294,9 @@ void main() case BTN_CANVAS_RESIZE: notify("Sorry, not implemented yet."); break; + case BTN_CROP: + EventCrop(); + break; case CLOSE_BTN: EventExitIconEdit(); break; @@ -334,7 +331,7 @@ void main() case evReDraw: Window_CanvasReSize.thread_exists(); - draw_window(); + DrawWindow(); break; } } @@ -362,19 +359,20 @@ void DrawStatusBar() { zoom.draw(wrapper.x, wrapper.y + wrapper.h + 6); + sprintf(#param,"%i x %i", image.columns, image.rows); DrawCaptButton( - wrapper.x+wrapper.w-calc(strlen(#param)*8) +6 - 1, + wrapper.x+wrapper.w-calc(strlen(#param)*8) -6 - 1, zoom.y, - calc(strlen(#param)*8)-6, + calc(strlen(#param)*8)+6, 18, BTN_CANVAS_RESIZE, system.color.work_button, system.color.work_button_text, - sprintf(#param,"%i x %i", image.rows, image.columns) + #param ); } -void draw_window() +void DrawWindow() { #define GAP 27 #define BLOCK_SPACE 10 @@ -404,6 +402,8 @@ void draw_window() DrawTopPanelButton(BTN_FLIP_VER, tx.inc(GAP), 35); 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_RIGHT, tx.inc(GAP), 37); //not implemented @@ -689,6 +689,22 @@ void EventMove(dword _action) 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: char test_icon_stak[4096]; diff --git a/programs/cmm/iconedit/tools/screen_copy.h b/programs/cmm/iconedit/tools/screen_copy.h index 6a0503bbd1..16108bd784 100644 --- a/programs/cmm/iconedit/tools/screen_copy.h +++ b/programs/cmm/iconedit/tools/screen_copy.h @@ -2,7 +2,7 @@ dword screen_copy; void ScreenCopy_activate() { 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) { diff --git a/programs/cmm/iconedit/tools/selection.h b/programs/cmm/iconedit/tools/selection.h index b803c7b0a3..7a699a5aee 100644 --- a/programs/cmm/iconedit/tools/selection.h +++ b/programs/cmm/iconedit/tools/selection.h @@ -98,10 +98,10 @@ void ApplySelectionToImage() { if (STATE_SELECTED != selection.state) return; selection.apply_to_image(); + selection.reset(); actionsHistory.saveCurrentState(); DrawCanvas(); - selection.reset(); } bool is_selection_moving() {