diff --git a/programs/cmm/appearance/appearance.c b/programs/cmm/appearance/appearance.c index f0c361178..33149f82c 100644 --- a/programs/cmm/appearance/appearance.c +++ b/programs/cmm/appearance/appearance.c @@ -1,4 +1,5 @@ //11.03.12 - start! +//ver 2.0 #ifndef AUTOBUILD ?include "lang.h--" @@ -9,13 +10,21 @@ #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" + +//===================================================// +// // +// DATA // +// // +//===================================================// + #ifdef LANG_RUS - ?define WINDOW_HEADER "Управление темой" - ?define T_SKINS " Тема окон" - ?define T_WALLPAPERS " Обои рабочего стола" + ?define WINDOW_HEADER "Настройки оформления" + ?define T_SKINS " Стиль окон" + ?define T_WALLPAPERS " Обои" #else ?define WINDOW_HEADER "Appearance" ?define T_SKINS " Skins" @@ -24,13 +33,16 @@ unsigned char icons[]= FROM "icons.raw"; -#define PANEL_H 30 +#define PANEL_H 40 +#define LIST_PADDING 20 +#define TAB_PADDING 16 +#define TAB_HEIGHT 25 #define SKINS_STANDART_PATH "/kolibrios/res/skins" #define WALP_STANDART_PATH "/kolibrios/res/wallpapers" -llist list[2]; -int active; -enum { SKINS, WALLPAPERS }; +llist list; +signed int active_tab, active_skin=-1, active_wallpaper=-1; +enum { SKINS=2, WALLPAPERS }; char folder_path[4096]; char cur_file_path[4096]; @@ -43,105 +55,12 @@ proc_info Form; scroll_bar scroll1 = { 18,200,398, 44,18,0,115,15,0,0xeeeeee,0xD2CED0,0x555555,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}; -void Open_Dir() -{ - int j; - list[active].count = 0; - if(io.dir.buffer)free(io.dir.buffer); - io.dir.load(#folder_path,DIR_ONLYREAL); - for (j=0; j list[active].visible) list_last = list[active].visible; else list_last = list[active].count; - - for (i=0; i=2) break; - DrawTabs(); - Draw_List(); + DrawWindowContent(); + debugi(menu.list.cur_y); + if (menu.list.cur_y) { + if (menu.list.cur_y == 10) EventOpenFile(); + if (menu.list.cur_y == 11) EventDeleteFile(); + menu.list.cur_y = 0; + }; } } -#define BT_PADDING 16 +void DrawWindowContent() +{ + int id; + list.SetFont(8, 14, 0x90); + id = list.cur_y; + list.SetSizes(LIST_PADDING, PANEL_H, Form.cwidth-scroll1.size_x-LIST_PADDING-LIST_PADDING, Form.cheight-PANEL_H-LIST_PADDING, 20); + list.cur_y = id; -void DrawTab(dword x,y, but_id, is_active, text) + DrawBar(0,0, Form.cwidth, PANEL_H-LIST_PADDING, system.color.work); + DrawRectangle3D(list.x-2, list.y-2, list.w+3+scroll1.size_x, list.h+3, system.color.work_dark, system.color.work_light); + DrawWideRectangle(list.x-LIST_PADDING, list.y-LIST_PADDING, LIST_PADDING*2+list.w+scroll1.size_x, LIST_PADDING*2+list.h, LIST_PADDING-2, system.color.work); + DrawTab(list.x+10, list.y, SKINS, T_SKINS); + if (isdir(WALP_STANDART_PATH)) DrawTab(strlen(T_SKINS)*8+TAB_PADDING+list.x+21, list.y, WALLPAPERS, T_WALLPAPERS); + DrawRectangle(list.x-1, list.y-1, list.w+1+scroll1.size_x, list.h+1, system.color.work_graph); + + Draw_List(); +} + +void DrawTab(dword x,y, but_id, text) { dword col_bg, col_text; - dword w=strlen(text)*6+BT_PADDING, h=21; + dword w=strlen(text)*8+TAB_PADDING, h=TAB_HEIGHT; + y -= h; - if (is_active) + if (but_id==active_tab) { col_bg=system.color.work_button; col_text=system.color.work_button_text; @@ -232,55 +176,132 @@ void DrawTab(dword x,y, but_id, is_active, text) col_text=system.color.work_text; } DrawCaptButton(x,y, w-1,h+1, but_id, col_bg, col_text, text); - _PutImage(x+6,y+4, 16,15, but_id-2*16*15*3+#icons); + _PutImage(x+10,h-16/2+y+1, 16,15, but_id-2*16*15*3+#icons); } - -void DrawTabs() -{ - DrawBar(0,0, Form.cwidth, PANEL_H-1, system.color.work); - DrawTab(10,7, 3, list[SKINS].active, T_SKINS); - if (isdir(WALP_STANDART_PATH)) DrawTab(strlen(T_SKINS)*6+BT_PADDING+21,7, 2, list[WALLPAPERS].active, T_WALLPAPERS); - DrawBar(0,PANEL_H-2, Form.cwidth, 1, system.color.work_graph); - DrawBar(0,PANEL_H-1, Form.cwidth, 1, 0xEEEeee); -} - -void TabClick(int N) -{ - if (N==SKINS) - { - list[SKINS].active = 1; - list[WALLPAPERS].active = 0; - } - if (N==WALLPAPERS) - { - list[SKINS].active = 0; - list[WALLPAPERS].active = 1; - } - active = N; - GetFiles(); - DrawTabs(); - Draw_List(); -} - - void DrawScroller() { scroll1.bckg_col = 0xBBBbbb; scroll1.frnt_col = system.color.work; scroll1.line_col = system.color.work_graph; - scroll1.max_area = list[active].count; - scroll1.cur_area = list[active].visible; - scroll1.position = list[active].first; + scroll1.max_area = list.count; + scroll1.cur_area = list.visible; + scroll1.position = list.first; scroll1.all_redraw=1; - scroll1.start_x = list[active].x + list[active].w; - scroll1.start_y = list[active].y-2; - scroll1.size_y = list[active].h+2; + scroll1.start_x = list.x + list.w; + scroll1.start_y = list.y-1; + scroll1.size_y = list.h+2; scrollbar_v_draw(#scroll1); } +void Open_Dir() +{ + int j; + list.count = 0; + if(io.dir.buffer)free(io.dir.buffer); + io.dir.load(#folder_path,DIR_ONLYREAL); + for (j=0; j list.visible) list_last = list.visible; else list_last = list.count; + + for (i=0; (i