Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5673 → Rev 5674

/programs/cmm/lib/gui.h
77,21 → 77,20
:void MoreLessBox(dword x,y,s, bt_id_more, bt_id_less, colors_pointer, value, text)
{
#define VALUE_FIELD_W 26;
system_colors colors;
ESI = colors_pointer;
colors.work_graph = ESI.system_colors.work_graph;
colors.work_text = ESI.system_colors.work_text;
colors.work_button = ESI.system_colors.work_button;
colors.work_button_text = ESI.system_colors.work_button_text;
system.color.work_graph = ESI.COLORS.work_graph;
system.color.work_text = ESI.COLORS.work_text;
system.color.work_button = ESI.COLORS.work_button;
system.color.work_button_text = ESI.COLORS.work_button_text;
 
DrawRectangle(x, y, VALUE_FIELD_W, s, colors.work_graph);
DrawRectangle(x, y, VALUE_FIELD_W, s, system.color.work_graph);
DrawRectangle3D(x+1, y+1, VALUE_FIELD_W-2, s-2, 0xDDDddd, 0xffffff);
DrawBar(x+2, y+2, VALUE_FIELD_W-3, s-3, 0xffffff);
WriteText(x+6, s / 2 + y -3, 0x80, 0x000000, itoa(value));
 
DrawCaptButton(VALUE_FIELD_W + x + 1, y, s, s, bt_id_more, colors.work_button, colors.work_button_text, "+");
DrawCaptButton(VALUE_FIELD_W + x + s + 2, y, s, s, bt_id_less, colors.work_button, colors.work_button_text, "-");
WriteText(x+VALUE_FIELD_W+s+s+10, s / 2 + y -3, 0x80, colors.work_text, text);
DrawCaptButton(VALUE_FIELD_W + x + 1, y, s, s, bt_id_more, system.color.work_button, system.color.work_button_text, "+");
DrawCaptButton(VALUE_FIELD_W + x + s + 2, y, s, s, bt_id_less, system.color.work_button, system.color.work_button_text, "-");
WriteText(x+VALUE_FIELD_W+s+s+10, s / 2 + y -3, 0x80, system.color.work_text, text);
}
 
:void DrawProgressBar(dword st_x, st_y, st_w, st_h, col_fon, col_border, col_fill, col_text, progress_percent)
/programs/cmm/lib/kolibri.h
37,12 → 37,6
#define BT_HIDE 0x40000000
#define BT_NOFRAME 0x20000000
 
//Button MOUSE
#define MOUSE_LEFT 001b
#define MOUSE_RIGHT 010b
#define MOUSE_LR 011b
#define MOUSE_CENTER 100b
 
//ASCII KEYS
#define ASCII_KEY_BS 008
#define ASCII_KEY_TAB 009
75,242 → 69,20
#define END_ARGS 0xFF00FF
//-------------------------------------------------------------------------
 
#ifndef INCLUDE_SYSTEM_H
#include "../lib/system.h"
#endif
 
#ifndef INCLUDE_MOUSE_H
#include "../lib/mouse.h"
#endif
 
:struct raw_image {
dword w, h, data;
};
 
/**
* The structure of the MOUSE
* x - coordinate X
* y - coordinate Y
* xx and yy - time coordinates
* lkm - left MOUSE button
* pkm - right MOUSE button
* mkm - MOUSE wheel
* key - keycode button
* tmp - time keycode
* down - key event press
* up - key release events
* move - event MOUSE movements
* click - when clicked
* dblclick - double-click the default 50 (500 ms)
* drag - drag the element event
*/
 
:dword __TMP_TIME,MOUSE_TIME;
:struct MOUSE
{
signed x,y,xx,yy,lkm,mkm,pkm,key,tmp,tmp_time,hor,vert,down,up,move,click,dblclick,drag,left,top;
dword handle,_;
byte cmd;
void clearTime();
void get();
void set();
void center();
dword hide();
void slider();
void show();
} mouse;
:void MOUSE::clearTime()
{
tmp_time = GetStartTime()+MOUSE_TIME;
}
:void MOUSE::show()
{
if(!handle)return;
ECX = handle;
EAX = 37;
EBX = 5;
$int 0x40;
}
:dword MOUSE::hide()
{
if(!_)
{
EAX = 68;
EBX = 12;
ECX = 32*32*4;
$int 0x40
ECX = EAX;
_ = EAX;
} else ECX = _;
EAX = 37;
EBX = 4;
DX = 2;
$int 0x40;
handle = EAX;
ECX = EAX;
EAX = 37;
EBX = 5;
$int 0x40;
handle = EAX;
}
 
