Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 647 → Rev 648

/programs/develop/libGUI/examples/C example/interface.c
0,0 → 1,1270
 
 
#include "./include/kolibrisys.h"
#include "./include/stdlib.h"
 
 
#define Cannot_load_libGUI 100
#define ParendSize 44
#define MessageSize 16
 
#define TOTAL_NUMBERS_OF_CONTROLS 150
 
#define WINDOW_POSX 50
#define WINDOW_POSY 50
#define WINDOW_SIZEX 512
#define WINDOW_SIZEY 384
 
#define FONT_SIZEX 6
 
#define BOOKMARK1_POSX 0
#define BOOKMARK1_POSY 55
#define BOOKMARK1_SIZEX 210
#define BOOKMARK2_POSX 215
#define BOOKMARK2_POSY 55
 
#define SCREEN_SIZEX 1024
#define SCREEN_SIZEY 768
 
#define CONTROLS_NUMBER_POS 4
 
#define DISTANCE1 130
 
struct WINDOW
{
int posx;
int posy;
int sizex;
int sizey;
};
 
struct HEADER
{
dword ctrl_proc;
dword *ctrl_fd;
dword *ctrl_bk;
dword *child_fd;
dword *child_bk;
dword *parend;
dword ctrl_x;
dword ctrl_y;
dword ctrl_sizex;
dword ctrl_sizey;
dword ctrl_ID;
 
}__attribute__((packed));;
 
struct MESSAGE
{
dword type;
dword arg1;
dword arg2;
dword arg3;
}__attribute__((packed));
 
struct ControlButton
{
dword ctrl_proc;
dword *ctrl_fd;
dword *ctrl_bk;
dword *child_fd;
dword *child_bk;
dword *parend;
dword ctrl_x;
dword ctrl_y;
dword ctrl_sizex;
dword ctrl_sizey;
dword ctrl_ID;
 
byte type;
byte flag;
word x;
word y;
word width;
word height;
dword image;
word imageX;
word imageY;
word imageSizeX;
word imageSizeY;
dword transparentColor;
dword text;
word textX;
word textY;
dword textcolor;
dword color1;
dword color2;
word mouseX;
word mouseY;
}__attribute__((packed));;
 
struct ControlScroller
{
dword ctrl_proc;
dword *ctrl_fd;
dword *ctrl_bk;
dword *child_fd;
dword *child_bk;
dword *parend;
dword ctrl_x;
dword ctrl_y;
dword ctrl_sizex;
dword ctrl_sizey;
dword ctrl_ID;
 
byte type;
word x;
word y;
word length;
dword color1;
float size;
float pos;
word buttons_flags;
dword ChildButton1;
dword ChildButton2;
word MouseX;
word MouseY;
}__attribute__((packed));;
 
struct ControlProgressbar
{
dword ctrl_proc;
dword *ctrl_fd;
dword *ctrl_bk;
dword *child_fd;
dword *child_bk;
dword *parend;
dword ctrl_x;
dword ctrl_y;
dword ctrl_sizex;
dword ctrl_sizey;
dword ctrl_ID;
 
byte type;
byte flag;
dword color1;
dword color2;
dword x;
dword y;
dword sizex;
dword sizey;
float progress;
dword color3;
}__attribute__((packed));;
 
 
typedef struct InfoForButton
{
byte type; //0
byte flag; //1
word x; //2
word y; //4
word width; //6
word height; //8
dword image; //10
word imageX; //14
word imageY; //16
word imageSizeX; //18
word imageSizeY; //20
dword transparentColor;//24
dword text; //28
word textX; //32
word textY; //34
dword textcolor; //36
dword color1; //40
dword color2;
word mouseX;
word mouseY;
}__attribute__((packed));
 
struct InfoForScroller
{
byte type;
word x;
word y;
word length;
dword color1;
float size;
float pos;
word buttons_flags;
dword ChildButton1;
dword ChildButton2;
word MouseX;
word MouseY;
}__attribute__((packed));
 
struct InfoForProgressbar
{
byte type;
byte flag;
dword color1;
dword color2;
dword x;
dword y;
dword sizex;
dword sizey;
float progress;
dword color3;
}__attribute__((packed));
 
 
struct InfoForImage
{
byte type;
byte flag;
dword color1;
dword x;
dword y;
dword sizex;
dword sizey;
dword pointer;
}__attribute__((packed));
 
struct InfoForText
{
byte type;
byte flag;
dword color1;
dword x;
dword y;
dword length;
dword text;
}__attribute__((packed));
 
struct InfoForNumber
{
byte type;
byte flag;
dword color1;
dword x;
dword y;
float number;
dword format;
}__attribute__((packed));
 
struct ControlImage
{
dword ctrl_proc;
dword *ctrl_fd;
dword *ctrl_bk;
dword *child_fd;
dword *child_bk;
dword *parend;
dword ctrl_x;
dword ctrl_y;
dword ctrl_sizex;
dword ctrl_sizey;
dword ctrl_ID;
 
byte type;
byte flag;
dword color1;
dword x;
dword y;
dword sizex;
dword sizey;
dword pointer;
}__attribute__((packed));
 
struct ControlText
{
dword ctrl_proc;
dword *ctrl_fd;
dword *ctrl_bk;
dword *child_fd;
dword *child_bk;
dword *parend;
dword ctrl_x;
dword ctrl_y;
dword ctrl_sizex;
dword ctrl_sizey;
dword ctrl_ID;
 
byte type;
byte flag;
dword color1;
dword x;
dword y;
dword length;
dword text;
}__attribute__((packed));
 
struct ControlNumber
{
dword ctrl_proc;
dword *ctrl_fd;
dword *ctrl_bk;
dword *child_fd;
dword *child_bk;
dword *parend;
dword ctrl_x;
dword ctrl_y;
dword ctrl_sizex;
dword ctrl_sizey;
dword ctrl_ID;
 
byte type;
byte flag;
dword color1;
dword x;
dword y;
float number;
dword format;
}__attribute__((packed));
 
//////////////////////////////Info for Bookmark 1///////////////////////////////
struct InfoForBookmark1
{
byte type;
byte flag;
dword x;
dword y;
dword sizex;
dword sizey;
dword color1;
dword reserved;
dword color2;
 
dword number_lines_bookmarks;
dword number_lines_bookmarks_in_1;
dword number_lines_bookmarks_in_2;
 
dword text_for_1;
dword number_controls_1;
dword type_control_10;
dword info_for_10_control;
 
dword a1,b1;
dword a2,b2;
dword a3,b3;
dword a4,b4;
 
dword a5,b5;
dword a6,b6;
dword a7,b7;
dword a8,b8;
 
dword text_for_2;
dword number_controls_2;
dword type_control_20;
dword info_for_20_control;
 
dword a9,b9;
dword a10,b10;
dword a11,b11;
dword a12,b12;
dword a13,b13;
dword a14,b14;
dword a15,b15;
 
dword a16,b16;
dword a17,b17;
dword a18,b18;
dword a19,b19;
dword a20,b20;
dword a21,b21;
dword a22,b22;
 
dword text_for_3;
dword number_controls_3;
dword type_control_30;
dword info_for_30_control;
 
//filler 256
dword a23,b23;
dword a24,b24;
dword a25,b25;
dword a26,b26;
dword a27,b27;
dword a28,b28;
dword a29,b29;
dword a30,b30;
dword a31,b31;
dword a32,b32;
dword a33,b33;
dword a34,b34;
dword a35,b35;
dword a36,b36;
dword a37,b37;
dword a38,b38;
 
dword a39,b39;
dword a40,b40;
dword a41,b41;
dword a42,b42;
dword a43,b43;
dword a44,b44;
dword a45,b45;
dword a46,b46;
dword a47,b47;
dword a48,b48;
dword a49,b49;
dword a50,b50;
dword a51,b51;
dword a52,b52;
dword a53,b53;
dword a54,b54;
 
dword text_for_4;
dword number_controls_4;
dword type_control_40;
dword info_for_40_control;
 
//filler 64
dword a55,b55;
dword a56,b56;
dword a57,b57;
dword a58,b58;
 
dword a59,b59;
dword a60,b60;
dword a61,b61;
dword a62,b62;
 
dword text_for_5;
dword number_controls_5;
dword type_control_50;
dword info_for_50_control;
 
}__attribute__((packed));
 
struct ControlBookmark1
{
dword ctrl_proc;
dword *ctrl_fd;
dword *ctrl_bk;
dword *child_fd;
dword *child_bk;
dword *parend;
dword ctrl_x;
dword ctrl_y;
dword ctrl_sizex;
dword ctrl_sizey;
dword ctrl_ID;
 
byte type;
byte flag;
dword x;
dword y;
dword sizex;
dword sizey;
dword color1;
dword reserved;
dword color2;
 
dword number_lines_bookmarks;
dword number_lines_bookmarks_in_1;
dword number_lines_bookmarks_in_2;
 
dword text_for_1;
dword number_controls_1;
dword type_control_10;
dword info_for_10_control;
 
//filler 64
dword a1,b1;
dword a2,b2;
dword a3,b3;
dword a4,b4;
 
dword a5,b5;
dword a6,b6;
dword a7,b7;
dword a8,b8;
 
dword text_for_2;
dword number_controls_2;
dword type_control_20;
dword info_for_20_control;
 
//filller 112 bytes
dword a9,b9;
dword a10,b10;
dword a11,b11;
dword a12,b12;
dword a13,b13;
dword a14,b14;
dword a15,b15;
 
dword a16,b16;
dword a17,b17;
dword a18,b18;
dword a19,b19;
dword a20,b20;
dword a21,b21;
dword a22,b22;
 
dword text_for_3;
dword number_controls_3;
dword type_control_30;
dword info_for_30_control;
 
//filler 256
dword a23,b23;
dword a24,b24;
dword a25,b25;
dword a26,b26;
dword a27,b27;
dword a28,b28;
dword a29,b29;
dword a30,b30;
dword a31,b31;
dword a32,b32;
dword a33,b33;
dword a34,b34;
dword a35,b35;
dword a36,b36;
dword a37,b37;
dword a38,b38;
 
dword a39,b39;
dword a40,b40;
dword a41,b41;
dword a42,b42;
dword a43,b43;
dword a44,b44;
dword a45,b45;
dword a46,b46;
dword a47,b47;
dword a48,b48;
dword a49,b49;
dword a50,b50;
dword a51,b51;
dword a52,b52;
dword a53,b53;
dword a54,b54;
 
 
dword text_for_4;
dword number_controls_4;
dword type_control_40;
dword info_for_40_control;
 
//filler 64
dword a55,b55;
dword a56,b56;
dword a57,b57;
dword a58,b58;
 
dword a59,b59;
dword a60,b60;
dword a61,b61;
dword a62,b62;
 
dword text_for_5;
dword number_controls_5;
dword type_control_50;
dword info_for_50_control;
 
}__attribute__((packed));
////////////////////////////////////////////////////////////////////////////////
 
//////////////////////////////Info for Bookmark 2///////////////////////////////
struct InfoForBookmark2
{
byte type;
byte flag;
dword x;
dword y;
dword sizex;
dword sizey;
dword color1;
dword reserved;
dword color2;
 
dword number_lines_bookmarks;
dword number_lines_bookmarks_in_1;
 
dword text_for_1;
dword number_controls_1;
dword type_control_10;
dword info_for_10_control;
dword type_control_11;
dword info_for_11_control;
 
dword text_for_2;
dword number_controls_2;
dword type_control_20;
dword info_for_20_control;
 
//filler 64
dword a1,b1;
dword a2,b2;
dword a3,b3;
dword a4,b4;
 
dword a5,b5;
dword a6,b6;
dword a7,b7;
dword a8,b8;
 
}__attribute__((packed));
 
struct ControlBookmark2
{
dword ctrl_proc;
dword *ctrl_fd;
dword *ctrl_bk;
dword *child_fd;
dword *child_bk;
dword *parend;
dword ctrl_x;
dword ctrl_y;
dword ctrl_sizex;
dword ctrl_sizey;
dword ctrl_ID;
 
byte type;
byte flag;
dword x;
dword y;
dword sizex;
dword sizey;
dword color1;
dword reserved;
dword color2;
 
dword number_lines_bookmarks;
dword number_lines_bookmarks_in_1;
 
dword text_for_1;
dword number_controls_1;
dword type_control_10;
dword info_for_10_control;
dword type_control_11;
dword info_for_11_control;
 
dword text_for_2;
dword number_controls_2;
dword type_control_20;
dword info_for_20_control;
 
//filler 64
dword a1,b1;
dword a2,b2;
dword a3,b3;
dword a4,b4;
 
dword a5,b5;
dword a6,b6;
dword a7,b7;
dword a8,b8;
 
}__attribute__((packed));
////////////////////////////////////////////////////////////////////////////////
 
//
// libGUI functions
//
void stdcall (*DestroyControl)(void *control);
void stdcall (*SendMessage)(struct HEADER *Parend,struct MESSAGE *Message);
int stdcall (*Version)(void);
void stdcall (*ResizeComponent)(void *Control,int new_sizex,int new_sizey);
void stdcall (*RemoveComponent)(void *Control,int new_x,int new_y);
void* stdcall (*CraeteButton)(struct HEADER *Parend,void *Control);
void* stdcall (*CraeteScroller)(struct HEADER *Parend,void *Control);
void* stdcall (*CraeteBookmark)(struct HEADER *Parend,void *Control);
void* stdcall (*CraeteImage)(struct HEADER *Parend,void *Control);
void* stdcall (*CraeteText)(struct HEADER *Parend,void *Control);
void* stdcall (*CraeteNumber)(struct HEADER *Parend,void *Control);
void* stdcall (*CraeteCheckbox)(struct HEADER *Parend,void *Control);
void* stdcall (*CraeteEditbox)(struct HEADER *Parend,void *Control);
void* stdcall (*CraeteProgressbar)(struct HEADER *Parend,void *Control);
 
char* sys_libGUI_path="/sys/lib/libGUI.obj";
 
void link(char *exp){
 
char name_DestroyControl[]={"DestroyControl"};
char name_SendMessage[]={"SendMessage"};
char name_Version[]={"Version"};
char name_ResizeComponent[]={"ResizeComponent"};
char name_RemoveComponent[]={"RemoveComponent"};
char name_CraeteButton[]={"CraeteButton"};
char name_CraeteScroller[]={"CraeteScroller"};
char name_CraeteBookmark[]={"CraeteBookmark"};
char name_CraeteImage[]={"CraeteImage"};
char name_CraeteText[]={"CraeteText"};
char name_CraeteNumber[]={"CraeteNumber"};
char name_CraeteCheckbox[]={"CraeteCheckbox"};
char name_CraeteEditbox[]={"CraeteEditbox"};
char name_CraeteProgressbar[]={"CraeteProgressbar"};
 
DestroyControl=(void stdcall (*)(void *control))
_ksys_cofflib_getproc(exp,name_DestroyControl);
SendMessage=(void stdcall (*)(struct HEADER *Parend,struct MESSAGE *Message))
_ksys_cofflib_getproc(exp,name_SendMessage);
Version=(int stdcall (*)(void))
_ksys_cofflib_getproc(exp,name_Version);
ResizeComponent=(void stdcall(*)(void *Control,int new_sizex,int new_sizey))
_ksys_cofflib_getproc(exp,name_ResizeComponent);
RemoveComponent=(void stdcall(*)(void *Control,int new_x,int new_y))
_ksys_cofflib_getproc(exp,name_RemoveComponent);
CraeteButton=(void* stdcall (*)(struct HEADER *Parend,void *Control))
_ksys_cofflib_getproc(exp,name_CraeteButton);
CraeteScroller=(void* stdcall (*)(struct HEADER *Parend,void *Control))
_ksys_cofflib_getproc(exp,name_CraeteScroller);
CraeteBookmark=(void* stdcall (*)(struct HEADER *Parend,void *Control))
_ksys_cofflib_getproc(exp,name_CraeteBookmark);
CraeteImage=(void* stdcall (*)(struct HEADER *Parend,void *Control))
_ksys_cofflib_getproc(exp,name_CraeteImage);
CraeteText=(void* stdcall (*)(struct HEADER *Parend,void *Control))
_ksys_cofflib_getproc(exp,name_CraeteText);
CraeteNumber=(void* stdcall (*)(struct HEADER *Parend,void *Control))
_ksys_cofflib_getproc(exp,name_CraeteNumber);
CraeteCheckbox=(void* stdcall (*)(struct HEADER *Parend,void *Control))
_ksys_cofflib_getproc(exp,name_CraeteCheckbox);
CraeteEditbox=(void* stdcall (*)(struct HEADER *Parend,void *Control))
_ksys_cofflib_getproc(exp,name_CraeteEditbox);
CraeteProgressbar=(void* stdcall (*)(struct HEADER *Parend,void *Control))
_ksys_cofflib_getproc(exp,name_CraeteProgressbar);
 
}
 
int Init_libGUI(void)
{
char *Export;
 
Export=(char *)_ksys_cofflib_load(sys_libGUI_path);
if (Export==0) return Cannot_load_libGUI;
 
link(Export);
return(0);
}
 
void draw_window(struct WINDOW *win)
{
_ksys_window_redraw(1);
_ksys_draw_window(win->posx,win->posy,win->sizex,win->sizey,0xaabbcc,3,0x5090d0,0,0x5080d0);
_ksys_window_redraw(2);
 
}
 
void CraeteInterface(dword *controls,struct HEADER *Parend,struct WINDOW *win)
{
char *names_of_bookmarks1[]={"SINGLET","DOUBLET","SIXTET","P(H)","OTHER"};
char *names_of_bookmarks2[]={"SPECTRA","INFORMATION"};
 
char *bookmark_singlet_text[]={"Isomer shift","Amplitude","Width","Xi^2"};
char *bookmark_doublet_text[]={"Isomer shift","Quadrupol shift","Amplitude 1",
"Amplitude 2","Width 1","Width 2","Xi^2"};
char *bookmark_sixtet_text[]={"Isomer shift","Quadrupol shift","Feld","Amplitude 1",
"Amplitude 2","Amplitude 3","Amplitude 4","Amplitude 5",
"Amplitude 6","Width 1","Width 2","Width 3","Width 4","Width 5",
"Width 6","Xi^2"};
char *bookmark_P_text[]={"K","Maximum feld H","Amplitude","Xi^2"};
char *bookmark_information_text[]={"Channels","Null channel","mm/s","Basis(impulses)"};
 
char button_crate_text[]={"Craete"};
char button_autocolibrovka_text[]={"Auto colibrovka"};
char button_combine_spectras_text[]={"To combine spectras"};
 
struct ControlButton *ButtonCraete;
struct InfoForButton *InfoButtonCraete;
struct ControlButton *ButtonAutoColibrovka;
struct InfoForButton *InfoButtonAutoColibrovka;
struct ControlButton *ButtonCombineSpectras;
struct InfoForButton *InfoButtonCombineSpectras;
 
struct InfoForImage *InfoImage;
struct ControlImage *Image;
struct InfoForText *InfoText;
struct ControlText *Text;
struct InfoForNumber *InfoNumber;
struct ControlNumber *Number;
struct ControlProgressbar *Progressbar1;
struct InfoForProgressbar *InfoProgressbar1;
struct ControlBookmark1 *Bookmark1;
struct InfoForBookmark1 *InfoBookmark1;
struct ControlBookmark2 *Bookmark2;
struct InfoForBookmark2 *InfoBookmark2;
 
dword *ptr,*ptr2;
int skin_height;
int i;
int x,y;
dword textcolor;
 
InfoButtonCraete=malloc(sizeof(InfoButtonCraete));
InfoButtonAutoColibrovka=malloc(sizeof(InfoButtonAutoColibrovka));
InfoButtonCombineSpectras=malloc(sizeof(InfoButtonCombineSpectras));
InfoImage=malloc(sizeof(InfoImage));
InfoText=malloc(sizeof(InfoText));
InfoNumber=malloc(sizeof(InfoNumber));
InfoProgressbar1=malloc(sizeof(InfoProgressbar1));
 
InfoBookmark1=malloc(sizeof(InfoBookmark1));
InfoBookmark2=malloc(sizeof(InfoBookmark2));
 
skin_height=_ksys_get_skin_height();
 
InfoButtonCraete->type=0x91;//10010001b
InfoButtonCraete->flag=0;
InfoButtonCraete->x=10;
InfoButtonCraete->y=10;
InfoButtonCraete->width=FONT_SIZEX*sizeof(button_crate_text)+10;
InfoButtonCraete->height=20;
InfoButtonCraete->text=(dword)button_crate_text;
InfoButtonCraete->textcolor=0;
InfoButtonCraete->color1=0xaabbcc;
 
InfoButtonAutoColibrovka->type=0x91;//10010001b
InfoButtonAutoColibrovka->flag=0;
InfoButtonAutoColibrovka->x=10;
InfoButtonAutoColibrovka->y=30;
InfoButtonAutoColibrovka->width=FONT_SIZEX*sizeof(button_autocolibrovka_text)+10;
InfoButtonAutoColibrovka->height=20;
InfoButtonAutoColibrovka->text=(dword)button_autocolibrovka_text;
InfoButtonAutoColibrovka->textcolor=0;
InfoButtonAutoColibrovka->color1=0xaabbcc;
 
InfoButtonCombineSpectras->type=0x91;//10010001b
InfoButtonCombineSpectras->flag=0;
InfoButtonCombineSpectras->x=10;
InfoButtonCombineSpectras->y=10;
InfoButtonCombineSpectras->width=FONT_SIZEX*sizeof(button_combine_spectras_text)+10;
InfoButtonCombineSpectras->height=20;
InfoButtonCombineSpectras->text=(dword)button_combine_spectras_text;
InfoButtonCombineSpectras->textcolor=0;
InfoButtonCombineSpectras->color1=0xaabbcc;
//prepea text for bookmark SINGLET
textcolor=0xffffff;
x=10;
y=40;
ptr=58+(dword)InfoBookmark1;
ptr2=58+32+(dword)InfoBookmark1;
for(i=0;i<4;i++)
{
InfoText[i].type=0x80;
InfoText[i].flag=0;
InfoText[i].x=x;
InfoText[i].y=y;
InfoText[i].color1=textcolor;
InfoText[i].text=bookmark_singlet_text[i];
InfoText[i].length=strlen(bookmark_singlet_text[i]);
 
InfoNumber[i].type=0x82;
InfoNumber[i].flag=0;
InfoNumber[i].x=x+DISTANCE1;
InfoNumber[i].y=y;
InfoNumber[i].color1=textcolor;
InfoNumber[i].number=-0.1234567;
InfoNumber[i].format=10*65536+7;
 
*ptr=(dword)5;
ptr++;
*ptr=(dword)&InfoText[i];
ptr++;
 
*ptr2=(dword)6;
ptr2++;
*ptr2=(dword)&InfoNumber[i];
ptr2++;
 
y=y+12;
}
//prepea text for bookmark DOUBLET
y=40;
ptr=58+64+16+(dword)InfoBookmark1;
ptr2=58+64+16+56+(dword)InfoBookmark1;
for(i=4;i<4+7;i++)
{
InfoText[i].type=0x80;
InfoText[i].flag=0;
InfoText[i].x=x;
InfoText[i].y=y;
InfoText[i].color1=textcolor;
InfoText[i].text=bookmark_doublet_text[i-4];
InfoText[i].length=strlen(bookmark_doublet_text[i-4]);
 
InfoNumber[i].type=0x82;
InfoNumber[i].flag=0;
InfoNumber[i].x=x+DISTANCE1;
InfoNumber[i].y=y;
InfoNumber[i].color1=textcolor;
InfoNumber[i].number=-0.1234567;
InfoNumber[i].format=10*65536+7;
 
*ptr=(dword)5;
ptr++;
*ptr=(dword)&InfoText[i];
ptr++;
 
*ptr2=(dword)6;
ptr2++;
*ptr2=(dword)&InfoNumber[i];
ptr2++;
y=y+12;
}
//prepea text for bookmark SIXTET
y=40;
ptr=58+64+16+112+16+(dword)InfoBookmark1;
ptr2=58+64+16+112+16+128+(dword)InfoBookmark1;
for(i=4+7;i<4+7+16;i++)
{
InfoText[i].type=0x80;
InfoText[i].flag=0;
InfoText[i].x=x;
InfoText[i].y=y;
InfoText[i].color1=textcolor;
InfoText[i].text=bookmark_sixtet_text[i-(4+7)];
InfoText[i].length=strlen(bookmark_sixtet_text[i-(4+7)]);
 
InfoNumber[i].type=0x82;
InfoNumber[i].flag=0;
InfoNumber[i].x=x+DISTANCE1;
InfoNumber[i].y=y;
InfoNumber[i].color1=textcolor;
InfoNumber[i].number=-0.1234567;
InfoNumber[i].format=10*65536+7;
 
*ptr=(dword)5;
ptr++;
*ptr=(dword)&InfoText[i];
ptr++;
 
*ptr2=(dword)6;
ptr2++;
*ptr2=(dword)&InfoNumber[i];
ptr2++;
y=y+12;
}
//prepea text for bookmark P(H)
y=40;
ptr=58+64+16+112+16+256+16+(dword)InfoBookmark1;
ptr2=58+64+16+112+16+256+16+32+(dword)InfoBookmark1;
for(i=4+7+16;i<4+7+16+4;i++)
{
InfoText[i].type=0x80;
InfoText[i].flag=0;
InfoText[i].x=x;
InfoText[i].y=y;
InfoText[i].color1=textcolor;
InfoText[i].text=bookmark_P_text[i-(4+7+16)];
InfoText[i].length=strlen(bookmark_P_text[i-(4+7+16)]);
 
InfoNumber[i].type=0x82;
InfoNumber[i].flag=0;
InfoNumber[i].x=x+DISTANCE1;
InfoNumber[i].y=y;
InfoNumber[i].color1=textcolor;
InfoNumber[i].number=-0.1234567;
InfoNumber[i].format=10*65536+7;
 
*ptr=(dword)5;
ptr++;
*ptr=(dword)&InfoText[i];
ptr++;
 
*ptr2=(dword)6;
ptr2++;
*ptr2=(dword)&InfoNumber[i];
ptr2++;
y=y+12;
}
 
//prepea text for bookmark INFORMATION
textcolor=0xffffff;
x=10;
y=40;
ptr=78+(dword)InfoBookmark2;
ptr2=78+32+(dword)InfoBookmark2;
for(i=4+7+16+4;i<4+7+16+4+4;i++)
{
InfoText[i].type=0x80;
InfoText[i].flag=0;
InfoText[i].x=x;
InfoText[i].y=y;
InfoText[i].color1=textcolor;
InfoText[i].text=bookmark_information_text[i-(4+7+16+4)];
InfoText[i].length=strlen(bookmark_information_text[i-(4+7+16+4)]);
 
InfoNumber[i].type=0x82;
InfoNumber[i].flag=0;
InfoNumber[i].x=x+DISTANCE1;
InfoNumber[i].y=y;
InfoNumber[i].color1=textcolor;
InfoNumber[i].number=-0.1234567;
InfoNumber[i].format=10*65536+7;
 
*ptr=(dword)5;
ptr++;
*ptr=(dword)&InfoText[i];
ptr++;
 
*ptr2=(dword)6;
ptr2++;
*ptr2=(dword)&InfoNumber[i];
ptr2++;
 
y=y+12;
}
 
//-------------------Init bookmark 1--------------------------------
InfoBookmark1->type=0x81; //10000001b
InfoBookmark1->x=BOOKMARK1_POSX;
InfoBookmark1->y=BOOKMARK1_POSY;
InfoBookmark1->sizex=BOOKMARK1_SIZEX;
InfoBookmark1->sizey=win->sizey-InfoBookmark1->y-skin_height-5;
InfoBookmark1->color1=0xaabbcc;
InfoBookmark1->color2=0xffffff;
InfoBookmark1->number_lines_bookmarks=2;
InfoBookmark1->number_lines_bookmarks_in_1=3;
InfoBookmark1->number_lines_bookmarks_in_2=2;
 
//bookmark singlet
InfoBookmark1->text_for_1=(dword)names_of_bookmarks1[0];
InfoBookmark1->number_controls_1=1+4+4;
InfoBookmark1->type_control_10=1;
InfoBookmark1->info_for_10_control=(dword)InfoButtonCraete;
 
//bookmark doublet
InfoBookmark1->text_for_2=(dword)names_of_bookmarks1[1];
InfoBookmark1->number_controls_2=1+7+7;
InfoBookmark1->type_control_20=1;
InfoBookmark1->info_for_20_control=(dword)InfoButtonCraete;
//bookmark sixtet
InfoBookmark1->text_for_3=(dword)names_of_bookmarks1[2];
InfoBookmark1->number_controls_3=1+16+16;
InfoBookmark1->type_control_30=1;
InfoBookmark1->info_for_30_control=(dword)InfoButtonCraete;
 
//bookmark P(H)
InfoBookmark1->text_for_4=(dword)names_of_bookmarks1[3];
InfoBookmark1->number_controls_4=1+4+4;
InfoBookmark1->type_control_40=1;
InfoBookmark1->info_for_40_control=(dword)InfoButtonCraete;
 
//bookmark OTHER
InfoBookmark1->text_for_5=(dword)names_of_bookmarks1[4];
InfoBookmark1->number_controls_5=1;
InfoBookmark1->type_control_50=1;
InfoBookmark1->info_for_50_control=(dword)InfoButtonCombineSpectras;
 
//-----------------------Init bookmark 2--------------------------------
InfoBookmark2->type=0x81; //10000001b
InfoBookmark2->x=BOOKMARK2_POSX;
InfoBookmark2->y=BOOKMARK2_POSY;
InfoBookmark2->sizex=win->sizex-InfoBookmark2->x-10;
InfoBookmark2->sizey=win->sizey-InfoBookmark2->y-skin_height-5;
InfoBookmark2->color1=0xaabbcc;
InfoBookmark2->color2=0xffffff;
InfoBookmark2->number_lines_bookmarks=1;
InfoBookmark2->number_lines_bookmarks_in_1=2;
 
//bookmark SPECTRA
InfoBookmark2->text_for_1=(dword)names_of_bookmarks2[0];
InfoBookmark2->number_controls_1=2;
InfoBookmark2->type_control_10=4;
InfoBookmark2->info_for_10_control=(dword)InfoImage;
InfoBookmark2->type_control_11=9;
InfoBookmark2->info_for_11_control=(dword)InfoProgressbar1;
 
//bookmark INFORMATION
InfoBookmark2->text_for_2=(dword)names_of_bookmarks2[1];
InfoBookmark2->number_controls_2=1+4+4;
InfoBookmark2->type_control_20=1;
InfoBookmark2->info_for_20_control=(dword)InfoButtonCraete;
InfoImage->type=0x80;//10000000b
InfoImage->flag=0;
InfoImage->x=10;
InfoImage->y=10;
InfoImage->sizex=InfoBookmark2->sizex-20;
InfoImage->sizey=InfoBookmark2->sizey-44-16;
InfoImage->pointer=(dword)malloc(SCREEN_SIZEX*SCREEN_SIZEY*3);
 
InfoProgressbar1->type=0x81;//10000001b;
InfoProgressbar1->flag=0;
InfoProgressbar1->color1=0xffffff;
InfoProgressbar1->color2=0xff0000;
InfoProgressbar1->x=10;
InfoProgressbar1->y=InfoBookmark2->sizey-16-26;
InfoProgressbar1->sizex=InfoBookmark2->sizex-20;
InfoProgressbar1->sizey=16;
InfoProgressbar1->progress=0.1;
InfoProgressbar1->color3=0xaabbcc;
 
Bookmark1=CraeteBookmark(Parend,InfoBookmark1);
Bookmark2=CraeteBookmark(Parend,InfoBookmark2);
ButtonAutoColibrovka=CraeteButton(Parend,InfoButtonAutoColibrovka);
 
controls[0]=(dword)Bookmark1;
controls[1]=(dword)Bookmark2;
controls[2]=(dword)ButtonAutoColibrovka;
controls[3]=(dword)InfoImage->pointer;
 
//copy child controls of bookmark1 to the array
//It's proved simple way for acces to the child controls of bookmark1.
ptr2=44+58+32+4+(dword)Bookmark1;
for(i=CONTROLS_NUMBER_POS;i<CONTROLS_NUMBER_POS+4;i++)
{
controls[i]=*ptr2;
ptr2=ptr2+2;
}
ptr2=44+58+64+16+56+4+(dword)Bookmark1;
for(i=CONTROLS_NUMBER_POS+4;i<CONTROLS_NUMBER_POS+4+7;i++)
{
controls[i]=*ptr2;
ptr2=ptr2+2;
}
ptr2=44+58+64+16+112+16+128+4+(dword)Bookmark1;
for(i=CONTROLS_NUMBER_POS+4+7;i<CONTROLS_NUMBER_POS+4+7+16;i++)
{
controls[i]=*ptr2;
ptr2=ptr2+2;
}
ptr2=44+58+64+16+112+16+256+16+32+4+(dword)Bookmark1;
for(i=CONTROLS_NUMBER_POS+4+7+16;i<CONTROLS_NUMBER_POS+4+7+16+4;i++)
{
controls[i]=*ptr2;
ptr2=ptr2+2;
}
ptr2=44+78+32+4+(dword)Bookmark2;
for(i=CONTROLS_NUMBER_POS+4+7+16+4;i<CONTROLS_NUMBER_POS+4+7+16+4+4;i++)
{
controls[i]=*ptr2;
ptr2=ptr2+2;
}
 
free(InfoButtonCraete);
free(InfoButtonAutoColibrovka);
free(InfoButtonCombineSpectras);
free(InfoBookmark1);
free(InfoBookmark2);
free(InfoImage);
free(InfoText);
free(InfoProgressbar1);
 
}
 
int main(int argc, char **argv)
{
char exit_status;
struct WINDOW *win;
struct HEADER *Parend;
struct MESSAGE *Message;
struct ControlProgressbar *Progressbar1;
struct InfoForProgressbar *InfoProgressbar1;
struct ControlBookmark1 *Bookmark1;
struct ControlBookmark2 *Bookmark2;
struct ControlImage *Image;
struct process_table_entry *ProcessInformation;
 
dword *controls;
int new_sizex1;
int new_sizey1;
int new_sizex2;
int new_sizey2;
int new_sizex3;
int new_sizey3;
int new_sizex4;
int new_sizey4;
int new_x;
int new_y;
 
int skin_height;
dword x,y,mouse_buttons;
float p;
 
 
_ksys_set_wanted_events(0x67);
 
Init_libGUI();
 
win=malloc(16);
win->posx=WINDOW_POSX;
win->posy=WINDOW_POSY;
win->sizex=WINDOW_SIZEX;
win->sizey=WINDOW_SIZEY;
 
draw_window(win);
 
controls=malloc(TOTAL_NUMBERS_OF_CONTROLS*100);
Parend=(struct HEADER *)malloc(ParendSize);
Message=(struct MESSAGE *)malloc(MessageSize);
ProcessInformation=malloc(sizeof(ProcessInformation));
 
CraeteInterface(controls,Parend,win);
 
Message->type=1;
Message->arg1=0;
Message->arg2=0;
Message->arg3=0;
 
SendMessage(Parend,Message);
 
exit_status=0;
while(exit_status!=1)
{
switch(_ksys_wait_for_event(2))
{
case 1:
{
_ksys_get_process_table(ProcessInformation,-1);
win->sizex=ProcessInformation->winx_size;
win->sizey=ProcessInformation->winy_size;
 
draw_window(win);
skin_height=_ksys_get_skin_height();
Bookmark1=controls[0];
Bookmark2=controls[1];
new_sizex1=Bookmark1->sizex;
new_sizey1=win->sizey-Bookmark1->y-skin_height-5;
new_sizex2=win->sizex-Bookmark2->x-10;
new_sizey2=win->sizey-Bookmark2->y-skin_height-5;
Image=Bookmark2->info_for_10_control;
new_sizex3=new_sizex2-20;
new_sizey3=new_sizey2-44-16;
Progressbar1=Bookmark2->info_for_11_control;
new_sizex4=new_sizex2-20;
new_sizey4=16;
new_x=Bookmark2->x+10;
new_y=Bookmark2->y+new_sizey2;
RemoveComponent(Progressbar1,new_x,new_y);
ResizeComponent(Bookmark1,new_sizex1,new_sizey1);
ResizeComponent(Image,new_sizex3,new_sizey3);
ResizeComponent(Progressbar1,new_sizex4,new_sizey4);
ResizeComponent(Bookmark2,new_sizex2,new_sizey2);
Message->type=1;
SendMessage(Parend,Message);
break;
}
 
case 2:
{
exit_status=1;
break;
}
 
case 3: {
if (_ksys_get_button_id()==1) {exit_status=1;}
break;
}
 
case 6:
{
mouse_buttons=_ksys_GetMouseButtonsState();
x=_ksys_GetMouseXY();
y=x & 0xffff;
x=x >> 16;
Message->type=6;
Message->arg1=x;
Message->arg2=y;
Message->arg3=mouse_buttons;
SendMessage(Parend,Message);
 
break;
}
 
default: break;
 
}
}
}
/programs/develop/libGUI/examples/C example/kolibri.ld
0,0 → 1,18
/*OUTPUT_FORMAT("binary")*/
ENTRY("start_")
SECTIONS
{
.text 0x000000:
{
*(.text)
}
.data : {
*(.data)
}
.bss :
{
*(.bss)
}
}
/programs/develop/libGUI/examples/C example/makefile2
0,0 → 1,22
OUTFILE = interface.kex
INPUT = interface.c
OUTPUT = interface.o
OBJS = start.o interface.o
 
 
.SUFFIXES: .asm .o
 
$(OUTFILE) : $(OBJS)
fasm start.asm start.o
gcc -c $(INPUT) -nostdinc -I/home/andrew/kolibri/develop/include/
ld -nostdlib -T kolibri.ld -n -L/home/andrew/kolibri/develop/lib/ -o $(OUTFILE) $(OBJS) -lck -lm
objcopy $(OUTFILE) -O binary
 
.asm.o:
fasm $*.asm
 
.c.o:
gcc -c $*.c
 
clean :
del *.o
/programs/develop/libGUI/examples/C example/start.asm
0,0 → 1,136
format MS COFF
section '.text' executable
public start_
;extrn mf_init
extrn main
;include 'debug2.inc'
__DEBUG__=0
 
start_:
;virtual at 0
db 'MENUET01' ; 1. Magic number (8 bytes)
dd 0x01 ; 2. Version of executable file
dd start ; 3. Start address
dd 0x0 ; 4. Size of image
dd 0x100000 ; 5. Size of needed memory
dd 0x100000 ; 6. Pointer to stack
hparams dd 0x0 ; 7. Pointer to program arguments
hpath dd 0x0 ; 8. Pointer to program path
;end virtual
 
start:
;DEBUGF 'Start programm\n'
;init heap of memory
mov eax,68
mov ebx,11
int 0x40
 
;DEBUGF ' path "%s"\n params "%s"\n', .path, .params
; check for overflow
mov al, [path+buf_len-1]
or al, [params+buf_len-1]
jnz .crash
; check if path written by OS
mov eax, [hparams]
test eax, eax
jz .without_path
mov eax, path
.without_path:
mov esi, eax
call push_param
; retrieving parameters
mov esi, params
xor edx, edx ; dl - èä¸ò ïàðàìåòð(1) èëè ðàçäåëèòåëè(0)
; dh - ñèìâîë ñ êîòîðîãî íà÷àëñÿ ïàðàìåòð (1 êàâû÷êè, 0 îñòàëüíîå)
mov ecx, 1 ; cl = 1
; ch = 0 ïðîñòî íîëü
.parse:
lodsb
test al, al
jz .run
test dl, dl
jnz .findendparam
;{åñëè áûë ðàçäåëèòåëü
cmp al, ' '
jz .parse ;çàãðóæåí ïðîáåë, ãðóçèì ñëåäóþùèé ñèìâîë
mov dl, cl ;íà÷èíàåòñÿ ïàðàìåòð
cmp al, '"'
jz @f ;çàãðóæåíû êàâû÷êè
mov dh, ch ;ïàðàìåòð áåç êàâû÷åê
dec esi
call push_param
inc esi
jmp .parse
 
@@:
mov dh, cl ;ïàðàìåòð â êàâû÷åêàõ
call push_param ;åñëè íå ïðîáåë çíà÷èò íà÷èíàåòñÿ êàêîé òî ïàðàìåòð
jmp .parse ;åñëè áûë ðàçäåëèòåëü}
 
.findendparam:
test dh, dh
jz @f ; áåç êàâû÷åê
cmp al, '"'
jz .clear
jmp .parse
@@:
cmp al, ' '
jnz .parse
 
.clear:
lea ebx, [esi - 1]
mov [ebx], ch
mov dl, ch
jmp .parse
 
.run:
;DEBUGF 'call main(%x, %x) with params:\n', [argc], argv
if __DEBUG__ = 1
mov ecx, [argc]
@@:
lea esi, [ecx * 4 + argv-4]
DEBUGF '0x%x) "%s"\n', cx, [esi]
loop @b
end if
push [argc]
push argv
call main
.exit:
;DEBUGF 'Exit from prog\n';
xor eax,eax
dec eax
int 0x40
dd -1
.crash:
;DEBUGF 'E:buffer overflowed\n'
jmp .exit
;============================
push_param:
;============================
;parameters
; esi - pointer
;description
; procedure increase argc
; and add pointer to array argv
; procedure changes ebx
mov ebx, [argc]
cmp ebx, max_parameters
jae .dont_add
mov [argv+4*ebx], esi
inc [argc]
.dont_add:
ret
;==============================
public params as '__argv'
public path as '__path'
 
section '.bss'
buf_len = 0x400
max_parameters=0x20
argc rd 1
argv rd max_parameters
path rb buf_len
params rb buf_len
 
;section '.data'
;include_debug_strings ; ALWAYS present in data section
/programs/develop/libGUI/examples/bookmarks/GETPROC.ASM
0,0 → 1,47
 
_ksys_cofflib_getproc:
 
mov ebx,[esp+4]
 
next_name_check:
 
mov ecx,[ebx]
test ecx,ecx
jz end_export
 
;cmp export string with name
mov esi,[esp+8]
xor edi,edi
next_simbol_check:
 
xor eax,eax
mov al,[ecx]
test al,al
jz exit_check_simbol
 
xor edx,edx
mov dl,[esi]
cmp al,dl
je simbols_equvalent
add edi,1
jmp exit_check_simbol
simbols_equvalent:
 
add ecx,1
add esi,1
jmp next_simbol_check
exit_check_simbol:
 
test edi,edi
jnz function_not_finded
mov eax,[ebx+4]
jmp end_export
function_not_finded:
 
add ebx,8
 
jmp next_name_check
 
end_export:
 
ret 8
/programs/develop/libGUI/examples/bookmarks/bookmark.asm
0,0 → 1,800
;
;
; This is example using GUI component Bookmark from libGUI.
;
;
 
include 'macros.inc'
use32
db 'MENUET01'
dd 1
dd start
dd i_end
dd 126*1024
dd 126*1024
dd 0
dd path
 
start:
;init hepe of memory
mcall 68,11
 
;set current dir as ./
call GetPath
 
;load dll
mcall 68,19,path
 
test eax,eax
jnz libGUI_loaded
 
mcall 68,19,sys_libGUI_path
 
test eax,eax
jnz libGUI_loaded
 
mcall -1
 
libGUI_loaded:
 
mov [myexport],eax
 
;load dll functions
 
push fnDestroyControl
push [myexport]
call _ksys_cofflib_getproc
mov [destroy_control],eax
 
push fnSendMessage
push [myexport]
call _ksys_cofflib_getproc
mov [send_message],eax
 
push fnResizeComponent
push [myexport]
call _ksys_cofflib_getproc
mov [resize_component],eax
 
push fnRemoveComponent
push [myexport]
call _ksys_cofflib_getproc
mov [remove_component],eax
 
push fnCraeteButton
push [myexport]
call _ksys_cofflib_getproc
mov [craete_button],eax
 
push fnCraeteScroller
push [myexport]
call _ksys_cofflib_getproc
mov [craete_scroller],eax
 
push fnCraeteBookmark
push [myexport]
call _ksys_cofflib_getproc
mov [craete_bookmark],eax
 
push fnCraeteImage
push [myexport]
call _ksys_cofflib_getproc
mov [craete_image],eax
 
push fnCraeteText
push [myexport]
call _ksys_cofflib_getproc
mov [craete_text],eax
 
push fnCraeteNumber
push [myexport]
call _ksys_cofflib_getproc
mov [craete_number],eax
 
push fnCraeteCheckbox
push [myexport]
call _ksys_cofflib_getproc
mov [craete_check_box],eax
 
push fnCraeteEditbox
push [myexport]
call _ksys_cofflib_getproc
mov [craete_edit_box],eax
 
;set events mask
mcall 40,1100111b
 
;get standart colors table
mcall 48,3,ColorsTable,40
 
;*********************************************
;****************Init Butttons****************
;*********************************************
 
mov ecx,[ColorsTable+8]
and ecx,0xffffff
 
mov [Button1.type],byte 10010001b
mov [Button1.x],120
mov [Button1.y],120
mov [Button1.width],word 70
mov [Button1.height],word 20
mov [Button1.color1],dword ecx
mov [Button1.color2],dword 0xffffff
mov [Button1.text],text1
 
 
 
mov [Button3.type],byte 10010001b
mov [Button3.x],165
mov [Button3.y],320
mov [Button3.width],word 70
mov [Button3.height],word 20
mov [Button3.color1],dword ecx
mov [Button3.color2],dword 0xffffff
mov [Button3.text],text3
 
 
push Button3
push Parend
call [craete_button]
mov [PointerToControlForButtonExit],eax
 
mov ecx,[ColorsTable+8]
and ecx,0xffffff
 
;********************************************
;***************Init scrollers****************
;********************************************
 
;init vertical scroller
mov ecx,[ColorsTable+8]
mov [VerticalScroller.type],byte 11110001b
mov [VerticalScroller.x],150
mov [VerticalScroller.y],10
mov [VerticalScroller.pos],0.2
mov [VerticalScroller.length],200
mov [VerticalScroller.size],0.3
mov [VerticalScroller.color1],ecx
 
;********************************************
;******************Init Image****************
;********************************************
 
mov [Image.type],byte 10000000b
mov [Image.x],30
mov [Image.y],10
mov [Image.sizex],200
mov [Image.sizey],200
mov [Image.pointer],Picture
 
;********************************************
;******************Init Text*****************
;********************************************
 
mov [Text.type],byte 10000000b
mov [Text.color],0xffffff
mov [Text.x],100
mov [Text.y],100
mov [Text.length],25
mov [Text.pointer],text_for_text
 
;********************************************
;*****************Init Number****************
;********************************************
 
mov [Number.type],byte 10000010b
mov [Number.color],0xffffff
mov [Number.x],150
mov [Number.y],100
mov [Number.parameters],5*65536+4
mov [Number.number],-1234.5678
 
;********************************************
;***************Init CheckBox****************
;********************************************
 
mov ecx,[ColorsTable+8]
and ecx,0xffffff
 
;mov [CheckBox.ch_flags],word 10b
mov [CheckBox.ch_left],150
mov [CheckBox.ch_top],330
mov [CheckBox.ch_text_margin],4
mov [CheckBox.ch_size],11
mov [CheckBox.ch_color],0xffffff
mov [CheckBox.ch_border_color],ecx
mov [CheckBox.ch_text_color],0
mov [CheckBox.ch_text_ptr],check_box_text
mov [CheckBox.ch_text_length],9
 
;********************************************
;***************Init EditBox*****************
;********************************************
 
mov ecx,[ColorsTable+8]
mov [EditBox.ed_flags],0b;1000000000000000b
mov [EditBox.ed_left],100 ;x
mov [EditBox.ed_top],100 ;y
mov [EditBox.ed_width],150
mov [EditBox.ed_height],14
mov [EditBox.ed_max],100
mov [EditBox.ed_text],buffer_for_text
mov [EditBox.ed_color],dword 0xffffff
mov [EditBox.shift_color],dword 0xaabbcc
mov [EditBox.ed_focus_border_color],0
mov [EditBox.ed_blur_border_color],ecx
mov [EditBox.ed_text_color],0
 
 
 
;********************************************
;***************Init bookmark****************
;********************************************
 
 
;init bookmark
mov ecx,[ColorsTable+8]
mov [Bookmark.type],byte 10000001b
mov [Bookmark.x],10
mov [Bookmark.y],10
mov [Bookmark.sizex],350
mov [Bookmark.sizey],270
mov [Bookmark.color_1],dword ecx
mov [Bookmark.color2],dword 0xffffff
 
mov [Bookmark.number_bookmarks],3
mov [Bookmark.number_zak_in_1],2
mov [Bookmark.number_zak_in_2],3
mov [Bookmark.number_zak_in_3],1
 
mov [Bookmark.text_for_1],text4
mov [Bookmark.number_contrl_1],1
mov [Bookmark.type_control_1],1
mov [Bookmark.info_1_control],dword Button1
 
mov [Bookmark.text_for_2],text5
mov [Bookmark.number_contrl_2],1
mov [Bookmark.type_control_2],6
mov [Bookmark.info_2_control],dword Number
 
mov [Bookmark.text_for_3],text6
mov [Bookmark.number_contrl_3],1
mov [Bookmark.type_control_3],8
mov [Bookmark.info_3_control],dword EditBox
 
mov [Bookmark.text_for_4],text7
mov [Bookmark.number_contrl_4],1
mov [Bookmark.type_control_4],4
mov [Bookmark.info_4_control],dword Image
 
mov [Bookmark.text_for_5],text8
mov [Bookmark.number_contrl_5],1
mov [Bookmark.type_control_5],2
mov [Bookmark.info_5_control],dword VerticalScroller
 
mov [Bookmark.text_for_6],text9
mov [Bookmark.number_contrl_6],1
mov [Bookmark.type_control_6],5
mov [Bookmark.info_6_control],dword Text
 
 
push Bookmark
push Parend
call [craete_bookmark]
mov [PointerToControlForBookmark],eax
 
call draw_window
 
;*****************************************************
;**********Example of resize component****************
;*****************************************************
mov ebx,[PointerToControlForButtonExit]
push 30;270
push 150;250
push ebx
call [resize_component]
 
;*****************************************************
;**********Example of remove component****************
;*****************************************************
mov ebx,[PointerToControlForButtonExit]
push 340;270
push 120;250
push ebx
call [remove_component]
 
;send message 1 for redrawing ALL controls
mov [Message],dword 1
 
push Message
push Parend
call [send_message]
 
 
still:
mcall 10
 
;check for redraw window
cmp eax,1
jne no_window
 
call draw_window
 
mov eax,[PointerToControlForBookmark]
mov ebx,[Window_SizeX]
mov ecx,[Window_SizeY]
sub ebx,50
sub ecx,130
;or [eax+44],byte 1000000b
mov [eax+32],ebx
mov [eax+36],ecx
 
mov [Message],dword 1
push Message
push Parend
call [send_message]
 
jmp still
no_window:
 
;check for keys events
cmp eax,2
jne no_keys
 
mcall 2
shr eax,8
 
mov [Message],dword 2
mov [Message+4],eax
 
push Message
push Parend
call [send_message]
 
mov eax,[Message+4]
 
cmp al,27
je exit
 
jmp still
no_keys:
 
;check for pressed butons
cmp eax,3
jne no_buttons
 
mcall 17
shr eax,8
 
jmp still
no_buttons:
 
;check for mouse events
cmp eax,6
jne no_mouse
 
mov [Message],dword 6
 
mcall 37,1
mov ebx,eax
shr eax,16 ;x
and ebx,0xffff ;y
 
mov [Message+4],eax
mov [Message+8],ebx
 
mcall 37,2
mov [Message+12],eax
 
;send system events to control
push Message
push Parend
call [send_message]
 
mov eax,[PointerToControlForButtonExit]
 
xor ebx,ebx
mov bl,byte[eax+45]
cmp bl,11b
jne no_crossing_pressing_button
 
mov [button_pressed],1
 
no_crossing_pressing_button:
 
xor ebx,ebx
mov bl,byte[eax+45]
cmp bl,1b
jne no_crossing_button
 
cmp [button_pressed],1
jne no_crossing_button
 
jmp exit
 
no_crossing_button:
 
jmp still
no_mouse:
 
jmp still
 
exit:
 
push [PointerToControlForButtonExit]
call [destroy_control]
 
push [PointerToControlForBookmark]
call [destroy_control]
 
mcall -1
 
 
 
;**********************************************
;*******************Draw window****************
;**********************************************
 
draw_window:
mcall 9,IPC_table,-1
mcall 12,1
 
mov eax,[IPC_table+34]
mov ebx,[IPC_table+38]
mov ecx,[IPC_table+42]
mov edx,[IPC_table+46]
mov [Window_CordinatX],eax
mov [Window_CordinatY],ebx
mov [Window_SizeX],ecx
mov [Window_SizeY],edx
 
cmp [Window_SizeX],400
jae no_minimum_size_x
 
mov [Window_SizeX],400
mov ecx,[Window_SizeX]
 
no_minimum_size_x:
 
cmp [Window_SizeY],400
jae no_minimum_size_y
 
mov [Window_SizeY],400
mov edx,[Window_SizeY]
 
no_minimum_size_y:
 
xor eax,eax
mov ebx,[Window_CordinatX]
mov ecx,[Window_CordinatY]
shl ebx,16
shl ecx,16
add ebx,[Window_SizeX]
add ecx,[Window_SizeY]
mov edx,0x03aabbcc
mov esi,0x805080d0
mov edi,0x005080d0
mcall
 
;call print_controls_information
 
mcall 12,2
ret
 
 
GetPath:
 
mov ebx,255
mov ecx,path
 
next_symvol:
mov edx,ecx
add edx,ebx
 
xor eax,eax
mov al,[edx]
cmp eax,'/'
je exit_path
 
dec ebx
jnz next_symvol
 
exit_path:
 
inc edx
mov esi,dll_name
mov edi,edx
mov ecx,10
rep movsb
 
ret
 
 
include 'getproc.asm'
 
;************************************************************
;***************************DATA*****************************
;************************************************************
 
align 4
 
dll_name db 'libGUI.obj',0
sys_libGUI_path db '/sys/lib/libGUI.obj',0
 
check_box_text db 'Check box',0
 
text1 db 'text',0
text3 db 'Exit',0
 
text4 db 'Bookmark_1',0
text5 db 'Bookmark_2',0
text6 db 'Bookmark_3',0
text7 db 'Bookmark_4',0
 
text8 db 'Bookmark_5',0
text9 db 'Bookmark_6',0
 
text_for_text db 'Hello world from bookmark',0
 
fnDestroyControl db 'DestroyControl',0
fnSendMessage db 'SendMessage',0
fnResizeComponent db 'ResizeComponent',0
fnRemoveComponent db 'RemoveComponent',0
fnCraeteButton db 'CraeteButton',0
fnCraeteScroller db 'CraeteScroller',0
fnCraeteBookmark db 'CraeteBookmark',0
fnCraeteImage db 'CraeteImage',0
fnCraeteText db 'CraeteText',0
fnCraeteNumber db 'CraeteNumber',0
fnCraeteCheckbox db 'CraeteCheckbox',0
fnCraeteEditbox db 'CraeteEditbox',0
fnCraeteProgressbar db 'CraeteProgressbar',0
 
myexport dd 0
 
destroy_control dd 0
send_message dd 0
resize_component dd 0
remove_component dd 0
craete_button dd 0
craete_scroller dd 0
craete_bookmark dd 0
craete_image dd 0
craete_text dd 0
craete_number dd 0
craete_check_box dd 0
craete_edit_box dd 0
craete_progres_bar dd 0
 
PointerToControlForButton1 dd 0
PointerToControlForButtonExit dd 0
 
PointerToControlForHorizontalScroller dd 0
PointerToControlForVerticalScroller dd 0
 
PointerToControlForBookmark dd 0
 
PointerToControlForImage dd 0
 
PointerToControlForText dd 0
 
PointerToControlForCheckBox dd 0
 
PointerToControlForEditBox dd 0
 
 
Window_CordinatX dd 0
Window_CordinatY dd 0
 
Window_SizeX dd 0
Window_SizeY dd 0
 
button_pressed dd 0
 
IPC_table rd 256
path rb 256
 
Parend: dd 0,0,0,0,0,0,0,0,0,0,0,0 ;44 bytes
Message rd 4
 
ColorsTable rd 10
buffer_for_text rb 100+2
 
struc BUTTON
{
.type db 1
.flag db 1
.x dw 1
.y dw 1
.width dw 1
.height dw 1
.image dd 1
.imageX dw 1
.imageY dw 1
.imageSizeX dw 1
.imageSizeY dw 1
.transparentColor dd 1
.text dd 1
.textX dw 1
.textY dw 1
.textcolor dd 1
.color1 dd 1
.color2 dd 1
.mouseX dw 1
.mouseY dw 1
}
 
struc SCROLLER
{
.type rb 1
.x rw 1
.y rw 1
.length rw 1
.color1 rd 1
.size rd 1
.pos rd 1
.buttons_flags rw 1
.ChildButton1 rd 1
.ChildButton2 rd 1
.mouseX rw 1
.mouseY rw 1
}
 
struc BOOKMARK
{
.type rb 1
.flag rb 1
.x rd 1
.y rd 1
.sizex rd 1
.sizey rd 1
.color_1 rd 1
.reserved rd 1
.color2 rd 1
 
.number_bookmarks rd 1
.number_zak_in_1 rd 1
.number_zak_in_2 rd 1
.number_zak_in_3 rd 1
 
.text_for_1 rd 1
.number_contrl_1 rd 1
.type_control_1 rd 1
.info_1_control rd 1
 
.text_for_2 rd 1
.number_contrl_2 rd 1
.type_control_2 rd 1
.info_2_control rd 1
 
.text_for_3 rd 1
.number_contrl_3 rd 1
.type_control_3 rd 1
.info_3_control rd 1
 
.text_for_4 rd 1
.number_contrl_4 rd 1
.type_control_4 rd 1
.info_4_control rd 1
 
.text_for_5 rd 1
.number_contrl_5 rd 1
.type_control_5 rd 1
.info_5_control rd 1
 
.text_for_6 rd 1
.number_contrl_6 rd 1
.type_control_6 rd 1
.info_6_control rd 1
 
}
 
struc IMAGE
{
.type rb 1
.flag rb 1
.color rd 1
.x rd 1
.y rd 1
.sizex rd 1
.sizey rd 1
.pointer rd 1
}
 
struc TEXT
{
.type rb 1
.flag rb 1
.color rd 1
.x rd 1
.y rd 1
.length rd 1
.pointer rd 1
}
 
struc NUMBER
{
.type rb 1
.flag rb 1
.color rd 1
.x rd 1
.y rd 1
.number rd 1
.parameters rd 1
}
 
struc CHECKBOX
{
.ch_flags rw 1
.ch_left rw 1
.ch_top rw 1
.ch_text_margin rd 1
.ch_size rd 1
.ch_size_2 rw 1
.ch_size_3 rw 1
.ch_color rd 1
.ch_border_color rd 1
.ch_text_color rd 1
.ch_text_ptr rd 1
.ch_text_length rw 1
.mouseX rd 1
.mouseY rd 1
}
struc EDITBOX
{
.ed_width rd 1 ;? ?
.ed_left rd 1 ; ??
.ed_top rd 1 ; ??
.ed_color rd 1 ;??? ?
.shift_color rd 1 ;?????. ??
.ed_focus_border_color rd 1 ;??? ?
.ed_blur_border_color rd 1 ;?? ? ?
.ed_text_color rd 1 ;????
.ed_max rd 1 ;- ? ?? ?? ?
.ed_text rd 1 ;??? ??
.ed_flags rw 1 ;?
.ed_size rd 1 ;- ?
.ed_pos rd 1 ;? ??
.ed_offset rd 1 ;??
.cl_curs_x rd 1 ;??? ???? ?
.cl_curs_y rd 1 ;??? ???? ?
.ed_shift_pos rd 1 ; ??
.ed_shift_pos_old rd 1 ;?? ??
.ed_height rd 1
.mouseX rd 1
.mouseY rd 1
}
 
struc PROGRESSBAR
{
.type rb 1
.flag rb 1
.color1 rd 1
.color2 rd 1
.x rd 1
.y rd 1
.sizex rd 1
.sizey rd 1
.progres rd 1
.color3 rd 1
}
 
Button1 BUTTON
Button3 BUTTON
VerticalScroller SCROLLER
Bookmark BOOKMARK
Image IMAGE
Text TEXT
Number NUMBER
CheckBox CHECKBOX
EditBox EDITBOX
EditBox2 EDITBOX
ProgressBar PROGRESSBAR
 
antibug: rb 2000
 
Picture:
file 'image.raw'
 
i_end:
/programs/develop/libGUI/examples/bookmarks/image.raw
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/develop/libGUI/examples/button/GETPROC.ASM
0,0 → 1,47
 
_ksys_cofflib_getproc:
 
mov ebx,[esp+4]
 
next_name_check:
 
mov ecx,[ebx]
test ecx,ecx
jz end_export
 
;cmp export string with name
mov esi,[esp+8]
xor edi,edi
next_simbol_check:
 
xor eax,eax
mov al,[ecx]
test al,al
jz exit_check_simbol
 
xor edx,edx
mov dl,[esi]
cmp al,dl
je simbols_equvalent
add edi,1
jmp exit_check_simbol
simbols_equvalent:
 
add ecx,1
add esi,1
jmp next_simbol_check
exit_check_simbol:
 
test edi,edi
jnz function_not_finded
mov eax,[ebx+4]
jmp end_export
function_not_finded:
 
add ebx,8
 
jmp next_name_check
 
end_export:
 
ret 8
/programs/develop/libGUI/examples/button/button.asm
0,0 → 1,444
;
;
; This is a example of using GUI component Button from libGUI
;
;
 
control_hader_size = 44
control_button_data_size = 50
 
include 'macros.inc'
use32
db 'MENUET01'
dd 1
dd start
dd i_end
dd 4*1024
dd 4*1024
dd 0
dd path
 
start:
;init hepe of memory
mcall 68,11
 
;set current dir as ./
call GetPath
 
;load dll
mcall 68,19,path
 
test eax,eax
jnz libGUI_loaded
 
;load dll from system directory
mcall 68,19,sys_dll_path
 
test eax,eax
jnz libGUI_loaded
 
mcall -1
 
libGUI_loaded:
 
mov [myexport],eax
 
;load dll functions
 
push fnDestroyControl
push [myexport]
call _ksys_cofflib_getproc
mov [destroy_control],eax
 
push fnSendMessage
push [myexport]
call _ksys_cofflib_getproc
mov [send_message],eax
 
push fnCraeteButton
push [myexport]
call _ksys_cofflib_getproc
mov [crate_button],eax
 
;set events mask
mcall 40,1100111b
 
;get standart colors table
mcall 48,3,ColorsTable,40
 
;*********************************************
;****************Init Butttons****************
;*********************************************
 
mov ecx,[ColorsTable+8]
and ecx,0xffffff
 
mov [Button1.type],byte 10010001b
mov [Button1.x],20
mov [Button1.y],10
mov [Button1.width],word 70
mov [Button1.height],word 20
mov [Button1.color1],0xaabbccff;dword ecx
;mov [Button1.color2],dword 0xffffff
mov [Button1.text],text1
 
push Button1
push Parend
call [crate_button]
mov [PointerToControlForButton1],eax
 
mov ecx,[ColorsTable+8]
and ecx,0xffffff
 
mov [Button2.type],byte 10010010b
mov [Button2.x],20
mov [Button2.y],40
mov [Button2.width],word 70
mov [Button2.height],word 20
mov [Button2.color1],dword ecx
mov [Button2.color2],dword 0xffffff
mov [Button2.image],ButtonPicture
mov [Button2.imageSizeX],16
mov [Button2.imageSizeY],16
mov [Button2.transparentColor],0xffffff
 
push Button2
push Parend
call [crate_button]
mov [PointerToControlForButton2],eax
 
 
mov ecx,[ColorsTable+8]
and ecx,0xffffff
 
mov [Button3.type],byte 10000100b
mov [Button3.x],20
mov [Button3.y],70
mov [Button3.width],word 70
mov [Button3.height],word 20
mov [Button3.color1],dword ecx
mov [Button3.color2],dword 0xffffff
mov [Button3.text],text1
mov [Button3.textX],40
mov [Button3.textY],8
mov [Button3.textcolor],0
mov [Button3.image],ButtonPicture
mov [Button3.imageX],3
mov [Button3.imageY],3
mov [Button3.imageSizeX],16
mov [Button3.imageSizeY],16
mov [Button3.transparentColor],0xffffff
 
push Button3
push Parend
call [crate_button]
mov [PointerToControlForButton3],eax
 
mov ecx,[ColorsTable+8]
and ecx,0xffffff
 
mov [Button4.type],byte 10010001b
mov [Button4.x],20
mov [Button4.y],100
mov [Button4.width],word 70
mov [Button4.height],word 20
mov [Button4.color1],dword ecx
mov [Button4.color2],dword 0xffffff
mov [Button4.text],text4
mov [Button4.textX],10
mov [Button4.textY],10
mov [Button4.textcolor],0
mov [Button4.image],ButtonPicture
mov [Button4.imageX],5
mov [Button4.imageY],5
mov [Button4.imageSizeX],16
mov [Button4.imageSizeY],16
mov [Button4.transparentColor],0xffffff
 
push Button4
push Parend
call [crate_button]
mov [PointerToControlForButton4],eax
 
 
call draw_window
 
;send message 1 for redrawing ALL controls
mov [Message],dword 1
 
push Message
push Parend
call [send_message]
 
 
still:
mcall 10
 
mov [SystemEvent],eax
 
;check for redraw window
cmp eax,1
jne no_window
 
call draw_window
 
mov [Message],dword 1
 
push Message
push Parend
call [send_message]
 
jmp still
no_window:
 
;check for keys events
cmp eax,2
jne no_keys
 
mcall 2
shr eax,8
 
mov [Message],dword 2
mov [Message+4],eax
 
push Message
push Parend
call [send_message]
 
mov eax,[Message+4]
 
cmp al,27
je exit
 
jmp still
no_keys:
 
;check for pressed butons
cmp eax,3
jne no_buttons
 
mcall 17
shr eax,8
 
jmp still
no_buttons:
 
;check for mouse events
cmp eax,6
jne no_mouse
 
mov [Message],dword 6
 
mcall 37,1
mov ebx,eax
shr eax,16 ;x
and ebx,0xffff ;y
 
mov [Message+4],eax
mov [Message+8],ebx
 
mcall 37,2
mov [Message+12],eax
 
;send system events to control
push Message
push Parend
call [send_message]
 
 
;button 1
mov esi,[PointerToControlForButton1]
add esi,control_hader_size ;size control's structure
mov edi,Button1
mov ecx,control_button_data_size
rep movsb
 
;button 2
mov esi,[PointerToControlForButton2]
add esi,control_hader_size ;size control's structure
mov edi,Button2
mov ecx,control_button_data_size
rep movsb
 
;button 3
mov esi,[PointerToControlForButton3]
add esi,control_hader_size ;size control's structure
mov edi,Button3
mov ecx,control_button_data_size
rep movsb
 
;button 4
mov esi,[PointerToControlForButton4]
add esi,control_hader_size ;size control's structure
mov edi,Button4
mov ecx,control_button_data_size
rep movsb
 
xor eax,eax
mov al,[Button4.flag]
cmp al,11b
jne no_exit_demo
 
mov [button_pressed],1
 
no_exit_demo:
 
cmp al,1b
jne no_only_crossing_button
 
cmp [button_pressed],1
jne no_only_crossing_button
 
jmp exit
 
no_only_crossing_button:
 
jmp still
no_mouse:
 
jmp still
 
exit:
 
;free resourses
push [PointerToControlForButton1]
call [destroy_control]
 
push [PointerToControlForButton2]
call [destroy_control]
 
push [PointerToControlForButton3]
call [destroy_control]
 
push [PointerToControlForButton4]
call [destroy_control]
 
mcall -1
 
;**********************************************
;*******************Draw window****************
;**********************************************
 
draw_window:
 
mcall 12,1
 
xor eax,eax
mov ebx,50
mov ecx,50
shl ebx,16
shl ecx,16
add ebx,200
add ecx,200
mov edx,0x03aabbcc
mov esi,0x805080d0
mov edi,0x005080d0
mcall
 
mcall 12,2
 
ret
 
 
GetPath:
 
mov ebx,255
mov ecx,path
 
next_symvol:
mov edx,ecx
add edx,ebx
 
xor eax,eax
mov al,[edx]
cmp eax,'/'
je exit_path
 
dec ebx
jnz next_symvol
 
exit_path:
 
inc edx
mov esi,dll_name
mov edi,edx
mov ecx,10
rep movsb
 
ret
 
include 'getproc.asm'
 
;************************************************************
;***************************DATA*****************************
;************************************************************
 
align 4
 
dll_name db 'libGUI.obj',0
sys_dll_path db '/sys/lib/libGUi.obj',0
 
 
text1 db 'text',0
text4 db 'Exit',0
 
fnDestroyControl db 'DestroyControl',0
fnSendMessage db 'SendMessage',0
fnCraeteButton db 'CraeteButton',0
 
myexport dd 0
 
destroy_control dd 0
send_message dd 0
crate_button dd 0
 
PointerToControlForButton1 dd 0
PointerToControlForButton2 dd 0
PointerToControlForButton3 dd 0
PointerToControlForButton4 dd 0
 
SystemEvent dd 0
button_pressed rb 1
 
path rb 256
 
Parend: dd 0,0,0,0,0,0,0,0,0,0,0,0 ;44 bytes
Message dd 0,0,0,0
ColorsTable dd 0,0,0,0,0,0,0,0,0,0,0,0
 
struc BUTTON
{
.type db 1
.flag db 1
.x dw 1
.y dw 1
.width dw 1
.height dw 1
.image dd 1
.imageX dw 1
.imageY dw 1
.imageSizeX dw 1
.imageSizeY dw 1
.transparentColor dd 1
.text dd 1
.textX dw 1
.textY dw 1
.textcolor dd 1
.color1 dd 1
.color2 dd 1
.mouseX dw 1
.mouseY dw 1
}
 
 
Button1 BUTTON
Button2 BUTTON
Button3 BUTTON
Button4 BUTTON
 
antibug rb 460
 
ButtonPicture:
file 'test.raw'
 
i_end:
/programs/develop/libGUI/examples/button/test.raw
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/develop/libGUI/examples/check_box/GETPROC.ASM
0,0 → 1,47
 
_ksys_cofflib_getproc:
 
mov ebx,[esp+4]
 
next_name_check:
 
mov ecx,[ebx]
test ecx,ecx
jz end_export
 
;cmp export string with name
mov esi,[esp+8]
xor edi,edi
next_simbol_check:
 
xor eax,eax
mov al,[ecx]
test al,al
jz exit_check_simbol
 
xor edx,edx
mov dl,[esi]
cmp al,dl
je simbols_equvalent
add edi,1
jmp exit_check_simbol
simbols_equvalent:
 
add ecx,1
add esi,1
jmp next_simbol_check
exit_check_simbol:
 
test edi,edi
jnz function_not_finded
mov eax,[ebx+4]
jmp end_export
function_not_finded:
 
add ebx,8
 
jmp next_name_check
 
end_export:
 
ret 8
/programs/develop/libGUI/examples/check_box/check_box.asm
0,0 → 1,373
;
;
; Example of using gui component CheckBox from libGUI.
;
;
 
include 'macros.inc'
use32
db 'MENUET01'
dd 1
dd start
dd i_end
dd 1600
dd 1600
dd 0
dd path
 
start:
;init hepe of memory
mcall 68,11
 
;set current dir as ./
call GetPath
 
;load dll
mcall 68,19,path
 
test eax,eax
jnz libGUI_loaded
 
mcall 68,19,sys_libGUI_path
 
test eax,eax
jnz libGUI_loaded
 
mcall -1
 
libGUI_loaded:
 
mov [myexport],eax
 
;load dll functions
 
push fnDestroyControl
push [myexport]
call _ksys_cofflib_getproc
mov [destroy_control],eax
 
push fnSendMessage
push [myexport]
call _ksys_cofflib_getproc
mov [send_message],eax
 
push fnCraeteButton
push [myexport]
call _ksys_cofflib_getproc
mov [craete_button],eax
 
push fnCraeteCheckbox
push [myexport]
call _ksys_cofflib_getproc
mov [craete_check_box],eax
 
;set events mask
mcall 40,1100111b
 
;get standart colors table
mcall 48,3,ColorsTable,40
 
;*********************************************
;****************Init Buttton****************
;*********************************************
 
mov ecx,[ColorsTable+8]
and ecx,0xffffff
 
mov [Button1.type],byte 10010001b
mov [Button1.x],10
mov [Button1.y],40
mov [Button1.width],word 70
mov [Button1.height],word 20
mov [Button1.color1],dword ecx
mov [Button1.color2],dword 0xffffff
mov [Button1.text],text1
 
push Button1
push Parend
call [craete_button]
mov [PointerToControlForButtonExit],eax
 
;********************************************
;***************Init CheckBox****************
;********************************************
 
mov ecx,[ColorsTable+8]
and ecx,0xffffff
 
;mov [CheckBox.ch_flags],word 10b
mov [CheckBox.ch_left],20
mov [CheckBox.ch_top],15
mov [CheckBox.ch_text_margin],4
mov [CheckBox.ch_size],11
mov [CheckBox.ch_color],0xffffff
mov [CheckBox.ch_border_color],ecx
mov [CheckBox.ch_text_color],0
mov [CheckBox.ch_text_ptr],check_box_text
mov [CheckBox.ch_text_length],9
 
push CheckBox
push Parend
call [craete_check_box]
mov [PointerToControlForCheckBox],eax
 
call draw_window
 
 
;send message 1 for redrawing ALL controls
mov [Message],dword 1
 
push Message
push Parend
call [send_message]
 
still:
mcall 10
 
;check for redraw window
cmp eax,1
jne no_window
 
call draw_window
 
mov [Message],dword 1
push Message
push Parend
call [send_message]
 
jmp still
no_window:
 
;check for keys events
cmp eax,2
jne no_keys
 
mcall 2
shr eax,8
 
mov [Message],dword 2
mov [Message+4],eax
 
push Message
push Parend
call [send_message]
 
mov eax,[Message+4]
 
cmp al,27
je exit
 
jmp still
no_keys:
 
;check for pressed butons
cmp eax,3
jne no_buttons
 
mcall 17
shr eax,8
 
jmp still
no_buttons:
 
;check for mouse events
cmp eax,6
jne no_mouse
 
mov [Message],dword 6
 
mcall 37,1
mov ebx,eax
shr eax,16 ;x
and ebx,0xffff ;y
 
mov [Message+4],eax
mov [Message+8],ebx
 
mcall 37,2
mov [Message+12],eax
 
;send system events to control
push Message
push Parend
call [send_message]
 
mov eax,[PointerToControlForButtonExit]
 
xor ebx,ebx
mov bl,byte[eax+45]
cmp bl,11b
jne no_crossing_pressing_button
 
mov [button_pressed],1
 
no_crossing_pressing_button:
 
xor ebx,ebx
mov bl,byte[eax+45]
cmp bl,1b
jne no_crossing_button
 
cmp [button_pressed],1
jne no_crossing_button
 
jmp exit
 
no_crossing_button:
 
jmp still
no_mouse:
 
jmp still
 
exit:
 
push [PointerToControlForButtonExit]
call [destroy_control]
 
push [PointerToControlForCheckBox]
call [destroy_control]
 
mcall -1
 
 
 
;**********************************************
;*******************Draw window****************
;**********************************************
 
draw_window:
 
mcall 12,1
 
xor eax,eax
mov ebx,50
mov ecx,50
shl ebx,16
shl ecx,16
add ebx,100
add ecx,100
mov edx,0x03aabbcc
mov esi,0x805080d0
mov edi,0x005080d0
mcall
 
mcall 12,2
ret
 
 
GetPath:
 
mov ebx,255
mov ecx,path
 
next_symvol:
mov edx,ecx
add edx,ebx
 
xor eax,eax
mov al,[edx]
cmp eax,'/'
je exit_path
 
dec ebx
jnz next_symvol
 
exit_path:
 
inc edx
mov esi,dll_name
mov edi,edx
mov ecx,10
rep movsb
 
ret
 
 
include 'getproc.asm'
 
;************************************************************
;***************************DATA*****************************
;************************************************************
 
align 4
 
dll_name db 'libGUI.obj',0
sys_libGUI_path db '/sys/lib/libGUI.obj',0
 
check_box_text db 'Check box',0
 
text1 db 'Exit',0
 
fnDestroyControl db 'DestroyControl',0
fnSendMessage db 'SendMessage',0
fnCraeteButton db 'CraeteButton',0
fnCraeteCheckbox db 'CraeteCheckbox',0
 
myexport dd 0
 
destroy_control dd 0
send_message dd 0
craete_button dd 0
craete_check_box dd 0
 
PointerToControlForButtonExit dd 0
 
PointerToControlForCheckBox dd 0
 
button_pressed dd 0
 
path rb 256
 
Parend: dd 0,0,0,0,0,0,0,0,0,0,0,0 ;44 bytes
Message rd 4
 
ColorsTable rd 10
 
struc BUTTON
{
.type db 1
.flag db 1
.x dw 1
.y dw 1
.width dw 1
.height dw 1
.image dd 1
.imageX dw 1
.imageY dw 1
.imageSizeX dw 1
.imageSizeY dw 1
.transparentColor dd 1
.text dd 1
.textX dw 1
.textY dw 1
.textcolor dd 1
.color1 dd 1
.color2 dd 1
.mouseX dw 1
.mouseY dw 1
}
 
 
struc CHECKBOX
{
.ch_flags rw 1
.ch_left rw 1
.ch_top rw 1
.ch_text_margin rd 1
.ch_size rd 1
.ch_size_2 rw 1
.ch_size_3 rw 1
.ch_color rd 1
.ch_border_color rd 1
.ch_text_color rd 1
.ch_text_ptr rd 1
.ch_text_length rw 1
.mouseX rd 1
.mouseY rd 1
}
 
 
Button1 BUTTON
CheckBox CHECKBOX
i_end:
/programs/develop/libGUI/examples/edit_box/GETPROC.ASM
0,0 → 1,47
 
_ksys_cofflib_getproc:
 
mov ebx,[esp+4]
 
next_name_check:
 
mov ecx,[ebx]
test ecx,ecx
jz end_export
 
;cmp export string with name
mov esi,[esp+8]
xor edi,edi
next_simbol_check:
 
xor eax,eax
mov al,[ecx]
test al,al
jz exit_check_simbol
 
xor edx,edx
mov dl,[esi]
cmp al,dl
je simbols_equvalent
add edi,1
jmp exit_check_simbol
simbols_equvalent:
 
add ecx,1
add esi,1
jmp next_simbol_check
exit_check_simbol:
 
test edi,edi
jnz function_not_finded
mov eax,[ebx+4]
jmp end_export
function_not_finded:
 
add ebx,8
 
jmp next_name_check
 
end_export:
 
ret 8
/programs/develop/libGUI/examples/edit_box/edit_box.asm
0,0 → 1,383
;
;
; This is example of using GUI component EditBox from libGUI.
;
;
 
include 'macros.inc'
use32
db 'MENUET01'
dd 1
dd start
dd i_end
dd 1800
dd 1800
dd 0
dd path
 
start:
;init hepe of memory
mcall 68,11
 
;set current dir as ./
call GetPath
 
;load dll
mcall 68,19,path
 
test eax,eax
jnz libGUI_loaded
 
mcall 68,19,sys_libGUI_path
 
test eax,eax
jnz libGUI_loaded
 
mcall -1
 
libGUI_loaded:
 
mov [myexport],eax
 
;load dll functions
 
push fnDestroyControl
push [myexport]
call _ksys_cofflib_getproc
mov [destroy_control],eax
 
push fnSendMessage
push [myexport]
call _ksys_cofflib_getproc
mov [send_message],eax
 
push fnCraeteButton
push [myexport]
call _ksys_cofflib_getproc
mov [craete_button],eax
 
push fnCraeteEditbox
push [myexport]
call _ksys_cofflib_getproc
mov [craete_edit_box],eax
 
;set events mask
mcall 40,1100111b
 
;get standart colors table
mcall 48,3,ColorsTable,40
 
;*********************************************
;****************Init Butttons****************
;*********************************************
 
mov ecx,[ColorsTable+8]
and ecx,0xffffff
 
mov [Button1.type],byte 10010001b
mov [Button1.x],20
mov [Button1.y],50
mov [Button1.width],word 70
mov [Button1.height],word 20
mov [Button1.color1],dword ecx
mov [Button1.color2],dword 0xffffff
mov [Button1.text],text1
 
push Button1
push Parend
call [craete_button]
mov [PointerToControlForButtonExit],eax
 
mov ecx,[ColorsTable+8]
and ecx,0xffffff
 
;********************************************
;***************Init EditBox*****************
;********************************************
 
mov ecx,[ColorsTable+8]
mov [EditBox.ed_flags],0b;1000000000000000b
mov [EditBox.ed_left],5 ;x
mov [EditBox.ed_top],10 ;y
mov [EditBox.ed_width],100
mov [EditBox.ed_height],14
mov [EditBox.ed_max],100
mov [EditBox.ed_text],buffer_for_text
mov [EditBox.ed_color],dword 0xffffff
mov [EditBox.shift_color],dword 0xaabbcc
mov [EditBox.ed_focus_border_color],0
mov [EditBox.ed_blur_border_color],ecx
mov [EditBox.ed_text_color],0
 
push EditBox
push Parend
call [craete_edit_box]
mov [PointerToControlForEditBox],eax
 
call draw_window
 
 
;send message 1 for redrawing ALL controls
mov [Message],dword 1
 
push Message
push Parend
call [send_message]
 
still:
mcall 10
 
;check for redraw window
cmp eax,1
jne no_window
 
call draw_window
 
mov [Message],dword 1
push Message
push Parend
call [send_message]
 
jmp still
no_window:
 
;check for keys events
cmp eax,2
jne no_keys
 
mcall 2
shr eax,8
 
mov [Message],dword 2
mov [Message+4],eax
 
push Message
push Parend
call [send_message]
 
mov eax,[Message+4]
 
cmp al,27
je exit
 
jmp still
no_keys:
 
;check for pressed butons
cmp eax,3
jne no_buttons
 
mcall 17
shr eax,8
 
jmp still
no_buttons:
 
;check for mouse events
cmp eax,6
jne no_mouse
 
mov [Message],dword 6
 
mcall 37,1
mov ebx,eax
shr eax,16 ;x
and ebx,0xffff ;y
 
mov [Message+4],eax
mov [Message+8],ebx
 
mcall 37,2
mov [Message+12],eax
 
;send system events to control
push Message
push Parend
call [send_message]
 
mov eax,[PointerToControlForButtonExit]
 
xor ebx,ebx
mov bl,byte[eax+45]
cmp bl,11b
jne no_crossing_pressing_button
 
mov [button_pressed],1
 
no_crossing_pressing_button:
 
xor ebx,ebx
mov bl,byte[eax+45]
cmp bl,1b
jne no_crossing_button
 
cmp [button_pressed],1
jne no_crossing_button
 
jmp exit
 
no_crossing_button:
 
jmp still
no_mouse:
 
jmp still
 
exit:
 
push [PointerToControlForButtonExit]
call [destroy_control]
 
push [PointerToControlForEditBox]
call [destroy_control]
 
mcall -1
 
 
 
;**********************************************
;*******************Draw window****************
;**********************************************
 
draw_window:
 
mcall 12,1
 
xor eax,eax
mov ebx,50
mov ecx,50
shl ebx,16
shl ecx,16
add ebx,120
add ecx,120
mov edx,0x03aabbcc
mov esi,0x805080d0
mov edi,0x005080d0
mcall
 
mcall 12,2
ret
 
 
GetPath:
 
mov ebx,255
mov ecx,path
 
next_symvol:
mov edx,ecx
add edx,ebx
 
xor eax,eax
mov al,[edx]
cmp eax,'/'
je exit_path
 
dec ebx
jnz next_symvol
 
exit_path:
 
inc edx
mov esi,dll_name
mov edi,edx
mov ecx,10
rep movsb
 
ret
 
 
include 'getproc.asm'
 
;************************************************************
;***************************DATA*****************************
;************************************************************
 
align 4
 
dll_name db 'libGUI.obj',0
sys_libGUI_path db '/sys/lib/libGUI.obj',0
 
text1 db 'Exit',0
 
text_for_text db 'Hello world from zakladka',0
 
fnDestroyControl db 'DestroyControl',0
fnSendMessage db 'SendMessage',0
fnCraeteButton db 'CraeteButton',0
fnCraeteEditbox db 'CraeteEditbox',0
 
myexport dd 0
 
destroy_control dd 0
send_message dd 0
craete_button dd 0
craete_edit_box dd 0
 
PointerToControlForButtonExit dd 0
 
PointerToControlForEditBox dd 0
 
button_pressed dd 0
 
path rb 256
 
Parend: dd 0,0,0,0,0,0,0,0,0,0,0,0 ;44 bytes
Message rd 4
 
ColorsTable rd 10
buffer_for_text rb 100+2
 
struc BUTTON
{
.type db 1
.flag db 1
.x dw 1
.y dw 1
.width dw 1
.height dw 1
.image dd 1
.imageX dw 1
.imageY dw 1
.imageSizeX dw 1
.imageSizeY dw 1
.transparentColor dd 1
.text dd 1
.textX dw 1
.textY dw 1
.textcolor dd 1
.color1 dd 1
.color2 dd 1
.mouseX dw 1
.mouseY dw 1
}
 
struc EDITBOX
{
.ed_width rd 1
.ed_left rd 1
.ed_top rd 1
.ed_color rd 1
.shift_color rd 1
.ed_focus_border_color rd 1
.ed_blur_border_color rd 1
.ed_text_color rd 1
.ed_max rd 1
.ed_text rd 1
.ed_flags rw 1
.ed_size rd 1
.ed_pos rd 1
.ed_offset rd 1
.cl_curs_x rd 1
.cl_curs_y rd 1
.ed_shift_pos rd 1
.ed_shift_pos_old rd 1
.ed_height rd 1
.mouseX rd 1
.mouseY rd 1
}
 
Button1 BUTTON
EditBox EDITBOX
 
i_end:
/programs/develop/libGUI/examples/image/GETPROC.ASM
0,0 → 1,47
 
_ksys_cofflib_getproc:
 
mov ebx,[esp+4]
 
next_name_check:
 
mov ecx,[ebx]
test ecx,ecx
jz end_export
 
;cmp export string with name
mov esi,[esp+8]
xor edi,edi
next_simbol_check:
 
xor eax,eax
mov al,[ecx]
test al,al
jz exit_check_simbol
 
xor edx,edx
mov dl,[esi]
cmp al,dl
je simbols_equvalent
add edi,1
jmp exit_check_simbol
simbols_equvalent:
 
add ecx,1
add esi,1
jmp next_simbol_check
exit_check_simbol:
 
test edi,edi
jnz function_not_finded
mov eax,[ebx+4]
jmp end_export
function_not_finded:
 
add ebx,8
 
jmp next_name_check
 
end_export:
 
ret 8
/programs/develop/libGUI/examples/image/KOSLOGO.RAW
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/develop/libGUI/examples/image/image.asm
0,0 → 1,362
;
;
; This is example of using GUI component Image from libGUI.
;
;
 
include 'macros.inc'
use32
db 'MENUET01'
dd 1
dd start
dd i_end
dd 7*1024+100
dd 7*1024+100
dd 0
dd path
 
start:
;init hepe of memory
mcall 68,11
 
;set current dir as ./
call GetPath
 
;load dll
mcall 68,19,path
 
test eax,eax
jnz libGUI_loaded
 
mcall 68,19,sys_libGUI_path
 
test eax,eax
jnz libGUI_loaded
 
mcall -1
 
libGUI_loaded:
 
mov [myexport],eax
 
;load dll functions
 
push fnDestroyControl
push [myexport]
call _ksys_cofflib_getproc
mov [destroy_control],eax
 
push fnSendMessage
push [myexport]
call _ksys_cofflib_getproc
mov [send_message],eax
 
push fnCraeteButton
push [myexport]
call _ksys_cofflib_getproc
mov [crate_button],eax
 
push fnCraeteImage
push [myexport]
call _ksys_cofflib_getproc
mov [crate_image],eax
 
;set events mask
mcall 40,1100111b
 
;get standart colors table
mcall 48,3,ColorsTable,40
 
;*********************************************
;****************Init Butttons****************
;*********************************************
 
mov ecx,[ColorsTable+8]
and ecx,0xffffff
 
mov [Button1.type],byte 10010001b
mov [Button1.x],10
mov [Button1.y],50
mov [Button1.width],word 70
mov [Button1.height],word 20
mov [Button1.color1],dword ecx
mov [Button1.color2],dword 0xffffff
mov [Button1.text],text1
 
push Button1
push Parend
call [crate_button]
mov [PointerToControlForButtonExit],eax
 
;********************************************
;******************Init Image****************
;********************************************
 
mov [Image.type],byte 10000000b
mov [Image.x],25
mov [Image.y],5
mov [Image.sizex],40
mov [Image.sizey],40
mov [Image.pointer],Picture
 
push Image
push Parend
call [crate_image]
mov [PointerToControlForImage],eax
 
call draw_window
 
;send message 1 for redrawing ALL controls
mov [Message],dword 1
 
push Message
push Parend
call [send_message]
 
still:
mcall 10
 
;check for redraw window
cmp eax,1
jne no_window
 
call draw_window
 
mov [Message],1
 
push Message
push Parend
call [send_message]
 
jmp still
no_window:
 
;check for keys events
cmp eax,2
jne no_keys
 
mcall 2
shr eax,8
 
mov [Message],dword 2
mov [Message+4],eax
 
push Message
push Parend
call [send_message]
 
mov eax,[Message+4]
 
cmp al,27
je exit
 
jmp still
no_keys:
 
;check for pressed butons
cmp eax,3
jne no_buttons
 
mcall 17
shr eax,8
 
jmp still
no_buttons:
 
;check for mouse events
cmp eax,6
jne no_mouse
 
mov [Message],dword 6
 
mcall 37,1
mov ebx,eax
shr eax,16 ;x
and ebx,0xffff ;y
 
mov [Message+4],eax
mov [Message+8],ebx
 
mcall 37,2
mov [Message+12],eax
 
;send system events to control
push Message
push Parend
call [send_message]
 
mov eax,[PointerToControlForButtonExit]
 
xor ebx,ebx
mov bl,byte[eax+45]
cmp bl,11b
jne no_crossing_pressing_button
 
mov [button_pressed],1
 
no_crossing_pressing_button:
 
xor ebx,ebx
mov bl,byte[eax+45]
cmp bl,1b
jne no_crossing_button
 
cmp [button_pressed],1
jne no_crossing_button
 
jmp exit
 
no_crossing_button:
 
jmp still
no_mouse:
 
jmp still
 
exit:
 
push [PointerToControlForButtonExit]
call [destroy_control]
 
push [PointerToControlForImage]
call [destroy_control]
 
mcall -1
 
 
 
;**********************************************
;*******************Draw window****************
;**********************************************
 
draw_window:
 
mcall 12,1
 
xor eax,eax
mov ebx,50
mov ecx,50
shl ebx,16
shl ecx,16
add ebx,100
add ecx,100
mov edx,0x03aabbcc
mov esi,0x805080d0
mov edi,0x005080d0
mcall
 
mcall 12,2
ret
 
 
GetPath:
 
mov ebx,255
mov ecx,path
 
next_symvol:
mov edx,ecx
add edx,ebx
 
xor eax,eax
mov al,[edx]
cmp eax,'/'
je exit_path
 
dec ebx
jnz next_symvol
 
exit_path:
 
inc edx
mov esi,dll_name
mov edi,edx
mov ecx,10
rep movsb
 
ret
 
 
include 'getproc.asm'
 
;************************************************************
;***************************DATA*****************************
;************************************************************
 
align 4
 
dll_name db 'libGUI.obj',0
sys_libGUI_path db '/sys/lib/libGUI.obj',0
 
text1 db 'Exit',0
 
fnDestroyControl db 'DestroyControl',0
fnSendMessage db 'SendMessage',0
fnCraeteButton db 'CraeteButton',0
fnCraeteImage db 'CraeteImage',0
 
myexport dd 0
 
destroy_control dd 0
send_message dd 0
crate_button dd 0
crate_image dd 0
 
PointerToControlForButtonExit dd 0
 
PointerToControlForImage dd 0
 
button_pressed dd 0
 
path rb 256
 
Parend: dd 0,0,0,0,0,0,0,0,0,0,0,0 ;44 bytes
Message rd 4
 
ColorsTable rd 10
 
struc BUTTON
{
.type db 1
.flag db 1
.x dw 1
.y dw 1
.width dw 1
.height dw 1
.image dd 1
.imageX dw 1
.imageY dw 1
.imageSizeX dw 1
.imageSizeY dw 1
.transparentColor dd 1
.text dd 1
.textX dw 1
.textY dw 1
.textcolor dd 1
.color1 dd 1
.color2 dd 1
.mouseX dw 1
.mouseY dw 1
}
 
struc IMAGE
{
.type rb 1
.flag rb 1
.color rd 1
.x rd 1
.y rd 1
.sizex rd 1
.sizey rd 1
.pointer rd 1
}
 
Button1 BUTTON
Image IMAGE
 
untibug: rb 1000
 
Picture:
file 'koslogo.raw'
 
i_end:
/programs/develop/libGUI/examples/number/GETPROC.ASM
0,0 → 1,47
 
_ksys_cofflib_getproc:
 
mov ebx,[esp+4]
 
next_name_check:
 
mov ecx,[ebx]
test ecx,ecx
jz end_export
 
;cmp export string with name
mov esi,[esp+8]
xor edi,edi
next_simbol_check:
 
xor eax,eax
mov al,[ecx]
test al,al
jz exit_check_simbol
 
xor edx,edx
mov dl,[esi]
cmp al,dl
je simbols_equvalent
add edi,1
jmp exit_check_simbol
simbols_equvalent:
 
add ecx,1
add esi,1
jmp next_simbol_check
exit_check_simbol:
 
test edi,edi
jnz function_not_finded
mov eax,[ebx+4]
jmp end_export
function_not_finded:
 
add ebx,8
 
jmp next_name_check
 
end_export:
 
ret 8
/programs/develop/libGUI/examples/number/number.asm
0,0 → 1,377
;
;
; This is example using GUI component Number from libGUI.
;
;
 
include 'macros.inc'
use32
db 'MENUET01'
dd 1
dd start
dd i_end
dd 1700
dd 1700
dd 0
dd path
 
start:
;init hepe of memory
mcall 68,11
 
;set current dir as ./
call GetPath
 
;load dll
mcall 68,19,path
 
test eax,eax
jnz libGUI_loaded
 
mcall 68,19,sys_libGUI_path
 
test eax,eax
jnz libGUI_loaded
 
mcall -1
 
libGUI_loaded:
 
mov [myexport],eax
 
;load dll functions
 
push fnDestroyControl
push [myexport]
call _ksys_cofflib_getproc
mov [destroy_control],eax
 
push fnSendMessage
push [myexport]
call _ksys_cofflib_getproc
mov [send_message],eax
 
push fnCraeteButton
push [myexport]
call _ksys_cofflib_getproc
mov [craete_button],eax
 
push fnCraeteNumber
push [myexport]
call _ksys_cofflib_getproc
mov [craete_number],eax
 
;set events mask
mcall 40,1100111b
 
;get standart colors table
mcall 48,3,ColorsTable,40
 
;*********************************************
;****************Init Butttons****************
;*********************************************
 
mov ecx,[ColorsTable+8]
and ecx,0xffffff
 
mov [Button1.type],byte 10010001b
mov [Button1.x],10
mov [Button1.y],50
mov [Button1.width],word 70
mov [Button1.height],word 20
mov [Button1.color1],dword ecx
mov [Button1.color2],dword 0xffffff
mov [Button1.text],text1
 
push Button1
push Parend
call [craete_button]
mov [PointerToControlForButtonExit],eax
 
mov ecx,[ColorsTable+8]
and ecx,0xffffff
 
;********************************************
;****************Init Numbers****************
;********************************************
 
mov [NumberFloat.type],byte 10000010b
mov [NumberFloat.color],0xffffff
mov [NumberFloat.x],20
mov [NumberFloat.y],10
mov [NumberFloat.parameters],4*65536+5
mov [NumberFloat.number],-1234.56789
 
mov [NumberInteger.type],byte 10000000b
mov [NumberInteger.color],0xffffff
mov [NumberInteger.x],26
mov [NumberInteger.y],30
mov [NumberInteger.parameters],8*65536
mov [NumberInteger.number],12345678
 
push NumberFloat
push Parend
call [craete_number]
mov [PointerToControlForNumberFloat],eax
 
push NumberInteger
push Parend
call [craete_number]
mov [PointerToControlForNumberInteger],eax
 
call draw_window
 
 
;send message 1 for redrawing ALL controls
mov [Message],dword 1
 
push Message
push Parend
call [send_message]
 
still:
mcall 10
 
;check for redraw window
cmp eax,1
jne no_window
 
call draw_window
 
mov [Message],dword 1
push Message
push Parend
call [send_message]
 
jmp still
no_window:
 
;check for keys events
cmp eax,2
jne no_keys
 
mcall 2
shr eax,8
 
mov [Message],dword 2
mov [Message+4],eax
 
push Message
push Parend
call [send_message]
 
mov eax,[Message+4]
 
cmp al,27
je exit
 
jmp still
no_keys:
 
;check for pressed butons
cmp eax,3
jne no_buttons
 
mcall 17
shr eax,8
 
jmp still
no_buttons:
 
;check for mouse events
cmp eax,6
jne no_mouse
 
mov [Message],dword 6
 
mcall 37,1
mov ebx,eax
shr eax,16 ;x
and ebx,0xffff ;y
 
mov [Message+4],eax
mov [Message+8],ebx
 
mcall 37,2
mov [Message+12],eax
 
;send system events to control
push Message
push Parend
call [send_message]
 
mov eax,[PointerToControlForButtonExit]
 
xor ebx,ebx
mov bl,byte[eax+45]
cmp bl,11b
jne no_crossing_pressing_button
 
mov [button_pressed],1
 
no_crossing_pressing_button:
 
xor ebx,ebx
mov bl,byte[eax+45]
cmp bl,1b
jne no_crossing_button
 
cmp [button_pressed],1
jne no_crossing_button
 
jmp exit
 
no_crossing_button:
 
jmp still
no_mouse:
 
jmp still
 
exit:
 
push [PointerToControlForButtonExit]
call [destroy_control]
 
push [PointerToControlForNumberFloat]
call [destroy_control]
 
push [PointerToControlForNumberInteger]
call [destroy_control]
 
mcall -1
 
 
 
;**********************************************
;*******************Draw window****************
;**********************************************
 
draw_window:
 
mcall 12,1
 
xor eax,eax
mov ebx,50
mov ecx,50
shl ebx,16
shl ecx,16
add ebx,100
add ecx,100
mov edx,0x03aabbcc
mov esi,0x805080d0
mov edi,0x005080d0
mcall
 
mcall 12,2
ret
 
 
GetPath:
 
mov ebx,255
mov ecx,path
 
next_symvol:
mov edx,ecx
add edx,ebx
 
xor eax,eax
mov al,[edx]
cmp eax,'/'
je exit_path
 
dec ebx
jnz next_symvol
 
exit_path:
 
inc edx
mov esi,dll_name
mov edi,edx
mov ecx,10
rep movsb
 
ret
 
 
include 'getproc.asm'
 
;************************************************************
;***************************DATA*****************************
;************************************************************
 
align 4
 
dll_name db 'libGUI.obj',0
sys_libGUI_path db '/sys/lib/libGUI.obj',0
 
text1 db 'Exit',0
 
fnDestroyControl db 'DestroyControl',0
fnSendMessage db 'SendMessage',0
fnCraeteButton db 'CraeteButton',0
fnCraeteNumber db 'CraeteNumber',0
 
myexport dd 0
 
destroy_control dd 0
send_message dd 0
craete_button dd 0
craete_number dd 0
 
PointerToControlForButtonExit dd 0
 
PointerToControlForNumberFloat dd 0
PointerToControlForNumberInteger dd 0
 
button_pressed dd 0
 
path rb 256
 
Parend: dd 0,0,0,0,0,0,0,0,0,0,0,0 ;44 bytes
Message rd 4
 
ColorsTable rd 10
 
struc BUTTON
{
.type db 1
.flag db 1
.x dw 1
.y dw 1
.width dw 1
.height dw 1
.image dd 1
.imageX dw 1
.imageY dw 1
.imageSizeX dw 1
.imageSizeY dw 1
.transparentColor dd 1
.text dd 1
.textX dw 1
.textY dw 1
.textcolor dd 1
.color1 dd 1
.color2 dd 1
.mouseX dw 1
.mouseY dw 1
}
 
 
struc NUMBER
{
.type rb 1
.flag rb 1
.color rd 1
.x rd 1
.y rd 1
.number rd 1
.parameters rd 1
}
 
Button1 BUTTON
NumberFloat NUMBER
NumberInteger NUMBER
 
i_end:
/programs/develop/libGUI/examples/progress_bar/GETPROC.ASM
0,0 → 1,47
 
_ksys_cofflib_getproc:
 
mov ebx,[esp+4]
 
next_name_check:
 
mov ecx,[ebx]
test ecx,ecx
jz end_export
 
;cmp export string with name
mov esi,[esp+8]
xor edi,edi
next_simbol_check:
 
xor eax,eax
mov al,[ecx]
test al,al
jz exit_check_simbol
 
xor edx,edx
mov dl,[esi]
cmp al,dl
je simbols_equvalent
add edi,1
jmp exit_check_simbol
simbols_equvalent:
 
add ecx,1
add esi,1
jmp next_simbol_check
exit_check_simbol:
 
test edi,edi
jnz function_not_finded
mov eax,[ebx+4]
jmp end_export
function_not_finded:
 
add ebx,8
 
jmp next_name_check
 
end_export:
 
ret 8
/programs/develop/libGUI/examples/progress_bar/progress_bar.asm
0,0 → 1,412
;
;
; Example of using GUI componet ProgressBar from libGUI
;
;
 
include 'macros.inc'
use32
db 'MENUET01'
dd 1
dd start
dd i_end
dd 124*1024
dd 124*1024
dd 0
dd path
 
start:
;init hepe of memory
mcall 68,11
 
;set current dir as ./
call GetPath
 
;load dll
mcall 68,19,path
 
test eax,eax
jnz libGUI_loaded
 
mcall 68,19,sys_libGUI_path
 
test eax,eax
jnz libGUI_loaded
 
mcall -1
 
libGUI_loaded:
 
mov [myexport],eax
 
;load dll functions
 
push fnDestroyControl
push [myexport]
call _ksys_cofflib_getproc
mov [destroy_control],eax
 
push fnSendMessage
push [myexport]
call _ksys_cofflib_getproc
mov [send_message],eax
 
push fnCraeteButton
push [myexport]
call _ksys_cofflib_getproc
mov [craete_button],eax
 
push fnCraeteProgressbar
push [myexport]
call _ksys_cofflib_getproc
mov [craete_progress_bar],eax
 
;set events mask
mcall 40,1100111b
 
;get standart colors table
mcall 48,3,ColorsTable,40
 
;*********************************************
;****************Init Butttons****************
;*********************************************
 
mov ecx,[ColorsTable+8]
and ecx,0xffffff
 
mov [Button1.type],byte 10010001b
mov [Button1.x],60
mov [Button1.y],50
mov [Button1.width],word 70
mov [Button1.height],word 20
mov [Button1.color1],dword ecx
mov [Button1.color2],dword 0xffffff
mov [Button1.text],text1
 
mov [ProgressBar.type],byte 10000001b
mov [ProgressBar.color1],dword 0xffffff
mov [ProgressBar.color2],0xff0000
mov [ProgressBar.color3],ecx
mov [ProgressBar.x],5
mov [ProgressBar.y],5
mov [ProgressBar.sizex],175
mov [ProgressBar.sizey],16
mov [ProgressBar.progres],0
 
push Button1
push Parend
call [craete_button]
mov [PointerToControlForButtonExit],eax
 
mov ecx,[ColorsTable+8]
and ecx,0xffffff
 
push ProgressBar
push Parend
call [craete_progress_bar]
mov [PointerToControlForProgressBar],eax
 
call draw_window
 
 
;send message 1 for redrawing ALL controls
mov [Message],dword 1
 
push Message
push Parend
call [send_message]
 
mov [progress],0.02
mov [progress_step],0.01
still:
;----------------------------------------
;--send special message for ProgressBar--
;----------------------------------------
 
mov ebx,[progress]
mov eax,[PointerToControlForProgressBar]
mov [eax+44],byte 1b
mov [eax+44+26],ebx
 
fld [progress_step]
fld [progress]
fadd st0,st1
fstp [progress]
fstp st0
 
cmp [progress],dword 1.0
jl no_1_
 
mov [progress],0.02
mov eax,[PointerToControlForProgressBar]
mov [eax+44],byte 10000001b
mov [eax+44+26],dword 0.02
 
mov [Message],dword 1
push Message
push Parend
call [send_message]
 
no_1_:
 
;fld [progress]
;fcmovbe
;fstsw ax
;sahf
;jle no_1_
 
;no_1_:
 
mov [Message],dword 3
push Message
push Parend
call [send_message]
 
mcall 5,1
 
mcall 11
 
;check for redraw window
cmp eax,1
jne no_window
 
call draw_window
 
mov [Message],dword 1
push Message
push Parend
call [send_message]
 
jmp still
no_window:
 
;check for keys events
cmp eax,2
jne no_keys
 
mcall 2
shr eax,8
 
mov [Message],dword 2
mov [Message+4],eax
 
push Message
push Parend
call [send_message]
 
mov eax,[Message+4]
 
cmp al,27
je exit
 
jmp still
no_keys:
 
;check for pressed butons
cmp eax,3
jne no_buttons
 
mcall 17
shr eax,8
 
jmp still
no_buttons:
 
;check for mouse events
cmp eax,6
jne no_mouse
 
mov [Message],dword 6
 
mcall 37,1
mov ebx,eax
shr eax,16 ;x
and ebx,0xffff ;y
 
mov [Message+4],eax
mov [Message+8],ebx
 
mcall 37,2
mov [Message+12],eax
 
;send system events to control
push Message
push Parend
call [send_message]
 
mov eax,[PointerToControlForButtonExit]
 
xor ebx,ebx
mov bl,byte[eax+45]
cmp bl,11b
jne no_crossing_pressing_button
 
mov [button_pressed],1
 
no_crossing_pressing_button:
 
xor ebx,ebx
mov bl,byte[eax+45]
cmp bl,1b
jne no_crossing_button
 
cmp [button_pressed],1
jne no_crossing_button
 
jmp exit
 
no_crossing_button:
 
jmp still
no_mouse:
 
jmp still
 
exit:
 
push [PointerToControlForButtonExit]
call [destroy_control]
 
push [PointerToControlForProgressBar]
call [destroy_control]
 
mcall -1
 
 
 
;**********************************************
;*******************Draw window****************
;**********************************************
 
draw_window:
 
mcall 12,1
 
xor eax,eax
mov ebx,50
mov ecx,50
shl ebx,16
shl ecx,16
add ebx,200
add ecx,100
mov edx,0x03aabbcc
mov esi,0x805080d0
mov edi,0x005080d0
mcall
 
;call print_controls_information
 
mcall 12,2
ret
 
 
GetPath:
 
mov ebx,255
mov ecx,path
 
next_symvol:
mov edx,ecx
add edx,ebx
 
xor eax,eax
mov al,[edx]
cmp eax,'/'
je exit_path
 
dec ebx
jnz next_symvol
 
exit_path:
 
inc edx
mov esi,dll_name
mov edi,edx
mov ecx,10
rep movsb
 
ret
 
 
include 'getproc.asm'
 
;************************************************************
;***************************DATA*****************************
;************************************************************
 
align 4
 
dll_name db 'libGUI.obj',0
sys_libGUI_path db '/sys/lib/libGUI.obj',0
 
text1 db 'Exit',0
 
fnDestroyControl db 'DestroyControl',0
fnSendMessage db 'SendMessage',0
fnCraeteButton db 'CraeteButton',0
fnCraeteProgressbar db 'CraeteProgressbar',0
 
myexport dd 0
 
destroy_control dd 0
send_message dd 0
craete_button dd 0
 
craete_progress_bar dd 0
 
PointerToControlForButtonExit dd 0
 
PointerToControlForProgressBar dd 0
 
button_pressed dd 0
progress dd 0
progress_step dd 0
path rb 256
 
Parend: dd 0,0,0,0,0,0,0,0,0,0,0,0 ;44 bytes
Message rd 4
 
ColorsTable rd 10
 
 
struc BUTTON
{
.type db 1
.flag db 1
.x dw 1
.y dw 1
.width dw 1
.height dw 1
.image dd 1
.imageX dw 1
.imageY dw 1
.imageSizeX dw 1
.imageSizeY dw 1
.transparentColor dd 1
.text dd 1
.textX dw 1
.textY dw 1
.textcolor dd 1
.color1 dd 1
.color2 dd 1
.mouseX dw 1
.mouseY dw 1
}
 
struc PROGRESSBAR
{
.type rb 1
.flag rb 1
.color1 rd 1
.color2 rd 1
.x rd 1
.y rd 1
.sizex rd 1
.sizey rd 1
.progres rd 1
.color3 rd 1
}
 
Button1 BUTTON
ProgressBar PROGRESSBAR
i_end:
/programs/develop/libGUI/examples/scroll_bar/GETPROC.ASM
0,0 → 1,47
 
_ksys_cofflib_getproc:
 
mov ebx,[esp+4]
 
next_name_check:
 
mov ecx,[ebx]
test ecx,ecx
jz end_export
 
;cmp export string with name
mov esi,[esp+8]
xor edi,edi
next_simbol_check:
 
xor eax,eax
mov al,[ecx]
test al,al
jz exit_check_simbol
 
xor edx,edx
mov dl,[esi]
cmp al,dl
je simbols_equvalent
add edi,1
jmp exit_check_simbol
simbols_equvalent:
 
add ecx,1
add esi,1
jmp next_simbol_check
exit_check_simbol:
 
test edi,edi
jnz function_not_finded
mov eax,[ebx+4]
jmp end_export
function_not_finded:
 
add ebx,8
 
jmp next_name_check
 
end_export:
 
ret 8
/programs/develop/libGUI/examples/scroll_bar/scroller.asm
0,0 → 1,506
;
;
; This is example of using GUI component Scroller from libGUI
;
;
 
control_hader_size = 44
control_scroller_data_size = 29
control_button_data_size = 50
 
first_child_button_pressed = 1b
second_child_button_pressed = 10000b
 
 
include 'macros.inc'
use32
db 'MENUET01'
dd 1
dd start
dd i_end
dd 4000
dd 4000
dd 0
dd path
 
start:
;init hepe of memory
mcall 68,11
;set current dir as ./
call GetPath
 
;load dll
mcall 68,19,path
 
test eax,eax
jnz libGUI_loaded
 
;load dll from system directory
mcall 68,19,sys_dll_path
 
test eax,eax
jnz libGUI_loaded
 
mcall -1
 
libGUI_loaded:
 
mov [myexport],eax
 
;load dll functions
 
push fnDestroyControl
push [myexport]
call _ksys_cofflib_getproc
mov [destroy_control],eax
 
push fnSendMessage
push [myexport]
call _ksys_cofflib_getproc
mov [send_message],eax
 
push fnCraeteButton
push [myexport]
call _ksys_cofflib_getproc
mov [craete_button],eax
 
push fnCraeteScroller
push [myexport]
call _ksys_cofflib_getproc
mov [craete_scroller],eax
 
 
;set events mask
mcall 40,1100111b
 
;get standart colors table
mcall 48,3,ColorsTable,40
 
;*********************************************
;****************Init Butttons****************
;*********************************************
 
mov ecx,[ColorsTable+8]
and ecx,0xffffff
 
mov [ButtonExit.type],byte 10010001b
mov [ButtonExit.x],90
mov [ButtonExit.y],160
mov [ButtonExit.width],word 70
mov [ButtonExit.height],word 20
mov [ButtonExit.color1],dword ecx
mov [ButtonExit.color2],dword 0xffffff
mov [ButtonExit.text],text
 
 
push ButtonExit
push Parend
call [craete_button]
mov [PointerToControlForButtonExit],eax
 
mov ecx,[ColorsTable+8]
and ecx,0xffffff
 
;********************************************
;***************Init scrollers****************
;********************************************
 
;init vertical scroller
mov ecx,[ColorsTable+8]
mov [VerticalScroller.type],byte 11100001b
mov [VerticalScroller.x],10
mov [VerticalScroller.y],30
mov [VerticalScroller.pos],0.2
mov [VerticalScroller.length],200
mov [VerticalScroller.size],0.9
mov [VerticalScroller.color1],ecx
 
 
push VerticalScroller
push Parend
call [craete_scroller]
mov [PointerToControlForVerticalScroller],eax
 
;init horizontal scroller
mov ecx,[ColorsTable+8]
mov [HorizontalScroller.type],byte 11110010b
mov [HorizontalScroller.x],30
mov [HorizontalScroller.y],30
mov [HorizontalScroller.pos],0.7
mov [HorizontalScroller.length],200
mov [HorizontalScroller.size],0.3
mov [HorizontalScroller.color1],0xaabbccff;ecx
 
push HorizontalScroller
push Parend
call [craete_scroller]
mov [PointerToControlForHorizontalScroller],eax
 
call draw_window
 
;send message 1 for redrawing ALL controls
mov [Message],dword 1
 
push Message
push Parend
call [send_message]
 
still:
mcall 10
 
mov [SystemEvent],eax
 
;-----------------------
;check for redraw window
;-----------------------
 
cmp eax,1
jne no_window
 
call draw_window
 
mov [Message],dword 1
 
push Message
push Parend
call [send_message]
 
jmp still
no_window:
 
;---------------------
;check for keys events
;---------------------
 
cmp eax,2
jne no_keys
 
mcall 2
shr eax,8
 
mov [Message],dword 2
mov [Message+4],eax
 
push Message
push Parend
call [send_message]
 
mov eax,[Message+4]
 
cmp al,27
je exit
 
jmp still
no_keys:
 
;-------------------------
;check for events of mouse
;-------------------------
 
cmp eax,3
jne no_button_close_window
 
 
mcall 17
shr eax,8
 
jmp still
no_button_close_window:
 
;check for mouse events
cmp eax,6
jne no_mouse
 
;craete message of mouse for controls
mov [Message],dword 6
 
mcall 37,1
mov ebx,eax
shr eax,16 ;x
and ebx,0xffff ;y
 
mov [Message+4],eax
mov [Message+8],ebx
 
mcall 37,2
mov [Message+12],eax
 
;send message to controls
push Message
push Parend
call [send_message]
 
;interraction with button exit
;copy data of scroller of button from control to structure
 
mov esi,[PointerToControlForButtonExit]
add esi,control_hader_size
mov edi,ButtonExit
mov ecx,control_button_data_size
rep movsb
 
xor eax,eax
mov al,[ButtonExit.flag]
 
;check button for pressing
and al,10b
test al,al
jz button_3_not_pressed
 
mov [button_pressed],1
 
jmp no_pressed_button
 
button_3_not_pressed:
 
cmp [button_pressed],1
jne no_pressed_button
 
jmp exit
no_pressed_button:
 
;interraction with vertical scroller
 
;copy data of vertical scroller from control to structure
 
mov esi,[PointerToControlForVerticalScroller]
add esi,control_hader_size
mov edi,VerticalScroller
mov ecx,control_scroller_data_size
rep movsb
 
mov eax,[VerticalScroller.pos]
mov [PosY_float],eax ;position of scroll bar from 0...1
 
xor edx,edx
call DrawRectangle
 
xor eax,eax
mov ax,[VerticalScroller.buttons_flags]
and ax,first_child_button_pressed
test ax,ax
jz vertical_first_child_button_not_pressed
 
mov edx,0xff00
call DrawRectangle
 
vertical_first_child_button_not_pressed:
 
 
xor eax,eax
mov ax,[VerticalScroller.buttons_flags]
and ax,second_child_button_pressed
test ax,ax
jz vertical_second_child_button_not_pressed
 
mov edx,0xff
call DrawRectangle
 
vertical_second_child_button_not_pressed:
 
;interraction with horizontal scroller
 
;copy data of horizontal scroller from control to structure
 
mov esi,[PointerToControlForHorizontalScroller]
add esi,control_hader_size
mov edi,HorizontalScroller
mov ecx,control_scroller_data_size
rep movsb
 
xor eax,eax
mov ax,[HorizontalScroller.buttons_flags]
and ax,first_child_button_pressed
test ax,ax
jz horizontal_first_child_button_not_pressed
 
mov edx,0xffffff
call DrawRectangle
 
horizontal_first_child_button_not_pressed:
 
xor eax,eax
mov ax,[HorizontalScroller.buttons_flags]
and ax,second_child_button_pressed
test ax,ax
jz horizontal_second_child_button_not_pressed
 
mov edx,0xff0000
call DrawRectangle
 
horizontal_second_child_button_not_pressed:
 
jmp still
no_mouse:
 
jmp still
 
exit:
 
;free resourses
push [PointerToControlForVerticalScroller]
call [destroy_control]
 
push [PointerToControlForHorizontalScroller]
call [destroy_control]
 
push [PointerToControlForButtonExit]
call [destroy_control]
 
mcall -1
 
;**********************************************
;*******************Draw window****************
;**********************************************
 
draw_window:
 
mcall 12,1
 
xor eax,eax
mov ebx,50
mov ecx,50
shl ebx,16
shl ecx,16
add ebx,280
add ecx,280
mov edx,0x03aabbcc
mov esi,0x805080d0
mov edi,0x005080d0
mcall
 
mcall 12,2
ret
 
 
GetPath:
 
mov ebx,255
mov ecx,path
 
next_symvol:
mov edx,ecx
add edx,ebx
 
xor eax,eax
mov al,[edx]
cmp eax,'/'
je exit_path
 
dec ebx
jnz next_symvol
 
exit_path:
 
inc edx
mov esi,dll_name
mov edi,edx
mov ecx,10
rep movsb
 
ret
 
DrawRectangle:
 
mov eax,13
mov ebx,100*65536+50
mov ecx,100*65536+50
int 0x40
 
ret
 
include 'getproc.asm'
 
;************************************************************
;***************************DATA*****************************
;************************************************************
 
align 4
 
dll_name db 'libGUI.obj',0
sys_dll_path db '/sys/lib/libGUI.obj',0
 
text db 'Exit',0
 
fnDestroyControl db 'DestroyControl',0
fnSendMessage db 'SendMessage',0
fnCraeteButton db 'CraeteButton',0
fnCraeteScroller db 'CraeteScroller',0
 
myexport dd 0
 
destroy_control dd 0
send_message dd 0
craete_button dd 0
craete_scroller dd 0
 
PointerToControlForButtonExit dd 0
 
PointerToControlForHorizontalScroller dd 0
PointerToControlForVerticalScroller dd 0
 
 
SystemEvent dd 0
 
PosX_float dd 0
PosY_float dd 0
 
 
button_pressed dd 0
 
IPC_table rd 256
path rb 256
ColorsTable rd 10
 
Parend: dd 0,0,0,0,0,0,0,0,0,0,0,0 ;44 bytes
Message rd 4
x dd 0
y dd 0
number dd 0
 
struc BUTTON
{
.type db 1
.flag db 1
.x dw 1
.y dw 1
.width dw 1
.height dw 1
.image dd 1
.imageX dw 1
.imageY dw 1
.imageSizeX dw 1
.imageSizeY dw 1
.transparentColor dd 1
.text dd 1
.textX dw 1
.textY dw 1
.textcolor dd 1
.color1 dd 1
.color2 dd 1
.mouseX dw 1
.mouseY dw 1
}
 
struc SCROLLER
{
.type rb 1
.x rw 1
.y rw 1
.length rw 1
.color1 rd 1
.size rd 1
.pos rd 1
.buttons_flags rw 1
.ChildButton1 rd 1
.ChildButton2 rd 1
.mouseX rw 1
.mouseY rw 1
}
 
ButtonExit BUTTON
VerticalScroller SCROLLER
HorizontalScroller SCROLLER
 
 
i_end:
/programs/develop/libGUI/examples/text/GETPROC.ASM
0,0 → 1,47
 
_ksys_cofflib_getproc:
 
mov ebx,[esp+4]
 
next_name_check:
 
mov ecx,[ebx]
test ecx,ecx
jz end_export
 
;cmp export string with name
mov esi,[esp+8]
xor edi,edi
next_simbol_check:
 
xor eax,eax
mov al,[ecx]
test al,al
jz exit_check_simbol
 
xor edx,edx
mov dl,[esi]
cmp al,dl
je simbols_equvalent
add edi,1
jmp exit_check_simbol
simbols_equvalent:
 
add ecx,1
add esi,1
jmp next_simbol_check
exit_check_simbol:
 
test edi,edi
jnz function_not_finded
mov eax,[ebx+4]
jmp end_export
function_not_finded:
 
add ebx,8
 
jmp next_name_check
 
end_export:
 
ret 8
/programs/develop/libGUI/examples/text/text.asm
0,0 → 1,364
;
;
; This is example using GUI component Text from libGUI.
;
;
 
include 'macros.inc'
use32
db 'MENUET01'
dd 1
dd start
dd i_end
dd 1600
dd 1600
dd 0
dd path
 
start:
;init hepe of memory
mcall 68,11
 
;set current dir as ./
call GetPath
 
;load dll
mcall 68,19,path
 
test eax,eax
jnz libGUI_loaded
 
mcall 68,19,sys_libGUI_path
 
test eax,eax
jnz libGUI_loaded
 
mcall -1
 
libGUI_loaded:
 
mov [myexport],eax
 
;load dll functions
 
push fnDestroyControl
push [myexport]
call _ksys_cofflib_getproc
mov [destroy_control],eax
 
push fnSendMessage
push [myexport]
call _ksys_cofflib_getproc
mov [send_message],eax
 
push fnCraeteButton
push [myexport]
call _ksys_cofflib_getproc
mov [craete_button],eax
 
push fnCraeteText
push [myexport]
call _ksys_cofflib_getproc
mov [craete_text],eax
 
;set events mask
mcall 40,1100111b
 
;get standart colors table
mcall 48,3,ColorsTable,40
 
;*********************************************
;****************Init Butttons****************
;*********************************************
 
mov ecx,[ColorsTable+8]
and ecx,0xffffff
 
mov [Button1.type],byte 10010001b
mov [Button1.x],80
mov [Button1.y],50
mov [Button1.width],word 70
mov [Button1.height],word 20
mov [Button1.color1],dword ecx
mov [Button1.color2],dword 0xffffff
mov [Button1.text],text1
 
push Button1
push Parend
call [craete_button]
mov [PointerToControlForButtonExit],eax
 
mov ecx,[ColorsTable+8]
and ecx,0xffffff
 
 
;********************************************
;******************Init Text*****************
;********************************************
 
mov [Text.type],byte 10000000b
mov [Text.color],0xffffff
mov [Text.x],5
mov [Text.y],10
mov [Text.length],36
mov [Text.pointer],text_for_text
 
 
push Text
push Parend
call [craete_text]
mov [PointerToControlForText],eax
 
call draw_window
 
 
;send message 1 for redrawing ALL controls
mov [Message],dword 1
 
push Message
push Parend
call [send_message]
 
still:
mcall 10
 
;check for redraw window
cmp eax,1
jne no_window
 
call draw_window
 
mov [Message],dword 1
push Message
push Parend
call [send_message]
 
jmp still
no_window:
 
;check for keys events
cmp eax,2
jne no_keys
 
mcall 2
shr eax,8
 
mov [Message],dword 2
mov [Message+4],eax
 
push Message
push Parend
call [send_message]
 
mov eax,[Message+4]
 
cmp al,27
je exit
 
jmp still
no_keys:
 
;check for pressed butons
cmp eax,3
jne no_buttons
 
mcall 17
shr eax,8
 
jmp still
no_buttons:
 
;check for mouse events
cmp eax,6
jne no_mouse
 
mov [Message],dword 6
 
mcall 37,1
mov ebx,eax
shr eax,16 ;x
and ebx,0xffff ;y
 
mov [Message+4],eax
mov [Message+8],ebx
 
mcall 37,2
mov [Message+12],eax
 
;send system events to control
push Message
push Parend
call [send_message]
 
mov eax,[PointerToControlForButtonExit]
 
xor ebx,ebx
mov bl,byte[eax+45]
cmp bl,11b
jne no_crossing_pressing_button
 
mov [button_pressed],1
 
no_crossing_pressing_button:
 
xor ebx,ebx
mov bl,byte[eax+45]
cmp bl,1b
jne no_crossing_button
 
cmp [button_pressed],1
jne no_crossing_button
 
jmp exit
 
no_crossing_button:
 
jmp still
no_mouse:
 
jmp still
 
exit:
 
push [PointerToControlForButtonExit]
call [destroy_control]
 
push [PointerToControlForText]
call [destroy_control]
 
mcall -1
 
 
;**********************************************
;*******************Draw window****************
;**********************************************
 
draw_window:
 
mcall 12,1
 
xor eax,eax
mov ebx,50
mov ecx,50
shl ebx,16
shl ecx,16
add ebx,250
add ecx,100
mov edx,0x03aabbcc
mov esi,0x805080d0
mov edi,0x005080d0
mcall
 
;call print_controls_information
 
mcall 12,2
ret
 
 
GetPath:
 
mov ebx,255
mov ecx,path
 
next_symvol:
mov edx,ecx
add edx,ebx
 
xor eax,eax
mov al,[edx]
cmp eax,'/'
je exit_path
 
dec ebx
jnz next_symvol
 
exit_path:
 
inc edx
mov esi,dll_name
mov edi,edx
mov ecx,10
rep movsb
 
ret
 
include 'getproc.asm'
 
;************************************************************
;***************************DATA*****************************
;************************************************************
 
align 4
 
dll_name db 'libGUI.obj',0
sys_libGUI_path db '/sys/lib/libGUI.obj',0
 
text1 db 'Exit',0
 
text_for_text db 'Example of using GUI component text.',0
 
fnDestroyControl db 'DestroyControl',0
fnSendMessage db 'SendMessage',0
fnCraeteButton db 'CraeteButton',0
fnCraeteText db 'CraeteText',0
 
myexport dd 0
 
destroy_control dd 0
send_message dd 0
craete_button dd 0
craete_text dd 0
 
PointerToControlForButtonExit dd 0
 
PointerToControlForText dd 0
 
button_pressed dd 0
 
 
path rb 256
 
Parend: dd 0,0,0,0,0,0,0,0,0,0,0,0 ;44 bytes
Message rd 4
 
ColorsTable rd 10
 
struc BUTTON
{
.type db 1
.flag db 1
.x dw 1
.y dw 1
.width dw 1
.height dw 1
.image dd 1
.imageX dw 1
.imageY dw 1
.imageSizeX dw 1
.imageSizeY dw 1
.transparentColor dd 1
.text dd 1
.textX dw 1
.textY dw 1
.textcolor dd 1
.color1 dd 1
.color2 dd 1
.mouseX dw 1
.mouseY dw 1
}
 
struc TEXT
{
.type rb 1
.flag rb 1
.color rd 1
.x rd 1
.y rd 1
.length rd 1
.pointer rd 1
}
 
Button1 BUTTON
Text TEXT
 
i_end:
/programs/develop/libGUI/install.txt
0,0 → 1,29
RUSSIAN
 
Åñòü íåñêîëüêî ñïîñîáîâ óñòàíîâèòü libGUI.
 
1) Óñòàíîâêà èç KolibriOS.
 
Çàãðóçèòå KolibriOS. Ïðè ïîìîùè ôàéëîâîãî ìåíåäæåðà (KFAR èëè KFM íà âàø âûáîð) çàéäèòå â äèðåêòîðèþ /rd/1/lib/ è ñêîïèðóéòå òóäà libGUI.obj
Çàïóñòèòå ïðîãðàììó RDSAVE. Åñëè âû çàãðóçèëèñü ñ æ¸ñòêîãî äèñêà, òî ñîõðàíèòå îáðàç íà æ¸ñòêèé äèñê. Ïî óìîë÷àíèþ ïîäðàçóìåâàåòñÿ, ÷òî Âû
çàãðóçèëè KolibriOS èç äèðåêòîðèè /hdx/1/kolibri/ , ãäå x çàâèñèò îò òîãî, íà êàêîì IDE ðàçú¸ìå íàõîäèòüñÿ âàø æ¸ñòêèé äèñê. Çíà÷åíèå x âû ìîæåòå
ïîñìîòðåòü â ôàéëîâîì ìåíåäæåðå.Åñëè âû çàãðóçèëèñü ñ floppy äèñêà, òî íàæìèòå ñîîòâåòñòâóþùóþ êíîïêó.
Âñ¸, óñòàíîâêà çàêîí÷åíà!
 
2)Îòêðîéòå îáðàç KOLIBRI.IMG ,Ýòî ìîæíî ñäåëàòü ïðè ïîìîùè ïðîãðàììû WinImage èëè êàêîé ëèáî äðóãîé ïðîãðàììû, ðàáîòàþùåé ñ img îáðàçàìè.
Çàéäèòå â îáðàçå â ïàïêó lib è ñêîïèðóéòå òóäà libGUI.obj . Ñîõðàíèòå îáðàç.
 
ENGLISH
 
There are some ways to establish libGUI.
 
1) Installation from KolibriOS.
 
Load KolibriOS. By means of the file manager (KFAR or KFM on your choice) go in a directory/rd/1/lib/and copy there libGUI.obj
Start program RDSAVE. If you were loaded from a hard disk keep an image on a hard disk. By default it is meant, that you
Have loaded KolibriOS from a directory/hdx/1/kolibri/where x depends on on what IDE a socket to be your hard disk. Value x you can
To look in the file manager. If you were loaded with floppy a disk press the appropriate button.
Everything, installation is completed!
 
2) Open image KOLIBRI.IMG, It can be made by means of program WinImage or what or other program working with img in the images.
Go in an image in a folder lib and copy there libGUI.obj. Keep an image.
/programs/develop/libGUI/src/VERSION.INC
0,0 → 1,16
;****************************************************
;****************get version of library**************
;****************************************************
;IN
;not
;OUT
;version of library
;fersion format year:mouth:day
align 4
 
get_version:
 
xor eax,eax
mov eax,dword 071014 ;07.10.13
 
ret
/programs/develop/libGUI/src/bookmark.inc
0,0 → 1,1647
 
zk_redraw_all_Bookmark = 1000000b
zk_redraw_all_Bookmark_off = 10111111b
zk_init_Bookmark = 10000000b
zk_init_Bookmark_off = 01111111b
zk_child_button_type = 10001001b
 
;****************************************************
;******************craete Bookmark********************
;****************************************************
;IN
;pointer to parend
;pointer to Bookmark's structure
;OUT
;pointer to initialized Bookmark's structure
align 4
 
craete_Bookmark:
 
mov ebx,[esp+4]
mov eax,[esp+8]
 
mov [PointerToStructureForBookmark],eax
mov [ParendForBookmark],ebx
 
mov ebx,eax
 
;calculate size of memory for control
 
;number of strings
mov ecx,[ebx+30]
add ebx,30+4
xor edx,edx
;calculate total number of Bookmarks
next_string_add:
 
add edx,[ebx]
add ebx,4
 
dec ecx
jnz next_string_add
;edx=chislo zakladok
mov [ChisloZakladok],edx
 
;save addres
mov edi,ebx
 
xor esi,esi
next_Bookmark_calculate:
 
;total number of controls on Bookmark
mov ecx,[ebx+4]
shl ecx,3
add esi,ecx
 
add ebx,8
add ebx,ecx
 
dec edx
jnz next_Bookmark_calculate
 
mov ecx,ebx
sub ebx,eax
mov eax,ebx
add eax,control_header_size+(44*4)
 
;eax= size of memory for control
push ebx
push edi
 
mov ebx,[ParendForBookmark]
call craete_control
 
pop edi
pop ebx
 
 
;set all button's parameters in control
mov [eax],dword Bookmark_
 
push edi
 
mov ecx,ebx
mov esi,[PointerToStructureForBookmark]
mov edi,eax
add edi,control_header_size
rep movsb
 
pop edi
 
mov [eax+control_header_size+22],ebx
 
;craete child controls for parend(Bookmark)
 
call get_skin_height
 
;set coordinats and size of control
mov ebx,[PointerToStructureForBookmark]
mov ecx,[ebx+2] ;x
mov edx,[ebx+6] ;y
mov esi,[ebx+10] ;size x
mov edi,[ebx+14] ;size y
add ecx,border_width
add edx,[skin_height]
;mov [ebx+2],ecx
;mov [ebx+6],edx
;copy information to control
mov [eax+24],ecx
mov [eax+28],edx
mov [eax+32],esi
mov [eax+36],edi
 
;load addres
mov ebx,eax
add ebx,control_header_size
mov edx,[ebx+30]
mov ecx,edx
mov esi,[ChisloZakladok]
mov [Bookmark.counter1],esi
;sizex*17
shl ecx,4
add ecx,edx
mov [Bookmark.sizey],ecx
 
mov ecx,edx
shl ecx,2
 
add ebx,30+4
add ebx,ecx ;pointer to information for first Bookmark
 
next_Bookmark_craete_childs:
 
;total number of controls on Bookmark
mov ecx,[ebx+4]
mov [Bookmark.counter2],ecx
add ebx,8
 
test ecx,ecx
jz no_controls_for_current_Bookmark
 
next_child_for_Bookmark:
 
;is child button ?
cmp [ebx],dword 1
jnz no_child_button_for_Bookmark
 
mov esi,eax ;parend
mov edi,[ebx+4] ;information for child
 
push eax
push ebx
 
push edi
push esi
 
call craete_button
 
mov esi,eax
 
pop ebx
pop eax
 
;save addres of new control
mov [ebx+4],esi
 
mov edi,[eax+24]
sub edi,border_width
add [esi+24],edi
mov edi,[eax+28]
sub edi,[skin_height]
add edi,[Bookmark.sizey]
add [esi+28],edi
jmp exit_child_for_Bookmark
no_child_button_for_Bookmark:
 
;is child scroler ?
cmp [ebx],dword 2
jnz no_child_scroler_for_Bookmark
 
mov esi,eax ;parend
mov edi,[ebx+4] ;information for child
 
push eax
push ebx
 
push edi
push esi
 
call craete_scroller
 
mov esi,eax
 
pop ebx
pop eax
 
mov [ebx+4],esi
 
mov edi,[eax+24]
sub edi,border_width
add [esi+24],edi
mov edi,[eax+28]
sub edi,[skin_height]
add edi,[Bookmark.sizey]
add [esi+28],edi
jmp exit_child_for_Bookmark
no_child_scroler_for_Bookmark:
 
 
;is child image ?
cmp [ebx],dword 4
jnz no_child_image_for_Bookmark
 
mov esi,eax ;parend
mov edi,[ebx+4] ;information for child
 
push eax
push ebx
 
push edi
push esi
 
call craete_image
 
mov esi,eax
 
pop ebx
pop eax
 
mov [ebx+4],esi
 
mov edi,[eax+24]
sub edi,border_width
add [esi+24],edi
mov edi,[eax+28]
sub edi,[skin_height]
add edi,[Bookmark.sizey]
add [esi+28],edi
jmp exit_child_for_Bookmark
 
no_child_image_for_Bookmark:
 
;is child text ?
cmp [ebx],dword 5
jnz no_child_text_for_Bookmark
 
mov esi,eax ;parend
mov edi,[ebx+4] ;information for child
 
push eax
push ebx
 
push edi
push esi
 
call craete_text
 
mov esi,eax
 
pop ebx
pop eax
 
mov [ebx+4],esi
 
mov edi,[eax+24]
sub edi,border_width
add [esi+24],edi
mov edi,[eax+28]
sub edi,[skin_height]
add edi,[Bookmark.sizey]
add [esi+28],edi
jmp exit_child_for_Bookmark
 
no_child_text_for_Bookmark:
 
;is child number ?
cmp [ebx],dword 6
jnz no_child_number_for_Bookmark
 
mov esi,eax ;parend
mov edi,[ebx+4] ;information for child
 
push eax
push ebx
 
push edi
push esi
 
call craete_number
 
mov esi,eax
 
pop ebx
pop eax
 
mov [ebx+4],esi
 
mov edi,[eax+24]
sub edi,border_width
add [esi+24],edi
mov edi,[eax+28]
sub edi,[skin_height]
add edi,[Bookmark.sizey]
add [esi+28],edi
jmp exit_child_for_Bookmark
 
no_child_number_for_Bookmark:
 
;is child CheckBox ?
cmp [ebx],dword 7
jnz no_child_check_box_for_Bookmark
 
mov esi,eax ;parend
mov edi,[ebx+4] ;information for child
 
push eax
push ebx
 
push edi
push esi
 
call craete_check_box
 
mov esi,eax
 
pop ebx
pop eax
 
mov [ebx+4],esi
 
mov edi,[eax+24]
sub edi,border_width
add [esi+24],edi
mov edi,[eax+28]
sub edi,[skin_height]
add edi,[Bookmark.sizey]
add [esi+28],edi
jmp exit_child_for_Bookmark
 
no_child_check_box_for_Bookmark:
 
;is child EditBox ?
cmp [ebx],dword 8
jnz no_child_edit_box_for_Bookmark
 
mov esi,eax ;parend
mov edi,[ebx+4] ;information for child
 
push eax
push ebx
 
push edi
push esi
 
call craete_edit_box
 
mov esi,eax
 
pop ebx
pop eax
 
mov [ebx+4],esi
 
mov edi,[eax+24]
sub edi,border_width
add [esi+24],edi
mov edi,[eax+28]
sub edi,[skin_height]
add edi,[Bookmark.sizey]
add [esi+28],edi
jmp exit_child_for_Bookmark
 
no_child_edit_box_for_Bookmark:
 
;is child ProgresBar ?
cmp [ebx],dword 9
jnz no_child_progres_bar_for_Bookmark
 
mov esi,eax ;parend
mov edi,[ebx+4] ;information for child
 
push eax
push ebx
 
push edi
push esi
 
call craete_progress_bar
 
mov esi,eax
 
pop ebx
pop eax
 
mov [ebx+4],esi
 
mov edi,[eax+24]
sub edi,border_width
add [esi+24],edi
mov edi,[eax+28]
sub edi,[skin_height]
add edi,[Bookmark.sizey]
add [esi+28],edi
jmp exit_child_for_Bookmark
 
no_child_progres_bar_for_Bookmark:
 
exit_child_for_Bookmark:
 
add ebx,8
 
dec [Bookmark.counter2]
jnz next_child_for_Bookmark
 
no_controls_for_current_Bookmark:
 
dec [Bookmark.counter1]
jnz next_Bookmark_craete_childs
 
ret 8
 
;****************************************************
;******************Draw Bookmark*********************
;****************************************************
;IN
;pointer to control of Bookmark
;message
;OUT
;not returned value
align 4
 
Bookmark_:
 
;get message
mov eax,[esp+8]
 
;get pointer to control of Bookmark
mov esi,[esp+4]
mov [PointerForBookmark],esi
 
push esi
mov ebx,[esi+control_header_size+22] ;size of data's structure
mov edi,dword Bookmark
mov ecx,(43*4)+2+4
add esi,control_header_size
add esi,ebx
rep movsb
pop esi
 
cmp [eax],dword 1
jne no_redraw_all_Bookmark
 
or [esi+control_header_size],byte zk_redraw_all_Bookmark
no_redraw_all_Bookmark:
 
cmp [eax],dword 6
jne no_mouse_Bookmark
 
mov esi,[eax+4]
mov edi,[eax+8]
mov ecx,[eax+12]
mov [Bookmark.MouseX],esi
mov [Bookmark.MouseY],edi
mov [ButtonsOfMouse],ecx
no_mouse_Bookmark:
 
;save message for child buttons
mov esi,eax
mov edi,dword Bookmark.MessageForChildButton
mov ecx,4
rep movsd
 
;no_mouse_Bookmark:
 
 
;load coordinats and size from control
mov eax,[PointerForBookmark]
mov ebx,[eax+24] ;x
mov ecx,[eax+28] ;y
mov edx,[eax+32] ;size x
mov esi,[eax+36] ;size y
mov edi,[eax+control_header_size+18] ;color1
 
;set current coordinats and sizes in Bookmark
mov [Bookmark.x],ebx
mov [Bookmark.y],ecx
mov [Bookmark.sizex],edx
mov [Bookmark.sizey],esi
mov [Bookmark.color1],edi
 
mov ebx,[PointerForBookmark]
add ebx,control_header_size
xor eax,eax
mov al,[ebx]
and al,zk_init_Bookmark
test al,al
jz no_redraw_Bookmark
 
and [ebx],byte zk_init_Bookmark_off
 
;generate colors tables
 
mov eax,[Bookmark.color1]
mov ebx,0xffffff
mov ecx,20
mov edx,dword colors_table1
call gradient
 
xor eax,eax
mov ebx,[Bookmark.color1]
mov ecx,20
mov edx,dword colors_table2
call gradient
 
;get memory for child buttons of Bookmark
mov eax,50*4
call malloc
mov [Bookmark.ChildButtonsForBookmark],eax
 
mov ebx,[PointerForBookmark]
add ebx,control_header_size
mov ecx,[ebx+30]
mov edx,ecx
add ebx,30+4
shl edx,2
mov esi,ebx
add esi,edx ;esi= pointer to information for first child
mov [Bookmark.PointerToTextForBookmark],esi
 
mov edi,[Bookmark.y]
mov [Bookmark.BookmarkY],edi
 
mov edi,[Bookmark.sizex]
sub edi,3
mov [Bookmark.FullBookmarkSizeX],edi
mov [Bookmark.ChisloStrokeZakladok],ecx
 
and [Bookmark.CounterChildButtons],0
 
;craete child buttons for Bookmarks
 
next_string_of_Bookmarks:
 
mov edi,[Bookmark.x]
add edi,2
mov [Bookmark.BookmarkX],edi
mov [Bookmark.WorkPlace_windowx],edi
 
;total number of Bookmarks in string
 
mov edx,[ebx]
mov edi,edx
mov [Bookmark.NumberBookmarksInEndString],edx
 
push eax
mov eax,[Bookmark.ChildButtonsForBookmark]
add eax,[Bookmark.CounterChildButtons]
mov [Bookmark.PointerToEndBookmarks],eax
pop eax
 
;calculate size of Bookmark
;size=(full_size/number_zakladok)
push eax
push edx
 
mov eax,[Bookmark.FullBookmarkSizeX]
cdq
idiv edi
 
mov [Bookmark.BookmarkSizeX],eax
mov [Bookmark.WorkPlace_windowsizex],eax
 
imul eax,edi
mov edx,[Bookmark.FullBookmarkSizeX]
sub edx,eax
mov [Bookmark.DefectSizeX],edx
 
pop edx
pop eax
 
next_child_button_craete_for_string:
 
cmp edx,1
jne no_disactivate_defect_size_x
 
mov esi,[Bookmark.DefectSizeX]
add [Bookmark.BookmarkSizeX],esi
no_disactivate_defect_size_x:
 
 
;craete control button for Bookmark
;load info to structure
mov esi,[PointerForBookmark]
add esi,control_header_size+26
mov edi,[esi]
mov [ChildButton.type],zk_child_button_type
mov [ChildButton.textcolor],edi
 
mov esi,[Bookmark.BookmarkX]
mov edi,[Bookmark.BookmarkY]
sub esi,border_width
sub edi,[skin_height]
mov [ChildButton.x],si
mov [ChildButton.y],di
mov esi,[Bookmark.BookmarkSizeX]
mov [ChildButton.width],si
mov [ChildButton.height],word 16
 
mov esi,[Bookmark.PointerToTextForBookmark]
mov edi,[esi]
mov [ChildButton.text],edi
 
;save child controls for this child button
mov edi,[Bookmark.ChildButtonsForBookmark]
add edi,[Bookmark.CounterChildButtons]
add edi,4
mov [edi],esi
 
;calculate new pointer for text of zakldka
;get total number of controls for current Bookmark
mov edi,[esi+4]
shl edi,3
add esi,edi
add esi,8
mov [Bookmark.PointerToTextForBookmark],esi
 
pushad
 
push ChildButton
push [PointerForBookmark]
call craete_button
 
;save control of child button
mov esi,eax
mov edi,[Bookmark.ChildButtonsForBookmark]
add edi,[Bookmark.CounterChildButtons]
mov [edi],esi
 
call DrawBookmark
 
;load obrabotchik for child button
mov edi,[Bookmark.ChildButtonsForBookmark]
add edi,[Bookmark.CounterChildButtons]
mov esi,[edi]
 
mov [Bookmark.MessageForChildButton],dword 1
push Bookmark.MessageForChildButton
push esi
call button
 
add [Bookmark.CounterChildButtons],8
popad
 
mov esi,[Bookmark.BookmarkSizeX]
add [Bookmark.BookmarkX],esi
 
dec edx
jnz next_child_button_craete_for_string
 
add ebx,4
add [Bookmark.BookmarkY],17 ;Bookmark size y
 
dec ecx
jnz next_string_of_Bookmarks
 
;calculate chislo zakladok
mov eax,[Bookmark.CounterChildButtons]
shr eax,3
mov [Bookmark.ChisloZakladok],eax
 
;draw work place for Bookmark
mov ebx,[Bookmark.ChisloStrokeZakladok] ;chislo strok
mov ecx,[Bookmark.x] ;x for Bookmark work place
shl ebx,4
mov edx,ebx
add ebx,[Bookmark.y] ;y for Bookmark work place
add ebx,[Bookmark.ChisloStrokeZakladok]
mov esi,[Bookmark.sizey] ;size y
mov edi,[Bookmark.sizex] ;size x
sub esi,edx ;size x Bookmark work place
sub esi,1
 
mov [Bookmark.WorkPlace_x],ecx
mov [Bookmark.WorkPlace_y],ebx
mov [Bookmark.WorkPlace_sizex],edi
mov [Bookmark.WorkPlace_sizey],esi
 
call DrawBookmarkWorkPlace
 
mov edi,1
mov [Bookmark.NumberActiveControl],edi
 
call SendMessageChildControlsOfBookmark
 
jmp exit_Bookmark
no_redraw_Bookmark:
 
 
 
;check crosing arrea of child buttons
mov eax,[Bookmark.x]
mov ebx,[Bookmark.y]
mov ecx,[Bookmark.sizex]
mov edx,[Bookmark.ChisloStrokeZakladok]
shl edx,4
mov esi,[Bookmark.MouseX]
mov edi,[Bookmark.MouseY]
 
call CheckCrossingBox
 
cmp eax,0xffffff
jne no_crosing_child_buttons_Bookmark
 
mov eax,[PointerForBookmark]
mov ecx,[eax+control_header_size+30] ;chislo zakladok in stroke
add eax,control_header_size+30+4
 
and [Bookmark.CounterChildButtons],0
mov [Bookmark.BookmarkFlag],0
 
next_stroke_Bookmark_check_crossing:
 
mov edx,[eax] ;number zakladok in string
mov [Bookmark.NumberBookmarksInActiveString],edx
 
mov esi,[Bookmark.ChildButtonsForBookmark]
add esi,[Bookmark.CounterChildButtons]
mov [Bookmark.PointerToActiveBookmarks],esi
 
next_Bookmark_in_string_check:
 
pushad
 
mov eax,[Bookmark.ChildButtonsForBookmark]
add eax,[Bookmark.CounterChildButtons]
mov ebx,[eax]
mov [Bookmark.ChildControlForBookmark],ebx
 
push Bookmark.MessageForChildButton
push ebx
call button
 
add [Bookmark.CounterChildButtons],8
popad
 
mov esi,[Bookmark.ChildControlForBookmark]
xor ebx,ebx
mov bl,byte[esi+control_header_size+1]
and bl,1b
cmp bl,1b
jne no_crossing_Bookmark___
 
cmp [ButtonsOfMouse],1
jne no_crossing_Bookmark___
 
mov [Bookmark.BookmarkFlag],byte 1
jmp exit_check_crossing_with_Bookmark
 
no_crossing_Bookmark___:
 
dec edx
jnz next_Bookmark_in_string_check
 
add eax,4
 
dec ecx
jnz next_stroke_Bookmark_check_crossing
 
exit_check_crossing_with_Bookmark:
 
 
cmp [Bookmark.BookmarkFlag],1
jne no_crosing_with_Bookmarks
 
mov [Bookmark.BookmarkFlag],byte 0
 
mov eax,[Bookmark.PointerToEndBookmarks]
mov ebx,[eax]
mov ecx,[ebx+28] ;y for string of end Bookmarks
 
mov edx,[Bookmark.PointerToActiveBookmarks]
mov esi,[edx]
mov edi,[esi+28] ;y for string of active Bookmarks
 
cmp ecx,edi
je no_change_Y_coordinats_in_Bookmarks
 
mov [Bookmark.y_end_stroke],ecx
mov [y],edi ;save y coordinate of active Bookmark
 
mov eax,[Bookmark.PointerToActiveBookmarks]
mov ecx,[Bookmark.NumberBookmarksInActiveString]
;y_active_string=y_end_string
next_Bookmark_change_y_active:
 
mov edx,[Bookmark.y_end_stroke]
mov ebx,[eax] ;ebx = pointer to Bookmark
mov [ebx+28],edx
 
add eax,8
 
dec ecx
jnz next_Bookmark_change_y_active
 
mov eax,[Bookmark.PointerToEndBookmarks]
mov ecx,[Bookmark.NumberBookmarksInEndString]
;y_end_string=y_active_string
next_Bookmark_change_y_end:
 
mov edx,[y]
mov ebx,[eax]
mov [ebx+28],edx
 
add eax,8
 
dec ecx
jnz next_Bookmark_change_y_end
 
mov eax,[Bookmark.PointerToActiveBookmarks]
mov ebx,[Bookmark.PointerToEndBookmarks]
mov ecx,[Bookmark.NumberBookmarksInActiveString]
mov edx,[Bookmark.NumberBookmarksInEndString]
 
mov esi,eax
mov edi,ecx
 
mov [Bookmark.PointerToActiveBookmarks],ebx
mov [Bookmark.NumberBookmarksInActiveString],edx
 
mov [Bookmark.PointerToEndBookmarks],esi
mov [Bookmark.NumberBookmarksInEndString],edi
 
no_change_Y_coordinats_in_Bookmarks:
 
mov eax,[Bookmark.ChildButtonsForBookmark]
mov ecx,[Bookmark.ChisloZakladok]
mov [Bookmark.MessageForChildButton],dword 1
next_Bookmark_redraw:
 
mov ebx,[eax]
mov edx,[ebx+24] ;x
mov esi,[ebx+28] ;y
mov edi,[ebx+32] ;size x
mov [Bookmark.BookmarkX],edx
mov [Bookmark.BookmarkY],esi
mov [Bookmark.BookmarkSizeX],edi
mov [Bookmark.ControlAddres],ebx
 
pushad
 
call DrawBookmark
 
;mov [Bookmark.MessageForChildButton],dword 1
push Bookmark.MessageForChildButton
push [Bookmark.ControlAddres]
call button
 
popad
 
add eax,8
dec ecx
jnz next_Bookmark_redraw
 
 
mov eax,[Bookmark.ChildControlForBookmark]
mov ebx,[eax+24] ;x coordinat of Bookmark
mov ecx,[eax+32] ;size x of Bookmark
mov [Bookmark.WorkPlace_windowx],ebx
mov [Bookmark.WorkPlace_windowsizex],ecx
 
;draw work place for Bookmark
mov ebx,[Bookmark.ChisloStrokeZakladok] ;chislo strok
mov ecx,[Bookmark.x] ;x for Bookmark work place
shl ebx,4
mov edx,ebx
add ebx,[Bookmark.y] ;y for Bookmark work place
add ebx,[Bookmark.ChisloStrokeZakladok]
mov esi,[Bookmark.sizey] ;size y
mov edi,[Bookmark.sizex] ;size x
sub esi,edx ;size x Bookmark work place
sub esi,1
 
mov [Bookmark.WorkPlace_x],ecx
mov [Bookmark.WorkPlace_y],ebx
mov [Bookmark.WorkPlace_sizex],edi
mov [Bookmark.WorkPlace_sizey],esi
 
call DrawBookmarkWorkPlace
 
mov edi,[Bookmark.CounterChildButtons]
shr edi,3
mov [Bookmark.NumberActiveControl],edi
 
call SendMessageChildControlsOfBookmark
 
;delay mouse click
mcall 5,7
 
no_crosing_with_Bookmarks:
 
jmp exit_Bookmark
no_crosing_child_buttons_Bookmark:
 
 
;check for redraw all Bookmark
mov ebx,[PointerForBookmark]
add ebx,control_header_size
xor eax,eax
mov al,[ebx]
and al,zk_redraw_all_Bookmark
test al,al
jz no_redraw_all_Bookmark__
 
and [ebx],byte zk_redraw_all_Bookmark_off
 
mov ebx,[PointerForBookmark]
add ebx,control_header_size
mov ecx,[ebx+30]
mov edx,ecx
add ebx,30+4
shl edx,2
mov esi,ebx
add esi,edx ;esi= pointer to information for first child
mov [Bookmark.PointerToTextForBookmark],esi
 
mov edi,[Bookmark.y]
mov [Bookmark.BookmarkY],edi
 
mov edi,[Bookmark.sizex]
sub edi,3
mov [Bookmark.FullBookmarkSizeX],edi
mov [Bookmark.ChisloStrokeZakladok],ecx
 
and [Bookmark.CounterChildButtons],0
mov [Bookmark.MessageForChildButton],dword 1
;craete child buttons for Bookmarks
 
next_string_of_Bookmarks_resize:
 
mov edi,[Bookmark.x]
add edi,2
mov [Bookmark.BookmarkX],edi
mov [Bookmark.WorkPlace_windowx],edi
 
;total number of Bookmarks in string
 
mov edx,[ebx]
mov edi,edx
mov [Bookmark.NumberBookmarksInEndString],edx
 
push eax
mov eax,[Bookmark.ChildButtonsForBookmark]
add eax,[Bookmark.CounterChildButtons]
mov [Bookmark.PointerToEndBookmarks],eax
pop eax
 
;calculate size of Bookmark
;size=(full_size/number_zakladok)
push eax
push edx
 
mov eax,[Bookmark.FullBookmarkSizeX]
cdq
idiv edi
 
mov [Bookmark.BookmarkSizeX],eax
mov [Bookmark.WorkPlace_windowsizex],eax
 
imul eax,edi
mov edx,[Bookmark.FullBookmarkSizeX]
sub edx,eax
mov [Bookmark.DefectSizeX],edx
 
pop edx
pop eax
 
next_child_button_resize:
 
cmp edx,1
jne no_disactivate_defect_size_x_resize
 
mov esi,[Bookmark.DefectSizeX]
add [Bookmark.BookmarkSizeX],esi
no_disactivate_defect_size_x_resize:
 
pushad
 
mov edi,[Bookmark.ChildButtonsForBookmark]
add edi,[Bookmark.CounterChildButtons]
mov esi,[edi]
 
mov eax,[Bookmark.BookmarkX]
mov ebx,[Bookmark.BookmarkY]
mov ecx,[Bookmark.BookmarkSizeX]
mov [Bookmark.ControlAddres],esi
mov [esi+24],eax ;x
mov [esi+28],ebx ;y
mov [esi+32],ecx ;size x
 
call DrawBookmark
 
push Bookmark.MessageForChildButton
push [Bookmark.ControlAddres]
call button
 
add [Bookmark.CounterChildButtons],8
 
popad
 
mov esi,[Bookmark.BookmarkSizeX]
add [Bookmark.BookmarkX],esi
 
dec edx
jnz next_child_button_resize
 
add ebx,4
add [Bookmark.BookmarkY],17 ;Bookmark size y
 
dec ecx
jnz next_string_of_Bookmarks_resize
 
;calculate chislo zakladok
mov eax,[Bookmark.CounterChildButtons]
shr eax,3
mov [Bookmark.ChisloZakladok],eax
 
;draw work place for Bookmark
mov ebx,[Bookmark.ChisloStrokeZakladok] ;chislo strok
mov ecx,[Bookmark.x] ;x for Bookmark work place
shl ebx,4
mov edx,ebx
add ebx,[Bookmark.y] ;y for Bookmark work place
add ebx,[Bookmark.ChisloStrokeZakladok]
mov esi,[Bookmark.sizey] ;size y
mov edi,[Bookmark.sizex] ;size x
sub esi,edx ;size x Bookmark work place
sub esi,1
 
mov [Bookmark.WorkPlace_x],ecx
mov [Bookmark.WorkPlace_y],ebx
mov [Bookmark.WorkPlace_sizex],edi
mov [Bookmark.WorkPlace_sizey],esi
 
call DrawBookmarkWorkPlace
 
mov edi,[Bookmark.NumberActiveControl]
call SendMessageChildControlsOfBookmark
 
jmp exit_Bookmark
 
no_redraw_all_Bookmark__:
 
 
;send events to controls of active Bookmark
mov edi,[Bookmark.NumberActiveControl]
call SendMessageChildControlsOfBookmark
 
exit_Bookmark:
 
;save work data in control
mov esi,[PointerForBookmark]
mov ebx,[esi+control_header_size+22] ;size of data's structure
mov esi,dword Bookmark
mov ecx,(43*4)+2+4
mov edi,[PointerForBookmark]
add edi,control_header_size
add edi,ebx
rep movsb
 
ret 8
 
;edi - number child Bookmark
;SendMessageForChildButton - message
 
SendMessageChildControlsOfBookmark:
 
;edi - number child Bookmark
 
mov eax,[PointerForBookmark]
add eax,control_header_size+30
mov ecx,[eax] ;number Bookmarks
shl ecx,2
add eax,4
add eax,ecx ;pointer to first child Bookmark
 
dec edi
jz addres_find_
 
next_child_control_find:
 
mov ebx,[eax+4] ;number controls
shl ebx,3
add eax,8
add eax,ebx ;pointer to next control
dec edi
jnz next_child_control_find
 
addres_find_:
 
mov ecx,[eax+4] ;number child controls for active Bookmark
mov [Bookmark.CounterChildControls],ecx
add eax,4+4+4 ;eax=pointer to child controls for Bookmark
mov [Bookmark.AddresOfActiveChildControl],eax
 
send_message_to_next_child_control_of_active_Bookmark:
 
mov eax,[Bookmark.AddresOfActiveChildControl]
 
;redraw control ?
 
cmp [Bookmark.MessageForChildButton],1
jne no_redraw_child_control_Bookmark
 
 
mov ebx,[eax]
mov ecx,[ebx]
push Bookmark.MessageForChildButton
push ebx
call ecx
 
jmp exit_send_message_to_child_control_Bookmark
no_redraw_child_control_Bookmark:
 
;send message of keys ?
 
cmp [Bookmark.MessageForChildButton],2
jne no_keys_child_control_Bookmark
 
;mov esi,[Bookmark.ActiveChildControl]
;test esi,esi
;jz exit_send_message_to_child_control_Bookmark
 
;mov eax,[Bookmark.ActiveChildControl]
mov ebx,[eax]
mov ecx,[ebx]
push Bookmark.MessageForChildButton
push ebx
call ecx
 
jmp exit_send_message_to_child_control_Bookmark
no_keys_child_control_Bookmark:
 
;send special message ?
 
cmp [Bookmark.MessageForChildButton],3
jne no_send_special_message_child_control_Bookmark
 
 
mov ebx,[eax]
mov ecx,[ebx]
push Bookmark.MessageForChildButton
push ebx
call ecx
 
jmp exit_send_message_to_child_control_Bookmark
no_send_special_message_child_control_Bookmark:
 
;Check mouse state ?
;------------------------------------------------------
cmp [Bookmark.MessageForChildButton],6
jne no_mouse_child_control_Bookmark
 
mov ebx,[eax]
mov eax,ebx
mov ebx,[Bookmark.MessageForChildButton+12]
test ebx,ebx
jz bookmark_left_button_of_mouse_not_pressed
 
mov ebx,[Bookmark.ActiveChildControl]
test ebx,ebx
jz bookmark_havent_active_control
 
mov eax,[Bookmark.ActiveChildControl]
mov ebx,[eax]
push Bookmark.MessageForChildButton
push eax
call ebx
 
jmp exit_send_message_to_child_control_Bookmark
bookmark_havent_active_control:
 
jmp bookmark_exit_if_left_button_of_mouse_pressed
bookmark_left_button_of_mouse_not_pressed:
 
mov ebx,[Bookmark.ActiveChildControl]
test ebx,ebx
jz bookmark_havent_active_control_
 
mov [Bookmark.ActiveChildControl],dword 0
 
bookmark_havent_active_control_:
 
bookmark_exit_if_left_button_of_mouse_pressed:
 
;send message to all child controls of active Bookmark
mov esi,[eax+24] ;x
mov edi,[eax+28] ;y
mov ecx,[eax+32] ;size x
mov edx,[eax+36] ;size y
mov [x],esi
mov [y],edi
mov eax,[x]
mov ebx,[y]
mov esi,[Bookmark.MouseX]
mov edi,[Bookmark.MouseY]
 
call CheckCrossingBox
 
cmp eax,0xffffff
jne no_crossing_123
 
cmp [Bookmark.MessageForChildButton+12],1
jne button_not_pressed_123
 
;save addres of activated control
mov eax,[Bookmark.AddresOfActiveChildControl]
mov ebx,[eax]
mov [Bookmark.ActiveChildControl],ebx
 
button_not_pressed_123:
no_crossing_123:
 
;send message to control
mov eax,[Bookmark.AddresOfActiveChildControl]
mov ebx,[eax]
mov ecx,[ebx]
push Bookmark.MessageForChildButton
push ebx
call ecx
 
no_mouse_child_control_Bookmark:
;------------------------------------------------------
 
;destroy child controls ?
;--------------------------------------------------------
cmp [Bookmark.MessageForChildButton],dword -1
jne no_delete_Bookmark_
 
and [Bookmark.CounterChildButtons],0
 
next_Bookmark_delete:
 
mov eax,[Bookmark.ChildButtonsForBookmark]
add eax,[Bookmark.CounterChildButtons]
 
;destroy child button
mov ebx,[eax] ;control child button
 
;pushad
 
push ebx
call destroy_control
 
;popad
 
;destroy child controls for CURRENT Bookmark
mov edi,[Bookmark.CounterChildButtons]
shr edi,3
inc edi
 
mov eax,[PointerForBookmark]
add eax,control_header_size+30
mov ecx,[eax] ;number Bookmarks
shl ecx,2
add eax,4
add eax,ecx ;pointer to first child Bookmark
 
dec edi
jz addres_find___
 
next_child_control_find__:
 
mov ebx,[eax+4] ;number controls
shl ebx,3
add eax,8
add eax,ebx ;pointer to next control
dec edi
jnz next_child_control_find__
 
addres_find___:
 
mov ecx,[eax+4] ;number child controls for active Bookmark
mov [Bookmark.CounterChildControls],ecx
add eax,4+4+4 ;eax=pointer to child controls for Bookmark
mov [Bookmark.AddresOfActiveChildControl],eax
 
next_child_control_of_Bookmark_delete:
 
mov eax,[Bookmark.AddresOfActiveChildControl]
mov ebx,[eax]
 
push ebx
call destroy_control
 
add [Bookmark.AddresOfActiveChildControl],8
 
dec [Bookmark.CounterChildControls]
jnz next_child_control_of_Bookmark_delete
 
add [Bookmark.CounterChildButtons],8
 
dec [Bookmark.ChisloZakladok]
jnz next_Bookmark_delete
 
;free memory from array
mov eax,[Bookmark.ChildButtonsForBookmark]
call free
 
no_delete_Bookmark_:
;----------------------------------------------------------------
 
exit_send_message_to_child_control_Bookmark:
 
add [Bookmark.AddresOfActiveChildControl],4+4
 
dec [Bookmark.CounterChildControls]
jnz send_message_to_next_child_control_of_active_Bookmark
 
ret
 
;BookmarkX
;BookmarkY
;BookmarkSizeX
;BookmarkSizeY
DrawBookmark:
 
mov eax,[Bookmark.BookmarkX]
mov ebx,[Bookmark.BookmarkY]
mov [x],eax
mov [y],ebx
 
;draw rectangle(x+1,y+1,sizex-2,sizey-2)
mov edx,[colors_table1]
mov esi,[Bookmark.BookmarkSizeX]
sub esi,2
 
mov eax,13
mov ebx,[x]
mov ecx,[y]
add ebx,1
add ecx,1
shl ebx,16
shl ecx,16
add ebx,esi
add ecx,(16)
and edx,0xffffff
mcall
 
mov eax,[colors_table1+15*3]
and eax,0xffffff
mov [Line.color],eax
mov [Pixel.color],eax
;draw white line(x+2,y,x+sizex-3,y)
 
mov eax,[x]
mov ebx,[y]
mov ecx,eax
add eax,2
add ecx,[Bookmark.BookmarkSizeX]
sub ecx,3
mov [Line.x1],eax
mov [Line.x2],ecx
mov [Line.y1],ebx
mov [Line.y2],ebx
call DrawLine
 
;draw white line(x,y+2,x,y+sizey)
mov eax,[x]
mov ebx,[y]
mov ecx,ebx
add ebx,2
add ecx,(16)
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ecx
call DrawLine
 
mov eax,[x]
mov ebx,[y]
add eax,1
add ebx,1
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
mov eax,[colors_table1+6*3]
and eax,0xffffff
mov [Line.color],eax
;draw light line(x+2,y+1,x+sizex-2,y+1)
 
mov eax,[x]
mov ebx,[y]
mov ecx,eax
add eax,2
add ebx,1
add ecx,[Bookmark.BookmarkSizeX]
sub ecx,2
mov [Line.x1],eax
mov [Line.x2],ecx
mov [Line.y1],ebx
mov [Line.y2],ebx
call DrawLine
 
;draw light line(x+1,y+2,x+1,y+sizey-1)
mov eax,[x]
mov ebx,[y]
mov ecx,ebx
add eax,1
add ebx,2
add ecx,(16)
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ecx
call DrawLine
 
mov eax,[colors_table2+9*3]
and eax,0xffffff
mov [Line.color],eax
mov [Pixel.color],eax
 
;draw dark line(x+sizex-1,y+2,x+sizex-1,y+sizey)
mov eax,[x]
mov ebx,[y]
add eax,[Bookmark.BookmarkSizeX]
mov edx,ebx
add ebx,2
add edx,(16)
sub eax,1
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],edx
call DrawLine
 
mov eax,[x]
mov ebx,[y]
add eax,[Bookmark.BookmarkSizeX]
add ebx,1
sub eax,2
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
mov eax,[colors_table2+16*3]
and eax,0xffffff
mov [Line.color],eax
 
;draw light dark line(x+sizex-2,y+2,x+sizex-2,y+sizey)
mov eax,[x]
mov ebx,[y]
add eax,[Bookmark.BookmarkSizeX]
sub eax,2
mov edx,ebx
add ebx,2
add edx,(16)
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],edx
call DrawLine
 
 
ret
 
DrawBookmarkWorkPlace:
 
mov esi,[Bookmark.WorkPlace_sizex]
sub esi,1
 
mov eax,13
mov ebx,[Bookmark.WorkPlace_x]
mov ecx,[Bookmark.WorkPlace_y]
add ebx,1
shl ebx,16
shl ecx,16
add ebx,esi
add ecx,[Bookmark.WorkPlace_sizey]
mov edx,[colors_table1]
and edx,0xffffff
mcall
 
mov eax,[colors_table1+15*3]
and eax,0xffffff
mov [Line.color],eax
 
;draw vertical light line(x,y,x,y+sizey)
mov eax,[Bookmark.WorkPlace_x]
mov ebx,[Bookmark.WorkPlace_y]
mov ecx,ebx
add ecx,[Bookmark.WorkPlace_sizey]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ecx
call DrawLine
 
;draw first horizontal light line
;(x,y,x+windowx,y)
mov eax,[Bookmark.WorkPlace_x]
mov ebx,[Bookmark.WorkPlace_y]
mov ecx,[Bookmark.WorkPlace_windowx]
 
cmp eax,ecx
je no_draw_line_00
 
mov [Line.x1],eax
mov [Line.x2],ecx
mov [Line.y1],ebx
mov [Line.y2],ebx
call DrawLine
 
no_draw_line_00:
 
;draw second horizontal light line
;(x,y,x+windowx,y)
mov eax,[Bookmark.WorkPlace_windowx]
add eax,[Bookmark.WorkPlace_windowsizex]
mov ebx,[Bookmark.WorkPlace_y]
mov ecx,[Bookmark.WorkPlace_x]
add ecx,[Bookmark.WorkPlace_sizex]
mov [Line.x1],eax
mov [Line.x2],ecx
mov [Line.y1],ebx
mov [Line.y2],ebx
call DrawLine
 
;draw next light lines
 
mov eax,[colors_table1+4*3]
and eax,0xffffff
mov [Line.color],eax
 
;draw vertical light line(x+1,y+1,x+1,y+sizey-1)
mov eax,[Bookmark.WorkPlace_x]
mov ebx,[Bookmark.WorkPlace_y]
mov ecx,ebx
add ecx,[Bookmark.WorkPlace_sizey]
add eax,1
add ebx,1
sub ecx,1
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ecx
call DrawLine
 
;draw first horizontal light line
;(x+1,y+1,x+windowx,y+1)
mov eax,[Bookmark.WorkPlace_x]
mov ebx,[Bookmark.WorkPlace_y]
mov ecx,[Bookmark.WorkPlace_windowx]
add ebx,1
 
cmp eax,ecx
je no_draw_line_01
 
mov [Line.x1],eax
mov [Line.x2],ecx
mov [Line.y1],ebx
mov [Line.y2],ebx
;call DrawLine
 
no_draw_line_01:
 
;draw second horizontal light line
;(x+1,y+1,x+windowx-2,y+1)
mov eax,[Bookmark.WorkPlace_windowx]
mov ecx,[Bookmark.WorkPlace_x]
mov ebx,[Bookmark.WorkPlace_y]
add eax,[Bookmark.WorkPlace_windowsizex]
add ecx,[Bookmark.WorkPlace_sizex]
add eax,1
add ebx,1
sub ecx,2
mov [Line.x1],eax
mov [Line.x2],ecx
mov [Line.y1],ebx
mov [Line.y2],ebx
call DrawLine
 
 
mov eax,[colors_table2+9*3]
and eax,0xffffff
mov [Line.color],eax
 
;draw vertical dark line(x+sizex,y,x+sizex,y+sizey)
mov eax,[Bookmark.WorkPlace_x]
mov ebx,[Bookmark.WorkPlace_y]
mov ecx,ebx
add eax,[Bookmark.WorkPlace_sizex]
add ecx,[Bookmark.WorkPlace_sizey]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ecx
call DrawLine
 
;draw horizontal dark line(x+1,y+sizey,x+sizex,y+sizey)
mov eax,[Bookmark.WorkPlace_x]
mov ebx,[Bookmark.WorkPlace_y]
mov ecx,eax
add ecx,[Bookmark.WorkPlace_sizex]
add ebx,[Bookmark.WorkPlace_sizey]
add eax,1
mov [Line.x1],eax
mov [Line.x2],ecx
mov [Line.y1],ebx
mov [Line.y2],ebx
call DrawLine
 
mov eax,[colors_table2+16*3]
and eax,0xffffff
mov [Line.color],eax
 
;draw vertical dark line(x+sizex-1,y+1,x+sizex-1,y+sizey-1)
mov eax,[Bookmark.WorkPlace_x]
mov ebx,[Bookmark.WorkPlace_y]
mov ecx,ebx
add eax,[Bookmark.WorkPlace_sizex]
add ecx,[Bookmark.WorkPlace_sizey]
sub eax,1
sub ecx,1
;add ebx,1
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ecx
call DrawLine
 
;draw horizontal dark line(x+1,y+sizey-1,x+sizex-1,y+sizey-1)
mov eax,[Bookmark.WorkPlace_x]
mov ebx,[Bookmark.WorkPlace_y]
mov ecx,eax
add ecx,[Bookmark.WorkPlace_sizex]
add ebx,[Bookmark.WorkPlace_sizey]
add eax,1
sub ecx,1
sub ebx,1
mov [Line.x1],eax
mov [Line.x2],ecx
mov [Line.y1],ebx
mov [Line.y2],ebx
call DrawLine
 
ret
/programs/develop/libGUI/src/button.inc
0,0 → 1,1437
 
;button's types
bt_check_text_type = 1b
bt_check_picture_type = 10b
bt_check_picture_text_type = 100b
bt_no_draw = 1000b
bt_check_3D_type = 10000b
bt_check_full_redraw = 10000000b
bt_full_redraw_off = 1111111b
 
;button's flags
bt_crossing = 1b
bt_crossing_pressing = 11b
bt_crossing_pressing_off = 11111100b
 
bt_control_data_size = 50
 
;****************************************************
;******************craete Button**********************
;****************************************************
;IN
;pointer to parend
;pointer to Buttton's structure
;OUT
;pointer to initialized Button's structure
align 4
 
craete_button:
 
mov ebx,[esp+4] ;parend
mov eax,[esp+8] ;control
 
mov [PointerToStructureForButton],eax
 
mov eax,control_header_size+bt_control_data_size
call craete_control
 
;set all button's parameters in control
mov ecx,dword button
mov [eax],dword button
 
mov ecx,bt_control_data_size
mov esi,[PointerToStructureForButton]
mov edi,eax
add edi,control_header_size
rep movsb
 
mov ebx,[PointerToStructureForButton]
xor ecx,ecx
xor edx,edx
xor esi,esi
xor edi,edi
mov cx,[ebx+2] ;button x
mov dx,[ebx+4] ;button y
mov si,[ebx+6] ;button size x
mov di,[ebx+8] ;button size y
 
call get_skin_height
add ecx,border_width
add edx,[skin_height]
;copy information to control
mov [eax+24],ecx
mov [eax+28],edx
mov [eax+32],esi
mov [eax+36],edi
 
ret 8
 
;****************************************************
;*******************Draw Button**********************
;****************************************************
;IN
;pointer to control of button
;message
;OUT
;not returned value
align 4
 
button:
 
;get message
mov eax,[esp+8]
 
;get pointer to control of button
mov esi,[esp+4]
mov [PointerForButton],esi
;copy control to local control
mov edi,dword Button
mov ecx,control_header_size+bt_control_data_size
cld
rep movsb
 
 
cmp [eax],dword 1
jne no_redraw_all_button
 
or [Button.type],bt_check_full_redraw
no_redraw_all_button:
 
cmp [eax],dword 2
jne no_keys_button
 
jmp exit_button
no_keys_button:
 
cmp [eax],dword 3
jne no_pressed_button_button
 
jmp exit_button
no_pressed_button_button:
 
cmp [eax],dword 6
jne no_mouse_button
 
mov esi,[eax+4]
mov edi,[eax+8]
mov ecx,[eax+12]
mov [Button.mouseX],si
mov [Button.mouseY],di
mov [ButtonsOfMouse],ecx
 
no_mouse_button:
 
 
cmp [eax],dword -1
jne no_delete_button
 
jmp exit_button
no_delete_button:
 
;load coordinats and size from control
mov eax,[PointerForButton]
mov ebx,[eax+24] ;x
mov ecx,[eax+28] ;y
mov edx,[eax+32] ;size x
mov esi,[eax+36] ;size y
;set current coordinats and sizes in zakladka
mov [Button.x],bx
mov [Button.y],cx
mov [Button.width],dx
mov [Button.height],si
 
 
mov [Button.color2],0xffffff
 
xor eax,eax
mov al,[Button.type]
and al,bt_check_full_redraw
test al,al
jz no_redraw_button
 
and [Button.type],bt_full_redraw_off
 
mov esi,dword Button
mov edi,[PointerForButton]
add esi,control_header_size
add edi,control_header_size
mov ecx,2
cld
rep movsb
 
;if bit 3 is tru than no draw button
mov al,[Button.type]
and al,bt_no_draw
test al,al
jnz no_draw_button
 
;generate colors tables
mov eax,[Button.color1]
mov ebx,0xffffff
mov ecx,20
mov edx,dword colors_table1
call gradient
 
xor eax,eax
mov ebx,[Button.color1]
mov ecx,20
mov edx,dword colors_table2
call gradient
 
xor eax,eax
mov al,[Button.type]
 
and al,bt_check_3D_type
test al,al
jz no_3d_button
 
;draw gradient up rectangle
mov eax,[Button.color1]
mov ebx,[Button.color2]
and eax,0xffffff
and ebx,0xffffff
xor ecx,ecx
xor edx,edx
xor esi,esi
xor edi,edi
mov cx,[Button.x]
mov dx,[Button.y]
mov si,[Button.width]
mov di,[Button.height]
add cx,1
add dx,2
sub si,1
sub di,3
call rectangle_gradient_up
 
mov eax,[Button.color1]
mov [Line.color],eax
 
;draw left vertical line
xor eax,eax
xor ebx,ebx
xor ecx,ecx
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.height]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y1],3
add [Line.y2],ecx
call DrawLine
 
;draw right vertical line
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor esi,esi
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.height]
mov si,[Button.width]
add eax,esi
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y1],3
add [Line.y2],ecx
call DrawLine
 
;draw down 1 horizontal line
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor esi,esi
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.height]
mov si,[Button.width]
add ebx,ecx
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],1
sub esi,1
add [Line.x2],esi
call DrawLine
 
;draw up light horizontal rectangle
xor ecx,ecx
xor esi,esi
mov si,[Button.height]
mov di,[Button.width]
mov eax,13
mov bx,[Button.x]
mov cx,[Button.y]
mov edx,0xffffff
add ebx,2
add ecx,1
shl ebx,16
shl ecx,16
sub edi,3
add ebx,edi
add ecx,2
mcall
 
;draw left light vertical line
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor edx,edx
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.height]
 
;calculate color
mov dx,[Button.height]
sub edx,3+2
mov esi,[pointer+edx*3]
and esi,0xffffff
add eax,1
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
mov [Line.color],esi; dword 0xffffff
add [Line.y1],2
sub ecx,3
add [Line.y2],ecx
call DrawLine
 
;draw right light vertical line
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor edx,edx
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.height]
 
add ax,[Button.width]
sub eax,1
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y1],2
sub ecx,3
add [Line.y2],ecx
call DrawLine
 
mov eax,[pointer+3*3]
and eax,0xffffff
mov [Button.color2],eax
mov [Line.color],eax
 
;draw up light left vertical line 1
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor esi,esi
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.height]
mov si,[Button.width]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y2],2
call DrawLine
 
;draw up light right vertical line 1
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor esi,esi
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.height]
mov si,[Button.width]
add eax,esi
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y2],2
call DrawLine
 
;draw up light left vertical line 2
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor esi,esi
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.height]
mov si,[Button.width]
add eax,1
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y2],1
call DrawLine
 
;draw up light right vertical line 2
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor esi,esi
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.height]
mov si,[Button.width]
add eax,esi
sub eax,1
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y2],1
call DrawLine
 
;draw up light horizontal line
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor esi,esi
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.height]
mov si,[Button.width]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],2
sub esi,2
add [Line.x2],esi
call DrawLine
 
mov eax,[pointer+3*3]
mov ebx,[pointer+3*9]
and eax,0xffffff
and ebx,0xffffff
call calculate_average_color
 
mov [Pixel.color],eax
 
;(x,y)
xor eax,eax
xor ebx,ebx
mov ax,[Button.x]
mov bx,[Button.y]
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
;(x+size_x,y)
xor eax,eax
xor ebx,ebx
xor ecx,ecx
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.width]
add eax,ecx
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
;(x+1,y+1)
xor eax,eax
xor ebx,ebx
mov ax,[Button.x]
mov bx,[Button.y]
add eax,1
add ebx,1
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
;(x+size_x-1,y+1)
xor eax,eax
xor ebx,ebx
xor ecx,ecx
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.width]
add eax,ecx
sub eax,1
add ebx,1
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
;(x,y+size_y)
xor eax,eax
xor ebx,ebx
mov ax,[Button.x]
mov bx,[Button.y]
add bx,[Button.height]
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
;(x+size_x,y+size_y)
xor eax,eax
xor ebx,ebx
xor ecx,ecx
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.width]
add eax,ecx
add bx,[Button.height]
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
;(x+1,y+size_y-2)
xor eax,eax
xor ebx,ebx
mov ax,[Button.x]
mov bx,[Button.y]
add eax,1
add bx,[Button.height]
sub ebx,2
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
;(x+size_x-1,y+size_y-2)
xor eax,eax
xor ebx,ebx
xor ecx,ecx
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.width]
add eax,ecx
sub eax,1
add bx,[Button.height]
sub ebx,2
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
no_3d_button:
 
;****************************
;*********2D button**********
;****************************
xor eax,eax
mov al,[Button.type]
and al,bt_check_3D_type
test al,al
jnz no_2D_button
 
mov edx,[colors_table1+18]
and edx,0xffffff
 
xor ebx,ebx
xor ecx,ecx
xor esi,esi
xor edi,edi
mov si,[Button.width]
mov di,[Button.height]
mov eax,13
mov bx,[Button.x]
mov cx,[Button.y]
add ebx,1
add ecx,1
sub si,1
sub di,1
shl ebx,16
shl ecx,16
add ebx,esi
add ecx,edi
mcall
 
mov eax,[colors_table1+15*3]
and eax,0xffffff
mov [Line.color],eax
 
xor eax,eax
xor ebx,ebx
xor ecx,ecx
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.height]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y2],ecx
call DrawLine
 
xor eax,eax
xor ebx,ebx
xor esi,esi
mov ax,[Button.x]
mov bx,[Button.y]
mov si,[Button.width]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x2],esi
call DrawLine
 
mov eax,[colors_table2+8*3]
and eax,0xffffff
mov [Line.color],eax
 
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor esi,esi
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.height]
mov si,[Button.width]
add eax,esi
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y2],ecx
call DrawLine
 
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor esi,esi
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.height]
mov si,[Button.width]
add ebx,ecx
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x2],esi
call DrawLine
 
no_2D_button:
 
no_draw_button:
 
;check drawing text on the button
xor eax,eax
mov al,[Button.type]
 
and al,bt_check_text_type
test al,al
jz no_button_only_with_text
 
call DrawStringOnTheButton
jmp end_case_button
no_button_only_with_text:
 
;check drawing picture on the button
xor eax,eax
mov al,[Button.type]
and al,bt_check_picture_type
test al,al
jz no_button_only_with_picture
 
call DrawPictureOnTheButton
jmp end_case_button
no_button_only_with_picture:
 
 
xor eax,eax
mov al,[Button.type]
and al,bt_check_picture_text_type
test al,al
jz no_button_with_text_and_picture
 
;draw string in coordinats (textX,textY)
xor eax,eax
xor ebx,ebx
mov ax,[Button.textX]
mov bx,[Button.textY]
add ax,[Button.x]
add bx,[Button.y]
mov [Font.x],eax
mov [Font.y],ebx
call DrawString
 
;draw picture in coordinats (imageX,imageY)
xor eax,eax
xor ebx,ebx
mov ax,[Button.imageX]
mov bx,[Button.imageY]
add ax,[Button.x]
add bx,[Button.y]
mov [xo],eax
mov [x],eax
mov [y],ebx
 
xor esi,esi
xor edi,edi
mov si,[Button.imageSizeX]
mov di,[Button.imageSizeY]
mov ebp,[Button.image]
 
xor eax,eax
inc eax
 
loop_y_image_:
 
mov ebx,[xo]
mov [x],ebx
 
xor esi,esi
mov si,[Button.imageSizeX]
 
loop_x_image_:
 
mov edx,[ebp]
and edx,0xffffff
cmp edx,[Button.transparentColor]
je no_draw_pixel_
 
mov ebx,[x]
mov ecx,[y]
mcall
no_draw_pixel_:
 
add ebp,3
add [x],1
dec esi
jnz loop_x_image_
 
add [y],1
dec edi
jnz loop_y_image_
 
no_button_with_text_and_picture:
 
no_redraw_button:
 
end_case_button:
 
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor edx,edx
xor esi,esi
xor edi,edi
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.width]
mov dx,[Button.height]
mov si,[Button.mouseX]
mov di,[Button.mouseY]
call CheckCrossingBox
 
cmp eax,0xffffff
jne no_crossing
 
xor ebx,ebx
mov bl,[Button.type]
and bl,bt_check_3D_type
test bl,bl
jz button_active_2D
 
push eax
mov eax,[ButtonsOfMouse]
 
cmp eax,1
je button_pressed_3d_
 
xor eax,eax
mov al,[Button.type]
and al,bt_no_draw
test al,al
jnz no_draw_active_button_3d_
 
call Draw3DActiveButton
 
no_draw_active_button_3d_:
 
mov [Button.flag],byte bt_crossing
jmp exit_button_pressed_3d_
 
button_pressed_3d_:
 
xor eax,eax
mov al,[Button.type]
and al,bt_no_draw
test al,al
jnz no_draw_pressed_button_3d_
 
call DrawPressed3DButton
 
no_draw_pressed_button_3d_:
 
mov [Button.flag],byte bt_crossing_pressing
 
exit_button_pressed_3d_:
 
pop eax
 
;save flag
mov esi,dword Button
mov edi,[PointerForButton]
add esi,control_header_size
add edi,control_header_size
mov ecx,2
cld
rep movsb
jmp no_crossing
 
button_active_2D:
 
push eax
mov eax,[ButtonsOfMouse]
 
cmp eax,1
je button_pressed_2d
 
xor eax,eax
mov al,[Button.type]
and al,bt_no_draw
test al,al
jnz no_active_button_2d_
 
call Draw2DActiveButton
 
no_active_button_2d_:
 
mov [Button.flag],byte bt_crossing
jmp exit_button_pressed_2d
button_pressed_2d:
 
xor eax,eax
mov al,[Button.type]
and al,bt_no_draw
test al,al
jnz no_draw_pressed_button_2d_
 
call DrawPressed2DButton
 
no_draw_pressed_button_2d_:
 
mov [Button.flag],byte bt_crossing_pressing
exit_button_pressed_2d:
 
pop eax
 
;save flag
mov esi,dword Button
mov edi,[PointerForButton]
add esi,control_header_size
add edi,control_header_size
mov ecx,2
cld
rep movsb
no_crossing:
 
cmp eax,0xffffff
je yes_crossing
xor ebx,ebx
mov bl,[Button.flag]
and bl,bt_crossing
test bl,bl
jz yes_crossing
 
xor ebx,ebx
mov bl,[Button.type]
and bl,bt_check_3D_type
test bl,bl
jz button_put_2D
 
push eax
 
xor eax,eax
mov al,[Button.type]
and al,bt_no_draw
test al,al
jnz no_draw_button_active_3d__
 
call Put3DActiveButton
no_draw_button_active_3d__:
 
pop eax
 
and [Button.flag],bt_crossing_pressing_off
mov esi,dword Button
mov edi,[PointerForButton]
add edi,control_header_size
add esi,control_header_size
mov ecx,2
cld
rep movsb
jmp yes_crossing
 
button_put_2D:
 
push eax
 
xor eax,eax
mov al,[Button.type]
and al,bt_no_draw
test al,al
jnz no_draw_button_active_2d__
 
call Put2DActiveButton
 
no_draw_button_active_2d__:
 
pop eax
 
and [Button.flag],bt_crossing_pressing_off
mov esi,dword Button
mov edi,[PointerForButton]
add esi,control_header_size
add edi,control_header_size
mov ecx,2
cld
rep movsb
yes_crossing:
 
exit_button:
 
ret 8
 
DrawStringOnTheButton:
 
;xor ebx,ebx
mov ebx,[Button.text]
call GetLengthString
imul eax,6 ;[Font.sizeX]
xor ebx,ebx
mov bx,[Button.width]
shr eax,1
shr ebx,1
sub ebx,eax
xor eax,eax
mov ax,[Button.x]
add eax,ebx
mov [Font.x],eax
xor ebx,ebx
mov bx,[Button.height]
shr ebx,1
sub ebx,3;[Font.sizeY]
xor eax,eax
mov ax,[Button.y]
add eax,ebx
mov [Font.y],eax
call DrawString
 
ret
 
DrawPictureOnTheButton:
 
xor esi,esi
xor edi,edi
xor eax,eax
xor ebx,ebx
mov ax,[Button.height]
mov bx,[Button.width]
mov di,[Button.imageSizeY]
mov si,[Button.imageSizeX]
shr ax,1
shr bx,1
shr si,1
shr di,1
sub ax,di
sub bx,si
add ax,[Button.y]
add bx,[Button.x]
mov [xo],ebx
mov [x],ebx
mov [y],eax
 
xor esi,esi
xor edi,edi
mov si,[Button.imageSizeX]
mov di,[Button.imageSizeY]
mov ebp,[Button.image]
 
xor eax,eax
inc eax
 
loop_y_image:
 
mov ebx,[xo]
mov [x],ebx
 
xor esi,esi
mov si,[Button.imageSizeX]
 
loop_x_image:
 
mov edx,[ebp]
and edx,0xffffff
cmp edx,[Button.transparentColor]
je no_draw_pixel
 
mov ebx,[x]
mov ecx,[y]
mcall
no_draw_pixel:
 
add ebp,3
add [x],1
dec esi
jnz loop_x_image
 
add [y],1
dec edi
jnz loop_y_image
 
ret
 
 
Draw3DActiveButton:
 
;call calculate_average_color
mov [Line.color],0xffffff;eax
 
xor eax,eax
xor ebx,ebx
xor ecx,ecx
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.height]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y1],3
sub ecx,1
add [Line.y2],ecx
call DrawLine
 
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor esi,esi
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.height]
mov si,[Button.width]
add eax,esi
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y1],3
sub ecx,1
add [Line.y2],ecx
call DrawLine
 
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor esi,esi
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.height]
add ebx,ecx
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],1
xor ecx,ecx
mov cx,[Button.width]
sub ecx,1
add [Line.x2],ecx
call DrawLine
 
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor esi,esi
mov ax,[Button.x]
mov bx,[Button.y]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],1
xor ecx,ecx
mov cx,[Button.width]
sub ecx,1
add [Line.x2],ecx
call DrawLine
 
ret
 
Put3DActiveButton:
 
mov eax,[Button.color1]
mov ebx,0xffffff
mov ecx,20
mov edx,dword pointer
call gradient
 
mov eax,[pointer+3];[Button.color1]
and eax,0xffffff
mov [Line.color],eax
 
xor eax,eax
xor ebx,ebx
xor ecx,ecx
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.height]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y1],3
sub ecx,1
add [Line.y2],ecx
call DrawLine
 
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor esi,esi
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.height]
mov si,[Button.width]
add eax,esi
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y1],3
sub ecx,1
add [Line.y2],ecx
call DrawLine
 
 
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor esi,esi
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.height]
add ebx,ecx
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],1
xor ecx,ecx
mov cx,[Button.width]
sub ecx,1
add [Line.x2],ecx
call DrawLine
 
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor esi,esi
mov ax,[Button.x]
mov bx,[Button.y]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],1
xor ecx,ecx
mov cx,[Button.width]
sub ecx,1
add [Line.x2],ecx
call DrawLine
 
ret
 
DrawPressed3DButton:
 
 
mov eax,[Button.color1]
mov ebx,0xffffff
mov ecx,20
mov edx,dword pointer
call gradient
 
mov edx,[pointer+3]
and edx,0xffffff
mov [Line.color],edx
 
xor eax,eax
xor ebx,ebx
xor ecx,ecx
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.height]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y1],3
sub ecx,1
add [Line.y2],ecx
call DrawLine
 
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor esi,esi
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.height]
mov si,[Button.width]
add eax,esi
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y1],3
sub ecx,1
add [Line.y2],ecx
call DrawLine
 
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor esi,esi
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.height]
add ebx,ecx
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],1
xor ecx,ecx
mov cx,[Button.width]
sub ecx,1
add [Line.x2],ecx
call DrawLine
 
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor esi,esi
mov ax,[Button.x]
mov bx,[Button.y]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],1
xor ecx,ecx
mov cx,[Button.width]
sub ecx,1
add [Line.x2],ecx
call DrawLine
 
ret
 
Draw2DActiveButton:
 
mov edx,[colors_table1]
and edx,0xffffff
;mov [Button.color2],edx
 
xor eax,eax
xor ebx,ebx
xor ecx,ecx
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.height]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
mov [Line.color],edx
add [Line.y2],ecx
call DrawLine
 
xor eax,eax
xor ebx,ebx
xor esi,esi
mov ax,[Button.x]
mov bx,[Button.y]
mov si,[Button.width]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x2],esi
call DrawLine
 
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor esi,esi
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.height]
mov si,[Button.width]
add eax,esi
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y2],ecx
call DrawLine
 
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor esi,esi
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.height]
mov si,[Button.width]
add ebx,ecx
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x2],esi
call DrawLine
 
ret
 
Put2DActiveButton:
 
mov edx,[pointer+15*3]
and edx,0xffffff
 
xor eax,eax
xor ebx,ebx
xor ecx,ecx
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.height]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
mov [Line.color],edx
add [Line.y2],ecx
call DrawLine
 
xor eax,eax
xor ebx,ebx
xor esi,esi
mov ax,[Button.x]
mov bx,[Button.y]
mov si,[Button.width]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x2],esi
call DrawLine
 
mov edx,[colors_table2+8*3]
and edx,0xffffff
 
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor esi,esi
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.height]
mov si,[Button.width]
add eax,esi
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
mov [Line.color],edx
add [Line.y2],ecx
call DrawLine
 
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor esi,esi
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.height]
mov si,[Button.width]
add ebx,ecx
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x2],esi
call DrawLine
 
ret
 
DrawPressed2DButton:
 
xor eax,eax
xor ebx,ebx
xor ecx,ecx
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.height]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
and [Line.color],0
add [Line.y2],ecx
call DrawLine
 
xor eax,eax
xor ebx,ebx
xor esi,esi
mov ax,[Button.x]
mov bx,[Button.y]
;mov cx,[Button.height]
mov si,[Button.width]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x2],esi
call DrawLine
 
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor esi,esi
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.height]
mov si,[Button.width]
add eax,esi
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
mov [Line.color],0xffffff
add [Line.y2],ecx
call DrawLine
 
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor esi,esi
mov ax,[Button.x]
mov bx,[Button.y]
mov cx,[Button.height]
mov si,[Button.width]
add ebx,ecx
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x2],esi
call DrawLine
 
ret
/programs/develop/libGUI/src/check_box.inc
0,0 → 1,234
 
cb_control_data_dize = 44
 
;****************************************************
;****************craete CheckBox**********************
;****************************************************
;IN
;pointer to parend
;pointer to CheckBox's structure
;OUT
;pointer to initialized control
align 4
 
craete_check_box:
 
mov ebx,[esp+4]
mov eax,[esp+8]
 
mov [PointerToStructureForCheckBox],eax
 
mov eax,control_header_size+cb_control_data_dize
call craete_control
 
;set all CheckBox's parameters in control
mov [eax],dword check_box
 
mov ecx,cb_control_data_dize
mov esi,[PointerToStructureForCheckBox]
mov edi,eax
add edi,control_header_size
rep movsb
 
call get_skin_height
 
mov ebx,[PointerToStructureForCheckBox]
xor ecx,ecx
xor edx,edx
mov cx,[ebx+2] ;CheckBox x
mov dx,[ebx+4] ;CheckBox y
mov esi,[ebx+10] ;CheckBox size
add ecx,border_width
add edx,[skin_height]
;copy information to control
mov [eax+24],ecx
mov [eax+28],edx
mov [eax+32],esi
mov [eax+36],esi
 
ret 8
 
;****************************************************
;*****************Draw CheckBox**********************
;****************************************************
;IN
;pointer to control of CheckBox
;message
;OUT
;not returned value
align 4
 
check_box:
 
;get message
mov eax,[esp+8]
 
;get pointer to control of CheckBox
mov esi,[esp+4]
mov [PointerForCheckBox],esi
 
;copy information from control to structure
add esi,control_header_size
mov edi,dword CheckBox
mov ecx,control_header_size+cb_control_data_dize
rep movsb
 
push eax
;load coordinats and size from control
mov eax,[PointerForCheckBox]
mov ebx,[eax+24] ;x
mov ecx,[eax+28] ;y
mov edx,[eax+32] ;size
;set current coordinats and sizes in CheckBox
mov [CheckBox.ch_left],bx
mov [CheckBox.ch_top],cx
mov [CheckBox.ch_size],edx
pop eax
 
cmp [eax],dword 1
jne no_redraw_all_check_box
 
mov eax,13
mov bx,[CheckBox.ch_left]
mov cx,[CheckBox.ch_top]
shl ebx,16
shl ecx,16
add ebx,[CheckBox.ch_size]
add ecx,[CheckBox.ch_size]
mov edx,[CheckBox.ch_border_color]
mcall
 
mov edx,[CheckBox.ch_color]
add ebx,1 shl 16 - 2
add ecx,1 shl 16 - 2
mcall
 
mov eax,[CheckBox.ch_size]
mov ebx,eax
mov ecx,3
shr ebx,1
cdq
idiv ecx
mov [CheckBox.ch_size_2],bx
mov [CheckBox.ch_size_3],ax
 
test word [CheckBox.ch_flags],2
jz @f
call draw_ch
@@:
 
movzx ebx,word[CheckBox.ch_left]
add ebx,[CheckBox.ch_size]
add ebx,[CheckBox.ch_text_margin]
shl ebx,16
mov bx,[CheckBox.ch_top]
add ebx,[CheckBox.ch_size]
add ebx,(-9+1)
mov ecx,[CheckBox.ch_text_color]
 
mov edx,[CheckBox.ch_text_ptr]
movzx esi,word [CheckBox.ch_text_length]
 
mov eax,4
mcall
 
jmp exit_check_box
no_redraw_all_check_box:
 
 
cmp [eax],dword 6
jne no_mouse_check_box
 
mov esi,[eax+4]
mov edi,[eax+8]
mov ebx,[eax+12] ;buttons of mouse state
mov [CheckBox.mouseX],esi
mov [CheckBox.mouseY],edi
mov eax,ebx
 
test eax,eax
jnz @f
btr word [CheckBox.ch_flags],2
jmp exit_check_box
@@:
bts word [CheckBox.ch_flags],2
jc .mouse_end
movzx esi,word [CheckBox.ch_text_length]
 
imul esi,6
add esi,[CheckBox.ch_text_margin]
 
mov eax,[CheckBox.mouseX]
shl eax,16
add eax,[CheckBox.mouseY]
 
xor ebx,ebx
 
movzx ebx,word[CheckBox.ch_top]
cmp ax,bx
jl .mouse_end
add ebx,[CheckBox.ch_size]
cmp ax,bx
jg .mouse_end
 
shr eax,16
movzx ebx,word[CheckBox.ch_left]
cmp ax,bx
jl .mouse_end
add ebx,[CheckBox.ch_size]
add ebx,esi
cmp ax,bx
jg .mouse_end
 
bts word[CheckBox.ch_flags],1
jc @f
 
call draw_ch
 
jmp .mouse_end
@@:
btr word[CheckBox.ch_flags],1
call clear_ch
 
.mouse_end:
 
no_mouse_check_box:
 
exit_check_box:
 
;save resultat of work in control
mov ecx,cb_control_data_dize ;save in control only flags
mov esi,dword CheckBox
mov edi,[PointerForCheckBox]
add edi,control_header_size
cld
rep movsb
 
ret 8
 
;ch_text_margin=4
;ch_size=11
 
clear_ch:
mov edx,[CheckBox.ch_color]
jmp @f
 
draw_ch:
mov edx,[CheckBox.ch_border_color]
@@:
 
movzx ebx,word[CheckBox.ch_left]
add bx,[CheckBox.ch_size_3]
shl ebx,16
mov bx,[CheckBox.ch_size_2]
;mov bp,bx
;push bx
movzx ecx,word [CheckBox.ch_top]
mov eax,13
add cx,[CheckBox.ch_size_3]
shl ecx,16
;mov cx,bp
mov cx,[CheckBox.ch_size_2]
mcall
 
ret
/programs/develop/libGUI/src/check_crossing_box.inc
0,0 → 1,26
;eax - x1
;ebx - y1
;ecx - size x
;edx - size y
;esi - x2
;edi - y2
;if crossing than eax=0xffffff
 
CheckCrossingBox:
 
add ecx,eax
add edx,ebx
 
cmp esi,eax
jl exit_crossing
cmp esi,ecx
ja exit_crossing
cmp edi,ebx
jl exit_crossing
cmp edi,edx
ja exit_crossing
xor eax,eax
mov eax,0xffffff
exit_crossing:
 
ret
/programs/develop/libGUI/src/config.inc
0,0 → 1,0
__CPU_type fix p5
/programs/develop/libGUI/src/debug.inc
0,0 → 1,131
macro debug_print str
{
local ..string, ..label
 
jmp ..label
..string db str,0
..label:
 
pushf
pushad
mov edx,..string
call debug_outstr
popad
popf
}
 
dps fix debug_print
 
macro debug_print_dec arg
{
pushf
pushad
if ~arg eq eax
mov eax,arg
end if
call debug_outdec
popad
popf
}
 
dpd fix debug_print_dec
 
;---------------------------------
debug_outdec: ;(eax - num, edi-str)
push 10 ;2
pop ecx ;1
push -'0' ;2
.l0:
xor edx,edx ;2
div ecx ;2
push edx ;1
test eax,eax ;2
jnz .l0 ;2
.l1:
pop eax ;1
add al,'0' ;2
call debug_outchar ; stosb
jnz .l1 ;2
ret ;1
;---------------------------------
 
debug_outchar: ; al - char
pushf
pushad
mov cl,al
mov eax,63
mov ebx,1
int 0x40
popad
popf
ret
 
debug_outstr:
mov eax,63
mov ebx,1
@@:
mov cl,[edx]
test cl,cl
jz @f
int 40h
inc edx
jmp @b
@@:
ret
 
 
macro newline
{
dps <13,10>
}
 
macro print message
{
dps message
newline
}
 
macro pregs
{
dps "EAX: "
dpd eax
dps " EBX: "
dpd ebx
newline
dps "ECX: "
dpd ecx
dps " EDX: "
dpd edx
newline
}
 
macro debug_print_hex arg
{
pushf
pushad
if ~arg eq eax
mov eax, arg
end if
call debug_outhex
popad
popf
}
dph fix debug_print_hex
 
debug_outhex:
; eax - number
mov edx, 8
.new_char:
rol eax, 4
movzx ecx, al
and cl, 0x0f
mov cl, [__hexdigits + ecx]
pushad
mcall 63, 1
popad
dec edx
jnz .new_char
ret
 
__hexdigits:
db '0123456789ABCDEF'
/programs/develop/libGUI/src/draw.inc
0,0 → 1,595
 
DrawLine:
 
mov eax,38
mov ebx,[Line.x1]
mov ecx,[Line.y1]
mov edx,[Line.color]
shl ebx,16
shl ecx,16
add ebx,[Line.x2]
add ecx,[Line.y2]
mcall
 
ret
 
DrawPixel:
 
xor eax,eax
inc al
mov ebx,[Pixel.x]
mov ecx,[Pixel.y]
mov edx,[Pixel.color]
mcall
 
ret
 
RectangleContour:
 
mov eax,38
mov ebx,[Rectangle.x]
mov ecx,[Rectangle.y]
mov edx,[Rectangle.color]
mov esi,ebx
mov edi,ecx
shl ebx,16
shl ecx,16
add ebx,esi
add ecx,edi
add ebx,[Rectangle.width]
mcall
 
mov eax,38
mov ebx,[Rectangle.x]
mov ecx,[Rectangle.y]
mov edx,[Rectangle.color]
add ecx,[Rectangle.height]
mov esi,ebx
mov edi,ecx
shl ebx,16
shl ecx,16
add ebx,esi
add ecx,edi
add ebx,[Rectangle.width]
mcall
 
mov eax,38
mov ebx,[Rectangle.x]
mov ecx,[Rectangle.y]
mov edx,[Rectangle.color]
mov esi,ebx
mov edi,ecx
shl ebx,16
shl ecx,16
add ebx,esi
add ecx,edi
add ecx,[Rectangle.height]
mcall
 
mov eax,38
mov ebx,[Rectangle.x]
mov ecx,[Rectangle.y]
mov edx,[Rectangle.color]
add ebx,[Rectangle.width]
mov esi,ebx
mov edi,ecx
shl ebx,16
shl ecx,16
add ebx,esi
add ecx,edi
add ecx,[Rectangle.height]
mcall
 
ret
 
;eax -first color
;ebx- second color
;OUT
;eax - averege color
calculate_average_color:
 
and eax,0xffffff
and ebx,0xffffff
 
mov [b_min],al
mov [b_max],bl
shr eax,8
shr ebx,8
mov [g_min],al
mov [g_max],bl
shr eax,8
shr ebx,8
mov [r_min],al
mov [r_max],bl
 
xor eax,eax
xor ebx,ebx
mov al,[r_max]
mov bl,[r_min]
add eax,ebx
shr eax,1
mov [r],al
 
xor eax,eax
xor ebx,ebx
mov al,[g_max]
mov bl,[g_min]
add eax,ebx
shr eax,1
mov [g],al
 
xor eax,eax
xor ebx,ebx
mov al,[b_max]
mov bl,[b_min]
add eax,ebx
shr eax,1
mov [b],al
 
xor eax,eax
mov al,[r]
shl eax,8
mov al,[g]
shl eax,8
mov al,[b]
 
ret
 
;eax -color
;ebx- sub value
;OUT
;eax - sabved color
calculate_sabved_color:
 
and eax,0xffffff
 
mov [b],al
shr eax,8
mov [g],al
shr eax,8
mov [r],al
 
sub [r],bl
sub [g],bl
sub [b],bl
 
xor eax,eax
mov al,[r]
shl eax,8
mov al,[g]
shl eax,8
mov al,[b]
 
ret
 
DrawString:
 
mov ebx,[Button.text]
call GetLengthString
mov esi,eax
 
mov eax,4
mov ebx,[Font.x]
shl ebx,16
add ebx,[Font.y]
mov ecx,[Button.textcolor]
mov edx,[Button.text]
mcall
 
ret
 
;eax -first color
;ebx- second color
;ecx- x coordinat of rectangle
;edx- y coordinat of rectangle
;esi- rectangle size x
;edi- rectangle size y
 
rectangle_gradient_right:
 
mov [line_coordinat_x],ecx
mov [line_coordinat_y],edx
mov [line_size_x],esi
mov [line_size_y],edi
 
mov ecx,esi
mov edx,dword pointer
call gradient
 
mov ecx,[line_coordinat_y]
shl ecx,16
add ecx,[line_coordinat_y]
add ecx,[line_size_y]
 
mov eax,[line_size_x]
add [line_coordinat_x],eax
 
mov esi,dword pointer
mov edi,[line_size_x]
 
next_vertical_line_draw_right:
 
mov eax,38
mov ebx,[line_coordinat_x]
shl ebx,16
add ebx,[line_coordinat_x]
mov edx,[esi]
and edx,0xffffff
mcall
 
add esi,3
sub [line_coordinat_x],1
 
dec edi
jnz next_vertical_line_draw_right
 
ret
 
;eax -first color
;ebx- second color
;ecx- x coordinat of rectangle
;edx- y coordinat of rectangle
;esi- rectangle size x
;edi- rectangle size y
 
rectangle_gradient_left:
 
mov [line_coordinat_x],ecx
mov [line_coordinat_y],edx
mov [line_size_x],esi
mov [line_size_y],edi
 
mov ecx,esi
mov edx,dword pointer
call gradient
 
mov ecx,[line_coordinat_y]
shl ecx,16
add ecx,[line_coordinat_y]
add ecx,[line_size_y]
 
mov esi,dword pointer
mov edi,[line_size_x]
 
next_vertical_line_draw_left:
 
mov eax,38
mov ebx,[line_coordinat_x]
shl ebx,16
add ebx,[line_coordinat_x]
mov edx,[esi]
and edx,0xffffff
mcall
 
add esi,3
add [line_coordinat_x],1
 
dec edi
jnz next_vertical_line_draw_left
 
ret
 
;eax -first color
;ebx- second color
;ecx- x coordinat of rectangle
;edx- y coordinat of rectangle
;esi- rectangle size x
;edi- rectangle size y
 
rectangle_gradient_up:
 
mov [line_coordinat_x],ecx
mov [line_coordinat_y],edx
mov [line_size_x],esi
mov [line_size_y],edi
 
mov ecx,edi
mov edx,dword pointer
call gradient
 
mov ebx,[line_coordinat_x]
shl ebx,16
add ebx,[line_coordinat_x]
add ebx,[line_size_x]
 
mov eax,[line_size_y]
add [line_coordinat_y],eax
 
mov esi,dword pointer
mov edi,[line_size_y]
 
next_horizontal_line_draw_up:
 
mov eax,38
mov ecx,[line_coordinat_y]
shl ecx,16
add ecx,[line_coordinat_y]
mov edx,[esi]
and edx,0xffffff
mcall
 
add esi,3
sub [line_coordinat_y],1
 
dec edi
jnz next_horizontal_line_draw_up
 
ret
 
;eax -first color
;ebx- second color
;ecx- x coordinat of rectangle
;edx- y coordinat of rectangle
;esi- rectangle size x
;edi- rectangle size y
 
rectangle_gradient_down:
 
mov [line_coordinat_x],ecx
mov [line_coordinat_y],edx
mov [line_size_x],esi
mov [line_size_y],edi
 
mov ecx,edi
mov edx,dword pointer
call gradient
 
mov ebx,[line_coordinat_x]
shl ebx,16
add ebx,[line_coordinat_x]
add ebx,[line_size_x]
 
mov esi,dword pointer
mov edi,[line_size_y]
 
next_horizontal_line_draw_down:
 
mov eax,38
mov ecx,[line_coordinat_y]
shl ecx,16
add ecx,[line_coordinat_y]
mov edx,[esi]
and edx,0xffffff
mcall
 
add esi,3
add [line_coordinat_y],1
 
dec edi
jnz next_horizontal_line_draw_down
 
ret
 
;eax -first color
;ebx- second color
;ecx- length of line
;edx- pointer to memory for colors of gradient
 
gradient:
 
mov [length],ecx
 
and eax,0xffffff
and eax,0xffffff
 
mov [b_min],al
mov [b_max],bl
shr eax,8
shr ebx,8
mov [g_min],al
mov [g_max],bl
shr eax,8
shr ebx,8
mov [r_min],al
mov [r_max],bl
 
mov eax,[length]
dec eax
mov [v],eax
fild [v]
 
xor eax,eax
mov al,[r_max]
sub al,[r_min]
mov [v],eax
fild [v]
fdiv st0,st1
fstp [step_r]
 
xor eax,eax
mov al,[g_max]
sub al,[g_min]
mov [v],eax
fild [v]
fdiv st0,st1
fstp [step_g]
 
xor eax,eax
mov al,[b_max]
sub al,[b_min]
mov [v],eax
fild [v]
fdiv st0,st1
fstp [step_b]
 
fstp [v]
 
xor eax,eax
mov al,[r_min]
mov [r],al
mov [v],eax
fild [v]
fstp [r_f]
 
xor eax,eax
mov al,[g_min]
mov [g],al
mov [v],eax
fild [v]
fstp [g_f]
 
xor eax,eax
mov al,[b_min]
mov [b],al
mov [v],eax
fild [v]
fstp [b_f]
 
next_gradient_color_save:
 
xor ebx,ebx
xor eax,eax
mov al,[r]
mov bl,al
shl eax,8
mov al,[g]
shl eax,8
mov al,[b]
 
mov [edx],ax
mov [edx+2],bl
 
fld [step_r]
fld [r_f]
fadd st0,st1
fst [r_f]
fistp [v]
xor eax,eax
mov eax,[v]
mov [r],al
fstp [v]
 
fld [step_g]
fld [g_f]
fadd st0,st1
fst [g_f]
fistp [v]
xor eax,eax
mov eax,[v]
mov [g],al
fstp [v]
 
fld [step_b]
fld [b_f]
fadd st0,st1
fst [b_f]
fistp [v]
xor eax,eax
mov eax,[v]
mov [b],al
fstp [v]
 
add edx,3
 
dec ecx
jnz next_gradient_color_save
 
ret
 
;IN
;NON
;OUT
;variable [skin_height]
 
get_skin_height:
 
pushad
 
mov eax,48
mov ebx,4
int 0x40
 
mov [skin_height],eax
popad
 
ret
;eax - x
;ebx - y
;ecx - size x
;edx - size y
;esi - pointer to memory for rectangle
SaveFonForRectangle:
 
mov [Rectangle.x],eax
mov [Rectangle.y],ebx
mov [Rectangle.width],ecx
mov [Rectangle.height],edx
mov [PointerToMem],esi
 
;get bytes per string
mov eax,61
mov ebx,2
mcall
mov [BitsPerPixel],eax
 
mov eax,61
mov ebx,3
mcall
mov [BytesPerString],eax
 
 
;get window coordinats
mov eax,9
mov ebx,dword IPC_table
or ecx,-1
mcall
 
mov eax,dword[IPC_table+34]
mov ebx,dword[IPC_table+38]
;mov ecx,dword[IPC_table+42]
;mov edx,dword[IPC_table+46]
;mov [WindowCoordinatX],eax
;mov [WindowCoordinatY],ebx
;mov [WindowSizeX],ecx
;mov [WindowSizeY],edx
 
add eax,[Rectangle.x]
add ebx,[Rectangle.y]
 
imul ebx,[BytesPerString]
mov esi,[Rectangle.width]
 
cmp [BitsPerPixel],24
jne no_24
 
lea eax,[eax+eax*2]
lea esi,[esi+esi*2]
mov edi,3
jmp exit_bits_per_pixel
no_24:
 
shl eax,2
shl esi,2
mov edi,4
exit_bits_per_pixel:
 
add eax,ebx
 
mov ebx,[BytesPerString]
sub ebx,esi
mov [offset],ebx
 
mov esi,[PointerToMem]
mov edx,[Rectangle.height]
next_string_pixels_save:
 
mov ecx,[Rectangle.width]
next_pixel_save:
 
mov ebx,[gs:eax]
and ebx,0xffffff
mov [esi],bx
shr ebx,16
mov [esi+2],bl
 
add esi,3
add eax,edi
dec ecx
jnz next_pixel_save
 
add eax,[offset]
dec edx
jnz next_string_pixels_save
 
exit_:
ret
/programs/develop/libGUI/src/edit_box.inc
0,0 → 1,249
 
eb_control_data_size = 82
 
;****************************************************
;******************craete EditBox*********************
;****************************************************
;IN
;pointer to parend
;pointer to EditBox's structure
;OUT
;pointer to initialized control
align 4
 
craete_edit_box:
 
mov ebx,[esp+4]
mov eax,[esp+8]
 
mov [PointerToStructureForEditBox],eax
 
mov eax,control_header_size+eb_control_data_size
call craete_control
 
;set all EditBox's parameters in control
mov [eax],dword edit_box
 
mov ecx,eb_control_data_size
mov esi,[PointerToStructureForEditBox]
mov edi,eax
add edi,control_header_size
rep movsb
 
call get_skin_height
 
mov ebx,[PointerToStructureForEditBox]
mov ecx,[ebx+4] ;x
mov edx,[ebx+8] ;y
mov esi,[ebx] ;size x
mov edi,[ebx+70] ;size y
add ecx,border_width
add edx,[skin_height]
;copy information to control
mov [eax+24],ecx
mov [eax+28],edx
mov [eax+32],esi
mov [eax+36],edi
 
ret 8
 
;****************************************************
;******************Draw EditBox**********************
;****************************************************
;include 'editbox_mac.inc'
;IN
;pointer to control of EditBox
;message
;OUT
;not returned value
align 4
 
include 'editbox_mac.inc'
 
edit_box:
;;;;;;;;;;;;
;Structure from libGui  á®æ¨ æ¨ï áâàãªâãà
;;;;;;;;;;;;
 
;get message
mov eax,[esp+8]
 
;get pointer to control of button
mov esi,[esp+4]
mov [PointerForEditBox],esi
 
;copy control to local control
add esi,control_header_size
mov edi,dword EditBox
mov ecx,eb_control_data_size
rep movsb
 
;;;;;;;;;;;;
;Structure from libGui  á®æ¨ æ¨ï áâàãªâãà
;;;;;;;;;;;;
srt_ed_libgui
 
push eax
;load coordinats and size from control
mov eax,[PointerForEditBox]
mov ebx,[eax+24] ;x
mov ecx,[eax+28] ;y
mov edx,[eax+32] ;size x
mov esi,[eax+36] ;size y
;set current coordinats and sizes in EeditBox
mov [EditBox.ed_left],ebx
mov [EditBox.ed_top],ecx
mov [EditBox.ed_width],edx
mov [EditBox.ed_height],esi
pop eax
 
;events of redraw all EditBox
 
cmp [eax],dword 1
jne .no_redraw_all_edit_box
 
 
call .draw_border
.draw_bg_cursor_text:
 
call .check_offset
 
call .draw_bg
 
call .draw_shift
.draw_cursor_text:
 
test word[EditBox.ed_flags],ed_focus
je @f
call .draw_cursor
@@:
call .draw_text
 
jmp .editbox_exit;exit_edit_box
.no_redraw_all_edit_box:
 
 
;events of keys for EditBox
 
cmp [eax],dword 2
jne .no_keys_edit_box
 
mov ebx,[eax+4]
shl ebx,8
mov eax,ebx
 
test word [EditBox.ed_flags],ed_focus
je .editbox_exit;exit_edit_box;@b
 
call .check_shift
 
;----------------------------------------------------------
;--- ¯à®¢¥à塞, çâ® ­ ¦ â® --------------------------------
;----------------------------------------------------------
 
use_key_process backspase,delete,left,right,home,end,insert
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;‡ £«ã誠 ­  ®¡à ¡®âªã ª« ¢¨è ¢¢¥àå ¨ ¢­¨§ â.¥. ¯à¨
;®¡­ à㦥­¨¨ íâ¨å ª®¤®¢ ¯à®¨á室¨â ¢ë室 ¨§ ®¡à ¡®â稪 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
srt_ed_libgui
use_key_no_process up,down,esc
 
;--- ­ ¦ â  ¤àã£ ï ª« ¢¨è  ---
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;à®¢¥àª  ãáâ ­®¢«¥­ «¨ ä« £ ¯à¨ ª®â®à®¬ ­ã¦­® ¢ë¢®¤¨âì
;⮫쪮 æ¨äàë ¢ ­ã¦­®¬ ¡®ªá¥ ¥á«¨ â ª®© ­¥®¡å®¤¨¬®á⨠­¥â
;­ã¦­® § ª®¬¥­â¨à®¢ âì ¬ ªà®á
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
use_key_figures_only
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;¯à®¢¥àª  ­  shift ¡ë« «¨ ­ ¦ â
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
are_key_shift_press
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ¯à®¢¥à塞, ­ å®¤¨âáï «¨ ªãàá®à ¢ ª®­æ¥ + ¤ «ì­¥©è ï ®¡à ¡®âª 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
are_key_cur_end
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Ž¡à ¡®âª  ª« ¢¨è insert,delete.backspase,home,end,left,right
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
use_work_key
 
 
.no_keys_edit_box:
 
;events of mouse for EditBox
 
cmp [eax],dword 6
jne .editbox_exit
 
mov esi,[eax+4]
mov edi,[eax+8]
mov ecx,[eax+12]
mov [EditBox.mouseX],esi
mov [EditBox.mouseY],edi
mov [ButtonsOfMouse],ecx
 
mov eax,ecx
 
test eax,1
jnz .mouse_left_button
and word [EditBox.ed_flags],ed_mouse_on_off
jmp .editbox_exit
 
.mouse_left_button:
 
mov eax,[EditBox.mouseX]
shl eax,16
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;”ã­ªæ¨ï ®¡à ¡®âª¨ ¬ë誨 ¯®«ã祭¨¥ ª®®à¤¨­ â ¨ ¯à®¢¥àª  ¨å + ¢ë¤¥«¥­¨ï
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
use_work_mouse ;scr_h,scr_w
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Ž¡é¨¥ ä㭪樨 ®¡à ¡®âª¨
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
use_general_func
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;”㭪樨 ¤«ï à ¡®âë á key
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
use_key_func
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;”㭪樨 ¤«ï à ¡®âë á mouse
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
use_mouse_func ;scr_w
 
;;;;;;;;;;;;;;;;;;;;;;;;;;
;Ž¡é¨© ¢ë室 ¨§ editbox ¤«ï ¢á¥å ä㭪権 ¨ ¯®áâ ®¡à ¡®â稪®¢
;;;;;;;;;;;;;;;;;;;;;;;;;;
 
.editbox_exit:
 
exit_edit_box:
 
;save resulatat of work in control
mov esi,dword EditBox
mov edi,[PointerForEditBox]
add edi,control_header_size
mov ecx,eb_control_data_size
rep movsb
 
ret 8
 
/programs/develop/libGUI/src/editbox_mac.inc
0,0 → 1,1143
;Œ ªà®á ¤«ï ¢ë¢®¤  ®á­®¢­ëå ä㭪権 ª®â®àë¥ ¨á¯«ì§ãîâáï ¡®ªá®¬
macro use_general_func
{
;debug_func
;----------------------------------------------------------
;--- ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ ¢ë¤¥«¥­®© ç á⨠-----------------
;----------------------------------------------------------
.draw_shift:
test word [EditBox.ed_flags],ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
jz @f
mov ebp,[EditBox.shift_color]
mov ebx,dword ed_shift_pos
call .sh_cl_
@@: ret
;----------------------------------------------------------
;--- ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ ⥪áâ  --------------------------
;----------------------------------------------------------
.draw_text:
;--- ¢ëç¨á«ï¥¬, ᪮«ìª® ¯®¬¥é ¥âáï ᨬ¢®«®¢ ---
;--- çâ®¡ë ¬ãá®à ­¥ à¨á®¢ âì ---
call .get_n
mov esi,[EditBox.ed_size]
mov ebx,ed_offset
sub esi,ebx
cmp eax,esi
jae @F
mov esi,eax ;çâ®¡ë ­¥ ¢ë室¨âì §  ¯à¥¤¥«ë íªà ­ 
;--- à¨á㥬 ⥪áâ ---
@@: mov eax,4
mov ebx,[EditBox.ed_left]
mov edx,ed_offset
add ebx,2
shl ebx,16
add ebx,[EditBox.ed_top]
mov ecx,[EditBox.ed_text_color]
add ebx,4
add edx,[EditBox.ed_text]
mcall
ret
;----------------------------------------------------------
;--- ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ ä®­  ----------------------------
;¢å®¤­ë¥ ¤ ­­ë¥
;eax
;edx - color
;----------------------------------------------------------
;¢å®¤ ⮫쪮 梥â edx
.draw_bg:
mov ebx,[EditBox.ed_left]
add ebx,1
mov edx,[EditBox.ed_color]
shl ebx,16
add ebx,[EditBox.ed_width]
sub ebx,1
.draw_bg_eax:
mov ecx,[EditBox.ed_top]
mov eax,13
add ecx,1
shl ecx,16
add ecx,ed_height
dec ecx
mcall
ret
 
;----------------------------------------------------------
;--- ¯à®æ¥¤ãà  ¯®«ã祭¨ï ª®«¨ç¥á⢠ ᨬ¢®«®¢ ¢ ⥪ã饩 é¨à¨­¥ ª®¬¯®­¥­â 
;----------------------------------------------------------
.get_n:
mov eax,[EditBox.ed_width] ;¯®«ã祬 è¨à¨­ã ª®¬¯®­¥­â 
xor edx,edx ;१ã«ìâ â à á¯®«®£ ¥âáï ¢ ¯ à¥ edx:eax ¢ eax - ®áâ â®ª
sub eax,4 ;¢ëç⨬ 4
mov ebx,6 ;§ £à㧬¨ ¤¥«¨â¥«ì
div ebx ;à §¬¤¥«¨¬ ­  6
ret
;----------------------------------------------------------
;--- ¯à®æ¥¤ãà  à¨á®¢ ­¨ï ªãàá®à  --------------------------
;----------------------------------------------------------
;¢å®¤­ë¥ ebp- 梥â
.clear_cursor:
mov edx,ebp
mov ebx,cl_curs_x
mov ecx,cl_curs_y
jmp .draw_curs
.draw_cursor:
mov edx,[EditBox.ed_text_color]
mov ebx,ed_pos
mov ecx,ed_offset
sub ebx,ecx
 
lea ebx,[ebx*2+ebx]
shl ebx,1
;imul ebx,6
add ebx,[EditBox.ed_left]
mov ecx,[EditBox.ed_top]
inc ebx
add ecx,2
mov ebp,ebx
shl ebx,16
mov bx,bp
mov ebp,ecx
 
shl ecx,16
mov cx,bp
add ecx,ed_height-4
 
mov cl_curs_x,ebx
mov cl_curs_y,ecx
.draw_curs:
mcall 38
ret
;----------------------------------------------------------
;--- ¯à®æ¥¤ãà  à¨á®¢ ­¨ï à ¬ª¨ ----------------------------
;----------------------------------------------------------
.draw_border:
;--- 梥â à ¬ª¨ ---
test word [EditBox.ed_flags],ed_focus
mov edx,[EditBox.ed_focus_border_color]
jne @f
mov edx,[EditBox.ed_blur_border_color]
@@:
;--- ᢥàåã ---
mov eax,38
mov ebx,[EditBox.ed_left]
mov ecx,ebx
shl ebx,16
mov bx,cx
add ebx,[EditBox.ed_width]
mov ecx,[EditBox.ed_top]
mov esi,ecx
shl ecx,16
mov cx,si
mcall
;--- á­¨§ã ---
mov esi,ecx
add ecx,ed_height
mov ebp,ecx
shl ecx,16
mov cx,bp
mcall
;--- á«¥¢  ---
mov cx,si
mov ebp,ebx
sub ebx,[EditBox.ed_width]
mcall
;--- á¯à ¢  ---
mov ebx,ebp
shl ebx,16
mov bx,bp
mcall
ret
;----------------------------------------------------------
;--- ¯à®¢¥àª , § è¥« «¨ ªãàá®à §  £à ­¨æë ¨, ¥á«¨ ­ ¤®, ---
;--- ¨§¬¥­ï¥¬ ᬥ饭¨¥ ------------------------------------
;--- ¥á«¨ ᬥ饭¨¥ ¡ë«® ãáâ ­®¢ª  ä« £  ed_offset_cl ¨­ ç¥
; ¥á«¨ ­¨ç¥£® ­¥ ¨§¬¥­¨«®áì â® ¢ëáâ ¢«¥­¨¥ ed_offset_fl
; ¢ ®¡é¥© ¡¨â®¢®© ¬ àà¨æ¥ á®áâ®ï­¨ï ª®¬¯®­¥­â®¢ word [EditBox.ed_flags]
;----------------------------------------------------------
.check_offset:
pusha
mov ecx,ed_pos
mov ebx,ed_offset
cmp ebx,ecx
ja .sub_8
 
push ebx
call .get_n ;¯®«ã稬 ª®«-¢® ᨬ¢®«®¢ ¢ ¯ à¥ ॣ¨áâ஢ edx:eax
pop ebx
mov edx,ebx
add edx,eax ;ed_offset+width editbox
inc edx ;­¥®¡å®¤¨¬® ¤«ï ­®¬ «ì­®£® ¯®«®¦¥­¨ï ªãàá®à  ¢ ªà ©­¥© «¥¢®© ¯®§¨æ¨¨
cmp edx,ecx
ja @f
 
mov edx,[EditBox.ed_size]
cmp edx,ecx
je .add_end
 
sub edx,ecx
cmp edx,8
jbe .add_8
add ebx,8
jmp .chk_d
 
.sub_8: cmp ecx,0
je .sub_min
cmp ebx,8
jbe .sub_min
sub ebx,8 ;ebx=ed_offset
jmp .chk_d
.sub_min:
xor ebx,ebx
jmp .chk_d
 
.add_end:sub edx,eax
mov ebx,edx
jmp .chk_d
.add_8: add ebx,edx
.chk_d: mov ed_offset,ebx
call .draw_bg
and word [EditBox.ed_flags],ed_offset_cl
edit_ex
@@:
or word [EditBox.ed_flags],ed_offset_fl
edit_ex
}
 
macro use_key_func
{
;Ž¡à ¡®âª  Shift ¤«ï á­ïâ¨ï ¢ë¤¥«¥­¨ï ­¥¨§¢¥áâ­®© ®¡« áâ¨
.shift: ;;;;;;;SHIFT
test word [EditBox.ed_flags],ed_shift
je .f_exit
 
@@: mov ebp,[EditBox.shift_color]
or word [EditBox.ed_flags],ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
mov ebx,dword ed_shift_pos
call .sh_cl_
jmp .draw_cursor_text
;;;;;;;;;;;;;;;;;;;;;
.f_exit:call .check_offset
and word [EditBox.ed_flags],ed_shift_cl
call .enable_null
jmp .draw_cursor_text
.sh_cl_:
;;;;;;SHIFT end
;®¡à ¡®âª  ®ç¨á⪨, ¯à¨ «¥¢®¬ - ¯à ¢®¬ ¤¢¨¦¥­¨¨ ¢ë¤¥«¥­¨ï
;¤«ï ®¡à ¡®âª¨ á­ïâ¨ï ¢ë¤¥«¥­¨ï
;¢å®¤­ë¥ ¯ à ¬¥âàë ebp=color ebx=ed_shift_pos
mov eax,dword ed_pos
cmp eax,ebx
 
jae .sh_n
push eax ;¬¥­ì襥 ¢ eax
push ebx ;¡®«ì襥
jmp .sh_n1
;¥á«¨ ¨­ ç¥
.sh_n: push ebx
push eax
.sh_n1:
call .check_offset
call .get_n
mov edx,eax ;size of ed_box
mov ecx,ed_offset
add eax,ecx ;eax = w_off= ed_offset+width
mov edx,eax ;save
pop ebx ;¡®«ì襥
pop eax ;¬¥­ì襥
 
cmp eax,ecx ;áà ¢­¥­¨¥ á ¬¥­ì襣® á offset.
jae .f_f ;¥á«¨ ¡®«ìè¥
xor eax,eax
cmp edx,ebx ;cà ¢­¨¬ à §¬¥à w_off á ¡®«ì訬
jb @f
sub ebx,ecx
jmp .nxt_f
@@: mov ebx,edx
sub ebx,ecx
jmp .nxt_f
.f_f:
sub eax,ecx
cmp edx,ebx ;cà ¢­¨¬ à §¬¥à w_off á ¡®«ì訬
jle @f
sub ebx,ecx
sub ebx,eax
jmp .nxt_f
@@:
mov ebx,edx
sub ebx,ecx
sub ebx,eax
.nxt_f:
mov edx,ebx
lea ebx,[eax*2+eax]
shl ebx,1
add ebx,[EditBox.ed_left]
inc ebx
shl ebx,16
lea ecx,[edx*2+edx]
shl ecx,1
mov bx,cx
inc ebx
mov edx,ebp;[EditBox.shift_color]
 
call .draw_bg_eax
@@: call .enable_null
ret
;;;;;;;;;;;;;;;;;;;;;
;“áâ ­®¢ª - á­ï⨥ ¢ë¤¥«¥­¨ï ¢ ®¤¨­ ᨬ¢®«
;;;;;;;;;;;;;;;;;;;;;
.drw_sim:
mov eax,dword ed_pos
call .draw_rectangle ;­ à¨á®¢ âì ¯àאַ㣮«ì­¨ª á § ¤ ­­ë¬ 梥⮬
jmp @b
;;;;;;;;;;;;;;;;;;;;;
;”ãªæ¨ï ãáâ ­®¢ª¨ ¢ë¤¥«¥­¨ï ¯à¨ ¤¢¨¦¥­¨ï ¢«¥¢® ¨ ¢¯à ¢® ¨ ­ ¦ â¨¨ shift
;‹®£¨ª :
;;;;;;;;;;
.draw_wigwag:
;äã­ªæ¨ï ãáâ ­®¢ª¨ ¯¥à¥¬¥­­ëå
mov ebp,[EditBox.shift_color]
call .clear_cursor
 
or word [EditBox.ed_flags],ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
mov ebp,[EditBox.shift_color]
mov eax,dword ed_pos
test word [EditBox.ed_flags],ed_left_fl
jz .low
jmp @f
;;;;;;;;;;
;”ãªæ¨ï 㤠«¥­¨ï ¢ë¤¥«¥­¨ï ¯à¨ ¤¢¨¦¥­¨ï ¢«¥¢® ¨ ¢¯à ¢® ¨ ­ ¦ â¨¨ shift
;‹®£¨ª :
;;;;;;;;;;
.draw_wigwag_cl:
;äã­ªæ¨ï ãáâ ­®¢ª¨ ¯¥à¥¬¥­­ëå
mov ebp,[EditBox.ed_color]
call .clear_cursor
 
mov ebp,[EditBox.ed_color]
mov eax,dword ed_pos
test word [EditBox.ed_flags],ed_left_fl
jz .low
@@: call .draw_rectangle ;­ à¨á®¢ âì ¯àאַ㣮«ì­¨ª § ªà è¨¢ ¥¬®© ®¡« áâ¨
ret
.low: dec eax
jmp @b
;¢å®¤­®© ¯ à ¬¥âà ebx - ed_pos
.sh_first_sh:
test word [EditBox.ed_flags],ed_shift
je @f
mov dword ed_shift_pos_old,ebx
test word [EditBox.ed_flags],ed_shift_on
jne @f
mov dword ed_shift_pos,ebx
or word [EditBox.ed_flags],ed_shift_on
@@: ret
;Ž¡à ¡®âª  ªà ©­¨å ¯®«®¦¥­¨© ¢ editbox ¯à¨ ­ ¦ â®¬ shift
;¯à®¨§¢®¤¨â á­ï⨥ ¢ë¤¥«¥­¨¥, ¥á«¨ ­¥â shift
;¨­ ç¥ ¢®®¡é¥ ¢ë室¨â
.sh_st_of:
test word [EditBox.ed_flags],ed_shift
jne @f
test word [EditBox.ed_flags],ed_shift_bac
je @f
mov ebp,[EditBox.ed_color]
mov ebx,dword ed_shift_pos
call .sh_cl_ ;®ç¨á⪠ ¢ë¤¥«¥­®£® äà £¬¥­â 
and word [EditBox.ed_flags],ed_shift_cl ; ®ç¨á⪠ ®â ⮣® çâ® ã¡à «¨ ¢ë¤¥«¥­¨¥
jmp .draw_cursor_text
@@:
and word [EditBox.ed_flags],ed_shift_off
edit_ex
;¯à®¢¥àª  á®áâ®ï­¨ï shift ¡ë« «¨ ®­ ­ ¦ â à ­ìè¥?
.sh_enable:
test word [EditBox.ed_flags],ed_shift
jne .sh_ext_en ;­ à¨á®¢ âì § ªà è¥­ë© ¯àאַ㣮«ì­¨ª
 
test word [EditBox.ed_flags],ed_shift_bac
je @f
call .check_offset
 
mov ebp,[EditBox.ed_color]
mov ebx,dword ed_shift_pos
call .sh_cl_ ;®ç¨á⪠ ¢ë¤¥«¥­®£® äà £¬¥­â 
call .draw_wigwag_cl
and word [EditBox.ed_flags],ed_shift_cl ; 1¢ à ­¥ ­ã¦­®
ret
 
@@: mov ebp,[EditBox.ed_color]
call .clear_cursor
call .check_offset
ret
.sh_ext_en:
call .check_offset
test word [EditBox.ed_flags],ed_offset_fl
je @f
;¨á®¢ ­¨¥ § ªà è¥­ëå ¯àאַ㣮«ì­¨ª®¢ ¨ ®ç¨á⪠ ¨å
mov eax,dword ed_shift_pos
mov ebx,dword ed_pos
mov ecx,dword ed_shift_pos_old
;¯à®¢¥àª  ¨ à¨á®¢ ­¨¥ § ªà è¥­ëå ®¡« á⥩
cmp eax,ecx
je .1_shem
jb .smaller
cmp ecx,ebx
ja .1_shem
call .draw_wigwag_cl ;clear
jmp .sh_e_end
.smaller:
cmp ecx,ebx
jb .1_shem
call .draw_wigwag_cl ;clear
jmp .sh_e_end
;alike =
.1_shem: call .draw_wigwag
.sh_e_end: and word [EditBox.ed_flags],ed_shift_off
ret
@@: mov ebp,[EditBox.shift_color]
mov ebx,dword ed_shift_pos
call .sh_cl_
jmp .sh_e_end
;äã­ªæ¨ï ¤«ï ®¡à ¡®âª¨ shift ¯à¨ ­ ¦ â¨¨ home and end
.sh_home_end:
mov ebp,[EditBox.ed_color]
call .clear_cursor
test word [EditBox.ed_flags],ed_shift_bac
je @f
mov ebp,[EditBox.ed_color]
mov ebx,dword ed_shift_pos_old
call .sh_cl_
 
@@: test word [EditBox.ed_flags],ed_shift
je .sh_exit_ ;¢ë©â¨
mov ebp,[EditBox.shift_color]
mov ebx,dword ed_shift_pos
call .sh_cl_
or word [EditBox.ed_flags],ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
jmp .sh_e_end
.sh_exit_: call .check_offset
ret
;äã­ªæ¨ï ¢­¥á¥­¨ï 0 ¯®  ¤à¥áã [EditBox.ed_size]+1
.enable_null:
pusha
mov eax,[EditBox.ed_size]
mov ebx,[EditBox.ed_text]
test eax,eax
add eax,ebx
jne @f
inc eax
@@: xor ebx,ebx
mov [eax],bl
edit_ex
;- 㤠«¥­¨¥ ᨬ¢®« 
;‚室­ë¥ ¤ ­­ë¥ edx=[EditBox.ed_size];ecx=ed_pos
.del_char:
mov esi,[EditBox.ed_text]
test word [EditBox.ed_flags],ed_shift_on
je @f
mov eax,dword ed_shift_pos
mov ebx,esi
cmp eax,ecx
jae .dh_n
 
mov ed_pos,eax ;çâ® ¡ë ­¥ ¡ë«® ã¡¥£ ­¨ï ªãàá®à 
mov ebp,ecx
sub ebp,eax
add ebx,eax ;eax ¬¥­ìè¥
sub edx,ecx
add esi,ecx
 
mov dword ed_shift_pos,ebp
jmp .del_ch_sh
;¥á«¨ ¨­ ç¥
.dh_n:
mov ebp,eax
sub ebp,ecx
add ebx,ecx
sub edx,eax
add esi,eax
mov dword ed_shift_pos,ebp
jmp .del_ch_sh
 
@@: add esi,ecx ;㪠§ â¥«ì + ᬥ饭¨¥ ª ॠ«ì­®¬ã ¡ãää¥àã
mov ebx,esi
inc esi
cld
 
sub edx,ecx
.del_ch_sh:
 
push edi
mov edi,ebx
@@:
lodsb
stosb
dec edx
jns @b
 
pop edi
ret
;¢ëç¨á«¨âì § ªà è¨¢ ¥¬ãî ®¡« áâì
;ᮣ« è¥­¨¥ ¢ ebp - ¯¥à¥¤ ¥âáï [EditBox.ed_size]
.clear_bg:
call .get_n ;¯®«ãç¨âì à §¬¥à ¢ ᨬ¢®« å è¨à¨­ë ª®¬¯®­¥­â 
push eax
mov ebx,ed_offset
add eax,ebx ;eax = w_off= ed_offset+width
mov ebx,ebp ;[EditBox.ed_size]
 
cmp eax,ebx
jb @f
mov eax,ed_pos
sub ebx,eax
mov ecx,ed_offset
sub eax,ecx
jmp .nxt
@@: mov ebx,ed_pos
push ebx
sub eax,ebx
mov ebx,eax ;It is don't optimal
 
pop eax ;ed_pos
mov ecx,ed_offset
sub eax,ecx
.nxt:
mov ebp,eax ;¯à®¢¥àª  ­  ¢ë室 § ªà è¨¢ ¥¬®© ®¡« á⨠§  ¯à¥¤¥«ë ¤«¨­ë
add ebp,ebx
pop edx
cmp ebp,edx
je @f
inc ebx
 
@@: mov edx,ebx
lea ebx,[eax*2+eax]
shl ebx,1
add ebx,[EditBox.ed_left]
inc ebx
shl ebx,16
lea ecx,[edx*2+edx]
shl ecx,1
mov bx,cx
mov edx,[EditBox.ed_color]
call .draw_bg_eax
ret
;;;;;;;;;;;;;;;;;;;
;;; Ž¡à ¡®âª  ¯à¨¬¨â¨¢®¢
;;;;;;;;;;;;;;;;;;;;
; à¨á®¢ âì ¯àאַ㣮«ì­¨ª, 梥⠯¥à¥¤ ¥âáï ¢ ebp
;¢å®¤­ë¥ ¯ à ¬¥âàë:
;eax=dword ed_pos
;ebp=-梥â [EditBox.ed_color] or [EditBox.shift_color]
.draw_rectangle:
mov ecx,dword ed_offset
sub eax,ecx
lea ebx,[eax*2+eax]
shl ebx,1
inc ebx
add ebx,[EditBox.ed_left]
shl ebx,16
add ebx,6
mov edx,ebp
call .draw_bg_eax
ret
;;;;;;;;;;;;;;;;;;
;;à®¢¥àª  ­ ¦ â «¨ shift
;;;;;;;;;;;;;;;;;;
.check_shift:
pusha ;á®åà ­¨¬ ¢á¥ ॣ¨áâàë
mcall 66,3,1
test al,0x03
je @f
or word [EditBox.ed_flags],ed_shift ;ãáâ ­®¢¨¬ ä« £
@@:edit_ex
}
;¬ ªà®á ª« ¢¨è ­  ª®â®àë¥ ¯à®¨á室¨â ॠªæ¨ï
macro use_key_process backspase,delete,left,right,home,end,insert
{
if backspase eq
else
cmp ah,8
jz .backspace
end if
if delete eq
else
cmp ah,0xb6
jz .delete
end if
if left eq
else
cmp ah,176
jz .left
end if
if right eq
else
cmp ah,179
jz .right
end if
if home eq
else
cmp ah,180
jz .home
end if
if home eq
else
cmp ah,181
jz .end
end if
if insert eq
else
cmp ah,185 ;insert
jz .insert
end if
}
macro use_key_no_process up,down,esc
{
if up eq
else
cmp ah,177
jz .editbox_exit
end if
if down eq
else
cmp ah,178
jz .editbox_exit
end if
if esc eq
else
cmp ah,27 ;ESC - ª« ¢¨è  ))
jz .editbox_exit
end if
}
 
macro use_key_figures_only
{
test word [EditBox.ed_flags],ed_figure_only ; ⮫쪮 æ¨äàë ?
jz @f
cmp ah,'0'
jb .editbox_exit
cmp ah,'9'
ja .editbox_exit
@@:
}
macro are_key_shift_press
{
test word [EditBox.ed_flags],ed_shift_on
je @f
;‚室­ë¥ ¤ ­­ë¥ edx=[EditBox.ed_size];ecx=ed_pos
push eax
mov edx,[EditBox.ed_size]
mov ecx, ed_pos
pusha
;;;;;;;;;;;;;;;;;;;;;
mov ebp,[EditBox.ed_color]
mov ebx,dword ed_shift_pos
call .sh_cl_
;;;;;;;;;;;;;;;;;;;;;
popa
call .del_char
;;;;
mov eax,dword ed_shift_pos
mov ebx,[EditBox.ed_size]
sub ebx,eax
mov [EditBox.ed_size],ebx
pop eax
@@:
}
macro are_key_cur_end
{
mov ecx,[EditBox.ed_size]
mov edx, [EditBox.ed_max]
test word [EditBox.ed_flags],ed_insert
jne @f
cmp ecx,edx
jae .editbox_exit
@@: mov ebx, ed_pos
cmp ebx,edx
jl @f ; ¥á«¨ ¬¥­ìè¥ ¨«¨ à ¢­®
jmp .editbox_exit
 
@@: ; ᤢ¨£ ¥¬ ᨬ¢®«ë ¯®á«¥ ªãàá®à  ¢¯à ¢®
mov ecx,[EditBox.ed_size]
push edi eax
mov ebp,edi
mov esi,[EditBox.ed_text] ; “ª § â¥«ì ­  ¡ãä¥à
;ã¤¥¬ à ¡®â âì á® áâப®©
add esi,ecx ;add [EditBox.ed_size] ¤®¡ ¢¨¬ max size
mov edi,esi
 
cmp ecx,ebx ;…᫨ ã ­ á ¯®§¨æ¨ï ªãàá®à  = ⥪ã饬ã à §¬¥àã ­ ¯¥ç â ­­ëå ᨬ¢®«®¢ â.¥. ªãàá®à á⮨⠢ ª®­æ¥
je .In_k
 
test word [ebp+40],ed_insert ;IF insert is enable â.ª. edi ¨§¬¥­¥­  ¤à¥á㥬 ç¥à¥§ ebp
jne .ins_v
;clear
pusha
mov edi,ebp
mov ebp,[EditBox.ed_size]
call .clear_bg
popa
sub ecx,ebx ; ©¤¥¬ ª®«-¢® ᨬ¢®«®¢ ¤«ï ¯¥à¥¤¢¨¦¥­¨ï.
inc edi ;‘¬¥á⨬ ­ è¨ ᨬ¢®«ë ¢ ¯à ¢®
std
inc ecx
@@:
;--------
lodsb
stosb
;--------
loop @b
.In_k: cld
pop eax
mov al,ah
stosb
pop edi
; ¢áâ ¢«ï¥¬ ª®¤ ª« ¢¨è¨ â㤠, £¤¥ ªãàá®à
; 㢥«¨ç¨¢ ¥¬ §­ ç¥­¨¥ à §¬¥à  ¨ ¯®§¨æ¨¨
inc dword [EditBox.ed_size]
inc dword ed_pos
call .draw_all2
jmp .shift
}
macro use_work_key
{
.insert: test word [EditBox.ed_flags],ed_insert ;not word ed_insert
je @f
and word [EditBox.ed_flags],ed_insert_cl
jmp .editbox_exit
@@:
or word [EditBox.ed_flags],ed_insert
jmp .editbox_exit
.ins_v:
dec dword [ebp+42];[EditBox.ed_size] ;processing is insert
sub esi,ecx
add esi,ebx
mov edi,esi
;clear
pusha
mov edi,ebp
mov ebp,ed_pos
call .clear_bg
popa
jmp .In_k
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.delete:
mov edx,[EditBox.ed_size]
mov ecx,ed_pos
cmp edx,ecx
jg .bac_del
test word [EditBox.ed_flags],ed_shift_on
jne .del_bac
edit_ex
.bac_del:
call .del_char
jmp .draw_all
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;--- ­ ¦ â  ª« ¢¨è  backspace ---
.backspace:
; ¯à®¢¥à塞, ªãàá®à ã «¥¢®£® ªà ï ?
mov ecx,ed_pos
test ecx,ecx
jnz .del_bac
test word [EditBox.ed_flags],ed_shift_on
jne .bac_del
 
edit_ex
.del_bac:
mov edx,[EditBox.ed_size]
cmp edx,ecx ;if ed_pos=[EditBox.ed_size]
je @f
dec ecx
call .del_char
@@: test word [EditBox.ed_flags],ed_shift_on
jne .bac_del
dec dword ed_pos
.draw_all:
push .shift;.draw_cursor_text;eax
 
test word [EditBox.ed_flags],ed_shift_on
je @f
mov eax,dword ed_shift_pos
mov ebx,[EditBox.ed_size]
sub ebx,eax
mov [EditBox.ed_size],ebx
 
mov ebp,[EditBox.ed_color]
call .clear_cursor
call .check_offset
call .draw_bg
ret
@@: dec dword [EditBox.ed_size]
 
.draw_all2:
and word [EditBox.ed_flags],ed_shift_cl
mov ebp,[EditBox.ed_color]
call .clear_cursor
call .check_offset
mov ebp,[EditBox.ed_size]
call .clear_bg
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;--- ­ ¦ â  ª« ¢¨è  left ---
.left: mov ebx,ed_pos
test ebx,ebx
jz .sh_st_of
or word [EditBox.ed_flags],ed_left_fl
call .sh_first_sh
dec dword ed_pos
call .sh_enable
jmp .draw_cursor_text
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;--- ­ ¦ â  ª« ¢¨è  right ---
.right: mov ebx,ed_pos
cmp ebx,[EditBox.ed_size]
je .sh_st_of
and word [EditBox.ed_flags],ed_right_fl
call .sh_first_sh
inc dword ed_pos
call .sh_enable
jmp .draw_cursor_text
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.home:
mov ebx,ed_pos
test ebx,ebx
jz .sh_st_of
call .sh_first_sh
xor eax,eax
mov ed_pos,eax
call .sh_home_end
jmp .draw_cursor_text
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.end:
mov ebx,ed_pos
cmp ebx,dword [EditBox.ed_size]
je .sh_st_of
call .sh_first_sh
mov eax,[EditBox.ed_size]
mov ed_pos,eax
call .sh_home_end
jmp .draw_cursor_text
}
 
macro use_mouse_func scr_w
{
;----------------------------------------------------------
;--- Ž¡à ¡®âª  .mouse_wigwag
;----------------------------------------------------------
.mouse_wigwag:
shr eax,16
or word [EditBox.ed_flags],ed_shift_bac+ed_shift_on+ed_shift
;;;;;;;;;;;;;;;;;;
;;¯à®æ¥¤ãà  ®¡à ¡®âª¨ ¯®«®¦¥­¨ï ¢ë¤¥«¥­­®£® ⥪áâ , ª®£¤  ¯à®¨á室¨â ¢ë室 §  ¯à¥¤¥«ë editbox
;;;;;;;;;;;;;;;;;;
;mov ebx,[IPC_table.box.left]
mov ebx,[EditBox.ed_left]
;if scr_w eq
;else
; add ebx,dword scr_w
;end if
cmp eax,ebx
jb .mleft
 
add ebx,[EditBox.ed_width]
cmp eax,ebx
ja .mright
 
sub ebx,[EditBox.ed_width]
 
xor edx,edx
sub eax,ebx ; ¢ëç⨬ ¨§ ª®®à¤¨­ â ¬ë誨 ¯® ®á¨ å ª®®à¤¨­ âë ¤® editbox ¯® ®á¨ å
mov ebx,6
div ebx
;;;;;;;;;;;;;;;;;;
;;¯à®æ¥¤ãà  ®¡à ¡®âª¨ ¯®«®¦¥­¨ï ¢ë¤¥«¥­­®£® ⥪áâ , ¢ ¯à¥¤¥« å ®¡« á⨠editbox
;;;;;;;;;;;;;;;;;;
;®«ã稫¨ ª®®à¤¨­ âë ¢ eax ¬ë誨, â.¥. ªã¤  ®­  ¯¥à¥¬¥á⨫ áì
;¨á®¢ ­¨¥ § ªà è¥­ëå ¯àאַ㣮«ì­¨ª®¢ ¨ ®ç¨á⪠ ¨å
add eax,ed_offset ;¤®¡ ¢¨¬ ᬥ饭¨¥
cmp eax,dword [EditBox.ed_size] ;¥á«¨ ¢ë諨 §  ¯à¥¤¥«ë, â® ­¨ç¥£® ­¥ ¤¥« âì
ja .mwigvag
.mdraw:
mov dword ed_pos,eax ;á®åà ­¨¬ ­®¢®¥ §­ ç¥­¨¥
;¨á®¢ ­¨¥ § ªà è¥­ëå ¯àאַ㣮«ì­¨ª®¢ ¨ ®ç¨á⪠ ¨å
mov ecx,dword ed_shift_pos
mov ebx,dword ed_shift_pos_old
mov dword ed_shift_pos_old,eax ;¢­¥á¥¬ ­®¢®¥ §­ ç¥­¨¥ áâ à®© ¯®§¨æ¨¨ ªãàá®à 
;¯à®¢¥àª  ¨ à¨á®¢ ­¨¥ § ªà è¥­ëå ®¡« á⥩
cmp ecx,ebx ;¢ëïá­ï¥¬ ªã¤  ¡ë«® ¤¢¨¦¥­¨¥ ­  ®¤¨­ è £ ­ § ¤
je .m1_shem ;¤¢¨¦¥­¨ï ­¥ ¡ë«® à ­¥¥
jb .msmaller ;¤¢¨¦¥­¨¥ ¡ë«® ->
cmp ebx,eax ;¤¢¨¦¥­¨¥ ¡ë«® ¤® í⮣® <- ¨ âãâ ¬ë ¯à®¢¥à塞 ᥩç á ªã¤  ¤¢¨¦¥­¨¥ ¯à®¨á室¨â
ja .m1_shem ;¥á«¨ ¡ë«® ¤¢¨¦¥­¨¥ <- â® ­ã¦­® § ªà á¨âì ®¡« áâì
je .mwigvag ;¥á«¨ ¨§¬¥­¥­¨ï ­¥ ¡ë«®, â® ­¨ç¥£® ­¥ ¤¥« âì
mov ebp,[EditBox.ed_color] ;âã⠭㦭® ®ç¨áâ¨âì ®¡« áâì c ed_pos ed_shift_pos_old
;¢å®¤­ë¥ ¯ à ¬¥âàë ebp=color ebx=ed_shift_pos
call .sh_cl_
jmp .mwigvag
.msmaller:
cmp ebx,eax
jb .m1_shem
mov ebp,[EditBox.ed_color]
;¢å®¤­ë¥ ¯ à ¬¥âàë ebp=color ebx=ed_shift_pos
call .sh_cl_
jmp .mwigvag
;alike =
.m1_shem:
mov ebp,[EditBox.shift_color]
;¢å®¤­ë¥ ¯ à ¬¥âàë ebp=color ebx=ed_shift_pos
mov ebx,ecx
call .sh_cl_
jmp .mwigvag
.mwigvag:
and word [EditBox.ed_flags],ed_shift_mcl
jmp .draw_cursor_text
; popa
; ret
.mleft:
mov eax,ed_pos
cmp eax,0
jbe .mwigvag
dec eax
call .check_offset
push eax
mov ebx,ed_shift_pos
mov ebp,[EditBox.shift_color]
call .sh_cl_
pop eax
jmp .mdraw
.mright:
mov eax,ed_pos
mov ebx,[EditBox.ed_size]
cmp eax,ebx
jae .mwigvag
inc eax
call .check_offset
mov ebx,ed_shift_pos
mov ebp,[EditBox.shift_color]
push eax
call .sh_cl_
pop eax
jmp .mdraw
}
 
macro use_work_mouse scr_h,scr_w
;----------------------------------------------------------
;--- € ­¥ 㤥ন¢ ¥¬ «¨ ¬ë ª« ¢¨èã ¬ë誨, ¯¥à¥¬¥é ï ªãàá®à, ¢® ¢á¥ à §­ë¥ áâ®à®­ë?
;----------------------------------------------------------
{
test word [EditBox.ed_flags],ed_mouse_on
jne .mouse_wigwag
;----------------------------------------------------------
;--- ¯à®¢¥à塞, ¯®¯ ¤ ¥â «¨ ªãàá®à ¢ edit box -------------
;----------------------------------------------------------
;mov ebx,[IPC_table.box.top]
 
mov eax,[EditBox.ed_left]
mov ebx,[EditBox.ed_top]
mov ecx,[EditBox.ed_width]
mov edx,[EditBox.ed_height]
mov esi,[EditBox.mouseX]
mov edi,[EditBox.mouseY]
 
call CheckCrossingBox
 
cmp eax,0xffffff
jne ._blur
 
;if scr_h eq
;else
; add ebx,scr_h
;end if
;cmp ax,bx
;jl ._blur;.mouse_end_no_focus
 
;add ebx,ed_height
;cmp ax,bx
;jg ._blur;.mouse_end_no_focus
 
;shr eax,16
 
;mov ebx,[IPC_table.box.left]
;add ebx,[EditBox.ed_left]
;if scr_w eq
;else
; add ebx,scr_w
;end if
;cmp ax,bx
;jl ._blur;.mouse_end_no_focus
 
;add ebx,[EditBox.ed_width]
;cmp ax,bx
;jg ._blur;.mouse_end_no_focus
 
;mov eax,[EditBox.mouseX]
 
;--- ¨§¬¥­ï¥¬ ¯®§¨æ¨î ªãàá®à  ---
;push eax
mov ebp,[EditBox.ed_color]
call .clear_cursor
;pop eax
mov eax,[EditBox.mouseX]
._mvpos:
;mov ebx,dword [IPC_table.box.left]
xor edx,edx
sub eax,[EditBox.ed_left]
;sub eax,ebx
;if scr_w eq
;else
; add ebx,scr_w
; sub eax,2
;end if
mov ebx,6
div bx
add eax,ed_offset
cmp eax,[EditBox.ed_size]
jna ._mshift
mov eax,[EditBox.ed_size]
._mshift:
;;;;;;;
;;‘¥ªæ¨ï ®¡à ¡®âª¨ shift ¨ ¢ë¤¥«¥­¨ï ¯® shift
;;;;;;;
test word [EditBox.ed_flags],ed_shift_bac
je @f
mov ebp,dword [EditBox.ed_color]
mov ebx,dword ed_shift_pos
push eax
call .sh_cl_
and word [EditBox.ed_flags],ed_shift_bac_cl
pop eax
@@:
test word [EditBox.ed_flags],ed_mouse_on
jne @f
 
mov dword ed_shift_pos,eax
or word [EditBox.ed_flags],ed_mouse_on
mov dword ed_pos,eax
;mov dword [mouse_flag],edi ;ãáâ ­®¢¨¬ ¨¤¥­â¨ä¨ª â®à
bts word [EditBox.ed_flags],1 ;ãáâ ­®¢ª  䮪ãá 
jmp .m_sh
@@:
cmp eax,dword ed_shift_pos ;¥á«¨ ¯®§¨æ¨¨ ­¥ ¨§¬¥­¨«¨áì
je .editbox_exit
mov ed_pos,eax
mov ebp,dword [EditBox.shift_color]
mov ebx,dword ed_shift_pos
call .sh_cl_
or word [EditBox.ed_flags],ed_mous_adn_b ;ãáâ ­®¢¨¬ ¡¨â çâ® ¬ë ¢ë¤¥«¨«¨ +shift_on +
.m_sh: call .draw_text
call .draw_cursor
;----------------------------------------------------------
;--- ¯à®æ¥¤ãà  ãáâ ­®¢ª¨ 䮪ãá  ---------------------------
;----------------------------------------------------------
jmp .drc
._blur:
test word [EditBox.ed_flags],ed_always_focus
jne .editbox_exit
btr word [EditBox.ed_flags],1 ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
jnc .editbox_exit
 
mov ebp,[EditBox.ed_color]
call .clear_cursor
.drc: call .draw_border
jmp .editbox_exit
}
 
 
; Œ ªà®á ¢ë室 
macro edit_ex
{
popa
ret
}
macro debug
{
;----------- ®â« ¤ª 
pushad
; mov dword [ed_buffer.2],0
; mov eax,edi
mov eax,dword [ed_buffer.2]
mov edi,ed_buffer.3
call .str
;à¨á®¢ ­¨¥ ä®­ 
mov eax,13
mov ebx,178*65536+70
mov ecx,28*65536+10
xor edx,edx
int 0x40
;¢ë¢®¤ §­ ç¥­¨ï ­  íªà ­
mov eax,4
mov ebx,180*65536+30
mov ecx,0x10DDBBCC
mov edx,ed_buffer.3
mov esi,8
int 0x40
popad
;----------- ®â« ¤ª 
}
macro debug_func
{
.str:
mov ecx,0x0a ;§ ¤ ¥âáï á¨á⥬  áç¨á«¥­¨ï ¨§¬¥­ïîâáï ॣ¨áâàë ebx,eax,ecx,edx ¢å®¤­ë¥ ¯ à ¬¥âàë eax - ç¨á«®
;¯à¥à¥¢®¤ ç¨á«  ¢ ASCII áâப㠢§®¤­ë¥ ¤ ­­ë¥ ecx=á¨á⥬  áç¨á«¥­ï edi  ¤à¥á ªã¤  § ¯¨á뢠âì, ¡ã¤¥¬ áâபã, ¯à¨ç¥¬ ª®­¥æ ¯¥à¥¬¥­­®©
cmp eax,ecx ;áà ¢­¨âì ¥á«¨ ¢ eax ¬¥­ìè¥ ç¥¬ ¢ ecx â® ¯¥à¥©â¨ ­  @@-1 â.¥. ­  pop eax
jb @f
xor edx,edx ;®ç¨áâ¨âì edx
div ecx ;à §¤¥«¨âì - ®áâ â®ª ¢ edx
push edx ;¯®«®¦¨âì ¢ á⥪
;dec edi ;ᬥ饭¨¥ ­¥®¡å®¤¨¬®¥ ¤«ï § ¯¨á¨ á ª®­æ  áâப¨
call .str;¯¥à¥©â¨ ­  á ¬ã ᥡï â.¥. ¢ë§¢ âì á ¬ã á¥¡ï ¨ â ª ¤® ⮣® ¬®¬¥­â  ¯®ª  ¢ eax ­¥ áâ ­¥â ¬¥­ìè¥ ç¥¬ ¢ ecx
pop eax
@@: ;cmp al,10 ;¯à®¢¥à¨âì ­¥ ¬¥­ìè¥ «¨ §­ ç¥­¨¥ ¢ al 祬 10 (¤«ï á¨á⥬ë áç¨á«¥­ï 10 ¤ ­­ ï ª®¬ ­¤  - «¨è­ ï))
;sbb al,$69 ;- ç¥áâ­® ¤ ­­ ï ¨­áâàãªæ¨ï ¬¥­ï § áâ ¢«ï¥â § ¤ã¬ âìáï â.¥. ï ­¥ §­ î ª ª íâ® à ¡®â ¥â
;das ;¯®á«¥ ¤ ­­®© ª®¬ ­¤ë ª ª ¡ë ¯à®¨á室¨â 㬥­ì襭¨¥ al ­  66h (¢ ª­¨£¥ ­ ¯¨á ­® ¤à㣮¥)
or al,0x30 ;¤ ­­ ï ª®¬ ­¤  ª®à®ç¥ 祬 ¤¢¥ ¢ëè¥
stosb ;§ ¯¨á âì í«¥¬¥­â ¨§ ॣ¨áâà  al ¢ ï祪㠯 ¬ï⨠es:edi
 
ret ;¢¥à­ãâìáï ç¥­ì ¨­â¥à¥á­ë© 室 â.ª. ¯®ª  ¢ á⥪¥ åà ­¨âìáï ª®«-¢® ¢ë§®¢®¢ â® á⮫쪮 à § ¬ë ¨ ¡ã¤¥¬ ¢ë§ë¢ âìáï
}
 
;;;;;;;;;;;;;;;
;For LibGui
;;;;;;;;;;;;;;;
macro srt_ed_libgui
{
;[EditBox.ed_width] equ [EditBox.ed_width] ;è¨à¨­  ª®¬¯®­¥­â 
;[EditBox.ed_left] equ [EditBox.ed_left] ;¯®«®¦¥­¨¥ ¯® ®á¨ å
;[EditBox.ed_top] equ [EditBox.ed_top] ;¯®«®¦¥­¨¥ ¯® ®á¨ ã
;[EditBox.ed_color] equ [EditBox.ed_color] ;梥â ä®­  ª®¬¯®­¥­â 
;[EditBox.shift_color] equ [EditBox.shift_color] ;=0x6a9480
;[EditBox.ed_focus_border_color] equ [EditBox.ed_focus_border_color] ;梥â à ¬ª¨ ª®¬¯®­¥­â 
;[EditBox.ed_blur_border_color] equ [EditBox.ed_blur_border_color] ;梥⠭¥  ªâ¨¢­®£® ª®¬¯®­¥­â 
;[EditBox.ed_text_color] equ [EditBox.ed_text_color] ;梥â ⥪áâ 
;[EditBox.ed_max] equ [EditBox.ed_max] ;ª®«-¢® ᨬ¢®«®¢ ª®â®àë¥ ¬®¦­® ¬ ªá¨¬ «ì­® ¢¢¥áâ¨
;[EditBox.ed_text] equ [EditBox.ed_text] ;㪠§ â¥«ì ­  ¡ãä¥à
;[EditBox.ed_flags] equ [EditBox.ed_flags] ;ä« £¨
;[EditBox.ed_size] equ [EditBox.ed_size] ;ª®«-¢® ᨬ¢®«®¢
ed_pos equ [EditBox.ed_pos] ;¯®§¨æ¨ï ªãàá®à 
ed_offset equ [EditBox.ed_offset] ;ᬥ饭¨¥
cl_curs_x equ [EditBox.cl_curs_x] ;¯à¥¤ë¤ã饥 ª®®à¤¨­ â  ªãàá®à  ¯® å
cl_curs_y equ [EditBox.cl_curs_y] ;¯à¥¤ë¤ã饥 ª®®à¤¨­ â  ªãàá®à  ¯® ã
ed_shift_pos equ [EditBox.ed_shift_pos] ;¯®«®¦¥­¨¥ ªãàá®à 
ed_shift_pos_old equ [EditBox.ed_shift_pos_old] ;áâ à®¥ ¯®«®¦¥­¨¥ ªãàá®à 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Bit mask from editbox
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ed_figure_only= 1000000000000000b ;®¤­¨ ᨬ¢®«ë
ed_always_focus= 100000000000000b
ed_focus= 10b ;䮪ãá ¯à¨«®¦¥­¨ï
ed_shift_on= 1000b ;¥á«¨ ­¥ ãáâ ­®¢«¥­ -§­ ç¨â ¢¯¥à¢ë¥ ­ ¦ â shift,¥á«¨ ¡ë« ãáâ ­®¢«¥­, §­ ç¨â ¬ë 㦥 çâ® - â® ¤¥« «¨ 㤥ন¢ ï shift
ed_shift_on_off=1111111111110111b
ed_shift= 100b ;¢ª«îç ¥âáï ¯à¨ ­ ¦ â¨¨ ­  shift â.¥. ¥á«¨ ­ ¦¨¬ î
ed_shift_off= 1111111111111011b
ed_shift_bac= 10000b ;¡¨â ¤«ï ®ç¨á⪨ ¢ë¤¥«¥­®£® shift â.¥. ¯à¨ ãáâ ­®¢ª¥ £®¢®à¨â çâ® ¥áâì ¢ë¤¥«¥­¨¥
ed_shift_bac_cl=1111111111101111b ;®ç¨á⪠ ¯à¨ 㤠«¥­¨¨ ¢ë¤¥«¥­¨ï
ed_shift_cl= 1111111111100011b
ed_shift_mcl= 1111111111111011b
ed_left_fl= 100000b
ed_right_fl= 1111111111011111b
ed_offset_fl= 1000000b
ed_offset_cl= 1111111110111111b
ed_insert= 10000000b
ed_insert_cl= 1111111101111111b
ed_mouse_on = 100000000b
ed_mous_adn_b= 100011000b
ed_mouse_on_off=1111111011111111b
ed_height=14 ; ¢ëá®â 
}
/programs/develop/libGUI/src/image.inc
0,0 → 1,140
 
im_control_data_size = 26
im_redraw_all = 10000000b
im_redraw_all_off = 01111111b
im_special_redraw_on = 1b
im_special_redraw_off = 11111110b
 
;****************************************************
;*******************craete Image**********************
;****************************************************
;IN
;pointer to parend
;pointer to Image's structure
;OUT
;pointer to initialized Image's structure
align 4
 
craete_image:
 
mov ebx,[esp+4]
mov eax,[esp+8]
 
mov [PointerToStructureForImage],eax
 
mov eax,control_header_size+im_control_data_size
call craete_control
 
;set all image's parameters in control
mov [eax],dword image
 
mov ecx,im_control_data_size
mov esi,[PointerToStructureForImage]
mov edi,eax
add edi,control_header_size
rep movsb
 
call get_skin_height
 
mov ebx,[PointerToStructureForImage]
mov ecx,[ebx+6] ;x
mov edx,[ebx+10] ;y
mov esi,[ebx+14] ;size x
mov edi,[ebx+18] ;size y
add ecx,border_width
add edx,[skin_height]
;copy information to control
mov [eax+24],ecx
mov [eax+28],edx
mov [eax+32],esi
mov [eax+36],edi
 
ret 8
 
;****************************************************
;********************Draw Image**********************
;****************************************************
;IN
;pointer to control of button
;message
;OUT
;not returned value
align 4
 
image:
 
;get message
mov eax,[esp+8]
 
;get pointer to control of image
mov esi,[esp+4]
mov [PointerForImage],esi
;copy control to local control
add esi,control_header_size
mov edi,dword Image
mov ecx,im_control_data_size
rep movsb
 
 
cmp [eax],dword 1
jne no_redraw_all_image
 
or [Image.type],im_redraw_all
no_redraw_all_image:
 
cmp [eax],dword 3
jne no_special_message_image
 
xor eax,eax
mov al,[Image.type]
and al,im_special_redraw_on
test al,al
jz no_activate_redraw_image
 
and [Image.type],im_special_redraw_off
or [Image.type],im_redraw_all
no_activate_redraw_image:
 
no_special_message_image:
 
;load coordinats and size from control
mov eax,[PointerForImage]
mov ebx,[eax+24] ;x
mov ecx,[eax+28] ;y
mov edx,[eax+32] ;size x
mov esi,[eax+36] ;size y
;set current coordinats and sizes in zakladka
mov [Image.x],ebx
mov [Image.y],ecx
mov [Image.sizex],edx
mov [Image.sizey],esi
 
xor eax,eax
mov al,[Image.type]
and al,im_redraw_all
test al,al
jz no_redraw_image_
 
and [Image.type],im_redraw_all_off
 
mov esi,dword Image
mov edi,[PointerForImage]
add edi,control_header_size
mov ecx,2
rep movsb
 
mov eax,7
mov ebx,[Image.pointer]
mov ecx,[Image.sizex]
shl ecx,16
add ecx,[Image.sizey]
mov edx,[Image.x]
shl edx,16
add edx,[Image.y]
mcall
 
no_redraw_image_:
 
exit_image:
 
ret 8
/programs/develop/libGUI/src/libGUI.asm
0,0 → 1,537
;**********************************************************************
; library of Graphics Universal Interface for Kolibri operation system
;
; version 071001
; 2007 year
;
;autors:
;
;andrew_programmer polynki@mail.ru
;
;menegement of controls : destroy_control, send_message
;GUI components : button,scroller,Bookmark,text,image,number,progres bar
;
;<Lrz> and Maxxxx32
;
;GUI components : CheckBox,EditBox
;
;**********************************************************************
 
format MS COFF
 
public EXPORTS
 
control_header_size = 44
 
border_width = 5
 
section '.flat' code readable align 16
 
include 'macros.inc'
include 'debug.inc'
 
;GUI components
 
include 'button.inc'
 
include 'scroller.inc'
 
include 'bookmark.inc'
 
include 'image.inc'
 
include 'text.inc'
 
include 'number.inc'
 
include 'check_box.inc'
 
include 'edit_box.inc'
 
include 'progress_bar.inc'
 
;engen of libGUI(menegment of controls)
 
include 'menegment_of_controls.inc'
 
;functions which proved work of GUI components
 
include 'draw.inc'
 
include 'string.inc'
 
include 'check_crossing_box.inc'
 
include 'memory.inc'
 
;function for get version of library
include 'version.inc'
 
;function for resize GUI component
include 'resize_component.inc'
 
;function for remove GUI component
include 'remove_component.inc'
 
align 16
EXPORTS:
dd szDestroyControl,destroy_control
dd szSendMessage,send_message
dd szVersion,get_version
dd szResizeComponent,resize_component
dd szRemoveComponent,remove_component
dd szcraeteButton,craete_button
dd szcraeteScroller,craete_scroller
dd szcraeteBookmark,craete_Bookmark
dd szcraeteImage,craete_image
dd szcraeteText,craete_text
dd szcraeteNumber,craete_number
dd szcraeteCheckBox,craete_check_box
dd szcraeteEditBox,craete_edit_box
dd szcraeteProgressBar,craete_progress_bar
dd 0,0
 
szDestroyControl db 'DestroyControl',0
szSendMessage db 'SendMessage',0
szVersion db 'Version',0
szResizeComponent db 'ResizeComponent',0
szRemoveComponent db 'RemoveComponent',0
szcraeteButton db 'CraeteButton',0
szcraeteScroller db 'CraeteScroller',0
szcraeteBookmark db 'CraeteBookmark',0
szcraeteImage db 'CraeteImage',0
szcraeteText db 'CraeteText',0
szcraeteNumber db 'CraeteNumber',0
szcraeteCheckBox db 'CraeteCheckbox',0
szcraeteEditBox db 'CraeteEditbox',0
szcraeteProgressBar db 'CraeteProgressbar',0
 
section '.data' data readable writable align 16
;************************************************
;******************DLL DATA**********************
;************************************************
 
point db '.',0
signum db '-',0
 
BitsPerPixel rd 1
BytesPerString rd 1
WindowCoordinatX rd 1
WindowCoordinatY rd 1
WindowSizeX rd 1
WindowSizeY rd 1
 
PointerToMem rd 1
offset rd 1
 
v rd 1
v2 rd 1
v3 rd 1
 
r_min rb 1
r_max rb 1
g_min rb 1
g_max rb 1
b_min rb 1
b_max rb 1
r rb 1
g rb 1
b rb 1
r_f rd 1
g_f rd 1
b_f rd 1
step_r rd 1
step_g rd 1
step_b rd 1
length rd 1
length2 rd 1
Color rd 1
AveregeColor rd 1
 
line_coordinat_x rd 1
line_coordinat_y rd 1
line_size_x rd 1
line_size_y rd 1
line_size_y_f rd 1
 
x rd 1
y rd 1
xo rd 1
yo rd 1
x_ctl rd 1
y_ctl rd 1
 
;ReturnAddresButton rd 1
;ReturnAddresScroller rd 1
;ReturnAddresBookmark rd 1
;ReturnAddresImage rd 1
;ReturnAddresText rd 1
;ReturnAddresNumber rd 1
;ReturnAddresCheckBox rd 1
;ReturnAddresEditBox rd 1
;ReturnAddresProgressBar rd 1
 
Button_Flag rb 1
 
Scrollersize rd 1
ControlID rd 1
Message rd 4
Parend rd 1
Control rd 1
ReturnControl rd 1
PointerToControl rd 1
ActiveControl rd 1
ActiveControlForKeys rd 1
ButtonsOfMouse rd 1
 
PointerToStructureForBookmark rd 1
ParendForBookmark rd 1
PointerToStructureForButton rd 1
ParendForButton rd 1
PointerToStructureForScroller rd 1
ParendForScroller rd 1
PointerToStructureForImage rd 1
PointerToStructureForText rd 1
PointerToStructureForNumber rd 1
PointerToStructureForCheckBox rd 1
PointerToStructureForEditBox rd 1
PointerToStructureForProgressBar rd 1
 
PointerForButton rd 1
PointerForScroller rd 1
PointerForBookmark rd 1
PointerForImage rd 1
PointerForText rd 1
PointerForNumber rd 1
PointerForCheckBox rd 1
PointerForEditBox rd 1
PointerForProgressBar rd 1
 
ChisloZakladok rd 1
 
integer_part rd 1
float_part rd 1
tochnost1 rd 1
tochnost2 rd 1
signum_float_number rb 1
 
skin_height rd 1
 
;*********************************
;**********GUI structures*********
;*********************************
 
;struc CONTROL
;{
; .ctrl_proc rd 0 ;0
; .ctrl_fd rd 0 ;4
; .ctrl_bk rd 0 ;8
; .child_fd rd 0 ;12
; .child_bk rd 0 ;16
; .parend rd 0 ;20
; .x rd 0 ;24
; .y rd 0 ;28
; .sizex rd 0 ;32
; .sizey rd 0 ;36
; .ID rd 0 ;40
;}
 
struc BUTTON
{
.ctrl_proc rd 1
.ctrl_fd rd 1
.ctrl_bk rd 1
.child_fd rd 1
.child_bk rd 1
.parend rd 1
.ctrl_x rd 1
.ctrl_y rd 1
.ctrl_sizex rd 1
.ctrl_sizey rd 1
.ctrl_ID rd 1
 
.type rb 1
.flag rb 1
.x rw 1
.y rw 1
.width rw 1
.height rw 1
.image rd 1
.imageX rw 1
.imageY rw 1
.imageSizeX rw 1
.imageSizeY rw 1
.transparentColor rd 1
.text rd 1
.textX rw 1
.textY rw 1
.textcolor rd 1
.color1 rd 1
.color2 rd 1
.mouseX rw 1
.mouseY rw 1
}
 
struc SCROLLER
{
.ctrl_proc rd 1
.ctrl_fd rd 1
.ctrl_bk rd 1
.child_fd rd 1
.child_bk rd 1
.parend rd 1
.ctrl_x rd 1
.ctrl_y rd 1
.ctrl_sizex rd 1
.ctrl_sizey rd 1
.ctrl_ID rd 1
 
.type rb 1
.x rw 1
.y rw 1
.length rw 1
.color1 rd 1
.size rd 1
.pos rd 1
.buttons_flags rw 1
.ChildButton1 rd 1
.ChildButton2 rd 1
.mouseX rw 1
.mouseY rw 1
}
 
;********************************
;*********Child Buttons**********
;********************************
struc CHILDBUTTON
{
.type rb 1
.flag rb 1
.x rw 1
.y rw 1
.width rw 1
.height rw 1
.image rd 1
.imageX rw 1
.imageY rw 1
.imageSizeX rw 1
.imageSizeY rw 1
.transparentColor rd 1
.text rd 1
.textX rw 1
.textY rw 1
.textcolor rd 1
.color1 rd 1
.color2 rd 1
.mouseX rw 1
.mouseY rw 1
}
 
struc BOOKMARK
{
.type rb 1
.flag rb 1
.x rd 1
.y rd 1
.sizex rd 1
.sizey rd 1
.color1 rd 1
.reserved rd 1
.color2 rd 1
 
.FullBookmarkSizeX rd 1
.BookmarkSizeX rd 1
.PointerToTextForBookmark rd 1
.BookmarkX rd 1
.BookmarkY rd 1
.ChildButtonsForBookmark rd 1
.CounterChildButtons rd 1
.ChisloZakladok rd 1
.ChisloStrokeZakladok rd 1
.MessageForChildButton rd 5
.ChildControlForBookmark rd 1
.NumberBookmarksInActiveString rd 1
.NumberBookmarksInEndString rd 1
.PointerToActiveBookmarks rd 1
.PointerToEndBookmarks rd 1
.BookmarkFlag rb 1
.y_end_stroke rd 1
 
.CounterChildControls rd 1
.ActiveChildControl rd 1
.AddresOfActiveChildControl rd 1
.MouseX rd 1
.MouseY rd 1
 
.DefectSizeX rd 1
.ControlAddres rd 1
 
.counter1 rd 1
.counter2 rd 1
 
.NumberActiveControl rd 1
 
.WorkPlace_x rd 1
.WorkPlace_y rd 1
.WorkPlace_sizex rd 1
.WorkPlace_sizey rd 1
.WorkPlace_windowx rd 1
.WorkPlace_windowsizex rd 1
 
}
 
struc IMAGE
{
.type rb 1
.flag rb 1
.color rd 1
.x rd 1
.y rd 1
.sizex rd 1
.sizey rd 1
.pointer rd 1
}
 
struc TEXT
{
.type rb 1
.flag rb 1
.color rd 1
.x rd 1
.y rd 1
.length rd 1
.pointer rd 1
}
 
struc NUMBER
{
.type rb 1
.flag rb 1
.color rd 1
.x rd 1
.y rd 1
.number rd 1
.parameters rd 1
}
 
struc CHECKBOX
{
.ch_flags rw 1
.ch_left rw 1
.ch_top rw 1
.ch_text_margin rd 1
.ch_size rd 1
.ch_size_2 rw 1
.ch_size_3 rw 1
.ch_color rd 1
.ch_border_color rd 1
.ch_text_color rd 1
.ch_text_ptr rd 1
.ch_text_length rw 1
.mouseX rd 1
.mouseY rd 1
}
 
struc EDITBOX
{
.ed_width rd 1
.ed_left rd 1
.ed_top rd 1
.ed_color rd 1
.shift_color rd 1
.ed_focus_border_color rd 1
.ed_blur_border_color rd 1
.ed_text_color rd 1
.ed_max rd 1
.ed_text rd 1
.ed_flags rw 1
.ed_size rd 1
.ed_pos rd 1
.ed_offset rd 1
.cl_curs_x rd 1
.cl_curs_y rd 1
.ed_shift_pos rd 1
.ed_shift_pos_old rd 1
.ed_height rd 1
.mouseX rd 1
.mouseY rd 1
}
 
struc PROGRESSBAR
{
.type rb 1
.flag rb 1
.color1 rd 1
.color2 rd 1
.x rd 1
.y rd 1
.sizex rd 1
.sizey rd 1
.progress rd 1
.color3 rd 1
}
 
;********************************
;*Graphics primitives structures*
;********************************
struc LINE
{
.x1 rd 1
.y1 rd 1
.x2 rd 1
.y2 rd 1
.color rd 1
}
 
struc PIXEL
{
.x rd 1
.y rd 1
.color rd 1
}
 
struc FONT1
{
.sizeX rd 6
.sizeY rd 9
.x rd 1
.y rd 1
}
 
struc RECTANGLE
{
.x rd 1
.y rd 1
.width rd 1
.height rd 1
.color rd 1
}
 
struc SCROLLBAR
{
.x rd 1
.y rd 1
}
 
Line LINE
Pixel PIXEL
Font FONT1
Rectangle RECTANGLE
ScrollBar SCROLLBAR
ChildButton CHILDBUTTON
 
Button BUTTON
Scroller SCROLLER
Bookmark BOOKMARK
Image IMAGE
Text TEXT
Number NUMBER
CheckBox CHECKBOX
EditBox EDITBOX
ProgressBar PROGRESSBAR
 
pointer rd 50
pointer2 rd 13
IPC_table process_information; rb 1024
colors_table1 rd 15
colors_table2 rd 15
/programs/develop/libGUI/src/macros.inc
0,0 → 1,269
; new application structure
macro meos_app_start
{
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
 
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
 
dd 0x0
}
MEOS_APP_START fix meos_app_start
 
macro code
{
__start:
}
CODE fix code
 
macro data
{
__data:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
UDATA fix udata
 
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
 
 
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
end if
}
 
 
 
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
 
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
 
macro mov arg1,arg2
{
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0'))
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
 
 
macro struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
dw ? ; +52 - reserved
.client_left dd ? ; +54
.client_top dd ? ; +58
.client_width dd ? ; +62
.client_height dd ? ; +66
.wnd_state db ? ; +70
rb (1024-71)
}
struct process_information
 
struc system_colors
{
.frame dd ?
.grab dd ?
.grab_button dd ?
.grab_button_text dd ?
.grab_text dd ?
.work dd ?
.work_button dd ?
.work_button_text dd ?
.work_text dd ?
.work_graph dd ?
}
struct system_colors
 
 
; constants
 
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
 
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b
/programs/develop/libGUI/src/memory.inc
0,0 → 1,32
;eax - size
;OUT
;eax - pointer
malloc:
 
push ebx
push ecx
 
mov ecx,eax
mov eax,68
mov ebx,12
mcall
 
pop ecx
pop ebx
 
ret
 
;eax - pointer
free:
push ebx
push ecx
 
mov ecx,eax
mov eax,68
mov ebx,13
mcall
 
pop ecx
pop ebx
 
ret
/programs/develop/libGUI/src/menegment_of_controls.inc
0,0 → 1,503
;****************************************************************
;***************Elements of menegment for Controls***************
;****************************************************************
 
;**********************************************************
;********************craete control*************************
;**********************************************************
 
;IN
;eax - ctructure's size
;ebx - Parend(pointer to structure for parend)
;OUT
;eax - pointer to new control
 
craete_control:
 
test eax,eax
jnz no_null_size
 
mov eax,1
no_null_size:
 
call malloc
mov [ReturnControl],eax
 
push ebx ;parend
push eax ;control
call AddObject
 
mov eax,[ReturnControl]
 
;information about craete control output to debug board
call new_line
mov [s_p],s_craete
call print_string
debug_print_dec [ReturnControl]
mov [s_p],s_parend
call print_string
debug_print_dec dword[eax+20]
mov [s_p],s_last
call print_string
debug_print_dec dword[eax+4]
;--------------------------------
 
ret
 
AddObject:
 
mov ecx,[esp+4] ;control
mov edx,[esp+8] ;parend
 
mov eax,[edx+12] ;eax=parend->child_fd
test eax,eax
jnz else_parend_add_object
 
add [ControlID],1
mov esi,[ControlID]
 
mov [edx+12],ecx ;Parend->child_fd=control
mov [edx+16],ecx ;Parend->child_bk=control
 
mov [ecx+20],edx ;control->parend=Parend
mov [ecx+4],edx ;control->ctrl_fd=Parend
mov [ecx+40],esi ;control->ctrl_ID=ID
 
jmp exit_if_parend_add_object
else_parend_add_object:
 
add [ControlID],1
mov esi,[ControlID]
 
mov edi,[edx+16] ;last_control=Parend->child_bk
mov [edx+16],ecx ;Parend->child_bk=control
 
mov [edi+8],ecx ;last_control->ctrl_bk=control
mov [ecx+4],edi ;control->ctrl_fd=last_control;
mov [ecx+20],edx ;control->parend=Parend;
mov [ecx+40],esi ;control->ctrl_ID=ID
 
exit_if_parend_add_object:
 
ret 8
 
 
;************************************************************
;***********************Destroy control**********************
;************************************************************
 
;Delete Control.
;IN
;pointer to control for delete
;OUT
;not returned value
align 4
 
destroy_control:
 
mov eax,[esp+4]
 
mov ebx,[eax+20] ;get parend for control
 
;checking pointer of control to 0
test eax,eax
jz exit_destroy_control
 
;checking parend to main parend(parend of window)
;if parend equ main parend than exit
test ebx,ebx
jz exit_destroy_control
 
mov ecx,[ebx+12] ;Parend->child_fd
test ecx,ecx
jz exit_destroy_control
 
mov ecx,[ebx+12] ;Parend->child_fd
mov edx,[ebx+16] ;Parend->child_bk
 
cmp ecx,edx
jne no_if_parend_child_fd_child_bk
 
cmp ecx,eax
jne no_if_parend_child_fd_control
 
mov [ebx+12],dword 0 ;Parend->child_fd=0
mov [ebx+16],dword 0 ;Parend->child_bk=0
 
;send message to control for deleting
push eax
 
mov [Message],dword -1
mov ebx,[eax] ;load .... for control
push Message
push eax
call ebx
 
pop eax
 
push eax
call free
pop eax
 
call new_line
mov [s_p],s_destroy
call print_string
debug_print_dec eax
mov [s_p],s_1
call print_string
 
jmp exit_destroy_control
no_if_parend_child_fd_control:
 
no_if_parend_child_fd_child_bk:
;----------------------------------------------
mov esi,ecx ;seek_control=Parend->child_fd
 
while_seek_control:
cmp esi,0
je exit_destroy_control
;*******************************************************************
cmp esi,eax
jne no_if_seek_control_control
;***************************************************************
mov edi,[esi+8]
test edi,edi
jz no_if_seek_control_ctrl_bk
;***********************************************************
mov ecx,[esi+4]
mov edx,[esi+8]
mov [edx+4],ecx
 
cmp ecx,ebx
je no_if_last_control_parend
;*******************************************************
mov [ecx+8],edx
jmp else_seek_control_ctrl_bk
;*******************************************************
no_if_last_control_parend:
 
mov [ebx+12],edx
 
jmp else_seek_control_ctrl_bk
;*********************************************************
no_if_seek_control_ctrl_bk:
;**********************************************************
 
mov ecx,[esi+4] ;last_control=seek_control->ctrl_fd
mov [ecx+8],dword 0 ;last_control->ctrl_bk=0
mov [ebx+16],ecx ;Parend->child_bk=last_control
 
else_seek_control_ctrl_bk:
;**********************************************************
 
;send message to control for deleting
push eax
 
mov [Message],dword -1
mov ebx,[eax] ;load .... for control
push Message
push eax
call ebx
 
pop eax
 
push eax
call free
pop eax
 
call new_line
mov [s_p],s_destroy
call print_string
debug_print_dec eax
mov [s_p],s_2
call print_string
 
jmp exit_destroy_control
 
no_if_seek_control_control:
;****************************************************************
 
mov edi,[esi+8] ;exchange_control=seek_control->ctrl_bk
mov esi,edi ;seek_control=exchange_control
 
jmp while_seek_control
;*******************************************************************
exit_destroy_control:
 
ret 4
 
;***********************************************************
;*****************Send message to Control*******************
;***********************************************************
 
;IN
;pointer to message
;pointer to parend(structure)
;OUT
;not returned value
align 4
 
send_message:
 
;get pointer to parend
mov eax,[esp+4]
mov [Parend],eax
 
;get message
mov esi,[esp+8]
mov edi,dword Message
mov ecx,4
rep movsd
 
;load event type
mov eax,[Message]
 
 
;check for event type and get parameters for Control
dec eax
jnz no_window_redraw
 
mov ebx,[Parend]
mov esi,[ebx+12] ;get pointer to first child control of parend
mov ebx,esi
 
send_message_for_redraw_to_next_control:
 
;if esi=0 than exit
test esi,esi
jz exit_check_event_type
 
push ebx
push esi
 
mov eax,ebx
mov ebx,[eax] ;load .... for control
push Message
push eax
call ebx
 
pop esi
pop ebx
 
mov esi,[ebx+8]
mov ebx,esi
 
jmp send_message_for_redraw_to_next_control
 
no_window_redraw:
 
dec eax
jnz no_keys
 
 
;if have active control than send message
;checking for active control
mov ebx,[ActiveControlForKeys]
test ebx,ebx
jz exit_check_event_type
 
mov eax,[ActiveControlForKeys]
mov ebx,[eax] ;load proc for control
push Message
push eax
call ebx
 
jmp exit_check_event_type
no_keys:
 
dec eax
jnz no_special_system_message
 
mov ebx,[Parend];
mov esi,[ebx+12]
mov ebx,esi
 
send_special_message_to_next_control:
 
;if esi=0 than exit
test esi,esi
jz exit_check_event_type
 
push ebx
push esi
 
mov eax,ebx
mov ebx,[eax] ;load .... for control
push Message
push eax
call ebx
 
pop esi
pop ebx
 
mov esi,[ebx+8]
mov ebx,esi
 
jmp send_special_message_to_next_control
 
no_special_system_message:
 
;*************************************************
;****************Mouse send message***************
;*************************************************
 
cmp eax,3
jne no_mouse
 
;check childrens of parend for crossing
mov ebx,[Parend]
mov esi,[ebx+12] ;esi =first child control
mov ebx,esi ;ebx =first child control
 
mov eax,[Message+12]
and eax,1b
test eax,eax
jz left_button_of_mouse_not_pressed
 
mov eax,[ActiveControl]
test eax,eax
jz havent_active_control
 
mov eax,[ActiveControl]
mov ebx,[eax] ;load proc for control
push Message
push eax
call ebx
 
jmp exit_check_event_type
havent_active_control:
 
jmp exit_if_left_button_of_mouse__pressed
left_button_of_mouse_not_pressed:
 
mov eax,[ActiveControl]
test eax,eax
jz havent_active_control_
 
mov [ActiveControl],dword 0
 
havent_active_control_:
 
exit_if_left_button_of_mouse__pressed:
 
 
next_conrol_check_for_crossing_with_mouse:
 
test esi,esi
jz exit_next_conrol_check_for_crossing_with_mouse
 
mov [PointerToControl],ebx
 
 
push ebx
push esi
 
mov eax,[ebx+28] ;eax = y coordinat of control
mov [y_ctl],eax
mov eax,[ebx+24] ;eax = x coordinat of control
 
mov ecx,[ebx+32] ;ecx = size x of control
mov edx,[ebx+36] ;edx = size y of control
mov esi,[Message+4] ;mouse x
mov edi,[Message+8] ;mouse y
mov ebx,[y_ctl]
 
call CheckCrossingBox
 
cmp eax,0xffffff
jne no_activate_control
 
mov eax,[Message+12]
and eax,1b
test eax,eax
jz no_activate_control
 
mov eax,[PointerToControl]
mov [ActiveControl],eax
mov [ActiveControlForKeys],eax
 
no_activate_control:
 
mov eax,[PointerToControl]
mov ebx,[eax] ;load proc for control
push Message
push eax
call ebx
 
pop esi
pop ebx
 
mov esi,[ebx+8] ;16 but not 8
mov ebx,esi
 
jmp next_conrol_check_for_crossing_with_mouse
 
exit_next_conrol_check_for_crossing_with_mouse:
 
no_mouse:
 
exit_check_event_type:
 
ret 8
 
 
new_line:
 
pushad
 
mov eax,63
mov ebx,1
xor ecx,ecx
mov cl,13
int 0x40
 
mov eax,63
mov ebx,1
xor ecx,ecx
mov cl,10
int 0x40
 
popad
 
ret
 
print_string:
 
pushad
 
xor esi,esi
 
next_symbol_print:
 
mov edi,[s_p]
add edi,esi
 
xor edx,edx
mov dl,byte[edi]
test dl,dl
jz exit_print_str
 
mov eax,63
mov ebx,1
xor ecx,ecx
mov cl,byte[edi]
int 0x40
 
inc esi
jmp next_symbol_print
 
exit_print_str:
 
popad
 
 
ret
 
s_p dd 0
s_craete db 'craete ',0
s_destroy db 'destroy ',0
s_parend db ' parend ',0
s_last db ' ctrl_fd ',0
s_next db ' ctrl_bk ',0
s_1 db ' 1',0
s_2 db ' 2',0
/programs/develop/libGUI/src/number.inc
0,0 → 1,383
 
nm_control_data_size = 22
nm_redraw_all = 10000000b
nm_redraw_off = 01111111b
nm_special_redraw_on = 100b
nm_special_redraw_off = 11111011b
nm_integer_type = 10b
nm_no_show_number = 1b
 
;****************************************************
;********************craete Number**********************
;****************************************************
;IN
;pointer to parend
;pointer to Number's structure
;OUT
;pointer to initialized Number's structure
align 4
 
craete_number:
 
mov ebx,[esp+4]
mov eax,[esp+8]
 
mov [PointerToStructureForNumber],eax
 
mov eax,control_header_size+nm_control_data_size
call craete_control
 
;set all image's parameters in control
mov [eax],dword number
 
mov ecx,nm_control_data_size
mov esi,[PointerToStructureForNumber]
mov edi,eax
add edi,control_header_size
rep movsb
 
call get_skin_height
 
mov ebx,[PointerToStructureForNumber]
mov ecx,[ebx+6] ;x
mov edx,[ebx+10] ;y
add ecx,border_width
add edx,[skin_height]
;copy information to control
mov [eax+24],ecx
mov [eax+28],edx
 
ret 8
 
;****************************************************
;********************Draw Number*********************
;****************************************************
;IN
;pointer to control of number
;message
;OUT
;not returned value
align 4
 
number:
 
;get message
mov eax,[esp+8]
 
;get pointer to control of image
mov esi,[esp+4]
mov [PointerForNumber],esi
;copy control to local control
add esi,control_header_size
mov edi,dword Number
mov ecx,nm_control_data_size
rep movsb
 
 
cmp [eax],dword 1
jne no_redraw_all_number
 
xor ebx,ebx
mov bl,[Number.type]
and bl,nm_no_show_number
test bl,bl
jnz no_redraw_all_number
 
or [Number.type],nm_redraw_all
 
no_redraw_all_number:
 
cmp [eax],dword 3
jne no_special_message_for_number
 
xor ebx,ebx
mov bl,[Number.type]
and bl,nm_special_redraw_on
test bl,bl
jz no_special_message_for_number
 
or [Number.type],nm_redraw_all
and [Number.type],nm_special_redraw_off
 
no_special_message_for_number:
 
cmp [eax],dword -1
jne no_destroy_control_of_number
 
jmp exit_number
no_destroy_control_of_number:
 
;load coordinats and size from control
mov eax,[PointerForNumber]
mov ebx,[eax+24] ;x
mov ecx,[eax+28] ;y
;set current coordinats and sizes in zakladka
mov [Number.x],ebx
mov [Number.y],ecx
 
xor eax,eax
mov al,[Number.type]
and al,nm_redraw_all
test al,al
jz no_redraw_number_
 
and [Number.type],nm_redraw_off
 
mov esi,dword Number
mov edi,[PointerForNumber]
add edi,control_header_size
mov ecx,2
rep movsb
 
;get standart colors table
mov eax,48
mov ebx,3
mov ecx,dword pointer2
mov edx,40
mcall
 
xor eax,eax
mov al,[Number.type]
and al,nm_integer_type
test al,al
jnz no_integer_number
 
mov eax,47
mov ebx,[Number.parameters]
mov ecx,[Number.number]
mov edx,[Number.x]
shl edx,16
add edx,[Number.y]
mov esi,[Number.color]
mov edi,[pointer2+8]
mcall
 
jmp no_redraw_number_
no_integer_number:
;---------------------------------------
 
mov ebx,[Number.parameters]
mov ecx,ebx
shr ebx,16 ;format for integer
and ecx,0xffff ;format for float
 
;get integer part of float number
mov eax,1
mov edi,ecx
pow_10__:
 
;eax=eax*10
lea eax,[eax+eax*4]
shl eax,1
 
dec edi
jnz pow_10__
mov edx,eax
 
;check for signum
mov [v2],0
fld [Number.number]
fcom [v2]
fstsw ax
sahf
jae no_signum_float_number
 
fabs
mov [signum_float_number],byte 1
 
no_signum_float_number:
fstp [Number.number]
 
mov [v2],edx ;v2=10^ecx
fild [v2]
fld [Number.number]
fmul st0,st1
fistp [v]
fstp st0
 
mov esi,edx
mov eax,[v]
cdq
idiv esi
mov [v],eax
 
and [integer_part],0
and [tochnost1],0
 
;save v in v2
mov eax,[v]
mov [v2],eax
 
mov [Number.flag],0
mov esi,ebx
get_next_razryd_of_number_integer:
 
mov eax,1
 
mov edi,esi
pow_10_integer:
 
;eax=eax*10
lea eax,[eax+eax*4]
shl eax,1
 
dec edi
jnz pow_10_integer
 
mov edi,eax
mov eax,[v]
cdq
idiv edi
and eax,0xf
 
test eax,eax
jz no_save_pos_for_integer
 
cmp [Number.flag],0
jne no_save_pos_for_integer
 
mov [Number.flag],1b
mov [tochnost1],esi
add [tochnost1],1
 
no_save_pos_for_integer:
 
imul eax,edi
sub [v],eax
add [integer_part],eax
 
dec esi
jnz get_next_razryd_of_number_integer
mov eax,[v]
add [integer_part],eax
 
cmp [tochnost1],0
jnz all_ok_with_tochnost
 
mov [tochnost1],1
all_ok_with_tochnost:
 
;get float part of float number
mov eax,[v2]
mov [v],eax
 
mov eax,1
mov edi,ecx
pow_10_float__:
 
;eax=eax*10
lea eax,[eax+eax*4]
shl eax,1
 
dec edi
jnz pow_10_float__
 
mov [v2],eax ;v2=10^ecx
 
fild [v2]
fild [v]
fld [Number.number]
fsub st0,st1
fmul st0,st2
fistp [v]
fstp st0
fstp st0
 
and [float_part],0
 
mov esi,ecx
get_next_razryd_of_number_float:
 
mov eax,1
 
mov edi,esi
pow_10_float:
 
;eax=eax*10
lea eax,[eax+eax*4]
shl eax,1
 
dec edi
jnz pow_10_float
 
mov edi,eax
mov eax,[v]
cdq
idiv edi
and eax,0xf
imul eax,edi
sub [v],eax
add [float_part],eax
 
dec esi
jnz get_next_razryd_of_number_float
mov eax,[v]
add [float_part],eax
 
mov [tochnost2],ecx
cmp [signum_float_number],byte 1
jne no_draw_signum_for_float_number
 
;draw signum
mov eax,4
mov ebx,[Number.x]
mov ecx,[Number.color]
mov edx,dword signum
mov esi,1
mov edi,[pointer2+8]
shl ebx,16
add ebx,[Number.y]
mcall
 
add [Number.x],6
mov [signum_float_number],0
no_draw_signum_for_float_number:
 
;draw integer part of float number
mov eax,47
mov ebx,[tochnost1]
mov ecx,[integer_part]
mov edx,[Number.x]
mov esi,[Number.color]
mov edi,[pointer2+8]
shl edx,16
shl ebx,16
add edx,[Number.y]
mcall
 
mov edx,[tochnost1]
add edx,1
lea edx,[edx+edx*2]
shl edx,1 ;edx=edx*6
add edx,[Number.x]
mov [x],edx
 
;draw float part of float number
mov eax,47
mov ebx,[tochnost2]
mov ecx,[float_part]
mov esi,[Number.color]
mov edi,[pointer2+8]
shl edx,16
shl ebx,16
add edx,[Number.y]
mcall
 
;draw point betwen integer part of number and float part of number
mov eax,4
mov ebx,[x]
mov ecx,[Number.color]
mov edx,dword point
mov esi,1
mov edi,[pointer2+8]
sub ebx,6
shl ebx,16
add ebx,[Number.y]
mcall
 
no_redraw_number_:
;-----------------------------------------
 
exit_number:
 
ret 8
/programs/develop/libGUI/src/progress_bar.inc
0,0 → 1,459
 
pb_control_data_size = 34
pb_redraw_all = 10000000b
pb_redraw_all_off = 01111111b
pb_special_progress_on = 1b
pb_special_progress_off = 11111110b
 
;****************************************************
;****************craete ProgressBar********************
;****************************************************
;IN
;pointer to parend
;pointer to ProgressBar's structure
;OUT
;pointer to initialized control
align 4
 
craete_progress_bar:
 
mov ebx,[esp+4]
mov eax,[esp+8]
 
mov [PointerToStructureForProgressBar],eax
 
mov eax,control_header_size+pb_control_data_size
call craete_control
 
;set all EditBox's parameters in control
mov [eax],dword progress_bar
 
mov ecx,pb_control_data_size
mov esi,[PointerToStructureForProgressBar]
mov edi,eax
add edi,control_header_size
rep movsb
 
call get_skin_height
 
mov ebx,[PointerToStructureForProgressBar]
mov ecx,[ebx+10] ;x
mov edx,[ebx+14] ;y
mov esi,[ebx+18] ;size x
mov edi,[ebx+22] ;size y
add ecx,border_width
add edx,[skin_height]
;copy information to control
mov [eax+24],ecx
mov [eax+28],edx
mov [eax+32],esi
mov [eax+36],edi
 
ret 8
 
;****************************************************
;*****************Draw ProgressBar********************
;****************************************************
;IN
;pointer to control of ProgressBar
;message
;OUT
;not returned value
align 4
 
progress_bar:
 
;get message
mov eax,[esp+8]
 
;get pointer to control of button
mov esi,[esp+4]
mov [PointerForProgressBar],esi
 
;copy control to local control
add esi,control_header_size
mov edi,dword ProgressBar
mov ecx,pb_control_data_size
rep movsb
 
 
push eax
;load coordinats and size from control
mov eax,[PointerForProgressBar]
mov ebx,[eax+24] ;x
mov ecx,[eax+28] ;y
mov edx,[eax+32] ;size x
mov esi,[eax+36] ;size y
;set current coordinats and sizes in EeditBox
mov [ProgressBar.x],ebx
mov [ProgressBar.y],ecx
mov [ProgressBar.sizex],edx
mov [ProgressBar.sizey],esi
 
pop eax
 
 
cmp [eax],dword -1
jne no_destroy_progress_bar
 
jmp exit_progress_bar
no_destroy_progress_bar:
 
cmp [eax],dword 1
jne no_redraw_all_progress_bar
 
or [ProgressBar.type],pb_redraw_all
 
no_redraw_all_progress_bar:
 
cmp [eax],dword 3
jne no_special_message_progress_bar
 
or [ProgressBar.type],pb_special_progress_on
 
no_special_message_progress_bar:
 
xor eax,eax
mov al,[ProgressBar.type]
and al,pb_redraw_all
test al,al
jz no_draw_all_progress_bar
 
and [ProgressBar.type],pb_redraw_all_off
 
call draw_all_progress_bar
 
jmp exit_progress_bar
 
no_draw_all_progress_bar:
 
xor eax,eax
mov al,[ProgressBar.type]
and al,pb_special_progress_on
test al,al
jz no_draw_progress_bar
 
and [ProgressBar.type],pb_special_progress_off
 
call draw_progress
 
no_draw_progress_bar:
 
exit_progress_bar:
 
ret 8
 
draw_all_progress_bar:
 
mov eax,[ProgressBar.color3]
mov ebx,dword 0xffffff
mov ecx,20
mov edx,dword colors_table1
call gradient
 
mov eax,13
mov ebx,[ProgressBar.x]
mov ecx,[ProgressBar.y]
mov edx,[ProgressBar.color1]
shl ebx,16
shl ecx,16
add ebx,[ProgressBar.sizex]
add ecx,[ProgressBar.sizey]
mcall
 
mov eax,[ProgressBar.x]
mov ebx,[ProgressBar.y]
add eax,[ProgressBar.sizex]
add ebx,[ProgressBar.sizey]
mov [v],eax ;v=x+sizex
mov [v2],ebx ;v2=y+sizey
 
;dark lines
mov eax,[ProgressBar.color3]
and eax,0xffffff
mov [Line.color],eax
mov [Pixel.color],eax
 
;(x+1,y)-(x+sizex-1,y)
mov eax,[ProgressBar.x]
mov ebx,[ProgressBar.y]
mov ecx,[v]
add eax,1
sub ecx,1
mov [Line.x1],eax
mov [Line.x2],ecx
mov [Line.y1],ebx
mov [Line.y2],ebx
call DrawLine
 
;(x+sizex,y+1)-(x+sizex,y+sizey-1)
mov eax,[v]
mov ebx,[v2]
mov ecx,[ProgressBar.y]
add ecx,1
sub ebx,1
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ecx
mov [Line.y2],ebx
call DrawLine
 
;(x+1,y+sizey)-(x+sizex-1,y+sizey)
mov eax,[ProgressBar.x]
mov ebx,[v]
mov ecx,[v2]
add eax,1
sub ebx,1
mov [Line.x1],eax
mov [Line.x2],ebx
mov [Line.y1],ecx
mov [Line.y2],ecx
call DrawLine
 
;(x,y+1)-(x,y_sizey-1)
mov eax,[ProgressBar.x]
mov ebx,[ProgressBar.y]
mov ecx,[v2]
add ebx,1
sub ecx,1
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ecx
call DrawLine
 
;(x+1,y+1)-(x+1,y+2)
mov eax,[ProgressBar.x]
mov ebx,[ProgressBar.y]
mov ecx,ebx
add eax,1
add ebx,1
add ecx,2
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ecx
call DrawLine
 
;(x+2,y+1)
mov eax,[ProgressBar.x]
mov ebx,[ProgressBar.y]
add eax,2
add ebx,1
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
;(x+1,y+sizey-1)-(x+1,y+sizey-2)
mov eax,[ProgressBar.x]
mov ebx,[v2]
mov ecx,ebx
add eax,1
sub ebx,1
sub ecx,2
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ecx
call DrawLine
 
;(x+2,y+sizey-1)
mov eax,[ProgressBar.x]
mov ebx,[v2]
add eax,2
sub ebx,1
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
;(x+sizex-1,y+1)-(x+sizex-1,y+2)
mov eax,[v]
mov ebx,[ProgressBar.y]
mov ecx,ebx
sub eax,1
add ebx,1
add ecx,2
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ecx
call DrawLine
 
;(x+sizex-2,y+1)
mov eax,[v]
mov ebx,[ProgressBar.y]
sub eax,2
add ebx,1
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
;(x+sizex-1,y+sizey-2)-(x+sizex-1,y+sizey-1)
mov eax,[v]
mov ebx,[v2]
mov ecx,ebx
sub eax,1
sub ebx,2
sub ecx,1
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ecx
call DrawLine
 
;(x+sizex-2,y+sizey-1)
mov eax,[v]
mov ebx,[v2]
sub eax,2
sub ebx,1
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
mov eax,[colors_table1+10*3]
and eax,0xffffff
mov [Line.color],eax
mov [Pixel.color],eax
 
;(x+3,y+1)-(x+sizex-3,y+1)
mov eax,[ProgressBar.x]
mov ebx,[v]
mov ecx,[ProgressBar.y]
add ecx,1
add eax,3
sub ebx,3
mov [Line.x1],eax
mov [Line.x2],ebx
mov [Line.y1],ecx
mov [Line.y2],ecx
call DrawLine
 
;(x+2,y+2)
mov eax,[ProgressBar.x]
mov ebx,[ProgressBar.y]
add eax,2
add ebx,2
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
;(x+sizex-1,y+3)-(x+sizex-1,y+sizey-3)
mov eax,[v]
mov ebx,[v2]
mov ecx,[ProgressBar.y]
sub eax,1
sub ebx,3
add ecx,3
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ecx
mov [Line.y2],ebx
call DrawLine
 
;(x+sizex-2,y+2)
mov eax,[v]
mov ebx,[ProgressBar.y]
sub eax,2
add ebx,2
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
;(x+3,y+sizey-1)-(x+sizex-3,y+sizey-1)
mov eax,[ProgressBar.x]
mov ebx,[v]
mov ecx,[v2]
sub ebx,3
sub ecx,1
add eax,3
mov [Line.x1],eax
mov [Line.x2],ebx
mov [Line.y1],ecx
mov [Line.y2],ecx
call DrawLine
 
;(x+sizex-2,y+sizey-2)
mov eax,[v]
mov ebx,[v2]
sub eax,2
sub ebx,2
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
;(x+1,y+3)-(x+1,y+sizey-3)
mov eax,[ProgressBar.x]
mov ebx,[ProgressBar.y]
mov ecx,[v2]
add eax,1
add ebx,3
sub ecx,3
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ecx
call DrawLine
 
;(x+2,y+sizey-2)
mov eax,[ProgressBar.x]
mov ebx,[v2]
add eax,2
sub ebx,2
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
ret
 
draw_progress:
 
cmp [ProgressBar.progress],dword 0.02
jae min_size_ok
 
mov [ProgressBar.progress],dword 0.02
min_size_ok:
 
cmp [ProgressBar.progress],dword 1.0
jle max_size_ok
 
mov [ProgressBar.progress],dword 1.0
max_size_ok:
 
mov eax,[ProgressBar.sizex]
sub eax,6
mov [v2],eax
 
fld [ProgressBar.progress]
fild [v2]
fmul st0,st1
fistp [v3]
fstp st0
 
mov eax,[ProgressBar.color2]
mov ebx,0xffffff
mov ecx,[ProgressBar.x]
mov edx,[ProgressBar.y]
mov esi,[v3]
mov edi,[ProgressBar.sizey]
sub edi,4
shr edi,1
add ecx,3
add edx,1
 
call rectangle_gradient_up
 
mov eax,[ProgressBar.color2]
mov ebx,0xffffff
mov ecx,[ProgressBar.x]
mov edx,[ProgressBar.y]
mov esi,[v3]
mov edi,[ProgressBar.sizey]
sub edi,4
shr edi,1
add ecx,3
add edx,2
add edx,edi
 
call rectangle_gradient_down
 
ret
/programs/develop/libGUI/src/remove_component.inc
0,0 → 1,24
;****************************************************
;***************Resize of GUI component**************
;****************************************************
;IN
;ResizeComponent(dword Parend,dword Control,dword newx,dword newy)
;newy
;newx
;Control
;Parend
;OUT
;not
 
align 4
 
remove_component:
 
mov ebx,[esp+4] ;Control
mov ecx,[esp+8] ;new x
mov edx,[esp+12] ;new y
 
mov [ebx+24],ecx
mov [ebx+28],edx
 
ret 12
/programs/develop/libGUI/src/resize_component.inc
0,0 → 1,24
;****************************************************
;***************Resize of GUI component**************
;****************************************************
;IN
;ResizeComponent(dword Parend,dword Control,dword newx,dword newy)
;newy
;newx
;Control
;Parend
;OUT
;not
 
align 4
 
resize_component:
 
mov ebx,[esp+4] ;Control
mov ecx,[esp+8] ;new size x
mov edx,[esp+12] ;new size y
 
mov [ebx+32],ecx
mov [ebx+36],edx
 
ret 12
/programs/develop/libGUI/src/scroller.inc
0,0 → 1,4195
 
;scroller's flags
sc_check_vertical = 1b
sc_check_horizontal = 10b
sc_check_init_child_buttons = 100b
sc_check_3D_type = 10000b
sc_scroll_bar_move = 100000b
sc_active = 1000000b
sc_redraw = 10000000b
sc_redraw_off = 01111111b
sc_full_redraw = 11100000b
sc_scroll_bar_move_off = 11011111b
sc_move_active_off = 10011111b
 
sc_first_child_button_pressed = 1b
sc_first_child_button_pressed_off = 11111110b
sc_second_child_button_pressed = 10000b
sc_second_child_button_pressed_off = 11101111b
 
sc_control_data_size = 29
sc_child_button_type = 10001000b
 
;****************************************************
;******************Crate Scroller*********************
;****************************************************
;IN
;pointer to parend
;pointer to Scroller's structure
;OUT
;pointer to initialized Scroller's structure
align 4
 
craete_scroller:
 
mov ebx,[esp+4]
mov eax,[esp+8]
 
mov [PointerToStructureForScroller],eax
 
mov eax,control_header_size+sc_control_data_size
call craete_control
 
;set all button's parameters in control
mov [eax],dword scroller
 
mov ecx,sc_control_data_size
mov esi,[PointerToStructureForScroller]
mov edi,eax
add edi,control_header_size
rep movsb
 
mov ebx,[PointerToStructureForScroller]
 
xor ecx,ecx
mov cl,byte[ebx]
and cl,sc_check_vertical
jz type_horizontal_scroller
 
;if we here than scroller vertical
mov esi,16 ;scroller size x
xor edi,edi
mov di,[ebx+5] ;scroller size y
jmp exit_type_scroller
type_horizontal_scroller:
 
xor esi,esi
mov si,[ebx+5] ;scroller size x
mov edi,16 ;scroller size y
exit_type_scroller:
 
xor ecx,ecx
xor edx,edx
mov cx,[ebx+1] ;scroller x
mov dx,[ebx+3] ;scroller y
 
call get_skin_height
add ecx,border_width
add edx,[skin_height]
;copy information to control
mov [eax+24],ecx
mov [eax+28],edx
mov [eax+32],esi
mov [eax+36],edi
 
ret 8
 
;****************************************************
;*******************Draw Scroller*********************
;****************************************************
;IN
;pointer to control of scroller
;message
;OUT
;not returned value
align 4
 
scroller:
 
 
;get message
mov eax,[esp+8]
 
;copy message
mov esi,eax
mov edi,dword Message
mov ecx,4
rep movsd
 
;get pointer to control of scroller
mov esi,[esp+4]
mov [PointerForScroller],esi
;copy control to local control
mov edi,dword Scroller
mov ecx,control_header_size+sc_control_data_size
rep movsb
 
 
cmp [eax],dword 1
jne no_redraw_all_scroller
 
or [Scroller.type],sc_full_redraw
no_redraw_all_scroller:
 
cmp [eax],dword 2
jne no_keys_scroller
 
jmp exit_scroller
no_keys_scroller:
 
cmp [eax],dword 3
jne no_pressed_button_scroller
 
jmp exit_scroller
no_pressed_button_scroller:
 
cmp [eax],dword 6
jne no_mouse_scroller
 
mov esi,[eax+4]
mov edi,[eax+8]
mov ecx,[eax+12]
mov [Scroller.mouseX],si
mov [Scroller.mouseY],di
mov [ButtonsOfMouse],ecx
no_mouse_scroller:
 
 
cmp [eax],dword -1
jne no_delete_scroller
 
mov eax,[Scroller.ChildButton1]
call free
 
mov eax,[Scroller.ChildButton2]
call free
 
;push [Scroller.ChildButton1]
;call destroy_control
 
;push [Scroller.ChildButton2]
;call destroy_control
 
jmp exit_scroller
no_delete_scroller:
 
;load coordinats and size from control
mov eax,[PointerForScroller]
mov ebx,[eax+24] ;x
mov ecx,[eax+28] ;y
mov edx,[eax+32] ;size x
mov esi,[eax+36] ;size y
;set current coordinats and sizes in scroller
mov [Scroller.x],bx
mov [Scroller.y],cx
 
xor eax,eax
mov al,[Scroller.type]
and al,sc_check_vertical
test al,al
jz set_for_horizontal
 
mov [Scroller.length],si
 
jmp exit_if_vertical
set_for_horizontal:
 
mov [Scroller.length],dx
 
exit_if_vertical:
 
;checking to craete child buttons
xor eax,eax
mov al,[Scroller.type]
and al,sc_check_init_child_buttons
jnz child_buttons_craeted
 
or [Scroller.type],sc_check_init_child_buttons
 
mov [ChildButton.type],byte sc_child_button_type
mov [ChildButton.width],16
mov [ChildButton.height],16
xor ebx,ebx
xor ecx,ecx
mov bx,[Scroller.x]
mov cx,[Scroller.y]
mov [ChildButton.x],bx
mov [ChildButton.y],cx
 
push ChildButton
push [PointerForScroller]
 
call craete_button
 
mov [Scroller.ChildButton1],eax
 
xor ebx,ebx
xor ecx,ecx
mov bx,[Scroller.x]
mov cx,[Scroller.y]
 
xor eax,eax
mov al,[Scroller.type]
and al,sc_check_vertical
test al,al
jz init_buttons_for_horizontal_scroller
 
 
add cx,[Scroller.length]
sub ecx,16
 
 
jmp exit_if_init_buttons_for_horizontal_scroller
init_buttons_for_horizontal_scroller:
 
 
add bx,[Scroller.length]
sub ebx,16
 
exit_if_init_buttons_for_horizontal_scroller:
 
mov [ChildButton.x],bx
mov [ChildButton.y],cx
 
push ChildButton
push [PointerForScroller]
 
call craete_button
 
mov [Scroller.ChildButton2],eax
 
mov esi,dword Scroller
mov edi,[PointerForScroller]
add esi,control_header_size
add edi,control_header_size
mov ecx,sc_control_data_size
rep movsb
 
child_buttons_craeted:
 
;checking for redraw all control
;if it is true than change koordinats of child buttons
xor eax,eax
mov al,[Scroller.type]
and al,sc_redraw
test al,al
jz no_change_koordinats_of_child_buttons
 
xor ebx,ebx
xor ecx,ecx
mov bx,[Scroller.x]
mov cx,[Scroller.y]
 
;first child button
mov eax,[Scroller.ChildButton1]
mov [eax+24],ebx ;x
mov [eax+28],ecx ;y
 
xor eax,eax
mov al,[Scroller.type]
and al,sc_check_vertical
test al,al
jz change_koordinats_of_buttons_for_horizontal_scroller
 
add cx,[Scroller.length]
sub ecx,16
 
jmp exit_if_change_koordinats_of_buttons_for_horizontal_scroller
change_koordinats_of_buttons_for_horizontal_scroller:
 
add bx,[Scroller.length]
sub ebx,16
 
exit_if_change_koordinats_of_buttons_for_horizontal_scroller:
 
;second child button
mov eax,[Scroller.ChildButton2]
mov [eax+24],ebx ;x
mov [eax+28],ecx ;y
 
no_change_koordinats_of_child_buttons:
 
;is a 3D scroller ?
xor eax,eax
mov al,[Scroller.type]
and al,sc_check_3D_type
test al,al
jz no_3D_scroller
 
 
mov eax,[Scroller.color1]
mov ebx,0xffffff
mov ecx,16
mov edx,dword pointer
call gradient
 
mov eax,[pointer+9]
and eax,0xffffff
mov [Color],eax
 
mov eax,[pointer]
mov ebx,0xffffff
call calculate_average_color
mov [AveregeColor],eax
 
;is a vertical 3D scroller ?
xor eax,eax
mov al,[Scroller.type]
and al,sc_check_vertical
test al,al
jz no_vertical_scroller_3D
 
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor edx,edx
xor esi,esi
xor edi,edi
mov ax,[Scroller.x]
mov bx,[Scroller.y]
mov cx,16
mov dx,[Scroller.length]
mov si,[Scroller.mouseX]
mov di,[Scroller.mouseY]
add ebx,17
sub edx,17+17
call CheckCrossingBox
 
cmp eax,0xffffff
jne no_crossing_vertical_scroller_3D
 
or [Scroller.type],sc_active
mov esi,dword Scroller
mov edi,[PointerForScroller]
add esi,control_header_size
add edi,control_header_size
mov ecx,sc_control_data_size
rep movsb
 
no_crossing_vertical_scroller_3D:
 
;is a vertical 3D scroller active ?
xor eax,eax
mov al,[Scroller.type]
and al,sc_active
test al,al
jz no_vertical_scroller_active
 
;calculate size of scroll bar
xor eax,eax
mov ax,[Scroller.length]
sub eax,16+16
mov [v],eax
fld [Scroller.size]
fild [v]
fmul st0,st1
fistp [Scrollersize]
fstp [v]
 
cmp [Scrollersize],4
jae no_minimum_size_vertical_3D_scroller
 
mov [Scrollersize],4
no_minimum_size_vertical_3D_scroller:
 
;if scroller is not active than use this is coordinats.
xor eax,eax
mov ax,[Scroller.length]
sub eax,17+17
sub eax,[Scrollersize]
mov [yo],eax
fld [Scroller.pos]
fild [yo]
fmul st0,st1
fistp [v]
fstp [v2]
 
xor eax,eax
mov ax,[Scroller.y]
add ax,17
add eax,[v]
mov [ScrollBar.y],eax
 
;check button of mouse
mov eax,[ButtonsOfMouse]
and eax,1b
test al,al
jz no_vertical_scroller_move
;calculate in pixels length of scroll bar
 
xor eax,eax
xor edx,edx
xor ecx,ecx
mov ax,[Scroller.y]
mov cx,[Scroller.length]
mov dx,[Scroller.mouseY]
mov ebx,edx
add ecx,eax
add eax,17
sub ecx,17
mov esi,ecx
 
sub ebx,eax
jns no_minimum_scroller_y
 
mov [Scroller.mouseY],ax
no_minimum_scroller_y:
 
sub ecx,edx
jns no_maximum_scroller_y
 
mov [Scroller.mouseY],si
no_maximum_scroller_y:
 
 
mov eax,[Scrollersize]
shr eax,1
xor ebx,ebx
mov bx,[Scroller.mouseY]
sub bx,[Scroller.y]
sub ebx,17
xor ecx,ecx
mov cx,[Scroller.y]
add cx,[Scroller.length]
sub cx,17
sub cx,[Scroller.mouseY]
 
cmp ebx,eax
jae no_correct_y
xor edx,edx
mov dx,[Scroller.y]
add dx,17
add edx,eax
no_correct_y:
 
cmp ecx,eax
jae no_correct_y_
xor edx,edx
mov dx,[Scroller.y]
add dx,[Scroller.length]
sub dx,17
sub edx,eax
no_correct_y_:
 
mov [ScrollBar.y],edx
sub [ScrollBar.y],eax
sub dx,[Scroller.y]
sub edx,17
sub edx,eax
mov [v],edx
 
shl eax,1
xor ebx,ebx
mov bx,[Scroller.length]
sub ebx,17+17
sub ebx,[Scrollersize]
mov [v2],ebx
 
fild [v2]
fild [v]
fdiv st0,st1
fstp [Scroller.pos]
fistp [v2]
 
;put 5 bit(scroll bar move)
or [Scroller.type],sc_scroll_bar_move
 
mov esi,dword Scroller
mov edi,[PointerForScroller]
add esi,control_header_size
add edi,control_header_size
mov ecx,sc_control_data_size
rep movsb
 
jmp no_vertical_scroller_active
no_vertical_scroller_move:
 
no_vertical_scroller_active:
 
;if bit 7 is a true than redraw all scroller.
 
xor eax,eax
mov al,[Scroller.type]
and al,sc_redraw
test al,al
jz no_redraw_all_vertical_scroller
 
and [Scroller.type],sc_redraw_off
mov esi,dword Scroller
mov edi,[PointerForScroller]
add esi,control_header_size
add edi,control_header_size
mov ecx,sc_control_data_size
rep movsb
 
call DrawButtonsOfVertical3DScroller
 
no_redraw_all_vertical_scroller:
 
xor eax,eax
mov al,[Scroller.type]
and al,sc_scroll_bar_move
test al,al
jz no_move_vertical_scroller_bar_3D
 
xor eax,eax
mov ax,[Scroller.x]
mov ebx,[ScrollBar.y]
mov ecx,[Scrollersize]
call DrawVertical3DScrollBar
 
and [Scroller.type],sc_scroll_bar_move_off
mov esi,dword Scroller
mov edi,[PointerForScroller]
add esi,control_header_size
add edi,control_header_size
mov ecx,sc_control_data_size
rep movsb
 
no_move_vertical_scroller_bar_3D:
 
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor edx,edx
xor esi,esi
xor edi,edi
mov ax,[Scroller.x]
mov bx,[Scroller.y]
mov cx,16
mov dx,[Scroller.length]
mov si,[Scroller.mouseX]
mov di,[Scroller.mouseY]
add ebx,17
sub edx,17+17
call CheckCrossingBox
 
cmp eax,0xffffff
jne no_crossing_vertical_scroller_3D_
 
or [Scroller.type],sc_active
mov esi,dword Scroller
mov edi,[PointerForScroller]
add esi,control_header_size
add edi,control_header_size
mov ecx,sc_control_data_size
rep movsb
 
jmp exit_crossing_vertical_scroller_3D
no_crossing_vertical_scroller_3D_:
 
;check button of mouse
mov eax,[ButtonsOfMouse]
 
and eax,1b
test al,al
jnz mouse_button_pressed_vertical
 
and [Scroller.type],sc_move_active_off
mov esi,dword Scroller
mov edi,[PointerForScroller]
add esi,control_header_size
add edi,control_header_size
mov ecx,sc_control_data_size
rep movsb
mouse_button_pressed_vertical:
 
exit_crossing_vertical_scroller_3D:
 
 
xor eax,eax
mov al,[Scroller.type]
and al,sc_active
test al,al
jz no_change_vertical_scroller_3D
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.mouseX]
 
sub eax,ebx
jns no_signum_1
neg eax
no_signum_1:
 
cmp eax,110
jle no_change_bits_vertical_scroller_3D
 
and [Scroller.type],sc_move_active_off
no_change_bits_vertical_scroller_3D:
 
mov esi,dword Scroller
mov edi,[PointerForScroller]
add esi,control_header_size
add edi,control_header_size
mov ecx,sc_control_data_size
rep movsb
 
no_change_vertical_scroller_3D:
 
no_vertical_scroller_3D:
 
;****************Horinzontal scroller**************
 
;is a horizontal 3D scroller ?
xor eax,eax
mov al,[Scroller.type]
and al,sc_check_horizontal
test al,al
jz no_horizontal_scroller_3D
 
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor edx,edx
xor esi,esi
xor edi,edi
mov ax,[Scroller.x]
mov bx,[Scroller.y]
mov cx,[Scroller.length]
mov dx,16
mov si,[Scroller.mouseX]
mov di,[Scroller.mouseY]
add eax,17
sub ecx,17+17
call CheckCrossingBox
 
cmp eax,0xffffff
jne no_crossing_horizontal_scroller_3D
 
or [Scroller.type],sc_active
mov esi,dword Scroller
mov edi,[PointerForScroller]
add esi,control_header_size
add edi,control_header_size
mov ecx,sc_control_data_size
rep movsb
 
no_crossing_horizontal_scroller_3D:
 
;is a vertical 3D scroller active ?
xor eax,eax
mov al,[Scroller.type]
and al,sc_active
test al,al
jz no_horizontal_scroller_active
 
;calculate size of scroll bar
xor eax,eax
mov ax,[Scroller.length]
sub eax,16+16
mov [v],eax
fld [Scroller.size]
fild [v]
fmul st0,st1
fistp [Scrollersize]
fstp [v]
 
cmp [Scrollersize],4
jae no_minimum_size_horizontal_3D_scroller
 
mov [Scrollersize],4
no_minimum_size_horizontal_3D_scroller:
 
;if scroller is not active than use this is coordinats.
xor eax,eax
mov ax,[Scroller.length]
sub eax,17+17
sub eax,[Scrollersize]
mov [xo],eax
fld [Scroller.pos]
fild [xo]
fmul st0,st1
fistp [v]
fstp [v2]
 
xor eax,eax
mov ax,[Scroller.x]
add ax,17
add eax,[v]
mov [ScrollBar.x],eax
 
;check button of mouse
mov eax,[ButtonsOfMouse]
 
and eax,1b
test al,al
jz no_horizontal_scroller_move
;calculate in pixels length of scroll bar
 
xor eax,eax
xor edx,edx
xor ecx,ecx
mov ax,[Scroller.x]
mov cx,[Scroller.length]
mov dx,[Scroller.mouseX]
mov ebx,edx
add ecx,eax
add eax,17
sub ecx,17
mov esi,ecx
 
sub ebx,eax
jns no_minimum_scroller_x_
 
mov [Scroller.mouseX],ax
no_minimum_scroller_x_:
 
sub ecx,edx
jns no_maximum_scroller_x_
 
mov [Scroller.mouseX],si
no_maximum_scroller_x_:
 
 
mov eax,[Scrollersize]
shr eax,1
xor ebx,ebx
mov bx,[Scroller.mouseX]
sub bx,[Scroller.x]
sub ebx,17
xor ecx,ecx
mov cx,[Scroller.x]
add cx,[Scroller.length]
sub cx,17
sub cx,[Scroller.mouseX]
 
cmp ebx,eax
jae no_correct_x_
xor edx,edx
mov dx,[Scroller.x]
add dx,17
add edx,eax
no_correct_x_:
 
cmp ecx,eax
jae no_correct_x__
xor edx,edx
mov dx,[Scroller.x]
add dx,[Scroller.length]
sub dx,17
sub edx,eax
no_correct_x__:
 
mov [ScrollBar.x],edx
sub [ScrollBar.x],eax
sub dx,[Scroller.x]
sub edx,17
sub edx,eax
mov [v],edx
 
xor ebx,ebx
mov bx,[Scroller.length]
sub ebx,17+17
sub ebx,[Scrollersize]
mov [v2],ebx
 
fild [v2]
fild [v]
fdiv st0,st1
fstp [Scroller.pos]
fistp [v2]
 
;put 5 bit(scroll bar move)
or [Scroller.type],sc_scroll_bar_move
 
mov esi,dword Scroller
mov edi,[PointerForScroller]
add esi,control_header_size
add edi,control_header_size
mov ecx,sc_control_data_size
rep movsb
 
jmp no_horizontal_scroller_active
no_horizontal_scroller_move:
 
no_horizontal_scroller_active:
 
;if bit 7 is a true than redraw all scroller.
 
xor eax,eax
mov al,[Scroller.type]
and al,sc_redraw
test al,al
jz no_redraw_all_horizontal_scroller
 
and [Scroller.type],sc_redraw_off
mov esi,dword Scroller
mov edi,[PointerForScroller]
add esi,control_header_size
add edi,control_header_size
mov ecx,sc_control_data_size
rep movsb
 
call DrawButtonsOfHorizontal3DScroller
 
no_redraw_all_horizontal_scroller:
 
xor eax,eax
mov al,[Scroller.type]
and al,sc_scroll_bar_move
test al,al
jz no_move_horizontal_scroller_bar_3D
 
xor ebx,ebx
mov bx,[Scroller.y]
mov eax,[ScrollBar.x]
mov ecx,[Scrollersize]
call DrawHorizontal3DScrollBar
 
and [Scroller.type],sc_scroll_bar_move_off
mov esi,dword Scroller
mov edi,[PointerForScroller]
add esi,control_header_size
add edi,control_header_size
mov ecx,sc_control_data_size
rep movsb
 
no_move_horizontal_scroller_bar_3D:
 
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor edx,edx
xor esi,esi
xor edi,edi
mov ax,[Scroller.x]
mov bx,[Scroller.y]
mov dx,16
mov cx,[Scroller.length]
mov si,[Scroller.mouseX]
mov di,[Scroller.mouseY]
add eax,17
sub ecx,17+17
call CheckCrossingBox
 
cmp eax,0xffffff
jne no_crossing_horizontal_scroller_3D_
 
or [Scroller.type],sc_active
mov esi,dword Scroller
mov edi,[PointerForScroller]
add esi,control_header_size
add edi,control_header_size
mov ecx,sc_control_data_size
rep movsb
 
jmp exit_crossing_horizontal_scroller_3D
no_crossing_horizontal_scroller_3D_:
 
;check button of mouse
mov eax,[ButtonsOfMouse]
 
and eax,1b
test al,al
jnz mouse_button_pressed_horizontal
 
and [Scroller.type],sc_move_active_off
mov esi,dword Scroller
mov edi,[PointerForScroller]
add esi,control_header_size
add edi,control_header_size
mov ecx,sc_control_data_size
rep movsb
mouse_button_pressed_horizontal:
 
exit_crossing_horizontal_scroller_3D:
 
 
xor eax,eax
mov al,[Scroller.type]
and al,sc_active
test al,al
jz no_change_horizontal_scroller_3D
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.y]
mov bx,[Scroller.mouseY]
 
sub eax,ebx
jns no_signum_1_x
neg eax
no_signum_1_x:
 
cmp eax,110
jle no_change_bits_horizontal_scroller_3D
 
and [Scroller.type],sc_move_active_off
no_change_bits_horizontal_scroller_3D:
 
mov esi,dword Scroller
mov edi,[PointerForScroller]
add esi,control_header_size
add edi,control_header_size
mov ecx,sc_control_data_size
rep movsb
 
no_change_horizontal_scroller_3D:
 
no_horizontal_scroller_3D:
 
no_3D_scroller:
 
;****************************************************
;********************2D scrollers*********************
;****************************************************
 
xor eax,eax
mov al,[Scroller.type]
and al,sc_check_3D_type
test al,al
jnz no_2D_scroller
 
mov eax,[Scroller.color1]
mov ebx,0xffffff
mov ecx,16
mov edx,dword pointer
call gradient
 
mov eax,[pointer+9]
and eax,0xffffff
mov [Color],eax
 
mov eax,[pointer]
mov ebx,0xffffff
call calculate_average_color
mov [AveregeColor],eax
 
;is a vertical 2D scroller ?
xor eax,eax
mov al,[Scroller.type]
and al,sc_check_vertical
test al,al
jz no_vertical_scroller_2D
 
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor edx,edx
xor esi,esi
xor edi,edi
mov ax,[Scroller.x]
mov bx,[Scroller.y]
mov cx,16
mov dx,[Scroller.length]
mov si,[Scroller.mouseX]
mov di,[Scroller.mouseY]
add ebx,17
sub edx,17+17
call CheckCrossingBox
 
cmp eax,0xffffff
jne no_crossing_vertical_scroller_2D
 
or [Scroller.type],sc_active
mov esi,dword Scroller
mov edi,[PointerForScroller]
add esi,control_header_size
add edi,control_header_size
mov ecx,sc_control_data_size
rep movsb
 
no_crossing_vertical_scroller_2D:
 
;is a vertical 2D scroller active ?
xor eax,eax
mov al,[Scroller.type]
and al,sc_active
test al,al
jz no_vertical_scroller_active_2D
 
;calculate size of scroll bar
xor eax,eax
mov ax,[Scroller.length]
sub eax,16+16
mov [v],eax
fld [Scroller.size]
fild [v]
fmul st0,st1
fistp [Scrollersize]
fstp [v]
 
cmp [Scrollersize],4
jae no_minimum_size_vertical_2D_scroller
 
mov [Scrollersize],4
no_minimum_size_vertical_2D_scroller:
 
;if scroller is not active than use this is coordinats.
xor eax,eax
mov ax,[Scroller.length]
sub eax,17+17
sub eax,[Scrollersize]
mov [yo],eax
fld [Scroller.pos]
fild [yo]
fmul st0,st1
fistp [v]
fstp [v2]
 
xor eax,eax
mov ax,[Scroller.y]
add ax,16
add eax,[v]
mov [ScrollBar.y],eax
 
;check button of mouse
mov eax,[ButtonsOfMouse]
 
and eax,1b
test al,al
jz no_vertical_scroller_move_2D
;calculate in pixels length of scroll bar
 
xor eax,eax
xor edx,edx
xor ecx,ecx
mov ax,[Scroller.y]
mov cx,[Scroller.length]
mov dx,[Scroller.mouseY]
mov ebx,edx
add ecx,eax
add eax,17
sub ecx,17
mov esi,ecx
 
sub ebx,eax
jns no_minimum_scroller_y_2D
 
mov [Scroller.mouseY],ax
no_minimum_scroller_y_2D:
 
sub ecx,edx
jns no_maximum_scroller_y_2D
 
mov [Scroller.mouseY],si
no_maximum_scroller_y_2D:
 
 
mov eax,[Scrollersize]
shr eax,1
xor ebx,ebx
mov bx,[Scroller.mouseY]
sub bx,[Scroller.y]
sub ebx,17
xor ecx,ecx
mov cx,[Scroller.y]
add cx,[Scroller.length]
sub cx,17
sub cx,[Scroller.mouseY]
 
cmp ebx,eax
jae no_correct_y_2D_
xor edx,edx
mov dx,[Scroller.y]
add dx,16
add edx,eax
no_correct_y_2D_:
 
cmp ecx,eax
jae no_correct_y_2D
xor edx,edx
mov dx,[Scroller.y]
add dx,[Scroller.length]
sub dx,16
sub edx,eax
no_correct_y_2D:
 
mov [ScrollBar.y],edx
sub [ScrollBar.y],eax
sub dx,[Scroller.y]
sub edx,16
sub edx,eax
mov [v],edx
 
shl eax,1
xor ebx,ebx
mov bx,[Scroller.length]
sub ebx,16+16
sub ebx,[Scrollersize]
mov [v2],ebx
 
fild [v2]
fild [v]
fdiv st0,st1
fstp [Scroller.pos]
fistp [v2]
 
;put 5 bit(scroll bar move)
or [Scroller.type],sc_scroll_bar_move
 
mov esi,dword Scroller
mov edi,[PointerForScroller]
add esi,control_header_size
add edi,control_header_size
mov ecx,sc_control_data_size
rep movsb
 
jmp no_vertical_scroller_active_2D
no_vertical_scroller_move_2D:
 
no_vertical_scroller_active_2D:
 
;if bit 7 is a true than redraw all scroller.
 
xor eax,eax
mov al,[Scroller.type]
and al,sc_redraw
test al,al
jz no_redraw_all_vertical_scroller_2D
 
and [Scroller.type],sc_redraw_off
mov esi,dword Scroller
mov edi,[PointerForScroller]
add esi,control_header_size
add edi,control_header_size
mov ecx,sc_control_data_size
rep movsb
 
call DrawButtonsOf2DVerticalScroller
 
no_redraw_all_vertical_scroller_2D:
 
xor eax,eax
mov al,[Scroller.type]
and al,sc_scroll_bar_move
test al,al
jz no_move_vertical_scroller_bar_2D
 
xor eax,eax
mov ax,[Scroller.x]
mov ebx,[ScrollBar.y]
mov ecx,[Scrollersize]
call DrawVertical2DScrollBar
 
and [Scroller.type],sc_scroll_bar_move_off
mov esi,dword Scroller
mov edi,[PointerForScroller]
add esi,control_header_size
add edi,control_header_size
mov ecx,sc_control_data_size
rep movsb
 
no_move_vertical_scroller_bar_2D:
 
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor edx,edx
xor esi,esi
xor edi,edi
mov ax,[Scroller.x]
mov bx,[Scroller.y]
mov cx,16
mov dx,[Scroller.length]
mov si,[Scroller.mouseX]
mov di,[Scroller.mouseY]
add ebx,17
sub edx,17+17
call CheckCrossingBox
 
cmp eax,0xffffff
jne no_crossing_vertical_scroller_2D_
 
or [Scroller.type],sc_active
mov esi,dword Scroller
mov edi,[PointerForScroller]
add esi,control_header_size
add edi,control_header_size
mov ecx,sc_control_data_size
rep movsb
 
jmp exit_crossing_vertical_scroller_2D
no_crossing_vertical_scroller_2D_:
 
;check button of mouse
mov eax,[ButtonsOfMouse]
 
and eax,1b
test al,al
jnz mouse_button_pressed_vertical_2D
 
and [Scroller.type],sc_move_active_off
mov esi,dword Scroller
mov edi,[PointerForScroller]
add esi,control_header_size
add edi,control_header_size
mov ecx,sc_control_data_size
rep movsb
mouse_button_pressed_vertical_2D:
 
exit_crossing_vertical_scroller_2D:
 
 
xor eax,eax
mov al,[Scroller.type]
and al,sc_active
test al,al
jz no_change_vertical_scroller_2D
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.mouseX]
 
sub eax,ebx
jns no_signum_1_y_2D
neg eax
no_signum_1_y_2D:
 
cmp eax,110
jle no_change_bits_vertical_scroller_2D
 
and [Scroller.type],sc_move_active_off
no_change_bits_vertical_scroller_2D:
 
mov esi,dword Scroller
mov edi,[PointerForScroller]
add esi,control_header_size
add edi,control_header_size
mov ecx,sc_control_data_size
rep movsb
 
no_change_vertical_scroller_2D:
 
no_vertical_scroller_2D:
 
;****************Horinzontal scroller**************
 
;is a horizontal 2D scroller ?
xor eax,eax
mov al,[Scroller.type]
and al,sc_check_horizontal
test al,al
jz no_horizontal_scroller_2D
 
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor edx,edx
xor esi,esi
xor edi,edi
mov ax,[Scroller.x]
mov bx,[Scroller.y]
mov cx,[Scroller.length]
mov dx,16
mov si,[Scroller.mouseX]
mov di,[Scroller.mouseY]
add eax,17
sub ecx,17+17
call CheckCrossingBox
 
cmp eax,0xffffff
jne no_crossing_horizontal_scroller_2D
 
or [Scroller.type],sc_active
mov esi,dword Scroller
mov edi,[PointerForScroller]
add esi,control_header_size
add edi,control_header_size
mov ecx,sc_control_data_size
rep movsb
 
no_crossing_horizontal_scroller_2D:
 
;is a vertical 3D scroller active ?
xor eax,eax
mov al,[Scroller.type]
and al,sc_active
test al,al
jz no_horizontal_scroller_active_2D
 
;calculate size of scroll bar
xor eax,eax
mov ax,[Scroller.length]
sub eax,16+16
mov [v],eax
fld [Scroller.size]
fild [v]
fmul st0,st1
fistp [Scrollersize]
fstp [v]
 
cmp [Scrollersize],4
jae no_minimum_size_horizontal_2D_scroller
 
mov [Scrollersize],4
no_minimum_size_horizontal_2D_scroller:
 
;if scroller is not active than use this is coordinats.
xor eax,eax
mov ax,[Scroller.length]
sub eax,17+17
sub eax,[Scrollersize]
mov [yo],eax
fld [Scroller.pos]
fild [yo]
fmul st0,st1
fistp [v]
fstp [v2]
 
xor eax,eax
mov ax,[Scroller.x]
add ax,16
add eax,[v]
mov [ScrollBar.x],eax
 
;check button of mouse
mov eax,[ButtonsOfMouse]
 
and eax,1b
test al,al
jz no_horizontal_scroller_move_2D
;calculate in pixels length of scroll bar
 
xor eax,eax
xor edx,edx
xor ecx,ecx
mov ax,[Scroller.x]
mov cx,[Scroller.length]
mov dx,[Scroller.mouseX]
mov ebx,edx
add ecx,eax
add eax,17
sub ecx,17
mov esi,ecx
 
sub ebx,eax
jns no_minimum_scroller_x_2D
 
mov [Scroller.mouseX],ax
no_minimum_scroller_x_2D:
 
sub ecx,edx
jns no_maximum_scroller_x_2D
 
mov [Scroller.mouseX],si
no_maximum_scroller_x_2D:
 
 
mov eax,[Scrollersize]
shr eax,1
xor ebx,ebx
mov bx,[Scroller.mouseX]
sub bx,[Scroller.x]
sub ebx,17
xor ecx,ecx
mov cx,[Scroller.x]
add cx,[Scroller.length]
sub cx,17
sub cx,[Scroller.mouseX]
 
cmp ebx,eax
jae no_correct_x_2D
xor edx,edx
mov dx,[Scroller.x]
add dx,16
add edx,eax
no_correct_x_2D:
 
cmp ecx,eax
jae no_correct_x__2D
xor edx,edx
mov dx,[Scroller.x]
add dx,[Scroller.length]
sub dx,16
sub edx,eax
no_correct_x__2D:
 
mov [ScrollBar.x],edx
sub [ScrollBar.x],eax
sub dx,[Scroller.x]
sub edx,16
sub edx,eax
mov [v],edx
 
xor ebx,ebx
mov bx,[Scroller.length]
sub ebx,16+16
sub ebx,[Scrollersize]
mov [v2],ebx
 
fild [v2]
fild [v]
fdiv st0,st1
fstp [Scroller.pos]
fistp [v2]
 
;put 5 bit(scroll bar move)
or [Scroller.type],sc_scroll_bar_move
 
mov esi,dword Scroller
mov edi,[PointerForScroller]
add esi,control_header_size
add edi,control_header_size
mov ecx,sc_control_data_size
rep movsb
 
jmp no_horizontal_scroller_active_2D
no_horizontal_scroller_move_2D:
 
no_horizontal_scroller_active_2D:
 
;if bit 7 is a true than redraw all scroller.
 
xor eax,eax
mov al,[Scroller.type]
and al,sc_redraw
test al,al
jz no_redraw_all_horizontal_scroller_2D
 
and [Scroller.type],sc_redraw_off
mov esi,dword Scroller
mov edi,[PointerForScroller]
add esi,control_header_size
add edi,control_header_size
mov ecx,sc_control_data_size
rep movsb
 
call DrawButtonsOf2DHorizontalScroller
 
no_redraw_all_horizontal_scroller_2D:
 
xor eax,eax
mov al,[Scroller.type]
and al,sc_scroll_bar_move
test al,al
jz no_move_horizontal_scroller_bar_2D
 
xor ebx,ebx
mov bx,[Scroller.y]
mov eax,[ScrollBar.x]
mov ecx,[Scrollersize]
call DrawHorizontal2DScrollBar
 
and [Scroller.type],sc_scroll_bar_move_off
mov esi,dword Scroller
mov edi,[PointerForScroller]
add esi,control_header_size
add edi,control_header_size
mov ecx,sc_control_data_size
rep movsb
 
no_move_horizontal_scroller_bar_2D:
 
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor edx,edx
xor esi,esi
xor edi,edi
mov ax,[Scroller.x]
mov bx,[Scroller.y]
mov dx,16
mov cx,[Scroller.length]
mov si,[Scroller.mouseX]
mov di,[Scroller.mouseY]
add eax,17
sub ecx,17+17
call CheckCrossingBox
 
cmp eax,0xffffff
jne no_crossing_horizontal_scroller_2D_
 
or [Scroller.type],sc_active
mov esi,dword Scroller
mov edi,[PointerForScroller]
add esi,control_header_size
add edi,control_header_size
mov ecx,sc_control_data_size
rep movsb
 
jmp exit_crossing_horizontal_scroller_2D
no_crossing_horizontal_scroller_2D_:
 
;check button of mouse
mov eax,[ButtonsOfMouse]
 
and eax,1b
test al,al
jnz mouse_button_pressed_horizontal_2D
 
and [Scroller.type],sc_move_active_off
mov esi,dword Scroller
mov edi,[PointerForScroller]
add esi,control_header_size
add edi,control_header_size
mov ecx,sc_control_data_size
rep movsb
mouse_button_pressed_horizontal_2D:
 
exit_crossing_horizontal_scroller_2D:
 
 
xor eax,eax
mov al,[Scroller.type]
and al,sc_active
test al,al
jz no_change_horizontal_scroller_2D
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.y]
mov bx,[Scroller.mouseY]
 
sub eax,ebx
jns no_signum_1_x_2D
neg eax
no_signum_1_x_2D:
 
cmp eax,110
jle no_change_bits_horizontal_scroller_2D
 
and [Scroller.type],sc_move_active_off
no_change_bits_horizontal_scroller_2D:
 
mov esi,dword Scroller
mov edi,[PointerForScroller]
add esi,control_header_size
add edi,control_header_size
mov ecx,sc_control_data_size
rep movsb
 
no_change_horizontal_scroller_2D:
 
no_horizontal_scroller_2D:
 
no_2D_scroller:
 
;checking to mouse events
cmp [Message],dword 6
jne no_send_message_to_child_buttons_of_scroller
 
;checking first child button
mov eax,[Scroller.ChildButton1]
mov ebx,[eax]
 
push Message
push eax
call ebx
 
mov eax,[Scroller.ChildButton1]
 
xor ebx,ebx
mov bl,[eax+45]
and bl,bt_crossing
test bl,bl
jz no_crossing_first_child_button_of_scroller
 
xor ebx,ebx
mov bl,[eax+45]
and bl,10b
test bl,bl
jz no_crossing_first_child_button_of_scroller
 
or [Scroller.buttons_flags],sc_first_child_button_pressed
or [Scroller.buttons_flags],10b
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
mov [x],eax
mov [y],ebx
 
;--------------------------------------
;---Checking stcroler to 2D or 3D types
;--------------------------------------
xor eax,eax
mov al,[Scroller.type]
and al,sc_check_3D_type
test al,al
jnz type_3D_first_child_button_crossing
 
;if we here than scroller 2D type
 
;----------------------------------------------------
;---Chcecking scroller to horizontal or vertical types
;----------------------------------------------------
 
call DrawPressedButtonOf2DScroller
 
jmp else_type_3D_first_child_button_crossing
 
type_3D_first_child_button_crossing:
 
;if we here than scroller 3D type
 
call DrawPressedButtonOf3DScroller
 
else_type_3D_first_child_button_crossing:
 
jmp crossing_first_child_button_of_scroller
no_crossing_first_child_button_of_scroller:
 
and [Scroller.buttons_flags],sc_first_child_button_pressed_off
 
xor eax,eax
mov ax,[Scroller.buttons_flags]
and ax,10b
test ax,ax
jz no_put_first_child_button
 
;--------------------------------------
;---Checking stcroler to 2D or 3D types
;--------------------------------------
xor eax,eax
mov al,[Scroller.type]
and al,sc_check_3D_type
test al,al
jnz type_3D_first_child_button_not_crossing
 
;if we here than scroller 2D type
 
;----------------------------------------------------
;---Chcecking scroller to horizontal or vertical types
;----------------------------------------------------
 
xor eax,eax
mov al,[Scroller.type]
and al,sc_check_vertical
test al,al
jz type_horizontal_first_child_2D_button
 
;put vertical first child button
call DrawButtonsOf2DVerticalScroller
 
jmp exit_else_type_horizontal_first_child_2D_button
type_horizontal_first_child_2D_button:
 
;put horizontal first child button
call DrawButtonsOf2DVerticalScroller
 
exit_else_type_horizontal_first_child_2D_button:
 
jmp else_type_3D_first_child_button_not_crossing
 
type_3D_first_child_button_not_crossing:
 
;if we here than scroller 3D type
 
;----------------------------------------------------
;---Chcecking scroller to horizontal or vertical types
;----------------------------------------------------
 
xor eax,eax
mov al,[Scroller.type]
and al,sc_check_vertical
test al,al
jz type_horizontal_first_child_3D_button
 
;put vertical first child button
call DrawButtonsOfVertical3DScroller
 
jmp else_type_3D_first_child_button_not_crossing
 
type_horizontal_first_child_3D_button:
 
;put horizontal first child button
call DrawButtonsOfHorizontal3DScroller
 
else_type_3D_first_child_button_not_crossing:
 
and [Scroller.buttons_flags],11111101b
 
no_put_first_child_button:
 
crossing_first_child_button_of_scroller:
 
;checking second child button
mov eax,[Scroller.ChildButton2]
mov ebx,[eax]
 
push Message
push eax
call ebx
 
mov eax,[Scroller.ChildButton2]
 
xor ebx,ebx
mov bl,[eax+45]
and bl,bt_crossing
test bl,bl
jz no_crossing_second_child_button_of_scroller
 
xor ebx,ebx
mov bl,[eax+45]
and bl,10b
test bl,bl
jz no_crossing_second_child_button_of_scroller
 
or [Scroller.buttons_flags],sc_second_child_button_pressed
or [Scroller.buttons_flags],100000b
 
xor eax,eax
xor ebx,ebx
xor ecx,ecx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
mov [x],eax
mov [y],ebx
 
mov cx,[Scroller.length]
sub ecx,16
 
;----------------------------------------------------
;---Chcecking scroller to horizontal or vertical types
;----------------------------------------------------
xor eax,eax
mov al,[Scroller.type]
and al,sc_check_vertical
test al,al
jz calculate_pos_horizontal_second_child_button
 
add [y],ecx
 
jmp exit_else_calculate_pos_horizontal_second_child_button
calculate_pos_horizontal_second_child_button:
 
add [x],ecx
 
exit_else_calculate_pos_horizontal_second_child_button:
 
;--------------------------------------
;---Checking stcroler to 2D or 3D types
;--------------------------------------
xor eax,eax
mov al,[Scroller.type]
and al,sc_check_3D_type
test al,al
jnz type_3D_second_child_button_crossing
 
;if we here than scroller 2D type
 
;----------------------------------------------------
;---Chcecking scroller to horizontal or vertical types
;----------------------------------------------------
 
call DrawPressedButtonOf2DScroller
 
jmp else_type_3D_second_child_button_crossing
 
type_3D_second_child_button_crossing:
 
;if we here than scroller 3D type
 
call DrawPressedButtonOf3DScroller
 
else_type_3D_second_child_button_crossing:
 
jmp crossing_second_child_button_of_scroller
no_crossing_second_child_button_of_scroller:
 
and [Scroller.buttons_flags],sc_second_child_button_pressed_off
 
xor eax,eax
mov ax,[Scroller.buttons_flags]
and ax,100000b
test ax,ax
jz no_put_second_child_button
 
;--------------------------------------
;---Checking stcroler to 2D or 3D types
;--------------------------------------
xor eax,eax
mov al,[Scroller.type]
and al,sc_check_3D_type
test al,al
jnz type_3D_second_child_button_not_crossing
 
;if we here than scroller 2D type
 
;----------------------------------------------------
;---Chcecking scroller to horizontal or vertical types
;----------------------------------------------------
 
xor eax,eax
mov al,[Scroller.type]
and al,sc_check_vertical
test al,al
jz type_horizontal_second_child_2D_button
 
;put vertical first child button
call DrawButtonsOf2DVerticalScroller
 
jmp exit_else_type_horizontal_second_child_2D_button
type_horizontal_second_child_2D_button:
 
;put horizontal first child button
call DrawButtonsOf2DVerticalScroller
 
exit_else_type_horizontal_second_child_2D_button:
 
jmp else_type_3D_second_child_button_not_crossing
 
type_3D_second_child_button_not_crossing:
 
;if we here than scroller 3D type
 
;----------------------------------------------------
;---Chcecking scroller to horizontal or vertical types
;----------------------------------------------------
 
xor eax,eax
mov al,[Scroller.type]
and al,sc_check_vertical
test al,al
jz type_horizontal_second_child_3D_button
 
;put vertical first child button
call DrawButtonsOfVertical3DScroller
 
jmp else_type_3D_second_child_button_not_crossing
 
type_horizontal_second_child_3D_button:
 
;put horizontal first child button
call DrawButtonsOfHorizontal3DScroller
 
else_type_3D_second_child_button_not_crossing:
 
and [Scroller.buttons_flags],11011111b
 
no_put_second_child_button:
 
crossing_second_child_button_of_scroller:
 
no_send_message_to_child_buttons_of_scroller:
 
exit_scroller:
 
;save resultat of work in control
mov esi,dword Scroller
mov edi,[PointerForScroller]
mov ecx,sc_control_data_size
add esi,control_header_size
add edi,control_header_size
rep movsb
 
ret 8
 
 
DrawPressedButtonOf2DScroller:
 
and [Line.color],0;eax
 
;draw horizontal up light line
mov eax,[x]
mov ebx,[y]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x2],15
call DrawLine
 
;draw vertical up light line
mov eax,[x]
mov ebx,[y]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y2],14
call DrawLine
 
;mov eax,[colors_table2+8*3]
;and eax,0xffffff
mov [Line.color],0xffffff ;eax
 
;draw vertical up dark line
mov eax,[x]
mov ebx,[y]
add eax,15
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y2],15
call DrawLine
 
;draw horizontal up dark line
mov eax,[x]
mov ebx,[y]
add ebx,15
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x2],15
call DrawLine
 
ret
 
DrawPressedButtonOf3DScroller:
 
and [Line.color],0;eax
 
;draw horizontal up light line
mov eax,[x]
mov ebx,[y]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x2],16
call DrawLine
 
;draw vertical up light line
mov eax,[x]
mov ebx,[y]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y2],16
call DrawLine
 
;mov eax,[colors_table2+8*3]
;and eax,0xffffff
mov [Line.color],0xffffff ;eax
 
;draw vertical up dark line
mov eax,[x]
mov ebx,[y]
add eax,16
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y2],16
call DrawLine
 
;draw horizontal up dark line
mov eax,[x]
mov ebx,[y]
add ebx,16
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x2],16
call DrawLine
 
ret
 
DrawButtonsOf2DHorizontalScroller:
 
;generate colors tables
mov eax,[Scroller.color1]
mov ebx,0xffffff
mov ecx,20
mov edx,dword colors_table1
call gradient
 
xor eax,eax
mov ebx,[Scroller.color1]
mov ecx,20
mov edx,dword colors_table2
call gradient
 
;draw vertical up rectangle
xor ebx,ebx
xor ecx,ecx
mov eax,13
mov bx,[Scroller.x]
mov cx,[Scroller.y]
shl ebx,16
shl ecx,16
add ebx,16
add ecx,16
mov edx,[Color]
and edx,0xffffff
mcall
 
mov eax,[colors_table1+15*3]
and eax,0xffffff
mov [Line.color],eax
 
;draw horizontal up light line
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x2],15
call DrawLine
 
;draw vertical up light line
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y2],15
call DrawLine
 
mov eax,[colors_table2+8*3]
and eax,0xffffff
mov [Line.color],eax
 
;draw vertical up dark line
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,15
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y2],15
call DrawLine
 
;draw horizontal up dark line
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add ebx,15
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x2],14
call DrawLine
 
and [Line.color],0
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],5
add [Line.x2],9
add [Line.y1],8
add [Line.y2],4
call DrawLine
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],6
add [Line.x2],9
add [Line.y1],8
add [Line.y2],5
call DrawLine
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],5
add [Line.x2],9
add [Line.y1],8
add [Line.y2],12
call DrawLine
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],6
add [Line.x2],9
add [Line.y1],8
add [Line.y2],11
call DrawLine
 
;draw vertical down rectangle
xor ebx,ebx
xor ecx,ecx
mov eax,13
mov edx,[Color]
mov bx,[Scroller.x]
mov cx,[Scroller.y]
add bx,[Scroller.length]
sub bx,16
shl ebx,16
shl ecx,16
add ebx,16
add ecx,16
and edx,0xffffff
mcall
 
mov eax,[colors_table1+15*3]
and eax,0xffffff
mov [Line.color],eax
 
;draw horizontal up light line
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add ax,[Scroller.length]
sub eax,15
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x2],15
call DrawLine
 
;draw vertical up light line
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add ax,[Scroller.length]
sub eax,16
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y2],15
call DrawLine
 
mov eax,[colors_table2+8*3]
and eax,0xffffff
mov [Line.color],eax
 
;draw vertical up dark line
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add ax,[Scroller.length]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y2],15
call DrawLine
 
;draw horizontal up dark line
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add ax,[Scroller.length]
sub eax,15
add ebx,15
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x2],15
call DrawLine
 
xor eax,eax
mov ax,[Scroller.length]
sub eax,16
mov [length],eax
 
and [Line.color],0
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,[length]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],12
add [Line.x2],8
add [Line.y1],8
add [Line.y2],4
call DrawLine
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,[length]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],11
add [Line.x2],8
add [Line.y1],8
add [Line.y2],5
call DrawLine
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,[length]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],12
add [Line.x2],8
add [Line.y1],8
add [Line.y2],12
call DrawLine
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,[length]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],11
add [Line.x2],8
add [Line.y1],8
add [Line.y2],11
call DrawLine
 
ret
 
DrawButtonsOf2DVerticalScroller:
 
;generate colors tables
mov eax,[Scroller.color1]
mov ebx,0xffffff
mov ecx,20
mov edx,dword colors_table1
call gradient
 
xor eax,eax
mov ebx,[Scroller.color1]
mov ecx,20
mov edx,dword colors_table2
call gradient
 
;draw vertical up rectangle
mov eax,13
mov edx,[Color]
xor ebx,ebx
xor ecx,ecx
mov bx,[Scroller.x]
mov cx,[Scroller.y]
shl ebx,16
shl ecx,16
add ebx,16
add ecx,16
and edx,0xffffff
mcall
 
mov eax,[colors_table1+15*3]
and eax,0xffffff
mov [Line.color],eax
 
;draw horizontal up light line
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x2],14
call DrawLine
 
;draw vertical up light line
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y2],14
call DrawLine
 
mov eax,[colors_table2+8*3];[pointer]
and eax,0xffffff
mov [Line.color],eax
 
;draw vertical up dark line
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,15
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y2],15
call DrawLine
 
;draw horizontal up dark line
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add ebx,15
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x2],15
call DrawLine
 
and [Line.color],0
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],4
add [Line.x2],8
add [Line.y1],9
add [Line.y2],5
call DrawLine
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],4
add [Line.x2],8
add [Line.y1],10
add [Line.y2],6
call DrawLine
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],8
add [Line.x2],12
add [Line.y1],5
add [Line.y2],9
call DrawLine
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],8
add [Line.x2],12
add [Line.y1],6
add [Line.y2],10
call DrawLine
 
;draw vertical down rectangle
xor ebx,ebx
xor ecx,ecx
mov eax,13
mov edx,[Color]
and edx,0xffffff
mov bx,[Scroller.x]
mov cx,[Scroller.y]
add cx,[Scroller.length]
sub cx,16
shl ebx,16
shl ecx,16
add ebx,16
add ecx,16
mcall
 
mov eax,[colors_table1+15*3]
and eax,0xffffff
mov [Line.color],eax
 
;draw horizontal up light line
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add bx,[Scroller.length]
sub ebx,16
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x2],15
call DrawLine
 
;draw vertical up light line
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add bx,[Scroller.length]
sub ebx,16
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y2],15
call DrawLine
 
mov eax,[colors_table2+8*3];[pointer]
and eax,0xffffff
mov [Line.color],eax
 
;draw vertical up dark line
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add bx,[Scroller.length]
sub ebx,16
add eax,15
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y2],15
call DrawLine
 
;draw horizontal up dark line
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add bx,[Scroller.length]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x2],15
call DrawLine
 
xor eax,eax
mov ax,[Scroller.length]
sub eax,16
mov [length],eax
 
and [Line.color],0
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add ebx,[length]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],4
add [Line.x2],8
add [Line.y1],7
add [Line.y2],11
call DrawLine
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add ebx,[length]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],4
add [Line.x2],8
add [Line.y1],6
add [Line.y2],10
call DrawLine
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add ebx,[length]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],12
add [Line.x2],8
add [Line.y1],7
add [Line.y2],11
call DrawLine
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add ebx,[length]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],12
add [Line.x2],8
add [Line.y1],6
add [Line.y2],10
call DrawLine
 
ret
 
DrawButtonsOfHorizontal3DScroller:
 
;draw vertical up rectangle
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
mov [Rectangle.x],eax
mov [Rectangle.y],ebx
mov [Rectangle.width],16
mov [Rectangle.height],16
 
mov eax,[pointer]
and eax,0xffffff
mov [Rectangle.color],eax
call RectangleContour
 
;draw gradient right
mov eax,[Scroller.color1]
mov ebx,dword 0xffffff
and eax,0xffffff
xor ecx,ecx
xor edx,edx
xor esi,esi
xor edi,edi
mov cx,[Scroller.x]
mov dx,[Scroller.y]
mov si,(16-1)
mov di,(16-2)
add cx,1
add dx,1
call rectangle_gradient_up
 
mov eax,[pointer+10*3]
and eax,0xffffff
mov [Line.color],eax
 
;draw horizontal up light line
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,1
add ebx,1
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x2],14
call DrawLine
 
;draw vertical up light line
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,1
add ebx,1
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y2],14
call DrawLine
 
mov eax,[Color]
mov [Line.color],eax
 
;draw vertical up dark line
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,16
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y1],1
add [Line.y2],14
call DrawLine
 
;draw horizontal up dark line
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,1
add ebx,15
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x2],14
call DrawLine
 
xor eax,eax
mov eax,[AveregeColor]
mov [Pixel.color],eax
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
xor eax,eax
mov ax,[Scroller.x]
add eax,16
mov [Pixel.x],eax
call DrawPixel
 
xor eax,eax
mov ax,[Scroller.x]
mov [Pixel.x],eax
add [Pixel.y],16
call DrawPixel
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,16
add ebx,16
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
;----------------
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,1
add ebx,1
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,15
add ebx,1
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,1
add ebx,15
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,15
add ebx,15
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
mov [Line.color],0
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],5
add [Line.x2],9
add [Line.y1],8
add [Line.y2],4
call DrawLine
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],6
add [Line.x2],9
add [Line.y1],8
add [Line.y2],5
call DrawLine
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],5
add [Line.x2],9
add [Line.y1],8
add [Line.y2],12
call DrawLine
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],6
add [Line.x2],9
add [Line.y1],8
add [Line.y2],11
call DrawLine
 
;draw vertical down rectangle
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add ax,[Scroller.length]
sub ax,16
mov [Rectangle.x],eax
mov [Rectangle.y],ebx
mov [Rectangle.width],16
mov [Rectangle.height],16
 
mov eax,[pointer]
and eax,0xffffff
mov [Rectangle.color],eax
call RectangleContour
 
;draw gradient right
mov eax,[Scroller.color1]
mov ebx,dword 0xffffff
and eax,0xffffff
xor ecx,ecx
xor edx,edx
xor esi,esi
xor edi,edi
mov cx,[Scroller.x]
mov dx,[Scroller.y]
add cx,[Scroller.length]
sub cx,16
mov si,(16-1)
mov di,(16-2)
add cx,1
add dx,1
call rectangle_gradient_up
 
mov eax,[pointer+10*3]
and eax,0xffffff
mov [Line.color],eax
 
;draw horizontal up light line
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add ax,[Scroller.length]
sub eax,15
add ebx,1
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x2],15
call DrawLine
 
;draw vertical up light line
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add ebx,1
add ax,[Scroller.length]
sub eax,15
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y2],14
call DrawLine
 
mov eax,[Color];[pointer]
mov [Line.color],eax
 
;draw vertical up dark line
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add ax,[Scroller.length]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y2],15
call DrawLine
 
;draw horizontal up dark line
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add ax,[Scroller.length]
sub eax,15
add ebx,15
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x2],14
call DrawLine
 
xor eax,eax
mov ax,[Scroller.length]
sub eax,16
mov [length],eax
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,[length]
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
add [Pixel.x],16
call DrawPixel
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add ebx,16
add eax,[length]
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,16
add ebx,16
add eax,[length]
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
;----------------
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,1
add ebx,1
add eax,[length]
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,15
add ebx,1
add eax,[length]
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,1
add ebx,15
add eax,[length]
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,15
add ebx,15
add eax,[length]
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
xor eax,eax
mov ax,[Scroller.length]
sub eax,16
mov [length],eax
 
and [Line.color],0
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,[length]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],12
add [Line.x2],8
add [Line.y1],8
add [Line.y2],4
call DrawLine
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,[length]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],11
add [Line.x2],8
add [Line.y1],8
add [Line.y2],5
call DrawLine
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,[length]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],12
add [Line.x2],8
add [Line.y1],8
add [Line.y2],12
call DrawLine
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,[length]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],11
add [Line.x2],8
add [Line.y1],8
add [Line.y2],11
call DrawLine
 
ret
 
DrawButtonsOfVertical3DScroller:
 
;draw vertical up rectangle
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
mov [Rectangle.x],eax
mov [Rectangle.y],ebx
mov [Rectangle.width],16
mov [Rectangle.height],16
 
mov eax,[pointer]
and eax,0xffffff
mov [Rectangle.color],eax
call RectangleContour
 
;draw gradient right
mov eax,[Scroller.color1]
mov ebx,dword 0xffffff
and eax,0xffffff
xor ecx,ecx
xor edx,edx
xor esi,esi
xor edi,edi
mov cx,[Scroller.x]
mov dx,[Scroller.y]
mov si,(16-1)
mov di,(16-2)
add cx,1
add dx,1
call rectangle_gradient_right
 
mov eax,[pointer+10*3]
and eax,0xffffff
mov [Line.color],eax
 
;draw horizontal up light line
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,1
add ebx,1
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x2],14
call DrawLine
 
;draw vertical up light line
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,1
add ebx,1
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y2],14
call DrawLine
 
mov eax,[Color]
mov [Line.color],eax
 
;draw vertical up dark line
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,15
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y1],1
add [Line.y2],14
call DrawLine
 
;draw horizontal up dark line
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,1
add ebx,15
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x2],14
call DrawLine
 
xor eax,eax
mov eax,[AveregeColor]
mov [Pixel.color],eax
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
xor eax,eax
mov ax,[Scroller.x]
add eax,16
mov [Pixel.x],eax
call DrawPixel
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add ebx,16
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,16
add ebx,16
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
;----------------
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,1
add ebx,1
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,15
add ebx,1
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,1
add ebx,15
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,15
add ebx,15
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
and [Line.color],0
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],4
add [Line.x2],8
add [Line.y1],9
add [Line.y2],5
call DrawLine
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],4
add [Line.x2],8
add [Line.y1],10
add [Line.y2],6
call DrawLine
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],8
add [Line.x2],12
add [Line.y1],5
add [Line.y2],9
call DrawLine
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],8
add [Line.x2],12
add [Line.y1],6
add [Line.y2],10
call DrawLine
 
;draw vertical down rectangle
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add bx,[Scroller.length]
sub bx,16
mov [Rectangle.x],eax
mov [Rectangle.y],ebx
mov [Rectangle.width],16
mov [Rectangle.height],16
 
mov eax,[pointer]
and eax,0xffffff
mov [Rectangle.color],eax
call RectangleContour
 
;draw gradient right
mov eax,[Scroller.color1]
mov ebx,dword 0xffffff
and eax,0xffffff
xor ecx,ecx
xor edx,edx
xor esi,esi
xor edi,edi
mov cx,[Scroller.x]
mov dx,[Scroller.y]
add dx,[Scroller.length]
sub dx,(16-1)
mov si,(16-1)
mov di,(16-2)
add cx,1
call rectangle_gradient_right
 
mov eax,[pointer+10*3]
and eax,0xffffff
mov [Line.color],eax
 
;draw horizontal up light line
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add bx,[Scroller.length]
sub ebx,15
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],1
add [Line.x2],15
call DrawLine
 
;draw vertical up light line
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,1
add bx,[Scroller.length]
sub ebx,15
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y2],14
call DrawLine
 
mov eax,[Color];[pointer]
mov [Line.color],eax
 
;draw vertical up dark line
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add bx,[Scroller.length]
sub ebx,15
add eax,15
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y2],14
call DrawLine
 
;draw horizontal up dark line
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add bx,[Scroller.length]
add eax,1
sub ebx,1
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x2],14
call DrawLine
 
xor eax,eax
mov ax,[Scroller.length]
sub eax,16
mov [length],eax
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add ebx,[length]
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
xor eax,eax
mov ax,[Scroller.x]
add eax,16
mov [Pixel.x],eax
call DrawPixel
 
xor eax,eax
mov ax,[Scroller.x]
mov [Pixel.x],eax
add [Pixel.y],16
call DrawPixel
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,16
add ebx,16
add ebx,[length]
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
;----------------
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,1
add ebx,1
add ebx,[length]
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,15
add ebx,1
add ebx,[length]
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,1
add ebx,15
add ebx,[length]
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add eax,15
add ebx,15
add ebx,[length]
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
xor eax,eax
mov ax,[Scroller.length]
sub eax,16
mov [length],eax
 
and [Line.color],0
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add ebx,[length]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],4
add [Line.x2],8
add [Line.y1],7
add [Line.y2],11
call DrawLine
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add ebx,[length]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],4
add [Line.x2],8
add [Line.y1],6
add [Line.y2],10
call DrawLine
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add ebx,[length]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],12
add [Line.x2],8
add [Line.y1],7
add [Line.y2],11
call DrawLine
 
xor eax,eax
xor ebx,ebx
mov ax,[Scroller.x]
mov bx,[Scroller.y]
add ebx,[length]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x1],12
add [Line.x2],8
add [Line.y1],6
add [Line.y2],10
call DrawLine
 
ret
 
;eax - x
;ebx - y
;ecx - size y in pixels
DrawVertical3DScrollBar:
 
mov [x],eax
mov [y],ebx
mov [length2],ecx
 
mov eax,[x]
mov ebx,[y]
mov ecx,[length2]
mov edx,[pointer]
and edx,0xffffff
mov [Rectangle.x],eax
mov [Rectangle.y],ebx
mov [Rectangle.width],16
mov [Rectangle.height],ecx
mov [Rectangle.color],edx
call RectangleContour
 
;draw gradient right
mov eax,[Scroller.color1]
mov ebx,dword 0xffffff
and eax,0xffffff
xor esi,esi
xor edi,edi
mov ecx,[x]
mov edx,[y]
add edx,1
mov si,(16-1)
mov edi,[length2]
sub edi,2
call rectangle_gradient_right
 
;------------------
xor eax,eax
mov eax,[AveregeColor]
mov [Pixel.color],eax
 
mov eax,[x]
mov ebx,[y]
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
mov eax,[x]
add eax,16
mov [Pixel.x],eax
call DrawPixel
 
mov eax,[x]
mov ebx,[y]
add ebx,[length2]
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
mov eax,[x]
mov ebx,[y]
add eax,16
add ebx,[length2]
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
mov eax,[x]
mov ebx,[y]
add eax,1
add ebx,1
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
mov eax,[x]
mov ebx,[y]
add eax,15
add ebx,1
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
mov eax,[x]
mov ebx,[y]
add eax,1
add ebx,[length2]
sub ebx,1
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
mov eax,[x]
mov ebx,[y]
add eax,16
add ebx,[length2]
sub eax,1
sub ebx,1
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
cmp [length2],12
jl no_draw_reliev_vertical_3D
 
mov ebx,[x]
mov eax,[length2]
shr eax,1
add eax,[y]
add ebx,5
sub eax,3
 
mov [Line.x1],ebx
mov [Line.x2],ebx
mov [Line.y1],eax
mov [Line.y2],eax
mov [Line.color],0xffffff
add [Line.x2],6
 
mov esi,4
next_light_line_draw_r_vertical_3D:
 
call DrawLine
add [Line.y1],2
add [Line.y2],2
 
dec esi
jnz next_light_line_draw_r_vertical_3D
 
mov ebx,[x]
mov eax,[length2]
shr eax,1
add eax,[y]
add ebx,6
sub eax,2
 
mov ecx,[Scroller.color1]
mov [Line.x1],ebx
mov [Line.x2],ebx
mov [Line.y1],eax
mov [Line.y2],eax
mov [Line.color],ecx
add [Line.x2],6
 
mov esi,4
next_dark_line_draw_r_vertical_3D:
 
call DrawLine
add [Line.y1],2
add [Line.y2],2
 
dec esi
jnz next_dark_line_draw_r_vertical_3D
 
no_draw_reliev_vertical_3D:
 
 
xor eax,eax
mov ax,[Scroller.y]
mov ebx,[y]
add eax,17
 
sub ebx,eax
jz no_draw_up_rectangle_vertical_3D
js no_draw_up_rectangle_vertical_3D
 
sub ebx,1
 
mov edi,ebx
 
mov eax,0xe4e4e4
mov ebx,0xffffff
xor edx,edx
mov ecx,[x]
mov dx,[Scroller.y]
add edx,17
sub ecx,1
mov esi,17
call rectangle_gradient_right
no_draw_up_rectangle_vertical_3D:
 
xor eax,eax
mov ax,[Scroller.y]
add ax,[Scroller.length]
mov ebx,[y]
add ebx,[length2]
sub eax,17
 
sub eax,ebx
jz no_draw_down_rectangle_vertical_3D
js no_draw_down_rectangle_vertical_3D
 
sub eax,1
mov edi,eax
 
mov eax,0xe4e4e4
mov ebx,0xffffff
mov ecx,[x]
xor edx,edx
mov edx,[y]
add edx,[length2]
add edx,1
sub ecx,1
mov esi,17
call rectangle_gradient_right
 
no_draw_down_rectangle_vertical_3D:
 
ret
 
;eax - x
;ebx - y
;ecx - size y in pixels
DrawHorizontal3DScrollBar:
 
mov [x],eax
mov [y],ebx
mov [length2],ecx
 
mov eax,[x]
mov ebx,[y]
mov ecx,[length2]
mov edx,[pointer]
and edx,0xffffff
mov [Rectangle.x],eax
mov [Rectangle.y],ebx
mov [Rectangle.width],ecx
mov [Rectangle.height],16
mov [Rectangle.color],edx
call RectangleContour
 
;draw gradient right
mov eax,[Scroller.color1]
mov ebx,dword 0xffffff
and eax,0xffffff
xor esi,esi
xor edi,edi
mov ecx,[x]
mov edx,[y]
add ecx,1
mov edi,(16-1)
mov esi,[length2]
sub esi,2
call rectangle_gradient_up
 
;------------------
xor eax,eax
mov eax,[AveregeColor]
mov [Pixel.color],eax
 
mov eax,[x]
mov ebx,[y]
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
mov ebx,[y]
add ebx,16
mov [Pixel.y],ebx
call DrawPixel
 
mov eax,[x]
mov ebx,[y]
add eax,[length2]
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
mov eax,[x]
mov ebx,[y]
add ebx,16
add eax,[length2]
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
mov eax,[x]
mov ebx,[y]
add eax,1
add ebx,1
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
mov eax,[x]
mov ebx,[y]
add ebx,15
add eax,1
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
mov eax,[x]
mov ebx,[y]
add ebx,1
add eax,[length2]
sub eax,1
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
mov eax,[x]
mov ebx,[y]
add ebx,15
add eax,[length2]
sub eax,1
mov [Pixel.x],eax
mov [Pixel.y],ebx
call DrawPixel
 
cmp [length2],12
jl no_draw_reliev_horizontal_3D
 
mov ebx,[y]
mov eax,[length2]
shr eax,1
add eax,[x]
add ebx,5
sub eax,3
 
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
mov [Line.color],0xffffff
add [Line.y2],6
 
mov esi,4
next_light_line_draw_r_horizontal_3D:
 
call DrawLine
add [Line.x1],2
add [Line.x2],2
 
dec esi
jnz next_light_line_draw_r_horizontal_3D
 
mov ebx,[y]
mov eax,[length2]
shr eax,1
add eax,[x]
add ebx,6
sub eax,2
 
mov ecx,[Scroller.color1]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
mov [Line.color],ecx
add [Line.y2],6
 
mov esi,4
next_dark_line_draw_r_horizontal_3D:
 
call DrawLine
add [Line.x1],2
add [Line.x2],2
 
dec esi
jnz next_dark_line_draw_r_horizontal_3D
 
no_draw_reliev_horizontal_3D:
 
 
xor eax,eax
mov ax,[Scroller.x]
mov ebx,[x]
add eax,17
 
sub ebx,eax
jz no_draw_up_rectangle_horizontal_3D
js no_draw_up_rectangle_horizontal_3D
 
sub ebx,1
 
mov esi,ebx
 
mov eax,0xe4e4e4
mov ebx,0xffffff
xor ecx,ecx
mov edx,[y]
mov cx,[Scroller.x]
add ecx,17
sub edx,1
mov edi,17
call rectangle_gradient_up
no_draw_up_rectangle_horizontal_3D:
 
xor eax,eax
mov ax,[Scroller.x]
add ax,[Scroller.length]
mov ebx,[x]
add ebx,[length2]
sub eax,17
 
sub eax,ebx
jz no_draw_down_rectangle_horizontal_3D
js no_draw_down_rectangle_horizontal_3D
 
sub eax,1
mov esi,eax
 
mov eax,0xe4e4e4
mov ebx,0xffffff
mov edx,[y]
xor ecx,ecx
mov ecx,[x]
add ecx,[length2]
add ecx,1
sub edx,1
mov edi,17
call rectangle_gradient_up
 
no_draw_down_rectangle_horizontal_3D:
 
ret
 
;eax - x
;ebx - y
;ecx - size y in pixels
DrawVertical2DScrollBar:
 
mov [x],eax
mov [y],ebx
mov [length2],ecx
 
mov eax,13
mov edx,[Color]
mov ebx,[x]
mov ecx,[y]
shl ebx,16
shl ecx,16
add ebx,16
add ecx,[length2]
and edx,0xffffff
mcall
 
;draw horizontal up light line
mov eax,[x]
mov ebx,[y]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x2],15
mov ecx,[colors_table1+15*3]
and ecx,0xffffff
mov [Line.color],ecx
call DrawLine
 
;draw vertical up light line
mov eax,[x]
mov ebx,[y]
mov ecx,[length2]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
add [Line.y2],ecx
call DrawLine
 
;draw vertical up dark line
mov eax,[x]
mov ebx,[y]
add eax,15
mov ecx,[length2]
sub ecx,1
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y2],ecx
mov ecx,[colors_table2+8*3];[pointer]
and ecx,0xffffff
mov [Line.color],ecx
call DrawLine
 
;draw horizontal up dark line
mov eax,[x]
mov ebx,[y]
mov ecx,[length2]
add ebx,ecx
sub ebx,1
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x2],15
call DrawLine
 
 
xor eax,eax
mov ax,[Scroller.y]
mov ebx,[y]
add eax,16
 
sub ebx,eax
jz no_draw_up_rectangle_vertical_2D
js no_draw_up_rectangle_vertical_2D
 
mov edi,ebx
 
xor ecx,ecx
mov eax,13
mov edx,0xe4e4e4
mov ebx,[x]
mov cx,[Scroller.y]
add ecx,16
shl ebx,16
shl ecx,16
add ebx,16
add ecx,edi
mcall
 
no_draw_up_rectangle_vertical_2D:
 
xor eax,eax
mov ax,[Scroller.y]
add ax,[Scroller.length]
mov ebx,[y]
add ebx,[length2]
sub eax,16
 
sub eax,ebx
jz no_draw_down_rectangle_vertical_2D
js no_draw_down_rectangle_vertical_2D
 
;sub eax,1
mov edi,eax
 
xor ecx,ecx
mov eax,13
mov edx,0xe4e4e4
mov ebx,[x]
mov ecx,[y]
add ecx,[length2]
shl ebx,16
shl ecx,16
add ebx,16
add ecx,edi
mcall
 
no_draw_down_rectangle_vertical_2D:
 
ret
 
;eax - x
;ebx - y
;ecx - size x in pixels
DrawHorizontal2DScrollBar:
 
mov [x],eax
mov [y],ebx
mov [length2],ecx
 
mov eax,13
mov edx,[Color]
mov ebx,[x]
mov ecx,[y]
shl ebx,16
shl ecx,16
add ebx,[length2]
add ecx,16
and edx,0xffffff
mcall
 
;draw horizontal up light line
mov eax,[x]
mov ebx,[y]
mov ecx,[length2]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
sub ecx,1
add [Line.x2],ecx
mov ecx,[colors_table1+15*3]
and ecx,0xffffff
mov [Line.color],ecx
call DrawLine
 
;draw vertical up light line
mov eax,[x]
mov ebx,[y]
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y2],15
call DrawLine
 
;draw vertical up dark line
mov eax,[x]
mov ebx,[y]
mov ecx,[length2]
sub ecx,1
add eax,ecx
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.y2],15
mov ecx,[colors_table2+8*3];[pointer]
and ecx,0xffffff
mov [Line.color],ecx
call DrawLine
 
;draw horizontal up dark line
mov eax,[x]
mov ebx,[y]
mov ecx,[length2]
sub ecx,1
add ebx,15
mov [Line.x1],eax
mov [Line.x2],eax
mov [Line.y1],ebx
mov [Line.y2],ebx
add [Line.x2],ecx
call DrawLine
 
 
xor eax,eax
mov ax,[Scroller.x]
mov ebx,[x]
add eax,16
 
sub ebx,eax
jz no_draw_up_rectangle_horizontal_2D
js no_draw_up_rectangle_horizontal_2D
 
mov edi,ebx
 
xor ecx,ecx
xor ebx,ebx
mov eax,13
mov edx,0xe4e4e4
mov bx,[Scroller.x]
mov cx,[Scroller.y]
add ebx,16
shl ebx,16
shl ecx,16
add ecx,16
add ebx,edi
mcall
 
no_draw_up_rectangle_horizontal_2D:
 
xor eax,eax
mov ax,[Scroller.x]
add ax,[Scroller.length]
mov ebx,[x]
add ebx,[length2]
sub eax,16
 
sub eax,ebx
jz no_draw_down_rectangle_horizontal_2D
js no_draw_down_rectangle_horizontal_2D
 
;sub eax,1
mov edi,eax
 
xor ecx,ecx
mov eax,13
mov edx,0xe4e4e4
mov ebx,[x]
mov ecx,[y]
add ebx,[length2]
shl ebx,16
shl ecx,16
add ebx,edi
add ecx,16
mcall
 
no_draw_down_rectangle_horizontal_2D:
 
ret
/programs/develop/libGUI/src/string.inc
0,0 → 1,19
;ebx - pointer to string
GetLengthString:
 
xor ecx,ecx
 
next_simvol:
inc ecx
xor eax,eax
mov al,[ebx]
test al,al
jz null
inc ebx
jmp next_simvol
 
null:
mov eax,ecx
dec eax
 
ret
/programs/develop/libGUI/src/struct.inc
0,0 → 1,180
 
; Macroinstructions for defining data structures
 
macro struct name
{ fields@struct equ name
match child parent, name \{ fields@struct equ child,fields@\#parent \}
sub@struct equ
struc db [val] \{ \common fields@struct equ fields@struct,.,db,<val> \}
struc dw [val] \{ \common fields@struct equ fields@struct,.,dw,<val> \}
struc du [val] \{ \common fields@struct equ fields@struct,.,du,<val> \}
struc dd [val] \{ \common fields@struct equ fields@struct,.,dd,<val> \}
struc dp [val] \{ \common fields@struct equ fields@struct,.,dp,<val> \}
struc dq [val] \{ \common fields@struct equ fields@struct,.,dq,<val> \}
struc dt [val] \{ \common fields@struct equ fields@struct,.,dt,<val> \}
struc rb count \{ fields@struct equ fields@struct,.,db,count dup (?) \}
struc rw count \{ fields@struct equ fields@struct,.,dw,count dup (?) \}
struc rd count \{ fields@struct equ fields@struct,.,dd,count dup (?) \}
struc rp count \{ fields@struct equ fields@struct,.,dp,count dup (?) \}
struc rq count \{ fields@struct equ fields@struct,.,dq,count dup (?) \}
struc rt count \{ fields@struct equ fields@struct,.,dt,count dup (?) \}
macro db [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,db,<val> \}
macro dw [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,dw,<val> \}
macro du [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,du,<val> \}
macro dd [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,dd,<val> \}
macro dp [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,dp,<val> \}
macro dq [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,dq,<val> \}
macro dt [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,dt,<val> \}
macro rb count \{ \local anonymous
fields@struct equ fields@struct,anonymous,db,count dup (?) \}
macro rw count \{ \local anonymous
fields@struct equ fields@struct,anonymous,dw,count dup (?) \}
macro rd count \{ \local anonymous
fields@struct equ fields@struct,anonymous,dd,count dup (?) \}
macro rp count \{ \local anonymous
fields@struct equ fields@struct,anonymous,dp,count dup (?) \}
macro rq count \{ \local anonymous
fields@struct equ fields@struct,anonymous,dq,count dup (?) \}
macro rt count \{ \local anonymous
fields@struct equ fields@struct,anonymous,dt,count dup (?) \}
macro union \{ fields@struct equ fields@struct,,union,<
sub@struct equ union \}
macro struct \{ fields@struct equ fields@struct,,substruct,<
sub@struct equ substruct \}
virtual at 0 }
 
macro ends
{ match , sub@struct \{ restruc db,dw,du,dd,dp,dq,dt
restruc rb,rw,rd,rp,rq,rt
purge db,dw,du,dd,dp,dq,dt
purge rb,rw,rd,rp,rq,rt
purge union,struct
match name=,fields,fields@struct \\{ fields@struct equ
make@struct name,fields
fields@\\#name equ fields \\}
end virtual \}
match any, sub@struct \{ fields@struct equ fields@struct> \}
restore sub@struct }
 
macro make@struct name,[field,type,def]
{ common
if $
display 'Error: definition of ',`name,' contains illegal instructions.',0Dh,0Ah
err
end if
local define
define equ name
forward
local sub
match , field \{ make@substruct type,name,sub def
define equ define,.,sub, \}
match any, field \{ define equ define,.#field,type,<def> \}
common
match fields, define \{ define@struct fields \} }
 
macro define@struct name,[field,type,def]
{ common
local list
list equ
forward
if ~ field eq .
name#field type def
sizeof.#name#field = $ - name#field
else
rb sizeof.#type
end if
local value
match any, list \{ list equ list, \}
list equ list <value>
common
sizeof.#name = $
restruc name
match values, list \{
struc name value \\{
match any, fields@struct \\\{ fields@struct equ fields@struct,.,name,<values> \\\}
match , fields@struct \\\{ label .
forward
match , value \\\\{ field type def \\\\}
match any, value \\\\{ field type value
if ~ field eq .
rb sizeof.#name#field - ($-field)
end if \\\\}
common \\\} \\} \} }
 
macro enable@substruct
{ macro make@substruct substruct,parent,name,[field,type,def]
\{ \common
\local define
define equ parent,name
\forward
\local sub
match , field \\{ match any, type \\\{ enable@substruct
make@substruct type,name,sub def
purge make@substruct
define equ define,.,sub, \\\} \\}
match any, field \\{ define equ define,.\#field,type,<def> \\}
\common
match fields, define \\{ define@\#substruct fields \\} \} }
 
enable@substruct
 
macro define@union parent,name,[field,type,def]
{ common
virtual at 0
forward
if ~ field eq .
virtual at 0
parent#field type def
sizeof.#parent#field = $ - parent#field
end virtual
if sizeof.#parent#field > $
rb sizeof.#parent#field - $
end if
else if sizeof.#type > $
rb sizeof.#type - $
end if
common
sizeof.#name = $
end virtual
struc name [value] \{ \common
label .\#name
last@union equ
forward
match any, last@union \\{ virtual at .\#name
field type def
end virtual \\}
match , last@union \\{ match , value \\\{ field type def \\\}
match any, value \\\{ field type value \\\} \\}
last@union equ field
common rb sizeof.#name - ($ - .\#name) \} }
 
macro define@substruct parent,name,[field,type,def]
{ common
virtual at 0
forward
if ~ field eq .
parent#field type def
sizeof.#parent#field = $ - parent#field
else
rb sizeof.#type
end if
local value
common
sizeof.#name = $
end virtual
struc name value \{
label .\#name
forward
match , value \\{ field type def \\}
match any, value \\{ field type value
if ~ field eq .
rb sizeof.#parent#field - ($-field)
end if \\}
common \} }
/programs/develop/libGUI/src/text.inc
0,0 → 1,150
 
tx_control_data_size = 22
tx_no_show_text = 1b
tx_redraw_all = 10000000b
tx_redraw_all_off = 01111111b
tx_special_redraw_on = 100b
tx_special_redraw_off = 11111011b
 
;****************************************************
;********************craete Text**********************
;****************************************************
;IN
;pointer to parend
;pointer to Text's structure
;OUT
;pointer to initialized Texr's structure
align 4
 
craete_text:
 
mov ebx,[esp+4]
mov eax,[esp+8]
 
mov [PointerToStructureForText],eax
 
mov eax,control_header_size+tx_control_data_size
call craete_control
 
;set all image's parameters in control
mov [eax],dword text
 
mov ecx,tx_control_data_size
mov esi,[PointerToStructureForText]
mov edi,eax
add edi,control_header_size
rep movsb
 
call get_skin_height
 
mov ebx,[PointerToStructureForText]
mov ecx,[ebx+6] ;x
mov edx,[ebx+10] ;y
mov esi,[ebx+14] ;length x
imul esi,6
add ecx,border_width
add edx,[skin_height]
;copy information to control
mov [eax+24],ecx
mov [eax+28],edx
mov [eax+32],esi
mov [eax+36],dword 9
 
ret 8
 
;****************************************************
;********************Draw Text**********************
;****************************************************
;IN
;pointer to control of text
;message
;OUT
;not returned value
align 4
 
text:
 
;get message
mov eax,[esp+8]
 
;get pointer to control of image
mov esi,[esp+4]
mov [PointerForText],esi
;copy control to local control
add esi,control_header_size
mov edi,dword Text
mov ecx,tx_control_data_size
rep movsb
 
 
cmp [eax],dword 1
jne no_redraw_all_text
 
xor ebx,ebx
mov bl,[Text.type]
and bl,tx_no_show_text
test bl,bl
jnz no_redraw_all_text
 
or [Text.type],tx_redraw_all
 
no_redraw_all_text:
 
cmp [eax],dword 3
jne no_special_message_for_text
 
xor ebx,ebx
mov bl,[Text.type]
and bl,tx_special_redraw_on
test bl,bl
jz no_special_message_for_text
 
or [Text.type],tx_redraw_all
and [Text.type],tx_special_redraw_off
 
no_special_message_for_text:
 
;load coordinats and size from control
mov eax,[PointerForText]
mov ebx,[eax+24] ;x
mov ecx,[eax+28] ;y
;set current coordinats and sizes in zakladka
mov [Text.x],ebx
mov [Text.y],ecx
 
;get standart colors table
mov eax,48
mov ebx,3
mov ecx,dword pointer2
mov edx,40
mcall
 
xor eax,eax
mov al,[Text.type]
and al,tx_redraw_all
test al,al
jz no_redraw_text_
 
and [Text.type],tx_redraw_all_off
 
mov esi,dword Text
mov edi,[PointerForText]
add edi,control_header_size
mov ecx,2
rep movsb
 
mov eax,4
mov ebx,[Text.x]
shl ebx,16
add ebx,[Text.y]
mov ecx,[Text.color]
mov edx,[Text.pointer]
mov esi,[Text.length]
mov edi,[pointer2+8]
mcall
 
no_redraw_text_:
 
exit_text:
 
ret 8