Rev 7778 | Rev 7804 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7778 | Rev 7786 | ||
---|---|---|---|
Line 148... | Line 148... | ||
148 | #include "include\delete.h" |
148 | #include "include\delete.h" |
149 | #include "include\about.h" |
149 | #include "include\about.h" |
150 | #include "include\properties.h" |
150 | #include "include\properties.h" |
151 | #include "include\breadcrumbs.h" |
151 | #include "include\breadcrumbs.h" |
Line -... | Line 152... | ||
- | 152 | ||
- | 153 | void load_libraries() |
|
- | 154 | { |
|
- | 155 | load_dll(boxlib, #box_lib_init,0); |
|
- | 156 | load_dll(libini, #lib_init,1); |
|
- | 157 | load_dll(libio, #libio_init,1); |
|
- | 158 | load_dll(libimg, #libimg_init,1); |
|
- | 159 | } |
|
152 | 160 | ||
153 | void main() |
161 | void main() |
154 | { |
162 | { |
155 | dword id; |
163 | dword id; |
156 | byte count_sl = 0; |
- | |
157 | signed x_old, y_old, dif_x, dif_y, adif_x, adif_y; |
164 | byte count_sl = 0; |
158 | char stats; |
165 | |
Line 159... | Line -... | ||
159 | rand_n = random(40); |
- | |
160 | 166 | rand_n = random(40); |
|
161 | load_dll(boxlib, #box_lib_init,0); |
- | |
162 | load_dll(libini, #lib_init,1); |
- | |
Line 163... | Line 167... | ||
163 | load_dll(libio, #libio_init,1); |
167 | |
164 | load_dll(libimg, #libimg_init,1); |
168 | load_libraries(); |
165 | 169 | ||
Line 180... | Line 184... | ||
180 | 184 | ||
181 | if (param) |
185 | if (param) |
182 | { |
186 | { |
Line 183... | Line 187... | ||
183 | if (strlen(#param)>1) && (param[strlen(#param)-1]=='/') param[strlen(#param)-1]=NULL; //no "/" at the end |
187 | if (strlen(#param)>1) && (param[strlen(#param)-1]=='/') param[strlen(#param)-1]=NULL; //no "/" at the end |
184 | - | ||
185 | if (dir_exists(#param)==true) |
188 | |
186 | { |
- | |
187 | strcpy(#path, #param); |
189 | if (dir_exists(#param)) { |
188 | } |
- | |
189 | else |
190 | strcpy(#path, #param); |
190 | { |
191 | } else { |
191 | notify(T_NOTIFY_APP_PARAM_WRONG); |
192 | notify(T_NOTIFY_APP_PARAM_WRONG); |
Line 192... | Line 193... | ||
192 | } |
193 | } |
193 | } |
194 | } |
194 | 195 | ||
195 | Open_Dir(#path,ONLY_OPEN); |
196 | Open_Dir(#path,ONLY_OPEN); |
196 | strcpy(#inactive_path, #path); |
- | |
197 | llist_copy(#files_inactive, #files); |
197 | strcpy(#inactive_path, #path); |
198 | SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER); |
198 | llist_copy(#files_inactive, #files); |
199 | loop(){ |
199 | SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER); |
200 | switch(WaitEventTimeout(50)) |
200 | loop() switch(WaitEventTimeout(50)) |
201 | { |
201 | { |
202 | case evMouse: |
202 | case evMouse: |
Line 207... | Line 207... | ||
207 | break; |
207 | break; |
208 | } |
208 | } |
Line 209... | Line 209... | ||
209 | 209 | ||
Line 210... | Line -... | ||
210 | mouse.get(); |
- | |
211 | - | ||
212 | if (!mouse.mkm) && (stats>0) stats = 0; |
- | |
213 | if (mouse.mkm) && (!stats) |
- | |
214 | { |
- | |
215 | x_old = mouse.x; |
- | |
216 | y_old = mouse.y; |
- | |
217 | stats = 1; |
- | |
218 | } |
- | |
219 | if (mouse.mkm) && (stats==1) |
- | |
220 | { |
- | |
221 | dif_x = mouse.x-x_old; |
- | |
222 | dif_y = mouse.y-y_old; |
210 | mouse.get(); |
Line 223... | Line -... | ||
223 | adif_x = fabs(dif_x); |
- | |
224 | adif_y = fabs(dif_y); |
- | |
225 | - | ||
226 | if (adif_x>adif_y) |
- | |
227 | { |
- | |
228 | if (dif_x > 150) |
- | |
229 | { |
- | |
230 | if (history.forward()) |
- | |
231 | { |
- | |
232 | strcpy(#path, history.current()); |
- | |
233 | files.KeyHome(); |
- | |
234 | Open_Dir(#path,WITH_REDRAW); |
- | |
235 | } |
- | |
236 | stats = 0; |
- | |
237 | } |
- | |
238 | if (dif_x < -150) |
- | |
239 | { |
- | |
240 | GoBack(); |
- | |
241 | stats = 0; |
- | |
242 | } |
- | |
243 | } |
- | |
244 | else |
- | |
245 | { |
- | |
246 | if (dif_y < -100) |
- | |
247 | { |
- | |
248 | Dir_Up(); |
- | |
249 | stats = 0; |
- | |
250 | } |
211 | |
251 | } |
212 | ProceedMouseGestures(); |
252 | } |
213 | |
253 | if (files.MouseOver(mouse.x, mouse.y)) |
214 | if (files.MouseOver(mouse.x, mouse.y)) |
254 | { |
215 | { |
Line 359... | Line 320... | ||
359 | case PATH_BTN: |
320 | case PATH_BTN: |
360 | notify(COPY_PATH_STR); |
321 | notify(COPY_PATH_STR); |
361 | Clipboard__CopyText(#path); |
322 | Clipboard__CopyText(#path); |
362 | break; |
323 | break; |
363 | case 21: //Back |
324 | case 21: //Back |
364 | GoBack(); |
325 | EventHistoryGoBack(); |
365 | break; |
326 | break; |
366 | case 22: //Forward |
327 | case 22: //Forward |
367 | if (history.forward()) |
328 | EventHistoryGoForward(); |
368 | { |
- | |
369 | strcpy(#path, history.current()); |
- | |
370 | files.KeyHome(); |
- | |
371 | Open_Dir(#path,WITH_REDRAW); |
- | |
372 | } |
- | |
373 | break; |
329 | break; |
374 | case 23: |
330 | case 23: |
375 | Dir_Up(); |
331 | Dir_Up(); |
376 | break; |
332 | break; |
377 | case 24: |
333 | case 24: |
Line 484... | Line 440... | ||
484 | } |
440 | } |
Line 485... | Line 441... | ||
485 | 441 | ||
486 | switch (key_scancode) |
442 | switch (key_scancode) |
487 | { |
443 | { |
488 | case SCAN_CODE_BS: |
444 | case SCAN_CODE_BS: |
489 | //GoBack(); |
445 | //EventHistoryGoBack(); |
490 | Dir_Up(); |
446 | Dir_Up(); |
491 | break; |
447 | break; |
492 | case SCAN_CODE_ENTER: |
448 | case SCAN_CODE_ENTER: |
493 | Open(0); |
449 | Open(0); |
Line 544... | Line 500... | ||
544 | else if(cmd_free==5) copy_stak=free(copy_stak); |
500 | else if(cmd_free==5) copy_stak=free(copy_stak); |
545 | else if(cmd_free==6) delete_stak=free(delete_stak); |
501 | else if(cmd_free==6) delete_stak=free(delete_stak); |
546 | cmd_free = false; |
502 | cmd_free = false; |
547 | } |
503 | } |
548 | } |
504 | } |
549 | } |
- | |
Line 550... | Line 505... | ||
550 | 505 | ||
551 | void draw_window() |
506 | void draw_window() |
552 | { |
507 | { |
553 | dword i; |
508 | dword i; |
Line 815... | Line 770... | ||
815 | if (buf) free(buf); |
770 | if (buf) free(buf); |
816 | errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT); |
771 | errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT); |
817 | if (errornum) |
772 | if (errornum) |
818 | { |
773 | { |
819 | history.add(#path); |
774 | history.add(#path); |
820 | GoBack(); |
775 | EventHistoryGoBack(); |
821 | Write_Error(errornum); |
776 | Write_Error(errornum); |
822 | return; |
777 | return; |
823 | } |
778 | } |
824 | maxcount = sizeof(file_mas)/sizeof(dword)-1; |
779 | maxcount = sizeof(file_mas)/sizeof(dword)-1; |
825 | if (files.count>maxcount) files.count = maxcount; |
780 | if (files.count>maxcount) files.count = maxcount; |
Line 971... | Line 926... | ||
971 | files.first=files.cur_y=0; |
926 | files.first=files.cur_y=0; |
972 | Open_Dir(#path,WITH_REDRAW); |
927 | Open_Dir(#path,WITH_REDRAW); |
973 | } |
928 | } |
974 | } |
929 | } |
Line 975... | Line 930... | ||
975 | 930 | ||
976 | inline fastcall void GoBack() |
931 | inline fastcall void EventHistoryGoBack() |
977 | { |
932 | { |
978 | char cur_folder[4096]; |
933 | char cur_folder[4096]; |
979 | strcpy(#cur_folder, #path); |
934 | strcpy(#cur_folder, #path); |
980 | if (history.back()) { |
935 | if (history.back()) { |
Line 1089... | Line 1044... | ||
1089 | void FnProcess(byte N) |
1044 | void FnProcess(byte N) |
1090 | { |
1045 | { |
1091 | switch(N) |
1046 | switch(N) |
1092 | { |
1047 | { |
1093 | case 1: |
1048 | case 1: |
1094 | if (!active_about) |
1049 | if (!active_about) { |
1095 | { |
- | |
1096 | about_stak = malloc(4096); |
1050 | about_stak = malloc(4096); |
1097 | about_thread_id = CreateThread(#about_dialog,about_stak+4092); |
1051 | about_thread_id = CreateThread(#about_dialog,about_stak+4092); |
1098 | break; |
1052 | break; |
1099 | } |
- | |
1100 | else |
1053 | } else { |
1101 | { |
- | |
1102 | ActivateWindow(GetProcessSlot(about_thread_id)); |
1054 | ActivateWindow(GetProcessSlot(about_thread_id)); |
1103 | } |
1055 | } |
1104 | break; |
1056 | break; |
1105 | case 2: |
1057 | case 2: |
1106 | if (!files.count) break; |
- | |
1107 | NewElement_Form(RENAME_ITEM, #file_name); |
1058 | if (files.count) NewElement_Form(RENAME_ITEM, #file_name); |
1108 | break; |
1059 | break; |
1109 | case 3: |
1060 | case 3: |
1110 | if (!itdir) RunProgram("/sys/tinypad", #file_path); |
1061 | if (files.count) && (!itdir) RunProgram("/sys/tinypad", #file_path); |
1111 | break; |
1062 | break; |
1112 | case 4: |
1063 | case 4: |
1113 | if (!itdir) RunProgram("/sys/develop/heed", #file_path); |
1064 | if (files.count) && (!itdir) RunProgram("/sys/develop/heed", #file_path); |
1114 | break; |
1065 | break; |
1115 | case 5: //refresh cur dir & devs |
1066 | case 5: //refresh cur dir & devs |
1116 | if (two_panels.checked) |
1067 | if (two_panels.checked) |
1117 | { |
1068 | { |
1118 | DrawFilePanels(); |
1069 | DrawFilePanels(); |
Line 1236... | Line 1187... | ||
1236 | DrawList(); |
1187 | DrawList(); |
1237 | Open_Dir(#path,WITH_REDRAW); |
1188 | Open_Dir(#path,WITH_REDRAW); |
1238 | SelectFileByName(#selected_filename); |
1189 | SelectFileByName(#selected_filename); |
1239 | } |
1190 | } |
Line -... | Line 1191... | ||
- | 1191 | ||
- | 1192 | void EventHistoryGoForward() |
|
- | 1193 | { |
|
- | 1194 | if (history.forward()) { |
|
- | 1195 | strcpy(#path, history.current()); |
|
- | 1196 | files.KeyHome(); |
|
- | 1197 | Open_Dir(#path,WITH_REDRAW); |
|
- | 1198 | } |
|
- | 1199 | } |
|
- | 1200 | ||
- | 1201 | void ProceedMouseGestures() |
|
- | 1202 | { |
|
- | 1203 | char stats; |
|
- | 1204 | signed x_old, y_old, dif_x, dif_y, adif_x, adif_y; |
|
- | 1205 | if (!mouse.mkm) && (stats>0) stats = 0; |
|
- | 1206 | if (mouse.mkm) && (!stats) |
|
- | 1207 | { |
|
- | 1208 | x_old = mouse.x; |
|
- | 1209 | y_old = mouse.y; |
|
- | 1210 | stats = 1; |
|
- | 1211 | } |
|
- | 1212 | if (mouse.mkm) && (stats==1) |
|
- | 1213 | { |
|
- | 1214 | dif_x = mouse.x-x_old; |
|
- | 1215 | dif_y = mouse.y-y_old; |
|
- | 1216 | adif_x = fabs(dif_x); |
|
- | 1217 | adif_y = fabs(dif_y); |
|
- | 1218 | ||
- | 1219 | if (adif_x>adif_y) { |
|
- | 1220 | if (dif_x > 150) { |
|
- | 1221 | EventHistoryGoForward(); |
|
- | 1222 | stats = 0; |
|
- | 1223 | } |
|
- | 1224 | if (dif_x < -150) { |
|
- | 1225 | EventHistoryGoBack(); |
|
- | 1226 | stats = 0; |
|
- | 1227 | } |
|
- | 1228 | } else { |
|
- | 1229 | if (dif_y < -100) { |
|
- | 1230 | Dir_Up(); |
|
- | 1231 | stats = 0; |
|
- | 1232 | } |
|
- | 1233 | } |
|
- | 1234 | } |
|
- | 1235 | } |
|
1240 | 1236 |