From f2e87fdd554ec545a53ba8b84082a81f4328d2d6 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Fri, 14 Jan 2022 19:34:48 +0000 Subject: [PATCH] lib/events.h: use structure collection_int instead of unstable Array git-svn-id: svn://kolibrios.org@9635 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/examples/array2.c | 46 ---------------------- programs/cmm/examples/leotag/info.xml | 15 ------- programs/cmm/examples/leotag/tags/base.xml | 17 -------- programs/cmm/imgedit/imgedit.c | 11 +++--- programs/cmm/lib/events.h | 15 ++++--- programs/cmm/quark/quark.c | 1 - 6 files changed, 15 insertions(+), 90 deletions(-) delete mode 100755 programs/cmm/examples/array2.c delete mode 100755 programs/cmm/examples/leotag/info.xml delete mode 100644 programs/cmm/examples/leotag/tags/base.xml diff --git a/programs/cmm/examples/array2.c b/programs/cmm/examples/array2.c deleted file mode 100755 index 549b310ad9..0000000000 --- a/programs/cmm/examples/array2.c +++ /dev/null @@ -1,46 +0,0 @@ -#define MEMSIZE 4096*400 - -#include "../lib/window.h" -#include "../lib/array.h" - -window win1=0; -void main() -{ - win1.background = 0xFFFFFF; - win1.left = 200; - win1.top = 200; - win1.caption = "Stress test"; - win1.ondraw = #draw_window; - win1.create(); -} - - -void draw_window() -{ - dword init = 0; - dword count = 0; - dword position = 0; - dword y = 15; - init = malloc(0x1000); - count = 200000; - while (count) - { - position = indexArray(init, count); - DSDWORD[position] = count*2; - count--; - } - position = indexArray(init, 123);DSDWORD[position] = 0; - position = indexArray(init, 777);DSDWORD[position] = 0; - count = 200000; - while (count) - { - position = indexArray(init, count); - if (DSDWORD[position] != count*2) - { - WriteText(15, y, 0x81, 0xFF0000, itoa(count)); - y += 25; - } - count--; - } - -} diff --git a/programs/cmm/examples/leotag/info.xml b/programs/cmm/examples/leotag/info.xml deleted file mode 100755 index d393ae16b9..0000000000 --- a/programs/cmm/examples/leotag/info.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - ExitProcess(); - - - (exit) - - - - - REV - 17.09.2018 - - \ No newline at end of file diff --git a/programs/cmm/examples/leotag/tags/base.xml b/programs/cmm/examples/leotag/tags/base.xml deleted file mode 100644 index e7618d8517..0000000000 --- a/programs/cmm/examples/leotag/tags/base.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - 0 - 0x81 - #000000 - - - - - DrawText({{left}},{{top}},{{type}},{{color}},{{value}}); - - - (DrawText {{left}} {{top}} {{type}} {{color}} {{value}}) - - - \ No newline at end of file diff --git a/programs/cmm/imgedit/imgedit.c b/programs/cmm/imgedit/imgedit.c index 5e155ff5c2..cf1a3a8ae1 100644 --- a/programs/cmm/imgedit/imgedit.c +++ b/programs/cmm/imgedit/imgedit.c @@ -62,7 +62,7 @@ scroll_bar scroll_h = { NULL,TOOLBAR_W+PAD+PAD,15,NULL,15,2,NULL,0,0,COL_DARK,CO enum { SAVE_AS_PNG=1, SAVE_AS_BMP=2, SAVE_AS_RAW=4 }; int saving_type=SAVE_AS_PNG; -char* libimg_bpp[] = { "???", "8pal", "24", "32", "15", "16", +char* libimg_bpp[] = { "-", "8pal", "24", "32", "15", "16", "mono", "8gray", "2pal", "4pal", "8gr/a" }; enum { @@ -194,6 +194,7 @@ void draw_content() //draw_tool_btn(14, ECTRL + SCAN_CODE_RIGHT, PAD, tx.inc(GAP_S), 31, false); //draw_tool_btn(15, ECTRL + SCAN_CODE_UP, PAD, tx.inc(GAP_S), 32, false); //draw_tool_btn(16, ECTRL + SCAN_CODE_DOWN, PAD, tx.inc(GAP_S), 33, false); + if (!main_image.image) goto _NO_IMAGE; draw_tool_btn(#event_save, ECTRL + SCAN_CODE_KEY_S, PAD, tx.inc(GAP_B), 05, "Save as", false); draw_tool_btn(#event_save_png, 0, PAD, tx.inc(GAP_S), -1, "PNG", saving_type & SAVE_AS_PNG); @@ -204,6 +205,7 @@ void draw_content() draw_tool_btn(#event_activate_resize,0, PAD, tx.inc(GAP_S), 06, "Resize", active_tool & TOOL_RESIZE); draw_tool_btn(#event_activate_depth, 0, PAD, tx.inc(GAP_S), 52, "Color depth", active_tool & TOOL_COLOR_DEPTH); draw_tool_btn(#event_activate_flprot,0, PAD, tx.inc(GAP_S), 36, "Flip/Rotate", active_tool & TOOL_FLIP_ROTATE); + _NO_IMAGE: draw_status_bar(); draw_canvas(); @@ -313,7 +315,7 @@ void event_set_color_depth() { main_image.set_vars(); draw_acive_panel(); draw_status_bar(); - draw_canvas(); + draw_canvas(); } } @@ -347,7 +349,6 @@ void draw_acive_panel() if (EAX) { img_destroy stdcall(EAX); } else { - //continue; a = -1; } } @@ -368,7 +369,7 @@ void draw_acive_panel() // DrawTopPanelButton1(#EventMoveDown, ECTRL + SCAN_CODE_DOWN, tx.inc(GAP_S), 33); break; default: - WriteText(CANVASX+PAD, HEADER_TEXTY, 0x90, COL_WORK_TEXT, "Welcome to ImageEditor Pro! Try to open some file."); + WriteText(CANVASX+PAD, HEADER_TEXTY, 0x90, COL_WORK_TEXT, "Welcome to ImageEditor Pro! Try to open a file."); } } @@ -384,7 +385,7 @@ void event_open() OpenDialog_start stdcall (#o_dialog); if (o_dialog.status) { open_image(#openfile_path); - draw_canvas(); + draw_window(); } } diff --git a/programs/cmm/lib/events.h b/programs/cmm/lib/events.h index 640953c708..e5d0a07265 100644 --- a/programs/cmm/lib/events.h +++ b/programs/cmm/lib/events.h @@ -1,13 +1,14 @@ +#ifndef INCLUDE_EVENTS_H +#define INCLUDE_EVENTS_H +#print "[include ]\n" -#ifndef INCLUDE_ARRAY_H -#include "../lib/array.h" -#endif +#include "../lib/collection.h" #define ECTRL 300 struct EVENTS { - Array array; + collection_int array; int new_id; void init(); int add(); @@ -17,7 +18,7 @@ struct EVENTS void EVENTS::init(dword size) { - array.init(size); + array.drop(); new_id = 900; } @@ -43,4 +44,6 @@ bool EVENTS::press(dword id) return true; } return false; -} \ No newline at end of file +} + +#endif \ No newline at end of file diff --git a/programs/cmm/quark/quark.c b/programs/cmm/quark/quark.c index 8975eb7730..10062054b7 100644 --- a/programs/cmm/quark/quark.c +++ b/programs/cmm/quark/quark.c @@ -23,7 +23,6 @@ #include "../lib/list_box.h" #include "../lib/draw_buf.h" #include "../lib/events.h" -#include "../lib/array.h" #include "../lib/clipboard.h" #include "../lib/math.h"