Subversion Repositories Kolibri OS

Rev

Rev 7628 | Rev 7778 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7628 Rev 7660
1
//11.03.12 - start!
1
//11.03.12 - start!
2
//ver 2.3
2
//ver 2.3
3
 
3
 
4
#ifndef AUTOBUILD
4
#ifndef AUTOBUILD
5
	?include "lang.h--"
5
	?include "lang.h--"
6
#endif
6
#endif
7
 
7
 
8
#define MEMSIZE 0xFE800
8
#define MEMSIZE 200*1024
9
#include "..\lib\mem.h"
9
#include "..\lib\mem.h"
10
#include "..\lib\strings.h"
10
#include "..\lib\strings.h"
11
#include "..\lib\io.h"
11
#include "..\lib\io.h"
12
#include "..\lib\list_box.h"
12
#include "..\lib\list_box.h"
13
#include "..\lib\gui.h"
13
#include "..\lib\gui.h"
14
 
14
 
15
#include "..\lib\obj\box_lib.h"
15
#include "..\lib\obj\box_lib.h"
16
#include "..\lib\obj\proc_lib.h"
16
#include "..\lib\obj\proc_lib.h"
17
#include "..\lib\obj\libini.h"
17
#include "..\lib\obj\libini.h"
18
 
18
 
19
#include "..\lib\patterns\select_list.h"
19
#include "..\lib\patterns\select_list.h"
20
#include "..\lib\patterns\simple_open_dialog.h"
20
#include "..\lib\patterns\simple_open_dialog.h"
21
 
21
 
22
#include "ui_elements_preview.h"
22
#include "ui_elements_preview.h"
23
 
23
 
24
//===================================================//
24
//===================================================//
25
//                                                   //
25
//                                                   //
26
//                       DATA                        //
26
//                       DATA                        //
27
//                                                   //
27
//                                                   //
28
//===================================================//
28
//===================================================//
29
 
29
 
30
#ifdef LANG_RUS
30
#ifdef LANG_RUS
31
	?define WINDOW_HEADER " áâனª¨ ®ä®à¬«¥­¨ï"
31
	?define WINDOW_HEADER " áâனª¨ ®ä®à¬«¥­¨ï"
32
	?define T_SKINS       "‘â¨«ì ®ª®­"
32
	?define T_SKINS       "‘â¨«ì ®ª®­"
33
	?define T_WALLPAPERS  "Ž¡®¨"
33
	?define T_WALLPAPERS  "Ž¡®¨"
34
	?define T_SELECT_FOLDER "‚ë¡à âì ¯ ¯ªã"
34
	?define T_SELECT_FOLDER "‚ë¡à âì ¯ ¯ªã"
35
	?define MENU_LIST "Žâªàëâì ä ©«   Enter\n“¤ «¨âì ä ©«     Del"
35
	?define MENU_LIST "Žâªàëâì ä ©«   Enter\n“¤ «¨âì ä ©«     Del"
36
	?define T_PICTURE_MODE " ®«®¦¥­¨¥ ª à⨭ª¨ "
36
	?define T_PICTURE_MODE " ®«®¦¥­¨¥ ª à⨭ª¨ "
37
	?define T_CHECKBOX_STRETCH " áâï­ãâì"
37
	?define T_CHECKBOX_STRETCH " áâï­ãâì"
38
	?define T_CHECKBOX_TILED "‡ ¬®áâ¨âì"
38
	?define T_CHECKBOX_TILED "‡ ¬®áâ¨âì"
39
	?define T_UPDATE_DOCK "Ž¡­®¢«ïâì Dock-¯ ­¥«ì"
39
	?define T_UPDATE_DOCK "Ž¡­®¢«ïâì Dock-¯ ­¥«ì"
40
#else
40
#else
41
	?define WINDOW_HEADER "Appearance"
41
	?define WINDOW_HEADER "Appearance"
42
	?define T_SKINS       "Skins"
42
	?define T_SKINS       "Skins"
43
	?define T_WALLPAPERS  "Wallpapers"
43
	?define T_WALLPAPERS  "Wallpapers"
44
	?define T_SELECT_FOLDER "Select folder"
44
	?define T_SELECT_FOLDER "Select folder"
