Subversion Repositories Kolibri OS

Rev

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

Rev 5814 Rev 5825
Line 191... Line 191...
191
					//select/open file {
191
					//select/open file {
192
					if (mouse.key&MOUSE_LEFT)&&((mouse.down)||(mouse.dblclick))
192
					if (mouse.key&MOUSE_LEFT)&&((mouse.down)||(mouse.dblclick))
193
					{
193
					{
194
						if (mouse.y>=files.y)//&&(mouse.click)
194
						if (mouse.y>=files.y)//&&(mouse.click)
195
						{
195
						{
196
							id = mouse.y - files.y / files.line_h + files.first;
196
							id = mouse.y - files.y / files.item_h + files.first;
197
							if (files.current!=id)
197
							if (files.cur_y!=id)
198
							{
198
							{
199
								mouse.clearTime();
199
								mouse.clearTime();
200
								if(!mouse.up)&&(id-files.first
200
								if(!mouse.up)&&(id-files.first
201
									files.current = id;
201
									files.cur_y = id;
202
									List_ReDraw();
202
									List_ReDraw();
203
								}
203
								}
204
							}
204
							}
205
							else IF(mouse.dblclick)Open(0);
205
							else IF(mouse.dblclick)Open(0);
206
						}
206
						}
Line 212... Line 212...
212
					{
212
					{
213
						menu_call_mouse = 1;
213
						menu_call_mouse = 1;
Line 214... Line 214...
214
						
214
						
215
						if (files.MouseOver(mouse.x, mouse.y))
215
						if (files.MouseOver(mouse.x, mouse.y))
216
						{
216
						{
217
							files.current = mouse.y - files.y / files.line_h + files.first;
217
							files.cur_y = mouse.y - files.y / files.item_h + files.first;
218
							List_ReDraw();
218
							List_ReDraw();
219
							menu_stak = malloc(4096);
219
							menu_stak = malloc(4096);
220
							CreateThread(#FileMenu,menu_stak+4092);	
220
							CreateThread(#FileMenu,menu_stak+4092);	
221
						}
221
						}
Line 455... Line 455...
455
								break;
455
								break;
456
						case SCAN_CODE_DEL:
456
						case SCAN_CODE_DEL:
457
								Del_Form();
457
								Del_Form();
458
								break;
458
								break;
459
						case SCAN_CODE_INS:
459
						case SCAN_CODE_INS:
460
								selected_offset = file_mas[files.current]*304 + buf+32 + 7;
460
								selected_offset = file_mas[files.cur_y]*304 + buf+32 + 7;
461
								if (files.current==0) && (!strncmp(selected_offset+33, "..", 2)) goto _INSERT_END; //do not selec ".." directory
461
								if (files.cur_y==0) && (!strncmp(selected_offset+33, "..", 2)) goto _INSERT_END; //do not selec ".." directory
462
								if (ESBYTE[selected_offset])
462
								if (ESBYTE[selected_offset])
463
								{
463
								{
464
									ESBYTE[selected_offset]=0;
464
									ESBYTE[selected_offset]=0;
465
									selected_count--;
465
									selected_count--;
466
								}
466
								}
Line 474... Line 474...
474
								break;
474
								break;
475
						case 059...068: //F1-F10
475
						case 059...068: //F1-F10
476
								FnProcess(key_scancode-58);
476
								FnProcess(key_scancode-58);
477
								break; 
477
								break; 
478
						default:    
478
						default:    
479
								for (i=files.current+1; i
479
								for (i=files.cur_y+1; i
480
								{
480
								{
481
									strcpy(#temp, file_mas[i]*304+buf+72);
481
									strcpy(#temp, file_mas[i]*304+buf+72);
482
									if (temp[0]==key_ascii) || (temp[0]==key_ascii-32)
482
									if (temp[0]==key_ascii) || (temp[0]==key_ascii-32)
483
									{
483
									{
484
										files.current = i - 1;
484
										files.cur_y = i - 1;
485
										files.KeyDown();
485
										files.KeyDown();
486
										List_ReDraw();
486
										List_ReDraw();
487
										break;
487
										break;
488
									}
488
									}
489
								}
489
								}
Line 573... Line 573...
573
void DrawFilePanels()
573
void DrawFilePanels()
574
{
574
{
575
	if (!two_panels)
575
	if (!two_panels)
576
	{
576
	{
577
		DrawDeviceAndActionsLeftPanel();
577
		DrawDeviceAndActionsLeftPanel();
578
		files.SetSizes(192, 57, Form.cwidth - 210, Form.cheight - 59, files.line_h);
578
		files.SetSizes(192, 57, Form.cwidth - 210, Form.cheight - 59, files.item_h);
579
		DrawList();
579
		DrawList();
580
		Open_Dir(#path,ONLY_SHOW);
580
		Open_Dir(#path,ONLY_SHOW);
581
	}
581
	}
582
	else
582
	else
583
	{
583
	{
Line 588... Line 588...
588
		if (active_panel==1)
588
		if (active_panel==1)
589
		{
589
		{
590
			llist_copy(#files, #files_inactive);
590
			llist_copy(#files, #files_inactive);
591
			strcpy(#path, #inactive_path);
591
			strcpy(#path, #inactive_path);
592
			col_selec = 0xCCCccc;
592
			col_selec = 0xCCCccc;
593
			files.SetSizes(Form.cwidth/2, 57+22, Form.cwidth/2 -17, Form.cheight-59-22, files.line_h);
593
			files.SetSizes(Form.cwidth/2, 57+22, Form.cwidth/2 -17, Form.cheight-59-22, files.item_h);
594
			DrawList();
594
			DrawList();
595
			Open_Dir(#path,WITH_REDRAW);
595
			Open_Dir(#path,WITH_REDRAW);
596
			llist_copy(#files, #files_active);
596
			llist_copy(#files, #files_active);
597
			strcpy(#path, #active_path);
597
			strcpy(#path, #active_path);
598
			col_selec = 0x94AECE;
598
			col_selec = 0x94AECE;
599
			files.SetSizes(2, 57+22, Form.cwidth/2-2-17, Form.cheight-59-22, files.line_h);
599
			files.SetSizes(2, 57+22, Form.cwidth/2-2-17, Form.cheight-59-22, files.item_h);
600
			DrawList();
600
			DrawList();
601
			Open_Dir(#path,WITH_REDRAW);
601
			Open_Dir(#path,WITH_REDRAW);
602
		}
602
		}
603
		if (active_panel==2)
603
		if (active_panel==2)
604
		{
604
		{
605
			files.SetSizes(2, 57+22, Form.cwidth/2-2-17, Form.cheight-59-22, files.line_h);
605
			files.SetSizes(2, 57+22, Form.cwidth/2-2-17, Form.cheight-59-22, files.item_h);
606
			DrawList();
606
			DrawList();
607
			Open_Dir(#path,WITH_REDRAW);
607
			Open_Dir(#path,WITH_REDRAW);
608
			llist_copy(#files, #files_active);
608
			llist_copy(#files, #files_active);
609
			strcpy(#path, #active_path);
609
			strcpy(#path, #active_path);
610
			col_selec = 0x94AECE;
610
			col_selec = 0x94AECE;
611
			files.SetSizes(Form.cwidth/2, 57+22, Form.cwidth/2 -17, Form.cheight-59-22, files.line_h);
611
			files.SetSizes(Form.cwidth/2, 57+22, Form.cwidth/2 -17, Form.cheight-59-22, files.item_h);
612
			DrawList();
612
			DrawList();
613
			Open_Dir(#path,WITH_REDRAW);
613
			Open_Dir(#path,WITH_REDRAW);
614
		}
614
		}
615
	}
615
	}
616
}
616
}
Line 617... Line 617...
617
 
617
 
618
 
618
 
619
void List_ReDraw()
619
void List_ReDraw()
620
{
620
{
Line 621... Line 621...
621
	int all_lines_h;
621
	int all_lines_h;
Line 622... Line 622...
622
	static int old_current, old_first;
622
	static int old_cur_y, old_first;
623
 
623
 
624
	files.CheckDoesValuesOkey(); //prevent some shit
624
	files.CheckDoesValuesOkey(); //prevent some shit
625
 
625
 
626
	if (list_full_redraw) || (old_first != files.first)
626
	if (list_full_redraw) || (old_first != files.first)
627
	{
627
	{
628
		old_current = files.current;
628
		old_cur_y = files.cur_y;
629
		old_first = files.first;
629
		old_first = files.first;
630
		list_full_redraw = false;
630
		list_full_redraw = false;
631
		goto _ALL_LIST_REDRAW;
631
		goto _ALL_LIST_REDRAW;
632
	}
632
	}
633
	if (old_current != files.current)
633
	if (old_cur_y != files.cur_y)
634
	{
634
	{
635
		if (old_current-files.first
635
		if (old_cur_y-files.first
Line 636... Line 636...
636
		Line_ReDraw(col_selec, files.current-files.first);
636
		Line_ReDraw(col_selec, files.cur_y-files.first);
Line 637... Line 637...
637
		old_current = files.current;
637
		old_cur_y = files.cur_y;
638
		return;
638
		return;
639
	}
639
	}
640
 
640
 
641
	_ALL_LIST_REDRAW:
641
	_ALL_LIST_REDRAW:
642
 
642
 
643
	for (j=0; j
643
	for (j=0; j
644
	//in the bottom
644
	//in the bottom
Line 653... Line 653...
653
void Line_ReDraw(dword bgcol, filenum){
653
void Line_ReDraw(dword bgcol, filenum){
654
	dword text_col=0,
654
	dword text_col=0,
655
	      ext1, attr,
655
	      ext1, attr,
656
	      file_offet,
656
	      file_offet,
657
	      file_name_off,
657
	      file_name_off,
658
	      y=filenum*files.line_h+files.y;
658
	      y=filenum*files.item_h+files.y;
659
	      BDVK file;
659
	      BDVK file;
660
	if (filenum==-1) return;
660
	if (filenum==-1) return;
661
	DrawBar(files.x,y,3,files.line_h,bgcol); 
661
	DrawBar(files.x,y,3,files.item_h,bgcol); 
662
	DrawBar(files.x+19,y,files.w-19,files.line_h,bgcol);
662
	DrawBar(files.x+19,y,files.w-19,files.item_h,bgcol);
663
	DrawBar(files.x+3,y+17,16,1,bgcol);
663
	DrawBar(files.x+3,y+17,16,1,bgcol);
664
	if (files.line_h>18) DrawBar(files.x+3,y+18,16,files.line_h-18,bgcol);
664
	if (files.item_h>18) DrawBar(files.x+3,y+18,16,files.item_h-18,bgcol);
665
	if (files.line_h>15) DrawBar(files.x+3,y,16,files.line_h-15,bgcol); 
665
	if (files.item_h>15) DrawBar(files.x+3,y,16,files.item_h-15,bgcol); 
Line 666... Line 666...
666
 
666
 
667
	file_offet = file_mas[filenum+files.first]*304 + buf+32;
667
	file_offet = file_mas[filenum+files.first]*304 + buf+32;
668
	attr = ESDWORD[file_offet];
668
	attr = ESDWORD[file_offet];
669
	file.selected = ESBYTE[file_offet+7];
669
	file.selected = ESBYTE[file_offet+7];
Line 672... Line 672...
672
 
672
 
673
	if (! TestBit(attr, 4) ) //file or folder?
673
	if (! TestBit(attr, 4) ) //file or folder?
674
	{	
674
	{	
675
		ext1 = strrchr(file_name_off,'.') + file_name_off;
675
		ext1 = strrchr(file_name_off,'.') + file_name_off;
676
		if (ext1==file_name_off) ext1 = " \0"; //if no extension then show nothing 
676
		if (ext1==file_name_off) ext1 = " \0"; //if no extension then show nothing 
677
		Put_icon(ext1, files.x+3, files.line_h/2-7+y, bgcol, 0);
677
		Put_icon(ext1, files.x+3, files.item_h/2-7+y, bgcol, 0);
678
		WriteText(7-strlen(ConvertSize(file.sizelo))*6+files.x+files.w - 58, files.text_y + y +1,files.font_type,0,ConvertSize(file.sizelo));
678
		WriteText(7-strlen(ConvertSize(file.sizelo))*6+files.x+files.w - 58, files.text_y + y +1,files.font_type,0,ConvertSize(file.sizelo));
679
	}
679
	}
680
	else
680
	else
681
	{
681
	{
682
		if (!strncmp(file_name_off,"..",3)) ext1=".."; else ext1="";
682
		if (!strncmp(file_name_off,"..",3)) ext1=".."; else ext1="";
683
		Put_icon(ext1, files.x+3, files.line_h/2-7+y, bgcol, 0);		
683
		Put_icon(ext1, files.x+3, files.item_h/2-7+y, bgcol, 0);		
Line 684... Line 684...
684
	}
684
	}
685
 
685
 
686
	if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=0xA6A6B7; //system or hiden?
686
	if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=0xA6A6B7; //system or hiden?
Line 706... Line 706...
706
		}		
706
		}		
707
	}
707
	}
708
	else
708
	else
709
	{
709
	{
710
		font.bg_color = bgcol;
710
		font.bg_color = bgcol;
711
		font.prepare(files.x + 23, files.line_h - font.height / 2 + y, file_name_off);
711
		font.prepare(files.x + 23, files.item_h - font.height / 2 + y, file_name_off);
712
		font.show();
712
		font.show();
713
	}
713
	}
714
	DrawBar(files.x+files.w-141,y,1,files.line_h,system.color.work); //gray line 1
714
	DrawBar(files.x+files.w-141,y,1,files.item_h,system.color.work); //gray line 1
715
	DrawBar(files.x+files.w-68,y,1,files.line_h,system.color.work); //gray line 2
715
	DrawBar(files.x+files.w-68,y,1,files.item_h,system.color.work); //gray line 2
716
}
716
}
Line 717... Line 717...
717
 
717
 
718
 
718
 
Line 732... Line 732...
732
			Write_Error(errornum);
732
			Write_Error(errornum);
733
			return;
733
			return;
734
		}
734
		}
735
		maxcount = sizeof(file_mas)/sizeof(dword)-1;
735
		maxcount = sizeof(file_mas)/sizeof(dword)-1;
736
		if (files.count>maxcount) files.count = maxcount;
736
		if (files.count>maxcount) files.count = maxcount;
737
		if (files.count>0) && (files.current-files.first==-1) files.current=0;
737
		if (files.count>0) && (files.cur_y-files.first==-1) files.cur_y=0;
738
	}
738
	}
739
	if (files.count!=-1)
739
	if (files.count!=-1)
740
	{
740
	{
741
		if(!_not_draw)
741
		if(!_not_draw)
742
		{
742
		{
Line 744... Line 744...
744
			DrawBar(PathShow.start_x-3, PathShow.start_y-4, PathShow.area_size_x+2, 15, 0xFFFfff);
744
			DrawBar(PathShow.start_x-3, PathShow.start_y-4, PathShow.area_size_x+2, 15, 0xFFFfff);
745
			PathShow_prepare stdcall(#PathShow);
745
			PathShow_prepare stdcall(#PathShow);
746
			PathShow_draw stdcall(#PathShow);
746
			PathShow_draw stdcall(#PathShow);
747
		}
747
		}
748
		HistoryPath(ADD_NEW_PATH);
748
		HistoryPath(ADD_NEW_PATH);
749
		files.visible = files.h / files.line_h;
749
		files.visible = files.h / files.item_h;
750
		if (files.count < files.visible) files.visible = files.count;
750
		if (files.count < files.visible) files.visible = files.count;
751
		if (redraw!=ONLY_SHOW) Sorting();
751
		if (redraw!=ONLY_SHOW) Sorting();
752
		list_full_redraw = true;
752
		list_full_redraw = true;
753
		if (redraw!=ONLY_OPEN)&&(!_not_draw) List_ReDraw();
753
		if (redraw!=ONLY_OPEN)&&(!_not_draw) List_ReDraw();
754
		DrawSystemDiscs();
754
		DrawSystemDiscs();
Line 941... Line 941...
941
	int ind;
941
	int ind;
942
	files.KeyHome();
942
	files.KeyHome();
943
   	Open_Dir(#path,ONLY_OPEN);
943
   	Open_Dir(#path,ONLY_OPEN);
944
	if (!real_files_names_case) strttl(that_file);
944
	if (!real_files_names_case) strttl(that_file);
945
	for (ind=files.count-1; ind>=0; ind--;) { if (!strcmp(file_mas[ind]*304+buf+72,that_file)) break; }
945
	for (ind=files.count-1; ind>=0; ind--;) { if (!strcmp(file_mas[ind]*304+buf+72,that_file)) break; }
946
	files.current = ind - 1;
946
	files.cur_y = ind - 1;
947
	files.KeyDown();
947
	files.KeyDown();
948
	List_ReDraw();
948
	List_ReDraw();
949
}
949
}
Line 981... Line 981...
981
	else
981
	else
982
	{
982
	{
983
		if (!strncmp(#file_name,"..",3)) { Dir_Up(); return; }
983
		if (!strncmp(#file_name,"..",3)) { Dir_Up(); return; }
984
		strcpy(#path, #file_path);
984
		strcpy(#path, #file_path);
985
		if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //need "/" in the end
985
		if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //need "/" in the end
986
		files.first=files.current=0;
986
		files.first=files.cur_y=0;
987
		Open_Dir(#path,WITH_REDRAW);
987
		Open_Dir(#path,WITH_REDRAW);
988
	}
988
	}
989
}
989
}