Eolite 1.98.8: simplify filenames, move menu to llist structure

git-svn-id: svn://kolibrios.org@4042 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2013-10-16 23:48:20 +00:00
parent 4ab50d25b8
commit 45af0d5563
10 changed files with 103 additions and 45 deletions

View File

@ -76,8 +76,8 @@
enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir
#define TITLE "Eolite File Manager v1.98.7" #define TITLE "Eolite File Manager v1.98.8"
#define ABOUT_TITLE "Eolite v1.98.7" #define ABOUT_TITLE "Eolite v1.98.8"
dword col_work = 0xE4DFE1; dword col_work = 0xE4DFE1;
dword col_border = 0x9098B0; //A0A0B8; //0x819FC5; dword col_border = 0x9098B0; //A0A0B8; //0x819FC5;
dword col_padding = 0xC8C9C9; dword col_padding = 0xC8C9C9;
@ -116,15 +116,16 @@ edit_box edit2 = {250,213,80,0xFFFFCC,0x94AECE,0xFFFFCC,0xffffff,0,248,#file_nam
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};
#include "include\copypaste.h" #include "include\copy.h"
#include "include\some_code.h" #include "include\other.h"
#include "include\sorting.h" #include "include\sorting.h"
#include "include\icons_f.h" #include "include\icons.h"
#include "include\ini.h" #include "include\ini.h"
#include "include\left_panel.h" #include "include\left_panel.h"
#include "include\history.h" #include "include\history.h"
#include "include\file_menu.h" #include "include\menu.h"
#include "include\about_dialog.h" #include "include\about.h"
#include "include\open_with.h"
void main() void main()
{ {
@ -158,12 +159,12 @@ void main()
if (m.x > files.x) && (m.x < files.x + files.w) && (m.y > files.y) && (m.y < files.y+files.h) && (!can_select) if (m.x > files.x) && (m.x < files.x + files.w) && (m.y > files.y) && (m.y < files.y+files.h) && (!can_select)
{ {
m_selected = m.y - 57 / files.line_h; m_selected = m.y - files.y / files.line_h;
if (m.lkm) can_select = 1; if (m.lkm) can_select = 1;
if (m.pkm) if (m.pkm)
{ {
can_show = 1; can_show = 1;
if (m.y - 57 / files.line_h != files.current) can_select = 1; if (m.y - files.y / files.line_h != files.current) can_select = 1;
} }
} }
@ -171,9 +172,9 @@ void main()
if (!m.lkm) && (!m.pkm) && (can_select) if (!m.lkm) && (!m.pkm) && (can_select)
{ {
can_select = 0; can_select = 0;
if (m.y>=57) if (m.y>=files.y)
{ {
id = m.y - 57 / files.line_h; id = m.y - files.y / files.line_h;
if (id!=m_selected) if (id!=m_selected)
{ {
can_show=0; can_show=0;
@ -193,7 +194,7 @@ void main()
if (!m.pkm) && (!m.lkm) && (can_show) if (!m.pkm) && (!m.lkm) && (can_show)
{ {
can_show = 0; can_show = 0;
if (m.y>=57) if (m.y>=files.y)
{ {
SwitchToAnotherThread(); SwitchToAnotherThread();
CreateThread(#FileMenu,#menu_stak); CreateThread(#FileMenu,#menu_stak);
@ -209,7 +210,7 @@ void main()
break; break;
} }
if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>40) && (m.y<57) if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>40) && (m.y<files.y)
{ {
IF (m.lkm==1) DrawRectangle3D(onLeft(26,0),41,14,14,0xC7C7C7,0xFFFFFF); IF (m.lkm==1) DrawRectangle3D(onLeft(26,0),41,14,14,0xC7C7C7,0xFFFFFF);
WHILE (m.lkm==1) && (files.first>0) WHILE (m.lkm==1) && (files.first>0)
@ -241,11 +242,11 @@ void main()
if (scroll_used) if (scroll_used)
{ {
IF (scroll_size/2+57>m.y) || (m.y<0) || (m.y>4000) m.y=scroll_size/2+57; //anee eo?ni? iaa ieiii IF (scroll_size/2+files.y>m.y) || (m.y<0) || (m.y>4000) m.y=scroll_size/2+files.y; //anee eo?ni? iaa ieiii
id=files.first; id=files.first;
j= scroll_size/2; j= scroll_size/2;
files.first = m.y -j -57 * files.count; files.first = m.y -j -files.y * files.count;
files.first /= onTop(22,57); files.first /= onTop(22,files.y);
IF (files.visible+files.first>files.count) files.first=files.count-files.visible; IF (files.visible+files.first>files.count) files.first=files.count-files.visible;
IF (id!=files.first) List_ReDraw(); IF (id!=files.first) List_ReDraw();
} }
@ -406,8 +407,8 @@ void main()
} }
break; break;
case evReDraw: case evReDraw:
if (action_buf) { menu_action(action_buf); action_buf=0;}
draw_window(); draw_window();
if (action_buf) { menu_action(action_buf); action_buf=0;}
} }
} }
@ -419,7 +420,12 @@ void menu_action(dword id)
SelectFile(#copy_to+strrchr(#copy_to,'/')); SelectFile(#copy_to+strrchr(#copy_to,'/'));
} }
if (id==100) Open(); if (id==100) Open();
if (id==201) notify("Not compleated yet"); if (id==201)
{
pause(10);
SwitchToAnotherThread();
CreateThread(#OpenWith,#open_with_stak);
}
if (id==202) FnProcess(3); //F3 if (id==202) FnProcess(3); //F3
if (id==203) FnProcess(4); //F4 if (id==203) FnProcess(4); //F4
if (id==104) Copy(#file_path, NOCUT); if (id==104) Copy(#file_path, NOCUT);
@ -459,7 +465,7 @@ void draw_window()
DrawFlatButton(files.x,40,onLeft(files.x,168),16,31,col_work,T_FILE); DrawFlatButton(files.x,40,onLeft(files.x,168),16,31,col_work,T_FILE);
DrawFlatButton(onLeft(168,0),40,73,16,32,col_work,T_TYPE); DrawFlatButton(onLeft(168,0),40,73,16,32,col_work,T_TYPE);
DrawFlatButton(onLeft(95,0),40,68,16,33,col_work,T_SIZE); DrawFlatButton(onLeft(95,0),40,68,16,33,col_work,T_SIZE);
DrawBar(onLeft(27,0),57,1,onTop(22,57),col_border); //line to the left from the scroll DrawBar(onLeft(27,0),files.y,1,onTop(22,files.y),col_border); //line to the left from the scroll
DrawFlatButton(onLeft(27,0),40,16,16,0,col_work,"\x18"); DrawFlatButton(onLeft(27,0),40,16,16,0,col_work,"\x18");
DrawFlatButton(onLeft(27,0),onTop(22,0),16,16,0,col_work,"\x19"); DrawFlatButton(onLeft(27,0),onTop(22,0),16,16,0,col_work,"\x19");
Open_Dir(#path,ONLY_SHOW); Open_Dir(#path,ONLY_SHOW);
@ -552,7 +558,7 @@ void Line_ReDraw(dword color, filenum){
dword text_col=0, dword text_col=0,
name_len=0, name_len=0,
attr, attr,
y=filenum*files.line_h+57; y=filenum*files.line_h+files.y;
DrawBar(files.x,y,3,files.line_h,color); DrawBar(files.x,y,3,files.line_h,color);
DrawBar(files.x+19,y,files.w-19,files.line_h,color); DrawBar(files.x+19,y,files.w-19,files.line_h,color);
DrawBar(files.x+3,y+17,16,1,color); DrawBar(files.x+3,y+17,16,1,color);
@ -904,4 +910,5 @@ stop:
char about_stak[512]; char about_stak[512];
char menu_stak[512]; char menu_stak[512];
char open_with_stak[512];
char copy_stak[4096]; char copy_stak[4096];

View File

@ -0,0 +1 @@
0x00FCCEFC,0x005C627C,0x00CCCCD0,0x00FCFDFC,0x00848AA4,0x009498AF,0x00E4E2E4,0x00F4F4FA,0x009CA4B6,0x00ABAEBC,0x007C829C,0x00ECEDEE,0x00C4C2C9,0x00E4E5EC,0x00DBDCE4,0x00D4D3DA,0x00C4C6D4,0x00FCB694,0x00D7E2EF,0x00BCBECC,0x00FC9D73,0x005C7A9C,0x005C7AA4,0x00647EA4,0x008CA2BC,0x00E4EBF0,0x00CCD5D9,0x007896B8,0x00BCC2D4,0x00D4EAFC,0x00C4CBD1,0x00CCDBE4,0x006C86A7,0x00ECF2F3,0x00DCF0FC,0x00748EAC,0x00B5E2FC,0x00C4DEFC,0x00B9CDE4,0x007CAADA,0x00ABB2C4,0x006492CC,0x005484B8,0x005C89BC,0x009CADC4,0x006482A4,0x00A47868,0x00644A44,0x007C603C,0x006C4F26,0x00644E44,0x00FCFD9F,0x00BA9D40,0x00FCE274,0x00FCDE60,0x00C4A650,0x00ECD274,0x00A29880,0x00FCC354,0x00ECB847,0x00FCF2F5,0x00E4AA54,0x00DCA24C,0x009B6A55,0x00543A34,0x0074799A,0x006EBEE0,0x007CBAE4,0x00A4CAF4,0x00040204,0x00F43E4C,0x0044CE3C,0x00047CBC,0x00FCC24C,0x009C8E74,0x00FCBB3C,0x00C4B6A4,0x007B828A,0x00C48A34,0x0054463C,0x00AB5A04,0x00FCE8A1,0x00AC6A14,0x00F4EED4,0x00FBD65C,0x00FCCA34,0x00ECB624,0x0034120C,0x00D2A226,0x00AEC5DA,0x007C9DCC,0x00B4DEF4,0x00578FC4,0x0094BAE4,0x00ECFEFC,0x0084AAD4,0x002C72BD,0x00A4C6EA,0x00518AC2,0x00447EBC,0x002669B1,0x008BB5E0,0x00BCD2EC,0x001C62AC,0x006C9CC9,0x003C7AB4,0x0064718B,0x00C6CBE2,0x008496BC,0x00EC8D99,0x00D49694,0x00949392,0x00CC8387,0x00BC7A24,0x00BC6A1C,0x00E7C267,0x008C5A14,0x00D59A52,0x00B0722C,0x00F0DAB4,0x00B45A04,0x008C522C,0x00CC923F,0x009C5204,0x00945204,0x00CC9A14,0x00FCFBD3,0x00FCF6BC,0x00FCDE98,0x00FCEAC4,0x00FCDA84,0x00F4D67C,0x00F4D27C,0x00DCBA54,0x007CBE7C,0x001C8E1C,0x00A98D04,0x001C8204,0x0090D280,0x00147E04,0x002C9018,0x00BCFAAC,0x003CC234,0x00C49204,0x00488404,0x0054AE4C,0x00C8F7A4,0x0084F26C,0x005CE64C,0x0024AE1C,0x00F8E4B4,0x00B4D6A4,0x0049A939,0x00E4FED4,0x00A8F694,0x004CDA44,0x0044E63C,0x00149E0C,0x00848204,0x0097B951,0x005C9D2F,0x006FCB4C,0x008CE264,0x004C9A24,0x00749224,0x00ECCA7C,0x00DCBE74,0x00349E2C,0x005CAE3C,0x0084B64C,0x00D0EC90,0x0084C73F,0x009CDA64,0x0070B63C,0x00BCE274,0x00C4BA4C,0x00DCB23C,0x00C4E6F4,0x0094CDC6,0x003CA674,0x0051A389,0x0074BAAC,0x002C8E64,0x0064BEDC,0x003C8E94,0x001C6E5C,0x0084AEA4,0x002489B9,0x001C6A84,0x00145A6C,0x0064827C,0x00ACBEA4,0x000C4E5C,0x004CA6CC,0x0084BAB4,0x00B4CEA4,0x00A4CEAC,0x000796D9,0x001C96CC,0x002496CC,0x0054CAFC,0x0030A6D8,0x00BC2E34,0x00247AB4,0x00946684,0x005C568C,0x00447684,0x0034867C,0x00449664,0x00A4CA94,0x00F46264,0x008C6E34,0x00ACEE64,0x006CAE34,0x00A02624,0x00E42A3C,0x00DC1A2C,0x00846224,0x00B4B2B4,0x008C4644,0x007C6634,0x00509224,0x00BBBCC3,0x00ACABAC,0x003C7A24,0x00547A44,0x00E15671,0x005C8614,0x00C44244,0x00DC4A6C,0x0084BA1C,0x0004A6F4,0x00E4627C,0x00EC7E94,0x00A47A04,0x008C8C8C,0x00848387,0x007B7C7E,0x009C9D9E,0x00A4A3AC,0x00D4CEDC,0x00FCD94A,0x00C9FEA4,0x005C6684,0x00FCCE1C,0x00FCC514,0x00464F6A,0x00F4EDFB,0x00C4BEC7,0x00515870,0x0099C5F1,0x00E4DEEC,0x00FCA274,0x00343644,0x00FC0204,0x00FCCBCC,

View File

@ -46,31 +46,36 @@ char *file_captions[] = {
void FileMenu() void FileMenu()
{ {
mouse mm; mouse mm;
word id, key, slot, index, start_y; word slot, index, start_y;
llist menu;
proc_info MenuForm; proc_info MenuForm;
int ccount=0, cur=0, newi, linew=10, lineh=18, texty; int texty, newi;
menu.ClearList();
menu.SetSizes(m.x+Form.left+5,m.y+Form.top+GetSkinHeight(),10,0,0,18);
for (index=0; file_captions[index]!=0; index+=3) for (index=0; file_captions[index]!=0; index+=3)
{ {
if (itdir) && (file_captions[index+2]>=200) continue; if (itdir) && (file_captions[index+2]>=200) continue;
if (strlen(file_captions[index])>linew) linew = strlen(file_captions[index]); if (strlen(file_captions[index])>menu.w) menu.w = strlen(file_captions[index]);
ccount++; menu.count++;
} }
linew = linew + 3 * 6 + 50; menu.w = menu.w + 3 * 6 + 50;
texty = lineh/2-4; menu.h = menu.count*menu.line_h;
texty = menu.line_h/2-4;
SetEventMask(100111b); SetEventMask(100111b);
goto _MENU_DRAW; goto _MENU_DRAW;
loop() switch(WaitEvent()) loop() switch(WaitEvent())
{ {
case evMouse: case evMouse:
slot = GetProcessSlot(MenuForm.ID); slot = GetProcessSlot(MenuForm.ID);
if (slot != GetActiveProcess()) ExitProcess(); if (slot != GetActiveProcess()) ExitProcess();
mm.get(); mm.get();
newi = mm.y - 1 / lineh; newi = mm.y - 1 / menu.line_h;
if (mm.y<=0) || (mm.y>ccount*lineh+5) || (mm.x<0) || (mm.x>linew) newi=-1; if (mm.y<=0) || (mm.y>menu.h+5) || (mm.x<0) || (mm.x>menu.w) newi=-1;
if (cur<>newi) if (menu.current<>newi)
{ {
cur=newi; menu.current=newi;
goto _ITEMS_DRAW; goto _ITEMS_DRAW;
} }
break; break;
@ -81,34 +86,34 @@ void FileMenu()
break; break;
case evKey: case evKey:
IF (GetKey()==27) ExitProcess(); if (GetKey()==27) ExitProcess();
break; break;
case evReDraw: _MENU_DRAW: case evReDraw: _MENU_DRAW:
DefineAndDrawWindow(m.x+Form.left+5,m.y+Form.top+GetSkinHeight(),linew+3,ccount*lineh+6,0x01, 0, 0, 0x01fffFFF); DefineAndDrawWindow(menu.x, menu.y,menu.w+3,menu.h+6,0x01, 0, 0, 0x01fffFFF);
GetProcessInfo(#MenuForm, SelfInfo); GetProcessInfo(#MenuForm, SelfInfo);
DrawRectangle(0,0,linew+1,ccount*lineh+2,col_border); DrawRectangle(0,0,menu.w+1,menu.h+2,col_border);
DrawBar(1,1,linew,1,0xFFFfff); DrawBar(1,1,menu.w,1,0xFFFfff);
DrawPopupShadow(1,1,linew,ccount*lineh,0); DrawPopupShadow(1,1,menu.w,menu.h,0);
_ITEMS_DRAW: _ITEMS_DRAW:
for (index=0, start_y=0; file_captions[index*3]!=0; index++) for (index=0, start_y=0; file_captions[index*3]!=0; index++)
{ {
DefineButton(1,start_y+1,linew,lineh-1,file_captions[index*3+2]+BT_HIDE+BT_NOFRAME,0xFFFFFF); DefineButton(1,start_y+1,menu.w,menu.line_h-1,file_captions[index*3+2]+BT_HIDE+BT_NOFRAME,0xFFFFFF);
if ((itdir) && (file_captions[index*3+2]>=200)) continue; if ((itdir) && (file_captions[index*3+2]>=200)) continue;
DrawBar(1,start_y+2,1,lineh,0xFFFfff); DrawBar(1,start_y+2,1,menu.line_h,0xFFFfff);
if (start_y/lineh==cur) if (start_y/menu.line_h==menu.current)
{ {
DrawBar(2,start_y+2,linew-1,lineh,0xFFFfff); DrawBar(2,start_y+2,menu.w-1,menu.line_h,0xFFFfff);
} }
else else
{ {
DrawBar(2,start_y+2,linew-1,lineh,col_work); DrawBar(2,start_y+2,menu.w-1,menu.line_h,col_work);
WriteText(8,start_y+texty+3,0x80,0xf2f2f2,file_captions[index*3]); WriteText(8,start_y+texty+3,0x80,0xf2f2f2,file_captions[index*3]);
} }
WriteText(7,start_y+texty+2,0x80,0x000000,file_captions[index*3]); WriteText(7,start_y+texty+2,0x80,0x000000,file_captions[index*3]);
WriteText(-strlen(file_captions[index*3+1])*6-6+linew,start_y+texty+2,0x80,0x888888,file_captions[index*3+1]); WriteText(-strlen(file_captions[index*3+1])*6-6+menu.w,start_y+texty+2,0x80,0x888888,file_captions[index*3+1]);
start_y+=lineh; start_y+=menu.line_h;
} }
} }
} }

View File

@ -0,0 +1,43 @@
//Leency 2013
void OpenWith()
{
?define OPEN_LIST_W 300
?define OPEN_LIST_H 300
mouse mm;
word key, slot, index, start_y;
llist app_list;
proc_info MenuForm;
int texty, newi;
app_list.ClearList();
app_list.SetSizes(files.w-OPEN_LIST_W/2+files.x+Form.left+4,files.h-OPEN_LIST_H/2+files.y+Form.top+GetSkinHeight(),OPEN_LIST_W,OPEN_LIST_H,150,18);
SetEventMask(100111b);
goto _APP_LIST_DRAW;
loop() switch(WaitEvent())
{
case evMouse:
slot = GetProcessSlot(MenuForm.ID);
if (slot != GetActiveProcess()) ExitProcess();
mm.get();
if (m.lkm) ExitProcess();
break;
case evKey:
key = GetKey();
if (key==27) ExitProcess();
break;
case evReDraw: _APP_LIST_DRAW:
DefineAndDrawWindow(app_list.x, app_list.y,app_list.w+3,app_list.h+6,0x01, 0, 0, 0x01fffFFF);
GetProcessInfo(#MenuForm, SelfInfo);
DrawPopup(0,0,app_list.w,app_list.h,0, col_work,col_border);
WriteText(10,10, 0x80, 0, "Select application to open file"w);
WriteText(10,23, 0x80, 0, #file_name);
WriteTextB(app_list.w/2-25,app_list.h/2, 0x90, 0, "S O O N");
_APP_LIST_ITEMS_DRAW:
break;
}
}

View File

@ -8,8 +8,9 @@ http://board.kolibrios.org/viewtopic.php?f=9&t=973
==Authors== ==Authors==
Leency - programming and design. Leency
Veliant - programming and support. Inactive now. Veliant
Punk_Joker
lev lev
<Lrz> <Lrz>
Nable Nable

View File

@ -17,6 +17,7 @@ http://board.kolibrios.org/viewtopic.php?f=9&t=973
==Авторы== ==Авторы==
Leency - разработка, дизайн. Leency - разработка, дизайн.
Veliant - программирование, поддержка. Veliant - программирование, поддержка.
Punk_Joker - код удаления папок, фиксы.
<Lrz> - компонент EditBox и либу к нему. <Lrz> - компонент EditBox и либу к нему.
lev - алгоритм работы с массивами строк. lev - алгоритм работы с массивами строк.
Nable - некоторые оптимизации и поддержка. Nable - некоторые оптимизации и поддержка.