DrawCheckBox replaced by structure checkbox, huge code refactoring

git-svn-id: svn://kolibrios.org@7244 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2018-04-19 20:12:07 +00:00
parent 02e3d16737
commit 8e9b52450a
20 changed files with 374 additions and 383 deletions

View File

@ -48,9 +48,14 @@ int files_mas[400];
int cur;
proc_info Form;
block skp;
_tabs tabs = { LP, LP, NULL, NULL, SKINS };
checkbox checkbox1 = { "Checkbox", true };
#define MENU_LIST "Open file Enter\nDelete Del"
//===================================================//
// //
// CODE //
@ -70,10 +75,10 @@ void main()
if (!CheckActiveProcess(Form.ID)) break;
SelectList_ProcessMouse();
if (mouse.down)&&(mouse.pkm) {
if (mouse.pkm)&&(select_list.MouseOver(mouse.x, mouse.y)) {
select_list.ProcessMouse(mouse.x, mouse.y);
SelectList_Draw();
menu.show(Form.left+mouse.x, Form.top+mouse.y+skin_height, 185, "Open file Enter\nDelete Del", 10);
menu.show(Form.left+mouse.x, Form.top+mouse.y+skin_height, 185, MENU_LIST, 10);
}
break;
@ -82,6 +87,7 @@ void main()
if (id==1) ExitProcess();
if (id==SKINS) EventTabClick(SKINS);
if (id==WALLPAPERS) EventTabClick(WALLPAPERS);
checkbox1.click(id);
break;
case evKey:
@ -107,7 +113,7 @@ void main()
case evReDraw:
system.color.get();
DefineAndDrawWindow(screen.width-400/2,80,400,404+skin_height,0x73,0xE4DFE1,WINDOW_HEADER,0);
DefineAndDrawWindow(screen.width-600/2,80,600,404+skin_height,0x73,0xE4DFE1,WINDOW_HEADER,0);
GetProcessInfo(#Form, SelfInfo);
IF (Form.status_window>=2) break;
DrawWindowContent();
@ -119,6 +125,7 @@ void main()
}
}
void DrawWindowContent()
{
int id;
@ -136,13 +143,31 @@ void DrawWindowContent()
SelectList_Init(
tabs.x+TAB_PADDING,
tabs.y+TAB_HEIGHT+TAB_PADDING,
tabs.w - TAB_PADDING - TAB_PADDING - scroll1.size_x,
250,
tabs.h - TAB_PADDING - TAB_PADDING - TAB_HEIGHT,
false
);
select_list.cur_y = id;
skp.set_size(
select_list.x + select_list.w + TAB_PADDING + scroll1.size_x,
select_list.y,
250,
250
);
SelectList_Draw();
SelectList_DrawBorder();
if (tabs.active_tab == SKINS)
{
DrawBar(skp.x, skp.y, skp.w, skp.h, system.color.work);
DrawFrame(skp.x, skp.y, skp.w, skp.h, " Components Preview ");
WriteText(skp.x+20, skp.y+30, 0x90, system.color.work_text, "Lorem ipsum");
checkbox1.draw(skp.x+20, skp.y+70);
DrawStandartCaptButton(skp.x+20, skp.y+skp.h-40, GetFreeButtonId(), "Apply");
DrawStandartCaptButton(skp.x+120, skp.y+skp.h-40, GetFreeButtonId(), "Close");
}
}

View File

