Subversion Repositories Kolibri OS

Rev

Rev 5478 | Rev 5532 | 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 "Настройки"
5526 leency 8
	?define SHOW_DEVICE_CLASS "Выводить названия класса устройств"
9
	?define SHOW_REAL_NAMES "Показывать имена файлов не меняя регистр"
10
	?define LIST_LINE_HEIGHT "Высота строки в списке"
11
	?define NOTIFY_COPY_END "Уведомлять о завершении копирования"
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"
5526 leency 17
	?define SHOW_DEVICE_CLASS "Show device class name"
18
	?define SHOW_REAL_NAMES "Show real file names without changing case"
19
	?define LIST_LINE_HEIGHT "List line height"
20
	?define NOTIFY_COPY_END "Notify when copying finished"
5428 leency 21
	?define CANCEL_T "Cancel"
22
	?define APPLY_T "Apply"
5416 punk_joker 23
#endif
24
 
5526 leency 25
char confir_section = "Config";
5416 punk_joker 26
 
5526 leency 27
 
5416 punk_joker 28
void settings_dialog()
29
{
30
	byte id;
31
	unsigned int key;
5435 leency 32
	proc_info settings_form;
5459 punk_joker 33
 
34
	if (active_settings) ExitProcess();
35
	active_settings=1;
5436 leency 36
 
5416 punk_joker 37
	loop() switch(WaitEvent())
38
	{
39
		case evButton:
40
				id=GetButtonID();
41
				if (id==10)
42
				{
5441 leency 43
					SaveIniSettings();
5459 punk_joker 44
					active_settings=0;
5428 leency 45
					action_buf = 300;
5416 punk_joker 46
					ExitProcess();
47
				}
5428 leency 48
				if (id==1) || (id==11)
5416 punk_joker 49
				{
5459 punk_joker 50
					active_settings=0;
5416 punk_joker 51
					ExitProcess();
52
				}
5435 leency 53
				if (id==5)
54
				{
55
					RunProgram("tinypad", "/sys/settings/assoc.ini");
5463 leency 56
					break;
5435 leency 57
				}
5463 leency 58
				if (id==20) show_dev_name ^= 1;
59
				if (id==21) real_files_names_case ^= 1;
60
				if (id==22) info_after_copy ^= 1;
5478 leency 61
				if (id==25) files.line_h++;
62
				if (id==26) && (files.line_h>8) files.line_h--;
5463 leency 63
				DrawSettingsCheckBoxes();
5416 punk_joker 64
				break;
65
 
66
		case evKey:
67
				key = GetKey();
5428 leency 68
				if (key==27)
5416 punk_joker 69
				{
5526 leency 70
					active_settings = 0;
5428 leency 71
					action_buf = 300;
5416 punk_joker 72
					ExitProcess();
73
				}
74
				break;
75
 
76
		case evReDraw:
5463 leency 77
				DefineAndDrawWindow(Form.left + 100, 150, 300, 210+GetSkinHeight(),0x34,sc.work,TITLE_SETT);
5435 leency 78
				GetProcessInfo(#settings_form, SelfInfo);
5463 leency 79
				DrawSettingsCheckBoxes();
5526 leency 80
				DrawFlatButton(9, 116, strlen(EDIT_FILE_ASSOCIATIONS)+4*6, 22, 5, 0xE4DFE1, EDIT_FILE_ASSOCIATIONS);
5435 leency 81
				DrawFlatButton(128, settings_form.cheight - 34, 70, 22, 10, 0xE4DFE1, APPLY_T);
82
				DrawFlatButton(208, settings_form.cheight - 34, 70, 22, 11, 0xE4DFE1, CANCEL_T);
5416 punk_joker 83
	}
5428 leency 84
}
85
 
5463 leency 86
void DrawSettingsCheckBoxes()
87
{
5526 leency 88
	CheckBox2(10, 11, 20, SHOW_DEVICE_CLASS,  show_dev_name);
89
	CheckBox2(10, 33, 21, SHOW_REAL_NAMES,  real_files_names_case);
90
	CheckBox2(10, 55, 22, NOTIFY_COPY_END,  info_after_copy);
91
	MoreLessBox(10, 82, 18, 25, 26, sc.work_graph, 0xD2D3D3, 0x000000, files.line_h, LIST_LINE_HEIGHT);
5463 leency 92
}
5428 leency 93
 
5463 leency 94
 
5441 leency 95
void LoadIniSettings()
5428 leency 96
{
5526 leency 97
	ini_get_color stdcall (eolite_ini_path, #confir_section, "SelectionColor", 0x94AECE);
5428 leency 98
	edit2.shift_color = EAX;
99
	col_selec = EAX;
5526 leency 100
	ini_get_int stdcall (eolite_ini_path, #confir_section, "LineHeight", 18);
5428 leency 101
	files.line_h = EAX;
5526 leency 102
	ini_get_int stdcall (eolite_ini_path, #confir_section, "ShowDeviceName", 1);
5428 leency 103
	show_dev_name = EAX;
5526 leency 104
	ini_get_int stdcall (eolite_ini_path, #confir_section, "RealFileNamesCase", 0);
5428 leency 105
	real_files_names_case = EAX;
5526 leency 106
	ini_get_int stdcall (eolite_ini_path, #confir_section, "InfoAfterCopy", 0);
5459 punk_joker 107
	info_after_copy = EAX;
5428 leency 108
}
109
 
5441 leency 110
void SaveIniSettings()
111
{
5526 leency 112
	ini_set_int stdcall (eolite_ini_path, #confir_section, "ShowDeviceName", show_dev_name);
113
	ini_set_int stdcall (eolite_ini_path, #confir_section, "RealFileNamesCase", real_files_names_case);
114
	ini_set_int stdcall (eolite_ini_path, #confir_section, "InfoAfterCopy", info_after_copy);
115
	ini_set_int stdcall (eolite_ini_path, #confir_section, "LineHeight", files.line_h);
5441 leency 116
}
5428 leency 117
 
5441 leency 118
 
119
 
5428 leency 120
void Write_Error(int error_number)
121
{
122
	char error_message[500];
123
	dword ii;
124
	if (files.current>=0) Line_ReDraw(0xFF0000, files.current);
125
	pause(5);
126
	strcpy(#error_message, "\"Eolite\n");
127
	ii = get_error(error_number);
128
	strcat(#error_message, ii);
129
	strcat(#error_message, "\" -tE");
130
	notify(#error_message);
131
}
132
 
133
 
134
void SetAppColors()
135
{
136
	sc.work = 0xE4DFE1;
137
	sc.work_text = 0;
138
	sc.work_graph  = 0x9098B0; //A0A0B8; //0x819FC5;
139
	sc.work_button_text = 0x000000;
140
	col_padding = 0xC8C9C9;
141
	//col_selec   = 0x94AECE;
142
	col_lpanel  = 0x00699C;
5463 leency 143
}
144
 
145
 
146
void CheckBox2(dword x, y, id, text, byte value) {
147
	CheckBox(x, y, 14, 14, id, text, sc.work_graph, sc.work_text, value);
5416 punk_joker 148
}