Subversion Repositories Kolibri OS

Rev

Rev 8762 | Rev 8765 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8762 Rev 8764
Line 1... Line 1...
1
//Leency, Veliant, Punk_Joker, PavelYakov & KolibriOS Team 2008-2021
1
//Leency, Veliant, Punk_Joker, PavelYakov & KolibriOS Team 2008-2021
2
//GNU GPL license.
2
//GNU GPL license.
Line 3... Line 3...
3
 
3
 
Line 4... Line 4...
4
// 70.5 - get volume info and label
4
// 70.5 - get volume info and label
5
 
5
 
Line 6... Line 6...
6
#define TITLE "Eolite File Manager 4.51"
6
#define TITLE "Eolite File Manager 4.6"
7
#define ABOUT_TITLE "EOLITE 4.51"
7
#define ABOUT_TITLE "EOLITE 4.6"
8
 
8
 
Line 26... Line 26...
26
#include "../lib/obj/libini.h"
26
#include "../lib/obj/libini.h"
27
#include "../lib/obj/box_lib.h"
27
#include "../lib/obj/box_lib.h"
28
#include "../lib/obj/libimg.h"
28
#include "../lib/obj/libimg.h"
Line 29... Line 29...
29
 
29
 
-
 
30
#include "../lib/patterns/history.h"
Line 30... Line 31...
30
#include "../lib/patterns/history.h"
31
#include "../lib/patterns/toolbar_button.h"
Line 31... Line 32...
31
 
32
 
32
#include "imgs/images.h"
33
#include "imgs/images.h"
Line 72... Line 73...
72
	dword slider_bg_left;
73
	dword slider_bg_left;
73
	dword odd_line;
74
	dword odd_line;
74
} col;
75
} col;
75
dword waves_pal[256];
76
dword waves_pal[256];
Line -... Line 77...
-
 
77
 
-
 
78
bool efm = false;
76
 
79
 
Line 77... Line 80...
77
int toolbar_buttons_x[7]={9,46,85,134,167,203};
80
int toolbar_buttons_x[7]={9,46,85,134,167,203};
78
 
81
 
