Subversion Repositories Kolibri OS

Rev

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

Rev 7628 Rev 7634
Line 48... Line 48...
48
	ONLY_SHOW, 
48
	ONLY_SHOW, 
49
	WITH_REDRAW, 
49
	WITH_REDRAW, 
50
	ONLY_OPEN
50
	ONLY_OPEN
51
};
51
};
Line -... Line 52...
-
 
52
 
-
 
53
struct Eolite_colors
-
 
54
{
52
 
55
	dword lpanel;
-
 
56
	dword list_vert_line; //vertical line between columns in list
-
 
57
	dword selec;
-
 
58
	dword selec_active;
-
 
59
	dword selec_inactive;
-
 
60
	dword selec_text;
-
 
61
	dword work;
-
 
62
	dword graph;
-
 
63
	dword list_bg;
-
 
64
	dword list_gb_text;
-
 
65
	dword list_text_hidden;
-
 
66
	dword work_gradient[24];
-
 
67
	dword slider_bg_big;
-
 
68
	dword slider_bg_left;
-
 
69
	dword odd_line;
Line 53... Line 70...
53
dword col_selec, col_lpanel, col_work, col_graph, col_list_line=0xDDD7CF;
70
} col;
Line 54... Line 71...
54
 
71
 
55
int toolbar_buttons_x[7]={9,46,85,134,167,203};
72
int toolbar_buttons_x[7]={9,46,85,134,167,203};
Line 148... Line 165...
148
	LoadIniSettings();
165
	LoadIniSettings();
149
	SystemDiscs.Get();
166
	SystemDiscs.Get();
Line 150... Line 167...
150
 
167
 
151
	Libimg_LoadImage(#icons16_default, "/sys/icons16.png");
168
	Libimg_LoadImage(#icons16_default, "/sys/icons16.png");
152
	Libimg_LoadImage(#icons16_selected, "/sys/icons16.png");
169
	Libimg_LoadImage(#icons16_selected, "/sys/icons16.png");
153
	Libimg_ReplaceColor(icons16_selected.image, icons16_selected.w, icons16_selected.h, 0xffFFFfff, col_selec);
170
	Libimg_ReplaceColor(icons16_selected.image, icons16_selected.w, icons16_selected.h, 0xffFFFfff, col.selec);
-
 
171
	Libimg_ReplaceColor(icons16_selected.image, icons16_selected.w, icons16_selected.h, 0xffCACBD6, MixColors(col.selec, 0, 200));
-
 
172
	if (col.list_bg!=0xFFFfff) {
-
 
173
		Libimg_ReplaceColor(icons16_default.image, icons16_selected.w, icons16_selected.h, 0xffFFFfff, col.list_bg);
-
 
174
		Libimg_ReplaceColor(icons16_default.image, icons16_selected.w, icons16_selected.h, 0xffCACBD6, MixColors(col.list_bg, 0, 200));		
Line 154... Line 175...
154
	Libimg_ReplaceColor(icons16_selected.image, icons16_selected.w, icons16_selected.h, 0xffCACBD6, MixColors(col_selec, 0, 200));
175
	}
155
 
176
 
156
	//-p just show file/folder properties dialog
177
	//-p just show file/folder properties dialog
157
	if (param) && (param[0]=='-') && (param[1]=='p')
178
	if (param) && (param[0]=='-') && (param[1]=='p')
Line 550... Line 571...
550
	}
571
	}
551
}
572
}
Line 552... Line 573...
552
 
573
 
