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