Rev 9640 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4078 | leency | 1 | //11.03.12 - start! |
2 | |||
9465 | leency | 3 | #define MEMSIZE 1024*70 |
7909 | leency | 4 | #include "../lib/mem.h" |
5 | #include "../lib/strings.h" |
||
6 | #include "../lib/io.h" |
||
7 | #include "../lib/list_box.h" |
||
8 | #include "../lib/gui.h" |
||
7353 | leency | 9 | |
7909 | leency | 10 | #include "../lib/obj/box_lib.h" |
11 | #include "../lib/obj/proc_lib.h" |
||
12 | #include "../lib/obj/libini.h" |
||
7353 | leency | 13 | |
7909 | leency | 14 | #include "../lib/patterns/select_list.h" |
15 | #include "../lib/patterns/simple_open_dialog.h" |
||
9453 | leency | 16 | #include "../lib/patterns/restart_process.h" |
4078 | leency | 17 | |
9524 | leency | 18 | dword fmas; |
19 | |||
7614 | leency | 20 | #include "ui_elements_preview.h" |
9455 | leency | 21 | #include "const.h" |
7614 | leency | 22 | |
6212 | leency | 23 | //===================================================// |
24 | // // |
||
25 | // DATA // |
||
26 | // // |
||
27 | //===================================================// |
||
28 | |||
9524 | leency | 29 | int active_skin=-1, active_wallpaper=-1, active_screensaver=-1; |
9469 | leency | 30 | |
9465 | leency | 31 | checkbox optionbox_stretch = { T_CHECKBOX_STRETCH, false }; |
7611 | leency | 32 | checkbox optionbox_tiled = { T_CHECKBOX_TILED, false }; |
9465 | leency | 33 | checkbox optionbox_auto = { T_CHECKBOX_AUTO, true }; |
7611 | leency | 34 | |
9516 | leency | 35 | char ss_available[200]; |
36 | |||
9465 | leency | 37 | collection list; |
9461 | leency | 38 | |
9524 | leency | 39 | |
6212 | leency | 40 | //===================================================// |
41 | // // |
||
42 | // CODE // |
||
43 | // // |
||
44 | //===================================================// |
||
5548 | leency | 45 | |
4078 | leency | 46 | void main() |
47 | { |
||
9461 | leency | 48 | int id, i; |
5626 | leency | 49 | load_dll(boxlib, #box_lib_init,0); |
7533 | leency | 50 | load_dll(libini, #lib_init,1); |
7353 | leency | 51 | load_dll(Proc_lib, #OpenDialog_init,0); |
52 | OpenDialog_init stdcall (#o_dialog); |
||
53 | |||
9469 | leency | 54 | GetIniSettings(); |
55 | |||
9453 | leency | 56 | tabs.add(#t_skins, #EventTabSkinsClick); |
57 | tabs.add(#t_wallpapers, #EventTabWallpappersClick); |
||
58 | tabs.add(#t_screensaver, #EventTabScreensaverClick); |
||
7909 | leency | 59 | tabs.draw_active_tab(); |
7353 | leency | 60 | |
7551 | leency | 61 | SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER); |
6096 | leency | 62 | loop() switch(WaitEvent()) |
4078 | leency | 63 | { |
64 | case evMouse: |
||
6653 | leency | 65 | SelectList_ProcessMouse(); |
9516 | leency | 66 | if (tabs.active_tab == TAB_SCREENSAVERS) { |
67 | scrollbar_h_mouse stdcall (#ss_timeout); |
||
68 | if (ss_timeout.redraw) { |
||
69 | draw_timeout(); |
||
70 | ss_timeout.redraw = false; //reset flag |
||
71 | } |
||
72 | } |
||
4078 | leency | 73 | break; |
74 | |||
75 | case evButton: |
||
76 | id=GetButtonID(); |
||
7551 | leency | 77 | if (id==1) EventExit(); |
7909 | leency | 78 | tabs.click(id); |
9465 | leency | 79 | if (tabs.active_tab == TAB_SKINS) { |
80 | checkbox1.click(id); |
||
81 | spinbox1.click(id); |
||
82 | } |
||
83 | if (tabs.active_tab == TAB_WALLPAPERS) { |
||
84 | if (id==BTN_SELECT_WALLP_FOLDER) EventSelectWallpFolder(); |
||
85 | if (optionbox_stretch.click(id)) EventSetWallpMode(1,0,0); |
||
86 | if (optionbox_tiled.click(id)) EventSetWallpMode(0,1,0); |
||
87 | if (optionbox_auto.click(id)) EventSetWallpMode(0,0,1); |
||
88 | } |
||
89 | if (tabs.active_tab == TAB_SCREENSAVERS) { |
||
90 | if (id==BTN_TEST_SCREENSAVER) EventOpenFile(); |
||
9489 | leency | 91 | if (id==BTN_SET_SCREENSAVER) EventSetSs(); |
9465 | leency | 92 | } |
4078 | leency | 93 | break; |
94 | |||
95 | case evKey: |
||
5706 | leency | 96 | GetKeys(); |
9516 | leency | 97 | if (select_list.ProcessKey(key_scancode)) { EventApply(); break; } |
98 | if (key_scancode==SCAN_CODE_ENTER) { EventOpenFile(); break; } |
||
99 | if (key_scancode==SCAN_CODE_DEL) { EventDeleteFile(); break; } |
||
9453 | leency | 100 | if (key_scancode==SCAN_CODE_TAB) { |
101 | id = tabs.active_tab+1; |
||
102 | if(id==3)id=0; |
||
103 | tabs.click(id + tabs.base_id); |
||
104 | break; |
||
105 | } |
||
9461 | leency | 106 | for (i=select_list.cur_y+1; i |
4078 | leency | 107 | { |
9481 | leency | 108 | id = list.get(i) + strrchr(list.get(i), '/'); |
109 | if (ESBYTE[id]==key_ascii) || (ESBYTE[id]==key_ascii-32) |
||
6212 | leency | 110 | { |
9461 | leency | 111 | select_list.cur_y = i - 1; |
6651 | leency | 112 | select_list.KeyDown(); |
6212 | leency | 113 | EventApply(); |
114 | break; |
||
115 | } |
||
4078 | leency | 116 | } |
117 | break; |
||
118 | |||
7353 | leency | 119 | case evReDraw: |
120 | draw_window(); |
||
4078 | leency | 121 | } |
122 | } |
||
123 | |||
7353 | leency | 124 | void draw_window() |
125 | { |
||
7909 | leency | 126 | sc.get(); |
9598 | leency | 127 | DefineAndDrawWindow(screen.w-WIN_W-9/2,80,WIN_W+9,WIN_H+4+skin_h,0x74,sc.work,WINDOW_HEADER,0); |
7244 | leency | 128 | |
9530 | leency | 129 | DrawBar(0, 0, WIN_W, PANEL_H-2, sc.work); //top |
130 | DrawBar(0, PANEL_H-2, LP-2, WIN_H-PANEL_H-LP+4, EDX); //left |
||
131 | DrawBar(LIST_W+LP+20, PANEL_H-2, WIN_W-LIST_W-26, WIN_H-PANEL_H-LP+4, EDX); //right |
||
132 | DrawBar(0, WIN_H-LP+2, WIN_W, LP-2, EDX); //bottom |
||
133 | |||
7909 | leency | 134 | tabs.draw(); |
9516 | leency | 135 | draw_icon_16w(tabs.x + TAB_P, LP+5, 17); |
136 | draw_icon_16w(sizeof(t_skins)-1*8 + TAB_P + TAB_P + tabs.x, LP+5, 6); |
||
137 | draw_icon_16w(sizeof(t_wallpapers)+sizeof(t_skins)-2*8 + TAB_P + TAB_P + TAB_P + tabs.x, LP+5, 61); |
||
7225 | leency | 138 | |
9461 | leency | 139 | if (tabs.active_tab == TAB_SKINS) |
7244 | leency | 140 | { |
9461 | leency | 141 | DrawFrame(RIGHTx, PANEL_H+5, RIGHTw, RIGHTh, T_UI_PREVIEW); |
142 | DrawUiElementsPreview(RIGHTx+20, PANEL_H+5, RIGHTh); |
||
7244 | leency | 143 | } |
9461 | leency | 144 | if (tabs.active_tab == TAB_WALLPAPERS) |
7353 | leency | 145 | { |
9465 | leency | 146 | DrawFrame(RIGHTx, PANEL_H+5, 180, 105, T_PICTURE_MODE); |
9461 | leency | 147 | optionbox_stretch.draw(RIGHTx+14, PANEL_H+25); |
148 | optionbox_tiled.draw(RIGHTx+14, PANEL_H+52); |
||
9465 | leency | 149 | optionbox_auto.draw(RIGHTx+14, PANEL_H+79); |
150 | DrawStandartCaptButton(RIGHTx, PANEL_H+130, BTN_SELECT_WALLP_FOLDER, T_SELECT_FOLDER); |
||
7353 | leency | 151 | } |
9461 | leency | 152 | if (tabs.active_tab == TAB_SCREENSAVERS) |
9453 | leency | 153 | { |
9516 | leency | 154 | draw_timeout(); |
9603 | leency | 155 | ss_timeout.line_col = sc.line; |
9516 | leency | 156 | ss_timeout.frnt_col = sc.work; |
157 | scrollbar_h_draw stdcall (#ss_timeout); |
||
9603 | leency | 158 | DrawRectangle(RIGHTx, RIGHTy+25, RIGHTw-20, 15, sc.line); |
9516 | leency | 159 | ESI = DrawStandartCaptButton(RIGHTx, PANEL_H + 65, BTN_TEST_SCREENSAVER, T_SS_PREVIEW); |
160 | DrawStandartCaptButton(RIGHTx+ESI, PANEL_H + 65, BTN_SET_SCREENSAVER, T_SS_SET); |
||
9453 | leency | 161 | } |
9530 | leency | 162 | |
163 | $push select_list.cur_y |
||
164 | SelectList_Init( |
||
165 | LP, |
||
166 | PANEL_H, |
||
167 | LIST_W, |
||
168 | WIN_H - LP - PANEL_H |
||
169 | ); |
||
170 | $pop select_list.cur_y |
||
171 | |||
172 | SelectList_Draw(); |
||
173 | SelectList_DrawBorder(); |
||
6212 | leency | 174 | } |
175 | |||
9516 | leency | 176 | void draw_timeout() |
177 | { |
||
178 | miniprintf(#param, T_SS_TIMEOUT, ss_timeout.position+1); |
||
179 | WriteTextWithBg(RIGHTx, PANEL_H, 0xD0, sc.work_text, #param, sc.work); |
||
180 | } |
||
181 | |||
9524 | leency | 182 | void add_filesnames_into_the_list() |
9455 | leency | 183 | { |
9524 | leency | 184 | int j; |
185 | for (j=0; j |
||
186 | miniprintf(#param,"%s/",#folder_path); |
||
187 | strcat(#param, io.dir.position(ESDWORD[j*4+fmas])); |
||
188 | list.add(#param); |
||
189 | } |
||
9455 | leency | 190 | } |
4410 | leency | 191 | |
6212 | leency | 192 | void Open_Dir() |