diff --git a/data/common/icons32.png b/data/common/icons32.png index 83725852d1..c20ba68503 100644 Binary files a/data/common/icons32.png and b/data/common/icons32.png differ diff --git a/data/common/settings/assoc.ini b/data/common/settings/assoc.ini index dd7c3b1e17..8e28503028 100644 --- a/data/common/settings/assoc.ini +++ b/data/common/settings/assoc.ini @@ -111,6 +111,7 @@ mpg=$FPlay mpeg=$FPlay mov=$FPlay webm=$FPlay +3gp=$FPlay png=$KIV jpg=$KIV diff --git a/programs/cmm/iconedit/colors_mas.h b/programs/cmm/iconedit/colors_mas.h index 026fba0c84..0962eb3c6d 100644 --- a/programs/cmm/iconedit/colors_mas.h +++ b/programs/cmm/iconedit/colors_mas.h @@ -62,6 +62,7 @@ struct _image void set_image(); dword get_pixel(); dword get_image(); + dword get_image_with_replaced_color(); void move(); }; @@ -190,6 +191,29 @@ dword _image::get_image() return img; } +dword _image::get_image_with_replaced_color(dword _col_from, _col_to) +{ + int r=0, c=0; + dword i; + dword cur_pixel; + + free(img); + i = img = malloc(rows*columns*3); + + for (r = 0; r < rows; r++) + for (c = 0; c < columns; c++) + { + cur_pixel = get_pixel(r,c); + if (cur_pixel == _col_from) cur_pixel = _col_to; + rgb.DwordToRgb(cur_pixel); + ESBYTE[i] = rgb.b; + ESBYTE[i+1] = rgb.g; + ESBYTE[i+2] = rgb.r; + i += 3; + } + return img; +} + enum { MOVE_LEFT, MOVE_RIGHT, diff --git a/programs/cmm/iconedit/iconedit.c b/programs/cmm/iconedit/iconedit.c index d2a6542ff5..840cd46ae8 100644 --- a/programs/cmm/iconedit/iconedit.c +++ b/programs/cmm/iconedit/iconedit.c @@ -32,7 +32,7 @@ pipet aside color view // // //===================================================// -#define T_TITLE "Icon Editor 0.52 Alpha" +#define T_TITLE "Icon Editor 0.53 Alpha" #define TOOLBAR_H 24+8 #define PANEL_LEFT_W 16+5+5+3+3 @@ -76,6 +76,7 @@ enum { BTN_FLIP_VER, BTN_ROTATE_LEFT, BTN_ROTATE_RIGHT, + BTN_TEST_ICON, BTN_PENCIL, BTN_PICK, BTN_FILL, @@ -264,6 +265,9 @@ void main() image.move(FLIP_HOR); DrawCanvas(); break; + case BTN_TEST_ICON: + EventTestIcon(); + break; case BTN_PENCIL: setCurrentTool(TOOL_PENCIL); break; @@ -309,6 +313,8 @@ void main() if (key_scancode == SCAN_CODE_KEY_B) setCurrentTool(TOOL_BAR); if (key_scancode == SCAN_CODE_KEY_S) setCurrentTool(TOOL_SELECT); + if (key_scancode == SCAN_CODE_KEY_T) EventTestIcon(); + if (key_scancode == SCAN_CODE_KEY_Z) && (key_modifier&KEY_LCTRL) actionsHistory.undoLastAction(); if (key_scancode == SCAN_CODE_KEY_Y) && (key_modifier&KEY_LCTRL) actionsHistory.redoLastAction(); @@ -371,6 +377,8 @@ void draw_window() DrawToolbarButton(BTN_FLIP_HOR, tx.inc(TB_ICON_PADDING+8), 34); DrawToolbarButton(BTN_FLIP_VER, tx.inc(TB_ICON_PADDING), 35); + + DrawToolbarButton(BTN_TEST_ICON, tx.inc(TB_ICON_PADDING+8), 12); // DrawToolbarButton(BTN_ROTATE_LEFT, tx.inc(TB_ICON_PADDING), 36); //not implemented // DrawToolbarButton(BTN_ROTATE_RIGHT, tx.inc(TB_ICON_PADDING), 37); //not implemented @@ -540,6 +548,40 @@ dword GetPixelUnderMouse() return GetPixelColorFromScreen(mouse.x + Form.left + 5, mouse.y + Form.top + skin_height); } +int preview_size = 128; +void DrawImageWithBg(dword _x, _y, _col_to) +{ + _x *= preview_size; + _y *= preview_size; + DrawWideRectangle(_x,_y, preview_size, preview_size, preview_size-image.columns/2, _col_to); + _PutImage(preview_size - image.columns / 2 + _x, preview_size - image.rows / 2 + _y, + image.columns, image.rows, image.get_image_with_replaced_color(color2, _col_to)); +} + +void ShowWindow_TestIcon() +{ + loop() switch(WaitEvent()) + { + case evButton: + if (GetButtonID()) ExitProcess(); + break; + + case evKey: + GetKeys(); + if (key_scancode == SCAN_CODE_ESC) ExitProcess(); + break; + + case evReDraw: + DefineAndDrawWindow(Form.left+100, Form.top+100, preview_size*2+9, + preview_size*2+skin_height+4, 0x74, NULL, "Test Icon", 0); + DrawImageWithBg(0, 0, 0x000000); + DrawImageWithBg(1, 0, 0xFFFfff); + DrawImageWithBg(0, 1, GetPixelColorFromScreen(0, 0)); + DrawImageWithBg(1, 1, system.color.work); + break; + } +} + //===================================================// // // // EVENTS // @@ -587,3 +629,11 @@ void EventSetActiveColor(int _number, _color) DrawColorPallets(); } +void EventTestIcon() +{ + CreateThread(#ShowWindow_TestIcon, #test_icon_stak+4092); +} + +stop: + +char test_icon_stak[4096]; diff --git a/programs/cmm/lib/keyboard.h b/programs/cmm/lib/keyboard.h index 24d87c1940..a22f887e24 100644 --- a/programs/cmm/lib/keyboard.h +++ b/programs/cmm/lib/keyboard.h @@ -53,6 +53,7 @@ #define SCAN_CODE_KEY_P 025 #define SCAN_CODE_KEY_R 019 #define SCAN_CODE_KEY_S 031 +#define SCAN_CODE_KEY_T 020 #define SCAN_CODE_KEY_V 047 #define SCAN_CODE_KEY_X 045 #define SCAN_CODE_KEY_Y 021