553
void draw_window()
574
void draw_window()
554
{
575
{
555
	int i;
576
	dword i;
556
	if (show_status_bar.checked) status_bar_h = STATUS_BAR_H; else status_bar_h = 0;
577
	if (show_status_bar.checked) status_bar_h = STATUS_BAR_H; else status_bar_h = 0;
557
	DefineAndDrawWindow(Form.left+rand_n,Form.top+rand_n,Form.width,Form.height,0x73,NULL,TITLE,0);
578
	DefineAndDrawWindow(Form.left+rand_n,Form.top+rand_n,Form.width,Form.height,0x73,NULL,TITLE,0);
558
	GetProcessInfo(#Form, SelfInfo);
579
	GetProcessInfo(#Form, SelfInfo);
559
	if (Form.status_window>2) return;
580
	if (Form.status_window>2) return;
560
	if (Form.height < 350) { MoveSize(OLD,OLD,OLD,350); return; }
581
	if (Form.height < 350) { MoveSize(OLD,OLD,OLD,350); return; }
561
	if (!two_panels.checked) && (Form.width < 480) { MoveSize(OLD,OLD,480,OLD); return; }
582
	if (!two_panels.checked) && (Form.width < 480) { MoveSize(OLD,OLD,480,OLD); return; }
562
	if ( two_panels.checked) && (Form.width < 573) { MoveSize(OLD,OLD,573,OLD); return; }
583
	if ( two_panels.checked) && (Form.width < 573) { MoveSize(OLD,OLD,573,OLD); return; }
563
	GetProcessInfo(#Form, SelfInfo);
584
	GetProcessInfo(#Form, SelfInfo);
564
	ESDWORD[#toolbar_pal] = col_work;
585
	ESDWORD[#toolbar_pal] = col.work;
565
	ESDWORD[#toolbar_pal+4] = MixColors(0, col_work, 35);
586
	ESDWORD[#toolbar_pal+4] = MixColors(0, col.work, 35);
566
	PutPaletteImage(#toolbar, 246, 34, 0, 0, 8, #toolbar_pal);
587
	PutPaletteImage(#toolbar, 246, 34, 0, 0, 8, #toolbar_pal);
567
	DrawBar(127, 8, 1, 25, col_graph);
588
	DrawBar(127, 8, 1, 25, col.graph);
568
	for (i=0; i<3; i++) DefineHiddenButton(toolbar_buttons_x[i]+2,7,31-5,29-5,21+i);
589
	for (i=0; i<3; i++) DefineHiddenButton(toolbar_buttons_x[i]+2,7,31-5,29-5,21+i);
569
	for (i=3; i<6; i++) DefineHiddenButton(toolbar_buttons_x[i],  5,31,  29,  21+i);
590
	for (i=3; i<6; i++) DefineHiddenButton(toolbar_buttons_x[i],  5,31,  29,  21+i);
570
	DrawBar(246,0, Form.cwidth - 246, 34, col_work);
591
	DrawBar(246,0, Form.cwidth - 246, 34, col.work);
571
	DrawDot(Form.cwidth-17,12);
592
	DrawDot(Form.cwidth-17,12);
572
	DrawDot(Form.cwidth-17,12+6);
593
	DrawDot(Form.cwidth-17,12+6);
573
	DrawDot(Form.cwidth-17,12+12);
594
	DrawDot(Form.cwidth-17,12+12);
574
	DefineHiddenButton(Form.cwidth-24,7,20,25,51+BT_NOFRAME); //dots
595
	DefineHiddenButton(Form.cwidth-24,7,20,25,51+BT_NOFRAME); //dots
575
	//main rectangles
596
	//main rectangles
576
	DrawRectangle(1,40,Form.cwidth-3,Form.cheight - 42-status_bar_h,col_graph);
597
	DrawRectangle(1,40,Form.cwidth-3,Form.cheight - 42-status_bar_h,col.graph);
577
	DrawRectangle(0,39,Form.cwidth-1,-show_status_bar.checked*status_bar_h + Form.cheight - 40,col_work_gradient[4]); //bg
598
	DrawRectangle(0,39,Form.cwidth-1,-show_status_bar.checked*status_bar_h + Form.cheight - 40,col.work_gradient[4]); //bg
578
	for (i=0; i<5; i++) DrawBar(0, 34+i, Form.cwidth, 1, col_work_gradient[11-i]);
599
	for (i=0; i<5; i++) DrawBar(0, 34+i, Form.cwidth, 1, col.work_gradient[11-i]);
579
	llist_copy(#files_active, #files);
600
	llist_copy(#files_active, #files);
580
	strcpy(#active_path, #path);
601
	strcpy(#active_path, #path);
581
	DrawStatusBar();
602
	DrawStatusBar();
582
	if (selected_count==0) Open_Dir(#path,ONLY_OPEN); //if there are no selected files -> refresh folder [L001] 
603
	if (selected_count==0) Open_Dir(#path,ONLY_OPEN); //if there are no selected files -> refresh folder [L001] 
Line 595... Line 616...
595
	DrawFlatButtonSmall(files.x + files.w,files.y+files.h-16,16,16,0,"\x19");
616
	DrawFlatButtonSmall(files.x + files.w,files.y+files.h-16,16,16,0,"\x19");
596
	if (sort_type==1) sorting_arrow_x = files.w - 141 / 2 + files.x + 18;
617
	if (sort_type==1) sorting_arrow_x = files.w - 141 / 2 + files.x + 18;
597
	if (sort_type==2) sorting_arrow_x = files.x + files.w - 90;
618
	if (sort_type==2) sorting_arrow_x = files.x + files.w - 90;
598
	if (sort_type==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w;
619
	if (sort_type==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w;
599
	WriteText(sorting_arrow_x,files.y-12,0x80, system.color.work_text, sorting_arrow_t);
620
	WriteText(sorting_arrow_x,files.y-12,0x80, system.color.work_text, sorting_arrow_t);
600
	DrawBar(files.x+files.w,files.y,1,files.h,col_graph);
621
	DrawBar(files.x+files.w,files.y,1,files.h,col.graph);
601
	if (two_panels.checked) && (files.x<5) DrawBar(files.x+files.w+16,files.y,1,files.h,col_graph);	
622
	if (two_panels.checked) && (files.x<5) DrawBar(files.x+files.w+16,files.y,1,files.h,col.graph);	
602
}
623
}
Line 603... Line 624...
603
 
624
 
604
void DrawStatusBar()
625
void DrawStatusBar()
605
{
626
{
Line 625... Line 646...
625
	else
646
	else
626
	{
647
	{
627
		SystemDiscs.Get();
648
		SystemDiscs.Get();
628
		llist_copy(#files, #files_inactive);
649
		llist_copy(#files, #files_inactive);
629
		strcpy(#path, #inactive_path);
650
		strcpy(#path, #inactive_path);
630
		col_selec = 0xCCCccc;
651
		col.selec = col.selec_inactive;
631
		SystemDiscs.Draw();
652
		SystemDiscs.Draw();
632
		files_y = files.y;
653
		files_y = files.y;
Line 633... Line 654...
633
 
654
 
634
		if (active_panel==1)
655
		if (active_panel==1)
635
		{
656
		{
636
			llist_copy(#files, #files_inactive);
657
			llist_copy(#files, #files_inactive);
637
			strcpy(#path, #inactive_path);
658
			strcpy(#path, #inactive_path);
638
			col_selec = 0xCCCccc; //this is a bad code: need to use some var to set inactive panel for DrawList();
659
			col.selec = col.selec_inactive; //this is a bad code: need to use some var to set inactive panel for DrawList();
639
			files.SetSizes(Form.cwidth/2, files_y, Form.cwidth/2 -17, Form.cheight-files_y-2 - status_bar_h, files.item_h);
660
			files.SetSizes(Form.cwidth/2, files_y, Form.cwidth/2 -17, Form.cheight-files_y-2 - status_bar_h, files.item_h);
640
			DrawList();
661
			DrawList();
641
			Open_Dir(#path,WITH_REDRAW);
662
			Open_Dir(#path,WITH_REDRAW);
642
			llist_copy(#files, #files_active);
663
			llist_copy(#files, #files_active);
643
			strcpy(#path, #active_path);
664
			strcpy(#path, #active_path);
644
			col_selec = 0x94AECE;
665
			col.selec = col.selec_active;
645
			files.SetSizes(2, files_y, Form.cwidth/2-2-17, Form.cheight-files_y-2 - status_bar_h, files.item_h);
666
			files.SetSizes(2, files_y, Form.cwidth/2-2-17, Form.cheight-files_y-2 - status_bar_h, files.item_h);
646
			DrawList();
667
			DrawList();
647
			Open_Dir(#path,WITH_REDRAW);
668
			Open_Dir(#path,WITH_REDRAW);
648
		}
669
		}
Line 651... Line 672...
651
			files.SetSizes(2, files_y, Form.cwidth/2-2-17, Form.cheight-files_y-2 - status_bar_h, files.item_h);
672
			files.SetSizes(2, files_y, Form.cwidth/2-2-17, Form.cheight-files_y-2 - status_bar_h, files.item_h);
652
			DrawList();
673
			DrawList();
653
			Open_Dir(#path,WITH_REDRAW);
674
			Open_Dir(#path,WITH_REDRAW);
654
			llist_copy(#files, #files_active);
675
			llist_copy(#files, #files_active);
655
			strcpy(#path, #active_path);
676
			strcpy(#path, #active_path);
656
			col_selec = 0x94AECE;
677
			col.selec = col.selec_active;
657
			files.SetSizes(Form.cwidth/2, files_y, Form.cwidth/2 -17, Form.cheight-files_y-2 - status_bar_h, files.item_h);
678
			files.SetSizes(Form.cwidth/2, files_y, Form.cwidth/2 -17, Form.cheight-files_y-2 - status_bar_h, files.item_h);
658
			DrawList();
679
			DrawList();
659
			Open_Dir(#path,WITH_REDRAW);
680
			Open_Dir(#path,WITH_REDRAW);
660
		}
681
		}
661
	}
682
	}
Line 677... Line 698...
677
		list_full_redraw = false;
698
		list_full_redraw = false;
678
		goto _ALL_LIST_REDRAW;
699
		goto _ALL_LIST_REDRAW;
679
	}
700
	}
680
	if (old_cur_y != files.cur_y)
701
	if (old_cur_y != files.cur_y)
681
	{
702
	{
682
		if (old_cur_y-files.first
703
		if (old_cur_y-files.first
683
		Line_ReDraw(col_selec, files.cur_y-files.first);
704
		Line_ReDraw(col.selec, files.cur_y-files.first);
684
		old_cur_y = files.cur_y;
705
		old_cur_y = files.cur_y;
685
		return;
706
		return;
686
	}
707
	}
Line 687... Line 708...
687
 
708
 
Line -... Line 709...
-
 
709
	_ALL_LIST_REDRAW:
688
	_ALL_LIST_REDRAW:
710
 
-
 
711
	for (j=0; j
-
 
712
		if (files.cur_y-files.first!=j) Line_ReDraw(col.list_bg, j); 
689
 
713
		else Line_ReDraw(col.selec, files.cur_y-files.first);		
690
	for (j=0; j
714
	}
691
	//in the bottom
715
	//in the bottom
692
	all_lines_h = j * files.item_h;
716
	all_lines_h = j * files.item_h;
693
	DrawBar(files.x,all_lines_h + files.y,files.w,files.h - all_lines_h,0xFFFFFF);
717
	DrawBar(files.x,all_lines_h + files.y,files.w,files.h - all_lines_h, col.list_bg);
694
	DrawBar(files.x+files.w-141,all_lines_h + files.y,1,files.h - all_lines_h,col_list_line);
718
	DrawBar(files.x+files.w-141,all_lines_h + files.y,1,files.h - all_lines_h,col.list_vert_line);
Line 695... Line 719...
695
	DrawBar(files.x+files.w-68,all_lines_h + files.y,1,files.h - all_lines_h,col_list_line);
719
	DrawBar(files.x+files.w-68,all_lines_h + files.y,1,files.h - all_lines_h,col.list_vert_line);
696
	Scroll();
720
	Scroll();
697
 
721
 
Line 698... Line 722...
698
	if (del_active) Del_Form();
722
	if (del_active) Del_Form();
699
	if (new_element_active) && (col_selec != 0xCCCccc) NewElement_Form(new_element_active, #new_element_name);
723
	if (new_element_active) && (col.selec != 0xCCCccc) NewElement_Form(new_element_active, #new_element_name);
700
}
724
}
Line 715... Line 739...
715
	}
739
	}
716
	return false;
740
	return false;
717
}
741
}
Line 718... Line 742...
718
 
742
 
719
void Line_ReDraw(dword bgcol, filenum){
743
void Line_ReDraw(dword bgcol, filenum){
720
	dword text_col=0,
744
	dword text_col=col.list_gb_text,
721
		  ext1, attr,
745
		  ext1, attr,
722
		  file_offet,
746
		  file_offet,
723
		  file_name_off,
747
		  file_name_off,
724
		  file_size=0,
748
		  file_size=0,
Line 729... Line 753...
729
	char label_file_name[4096];
753
	char label_file_name[4096];
730
	if (filenum==-1) return;
754
	if (filenum==-1) return;
731
	DrawBar(files.x,y,4,files.item_h,bgcol);
755
	DrawBar(files.x,y,4,files.item_h,bgcol);
732
	DrawBar(files.x+4,y,icon_size,icon_y-y,bgcol);
756
	DrawBar(files.x+4,y,icon_size,icon_y-y,bgcol);
733
	if (files.item_h>icon_size) DrawBar(files.x+4,icon_y+icon_size-1,icon_size,y+files.item_h-icon_y-icon_size+1,bgcol);
757
	if (files.item_h>icon_size) DrawBar(files.x+4,icon_y+icon_size-1,icon_size,y+files.item_h-icon_y-icon_size+1,bgcol);
734
	if (colored_lines.checked) && (bgcol!=col_selec) && (filenum%2) bgcol=0xF1F1F1;
758
	if (colored_lines.checked) && (bgcol!=col.selec) && (filenum%2) bgcol=col.odd_line;
735
	DrawBar(files.x+icon_size+4,y,files.w-icon_size-4,files.item_h,bgcol);
759
	DrawBar(files.x+icon_size+4,y,files.w-icon_size-4,files.item_h,bgcol);
Line 736... Line 760...
736
 
760
 
737
	file_offet = file_mas[filenum+files.first]*304 + buf+32;
761
	file_offet = file_mas[filenum+files.first]*304 + buf+32;
738
	attr = ESDWORD[file_offet];
762
	attr = ESDWORD[file_offet];
Line 745... Line 769...
745
	if (! TestBit(attr, 4) ) //file or folder?
769
	if (! TestBit(attr, 4) ) //file or folder?
746
	{	
770
	{	
747
		ext1 = strrchr(file_name_off,'.') + file_name_off;
771
		ext1 = strrchr(file_name_off,'.') + file_name_off;
748
		if (ext1==file_name_off) ext1 = NULL; //if no extension then show nothing
772
		if (ext1==file_name_off) ext1 = NULL; //if no extension then show nothing
749
		file_size = ConvertSize64(file.sizelo, file.sizehi);
773
		file_size = ConvertSize64(file.sizelo, file.sizehi);
750
		if (ext1) && (strlen(ext1)<9) WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, 0, ext1);
774
		if (ext1) && (strlen(ext1)<9) WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, col.list_gb_text, ext1);
751
	}
775
	}
752
	else
776
	else
753
	{
777
	{
754
		if (!strcmp(file_name_off,"..")) ext1=""; else {
778
		if (!strcmp(file_name_off,"..")) ext1=""; else {
755
			ext1="";
779
			ext1="";
756
			WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, 0, ext1);
780
			WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, col.list_gb_text, ext1);
757
		}
781
		}
758
		if (chrnum(#path, '/')==1) file_size = GetDeviceSizeLabel(#temp_path);
782
		if (chrnum(#path, '/')==1) file_size = GetDeviceSizeLabel(#temp_path);
759
	}
783
	}
760
	if (file_size) WriteText(7-strlen(file_size)*6+files.x+files.w-58, 
784
	if (file_size) WriteText(7-strlen(file_size)*6+files.x+files.w-58, 
761
			files.text_y+y+1, files.font_type, 0, file_size);
785
			files.text_y+y+1, files.font_type, col.list_gb_text, file_size);
762
	DrawIconByExtension(#temp_path, ext1, files.x+4, icon_y, bgcol);
786
	DrawIconByExtension(#temp_path, ext1, files.x+4, icon_y, bgcol);
Line 763... Line 787...
763
 
787
 
764
	if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=0xA6A6B7; //system or hiden?
788
	if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=col.list_text_hidden; //system or hiden?
765
	if (bgcol==col_selec)
789
	if (bgcol==col.selec)
766
	{
790
	{
767
		file_name_is_8_3(file_name_off);
791
		file_name_is_8_3(file_name_off);
768
		itdir = TestBit(attr, 4);
792
		itdir = TestBit(attr, 4);
769
		strcpy(#file_name, file_name_off);
793
		strcpy(#file_name, file_name_off);
770
		if (!strcmp(#path,"/")) sprintf(#file_path,"%s%s",#path,file_name_off);
794
		if (!strcmp(#path,"/")) sprintf(#file_path,"%s%s",#path,file_name_off);
771
			else sprintf(#file_path,"%s/%s",#path,file_name_off);
795
			else sprintf(#file_path,"%s/%s",#path,file_name_off);
-
 
796
		if (text_col==col.list_text_hidden) {
-
 
797
			text_col=MixColors(col.selec_text, col.list_text_hidden, 65); 
772
		if (text_col==0xA6A6B7) text_col=0xFFFFFF;
798
		} else text_col=col.selec_text;
773
	}
799
	}
774
	if (file.selected) text_col=0xFF0000;
800
	if (file.selected) text_col=0xFF0000;
775
	if (kfont.size.pt==9) || (!kfont.font)
801
	if (kfont.size.pt==9) || (!kfont.font)
776
	{
802
	{
Line 793... Line 819...
793
			while (kfont.getsize(kfont.size.pt, #label_file_name) + 141 + 26 > files.w) {
819
			while (kfont.getsize(kfont.size.pt, #label_file_name) + 141 + 26 > files.w) {
794
				ESBYTE[#label_file_name+strlen(#label_file_name)-1] = NULL;
820
				ESBYTE[#label_file_name+strlen(#label_file_name)-1] = NULL;
795
			}
821
			}
796
			strcpy(#label_file_name+strlen(#label_file_name)-2, "...");			
822
			strcpy(#label_file_name+strlen(#label_file_name)-2, "...");			
797
		}
823
		}
798
		kfont.WriteIntoWindow(files.x + icon_size+7, files.item_h - kfont.height / 2 + y, bgcol, text_col, kfont.size.pt, #label_file_name);
824
		kfont.WriteIntoWindow(files.x + icon_size+7, files.item_h - kfont.height / 2 + y, 
-
 
825
			bgcol, text_col, kfont.size.pt, #label_file_name);
799
	}
826
	}
800
	DrawBar(files.x+files.w-141,y,1,files.item_h,col_list_line); //gray line 1
827
	DrawBar(files.x+files.w-141,y,1,files.item_h,col.list_vert_line); //gray line 1
801
	DrawBar(files.x+files.w-68,y,1,files.item_h,col_list_line); //gray line 2
828
	DrawBar(files.x+files.w-68,y,1,files.item_h,col.list_vert_line); //gray line 2
802
}
829
}
Line 803... Line 830...
803
 
830
 
804
 
831