forked from KolibriOS/kolibrios
CMM: rework Tabs element
git-svn-id: svn://kolibrios.org@7225 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
e6c83f1f8d
commit
4238d0ea38
@ -33,7 +33,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PANEL_H 40
|
#define PANEL_H 40
|
||||||
#define LIST_PADDING 20
|
#define LP 10 //LIST_PADDING
|
||||||
#define SKINS_STANDART_PATH "/kolibrios/res/skins"
|
#define SKINS_STANDART_PATH "/kolibrios/res/skins"
|
||||||
#define WALP_STANDART_PATH "/kolibrios/res/wallpapers"
|
#define WALP_STANDART_PATH "/kolibrios/res/wallpapers"
|
||||||
|
|
||||||
@ -49,6 +49,8 @@ int cur;
|
|||||||
|
|
||||||
proc_info Form;
|
proc_info Form;
|
||||||
|
|
||||||
|
_tabs tabs = { LP, LP, NULL, NULL, SKINS };
|
||||||
|
|
||||||
//===================================================//
|
//===================================================//
|
||||||
// //
|
// //
|
||||||
// CODE //
|
// CODE //
|
||||||
@ -86,7 +88,9 @@ void main()
|
|||||||
GetKeys();
|
GetKeys();
|
||||||
if (select_list.ProcessKey(key_scancode)) EventApply();
|
if (select_list.ProcessKey(key_scancode)) EventApply();
|
||||||
if (key_scancode==SCAN_CODE_ENTER) EventOpenFile();
|
if (key_scancode==SCAN_CODE_ENTER) EventOpenFile();
|
||||||
if (key_scancode==SCAN_CODE_TAB) if (tabs.active_tab==SKINS) EventTabClick(WALLPAPERS); else EventTabClick(SKINS);
|
if (key_scancode==SCAN_CODE_TAB)
|
||||||
|
if (tabs.active_tab==SKINS) EventTabClick(WALLPAPERS);
|
||||||
|
else EventTabClick(SKINS);
|
||||||
if (key_scancode==SCAN_CODE_DEL) EventDeleteFile();
|
if (key_scancode==SCAN_CODE_DEL) EventDeleteFile();
|
||||||
for (id=select_list.cur_y+1; id<select_list.count; id++)
|
for (id=select_list.cur_y+1; id<select_list.count; id++)
|
||||||
{
|
{
|
||||||
@ -118,21 +122,25 @@ void main()
|
|||||||
void DrawWindowContent()
|
void DrawWindowContent()
|
||||||
{
|
{
|
||||||
int id;
|
int id;
|
||||||
|
|
||||||
|
DrawWideRectangle(0, 0, Form.cwidth, Form.cheight, LP, system.color.work);
|
||||||
|
|
||||||
|
tabs.w = Form.cwidth-LP-LP;
|
||||||
|
tabs.h = Form.cheight-LP-LP;
|
||||||
|
tabs.draw_wrapper();
|
||||||
|
|
||||||
|
tabs.draw_button(tabs.x+TAB_PADDING, tabs.y+TAB_HEIGHT, SKINS, T_SKINS);
|
||||||
|
tabs.draw_button(strlen(T_SKINS)*8+tabs.x+TAB_PADDING+TAB_PADDING, tabs.y+TAB_HEIGHT, WALLPAPERS, T_WALLPAPERS);
|
||||||
|
|
||||||
id = select_list.cur_y;
|
id = select_list.cur_y;
|
||||||
SelectList_Init(
|
SelectList_Init(
|
||||||
LIST_PADDING,
|
tabs.x+TAB_PADDING,
|
||||||
PANEL_H,
|
tabs.y+TAB_HEIGHT+TAB_PADDING,
|
||||||
Form.cwidth-scroll1.size_x-LIST_PADDING-LIST_PADDING,
|
tabs.w - TAB_PADDING - TAB_PADDING - scroll1.size_x,
|
||||||
Form.cheight-PANEL_H-LIST_PADDING,
|
tabs.h - TAB_PADDING - TAB_PADDING - TAB_HEIGHT,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
select_list.cur_y = id;
|
select_list.cur_y = id;
|
||||||
DrawBar(0,0, Form.cwidth, PANEL_H-LIST_PADDING, system.color.work);
|
|
||||||
DrawWideRectangle(select_list.x-LIST_PADDING, select_list.y-LIST_PADDING, LIST_PADDING*2+select_list.w+scroll1.size_x,
|
|
||||||
LIST_PADDING*2+select_list.h, LIST_PADDING-2, system.color.work);
|
|
||||||
tabs.draw(select_list.x+10, select_list.y, SKINS, T_SKINS);
|
|
||||||
if (dir_exists(WALP_STANDART_PATH)) tabs.draw(strlen(T_SKINS)*8+TAB_PADDING+select_list.x+21, select_list.y,
|
|
||||||
WALLPAPERS, T_WALLPAPERS);
|
|
||||||
SelectList_Draw();
|
SelectList_Draw();
|
||||||
SelectList_DrawBorder();
|
SelectList_DrawBorder();
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,10 @@ void Sort_by_Name(int a, b)
|
|||||||
int j, i = a;
|
int j, i = a;
|
||||||
if (a >= b) return;
|
if (a >= b) return;
|
||||||
for (j = a; j <= b; j++)
|
for (j = a; j <= b; j++)
|
||||||
if (strcmp(files_mas[j]*304 + buf+72, files_mas[b]*304 + buf+72)<=0) { files_mas[i] >< files_mas[j]; i++;}
|
if (strcmpi(files_mas[j]*304 + buf+72, files_mas[b]*304 + buf+72)<=0) {
|
||||||
|
files_mas[i] >< files_mas[j];
|
||||||
|
i++;
|
||||||
|
}
|
||||||
Sort_by_Name(a, i-2);
|
Sort_by_Name(a, i-2);
|
||||||
Sort_by_Name(i, b);
|
Sort_by_Name(i, b);
|
||||||
}
|
}
|
@ -364,7 +364,7 @@ int error;
|
|||||||
dword cbuf;
|
dword cbuf;
|
||||||
int error=-1;
|
int error=-1;
|
||||||
dword offpos=0;
|
dword offpos=0;
|
||||||
int block_size=1024*4024; //copy by 4 MiBs
|
int block_size=1024*1024*4; //copy by 4 MiBs
|
||||||
{
|
{
|
||||||
cbuf = malloc(block_size);
|
cbuf = malloc(block_size);
|
||||||
WriteFile(0, 0, copyTo); //create file
|
WriteFile(0, 0, copyTo); //create file
|
||||||
|
@ -17,6 +17,9 @@
|
|||||||
#include "../lib/math.h"
|
#include "../lib/math.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "../lib/gui/tabs.h"
|
||||||
|
#include "../lib/gui/more_less_box.h"
|
||||||
|
|
||||||
:void DrawRectangle(dword x,y,w,h,color1)
|
:void DrawRectangle(dword x,y,w,h,color1)
|
||||||
{
|
{
|
||||||
if (w<=0) || (h<=0) return;
|
if (w<=0) || (h<=0) return;
|
||||||
@ -163,24 +166,6 @@
|
|||||||
DrawRectangle3D(x-1,y-1,w+2,h+2,system.color.work_dark,system.color.work_light);
|
DrawRectangle3D(x-1,y-1,w+2,h+2,system.color.work_dark,system.color.work_light);
|
||||||
}
|
}
|
||||||
|
|
||||||
:void MoreLessBox(dword x,y, bt_id_more, bt_id_less, value, text)
|
|
||||||
{
|
|
||||||
#define VALUE_FIELD_W 34
|
|
||||||
#define SIZE 18
|
|
||||||
dword value_text = itoa(value);
|
|
||||||
|
|
||||||
DrawRectangle(x, y, VALUE_FIELD_W+1, SIZE, system.color.work_graph);
|
|
||||||
DrawRectangle3D(x+1, y+1, VALUE_FIELD_W-2, SIZE-2, 0xDDDddd, 0xffffff);
|
|
||||||
DrawBar(x+2, y+2, VALUE_FIELD_W-3, SIZE-3, 0xffffff);
|
|
||||||
WriteText( -strlen(value_text)+3*8 + x+6, SIZE / 2 + y -6, 0x90, 0x333333, value_text);
|
|
||||||
|
|
||||||
DrawCaptButton(VALUE_FIELD_W + x + 1, y, SIZE, SIZE, bt_id_more, system.color.work_button, system.color.work_button_text, "+");
|
|
||||||
DrawCaptButton(VALUE_FIELD_W + x + SIZE, y, SIZE, SIZE, bt_id_less, system.color.work_button, system.color.work_button_text, "-");
|
|
||||||
EDI = system.color.work;
|
|
||||||
WriteText(x+VALUE_FIELD_W+SIZE+SIZE+10, SIZE / 2 + y -7, 0xD0, system.color.work_text, text);
|
|
||||||
DrawRectangle3D(x-1,y-1,VALUE_FIELD_W+SIZE+SIZE+2,SIZE+2,system.color.work_dark,system.color.work_light);
|
|
||||||
}
|
|
||||||
|
|
||||||
:void DrawEditBox(dword edit_box_pointer)
|
:void DrawEditBox(dword edit_box_pointer)
|
||||||
{
|
{
|
||||||
dword x,y,w,h,bg;
|
dword x,y,w,h,bg;
|
||||||
@ -362,89 +347,6 @@ TODO: scroll
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*=========================================================
|
|
||||||
==
|
|
||||||
== TABS
|
|
||||||
==
|
|
||||||
/========================================================*/
|
|
||||||
|
|
||||||
#define TAB_PADDING 25
|
|
||||||
#define TAB_HEIGHT 25
|
|
||||||
|
|
||||||
:struct _tabs
|
|
||||||
{
|
|
||||||
int active_tab;
|
|
||||||
void draw();
|
|
||||||
int click();
|
|
||||||
} tabs;
|
|
||||||
|
|
||||||
:void _tabs::draw(dword x,y, but_id, text)
|
|
||||||
{
|
|
||||||
dword col_bg, col_text;
|
|
||||||
dword w=strlen(text)*8+TAB_PADDING, h=TAB_HEIGHT;
|
|
||||||
y -= h;
|
|
||||||
|
|
||||||
if (but_id==active_tab)
|
|
||||||
{
|
|
||||||
col_bg=system.color.work_button;
|
|
||||||
col_text=system.color.work_button_text;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
col_bg=system.color.work;
|
|
||||||
col_text=system.color.work_text;
|
|
||||||
}
|
|
||||||
DrawCaptButton(x,y, w-1,h+1, but_id, col_bg, col_text, text);
|
|
||||||
}
|
|
||||||
|
|
||||||
:int _tabs::click(int N)
|
|
||||||
{
|
|
||||||
if (N==active_tab) return false;
|
|
||||||
active_tab = N;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*=========================================================
|
|
||||||
==
|
|
||||||
== MORE LESS BOX
|
|
||||||
==
|
|
||||||
/========================================================*/
|
|
||||||
|
|
||||||
:struct more_less_box
|
|
||||||
{
|
|
||||||
signed x,y;
|
|
||||||
unsigned value, min, max;
|
|
||||||
unsigned bt_id_more, bt_id_less;
|
|
||||||
dword text;
|
|
||||||
bool click();
|
|
||||||
void draw();
|
|
||||||
};
|
|
||||||
|
|
||||||
:bool more_less_box::click(unsigned id)
|
|
||||||
{
|
|
||||||
if (id==bt_id_less) { value = math.max(value-1, min); draw(); return 1; }
|
|
||||||
if (id==bt_id_more) { value = math.min(value+1, max); draw(); return 1; }
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
:void more_less_box::draw()
|
|
||||||
{
|
|
||||||
#define VALUE_FIELD_W 34
|
|
||||||
#define SIZE 18
|
|
||||||
dword value_text = itoa(value);
|
|
||||||
|
|
||||||
DrawRectangle(x, y, VALUE_FIELD_W+1, SIZE, system.color.work_graph);
|
|
||||||
DrawRectangle3D(x+1, y+1, VALUE_FIELD_W-2, SIZE-2, 0xDDDddd, 0xffffff);
|
|
||||||
DrawBar(x+2, y+2, VALUE_FIELD_W-3, SIZE-3, 0xffffff);
|
|
||||||
WriteText( -strlen(value_text)+3*8 + x+6, SIZE / 2 + y -6, 0x90, 0x333333, value_text);
|
|
||||||
|
|
||||||
DrawCaptButton(VALUE_FIELD_W + x + 1, y, SIZE, SIZE, bt_id_more, system.color.work_button, system.color.work_button_text, "+");
|
|
||||||
DrawCaptButton(VALUE_FIELD_W + x + SIZE, y, SIZE, SIZE, bt_id_less, system.color.work_button, system.color.work_button_text, "-");
|
|
||||||
EDI = system.color.work;
|
|
||||||
WriteText(x+VALUE_FIELD_W+SIZE+SIZE+10, SIZE / 2 + y -7, 0xD0, system.color.work_text, text);
|
|
||||||
DrawRectangle3D(x-1,y-1,VALUE_FIELD_W+SIZE+SIZE+2,SIZE+2,system.color.work_dark,system.color.work_light);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
53
programs/cmm/lib/gui/more_less_box.h
Normal file
53
programs/cmm/lib/gui/more_less_box.h
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
:struct more_less_box
|
||||||
|
{
|
||||||
|
signed x,y;
|
||||||
|
unsigned value, min, max;
|
||||||
|
unsigned bt_id_more, bt_id_less;
|
||||||
|
dword text;
|
||||||
|
bool click();
|
||||||
|
void draw();
|
||||||
|
};
|
||||||
|
|
||||||
|
:bool more_less_box::click(unsigned id)
|
||||||
|
{
|
||||||
|
if (id==bt_id_less) { value = math.max(value-1, min); draw(); return 1; }
|
||||||
|
if (id==bt_id_more) { value = math.min(value+1, max); draw(); return 1; }
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
:void more_less_box::draw()
|
||||||
|
{
|
||||||
|
#define VALUE_FIELD_W 34
|
||||||
|
#define SIZE 18
|
||||||
|
dword value_text = itoa(value);
|
||||||
|
|
||||||
|
DrawRectangle(x, y, VALUE_FIELD_W+1, SIZE, system.color.work_graph);
|
||||||
|
DrawRectangle3D(x+1, y+1, VALUE_FIELD_W-2, SIZE-2, 0xDDDddd, 0xffffff);
|
||||||
|
DrawBar(x+2, y+2, VALUE_FIELD_W-3, SIZE-3, 0xffffff);
|
||||||
|
WriteText( -strlen(value_text)+3*8 + x+6, SIZE / 2 + y -6, 0x90, 0x333333, value_text);
|
||||||
|
|
||||||
|
DrawCaptButton(VALUE_FIELD_W + x + 1, y, SIZE, SIZE, bt_id_more, system.color.work_button, system.color.work_button_text, "+");
|
||||||
|
DrawCaptButton(VALUE_FIELD_W + x + SIZE, y, SIZE, SIZE, bt_id_less, system.color.work_button, system.color.work_button_text, "-");
|
||||||
|
EDI = system.color.work;
|
||||||
|
WriteText(x+VALUE_FIELD_W+SIZE+SIZE+10, SIZE / 2 + y -7, 0xD0, system.color.work_text, text);
|
||||||
|
DrawRectangle3D(x-1,y-1,VALUE_FIELD_W+SIZE+SIZE+2,SIZE+2,system.color.work_dark,system.color.work_light);
|
||||||
|
}
|
||||||
|
|
||||||
|
//OUTDATED: to be removed
|
||||||
|
:void MoreLessBox(dword x,y, bt_id_more, bt_id_less, value, text)
|
||||||
|
{
|
||||||
|
#define VALUE_FIELD_W 34
|
||||||
|
#define SIZE 18
|
||||||
|
dword value_text = itoa(value);
|
||||||
|
|
||||||
|
DrawRectangle(x, y, VALUE_FIELD_W+1, SIZE, system.color.work_graph);
|
||||||
|
DrawRectangle3D(x+1, y+1, VALUE_FIELD_W-2, SIZE-2, 0xDDDddd, 0xffffff);
|
||||||
|
DrawBar(x+2, y+2, VALUE_FIELD_W-3, SIZE-3, 0xffffff);
|
||||||
|
WriteText( -strlen(value_text)+3*8 + x+6, SIZE / 2 + y -6, 0x90, 0x333333, value_text);
|
||||||
|
|
||||||
|
DrawCaptButton(VALUE_FIELD_W + x + 1, y, SIZE, SIZE, bt_id_more, system.color.work_button, system.color.work_button_text, "+");
|
||||||
|
DrawCaptButton(VALUE_FIELD_W + x + SIZE, y, SIZE, SIZE, bt_id_less, system.color.work_button, system.color.work_button_text, "-");
|
||||||
|
EDI = system.color.work;
|
||||||
|
WriteText(x+VALUE_FIELD_W+SIZE+SIZE+10, SIZE / 2 + y -7, 0xD0, system.color.work_text, text);
|
||||||
|
DrawRectangle3D(x-1,y-1,VALUE_FIELD_W+SIZE+SIZE+2,SIZE+2,system.color.work_dark,system.color.work_light);
|
||||||
|
}
|
56
programs/cmm/lib/gui/tabs.h
Normal file
56
programs/cmm/lib/gui/tabs.h
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
|
||||||
|
#define TAB_PADDING 15
|
||||||
|
#define TAB_HEIGHT 28
|
||||||
|
|
||||||
|
:struct _tabs
|
||||||
|
{
|
||||||
|
int x,y,w,h;
|
||||||
|
int active_tab;
|
||||||
|
void draw_button();
|
||||||
|
int click();
|
||||||
|
void draw_wrapper();
|
||||||
|
};
|
||||||
|
|
||||||
|
:void _tabs::draw_wrapper()
|
||||||
|
{
|
||||||
|
dword color_light = MixColors(system.color.work, 0xFFFfff, 40);
|
||||||
|
dword color_content = MixColors(system.color.work, 0xFFFfff, 120);
|
||||||
|
dword color_light_border = MixColors(system.color.work, system.color.work_graph, 120);
|
||||||
|
|
||||||
|
DrawRectangle(x-1, y-1, w+1, h+1, system.color.work_graph);
|
||||||
|
DrawBar(x, y, w, h, color_content); //0xF3F3F3
|
||||||
|
DrawRectangle3D(x, y, w-1, h-1, color_light, color_content); //0xF3F3F3
|
||||||
|
|
||||||
|
DrawBar(x+1, y+h+1, w-2, 2, system.color.work_dark); //"shadow"
|
||||||
|
|
||||||
|
DrawBar(x, y+TAB_HEIGHT-1, w, 1, color_light_border);
|
||||||
|
DrawBar(x, y+TAB_HEIGHT, w, 1, color_light);
|
||||||
|
}
|
||||||
|
|
||||||
|
:void _tabs::draw_button(dword xx,yy, but_id, text)
|
||||||
|
{
|
||||||
|
dword col_bg, col_text;
|
||||||
|
dword ww=strlen(text)*8, hh=TAB_HEIGHT;
|
||||||
|
yy -= hh;
|
||||||
|
|
||||||
|
if (but_id==active_tab)
|
||||||
|
{
|
||||||
|
col_bg=0xE44C9C;
|
||||||
|
col_text=0x000000;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
col_bg=0xC3A1B7;
|
||||||
|
col_text=0x333333;
|
||||||
|
}
|
||||||
|
DefineHiddenButton(xx,yy, ww-1,hh-1, but_id);
|
||||||
|
WriteText(xx, yy+6, 0x90, col_text, text);
|
||||||
|
DrawBar(xx, yy+hh-3, ww, 3, col_bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
:int _tabs::click(int N)
|
||||||
|
{
|
||||||
|
if (N==active_tab) return false;
|
||||||
|
active_tab = N;
|
||||||
|
return true;
|
||||||
|
}
|
@ -158,9 +158,12 @@ struct proc_info
|
|||||||
byte reserved[1024-71-8];
|
byte reserved[1024-71-8];
|
||||||
};
|
};
|
||||||
|
|
||||||
inline fastcall void GetProcessInfo(EBX, ECX)
|
:void GetProcessInfo(dword _process_struct_pointer, _process_id)
|
||||||
{
|
{
|
||||||
$mov eax,9;
|
skin_height = GetSkinHeight();
|
||||||
|
EAX = 9;
|
||||||
|
EBX = _process_struct_pointer;
|
||||||
|
ECX = _process_id;
|
||||||
$int 0x40
|
$int 0x40
|
||||||
DSDWORD[EBX+71] = DSDWORD[EBX+42] - 9; //set cwidth
|
DSDWORD[EBX+71] = DSDWORD[EBX+42] - 9; //set cwidth
|
||||||
DSDWORD[EBX+75] = DSDWORD[EBX+46] - skin_height - 4; //set cheight
|
DSDWORD[EBX+75] = DSDWORD[EBX+46] - skin_height - 4; //set cheight
|
||||||
|
Loading…
Reference in New Issue
Block a user