45
	?define MENU_LIST "Open file      Enter\nDelete file      Del"
45
	?define MENU_LIST "Open file      Enter\nDelete file      Del"
46
	?define T_PICTURE_MODE " Picture Mode "
46
	?define T_PICTURE_MODE " Picture Mode "
47
	?define T_CHECKBOX_STRETCH "Stretch"
47
	?define T_CHECKBOX_STRETCH "Stretch"
48
	?define T_CHECKBOX_TILED "Tiled"
48
	?define T_CHECKBOX_TILED "Tiled"
49
	?define T_UPDATE_DOCK "Update Dock"
49
	?define T_UPDATE_DOCK "Update Dock"
50
#endif
50
#endif
51
 
51
 
52
#define PANEL_H 40
52
#define PANEL_H 40
53
#define LP 10 //LIST_PADDING
53
#define LP 10 //LIST_PADDING
54
char skins_folder_path[4096];
54
char skins_folder_path[4096];
55
char wallp_folder_path[4096];
55
char wallp_folder_path[4096];
56
 
56
 
57
signed int active_skin=-1, active_wallpaper=-1;
57
signed int active_skin=-1, active_wallpaper=-1;
58
enum { 
58
enum { 
59
	SKINS=2, 
59
	SKINS=2, 
60
	WALLPAPERS,
60
	WALLPAPERS,
61
	BTN_SELECT_WALLP_FOLDER };
61
	BTN_SELECT_WALLP_FOLDER };
62
 
62
 
63
char folder_path[4096];
63
char folder_path[4096];
64
char cur_file_path[4096];
64
char cur_file_path[4096];
65
char cur_skin_path[4096];
65
char cur_skin_path[4096];
66
char temp_filename[4096];
66
char temp_filename[4096];
67
int files_mas[400];
67
int files_mas[400];
68
 
68
 
69
int cur;
69
int cur;
70
 
70
 
71
proc_info Form;
71
proc_info Form;
72
block skp;
72
block skp;
73
 
73
 
74
_tabs tabs = { SKINS, LP, LP, NULL, NULL };
74
_tabs tabs = { SKINS, LP, LP, NULL, NULL };
75
 
75
 
76
checkbox update_docky = { T_UPDATE_DOCK, false };
76
checkbox update_docky = { T_UPDATE_DOCK, false };
77
 
77
 
78
char default_dir[] = "/rd/1";
78
char default_dir[] = "/rd/1";
79
od_filter filter2 = { 8, "TXT\0\0" };
79
od_filter filter2 = { 8, "TXT\0\0" };
80
 
80
 
81
checkbox optionbox_stretch = { T_CHECKBOX_STRETCH, true };
81
checkbox optionbox_stretch = { T_CHECKBOX_STRETCH, true };
82
checkbox optionbox_tiled = { T_CHECKBOX_TILED, false };
82
checkbox optionbox_tiled = { T_CHECKBOX_TILED, false };
83
 
83
 
84
//===================================================//
84
//===================================================//
85
//                                                   //
85
//                                                   //
86
//                       CODE                        //
86
//                       CODE                        //
87
//                                                   //
87
//                                                   //
88
//===================================================//
88
//===================================================//
89
 
89
 
