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