mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-11-28 11:43:09 +03:00
Eolite 1.1
git-svn-id: svn://kolibrios.org@2568 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
42fc2bf612
commit
56efa5dc90
@ -1,10 +1,10 @@
|
||||
//Leency & Veliant -=- KolibriOS Team -=- 2012
|
||||
//GNU GPL licence.
|
||||
|
||||
#include "lib\kolibri.h--"
|
||||
#include "lib\memory.h--"
|
||||
#include "lib\edit_box_lib.h--"
|
||||
#include "lib\file_system.h--"
|
||||
#include "lib\kolibri.h"
|
||||
#include "lib\memory.h"
|
||||
#include "lib\edit_box_lib.h"
|
||||
#include "lib\file_system.h"
|
||||
#include "imgs\toolbar.txt"
|
||||
#include "imgs\left_p.txt"
|
||||
|
||||
@ -16,9 +16,8 @@ int BUTTON_HEIGHT=18;
|
||||
#define ONLY_OPEN 2
|
||||
|
||||
//ïåðåìåííûå
|
||||
#define title "Eolite File Manager v1.0"
|
||||
#define videlenie 0x94AECE //0xFEA4B7,0x8BCDFF,0xB8C9B8}; //öâåò âûäåëåííîãî ýëåìåíòà èç ñïèñêà ôàéëîâ
|
||||
byte toolbar_buttons_x[6]={9,46,85,134,167,203};
|
||||
#define title "Eolite File Manager v1.1"
|
||||
dword videlenie=0x94AECE; //öâåò âûäåëåííîãî ýëåìåíòà èç ñïèñêà ôàéëîâ
|
||||
//
|
||||
int but_num,
|
||||
count,
|
||||
@ -31,7 +30,7 @@ byte cut_active,
|
||||
byte show_actions=1,
|
||||
sort_num=2,
|
||||
isdir;
|
||||
char path[4096]="/rd/1/",
|
||||
char path[4096],
|
||||
edit_path[4096],
|
||||
file_path[4096],
|
||||
file_name[4096],
|
||||
@ -39,76 +38,47 @@ char path[4096]="/rd/1/",
|
||||
temp[4096];
|
||||
byte PathHistory[4096];
|
||||
|
||||
int toolbar_buttons_x[6]={9,46,85,134,167,203};
|
||||
|
||||
dword file_mas[6898];
|
||||
int j, i, mouse_dd;
|
||||
|
||||
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};
|
||||
edit_box edit1= {250,247,13,0xffffff,0x94AECE,0xD3DDEB,0xffffff,0,248,#edit_path,#mouse_dd,64,6,6};
|
||||
edit_box edit2= {250,213,80,0xFFFFCC,0x94AECE,0xFFFFCC,0xffffff,0,248,#file_name,#mouse_dd,64,6,6};
|
||||
|
||||
proc_info Form;
|
||||
dword buf, off; //äëÿ òåêñòà è áóôåðà
|
||||
dword devbuf, dev_num;
|
||||
|
||||
#include "include\about_dialog.h--"
|
||||
#include "include\some_code.h--"
|
||||
#include "include\sorting.h--"
|
||||
#include "include\icons_f.h--"
|
||||
#include "include\ini.h--"
|
||||
#include "include\about_dialog.h"
|
||||
#include "include\some_code.h"
|
||||
#include "include\sorting.h"
|
||||
#include "include\icons_f.h"
|
||||
#include "include\ini.h"
|
||||
#include "include\devices.h"
|
||||
|
||||
|
||||
void Devices()
|
||||
{
|
||||
byte dev_icon;
|
||||
dword drive_name[30];
|
||||
char dev_name[4];
|
||||
|
||||
DrawBar(2,41,190,15,0x00699C); //ñèíèé ïðÿìîóãîëüíèê - ñâåðõó
|
||||
DrawBar(2,56,15,onTop(21,41),0x00699C); //ñèíèé ïðÿìîóãîëüíèê - ñëåâà
|
||||
DrawBar(177,56,15,onTop(21,41),0x00699C); //ñèíèé ïðÿìîóãîëüíèê - ñïðàâà
|
||||
//ñïèñîê äèñêîâ
|
||||
Tip(56, "Goto:", 0, "");
|
||||
for (i=0;i<dev_num;i++)
|
||||
{
|
||||
DrawBar(17,i*16+74,160,17,0xFFFFFF); //áåëîå
|
||||
DefineButton(17,i*16+74,159,16,100+i+BT_HIDE,0xFFFFFF); //ñîçäà¸ì êíîïêè, à ïîòîì âûâîäèì íàçâàíèÿ äèñêîâ
|
||||
copystr("Unknown drive",#drive_name); //èçíà÷àëüíî íåèçâåñíûé íîñèòåëü
|
||||
dev_icon=3; //ïî-óìîë÷àíèþ óñòðîéñòâî âûãëÿäèò êàê æåñòÿê
|
||||
copystr(i*304+ devbuf+72, #dev_name);
|
||||
IF (dev_name[0]=='r') { dev_icon=0; copystr("RAM-disk /rd/1",#drive_name); }
|
||||
IF (dev_name[0]=='c') { dev_icon=1; copystr("CD-drive /",#drive_name); }
|
||||
IF (dev_name[0]=='f') { dev_icon=2; copystr("Floppy disk /",#drive_name); }
|
||||
IF (dev_name[0]=='h') copystr("Hard disk drive /",#drive_name);
|
||||
IF (dev_name[0]=='b') copystr("SATA disk drive /",#drive_name);
|
||||
//
|
||||
IF (dev_icon<>0) copystr(#dev_name,#drive_name+strlen(#drive_name));
|
||||
copystr("/",#drive_name+strlen(#drive_name));
|
||||
//
|
||||
WriteText(45,i*16+79,0x80,0,#drive_name,0);
|
||||
PutImage(dev_icon*14*13*3+#devices,14,13,21,i*16+76);
|
||||
}
|
||||
}
|
||||
|
||||
void main()
|
||||
word key, id;
|
||||
mouse m;
|
||||
int pressed_y;
|
||||
{
|
||||
GetIni(1);
|
||||
//
|
||||
load_editbox_lib();
|
||||
devbuf= malloc(3112); //áóôåð ãäå-òî íà 10 äåâàéñîâ â ëåâîé ïàíåëè
|
||||
ReadDir(10, devbuf, "/");
|
||||
dev_num=EBX;
|
||||
//
|
||||
//curbtn=za_kadrom=0;
|
||||
GetSystemDiscs();
|
||||
GetIni(1);
|
||||
|
||||
edit1.shift_color=videlenie;
|
||||
edit2.shift_color=videlenie;
|
||||
|
||||
HistoryPath(add_new_path);
|
||||
IF (param[0]<>'') //áûë ëè çàïóñê ñ ïàðàìåòðîì
|
||||
{
|
||||
copystr(#param, #path);
|
||||
IF (strcmp(#path+strlen(#path)-1,"/")<>0) copystr("/",#path+strlen(#path)); //åñëè íåò, + "/"
|
||||
}
|
||||
else copystr("/rd/1/", #path);
|
||||
Open_Dir(#path,ONLY_OPEN);
|
||||
loop()
|
||||
{
|
||||
@ -167,7 +137,8 @@ int pressed_y;
|
||||
IF (scroll_size/2+57>m.y) || (m.y<0) || (m.y>4000) m.y=scroll_size/2+57; //åñëè êóðñîð íàä îêíîì
|
||||
id=za_kadrom; //ñîõðàíÿåì ñòàðîå êîëè÷åñòâî
|
||||
j= scroll_size/2;
|
||||
za_kadrom = m.y -j -57 * count; za_kadrom /= onTop(22,57);
|
||||
za_kadrom = m.y -j -57 * count;
|
||||
za_kadrom /= onTop(22,57);
|
||||
IF (but_num+za_kadrom>count) za_kadrom=count-but_num;
|
||||
IF (id<>za_kadrom) List_ReDraw(); //÷òîá ëèøíèé ðàç íå ïåðåðèñîâûâàòü
|
||||
m.get();
|
||||
@ -229,22 +200,21 @@ int pressed_y;
|
||||
break;
|
||||
case 100...120:
|
||||
DEVICE_MARK:
|
||||
copystr(id-100*304+ devbuf+72, #path);
|
||||
IF (path[0]=='r') copystr("/rd/1",#file_path);
|
||||
ELSE {
|
||||
copystr("/", #file_path);
|
||||
copystr(#path, #file_path+strlen(#file_path));
|
||||
}
|
||||
GOTO OPEN_DEV;
|
||||
//copystr(#disk_list[id-100].Item, #file_path);
|
||||
//GOTO OPEN_DEV;
|
||||
copystr(#disk_list[id-100].Item, #path);
|
||||
za_kadrom=curbtn=0;
|
||||
Open_Dir(#path,1);
|
||||
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,"..")==0) Dir_Up(); ELSE
|
||||
if (!isdir) GetIni(0); else
|
||||
if (strcmp(#file_name,"..")==0) Dir_Up(); else
|
||||
{ OPEN_DEV:
|
||||
copystr(#file_path, #path);
|
||||
copystr("/", #path+strlen(#path));
|
||||
IF (strcmp(#path+strlen(#path)-1,"/")<>0) copystr("/",#path+strlen(#path)); //åñëè íåò, + "/"
|
||||
za_kadrom=curbtn=0;
|
||||
Open_Dir(#path,1);
|
||||
}
|
||||
@ -275,7 +245,7 @@ int pressed_y;
|
||||
{
|
||||
case 209...217:
|
||||
id=key-110;
|
||||
IF (id-100>=dev_num) break;
|
||||
IF (id-100>=disc_num) break;
|
||||
GOTO DEVICE_MARK;
|
||||
case 8: //Íàçàä
|
||||
GoBack();
|
||||
@ -375,7 +345,7 @@ int pressed_y;
|
||||
|
||||
|
||||
inline fastcall void draw_window()
|
||||
{
|
||||
{
|
||||
DefineAndDrawWindow(98,90,582,482,0x73,0x10E4DFE1,0,0,title);
|
||||
Form.GetInfo(#Form, SelfInfo);
|
||||
IF (Form.status_window==4) return; //íè÷åãî íå äåëàòü åñëè îêíî ñõëîïíóòî â çàãîëîâîê
|
||||
@ -396,8 +366,8 @@ 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(); //ôóíêöèè ôàéëîâ è ïàïîê
|
||||
DrawSystemDiscs();
|
||||
Actions();
|
||||
//SortButtons
|
||||
DrawFlatButton(192,40,onLeft(192,168),16,31,0xE4DFE1,"File");
|
||||
DrawFlatButton(onLeft(168,0),40,73,16,32,0xE4DFE1,"Type");
|
||||
@ -408,6 +378,7 @@ inline fastcall void draw_window()
|
||||
DrawBar(onLeft(27,0),57,1,onTop(22,57),0x94AECE); //ëèíèÿ ñëåâà îò ïðîêðóòêè
|
||||
DrawFlatButton(onLeft(27,0),40,16,16,0,0xE4DFE1,"\x18"); //ïðîêðóòêà ââåðõ
|
||||
DrawFlatButton(onLeft(27,0),onTop(22,0),16,16,0,0xE4DFE1,"\x19");//ïðîêðóòêà âíèç
|
||||
if (del_active==1) Del_Form();
|
||||
}
|
||||
|
||||
|
||||
@ -453,13 +424,6 @@ void FileList_ReDraw(int curbtn_)
|
||||
}
|
||||
else //âíèç
|
||||
{
|
||||
/*if (count-za_kadrom-but_num==1) //ýòî çàãëóøêà
|
||||
{
|
||||
za_kadrom=count-but_num;
|
||||
curbtn=but_num-1;
|
||||
List_ReDraw();
|
||||
}*/
|
||||
|
||||
IF (za_kadrom==count-but_num) && (curbtn==but_num-1) return;
|
||||
IF (but_num-curbtn>curbtn_)
|
||||
{
|
||||
@ -470,7 +434,6 @@ void FileList_ReDraw(int curbtn_)
|
||||
}
|
||||
else
|
||||
{
|
||||
//IF(za_kadrom+but_num+curbtn_>=count) //à òóò êàæèñü áûë áàã
|
||||
IF(za_kadrom+curbtn+curbtn_>=count)
|
||||
{
|
||||
za_kadrom=count-but_num;
|
||||
@ -513,7 +476,7 @@ void List_ReDraw()
|
||||
//puticon+icon_fairing!!!
|
||||
void Line_ReDraw(dword color, filenum){
|
||||
dword text_col=0, temp_int,
|
||||
/*
|
||||
/* //ýòî ÿ ïûòàëñÿ ñäåëàòü âèä êðóïíûìè çíà÷êàìè
|
||||
dword text_col=0, temp_int, x,
|
||||
max_x=onLeft(28,192)/BUTTON_HEIGHT,
|
||||
y=filenum/max_x*BUTTON_HEIGHT+57; //ïîëîæåíèå òåêñòà ïî Y
|
||||
@ -525,26 +488,27 @@ void Line_ReDraw(dword color, filenum){
|
||||
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(195,y,16,2,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);
|
||||
//
|
||||
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,'.'), BUTTON_HEIGHT-14/2+y);
|
||||
temp_int = Put_icon(#temp+find_symbol(#temp,'.'), BUTTON_HEIGHT/2-7+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);
|
||||
IF (!strcmp("..",off)) temp_int=Put_icon("..", BUTTON_HEIGHT/2-7+y);
|
||||
ELSE
|
||||
temp_int=Put_icon("<DIR>", y+2);
|
||||
temp_int=Put_icon("<DIR>", BUTTON_HEIGHT/2-7+y);
|
||||
if (color==videlenie)
|
||||
{
|
||||
isdir=TestBit(ESDWORD[off-40], 4);
|
||||
IconFairing(temp_int, y+2); //çàêðàøèâàåì èêîíêó
|
||||
IconFairing(temp_int, BUTTON_HEIGHT/2-7+y); //çàêðàøèâàåì èêîíêó
|
||||
copystr(off,#file_name);
|
||||
copystr(#path,#file_path);
|
||||
copystr(#file_name,#file_path+strlen(#file_path)); //ïîëíûé ïóòü ê ôàéëó
|
||||
@ -607,12 +571,24 @@ void Open_Dir(dword temp_, redraw){
|
||||
inline Sorting()
|
||||
{
|
||||
dword k=0, l=1;
|
||||
IF (!strcmp(#path,"/")) {FOR(k=1;k<count;k++;)file_mas[k]=k; return;} //íå ñîðòèðîâàòü ïàïêè è íå ìåíÿòü ðåãèñòð â "/"
|
||||
if (!strcmp(#path,"/")) //íå ñîðòèðîâàòü ïàïêè è íå ìåíÿòü ðåãèñòð â "/"
|
||||
{
|
||||
FOR(k=1;k<count;k++;) file_mas[k]=k;
|
||||
return;
|
||||
}
|
||||
FOR (j=count-1, off=count-1*304+buf+32; j>=0; j--, off-=304;) //ïàïêè ââåðõ, ôàéëû âíèç
|
||||
{
|
||||
ChangeCase(off+40);
|
||||
IF (TestBit(ESDWORD[off],4)) {file_mas[k]=j; k++;}
|
||||
ELSE {file_mas[count-l]=j; l++;}
|
||||
if (TestBit(ESDWORD[off],4)) //ïàïêà?
|
||||
{
|
||||
file_mas[k]=j;
|
||||
k++;
|
||||
}
|
||||
else
|
||||
{
|
||||
file_mas[count-l]=j;
|
||||
l++;
|
||||
}
|
||||
}
|
||||
//Ñîáñòâåííî ñîðòèðîâêà: âíà÷àëå ïàïêè, ïîòîì ôàéëû
|
||||
Sort_by_Name(0,k-1);
|
||||
@ -747,15 +723,16 @@ void ReName(byte rename)
|
||||
|
||||
void Actions()
|
||||
{
|
||||
int actions_y=dev_num*16;
|
||||
int actions_y=disc_num*16;
|
||||
DrawBar(17,actions_y+75,160,15,0x00699C); //ñèíèé ïðÿìîóãîëüíèê - ïîä äåâàéñàìè
|
||||
DrawBar(17,show_actions*51+actions_y+108,160,onTop(show_actions*51+actions_y+108,6),0x00699C); //ñèíåå â êîíöå
|
||||
if (show_actions==1)
|
||||
{
|
||||
Tip(actions_y+90, "Actions", 77, "\x19");
|
||||
Tip(actions_y+90, "Actions", 77, "\x19"); //çàãîëîâîê
|
||||
DrawBar(17,actions_y+108,160,51,0xFFFFFF); //áåëîå
|
||||
PutImage(#factions,16,44,21,actions_y+113); //ïèêòîãðàìêè
|
||||
PutImage(#factions,16,44,21,actions_y+113); //èêîíêè
|
||||
//rename file
|
||||
DefineButton(22,actions_y+108,159,16,80+BT_HIDE,0xE4DFE1);
|
||||
DefineButton(17,actions_y+108,159,16,80+BT_HIDE,0xE4DFE1);
|
||||
WriteText(42,actions_y+113,0x80,0,"Rename file <F2>",0);
|
||||
//delete file
|
||||
DefineButton(17,actions_y+125,159,16,81+BT_HIDE,0xE4DFE1);
|
||||
@ -764,12 +741,13 @@ void Actions()
|
||||
DefineButton(17,actions_y+142,159,16,82+BT_HIDE,0xE4DFE1);
|
||||
WriteText(42,actions_y+147,0x80,0,"Create folder <F6>",0);
|
||||
}
|
||||
ELSE
|
||||
else
|
||||
{
|
||||
DeleteButton(80); DeleteButton(81); DeleteButton(82);
|
||||
DeleteButton(80);
|
||||
DeleteButton(81);
|
||||
DeleteButton(82);
|
||||
Tip(actions_y+90, "Actions", 77, "\x18");
|
||||
}
|
||||
DrawBar(17,show_actions*51+actions_y+108,160,onTop(show_actions*51+actions_y+108,6),0x00699C); //ñèíåå â êîíöå
|
||||
}
|
||||
|
||||
|
||||
@ -789,13 +767,8 @@ void SelectFile(dword that_file)
|
||||
za_kadrom=curbtn=0; //ââåðõ ñïèñêà
|
||||
Open_Dir(#path,ONLY_OPEN);
|
||||
ChangeCase(that_file);
|
||||
FOR (i=count-1; i>=0; i--;) IF(strcmp(file_mas[i]*304+buf+72,that_file)==0) BREAK;
|
||||
/*IF (i>but_num-1) && (i>count-but_num) //âñ¸ ýòî ïî-èäåå ìîæíî ñäåëàòü ÷åðåç FileList_ReDraw(i) èëè ÿ íåïðàâ?
|
||||
{
|
||||
za_kadrom=count-but_num;
|
||||
curbtn=i-count+but_num;
|
||||
}
|
||||
ELSE FileList_ReDraw(i);*/
|
||||
for (i=count-1; i>=0; i--;)
|
||||
if (strcmp(file_mas[i]*304+buf+72,that_file)==0) break;
|
||||
FileList_ReDraw(i);
|
||||
List_ReDraw();
|
||||
}
|
||||
|
@ -1,6 +1,19 @@
|
||||
05.04.12 -- v1.1 --16,2 Кб
|
||||
- отображение списка дисков, а не устройств в панели слева;
|
||||
- уменьшен размер программы и потребляемой памяти;
|
||||
- возможность задать цвет выделения и высоту пункта в списке файлов;
|
||||
- после перерисовки окна пропадал диалог удаления файла
|
||||
- другие мелкие исправления.
|
||||
|
||||
26.03.12 -- v1.0 --16,2 Кб
|
||||
Мелкие исправления.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
27.08.11 -- v0.99.8 RC3 -- 16.2 Кб
|
||||
- исправления в скроллбаре, баг со времён первых версий;
|
||||
- в 90% случаев не выделяло переименованый файл;
|
||||
|
@ -29,6 +29,7 @@ Rock_maniak_forever
|
||||
turbanoff
|
||||
Sorcerer
|
||||
Gluk
|
||||
lev
|
||||
|
||||
|
||||
KolibriOS Forever!
|
@ -27,6 +27,7 @@ Nable -
|
||||
Mario79 - советы.
|
||||
S1n - за реализацию работы с lib_ini (увы не используемую).
|
||||
Rock_maniak_forever, turbanoff, Sorcerer, Gluk, Albom - за найденые баги.
|
||||
lev - за алгоритм работы с массивами строк.
|
||||
|
||||
|
||||
У нас будет свой Менует с блекджеком! И шлюхами! KolibriOS Forever!
|
@ -1,5 +1,5 @@
|
||||
@..\C--\c-- Eolite.c--
|
||||
del Eolite
|
||||
rename Eolite.com Eolite
|
||||
@..\C--\kpack Eolite
|
||||
rem @..\C--\kpack Eolite
|
||||
pause
|
@ -37,7 +37,7 @@ void authors()
|
||||
DefineAndDrawWindow(600,150,181,256,0x34,0x10EFEBEF,0,0,"About Eolite");
|
||||
DrawBar(0,0,172,50,0x8494C4); //ãîëóáîå ñçàäè
|
||||
PutPaletteImage(#logo,85,85,43,7,#logo_pal);
|
||||
WriteText(54,100,0x80,0xBF40BF,"Eolite v1.0",0);
|
||||
WriteText(54,100,0x80,0xBF40BF,"Eolite v1.1",0);
|
||||
WriteText(55,120,0x80,0,"Developers:",0);
|
||||
WriteText(39,130,0x80,0,"Leency & Veliant",0);
|
||||
WriteText(30,140,0x80,0,"Diamond, Lrz, Nable",0);
|
70
programs/fs/Eolite/trunk/include/devices.h
Normal file
70
programs/fs/Eolite/trunk/include/devices.h
Normal file
@ -0,0 +1,70 @@
|
||||
//03.04.2012
|
||||
|
||||
struct string {
|
||||
char Item[4096];
|
||||
};
|
||||
|
||||
string disk_list[20];
|
||||
int disc_num;
|
||||
|
||||
|
||||
void GetSystemDiscs()
|
||||
{
|
||||
char dev_name[10], sys_discs[10];
|
||||
int i1, j1, dev_num, dev_disc_num;
|
||||
dword devbuf;
|
||||
|
||||
devbuf= malloc(3112); //áóôåð ãäå-òî íà 10 äåâàéñîâ â ëåâîé ïàíåëè
|
||||
ReadDir(10, devbuf, "/");
|
||||
dev_num = EBX;
|
||||
for (i1=0; i1<dev_num; i1++)
|
||||
{
|
||||
copystr("/", #dev_name); // /
|
||||
copystr(i1*304+ devbuf+72, #dev_name+strlen(#dev_name)); // /rd
|
||||
copystr("/", #dev_name+strlen(#dev_name)); // /rd/
|
||||
|
||||
Open_Dir(#dev_name, ONLY_OPEN);
|
||||
dev_disc_num = count;
|
||||
for (j1=0; j1<dev_disc_num; j1++;)
|
||||
{
|
||||
copystr(#dev_name, #sys_discs); // /rd/
|
||||
copystr(j1*304+ buf+72, #sys_discs+strlen(#sys_discs)); // /rd/1
|
||||
copystr("/", #sys_discs+strlen(#sys_discs)); // /rd/1/
|
||||
copystr(#sys_discs,#disk_list[disc_num].Item);
|
||||
disc_num++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DrawSystemDiscs()
|
||||
{
|
||||
byte disc_icon;
|
||||
char dev_name[6];
|
||||
char disc_name[100];
|
||||
int i, dev_icon;
|
||||
|
||||
DrawBar(2,41,190,15,0x00699C); //ñèíèé ïðÿìîóãîëüíèê - ñâåðõó
|
||||
DrawBar(2,56,15,onTop(21,41),0x00699C); //ñèíèé ïðÿìîóãîëüíèê - ñëåâà
|
||||
DrawBar(177,56,15,onTop(21,41),0x00699C); //ñèíèé ïðÿìîóãîëüíèê - ñïðàâà
|
||||
//ñïèñîê äèñêîâ
|
||||
Tip(56, "Disks", 0, "");
|
||||
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); //ñîçäà¸ì êíîïêè, à ïîòîì âûâîäèì íàçâàíèÿ äèñêîâ
|
||||
copystr("Unknown drive",#disc_name); //èçíà÷àëüíî íåèçâåñíûé íîñèòåëü
|
||||
dev_icon=3; //ïî-óìîë÷àíèþ óñòðîéñòâî âûãëÿäèò êàê æåñòÿê
|
||||
copystr(#disk_list[i].Item, #dev_name);
|
||||
IF (dev_name[1]=='r') { dev_icon=0; copystr("RAM disk ",#disc_name); }
|
||||
IF (dev_name[1]=='c') { dev_icon=1; copystr("CD-ROM ",#disc_name); }
|
||||
IF (dev_name[1]=='f') { dev_icon=2; copystr("Floppy disk ",#disc_name); }
|
||||
IF (dev_name[1]=='h') || (dev_name[1]=='b') copystr("Hard disk ",#disc_name);
|
||||
//IF (dev_name[1]=='b') copystr("SATA disk ",#disc_name);
|
||||
copystr(#dev_name,#disc_name+strlen(#disc_name));
|
||||
//
|
||||
WriteText(45,i*16+79,0x80,0,#disc_name,0);
|
||||
PutImage(dev_icon*14*13*3+#devices,14,13,21,i*16+76);
|
||||
}
|
||||
}
|
@ -49,7 +49,9 @@ void GetIni(byte onload)
|
||||
case 0x0a:
|
||||
case 0x0d:
|
||||
InfType=PARAM;
|
||||
//IF (strcmp(#parametr,"select_color")==0) videlenie=StrToCol(#option);
|
||||
IF (strcmp(#parametr,"SelectionColor")==0) videlenie=StrToCol(#option);
|
||||
IF (strcmp(#parametr,"LineHeight")==0) BUTTON_HEIGHT=StrToInt(#option);
|
||||
|
||||
IF (parametr) && (!strcmp(#file_name+find_symbol(#file_name,'.'),#parametr)) {
|
||||
errornum=RunProgram(#option,#file_path);
|
||||
IF (errornum<0) //åñëè îøèáî÷êà âûøëà ïðè çàïóñêå
|
@ -7,13 +7,13 @@ byte os_name[8] = {'M','E','N','U','E','T','0','1'};
|
||||
dword os_version = 0x00000001;
|
||||
dword start_addr = #main;
|
||||
dword final_addr = #stop+32;
|
||||
dword alloc_mem = 0x00100000;
|
||||
dword x86esp_reg = 0x00100000; // 0x0007fff0;
|
||||
dword alloc_mem = 0x00070000;
|
||||
dword x86esp_reg = 0x00070000; // 0x0007fff0;
|
||||
dword I_Param = #param;
|
||||
dword I_Path = #program_path;
|
||||
|
||||
char param[4096]="";
|
||||
char program_path[4096]="";
|
||||
char param[4096];
|
||||
char program_path[4096];
|
||||
|
||||
|
||||
//Events
|
||||
@ -224,7 +224,7 @@ l1:
|
||||
$jnz l1
|
||||
}
|
||||
|
||||
char buffer[11]="";
|
||||
char buffer[11];
|
||||
inline fastcall dword IntToStr(dword ESI)
|
||||
{
|
||||
$mov edi, #buffer
|
||||
@ -252,6 +252,37 @@ f3:
|
||||
$ret
|
||||
}
|
||||
|
||||
inline fastcall dword StrToInt()
|
||||
{
|
||||
ESI=EDI=EAX;
|
||||
IF(DSBYTE[ESI]=='-')ESI++;
|
||||
EAX=0;
|
||||
BH=AL;
|
||||
do{
|
||||
BL=DSBYTE[ESI]-'0';
|
||||
EAX=EAX*10+EBX;
|
||||
ESI++;
|
||||
}while(DSBYTE[ESI]>0);
|
||||
IF(DSBYTE[EDI]=='-') -EAX;
|
||||
}
|
||||
|
||||
dword StrToCol(char* htmlcolor)
|
||||
{
|
||||
dword j, color=0;
|
||||
char ch=0x00;
|
||||
|
||||
FOR (j=0; j<6; j++)
|
||||
{
|
||||
ch=ESBYTE[htmlcolor+j];
|
||||
IF ((ch>='0') && (ch<='9')) ch -= '0';
|
||||
IF ((ch>='A') && (ch<='F')) ch -= 'A'-10;
|
||||
IF ((ch>='a') && (ch<='f')) ch -= 'a'-10;
|
||||
color = color*0x10 + ch;
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
inline fastcall int strcmp(ESI, EDI)
|
||||
{
|
||||
loop()
|
Loading…
Reference in New Issue
Block a user