forked from KolibriOS/kolibrios
Eolite 1.77: RMB menu, list_box element used, fixed crash when changing size (reported by 0CodErr), a lot of other improvements
git-svn-id: svn://kolibrios.org@3434 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
e7fb8b345e
commit
ce5a4a5f1a
@ -2,7 +2,6 @@
|
||||
//GNU GPL licence.
|
||||
|
||||
//êîïèðîâàòü ÷åðåç ïîòîê
|
||||
//èêîíêà äåéñòâèòåëüíî íóæíà äðóãàÿ äëÿ íåèçâåñíûõ óñòðîéñòâ è ïàïîê â áóäóþùåì.
|
||||
|
||||
//libraries
|
||||
#define MEMSIZE 0xA0000
|
||||
@ -14,79 +13,57 @@
|
||||
#include "..\lib\file_system.h"
|
||||
#include "..\lib\figures.h"
|
||||
#include "..\lib\encoding.h"
|
||||
#include "..\lib\list_box.h"
|
||||
#include "..\lib\copyf.h"
|
||||
//images
|
||||
#include "imgs\toolbar.txt"
|
||||
#include "imgs\left_p.txt"
|
||||
|
||||
int BUTTON_HEIGHT=18;
|
||||
|
||||
//for OpenDir
|
||||
#define ONLY_SHOW 0
|
||||
#define WITH_REDRAW 1
|
||||
#define ONLY_OPEN 2
|
||||
|
||||
//ïåðåìåííûå
|
||||
#define TITLE "Eolite File Manager v1.65"
|
||||
#define ABOUT_TITLE "Eolite v1.65"
|
||||
#define TITLE "Eolite File Manager v1.77"
|
||||
#define ABOUT_TITLE "Eolite v1.77"
|
||||
dword col_work = 0xE4DFE1;
|
||||
dword col_border = 0x819FC5;
|
||||
dword col_padding = 0xC8C9C9;
|
||||
dword col_selec = 0x94AECE;
|
||||
dword col_lpanel = 0x00699C;
|
||||
|
||||
int toolbar_buttons_x[7]={9,46,85,134,167,203};
|
||||
char tmp_disk_del_param[3]="d0";
|
||||
struct path_string { char Item[4096]; };
|
||||
|
||||
int f_visible,
|
||||
count,
|
||||
za_kadrom,
|
||||
curbtn;
|
||||
|
||||
|
||||
byte cut_active,
|
||||
rename_active,
|
||||
del_active;
|
||||
byte show_actions=1,
|
||||
show_dev_name=1,
|
||||
sort_num=2,
|
||||
isdir;
|
||||
unsigned char
|
||||
llist files;
|
||||
|
||||
byte
|
||||
path[4096],
|
||||
edit_path[4096],
|
||||
file_path[4096],
|
||||
file_name[256],
|
||||
copy_file[4096],
|
||||
temp[4096];
|
||||
int scroll_size;
|
||||
|
||||
struct path_string {
|
||||
char Item[4096];
|
||||
};
|
||||
|
||||
int toolbar_buttons_x[7]={9,46,85,134,167,203};
|
||||
char tmp_disk_del_param[3]="d0";
|
||||
|
||||
dword file_mas[6898];
|
||||
int j, i, mouse_dd;
|
||||
int scroll_used;
|
||||
temp[4096];
|
||||
byte
|
||||
cut_active,
|
||||
rename_active,
|
||||
del_active;
|
||||
byte
|
||||
show_dev_name=1,
|
||||
sort_num=2,
|
||||
isdir;
|
||||
|
||||
proc_info Form;
|
||||
mouse m;
|
||||
dword buf, off; //äëÿ òåêñòà è áóôåðà
|
||||
int mouse_dd, scroll_used, scroll_size;
|
||||
dword buf, off;
|
||||
dword file_mas[6898];
|
||||
int j, i;
|
||||
|
||||
edit_box edit2= {250,213,80,0xFFFFCC,0x94AECE,0xFFFFCC,0xffffff,0,248,#file_name,#mouse_dd,64,6,6};
|
||||
PathShow_data PathShow = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, #path, #edit_path, 0};
|
||||
PathShow_data PathShow = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, #path, #temp, 0};
|
||||
PathShow_data FileShow = {0, 56,215, 6, 100, 0, 0, 0x0, 0xFFFfff, #file_name, #temp, 0};
|
||||
|
||||
inline fastcall signed int _strrchr( ESI,BL)
|
||||
{
|
||||
int jj=0, last=strlen(ESI);
|
||||
do{
|
||||
jj++;
|
||||
$lodsb
|
||||
IF(AL==BL) last=jj;
|
||||
} while(AL!=0);
|
||||
return last;
|
||||
}
|
||||
|
||||
#include "include\some_code.h"
|
||||
#include "include\about_dialog.h"
|
||||
#include "include\sorting.h"
|
||||
@ -94,52 +71,83 @@ inline fastcall signed int _strrchr( ESI,BL)
|
||||
#include "include\ini.h"
|
||||
#include "include\left_panel.h"
|
||||
#include "include\history.h"
|
||||
#include "include\file_menu.h"
|
||||
|
||||
void main()
|
||||
{
|
||||
word key, id, can_show;
|
||||
int min_win_h;
|
||||
word key, id, can_show, can_select;
|
||||
|
||||
files.line_h=18;
|
||||
mem_Init();
|
||||
if (load_dll2(boxlib, #box_lib_init,0)!=0) notify("Error while loading library /rd/1/lib/box_lib.obj");
|
||||
GetSystemDiscs();
|
||||
SystemDiscsGet();
|
||||
GetIni(1);
|
||||
if (param)
|
||||
{
|
||||
strcpy(#path, #param);
|
||||
if (strcmp(#path+strlen(#path)-1,"/")<>0) strcat(#path, "/"); //åñëè íåò, + "/"
|
||||
if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //add "/" to the end of the string
|
||||
}
|
||||
else
|
||||
strcpy(#path, "/rd/1/");
|
||||
Open_Dir(#path,ONLY_OPEN);
|
||||
SetEventMask(0x27);
|
||||
loop() switch(WaitEvent())
|
||||
loop() switch(WaitEvent())
|
||||
{
|
||||
case evMouse:
|
||||
IF (del_active) break;
|
||||
|
||||
IF (del_active) break;
|
||||
id=GetProcessSlot(Form.ID);
|
||||
IF (id<>GetActiveProcess()) break; //åñëè îêíî íå àêòèâíî íà ñîáûòèÿ ìûøè íå ðåàãèðóåì
|
||||
|
||||
IF (rename_active) edit_box_mouse stdcall(#edit2);
|
||||
IF (id<>GetActiveProcess()) || (Form.status_window>2) break;
|
||||
IF (rename_active) { edit_box_mouse stdcall(#edit2); break; }
|
||||
|
||||
m.get();
|
||||
|
||||
/*if (m.pkm) && (m.x > 192) && (m.y > 57) can_show = 1;
|
||||
if (!m.pkm) && (can_show)
|
||||
if (m.x > files.x) && (m.x < files.x + files.w) && (m.y > files.y) && (m.y < files.y+files.h)
|
||||
{
|
||||
if (m.lkm) can_select = 1;
|
||||
if (m.pkm)
|
||||
{
|
||||
can_show = 1;
|
||||
if (m.y - 57 / files.line_h != files.current) can_select = 1;
|
||||
}
|
||||
}
|
||||
|
||||
//select/open file {
|
||||
if (!m.lkm) && (!m.pkm) && (can_select)
|
||||
{
|
||||
can_select = 0;
|
||||
if (m.y<57) break;
|
||||
id = m.y - 57 / files.line_h;
|
||||
if (files.current!=id) FileList_ReDraw(id-files.current);
|
||||
else Open();
|
||||
};
|
||||
// } select/open file
|
||||
|
||||
//file menu {
|
||||
if (!m.pkm) && (!m.lkm) && (can_show)
|
||||
{
|
||||
can_show = 0;
|
||||
if (m.y<57) break;
|
||||
SwitchToAnotherThread();
|
||||
CreateThread(#FileMenu,#stak2);
|
||||
can_show = 0;
|
||||
}*/
|
||||
break;
|
||||
}
|
||||
// } file menu
|
||||
|
||||
|
||||
if (m.vert)
|
||||
{
|
||||
files.MouseScroll(m.vert);
|
||||
List_ReDraw();
|
||||
break;
|
||||
}
|
||||
|
||||
if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>40) && (m.y<57)
|
||||
{
|
||||
IF (m.lkm==1) DrawRectangle3D(onLeft(26,0),41,14,14,0xC7C7C7,0xFFFFFF);
|
||||
WHILE (m.lkm==1) && (za_kadrom>0)
|
||||
WHILE (m.lkm==1) && (files.first>0)
|
||||
{
|
||||
pause(10);
|
||||
za_kadrom--;
|
||||
pause(8);
|
||||
files.first--;
|
||||
List_ReDraw();
|
||||
m.get();
|
||||
}
|
||||
@ -149,48 +157,29 @@ void main()
|
||||
if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>onTop(22,0)+1) && (m.y<onTop(22,0)+16)
|
||||
{
|
||||
IF (m.lkm==1) DrawRectangle3D(onLeft(26,0),onTop(21,0),14,14,0xC7C7C7,0xFFFFFF);
|
||||
while (m.lkm==1) && (za_kadrom<count-f_visible)
|
||||
while (m.lkm==1) && (files.first<files.count-files.visible)
|
||||
{
|
||||
pause(10);
|
||||
za_kadrom++;
|
||||
pause(8);
|
||||
files.first++;
|
||||
List_ReDraw();
|
||||
m.get();
|
||||
}
|
||||
DrawRectangle3D(onLeft(26,0),onTop(21,0),14,14,0xFFFFFF,0xC7C7C7);
|
||||
}
|
||||
|
||||
//êîë¸ñèêî ìûøè
|
||||
IF (m.vert==65535) && (za_kadrom>0)
|
||||
{
|
||||
if (za_kadrom>0) za_kadrom--;
|
||||
if (curbtn<f_visible-1) curbtn++;
|
||||
List_ReDraw();
|
||||
if (za_kadrom>0) za_kadrom--;
|
||||
if (curbtn<f_visible-1) curbtn++;
|
||||
List_ReDraw();
|
||||
}
|
||||
IF (m.vert==1) && (za_kadrom<count-f_visible)
|
||||
{
|
||||
if (za_kadrom<count-f_visible) za_kadrom++;
|
||||
if (curbtn>0) curbtn--;
|
||||
List_ReDraw();
|
||||
if (za_kadrom<count-f_visible) za_kadrom++;
|
||||
if (curbtn>0) curbtn--;
|
||||
List_ReDraw();
|
||||
}
|
||||
//ñêðîëë
|
||||
if (!m.lkm) && (scroll_used) { scroll_used=NULL; TVScroll(); }
|
||||
if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>56) && (m.y<Form.height) && (m.lkm) && (!scroll_used) {scroll_used=1;TVScroll();}
|
||||
//Scrooll
|
||||
if (!m.lkm) && (scroll_used) { scroll_used=NULL; Scroll(); }
|
||||
if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>56) && (m.y<Form.height) && (m.lkm) && (!scroll_used) {scroll_used=1;Scroll();}
|
||||
|
||||
if (scroll_used)
|
||||
{
|
||||
IF (scroll_size/2+57>m.y) || (m.y<0) || (m.y>4000) m.y=scroll_size/2+57; //åñëè êóðñîð íàä îêíîì
|
||||
id=za_kadrom; //ñîõðàíÿåì ñòàðîå êîëè÷åñòâî
|
||||
IF (scroll_size/2+57>m.y) || (m.y<0) || (m.y>4000) m.y=scroll_size/2+57; //anee eo?ni? iaa ieiii
|
||||
id=files.first;
|
||||
j= scroll_size/2;
|
||||
za_kadrom = m.y -j -57 * count;
|
||||
za_kadrom /= onTop(22,57);
|
||||
IF (f_visible+za_kadrom>count) za_kadrom=count-f_visible;
|
||||
IF (id<>za_kadrom) List_ReDraw(); //÷òîá ëèøíèé ðàç íå ïåðåðèñîâûâàòü
|
||||
files.first = m.y -j -57 * files.count;
|
||||
files.first /= onTop(22,57);
|
||||
IF (files.visible+files.first>files.count) files.first=files.count-files.visible;
|
||||
IF (id<>files.first) List_ReDraw();
|
||||
}
|
||||
break;
|
||||
//Button pressed-----------------------------------------------------------------------------
|
||||
@ -211,7 +200,7 @@ void main()
|
||||
case 22: //Forward
|
||||
if (HistoryPath(GO_FORWARD))
|
||||
{
|
||||
za_kadrom=curbtn=NULL; //ââåðõ ñïèñêà
|
||||
files.first=files.current=NULL; //aaa?o nienea
|
||||
Open_Dir(#path,WITH_REDRAW);
|
||||
}
|
||||
break;
|
||||
@ -230,49 +219,24 @@ void main()
|
||||
IF(sort_num==2) DrawFilledBar(onLeft(115,0),42,6,10);
|
||||
IF(sort_num==3) DrawFilledBar(onLeft(44,0),42,6,10);
|
||||
sort_num=id-30;
|
||||
Open_Dir(#path,1);
|
||||
break;
|
||||
case 30: //about
|
||||
SwitchToAnotherThread();
|
||||
CreateThread(#about_dialog,#stak1);
|
||||
break;
|
||||
case 77:
|
||||
IF (show_actions==1) show_actions=0; ELSE show_actions=1;
|
||||
DrawLeftPanel();
|
||||
Open_Dir(#path,WITH_REDRAW);
|
||||
break;
|
||||
case 78: //rescan devices
|
||||
Tip(56, "Devices", 78, "-");
|
||||
pause(10);
|
||||
GetIni(1);
|
||||
GetSystemDiscs();
|
||||
SystemDiscsGet();
|
||||
Open_Dir(#path,WITH_REDRAW);
|
||||
DrawLeftPanel();
|
||||
break;
|
||||
case 80: //rename
|
||||
goto REN_MARK;
|
||||
case 81: //Delete file
|
||||
Del_Form();
|
||||
break;
|
||||
case 82: //create folder
|
||||
NEW_FOLDER_MARK:
|
||||
strcpy(#temp, #path);
|
||||
strcat(#temp, "New folder");
|
||||
CreateDir(#temp);
|
||||
IF (!EAX){
|
||||
SelectFile("New folder");
|
||||
goto REN_MARK;
|
||||
}
|
||||
ELSE
|
||||
{
|
||||
Write_Error(EAX);
|
||||
ShowMessage("Folder can not be created.");
|
||||
}
|
||||
case 50...60: //Actions
|
||||
ActionsProcess(id-50);
|
||||
break;
|
||||
case 100...120:
|
||||
DEVICE_MARK:
|
||||
DrawRectangle3D(17,id-100*16+74,159,16, 0, 0); //âûäåëåíèå
|
||||
DrawRectangle3D(17,id-100*16+74,159,16, 0, 0); //auaaeaiea
|
||||
strcpy(#path, #disk_list[id-100].Item);
|
||||
za_kadrom=curbtn=0;
|
||||
files.first=files.current=0;
|
||||
Open_Dir(#path,1);
|
||||
pause(5);
|
||||
DrawRectangle3D(17,id-100*16+74,159,16, 0xFFFFFF, 0xFFFFFF);
|
||||
@ -281,30 +245,10 @@ void main()
|
||||
tmp_disk_del_param[1]=disk_list[id-130].Item[4];
|
||||
RunProgram("/sys/tmpdisk", #tmp_disk_del_param);
|
||||
pause(10);
|
||||
GetSystemDiscs();
|
||||
SystemDiscsGet();
|
||||
Open_Dir(#path,WITH_REDRAW);
|
||||
DrawLeftPanel();
|
||||
break;
|
||||
default:
|
||||
if (id<200) break; //êíîïêè èç ñïèñêà ôàéëîâ
|
||||
if (curbtn!=id-201) {FileList_ReDraw(id-201-curbtn); break;}
|
||||
else
|
||||
{
|
||||
OPEN_MARK:
|
||||
if (!isdir)
|
||||
{
|
||||
GetIni(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!strcmp(#file_name,"..")) { Dir_Up(); break; }
|
||||
OPEN_DEV:
|
||||
strcpy(#path, #file_path);
|
||||
IF (strcmp(#path+strlen(#path)-1,"/")<>0) strcat(#path,"/"); //åñëè íåò, + "/"
|
||||
za_kadrom=curbtn=0;
|
||||
Open_Dir(#path,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
//Key pressed-----------------------------------------------------------------------------
|
||||
@ -329,24 +273,24 @@ void main()
|
||||
id=key-110;
|
||||
IF (id-100>=disc_num) break;
|
||||
GOTO DEVICE_MARK;
|
||||
case 8: //Íàçàä
|
||||
case 008:
|
||||
//GoBack();
|
||||
Dir_Up();
|
||||
break;
|
||||
case 004: //Ctrl+D ðèñ íà ðàá ñòîë ðàñòÿíóòü
|
||||
case 004: //Ctrl+D set as bg
|
||||
strcpy(#temp, "\\S__");
|
||||
strcat(#temp, #file_path);
|
||||
RunProgram("/sys/media/kiv", #temp);
|
||||
break;
|
||||
case 014: //Ctrl+N íîâîå îêíî
|
||||
case 014: //Ctrl+N new window
|
||||
IF (Form.left==98) MoveSize(Form.left-20,Form.top-20,OLD,OLD);
|
||||
RunProgram("/sys/File Managers/Eolite", #path);
|
||||
break;
|
||||
case 024: //Ctrl+X
|
||||
case 003: //Ctrl+C
|
||||
CTRLC_MARK:
|
||||
IF (isdir) break; //ïàïêè ïîêà ÷òî êîïèðîâàòü íå óìååì
|
||||
strcpy(#copy_file, #file_path); //âû÷èñëÿåì êàêîé ôàéë êîïèðîâàòü
|
||||
IF (isdir) break;
|
||||
strcpy(#copy_file, #file_path);
|
||||
IF (key==24) cut_active=1; ELSE cut_active=0;
|
||||
break;
|
||||
case 022: //Ctrl+V
|
||||
@ -357,11 +301,8 @@ void main()
|
||||
break;
|
||||
case 013: //Enter
|
||||
IF (rename_active==1) {ReName(true); break;}
|
||||
GOTO OPEN_MARK;
|
||||
Open();
|
||||
break;
|
||||
case 55: //F6 - new folder
|
||||
goto NEW_FOLDER_MARK;
|
||||
case 56: //IF (rename_active==1) break;//up
|
||||
case 178: //up
|
||||
FileList_ReDraw(-1);
|
||||
break;
|
||||
@ -369,52 +310,34 @@ void main()
|
||||
FileList_ReDraw(1);
|
||||
break;
|
||||
case 180: //home
|
||||
za_kadrom=0;
|
||||
curbtn=0;
|
||||
files.first=0;
|
||||
files.current=0;
|
||||
List_ReDraw();
|
||||
break;
|
||||
case 181: //end
|
||||
za_kadrom=count-f_visible;
|
||||
curbtn=f_visible-1;
|
||||
files.first=files.count-files.visible;
|
||||
files.current=files.visible-1;
|
||||
List_ReDraw();
|
||||
break;
|
||||
case 183: //Page Down
|
||||
FileList_ReDraw(f_visible-1);
|
||||
FileList_ReDraw(files.visible-1);
|
||||
break;
|
||||
case 184: //Page Up
|
||||
FileList_ReDraw(-f_visible+1);
|
||||
FileList_ReDraw(-files.visible+1);
|
||||
break;
|
||||
case 051: //Íàæàòà F2
|
||||
REN_MARK:
|
||||
if (!count) break;
|
||||
DeleteButton(curbtn+201); //ýòî ÷òîá ìîæíî áûëî âûäåëÿòü ìûøüþ
|
||||
edit2.flags=66; //äåëàåì êîìïîíåíò àêòèâíûì
|
||||
edit2.width=onLeft(24,217);
|
||||
edit2.top=curbtn*BUTTON_HEIGHT+59;
|
||||
edit2.size=edit2.pos=strlen(#file_name);
|
||||
edit_box_draw stdcall (#edit2);
|
||||
DrawBar(213,curbtn*BUTTON_HEIGHT+58,edit2.width+1,1,0xFFFFCC); //ïîëîñà æåëòàÿ ñâåðõó äëÿ îäèíàêîâîñòè
|
||||
rename_active=1;
|
||||
break;
|
||||
case 052: //Íàæàòà F3
|
||||
IF (!isdir) RunProgram("/sys/tinypad", #file_path);
|
||||
break;
|
||||
case 053: //Íàæàòà F4
|
||||
IF (!isdir) RunProgram("/sys/develop/heed", #file_path);
|
||||
break;
|
||||
case 054: //F5
|
||||
Open_Dir(#path,1);
|
||||
break;
|
||||
case 182: //delete file
|
||||
case 182: //del
|
||||
Del_Form();
|
||||
break;
|
||||
case 050...059: //F1-F10
|
||||
ActionsProcess(key-49);
|
||||
break;
|
||||
default:
|
||||
for (i=curbtn+za_kadrom+1; i<count; i++)
|
||||
for (i=files.current+files.first+1; i<files.count; i++)
|
||||
{
|
||||
strcpy(#temp, file_mas[i]*304+buf+72);
|
||||
IF (temp[0]==key) || (temp[0]==key-32)
|
||||
{
|
||||
FileList_ReDraw(i-curbtn-za_kadrom);
|
||||
FileList_ReDraw(i-files.current-files.first);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -424,8 +347,8 @@ void main()
|
||||
DefineAndDrawWindow(40,20,550,500,0x73,col_work,TITLE);
|
||||
GetProcessInfo(#Form, SelfInfo);
|
||||
if (Form.status_window>2) break;
|
||||
min_win_h = disc_num*16+195;
|
||||
if (Form.height < min_win_h) MoveSize(OLD,OLD,OLD,min_win_h);
|
||||
files.SetSizes(192, 57, onLeft(192,27), onTop(57,6), disc_num*16+195,files.line_h);
|
||||
if (Form.height < files.min_h) MoveSize(OLD,OLD,OLD,files.min_h);
|
||||
if (Form.width<480) MoveSize(OLD,OLD,480,OLD);
|
||||
draw_window();
|
||||
}
|
||||
@ -434,38 +357,35 @@ void main()
|
||||
|
||||
inline fastcall void draw_window()
|
||||
{
|
||||
//toolbar buttons
|
||||
//toolbar
|
||||
PutPaletteImage(#toolbar,246,34,0,0,8,#toolbar_pal);
|
||||
for (j=0; j<3; j++) DefineButton(toolbar_buttons_x[j]+2,5+2,31-5,29-5,21+j+BT_HIDE,col_work);
|
||||
for (j=3; j<6; j++) DefineButton(toolbar_buttons_x[j],5,31,29,21+j+BT_HIDE,col_work);
|
||||
//ïîëîñà àäðåñà
|
||||
DrawBar(246,0,onLeft(246,60),12, col_work); //ôîí íàä ïîëîñîé àäðåñà
|
||||
DrawBar(246,29,onLeft(246,60),5,col_work); //ôîí ïîä ïîëîñîé àäðåñà
|
||||
DrawRectangle3D(246,12,onLeft(66,246),16,col_border,col_border); //îáîäîê
|
||||
DefineButton(onLeft(34,0),6,27,28,30+BT_HIDE+BT_NOFRAME,col_work); //about
|
||||
DrawBar(246,29,onLeft(246,60),5,col_work); //ôîí ïîä ïîëîñîé àäðåñà
|
||||
DrawRectangle3D(246,12,onLeft(66,246),16,col_border,col_border);
|
||||
DefineButton(onLeft(34,0),6,27,28,51+BT_HIDE+BT_NOFRAME,col_work); //about
|
||||
PutPaletteImage(#goto_about,56,34,Form.width-65,0,8,#goto_about_pal);
|
||||
//ïðÿìîóãîëüíèêè âíóòðè
|
||||
DrawRectangle3D(1,40,Form.cwidth-3,onTop(46,0),col_border,col_border); //ñèíèé îáîäîê
|
||||
DrawRectangle3D(0,39,Form.cwidth-1,onTop(44,0),col_palette[4],col_palette[4]); //ôîí
|
||||
//main rectangles
|
||||
DrawRectangle3D(1,40,Form.cwidth-3,onTop(46,0),col_border,col_border);
|
||||
DrawRectangle3D(0,39,Form.cwidth-1,onTop(44,0),col_palette[4],col_palette[4]); //bg
|
||||
for (i=0; i<5; i++) DrawBar(0, 34+i, Form.cwidth, 1, col_palette[8-i]);
|
||||
DrawLeftPanel();
|
||||
//SortButtons
|
||||
DrawFlatButton(192,40,onLeft(192,168),16,31,col_work,"File");
|
||||
//ListBox
|
||||
DrawFlatButton(files.x,40,onLeft(files.x,168),16,31,col_work,"File");
|
||||
DrawFlatButton(onLeft(168,0),40,73,16,32,col_work,"Type");
|
||||
DrawFlatButton(onLeft(95,0),40,68,16,33,col_work,"Size");
|
||||
//Ïåðåðèñîâûâàåì ñïèñîê
|
||||
DrawBar(onLeft(27,0),57,1,onTop(22,57),col_border); //line to the left from the scroll
|
||||
DrawFlatButton(onLeft(27,0),40,16,16,0,col_work,"\x18");
|
||||
DrawFlatButton(onLeft(27,0),onTop(22,0),16,16,0,col_work,"\x19");
|
||||
Open_Dir(#path,ONLY_SHOW);
|
||||
//ïðîêðóòêà
|
||||
DrawBar(onLeft(27,0),57,1,onTop(22,57),col_border); //ëèíèÿ ñëåâà îò ïðîêðóòêè
|
||||
DrawFlatButton(onLeft(27,0),40,16,16,0,col_work,"\x18"); //ïðîêðóòêà ââåðõ
|
||||
DrawFlatButton(onLeft(27,0),onTop(22,0),16,16,0,col_work,"\x19");//ïðîêðóòêà âíèç
|
||||
if (del_active) Del_Form();
|
||||
DefineButton(onLeft(34,0),6,27,28,30+BT_HIDE+BT_NOFRAME,col_work); //about
|
||||
}
|
||||
|
||||
|
||||
void KEdit()
|
||||
{
|
||||
if (Form.width<480) return;
|
||||
PathShow.area_size_x = Form.cwidth-306;
|
||||
DrawBar(PathShow.start_x-3, PathShow.start_y-4, PathShow.area_size_x+2, 15, 0xFFFfff);
|
||||
PathShow_prepare stdcall(#PathShow);
|
||||
@ -473,52 +393,52 @@ void KEdit()
|
||||
}
|
||||
|
||||
|
||||
void FileList_ReDraw(int curbtn_)
|
||||
void FileList_ReDraw(int cur)
|
||||
{
|
||||
if (curbtn_<=0) //ââåðõ
|
||||
if (cur<=0) //up
|
||||
{
|
||||
IF (za_kadrom==0) && (curbtn<=0) return;
|
||||
IF (-curbtn_-1<curbtn)
|
||||
IF (files.first==0) && (files.current<=0) return;
|
||||
IF (-cur-1<files.current)
|
||||
{
|
||||
Line_ReDraw(0xFFFFFF, curbtn); //áåëàÿ ïîëîñà
|
||||
curbtn+=curbtn_;
|
||||
Line_ReDraw(col_selec, curbtn); //âûäåëåíèå
|
||||
Line_ReDraw(0xFFFFFF, files.current);
|
||||
files.current+=cur;
|
||||
Line_ReDraw(col_selec, files.current);
|
||||
return;
|
||||
}
|
||||
ELSE
|
||||
{
|
||||
IF (-curbtn_<za_kadrom) za_kadrom+=curbtn_; ELSE za_kadrom=0;
|
||||
curbtn=0;
|
||||
IF (-cur<files.first) files.first+=cur; ELSE files.first=0;
|
||||
files.current=0;
|
||||
List_ReDraw();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else //âíèç
|
||||
else //down
|
||||
{
|
||||
IF (za_kadrom==count-f_visible) && (curbtn==f_visible-1) return;
|
||||
IF (f_visible-curbtn>curbtn_)
|
||||
IF (files.first==files.count-files.visible) && (files.current==files.visible-1) return;
|
||||
IF (files.visible-files.current>cur)
|
||||
{
|
||||
Line_ReDraw(0xFFFFFF, curbtn); //áåëàÿ ïîëîñà
|
||||
curbtn+=curbtn_;
|
||||
Line_ReDraw(col_selec, curbtn); //âûäåëåíèå
|
||||
Line_ReDraw(0xFFFFFF, files.current);
|
||||
files.current+=cur;
|
||||
Line_ReDraw(col_selec, files.current);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
IF(za_kadrom+curbtn+curbtn_>=count)
|
||||
IF(files.first+files.current+cur>=files.count)
|
||||
{
|
||||
za_kadrom=count-f_visible;
|
||||
curbtn=curbtn_-za_kadrom+curbtn;
|
||||
files.first=files.count-files.visible;
|
||||
files.current=cur-files.first+files.current;
|
||||
}
|
||||
ELSE
|
||||
{
|
||||
za_kadrom+=curbtn_+curbtn-f_visible+1;
|
||||
curbtn=f_visible-1;
|
||||
files.first+=cur+files.current-files.visible+1;
|
||||
files.current=files.visible-1;
|
||||
}
|
||||
|
||||
IF (curbtn<0) || (curbtn>f_visible)
|
||||
IF (files.current<0) || (files.current>files.visible)
|
||||
{
|
||||
curbtn=f_visible-1;
|
||||
files.current=files.visible-1;
|
||||
}
|
||||
List_ReDraw();
|
||||
}
|
||||
@ -530,67 +450,70 @@ void FileList_ReDraw(int curbtn_)
|
||||
|
||||
void List_ReDraw()
|
||||
{
|
||||
int paint_x=f_visible*BUTTON_HEIGHT+57;
|
||||
IF (count-za_kadrom<f_visible) || (curbtn>f_visible-1) //åñëè ìû â êîíöå ñïèñêà ôàéëîâ ðàçâåðí¸ì îêíî ïîÿâÿòüñÿ ïóñòÿå áåëûå êíîïêè
|
||||
{ za_kadrom=count-f_visible; curbtn=f_visible-1; } //ýòî åñëè âûäåëåíèå ïîñëå ñõëîïûâàíèÿ îêíà çà êàäðîì
|
||||
int paint_y;
|
||||
//åñëè ìû â êîíöå ñïèñêà ôàéëîâ ðàçâåðí¸ì îêíî ïîÿâÿòüñÿ ïóñòÿå áåëûå êíîïêè
|
||||
//ýòî åñëè âûäåëåíèå ïîñëå ñõëîïûâàíèÿ îêíà çà êàäðîì
|
||||
if (files.count-files.first<files.visible) || (files.current>files.visible-1)
|
||||
{ files.first=files.count-files.visible; files.current=files.visible-1; }
|
||||
|
||||
FOR (j=0; j<f_visible; j++) IF (curbtn<>j) Line_ReDraw(0xFFFFFF, j); ELSE Line_ReDraw(col_selec, curbtn);
|
||||
DrawBar(192,paint_x,onLeft(27,192),onTop(paint_x,6),0xFFFFFF); //çàëèâêà áåëûì äîêîíöà
|
||||
DrawBar(onLeft(168,0),paint_x,1,onTop(paint_x,6),col_work); //ïîëîñà ñåðàÿ âåðòèêàëüíàÿ 1
|
||||
DrawBar(onLeft(95,0),paint_x,1,onTop(paint_x,6),col_work); //ïîëîñà ñåðàÿ âåðòèêàëüíàÿ 2
|
||||
TVScroll();
|
||||
for (j=0; j<files.visible; j++) if (files.current<>j) Line_ReDraw(0xFFFFFF, j); else Line_ReDraw(col_selec, files.current);
|
||||
//in the bottom
|
||||
paint_y = j * files.line_h + files.y;
|
||||
DrawBar(files.x,paint_y,files.w,onTop(paint_y,6),0xFFFFFF);
|
||||
DrawBar(onLeft(168,0),paint_y,1,onTop(paint_y,6),col_work);
|
||||
DrawBar(onLeft(95,0),paint_y,1,onTop(paint_y,6),col_work);
|
||||
Scroll();
|
||||
}
|
||||
|
||||
void Line_ReDraw(dword color, filenum){
|
||||
dword text_col=0, name_len=0, y=filenum*BUTTON_HEIGHT+57; //ïîëîæåíèå òåêñòà ïî Y
|
||||
dword text_col=0, name_len=0, y=filenum*files.line_h+57;
|
||||
IF (rename_active==1) ReName(false);
|
||||
DefineButton(192,y,onLeft(28,192),BUTTON_HEIGHT,201+filenum+BT_HIDE+BT_NOFRAME,color); //êíîïà
|
||||
//äà, ÿ íå ñïîðþ ÷òî èçâðàò, íî çàòî ïåðåðèñîâêè íå âèäíî
|
||||
DrawBar(192,y,3,BUTTON_HEIGHT,color);
|
||||
DrawBar(192+19,y,onLeft(46,192),BUTTON_HEIGHT,color); DrawBar(195,y+17,16,1,color);
|
||||
if (BUTTON_HEIGHT>18) DrawBar(195,y+18,16,BUTTON_HEIGHT-18,color);
|
||||
if (BUTTON_HEIGHT>15) DrawBar(195,y,16,BUTTON_HEIGHT-15,color);
|
||||
DrawBar(192,y,3,files.line_h,color);
|
||||
DrawBar(192+19,y,onLeft(46,192),files.line_h,color); DrawBar(195,y+17,16,1,color);
|
||||
if (files.line_h>18) DrawBar(195,y+18,16,files.line_h-18,color);
|
||||
if (files.line_h>15) DrawBar(195,y,16,files.line_h-15,color);
|
||||
|
||||
off=file_mas[filenum+za_kadrom]*304 + buf+72;
|
||||
off=file_mas[filenum+files.first]*304 + buf+72;
|
||||
|
||||
if (!TestBit(ESDWORD[off-40], 4)) //ýòî ÔÀÉË èëè ïàïêà?
|
||||
if (!TestBit(ESDWORD[off-40], 4)) //file or folder?
|
||||
{
|
||||
strcpy(#temp, off);
|
||||
Put_icon(#temp+_strrchr(#temp,'.'), BUTTON_HEIGHT/2-7+y, color);
|
||||
WriteText(7-strlen(ConvertMemSize(ESDWORD[off-8]))*6+onLeft(75,0),BUTTON_HEIGHT-6/2+y,0x80,0,ConvertMemSize(ESDWORD[off-8])); //size
|
||||
Put_icon(#temp+_strrchr(#temp,'.'), files.line_h/2-7+y, color);
|
||||
WriteText(7-strlen(ConvertMemSize(ESDWORD[off-8]))*6+onLeft(75,0),files.line_h-6/2+y,0x80,0,ConvertMemSize(ESDWORD[off-8])); //size
|
||||
}
|
||||
else
|
||||
if (!strcmp("..",off))
|
||||
Put_icon("..", BUTTON_HEIGHT/2-7+y, color);
|
||||
Put_icon("..", files.line_h/2-7+y, color);
|
||||
else
|
||||
Put_icon("<DIR>", BUTTON_HEIGHT/2-7+y, color);
|
||||
|
||||
if (TestBit(ESDWORD[off-40],1)) || (TestBit(ESDWORD[off-40],2)) text_col=0xA6A6B7; //ôàéë ñêðûòûé èëè ñèñòåìíûé?
|
||||
Put_icon("<DIR>", files.line_h/2-7+y, color);
|
||||
if (TestBit(ESDWORD[off-40],1)) || (TestBit(ESDWORD[off-40],2)) text_col=0xA6A6B7; //system or hiden?
|
||||
if (color<>0xFFFfff)
|
||||
{
|
||||
isdir=TestBit(ESDWORD[off-40], 4);
|
||||
strcpy(#file_name, off);
|
||||
strcpy(#file_path, #path);
|
||||
strcat(#file_path, #file_name); //ïîëíûé ïóòü ê ôàéëó
|
||||
strcat(#file_path, #file_name);
|
||||
if (text_col==0xA6A6B7) text_col=0xFFFFFF;
|
||||
}
|
||||
FileShow.font_color = text_col;
|
||||
FileShow.area_size_x = Form.width - 380;
|
||||
FileShow.text_pointer = off;
|
||||
FileShow.start_y = BUTTON_HEIGHT/2-3+y;
|
||||
PathShow_prepare stdcall(#FileShow);
|
||||
PathShow_draw stdcall(#FileShow);
|
||||
|
||||
DrawBar(onLeft(168,0),y,1,BUTTON_HEIGHT,col_work); //ïîëîñà ñåðàÿ âåðòèêàëüíàÿ 1
|
||||
DrawBar(onLeft(95,0),y,1,BUTTON_HEIGHT,col_work); //ïîëîñà ñåðàÿ âåðòèêàëüíàÿ 2
|
||||
if (Form.width>=480)
|
||||
{
|
||||
FileShow.font_color = text_col;
|
||||
FileShow.area_size_x = Form.width - 380;
|
||||
FileShow.text_pointer = off;
|
||||
FileShow.start_y = files.line_h/2-3+y;
|
||||
PathShow_prepare stdcall(#FileShow);
|
||||
PathShow_draw stdcall(#FileShow);
|
||||
}
|
||||
DrawBar(onLeft(168,0),y,1,files.line_h,col_work); //gray line 1
|
||||
DrawBar(onLeft(95,0),y,1,files.line_h,col_work); //gray line 2
|
||||
}
|
||||
|
||||
|
||||
void Open_Dir(dword temp_, redraw){
|
||||
int errornum, max_count;
|
||||
int errornum, count;
|
||||
char path_[4096],
|
||||
somelen=strlen(temp_)-1;
|
||||
|
||||
|
||||
if (redraw<>ONLY_SHOW)
|
||||
{
|
||||
strcpy(#path_, temp_);
|
||||
@ -599,37 +522,35 @@ void Open_Dir(dword temp_, redraw){
|
||||
if (buf) free(buf);
|
||||
buf = malloc(32);
|
||||
errornum=ReadDir(0, buf, #path_);
|
||||
if (errornum<>0) //îøèáêà ïðè ÷òåíèè ïàïêè
|
||||
if (errornum<>0)
|
||||
{
|
||||
HistoryPath(ADD_NEW_PATH);
|
||||
GoBack();
|
||||
Write_Error(errornum);
|
||||
return;
|
||||
}
|
||||
count = ESDWORD[buf+8];
|
||||
buf = realloc(buf, count * 304 + 32);
|
||||
ReadDir(count, buf, #path_);
|
||||
count=EBX;
|
||||
max_count = sizeof(file_mas)/sizeof(dword)-1;
|
||||
if (count>max_count) count=max_count;
|
||||
files.count = ESDWORD[buf+8];
|
||||
buf = realloc(buf, files.count * 304 + 32);
|
||||
ReadDir(files.count, buf, #path_);
|
||||
files.count=EBX;
|
||||
count = sizeof(file_mas)/sizeof(dword)-1;
|
||||
if (files.count>count) files.count=count;
|
||||
|
||||
}
|
||||
if (count<>-1)
|
||||
if (files.count<>-1)
|
||||
{
|
||||
KEdit();
|
||||
HistoryPath(ADD_NEW_PATH);
|
||||
IF (!strcmp(".",buf+72)) {count--; memmov(buf,buf+304,count*304);} //ôèëüòðóåì ýëåìåíò "."
|
||||
FOR (j=0;j<f_visible;j++) DeleteButton(201+j); //óäàëÿåì ñòàðûå
|
||||
f_visible=onTop(6,57)/BUTTON_HEIGHT;
|
||||
IF (count<f_visible) f_visible=count;
|
||||
//ñòðåëî÷êà ñîðòèðîâêè
|
||||
IF (!strcmp(".",buf+72)) {files.count--; memmov(buf,buf+304,files.count*304);} //oeeuo?oai yeaiaio "."
|
||||
files.visible=onTop(6,57)/files.line_h;
|
||||
IF (files.count<files.visible) files.visible=files.count;
|
||||
IF (sort_num==1) WriteText(Form.width+60/2,45,0x80,0x4E78AC,"\x19");
|
||||
IF (sort_num==2) WriteText(Form.width-115,45,0x80,0x4E78AC,"\x19");
|
||||
IF (sort_num==3) WriteText(Form.width-44,45,0x80,0x4E78AC,"\x19");
|
||||
IF (redraw<>ONLY_SHOW) Sorting(); //äëÿ áîëüøèõ ïàïîê ïðè ðåïåèíòå îêíà
|
||||
IF (redraw<>ONLY_SHOW) Sorting();
|
||||
IF (redraw<>ONLY_OPEN) List_ReDraw();
|
||||
}
|
||||
IF (count==-1) && (redraw<>ONLY_OPEN) {f_visible=count=0; List_ReDraw();}
|
||||
IF (files.count==-1) && (redraw<>ONLY_OPEN) {files.visible=files.count=0; List_ReDraw();}
|
||||
}
|
||||
|
||||
|
||||
@ -638,31 +559,31 @@ inline Sorting()
|
||||
{
|
||||
dword k=0, l=1;
|
||||
int i;
|
||||
if (!strcmp(#path,"/")) //íå ñîðòèðîâàòü ïàïêè è íå ìåíÿòü ðåãèñòð â "/"
|
||||
if (!strcmp(#path,"/")) //do not sort
|
||||
{
|
||||
FOR(k=1;k<count;k++;) file_mas[k]=k;
|
||||
FOR(k=1;k<files.count;k++;) file_mas[k]=k;
|
||||
return;
|
||||
}
|
||||
FOR (j=count-1, off=count-1*304+buf+32; j>=0; j--, off-=304;) //ïàïêè ââåðõ, ôàéëû âíèç
|
||||
FOR (j=files.count-1, off=files.count-1*304+buf+32; j>=0; j--, off-=304;) //files | folders
|
||||
{
|
||||
strttl(off+40);
|
||||
if (TestBit(ESDWORD[off],4)) //ïàïêà?
|
||||
if (TestBit(ESDWORD[off],4)) //isdir?
|
||||
{
|
||||
file_mas[k]=j;
|
||||
k++;
|
||||
}
|
||||
else
|
||||
{
|
||||
file_mas[count-l]=j;
|
||||
file_mas[files.count-l]=j;
|
||||
l++;
|
||||
}
|
||||
}
|
||||
//Ñîáñòâåííî ñîðòèðîâêà: âíà÷àëå ïàïêè, ïîòîì ôàéëû
|
||||
//sorting: files first, then folders
|
||||
Sort_by_Name(0,k-1);
|
||||
IF (sort_num==1) Sort_by_Name(k,count-1);
|
||||
IF (sort_num==2) Sort_by_Type(k,count-1);
|
||||
IF (sort_num==3) Sort_by_Size(k,count-1);
|
||||
//åñëè ïàïêà ".." íå ïåðâàÿ, ñòàâèì å¸ òóäà
|
||||
IF (sort_num==1) Sort_by_Name(k,files.count-1);
|
||||
IF (sort_num==2) Sort_by_Type(k,files.count-1);
|
||||
IF (sort_num==3) Sort_by_Size(k,files.count-1);
|
||||
//".." should be first
|
||||
IF (k>0) && (strcmp(file_mas[0]*304+buf+72,"..")<>0) FOR(k--; k>0; k--;) IF (!strcmp(file_mas[k]*304+buf+72,"..")) file_mas[k]><file_mas[0];
|
||||
}
|
||||
|
||||
@ -670,23 +591,22 @@ inline Sorting()
|
||||
void Del_Form()
|
||||
{
|
||||
int dform_x=Form.width/2-13;
|
||||
//òèïà îêíî
|
||||
if (!count) return;
|
||||
FOR (i=5;i<11;i++) DeleteButton(201+i); //óäàëÿåì êíîïêè ïîä ôîðìîé
|
||||
DrawFlatButton(dform_x,160,200,80,0,col_work, ""); //ôîðìà
|
||||
//oeia ieii
|
||||
if (!files.count) return;
|
||||
DrawFlatButton(dform_x,160,200,80,0,col_work, ""); //oi?ia
|
||||
WriteText(dform_x+19,175,0x80,0,"Do you really want to delete");
|
||||
IF (strlen(#file_name)<28)
|
||||
{
|
||||
WriteText(strlen(#file_name)*6+dform_x+20,190,0x80,0,"?");
|
||||
WriteText(dform_x+20,190,0x80,0,#file_name); //ïèøåì èìÿ
|
||||
WriteText(dform_x+20,190,0x80,0,#file_name); //ieoai eiy
|
||||
}
|
||||
ELSE
|
||||
{
|
||||
WriteText(164+dform_x,190,0x80,0,"...?");
|
||||
ESI = 24;
|
||||
WriteText(dform_x+20,190,0,0,#file_name); //ïèøåì èìÿ
|
||||
WriteText(dform_x+20,190,0,0,#file_name); //ieoai eiy
|
||||
}
|
||||
//êíîïî÷êè
|
||||
//eiiii?ee
|
||||
DrawFlatButton(dform_x+20,208,70,20,301,0xFFB6B5,"Yes");
|
||||
DrawFlatButton(dform_x+111,208,70,20,302,0xC6DFC6,"No");
|
||||
del_active=1;
|
||||
@ -707,7 +627,7 @@ void Del_File(byte dodel)
|
||||
}
|
||||
}
|
||||
del_active=0;
|
||||
DeleteButton(301); DeleteButton(302); //óäàëÿåì êíîïî÷êè Yes/No
|
||||
DeleteButton(301); DeleteButton(302);
|
||||
Open_Dir(#path,1);
|
||||
}
|
||||
|
||||
@ -716,22 +636,22 @@ void Paste()
|
||||
char new_copy_path[4096];
|
||||
int copy_rezult;
|
||||
|
||||
IF (!copy_file) return; //îòìåíà, åøè åù¸ íè÷¸ íå ñêîïèðîâàëè
|
||||
IF (!copy_file) return;
|
||||
strcpy(#new_copy_path, #path);
|
||||
strcat(#new_copy_path, #copy_file+strrchr(#copy_file,'/'));
|
||||
if (!strcmp(#copy_file,#new_copy_path)) //åñëè ìû êîïèðóåì è âñòàâëÿåì â îäíîé è òîé æå ïàïêå
|
||||
if (!strcmp(#copy_file,#new_copy_path))
|
||||
{
|
||||
strcpy(#new_copy_path, #path);
|
||||
strcat(#new_copy_path, "new_");
|
||||
strcat(#new_copy_path, #copy_file+strrchr(#copy_file,'/'));
|
||||
}
|
||||
copy_rezult = CopyFile(#copy_file,#new_copy_path);
|
||||
IF (copy_rezult!=0) //îøèáêà
|
||||
IF (copy_rezult!=0)
|
||||
{
|
||||
Write_Error(copy_rezult);
|
||||
return;
|
||||
}
|
||||
IF (cut_active) //åñëè ìû âûáðàëè âûðåçàòü
|
||||
IF (cut_active)
|
||||
{
|
||||
strcpy(#file_path, #copy_file);
|
||||
Del_File(true);
|
||||
@ -748,11 +668,10 @@ void ReName(byte rename)
|
||||
char edit_name[256];
|
||||
rename_active=0;
|
||||
edit2.flags=64;
|
||||
DefineButton(192,curbtn*BUTTON_HEIGHT+57,onLeft(27,192),BUTTON_HEIGHT,curbtn+201+BT_HIDE+BT_NOFRAME,0xFFFFFF);
|
||||
if (rename==true)
|
||||
{
|
||||
strcpy(#temp, #path);
|
||||
strcpy(#edit_name, #file_name); //ñîõðàíÿåì íîâîå èìÿ ôàéëà, äëÿ òîãî, ÷òîáû åãî ïîòîì âûäåëèòü
|
||||
strcpy(#edit_name, #file_name); //save edit name to select it later
|
||||
strcat(#temp, #file_name);
|
||||
if (strcmp(#file_path,#temp)<>0) && (file_name)
|
||||
IF (isdir)
|
||||
@ -774,16 +693,16 @@ void ReName(byte rename)
|
||||
}
|
||||
SelectFile(#edit_name);
|
||||
}
|
||||
Line_ReDraw(col_selec,curbtn);
|
||||
Line_ReDraw(col_selec,files.current);
|
||||
}
|
||||
|
||||
|
||||
void SelectFile(dword that_file)
|
||||
{
|
||||
za_kadrom=curbtn=0; //ââåðõ ñïèñêà
|
||||
files.first=files.current=0;
|
||||
Open_Dir(#path,ONLY_OPEN);
|
||||
strttl(that_file);
|
||||
for (i=count-1; i>=0; i--;)
|
||||
for (i=files.count-1; i>=0; i--;)
|
||||
if (!strcmp(file_mas[i]*304+buf+72,that_file)) break;
|
||||
FileList_ReDraw(i);
|
||||
List_ReDraw();
|
||||
@ -802,15 +721,97 @@ void Dir_Up()
|
||||
SelectFile(#cur_folder);
|
||||
}
|
||||
|
||||
void Open()
|
||||
{
|
||||
if (!isdir)
|
||||
{
|
||||
GetIni(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!strcmp(#file_name,"..")) { Dir_Up(); return; }
|
||||
strcpy(#path, #file_path);
|
||||
if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //need "/" in the end
|
||||
files.first=files.current=0;
|
||||
Open_Dir(#path,1);
|
||||
}
|
||||
}
|
||||
|
||||
inline fastcall void GoBack() //âíà÷àëå óäàëÿåì òåêóùèé ïóòü, à ïîòîì êîïèðóåì òî, ÷òî îñòàëîñü
|
||||
|
||||
inline fastcall void GoBack()
|
||||
{
|
||||
char cur_folder[4096];
|
||||
strcpy(#cur_folder, GetCurrentFolder());
|
||||
if (HistoryPath(GO_BACK)) SelectFile(#cur_folder);
|
||||
}
|
||||
|
||||
void ActionsProcess(char N)
|
||||
{
|
||||
switch(N)
|
||||
{
|
||||
case 1:
|
||||
SwitchToAnotherThread();
|
||||
CreateThread(#about_dialog,#stak1);
|
||||
break;
|
||||
case 2:
|
||||
if (!files.count) break;
|
||||
DeleteButton(files.current+201);
|
||||
edit2.flags=100000000000010b; //set active
|
||||
edit2.width=onLeft(24,217);
|
||||
edit2.top=files.current*files.line_h+59;
|
||||
edit2.size=edit2.pos=strlen(#file_name);
|
||||
edit_box_draw stdcall (#edit2);
|
||||
DrawBar(213,files.current*files.line_h+58,edit2.width+1,1,0xFFFFCC); //bg
|
||||
rename_active=1;
|
||||
break;
|
||||
case 3:
|
||||
IF (!isdir) RunProgram("/sys/tinypad", #file_path);
|
||||
break;
|
||||
case 4:
|
||||
IF (!isdir) RunProgram("/sys/develop/heed", #file_path);
|
||||
break;
|
||||
case 5:
|
||||
Open_Dir(#path,1);
|
||||
break;
|
||||
case 6:
|
||||
strcpy(#temp, #path);
|
||||
strcat(#temp, "New folder");
|
||||
CreateDir(#temp);
|
||||
if (!EAX){
|
||||
SelectFile("New folder");
|
||||
ActionsProcess(2);
|
||||
}
|
||||
else
|
||||
{
|
||||
Write_Error(EAX);
|
||||
ShowMessage("Folder can not be created.");
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
strcpy(#temp, #path);
|
||||
strcat(#temp, "New file");
|
||||
WriteFile(0, 0, #temp);
|
||||
if (!EAX){
|
||||
SelectFile("New file");
|
||||
ActionsProcess(2);
|
||||
}
|
||||
else
|
||||
{
|
||||
Write_Error(EAX);
|
||||
ShowMessage("File can not be created.");
|
||||
}
|
||||
break;
|
||||
case 10: //F10
|
||||
RunProgram(EDITOR_PATH, abspath("Eolite.ini"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void copyf_Action() {
|
||||
return;
|
||||
}
|
||||
|
||||
stop:
|
||||
|
||||
char stak1[100];
|
||||
char stak2[100];
|
||||
char stak1[512];
|
||||
char stak2[512];
|
Binary file not shown.
@ -20,7 +20,7 @@ dword blue_hl_pal[]= {0x0001699C,0x0000699C,0x00026A9C,0x0002699C,
|
||||
|
||||
unsigned char devices[14*78]= FROM "imgs\dev.raw";
|
||||
|
||||
unsigned char factions[16*44] = FROM "imgs\actions.raw";
|
||||
unsigned char factions[14*39] = FROM "imgs\actions.raw";
|
||||
|
||||
unsigned char logo[7225] = FROM "imgs\logo8b.raw";
|
||||
|
||||
|
BIN
programs/cmm/eolite/imgs/png/actions.png
Normal file
BIN
programs/cmm/eolite/imgs/png/actions.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 694 B |
Binary file not shown.
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 6.0 KiB |
@ -14,7 +14,6 @@ void about_dialog()
|
||||
id=GetButtonID();
|
||||
IF (id==1) || (id==10) ExitProcess();
|
||||
IF (id==23) RunProgram(BROWSER_PATH, BROWSER_LINK);
|
||||
IF (id==33) RunProgram(EDITOR_PATH, abspath("Eolite.ini"));
|
||||
break;
|
||||
|
||||
case evKey:
|
||||
@ -33,8 +32,6 @@ void about_dialog()
|
||||
WriteText(29,170,0x80,0,"Visit");
|
||||
DrawLink(66,170,0x80,23, "kolibri-n.org");
|
||||
DrawFlatButton(85,190,70,22,10,0xE4DFE1, "Close");
|
||||
DefineButton(20-1,195-1, 16+1,15+1, 33+BT_HIDE, 0);
|
||||
PutPaletteImage(8*16*15+#ficons,16,15,20,195,8,#ficons_pal);
|
||||
DrawFilledBar(0, 216, 172, 12);
|
||||
}
|
||||
}
|
66
programs/cmm/eolite/include/file_menu.h
Normal file
66
programs/cmm/eolite/include/file_menu.h
Normal file
@ -0,0 +1,66 @@
|
||||
//Leency 2008-2013
|
||||
|
||||
char *captions[] = {
|
||||
"Open", "Enter",
|
||||
"Open with...", "Ctrl+Ent",
|
||||
"View as text", "F3",
|
||||
"View as HEX", "F4",
|
||||
"Rename", "F2",
|
||||
"Delete", "Del",
|
||||
0};
|
||||
|
||||
void FileMenu()
|
||||
{
|
||||
proc_info MenuForm;
|
||||
word id, key, slot;
|
||||
int ccount=0, linew=10, lineh=18, texty;
|
||||
for (i=0; captions[i]!=0; i+=2)
|
||||
{
|
||||
ccount++;
|
||||
if (strlen(captions[i])>linew) linew = strlen(captions[i]);
|
||||
}
|
||||
linew = linew + 3 * 6 + 70;
|
||||
texty = lineh/2-4;
|
||||
SetEventMask(100111b);
|
||||
|
||||
goto _MENU_DRAW;
|
||||
loop() switch(WaitEvent())
|
||||
{
|
||||
case evMouse:
|
||||
slot = GetProcessSlot(MenuForm.ID);
|
||||
if (slot != GetActiveProcess()) ExitProcess();
|
||||
break;
|
||||
|
||||
case evButton:
|
||||
id=GetButtonID();
|
||||
if (id==100) Open();
|
||||
if (id==101) notify("Not compleated yet");
|
||||
if (id==102) ActionsProcess(3);
|
||||
if (id==103) ActionsProcess(4);
|
||||
if (id==104) ActionsProcess(2);
|
||||
if (id==105) Del_Form();
|
||||
ExitProcess();
|
||||
break;
|
||||
|
||||
case evKey:
|
||||
IF (GetKey()==27) ExitProcess();
|
||||
break;
|
||||
|
||||
case evReDraw: _MENU_DRAW:
|
||||
DefineAndDrawWindow(m.x+Form.left+5,m.y+Form.top+GetSkinHeight(),linew+2,ccount*lineh+2,0x01,0xEEEeee,0x01fffFFF);
|
||||
GetProcessInfo(#MenuForm, SelfInfo);
|
||||
/* _PutImage(1,23, 16,44, #factions); //èêîíêè */
|
||||
DrawRectangle(0,0,linew+1,ccount*lineh+1,col_border);
|
||||
PutShadow(linew+2,1,1,ccount*lineh+1,0,1);
|
||||
PutShadow(1,ccount*lineh+2,linew+1,1,0,1);
|
||||
|
||||
for (i=0; captions[i*2]!=0; i++)
|
||||
{
|
||||
DefineButton(1,i*lineh,linew,lineh-1,i+100+BT_HIDE,0xFFFFFF);
|
||||
DrawBar(1,i*lineh+1,1,lineh,0xFFFfff);
|
||||
DrawBar(2,i*lineh+1,linew-1,lineh,col_work);
|
||||
WriteText(6,i*lineh+texty+1,0x80,0x000000,captions[i*2]);
|
||||
WriteText(-strlen(captions[i*2+1])*6-7+linew,i*lineh+texty+1,0x80,0x999999,captions[i*2+1]);
|
||||
}
|
||||
}
|
||||
}
|
@ -6,25 +6,6 @@
|
||||
#define PARAM 2
|
||||
#define OPTION 3
|
||||
|
||||
unsigned char *ERROR_TEXT[]={
|
||||
"Code #0 - No error",
|
||||
"Error #1 - Base or partition of a hard disk is not defined",
|
||||
"Error #2 - Function isn't supported for this file system",
|
||||
"Error #3 - Unknown file system",
|
||||
"Error #4 - Reserved, is never returned",
|
||||
"Error #5 - File or folder not found",
|
||||
"Error #6 - End of file, EOF",
|
||||
"Error #7 - Pointer lies outside of application memory",
|
||||
"Error #8 - Too less disk space",
|
||||
"Error #9 - FAT table is destroyed",
|
||||
"Error #10 - Access denied",
|
||||
"Error #11 - Device error",
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
"Error #30 - Not enough memory",
|
||||
"Error #31 - File is not executable",
|
||||
"Error #32 - Too many processes",
|
||||
0};
|
||||
|
||||
void GetIni(byte onload)
|
||||
{
|
||||
@ -61,7 +42,7 @@ void GetIni(byte onload)
|
||||
case 0x0d:
|
||||
InfType=PARAM;
|
||||
IF (!strcmp(#parametr,"SelectionColor")) edit2.shift_color=col_selec=StrToCol(#option);
|
||||
IF (!strcmp(#parametr,"LineHeight")) BUTTON_HEIGHT=atoi(#option);
|
||||
IF (!strcmp(#parametr,"LineHeight")) files.line_h = atoi(#option);
|
||||
IF (!strcmp(#parametr,"ShowDeviceName")) show_dev_name=atoi(#option);
|
||||
|
||||
/*if (!strcmp(#section,"UserDirectories")) && (parametr) && (onload)
|
||||
@ -94,20 +75,9 @@ void GetIni(byte onload)
|
||||
|
||||
void Write_Error(int error_number)
|
||||
{
|
||||
char error[256];
|
||||
|
||||
if (error_number<0) error_number=-1*error_number;
|
||||
|
||||
if (error_number<33)
|
||||
strcpy(#error, ERROR_TEXT[error_number]);
|
||||
else
|
||||
{
|
||||
strcpy(#error, itoa(error_number));
|
||||
strcat(#error, " - Unknown error number O_o");
|
||||
}
|
||||
if (curbtn>=0) Line_ReDraw(0xFF0000, curbtn);
|
||||
if (files.current>=0) Line_ReDraw(0xFF0000, files.current);
|
||||
pause(5);
|
||||
notify(#error);
|
||||
notify(get_error(error_number));
|
||||
}
|
||||
|
||||
|
||||
|
@ -16,7 +16,7 @@ path_string disk_list[30];
|
||||
int disc_num;
|
||||
dword devbuf;
|
||||
|
||||
void GetSystemDiscs()
|
||||
void SystemDiscsGet()
|
||||
{
|
||||
unsigned char dev_name[10], sys_discs[10];
|
||||
unsigned int i1, j1, dev_num, dev_disc_num;
|
||||
@ -32,8 +32,8 @@ void GetSystemDiscs()
|
||||
strcat(#dev_name, i1*304+ devbuf+72); // /rd
|
||||
strcat(#dev_name, "/"); // /rd/
|
||||
Open_Dir(#dev_name, ONLY_OPEN);
|
||||
dev_disc_num = count;
|
||||
//if (count<=0) copystr(#dev_name,#disk_list[disc_num].Item); else
|
||||
dev_disc_num = files.count;
|
||||
//if (files.count<=0) copystr(#dev_name,#disk_list[disc_num].Item); else
|
||||
for (j1=0; j1<dev_disc_num; j1++;)
|
||||
{
|
||||
strcpy(#sys_discs, #dev_name); // /rd/
|
||||
@ -46,20 +46,17 @@ void GetSystemDiscs()
|
||||
}
|
||||
|
||||
|
||||
void DrawSystemDiscs()
|
||||
void SystemDiscsDraw()
|
||||
{
|
||||
byte disc_icon;
|
||||
char dev_name[10];
|
||||
char disc_name[100];
|
||||
char dev_name[10], disc_name[100];
|
||||
int i, dev_icon;
|
||||
|
||||
for (i=0; i<20; i++) DeleteButton(100+i);
|
||||
//ñïèñîê äèñêîâ
|
||||
Tip(56, "Devices", 78, "=");
|
||||
for (i=0; i<20; i++) DeleteButton(100+i);
|
||||
for (i=0;i<disc_num;i++)
|
||||
{
|
||||
DrawBar(17,i*16+74,160,17,0xFFFFFF); //ôîí
|
||||
DefineButton(17,i*16+74,159,16,100+i+BT_HIDE,0xFFFFFF); //ñîçäà¸ì êíîïêè, à ïîòîì âûâîäèì íàçâàíèÿ äèñêîâ
|
||||
DrawBar(17,i*16+74,160,17,0xFFFFFF);
|
||||
DefineButton(17,i*16+74,159,16,100+i+BT_HIDE,0xFFFFFF);
|
||||
strcpy(#dev_name, #disk_list[i].Item);
|
||||
dev_name[strlen(#dev_name)-1]=NULL;
|
||||
switch(dev_name[1])
|
||||
@ -107,76 +104,36 @@ void DrawSystemDiscs()
|
||||
}
|
||||
}
|
||||
|
||||
void FileMenu()
|
||||
{
|
||||
word id, key;
|
||||
loop() switch(WaitEvent())
|
||||
{
|
||||
case evButton:
|
||||
id=GetButtonID();
|
||||
ExitProcess();
|
||||
break;
|
||||
|
||||
case evKey:
|
||||
IF (GetKey()==27) ExitProcess();
|
||||
break;
|
||||
|
||||
case evReDraw:
|
||||
DefineAndDrawWindow(m.x+1+Form.left,m.y+Form.top,159,90,0x01,0xEEEeee,0x01fffFFF);
|
||||
DrawBar(1,18,160,51,0xFFFFFF); //áåëîå
|
||||
_PutImage(1,23, 16,44, #factions); //èêîíêè
|
||||
//rename file
|
||||
DefineButton(1,18,159,16,80+BT_HIDE,0xE4DFE1);
|
||||
WriteText(26,23,0x80,0,"Rename file");
|
||||
WriteText(134,23,0x80,0x999999,"[F2]");
|
||||
//delete file
|
||||
DefineButton(1,35,159,16,81+BT_HIDE,0xE4DFE1);
|
||||
WriteText(26,40,0x80,0,"Delete file");
|
||||
WriteText(144,40,0x80,0x999999,"[Del]");
|
||||
//create folder
|
||||
DefineButton(1,52,159,16,82+BT_HIDE,0xE4DFE1);
|
||||
WriteText(26,57,0x80,0,"Create folder");
|
||||
WriteText(134,57,0x80,0x999999,"[F6]");
|
||||
}
|
||||
}
|
||||
|
||||
void Actions()
|
||||
char *actions[] = {
|
||||
57, "New file", "F7",
|
||||
56, "New folder", "F6",
|
||||
60, "Options", "F10",
|
||||
0,0,0
|
||||
};
|
||||
void ActionsDraw()
|
||||
{
|
||||
int actions_y=disc_num*16;
|
||||
|
||||
DeleteButton(80);
|
||||
DeleteButton(81);
|
||||
DeleteButton(82);
|
||||
|
||||
if (!show_actions)
|
||||
Tip(actions_y+90, "Actions", 77, "\x18");
|
||||
else
|
||||
int actions_y=disc_num*16+108, lineh=16;
|
||||
Tip(actions_y-18, "Actions", 77, ""); //çàãîëîâîê
|
||||
for (i=0; actions[i*3]!=0; i++, actions_y+=lineh)
|
||||
{
|
||||
Tip(actions_y+90, "Actions", 77, "\x19"); //çàãîëîâîê
|
||||
DrawBar(17,actions_y+108,160,51,0xFFFFFF); //áåëîå
|
||||
_PutImage(21,actions_y+113, 16,44, #factions); //èêîíêè
|
||||
//rename file
|
||||
DefineButton(17,actions_y+108,159,16,80+BT_HIDE,0xE4DFE1);
|
||||
WriteText(42,actions_y+113,0x80,0,"Rename file");
|
||||
WriteText(150,actions_y+113,0x80,0x999999,"[F2]");
|
||||
//delete file
|
||||
DefineButton(17,actions_y+125,159,16,81+BT_HIDE,0xE4DFE1);
|
||||
WriteText(42,actions_y+130,0x80,0,"Delete file");
|
||||
WriteText(144,actions_y+130,0x80,0x999999,"[Del]");
|
||||
//create folder
|
||||
DefineButton(17,actions_y+142,159,16,82+BT_HIDE,0xE4DFE1);
|
||||
WriteText(42,actions_y+147,0x80,0,"Create folder");
|
||||
WriteText(150,actions_y+147,0x80,0x999999,"[F6]");
|
||||
DrawBar(17,actions_y,160,lineh,0xFFFFFF); //áåëîå
|
||||
DefineButton(17,actions_y,159,lineh,actions[i*3]+BT_HIDE,0xE4DFE1);
|
||||
WriteText(45,actions_y+4,0x80,0,actions[i*3+1]);
|
||||
WriteText(-strlen(actions[i*3+2])*6+170,actions_y+4,0x80,0x999999,actions[i*3+2]);
|
||||
_PutImage(21,actions_y+2, 14,13, i*14*13*3+#factions);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LeftPanelBackground()
|
||||
void LeftPanelBgDraw()
|
||||
{
|
||||
int actions_y=disc_num*16;
|
||||
int start_y = show_actions*51+actions_y+108;
|
||||
int start_y = actions_y+156;
|
||||
DrawBar(2,41,190,15,col_lpanel); //ñèíèé ïðÿìîóãîëüíèê - íàä äåâàéñàìè
|
||||
DrawBar(17,actions_y+75,160,15,col_lpanel); //ñèíèé ïðÿìîóãîëüíèê - ïîä äåâàéñàìè
|
||||
PutShadow(17,actions_y+75,160,1,1,2);
|
||||
PutShadow(18,actions_y+75+1,158,1,1,1);
|
||||
DrawBar(2,56,15,actions_y+103,col_lpanel); //ñèíèé ïðÿìîóãîëüíèê - ñëåâà
|
||||
DrawBar(177,56,15,actions_y+103,col_lpanel); //ñèíèé ïðÿìîóãîëüíèê - ñïðàâà
|
||||
if (onTop(start_y, 6) < 268)
|
||||
@ -186,13 +143,15 @@ void LeftPanelBackground()
|
||||
DrawBar(2,start_y,190,onTop(start_y,6+268),col_lpanel);
|
||||
PutPaletteImage(#blue_hl, 190, 268, 2, onTop(268,6), 8, #blue_hl_pal);
|
||||
}
|
||||
PutShadow(17,start_y,160,1,1,2);
|
||||
PutShadow(18,start_y+1,158,1,1,1);
|
||||
}
|
||||
|
||||
|
||||
void DrawLeftPanel()
|
||||
{
|
||||
DrawSystemDiscs();
|
||||
Actions();
|
||||
LeftPanelBackground();
|
||||
SystemDiscsDraw();
|
||||
ActionsDraw();
|
||||
LeftPanelBgDraw();
|
||||
}
|
||||
|
||||
|
@ -12,29 +12,40 @@ void ShowMessage(dword message)
|
||||
List_ReDraw();
|
||||
}
|
||||
|
||||
inline fastcall signed int _strrchr( ESI,BL)
|
||||
{
|
||||
int jj=0, last=strlen(ESI);
|
||||
do{
|
||||
jj++;
|
||||
$lodsb
|
||||
IF(AL==BL) last=jj;
|
||||
} while(AL!=0);
|
||||
return last;
|
||||
}
|
||||
|
||||
|
||||
dword col_palette[14] = {0xD2D3D3,0xD4D4D4,0xD6D5D6,0xD8D7D8,0xDAD8D9,0xDCDADB,
|
||||
0xDFDCDD,0xE1DDDE,0xE2DEE0,0xE4DFE1,0xE3DFE1,0xE3DFE1,0xE3DFE1,0xE3DFE1,0xE3DFE1};
|
||||
|
||||
inline fastcall void TVScroll() { //Ïðîêðóòêà
|
||||
inline fastcall void Scroll() { //Ïðîêðóòêà
|
||||
dword on_y, i;
|
||||
if (count<=0)
|
||||
if (files.count<=0)
|
||||
{
|
||||
on_y = 57;
|
||||
scroll_size = onTop(22,58);
|
||||
}
|
||||
else
|
||||
{
|
||||
on_y = za_kadrom * onTop(22,57) / count +57;
|
||||
scroll_size=onTop(22,57) * f_visible - f_visible / count;
|
||||
on_y = files.first * onTop(22,57) / files.count +57;
|
||||
scroll_size=onTop(22,57) * files.visible - files.visible / files.count;
|
||||
if (scroll_size<20) scroll_size = 20; //óñòàíàâëèâàåì ìèíèìàëüíûé ðàçìåð ñêðîëëà
|
||||
if (scroll_size>onTop(22,57)-on_y+56) || (za_kadrom+f_visible>=count) on_y=onTop(23+scroll_size,0); //äëÿ áîëüøîãî ñïèñêà
|
||||
if (scroll_size>onTop(22,57)-on_y+56) || (files.first+files.visible>=files.count) on_y=onTop(23+scroll_size,0); //äëÿ áîëüøîãî ñïèñêà
|
||||
}
|
||||
DrawFlatButton(onLeft(27,0),on_y,16,scroll_size,0,-1,"");//ïîëçóíîê
|
||||
if (!scroll_used) for (i=0; i<13; i++) DrawBar(onLeft(25-i,0), on_y+2, 1, scroll_size-3, col_palette[13-i]);
|
||||
if (scroll_used) for (i=0; i<13; i++) DrawBar(onLeft(25-i,0), on_y+2, 1, scroll_size-3, col_palette[i]);
|
||||
//ïîëå äî ïîëçóíêà
|
||||
if (on_y>58) DrawBar(onLeft(26,0),57,15,1, 0xC7C9C9);
|
||||
if (on_y>58) DrawBar(onLeft(26,0),57,15,1, 0xC7C9C9);
|
||||
DrawBar(onLeft(26,0),58,1, on_y-58,0xC7C9C9);
|
||||
DrawBar(onLeft(25,0),58,14,on_y-58,0xCED0D0);
|
||||
//ïîëå ïîñëå ïîëçóíêà
|
||||
|
@ -1,3 +1,11 @@
|
||||
01.05.13 -- v1.77
|
||||
- исправлено падение при изменении размера окна (нашёл 0CodErr);
|
||||
- меню файлов (не закончено);
|
||||
- перевод программы на элемент list_box: упрощение кода, гибкость элемента,
|
||||
задел на двупанельность;
|
||||
- вместо кнопок файлов теперь используются события мыши;
|
||||
- очень много других исправлений и оптимизаций.
|
||||
|
||||
03.03.13 -- v1.64
|
||||
- перенос программы на общую библиотеку (очень хотел s1n). Это даёт доступ
|
||||
к множествам наработок основной ветви;
|
||||
|
@ -71,6 +71,14 @@ void Install()
|
||||
EndLoop();
|
||||
}
|
||||
|
||||
void copyf_Action(dword filename)
|
||||
{
|
||||
if (CheckEvent()==evReDraw) { DefineWindow("Installation Started", "Stop"); ShowProgress("Copying files..."); }
|
||||
ShowProgress(NULL);
|
||||
DrawBar(TEXTX, BLACK_H+50, Form.cwidth-TEXTX, 12, 0xFFFfff);
|
||||
WriteText(TEXTX, BLACK_H+50, 0x80, 0, filename);
|
||||
}
|
||||
|
||||
|
||||
void EndLoop()
|
||||
{
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "..\lib\file_system.h"
|
||||
#include "..\lib\mem.h"
|
||||
#include "..\lib\dll.h"
|
||||
#include "..\lib\copyf.h"
|
||||
//*.obj libraries
|
||||
#include "..\lib\lib.obj\box_lib.h"
|
||||
#include "..\lib\lib.obj\libio_lib.h"
|
||||
@ -47,7 +48,6 @@ int DefineWindow(dword wtitle, wbutton)
|
||||
return 1;
|
||||
}
|
||||
|
||||
#include "copyf.c"
|
||||
#include "tmp_add.c"
|
||||
#include "hallo.c";
|
||||
#include "installation.c";
|
||||
|
@ -75,10 +75,7 @@ void CopyFolder(dword from, to)
|
||||
strcpy(#copy_in, to);
|
||||
strcat(#copy_in, filename);
|
||||
|
||||
if (CheckEvent()==evReDraw) { DefineWindow("Installation Started", "Stop"); ShowProgress("Copying files..."); }
|
||||
ShowProgress(NULL);
|
||||
DrawBar(TEXTX, BLACK_H+50, Form.cwidth-TEXTX, 12, 0xFFFfff);
|
||||
WriteText(TEXTX, BLACK_H+50, 0x80, 0, filename);
|
||||
copyf_Action(filename);
|
||||
|
||||
error = CopyFile(#copy_from, #copy_in);
|
||||
if (error) error = CopyFile(#copy_from, #copy_in); // #2 :)
|
||||
@ -88,7 +85,6 @@ void CopyFolder(dword from, to)
|
||||
free(dirbuf);
|
||||
}
|
||||
|
||||
|
||||
unsigned char *ERROR_TEXT[]={
|
||||
"Code #0 - No error",
|
||||
"Error #1 - Base or partition of a hard disk is not defined",
|
||||
@ -109,19 +105,24 @@ unsigned char *ERROR_TEXT[]={
|
||||
"Error #32 - Too many processes",
|
||||
0};
|
||||
|
||||
void debug_error(int path, error_number)
|
||||
dword get_error(int N)
|
||||
{
|
||||
char error[256];
|
||||
if (path) debug(path);
|
||||
if (error_number<0) error_number*=-1;
|
||||
if (error_number<33)
|
||||
if (N<0) N*=-1;
|
||||
if (N<33)
|
||||
{
|
||||
strcpy(#error, ERROR_TEXT[error_number]);
|
||||
strcpy(#error, ERROR_TEXT[N]);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(#error, itoa(error_number));
|
||||
strcpy(#error, itoa(N));
|
||||
strcat(#error, " - Unknown error number O_o");
|
||||
}
|
||||
debug(#error);
|
||||
return #error;
|
||||
}
|
||||
|
||||
void debug_error(dword path, error_number)
|
||||
{
|
||||
if (path) debug(path);
|
||||
debug(get_error(error_number));
|
||||
}
|
@ -101,9 +101,8 @@ void DrawCaptButton(dword x,y,w,h,id,color_b, color_t,text)
|
||||
proc_info wForm;
|
||||
dword shadow_buf, skin_height;
|
||||
shadow_buf = mem_Alloc(w*h*3);
|
||||
//skin_height = GetSkinHeight();
|
||||
GetProcessInfo(#wForm, SelfInfo);
|
||||
CopyScreen(shadow_buf, x+wForm.left, y+wForm.top, w, h);
|
||||
CopyScreen(shadow_buf, 5*border+x+wForm.left, GetSkinHeight()*border+y+wForm.top, w, h);
|
||||
ShadowImage(shadow_buf, w, h, strength);
|
||||
_PutImage(x,y,w,h,shadow_buf);
|
||||
mem_Free(shadow_buf);
|
||||
|
@ -155,6 +155,7 @@ f70 read_dir_70;
|
||||
:int GetDir(dword dir_buf, file_count, path)
|
||||
{
|
||||
dword buf, fcount, error;
|
||||
ESDWORD[file_count] = 0;
|
||||
buf = malloc(32);
|
||||
error = ReadDir(0, buf, path);
|
||||
if (!error)
|
||||
|
@ -65,6 +65,7 @@ void mouse::get()
|
||||
$and ebx,0x0000FFFF
|
||||
//hor = EAX;
|
||||
vert = EBX;
|
||||
if (y>6000) y=0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
0};
|
||||
#endif
|
||||
|
||||
char stak[100];
|
||||
char stak[512];
|
||||
#define ITEM_HEIGHT 18
|
||||
int ITEM_WIDTH;
|
||||
|
||||
@ -82,9 +82,8 @@ void window()
|
||||
case evMouse:
|
||||
m.get();
|
||||
|
||||
GetProcessInfo(#MenuForm, SelfInfo);
|
||||
id1=GetProcessSlot(MenuForm.ID);
|
||||
if (id1<>GetActiveProcess()) ExitProcess();
|
||||
if (id1<>GetActiveProcess()) ExitProcess();
|
||||
id1=m.y-1/ITEM_HEIGHT;
|
||||
if (m.y<0) || (id1+1>items_num) || (m.x<0) || (m.x>ITEM_WIDTH) break;
|
||||
if (m.lkm) || (m.pkm)
|
||||
@ -130,6 +129,7 @@ void window()
|
||||
while (ITEMS_LIST[items_num*3]) items_num++;
|
||||
m.get();
|
||||
DefineAndDrawWindow(m.x+1,m.y,ITEM_WIDTH+1,items_num*ITEM_HEIGHT+2,0x01,sc.work,0, 0x01fffFFF);
|
||||
GetProcessInfo(#MenuForm, SelfInfo);
|
||||
DrawRectangle(0,0,ITEM_WIDTH,items_num*ITEM_HEIGHT+1,sc.work_graph); //îáîäîê
|
||||
PutShadow(ITEM_WIDTH+1,1,1,items_num*ITEM_HEIGHT+1,0,1);
|
||||
PutShadow(1,items_num*ITEM_HEIGHT+2,ITEM_WIDTH+1,1,0,1);
|
||||
|
Loading…
Reference in New Issue
Block a user