mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-24 23:56:49 +03:00
CMM: optimizations, fixes
git-svn-id: svn://kolibrios.org@4081 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
a32ea3f480
commit
6ba7bf3033
@ -142,7 +142,7 @@ void main()
|
||||
|
||||
mem_Init();
|
||||
if (param) strcpy(#folder_path, #param);
|
||||
list[SKINS].current = list[WALLPAPERS].current = 0;
|
||||
list[SKINS].current = list[WALLPAPERS].current = -1;
|
||||
list[SKINS].first = list[WALLPAPERS].first = 0;
|
||||
GetFiles(WALLPAPERS);
|
||||
list[active].SetSizes(0, 230, 350, 400-PANEL_H, 40, 18);
|
||||
@ -154,20 +154,13 @@ void main()
|
||||
case evMouse:
|
||||
mm.get();
|
||||
if (mm.vert) && (list[active].MouseScroll(mm.vert)) Draw_List();
|
||||
/*
|
||||
if (mouse_clicked)
|
||||
{
|
||||
if (!mm.lkm) && (list[active].ProcessMouse(mm.x, mm.y)) Apply();
|
||||
if (!mm.lkm) && (active==SKINS) && (list[SKINS].ProcessMouse(mm.x, mm.y)) Apply();
|
||||
if (!mm.lkm) && (active==WALLPAPERS) && (list[WALLPAPERS].ProcessMouse(mm.x, mm.y)) Apply();
|
||||
mouse_clicked=0;
|
||||
}
|
||||
if (mm.lkm) && (list[active].MouseOver(mm.x, mm.y)) mouse_clicked=1;
|
||||
*/
|
||||
EAX = active;
|
||||
if (mm.lkm)
|
||||
{
|
||||
if (active==SKINS) && (list[SKINS].ProcessMouse(mm.x, mm.y)) Apply();
|
||||
if if (active==WALLPAPERS) && (list[WALLPAPERS].ProcessMouse(mm.x, mm.y)) Apply();
|
||||
}
|
||||
if (mm.lkm) && (list[SKINS].MouseOver(mm.x, mm.y)) mouse_clicked=1;
|
||||
break;
|
||||
|
||||
case evButton:
|
||||
|
@ -66,7 +66,7 @@ int action_buf;
|
||||
|
||||
void main()
|
||||
{
|
||||
int btn, key;
|
||||
int key, btn;
|
||||
int half_scroll_size;
|
||||
int scroll_used=0, show_menu;
|
||||
|
||||
@ -98,8 +98,7 @@ void main()
|
||||
//break;
|
||||
};*/
|
||||
|
||||
btn=GetProcessSlot(Form.ID);
|
||||
if (btn<>GetActiveProcess()) break;
|
||||
if (!CheckActiveProcess(Form.ID)) break;
|
||||
|
||||
edit_box_mouse stdcall (#address_box);
|
||||
|
||||
|
@ -14,39 +14,36 @@ char *ITEMS_LIST[]={
|
||||
#endif
|
||||
0};
|
||||
|
||||
llist menu;
|
||||
dword col_work = 0xE4DFE1;
|
||||
dword col_border = 0x9098B0;
|
||||
|
||||
void menu_rmb()
|
||||
{
|
||||
mouse mm;
|
||||
proc_info MenuForm;
|
||||
llist menu;
|
||||
int overid, key, N;
|
||||
dword col_work = 0xE4DFE1;
|
||||
dword col_border = 0x9098B0;
|
||||
int key;
|
||||
|
||||
menu.first = menu.current = 0;
|
||||
while (ITEMS_LIST[menu.count*2]) {menu.count++; menu.visible++;}
|
||||
menu.line_h = 19;
|
||||
menu.w = 165;
|
||||
menu.h = menu.count * menu.line_h;
|
||||
while (ITEMS_LIST[menu.count*2]) menu.count++;
|
||||
menu.SetSizes(2,2,165,menu.count*19,0,19);
|
||||
SetEventMask(100111b);
|
||||
|
||||
loop() switch(WaitEvent())
|
||||
{
|
||||
case evMouse:
|
||||
GetProcessInfo(#MenuForm, SelfInfo);
|
||||
N=GetProcessSlot(MenuForm.ID);
|
||||
if (N<>GetActiveProcess()) ExitProcess();
|
||||
if (!CheckActiveProcess(MenuForm.ID)) ExitProcess();
|
||||
|
||||
mm.get();
|
||||
if (menu.ProcessMouse(mm.x, mm.y)) goto _ITEMS_DRAW;
|
||||
if (menu.ProcessMouse(mm.x, mm.y)) DrawMenuList();
|
||||
if (mm.lkm) || (mm.pkm) { action_buf = ITEMS_LIST[menu.current*2+1]; ExitProcess(); }
|
||||
break;
|
||||
|
||||
case evKey:
|
||||
key = GetKey();
|
||||
if (key==27) ExitProcess();
|
||||
if (menu.ProcessKey(key)) goto _ITEMS_DRAW;
|
||||
if (menu.ProcessKey(key)) DrawMenuList();
|
||||
if (key==13)
|
||||
{
|
||||
action_buf = ITEMS_LIST[menu.current*2+1];
|
||||
@ -55,26 +52,26 @@ void menu_rmb()
|
||||
break;
|
||||
|
||||
case evReDraw:
|
||||
DefineAndDrawWindow(Form.left+m.x,Form.top+m.y+GetSkinHeight()+3,menu.w+2,menu.count*menu.line_h+4,0x01, 0, 0, 0x01fffFFF);
|
||||
DrawPopup(0,0,menu.w,menu.count*menu.line_h+3,0, col_work,col_border);
|
||||
|
||||
_ITEMS_DRAW:
|
||||
for (N=0; N<menu.count; N++;)
|
||||
{
|
||||
if (N==menu.current)
|
||||
DrawBar(2, N*menu.line_h+2, menu.w-3, menu.line_h, 0x94AECE);
|
||||
else
|
||||
{
|
||||
DrawBar(2, N*menu.line_h+2, menu.w-3, menu.line_h, col_work);
|
||||
WriteText(19,N*menu.line_h+9,0x80,0xf2f2f2,ITEMS_LIST[N*2]);
|
||||
}
|
||||
WriteText(18,N*menu.line_h+8,0x80,0x000000,ITEMS_LIST[N*2]);
|
||||
}
|
||||
DrawBar(7, cur_encoding*menu.line_h+9, 4, 4, 0x444444); //show current encoding
|
||||
DefineAndDrawWindow(Form.left+m.x,Form.top+m.y+GetSkinHeight()+3,menu.w+2,menu.h+4,0x01, 0, 0, 0x01fffFFF);
|
||||
DrawPopup(0,0,menu.w,menu.h+3,0, col_work,col_border);
|
||||
DrawMenuList();
|
||||
}
|
||||
}
|
||||
|
||||
void DrawMenuList()
|
||||
{
|
||||
int N;
|
||||
|
||||
|
||||
|
||||
|
||||
for (N=0; N<menu.count; N++;)
|
||||
{
|
||||
if (N==menu.current)
|
||||
DrawBar(menu.x, N*menu.line_h+menu.y, menu.w-3, menu.line_h, 0x94AECE);
|
||||
else
|
||||
{
|
||||
DrawBar(menu.x, N*menu.line_h+menu.y, menu.w-3, menu.line_h, col_work);
|
||||
WriteText(19,N*menu.line_h+9,0x80,0xf2f2f2,ITEMS_LIST[N*2]);
|
||||
}
|
||||
WriteText(18,N*menu.line_h+8,0x80,0x000000,ITEMS_LIST[N*2]);
|
||||
}
|
||||
DrawBar(7, cur_encoding*menu.line_h+9, 4, 4, 0x444444); //show current encoding
|
||||
}
|
||||
|
@ -170,10 +170,8 @@ void main()
|
||||
loop() switch(WaitEvent())
|
||||
{
|
||||
case evMouse:
|
||||
IF (del_active) break;
|
||||
id=GetProcessSlot(Form.ID);
|
||||
IF (id!=GetActiveProcess()) || (Form.status_window>2) break;
|
||||
IF (rename_active) { edit_box_mouse stdcall(#edit2); break; }
|
||||
if (del_active) || (!CheckActiveProcess(Form.ID)) || (Form.status_window>2) break;
|
||||
if (rename_active) { edit_box_mouse stdcall(#edit2); break; }
|
||||
|
||||
m.get();
|
||||
|
||||
|
@ -48,7 +48,7 @@ int cur_action_buf;
|
||||
void FileMenu()
|
||||
{
|
||||
mouse mm;
|
||||
word slot, key;
|
||||
word key;
|
||||
proc_info MenuForm;
|
||||
int index;
|
||||
|
||||
@ -69,8 +69,7 @@ void FileMenu()
|
||||
loop() switch(WaitEvent())
|
||||
{
|
||||
case evMouse:
|
||||
slot = GetProcessSlot(MenuForm.ID);
|
||||
if (slot != GetActiveProcess()) ExitProcess();
|
||||
if (!CheckActiveProcess(MenuForm.ID)) ExitProcess();
|
||||
mm.get();
|
||||
if (menu.ProcessMouse(mm.x, mm.y)) MenuListRedraw();
|
||||
if (mm.lkm) {action_buf = cur_action_buf; pause(5); ExitProcess(); }
|
||||
|
@ -64,20 +64,19 @@ void OpenWith()
|
||||
#define PADDING 8
|
||||
int WIN_H;
|
||||
mouse mm;
|
||||
word key, slot;
|
||||
word key;
|
||||
proc_info MenuForm;
|
||||
|
||||
app_list.ClearList();
|
||||
app_list.SetSizes(PADDING,PANEL_H+1,WIN_W-PADDING-PADDING,OPEN_LIST_VISIBLE_N*OPEN_LIST_LINE_H,150,OPEN_LIST_LINE_H);
|
||||
if (!app_list.count) if (GetListOfPrograms()==-1) return;
|
||||
app_list.SetSizes(PADDING,PANEL_H+1,WIN_W-PADDING-PADDING,OPEN_LIST_VISIBLE_N*OPEN_LIST_LINE_H,150,OPEN_LIST_LINE_H);
|
||||
SetEventMask(100111b);
|
||||
goto _APP_LIST_DRAW;
|
||||
|
||||
loop() switch(WaitEvent())
|
||||
{
|
||||
case evMouse:
|
||||
slot = GetProcessSlot(MenuForm.ID);
|
||||
if (slot != GetActiveProcess()) ExitProcess();
|
||||
if (!CheckActiveProcess(MenuForm.ID)) ExitProcess();
|
||||
mm.get();
|
||||
if (mm.vert) && (app_list.MouseScroll(mm.vert)) DrawAppList();
|
||||
if (app_list.ProcessMouse(mm.x, mm.y)) DrawAppList();
|
||||
|
@ -218,6 +218,13 @@ inline fastcall int GetActiveProcess()
|
||||
$int 0x40
|
||||
}
|
||||
|
||||
:int CheckActiveProcess(int Form_ID)
|
||||
{
|
||||
int id=GetProcessSlot(Form_ID);
|
||||
if (id==GetActiveProcess()) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline fastcall void ActivateWindow( ECX)
|
||||
{
|
||||
EAX = 18;
|
||||
|
@ -80,10 +80,8 @@ void window()
|
||||
loop() switch(WaitEvent())
|
||||
{
|
||||
case evMouse:
|
||||
if (!CheckActiveProcess(MenuForm.ID)) ExitProcess();
|
||||
m.get();
|
||||
|
||||
id1=GetProcessSlot(MenuForm.ID);
|
||||
if (id1<>GetActiveProcess()) ExitProcess();
|
||||
id1=m.y-1/ITEM_HEIGHT;
|
||||
if (m.y<0) || (id1+1>items_num) || (m.x<0) || (m.x>ITEM_WIDTH) break;
|
||||
if (m.lkm) || (m.pkm)
|
||||
|
Loading…
Reference in New Issue
Block a user