forked from KolibriOS/kolibrios
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:
parent
b31ece4fbd
commit
f2e87fdd55
@ -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--;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -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>
|
|
@ -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>
|
|
@ -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 };
|
enum { SAVE_AS_PNG=1, SAVE_AS_BMP=2, SAVE_AS_RAW=4 };
|
||||||
int saving_type=SAVE_AS_PNG;
|
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" };
|
"mono", "8gray", "2pal", "4pal", "8gr/a" };
|
||||||
|
|
||||||
enum {
|
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(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(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);
|
//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, 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);
|
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_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_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);
|
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_status_bar();
|
||||||
draw_canvas();
|
draw_canvas();
|
||||||
@ -347,7 +349,6 @@ void draw_acive_panel()
|
|||||||
if (EAX) {
|
if (EAX) {
|
||||||
img_destroy stdcall(EAX);
|
img_destroy stdcall(EAX);
|
||||||
} else {
|
} else {
|
||||||
//continue;
|
|
||||||
a = -1;
|
a = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -368,7 +369,7 @@ void draw_acive_panel()
|
|||||||
// DrawTopPanelButton1(#EventMoveDown, ECTRL + SCAN_CODE_DOWN, tx.inc(GAP_S), 33);
|
// DrawTopPanelButton1(#EventMoveDown, ECTRL + SCAN_CODE_DOWN, tx.inc(GAP_S), 33);
|
||||||
break;
|
break;
|
||||||
default:
|
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);
|
OpenDialog_start stdcall (#o_dialog);
|
||||||
if (o_dialog.status) {
|
if (o_dialog.status) {
|
||||||
open_image(#openfile_path);
|
open_image(#openfile_path);
|
||||||
draw_canvas();
|
draw_window();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
|
#ifndef INCLUDE_EVENTS_H
|
||||||
|
#define INCLUDE_EVENTS_H
|
||||||
|
#print "[include <collection.h>]\n"
|
||||||
|
|
||||||
#ifndef INCLUDE_ARRAY_H
|
#include "../lib/collection.h"
|
||||||
#include "../lib/array.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define ECTRL 300
|
#define ECTRL 300
|
||||||
|
|
||||||
struct EVENTS
|
struct EVENTS
|
||||||
{
|
{
|
||||||
Array array;
|
collection_int array;
|
||||||
int new_id;
|
int new_id;
|
||||||
void init();
|
void init();
|
||||||
int add();
|
int add();
|
||||||
@ -17,7 +18,7 @@ struct EVENTS
|
|||||||
|
|
||||||
void EVENTS::init(dword size)
|
void EVENTS::init(dword size)
|
||||||
{
|
{
|
||||||
array.init(size);
|
array.drop();
|
||||||
new_id = 900;
|
new_id = 900;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,3 +45,5 @@ bool EVENTS::press(dword id)
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -23,7 +23,6 @@
|
|||||||
#include "../lib/list_box.h"
|
#include "../lib/list_box.h"
|
||||||
#include "../lib/draw_buf.h"
|
#include "../lib/draw_buf.h"
|
||||||
#include "../lib/events.h"
|
#include "../lib/events.h"
|
||||||
#include "../lib/array.h"
|
|
||||||
#include "../lib/clipboard.h"
|
#include "../lib/clipboard.h"
|
||||||
#include "../lib/math.h"
|
#include "../lib/math.h"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user