Rev 5532 | Rev 5550 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5532 | Rev 5549 | ||
---|---|---|---|
1 | //Leency, Veliant, Punk_Joker & KolibriOS Team 2008-2015 |
1 | //Leency, Veliant, Punk_Joker & KolibriOS Team 2008-2015 |
2 | //GNU GPL licence. |
2 | //GNU GPL licence. |
3 | 3 | ||
4 | #ifndef AUTOBUILD |
4 | #ifndef AUTOBUILD |
5 | #include "lang.h--" |
5 | #include "lang.h--" |
6 | #endif |
6 | #endif |
7 | 7 | ||
8 | //libraries |
8 | //libraries |
9 | #define MEMSIZE 0xD0000 |
9 | #define MEMSIZE 0xD0000 |
10 | #include "..\lib\kolibri.h" |
10 | #include "..\lib\kolibri.h" |
11 | #include "..\lib\clipboard.h" |
11 | #include "..\lib\clipboard.h" |
12 | #include "..\lib\strings.h" |
12 | #include "..\lib\strings.h" |
13 | #include "..\lib\mem.h" |
13 | #include "..\lib\mem.h" |
14 | #include "..\lib\dll.h" |
14 | #include "..\lib\dll.h" |
15 | #include "..\lib\file_system.h" |
15 | #include "..\lib\file_system.h" |
16 | #include "..\lib\gui.h" |
16 | #include "..\lib\gui.h" |
17 | #include "..\lib\list_box.h" |
17 | #include "..\lib\list_box.h" |
18 | #include "..\lib\copyf.h" |
18 | #include "..\lib\copyf.h" |
19 | #include "..\lib\random.h" |
19 | #include "..\lib\random.h" |
20 | //obj |
20 | //obj |
21 | #include "..\lib\obj\libini.h" |
21 | #include "..\lib\obj\libini.h" |
22 | #include "..\lib\obj\box_lib.h" |
22 | #include "..\lib\obj\box_lib.h" |
23 | //images |
23 | //images |
24 | #include "imgs\toolbar.txt" |
24 | #include "imgs\toolbar.txt" |
25 | #include "imgs\left_p.txt" |
25 | #include "imgs\left_p.txt" |
26 | #include "imgs\icons.txt" |
26 | #include "imgs\icons.txt" |
27 | 27 | ||
28 | #ifdef LANG_RUS |
28 | #ifdef LANG_RUS |
29 | ?define T_FILE " ©«" |
29 | ?define T_FILE " ©«" |
30 | ?define T_TYPE "¨¯" |
30 | ?define T_TYPE "¨¯" |
31 | ?define T_SIZE " §¬¥à" |
31 | ?define T_SIZE " §¬¥à" |
32 | ?define T_NEW_FOLDER "®¢ ï ¯ ¯ª " |
32 | ?define T_NEW_FOLDER "®¢ ï ¯ ¯ª " |
33 | ?define T_NEW_FILE "®¢ë© ä ©«" |
33 | ?define T_NEW_FILE "®¢ë© ä ©«" |
34 | ?define T_DELETE_FILE "ë ¤¥©áâ¢¨â¥«ì® å®â¨â¥ 㤠«¨âì" |
34 | ?define T_DELETE_FILE "ë ¤¥©áâ¢¨â¥«ì® å®â¨â¥ 㤠«¨âì" |
35 | ?define T_YES " " |
35 | ?define T_YES " " |
36 | ?define T_NO "¥â" |
36 | ?define T_NO "¥â" |
37 | ?define T_DEL_ERROR_1 "訡ª . ¯ª ¥ ¯ãáâ ï." |
37 | ?define T_DEL_ERROR_1 "訡ª . ¯ª ¥ ¯ãáâ ï." |
38 | ?define WAIT_DELETING_FOLDER "¤ «ï¥âáï ¯ ¯ª . ®¤®¦¨â¥..." |
38 | ?define WAIT_DELETING_FOLDER "¤ «ï¥âáï ¯ ¯ª . ®¤®¦¨â¥..." |
39 | ?define NOT_CREATE_FOLDER "¥ 㤠«®áì ᮧ¤ âì ¯ ¯ªã." |
39 | ?define NOT_CREATE_FOLDER "¥ 㤠«®áì ᮧ¤ âì ¯ ¯ªã." |
40 | ?define NOT_CREATE_FILE "¥ 㤠«®áì ᮧ¤ âì ä ©«." |
40 | ?define NOT_CREATE_FILE "¥ 㤠«®áì ᮧ¤ âì ä ©«." |
41 | ?define ERROR_1 "訡ª ¯à¨ § £à㧪¥ ¡¨¡«¨®â¥ª¨ /rd/1/lib/box_lib.obj" |
41 | ?define ERROR_1 "訡ª ¯à¨ § £à㧪¥ ¡¨¡«¨®â¥ª¨ /rd/1/lib/box_lib.obj" |
42 | ?define T_PASTE_WINDOW_TITLE "®¯¨àãî..." |
42 | ?define T_PASTE_WINDOW_TITLE "®¯¨àãî..." |
43 | ?define T_PASTE_WINDOW_TEXT "®¯¨àã¥âáï ä ©«:" |
43 | ?define T_PASTE_WINDOW_TEXT "®¯¨àã¥âáï ä ©«:" |
44 | ?define T_PASTE_WINDOW_BUTTON "à¥à¢ âì" |
44 | ?define T_PASTE_WINDOW_BUTTON "à¥à¢ âì" |
45 | ?define INFO_AFTER_COPY "®¯¨à®¢ ¨¥ § ¢¥à襮" |
45 | ?define INFO_AFTER_COPY "®¯¨à®¢ ¨¥ § ¢¥à襮" |
46 | ?define T_CANCEL_PASTE "®¯¨à®¢ ¨¥ ¯à¥ªà 饮. ¯ª ᪮¯¨à®¢ ¥ ¯®«®áâìî." |
46 | ?define T_CANCEL_PASTE "®¯¨à®¢ ¨¥ ¯à¥ªà 饮. ¯ª ᪮¯¨à®¢ ¥ ¯®«®áâìî." |
47 | ?define T_SELECT_APP_TO_OPEN_WITH "ë¡¥à¨â¥ ¯à®£à ¬¬ã ¤«ï ®âªàëâ¨ï ä ©« " |
47 | ?define T_SELECT_APP_TO_OPEN_WITH "ë¡¥à¨â¥ ¯à®£à ¬¬ã ¤«ï ®âªàëâ¨ï ä ©« " |
48 | ?define DEL_MORE_FILES_1 "¢ë¡à ë¥ í«¥¬¥âë (" |
48 | ?define DEL_MORE_FILES_1 "¢ë¡à ë¥ í«¥¬¥âë (" |
49 | ?define DEL_MORE_FILES_2 " èâ.)?" |
49 | ?define DEL_MORE_FILES_2 " èâ.)?" |
50 | #elif LANG_EST |
50 | #elif LANG_EST |
51 | ?define T_FILE "Fail" |
51 | ?define T_FILE "Fail" |
52 | ?define T_TYPE "Tüüp" |
52 | ?define T_TYPE "Tüüp" |
53 | ?define T_SIZE "Suurus" |
53 | ?define T_SIZE "Suurus" |
54 | ?define T_NEW_FOLDER "Uus kataloog" |
54 | ?define T_NEW_FOLDER "Uus kataloog" |
55 | ?define T_NEW_FILE "Uus fail" |
55 | ?define T_NEW_FILE "Uus fail" |
56 | ?define T_DELETE_FILE "Kas sa tahad tõesti kustutada" |
56 | ?define T_DELETE_FILE "Kas sa tahad tõesti kustutada" |
57 | ?define T_YES "Jah" |
57 | ?define T_YES "Jah" |
58 | ?define T_NO "Ei" |
58 | ?define T_NO "Ei" |
59 | ?define T_DEL_ERROR_1 "Viga. Kataloog ei ole tühi." |
59 | ?define T_DEL_ERROR_1 "Viga. Kataloog ei ole tühi." |
60 | ?define WAIT_DELETING_FOLDER "Deleting folder. Please, wait..." |
60 | ?define WAIT_DELETING_FOLDER "Deleting folder. Please, wait..." |
61 | ?define NOT_CREATE_FOLDER "Kataloogi ei saa luua." |
61 | ?define NOT_CREATE_FOLDER "Kataloogi ei saa luua." |
62 | ?define NOT_CREATE_FILE "Faili ei saa luua." |
62 | ?define NOT_CREATE_FILE "Faili ei saa luua." |
63 | ?define ERROR_1 "Viga teegi laadimisel /rd/1/lib/box_lib.obj" |
63 | ?define ERROR_1 "Viga teegi laadimisel /rd/1/lib/box_lib.obj" |
64 | ?define T_PASTE_WINDOW_TITLE "Kopeerin..." |
64 | ?define T_PASTE_WINDOW_TITLE "Kopeerin..." |
65 | ?define T_PASTE_WINDOW_TEXT "Kopeerin faili:" |
65 | ?define T_PASTE_WINDOW_TEXT "Kopeerin faili:" |
66 | ?define T_PASTE_WINDOW_BUTTON "Abort" |
66 | ?define T_PASTE_WINDOW_BUTTON "Abort" |
67 | ?define INFO_AFTER_COPY "Copy finished" |
67 | ?define INFO_AFTER_COPY "Copy finished" |
68 | ?define T_CANCEL_PASTE "Copy process terminated. Folder copied incompletely." |
68 | ?define T_CANCEL_PASTE "Copy process terminated. Folder copied incompletely." |
69 | ?define T_SELECT_APP_TO_OPEN_WITH "Select application to open file" |
69 | ?define T_SELECT_APP_TO_OPEN_WITH "Select application to open file" |
70 | ?define DEL_MORE_FILES_1 "selected items(" |
70 | ?define DEL_MORE_FILES_1 "selected items(" |
71 | ?define DEL_MORE_FILES_2 " pcs.)?" |
71 | ?define DEL_MORE_FILES_2 " pcs.)?" |
72 | #else |
72 | #else |
73 | ?define T_FILE "File" |
73 | ?define T_FILE "File" |
74 | ?define T_TYPE "Type" |
74 | ?define T_TYPE "Type" |
75 | ?define T_SIZE "Size" |
75 | ?define T_SIZE "Size" |
76 | ?define T_NEW_FOLDER "New folder" |
76 | ?define T_NEW_FOLDER "New folder" |
77 | ?define T_NEW_FILE "New file" |
77 | ?define T_NEW_FILE "New file" |
78 | ?define T_DELETE_FILE "Do you really want to delete" |
78 | ?define T_DELETE_FILE "Do you really want to delete" |
79 | ?define T_YES "Yes" |
79 | ?define T_YES "Yes" |
80 | ?define T_NO "No" |
80 | ?define T_NO "No" |
81 | ?define T_DEL_ERROR_1 "Error. Folder isn't empty." |
81 | ?define T_DEL_ERROR_1 "Error. Folder isn't empty." |
82 | ?define WAIT_DELETING_FOLDER "Deleting folder. Please, wait..." |
82 | ?define WAIT_DELETING_FOLDER "Deleting folder. Please, wait..." |
83 | ?define NOT_CREATE_FOLDER "Folder can not be created." |
83 | ?define NOT_CREATE_FOLDER "Folder can not be created." |
84 | ?define NOT_CREATE_FILE "File can not be created." |
84 | ?define NOT_CREATE_FILE "File can not be created." |
85 | ?define ERROR_1 "Error while loading library /rd/1/lib/box_lib.obj" |
85 | ?define ERROR_1 "Error while loading library /rd/1/lib/box_lib.obj" |
86 | ?define T_PASTE_WINDOW_TITLE "Copying..." |
86 | ?define T_PASTE_WINDOW_TITLE "Copying..." |
87 | ?define T_PASTE_WINDOW_TEXT "Copying file:" |
87 | ?define T_PASTE_WINDOW_TEXT "Copying file:" |
88 | ?define T_PASTE_WINDOW_BUTTON "Abort" |
88 | ?define T_PASTE_WINDOW_BUTTON "Abort" |
89 | ?define INFO_AFTER_COPY "Copy finished" |
89 | ?define INFO_AFTER_COPY "Copy finished" |
90 | ?define T_CANCEL_PASTE "Copy process terminated. Folder copied incompletely." |
90 | ?define T_CANCEL_PASTE "Copy process terminated. Folder copied incompletely." |
91 | ?define T_SELECT_APP_TO_OPEN_WITH "Select application to open file" |
91 | ?define T_SELECT_APP_TO_OPEN_WITH "Select application to open file" |
92 | ?define DEL_MORE_FILES_1 "selected items(" |
92 | ?define DEL_MORE_FILES_1 "selected items(" |
93 | ?define DEL_MORE_FILES_2 " pcs.)?" |
93 | ?define DEL_MORE_FILES_2 " pcs.)?" |
94 | #endif |
94 | #endif |
95 | 95 | ||
96 | enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir |
96 | enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir |
97 | 97 | ||
98 | #define TITLE "Eolite File Manager v2.7" |
98 | #define TITLE "Eolite File Manager v2.72" |
99 | #define ABOUT_TITLE "Eolite v2.7" |
99 | #define ABOUT_TITLE "Eolite v2.72" |
100 | dword col_padding, col_selec, col_lpanel; |
100 | dword col_padding, col_selec, col_lpanel; |
101 | 101 | ||
102 | int toolbar_buttons_x[7]={9,46,85,134,167,203}; |
102 | int toolbar_buttons_x[7]={9,46,85,134,167,203}; |
103 | struct path_string { char Item[4096]; }; |
103 | struct path_string { char Item[4096]; }; |
104 | 104 | ||
105 | byte active_about=0; |
105 | byte active_about=0; |
106 | word about_window; |
106 | word about_window; |
107 | byte active_settings=0; |
107 | byte active_settings=0; |
108 | word settings_window; |
108 | word settings_window; |
109 | 109 | ||
110 | byte menu_call_mouse=0; |
110 | byte menu_call_mouse=0; |
111 | 111 | ||
112 | llist files; |
112 | llist files; |
113 | 113 | ||
114 | byte |
114 | byte |
115 | path[4096], |
115 | path[4096], |
116 | file_path[4096], |
116 | file_path[4096], |
117 | file_name[256], |
117 | file_name[256], |
118 | temp[4096]; |
118 | temp[4096]; |
119 | byte |
119 | byte |
120 | rename_active=0, |
120 | rename_active=0, |
121 | del_active=0, |
121 | del_active=0, |
122 | show_dev_name=1, |
122 | show_dev_name=1, |
123 | real_files_names_case=0, |
123 | real_files_names_case=0, |
124 | use_big_fonts=0, |
124 | use_big_fonts=0, |
125 | font_type, |
125 | font_type, |
126 | info_after_copy=0, |
126 | info_after_copy=0, |
127 | sort_num=2, |
127 | sort_num=2, |
128 | itdir; |
128 | itdir; |
129 | 129 | ||
130 | dword eolite_ini_path; |
130 | dword eolite_ini_path; |
131 | 131 | ||
132 | proc_info Form; |
132 | proc_info Form; |
133 | system_colors sc; |
133 | system_colors sc; |
134 | mouse m; |
134 | mouse m; |
135 | int mouse_dd, scroll_used, sc_slider_h, sorting_arrow_x, kolibrios_drive; |
135 | int mouse_dd, scroll_used, sc_slider_h, sorting_arrow_x, kolibrios_drive; |
136 | dword buf; |
136 | dword buf; |
137 | dword file_mas[6898]; |
137 | dword file_mas[6898]; |
138 | int j, i; |
138 | int j, i; |
139 | int action_buf; |
139 | int action_buf; |
140 | int rand_n; |
140 | int rand_n; |
141 | int selected_count; |
141 | int selected_count; |
- | 142 | ||
- | 143 | mouse gestures; |
|
- | 144 | signed x_old, y_old, dif_x, dif_y, adif_x, adif_y; |
|
- | 145 | byte stats; |
|
142 | 146 | ||
143 | edit_box edit2 = {250,213,80,0xFFFFCC,0x94AECE,0xFFFFCC,0xffffff,0,248,#file_name,#mouse_dd,64,6,6}; |
147 | edit_box edit2 = {250,213,80,0xFFFFCC,0x94AECE,0xFFFFCC,0xffffff,0,248,#file_name,#mouse_dd,64,6,6}; |
144 | PathShow_data PathShow = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, #path, #temp, 0}; |
148 | PathShow_data PathShow = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, #path, #temp, 0}; |
145 | PathShow_data FileShow = {0, 56,215, 6, 100, 0, 0, 0x0, 0xFFFfff, #file_name, #temp, 0}; |
149 | PathShow_data FileShow = {0, 56,215, 6, 100, 0, 0, 0x0, 0xFFFfff, #file_name, #temp, 0}; |
146 | 150 | ||
147 | #include "include\copy.h" |
151 | #include "include\copy.h" |
148 | #include "include\gui.h" |
152 | #include "include\gui.h" |
149 | #include "include\sorting.h" |
153 | #include "include\sorting.h" |
150 | #include "include\icons.h" |
154 | #include "include\icons.h" |
151 | #include "include\left_panel.h" |
155 | #include "include\left_panel.h" |
152 | #include "include\history.h" |
156 | #include "include\history.h" |
153 | #include "include\menu.h" |
157 | #include "include\menu.h" |
154 | #include "include\about.h" |
158 | #include "include\about.h" |
155 | #include "include\settings.h" |
159 | #include "include\settings.h" |
156 | #include "include\properties.h" |
160 | #include "include\properties.h" |
157 | 161 | ||
158 | void main() |
162 | void main() |
159 | { |
163 | { |
160 | word key, id, can_show, can_select, m_selected; |
164 | word key, id, can_show, can_select, m_selected; |
161 | dword selected_offset; |
165 | dword selected_offset; |
162 | rand_n = random(40); |
166 | rand_n = random(40); |
163 | - | ||
- | 167 | gestures.get(); |
|
164 | mem_Init(); |
168 | mem_Init(); |
165 | if (load_dll2(boxlib, #box_lib_init,0)!=0) notify(ERROR_1); |
169 | if (load_dll2(boxlib, #box_lib_init,0)!=0) notify(ERROR_1); |
166 | if (load_dll2(libini, #lib_init,1)!=0) notify("Error: library doesn't exists - libini"); |
170 | if (load_dll2(libini, #lib_init,1)!=0) notify("Error: library doesn't exists - libini"); |
167 | eolite_ini_path = abspath("Eolite.ini"); |
171 | eolite_ini_path = abspath("Eolite.ini"); |
168 | LoadIniSettings(); |
172 | LoadIniSettings(); |
169 | GetSystemDiscs(); |
173 | GetSystemDiscs(); |
170 | SetAppColors(); |
174 | SetAppColors(); |
171 | if (param) |
175 | if (param) |
172 | { |
176 | { |
173 | strcpy(#path, #param); |
177 | strcpy(#path, #param); |
174 | if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //add "/" to the end of the string |
178 | if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //add "/" to the end of the string |
175 | } |
179 | } |
176 | else |
180 | else |
177 | { |
181 | { |
178 | strcpy(#path, "/rd/1/"); |
182 | strcpy(#path, "/rd/1/"); |
179 | } |
183 | } |
180 | Open_Dir(#path,ONLY_OPEN); |
184 | Open_Dir(#path,ONLY_OPEN); |
181 | SetEventMask(0x27); |
185 | SetEventMask(0x27); |
182 | loop() switch(WaitEvent()) |
186 | loop() switch(WaitEvent()) |
183 | { |
187 | { |
184 | case evMouse: |
188 | case evMouse: |
185 | if (del_active) || (!CheckActiveProcess(Form.ID)) || (Form.status_window>2) break; |
189 | if (del_active) || (!CheckActiveProcess(Form.ID)) || (Form.status_window>2) break; |
186 | if (rename_active) { edit_box_mouse stdcall(#edit2); break; } |
190 | if (rename_active) { edit_box_mouse stdcall(#edit2); break; } |
187 | 191 | ||
188 | m.get(); |
192 | m.get(); |
- | 193 | ||
- | 194 | ||
- | 195 | gestures.get(); |
|
- | 196 | if (gestures.mkm) && (stats==0) |
|
- | 197 | { |
|
- | 198 | x_old = gestures.x; |
|
- | 199 | y_old = gestures.y; |
|
- | 200 | stats = 1; |
|
- | 201 | } |
|
- | 202 | if (gestures.mkm) && (stats==1) |
|
- | 203 | { |
|
- | 204 | dif_x = gestures.x-x_old; |
|
- | 205 | dif_y = gestures.y-y_old; |
|
- | 206 | ||
- | 207 | if (dif_x<0) adif_x = -dif_x; |
|
- | 208 | else adif_x = dif_x; |
|
- | 209 | if (dif_y<0) adif_y = -dif_y; |
|
- | 210 | else adif_y = dif_y; |
|
- | 211 | ||
- | 212 | if (adif_x>adif_y) |
|
- | 213 | { |
|
- | 214 | if (dif_x > 150) |
|
- | 215 | { |
|
- | 216 | if (HistoryPath(GO_FORWARD)) |
|
- | 217 | { |
|
- | 218 | files.first=files.current=NULL; //aaa?o nienea |
|
- | 219 | Open_Dir(#path,WITH_REDRAW); |
|
- | 220 | } |
|
- | 221 | stats = 0; |
|
- | 222 | } |
|
- | 223 | if (dif_x < -150) |
|
- | 224 | { |
|
- | 225 | GoBack(); |
|
- | 226 | stats = 0; |
|
- | 227 | } |
|
- | 228 | } |
|
- | 229 | else |
|
- | 230 | { |
|
- | 231 | if (dif_y < -150) |
|
- | 232 | { |
|
- | 233 | Dir_Up(); |
|
- | 234 | stats = 0; |
|
- | 235 | } |
|
- | 236 | } |
|
- | 237 | } |
|
- | 238 | ||
189 | 239 | ||
190 | if (files.MouseOver(m.x, m.y)) && (!can_select) |
240 | if (files.MouseOver(m.x, m.y)) && (!can_select) |
191 | { |
241 | { |
192 | m_selected = m.y - files.y / files.line_h; |
242 | m_selected = m.y - files.y / files.line_h; |
193 | if (m.lkm) can_select = 1; |
243 | if (m.lkm) can_select = 1; |
194 | if (m.pkm) |
244 | if (m.pkm) |
195 | { |
245 | { |
196 | can_show = 1; |
246 | can_show = 1; |
197 | if (m.y - files.y / files.line_h != files.current) can_select = 1; |
247 | if (m.y - files.y / files.line_h != files.current) can_select = 1; |
198 | } |
248 | } |
199 | } |
249 | } |
200 | 250 | ||
201 | //select/open file { |
251 | //select/open file { |
202 | if (!m.lkm) && (!m.pkm) && (can_select) |
252 | if (!m.lkm) && (!m.pkm) && (can_select) |
203 | { |
253 | { |
204 | can_select = 0; |
254 | can_select = 0; |
205 | if (m.y>=files.y) |
255 | if (m.y>=files.y) |
206 | { |
256 | { |
207 | id = m.y - files.y / files.line_h; |
257 | id = m.y - files.y / files.line_h; |
208 | if (id!=m_selected) |
258 | if (id!=m_selected) |
209 | { |
259 | { |
210 | can_show=0; |
260 | can_show=0; |
211 | break; |
261 | break; |
212 | } |
262 | } |
213 | if (files.current!=id) |
263 | if (files.current!=id) |
214 | { |
264 | { |
215 | if (id |
265 | if (id |
216 | } |
266 | } |
217 | else |
267 | else |
218 | Open(0); |
268 | Open(0); |
219 | } |
269 | } |
220 | }; |
270 | }; |
221 | // } select/open file |
271 | // } select/open file |
222 | 272 | ||
223 | //file menu { |
273 | //file menu { |
224 | if (!m.pkm) && (!m.lkm) && (can_show) |
274 | if (!m.pkm) && (!m.lkm) && (can_show) |
225 | { |
275 | { |
226 | can_show = 0; |
276 | can_show = 0; |
227 | menu_call_mouse = 1; |
277 | menu_call_mouse = 1; |
228 | if (m.y>=files.y) |
278 | if (m.y>=files.y) |
229 | { |
279 | { |
230 | SwitchToAnotherThread(); |
280 | SwitchToAnotherThread(); |
231 | CreateThread(#FileMenu,#menu_stak+4092); |
281 | CreateThread(#FileMenu,#menu_stak+4092); |
232 | } |
282 | } |
233 | break; |
283 | break; |
234 | } |
284 | } |
235 | // } file menu |
285 | // } file menu |
236 | 286 | ||
237 | if (m.vert) |
287 | if (m.vert) |
238 | { |
288 | { |
239 | if (files.MouseScroll(m.vert)) List_ReDraw(); |
289 | if (files.MouseScroll(m.vert)) List_ReDraw(); |
240 | break; |
290 | break; |
241 | } |
291 | } |
242 | 292 | ||
243 | if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>40) && (m.y |
293 | if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>40) && (m.y |
244 | { |
294 | { |
245 | IF (m.lkm==1) DrawRectangle3D(Form.cwidth - 17,41,14,14,0xC7C7C7,0xFFFFFF); |
295 | IF (m.lkm==1) DrawRectangle3D(Form.cwidth - 17,41,14,14,0xC7C7C7,0xFFFFFF); |
246 | WHILE (m.lkm==1) && (files.first>0) |
296 | WHILE (m.lkm==1) && (files.first>0) |
247 | { |
297 | { |
248 | pause(8); |
298 | pause(8); |
249 | files.first--; |
299 | files.first--; |
250 | List_ReDraw(); |
300 | List_ReDraw(); |
251 | m.get(); |
301 | m.get(); |
252 | } |
302 | } |
253 | DrawRectangle3D(Form.cwidth - 17,41,14,14,0xFFFFFF,0xC7C7C7); |
303 | DrawRectangle3D(Form.cwidth - 17,41,14,14,0xFFFFFF,0xC7C7C7); |
254 | } |
304 | } |
255 | 305 | ||
256 | if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>onTop(22,0)+1) && (m.y |
306 | if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>onTop(22,0)+1) && (m.y |
257 | { |
307 | { |
258 | IF (m.lkm==1) DrawRectangle3D(Form.cwidth - 17,onTop(21,0),14,14,0xC7C7C7,0xFFFFFF); |
308 | IF (m.lkm==1) DrawRectangle3D(Form.cwidth - 17,onTop(21,0),14,14,0xC7C7C7,0xFFFFFF); |
259 | while (m.lkm==1) && (files.first |
309 | while (m.lkm==1) && (files.first |
260 | { |
310 | { |
261 | pause(8); |
311 | pause(8); |
262 | files.first++; |
312 | files.first++; |
263 | List_ReDraw(); |
313 | List_ReDraw(); |
264 | m.get(); |
314 | m.get(); |
265 | } |
315 | } |
266 | DrawRectangle3D(Form.cwidth - 17,onTop(21,0),14,14,0xFFFFFF,0xC7C7C7); |
316 | DrawRectangle3D(Form.cwidth - 17,onTop(21,0),14,14,0xFFFFFF,0xC7C7C7); |
267 | } |
317 | } |
268 | 318 | ||
269 | //Scrooll |
319 | //Scrooll |
270 | if (!m.lkm) && (scroll_used) { scroll_used=NULL; Scroll(); } |
320 | if (!m.lkm) && (scroll_used) { scroll_used=NULL; Scroll(); } |
271 | if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>56) && (m.y |
321 | if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>56) && (m.y |
272 | 322 | ||
273 | if (scroll_used) |
323 | if (scroll_used) |
274 | { |
324 | { |
275 | IF (sc_slider_h/2+files.y>m.y) || (m.y<0) || (m.y>4000) m.y=sc_slider_h/2+files.y; //anee eo?ni? iaa ieiii |
325 | IF (sc_slider_h/2+files.y>m.y) || (m.y<0) || (m.y>4000) m.y=sc_slider_h/2+files.y; //anee eo?ni? iaa ieiii |
276 | id=files.first; |
326 | id=files.first; |
277 | j= sc_slider_h/2; |
327 | j= sc_slider_h/2; |
278 | files.first = m.y -j -files.y * files.count; |
328 | files.first = m.y -j -files.y * files.count; |
279 | files.first /= onTop(22,files.y); |
329 | files.first /= onTop(22,files.y); |
280 | IF (files.visible+files.first>files.count) files.first=files.count-files.visible; |
330 | IF (files.visible+files.first>files.count) files.first=files.count-files.visible; |
281 | IF (id!=files.first) List_ReDraw(); |
331 | IF (id!=files.first) List_ReDraw(); |
282 | } |
332 | } |
283 | break; |
333 | break; |
284 | //Button pressed----------------------------------------------------------------------------- |
334 | //Button pressed----------------------------------------------------------------------------- |
285 | case evButton: |
335 | case evButton: |
286 | id=GetButtonID(); |
336 | id=GetButtonID(); |
287 | if (id==1) |
337 | if (id==1) |
288 | { |
338 | { |
289 | KillProcess(about_window); |
339 | KillProcess(about_window); |
290 | ExitProcess(); |
340 | ExitProcess(); |
291 | } |
341 | } |
292 | if (rename_active) break; |
342 | if (rename_active) break; |
293 | if (del_active) |
343 | if (del_active) |
294 | { |
344 | { |
295 | IF (id==301) || (id==302) Del_File(302-id); |
345 | IF (id==301) || (id==302) Del_File(302-id); |
296 | break; |
346 | break; |
297 | } |
347 | } |
298 | 348 | ||
299 | switch(id) |
349 | switch(id) |
300 | { |
350 | { |
301 | case 21: //Back |
351 | case 21: //Back |
302 | GoBack(); |
352 | GoBack(); |
303 | break; |
353 | break; |
304 | case 22: //Forward |
354 | case 22: //Forward |
305 | if (HistoryPath(GO_FORWARD)) |
355 | if (HistoryPath(GO_FORWARD)) |
306 | { |
356 | { |
307 | files.first=files.current=NULL; //aaa?o nienea |
357 | files.first=files.current=NULL; //aaa?o nienea |
308 | Open_Dir(#path,WITH_REDRAW); |
358 | Open_Dir(#path,WITH_REDRAW); |
309 | } |
359 | } |
310 | break; |
360 | break; |
311 | case 23: //up! |
361 | case 23: //up! |
312 | Dir_Up(); |
362 | Dir_Up(); |
313 | break; |
363 | break; |
314 | case 24: //cut |
364 | case 24: //cut |
315 | Copy(#file_path, CUT); |
365 | Copy(#file_path, CUT); |
316 | break; |
366 | break; |
317 | case 25: //copy |
367 | case 25: //copy |
318 | Copy(#file_path, NOCUT); |
368 | Copy(#file_path, NOCUT); |
319 | break; |
369 | break; |
320 | case 26: //paste |
370 | case 26: //paste |
321 | CreateThread(#Paste,#copy_stak+4092); |
371 | CreateThread(#Paste,#copy_stak+4092); |
322 | break; |
372 | break; |
323 | case 31...33: //sort |
373 | case 31...33: //sort |
324 | IF(sort_num==1) DrawFilledBar(sorting_arrow_x,42,6,10); |
374 | IF(sort_num==1) DrawFilledBar(sorting_arrow_x,42,6,10); |
325 | IF(sort_num==2) DrawFilledBar(sorting_arrow_x,42,6,10); |
375 | IF(sort_num==2) DrawFilledBar(sorting_arrow_x,42,6,10); |
326 | IF(sort_num==3) DrawFilledBar(sorting_arrow_x,42,6,10); |
376 | IF(sort_num==3) DrawFilledBar(sorting_arrow_x,42,6,10); |
327 | sort_num=id-30; |
377 | sort_num=id-30; |
328 | Open_Dir(#path,WITH_REDRAW); |
378 | Open_Dir(#path,WITH_REDRAW); |
329 | break; |
379 | break; |
330 | case 50...60: //Actions |
380 | case 50...60: //Actions |
331 | FnProcess(id-50); |
381 | FnProcess(id-50); |
332 | break; |
382 | break; |
333 | case 100...120: |
383 | case 100...120: |
334 | DEVICE_MARK: |
384 | DEVICE_MARK: |
335 | DrawRectangle(17,id-100*16+74,159,16, 0); //auaaeaiea |
385 | DrawRectangle(17,id-100*16+74,159,16, 0); //auaaeaiea |
336 | strcpy(#path, #disk_list[id-100].Item); |
386 | strcpy(#path, #disk_list[id-100].Item); |
337 | files.first=files.current=0; |
387 | files.first=files.current=0; |
338 | Open_Dir(#path,WITH_REDRAW); |
388 | Open_Dir(#path,WITH_REDRAW); |
339 | pause(5); |
389 | pause(5); |
340 | DrawRectangle(17,id-100*16+74,159,16, 0xFFFFFF); |
390 | DrawRectangle(17,id-100*16+74,159,16, 0xFFFFFF); |
341 | break; |
391 | break; |
342 | } |
392 | } |
343 | break; |
393 | break; |
344 | //Key pressed----------------------------------------------------------------------------- |
394 | //Key pressed----------------------------------------------------------------------------- |
345 | case evKey: |
395 | case evKey: |
346 | key = GetKey(); |
396 | key = GetKey(); |
347 | if (Form.status_window>2) break; |
397 | if (Form.status_window>2) break; |
348 | IF (del_active) |
398 | IF (del_active) |
349 | { |
399 | { |
350 | IF (key==013) Del_File(true); |
400 | IF (key==013) Del_File(true); |
351 | IF (key==027) Del_File(false); |
401 | IF (key==027) Del_File(false); |
352 | break; |
402 | break; |
353 | } |
403 | } |
354 | IF (edit2.flags!=64) && (key!=13) && (key!=27) |
404 | IF (edit2.flags!=64) && (key!=13) && (key!=27) |
355 | { |
405 | { |
356 | EAX=key<<8; |
406 | EAX=key<<8; |
357 | edit_box_key stdcall (#edit2); |
407 | edit_box_key stdcall (#edit2); |
358 | break; |
408 | break; |
359 | } |
409 | } |
360 | switch (key) |
410 | switch (key) |
361 | { |
411 | { |
362 | case 209...217: |
412 | case 209...217: |
363 | id=key-110; |
413 | id=key-110; |
364 | IF (id-100>=disc_num) break; |
414 | IF (id-100>=disc_num) break; |
365 | GOTO DEVICE_MARK; |
415 | GOTO DEVICE_MARK; |
366 | case ASCII_KEY_BS: |
416 | case ASCII_KEY_BS: |
367 | //GoBack(); |
417 | //GoBack(); |
368 | Dir_Up(); |
418 | Dir_Up(); |
369 | break; |
419 | break; |
370 | case 004: //Ctrl+D set as bg |
420 | case 004: //Ctrl+D set as bg |
371 | strcpy(#temp, "\\S__"); |
421 | strcpy(#temp, "\\S__"); |
372 | strcat(#temp, #file_path); |
422 | strcat(#temp, #file_path); |
373 | RunProgram("/sys/media/kiv", #temp); |
423 | RunProgram("/sys/media/kiv", #temp); |
374 | break; |
424 | break; |
375 | case 014: //Ctrl+N new window |
425 | case 014: //Ctrl+N new window |
376 | IF (Form.left==98) MoveSize(Form.left-20,Form.top-20,OLD,OLD); |
426 | IF (Form.left==98) MoveSize(Form.left-20,Form.top-20,OLD,OLD); |
377 | RunProgram("/sys/File Managers/Eolite", #path); |
427 | RunProgram("/sys/File Managers/Eolite", #path); |
378 | break; |
428 | break; |
379 | case 024: //Ctrl+X |
429 | case 024: //Ctrl+X |
380 | Copy(#file_path, CUT); |
430 | Copy(#file_path, CUT); |
381 | break; |
431 | break; |
382 | case 003: //Ctrl+C |
432 | case 003: //Ctrl+C |
383 | Copy(#file_path, NOCUT); |
433 | Copy(#file_path, NOCUT); |
384 | break; |
434 | break; |
385 | case 022: //Ctrl+V |
435 | case 022: //Ctrl+V |
386 | CreateThread(#Paste,#copy_stak+4092); |
436 | CreateThread(#Paste,#copy_stak+4092); |
387 | break; |
437 | break; |
388 | case 001: //Ctrl+A |
438 | case 001: //Ctrl+A |
389 | debugln("press Ctrl+A"); |
439 | debugln("press Ctrl+A"); |
390 | for (i=0; i |
440 | for (i=0; i |
391 | { |
441 | { |
392 | selected_offset = file_mas[i]*304 + buf+32 + 7; |
442 | selected_offset = file_mas[i]*304 + buf+32 + 7; |
393 | ESBYTE[selected_offset] = 1; |
443 | ESBYTE[selected_offset] = 1; |
394 | selected_count++; |
444 | selected_count++; |
395 | } |
445 | } |
396 | List_ReDraw(); |
446 | List_ReDraw(); |
397 | break; |
447 | break; |
398 | case 021: //Ctrl+U |
448 | case 021: //Ctrl+U |
399 | debugln("press Ctrl+A"); |
449 | debugln("press Ctrl+A"); |
400 | for (i=0; i |
450 | for (i=0; i |
401 | { |
451 | { |
402 | selected_offset = file_mas[i]*304 + buf+32 + 7; |
452 | selected_offset = file_mas[i]*304 + buf+32 + 7; |
403 | ESBYTE[selected_offset] = 0; |
453 | ESBYTE[selected_offset] = 0; |
404 | } |
454 | } |
405 | selected_count = 0; |
455 | selected_count = 0; |
406 | List_ReDraw(); |
456 | List_ReDraw(); |
407 | break; |
457 | break; |
408 | case ASCII_KEY_ESC: |
458 | case ASCII_KEY_ESC: |
409 | IF (rename_active==1) ReName(false); |
459 | IF (rename_active==1) ReName(false); |
410 | break; |
460 | break; |
411 | case ASCII_KEY_ENTER: |
461 | case ASCII_KEY_ENTER: |
412 | IF (rename_active==1) {ReName(true); break;} |
462 | IF (rename_active==1) {ReName(true); break;} |
413 | Open(0); |
463 | Open(0); |
414 | break; |
464 | break; |
415 | case 074: //menu |
465 | case 074: //menu |
416 | menu_call_mouse=0; |
466 | menu_call_mouse=0; |
417 | SwitchToAnotherThread(); |
467 | SwitchToAnotherThread(); |
418 | CreateThread(#FileMenu,#menu_stak+4092); |
468 | CreateThread(#FileMenu,#menu_stak+4092); |
419 | break; |
469 | break; |
420 | case 173: //Ctrl+Enter |
470 | case 173: //Ctrl+Enter |
421 | if (!itdir) ShowOpenWithDialog(); |
471 | if (!itdir) ShowOpenWithDialog(); |
422 | else Open(1); |
472 | else Open(1); |
423 | break; |
473 | break; |
424 | case ASCII_KEY_UP: |
474 | case ASCII_KEY_UP: |
425 | List_Current(-1); |
475 | List_Current(-1); |
426 | break; |
476 | break; |
427 | case ASCII_KEY_DOWN: |
477 | case ASCII_KEY_DOWN: |
428 | List_Current(1); |
478 | List_Current(1); |
429 | break; |
479 | break; |
430 | case ASCII_KEY_HOME: |
480 | case ASCII_KEY_HOME: |
431 | if (files.KeyHome()) List_ReDraw(); |
481 | if (files.KeyHome()) List_ReDraw(); |
432 | break; |
482 | break; |
433 | case ASCII_KEY_END: |
483 | case ASCII_KEY_END: |
434 | if (files.KeyEnd()) List_ReDraw(); |
484 | if (files.KeyEnd()) List_ReDraw(); |
435 | break; |
485 | break; |
436 | case ASCII_KEY_PGDN: |
486 | case ASCII_KEY_PGDN: |
437 | List_Current(files.visible-1); |
487 | List_Current(files.visible-1); |
438 | break; |
488 | break; |
439 | case ASCII_KEY_PGUP: |
489 | case ASCII_KEY_PGUP: |
440 | List_Current(-files.visible+1); |
490 | List_Current(-files.visible+1); |
441 | break; |
491 | break; |
442 | case ASCII_KEY_DEL: |
492 | case ASCII_KEY_DEL: |
443 | Del_Form(); |
493 | Del_Form(); |
444 | break; |
494 | break; |
445 | case ASCII_KEY_INS: |
495 | case ASCII_KEY_INS: |
446 | selected_offset = file_mas[files.current+files.first]*304 + buf+32 + 7; |
496 | selected_offset = file_mas[files.current+files.first]*304 + buf+32 + 7; |
447 | if (ESBYTE[selected_offset]) |
497 | if (ESBYTE[selected_offset]) |
448 | { |
498 | { |
449 | ESBYTE[selected_offset]=0; |
499 | ESBYTE[selected_offset]=0; |
450 | selected_count--; |
500 | selected_count--; |
451 | } |
501 | } |
452 | else |
502 | else |
453 | { |
503 | { |
454 | ESBYTE[selected_offset] = 1; |
504 | ESBYTE[selected_offset] = 1; |
455 | selected_count++; |
505 | selected_count++; |
456 | } |
506 | } |
457 | List_Current(1); |
507 | List_Current(1); |
458 | break; |
508 | break; |
459 | case 048...059: //F1-F10 |
509 | case 048...059: //F1-F10 |
460 | FnProcess(key-49); |
510 | FnProcess(key-49); |
461 | break; |
511 | break; |
462 | default: |
512 | default: |
463 | for (i=files.current+files.first+1; i |
513 | for (i=files.current+files.first+1; i |
464 | { |
514 | { |
465 | strcpy(#temp, file_mas[i]*304+buf+72); |
515 | strcpy(#temp, file_mas[i]*304+buf+72); |
466 | IF (temp[0]==key) || (temp[0]==key-32) |
516 | IF (temp[0]==key) || (temp[0]==key-32) |
467 | { |
517 | { |
468 | List_Current(i-files.current-files.first); |
518 | List_Current(i-files.current-files.first); |
469 | break; |
519 | break; |
470 | } |
520 | } |
471 | } |
521 | } |
472 | } |
522 | } |
473 | break; |
523 | break; |
474 | case evReDraw: |
524 | case evReDraw: |
475 | draw_window(); |
525 | draw_window(); |
476 | if (action_buf) { menu_action(action_buf); action_buf=0;} |
526 | if (action_buf) { menu_action(action_buf); action_buf=0;} |
477 | } |
527 | } |
478 | } |
528 | } |
479 | 529 | ||
480 | 530 | ||
481 | inline fastcall signed int _strrchr( ESI,BL) |
531 | inline fastcall signed int _strrchr( ESI,BL) |
482 | { |
532 | { |
483 | int jj=0, last=strlen(ESI); |
533 | int jj=0, last=strlen(ESI); |
484 | do{ |
534 | do{ |
485 | jj++; |
535 | jj++; |
486 | $lodsb |
536 | $lodsb |
487 | IF(AL==BL) last=jj; |
537 | IF(AL==BL) last=jj; |
488 | } while(AL!=0); |
538 | } while(AL!=0); |
489 | return last; |
539 | return last; |
490 | } |
540 | } |
491 | 541 | ||
492 | 542 | ||
493 | void menu_action(dword id) |
543 | void menu_action(dword id) |
494 | { |
544 | { |
495 | if (id==COPY_PASTE_END) |
545 | if (id==COPY_PASTE_END) |
496 | { |
546 | { |
497 | FnProcess(5); |
547 | FnProcess(5); |
498 | SelectFile(#copy_to+strrchr(#copy_to,'/')); |
548 | SelectFile(#copy_to+strrchr(#copy_to,'/')); |
499 | } |
549 | } |
500 | if (id==100) Open(0); |
550 | if (id==100) Open(0); |
501 | if (id==201) ShowOpenWithDialog(); |
551 | if (id==201) ShowOpenWithDialog(); |
502 | if (id==202) FnProcess(3); //F3 |
552 | if (id==202) FnProcess(3); //F3 |
503 | if (id==203) FnProcess(4); //F4 |
553 | if (id==203) FnProcess(4); //F4 |
504 | if (id==104) Copy(#file_path, NOCUT); |
554 | if (id==104) Copy(#file_path, NOCUT); |
505 | if (id==105) Copy(#file_path, CUT); |
555 | if (id==105) Copy(#file_path, CUT); |
506 | if (id==106) CreateThread(#Paste,#copy_stak+4092); |
556 | if (id==106) CreateThread(#Paste,#copy_stak+4092); |
507 | if (id==207) FnProcess(2); |
557 | if (id==207) FnProcess(2); |
508 | if (id==108) Del_Form(); |
558 | if (id==108) Del_Form(); |
509 | if (id==109) FnProcess(5); |
559 | if (id==109) FnProcess(5); |
510 | if (id==110) FnProcess(8); |
560 | if (id==110) FnProcess(8); |
511 | if (id==300) { FnProcess(5); List_ReDraw(); } |
561 | if (id==300) { FnProcess(5); List_ReDraw(); } |
512 | } |
562 | } |
513 | 563 | ||
514 | 564 | ||
515 | void draw_window() |
565 | void draw_window() |
516 | { |
566 | { |
517 | DefineAndDrawWindow(GetScreenWidth()-550/4+rand_n,rand_n+30,550,500,0x73,sc.work,TITLE,0); |
567 | DefineAndDrawWindow(GetScreenWidth()-550/4+rand_n,rand_n+30,550,500,0x73,sc.work,TITLE,0); |
518 | GetProcessInfo(#Form, SelfInfo); |
568 | GetProcessInfo(#Form, SelfInfo); |
519 | if (Form.status_window>2) return; |
569 | if (Form.status_window>2) return; |
520 | files.SetSizes(192, 57, Form.cwidth - 210, onTop(57,6), disc_num*16+195,files.line_h); |
570 | files.SetSizes(192, 57, Form.cwidth - 210, onTop(57,6), disc_num*16+195,files.line_h); |
521 | if (Form.height < files.min_h) MoveSize(OLD,OLD,OLD,files.min_h); |
571 | if (Form.height < files.min_h) MoveSize(OLD,OLD,OLD,files.min_h); |
522 | if (Form.width<480) MoveSize(OLD,OLD,480,OLD); |
572 | if (Form.width<480) MoveSize(OLD,OLD,480,OLD); |
523 | GetProcessInfo(#Form, SelfInfo); //if win_size changed |
573 | GetProcessInfo(#Form, SelfInfo); //if win_size changed |
524 | 574 | ||
525 | PutPaletteImage(#toolbar,246,34,0,0,8,#toolbar_pal); |
575 | PutPaletteImage(#toolbar,246,34,0,0,8,#toolbar_pal); |
526 | DrawBar(127, 8, 1, 25, sc.work_graph); |
576 | DrawBar(127, 8, 1, 25, sc.work_graph); |
527 | for (j=0; j<3; j++) DefineButton(toolbar_buttons_x[j]+2,5+2,31-5,29-5,21+j+BT_HIDE,sc.work); |
577 | for (j=0; j<3; j++) DefineButton(toolbar_buttons_x[j]+2,5+2,31-5,29-5,21+j+BT_HIDE,sc.work); |
528 | for (j=3; j<6; j++) DefineButton(toolbar_buttons_x[j],5,31,29,21+j+BT_HIDE,sc.work); |
578 | for (j=3; j<6; j++) DefineButton(toolbar_buttons_x[j],5,31,29,21+j+BT_HIDE,sc.work); |
529 | DrawBar(246,0,Form.cwidth - 297,12, sc.work); //upper editbox |
579 | DrawBar(246,0,Form.cwidth - 297,12, sc.work); //upper editbox |
530 | DrawBar(246,29,Form.cwidth - 297,5,sc.work); //under editbox |
580 | DrawBar(246,29,Form.cwidth - 297,5,sc.work); //under editbox |
531 | DrawRectangle(246,12,Form.cwidth - 303,16,sc.work_graph); |
581 | DrawRectangle(246,12,Form.cwidth - 303,16,sc.work_graph); |
532 | DefineButton(Form.cwidth - 25,6,27,28,51+BT_HIDE+BT_NOFRAME,0); //about |
582 | DefineButton(Form.cwidth - 25,6,27,28,51+BT_HIDE+BT_NOFRAME,0); //about |
533 | PutPaletteImage(#goto_about,56,34,Form.width-65,0,8,#goto_about_pal); |
583 | PutPaletteImage(#goto_about,56,34,Form.width-65,0,8,#goto_about_pal); |
534 | //main rectangles |
584 | //main rectangles |
535 | DrawRectangle(1,40,Form.cwidth-3,onTop(46,0),sc.work_graph); |
585 | DrawRectangle(1,40,Form.cwidth-3,onTop(46,0),sc.work_graph); |
536 | DrawRectangle(0,39,Form.cwidth-1,onTop(44,0),col_palette[4]); //bg |
586 | DrawRectangle(0,39,Form.cwidth-1,onTop(44,0),col_palette[4]); //bg |
537 | for (i=0; i<5; i++) DrawBar(0, 34+i, Form.cwidth, 1, col_palette[8-i]); |
587 | for (i=0; i<5; i++) DrawBar(0, 34+i, Form.cwidth, 1, col_palette[8-i]); |
538 | DrawLeftPanel(); |
588 | DrawLeftPanel(); |
539 | //ListBox |
589 | //ListBox |
540 | DrawFlatButton(files.x,40,Form.cwidth - files.x - 159,16,31,sc.work,T_FILE); |
590 | DrawFlatButton(files.x,40,Form.cwidth - files.x - 159,16,31,sc.work,T_FILE); |
541 | DrawFlatButton(Form.cwidth - 159,40,73,16,32,sc.work,T_TYPE); |
591 | DrawFlatButton(Form.cwidth - 159,40,73,16,32,sc.work,T_TYPE); |
542 | DrawFlatButton(Form.cwidth - 86,40,68,16,33,sc.work,T_SIZE); |
592 | DrawFlatButton(Form.cwidth - 86,40,68,16,33,sc.work,T_SIZE); |
543 | DrawBar(files.x+files.w,files.y,1,onTop(22,files.y),sc.work_graph); //line to the left from the scroll |
593 | DrawBar(files.x+files.w,files.y,1,onTop(22,files.y),sc.work_graph); //line to the left from the scroll |
544 | DrawFlatButton(files.x+files.w,40,16,16,0,sc.work,"\x18"); |
594 | DrawFlatButton(files.x+files.w,40,16,16,0,sc.work,"\x18"); |
545 | DrawFlatButton(files.x+files.w,onTop(22,0),16,16,0,sc.work,"\x19"); |
595 | DrawFlatButton(files.x+files.w,onTop(22,0),16,16,0,sc.work,"\x19"); |
546 | Open_Dir(#path,ONLY_SHOW); |
596 | Open_Dir(#path,ONLY_SHOW); |
547 | if (del_active) Del_Form(); |
597 | if (del_active) Del_Form(); |
548 | if (rename_active) FnProcess(2); |
598 | if (rename_active) FnProcess(2); |
549 | } |
599 | } |
550 | 600 | ||
551 | 601 | ||
552 | void KEdit() |
602 | void KEdit() |
553 | { |
603 | { |
554 | if (Form.width<480) return; |
604 | if (Form.width<480) return; |
555 | PathShow.area_size_x = Form.cwidth-306; |
605 | PathShow.area_size_x = Form.cwidth-306; |
556 | DrawBar(PathShow.start_x-3, PathShow.start_y-4, PathShow.area_size_x+2, 15, 0xFFFfff); |
606 | DrawBar(PathShow.start_x-3, PathShow.start_y-4, PathShow.area_size_x+2, 15, 0xFFFfff); |
557 | PathShow_prepare stdcall(#PathShow); |
607 | PathShow_prepare stdcall(#PathShow); |
558 | PathShow_draw stdcall(#PathShow); |
608 | PathShow_draw stdcall(#PathShow); |
559 | } |
609 | } |
560 | 610 | ||
561 | 611 | ||
562 | void List_Current(signed int cur) |
612 | void List_Current(signed int cur) |
563 | { |
613 | { |
564 | if (cur<=0) //up |
614 | if (cur<=0) //up |
565 | { |
615 | { |
566 | IF (files.first==0) && (files.current<=0) return; |
616 | IF (files.first==0) && (files.current<=0) return; |
567 | IF (-cur-1 |
617 | IF (-cur-1 |
568 | { |
618 | { |
569 | Line_ReDraw(0xFFFFFF, files.current); |
619 | Line_ReDraw(0xFFFFFF, files.current); |
570 | files.current+=cur; |
620 | files.current+=cur; |
571 | Line_ReDraw(col_selec, files.current); |
621 | Line_ReDraw(col_selec, files.current); |
572 | return; |
622 | return; |
573 | } |
623 | } |
574 | ELSE |
624 | ELSE |
575 | { |
625 | { |
576 | IF (-cur |
626 | IF (-cur |
577 | files.current=0; |
627 | files.current=0; |
578 | List_ReDraw(); |
628 | List_ReDraw(); |
579 | return; |
629 | return; |
580 | } |
630 | } |
581 | } |
631 | } |
582 | else //down |
632 | else //down |
583 | { |
633 | { |
584 | IF (files.first==files.count-files.visible) && (files.current==files.visible-1) |
634 | IF (files.first==files.count-files.visible) && (files.current==files.visible-1) |
585 | { |
635 | { |
586 | Line_ReDraw(col_selec, files.current); |
636 | Line_ReDraw(col_selec, files.current); |
587 | return; |
637 | return; |
588 | } |
638 | } |
589 | IF (files.visible-files.current>cur) |
639 | IF (files.visible-files.current>cur) |
590 | { |
640 | { |
591 | Line_ReDraw(0xFFFFFF, files.current); |
641 | Line_ReDraw(0xFFFFFF, files.current); |
592 | files.current+=cur; |
642 | files.current+=cur; |
593 | Line_ReDraw(col_selec, files.current); |
643 | Line_ReDraw(col_selec, files.current); |
594 | return; |
644 | return; |
595 | } |
645 | } |
596 | else |
646 | else |
597 | { |
647 | { |
598 | IF(files.first+files.current+cur>=files.count) |
648 | IF(files.first+files.current+cur>=files.count) |
599 | { |
649 | { |
600 | files.first=files.count-files.visible; |
650 | files.first=files.count-files.visible; |
601 | files.current=cur-files.first+files.current; |
651 | files.current=cur-files.first+files.current; |
602 | } |
652 | } |
603 | ELSE |
653 | ELSE |
604 | { |
654 | { |
605 | files.first+=cur+files.current-files.visible+1; |
655 | files.first+=cur+files.current-files.visible+1; |
606 | files.current=files.visible-1; |
656 | files.current=files.visible-1; |
607 | } |
657 | } |
608 | 658 | ||
609 | IF (files.current<0) || (files.current>files.visible) |
659 | IF (files.current<0) || (files.current>files.visible) |
610 | { |
660 | { |
611 | files.current=files.visible-1; |
661 | files.current=files.visible-1; |
612 | } |
662 | } |
613 | List_ReDraw(); |
663 | List_ReDraw(); |
614 | } |
664 | } |
615 | } |
665 | } |
616 | } |
666 | } |
617 | 667 | ||
618 | 668 | ||
619 | void List_ReDraw() |
669 | void List_ReDraw() |
620 | { |
670 | { |
621 | int paint_y; |
671 | int paint_y; |
622 | //we are in the end of the list => maximize window => there will be white lines after the last element |
672 | //we are in the end of the list => maximize window => there will be white lines after the last element |
623 | if (files.count-files.first |
673 | if (files.count-files.first |
624 | { files.first=files.count-files.visible; files.current=files.visible-1; } |
674 | { files.first=files.count-files.visible; files.current=files.visible-1; } |
625 | for (j=0; j |
675 | for (j=0; j |
626 | //in the bottom |
676 | //in the bottom |
627 | paint_y = j * files.line_h + files.y; |
677 | paint_y = j * files.line_h + files.y; |
628 | DrawBar(files.x,paint_y,files.w,onTop(paint_y,6),0xFFFFFF); |
678 | DrawBar(files.x,paint_y,files.w,onTop(paint_y,6),0xFFFFFF); |
629 | DrawBar(Form.cwidth-159,paint_y,1,onTop(paint_y,6),sc.work); |
679 | DrawBar(Form.cwidth-159,paint_y,1,onTop(paint_y,6),sc.work); |
630 | DrawBar(Form.cwidth-86,paint_y,1,onTop(paint_y,6),sc.work); |
680 | DrawBar(Form.cwidth-86,paint_y,1,onTop(paint_y,6),sc.work); |
631 | Scroll(); |
681 | Scroll(); |
632 | } |
682 | } |
633 | 683 | ||
634 | 684 | ||
635 | void Line_ReDraw(dword color, filenum){ |
685 | void Line_ReDraw(dword color, filenum){ |
636 | dword text_col=0, |
686 | dword text_col=0, |
637 | ext1, attr, |
687 | ext1, attr, |
638 | file_offet, |
688 | file_offet, |
639 | file_name_off, |
689 | file_name_off, |
640 | y=filenum*files.line_h+files.y; |
690 | y=filenum*files.line_h+files.y; |
641 | BDVK file; |
691 | BDVK file; |
642 | if (filenum==-1) return; |
692 | if (filenum==-1) return; |
643 | DrawBar(files.x,y,3,files.line_h,color); |
693 | DrawBar(files.x,y,3,files.line_h,color); |
644 | DrawBar(files.x+19,y,files.w-19,files.line_h,color); |
694 | DrawBar(files.x+19,y,files.w-19,files.line_h,color); |
645 | DrawBar(files.x+3,y+17,16,1,color); |
695 | DrawBar(files.x+3,y+17,16,1,color); |
646 | if (files.line_h>18) DrawBar(files.x+3,y+18,16,files.line_h-18,color); |
696 | if (files.line_h>18) DrawBar(files.x+3,y+18,16,files.line_h-18,color); |
647 | if (files.line_h>15) DrawBar(files.x+3,y,16,files.line_h-15,color); |
697 | if (files.line_h>15) DrawBar(files.x+3,y,16,files.line_h-15,color); |
648 | 698 | ||
649 | file_offet = file_mas[filenum+files.first]*304 + buf+32; |
699 | file_offet = file_mas[filenum+files.first]*304 + buf+32; |
650 | attr = ESDWORD[file_offet]; |
700 | attr = ESDWORD[file_offet]; |
651 | file.selected = ESBYTE[file_offet+7]; |
701 | file.selected = ESBYTE[file_offet+7]; |
652 | file.sizelo = ESDWORD[file_offet+32]; |
702 | file.sizelo = ESDWORD[file_offet+32]; |
653 | file_name_off = file_offet+40; |
703 | file_name_off = file_offet+40; |
654 | 704 | ||
655 | if (! TestBit(attr, 4) ) //file or folder? |
705 | if (! TestBit(attr, 4) ) //file or folder? |
656 | { |
706 | { |
657 | Put_icon(file_name_off+_strrchr(file_name_off,'.'), files.x+3, files.line_h/2-7+y, color, 0); |
707 | Put_icon(file_name_off+_strrchr(file_name_off,'.'), files.x+3, files.line_h/2-7+y, color, 0); |
658 | WriteText(7-strlen(ConvertSize(file.sizelo))*6+Form.cwidth - 76,files.line_h-6/2+y,font_type,0,ConvertSize(file.sizelo)); |
708 | WriteText(7-strlen(ConvertSize(file.sizelo))*6+Form.cwidth - 76,files.line_h-6/2+y,font_type,0,ConvertSize(file.sizelo)); |
659 | } |
709 | } |
660 | else |
710 | else |
661 | { |
711 | { |
662 | if (strcmp("..",file_name_off)==0) ext1=".."; else ext1=" |
712 | if (strcmp("..",file_name_off)==0) ext1=".."; else ext1=" |
663 | Put_icon(ext1, files.x+3, files.line_h/2-7+y, color, 0); |
713 | Put_icon(ext1, files.x+3, files.line_h/2-7+y, color, 0); |
664 | } |
714 | } |
665 | 715 | ||
666 | if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=0xA6A6B7; //system or hiden? |
716 | if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=0xA6A6B7; //system or hiden? |
667 | if (color!=0xFFFfff) |
717 | if (color!=0xFFFfff) |
668 | { |
718 | { |
669 | itdir = TestBit(attr, 4); |
719 | itdir = TestBit(attr, 4); |
670 | strcpy(#file_name, file_name_off); |
720 | strcpy(#file_name, file_name_off); |
671 | strcpy(#file_path, #path); |
721 | strcpy(#file_path, #path); |
672 | strcat(#file_path, #file_name); |
722 | strcat(#file_path, #file_name); |
673 | if (text_col==0xA6A6B7) text_col=0xFFFFFF; |
723 | if (text_col==0xA6A6B7) text_col=0xFFFFFF; |
674 | } |
724 | } |
675 | if (file.selected) text_col=0xFF0000; |
725 | if (file.selected) text_col=0xFF0000; |
676 | if (Form.width>=480) |
726 | if (Form.width>=480) |
677 | { |
727 | { |
678 | FileShow.start_x = files.x + 23; |
728 | FileShow.start_x = files.x + 23; |
679 | FileShow.font_color = text_col; |
729 | FileShow.font_color = text_col; |
680 | FileShow.area_size_x = Form.width - 380; |
730 | FileShow.area_size_x = Form.width - 380; |
681 | FileShow.text_pointer = file_name_off; |
731 | FileShow.text_pointer = file_name_off; |
682 | FileShow.start_y = files.text_y+y; |
732 | FileShow.start_y = files.text_y+y; |
683 | PathShow_prepare stdcall(#FileShow); |
733 | PathShow_prepare stdcall(#FileShow); |
684 | PathShow_draw stdcall(#FileShow); |
734 | PathShow_draw stdcall(#FileShow); |
685 | } |
735 | } |
686 | DrawBar(Form.cwidth-159,y,1,files.line_h,sc.work); //gray line 1 |
736 | DrawBar(Form.cwidth-159,y,1,files.line_h,sc.work); //gray line 1 |
687 | DrawBar(Form.cwidth-86,y,1,files.line_h,sc.work); //gray line 2 |
737 | DrawBar(Form.cwidth-86,y,1,files.line_h,sc.work); //gray line 2 |
688 | } |
738 | } |
689 | 739 | ||
690 | 740 | ||
691 | void Open_Dir(dword dir_path, redraw){ |
741 | void Open_Dir(dword dir_path, redraw){ |
692 | int errornum, maxcount; |
742 | int errornum, maxcount; |
693 | 743 | ||
694 | if (redraw!=ONLY_SHOW) |
744 | if (redraw!=ONLY_SHOW) |
695 | { |
745 | { |
696 | if (ESBYTE[dir_path+1]!='\0') ESBYTE[dir_path+strlen(dir_path)-1] = '\0'; |
746 | if (ESBYTE[dir_path+1]!='\0') ESBYTE[dir_path+strlen(dir_path)-1] = '\0'; |
697 | if (buf) free(buf); |
747 | if (buf) free(buf); |
698 | errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT); |
748 | errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT); |
699 | if (ESBYTE[dir_path+1]!='\0') chrcat(dir_path, '/'); |
749 | if (ESBYTE[dir_path+1]!='\0') chrcat(dir_path, '/'); |
700 | if (errornum) |
750 | if (errornum) |
701 | { |
751 | { |
702 | HistoryPath(ADD_NEW_PATH); |
752 | HistoryPath(ADD_NEW_PATH); |
703 | GoBack(); |
753 | GoBack(); |
704 | Write_Error(errornum); |
754 | Write_Error(errornum); |
705 | return; |
755 | return; |
706 | } |
756 | } |
707 | maxcount = sizeof(file_mas)/sizeof(dword)-1; |
757 | maxcount = sizeof(file_mas)/sizeof(dword)-1; |
708 | if (files.count>maxcount) files.count = maxcount; |
758 | if (files.count>maxcount) files.count = maxcount; |
709 | if (files.count>0) && (files.current==-1) files.current=0; |
759 | if (files.count>0) && (files.current==-1) files.current=0; |
710 | } |
760 | } |
711 | if (files.count!=-1) |
761 | if (files.count!=-1) |
712 | { |
762 | { |
713 | KEdit(); |
763 | KEdit(); |
714 | HistoryPath(ADD_NEW_PATH); |
764 | HistoryPath(ADD_NEW_PATH); |
715 | files.visible = files.h / files.line_h; |
765 | files.visible = files.h / files.line_h; |
716 | IF (files.count < files.visible) files.visible = files.count; |
766 | IF (files.count < files.visible) files.visible = files.count; |
717 | IF (sort_num==1) sorting_arrow_x = Form.width+60/2; |
767 | IF (sort_num==1) sorting_arrow_x = Form.width+60/2; |
718 | IF (sort_num==2) sorting_arrow_x = Form.width-115; |
768 | IF (sort_num==2) sorting_arrow_x = Form.width-115; |
719 | IF (sort_num==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w; |
769 | IF (sort_num==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w; |
720 | WriteText(sorting_arrow_x,45,0x80,sc.work_graph,"\x19"); |
770 | WriteText(sorting_arrow_x,45,0x80,sc.work_graph,"\x19"); |
721 | IF (redraw!=ONLY_SHOW) Sorting(); |
771 | IF (redraw!=ONLY_SHOW) Sorting(); |
722 | IF (redraw!=ONLY_OPEN) List_ReDraw(); |
772 | IF (redraw!=ONLY_OPEN) List_ReDraw(); |
723 | } |
773 | } |
724 | IF (files.count==-1) && (redraw!=ONLY_OPEN) {files.visible=files.count=0; List_ReDraw();} |
774 | IF (files.count==-1) && (redraw!=ONLY_OPEN) {files.visible=files.count=0; List_ReDraw();} |
725 | } |
775 | } |
726 | 776 | ||
727 | 777 | ||
728 | inline Sorting() |
778 | inline Sorting() |
729 | { |
779 | { |
730 | dword k=0, l=1; |
780 | dword k=0, l=1; |
731 | dword file_off; |
781 | dword file_off; |
732 | int i; |
782 | int i; |
733 | if (!strcmp(#path,"/")) //do not sort |
783 | if (!strcmp(#path,"/")) //do not sort |
734 | { |
784 | { |
735 | FOR(k=1;k |
785 | FOR(k=1;k |
736 | return; |
786 | return; |
737 | } |
787 | } |
738 | FOR (j=files.count-1, file_off=files.count-1*304+buf+32; j>=0; j--, file_off-=304;) //files | folders |
788 | FOR (j=files.count-1, file_off=files.count-1*304+buf+32; j>=0; j--, file_off-=304;) //files | folders |
739 | { |
789 | { |
740 | if (!real_files_names_case) strttl(file_off+40); |
790 | if (!real_files_names_case) strttl(file_off+40); |
741 | if (TestBit(ESDWORD[file_off],4)) //directory? |
791 | if (TestBit(ESDWORD[file_off],4)) //directory? |
742 | { |
792 | { |
743 | file_mas[k]=j; |
793 | file_mas[k]=j; |
744 | k++; |
794 | k++; |
745 | } |
795 | } |
746 | else |
796 | else |
747 | { |
797 | { |
748 | file_mas[files.count-l]=j; |
798 | file_mas[files.count-l]=j; |
749 | l++; |
799 | l++; |
750 | } |
800 | } |
751 | } |
801 | } |
752 | //sorting: files first, then folders |
802 | //sorting: files first, then folders |
753 | Sort_by_Name(0,k-1); |
803 | Sort_by_Name(0,k-1); |
754 | IF (sort_num==1) Sort_by_Name(k,files.count-1); |
804 | IF (sort_num==1) Sort_by_Name(k,files.count-1); |
755 | IF (sort_num==2) Sort_by_Type(k,files.count-1); |
805 | IF (sort_num==2) Sort_by_Type(k,files.count-1); |
756 | IF (sort_num==3) Sort_by_Size(k,files.count-1); |
806 | IF (sort_num==3) Sort_by_Size(k,files.count-1); |
757 | //".." should be first |
807 | //".." should be first |
758 | IF (k>0) && (strcmp(file_mas[0]*304+buf+72,"..")!=0) |
808 | IF (k>0) && (strcmp(file_mas[0]*304+buf+72,"..")!=0) |
759 | FOR(k--; k>0; k--;) IF (!strcmp(file_mas[k]*304+buf+72,"..")) {file_mas[k]> |
809 | FOR(k--; k>0; k--;) IF (!strcmp(file_mas[k]*304+buf+72,"..")) {file_mas[k]> |
760 | } |
810 | } |
761 | 811 | ||
762 | 812 | ||
763 | void Del_Form() |
813 | void Del_Form() |
764 | { |
814 | { |
765 | dword selected_offset2; |
815 | dword selected_offset2; |
766 | int cont = 0; |
816 | int cont = 0; |
767 | byte f_count[128]; |
817 | byte f_count[128]; |
768 | int dform_x=files.w-220/2+files.x; |
818 | int dform_x=files.w-220/2+files.x; |
769 | if (strcmp(#file_name,".")==0) || (strcmp(#file_name,"..")==0) return; |
819 | if (strcmp(#file_name,".")==0) || (strcmp(#file_name,"..")==0) return; |
770 | if (del_active==2) |
820 | if (del_active==2) |
771 | { |
821 | { |
772 | if (itdir) ShowMessage(WAIT_DELETING_FOLDER, 0); |
822 | if (itdir) ShowMessage(WAIT_DELETING_FOLDER, 0); |
773 | } |
823 | } |
774 | else |
824 | else |
775 | { |
825 | { |
776 | if (!files.count) return; |
826 | if (!files.count) return; |
777 | DrawPopup(dform_x,160,220,80,1,sc.work,sc.work_graph); |
827 | DrawPopup(dform_x,160,220,80,1,sc.work,sc.work_graph); |
778 | WriteText(-strlen(T_DELETE_FILE)*3+110+dform_x,175,0x80,sc.work_text,T_DELETE_FILE); |
828 | WriteText(-strlen(T_DELETE_FILE)*3+110+dform_x,175,0x80,sc.work_text,T_DELETE_FILE); |
779 | for (i=0; i |
829 | for (i=0; i |
780 | { |
830 | { |
781 | selected_offset2 = file_mas[i]*304 + buf+32 + 7; |
831 | selected_offset2 = file_mas[i]*304 + buf+32 + 7; |
782 | if (ESBYTE[selected_offset2]) cont++; |
832 | if (ESBYTE[selected_offset2]) cont++; |
783 | } |
833 | } |
784 | if (cont) |
834 | if (cont) |
785 | { |
835 | { |
786 | strcpy(#f_count, DEL_MORE_FILES_1); |
836 | strcpy(#f_count, DEL_MORE_FILES_1); |
787 | strcat(#f_count, itoa(cont)); |
837 | strcat(#f_count, itoa(cont)); |
788 | strcat(#f_count, DEL_MORE_FILES_2); |
838 | strcat(#f_count, DEL_MORE_FILES_2); |
789 | WriteText(-strlen(#f_count)*3+110+dform_x,190,0x80,sc.work_text,#f_count); |
839 | WriteText(-strlen(#f_count)*3+110+dform_x,190,0x80,sc.work_text,#f_count); |
790 | } |
840 | } |
791 | else |
841 | else |
792 | { |
842 | { |
793 | IF (strlen(#file_name)<28) |
843 | IF (strlen(#file_name)<28) |
794 | { |
844 | { |
795 | WriteText(strlen(#file_name)*3+110+dform_x+2,190,0x80,sc.work_text,"?"); |
845 | WriteText(strlen(#file_name)*3+110+dform_x+2,190,0x80,sc.work_text,"?"); |
796 | WriteText(-strlen(#file_name)*3+110+dform_x,190,0x80,sc.work_text,#file_name); |
846 | WriteText(-strlen(#file_name)*3+110+dform_x,190,0x80,sc.work_text,#file_name); |
797 | } |
847 | } |
798 | else |
848 | else |
799 | { |
849 | { |
800 | WriteText(164+dform_x,190,0x80,0,"...?"); |
850 | WriteText(164+dform_x,190,0x80,0,"...?"); |
801 | ESI = 24; |
851 | ESI = 24; |
802 | WriteText(dform_x+20,190,0,0,#file_name); |
852 | WriteText(dform_x+20,190,0,0,#file_name); |
803 | } |
853 | } |
804 | } |
854 | } |
805 | DrawFlatButton(dform_x+27,208,70,20,301,0xFFB6B5,T_YES); |
855 | DrawFlatButton(dform_x+27,208,70,20,301,0xFFB6B5,T_YES); |
806 | DrawFlatButton(dform_x+120,208,70,20,302,0xC6DFC6,T_NO); |
856 | DrawFlatButton(dform_x+120,208,70,20,302,0xC6DFC6,T_NO); |
807 | del_active=1; |
857 | del_active=1; |
808 | } |
858 | } |
809 | } |
859 | } |
810 | 860 | ||
811 | int del_error; |
861 | int del_error; |
812 | int Del_File2(dword way) |
862 | int Del_File2(dword way) |
813 | { |
863 | { |
814 | dword dirbuf, fcount, i, filename; |
864 | dword dirbuf, fcount, i, filename; |
815 | int error; |
865 | int error; |
816 | char del_from[4096]; |
866 | char del_from[4096]; |
817 | if (isdir(way)) |
867 | if (isdir(way)) |
818 | { |
868 | { |
819 | if (error = GetDir(#dirbuf, #fcount, way, DIRS_ONLYREAL)) del_error = error; |
869 | if (error = GetDir(#dirbuf, #fcount, way, DIRS_ONLYREAL)) del_error = error; |
820 | for (i=0; i |
870 | for (i=0; i |
821 | { |
871 | { |
822 | if (CheckEvent()==evReDraw) draw_window(); |
872 | if (CheckEvent()==evReDraw) draw_window(); |
823 | filename = i*304+dirbuf+72; |
873 | filename = i*304+dirbuf+72; |
824 | strcpy(#del_from, way); |
874 | strcpy(#del_from, way); |
825 | chrcat(#del_from, '/'); |
875 | chrcat(#del_from, '/'); |
826 | strcat(#del_from, filename); |
876 | strcat(#del_from, filename); |
827 | if ( TestBit(ESDWORD[filename-40], 4) ) |
877 | if ( TestBit(ESDWORD[filename-40], 4) ) |
828 | Del_File2(#del_from); |
878 | Del_File2(#del_from); |
829 | else |
879 | else |
830 | { |
880 | { |
831 | if (error = DeleteFile(#del_from)) del_error = error; |
881 | if (error = DeleteFile(#del_from)) del_error = error; |
832 | } |
882 | } |
833 | } |
883 | } |
834 | } |
884 | } |
835 | if (error = DeleteFile(way)) del_error = error; |
885 | if (error = DeleteFile(way)) del_error = error; |
836 | } |
886 | } |
837 | 887 | ||
838 | 888 | ||
839 | void Del_File(byte dodel) |
889 | void Del_File(byte dodel) |
840 | { |
890 | { |
841 | byte del_from[4096]; |
891 | byte del_from[4096]; |
842 | dword selected_offset2; |
892 | dword selected_offset2; |
843 | int tst, count, i; |
893 | int tst, count, i; |
844 | 894 | ||
845 | if (dodel==true) |
895 | if (dodel==true) |
846 | { |
896 | { |
847 | del_active=2; |
897 | del_active=2; |
848 | if (itdir) ShowMessage(WAIT_DELETING_FOLDER, 0); |
898 | if (itdir) ShowMessage(WAIT_DELETING_FOLDER, 0); |
849 | del_error = 0; |
899 | del_error = 0; |
850 | 900 | ||
851 | if (selected_count) |
901 | if (selected_count) |
852 | { |
902 | { |
853 | for (i=0; i |
903 | for (i=0; i |
854 | { |
904 | { |
855 | selected_offset2 = file_mas[i]*304 + buf+32 + 7; |
905 | selected_offset2 = file_mas[i]*304 + buf+32 + 7; |
856 | if (ESBYTE[selected_offset2]) { |
906 | if (ESBYTE[selected_offset2]) { |
857 | strcpy(#del_from, #path); |
907 | strcpy(#del_from, #path); |
858 | strcat(#del_from, file_mas[i]*304+buf+72); |
908 | strcat(#del_from, file_mas[i]*304+buf+72); |
859 | Del_File2(#del_from); |
909 | Del_File2(#del_from); |
860 | } |
910 | } |
861 | } |
911 | } |
862 | } |
912 | } |
863 | else |
913 | else |
864 | { |
914 | { |
865 | Del_File2(#file_path); |
915 | Del_File2(#file_path); |
866 | } |
916 | } |
867 | if (del_error) Write_Error(del_error); |
917 | if (del_error) Write_Error(del_error); |
868 | } |
918 | } |
869 | del_active=0; |
919 | del_active=0; |
870 | DeleteButton(301); |
920 | DeleteButton(301); |
871 | DeleteButton(302); |
921 | DeleteButton(302); |
872 | Open_Dir(#path,WITH_REDRAW); |
922 | Open_Dir(#path,WITH_REDRAW); |
873 | } |
923 | } |
874 | 924 | ||
875 | 925 | ||
876 | void ReName(byte rename) |
926 | void ReName(byte rename) |
877 | { |
927 | { |
878 | int del_rezult, copy_rezult; |
928 | int del_rezult, copy_rezult; |
879 | char edit_name[256]; |
929 | char edit_name[256]; |
880 | rename_active=0; |
930 | rename_active=0; |
881 | edit2.flags=64; |
931 | edit2.flags=64; |
882 | if (rename==true) |
932 | if (rename==true) |
883 | { |
933 | { |
884 | strcpy(#temp, #path); |
934 | strcpy(#temp, #path); |
885 | strcpy(#edit_name, #file_name); //save edit name to select it later |
935 | strcpy(#edit_name, #file_name); //save edit name to select it later |
886 | strcat(#temp, #file_name); |
936 | strcat(#temp, #file_name); |
887 | if (strcmpi(#file_path,#temp)!=0) && (file_name) |
937 | if (strcmpi(#file_path,#temp)!=0) && (file_name) |
888 | if (itdir) |
938 | if (itdir) |
889 | { |
939 | { |
890 | if (del_rezult = DeleteFile(#file_path)) |
940 | if (del_rezult = DeleteFile(#file_path)) |
891 | { |
941 | { |
892 | Write_Error(del_rezult); |
942 | Write_Error(del_rezult); |
893 | ShowMessage(T_DEL_ERROR_1, 150); |
943 | ShowMessage(T_DEL_ERROR_1, 150); |
894 | return; |
944 | return; |
895 | } |
945 | } |
896 | if (CreateDir(#temp)) CreateDir(#file_path); |
946 | if (CreateDir(#temp)) CreateDir(#file_path); |
897 | Open_Dir(#path,WITH_REDRAW); |
947 | Open_Dir(#path,WITH_REDRAW); |
898 | SelectFile(#edit_name); |
948 | SelectFile(#edit_name); |
899 | } |
949 | } |
900 | else |
950 | else |
901 | { |
951 | { |
902 | if (copy_rezult = CopyFile(#file_path,#temp)) |
952 | if (copy_rezult = CopyFile(#file_path,#temp)) |
903 | { |
953 | { |
904 | Write_Error(copy_rezult); |
954 | Write_Error(copy_rezult); |
905 | } |
955 | } |
906 | else |
956 | else |
907 | { |
957 | { |
908 | Del_File(true); |
958 | Del_File(true); |
909 | SelectFile(#edit_name); |
959 | SelectFile(#edit_name); |
910 | } |
960 | } |
911 | } |
961 | } |
912 | } |
962 | } |
913 | Line_ReDraw(col_selec,files.current); |
963 | Line_ReDraw(col_selec,files.current); |
914 | } |
964 | } |
915 | 965 | ||
916 | 966 | ||
917 | void SelectFile(dword that_file) |
967 | void SelectFile(dword that_file) |
918 | { |
968 | { |
919 | files.first=files.current=0; |
969 | files.first=files.current=0; |
920 | Open_Dir(#path,ONLY_OPEN); |
970 | Open_Dir(#path,ONLY_OPEN); |
921 | if (!real_files_names_case) strttl(that_file); |
971 | if (!real_files_names_case) strttl(that_file); |
922 | for (i=files.count-1; i>=0; i--;) |
972 | for (i=files.count-1; i>=0; i--;) |
923 | if (!strcmp(file_mas[i]*304+buf+72,that_file)) break; |
973 | if (!strcmp(file_mas[i]*304+buf+72,that_file)) break; |
924 | List_Current(i); |
974 | List_Current(i); |
925 | List_ReDraw(); |
975 | List_ReDraw(); |
926 | } |
976 | } |
927 | 977 | ||
928 | 978 | ||
929 | void Dir_Up() |
979 | void Dir_Up() |
930 | { |
980 | { |
931 | char cur_folder[4096]; |
981 | char cur_folder[4096]; |
932 | i=strlen(#path)-1; |
982 | i=strlen(#path)-1; |
933 | if (i==0) return; |
983 | if (i==0) return; |
934 | path[i]=0x00; |
984 | path[i]=0x00; |
935 | i = strrchr(#path, '/'); |
985 | i = strrchr(#path, '/'); |
936 | strcpy(#cur_folder, #path+i); |
986 | strcpy(#cur_folder, #path+i); |
937 | path[i]=0x00; |
987 | path[i]=0x00; |
938 | SelectFile(#cur_folder); |
988 | SelectFile(#cur_folder); |
939 | } |
989 | } |
940 | 990 | ||
941 | void Open(byte rez) |
991 | void Open(byte rez) |
942 | { |
992 | { |
943 | byte temp[4096]; |
993 | byte temp[4096]; |
944 | selected_count = 0; |
994 | selected_count = 0; |
945 | if (rez) |
995 | if (rez) |
946 | { |
996 | { |
947 | if (!strcmp(#file_name,"..")) return; |
997 | if (!strcmp(#file_name,"..")) return; |
948 | strcpy(#temp, #file_path); |
998 | strcpy(#temp, #file_path); |
949 | if (path[strlen(#temp)-1]!='/') chrcat(#temp, '/'); //need "/" in the end |
999 | if (path[strlen(#temp)-1]!='/') chrcat(#temp, '/'); //need "/" in the end |
950 | RunProgram("/sys/File Managers/Eolite", #temp); |
1000 | RunProgram("/sys/File Managers/Eolite", #temp); |
951 | return; |
1001 | return; |
952 | } |
1002 | } |
953 | if (!files.count) return; |
1003 | if (!files.count) return; |
954 | if (!itdir) |
1004 | if (!itdir) |
955 | { |
1005 | { |
956 | if (strrchr(#file_name, '.')==0) RunProgram(#file_path, ""); else RunProgram("/sys/@open", #file_path); |
1006 | if (strrchr(#file_name, '.')==0) RunProgram(#file_path, ""); else RunProgram("/sys/@open", #file_path); |
957 | } |
1007 | } |
958 | else |
1008 | else |
959 | { |
1009 | { |
960 | if (!strcmp(#file_name,"..")) { Dir_Up(); return; } |
1010 | if (!strcmp(#file_name,"..")) { Dir_Up(); return; } |
961 | strcpy(#path, #file_path); |
1011 | strcpy(#path, #file_path); |
962 | if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //need "/" in the end |
1012 | if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //need "/" in the end |
963 | files.first=files.current=0; |
1013 | files.first=files.current=0; |
964 | Open_Dir(#path,WITH_REDRAW); |
1014 | Open_Dir(#path,WITH_REDRAW); |
965 | } |
1015 | } |
966 | } |
1016 | } |
967 | 1017 | ||
968 | 1018 | ||
969 | inline fastcall void GoBack() |
1019 | inline fastcall void GoBack() |
970 | { |
1020 | { |
971 | char cur_folder[4096]; |
1021 | char cur_folder[4096]; |
972 | strcpy(#cur_folder, GetCurrentFolder()); |
1022 | strcpy(#cur_folder, GetCurrentFolder()); |
973 | if (HistoryPath(GO_BACK)) SelectFile(#cur_folder); |
1023 | if (HistoryPath(GO_BACK)) SelectFile(#cur_folder); |
974 | } |
1024 | } |
975 | 1025 | ||
976 | void ShowOpenWithDialog() |
1026 | void ShowOpenWithDialog() |
977 | { |
1027 | { |
978 | byte param[4097]; |
1028 | byte param[4097]; |
979 | param[0] = '~'; |
1029 | param[0] = '~'; |
980 | param[1] = '\0'; |
1030 | param[1] = '\0'; |
981 | strcat(#param, #file_path); |
1031 | strcat(#param, #file_path); |
982 | RunProgram("/sys/@open", #param); |
1032 | RunProgram("/sys/@open", #param); |
983 | } |
1033 | } |
984 | 1034 | ||
985 | void FnProcess(char N) |
1035 | void FnProcess(char N) |
986 | { |
1036 | { |
987 | switch(N) |
1037 | switch(N) |
988 | { |
1038 | { |
989 | case 1: |
1039 | case 1: |
990 | if (!active_about) |
1040 | if (!active_about) |
991 | { |
1041 | { |
992 | SwitchToAnotherThread(); |
1042 | SwitchToAnotherThread(); |
993 | about_window=CreateThread(#about_dialog,#about_stak+4092); |
1043 | about_window=CreateThread(#about_dialog,#about_stak+4092); |
994 | break; |
1044 | break; |
995 | } |
1045 | } |
996 | else |
1046 | else |
997 | { |
1047 | { |
998 | ActivateWindow(GetProcessSlot(about_window)); |
1048 | ActivateWindow(GetProcessSlot(about_window)); |
999 | } |
1049 | } |
1000 | break; |
1050 | break; |
1001 | case 2: |
1051 | case 2: |
1002 | if (!files.count) break; |
1052 | if (!files.count) break; |
1003 | edit2.flags = 100000000000010b; //set active |
1053 | edit2.flags = 100000000000010b; //set active |
1004 | edit2.left = files.x + 21; |
1054 | edit2.left = files.x + 21; |
1005 | edit2.width = files.w - 26; |
1055 | edit2.width = files.w - 26; |
1006 | edit2.top=files.current*files.line_h+59; |
1056 | edit2.top=files.current*files.line_h+59; |
1007 | edit2.size=edit2.pos=strlen(#file_name); |
1057 | edit2.size=edit2.pos=strlen(#file_name); |
1008 | edit_box_draw stdcall (#edit2); |
1058 | edit_box_draw stdcall (#edit2); |
1009 | DrawBar(edit2.left,files.current*files.line_h+58,edit2.width+1,1,0xFFFFCC); //bg |
1059 | DrawBar(edit2.left,files.current*files.line_h+58,edit2.width+1,1,0xFFFFCC); //bg |
1010 | rename_active=1; |
1060 | rename_active=1; |
1011 | break; |
1061 | break; |
1012 | case 3: |
1062 | case 3: |
1013 | IF (!itdir) RunProgram("/sys/tinypad", #file_path); |
1063 | IF (!itdir) RunProgram("/sys/tinypad", #file_path); |
1014 | break; |
1064 | break; |
1015 | case 4: |
1065 | case 4: |
1016 | IF (!itdir) RunProgram("/sys/develop/heed", #file_path); |
1066 | IF (!itdir) RunProgram("/sys/develop/heed", #file_path); |
1017 | break; |
1067 | break; |
1018 | case 5: //refresh cur dir & devs |
1068 | case 5: //refresh cur dir & devs |
1019 | Tip(56, T_DEVICES, 55, "-"); |
1069 | Tip(56, T_DEVICES, 55, "-"); |
1020 | Open_Dir(#path,WITH_REDRAW); |
1070 | Open_Dir(#path,WITH_REDRAW); |
1021 | pause(10); |
1071 | pause(10); |
1022 | LoadIniSettings(); |
1072 | LoadIniSettings(); |
1023 | GetSystemDiscs(); |
1073 | GetSystemDiscs(); |
1024 | Open_Dir(#path,WITH_REDRAW); |
1074 | Open_Dir(#path,WITH_REDRAW); |
1025 | DrawLeftPanel(); |
1075 | DrawLeftPanel(); |
1026 | break; |
1076 | break; |
1027 | case 6: |
1077 | case 6: |
1028 | strcpy(#temp, #path); |
1078 | strcpy(#temp, #path); |
1029 | strcat(#temp, T_NEW_FOLDER); |
1079 | strcat(#temp, T_NEW_FOLDER); |
1030 | CreateDir(#temp); |
1080 | CreateDir(#temp); |
1031 | if (!EAX){ |
1081 | if (!EAX){ |
1032 | SelectFile(T_NEW_FOLDER); |
1082 | SelectFile(T_NEW_FOLDER); |
1033 | FnProcess(2); |
1083 | FnProcess(2); |
1034 | } |
1084 | } |
1035 | else |
1085 | else |
1036 | { |
1086 | { |
1037 | Write_Error(EAX); |
1087 | Write_Error(EAX); |
1038 | ShowMessage(NOT_CREATE_FOLDER, 150); |
1088 | ShowMessage(NOT_CREATE_FOLDER, 150); |
1039 | } |
1089 | } |
1040 | break; |
1090 | break; |
1041 | case 7: |
1091 | case 7: |
1042 | strcpy(#temp, #path); |
1092 | strcpy(#temp, #path); |
1043 | strcat(#temp, T_NEW_FILE); |
1093 | strcat(#temp, T_NEW_FILE); |
1044 | WriteFile(0, 0, #temp); |
1094 | WriteFile(0, 0, #temp); |
1045 | if (!EAX){ |
1095 | if (!EAX){ |
1046 | SelectFile(T_NEW_FILE); |
1096 | SelectFile(T_NEW_FILE); |
1047 | FnProcess(2); |
1097 | FnProcess(2); |
1048 | } |
1098 | } |
1049 | else |
1099 | else |
1050 | { |
1100 | { |
1051 | Write_Error(EAX); |
1101 | Write_Error(EAX); |
1052 | ShowMessage(NOT_CREATE_FILE, 150); |
1102 | ShowMessage(NOT_CREATE_FILE, 150); |
1053 | } |
1103 | } |
1054 | break; |
1104 | break; |
1055 | case 8: |
1105 | case 8: |
1056 | SwitchToAnotherThread(); |
1106 | SwitchToAnotherThread(); |
1057 | CreateThread(#properties_dialog, #properties_stak+4092); |
1107 | CreateThread(#properties_dialog, #properties_stak+4092); |
1058 | break; |
1108 | break; |
1059 | case 10: //F10 |
1109 | case 10: //F10 |
1060 | if (!active_settings) |
1110 | if (!active_settings) |
1061 | { |
1111 | { |
1062 | SwitchToAnotherThread(); |
1112 | SwitchToAnotherThread(); |
1063 | settings_window=CreateThread(#settings_dialog, #settings_stak+4092); |
1113 | settings_window=CreateThread(#settings_dialog, #settings_stak+4092); |
1064 | break; |
1114 | break; |
1065 | } |
1115 | } |
1066 | else |
1116 | else |
1067 | { |
1117 | { |
1068 | ActivateWindow(GetProcessSlot(settings_window)); |
1118 | ActivateWindow(GetProcessSlot(settings_window)); |
1069 | } |
1119 | } |
1070 | break; |
1120 | break; |
1071 | } |
1121 | } |
1072 | } |
1122 | } |
1073 | 1123 | ||
1074 | //need to remove these functiones, they are a very old shit :) |
1124 | //need to remove these functiones, they are a very old shit :) |
1075 | dword onTop(dword down,up) {EAX=Form.height-GetSkinHeight()-down-up;} |
1125 | dword onTop(dword down,up) {EAX=Form.height-GetSkinHeight()-down-up;} |
1076 | 1126 | ||
1077 | 1127 | ||
1078 | stop: |
1128 | stop: |
1079 | 1129 | ||
1080 | char menu_stak[4096]; |
1130 | char menu_stak[4096]; |
1081 | char copy_stak[4096]; |
1131 | char copy_stak[4096]; |
1082 | char open_with_stak[4096]; |
1132 | char open_with_stak[4096]; |
1083 | char about_stak[4096]; |
1133 | char about_stak[4096]; |
1084 | char properties_stak[4096]; |
1134 | char properties_stak[4096]; |
1085 | char settings_stak[4096];28)>>0)> |
1135 | char settings_stak[4096];28)>>0)> |
1086 | >=0)>=0)>480)>5;>6;>3;>480)>>8; |
1136 | >=0)>=0)>480)>5;>6;>3;>480)>>8; |
1087 | ><8; |
1137 | ><8; |
1088 | >0)>=Form.width-6)> |
1138 | >0)>=Form.width-6)> |
1089 | > |
1139 | > |
1090 | >=Form.width-6)> |
1140 | >=Form.width-6)> |
1091 | >=Form.width-6)> |
1141 | >=Form.width-6)>>>0)>0)> |