79
bool active_about = false;
82
bool active_about = false;
Line 161... Line 164...
161
void handle_param()
164
void handle_param()
162
{
165
{
163
	//-p  : just show file/folder properties dialog
166
	//-p  : just show file/folder properties dialog
164
	//-d  : delete file/folder
167
	//-d  : delete file/folder
165
	//-v : paste files/folder from clipboard
168
	//-v : paste files/folder from clipboard
-
 
169
	dword p = #param;
-
 
170
	if (param[0]=='/') && (param[1]=='E') && (param[2]=='F') && (param[3]=='M') {
-
 
171
		efm = true;
-
 
172
		p += 4;
-
 
173
		if (param[4]==' ') p++;
-
 
174
	}
-
 
175
 
-
 
176
	if (ESBYTE[p]=='\0') return;
-
 
177
 
166
	if (param) && (param[0]=='-') switch (param[1]) 
178
	if (ESBYTE[p]=='-') switch (ESBYTE[p+1]) 
167
	{
179
	{
168
		case 'p':
180
		case 'p':
169
			strcpy(#file_path, #param + 3);
181
			strcpy(#file_path, p + 3);
170
			itdir = dir_exists(#file_path);
182
			itdir = dir_exists(#file_path);
171
			strcpy(#file_name, #param + strrchr(#param, '/'));
183
			strcpy(#file_name, p + strrchr(p, '/'));
172
			param[strrchr(#param, '/')-1] = '\0';
184
			ESBYTE[strrchr(p, '/')+p-1] = '\0';
173
			strcpy(#path, #param + 3);
185
			strcpy(#path, p + 3);
174
			properties_dialog();
186
			properties_dialog();
175
			ExitProcess();
187
			ExitProcess();
176
			return;
-
 
177
		case 'd':
188
		case 'd':
178
			strcpy(#file_path, #param + 3);
189
			strcpy(#file_path, p + 3);
179
			itdir = dir_exists(#file_path);
190
			itdir = dir_exists(#file_path);
180
			DisplayOperationForm(DELETE_FLAG);
191
			DisplayOperationForm(DELETE_FLAG);
181
			DeleteSingleElement();
192
			DeleteSingleElement();
182
			ExitProcess();
193
			ExitProcess();
183
			return;
-
 
184
		case 'v':
194
		case 'v':
185
			cut_active = param[2] - '0';
195
			cut_active = ESBYTE[p+2] - '0';
186
			strcpy(#path, #param + 4);
196
			strcpy(#path, p + 4);
187
			PasteThread();
197
			PasteThread();
188
			ExitProcess();
198
			ExitProcess();
-
 
199
	}
-
 
200
 
-
 
201
	if (ESBYTE[strlen(p)+p-1]=='/') ESBYTE[strlen(p)+p-1]=NULL; //no "/" at the end
-
 
202
 
-
 
203
	if (dir_exists(p)) {
-
 
204
		strcpy(#path, p);
-
 
205
	} else {
-
 
206
		if (file_exists(p)) {
-
 
207
			ESBYTE[strrchr(p, '/')+p-1] = '\0';
-
 
208
			strcpy(#path, p);
-
 
209
			SelectFileByName(p+strlen(p)+1);
189
			return;
210
		} else {
-
 
211
			notify(T_NOTIFY_APP_PARAM_WRONG);
-
 
212
		}
190
	}
213
	}	
191
}
214
}
Line 192... Line 215...
192
 
215
 
193
void main() 
216
void main() 
194
{
217
{
195
	dword id;
218
	dword id;
Line -... Line 219...
-
 
219
	int old_cur_y;
-
 
220
 
-
 
221
	handle_param();
196
	int old_cur_y;
222
	ESBYTE[0] = NULL;
Line 197... Line 223...
197
 
223
 
Line 198... Line 224...
198
	rand_n = random(80);
224
	rand_n = random(80);
199
 
225
 
200
	load_libraries();
226
	load_libraries();	
Line 201... Line -...
201
	
-
 
202
	SetAppColors();
-
 
203
	LoadIniSettings();
-
 
204
	SystemDiscs.Get();
-
 
205
 
-
 
206
	handle_param();
-
 
207
 
-
 
208
	ESBYTE[0] = NULL;
-
 
209
 
-
 
210
	if (param)
-
 
211
	{
-
 
212
		if (strlen(#param)>1) && (param[strlen(#param)-1]=='/') param[strlen(#param)-1]=NULL; //no "/" at the end
-
 
213
 
-
 
214
		if (dir_exists(#param)) {
-
 
215
			strcpy(#path, #param);
-
 
216
		} else {
-
 
217
			if (file_exists(#param)) {
-
 
218
				param[strrchr(#param, '/')-1] = '\0';
-
 
219
				strcpy(#path, #param);
-
 
220
				SelectFileByName(#param+strlen(#param)+1);
-
 
221
			} else {
-
 
222
				notify(T_NOTIFY_APP_PARAM_WRONG);
227
 
223
			}
228
	SetAppColors();
224
		}
229
	LoadIniSettings();
225
	}
230
	SystemDiscs.Get();
226
	
231
 
Line 305... Line 310...
305
				DrawRectangle3D(files.x+files.w+1,files.y+files.h-15,14,14,sc.work_light,sc.work_dark);
310
				DrawRectangle3D(files.x+files.w+1,files.y+files.h-15,14,14,sc.work_light,sc.work_dark);
306
			}
311
			}
Line 307... Line 312...
307
 
312
 
308
			//Scrooll
313
			//Scrooll
309
			if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+18) && (mouse.y>files.y) && (mouse.y
314
			if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+18) && (mouse.y>files.y) && (mouse.y
Line 310... Line 315...
310
			if (scroll_used) && (mouse.up) { scroll_used=false; Scroll(); }
315
			if (scroll_used) && (!mouse.key&MOUSE_LEFT) { scroll_used=false; Scroll(); }
311
			
316
			
312
			if (scroll_used)
317
			if (scroll_used)
313
			{
318
			{
Line 523... Line 528...
523
							EventChooseFile(files.cur_y);
528
							EventChooseFile(files.cur_y);
524
							files.KeyDown();
529
							files.KeyDown();
525
							DrawStatusBar();
530
							DrawStatusBar();
526
							List_ReDraw();
531
							List_ReDraw();
527
							break;
532
							break;
528
					case SCAN_CODE_F1...SCAN_CODE_F10:
533
					case SCAN_CODE_F2...SCAN_CODE_F10:
529
							FnProcess(key_scancode-58);
534
							FnProcess(key_scancode-58);
530
							break; 
535
							break; 
531
					default:
536
					default:
532
							EventSelectFileByKeyPress();
537
							EventSelectFileByKeyPress();
533
			}                         
538
			}                         
Line 558... Line 563...
558
}
563
}
Line 559... Line 564...
559
 
564
 
560
void draw_window()
565
void draw_window()
561
{
566
{
-
 
567
	dword i;
562
	dword i;
568
	incn x;
563
	if (show_status_bar.checked) status_bar_h = STATUS_BAR_H; else status_bar_h = 0;
569
	if (show_status_bar.checked) status_bar_h = STATUS_BAR_H; else status_bar_h = 0;
564
	DefineAndDrawWindow(Form.left+rand_n,Form.top+rand_n,Form.width,Form.height,0x73,NULL,TITLE,0);
570
	DefineAndDrawWindow(Form.left+rand_n,Form.top+rand_n,Form.width,Form.height,0x73,NULL,TITLE,0);
565
	GetProcessInfo(#Form, SelfInfo);
571
	GetProcessInfo(#Form, SelfInfo);
566
	if (Form.status_window>2) return;
572
	if (Form.status_window>2) return;
567
	if (Form.height < 350) { MoveSize(OLD,OLD,OLD,350); return; }
-
 
568
	if (!two_panels.checked) && (Form.width < 480) { MoveSize(OLD,OLD,480,OLD); return; }
-
 
569
	if ( two_panels.checked) && (Form.width < 573) { MoveSize(OLD,OLD,573,OLD); return; }
573
	if (Form.height < 350) { MoveSize(OLD,OLD,OLD,350); return; }
570
	GetProcessInfo(#Form, SelfInfo);
574
	GetProcessInfo(#Form, SelfInfo);
-
 
575
	SetAppColors();
-
 
576
	if (two_panels.checked) {
-
 
577
		if (Form.width < 573) { MoveSize(OLD,OLD,573,OLD); return; }
-
 
578
		DrawBar(0, 0, Form.cwidth, 34, sc.work);
-
 
579
		#define PAD 7
-
 
580
		#define GAP_S 26+5
-
 
581
		#define GAP_B 26+14
-
 
582
		x.set(-GAP_S+8);
-
 
583
		DrawTopPanelButton(21, x.inc(GAP_S), PAD, 30, false);
-
 
584
		DrawTopPanelButton(22, x.inc(GAP_S), PAD, 31, false);
-
 
585
		DrawTopPanelButton(23, x.inc(GAP_B), PAD, 01, false);
-
 
586
		DrawTopPanelButton(24, x.inc(GAP_B), PAD, 55, false);
-
 
587
		DrawTopPanelButton(25, x.inc(GAP_S), PAD, 20, false);
-
 
588
		DrawTopPanelButton(26, x.inc(GAP_S), PAD, 56, false);
-
 
589
		DrawTopPanelButton(51, Form.cwidth-GAP_S-PAD, PAD, -1, false); //burger menu
-
 
590
	} else {
571
	SetAppColors();
591
		if (Form.width < 480) { MoveSize(OLD,OLD,480,OLD); return; }
572
	ESDWORD[#toolbar_pal] = sc.work;
592
		ESDWORD[#toolbar_pal] = sc.work;
573
	ESDWORD[#toolbar_pal+4] = MixColors(0, sc.work, 35);
593
		ESDWORD[#toolbar_pal+4] = MixColors(0, sc.work, 35);
574
	PutPaletteImage(#toolbar, 246, 34, 0, 0, 8, #toolbar_pal);
-
 
575
	DrawBar(127, 8, 1, 25, sc.work_graph);
594
		PutPaletteImage(#toolbar, 246, 34, 0, 0, 8, #toolbar_pal);		
576
	for (i=0; i<3; i++) DefineHiddenButton(toolbar_buttons_x[i]+2,7,31-5,29-5,21+i);
595
		for (i=0; i<3; i++) DefineHiddenButton(toolbar_buttons_x[i]+2,7,31-5,29-5,21+i);
-
 
596
		for (i=3; i<6; i++) DefineHiddenButton(toolbar_buttons_x[i],  5,31,  29,  21+i);
577
	for (i=3; i<6; i++) DefineHiddenButton(toolbar_buttons_x[i],  5,31,  29,  21+i);
597
		DrawBar(127, 8, 1, 25, sc.work_graph);
578
	DrawBar(246,0, Form.cwidth - 246, 34, sc.work);
598
		DrawBar(246,0, Form.cwidth - 246, 34, sc.work);
579
	DrawDot(Form.cwidth-17,12);
599
		DrawDot(Form.cwidth-17,12);
580
	DrawDot(Form.cwidth-17,12+6);
600
		DrawDot(Form.cwidth-17,12+6);
581
	DrawDot(Form.cwidth-17,12+12);
601
		DrawDot(Form.cwidth-17,12+12);
-
 
602
		DefineHiddenButton(Form.cwidth-24,7,20,25,51+BT_NOFRAME); //dots
582
	DefineHiddenButton(Form.cwidth-24,7,20,25,51+BT_NOFRAME); //dots
603
	}
583
	//main rectangles
604
	//main rectangles
584
	DrawRectangle(1,40,Form.cwidth-3,Form.cheight - 42-status_bar_h,sc.work_graph);
605
	DrawRectangle(1,40,Form.cwidth-3,Form.cheight - 42-status_bar_h,sc.work_graph);
585
	DrawRectangle(0,39,Form.cwidth-1,-show_status_bar.checked*status_bar_h + Form.cheight - 40,col.work_gradient[4]); //bg
606
	DrawRectangle(0,39,Form.cwidth-1,-show_status_bar.checked*status_bar_h + Form.cheight - 40,col.work_gradient[4]); //bg
586
	for (i=0; i<6; i++) DrawBar(0, 34+i, Form.cwidth, 1, MixColors(sc.work_dark, sc.work, i*10));
607
	for (i=0; i<6; i++) DrawBar(0, 34+i, Form.cwidth, 1, MixColors(sc.work_dark, sc.work, i*10));
Line 595... Line 616...
595
void DrawList() 
616
void DrawList() 
596
{
617
{
597
	word sorting_arrow_x;
618
	word sorting_arrow_x;
598
	dword sorting_arrow_t = "\x19";
619
	dword sorting_arrow_t = "\x19";
599
	if (sort_desc) sorting_arrow_t = "\x18";
620
	if (sort_desc) sorting_arrow_t = "\x18";
600
	DrawFlatButtonSmall(files.x, files.y-17,     files.w - 141,16,31,T_FILE);
621
	DrawFlatButtonSmall(files.x - efm,           files.y-17,files.w-141+efm,16,31,T_FILE);
601
	DrawFlatButtonSmall(files.x + files.w - 141, files.y-17,73,16,32,T_TYPE);
622
	DrawFlatButtonSmall(files.x + files.w - 141, files.y-17,73,16,32,T_TYPE);
602
	DrawFlatButtonSmall(files.x + files.w -  68, files.y-17,68,16,33,T_SIZE);
623
	DrawFlatButtonSmall(files.x + files.w -  68, files.y-17,68,16,33,T_SIZE);
603
	DrawFlatButtonSmall(files.x + files.w,       files.y-17,16,16, 0,"\x18");
624
	DrawFlatButtonSmall(files.x + files.w,       files.y-17,16,16, 0,"\x18");
604
	DrawFlatButtonSmall(files.x + files.w,files.y+files.h-16,16,16,0,"\x19");
625
	DrawFlatButtonSmall(files.x + files.w,files.y+files.h-16,16,16,0,"\x19");
605
	if (sort_type==1) sorting_arrow_x = files.w - 141 / 2 + files.x + 18;
626
	if (sort_type==1) sorting_arrow_x = files.w - 141 / 2 + files.x + 18;