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