forked from KolibriOS/kolibrios
Eolite 3.0 beta: rewrote list functions, fixed rarely crash while window resize
git-svn-id: svn://kolibrios.org@5694 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
bf523330da
commit
4bdbccb935
@ -103,8 +103,8 @@
|
|||||||
enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir
|
enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir
|
||||||
enum { CREATE_FILE=1, CREATE_FOLDER, RENAME_ITEM }; //NewElement
|
enum { CREATE_FILE=1, CREATE_FOLDER, RENAME_ITEM }; //NewElement
|
||||||
|
|
||||||
#define TITLE "Eolite File Manager v2.96"
|
#define TITLE "Eolite File Manager v3.0 beta"
|
||||||
#define ABOUT_TITLE "Eolite 2.96"
|
#define ABOUT_TITLE "Eolite 3.0 beta"
|
||||||
dword col_padding, col_selec, col_lpanel;
|
dword col_padding, col_selec, col_lpanel;
|
||||||
|
|
||||||
int toolbar_buttons_x[7]={9,46,85,134,167,203};
|
int toolbar_buttons_x[7]={9,46,85,134,167,203};
|
||||||
@ -119,6 +119,8 @@ byte menu_call_mouse=0;
|
|||||||
|
|
||||||
llist files;
|
llist files;
|
||||||
|
|
||||||
|
byte list_full_redraw;
|
||||||
|
|
||||||
byte
|
byte
|
||||||
path[4096],
|
path[4096],
|
||||||
file_path[4096],
|
file_path[4096],
|
||||||
@ -142,7 +144,7 @@ dword eolite_ini_path;
|
|||||||
dword menu_stak,about_stak,properties_stak,settings_stak,copy_stak;
|
dword menu_stak,about_stak,properties_stak,settings_stak,copy_stak;
|
||||||
|
|
||||||
proc_info Form;
|
proc_info Form;
|
||||||
int mouse_dd, scroll_used, sc_slider_h, sorting_arrow_x, kolibrios_drive;
|
int mouse_dd, sc_slider_h, sorting_arrow_x, kolibrios_drive;
|
||||||
dword buf;
|
dword buf;
|
||||||
dword file_mas[6898];
|
dword file_mas[6898];
|
||||||
int j, i;
|
int j, i;
|
||||||
@ -152,13 +154,13 @@ int selected_count;
|
|||||||
byte CMD_REFRESH;
|
byte CMD_REFRESH;
|
||||||
|
|
||||||
signed x_old, y_old, dif_x, dif_y, adif_x, adif_y;
|
signed x_old, y_old, dif_x, dif_y, adif_x, adif_y;
|
||||||
byte stats;
|
|
||||||
|
|
||||||
edit_box edit2 = {250,213,80,0xFFFFCC,0x94AECE,0xFFFFCC,0xFFFFFF,0,248,#file_name,#mouse_dd,64,6,6};
|
edit_box edit2 = {250,213,80,0xFFFFCC,0x94AECE,0xFFFFCC,0xFFFFFF,0,248,#file_name,#mouse_dd,64,6,6};
|
||||||
edit_box new_file_ed = {171,213,180,0xFFFFFF,0x94AECE,0xFFFFFF,0xFFFFFF,0,248,#new_element_name,#mouse_dd,100000000000010b,6,0};
|
edit_box new_file_ed = {171,213,180,0xFFFFFF,0x94AECE,0xFFFFFF,0xFFFFFF,0,248,#new_element_name,#mouse_dd,100000000000010b,6,0};
|
||||||
PathShow_data PathShow = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, #path, #temp, 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};
|
PathShow_data FileShow = {0, 56,215, 6, 100, 0, 0, 0x0, 0xFFFfff, #file_name, #temp, 0};
|
||||||
byte cmd_free;
|
byte cmd_free=0;
|
||||||
#include "include\copy.h"
|
#include "include\copy.h"
|
||||||
#include "include\gui.h"
|
#include "include\gui.h"
|
||||||
#include "include\sorting.h"
|
#include "include\sorting.h"
|
||||||
@ -173,7 +175,8 @@ byte cmd_free;
|
|||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
word key, id, can_show, can_select, m_selected;
|
word key, id;
|
||||||
|
char can_show, can_select, scroll_used, stats;
|
||||||
dword selected_offset;
|
dword selected_offset;
|
||||||
dword IPC_LEN,IPC_ID;
|
dword IPC_LEN,IPC_ID;
|
||||||
char IPC_BUF[10];
|
char IPC_BUF[10];
|
||||||
@ -232,7 +235,7 @@ void main()
|
|||||||
{
|
{
|
||||||
if (HistoryPath(GO_FORWARD))
|
if (HistoryPath(GO_FORWARD))
|
||||||
{
|
{
|
||||||
files.first=files.current=NULL;
|
files.KeyHome();
|
||||||
Open_Dir(#path,WITH_REDRAW);
|
Open_Dir(#path,WITH_REDRAW);
|
||||||
}
|
}
|
||||||
stats = 0;
|
stats = 0;
|
||||||
@ -259,11 +262,14 @@ void main()
|
|||||||
{
|
{
|
||||||
if (mouse.y>=files.y)//&&(mouse.click)
|
if (mouse.y>=files.y)//&&(mouse.click)
|
||||||
{
|
{
|
||||||
id = mouse.y - files.y / files.line_h;
|
id = mouse.y - files.y / files.line_h + files.first;
|
||||||
IF (files.current!=id)
|
if (files.current!=id)
|
||||||
{
|
{
|
||||||
mouse.clearTime();
|
mouse.clearTime();
|
||||||
if(!mouse.up)&&(id<files.visible) List_Current(id-files.current);
|
if(!mouse.up)&&(id-files.first<files.visible) {
|
||||||
|
files.current = id;
|
||||||
|
List_ReDraw();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else IF(mouse.dblclick)Open(0);
|
else IF(mouse.dblclick)Open(0);
|
||||||
}
|
}
|
||||||
@ -274,11 +280,10 @@ void main()
|
|||||||
if (mouse.key&MOUSE_RIGHT)&&(mouse.up)
|
if (mouse.key&MOUSE_RIGHT)&&(mouse.up)
|
||||||
{
|
{
|
||||||
menu_call_mouse = 1;
|
menu_call_mouse = 1;
|
||||||
if (mouse.y>=files.y)//&&(mouse.click)
|
|
||||||
|
if (files.MouseOver(mouse.x, mouse.y))
|
||||||
{
|
{
|
||||||
id = mouse.y - files.y / files.line_h;
|
files.current = mouse.y - files.y / files.line_h + files.first;
|
||||||
if (files.current!=id) List_Current(id-files.current);
|
|
||||||
//SwitchToAnotherThread();
|
|
||||||
menu_stak = malloc(4096);
|
menu_stak = malloc(4096);
|
||||||
CreateThread(#FileMenu,menu_stak+4092);
|
CreateThread(#FileMenu,menu_stak+4092);
|
||||||
}
|
}
|
||||||
@ -361,7 +366,7 @@ void main()
|
|||||||
case 22: //Forward
|
case 22: //Forward
|
||||||
if (HistoryPath(GO_FORWARD))
|
if (HistoryPath(GO_FORWARD))
|
||||||
{
|
{
|
||||||
files.first=files.current=NULL; //aaa?o nienea
|
files.KeyHome();
|
||||||
Open_Dir(#path,WITH_REDRAW);
|
Open_Dir(#path,WITH_REDRAW);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -391,7 +396,7 @@ void main()
|
|||||||
DEVICE_MARK:
|
DEVICE_MARK:
|
||||||
DrawRectangle(17,id-100*16+74,159,16, 0); //auaaeaiea
|
DrawRectangle(17,id-100*16+74,159,16, 0); //auaaeaiea
|
||||||
strcpy(#path, #disk_list[id-100].Item);
|
strcpy(#path, #disk_list[id-100].Item);
|
||||||
files.first=files.current=0;
|
files.KeyHome();
|
||||||
Open_Dir(#path,WITH_REDRAW);
|
Open_Dir(#path,WITH_REDRAW);
|
||||||
pause(5);
|
pause(5);
|
||||||
DrawRectangle(17,id-100*16+74,159,16, 0xFFFFFF);
|
DrawRectangle(17,id-100*16+74,159,16, 0xFFFFFF);
|
||||||
@ -422,6 +427,11 @@ void main()
|
|||||||
edit_box_key stdcall (#edit2);
|
edit_box_key stdcall (#edit2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (files.ProcessKey(key))
|
||||||
|
{
|
||||||
|
List_ReDraw();
|
||||||
|
break;
|
||||||
|
}
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
case 209...217:
|
case 209...217:
|
||||||
@ -484,30 +494,12 @@ void main()
|
|||||||
if (!itdir) ShowOpenWithDialog();
|
if (!itdir) ShowOpenWithDialog();
|
||||||
else Open(1);
|
else Open(1);
|
||||||
break;
|
break;
|
||||||
case ASCII_KEY_UP:
|
|
||||||
List_Current(-1);
|
|
||||||
break;
|
|
||||||
case ASCII_KEY_DOWN:
|
|
||||||
List_Current(1);
|
|
||||||
break;
|
|
||||||
case ASCII_KEY_HOME:
|
|
||||||
if (files.KeyHome()) List_ReDraw();
|
|
||||||
break;
|
|
||||||
case ASCII_KEY_END:
|
|
||||||
if (files.KeyEnd()) List_ReDraw();
|
|
||||||
break;
|
|
||||||
case ASCII_KEY_PGDN:
|
|
||||||
List_Current(files.visible-1);
|
|
||||||
break;
|
|
||||||
case ASCII_KEY_PGUP:
|
|
||||||
List_Current(-files.visible+1);
|
|
||||||
break;
|
|
||||||
case ASCII_KEY_DEL:
|
case ASCII_KEY_DEL:
|
||||||
Del_Form();
|
Del_Form();
|
||||||
break;
|
break;
|
||||||
case ASCII_KEY_INS:
|
case ASCII_KEY_INS:
|
||||||
selected_offset = file_mas[files.current+files.first]*304 + buf+32 + 7;
|
selected_offset = file_mas[files.current]*304 + buf+32 + 7;
|
||||||
if (files.current+files.first==0) && (!strncmp(selected_offset+33, "..", 2)) goto _INSERT_END; //do not selec ".." directory
|
if (files.current==0) && (!strncmp(selected_offset+33, "..", 2)) goto _INSERT_END; //do not selec ".." directory
|
||||||
if (ESBYTE[selected_offset])
|
if (ESBYTE[selected_offset])
|
||||||
{
|
{
|
||||||
ESBYTE[selected_offset]=0;
|
ESBYTE[selected_offset]=0;
|
||||||
@ -519,18 +511,20 @@ void main()
|
|||||||
selected_count++;
|
selected_count++;
|
||||||
}
|
}
|
||||||
_INSERT_END:
|
_INSERT_END:
|
||||||
List_Current(1);
|
if (files.KeyDown()) List_ReDraw();
|
||||||
break;
|
break;
|
||||||
case 048...059: //F1-F10
|
case 048...059: //F1-F10
|
||||||
FnProcess(key-49);
|
FnProcess(key-49);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
for (i=files.current+files.first+1; i<files.count; i++)
|
for (i=files.current+1; i<files.count; i++)
|
||||||
{
|
{
|
||||||
strcpy(#temp, file_mas[i]*304+buf+72);
|
strcpy(#temp, file_mas[i]*304+buf+72);
|
||||||
if (temp[0]==key) || (temp[0]==key-32)
|
if (temp[0]==key) || (temp[0]==key-32)
|
||||||
{
|
{
|
||||||
List_Current(i-files.current-files.first);
|
files.current = i - 1;
|
||||||
|
files.KeyDown();
|
||||||
|
List_ReDraw();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -580,7 +574,7 @@ void menu_action(dword id)
|
|||||||
if (id==COPY_PASTE_END)
|
if (id==COPY_PASTE_END)
|
||||||
{
|
{
|
||||||
FnProcess(5);
|
FnProcess(5);
|
||||||
SelectFile(#copy_to+strrchr(#copy_to,'/'));
|
SelectFileByName(#copy_to+strrchr(#copy_to,'/'));
|
||||||
}
|
}
|
||||||
if (id==100) Open(0);
|
if (id==100) Open(0);
|
||||||
if (id==201) ShowOpenWithDialog();
|
if (id==201) ShowOpenWithDialog();
|
||||||
@ -606,11 +600,10 @@ void draw_window()
|
|||||||
DefineAndDrawWindow(GetScreenWidth()-550/4+rand_n,rand_n+30,550,500,0x73,system.color.work,TITLE,0);
|
DefineAndDrawWindow(GetScreenWidth()-550/4+rand_n,rand_n+30,550,500,0x73,system.color.work,TITLE,0);
|
||||||
GetProcessInfo(#Form, SelfInfo);
|
GetProcessInfo(#Form, SelfInfo);
|
||||||
if (Form.status_window>2) return;
|
if (Form.status_window>2) return;
|
||||||
files.SetSizes(192, 57, Form.cwidth - 210, 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.height < files.min_h) MoveSize(OLD,OLD,OLD,files.min_h);
|
||||||
if (Form.width<480) MoveSize(OLD,OLD,480,OLD);
|
if (Form.width<480) MoveSize(OLD,OLD,480,OLD);
|
||||||
GetProcessInfo(#Form, SelfInfo); //if win_size changed
|
GetProcessInfo(#Form, SelfInfo); //if win_size changed
|
||||||
|
files.SetSizes(192, 57, Form.cwidth - 210, onTop(57,6), disc_num*16+195,files.line_h);
|
||||||
PutPaletteImage(#toolbar,246,34,0,0,8,#toolbar_pal);
|
PutPaletteImage(#toolbar,246,34,0,0,8,#toolbar_pal);
|
||||||
DrawBar(127, 8, 1, 25, system.color.work_graph);
|
DrawBar(127, 8, 1, 25, system.color.work_graph);
|
||||||
for (j=0; j<3; j++) DefineButton(toolbar_buttons_x[j]+2,5+2,31-5,29-5,21+j+BT_HIDE,system.color.work);
|
for (j=0; j<3; j++) DefineButton(toolbar_buttons_x[j]+2,5+2,31-5,29-5,21+j+BT_HIDE,system.color.work);
|
||||||
@ -638,80 +631,31 @@ void draw_window()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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);
|
|
||||||
PathShow_draw stdcall(#PathShow);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void List_Current(signed int cur)
|
|
||||||
{
|
|
||||||
if (cur<=0) //up
|
|
||||||
{
|
|
||||||
if (files.first==0) && (files.current<=0) return;
|
|
||||||
if (-cur-1<files.current)
|
|
||||||
{
|
|
||||||
Line_ReDraw(0xFFFFFF, files.current);
|
|
||||||
files.current+=cur;
|
|
||||||
Line_ReDraw(col_selec, files.current);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (-cur<files.first) files.first+=cur; else files.first=0;
|
|
||||||
files.current=0;
|
|
||||||
List_ReDraw();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else //down
|
|
||||||
{
|
|
||||||
if (files.first==files.count-files.visible) && (files.current==files.visible-1)
|
|
||||||
{
|
|
||||||
Line_ReDraw(col_selec, files.current);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (files.visible-files.current>cur)
|
|
||||||
{
|
|
||||||
Line_ReDraw(0xFFFFFF, files.current);
|
|
||||||
files.current+=cur;
|
|
||||||
Line_ReDraw(col_selec, files.current);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(files.first+files.current+cur>=files.count)
|
|
||||||
{
|
|
||||||
files.first=files.count-files.visible;
|
|
||||||
files.current=cur-files.first+files.current;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
files.first+=cur+files.current-files.visible+1;
|
|
||||||
files.current=files.visible-1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (files.current<0) || (files.current>files.visible)
|
|
||||||
{
|
|
||||||
files.current=files.visible-1;
|
|
||||||
}
|
|
||||||
List_ReDraw();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void List_ReDraw()
|
void List_ReDraw()
|
||||||
{
|
{
|
||||||
int paint_y;
|
int paint_y;
|
||||||
//we are in the end of the list => maximize window => there will be white lines after the last element
|
static int old_current, old_first;
|
||||||
if (files.count-files.first<files.visible) || (files.current>files.visible-1)
|
|
||||||
{ files.first=files.count-files.visible; files.current=files.visible-1; }
|
files.CheckDoesValuesOkey(); //prevent some shit
|
||||||
for (j=0; j<files.visible; j++) if (files.current!=j) Line_ReDraw(0xFFFFFF, j); else Line_ReDraw(col_selec, files.current);
|
|
||||||
|
if (list_full_redraw) || (old_first != files.first)
|
||||||
|
{
|
||||||
|
old_current = files.current;
|
||||||
|
old_first = files.first;
|
||||||
|
list_full_redraw = false;
|
||||||
|
goto _ALL_LIST_REDRAW;
|
||||||
|
}
|
||||||
|
if (old_current != files.current)
|
||||||
|
{
|
||||||
|
Line_ReDraw(0xFFFFFF, old_current-files.first);
|
||||||
|
Line_ReDraw(col_selec, files.current-files.first);
|
||||||
|
old_current = files.current;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_ALL_LIST_REDRAW:
|
||||||
|
|
||||||
|
for (j=0; j<files.visible; j++) if (files.current-files.first!=j) Line_ReDraw(0xFFFFFF, j); else Line_ReDraw(col_selec, files.current-files.first);
|
||||||
//in the bottom
|
//in the bottom
|
||||||
paint_y = j * files.line_h + files.y;
|
paint_y = j * files.line_h + files.y;
|
||||||
DrawBar(files.x,paint_y,files.w,onTop(paint_y,6),0xFFFFFF);
|
DrawBar(files.x,paint_y,files.w,onTop(paint_y,6),0xFFFFFF);
|
||||||
@ -794,11 +738,17 @@ void Open_Dir(dword dir_path, redraw){
|
|||||||
}
|
}
|
||||||
maxcount = sizeof(file_mas)/sizeof(dword)-1;
|
maxcount = sizeof(file_mas)/sizeof(dword)-1;
|
||||||
if (files.count>maxcount) files.count = maxcount;
|
if (files.count>maxcount) files.count = maxcount;
|
||||||
if (files.count>0) && (files.current==-1) files.current=0;
|
if (files.count>0) && (files.current-files.first==-1) files.current=0;
|
||||||
}
|
}
|
||||||
if (files.count!=-1)
|
if (files.count!=-1)
|
||||||
{
|
{
|
||||||
if(!_not_draw)KEdit();
|
if(!_not_draw)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
PathShow_draw stdcall(#PathShow);
|
||||||
|
}
|
||||||
HistoryPath(ADD_NEW_PATH);
|
HistoryPath(ADD_NEW_PATH);
|
||||||
files.visible = files.h / files.line_h;
|
files.visible = files.h / files.line_h;
|
||||||
if (files.count < files.visible) files.visible = files.count;
|
if (files.count < files.visible) files.visible = files.count;
|
||||||
@ -807,10 +757,15 @@ void Open_Dir(dword dir_path, redraw){
|
|||||||
if (sort_num==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w;
|
if (sort_num==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w;
|
||||||
WriteText(sorting_arrow_x,45,0x80,system.color.work_graph,"\x19");
|
WriteText(sorting_arrow_x,45,0x80,system.color.work_graph,"\x19");
|
||||||
if (redraw!=ONLY_SHOW) Sorting();
|
if (redraw!=ONLY_SHOW) Sorting();
|
||||||
|
list_full_redraw = true;
|
||||||
if (redraw!=ONLY_OPEN)&&(!_not_draw) List_ReDraw();
|
if (redraw!=ONLY_OPEN)&&(!_not_draw) List_ReDraw();
|
||||||
DrawSystemDiscs();
|
DrawSystemDiscs();
|
||||||
}
|
}
|
||||||
if (files.count==-1) && (redraw!=ONLY_OPEN) {files.visible=files.count=0; if(!_not_draw)List_ReDraw();}
|
if (files.count==-1) && (redraw!=ONLY_OPEN)
|
||||||
|
{
|
||||||
|
files.KeyHome();
|
||||||
|
if(!_not_draw) { list_full_redraw=true; List_ReDraw(); }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -959,14 +914,15 @@ void Del_File(byte dodel)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SelectFile(dword that_file)
|
void SelectFileByName(dword that_file)
|
||||||
{
|
{
|
||||||
files.first=files.current=0;
|
int ind;
|
||||||
|
files.KeyHome();
|
||||||
Open_Dir(#path,ONLY_OPEN);
|
Open_Dir(#path,ONLY_OPEN);
|
||||||
if (!real_files_names_case) strttl(that_file);
|
if (!real_files_names_case) strttl(that_file);
|
||||||
for (i=files.count-1; i>=0; i--;)
|
for (ind=files.count-1; ind>=0; ind--;) { if (!strcmp(file_mas[ind]*304+buf+72,that_file)) break; }
|
||||||
if (!strcmp(file_mas[i]*304+buf+72,that_file)) break;
|
files.current = ind - 1;
|
||||||
List_Current(i);
|
files.KeyDown();
|
||||||
List_ReDraw();
|
List_ReDraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -980,7 +936,7 @@ void Dir_Up()
|
|||||||
i = strrchr(#path, '/');
|
i = strrchr(#path, '/');
|
||||||
strcpy(#cur_folder, #path+i);
|
strcpy(#cur_folder, #path+i);
|
||||||
path[i]=0x00;
|
path[i]=0x00;
|
||||||
SelectFile(#cur_folder);
|
SelectFileByName(#cur_folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Open(byte rez)
|
void Open(byte rez)
|
||||||
@ -1015,7 +971,7 @@ inline fastcall void GoBack()
|
|||||||
{
|
{
|
||||||
char cur_folder[4096];
|
char cur_folder[4096];
|
||||||
strcpy(#cur_folder, GetCurrentFolder());
|
strcpy(#cur_folder, GetCurrentFolder());
|
||||||
if (HistoryPath(GO_BACK)) SelectFile(#cur_folder);
|
if (HistoryPath(GO_BACK)) SelectFileByName(#cur_folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShowOpenWithDialog()
|
void ShowOpenWithDialog()
|
||||||
@ -1078,7 +1034,7 @@ void NewElement(byte newf)
|
|||||||
}
|
}
|
||||||
if (CreateDir(#temp)) CreateDir(#file_path);
|
if (CreateDir(#temp)) CreateDir(#file_path);
|
||||||
Open_Dir(#path,WITH_REDRAW);
|
Open_Dir(#path,WITH_REDRAW);
|
||||||
SelectFile(new_file_ed.text);
|
SelectFileByName(new_file_ed.text);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1089,7 +1045,7 @@ void NewElement(byte newf)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Del_File(true);
|
Del_File(true);
|
||||||
SelectFile(new_file_ed.text);
|
SelectFileByName(new_file_ed.text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1100,7 +1056,7 @@ void NewElement(byte newf)
|
|||||||
}
|
}
|
||||||
new_element_active = 0;
|
new_element_active = 0;
|
||||||
Open_Dir(#path,WITH_REDRAW);
|
Open_Dir(#path,WITH_REDRAW);
|
||||||
SelectFile(new_file_ed.text);
|
SelectFileByName(new_file_ed.text);
|
||||||
}
|
}
|
||||||
new_element_active = 0;
|
new_element_active = 0;
|
||||||
Open_Dir(#path,WITH_REDRAW);
|
Open_Dir(#path,WITH_REDRAW);
|
||||||
|
@ -183,5 +183,5 @@ void copyf_Draw_Progress(dword copying_filename) {
|
|||||||
progressbar_draw stdcall (#copy_bar);
|
progressbar_draw stdcall (#copy_bar);
|
||||||
progressbar_progress stdcall (#copy_bar);
|
progressbar_progress stdcall (#copy_bar);
|
||||||
//copy_bar.value++;
|
//copy_bar.value++;
|
||||||
pause(100);
|
//pause(10);
|
||||||
}
|
}
|
@ -2,7 +2,7 @@
|
|||||||
dword col_palette[14] = {0xD2D3D3,0xD4D4D4,0xD6D5D6,0xD8D7D8,0xDAD8D9,0xDCDADB,
|
dword col_palette[14] = {0xD2D3D3,0xD4D4D4,0xD6D5D6,0xD8D7D8,0xDAD8D9,0xDCDADB,
|
||||||
0xDFDCDD,0xE1DDDE,0xE2DEE0,0xE4DFE1,0xE3DFE1,0xE3DFE1,0xE3DFE1,0xE3DFE1,0xE3DFE1};
|
0xDFDCDD,0xE1DDDE,0xE2DEE0,0xE4DFE1,0xE3DFE1,0xE3DFE1,0xE3DFE1,0xE3DFE1,0xE3DFE1};
|
||||||
|
|
||||||
void Scroll() {
|
void Scroll(char scroll_used) {
|
||||||
dword i;
|
dword i;
|
||||||
|
|
||||||
word sc_x = Form.cwidth - 18;
|
word sc_x = Form.cwidth - 18;
|
||||||
|
@ -14,13 +14,16 @@ struct llist
|
|||||||
int count, visible, first, current; //visible = row_max
|
int count, visible, first, current; //visible = row_max
|
||||||
int active;
|
int active;
|
||||||
void ClearList();
|
void ClearList();
|
||||||
int ProcessKey(dword key);
|
|
||||||
int MouseOver(int xx, yy);
|
int MouseOver(int xx, yy);
|
||||||
int ProcessMouse(int xx, yy);
|
int ProcessMouse(int xx, yy);
|
||||||
|
int ProcessKey(dword key);
|
||||||
int KeyDown();
|
int KeyDown();
|
||||||
int KeyUp();
|
int KeyUp();
|
||||||
int KeyHome();
|
int KeyHome();
|
||||||
int KeyEnd();
|
int KeyEnd();
|
||||||
|
int KeyPgDown();
|
||||||
|
int KeyPgUp();
|
||||||
|
void CheckDoesValuesOkey();
|
||||||
void SetSizes(int xx, yy, ww, hh, min_hh, line_hh);
|
void SetSizes(int xx, yy, ww, hh, min_hh, line_hh);
|
||||||
int MouseScroll(dword scroll_state);
|
int MouseScroll(dword scroll_state);
|
||||||
int MouseScrollNoSelection(dword scroll_state);
|
int MouseScrollNoSelection(dword scroll_state);
|
||||||
@ -30,14 +33,10 @@ struct llist
|
|||||||
|
|
||||||
void llist::debug_values()
|
void llist::debug_values()
|
||||||
{
|
{
|
||||||
debug("current: ");
|
char yi[128];
|
||||||
debugi(current);
|
sprintf(#yi, "%s %d %s %d %s %d %s %d", "current:", current, "first:", first,
|
||||||
debug("first: ");
|
"visible:", visible, "count:", count);
|
||||||
debugi(first);
|
debugln(#yi);
|
||||||
debug("visible: ");
|
|
||||||
debugi(visible);
|
|
||||||
debug("count: ");
|
|
||||||
debugi(count);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -56,7 +55,7 @@ void llist::SetSizes(int xx, yy, ww, hh, min_hh, line_hh)
|
|||||||
h = hh;
|
h = hh;
|
||||||
min_h = min_hh;
|
min_h = min_hh;
|
||||||
line_h = line_hh;
|
line_h = line_hh;
|
||||||
text_y = line_hh / 2 - 4;
|
text_y = line_h / 2 - 4;
|
||||||
visible = h / line_h;
|
visible = h / line_h;
|
||||||
column_max = w / 6;
|
column_max = w / 6;
|
||||||
//if (visible > count) visible=count;
|
//if (visible > count) visible=count;
|
||||||
@ -128,6 +127,8 @@ int llist::ProcessKey(dword key)
|
|||||||
case ASCII_KEY_UP: return KeyUp();
|
case ASCII_KEY_UP: return KeyUp();
|
||||||
case ASCII_KEY_HOME: return KeyHome();
|
case ASCII_KEY_HOME: return KeyHome();
|
||||||
case ASCII_KEY_END: return KeyEnd();
|
case ASCII_KEY_END: return KeyEnd();
|
||||||
|
case ASCII_KEY_PGUP: return KeyPgUp();
|
||||||
|
case ASCII_KEY_PGDN: return KeyPgDown();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -136,47 +137,82 @@ int llist::KeyDown()
|
|||||||
{
|
{
|
||||||
if (current-first+1<visible)
|
if (current-first+1<visible)
|
||||||
{
|
{
|
||||||
if (current+1>=count) return 0;
|
if (current + 1 >= count) return 0;
|
||||||
current++;
|
current++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (visible+first>=count) return 0;
|
if (visible + first >= count) return 0;
|
||||||
first++;
|
first++;
|
||||||
current++;
|
current++;
|
||||||
}
|
}
|
||||||
|
if (current < first) || (current > first + visible)
|
||||||
|
{
|
||||||
|
first = current;
|
||||||
|
CheckDoesValuesOkey();
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int llist::KeyUp()
|
int llist::KeyUp()
|
||||||
{
|
{
|
||||||
if (current>first)
|
if (current > first)
|
||||||
{
|
{
|
||||||
current--;
|
current--;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (first==0) return 0;
|
if (first == 0) return 0;
|
||||||
first--;
|
first--;
|
||||||
current--;
|
current--;
|
||||||
}
|
}
|
||||||
|
if (current < first) || (current > first + visible)
|
||||||
|
{
|
||||||
|
first = current;
|
||||||
|
CheckDoesValuesOkey();
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int llist::KeyHome()
|
int llist::KeyHome()
|
||||||
{
|
{
|
||||||
if (current==0) && (first==0) return 0;
|
if (current==0) && (first==0) return 0;
|
||||||
current=0;
|
current = first = 0;
|
||||||
first=0;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int llist::KeyEnd()
|
int llist::KeyEnd()
|
||||||
{
|
{
|
||||||
if (current==count-1) && (first==count-visible) return 0;
|
if (current==count-1) && (first==count-visible) return 0;
|
||||||
current=count-1;
|
current = count-1;
|
||||||
first=count-visible;
|
first = count - visible;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int llist::KeyPgUp()
|
||||||
|
{
|
||||||
|
if (count <= visible) return KeyHome();
|
||||||
|
if (first == 0) return 0;
|
||||||
|
first -= visible;
|
||||||
|
CheckDoesValuesOkey();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int llist::KeyPgDown()
|
||||||
|
{
|
||||||
|
if (count <= visible) return KeyEnd();
|
||||||
|
if (first == count - visible) return 0;
|
||||||
|
first += visible;
|
||||||
|
CheckDoesValuesOkey();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void llist::CheckDoesValuesOkey()
|
||||||
|
{
|
||||||
|
if (first < 0) first = 0;
|
||||||
|
if (visible + first > count) first = count - visible;
|
||||||
|
if (current >= count) current = count - 1;
|
||||||
|
if (current < 0) current = 0;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in New Issue
Block a user