/programs/cmm/appearance/appearance.c |
---|
6,18 → 6,19 |
#endif |
#define MEMSIZE 200*1024 |
#include "..\lib\mem.h" |
#include "..\lib\strings.h" |
#include "..\lib\io.h" |
#include "..\lib\list_box.h" |
#include "..\lib\gui.h" |
#include "../lib/mem.h" |
#include "../lib/strings.h" |
#include "../lib/io.h" |
#include "../lib/list_box.h" |
#include "../lib/obj/libimg.h" |
#include "../lib/gui.h" |
#include "..\lib\obj\box_lib.h" |
#include "..\lib\obj\proc_lib.h" |
#include "..\lib\obj\libini.h" |
#include "../lib/obj/box_lib.h" |
#include "../lib/obj/proc_lib.h" |
#include "../lib/obj/libini.h" |
#include "..\lib\patterns\select_list.h" |
#include "..\lib\patterns\simple_open_dialog.h" |
#include "../lib/patterns/select_list.h" |
#include "../lib/patterns/simple_open_dialog.h" |
#include "ui_elements_preview.h" |
56,9 → 57,8 |
signed int active_skin=-1, active_wallpaper=-1; |
enum { |
SKINS=2, |
WALLPAPERS, |
BTN_SELECT_WALLP_FOLDER }; |
BASE_TAB_BUTTON_ID=2, |
BTN_SELECT_WALLP_FOLDER=10 }; |
char folder_path[4096]; |
char cur_file_path[4096]; |
71,8 → 71,10 |
proc_info Form; |
block skp; |
_tabs tabs = { SKINS, LP, LP, NULL, NULL }; |
enum {SKINS, WALLPAPERS}; |
_tabs tabs = { LP, LP, NULL, BASE_TAB_BUTTON_ID }; |
checkbox update_docky = { T_UPDATE_DOCK, false }; |
char default_dir[] = "/rd/1"; |
98,17 → 100,21 |
void main() |
{ |
int id, mouse_clicked; |
int id; |
GetRealFolderPathes(); |
load_dll(boxlib, #box_lib_init,0); |
load_dll(libini, #lib_init,1); |
load_dll(libio, #libio_init,1); |
load_dll(libimg, #libimg_init,1); |
load_dll(Proc_lib, #OpenDialog_init,0); |
o_dialog.type = 2; //select folder |
OpenDialog_init stdcall (#o_dialog); |
EventTabClick(SKINS); |
tabs.add(T_SKINS, #EventTabSkinsClick); |
tabs.add(T_WALLPAPERS, #EventTabWallpappersClick); |
tabs.draw_active_tab(); |
SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER); |
loop() switch(WaitEvent()) |
133,9 → 139,8 |
case evButton: |
id=GetButtonID(); |
if (id==1) EventExit(); |
if (id==SKINS) EventTabClick(SKINS); |
if (id==WALLPAPERS) EventTabClick(WALLPAPERS); |
if (id==BTN_SELECT_WALLP_FOLDER) EventSelectWallpFolder(); |
tabs.click(id); |
checkbox1.click(id); |
spinbox1.click(id); |
if (update_docky.click(id)) EventUpdateDocky(); |
147,10 → 152,7 |
GetKeys(); |
if (select_list.ProcessKey(key_scancode)) EventApply(); |
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) tabs.click(tabs.active_tab ^ 1); |
if (key_scancode==SCAN_CODE_DEL) EventDeleteFile(); |
if (! edit_cmm.flags & ed_focus) && (! edit_st.flags & ed_focus) |
198,17 → 200,19 |
if (tabs.active_tab == SKINS) list_w=250; else list_w=350; |
tabs.w = Form.cwidth-LP-LP; |
tabs.h = Form.cheight-LP-LP; |
tabs.draw_wrapper(); |
tabs.draw_button(tabs.x+TAB_PADDING, SKINS, T_SKINS); |
tabs.draw_button(strlen(T_SKINS)*8+tabs.x+TAB_PADDING+TAB_PADDING, WALLPAPERS, T_WALLPAPERS); |
tabs.draw(); |
DrawIcon16(tabs.x + TAB_PADDING, 15, sc.work, 17); |
DrawIcon16(strlen(T_SKINS)*8 + tabs.x + TAB_PADDING + TAB_PADDING, 15, sc.work, 6); |
if (select_list.cur_y>select_list.visible) select_list.first=select_list.cur_y; |
select_list.CheckDoesValuesOkey(); |
id = select_list.cur_y; |
SelectList_Init( |
tabs.x+TAB_PADDING, |
tabs.y+TAB_HEIGHT+TAB_PADDING, |
list_w, |
tabs.h - TAB_PADDING - TAB_PADDING - TAB_HEIGHT, |
Form.cheight-LP-LP - TAB_PADDING - TAB_PADDING - TAB_HEIGHT, |
false |
); |
select_list.cur_y = id; |
299,11 → 303,8 |
// // |
//===================================================// |
void EventTabClick(int N) |
void EventTabSkinsClick() |
{ |
tabs.click(N); |
if (tabs.active_tab == SKINS) |
{ |
active_wallpaper = select_list.cur_y; |
strcpy(#folder_path, #skins_folder_path); |
select_list.ClearList(); |
310,8 → 311,11 |
Open_Dir(); |
if (!select_list.count) notify("'No skins were found' -E"); |
select_list.cur_y = active_skin; |
if (select_list.w) draw_window(); |
} |
if (tabs.active_tab == WALLPAPERS) |
void EventTabWallpappersClick() |
{ |
active_skin = select_list.cur_y; |
strcpy(#folder_path, #wallp_folder_path); |
319,8 → 323,7 |
Open_Dir(); |
if (!select_list.count) notify("'No wallpapers were found' -E"); |
select_list.cur_y = active_wallpaper; |
} |
if (select_list.cur_y>select_list.visible) select_list.first=select_list.cur_y; select_list.CheckDoesValuesOkey(); |
if (select_list.w) draw_window(); |
} |
342,7 → 345,7 |
OpenDialog_start stdcall (#o_dialog); |
if (o_dialog.status) { |
strcpy(#wallp_folder_path, #opendir_path); |
EventTabClick(WALLPAPERS); |
EventTabWallpappersClick(); |
} |
} |
/programs/cmm/kf_font_viewer/font_viewer.c |
---|
6,14 → 6,11 |
#define PANELH 28 |
#define WIN_W 490 |
#define WIN_H 315 |
#define BASE_TAB_BUTTON_ID 97 |
proc_info Form; |
enum { |
PHRASE_TAB=20, CHARS_TAB |
}; |
_tabs tabs = { WIN_W-130, 0, NULL, BASE_TAB_BUTTON_ID }; |
_tabs tabs = { PHRASE_TAB }; |
block preview = { 0, PANELH, WIN_W, WIN_H - PANELH }; |
checkbox bold = { "Bold", false }; |
checkbox smooth = { "Smooth", true }; |
27,6 → 24,10 |
kfont.init(#param); |
strcpy(#title, "Font preview: "); |
strcat(#title, #param); |
tabs.add("Phrase", #DrawPreviewPhrase); |
tabs.add("Chars", #DrawPreviewChars); |
loop() switch(WaitEvent()) |
{ |
case evButton: |
35,7 → 36,7 |
bold.click(btn); |
smooth.click(btn); |
colored.click(btn); |
if (btn==PHRASE_TAB) || (btn==CHARS_TAB) tabs.click(btn); |
tabs.click(btn); |
goto _DRAW_WINDOW_CONTENT; |
case evReDraw: |
sc.get(); |
53,8 → 54,8 |
smooth.draw(83,8); |
colored.draw(170,8); |
tabs.draw_button(Form.cwidth-130, PHRASE_TAB, "Phrase"); |
tabs.draw_button(Form.cwidth-60, CHARS_TAB, "Chars"); |
tabs.draw(); |
tabs.draw_active_tab(); |
if (!kfont.font) |
{ |
62,8 → 63,6 |
WriteText(10, 50, 0x82, 0xFF00FF, "Font is not loaded."); |
break; |
} |
if (tabs.active_tab==PHRASE_TAB) DrawPreviewPhrase(); |
if (tabs.active_tab==CHARS_TAB) DrawPreviewChars(); |
} |
} |
/programs/cmm/lib/gui/tabs.h |
---|
3,28 → 3,58 |
#endif |
#define TAB_HEIGHT 28 |
#define NAME_SIZE 64 |
:struct _tabs |
{ |
int x,y,w; |
int base_id; |
int active_tab; |
int x,y,w,h; |
char names[640]; |
int count; |
dword events[10]; |
int click(); |
void draw(); |
void draw_active_tab(); |
void add(); |
dword draw_button(); |
int click(); |
void draw_wrapper(); |
}; |
:void _tabs::draw_wrapper() |
:void _tabs::draw() |
{ |
DrawRectangle(x,y+TAB_HEIGHT,w-1,h-TAB_HEIGHT, sc.work_graph); |
DrawBar(x+1,y+1+TAB_HEIGHT,w-3,1, sc.work_light); |
int i, xx=x; |
if (w) { |
DrawBar(x+1,y+0+TAB_HEIGHT,w,1, sc.work_graph); |
DrawBar(x+1,y+1+TAB_HEIGHT,w,1, sc.work_light); |
} |
:dword _tabs::draw_button(dword xx, but_id, text) |
for (i=0; i<count; i++) { |
xx += draw_button(xx + TAB_PADDING, i, i*NAME_SIZE + #names) + TAB_PADDING; |
} |
} |
:void _tabs::draw_active_tab() |
{ |
events[active_tab](); |
} |
:void _tabs::add(dword text, event) |
{ |
strcpy(count*NAME_SIZE + #names, text); |
events[count] = event; |
count++; |
} |
:dword _tabs::draw_button(dword xx, _id, text) |
{ |
dword col_bg, col_text; |
dword ww=strlen(text)*8, hh=TAB_HEIGHT; |
dword ww=strlen(text)*8; |
if (but_id==active_tab) |
if (_id==active_tab) |
{ |
col_bg=0xE44C9C; |
col_text=sc.work_text; |
34,16 → 64,18 |
col_bg=0xC3A1B7; |
col_text= MixColors(sc.work, sc.work_text, 120); |
} |
DefineHiddenButton(xx-2,y, ww-1+4,hh-1, but_id); |
DefineHiddenButton(xx-2,y, ww-1+4,TAB_HEIGHT-1, _id + base_id); |
WriteText(xx, y+6, 0x90, col_text, text); |
DrawBar(xx, y+hh-3, ww, 3, col_bg); |
//DrawStandartCaptButton(xx, y, but_id, text); //GetFreeButtonId() |
return xx; |
DrawBar(xx, y+TAB_HEIGHT-3, ww, 3, col_bg); |
return ww; |
} |
:int _tabs::click(int N) |
:int _tabs::click(int _id) |
{ |
if (N==active_tab) return false; |
active_tab = N; |
if (_id < base_id) || (_id > base_id + count) || (_id == active_tab) { |
return false; |
} |
active_tab = _id - base_id; |
events[active_tab](); |
return true; |
} |
/programs/cmm/sysmon/sysmon.c |
---|
37,6 → 37,7 |
#define WIN_CONTENT_W 400 |
#define WIN_CONTENT_H 465 |
#define ICONGAP 26 |
#define BASE_TAB_BUTTON_ID 10 |
proc_info Form; |
#ifdef LANG_RUS |
51,14 → 52,8 |
#define T_APP_TITLE "System Monitor" |
#endif |
enum { |
TAB_GENERAL=20, |
TAB_DRIVES, |
TAB_PROCESSES |
}; |
_tabs tabs = { 4, 10, WIN_CONTENT_W+WIN_PAD+WIN_PAD-4-4, BASE_TAB_BUTTON_ID }; |
_tabs tabs = { TAB_GENERAL, 4, 10, WIN_CONTENT_W+WIN_PAD+WIN_PAD-4-4, TAB_HEIGHT }; |
//===================================================// |
// // |
// GENERAL EVENTS // |
75,10 → 70,7 |
if (Form.status_window>2) return false; |
//if (Form.width < 300) { MoveSize(OLD,OLD,300,OLD); break; } |
//if (Form.height < 200) { MoveSize(OLD,OLD,OLD,200); break; } |
tabs.draw_wrapper(); |
butx = tabs.draw_button(tabs.x+TAB_PADDING, TAB_GENERAL, T_CPU_AND_RAM); |
butx = tabs.draw_button(strlen(T_CPU_AND_RAM)*8+TAB_PADDING+butx, TAB_DRIVES, T_DRIVES); |
tabs.draw_button(strlen(T_DRIVES)*8+TAB_PADDING+butx, TAB_PROCESSES, T_PROCESSES); |
tabs.draw(); |
return true; |
} |
86,18 → 78,7 |
{ |
int bid = GetButtonID(); |
if (1==bid) ExitProcess(); |
if (TAB_GENERAL==bid) { |
tabs.active_tab = TAB_GENERAL; |
CPUnRAM__Main(); |
} |
if (TAB_PROCESSES==bid) { |
tabs.active_tab = TAB_PROCESSES; |
Processes__Main(); |
} |
if (TAB_DRIVES==bid) { |
tabs.active_tab = TAB_DRIVES; |
Drives__Main(); |
} |
tabs.click(); |
return bid; |
} |
117,5 → 98,10 |
load_dll(libimg, #libimg_init,1); |
load_dll(libini, #lib_init,1); |
load_dll(boxlib, #box_lib_init,0); |
tabs.add(T_CPU_AND_RAM, #CPUnRAM__Main); |
tabs.add(T_DRIVES, #Drives__Main); |
tabs.add(T_PROCESSES, #Processes__Main); |
CPUnRAM__Main(); |
} |