Eolite: improvements for the future

git-svn-id: svn://kolibrios.org@2527 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2012-03-30 10:00:24 +00:00
parent ad3a539c49
commit c239c2aef6

View File

@ -1,8 +1,6 @@
//Leency & Veliant -=- KolibriOS Team -=- 2012
//GNU GPL licence.
//íåìíîãî êðèâàÿ ïðîêðóòêà
#include "lib\kolibri.h--"
#include "lib\memory.h--"
#include "lib\edit_box_lib.h--"
@ -10,6 +8,8 @@
#include "imgs\toolbar.txt"
#include "imgs\left_p.txt"
int BUTTON_HEIGHT=18;
//for OpenDir
#define ONLY_SHOW 0
#define WITH_REDRAW 1
@ -335,10 +335,10 @@ int pressed_y;
DeleteButton(curbtn+201); //ýòî ÷òîá ìîæíî áûëî âûäåëÿòü ìûøüþ
edit2.flags=66; //äåëàåì êîìïîíåíò àêòèâíûì
edit2.width=onLeft(24,217);
edit2.top=curbtn*18+59;
edit2.top=curbtn*BUTTON_HEIGHT+59;
edit2.size=edit2.pos=strlen(#file_name);
edit_box_draw stdcall (#edit2);
DrawBar(213,curbtn*18+58,edit2.width+1,1,0xFFFFCC); //ïîëîñà æåëòàÿ ñâåðõó äëÿ îäèíàêîâîñòè
DrawBar(213,curbtn*BUTTON_HEIGHT+58,edit2.width+1,1,0xFFFFCC); //ïîëîñà æåëòàÿ ñâåðõó äëÿ îäèíàêîâîñòè
rename_active=1;
break;
case 052: //Íàæàòà F3
@ -488,12 +488,7 @@ void FileList_ReDraw(int curbtn_)
}
List_ReDraw();
/*WriteDebug("");
WriteDebug(#path);
WriteDebug("Number of files:"); WriteDebug(IntToStr(count));
WriteDebug("but_num:"); WriteDebug(IntToStr(but_num));
WriteDebug("curbtn"); WriteDebug(IntToStr(curbtn));
WriteDebug("ra_kadrom:"); WriteDebug(IntToStr(za_kadrom));*/
//WriteFullDebug("");
}
}
}
@ -503,7 +498,7 @@ void FileList_ReDraw(int curbtn_)
void List_ReDraw()
{
int paint_x=but_num*18+57;
int paint_x=but_num*BUTTON_HEIGHT+57;
IF (count-za_kadrom<but_num) || (curbtn>but_num-1) //åñëè ìû â êîíöå ñïèñêà ôàéëîâ ðàçâåðí¸ì îêíî ïîÿâÿòüñÿ ïóñòÿå áåëûå êíîïêè
{ za_kadrom=count-but_num; curbtn=but_num-1; } //ýòî åñëè âûäåëåíèå ïîñëå ñõëîïûâàíèÿ îêíà çà êàäðîì
//
@ -518,21 +513,30 @@ void List_ReDraw()
//puticon+icon_fairing!!!
void Line_ReDraw(dword color, filenum){
dword text_col=0, temp_int,
y=filenum*18+57; //ïîëîæåíèå òåêñòà ïî Y
/*
dword text_col=0, temp_int, x,
max_x=onLeft(28,192)/BUTTON_HEIGHT,
y=filenum/max_x*BUTTON_HEIGHT+57; //ïîëîæåíèå òåêñòà ïî Y
temp_int=filenum/max_x;
temp_int=temp_int*max_x;
x=filenum-temp_int*BUTTON_HEIGHT+192;
*/
y=filenum*BUTTON_HEIGHT+57; //ïîëîæåíèå òåêñòà ïî Y
IF (rename_active==1) ReName(false);
//äà, ÿ íå ñïîðþ ÷òî èçâðàò, íî ïåðåðèñîâêà çàòî ìàëåíüêàÿ
DeleteButton(201+filenum);
DefineButton(192,y,onLeft(28,192),18,201+filenum+BT_HIDE+BT_NOFRAME,color); //êíîïà
DrawBar(192,y,3,18,color); DrawBar(195,y,16,2,color);
DrawBar(192+19,y,onLeft(46,192),18,color); DrawBar(195,y+17,16,1,color);
DefineButton(192,y,onLeft(28,192),BUTTON_HEIGHT,201+filenum+BT_HIDE+BT_NOFRAME,color); //êíîïà
DrawBar(192,y,3,BUTTON_HEIGHT,color); DrawBar(195,y,16,2,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);
//
off=file_mas[filenum+za_kadrom]*304 + buf+72;
if (TestBit(ESDWORD[off-40],1)) || (TestBit(ESDWORD[off-40],2)) text_col=0xA6A6B7;
if (!TestBit(ESDWORD[off-40],4))
{
copystr(off,#temp);
temp_int = Put_icon(#temp+find_symbol(#temp,'.'), y+2);
WriteText(7-strlen(ConvertSize(ESDWORD[off-8]))*6+onLeft(75,0),y+6,0x80,0,ConvertSize(ESDWORD[off-8]),0); //size
temp_int = Put_icon(#temp+find_symbol(#temp,'.'), BUTTON_HEIGHT-14/2+y);
WriteText(7-strlen(ConvertSize(ESDWORD[off-8]))*6+onLeft(75,0),BUTTON_HEIGHT-6/2+y,0x80,0,ConvertSize(ESDWORD[off-8]),0); //size
}
ELSE
IF (!strcmp("..",off)) temp_int=Put_icon("..", y+2);
@ -549,9 +553,9 @@ void Line_ReDraw(dword color, filenum){
}
temp_int = onLeft(215,165)/6;
IF (strlen(off)<temp_int) temp_int = strlen(off); //äëèííà íàçâàíèÿ ôàéëà
WriteText(215,y+6,0,text_col,off,temp_int); //èìÿ ôàéëà
DrawBar(onLeft(168,0),y,1,18,0xE4DFE1); //ïîëîñà ñåðàÿ âåðòèêàëüíàÿ 1
DrawBar(onLeft(95,0),y,1,18,0xE4DFE1); //ïîëîñà ñåðàÿ âåðòèêàëüíàÿ 2
WriteText(215,BUTTON_HEIGHT-6/2+y,0,text_col,off,temp_int); //èìÿ ôàéëà
DrawBar(onLeft(168,0),y,1,BUTTON_HEIGHT,0xE4DFE1); //ïîëîñà ñåðàÿ âåðòèêàëüíàÿ 1
DrawBar(onLeft(95,0),y,1,BUTTON_HEIGHT,0xE4DFE1); //ïîëîñà ñåðàÿ âåðòèêàëüíàÿ 2
}
@ -587,7 +591,7 @@ void Open_Dir(dword temp_, redraw){
HistoryPath(add_new_path);
IF (!strcmp(".",buf+72)) {memmov(buf,buf+304,count-1*304); count--;} //ôèëüòðóåì ýëåìåíò "."
FOR (j=0;j<but_num;j++) DeleteButton(201+j); //óäàëÿåì ñòàðûå
but_num=onTop(6,57)/18;
but_num=onTop(6,57)/BUTTON_HEIGHT;
IF (count<but_num) but_num=count;
//ñòðåëî÷êà ñîðòèðîâêè
IF (sort_num==1) WriteText(Form.width+60/2,45,0x80,0x4E78AC,"\x19",0);
@ -712,7 +716,7 @@ void ReName(byte rename)
char edit_name[256]='';
rename_active=0;
edit2.flags=64;
DefineButton(192,curbtn*18+57,onLeft(27,192),18,curbtn+201+BT_HIDE+BT_NOFRAME,0xFFFFFF);
DefineButton(192,curbtn*BUTTON_HEIGHT+57,onLeft(27,192),BUTTON_HEIGHT,curbtn+201+BT_HIDE+BT_NOFRAME,0xFFFFFF);
if (rename==true)
{
copystr(#path,#temp);