//set new attributes MOUSE
:void MOUSE::set()
{
if((xx!=x)||(yy!=y))
{
EAX = 18;
EBX = 19;
ECX = 4;
EDX = (x<<16)+y;
$int 0x40
//move = true;
}
if((key)||(lkm|mkm|pkm))&&(down|up|click|dblclick|move)
{
if(lkm|mkm|pkm)key=(lkm)|(pkm<<1)|(2<<mkm);
EAX = 18;
EBX = 19;
ECX = key;
EDX = (x<<16)+y;
$int 0x40
}
}
 
:void MOUSE::center()
{
EAX = 18;
EBX = 15;
$int 0x40
}
 
//get new attributes MOUSE
:void MOUSE::get()
{
EAX = 37;
EBX = 1;
$int 0x40
$mov ebx, eax
$shr eax, 16
$and ebx,0x0000FFFF
x = EAX;
y = EBX;
if (x>6000) x-=65535;
if (y>6000) y-=65535;
EAX = 37;
EBX = 2;
$int 0x40
$mov ebx, eax
$mov ecx, eax
key = EAX;
$and eax, 0x00000001
$shr ebx, 1
$and ebx, 0x00000001
$shr ecx, 2
$and ecx, 0x00000001
lkm = EAX;
pkm = EBX;
mkm = ECX;
//when you release the MOUSE button
// Mouse Move Event
if(xx!=x)||(yy!=y)
{
move = true;
xx = x;
yy = y;
}
else move = false;
// Mouse Up Event
if(cmd)&&(!key){
up = true;
down = false;
drag = false;
if(!move) click = true;
__TMP_TIME = GetStartTime();
if(__TMP_TIME-tmp_time<=MOUSE_TIME)
{
dblclick = true;
click = false;
}
tmp_time = __TMP_TIME;
//returns the key code
key = tmp;
lkm = 1&tmp;
pkm = 2&tmp;
pkm >>= 1;
mkm = 4&tmp;
mkm >>= 2;
cmd = false;
}
//when you press the MOUSE button
// Mouse Down Event/Move Event
else
{
up = false;
click = false;
dblclick = false;
down = false;
// Mouse Move Event
if(key)if(!cmd)
{
down = true;
if(move)drag = true;
cmd = true;
tmp=key;
}
}
//scroll
EAX = 37;
EBX = 7;
$int 0x40
$mov ebx, eax
$shr eax, 16
$and ebx,0x0000FFFF
//hor = EAX;
vert = EBX;
}
 
 
 
:void MOUSE::slider()
{
signed _x,_y;
if(!handle)hide();
get();
_x = x;_y = y;
pause(5);
get();
left = _x - x;
top = _y - y;
center();
get();
_x = x;_y = y;
pause(5);
}
 
:struct keyboard
{
signed key;
byte down,up,press;
void get(void);
};
 
:void keyboard::get(void)
{
}
 
:struct system_colors
{
dword frame,grab,grab_button,grab_button_text,grab_text,
work,work_button,work_button_text,work_text,work_graph;
void get();
};
 
:void system_colors::get()
{
EAX = 48;
EBX = 3;
ECX = #frame;
EDX = 40;
$int 0x40
}
 
//------------------------------------------------------------------------------
:dword wait_event_code;
inline fastcall dword WaitEvent()
/programs/cmm/lib/mouse.h
0,0 → 1,214
#ifndef INCLUDE_MOUSE_H
#define INCLUDE_MOUSE_H
 
//Button MOUSE
#define MOUSE_LEFT 001b
#define MOUSE_RIGHT 010b
#define MOUSE_LR 011b
#define MOUSE_CENTER 100b
 
/**
* The structure of the MOUSE
* x - coordinate X
* y - coordinate Y
* xx and yy - time coordinates
* lkm - left MOUSE button
* pkm - right MOUSE button
* mkm - MOUSE wheel
* key - keycode button
* tmp - time keycode
* down - key event press
* up - key release events
* move - event MOUSE movements
* click - when clicked
* dblclick - double-click the default 50 (500 ms)
* drag - drag the element event
*/
 
