mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-11-28 11:43:09 +03:00
eolite some code optimizations
git-svn-id: svn://kolibrios.org@2266 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
c291018d79
commit
a98a757c38
@ -42,7 +42,7 @@ byte PathHistory[4096];
|
||||
dword file_mas[6898];
|
||||
int j, i, mouse_dd;
|
||||
|
||||
dword stak[100]=0; //îêíî About
|
||||
dword stak[100]; //îêíî About
|
||||
|
||||
edit_box edit1= {250,247,13,0xffffff,videlenie,0xD3DDEB,0xffffff,0,248,#edit_path,#mouse_dd,64,6,6};
|
||||
edit_box edit2= {250,213,80,0xFFFFCC,videlenie,0xFFFFCC,0xffffff,0,248,#file_name,#mouse_dd,64,6,6};
|
||||
@ -51,7 +51,8 @@ proc_info Form;
|
||||
dword buf, off; //äëÿ òåêñòà è áóôåðà
|
||||
dword devbuf, dev_num;
|
||||
|
||||
#include "include\LVabout.h--"
|
||||
#include "include\about_dialog.h--"
|
||||
#include "include\some_code.h--"
|
||||
#include "include\sorting.h--"
|
||||
#include "include\icons_f.h--"
|
||||
#include "include\ini.h--"
|
||||
@ -87,7 +88,6 @@ void Devices()
|
||||
WriteText(45,i*16+79,0x80,0,#drive_name,0);
|
||||
PutImage(dev_icon*14*13*3+#devices,14,13,21,i*16+76);
|
||||
}
|
||||
Actions(); //ôóíêöèè ôàéëîâ è ïàïîê
|
||||
}
|
||||
|
||||
void main()
|
||||
@ -387,6 +387,7 @@ inline fastcall void draw_window()
|
||||
DrawRegion_3D(1,40,Form.width-12,onTop(46,0),0x94AECE,0x94AECE); //ñèíèé îáîäîê
|
||||
DrawRegion_3D(0,39,Form.width-10,onTop(44,0),0xE4DFE1,0xE4DFE1); //ôîí
|
||||
Devices(); //ïàíåëü ñëåâà íà ñèíåì ôîíå
|
||||
Actions(); //ôóíêöèè ôàéëîâ è ïàïîê
|
||||
//SortButtons
|
||||
DrawFlatButton(192,40,onLeft(192,168),16,31,0xE4DFE1,"File");
|
||||
DrawFlatButton(onLeft(168,0),40,73,16,32,0xE4DFE1,"Type");
|
||||
@ -598,7 +599,7 @@ inline Sorting()
|
||||
//Ñîáñòâåííî ñîðòèðîâêà: âíà÷àëå ïàïêè, ïîòîì ôàéëû
|
||||
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==2) Sort_by_Type(k,count-1);
|
||||
IF (sort_num==3) Sort_by_Size(k,count-1);
|
||||
//åñëè ïàïêà ".." íå ïåðâàÿ, ñòàâèì å¸ òóäà
|
||||
IF (k>0) && (strcmp(file_mas[0]*304+buf+72,"..")<>0) FOR(k=k-1; k>0; k--;) IF (!strcmp(file_mas[k]*304+buf+72,"..")) file_mas[k]><file_mas[0];
|
||||
|
@ -2,10 +2,6 @@
|
||||
|
||||
#include "imgs\logo.txt"
|
||||
|
||||
#define REDRAW 1
|
||||
#define ANIM 2
|
||||
#define NOTIP 3
|
||||
|
||||
#define BROWSER_PATH "/sys/htmlv"
|
||||
#define BROWSER_LINK "http://www.kolibri-os.narod.ru"
|
||||
|
||||
@ -25,24 +21,18 @@ void authors()
|
||||
IF (mm.lkm) {DrawRegion_3D(86,191,68,20,0xC7C7C7,0xFFFFFF); letitclose=1;}
|
||||
ELSE {IF (letitclose) {DrawRegion_3D(86,191,68,20,0xFFFFFF,0xC7C7C7); Pause(7); ExitProcess();}}
|
||||
ELSE IF (letitclose) {letitclose=0; DrawRegion_3D(86,191,68,20,0xFFFFFF,0xC7C7C7);}
|
||||
|
||||
/*WHILE (mm.lkm==1) //àíèìàöûÿ Ûûûû)))
|
||||
{
|
||||
PutPaletteImage(p*16*15+#ficons,16,15,30,192,#ficons_pal);
|
||||
IF (p>23) p=0; ELSE p++;
|
||||
Pause(25);
|
||||
mm.get();
|
||||
}*/
|
||||
|
||||
break;
|
||||
|
||||
case evButton:
|
||||
id=GetButtonID();
|
||||
IF (id==1) ExitProcess();
|
||||
IF (id==23) RunProgram(BROWSER_PATH, BROWSER_LINK);
|
||||
break;
|
||||
|
||||
case evKey:
|
||||
IF (GetKey()==27) ExitProcess();
|
||||
break;
|
||||
|
||||
case evReDraw:
|
||||
DefineAndDrawWindow(500,200,181,256,0x34,0x10EFEBEF,0,0,"About Eolite");
|
||||
DrawBar(0,0,172,50,0x8494C4); //ãîëóáîå ñçàäè
|
||||
@ -63,57 +53,4 @@ void DrawLink(dword x,y,btn_id, inscription)
|
||||
WriteText(x,y,0x80,0x4E00E7,inscription,0);
|
||||
DrawBar(x,y+8,strlen(inscription)*6,1,0x4E00E7); //ïîä÷åðêíóòü ññûëêó
|
||||
DefineButton(x-1,y-1,strlen(inscription)*6,10,btn_id+BT_HIDE,0);
|
||||
}
|
||||
|
||||
|
||||
#define add_new_path 1
|
||||
#define go_back 2
|
||||
|
||||
void HistoryPath(byte action)
|
||||
{
|
||||
if (action==add_new_path)
|
||||
{
|
||||
IF (strcmp(#PathHistory+find_symbol(#PathHistory,'|'),#path)==0) return;
|
||||
IF (strlen(#PathHistory)+strlen(#path)>2560)
|
||||
{
|
||||
copystr(#PathHistory+1024,#PathHistory);
|
||||
copystr("/",#PathHistory+strlen(#PathHistory));
|
||||
}
|
||||
copystr("|",#PathHistory+strlen(#PathHistory));
|
||||
copystr(#path,#PathHistory+strlen(#PathHistory));
|
||||
}
|
||||
if (action==go_back)
|
||||
{
|
||||
i=strlen(#PathHistory)-1;
|
||||
WHILE (PathHistory[i]<>'|') { i--; };
|
||||
IF (i>0) PathHistory[i]=0x00;
|
||||
WHILE (PathHistory[i]<>'|') { copystr(#PathHistory[i],#path); i--; }
|
||||
IF (i>0) PathHistory[i]=0x00;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
dword onLeft(dword right,left) {EAX=Form.width-right-left;}
|
||||
dword onTop(dword down,up) {EAX=Form.height-GetSkinWidth()-down-up;}
|
||||
|
||||
|
||||
void ShowMessage(dword message)
|
||||
{
|
||||
DrawFlatButton(Form.width/2-13,160,200,80,0,0xFFB6B5, message);
|
||||
Pause(150);
|
||||
List_ReDraw();
|
||||
}
|
||||
|
||||
|
||||
dword ConvertSize(dword bytes)
|
||||
{
|
||||
byte size_prefix[8], temp[3];
|
||||
IF (bytes>=1073741824) copystr(" Gb",#temp);
|
||||
ELSE IF (bytes>=1048576) copystr(" Mb",#temp);
|
||||
ELSE IF (bytes>=1024) copystr(" Kb",#temp);
|
||||
ELSE copystr(" b ",#temp);
|
||||
WHILE (bytes>1023) bytes/=1024;
|
||||
copystr(IntToStr(bytes),#size_prefix);
|
||||
copystr(#temp,#size_prefix+strlen(#size_prefix));
|
||||
EAX=#size_prefix;
|
||||
}
|
||||
}
|
@ -232,7 +232,6 @@ void IconFairing(int filenum, y)
|
||||
DrawBar(195,y+13,4,1,videlenie);
|
||||
DrawBar(195,y+14,6,1,videlenie);
|
||||
|
||||
|
||||
DrawBar(195+11,y,5,1,videlenie);
|
||||
DrawBar(195+13,y+1,3,1,videlenie);
|
||||
DrawBar(195+14,y+2,2,1,videlenie);
|
||||
|
53
programs/fs/Eolite/trunk/include/some_code.h--
Normal file
53
programs/fs/Eolite/trunk/include/some_code.h--
Normal file
@ -0,0 +1,53 @@
|
||||
//Leency - 2011
|
||||
|
||||
#define add_new_path 1
|
||||
#define go_back 2
|
||||
|
||||
void HistoryPath(byte action)
|
||||
{
|
||||
if (action==add_new_path)
|
||||
{
|
||||
IF (strcmp(#PathHistory+find_symbol(#PathHistory,'|'),#path)==0) return;
|
||||
IF (strlen(#PathHistory)+strlen(#path)>2560)
|
||||
{
|
||||
copystr(#PathHistory+1024,#PathHistory);
|
||||
copystr("/",#PathHistory+strlen(#PathHistory));
|
||||
}
|
||||
copystr("|",#PathHistory+strlen(#PathHistory));
|
||||
copystr(#path,#PathHistory+strlen(#PathHistory));
|
||||
}
|
||||
if (action==go_back)
|
||||
{
|
||||
i=strlen(#PathHistory)-1;
|
||||
WHILE (PathHistory[i]<>'|') { i--; };
|
||||
IF (i>0) PathHistory[i]=0x00;
|
||||
WHILE (PathHistory[i]<>'|') { copystr(#PathHistory[i],#path); i--; }
|
||||
IF (i>0) PathHistory[i]=0x00;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
dword onLeft(dword right,left) {EAX=Form.width-right-left;}
|
||||
dword onTop(dword down,up) {EAX=Form.height-GetSkinWidth()-down-up;}
|
||||
|
||||
|
||||
void ShowMessage(dword message)
|
||||
{
|
||||
DrawFlatButton(Form.width/2-13,160,200,80,0,0xFFB6B5, message);
|
||||
Pause(150);
|
||||
List_ReDraw();
|
||||
}
|
||||
|
||||
|
||||
dword ConvertSize(dword bytes)
|
||||
{
|
||||
byte size_prefix[8], temp[3];
|
||||
IF (bytes>=1073741824) copystr(" Gb",#temp);
|
||||
ELSE IF (bytes>=1048576) copystr(" Mb",#temp);
|
||||
ELSE IF (bytes>=1024) copystr(" Kb",#temp);
|
||||
ELSE copystr(" b ",#temp);
|
||||
WHILE (bytes>1023) bytes/=1024;
|
||||
copystr(IntToStr(bytes),#size_prefix);
|
||||
copystr(#temp,#size_prefix+strlen(#size_prefix));
|
||||
EAX=#size_prefix;
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
|
||||
void Sort_by_Size(int a, b) // äëÿ ïåðâîãî âûçîâà: a = 0, b = <ýëåìåíòîâ â ìàññèâå> - 1
|
||||
{
|
||||
int i= a;
|
||||
int i = a;
|
||||
IF (a >= b) return;
|
||||
FOR (j = a; j <= b; j++)
|
||||
IF (ESDWORD[file_mas[j]*304 + buf+64] <= ESDWORD[file_mas[b]*304 + buf+64])
|
||||
@ -25,7 +25,11 @@ void Sort_by_Name(int a, b) //
|
||||
|
||||
void Sort_by_Type(int a, b) // äëÿ ïåðâîãî âûçîâà: a = 0, b = <ýëåìåíòîâ â ìàññèâå> - 1
|
||||
{
|
||||
int i=a; dword offset=buf+72; byte filename1[256], filename2[256]; int n;
|
||||
int i=a;
|
||||
int n;
|
||||
dword offset=buf+72;
|
||||
byte filename1[256], filename2[256];
|
||||
|
||||
IF (a >= b) return;
|
||||
for (j = a; j <= b; j++)
|
||||
{
|
||||
|
@ -11,6 +11,7 @@ dword alloc_mem = 0x00100000;
|
||||
dword x86esp_reg = 0x00100000; // 0x0007fff0;
|
||||
dword I_Param = #param;
|
||||
dword I_Path = #program_path;
|
||||
|
||||
char param[4096]="";
|
||||
char program_path[4096]="";
|
||||
|
||||
@ -37,7 +38,7 @@ struct mouse{
|
||||
void get();
|
||||
};
|
||||
|
||||
int TestBit(EAX, CL)
|
||||
inline fastcall int TestBit(EAX, CL)
|
||||
{
|
||||
$shr eax,cl
|
||||
$and eax,1
|
||||
@ -95,14 +96,14 @@ void proc_info::GetInfo(dword EBX, ECX)
|
||||
$int 0x40
|
||||
}
|
||||
|
||||
int GetSlot(dword ECX)
|
||||
inline fastcall int GetSlot(dword ECX)
|
||||
{
|
||||
EAX = 18;
|
||||
EBX = 21;
|
||||
$int 0x40
|
||||
}
|
||||
|
||||
int ActiveProcess()
|
||||
inline fastcall int ActiveProcess()
|
||||
{
|
||||
EAX = 18;
|
||||
EBX = 7;
|
||||
@ -156,21 +157,21 @@ inline fastcall void Pause(dword EBX){
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void DefineAndDrawWindow(dword x,y,sizeX,sizeY,
|
||||
byte mainAreaType, dword mainAreaColor,byte headerType,dword headerColor,EDI)
|
||||
void DefineAndDrawWindow(dword x,y,sizeX,sizeY,byte mainAreaType,
|
||||
dword mainAreaColour,byte headerType,dword headerColour,EDI)
|
||||
{
|
||||
EAX = 12;
|
||||
EAX = 12; // function 12:tell os about windowdraw
|
||||
EBX = 1;
|
||||
$int 0x40
|
||||
|
||||
EBX = x << 16 + sizeX;
|
||||
ECX = y << 16 + sizeY;
|
||||
EDX = mainAreaType << 24 | mainAreaColor;
|
||||
ESI = headerType << 24 | headerColor;
|
||||
EDX = mainAreaType << 24 | mainAreaColour;
|
||||
ESI = headerType << 24 | headerColour;
|
||||
$xor eax,eax
|
||||
$int 0x40
|
||||
|
||||
EAX = 12;
|
||||
|
||||
EAX = 12; // function 12:tell os about windowdraw
|
||||
EBX = 2;
|
||||
$int 0x40
|
||||
}
|
||||
@ -366,7 +367,7 @@ void PutImage(dword EBX,w,h,x,y)
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/*void WriteDebug(dword EDX)
|
||||
inline fastcall void WriteDebug(dword EDX)
|
||||
{
|
||||
$mov eax, 63
|
||||
$mov ebx, 1
|
||||
@ -402,4 +403,4 @@ inline fastcall void WriteFullDebug(dword ESI)
|
||||
WriteDebug(IntToStr(za_kadrom));
|
||||
|
||||
Pause(200);
|
||||
}*/
|
||||
}
|
Loading…
Reference in New Issue
Block a user