Subversion Repositories Kolibri OS

Rev

Rev 5459 | Rev 5464 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5428 leency 1
//Leency 2008-2015
5416 punk_joker 2
 
3
#define EDITOR_PATH     "/sys/tinypad"
4
 
5
#ifdef LANG_RUS
5435 leency 6
	?define EDIT_FILE_ASSOCIATIONS "Редактировать ассоциации файлов"
5416 punk_joker 7
	?define TITLE_SETT "Настройки"
5428 leency 8
	?define SET_1 "Выводить названия класса устройств"
9
	?define SET_2 "Показывать имена файлов не меняя регистр"
10
	?define SET_3 "Высота строки в списке"
5459 punk_joker 11
	?define SET_4 "Уведомлять о завершении копирования"
5416 punk_joker 12
	?define CANCEL_T "Отмена"
13
	?define APPLY_T "Применить"
14
#else
5435 leency 15
	?define EDIT_FILE_ASSOCIATIONS "Edit file associations"
5428 leency 16
	?define TITLE_SETT "Settings"
17
	?define SET_1 "Show device class name"
18
	?define SET_2 "Show real file names without changing case"
19
	?define SET_3 "List line height"
5459 punk_joker 20
	?define SET_4 "To notify the completion of the copy"
5428 leency 21
	?define CANCEL_T "Cancel"
22
	?define APPLY_T "Apply"
5416 punk_joker 23
#endif
24
 
25
int	mouse_ddd;
26
char lineh_s[30]="18\0";
5463 leency 27
edit_box LineHeight_ed = {52,10,97,0xffffff,0x94AECE,0xffc90E,0xffffff,2,4,#lineh_s,#mouse_ddd, 1000000000000000b,2,2};
5416 punk_joker 28
 
29
void settings_dialog()
30
{
31
	byte id;
32
	unsigned int key;
5435 leency 33
	proc_info settings_form;
5459 punk_joker 34
 
35
	if (active_settings) ExitProcess();
36
	active_settings=1;
5436 leency 37
 
5416 punk_joker 38
	SetEventMask(0x27);
39
	loop() switch(WaitEvent())
40
	{
41
		case evButton:
42
				id=GetButtonID();
43
				if (id==10)
44
				{
5441 leency 45
					SaveIniSettings();
5459 punk_joker 46
					active_settings=0;
5428 leency 47
					action_buf = 300;
5416 punk_joker 48
					ExitProcess();
49
				}
5428 leency 50
				if (id==1) || (id==11)
5416 punk_joker 51
				{
5459 punk_joker 52
					active_settings=0;
5416 punk_joker 53
					ExitProcess();
54
				}
5435 leency 55
				if (id==5)
56
				{
57
					RunProgram("tinypad", "/sys/settings/assoc.ini");
5463 leency 58
					break;
5435 leency 59
				}
5463 leency 60
				if (id==20) show_dev_name ^= 1;
61
				if (id==21) real_files_names_case ^= 1;
62
				if (id==22) info_after_copy ^= 1;
63
				DrawSettingsCheckBoxes();
5416 punk_joker 64
				break;
65
 
66
		case evKey:
67
				key = GetKey();
5428 leency 68
				if (key==27)
5416 punk_joker 69
				{
5459 punk_joker 70
					active_settings=0;
5428 leency 71
					action_buf = 300;
5416 punk_joker 72
					ExitProcess();
73
				}
74
				EAX=key<<8;
75
				edit_box_key stdcall(#LineHeight_ed);
76
				break;
77
 
78
		case evMouse:
79
				edit_box_mouse stdcall (#LineHeight_ed);
80
				break;
81
 
82
		case evReDraw:
5463 leency 83
				DefineAndDrawWindow(Form.left + 100, 150, 300, 210+GetSkinHeight(),0x34,sc.work,TITLE_SETT);
5435 leency 84
				GetProcessInfo(#settings_form, SelfInfo);
5444 leency 85
 
5463 leency 86
				DrawSettingsCheckBoxes();
5444 leency 87
 
5463 leency 88
				WriteText(10, 84, 0x80, 0x000000, SET_3);
5416 punk_joker 89
				key = itoa(files.line_h);
90
				strcpy(#lineh_s, key);
91
				edit_box_draw stdcall (#LineHeight_ed);
5435 leency 92
				DrawRectangle(LineHeight_ed.left-1, LineHeight_ed.top-1, LineHeight_ed.width+2, 16, sc.work_graph);
5463 leency 93
 
94
				DrawFlatButton(9, 127, strlen(EDIT_FILE_ASSOCIATIONS)+4*6, 22, 5, 0xE4DFE1, EDIT_FILE_ASSOCIATIONS);
95
 
5435 leency 96
				DrawFlatButton(128, settings_form.cheight - 34, 70, 22, 10, 0xE4DFE1, APPLY_T);
97
				DrawFlatButton(208, settings_form.cheight - 34, 70, 22, 11, 0xE4DFE1, CANCEL_T);
5416 punk_joker 98
	}
5428 leency 99
}
100
 
5463 leency 101
void DrawSettingsCheckBoxes()
102
{
103
	CheckBox2(10, 11, 20, SET_1,  show_dev_name);
104
	CheckBox2(10, 33, 21, SET_2,  real_files_names_case);
105
	CheckBox2(10, 55, 22, SET_3,  info_after_copy);
106
}
5428 leency 107
 
5463 leency 108
 
5441 leency 109
void LoadIniSettings()
5428 leency 110
{
111
	ini_get_color stdcall (eolite_ini_path, "Config", "SelectionColor", 0x94AECE);
112
	edit2.shift_color = EAX;
113
	col_selec = EAX;
114
	ini_get_int stdcall (eolite_ini_path, "Config", "LineHeight", 18);
115
	files.line_h = EAX;
116
	ini_get_int stdcall (eolite_ini_path, "Config", "ShowDeviceName", 1);
117
	show_dev_name = EAX;
118
	ini_get_int stdcall (eolite_ini_path, "Config", "RealFileNamesCase", 0);
119
	real_files_names_case = EAX;
5459 punk_joker 120
	ini_get_int stdcall (eolite_ini_path, "Config", "InfoAfterCopy", 0);
121
	info_after_copy = EAX;
5428 leency 122
}
123
 
5441 leency 124
void SaveIniSettings()
125
{
126
	ini_set_int stdcall (eolite_ini_path, "Config", "ShowDeviceName", show_dev_name);
127
	ini_set_int stdcall (eolite_ini_path, "Config", "RealFileNamesCase", real_files_names_case);
5459 punk_joker 128
	ini_set_int stdcall (eolite_ini_path, "Config", "InfoAfterCopy", info_after_copy);
5441 leency 129
	ini_set_int stdcall (eolite_ini_path, "Config", "LineHeight", atoi(#lineh_s));
130
}
5428 leency 131
 
5441 leency 132
 
133
 
5428 leency 134
void Write_Error(int error_number)
135
{
136
	char error_message[500];
137
	dword ii;
138
	if (files.current>=0) Line_ReDraw(0xFF0000, files.current);
139
	pause(5);
140
	strcpy(#error_message, "\"Eolite\n");
141
	ii = get_error(error_number);
142
	strcat(#error_message, ii);
143
	strcat(#error_message, "\" -tE");
144
	notify(#error_message);
145
}
146
 
147
 
148
void SetAppColors()
149
{
150
	sc.work = 0xE4DFE1;
151
	sc.work_text = 0;
152
	sc.work_graph  = 0x9098B0; //A0A0B8; //0x819FC5;
153
	sc.work_button_text = 0x000000;
154
	col_padding = 0xC8C9C9;
155
	//col_selec   = 0x94AECE;
156
	col_lpanel  = 0x00699C;
5463 leency 157
}
158
 
159
 
160
void CheckBox2(dword x, y, id, text, byte value) {
161
	CheckBox(x, y, 14, 14, id, text, sc.work_graph, sc.work_text, value);
5416 punk_joker 162
}