lib/events.h: use structure collection_int instead of unstable Array

git-svn-id: svn://kolibrios.org@9635 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2022-01-14 19:34:48 +00:00
parent b31ece4fbd
commit f2e87fdd55
6 changed files with 15 additions and 90 deletions

View File

@ -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--;
}
}

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<application>
<keyboard language="C--" type="press" key="CODE_ESC">
ExitProcess();
</keyboard>
<keyboard language="lisp" type="press" key="KEY_ESC">
(exit)
</keyboard>
<window type="undragable" right="15" bottom="15" width="150" height="80">
<DrawBar left="0" top="0" width="150" height="80" color="#414155" />
<DrawRect left="0" top="0" width="150" height="80" weight="3" color="#5555FF" />
<DrawText left="15" top="20" type="0x81" color="#FFFF55"> REV <RevisionNumber /> </DrawText>
<DrawText left="15" top="45" type="0x81" color="#FFFF55">17.09.2018</DrawText>
</window>
</application>

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<tags>
<resources>
<integer name="default">0</integer>
<integer name="defaultTypeDrawText">0x81</integer>
<color name="black">#000000</color>
<string name="default"></string>
</resources>
<DrawText left="@integer/default" top="@integer/default" type="@integer/defaultTypeDrawText" color="@color/black" value="@string/default">
<code language="c--">
DrawText({{left}},{{top}},{{type}},{{color}},{{value}});
</code>
<code language="lisp">
(DrawText {{left}} {{top}} {{type}} {{color}} {{value}})
</code>
</DrawText>
</tags>

View File

@ -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();
}
}

View File

@ -1,13 +1,14 @@
#ifndef INCLUDE_EVENTS_H
#define INCLUDE_EVENTS_H
#print "[include <collection.h>]\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;
}
}
#endif

View File

@ -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"