//11.03.12 - start! //ver 2.0 #ifndef AUTOBUILD ?include "lang.h--" #endif #define MEMSIZE 0xFE800 #include "..\lib\mem.h" #include "..\lib\strings.h" #include "..\lib\io.h" #include "..\lib\list_box.h" #include "..\lib\menu.h" #include "..\lib\gui.h" #include "..\lib\obj\box_lib.h" #include "..\lib\patterns\select_list.h" //===================================================// // // // DATA // // // //===================================================// #ifdef LANG_RUS ?define WINDOW_HEADER "Настройки оформления" ?define T_SKINS "Стиль окон" ?define T_WALLPAPERS "Обои" #else ?define WINDOW_HEADER "Appearance" ?define T_SKINS "Skins" ?define T_WALLPAPERS "Wallpappers" #endif #define PANEL_H 40 #define LP 10 //LIST_PADDING #define SKINS_STANDART_PATH "/kolibrios/res/skins" #define WALP_STANDART_PATH "/kolibrios/res/wallpapers" signed int active_skin=-1, active_wallpaper=-1; enum { SKINS=2, WALLPAPERS }; char folder_path[4096]; char cur_file_path[4096]; char temp_filename[4096]; int files_mas[400]; int cur; proc_info Form; _tabs tabs = { LP, LP, NULL, NULL, SKINS }; //===================================================// // // // CODE // // // //===================================================// void main() { int id, mouse_clicked; SetEventMask(0x27); load_dll(boxlib, #box_lib_init,0); EventTabClick(SKINS); loop() switch(WaitEvent()) { case evMouse: if (!CheckActiveProcess(Form.ID)) break; SelectList_ProcessMouse(); if (mouse.down)&&(mouse.pkm) { 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); } break; case evButton: id=GetButtonID(); if (id==1) ExitProcess(); if (id==SKINS) EventTabClick(SKINS); if (id==WALLPAPERS) EventTabClick(WALLPAPERS); break; case evKey: 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_DEL) EventDeleteFile(); for (id=select_list.cur_y+1; id=2) break; DrawWindowContent(); if (menu.list.cur_y) { if (menu.list.cur_y == 10) EventOpenFile(); if (menu.list.cur_y == 11) EventDeleteFile(); menu.list.cur_y = 0; }; } } void DrawWindowContent() { 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, SKINS, T_SKINS); tabs.draw_button(strlen(T_SKINS)*8+tabs.x+TAB_PADDING+TAB_PADDING, WALLPAPERS, T_WALLPAPERS); id = select_list.cur_y; SelectList_Init( tabs.x+TAB_PADDING, tabs.y+TAB_HEIGHT+TAB_PADDING, tabs.w - TAB_PADDING - TAB_PADDING - scroll1.size_x, tabs.h - TAB_PADDING - TAB_PADDING - TAB_HEIGHT, false ); select_list.cur_y = id; SelectList_Draw(); SelectList_DrawBorder(); } void Open_Dir() { int j; select_list.count = 0; if(io.dir.buffer)free(io.dir.buffer); io.dir.load(#folder_path,DIR_ONLYREAL); for (j=0; jselect_list.visible) select_list.first=select_list.cur_y; select_list.CheckDoesValuesOkey(); if (select_list.w) DrawWindowContent(); } void EventDeleteFile() { io.del(#cur_file_path); Open_Dir(); EventApply(); } void EventApply() { if (tabs.active_tab==SKINS) { cur = select_list.cur_y; sprintf(#cur_file_path,"%s/%s",#folder_path,io.dir.position(files_mas[cur])); SetSystemSkin(#cur_file_path); } if (tabs.active_tab==WALLPAPERS) { cur = select_list.cur_y; sprintf(#cur_file_path,"\\S__%s/%s",#folder_path,io.dir.position(files_mas[cur])); RunProgram("/sys/media/kiv", #cur_file_path); SelectList_Draw(); } } void EventOpenFile() { if (tabs.active_tab==SKINS) RunProgram("/sys/skincfg", #cur_file_path); if (tabs.active_tab==WALLPAPERS) RunProgram("/sys/media/kiv", #cur_file_path); } stop: