Rev 5674 | Rev 5706 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4078 | leency | 1 | //11.03.12 - start! |
2 | |||
4085 | leency | 3 | #ifndef AUTOBUILD |
4 | ?include "lang.h--" |
||
5 | #endif |
||
6 | |||
4078 | leency | 7 | #define MEMSIZE 0xFE800 |
8 | #include "..\lib\mem.h" |
||
4085 | leency | 9 | #include "..\lib\strings.h" |
5654 | leency | 10 | #include "..\lib\io.h" |
4078 | leency | 11 | #include "..\lib\list_box.h" |
5499 | leency | 12 | #include "..\lib\gui.h" |
13 | #include "..\lib\obj\box_lib.h" |
||
4078 | leency | 14 | |
4085 | leency | 15 | #ifdef LANG_RUS |
16 | ?define WINDOW_HEADER "Усправление темой" |
||
4411 | leency | 17 | ?define T_SKINS " Тема окон" |
18 | ?define T_WALLPAPERS " Обои рабочего стола" |
||
4085 | leency | 19 | #else |
20 | ?define WINDOW_HEADER "Appearance" |
||
4411 | leency | 21 | ?define T_SKINS " Skins" |
22 | ?define T_WALLPAPERS " Wallpappers" |
||
4085 | leency | 23 | #endif |
4078 | leency | 24 | |
4544 | leency | 25 | unsigned char icons[]= FROM "icons.raw"; |
4085 | leency | 26 | |
4078 | leency | 27 | #define PANEL_H 30 |
5656 | pavelyakov | 28 | #define SKINS_STANDART_PATH "/sys/skins" |
29 | //"/kolibrios/res/skins" |
||
30 | |||
4885 | leency | 31 | #define WALP_STANDART_PATH "/kolibrios/res/wallpapers" |
4078 | leency | 32 | |
33 | llist list[2]; |
||
34 | int active; |
||
4410 | leency | 35 | enum { WALLPAPERS, SKINS }; |
4078 | leency | 36 | |
37 | char folder_path[4096]; |
||
38 | char cur_file_path[4096]; |
||
39 | char temp_filename[4096]; |
||
40 | int files_mas[100]; |
||
41 | |||
42 | int cur; |
||
43 | |||
44 | proc_info Form; |
||
45 | |||
4085 | leency | 46 | 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}; |
47 | |||
4078 | leency | 48 | void Open_Dir() |
49 | { |
||
5654 | leency | 50 | int j; |
4078 | leency | 51 | list[active].count = 0; |
5656 | pavelyakov | 52 | if(io.dir.buffer)free(io.dir.buffer); |
5655 | leency | 53 | io.dir.load(#folder_path,DIR_ONLYREAL); |
5654 | leency | 54 | for (j=0; j |
4078 | leency | 55 | { |
5655 | leency | 56 | strcpy(#temp_filename, io.dir.position(j)); |
4410 | leency | 57 | strlwr(#temp_filename); |
4885 | leency | 58 | if (active==SKINS) if (strcmpi(#temp_filename+strlen(#temp_filename)-4,".skn")!=0) continue; |
59 | if (active==WALLPAPERS) if (strcmpi(#temp_filename+strlen(#temp_filename)-4,".txt")==0) continue; |
||
4078 | leency | 60 | cur = list[active].count; |
61 | files_mas[cur]=j; |
||
4885 | leency | 62 | if (!strcmpi("default.skn",#temp_filename)) files_mas[0]> |
4078 | leency | 63 | list[active].count++; |
64 | } |
||
65 | } |
||
66 | |||
67 | void Draw_List() |
||
68 | { |
||
69 | int i; |
||
4410 | leency | 70 | int yyy; |
5548 | leency | 71 | int list_last; |
4085 | leency | 72 | list[SKINS].SetSizes(0, PANEL_H, Form.cwidth-scroll1.size_x-1, Form.cheight-PANEL_H, 40, 20); |
73 | list[WALLPAPERS].SetSizes(0, PANEL_H, Form.cwidth-scroll1.size_x-1, Form.cheight-PANEL_H, 40, 20); |
||
5548 | leency | 74 | if (list[active].count > list[active].visible) list_last = list[active].visible; else list_last = list[active].count; |
75 | |||
76 | for (i=0; i |
||
4078 | leency | 77 | { |
78 | cur = list[active].first; |
||
5655 | leency | 79 | strcpy(#temp_filename, io.dir.position(files_mas[i+cur])); |
4410 | leency | 80 | temp_filename[strlen(#temp_filename)-4] = 0; |
81 | yyy = i*list[active].line_h+list[active].y; |
||
4078 | leency | 82 | |
83 | if (list[active].current-list[active].first==i) |
||
84 | { |
||
5674 | pavelyakov | 85 | if (system.color.work_button!=system.color.work) |
4078 | leency | 86 | { |
5674 | pavelyakov | 87 | DrawBar(0, yyy, list[active].w, list[active].line_h, system.color.work_button); |
88 | if (i |
||
4078 | leency | 89 | } |
90 | else |
||
91 | { |
||
5674 | pavelyakov | 92 | DrawBar(0, yyy, list[active].w, list[active].line_h, system.color.grab_button); |
93 | if (i |
||
4410 | leency | 94 | } |
4078 | leency | 95 | } |
96 | else |
||
97 | { |
||
4410 | leency | 98 | DrawBar(0,yyy,list[active].w, list[active].line_h, 0xFFFfff); |
4411 | leency | 99 | WriteText(12,yyy+list[active].text_y,0x80,0, #temp_filename); |
4078 | leency | 100 | } |
101 | } |
||
5548 | leency | 102 | DrawBar(0,list_last*list[active].line_h+list[active].y, list[active].w, -list_last*list[active].line_h+ list[active].h, 0xFFFfff); |
4085 | leency | 103 | DrawScroller(); |
4078 | leency | 104 | } |
105 | |||
4410 | leency | 106 | void GetFiles() |
4078 | leency | 107 | { |
4410 | leency | 108 | if (list[SKINS].active) |
4078 | leency | 109 | { |
110 | strcpy(#folder_path, SKINS_STANDART_PATH); |
||
111 | Open_Dir(); |
||
4885 | leency | 112 | if (!list[active].count) notify("'No skins were found' -E"); |
4078 | leency | 113 | } |
4410 | leency | 114 | if (list[WALLPAPERS].active) |
4078 | leency | 115 | { |
116 | strcpy(#folder_path, WALP_STANDART_PATH); |
||
117 | Open_Dir(); |
||
4885 | leency | 118 | if (!list[active].count) notify("'No wallpapers were found' -E"); |
4078 | leency | 119 | } |
120 | } |
||
121 | |||
122 | void Apply() |
||
123 | { |
||
4410 | leency | 124 | if (list[SKINS].active) |
4078 | leency | 125 | { |
4410 | leency | 126 | cur = list[SKINS].current; |
5656 | pavelyakov | 127 | sprintf(#cur_file_path,"%s/%s",#folder_path,io.dir.position(files_mas[cur])); |
4078 | leency | 128 | SetSystemSkin(#cur_file_path); |
129 | } |
||
4410 | leency | 130 | if (list[WALLPAPERS].active) |
4078 | leency | 131 | { |
4410 | leency | 132 | cur = list[WALLPAPERS].current; |
5656 | pavelyakov | 133 | sprintf(#cur_file_path,"\\S__%s/%s",#folder_path,io.dir.position(files_mas[cur])); |
4078 | leency | 134 | RunProgram("/sys/media/kiv", #cur_file_path); |
135 | Draw_List(); |
||
136 | } |
||
137 | } |
||
138 | |||
139 | OpenFile() |
||
140 | { |
||
4410 | leency | 141 | if (list[SKINS].active) RunProgram("/sys/desktop", #cur_file_path); |
142 | if (list[WALLPAPERS].active) RunProgram("/sys/media/kiv", #cur_file_path); |
||
4078 | leency | 143 | } |
144 | |||
145 | |||
146 | void main() |
||
147 | { |
||
5705 | punk_joker | 148 | int id, mouse_clicked; |
149 | word key_ascii, key_scancode; |
||
150 | dword status_key; |
||
4078 | leency | 151 | |
4410 | leency | 152 | SetEventMask(0x27); |
5626 | leency | 153 | load_dll(boxlib, #box_lib_init,0); |
4081 | leency | 154 | list[SKINS].current = list[WALLPAPERS].current = -1; |
4078 | leency | 155 | list[SKINS].first = list[WALLPAPERS].first = 0; |
4410 | leency | 156 | TabClick(WALLPAPERS); |
157 | list[WALLPAPERS].SetSizes(0, 230, 350, 400-PANEL_H, 40, 18); |
||
158 | list[SKINS].SetSizes(0, 230, 350, 400-PANEL_H, 40, 18); |
||
4078 | leency | 159 | loop() |
160 | { |
||
161 | switch(WaitEvent()) |
||
162 | { |
||
163 | case evMouse: |
||
4085 | leency | 164 | if (!CheckActiveProcess(Form.ID)) break; |
5656 | pavelyakov | 165 | mouse.get(); |
4085 | leency | 166 | scrollbar_v_mouse (#scroll1); |
5656 | pavelyakov | 167 | if (list[active].first != scroll1.position) |
4085 | leency | 168 | { |
169 | list[active].first = scroll1.position; |
||
170 | Draw_List(); |
||
171 | break; |
||
172 | } |
||
4410 | leency | 173 | |
5640 | pavelyakov | 174 | if (mouse.vert) |
4410 | leency | 175 | { |
5640 | pavelyakov | 176 | if (list[SKINS].active) && (list[SKINS].MouseScroll(mouse.vert)) Draw_List(); |
177 | if (list[WALLPAPERS].active) && (list[WALLPAPERS].MouseScroll(mouse.vert)) Draw_List(); |
||
4410 | leency | 178 | } |
179 | |||
5656 | pavelyakov | 180 | if (mouse.up)&&(mouse_clicked) |
4078 | leency | 181 | { |
5656 | pavelyakov | 182 | if (mouse.lkm) &&(list[SKINS].active) && (list[SKINS].ProcessMouse(mouse.x, mouse.y)) Apply(); |
183 | if (mouse.lkm) &&(list[WALLPAPERS].active) && (list[WALLPAPERS].ProcessMouse(mouse.x, mouse.y)) Apply(); |
||
184 | mouse_clicked=false; |
||