90
void GetRealFolderPathes()
90
void GetRealFolderPathes()
91
{
91
{
92
	char real_skin_path[4096];
92
	char real_skin_path[4096];
93
	SetCurDir("/kolibrios");
93
	SetCurDir("/kolibrios");
94
	GetCurDir(#real_skin_path, sizeof(real_skin_path));
94
	GetCurDir(#real_skin_path, sizeof(real_skin_path));
95
	sprintf(#skins_folder_path, "%s/res/skins", #real_skin_path);
95
	sprintf(#skins_folder_path, "%s/res/skins", #real_skin_path);
96
	sprintf(#wallp_folder_path, "%s/res/wallpapers", #real_skin_path);
96
	sprintf(#wallp_folder_path, "%s/res/wallpapers", #real_skin_path);
97
}
97
}
98
 
98
 
99
void main()
99
void main()
100
{   
100
{   
101
	int id, mouse_clicked;
101
	int id, mouse_clicked;
102
 
102
 
103
	GetRealFolderPathes();
103
	GetRealFolderPathes();
104
 
104
 
105
	load_dll(boxlib, #box_lib_init,0);
105
	load_dll(boxlib, #box_lib_init,0);
106
	load_dll(libini, #lib_init,1);
106
	load_dll(libini, #lib_init,1);
107
	load_dll(Proc_lib, #OpenDialog_init,0);
107
	load_dll(Proc_lib, #OpenDialog_init,0);
108
	o_dialog.type = 2; //select folder
108
	o_dialog.type = 2; //select folder
109
	OpenDialog_init stdcall (#o_dialog);
109
	OpenDialog_init stdcall (#o_dialog);
110
 
110
 
111
	EventTabClick(SKINS);
111
	EventTabClick(SKINS);
112
 
112
 
113
	SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);
113
	SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);
114
	loop() switch(WaitEvent()) 
114
	loop() switch(WaitEvent()) 
115
	{
115
	{
116
	  	case evMouse:
116
	  	case evMouse:
117
			SelectList_ProcessMouse();
117
			SelectList_ProcessMouse();
118
 
118
 
119
			if (tabs.active_tab == SKINS) {
119
			if (tabs.active_tab == SKINS) {
120
				edit_box_mouse stdcall (#edit_cmm);
120
				edit_box_mouse stdcall (#edit_cmm);
121
				edit_box_mouse stdcall (#edit_st);
121
				edit_box_mouse stdcall (#edit_st);
122
			}
122
			}
123
 
123
 
124
	  		if (mouse.pkm)&&(select_list.MouseOver(mouse.x, mouse.y)) {
124
	  		if (mouse.pkm)&&(select_list.MouseOver(mouse.x, mouse.y)) {
125
	  			select_list.ProcessMouse(mouse.x, mouse.y);
125
	  			select_list.ProcessMouse(mouse.x, mouse.y);
126
				SelectList_Draw();
126
				SelectList_Draw();
127
				EventSetNewCurrent();
127
				EventSetNewCurrent();
128
	  			menu.show(Form.left+mouse.x, Form.top+mouse.y+skin_height, 146, MENU_LIST, 10); 
128
	  			menu.show(Form.left+mouse.x, Form.top+mouse.y+skin_height, 146, MENU_LIST, 10); 
129
	  		}
129
	  		}
130
	  		break;
130
	  		break;
131
 
131
 
132
		case evButton:
132
		case evButton:
133
			id=GetButtonID();
133
			id=GetButtonID();
134
			if (id==1) EventExit();
134
			if (id==1) EventExit();
135
			if (id==SKINS) EventTabClick(SKINS);
135
			if (id==SKINS) EventTabClick(SKINS);
136
			if (id==WALLPAPERS) EventTabClick(WALLPAPERS);
136
			if (id==WALLPAPERS) EventTabClick(WALLPAPERS);
137
			if (id==BTN_SELECT_WALLP_FOLDER) EventSelectWallpFolder();
137
			if (id==BTN_SELECT_WALLP_FOLDER) EventSelectWallpFolder();
138
			checkbox1.click(id);
138
			checkbox1.click(id);
139
			spinbox1.click(id);
139
			spinbox1.click(id);
140
			if (update_docky.click(id)) EventUpdateDocky();
140
			if (update_docky.click(id)) EventUpdateDocky();
141
			if (!optionbox_stretch.checked) && (optionbox_stretch.click(id)) EventSetWallpMode_Stretch();
141
			if (!optionbox_stretch.checked) && (optionbox_stretch.click(id)) EventSetWallpMode_Stretch();
142
			if (!optionbox_tiled.checked) && (optionbox_tiled.click(id)) EventSetWallpMode_Tiled();
142
			if (!optionbox_tiled.checked) && (optionbox_tiled.click(id)) EventSetWallpMode_Tiled();
143
			break;
143
			break;
144
	  
144
	  
145
		case evKey:
145
		case evKey:
146
			GetKeys(); 
146
			GetKeys(); 
147
			if (select_list.ProcessKey(key_scancode)) EventApply();
147
			if (select_list.ProcessKey(key_scancode)) EventApply();
148
			if (key_scancode==SCAN_CODE_ENTER) EventOpenFile();
148
			if (key_scancode==SCAN_CODE_ENTER) EventOpenFile();
149
			if (key_scancode==SCAN_CODE_TAB) {
149
			if (key_scancode==SCAN_CODE_TAB) {
150
				if (tabs.active_tab==SKINS) EventTabClick(WALLPAPERS); 
150
				if (tabs.active_tab==SKINS) EventTabClick(WALLPAPERS); 
151
				else EventTabClick(SKINS);				
151
				else EventTabClick(SKINS);				
152
			}
152
			}
153
			if (key_scancode==SCAN_CODE_DEL) EventDeleteFile();
153
			if (key_scancode==SCAN_CODE_DEL) EventDeleteFile();
154
 
154
 
155
			if (! edit_cmm.flags & ed_focus) && (! edit_st.flags & ed_focus)
155
			if (! edit_cmm.flags & ed_focus) && (! edit_st.flags & ed_focus)
156
			for (id=select_list.cur_y+1; id
156
			for (id=select_list.cur_y+1; id
157
			{
157
			{
158
				strcpy(#temp_filename, io.dir.position(files_mas[id]));
158
				strcpy(#temp_filename, io.dir.position(files_mas[id]));
159
				if (temp_filename[0]==key_ascii) || (temp_filename[0]==key_ascii-32)
159
				if (temp_filename[0]==key_ascii) || (temp_filename[0]==key_ascii-32)
160
				{
160
				{
161
					select_list.cur_y = id - 1;
161
					select_list.cur_y = id - 1;
162
					select_list.KeyDown();
162
					select_list.KeyDown();
163
					EventApply();
163
					EventApply();
164
					break;
164
					break;
165
				}
165
				}
166
			}
166
			}
167
 
167
 
168
			if (tabs.active_tab == SKINS) {
168
			if (tabs.active_tab == SKINS) {
169
				EAX = key_ascii << 8;
169
				EAX = key_ascii << 8;
170
				edit_box_key stdcall (#edit_cmm);
170
				edit_box_key stdcall (#edit_cmm);
171
				edit_box_key stdcall (#edit_st);				
171
				edit_box_key stdcall (#edit_st);				
172
			}
172
			}
173
			break;
173
			break;
174
		 
174
		 
175
		 case evReDraw:		
175
		 case evReDraw:		
176
			draw_window();
176
			draw_window();
177
	 		if (menu.cur_y) {
177
	 		if (menu.cur_y) {
178
				if (menu.cur_y == 10) EventOpenFile();
178
				if (menu.cur_y == 10) EventOpenFile();
179
				if (menu.cur_y == 11) EventDeleteFile();
179
				if (menu.cur_y == 11) EventDeleteFile();
180
				menu.cur_y = 0;
180
				menu.cur_y = 0;
181
			};
181
			};
182
   }
182
   }
183
}
183
}
184
 
184
 
185
void draw_window()
185
void draw_window()
186
{
186
{
187
	system.color.get();	
187
	system.color.get();	
188
	DefineAndDrawWindow(screen.width-600/2,80,630,504+skin_height,0x34,system.color.work,WINDOW_HEADER,0);
188
	DefineAndDrawWindow(screen.width-600/2,80,630,504+skin_height,0x34,system.color.work,WINDOW_HEADER,0);
189
	GetProcessInfo(#Form, SelfInfo);
189
	GetProcessInfo(#Form, SelfInfo);
190
	IF (Form.status_window>=2) return;
190
	IF (Form.status_window>=2) return;
191
	DrawWindowContent();
191
	DrawWindowContent();
192
}
192
}
193
 
193
 
194
void DrawWindowContent()
194
void DrawWindowContent()
195
{
195
{
196
	int id;
196
	int id;
197
	int list_w;
197
	int list_w;
198
 
198
 
199
	system.color.get();	
199
	system.color.get();	
200
 
200
 
201
	if (tabs.active_tab == SKINS) list_w=250; else list_w=350;
201
	if (tabs.active_tab == SKINS) list_w=250; else list_w=350;
202
 
202
 
203
	tabs.w = Form.cwidth-LP-LP;
203
	tabs.w = Form.cwidth-LP-LP;
204
	tabs.h = Form.cheight-LP-LP;
204
	tabs.h = Form.cheight-LP-LP;
205
	tabs.draw_wrapper();
205
	tabs.draw_wrapper();
206
	tabs.draw_button(tabs.x+TAB_PADDING, SKINS, T_SKINS);	
206
	tabs.draw_button(tabs.x+TAB_PADDING, SKINS, T_SKINS);	
207
	tabs.draw_button(strlen(T_SKINS)*8+tabs.x+TAB_PADDING+TAB_PADDING, WALLPAPERS, T_WALLPAPERS);
207
	tabs.draw_button(strlen(T_SKINS)*8+tabs.x+TAB_PADDING+TAB_PADDING, WALLPAPERS, T_WALLPAPERS);
208
 
208
 
209
	id = select_list.cur_y;
209
	id = select_list.cur_y;
210
	SelectList_Init(
210
	SelectList_Init(
211
		tabs.x+TAB_PADDING,
211
		tabs.x+TAB_PADDING,
212
		tabs.y+TAB_HEIGHT+TAB_PADDING, 
212
		tabs.y+TAB_HEIGHT+TAB_PADDING, 
213
		list_w, 
213
		list_w, 
214
		tabs.h - TAB_PADDING - TAB_PADDING - TAB_HEIGHT, 
214
		tabs.h - TAB_PADDING - TAB_PADDING - TAB_HEIGHT, 
215
		false
215
		false
216
		);
216
		);
217
	select_list.cur_y = id;
217
	select_list.cur_y = id;
218
 
218
 
219
	skp.set_size(
219
	skp.set_size(
220
		select_list.x + select_list.w + TAB_PADDING + scroll1.size_x + 20,
220
		select_list.x + select_list.w + TAB_PADDING + scroll1.size_x + 20,
221
		select_list.y + 30 + 50,
221
		select_list.y + 30 + 50,
222
		list_w,
222
		list_w,
223
		230 //select_list.h - 50 - 50
223
		230 //select_list.h - 50 - 50
224
	);
224
	);
225
 
225
 
226
	SelectList_Draw();
226
	SelectList_Draw();
227
	SelectList_DrawBorder();
227
	SelectList_DrawBorder();
228
	//DrawWideRectangle(0, 0, Form.cwidth, Form.cheight, LP, system.color.work);
228
	//DrawWideRectangle(0, 0, Form.cwidth, Form.cheight, LP, system.color.work);
229
 
229
 
230
	if (tabs.active_tab == SKINS)
230
	if (tabs.active_tab == SKINS)
231
	{
231
	{
232
		update_docky.draw(skp.x, select_list.y+15);
232
		update_docky.draw(skp.x, select_list.y+15);
233
		DrawFrame(skp.x, skp.y, skp.w, skp.h, " Components Preview ");
233
		DrawFrame(skp.x, skp.y, skp.w, skp.h, " Components Preview ");
234
		DrawUiElementsPreview(skp.x+20, skp.y, skp.h);
234
		DrawUiElementsPreview(skp.x+20, skp.y, skp.h);
235
	}
235
	}
236
	if (tabs.active_tab == WALLPAPERS)
236
	if (tabs.active_tab == WALLPAPERS)
237
	{
237
	{
238
		skp.x -= TAB_PADDING + 3;
238
		skp.x -= TAB_PADDING + 3;
239
		DrawStandartCaptButton(skp.x, select_list.y, BTN_SELECT_WALLP_FOLDER, T_SELECT_FOLDER);
239
		DrawStandartCaptButton(skp.x, select_list.y, BTN_SELECT_WALLP_FOLDER, T_SELECT_FOLDER);
240
		DrawFrame(skp.x, select_list.y+50, 180, 80, T_PICTURE_MODE);
240
		DrawFrame(skp.x, select_list.y+50, 180, 80, T_PICTURE_MODE);
241
		optionbox_stretch.draw(skp.x+14, select_list.y+70);
241
		optionbox_stretch.draw(skp.x+14, select_list.y+70);
242
		optionbox_tiled.draw(skp.x+14, select_list.y+97);
242
		optionbox_tiled.draw(skp.x+14, select_list.y+97);
243
	}
243
	}
244
}
244
}
245
 
245
 
246
 
246
 
247
void Open_Dir()
247
void Open_Dir()
248
{
248
{
249
	int j;
249
	int j;
250
	select_list.count = 0;
250
	select_list.count = 0;
251
	if(io.dir.buffer)free(io.dir.buffer);
251
	if(io.dir.buffer)free(io.dir.buffer);
252
	io.dir.load(#folder_path,DIR_ONLYREAL);
252
	io.dir.load(#folder_path,DIR_ONLYREAL);
253
	for (j=0; j
253
	for (j=0; j
254
	{
254
	{
255
		strcpy(#temp_filename, io.dir.position(j));
255
		strcpy(#temp_filename, io.dir.position(j));
256
		strlwr(#temp_filename);
256
		strlwr(#temp_filename);
257
		if (tabs.active_tab==SKINS) {
257
		if (tabs.active_tab==SKINS) {
258
			if (strcmpi(#temp_filename+strlen(#temp_filename)-4,".skn")!=0) continue;
258
			if (strcmpi(#temp_filename+strlen(#temp_filename)-4,".skn")!=0) continue;
259
		}
259
		}
260
		if (tabs.active_tab==WALLPAPERS) {
260
		if (tabs.active_tab==WALLPAPERS) {
261
			if (strcmpi(#temp_filename+strlen(#temp_filename)-4,".png")!=0)
261
			if (strcmpi(#temp_filename+strlen(#temp_filename)-4,".png")!=0)
262
			&& (strcmpi(#temp_filename+strlen(#temp_filename)-4,".jpg")!=0) 
262
			&& (strcmpi(#temp_filename+strlen(#temp_filename)-4,".jpg")!=0) 
263
			&& (strcmpi(#temp_filename+strlen(#temp_filename)-5,".jpeg")!=0)
263
			&& (strcmpi(#temp_filename+strlen(#temp_filename)-5,".jpeg")!=0)
264
			&& (strcmpi(#temp_filename+strlen(#temp_filename)-4,".gif")!=0) continue;
264
			&& (strcmpi(#temp_filename+strlen(#temp_filename)-4,".gif")!=0) continue;
265
		}
265
		}
266
		cur = select_list.count;
266
		cur = select_list.count;
267
		files_mas[cur]=j;
267
		files_mas[cur]=j;
268
		if (!strcmpi("default.skn",#temp_filename)) files_mas[0]>
268
		if (!strcmpi("default.skn",#temp_filename)) files_mas[0]>
269
		select_list.count++;
269
		select_list.count++;
270
	}
270
	}
271
}
271
}
272
 
272
 
273
void SelectList_DrawLine(dword i)
273
void SelectList_DrawLine(dword i)
274
{
274
{
275
	int yyy, list_last;
275
	int yyy, list_last;
276
 
276
 
277
	cur = select_list.first + i;
277
	cur = select_list.first + i;
278
	strcpy(#temp_filename, io.dir.position(files_mas[cur]));
278
	strcpy(#temp_filename, io.dir.position(files_mas[cur]));
279
	temp_filename[strlen(#temp_filename)-4] = 0;
279
	temp_filename[strlen(#temp_filename)-4] = 0;
280
	yyy = i*select_list.item_h+select_list.y;
280
	yyy = i*select_list.item_h+select_list.y;
281
	
281
	
282
	if (select_list.cur_y-select_list.first==i)
282
	if (select_list.cur_y-select_list.first==i)
283
	{
283
	{
284
		DrawBar(select_list.x, yyy, select_list.w, select_list.item_h, system.color.work_button);
284
		DrawBar(select_list.x, yyy, select_list.w, select_list.item_h, system.color.work_button);
285
		WriteText(select_list.x+12,yyy+select_list.text_y,select_list.font_type,system.color.work_button_text, #temp_filename);
285
		WriteText(select_list.x+12,yyy+select_list.text_y,select_list.font_type,system.color.work_button_text, #temp_filename);
286
	}
286
	}
287
	else
287
	else
288
	{
288
	{
289
		DrawBar(select_list.x,yyy,select_list.w, select_list.item_h, 0xFFFfff);
289
		DrawBar(select_list.x,yyy,select_list.w, select_list.item_h, 0xFFFfff);
290
		WriteText(select_list.x+12,yyy+select_list.text_y,select_list.font_type,0, #temp_filename);
290
		WriteText(select_list.x+12,yyy+select_list.text_y,select_list.font_type,0, #temp_filename);
291
	}
291
	}
292
}
292
}
293
 
293
 
294
void SelectList_LineChanged() 
294
void SelectList_LineChanged() 
295
{
295
{
296
	EventApply();
296
	EventApply();
297
}
297
}
298
 
298
 
299
//===================================================//
299
//===================================================//
300
//                                                   //
300
//                                                   //
301
//                     EVENTS                        //
301
//                     EVENTS                        //
302
//                                                   //
302
//                                                   //
303
//===================================================//
303
//===================================================//
304
 
304
 
305
void EventTabClick(int N)
305
void EventTabClick(int N)
306
{
306
{
307
	tabs.click(N);
307
	tabs.click(N);
308
	if (tabs.active_tab == SKINS) 
308
	if (tabs.active_tab == SKINS) 
309
	{
309
	{
310
		active_wallpaper = select_list.cur_y;
310
		active_wallpaper = select_list.cur_y;
311
		strcpy(#folder_path, #skins_folder_path);
311
		strcpy(#folder_path, #skins_folder_path);
312
		select_list.ClearList();
312
		select_list.ClearList();
313
		Open_Dir();
313
		Open_Dir();
314
		if (!select_list.count) notify("'No skins were found' -E");
314
		if (!select_list.count) notify("'No skins were found' -E");
315
		select_list.cur_y = active_skin;
315
		select_list.cur_y = active_skin;
316
	}
316
	}
317
	if (tabs.active_tab == WALLPAPERS)
317
	if (tabs.active_tab == WALLPAPERS)
318
	{
318
	{
319
		active_skin = select_list.cur_y;
319
		active_skin = select_list.cur_y;
320
		strcpy(#folder_path, #wallp_folder_path);
320
		strcpy(#folder_path, #wallp_folder_path);
321
		select_list.ClearList();
321
		select_list.ClearList();
322
		Open_Dir();
322
		Open_Dir();
323
		if (!select_list.count) notify("'No wallpapers were found' -E");
323
		if (!select_list.count) notify("'No wallpapers were found' -E");
324
		select_list.cur_y = active_wallpaper;
324
		select_list.cur_y = active_wallpaper;
325
	}
325
	}
326
	if (select_list.cur_y>select_list.visible) select_list.first=select_list.cur_y; select_list.CheckDoesValuesOkey();
326
	if (select_list.cur_y>select_list.visible) select_list.first=select_list.cur_y; select_list.CheckDoesValuesOkey();
327
	if (select_list.w) draw_window();
327
	if (select_list.w) draw_window();
328
}
328
}
329
 
329
 
330
void EventDeleteFile()
330
void EventDeleteFile()
331
{
331
{
332
	io.del(#cur_file_path);
332
	io.del(#cur_file_path);
333
	Open_Dir();
333
	Open_Dir();
334
	EventApply();
334
	EventApply();
335
}
335
}
336
 
336
 
337
void EventSetNewCurrent()
337
void EventSetNewCurrent()
338
{
338
{
339
	cur = select_list.cur_y;
339
	cur = select_list.cur_y;
340
	sprintf(#cur_file_path,"%s/%s",#folder_path,io.dir.position(files_mas[cur]));
340
	sprintf(#cur_file_path,"%s/%s",#folder_path,io.dir.position(files_mas[cur]));
341
}
341
}
342
 
342
 
343
void EventSelectWallpFolder()
343
void EventSelectWallpFolder()
344
{
344
{
345
	OpenDialog_start stdcall (#o_dialog);
345
	OpenDialog_start stdcall (#o_dialog);
346
	if (o_dialog.status) {
346
	if (o_dialog.status) {
347
		strcpy(#wallp_folder_path, #opendir_path);
347
		strcpy(#wallp_folder_path, #opendir_path);
348
		EventTabClick(WALLPAPERS);
348
		EventTabClick(WALLPAPERS);
349
	}
349
	}
350
}
350
}
351
 
351
 
352
void EventSetWallpMode_Stretch()
352
void EventSetWallpMode_Stretch()
353
{
353
{
354
	optionbox_tiled.checked = false;
354
	optionbox_tiled.checked = false;
355
	optionbox_tiled.redraw();
355
	optionbox_tiled.redraw();
356
	EventApply();
356
	EventApply();
357
}
357
}
358
 
358
 
359
void EventSetWallpMode_Tiled()
359
void EventSetWallpMode_Tiled()
360
{
360
{
361
	optionbox_stretch.checked = false;
361
	optionbox_stretch.checked = false;
362
	optionbox_stretch.redraw();
362
	optionbox_stretch.redraw();
363
	EventApply();
363
	EventApply();
364
}
364
}
365
 
365
 
366
#include "..\lib\patterns\restart_process.h"
366
#include "..\lib\patterns\restart_process.h"
367
void EventApply()
367
void EventApply()
368
{
368
{
369
	char kivpath[4096+10];
369
	char kivpath[4096+10];
370
	EventSetNewCurrent();
370
	EventSetNewCurrent();
371
	if (tabs.active_tab==SKINS)
371
	if (tabs.active_tab==SKINS)
372
	{
372
	{
373
		cur = select_list.cur_y;
373
		cur = select_list.cur_y;
374
		SetSystemSkin(#cur_file_path);
374
		SetSystemSkin(#cur_file_path);
375
		SelectList_Draw();
375
		SelectList_Draw();
376
		strcpy(#cur_skin_path, #cur_file_path);
376
		strcpy(#cur_skin_path, #cur_file_path);
377
		EventUpdateDocky();
377
		EventUpdateDocky();
378
	} 
378
	} 
379
	if (tabs.active_tab==WALLPAPERS)
379
	if (tabs.active_tab==WALLPAPERS)
380
	{
380
	{
381
		SelectList_Draw();
381
		SelectList_Draw();
382
		if (optionbox_stretch.checked) strcpy(#kivpath, "\\S__");
382
		if (optionbox_stretch.checked) strcpy(#kivpath, "\\S__");
383
		if (optionbox_tiled.checked) strcpy(#kivpath, "\\T__");
383
		if (optionbox_tiled.checked) strcpy(#kivpath, "\\T__");
384
		strcat(#kivpath, #cur_file_path);
384
		strcat(#kivpath, #cur_file_path);
385
		RunProgram("/sys/media/kiv", #kivpath);
385
		RunProgram("/sys/media/kiv", #kivpath);
386
	}
386
	}
387
}
387
}
388
 
388
 
389
void EventUpdateDocky()
389
void EventUpdateDocky()
390
{
390
{
391
	if (!update_docky.checked) return;
391
	if (!update_docky.checked) return;
392
	KillProcessByName("@docky", MULTIPLE);
392
	KillProcessByName("@docky", MULTIPLE);
393
	RunProgram("/sys/@docky",NULL);
393
	RunProgram("/sys/@docky",NULL);
394
	pause(50);
394
	pause(50);
395
	ActivateWindow(GetProcessSlot(Form.ID));
395
	ActivateWindow(GetProcessSlot(Form.ID));
396
}
396
}
397
 
397
 
398
void EventOpenFile()
398
void EventOpenFile()
399
{
399
{
400
	if (tabs.active_tab==SKINS) RunProgram("/sys/skincfg", #cur_file_path);
400
	if (tabs.active_tab==SKINS) RunProgram("/sys/skincfg", #cur_file_path);
401
	if (tabs.active_tab==WALLPAPERS) RunProgram("/sys/media/kiv", #cur_file_path);
401
	if (tabs.active_tab==WALLPAPERS) RunProgram("/sys/media/kiv", #cur_file_path);
402
}
402
}
403
 
403
 
404
_ini ini = { "/sys/settings/eskin.ini", "main" };
404
_ini ini = { "/sys/settings/eskin.ini", "main" };
405
void EventExit()
405
void EventExit()
406
{
406
{
407
	if (cur_skin_path) ini.SetString("skin", #cur_skin_path, strlen(#cur_skin_path));
407
	if (cur_skin_path) ini.SetString("skin", #cur_skin_path, strlen(#cur_skin_path));
408
	ExitProcess();
408
	ExitProcess();
409
}
409
}
410
 
410
 
411
stop:
411
stop:
412
>
412
>