@ -13,7 +13,7 @@
/* === TRANSLATIONS === */
#define T_WTITLE "EasyShot v0.75"
#define T_WTITLE "EasyShot v0.76"
#ifdef LANG_RUS
?define T_TAKE_SCREENSHOT " ‘¤¥« âì áªà¨­è®â"
@ -35,11 +35,15 @@ enum {
#define PD 18 //padding
struct _settings {
bool minimise;
int delay;
char save_path[4096];
} settings = { true, 1, "/tmp0/1" };
char save_path[4096] = "/tmp0/1";
dword mouse_dd1;
edit_box edit_box_path = {270,10,70,0xffffff,0x94AECE,0xFFFfff,0xffffff,
0x10000000,sizeof(save_path),#save_path,#mouse_dd1, 0b};
more_less_box delay = { 1, 0, 64, "Delay in seconds" };
checkbox minimise = { "Minimize window", true };
/* === CODE === */
@ -52,10 +56,8 @@ void main()
load_dll(boxlib, #box_lib_init,0);
Libimg_LoadImage(#skin, "/sys/icons16.png");
screenshot_length = screen.width * screen.height * 3;
screenshot = malloc(screenshot_length);
screenshot = malloc(screenshot_length);
loop() switch(WaitEvent())
{
@ -63,7 +65,7 @@ void main()
id = GetButtonID();
if (id == CLOSE_BTN) ExitProcess();
if (id == BTN_MAKE_SCREENSHOT) EventTakeScreenshot();
if (id == BTN_SETTINGS) EventShowSettings();
if (id == BTN_SETTINGS) CreateThread(#SettingsWindow,#settings_stak+4092);
break;
case evKey:
@ -89,11 +91,11 @@ void DrawMainContent()
}
void EventTakeScreenshot() {
if (settings.minimise) MinimizeWindow();
pause(settings.delay*100);
if (minimise.checked) MinimizeWindow();
pause(delay.value*100);
CopyScreen(screenshot, 0, 0, screen.width, screen.height);
ActivateWindow(GetProcessSlot(Form.ID));
if (!settings.minimise) DrawMainContent();
if (!minimise.checked) DrawMainContent();
EventSaveImageFile();
}
@ -103,21 +105,11 @@ void EventSaveImageFile()
char save_file_name[4096];
do {
i++;
sprintf(#save_file_name, "%s/screen_%i.png", #settings.save_path, i);
sprintf(#save_file_name, "%s/screen_%i.png", #save_path, i);
} while (file_exists(#save_file_name));
save_image(screenshot, screen.width, screen.height, #save_file_name);
}
void EventShowSettings()
{
CreateThread(#SettingsWindow,#settings_stak+4092);
}
char path_tmp[4096];
dword mouse_dd1;
edit_box edit_box_path = {270,10,70,0xffffff,0x94AECE,0xFFFfff,0xffffff,0x10000000,sizeof(path_tmp),#path_tmp,#mouse_dd1, 0b};
more_less_box delay = { 1, 0, 64, "Delay in seconds" };
void SettingsWindow()
{
@ -136,26 +128,20 @@ void SettingsWindow()
case evButton:
id = GetButtonID();
delay.click(id);
if (CLOSE_BTN == id) ExitProcess();
if (12 == id) { settings.minimise ^= 1; goto _DRAW_CONTENT; }
delay.click(id);
minimise.click(id);
break;
case evReDraw:
DefineAndDrawWindow(Form.left+100, Form.top-40, 330, 170, 0x34, system.color.work, "Settings",0);
_DRAW_CONTENT:
CheckBox(15, 10, 12, "Minimize window", settings.minimise);
minimise.draw(15, 10);
delay.draw(15, 40);
//DrawEditBox(#edit_box_path);
}
}
inline byte calc_rgb(dword B, item_h)
{
return calc(ESBYTE[B+3] + ESBYTE[B] + ESBYTE[B-3]
+ ESBYTE[B-item_h] + ESBYTE[B+item_h] / 5);
}
int DrawIconButton(dword x, y, id, text, icon)
{
int btwidth;

View File

@ -96,17 +96,8 @@ int j, i;
int action_buf;
int rand_n;
//struct t_settings {
char sort_num=2;
bool show_dev_name=true,
real_files_names_case=true,
info_after_copy=false,
two_panels=false,
show_breadcrumb=false,
show_status_bar=true,
active_panel=1,
big_icons=false;
//} settings;
int active_panel=1;
libimg_image icons16_default;
libimg_image icons16_selected;
@ -310,7 +301,7 @@ void main()
break;
}
if (two_panels) && (mouse.y > files.y) && (mouse.down) {
if (two_panels.checked) && (mouse.y > files.y) && (mouse.down) {
if (mouse.x<Form.cwidth/2)
{
if (active_panel!=1)
@ -417,7 +408,7 @@ void main()
key_scancode -= 59;
if (key_scancode < SystemDiscs.list.count)
{
if (!two_panels)
if (!two_panels.checked)
{
DrawRectangle(17,key_scancode*16+74,159,16, 0); //display click
pause(7);
@ -475,7 +466,7 @@ void main()
Open(0);
break;
case SCAN_CODE_TAB:
if (!two_panels) break;
if (!two_panels.checked) break;
if (active_panel==1) active_panel=2; else active_panel=1;
ChangeActivePanel();
DrawStatusBar();
@ -557,7 +548,7 @@ void DrawFavButton(int x)
void draw_window()
{
if (show_status_bar) status_bar_h = STATUS_BAR_H; else status_bar_h = 0;
if (show_status_bar.checked) status_bar_h = STATUS_BAR_H; else status_bar_h = 0;
DefineAndDrawWindow(WinX+rand_n,WinY+rand_n,WinW,WinH,0x73,NULL,TITLE,0);
GetProcessInfo(#Form, SelfInfo);
if (Form.status_window>2) return;
@ -597,14 +588,14 @@ void DrawList()
if (sort_num==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w;
WriteText(sorting_arrow_x,files.y-12,0x80,col_graph,"\x19");
DrawBar(files.x+files.w,files.y,1,files.h,col_graph);
if (two_panels) && (files.x<5) DrawBar(files.x+files.w+16,files.y,1,files.h,col_graph);
if (two_panels.checked) && (files.x<5) DrawBar(files.x+files.w+16,files.y,1,files.h,col_graph);
}
void DrawStatusBar()
{
char status_bar_str[80];
int go_up_folder_exists=0;
if (!show_status_bar) return;
if (!show_status_bar.checked) return;
if (files.count>0) && (strcmp(file_mas[0]*304+buf+72,"..")==0) go_up_folder_exists=1;
DrawBar(1, Form.cheight - status_bar_h-1, Form.cwidth-2, status_bar_h, system.color.work);
sprintf(#status_bar_str, STATUS_STR, files.count-go_up_folder_exists, count_dir-go_up_folder_exists, files.count-count_dir, selected_count);
@ -614,7 +605,7 @@ void DrawStatusBar()
void DrawFilePanels()
{
int files_y;
if (!two_panels)
if (!two_panels.checked)
{
DrawDeviceAndActionsLeftPanel();
files.SetSizes(192, 57, Form.cwidth - 210, Form.cheight - 59 - status_bar_h, files.item_h);
@ -801,7 +792,7 @@ void Open_Dir(dword dir_path, redraw){
}
if (files.count!=-1)
{
if(!_not_draw) if (show_breadcrumb) DrawBreadCrumbs(); else DrawPathBar();
if(!_not_draw) if (show_breadcrumb.checked) DrawBreadCrumbs(); else DrawPathBar();
history.add(#path);
SystemDiscs.Draw();
files.visible = files.h / files.item_h;
@ -831,7 +822,7 @@ inline Sorting()
}
for (j=files.count-1, file_off=files.count-1*304+buf+32; j>=0; j--, file_off-=304;) //files | folders
{
if (!real_files_names_case) strttl(file_off+40);
if (!show_real_names.checked) strttl(file_off+40);
if (TestBit(ESDWORD[file_off],4)) //directory?
{
file_mas[k]=j;
@ -893,7 +884,7 @@ void SelectFileByName(dword that_file)
int ind;
files.KeyHome();
Open_Dir(#path,ONLY_OPEN);
if (!real_files_names_case) strttl(that_file);
if (!show_real_names.checked) strttl(that_file);
for (ind=files.count-1; ind>=0; ind--;) { if (!strcmp(file_mas[ind]*304+buf+72,that_file)) break; }
files.cur_y = ind - 1;
files.KeyDown();
@ -1079,7 +1070,7 @@ void FnProcess(byte N)
if (!itdir) RunProgram("/sys/develop/heed", #file_path);
break;
case 5: //refresh cur dir & devs
if (two_panels)
if (two_panels.checked)
{
DrawFilePanels();
}

View File

@ -4,7 +4,7 @@
void about_dialog()
{
byte id;
int id;
proc_info about_form;
int about_x;

View File

@ -117,7 +117,7 @@ void PasteThread()
path_offset += strlen(path_offset) + 1;
}
cut_active=false;
if (info_after_copy) notify(INFO_AFTER_COPY);
if (info_after_copy.checked) notify(INFO_AFTER_COPY);
DialogExit();
}

View File

@ -9,7 +9,7 @@ void DrawIconByExtension(dword file_path, extension, xx, yy, fairing_color)
dword selected_image;
dword default_image;
if (big_icons) {
if (big_icons.checked) {
icons_ini.section = "icons32";
selected_image = icons32_selected.image;
default_image = icons32_default.image;
@ -35,7 +35,7 @@ void DrawIconByExtension(dword file_path, extension, xx, yy, fairing_color)
if (fairing_color==col_selec)
{
img_draw stdcall(selected_image, xx, yy, icon_size, icon_size, 0, icon_n*icon_size);
if (!big_icons) IconFairing(icon_n, xx, yy, fairing_color);
if (big_icons.checked==false) IconFairing(icon_n, xx, yy, fairing_color);
}
else
{

View File

@ -128,15 +128,15 @@ void _SystemDiscs::Draw()
for (i=0; i<30; i++) DeleteButton(100+i);
if ( two_panels) { draw_y = 41; draw_x = 2; draw_h = 21; }
if (!two_panels) { draw_y = 74; draw_x = 17; draw_h = 16; }
if ( two_panels.checked) { draw_y = 41; draw_x = 2; draw_h = 21; }
if (!two_panels.checked) { draw_y = 74; draw_x = 17; draw_h = 16; }
for (i=0;i<list.count;i++)
{
strcpy(#dev_name, list.get(i));
GetDiskIconAndName(dev_name[1], #dev_icon, #disc_name);
if (strstr(#path, #dev_name)-#path==0) is_active=true; else is_active=false;
if (two_panels)
if (two_panels.checked)
{
name_len = strlen(#dev_name)-1*8;
DrawBar(draw_x, draw_y, name_len + 31, draw_h, 0xFFFFFF);
@ -155,12 +155,11 @@ void _SystemDiscs::Draw()
DrawBar(draw_x,draw_y,6,draw_h+1,0xFFFFFF);
DrawBar(draw_x+6+18,draw_y,160-6-18,draw_h+1,0xFFFFFF);
DefineButton(draw_x,draw_y,159,16,100+i+BT_HIDE,0xFFFFFF);
if (show_dev_name)
if (show_dev_name.checked)
{
strcat(#disc_name, #dev_name);
if (is_active) WriteText(draw_x+30,draw_y+5,0x80,0x555555,#disc_name);
WriteText(draw_x+29,draw_y+5,0x80,0,#disc_name);
}
WriteText(draw_x+29,draw_y+5,0x80,0,#disc_name); }
else
{
if (is_active) WriteText(draw_x+30,draw_y+5,0x80,0x555555,#dev_name);
@ -170,7 +169,7 @@ void _SystemDiscs::Draw()
draw_y += draw_h;
}
}
if (two_panels)
if (two_panels.checked)
{
DrawBar(draw_x, draw_y, Form.cwidth - draw_x - 2, draw_h, 0xFFFFFF);
DefineButton(Form.cwidth - 23, draw_y+2, 17,16, 60+BT_HIDE, 0xCCCccc);

View File

@ -50,7 +50,21 @@ BDVK file_info_general;
BDVK file_info_dirsize;
proc_info settings_form;
bool quest_active, atr_readonly, atr_hidden, atr_system;
bool quest_active;
checkbox ch_read_only = { PR_T_ONLY_READ, NULL };
checkbox ch_hidden = { PR_T_HIDDEN, NULL };
checkbox ch_system = { PR_T_SYSTEM, NULL };
void SetPropertiesFile(dword cur_file, bdvk_pointer)
{
GetFileInfo(cur_file, bdvk_pointer);
ESI = bdvk_pointer;
ESI.BDVK.readonly = ch_read_only.checked;
ESI.BDVK.hidden = ch_hidden.checked;
ESI.BDVK.system = ch_system.checked;
SetFileInfo(cur_file, bdvk_pointer);
}
void SetPropertiesDir(dword way)
{
@ -70,11 +84,7 @@ void SetPropertiesDir(dword way)
{
SetPropertiesDir(cur_file);
}
GetFileInfo(cur_file, #file_info_dirsize);
file_info_dirsize.readonly = atr_readonly;
file_info_dirsize.hidden = atr_hidden;
file_info_dirsize.system = atr_system;
SetFileInfo(cur_file, #file_info_dirsize);
SetPropertiesFile(cur_file, #file_info_dirsize);
}
free(cur_file);
}
@ -95,11 +105,7 @@ void SetProperties(byte prop)
{
strcpy(cur_file, #path);
strcat(cur_file, file_mas[i]*304+buf+72);
GetFileInfo(cur_file, #file_info_general);
file_info_general.readonly = atr_readonly;
file_info_general.hidden = atr_hidden;
file_info_general.system = atr_system;
SetFileInfo(cur_file, #file_info_general);
SetPropertiesDir(cur_file);
if (prop==2)
{
if (dir_exists(cur_file))
@ -113,11 +119,7 @@ void SetProperties(byte prop)
}
else
{
GetFileInfo(#file_path, #file_info_general);
file_info_general.readonly = atr_readonly;
file_info_general.hidden = atr_hidden;
file_info_general.system = atr_system;
SetFileInfo(#file_path, #file_info_general);
SetPropertiesFile(#file_path, #file_info_general);
if (prop==2) SetPropertiesDir(#file_path);
}
quest_active = 0;
@ -125,11 +127,7 @@ void SetProperties(byte prop)
}
else
{
GetFileInfo(#file_path, #file_info_general);
file_info_general.readonly = atr_readonly;
file_info_general.hidden = atr_hidden;
file_info_general.system = atr_system;
SetFileInfo(#file_path, #file_info_general);
SetPropertiesFile(#file_path, #file_info_general);
}
cmd_free=3;
_not_draw = true;
@ -206,7 +204,7 @@ void GetSizeMoreFiles(dword way)
void properties_dialog()
{
byte id;
int id;
DSBYTE[#folder_info]=0;
file_count = 0;
@ -216,9 +214,9 @@ void properties_dialog()
if (selected_count)
{
GetSizeMoreFiles(#path);
atr_readonly = 0;
atr_hidden = 0;
atr_system = 0;
ch_read_only.checked = 0;
ch_hidden.checked = 0;
ch_system.checked = 0;
}
else
{
@ -226,9 +224,9 @@ void properties_dialog()
strcpy(#file_name2, #file_name);
file_name_ed.size = strlen(#file_name2);
if(itdir) GetSizeDir(#file_path);
atr_readonly = file_info_general.readonly;
atr_hidden = file_info_general.hidden;
atr_system = file_info_general.system;
ch_read_only.checked = file_info_general.readonly;
ch_hidden.checked = file_info_general.hidden;
ch_system.checked = file_info_general.system;
}
strcpy(#path_to_file, #path);
path_to_file_ed.size = strlen(#path_to_file);
@ -238,6 +236,9 @@ void properties_dialog()
{
case evButton:
id=GetButtonID();
ch_read_only.click(id);
ch_hidden.click(id);
ch_system.click(id);
if (quest_active)
{
IF (id==301) SetProperties(2);
@ -262,21 +263,6 @@ void properties_dialog()
}
break;
}
if (id==20)
{
atr_readonly ^= 1;
DrawPropertiesCheckBoxes();
}
if (id==21)
{
atr_hidden ^= 1;
DrawPropertiesCheckBoxes();
}
if (id==22)
{
atr_system ^= 1;
DrawPropertiesCheckBoxes();
}
break;
case evMouse:
@ -323,6 +309,7 @@ void properties_dialog()
void DrawPropertiesWindow()
{
dword ext1;
incn y;
char temp_path[sizeof(file_path)];
DefineAndDrawWindow(Form.left + 150,150,315,360+skin_height,0x34,system.color.work,WINDOW_TITLE_PROPERTIES,0);
GetProcessInfo(#settings_form, SelfInfo);
@ -373,7 +360,10 @@ void DrawPropertiesWindow()
WriteText(120, 99, 0x90, system.color.work_text, #element_size_label);
}
DrawFrame(10, 212, -10*2 + settings_form.cwidth - 2, 92, FLAGS);
DrawPropertiesCheckBoxes();
y.n = 212; //212 => attributes_frame.y
ch_read_only.draw(24, y.inc(18));
ch_hidden.draw(24, y.inc(24));
ch_system.draw(24, y.inc(24));
}
void PropertiesDrawIcon(dword file_path, extension)
@ -382,12 +372,3 @@ void PropertiesDrawIcon(dword file_path, extension)
DrawBar(20-ICON_PADDING, 30-ICON_PADDING-1, ICON_PADDING*2+16, ICON_PADDING*2+16, 0xFFFfff);
DrawIconByExtension(file_path, extension, 20, 30, system.color.work_light);
}
void DrawPropertiesCheckBoxes()
{
incn y;
y.n = 212; //212 => attributes_frame.y
CheckBox(24, y.inc(18), 20, PR_T_ONLY_READ, atr_readonly);
CheckBox(24, y.inc(24), 21, PR_T_HIDDEN, atr_hidden);
CheckBox(24, y.inc(24), 22, PR_T_SYSTEM, atr_system);
}

View File

@ -38,13 +38,20 @@ char path_start[4096]="\0";
edit_box path_start_ed = {290,50,57,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,4098,
#path_start,#set_mouse_dd, 100000000000010b,0,0};
more_less_box font_size = { NULL, 9, 22, FONT_SIZE_LABEL };
more_less_box font_size = { NULL, 9, 22, FONT_SIZE_LABEL };
more_less_box line_height = { NULL, 16, 64, LIST_LINE_HEIGHT };
checkbox show_dev_name = { SHOW_DEVICE_CLASS };
checkbox show_real_names = { SHOW_REAL_NAMES };
checkbox show_status_bar = { SHOW_STATUS_BAR };
checkbox info_after_copy = { NOTIFY_COPY_END };
checkbox show_breadcrumb = { SHOW_BREADCRUMBS };
checkbox big_icons = { BIG_ICONS };
checkbox two_panels = { USE_TWO_PANELS };
void settings_dialog()
{
byte id;
int id;
active_settings=1;
font_size.value = kfont.size.pt;
line_height.value = files.item_h;
@ -58,7 +65,7 @@ void settings_dialog()
case evButton:
id=GetButtonID();
if (id==1) { ExitSettings(); break; }
if (1==id) { ExitSettings(); break; }
else if (id==5)
{
RunProgram("tinypad", "/sys/settings/assoc.ini");
@ -78,40 +85,19 @@ void settings_dialog()
ini.SetString("DefaultPath", #path_start,strlen(#path_start));
break;
}
else if (id==20) show_dev_name ^= 1;
else if (id==21) { action_buf=109; real_files_names_case ^= 1; }
else if (id==22) info_after_copy ^= 1;
else if (id==24) two_panels ^= true;
else if (id==32) show_breadcrumb ^= true;
else if (id==27) show_status_bar ^= 1;
else if (font_size.click(id)) {
show_dev_name.click(id);
if (show_real_names.click(id)) action_buf=109;
info_after_copy.click(id);
two_panels.click(id);
show_breadcrumb.click(id);
show_status_bar.click(id);
if (font_size.click(id)) {
kfont.size.pt = font_size.value;
kfont.changeSIZE();
BigFontsChange();
}
else if (line_height.click(id)) {
files.item_h = line_height.value;
}
else if (id==33) {
big_icons ^= 1;
if (big_icons) {
icon_size=32;
files.item_h = line_height.value = 34;
if (!icons32_default.image)
{
Libimg_LoadImage(#icons32_default, "/sys/icons32.png");
Libimg_LoadImage(#icons32_selected, "/sys/icons32.png");
Libimg_ReplaceColor(icons32_default.image, icons32_selected.w,
icons32_selected.h, 0x00000000, 0xffFFFfff);
Libimg_ReplaceColor(icons32_selected.image, icons32_selected.w,
icons32_selected.h, 0x00000000, col_selec);
}
}
else {
icon_size=16;
files.item_h = line_height.value = 18;
}
}
if (line_height.click(id)) files.item_h = line_height.value;
if (big_icons.click(id)) BigIconsSwitch();
EventRedrawWindow(Form.left,Form.top);
break;
@ -143,13 +129,13 @@ void DrawSettingsCheckBoxes()
incn y;
int x=11, frx=26, but_x;
y.n = 0;
CheckBox(x, y.inc(14), 20, SHOW_DEVICE_CLASS, show_dev_name);
CheckBox(x, y.inc(25), 21, SHOW_REAL_NAMES, real_files_names_case);
CheckBox(x, y.inc(25), 27, SHOW_STATUS_BAR, show_status_bar);
CheckBox(x, y.inc(25), 22, NOTIFY_COPY_END, info_after_copy);
CheckBox(x, y.inc(25), 32, SHOW_BREADCRUMBS, show_breadcrumb);
CheckBox(x, y.inc(25), 33, BIG_ICONS, big_icons);
CheckBox(x, y.inc(25), 24, USE_TWO_PANELS, two_panels);
show_dev_name.draw(x, y.inc(14));
show_real_names.draw(x, y.inc(25));
show_status_bar.draw(x, y.inc(25));
info_after_copy.draw(x, y.inc(25));
show_breadcrumb.draw(x, y.inc(25));
big_icons.draw(x, y.inc(25));
two_panels.draw(x, y.inc(25));
font_size.draw(x, y.inc(31));
line_height.draw(x, y.inc(31));
@ -172,12 +158,12 @@ void LoadIniSettings()
ini.section = "Config";
files.SetFont(6, 9, 10000000b);
real_files_names_case = ini.GetInt("RealFileNamesCase", 1);
show_dev_name = ini.GetInt("ShowDeviceName", 1);
show_status_bar = ini.GetInt("ShowStatusBar", 1);
info_after_copy = ini.GetInt("InfoAfterCopy", 0);
show_real_names.checked = ini.GetInt("RealFileNamesCase", true);
show_dev_name.checked = ini.GetInt("ShowDeviceName", true);
show_status_bar.checked = ini.GetInt("ShowStatusBar", true);
info_after_copy.checked = ini.GetInt("InfoAfterCopy", false);
two_panels.checked = ini.GetInt("TwoPanels", false);
kfont.size.pt = ini.GetInt("FontSize", 13);
two_panels = ini.GetInt("TwoPanels", 0);
files.item_h = ini.GetInt("LineHeight", 19);
WinX = ini.GetInt("WinX", 200);
WinY = ini.GetInt("WinY", 50);
@ -197,12 +183,12 @@ void LoadIniSettings()
void SaveIniSettings()
{
ini.SetInt("ShowDeviceName", show_dev_name);
ini.SetInt("ShowStatusBar", show_status_bar);
ini.SetInt("RealFileNamesCase", real_files_names_case);
ini.SetInt("InfoAfterCopy", info_after_copy);
ini.SetInt("ShowDeviceName", show_dev_name.checked);
ini.SetInt("ShowStatusBar", show_status_bar.checked);
ini.SetInt("RealFileNamesCase", show_real_names.checked);
ini.SetInt("InfoAfterCopy", info_after_copy.checked);
ini.SetInt("FontSize", kfont.size.pt);
ini.SetInt("TwoPanels", two_panels);
ini.SetInt("TwoPanels", two_panels.checked);
ini.SetInt("LineHeight", files.item_h);
ini.SetInt("WinX", Form.left);
ini.SetInt("WinY", Form.top);
@ -245,3 +231,25 @@ void BigFontsChange()
if (files.item_h<18) files.item_h = 18;
files_active.item_h = files_inactive.item_h = files.item_h;
}
void BigIconsSwitch()
{
if (big_icons.checked)
{
icon_size=32;
files.item_h = line_height.value = 34;
if (!icons32_default.image)
{
Libimg_LoadImage(#icons32_default, "/sys/icons32.png");
Libimg_LoadImage(#icons32_selected, "/sys/icons32.png");
Libimg_ReplaceColor(icons32_default.image, icons32_selected.w,
icons32_selected.h, 0x00000000, 0xffFFFfff);
Libimg_ReplaceColor(icons32_selected.image, icons32_selected.w,
icons32_selected.h, 0x00000000, col_selec);
}
}
else {
icon_size=16;
files.item_h = line_height.value = 18;
}
}

View File

@ -29,7 +29,7 @@ enum {
========================================================*/
void main()
byte id;
int id;
{
loop() switch(WaitEvent())
{

View File

@ -9,14 +9,14 @@
proc_info Form;
enum {
STRONG_BTN=10, SMOOTH_BTN,
PHRASE_TAB=20, CHARS_TAB
};
_tabs tabs = { 0,0, WIN_W, WIN_H, PHRASE_TAB};
block preview = { 0, PANELH, WIN_W, WIN_H - PANELH };
checkbox bold = { "Bold", false };
checkbox smooth = { "Smooth", true };
void main()
{
@ -31,8 +31,8 @@ void main()
case evButton:
btn = GetButtonID();
if (btn==1) ExitProcess();
if (btn==STRONG_BTN) kfont.bold ^=1;
if (btn==SMOOTH_BTN) kfont.smooth ^=1;
if (bold.click(btn)) kfont.bold = bold.checked;
if (smooth.click(btn)) kfont.smooth = smooth.checked;
if (btn==PHRASE_TAB) || (btn==CHARS_TAB) tabs.click(btn);
goto _DRAW_WINDOW_CONTENT;
case evReDraw:
@ -44,8 +44,8 @@ void main()
DrawBar(0, 0, Form.cwidth, PANELH-1, system.color.work);
DrawBar(0, PANELH-1,Form.cwidth,1,system.color.work_graph);
CheckBox(10, 8, STRONG_BTN, "Bold", kfont.bold);
CheckBox(83,8, SMOOTH_BTN, "Smooth", kfont.smooth);
bold.draw(10, 8);
smooth.draw(83,8);
tabs.draw_button(Form.cwidth-130, PHRASE_TAB, "Phrase");
tabs.draw_button(Form.cwidth-60, CHARS_TAB, "Chars");

View File

@ -21,7 +21,7 @@
#include "../lib/gui/more_less_box.h"
#include "../lib/gui/checkbox.h"
int last_free_button_id = 1000;
:int last_free_button_id = 1000;
:int GetFreeButtonId()
{
last_free_button_id++;

View File

@ -33,27 +33,57 @@
0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04
};
:void CheckBox(dword x,y,bt_id, text, is_checked)
struct checkbox
{
byte w=14, h=14;
DefineButton(x-1, y-1, strlen(text)*8 + w + 17, h+2, bt_id+BT_HIDE+BT_NOFRAME, 0);
EDI = system.color.work;
WriteText(x+w+8, h / 2 + y -7, 0xD0, system.color.work_text, text);
DrawRectangle(x, y, w, h, system.color.work_graph);
if (is_checked == 0)
{
DrawRectangle3D(x+1, y+1, w-2, h-2, 0xDDDddd, 0xffffff);
DrawBar(x+2, y+2, w-3, h-3, 0xffffff);
dword text;
bool checked;
bool disabled;
dword x,y, id;
bool click();
void draw();
void redraw();
};
:bool checkbox::click(dword _id)
{
if (disabled) return 0;
if (_id == id) {
checked^=1;
redraw();
return 1;
}
else if (is_checked == 1)
return 0;
}
:void checkbox::draw(dword _x,_y)
{
#define SIZE 14
if (!id) id = GetFreeButtonId();
x=_x; y=_y;
DefineButton(x-1, y-1, strlen(text)*8 + SIZE + 17, SIZE+2, id+BT_HIDE+BT_NOFRAME, 0);
EDI = system.color.work;
WriteText(x+SIZE+8, SIZE / 2 + y -7, 0xD0, system.color.work_text, text);
DrawRectangle(x, y, SIZE, SIZE, system.color.work_graph);
if (checked == 0)
{
DrawWideRectangle(x+1, y+1, w-1, h-1, 2, 0xffffff);
DrawRectangle3D(x+1, y+1, SIZE-2, SIZE-2, 0xDDDddd, 0xffffff);
DrawBar(x+2, y+2, SIZE-3, SIZE-3, 0xffffff);
}
else if (checked == 1)
{
DrawWideRectangle(x+1, y+1, SIZE-1, SIZE-1, 2, 0xffffff);
_PutImage(x+1, y+1, 13, 13, #checkbox_flag);
}
else if (is_checked == 2) //not active
else if (checked == 2) //not active
{
DrawWideRectangle(x+1, y+1, w-1, h-1, 2, 0xffffff);
DrawBar(x+3, y+3, w-5, h-5, 0x888888);
DrawWideRectangle(x+1, y+1, SIZE-1, SIZE-1, 2, 0xffffff);
DrawBar(x+3, y+3, SIZE-5, SIZE-5, 0x888888);
}
DrawRectangle3D(x-1,y-1,w+2,h+2,system.color.work_dark,system.color.work_light);
DrawRectangle3D(x-1,y-1,SIZE+2,SIZE+2,system.color.work_dark,system.color.work_light);
}
:void checkbox::redraw()
{
draw(x,y);
}

View File

@ -613,14 +613,9 @@ inline fastcall dword GetStartTime()
:dword X_EventRedrawWindow,Y_EventRedrawWindow;
:void _EventRedrawWindow()
{
loop()switch(WaitEvent())
{
case evReDraw:
DefineAndDrawWindow(X_EventRedrawWindow,Y_EventRedrawWindow,100,1,0x34,0xFFFFFF,NULL,0);
pause(10);
ExitProcess();
break;
}
DefineAndDrawWindow(X_EventRedrawWindow,Y_EventRedrawWindow,1,1,0x34,0xFFFFFF,NULL,0);
//pause(10);
ExitProcess();
}
:char REDRAW_BUFF_EVENT_[4096];
:void EventRedrawWindow(dword x,y)

View File

@ -206,13 +206,13 @@ void GetSettings()
strcpy(#login, #email_text);
ESBYTE[strchr(#login,'@')] = NULL;
if (checked[CUSTOM])
if (automatic.checked)
{
strcpy(#POP_server_path, "pop.");
strcat(#POP_server_path, strchr(#email_text,'@')+1);
POP_server_port = DEFAULT_POP_PORT;
}
if (checked[MANUAL])
else
{
strcpy(#POP_server_path, #POP_server1);
POP_server_port = atoi(#POP_server_port1);

View File

@ -1,9 +1,5 @@
//Leency & SoUrcerer, LGPL
#define CUSTOM 0
#define MANUAL 1
char checked[3] = { 1, 0 };
char *text1[] = {"POP server adress:", "POP server port:", "SMTP server adress:", "SMTP server port:", '\0'};
dword mouse_opt;
@ -16,6 +12,7 @@ edit_box POP_server_port_box = {210,230,160,0xffffff,0x94AECE,0xffc90E,0xCACAC
edit_box SMTP_server_box = {210,230,195,0xffffff,0x94AECE,0xffc90E,0xCACACA,0x10000000,sizeof(SMTP_server1),#SMTP_server1,#mouse_opt,100000000000b};
edit_box SMTP_server_port_box = {210,230,230,0xffffff,0x94AECE,0xffc90E,0xCACACA,0x10000000,5,#SMTP_server_port1,#mouse_opt,100000000000b};
checkbox automatic = { "Automatic configuration", true };
void SettingsDialog()
{
@ -44,29 +41,27 @@ void SettingsDialog()
id = GetButtonID();
if (id==1) SaveAndExit();
if (id==19) LoginBoxLoop();
if (id==17) || (id==18)
if (automatic.click(id))
{
if (checked[id-17]==1) break;
checked[0]><checked[1];
if (checked[1]) {
if (automatic.checked) {
POP_server_box.flags = POP_server_box.flags = POP_server_port_box.flags = SMTP_server_box.flags = SMTP_server_port_box.flags = 100000000000b;
POP_server_box.blur_border_color = POP_server_box.blur_border_color = POP_server_port_box.blur_border_color =
SMTP_server_box.blur_border_color = SMTP_server_port_box.blur_border_color = 0xCACACA;
}
else {
POP_server_box.flags = 0b10;
POP_server_port_box.flags = SMTP_server_box.flags = SMTP_server_port_box.flags = 0b;
POP_server_box.blur_border_color = POP_server_box.blur_border_color = POP_server_port_box.blur_border_color =
SMTP_server_box.blur_border_color = SMTP_server_port_box.blur_border_color = 0xFFFfff;
}
else {
POP_server_box.flags = POP_server_box.flags = POP_server_port_box.flags = SMTP_server_box.flags = SMTP_server_port_box.flags = 100000000000b;
POP_server_box.blur_border_color = POP_server_box.blur_border_color = POP_server_port_box.blur_border_color =
SMTP_server_box.blur_border_color = SMTP_server_port_box.blur_border_color = 0xCACACA;
}
OptionsWindow();
DrawOptionsWindow();
}
break;
case evKey:
GetKeys();;
if (checked[1]==0) break;
if (automatic.checked==true) break;
if (key_scancode==SCAN_CODE_TAB)
{
if (POP_server_box.flags & 0b10) { POP_server_box.flags -= 0b10; POP_server_port_box.flags += 0b10; } else
@ -74,7 +69,7 @@ void SettingsDialog()
if (SMTP_server_box.flags & 0b10) { SMTP_server_box.flags -= 0b10; SMTP_server_port_box.flags += 0b10; } else
if (SMTP_server_port_box.flags & 0b10) { SMTP_server_port_box.flags -= 0b10; POP_server_box.flags += 0b10; } else
POP_server_box.flags = 0b10;
OptionsWindow();
DrawOptionsWindow();
}
EAX=key_ascii<<8;
@ -87,13 +82,13 @@ void SettingsDialog()
case evReDraw: _OPT_WIN:
if !(DefineWindow(OPTIONS_HEADER)) break;
DrawBar(0,0, Form.cwidth, Form.cheight, system.color.work);
OptionsWindow();
DrawOptionsWindow();
break;
}
}
}
void OptionsWindow()
void DrawOptionsWindow()
{
#define ELEM_X 25
int i;
@ -104,8 +99,7 @@ void OptionsWindow()
DrawCaptButton(Form.cwidth-79, Form.cheight-32, 70, 25, 19, system.color.work_button, system.color.work_button_text,"Apply");
WriteText(ELEM_X, y.inc(20), 0x81, system.color.work_text, "Network settings");
CheckBox(ELEM_X, y.inc(35), 17, "Use custom settings", checked[0]);
CheckBox(ELEM_X, y.inc(30), 18, "Manual configuration", checked[1]);
automatic.draw(ELEM_X, y.inc(65));
EDI = system.color.work;
for (i=0; i<4; i++) WriteText(ELEM_X+40, i*35+POP_server_box.top + 3, 0xD0, system.color.work_text, text1[i]);
DrawEditBox(#POP_server_box);

View File

@ -34,30 +34,27 @@
?define MOUSE_EMULATION "Enable mouse emulation using keyboard NumPad"
?define MADMOUSE "Through screen sides for pointer"
#endif
proc_info Form;
#define PD 18 //padding
block mouse_frame = { PD, PD, NULL, 130 };
block mouse_frame = { 18, 18, NULL, 130 };
more_less_box pointer_speed = { NULL, 0, 64, POINTER_SPEED };
more_less_box acceleration = { NULL, 0, 64, ACCELERATION_TEXT };
more_less_box double_click_delay = { NULL, 0, 999, DOUBLE_CLICK_TEXT, 8 };
checkbox emulation = { MOUSE_EMULATION, NULL };
checkbox madmouse = { MADMOUSE, NULL };
unsigned char panels_img_data[] = FROM "mouse_image.raw";
raw_image panels_img = { 59, 101, #panels_img_data };
_ini ini = { "/sys/settings/system.ini", "mouse" };
struct _mouse_cfg {
bool emulation;
bool madmouse;
int click_status;
} mouse_cfg;
void main() {
char id;
int click_status;
load_dll(libini, #lib_init,1);
load_dll(boxlib, #box_lib_init,0);
@ -70,40 +67,31 @@ void main() {
{
case evMouse:
mouse.get();
if (mouse.down) && (mouse_cfg.click_status==0) && (mouse_frame.hovered()) {
if (mouse.key&MOUSE_LEFT) mouse_cfg.click_status = 1;
if (mouse.key&MOUSE_RIGHT) mouse_cfg.click_status = 2;
if (mouse.key&MOUSE_CENTER) mouse_cfg.click_status = 3;
DrawMouseImage();
if (mouse.down) && (click_status==0) && (mouse_frame.hovered()) {
if (mouse.key&MOUSE_LEFT) click_status = 1;
if (mouse.key&MOUSE_RIGHT) click_status = 2;
if (mouse.key&MOUSE_CENTER) click_status = 3;
DrawMouseImage(click_status);
}
if (mouse.up) {
mouse_cfg.click_status=0;
DrawMouseImage();
click_status=0;
DrawMouseImage(click_status);
}
break;
case evButton:
id = GetButtonID();
switch (id) {
case 1:
ExitApp();
break;
case 100:
if (mouse_cfg.emulation==true) KillProcessByName("mousemul", SINGLE);
else RunProgram("/sys/mousemul", 0);
mouse_cfg.emulation ^= 1;
DrawControls();
break;
case 101:
if (mouse_cfg.madmouse==true) KillProcessByName("madmouse", SINGLE);
else RunProgram("/sys/madmouse", 0);
mouse_cfg.madmouse ^= 1;
DrawControls();
break;
default:
if (pointer_speed.click(id)) ApplyCfg();;
if (acceleration.click(id)) ApplyCfg();;
if (double_click_delay.click(id)) ApplyCfg();;
if (1==id) ExitApp();
if (pointer_speed.click(id)) ApplyCfg();;
if (acceleration.click(id)) ApplyCfg();;
if (double_click_delay.click(id)) ApplyCfg();;
if (emulation.click(id)) {
if (emulation.checked==true) KillProcessByName("mousemul", SINGLE);
else RunProgram("/sys/mousemul", 0);
}
if (madmouse.click(id)) {
if (madmouse.checked==true) KillProcessByName("madmouse", SINGLE);
else RunProgram("/sys/madmouse", 0);
}
break;
@ -128,25 +116,28 @@ void main() {
}
void DrawMouseImage() {
void DrawMouseImage(dword status) {
_PutImage(mouse_frame.x+30, mouse_frame.y + 15, panels_img.w, panels_img.h,
mouse_cfg.click_status * panels_img.w * panels_img.h * 3 + panels_img.data);
status * panels_img.w * panels_img.h * 3 + panels_img.data);
}
void DrawControls() {
pointer_speed.draw(PD, PD+142);
acceleration.draw(PD, PD+172);
double_click_delay.draw(PD+202);
CheckBox(mouse_frame.x, mouse_frame.y + 236, 100, MOUSE_EMULATION, mouse_cfg.emulation);
CheckBox(mouse_frame.x, mouse_frame.y + 262, 101, MADMOUSE, mouse_cfg.madmouse);
int x = mouse_frame.x;
incn y;
y.n = mouse_frame.y+115;
pointer_speed.draw(x, y.inc(30));
acceleration.draw(x, y.inc(30));
double_click_delay.draw(x, y.inc(30));
emulation.draw(x, y.inc(33));
madmouse.draw(x, y.inc(27));
}
void LoadCfg() {
acceleration.value = ini.GetInt("acceleration", GetMouseAcceleration());
pointer_speed.value = ini.GetInt("speed", GetMouseSpeed());
double_click_delay.value = ini.GetInt("double_click_delay", GetMouseDoubleClickDelay());
mouse_cfg.madmouse = CheckProcessExists("MADMOUSE");
mouse_cfg.emulation = CheckProcessExists("MOUSEMUL");
madmouse.checked = CheckProcessExists("MADMOUSE");
emulation.checked = CheckProcessExists("MOUSEMUL");
}
void ExitApp() {

View File

@ -65,22 +65,30 @@ raw_image panels_img = { 37, 27, #panels_img_data };
proc_info Form;
word dkFsize;
byte dkLocation, dkAshow;
byte tbAttachment, tbSoftenUp, tbSoftenDown, tbMinLeftButton, tbMinRightButton,
tbMenuButton, tbRunApplButton, tbClnDeskButton, tbClock, tbCpuUsage, tbChangeLang;
enum {
TASKBAR,
DOCKY,
ALL
};
enum { BTN_TB_ATTACHEMENT=100, BTN_DOCKY_ATTACHEMENT=200 };
enum { TASKBAR, DOCKY };
more_less_box tbPanelHeight = { NULL, 6, 99, PANEL_HEIGHT };
more_less_box tbSoftenHeight = { NULL, 0, 99, SOFTEN_HEIGHT };
more_less_box tbButtonOffset = { NULL, 0, 99, BUTTON_OFFSET };
int tbAttachment;
checkbox tbSoftenUp = { SOFTEN_UP };
checkbox tbClock = { CLOCK };
checkbox tbSoftenDown = { SOFTEN_DOWN };
checkbox tbCpuUsage = { CPU_USAGE };
checkbox tbMinLeftButton = { MIN_LEFT_BUTTON };
checkbox tbChangeLang = { CHANGE_LANG };
checkbox tbMinRightButton = { MIN_RIGHT_BUTTON };
checkbox tbMenuButton = { MENU_BUTTON };
checkbox dkFsize = { FSIZE };
checkbox dkAshow = { ASHOW };
int dkLocation;
checkbox tbRunApplButton;
checkbox tbClnDeskButton;
void main()
{
dword id, key;
@ -94,42 +102,35 @@ void main()
{
case evButton:
id=GetButtonID();
if (id==1) ExitProcess();
if (1==id) ExitProcess();
//taskbar buttons
if (id>=100) && (id<200)
{
if (id==100) tbAttachment ^= 1;
if (id==105) tbSoftenUp ^= 1;
if (id==106) tbSoftenDown ^= 1;
if (id==107) tbMinLeftButton ^= 1;
if (id==108) tbMinRightButton ^= 1;
if (id==109) tbRunApplButton ^= 1;
if (id==110) tbClnDeskButton ^= 1;
if (id==111) tbClock ^= 1;
if (id==112) tbCpuUsage ^= 1;
if (id==113) tbChangeLang ^= 1;
if (id==114) tbMenuButton ^= 1;
tbPanelHeight.click(id);
tbSoftenHeight.click(id);
tbButtonOffset.click(id);
DrawWindowContent(TASKBAR);
SaveCfg(TASKBAR);
RestartProcess(TASKBAR);
if (BTN_TB_ATTACHEMENT == id) {
tbAttachment ^= 1;
DrawWindowContent();
SaveSettingsAndRestartProcess(TASKBAR);
}
if (tbSoftenUp.click(id)) || (tbSoftenDown.click(id))
|| (tbMinLeftButton.click(id)) || (tbMinRightButton.click(id))
|| (tbRunApplButton.click(id)) || (tbClnDeskButton.click(id)) {
SaveSettingsAndRestartProcess(TASKBAR);
}
if (tbClock.click(id)) || (tbCpuUsage.click(id))
|| (tbChangeLang.click(id)) || (tbMenuButton.click(id))
|| (tbPanelHeight.click(id)) || (tbSoftenHeight.click(id))
|| (tbButtonOffset.click(id)) {
SaveSettingsAndRestartProcess(TASKBAR);
}
//docky buttons
if (id>=200)
{
if (id==200)
{
dkLocation++;
if (dkLocation>3) dkLocation=1;
}
if (id==201) dkFsize ^= 1;
if (id==202) dkAshow ^= 1;
DrawWindowContent(DOCKY);
SaveCfg(DOCKY);
RestartProcess(DOCKY);
if (id==200) {
dkLocation++;
if (dkLocation>3) dkLocation=1;
DrawWindowContent();
SaveSettingsAndRestartProcess(DOCKY);
}
if (dkFsize.click(id)) SaveSettingsAndRestartProcess(DOCKY);
if (dkAshow.click(id)) SaveSettingsAndRestartProcess(DOCKY);
break;
case evKey:
@ -142,84 +143,79 @@ void main()
DefineAndDrawWindow(130, 150, 465, 398 + skin_height, 0x34, system.color.work, WINDOW_TITLE, 0);
GetProcessInfo(#Form, SelfInfo);
if (Form.status_window>2) break;
DrawWindowContent(ALL);
DrawWindowContent();
}
}
void DrawWindowContent(byte panel_type)
void DrawWindowContent()
{
#define PD 10
dword frame_y;
word win_center_x = Form.cwidth / 2 + 20;
incn y;
if (panel_type==ALL) || (panel_type==TASKBAR)
{
frame_y = 15;
y.n = frame_y;
DefineButton(22, y.inc(18), panels_img.w-1, 27-1, 100 + BT_HIDE, 0);
_PutImage(22, y.n, 37, 27, tbAttachment * 37 * 27 * 3 + panels_img.data);
WriteText(68, y.inc(7), 0x90, system.color.work_text, CHANGE_POS);
CheckBox(22, y.inc(35), 105, SOFTEN_UP, tbSoftenUp);
CheckBox(win_center_x, y.n, 111, CLOCK, tbClock);
CheckBox(22, y.inc(24), 106, SOFTEN_DOWN, tbSoftenDown);
CheckBox(win_center_x, y.n, 112, CPU_USAGE, tbCpuUsage);
CheckBox(22, y.inc(24), 107, MIN_LEFT_BUTTON, tbMinLeftButton);
CheckBox(win_center_x, y.n, 113, CHANGE_LANG, tbChangeLang);
CheckBox(22, y.inc(24), 108, MIN_RIGHT_BUTTON, tbMinRightButton);
CheckBox(win_center_x, y.n, 114, MENU_BUTTON, tbMenuButton);
tbPanelHeight.draw(22, y.inc(28));
tbSoftenHeight.draw(22, y.inc(32));
tbButtonOffset.draw(22, y.inc(32));
DrawFrame(PD, frame_y, Form.cwidth-PD-PD, y.inc(32)-frame_y, TASK_FRAME_T);
}
if (panel_type==ALL) || (panel_type==DOCKY)
{
frame_y = calc(y.inc(20));
DefineButton(22, y.inc(18), panels_img.w-1, 27-1, 200 + BT_HIDE, 0);
_PutImage(22, y.n, 37, 27, dkLocation + 1 * 37 * 27 * 3 + panels_img.data);
WriteText(68, y.inc(7), 0x90, system.color.work_text, CHANGE_POS);
CheckBox(22, y.inc(35), 201, FSIZE, dkFsize);
CheckBox(win_center_x, y.n, 202, ASHOW, dkAshow);
DrawFrame(PD, frame_y, Form.cwidth-PD-PD, Form.cheight-frame_y-PD, DOCK_FRAME_T);
}
frame_y = 15;
y.n = frame_y;
DefineButton(22, y.inc(18), panels_img.w-1, 27-1, 100 + BT_HIDE, 0);
_PutImage(22, y.n, 37, 27, tbAttachment * 37 * 27 * 3 + panels_img.data);
WriteText(68, y.inc(7), 0x90, system.color.work_text, CHANGE_POS);
tbSoftenUp.draw(22, y.inc(35));
tbClock.draw(win_center_x, y.n);
tbSoftenDown.draw(22, y.inc(24));
tbCpuUsage.draw(win_center_x, y.n);
tbMinLeftButton.draw(22, y.inc(24));
tbChangeLang.draw(win_center_x, y.n);
tbMinRightButton.draw(22, y.inc(24));
tbMenuButton.draw(win_center_x, y.n);
tbPanelHeight.draw(22, y.inc(28));
tbSoftenHeight.draw(22, y.inc(32));
tbButtonOffset.draw(22, y.inc(32));
DrawFrame(PD, frame_y, Form.cwidth-PD-PD, y.inc(32)-frame_y, TASK_FRAME_T);
//DOCKY
frame_y = calc(y.inc(20));
DefineButton(22, y.inc(18), panels_img.w-1, 27-1, 200 + BT_HIDE, 0);
_PutImage(22, y.n, 37, 27, dkLocation + 1 * 37 * 27 * 3 + panels_img.data);
WriteText(68, y.inc(7), 0x90, system.color.work_text, CHANGE_POS);
dkFsize.draw(22, y.inc(35));
dkAshow.draw(win_center_x, y.n);
DrawFrame(PD, frame_y, Form.cwidth-PD-PD, Form.cheight-frame_y-PD, DOCK_FRAME_T);
}
void LoadCfg()
{
tbAttachment = taskbar_flags_ini.GetInt("Attachment", 1);
tbSoftenUp = taskbar_flags_ini.GetInt("SoftenUp", 1);
tbSoftenDown = taskbar_flags_ini.GetInt("SoftenDown", 1);
tbMinLeftButton = taskbar_flags_ini.GetInt("MinLeftButton", 1);
tbMinRightButton = taskbar_flags_ini.GetInt("MinRightButton", 1);
tbClock = taskbar_flags_ini.GetInt("Clock", 1);
tbCpuUsage = taskbar_flags_ini.GetInt("CpuUsage", 1);
tbChangeLang = taskbar_flags_ini.GetInt("ChangeLang", 1);
tbMenuButton = taskbar_flags_ini.GetInt("MenuButton", 1);
tbAttachment = taskbar_flags_ini.GetInt("Attachment", 1);
tbSoftenUp.checked = taskbar_flags_ini.GetInt("SoftenUp", 1);
tbSoftenDown.checked = taskbar_flags_ini.GetInt("SoftenDown", 1);
tbMinLeftButton.checked = taskbar_flags_ini.GetInt("MinLeftButton", 1);
tbMinRightButton.checked = taskbar_flags_ini.GetInt("MinRightButton", 1);
tbClock.checked = taskbar_flags_ini.GetInt("Clock", 1);
tbCpuUsage.checked = taskbar_flags_ini.GetInt("CpuUsage", 1);
tbChangeLang.checked = taskbar_flags_ini.GetInt("ChangeLang", 1);
tbMenuButton.checked = taskbar_flags_ini.GetInt("MenuButton", 1);
tbPanelHeight.value = taskbar_vars_ini.GetInt("PanelHeight", 28);
tbSoftenHeight.value = taskbar_vars_ini.GetInt("SoftenHeight", 4);
tbButtonOffset.value = taskbar_vars_ini.GetInt("ButtonTopOffset", 3);
tbButtonOffset.value = taskbar_vars_ini.GetInt("ButtonBotOffset", 3);
dkLocation = docky_ini.GetInt("location", 0);
dkFsize = docky_ini.GetInt("fsize", 0);
dkAshow = docky_ini.GetInt("ashow", 0);
dkFsize.checked = docky_ini.GetInt("fsize", 0);
dkAshow.checked = docky_ini.GetInt("ashow", 0);
}
void SaveCfg(byte panel_type)
void SaveSettingsAndRestartProcess(byte panel_type)
{
if (panel_type==TASKBAR) {
taskbar_flags_ini.SetInt("Attachment", tbAttachment);
taskbar_flags_ini.SetInt("SoftenUp", tbSoftenUp);
taskbar_flags_ini.SetInt("SoftenDown", tbSoftenDown);
taskbar_flags_ini.SetInt("MinLeftButton", tbMinLeftButton);
taskbar_flags_ini.SetInt("MinRightButton", tbMinRightButton);
taskbar_flags_ini.SetInt("RunApplButton", tbRunApplButton);
taskbar_flags_ini.SetInt("ClnDeskButton", tbClnDeskButton);
taskbar_flags_ini.SetInt("Clock", tbClock);
taskbar_flags_ini.SetInt("CpuUsage", tbCpuUsage);
taskbar_flags_ini.SetInt("ChangeLang", tbChangeLang);
taskbar_flags_ini.SetInt("MenuButton", tbMenuButton);
taskbar_flags_ini.SetInt("SoftenUp", tbSoftenUp.checked);
taskbar_flags_ini.SetInt("SoftenDown", tbSoftenDown.checked);
taskbar_flags_ini.SetInt("MinLeftButton", tbMinLeftButton.checked);
taskbar_flags_ini.SetInt("MinRightButton", tbMinRightButton.checked);
taskbar_flags_ini.SetInt("RunApplButton", tbRunApplButton.checked);
taskbar_flags_ini.SetInt("ClnDeskButton", tbClnDeskButton.checked);
taskbar_flags_ini.SetInt("Clock", tbClock.checked);
taskbar_flags_ini.SetInt("CpuUsage", tbCpuUsage.checked);
taskbar_flags_ini.SetInt("ChangeLang", tbChangeLang.checked);
taskbar_flags_ini.SetInt("MenuButton", tbMenuButton.checked);
taskbar_vars_ini.SetInt("PanelHeight", tbPanelHeight.value);
taskbar_vars_ini.SetInt("SoftenHeight", tbSoftenHeight.value);
taskbar_vars_ini.SetInt("ButtonTopOffset", tbButtonOffset.value);
@ -227,9 +223,10 @@ void SaveCfg(byte panel_type)
}
if (panel_type==DOCKY) {
docky_ini.SetInt("location", dkLocation);
docky_ini.SetInt("fsize", dkFsize);
docky_ini.SetInt("ashow", dkAshow);
docky_ini.SetInt("fsize", dkFsize.checked);
docky_ini.SetInt("ashow", dkAshow.checked);
}
RestartProcess(panel_type);
}
void RestartProcess(byte panel_type)

View File

@ -36,10 +36,11 @@ enum {
};
int current_process_id = 0;
int show_system;
unsigned maxcpu;
int proc_list[256];
checkbox show_system = { T_SHOW_SYSTEM_PROCESSES, false };
//===================================================//
// //
// CODE //
@ -55,7 +56,7 @@ void GetCpuFrequency() {
void main()
{
byte btn;
int btn;
load_dll(boxlib, #box_lib_init,0);
SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);
GetCpuFrequency();
@ -78,10 +79,8 @@ void main()
{
ExitProcess();
}
if (BTN_ID_SHOW_SYSTEM_PROCESSES == btn)
if (show_system.click(btn))
{
show_system ^= 1;
Draw_ShowSystemProcessesCheckbox();
SelectList_LineChanged();
}
if (BTN_ID_KILL_PROCESS == btn)
@ -114,7 +113,7 @@ void main()
select_list.y+select_list.h+5,
110,25,BTN_ID_SHOW_PROCESS_INFO,
system.color.work_button, system.color.work_button_text, T_DETAILS);
Draw_ShowSystemProcessesCheckbox();
show_system.draw(select_list.x + 3, select_list.y+select_list.h+10);
default:
SelectList_LineChanged();
}
@ -138,7 +137,7 @@ void GetProcessList()
if (Process.name)
{
for (j=0; j<11; j++) if (Process.name[j]!=' ') {
if (show_system==false) {
if (show_system.checked==false) {
//do not show system process
if (Process.name[0]=='@') break;
if (!strcmp(#Process.name, "IDLE")) break;
@ -174,11 +173,6 @@ void SelectList_DrawLine(dword i)
}
void Draw_ShowSystemProcessesCheckbox() {
CheckBox(select_list.x + 3, select_list.y+select_list.h+10, 20,
T_SHOW_SYSTEM_PROCESSES, show_system);
}

View File

@ -59,7 +59,7 @@ dword COLOR_TEXT = 0xFFFfff;
void main()
{
byte btn;
int btn;
load_dll(libio, #libio_init,1);
load_dll(libimg, #libimg_init,1);
load_dll(libini, #lib_init,1);