:dword __TMP_TIME,MOUSE_TIME;
:struct MOUSE
{
signed x,y,xx,yy,lkm,mkm,pkm,key,tmp,tmp_time,hor,vert,down,up,move,click,dblclick,drag,left,top;
dword handle,_;
byte cmd;
void clearTime();
void get();
void set();
void center();
dword hide();
void slider();
void show();
} mouse;
:void MOUSE::clearTime()
{
tmp_time = GetStartTime()+MOUSE_TIME;
}
:void MOUSE::show()
{
if(!handle)return;
ECX = handle;
EAX = 37;
EBX = 5;
$int 0x40;
}
:dword MOUSE::hide()
{
if(!_)
{
EAX = 68;
EBX = 12;
ECX = 32*32*4;
$int 0x40
ECX = EAX;
_ = EAX;
} else ECX = _;
EAX = 37;
EBX = 4;
DX = 2;
$int 0x40;
handle = EAX;
ECX = EAX;
EAX = 37;
EBX = 5;
$int 0x40;
handle = EAX;
}
 
//set new attributes MOUSE
:void MOUSE::set()
{
if((xx!=x)||(yy!=y))
{
EAX = 18;
EBX = 19;
ECX = 4;
EDX = (x<<16)+y;
$int 0x40
//move = true;
}
if((key)||(lkm|mkm|pkm))&&(down|up|click|dblclick|move)
{
if(lkm|mkm|pkm)key=(lkm)|(pkm<<1)|(2<<mkm);
EAX = 18;
EBX = 19;
ECX = key;
EDX = (x<<16)+y;
$int 0x40
}
}
 
:void MOUSE::center()
{
EAX = 18;
EBX = 15;
$int 0x40
}
 
//get new attributes MOUSE
:void MOUSE::get()
{
EAX = 37;
EBX = 1;
$int 0x40
$mov ebx, eax
$shr eax, 16
$and ebx,0x0000FFFF
x = EAX;
y = EBX;
if (x>6000) x-=65535;
if (y>6000) y-=65535;
EAX = 37;
EBX = 2;
$int 0x40
$mov ebx, eax
$mov ecx, eax
key = EAX;
$and eax, 0x00000001
$shr ebx, 1
$and ebx, 0x00000001
$shr ecx, 2
$and ecx, 0x00000001
lkm = EAX;
pkm = EBX;
mkm = ECX;
//when you release the MOUSE button
// Mouse Move Event
if(xx!=x)||(yy!=y)
{
move = true;
xx = x;
yy = y;
}
else move = false;
// Mouse Up Event
if(cmd)&&(!key){
up = true;
down = false;
drag = false;
if(!move) click = true;
__TMP_TIME = GetStartTime();
if(__TMP_TIME-tmp_time<=MOUSE_TIME)
{
dblclick = true;
click = false;
}
tmp_time = __TMP_TIME;
//returns the key code
key = tmp;
lkm = 1&tmp;
pkm = 2&tmp;
pkm >>= 1;
mkm = 4&tmp;
mkm >>= 2;
cmd = false;
}
//when you press the MOUSE button
// Mouse Down Event/Move Event
else
{
up = false;
click = false;
dblclick = false;
down = false;
// Mouse Move Event
if(key)if(!cmd)
{
down = true;
if(move)drag = true;
cmd = true;
tmp=key;
}
}
//scroll
EAX = 37;
EBX = 7;
$int 0x40
$mov ebx, eax
$shr eax, 16
$and ebx,0x0000FFFF
//hor = EAX;
vert = EBX;
}
 
 
 
:void MOUSE::slider()
{
signed _x,_y;
if(!handle)hide();
get();
_x = x;_y = y;
pause(5);
get();
left = _x - x;
top = _y - y;
center();
get();
_x = x;_y = y;
pause(5);
}
 
#endif
/programs/cmm/lib/system.h
0,0 → 1,25
#ifndef INCLUDE_SYSTEM_H
#define INCLUDE_SYSTEM_H
 
:struct COLORS
{
dword frame,grab,grab_button,grab_button_text,grab_text,
work,work_button,work_button_text,work_text,work_graph;
void get();
};
 
:void COLORS::get()
{
EAX = 48;
EBX = 3;
ECX = #frame;
EDX = 40;
$int 0x40
}
 
:struct SYSTEM
{
COLORS color;
} system;
 
#endif