forked from KolibriOS/kolibrios
cmm: fix regression which increased all app size
git-svn-id: svn://kolibrios.org@7450 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
ce3c40a673
commit
bb682b53c1
@ -196,7 +196,7 @@ void main()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case evReDraw:
|
case evReDraw:
|
||||||
if (menu.list.cur_y)
|
if (menu.cur_y)
|
||||||
{
|
{
|
||||||
EventMenuClick();
|
EventMenuClick();
|
||||||
}
|
}
|
||||||
@ -396,7 +396,7 @@ void DrawVerticalScroll()
|
|||||||
|
|
||||||
void EventMenuClick()
|
void EventMenuClick()
|
||||||
{
|
{
|
||||||
switch(menu.list.cur_y)
|
switch(menu.cur_y)
|
||||||
{
|
{
|
||||||
//File
|
//File
|
||||||
case FILE_SUBMENU_ID_OPEN:
|
case FILE_SUBMENU_ID_OPEN:
|
||||||
@ -413,7 +413,7 @@ void EventMenuClick()
|
|||||||
break;
|
break;
|
||||||
//Encoding
|
//Encoding
|
||||||
case MENU_ID_ENCODING...MENU_ID_ENCODING+9:
|
case MENU_ID_ENCODING...MENU_ID_ENCODING+9:
|
||||||
EventChangeEncoding(menu.list.cur_y-MENU_ID_ENCODING);
|
EventChangeEncoding(menu.cur_y-MENU_ID_ENCODING);
|
||||||
break;
|
break;
|
||||||
//Reopen
|
//Reopen
|
||||||
case FILE_SUBMENU_ID_TINYPAD:
|
case FILE_SUBMENU_ID_TINYPAD:
|
||||||
@ -435,7 +435,7 @@ void EventMenuClick()
|
|||||||
EventOpenFileInAnotherProgram("/sys/develop/heed");
|
EventOpenFileInAnotherProgram("/sys/develop/heed");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
menu.list.cur_y = 0;
|
menu.cur_y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventShowMenu(dword _menu_item_x, _menu_list, _id, _selected)
|
void EventShowMenu(dword _menu_item_x, _menu_list, _id, _selected)
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#define MEMSIZE 4096*100
|
#define MEMSIZE 4096*100
|
||||||
|
|
||||||
|
#include "../lib/gui.h"
|
||||||
#include "../lib/kfont.h"
|
#include "../lib/kfont.h"
|
||||||
#include "../lib/io.h"
|
#include "../lib/io.h"
|
||||||
#include "../lib/gui.h"
|
#include "../lib/cursor.h"
|
||||||
#include "../lib/list_box.h"
|
|
||||||
|
|
||||||
#include "../lib/obj/box_lib.h"
|
#include "../lib/obj/box_lib.h"
|
||||||
#include "../lib/obj/libini.h"
|
#include "../lib/obj/libini.h"
|
||||||
@ -11,7 +11,6 @@
|
|||||||
#include "../lib/obj/libimg.h"
|
#include "../lib/obj/libimg.h"
|
||||||
#include "../lib/obj/proc_lib.h"
|
#include "../lib/obj/proc_lib.h"
|
||||||
#include "../lib/obj/http.h"
|
#include "../lib/obj/http.h"
|
||||||
#include "../lib/cursor.h"
|
|
||||||
|
|
||||||
#include "../lib/patterns/simple_open_dialog.h"
|
#include "../lib/patterns/simple_open_dialog.h"
|
||||||
#include "../lib/patterns/history.h"
|
#include "../lib/patterns/history.h"
|
||||||
@ -111,19 +110,19 @@ void main()
|
|||||||
break;
|
break;
|
||||||
case evReDraw:
|
case evReDraw:
|
||||||
draw_window();
|
draw_window();
|
||||||
if (menu.list.cur_y>=10) && (menu.list.cur_y<20) {
|
if (menu.cur_y>=10) && (menu.cur_y<20) {
|
||||||
encoding = menu.list.cur_y - 10;
|
encoding = menu.cur_y - 10;
|
||||||
EventPageRefresh();
|
EventPageRefresh();
|
||||||
menu.list.cur_y = 0;
|
menu.cur_y = 0;
|
||||||
}
|
}
|
||||||
if (menu.list.cur_y>=20) {
|
if (menu.cur_y>=20) {
|
||||||
menu.list.cur_y-=20;
|
menu.cur_y-=20;
|
||||||
if (menu.list.cur_y==0) EventPageRefresh();
|
if (menu.cur_y==0) EventPageRefresh();
|
||||||
if (menu.list.cur_y==1) EventRunEdit();
|
if (menu.cur_y==1) EventRunEdit();
|
||||||
if (menu.list.cur_y==2) EventShowHistory();
|
if (menu.cur_y==2) EventShowHistory();
|
||||||
if (menu.list.cur_y==3) EventShowDownloader();
|
if (menu.cur_y==3) EventShowDownloader();
|
||||||
if (menu.list.cur_y==4) EventShowInfo();
|
if (menu.cur_y==4) EventShowInfo();
|
||||||
menu.list.cur_y = 0;
|
menu.cur_y = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,10 +152,10 @@ void main()
|
|||||||
|
|
||||||
case evReDraw:
|
case evReDraw:
|
||||||
draw_window();
|
draw_window();
|
||||||
if (menu.list.cur_y) {
|
if (menu.cur_y) {
|
||||||
if (menu.list.cur_y == 10) EventOpenFile();
|
if (menu.cur_y == 10) EventOpenFile();
|
||||||
if (menu.list.cur_y == 11) EventDeleteFile();
|
if (menu.cur_y == 11) EventDeleteFile();
|
||||||
menu.list.cur_y = 0;
|
menu.cur_y = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -176,9 +176,9 @@ void main()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case evReDraw:
|
case evReDraw:
|
||||||
if (menu.list.cur_y) {
|
if (menu.cur_y) {
|
||||||
ProcessEvent(menu.list.cur_y);
|
ProcessEvent(menu.cur_y);
|
||||||
menu.list.cur_y = 0;
|
menu.cur_y = 0;
|
||||||
}
|
}
|
||||||
DefineAndDrawWindow(GetScreenWidth()-800/2-random(80),GetScreenHeight()-600/2-random(80),800,600,0x73,col_bg,0,0);
|
DefineAndDrawWindow(GetScreenWidth()-800/2-random(80),GetScreenHeight()-600/2-random(80),800,600,0x73,col_bg,0,0);
|
||||||
GetProcessInfo(#Form, SelfInfo);
|
GetProcessInfo(#Form, SelfInfo);
|
||||||
|
@ -55,8 +55,8 @@ void main()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case evReDraw:
|
case evReDraw:
|
||||||
if (menu.list.cur_y) {
|
if (menu.cur_y) {
|
||||||
if (menu.list.cur_y > butv.id) && (menu.list.cur_y < buta.id) category = menu.list.cur_y - butv.id;
|
if (menu.cur_y > butv.id) && (menu.cur_y < buta.id) category = menu.cur_y - butv.id;
|
||||||
}
|
}
|
||||||
DefineAndDrawWindow(215,100,350,300,0x34,0xFFFFFF,"Window header",0);
|
DefineAndDrawWindow(215,100,350,300,0x34,0xFFFFFF,"Window header",0);
|
||||||
GetProcessInfo(#Form, SelfInfo);
|
GetProcessInfo(#Form, SelfInfo);
|
||||||
|
@ -862,10 +862,10 @@ void EventShowImageMenu()
|
|||||||
|
|
||||||
void EventCheckMenuItemSelected()
|
void EventCheckMenuItemSelected()
|
||||||
{
|
{
|
||||||
if (menu.list.cur_y) {
|
if (menu.cur_y) {
|
||||||
if (20 == menu.list.cur_y) EventCountColorsUsed();
|
if (20 == menu.cur_y) EventCountColorsUsed();
|
||||||
if (21 == menu.list.cur_y) EventReplaceImageColors(color1, color2);
|
if (21 == menu.cur_y) EventReplaceImageColors(color1, color2);
|
||||||
menu.list.cur_y = 0;
|
menu.cur_y = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,10 +19,17 @@
|
|||||||
|
|
||||||
#include "../lib/gui/tabs.h"
|
#include "../lib/gui/tabs.h"
|
||||||
#include "../lib/gui/more_less_box.h"
|
#include "../lib/gui/more_less_box.h"
|
||||||
|
|
||||||
|
#ifndef INCLUDE_CHECKBOX
|
||||||
#include "../lib/gui/checkbox.h"
|
#include "../lib/gui/checkbox.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "../lib/gui/child_window.h"
|
#include "../lib/gui/child_window.h"
|
||||||
#include "../lib/gui/text_view_area.h"
|
#include "../lib/gui/text_view_area.h"
|
||||||
|
|
||||||
|
#ifndef INCLUDE_MENU_H
|
||||||
#include "../lib/gui/menu.h"
|
#include "../lib/gui/menu.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
:int last_free_button_id = 1000;
|
:int last_free_button_id = 1000;
|
||||||
:int GetFreeButtonId()
|
:int GetFreeButtonId()
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
#ifndef INCLUDE_CHECKBOX
|
||||||
|
#define INCLUDE_CHECKBOX
|
||||||
|
|
||||||
:unsigned char checkbox_flag[507] = {
|
:unsigned char checkbox_flag[507] = {
|
||||||
0xFC, 0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC,
|
0xFC, 0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC,
|
||||||
0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC, 0xD4,
|
0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC, 0xD4,
|
||||||
@ -86,3 +89,5 @@ struct checkbox
|
|||||||
{
|
{
|
||||||
draw(x,y);
|
draw(x,y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -1,30 +1,31 @@
|
|||||||
#ifndef INCLUDE_MENU_H
|
#ifndef INCLUDE_MENU_H
|
||||||
#define INCLUDE_MENU_H
|
#define INCLUDE_MENU_H
|
||||||
|
|
||||||
|
#ifndef INCLUDE_LIST_BOX
|
||||||
#include "../lib/list_box.h"
|
#include "../lib/list_box.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
:dword menu_process_id;
|
:dword menu_process_id;
|
||||||
|
|
||||||
:struct _menu
|
:struct _menu : llist
|
||||||
{
|
{
|
||||||
dword appear_x, appear_y, text, identifier, selected;
|
dword appear_x, appear_y, text, identifier, selected;
|
||||||
llist list;
|
|
||||||
void show();
|
void show();
|
||||||
char stak[4096];
|
char stak[4096];
|
||||||
} menu;
|
} menu;
|
||||||
|
|
||||||
void _menu::show(dword _appear_x, _appear_y, _menu_width, _text, _identifier)
|
:void _menu::show(dword _appear_x, _appear_y, _menu_width, _menu_text, _identifier)
|
||||||
{
|
{
|
||||||
#define ITEM_H 21
|
#define ITEM_H 21
|
||||||
appear_x = _appear_x;
|
appear_x = _appear_x;
|
||||||
appear_y = _appear_y;
|
appear_y = _appear_y;
|
||||||
text = _text;
|
text = _menu_text;
|
||||||
identifier = _identifier;
|
identifier = _identifier;
|
||||||
|
|
||||||
list.cur_y = -1;
|
cur_y = -1;
|
||||||
list.ClearList();
|
ClearList();
|
||||||
list.count = chrnum(text, '\n')+1;
|
count = chrnum(text, '\n')+1;
|
||||||
list.SetSizes(2,2,_menu_width,list.count*ITEM_H,ITEM_H);
|
SetSizes(2,2,_menu_width,count*ITEM_H,ITEM_H);
|
||||||
|
|
||||||
menu_process_id = CreateThread(#_menu_thread,#stak+4092);
|
menu_process_id = CreateThread(#_menu_thread,#stak+4092);
|
||||||
}
|
}
|
||||||
@ -39,18 +40,18 @@ void _menu::show(dword _appear_x, _appear_y, _menu_width, _text, _identifier)
|
|||||||
GetProcessInfo(#MenuForm, SelfInfo);
|
GetProcessInfo(#MenuForm, SelfInfo);
|
||||||
if (!CheckActiveProcess(MenuForm.ID)) _menu_no_item_click();
|
if (!CheckActiveProcess(MenuForm.ID)) _menu_no_item_click();
|
||||||
mouse.get();
|
mouse.get();
|
||||||
if (menu.list.ProcessMouse(mouse.x, mouse.y)) _menu_draw_list();
|
if (menu.ProcessMouse(mouse.x, mouse.y)) _menu_draw_list();
|
||||||
if (mouse.lkm)&&(mouse.up) _menu_item_click();
|
if (mouse.lkm)&&(mouse.up) _menu_item_click();
|
||||||
break;
|
break;
|
||||||
case evKey:
|
case evKey:
|
||||||
GetKeys();
|
GetKeys();
|
||||||
if (key_scancode==SCAN_CODE_ESC) _menu_no_item_click();
|
if (key_scancode==SCAN_CODE_ESC) _menu_no_item_click();
|
||||||
if (key_scancode==SCAN_CODE_ENTER) _menu_item_click();
|
if (key_scancode==SCAN_CODE_ENTER) _menu_item_click();
|
||||||
if (menu.list.ProcessKey(key_scancode)) _menu_draw_list();
|
if (menu.ProcessKey(key_scancode)) _menu_draw_list();
|
||||||
break;
|
break;
|
||||||
case evReDraw:
|
case evReDraw:
|
||||||
DefineAndDrawWindow(menu.appear_x,menu.appear_y,menu.list.w+2,menu.list.h+4,0x01, 0, 0, 0x01fffFFF);
|
DefineAndDrawWindow(menu.appear_x,menu.appear_y,menu.w+2,menu.h+4,0x01, 0, 0, 0x01fffFFF);
|
||||||
DrawPopup(0,0,menu.list.w,menu.list.h+3,0, 0xE4DFE1,0x9098B0);
|
DrawPopup(0,0,menu.w,menu.h+3,0, 0xE4DFE1,0x9098B0);
|
||||||
_menu_draw_list();
|
_menu_draw_list();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -58,24 +59,24 @@ void _menu::show(dword _appear_x, _appear_y, _menu_width, _text, _identifier)
|
|||||||
:void _menu_draw_list()
|
:void _menu_draw_list()
|
||||||
{
|
{
|
||||||
int N, bgcol;
|
int N, bgcol;
|
||||||
for (N=0; N<menu.list.count; N++;)
|
for (N=0; N<menu.count; N++;)
|
||||||
{
|
{
|
||||||
if (N==menu.list.cur_y) bgcol=0xFFFfff; else bgcol=0xE4DFE1;
|
if (N==menu.cur_y) bgcol=0xFFFfff; else bgcol=0xE4DFE1;
|
||||||
DrawBar(menu.list.x, N*menu.list.item_h+menu.list.y, menu.list.w-3, menu.list.item_h, bgcol);
|
DrawBar(menu.x, N*menu.item_h+menu.y, menu.w-3, menu.item_h, bgcol);
|
||||||
}
|
}
|
||||||
WriteTextLines(13, menu.list.item_h-8/2+menu.list.y, 0x80, 0, menu.text, menu.list.item_h);
|
WriteTextLines(13, menu.item_h-8/2+menu.y, 0x80, 0, menu.text, menu.item_h);
|
||||||
if (menu.selected) WriteText(5, menu.selected-1*menu.list.item_h+8, 0x80, 0xEE0000, "\x10");
|
if (menu.selected) WriteText(5, menu.selected-1*menu.item_h+8, 0x80, 0xEE0000, "\x10");
|
||||||
}
|
}
|
||||||
|
|
||||||
:void _menu_item_click()
|
:void _menu_item_click()
|
||||||
{
|
{
|
||||||
menu.list.cur_y = menu.identifier + menu.list.cur_y;
|
menu.cur_y = menu.identifier + menu.cur_y;
|
||||||
KillProcess(menu_process_id);
|
KillProcess(menu_process_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
:void _menu_no_item_click()
|
:void _menu_no_item_click()
|
||||||
{
|
{
|
||||||
menu.list.cur_y = 0;
|
menu.cur_y = 0;
|
||||||
KillProcess(menu_process_id);
|
KillProcess(menu_process_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,21 +25,22 @@
|
|||||||
|
|
||||||
:dword _rgb::RgbToDword()
|
:dword _rgb::RgbToDword()
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
dword _r, _g, _b;
|
dword _r, _g, _b;
|
||||||
_r = r << 16;
|
_r = r << 16;
|
||||||
_g = g << 8;
|
_g = g << 8;
|
||||||
_b = b;
|
_b = b;
|
||||||
return _r + _g + _b;
|
return _r + _g + _b;
|
||||||
|
*/
|
||||||
|
EAX = r << 16;
|
||||||
|
EAX += g << 8;
|
||||||
|
EAX += b;
|
||||||
}
|
}
|
||||||
|
|
||||||
:dword MixColors(dword _base, _overlying, dword a)
|
:dword MixColors(dword _base, _overlying, dword a)
|
||||||
{
|
{
|
||||||
_rgb rgb1, rgb2, rgb_final;
|
_rgb rgb1, rgb2, rgb_final;
|
||||||
dword n_a;
|
dword n_a;
|
||||||
if (a<0) || (a>255) {
|
|
||||||
debug("Wrong alpha param in MixColors()!");
|
|
||||||
debugval("alpha", a);
|
|
||||||
}
|
|
||||||
|
|
||||||
rgb1.DwordToRgb(_base);
|
rgb1.DwordToRgb(_base);
|
||||||
rgb2.DwordToRgb(_overlying);
|
rgb2.DwordToRgb(_overlying);
|
||||||
|
@ -97,11 +97,11 @@ void main()
|
|||||||
HandleButtonEvent();
|
HandleButtonEvent();
|
||||||
break;
|
break;
|
||||||
case evReDraw:
|
case evReDraw:
|
||||||
if (menu.list.cur_y) {
|
if (menu.cur_y) {
|
||||||
encoding = menu.list.cur_y - 10;
|
encoding = menu.cur_y - 10;
|
||||||
OpenFile(#param);
|
OpenFile(#param);
|
||||||
PreparePage();
|
PreparePage();
|
||||||
menu.list.cur_y = NULL;
|
menu.cur_y = NULL;
|
||||||
};
|
};
|
||||||
draw_window();
|
draw_window();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user