forked from KolibriOS/kolibrios
New libs: io.h, math.h, date.h
kolibri.h: class mouse Update applications git-svn-id: svn://kolibrios.org@5640 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
60df867037
commit
211966e1dd
@ -112,7 +112,6 @@ menu_data menudata1 = {0, 40, 2, 15, 2, #menu_text_area1.menu, #menu_text_area1.
|
||||
void main()
|
||||
{
|
||||
int id, key;
|
||||
mouse m;
|
||||
|
||||
strcpy(#filter2.ext1, "TXT");
|
||||
//strcpy(#filter2.ext2, "ASM");
|
||||
@ -139,8 +138,8 @@ void main()
|
||||
switch(WaitEvent())
|
||||
{
|
||||
case evMouse:
|
||||
m.get();
|
||||
if (tview.MouseScrollNoSelection(m.vert)) DrawText();
|
||||
mouse.get();
|
||||
if (tview.MouseScrollNoSelection(mouse.vert)) DrawText();
|
||||
|
||||
menu_bar_mouse stdcall (#menudata1);
|
||||
if (menudata1.click)
|
||||
|
@ -163,7 +163,6 @@ OpenFile()
|
||||
void main()
|
||||
{
|
||||
int id, key, mouse_clicked;
|
||||
mouse mm;
|
||||
|
||||
mem_Init();
|
||||
SetEventMask(0x27);
|
||||
@ -187,21 +186,21 @@ void main()
|
||||
break;
|
||||
}
|
||||
|
||||
mm.get();
|
||||
mouse.get();
|
||||
|
||||
if (mm.vert)
|
||||
if (mouse.vert)
|
||||
{
|
||||
if (list[SKINS].active) && (list[SKINS].MouseScroll(mm.vert)) Draw_List();
|
||||
if (list[WALLPAPERS].active) && (list[WALLPAPERS].MouseScroll(mm.vert)) Draw_List();
|
||||
if (list[SKINS].active) && (list[SKINS].MouseScroll(mouse.vert)) Draw_List();
|
||||
if (list[WALLPAPERS].active) && (list[WALLPAPERS].MouseScroll(mouse.vert)) Draw_List();
|
||||
}
|
||||
|
||||
if (mouse_clicked)
|
||||
{
|
||||
if (!mm.lkm) && (list[SKINS].active) && (list[SKINS].ProcessMouse(mm.x, mm.y)) Apply();
|
||||
if (!mm.lkm) && (list[WALLPAPERS].active) && (list[WALLPAPERS].ProcessMouse(mm.x, mm.y)) Apply();
|
||||
if (!mouse.lkm) && (list[SKINS].active) && (list[SKINS].ProcessMouse(mouse.x, mouse.y)) Apply();
|
||||
if (!mouse.lkm) && (list[WALLPAPERS].active) && (list[WALLPAPERS].ProcessMouse(mouse.x, mouse.y)) Apply();
|
||||
mouse_clicked=0;
|
||||
}
|
||||
if (mm.lkm) && (list[SKINS].MouseOver(mm.x, mm.y)) mouse_clicked=1;
|
||||
if (mouse.lkm) && (list[SKINS].MouseOver(mouse.x, mouse.y)) mouse_clicked=1;
|
||||
break;
|
||||
|
||||
|
||||
|
@ -56,7 +56,7 @@ char str_location[]="location\0";
|
||||
int redirected = 0;
|
||||
|
||||
char stak[4096];
|
||||
mouse m;
|
||||
|
||||
int action_buf;
|
||||
|
||||
dword http_transfer = 0;
|
||||
@ -149,13 +149,13 @@ void main()
|
||||
if (!CheckActiveProcess(Form.ID)) break;
|
||||
//Edit URL
|
||||
edit_box_mouse stdcall (#address_box);
|
||||
m.get();
|
||||
mouse.get();
|
||||
//Links hover
|
||||
if (m.y>WB1.list.y) PageLinks.Hover(m.x, m.y, link_color_inactive, link_color_active, bg_color);
|
||||
if (mouse.y>WB1.list.y) PageLinks.Hover(mouse.x, mouse.y, link_color_inactive, link_color_active, bg_color);
|
||||
//Menu
|
||||
if (m.y>WB1.list.y) && (m.y<Form.height) && (bufsize)
|
||||
if (mouse.y>WB1.list.y) && (mouse.y<Form.height) && (bufsize)
|
||||
{
|
||||
if (m.pkm) && (m.up)
|
||||
if (mouse.pkm) && (mouse.up)
|
||||
{
|
||||
SwitchToAnotherThread();
|
||||
CreateThread(#menu_rmb,#stak+4092);
|
||||
@ -163,26 +163,26 @@ void main()
|
||||
}
|
||||
}
|
||||
//Mouse scroll
|
||||
if (m.vert)
|
||||
if (mouse.vert)
|
||||
{
|
||||
if (WB1.list.MouseScroll(m.vert)) WB1.Parse();
|
||||
if (WB1.list.MouseScroll(mouse.vert)) WB1.Parse();
|
||||
}
|
||||
//Drag scroller
|
||||
scroll_wv.all_redraw = 0;
|
||||
if (!m.lkm) scroll_used=0;
|
||||
if (m.x>=scroll_wv.start_x) && (m.x<=scroll_wv.start_x+scroll_wv.size_x)
|
||||
&& (m.y>=scroll_wv.start_y+scroll_wv.btn_height) && (-scroll_wv.btn_height+scroll_wv.start_y+scroll_wv.size_y>m.y)
|
||||
&& (WB1.list.count>WB1.list.visible) && (m.lkm)
|
||||
if (!mouse.lkm) scroll_used=0;
|
||||
if (mouse.x>=scroll_wv.start_x) && (mouse.x<=scroll_wv.start_x+scroll_wv.size_x)
|
||||
&& (mouse.y>=scroll_wv.start_y+scroll_wv.btn_height) && (-scroll_wv.btn_height+scroll_wv.start_y+scroll_wv.size_y>mouse.y)
|
||||
&& (WB1.list.count>WB1.list.visible) && (mouse.lkm)
|
||||
{
|
||||
scroll_used=1;
|
||||
}
|
||||
if (scroll_used)
|
||||
{
|
||||
m.y = m.y / WB1.DrawBuf.zoomf + 5;
|
||||
mouse.y = mouse.y / WB1.DrawBuf.zoomf + 5;
|
||||
half_scroll_size = WB1.list.h - 16 * WB1.list.visible / WB1.list.count - 3 /2;
|
||||
if (half_scroll_size+WB1.list.y>m.y) || (m.y<0) || (m.y>4000) m.y=half_scroll_size+WB1.list.y;
|
||||
if (half_scroll_size+WB1.list.y>mouse.y) || (mouse.y<0) || (mouse.y>4000) mouse.y=half_scroll_size+WB1.list.y;
|
||||
btn=WB1.list.first;
|
||||
WB1.list.first = m.y -half_scroll_size -WB1.list.y * WB1.list.count / WB1.list.h;
|
||||
WB1.list.first = mouse.y -half_scroll_size -WB1.list.y * WB1.list.count / WB1.list.h;
|
||||
if (WB1.list.visible+WB1.list.first>WB1.list.count) WB1.list.first=WB1.list.count-WB1.list.visible;
|
||||
if (btn!=WB1.list.first) WB1.Parse();
|
||||
}
|
||||
@ -473,8 +473,8 @@ void Scan(int id)
|
||||
return;
|
||||
case 312:
|
||||
SwitchToAnotherThread();
|
||||
m.y = TOOLBAR_H-6;
|
||||
m.x = Form.cwidth - 167;
|
||||
mouse.y = TOOLBAR_H-6;
|
||||
mouse.x = Form.cwidth - 167;
|
||||
CreateThread(#menu_rmb,#stak+4092);
|
||||
return;
|
||||
case 122:
|
||||
|
@ -38,7 +38,7 @@ enum { STATE_NOT_STARTED, STATE_IN_PROGRESS, STATE_COMPLETED };
|
||||
void Downloader()
|
||||
{
|
||||
int key, btn;
|
||||
mouse m;
|
||||
|
||||
char notify_message[4296];
|
||||
|
||||
if (DL_URL[0]) {
|
||||
|
@ -26,7 +26,6 @@ llist menu;
|
||||
|
||||
void menu_rmb()
|
||||
{
|
||||
mouse mm;
|
||||
proc_info MenuForm;
|
||||
int key;
|
||||
|
||||
@ -42,9 +41,9 @@ void menu_rmb()
|
||||
GetProcessInfo(#MenuForm, SelfInfo);
|
||||
if (!CheckActiveProcess(MenuForm.ID)) ExitProcess();
|
||||
|
||||
mm.get();
|
||||
if (menu.ProcessMouse(mm.x, mm.y)) DrawMenuList();
|
||||
if (mm.lkm)&&(mm.up) { action_buf = ITEMS_LIST[menu.current*2+1]; ExitProcess(); }
|
||||
mouse.get();
|
||||
if (menu.ProcessMouse(mouse.x, mouse.y)) DrawMenuList();
|
||||
if (mouse.lkm)&&(mouse.up) { action_buf = ITEMS_LIST[menu.current*2+1]; ExitProcess(); }
|
||||
break;
|
||||
|
||||
case evKey:
|
||||
@ -59,7 +58,7 @@ void menu_rmb()
|
||||
break;
|
||||
|
||||
case evReDraw:
|
||||
DefineAndDrawWindow(Form.left+m.x-6,Form.top+m.y+GetSkinHeight()+3,menu.w+2,menu.h+4,0x01, 0, 0, 0x01fffFFF);
|
||||
DefineAndDrawWindow(Form.left+mouse.x-6,Form.top+mouse.y+GetSkinHeight()+3,menu.w+2,menu.h+4,0x01, 0, 0, 0x01fffFFF);
|
||||
DrawPopup(0,0,menu.w,menu.h+3,0, col_bg,border_color);
|
||||
DrawMenuList();
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ DrawBufer diagram;
|
||||
void main()
|
||||
{
|
||||
int key, btn;
|
||||
mouse m;
|
||||
|
||||
char filepath[4096];
|
||||
char notify_message[4296];
|
||||
|
||||
|
@ -80,7 +80,7 @@ void main()
|
||||
goto _DRAW;
|
||||
loop()
|
||||
{
|
||||
WaitEventTimeout(330);
|
||||
WaitEventTimeout(7);
|
||||
switch(EAX & 0xFF)
|
||||
{
|
||||
case evButton:
|
||||
@ -106,14 +106,10 @@ void main()
|
||||
sc.get();
|
||||
DefineAndDrawWindow(0,0,WIN_SIZE_X, WIN_SIZE_Y, 0x01, 0, 0, 0x01fffFFF);
|
||||
//_PutImage(0,0,WIN_SIZE_X,WIN_SIZE_Y,shadow_buf);
|
||||
if(!i){
|
||||
_PutImage(0,0,WIN_SIZE_X, PANEL_Y,s1);
|
||||
|
||||
_PutImage(0,PANEL_Y,sides_w, PANEL_SIZE_Y+1,s2);
|
||||
_PutImage(sides_w+PANEL_SIZE_X+1,PANEL_Y,sides_w-1, PANEL_SIZE_Y+1,s3);
|
||||
_PutImage(0,PANEL_Y+PANEL_SIZE_Y+1,WIN_SIZE_X, PANEL_Y-1,s4);
|
||||
//i = 1;
|
||||
}
|
||||
draw_main_area(PANEL_X, PANEL_Y, PANEL_SIZE_X, PANEL_SIZE_Y);
|
||||
break;
|
||||
default: _DRAW:
|
||||
|
@ -142,7 +142,6 @@ dword menu_stak,about_stak,properties_stak,settings_stak,copy_stak;
|
||||
|
||||
proc_info Form;
|
||||
system_colors sc;
|
||||
mouse m;
|
||||
int mouse_dd, scroll_used, sc_slider_h, sorting_arrow_x, kolibrios_drive;
|
||||
dword buf;
|
||||
dword file_mas[6898];
|
||||
@ -152,7 +151,6 @@ int rand_n;
|
||||
int selected_count;
|
||||
byte CMD_REFRESH;
|
||||
|
||||
mouse gestures;
|
||||
signed x_old, y_old, dif_x, dif_y, adif_x, adif_y;
|
||||
byte stats;
|
||||
|
||||
@ -181,7 +179,6 @@ void main()
|
||||
char IPC_BUF[10];
|
||||
dword tmp;
|
||||
rand_n = random(40);
|
||||
gestures.get();
|
||||
mem_Init();
|
||||
load_dll(boxlib, #box_lib_init,0);
|
||||
load_dll(libini, #lib_init,1);
|
||||
@ -213,21 +210,19 @@ void main()
|
||||
break;
|
||||
}
|
||||
|
||||
m.get();
|
||||
mouse.get();
|
||||
|
||||
|
||||
gestures.get();
|
||||
if (!gestures.mkm) && (stats>0) stats = 0;
|
||||
if (gestures.mkm) && (stats==0)
|
||||
if (!mouse.mkm) && (stats>0) stats = 0;
|
||||
if (mouse.mkm) && (stats==0)
|
||||
{
|
||||
x_old = gestures.x;
|
||||
y_old = gestures.y;
|
||||
x_old = mouse.x;
|
||||
y_old = mouse.y;
|
||||
stats = 1;
|
||||
}
|
||||
if (gestures.mkm) && (stats==1)
|
||||
if (mouse.mkm) && (stats==1)
|
||||
{
|
||||
dif_x = gestures.x-x_old;
|
||||
dif_y = gestures.y-y_old;
|
||||
dif_x = mouse.x-x_old;
|
||||
dif_y = mouse.y-y_old;
|
||||
adif_x = fabs(dif_x);
|
||||
adif_y = fabs(dif_y);
|
||||
|
||||
@ -257,31 +252,31 @@ void main()
|
||||
}
|
||||
}
|
||||
}
|
||||
if (files.MouseOver(m.x, m.y))&&((m.up)||(m.down)||(m.dblclick))
|
||||
if (files.MouseOver(mouse.x, mouse.y))&&((mouse.up)||(mouse.down)||(mouse.dblclick))
|
||||
{
|
||||
//select/open file {
|
||||
if (m.key&MOUSE_LEFT)&&((m.down)||(m.dblclick))
|
||||
if (mouse.key&MOUSE_LEFT)&&((mouse.down)||(mouse.dblclick))
|
||||
{
|
||||
if (m.y>=files.y)//&&(m.click)
|
||||
if (mouse.y>=files.y)//&&(mouse.click)
|
||||
{
|
||||
id = m.y - files.y / files.line_h;
|
||||
id = mouse.y - files.y / files.line_h;
|
||||
if (files.current!=id)
|
||||
{
|
||||
m.clearTime();
|
||||
mouse.clearTime();
|
||||
if (id<files.visible) List_Current(id-files.current);
|
||||
}
|
||||
else if(m.dblclick)Open(0);
|
||||
else if(mouse.dblclick)Open(0);
|
||||
}
|
||||
}
|
||||
// } select/open file
|
||||
else
|
||||
//file menu {
|
||||
if (m.key&MOUSE_RIGHT)&&(m.up)
|
||||
if (mouse.key&MOUSE_RIGHT)&&(mouse.up)
|
||||
{
|
||||
menu_call_mouse = 1;
|
||||
if (m.y>=files.y)//&&(m.click)
|
||||
if (mouse.y>=files.y)//&&(mouse.click)
|
||||
{
|
||||
id = m.y - files.y / files.line_h;
|
||||
id = mouse.y - files.y / files.line_h;
|
||||
if (files.current!=id) List_Current(id-files.current);
|
||||
//SwitchToAnotherThread();
|
||||
menu_stak = malloc(4096);
|
||||
@ -292,48 +287,48 @@ void main()
|
||||
// } file menu
|
||||
}
|
||||
|
||||
if (m.vert)
|
||||
if (mouse.vert)
|
||||
{
|
||||
if (files.MouseScroll(m.vert)) List_ReDraw();
|
||||
if (files.MouseScroll(mouse.vert)) List_ReDraw();
|
||||
break;
|
||||
}
|
||||
|
||||
if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>40) && (m.y<files.y)
|
||||
if (mouse.x>=Form.width-26) && (mouse.x<=Form.width-6) && (mouse.y>40) && (mouse.y<files.y)
|
||||
{
|
||||
if (m.lkm==1) DrawRectangle3D(Form.cwidth - 17,41,14,14,0xC7C7C7,0xFFFFFF);
|
||||
WHILE (m.lkm==1) && (files.first>0)
|
||||
if (mouse.lkm==1) DrawRectangle3D(Form.cwidth - 17,41,14,14,0xC7C7C7,0xFFFFFF);
|
||||
WHILE (mouse.lkm==1) && (files.first>0)
|
||||
{
|
||||
pause(8);
|
||||
files.first--;
|
||||
List_ReDraw();
|
||||
m.get();
|
||||
mouse.get();
|
||||
}
|
||||
DrawRectangle3D(Form.cwidth - 17,41,14,14,0xFFFFFF,0xC7C7C7);
|
||||
}
|
||||
|
||||
if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>onTop(22,0)+1) && (m.y<onTop(22,0)+16)
|
||||
if (mouse.x>=Form.width-26) && (mouse.x<=Form.width-6) && (mouse.y>onTop(22,0)+1) && (mouse.y<onTop(22,0)+16)
|
||||
{
|
||||
if (m.lkm==1) DrawRectangle3D(Form.cwidth - 17,onTop(21,0),14,14,0xC7C7C7,0xFFFFFF);
|
||||
while (m.lkm==1) && (files.first<files.count-files.visible)
|
||||
if (mouse.lkm==1) DrawRectangle3D(Form.cwidth - 17,onTop(21,0),14,14,0xC7C7C7,0xFFFFFF);
|
||||
while (mouse.lkm==1) && (files.first<files.count-files.visible)
|
||||
{
|
||||
pause(8);
|
||||
files.first++;
|
||||
List_ReDraw();
|
||||
m.get();
|
||||
mouse.get();
|
||||
}
|
||||
DrawRectangle3D(Form.cwidth - 17,onTop(21,0),14,14,0xFFFFFF,0xC7C7C7);
|
||||
}
|
||||
|
||||
//Scrooll
|
||||
if (!m.lkm) && (scroll_used) { scroll_used=NULL; Scroll(); }
|
||||
if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>56) && (m.y<Form.height) && (m.lkm) && (!scroll_used) {scroll_used=1;Scroll();}
|
||||
if (!mouse.lkm) && (scroll_used) { scroll_used=NULL; Scroll(); }
|
||||
if (mouse.x>=Form.width-26) && (mouse.x<=Form.width-6) && (mouse.y>56) && (mouse.y<Form.height) && (mouse.lkm) && (!scroll_used) {scroll_used=1;Scroll();}
|
||||
|
||||
if (scroll_used)
|
||||
{
|
||||
if (sc_slider_h/2+files.y>m.y) || (m.y<0) || (m.y>4000) m.y=sc_slider_h/2+files.y; //anee eo?ni? iaa ieiii
|
||||
if (sc_slider_h/2+files.y>mouse.y) || (mouse.y<0) || (mouse.y>4000) mouse.y=sc_slider_h/2+files.y; //anee eo?ni? iaa ieiii
|
||||
id=files.first;
|
||||
j= sc_slider_h/2;
|
||||
files.first = m.y -j -files.y * files.count;
|
||||
files.first = mouse.y -j -files.y * files.count;
|
||||
files.first /= onTop(22,files.y);
|
||||
if (files.visible+files.first>files.count) files.first=files.count-files.visible;
|
||||
if (id!=files.first) List_ReDraw();
|
||||
|
@ -50,7 +50,6 @@ int cur_action_buf;
|
||||
|
||||
void FileMenu()
|
||||
{
|
||||
mouse mm;
|
||||
word key;
|
||||
proc_info MenuForm;
|
||||
int index;
|
||||
@ -72,10 +71,10 @@ void FileMenu()
|
||||
loop() switch(WaitEvent())
|
||||
{
|
||||
case evMouse:
|
||||
mm.get();
|
||||
mouse.get();
|
||||
if (!CheckActiveProcess(MenuForm.ID)){ cmd_free=1; ExitProcess();}
|
||||
else if (mm.move)&&(menu.ProcessMouse(mm.x, mm.y)) MenuListRedraw();
|
||||
else if (mm.key&MOUSE_LEFT)&&(mm.up) {action_buf = cur_action_buf; cmd_free=1; ExitProcess(); }
|
||||
else if (mouse.move)&&(menu.ProcessMouse(mouse.x, mouse.y)) MenuListRedraw();
|
||||
else if (mouse.key&MOUSE_LEFT)&&(mouse.up) {action_buf = cur_action_buf; cmd_free=1; ExitProcess(); }
|
||||
break;
|
||||
|
||||
case evKey:
|
||||
@ -86,7 +85,7 @@ void FileMenu()
|
||||
break;
|
||||
|
||||
case evReDraw: _MENU_DRAW:
|
||||
if (menu_call_mouse) DefineAndDrawWindow(m.x+Form.left+5, m.y+Form.top+GetSkinHeight(),menu.w+3,menu.h+6,0x01, 0, 0, 0x01fffFFF);
|
||||
if (menu_call_mouse) DefineAndDrawWindow(mouse.x+Form.left+5, mouse.y+Form.top+GetSkinHeight(),menu.w+3,menu.h+6,0x01, 0, 0, 0x01fffFFF);
|
||||
else DefineAndDrawWindow(Form.left+files.x+15, files.line_h*files.current+files.y+Form.top+30,menu.w+3,menu.h+6,0x01, 0, 0, 0x01fffFFF);
|
||||
GetProcessInfo(#MenuForm, SelfInfo);
|
||||
DrawRectangle(0,0,menu.w+1,menu.h+2,sc.work_graph);
|
||||
|
@ -1,10 +1,13 @@
|
||||
#define MEMSIZE 0x3E80
|
||||
#include "..\lib\strings.h"
|
||||
|
||||
#include "../lib/io.h"
|
||||
#include "../lib/draw.h"
|
||||
|
||||
void main()
|
||||
{
|
||||
int id, key;
|
||||
|
||||
mem_Init();
|
||||
io.set("/sys/RUN",ATR_HIDDEN);
|
||||
loop()
|
||||
{
|
||||
switch(WaitEvent())
|
||||
@ -27,16 +30,17 @@ void main()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void draw_window()
|
||||
{
|
||||
proc_info Form;
|
||||
dword pos;
|
||||
//float zz=0.944,ret;
|
||||
DefineAndDrawWindow(215,100,250,200,0x34,0xFFFFFF,"Window header");
|
||||
//draw.gradient(pos,10,10,0x0,20,20,0x0);
|
||||
GetProcessInfo(#Form, SelfInfo);
|
||||
WriteText(50,80,0x80,0,"Press Enter");
|
||||
draw.circle(60,60,5);
|
||||
|
||||
WriteText(10,110,0x80,0,#param);
|
||||
}
|
||||
|
||||
|
||||
stop:
|
||||
|
16
programs/cmm/lib/date.h
Normal file
16
programs/cmm/lib/date.h
Normal file
@ -0,0 +1,16 @@
|
||||
//IO library
|
||||
#ifndef INCLUDE_DATE_H
|
||||
#define INCLUDE_DATE_H
|
||||
|
||||
#ifndef INCLUDE_STRING_H
|
||||
#include "../lib/strings.h"
|
||||
#endif
|
||||
|
||||
:struct date
|
||||
{
|
||||
byte day;
|
||||
byte month;
|
||||
word year;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,11 +1,8 @@
|
||||
#ifndef INCLUDE_FILESYSTEM_H
|
||||
#define INCLUDE_FILESYSTEM_H
|
||||
#ifndef INCLUDE_KOLIBRI_H
|
||||
#include "../lib/kolibri.h"
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_STRING_H
|
||||
#include "../lib/strings.h"
|
||||
#ifndef INCLUDE_DATE_H
|
||||
#include "../lib/date.h"
|
||||
#endif
|
||||
|
||||
:struct f70{
|
||||
@ -18,13 +15,6 @@
|
||||
dword name;
|
||||
};
|
||||
|
||||
:struct date
|
||||
{
|
||||
byte day;
|
||||
byte month;
|
||||
word year;
|
||||
};
|
||||
|
||||
:struct BDVK {
|
||||
dword readonly:1, hidden:1, system:1, volume_label:1, isfolder:1, notarchived:1, :0;
|
||||
byte type_name;
|
||||
@ -41,28 +31,7 @@
|
||||
};
|
||||
|
||||
|
||||
:void DrawDate(dword x, y, color, in_date)
|
||||
{
|
||||
//char text[15];
|
||||
EDI = in_date;
|
||||
EAX = 47;
|
||||
EBX = 2<<16;
|
||||
EDX = x<<16+y;
|
||||
ESI = 0x80<<24+color;
|
||||
ECX = EDI.date.day;
|
||||
$int 0x40;
|
||||
EDX += 18<<16;
|
||||
ECX = EDI.date.month;
|
||||
$int 0x40;
|
||||
EDX += 18<<16;
|
||||
EBX = 4<<16;
|
||||
ECX = EDI.date.year;
|
||||
$int 0x40;
|
||||
PutPixel(x+14,y+6,color);
|
||||
PutPixel(x+32,y+6,color);
|
||||
//sprintf(#text,"%d",EDI.date.year);
|
||||
//WriteText(x, y, 0x80, 0x000000, #text);
|
||||
}
|
||||
|
||||
|
||||
|
||||
///////////////////////////
|
||||
@ -83,9 +52,9 @@
|
||||
$int 0x40
|
||||
}
|
||||
|
||||
///////////////////////////
|
||||
/////////////////////////////////////
|
||||
// Èçìåíåíèå ïàðàìåòðîâ ôàéëà //
|
||||
///////////////////////////
|
||||
/////////////////////////////////////
|
||||
:f70 setinfo_file_70;
|
||||
:dword SetFileInfo(dword file_path, bdvk_struct)
|
||||
{
|
||||
@ -173,9 +142,9 @@
|
||||
$int 0x40
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
///////////////////////////
|
||||
// Çàïèñàòü ôàéë //
|
||||
////////////////////////////
|
||||
///////////////////////////
|
||||
:f70 write_file_70;
|
||||
:int WriteFile(dword write_file_size, write_buffer, write_file_path)
|
||||
{
|
||||
@ -191,9 +160,9 @@
|
||||
$int 0x40
|
||||
}
|
||||
|
||||
//////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
// WriteInFileThatAlredyExists //
|
||||
//////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
:f70 write_file_offset_70;
|
||||
:int WriteFileWithOffset(dword write_data_size, write_buffer, write_file_path, offset)
|
||||
{
|
||||
|
473
programs/cmm/lib/io.h
Normal file
473
programs/cmm/lib/io.h
Normal file
@ -0,0 +1,473 @@
|
||||
//IO library
|
||||
#ifndef INCLUDE_IO_H
|
||||
#define INCLUDE_IO_H
|
||||
|
||||
#ifndef INCLUDE_DATE_H
|
||||
#include "../lib/date.h"
|
||||
#endif
|
||||
|
||||
#ifdef LANG_RUS
|
||||
#define __T__GB "ƒ¡"
|
||||
#define __T__MB "Œ¡"
|
||||
#define __T__KB "Š¡"
|
||||
#define __T___B "<22>"
|
||||
#else
|
||||
#define __T__GB "Gb"
|
||||
#define __T__MB "Mb"
|
||||
#define __T__KB "Kb"
|
||||
#define __T___B "B"
|
||||
#endif
|
||||
|
||||
#define ATR_READONLY 000001b
|
||||
#define ATR_HIDDEN 000100b
|
||||
#define ATR_SYSTEM 010000b
|
||||
|
||||
#define ATR_NOREADONLY 000010b
|
||||
#define ATR_NOHIDDEN 001000b
|
||||
#define ATR_NOSYSTEM 100000b
|
||||
|
||||
:enum
|
||||
{
|
||||
DIR_ALL,
|
||||
DIR_NOROOT,
|
||||
DIR_ONLYREAL
|
||||
};
|
||||
|
||||
:struct ___f70{
|
||||
dword func;
|
||||
dword param1;
|
||||
dword param2;
|
||||
dword param3;
|
||||
dword param4;
|
||||
char rezerv;
|
||||
dword name;
|
||||
}__file_F70;
|
||||
|
||||
:int ___ReadDir(dword file_count, read_buffer, dir_path)
|
||||
{
|
||||
__file_F70.func = 1;
|
||||
__file_F70.param1 =
|
||||
__file_F70.param2 =
|
||||
__file_F70.rezerv = 0;
|
||||
__file_F70.param3 = file_count;
|
||||
__file_F70.param4 = read_buffer;
|
||||
__file_F70.name = dir_path;
|
||||
$mov eax,70
|
||||
$mov ebx,#__file_F70.func
|
||||
$int 0x40
|
||||
}
|
||||
|
||||
:dword ___GetFileInfo(dword file_path, bdvk_struct)
|
||||
{
|
||||
__file_F70.func = 5;
|
||||
__file_F70.param1 =
|
||||
__file_F70.param2 =
|
||||
__file_F70.param3 = 0;
|
||||
__file_F70.param4 = bdvk_struct;
|
||||
__file_F70.rezerv = 0;
|
||||
__file_F70.name = file_path;
|
||||
$mov eax,70
|
||||
$mov ebx,#__file_F70.func
|
||||
$int 0x40
|
||||
}
|
||||
|
||||
:struct ____BDVK {
|
||||
dword readonly:1, hidden:1, system:1, volume_label:1, isfolder:1, notarchived:1, :0;
|
||||
byte type_name;
|
||||
byte rez1, rez2, selected;
|
||||
dword timecreate;
|
||||
date datecreate;
|
||||
dword timelastaccess;
|
||||
date datelastaccess;
|
||||
dword timelastedit;
|
||||
date datelastedit;
|
||||
dword sizelo;
|
||||
dword sizehi;
|
||||
char name[518];
|
||||
};
|
||||
|
||||
:struct __FILE
|
||||
{
|
||||
dword count;
|
||||
int del(...);
|
||||
int read(...);
|
||||
int write(...);
|
||||
dword set(...);
|
||||
};
|
||||
:dword __FILE::set(dword file_path)
|
||||
{
|
||||
__file_F70.func = 6;
|
||||
__file_F70.param1 =
|
||||
__file_F70.param2 =
|
||||
__file_F70.param3 = 0;
|
||||
__file_F70.param4 = #io.BDVK;
|
||||
__file_F70.rezerv = 0;
|
||||
__file_F70.name = file_path;
|
||||
$mov eax,70
|
||||
$mov ebx,#__file_F70.func
|
||||
$int 0x40
|
||||
}
|
||||
:int __FILE::del(dword PATH)
|
||||
{
|
||||
__file_F70.func = 8;
|
||||
__file_F70.param1 =
|
||||
__file_F70.param2 =
|
||||
__file_F70.param3 =
|
||||
__file_F70.param4 =
|
||||
__file_F70.rezerv = 0;
|
||||
__file_F70.name = PATH;
|
||||
$mov eax,70
|
||||
$mov ebx,#__file_F70.func
|
||||
$int 0x40
|
||||
}
|
||||
:int __FILE::read(dword read_pos, read_file_size, read_buffer, read_file_path)
|
||||
{
|
||||
__file_F70.func = 0;
|
||||
__file_F70.param1 = read_pos;
|
||||
__file_F70.param2 = 0;
|
||||
__file_F70.param3 = read_file_size;
|
||||
__file_F70.param4 = read_buffer;
|
||||
__file_F70.rezerv = 0;
|
||||
__file_F70.name = read_file_path;
|
||||
$mov eax,70
|
||||
$mov ebx,#__file_F70.func
|
||||
$int 0x40
|
||||
}
|
||||
:int __FILE::write(dword write_file_size, write_buffer, write_file_path)
|
||||
{
|
||||
__file_F70.func = 2;
|
||||
__file_F70.param1 = 0;
|
||||
__file_F70.param2 = 0;
|
||||
__file_F70.param3 = write_file_size;
|
||||
__file_F70.param4 = write_buffer;
|
||||
__file_F70.rezerv = 0;
|
||||
__file_F70.name = write_file_path;
|
||||
$mov eax,70
|
||||
$mov ebx,#__file_F70.func
|
||||
$int 0x40
|
||||
}
|
||||
:struct __DIR
|
||||
{
|
||||
int make(dword name);
|
||||
dword buffer;
|
||||
signed count;
|
||||
};
|
||||
:int __DIR::make(dword new_folder_path)
|
||||
{
|
||||
__file_F70.func = 9;
|
||||
__file_F70.param1 =
|
||||
__file_F70.param2 =
|
||||
__file_F70.param3 =
|
||||
__file_F70.param4 =
|
||||
__file_F70.rezerv = 0;
|
||||
__file_F70.name = new_folder_path;
|
||||
$mov eax,70
|
||||
$mov ebx,#__file_F70.func
|
||||
$int 0x40
|
||||
}
|
||||
|
||||
:struct __PATH
|
||||
{
|
||||
dword file(...);
|
||||
dword path(...);
|
||||
};
|
||||
:char __PATH_NEW[4096];
|
||||
:dword __PATH::path(dword PATH)
|
||||
{
|
||||
dword _NPT;
|
||||
_NPT = #__PATH_NEW;
|
||||
if(DSBYTE[PATH]=='/')
|
||||
{
|
||||
if(strcmp(PATH,"sys/",4))
|
||||
if(strcmp(PATH,"hd/",3))
|
||||
if(strcmp(PATH,"rd/",3))
|
||||
if(strcmp(PATH,"tmp/",4))
|
||||
if(strcmp(PATH,"fd/",3))
|
||||
if(strcmp(PATH,"cd/",3)) sprintf(_NPT,"/%s%s","sys",PATH);
|
||||
}
|
||||
while(DSBYTE[_NPT])
|
||||
{
|
||||
if(DSBYTE[_NPT]=='.')
|
||||
{
|
||||
if(DSBYTE[_NPT+1]=='.')
|
||||
{
|
||||
if(DSBYTE[_NPT+1]=='/')
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
else if(DSBYTE[_NPT+1]=='/')
|
||||
{
|
||||
_NPT++;
|
||||
sprintf(_NPT,"/%s%s","sys",_NPT);
|
||||
}
|
||||
}
|
||||
_NPT++;
|
||||
}
|
||||
return _NPT;
|
||||
}
|
||||
|
||||
:dword __PATH::file(dword name)
|
||||
{
|
||||
dword ret;
|
||||
ret = name;
|
||||
while(DSBYTE[name])
|
||||
{
|
||||
if(DSBYTE[name]=='/')ret = name+1;
|
||||
name++;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
:struct IO
|
||||
{
|
||||
dword buffer_data;
|
||||
dword size_dir;
|
||||
dword count_dirs,count_files;
|
||||
signed FILES_SIZE;
|
||||
dword file_name;
|
||||
double size(...);
|
||||
dword get_size_dir(dword name);
|
||||
signed count(dword path);
|
||||
dword dir_buffer(dword path;byte options);
|
||||
dword dir_position(dword pos);
|
||||
signed int run(dword path,param);
|
||||
byte del(...);
|
||||
dword read(...);
|
||||
int write(...);
|
||||
byte copy(...);
|
||||
byte move(...);
|
||||
dword set(...);
|
||||
dword convert_size();
|
||||
__DIR dir;
|
||||
__PATH path;
|
||||
__FILE file;
|
||||
____BDVK BDVK;
|
||||
}io;
|
||||
|
||||
:byte __ConvertSize_size_prefix[8];
|
||||
:dword IO::convert_size()
|
||||
{
|
||||
byte size_nm[3];
|
||||
dword bytes;
|
||||
bytes = FILES_SIZE;
|
||||
if (bytes>=1073741824) strncpy(#size_nm, __T__GB,2);
|
||||
else if (bytes>=1048576) strncpy(#size_nm, __T__MB,2);
|
||||
else if (bytes>=1024) strncpy(#size_nm, __T__KB,2);
|
||||
else strncpy(#size_nm, __T___B,1);
|
||||
while (bytes>1023) bytes/=1024;
|
||||
sprintf(#__ConvertSize_size_prefix,"%d %s",bytes,#size_nm);
|
||||
return #__ConvertSize_size_prefix;
|
||||
}
|
||||
|
||||
:int IO::write(dword PATH,data)
|
||||
{
|
||||
file.write(0,strlen(data),data,PATH);
|
||||
}
|
||||
:dword IO::read(dword PATH)
|
||||
{
|
||||
___GetFileInfo(PATH, #BDVK);
|
||||
if(BDVK.isfolder)return 0;
|
||||
FILES_SIZE = BDVK.sizelo;
|
||||
buffer_data = malloc(FILES_SIZE+1);
|
||||
file.read(0,FILES_SIZE,buffer_data,PATH);
|
||||
return buffer_data;
|
||||
}
|
||||
|
||||
:signed int IO::run(dword rpath,rparam)
|
||||
{
|
||||
__file_F70.func = 7;
|
||||
__file_F70.param1 =
|
||||
__file_F70.param3 =
|
||||
__file_F70.param4 =
|
||||
__file_F70.rezerv = 0;
|
||||
__file_F70.param2 = rparam;
|
||||
__file_F70.name = rpath;
|
||||
$mov eax,70
|
||||
$mov ebx,#__file_F70.func
|
||||
$int 0x40
|
||||
}
|
||||
:signed IO::count(dword PATH)
|
||||
{
|
||||
byte buf[32];
|
||||
if(!___ReadDir(0, #buf, PATH))
|
||||
{
|
||||
dir.count = ESDWORD[#buf+8];
|
||||
return dir.count;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
:dword IO::dir_position(dword pos)
|
||||
{
|
||||
return pos*304+dir.buffer+72;
|
||||
}
|
||||
:dword IO::dir_buffer(dword PATH;byte options)
|
||||
{
|
||||
count(PATH);
|
||||
if(dir.count!=-1)
|
||||
{
|
||||
//if(dir.buffer) dir.buffer = realloc(dir.buffer,dir.count+1*304+32);
|
||||
//else
|
||||
dir.buffer = malloc(dir.count+1*304+32);
|
||||
___ReadDir(dir.count, dir.buffer, PATH);
|
||||
if (options == DIR_ONLYREAL)
|
||||
{
|
||||
if (!strcmp(".",dir.buffer+72)){dir.count--; memmov(dir.buffer,dir.buffer+304,dir.count*304);}
|
||||
if (!strcmp("..",dir.buffer+72)){dir.count--; memmov(dir.buffer,dir.buffer+304,dir.count*304);}
|
||||
return dir.buffer;
|
||||
}
|
||||
if (options == DIR_NOROOT)
|
||||
{
|
||||
if (!strcmp(".",dir.buffer+72)) memmov(dir.buffer,dir.buffer+304,dir.count*304-304);
|
||||
return dir.buffer;
|
||||
}
|
||||
return dir.buffer;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
:double IO::size(dword PATH)
|
||||
{
|
||||
dword i,tmp_buf,count_dir,count_file;
|
||||
dword filename;
|
||||
double size_tmp;
|
||||
double tmp;
|
||||
if(!PATH)return 0;
|
||||
if(___GetFileInfo(PATH, #BDVK))return -1;
|
||||
if(BDVK.isfolder)
|
||||
{
|
||||
tmp_buf = dir_buffer(PATH,DIR_ONLYREAL);
|
||||
if(dir.count<1)return 0;
|
||||
count_dir = dir.count;
|
||||
i = 0;
|
||||
size_tmp = 0;
|
||||
count_file = malloc(4096);
|
||||
while(i<count_dir)
|
||||
{
|
||||
filename = i*304+tmp_buf+72;
|
||||
sprintf(count_file,"%s/%s",PATH,filename);
|
||||
tmp = size(count_file);
|
||||
if(tmp==-1)return -1;
|
||||
size_tmp += tmp;
|
||||
i++;
|
||||
if (TestBit(ESDWORD[filename-40], 4))count_dirs++;
|
||||
else count_files++;
|
||||
}
|
||||
|
||||
free(tmp_buf);
|
||||
free(count_file);
|
||||
FILES_SIZE = size_tmp;
|
||||
return FILES_SIZE;
|
||||
}
|
||||
FILES_SIZE = BDVK.sizelo;
|
||||
count_files++;
|
||||
return FILES_SIZE;
|
||||
}
|
||||
:byte IO::del(dword PATH)
|
||||
{
|
||||
dword i,tmp_buf,count_dir,count_file;
|
||||
if(!PATH)return 0;
|
||||
if(___GetFileInfo(PATH, #BDVK))return false;
|
||||
if(BDVK.isfolder)
|
||||
{
|
||||
tmp_buf = dir_buffer(PATH,DIR_ONLYREAL);
|
||||
count_dir = dir.count;
|
||||
i = 0;
|
||||
count_file = malloc(4096);
|
||||
while(i<count_dir)
|
||||
{
|
||||
sprintf(count_file,"%s/%s",PATH,i*304+tmp_buf+72);
|
||||
if(!del(count_file))return false;
|
||||
i++;
|
||||
}
|
||||
free(tmp_buf);
|
||||
free(count_file);
|
||||
}
|
||||
file.del(PATH);
|
||||
return true;
|
||||
}
|
||||
:dword IO::set(dword PATH,atr)
|
||||
{
|
||||
dword i,tmp_buf,count_dir,count_file;
|
||||
byte cmd_read,cmd_hide,cmd_system;
|
||||
if(!PATH)return 0;
|
||||
if(___GetFileInfo(PATH, #BDVK))return false;
|
||||
cmd_read = atr&11b;
|
||||
atr>>=2;
|
||||
cmd_hide = atr&11b;
|
||||
atr>>=2;
|
||||
cmd_system = atr&11b;
|
||||
if(BDVK.isfolder)
|
||||
{
|
||||
tmp_buf = dir_buffer(PATH,DIR_ONLYREAL);
|
||||
count_dir = dir.count;
|
||||
i = 0;
|
||||
count_file = malloc(4096);
|
||||
while(i<count_dir)
|
||||
{
|
||||
sprintf(count_file,"%s/%s",PATH,i*304+tmp_buf+72);
|
||||
file.set(PATH,atr);
|
||||
i++;
|
||||
}
|
||||
free(tmp_buf);
|
||||
free(count_file);
|
||||
return 0;
|
||||
}
|
||||
if(cmd_read)
|
||||
{
|
||||
if(cmd_read&01b)BDVK.readonly = true;
|
||||
else BDVK.readonly = false;
|
||||
}
|
||||
if(cmd_hide)
|
||||
{
|
||||
if(cmd_hide&01b)BDVK.hidden = true;
|
||||
else BDVK.hidden = false;
|
||||
}
|
||||
if(cmd_system)
|
||||
{
|
||||
if(cmd_system&01b)BDVK.system = true;
|
||||
else BDVK.system = false;
|
||||
}
|
||||
file.set(PATH);
|
||||
}
|
||||
:byte IO::copy(dword PATH,PATH1)
|
||||
{
|
||||
dword i,tmp_buf,count_dir,count_file;
|
||||
dword _path_;
|
||||
byte ret;
|
||||
if(!PATH)return 0;
|
||||
if(___GetFileInfo(PATH, #BDVK))return false;
|
||||
_path_ = malloc(4096);
|
||||
if(BDVK.isfolder)
|
||||
{
|
||||
sprintf(_path_,"%s/%s",PATH1,path.file(PATH));
|
||||
dir.make(_path_);
|
||||
tmp_buf = dir_buffer(PATH,DIR_ONLYREAL);
|
||||
count_dir = dir.count;
|
||||
i = 0;
|
||||
count_file = malloc(4096);
|
||||
while(i<count_dir)
|
||||
{
|
||||
sprintf(count_file,"%s/%s",PATH,i*304+tmp_buf+72);
|
||||
if(!copy(count_file,_path_))return false;
|
||||
i++;
|
||||
}
|
||||
free(tmp_buf);
|
||||
free(count_file);
|
||||
free(_path_);
|
||||
return true;
|
||||
}
|
||||
read(PATH);
|
||||
sprintf(_path_,"%s/%s",PATH1,path.file(PATH));
|
||||
ret = file.write(FILES_SIZE,buffer_data,_path_);
|
||||
free(_path_);
|
||||
if(!ret)return true;
|
||||
return false;
|
||||
}
|
||||
:byte IO::move(dword PATH,PATH1)
|
||||
{
|
||||
if(copy(PATH,PATH1))if(del(PATH))return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
@ -36,7 +36,7 @@ char program_path[4096];
|
||||
#define BT_HIDE 0x40000000
|
||||
#define BT_NOFRAME 0x20000000
|
||||
|
||||
//Button mouse
|
||||
//Button MOUSE
|
||||
#define MOUSE_LEFT 001b
|
||||
#define MOUSE_RIGHT 010b
|
||||
#define MOUSE_LR 011b
|
||||
@ -79,24 +79,24 @@ char program_path[4096];
|
||||
};
|
||||
|
||||
/**
|
||||
* The structure of the mouse
|
||||
* The structure of the MOUSE
|
||||
* x - coordinate X
|
||||
* y - coordinate Y
|
||||
* xx and yy - time coordinates
|
||||
* lkm - left mouse button
|
||||
* pkm - right mouse button
|
||||
* mkm - mouse wheel
|
||||
* lkm - left MOUSE button
|
||||
* pkm - right MOUSE button
|
||||
* mkm - MOUSE wheel
|
||||
* key - keycode button
|
||||
* tmp - time keycode
|
||||
* down - key event press
|
||||
* up - key release events
|
||||
* move - event mouse movements
|
||||
* move - event MOUSE movements
|
||||
* click - when clicked
|
||||
* dblclick - double-click the default 50 (500 ms)
|
||||
*/
|
||||
|
||||
:dword __TMP_TIME,MOUSE_TIME;
|
||||
:struct mouse
|
||||
:struct MOUSE
|
||||
{
|
||||
signed x,y,xx,yy,lkm,mkm,pkm,key,tmp,tmp_time,hor,vert,down,up,move,click,dblclick,left,top;
|
||||
dword handle,_;
|
||||
@ -108,12 +108,12 @@ char program_path[4096];
|
||||
dword hide();
|
||||
void slider();
|
||||
void show();
|
||||
};
|
||||
:void mouse::clearTime()
|
||||
} mouse;
|
||||
:void MOUSE::clearTime()
|
||||
{
|
||||
tmp_time = GetStartTime()+MOUSE_TIME;
|
||||
}
|
||||
:void mouse::show()
|
||||
:void MOUSE::show()
|
||||
{
|
||||
if(!handle)return;
|
||||
ECX = handle;
|
||||
@ -121,7 +121,7 @@ char program_path[4096];
|
||||
EBX = 5;
|
||||
$int 0x40;
|
||||
}
|
||||
:dword mouse::hide()
|
||||
:dword MOUSE::hide()
|
||||
{
|
||||
if(!_)
|
||||
{
|
||||
@ -144,8 +144,8 @@ char program_path[4096];
|
||||
handle = EAX;
|
||||
}
|
||||
|
||||
//set new attributes mouse
|
||||
:void mouse::set()
|
||||
//set new attributes MOUSE
|
||||
:void MOUSE::set()
|
||||
{
|
||||
if((xx!=x)||(yy!=y))
|
||||
{
|
||||
@ -167,15 +167,15 @@ char program_path[4096];
|
||||
}
|
||||
}
|
||||
|
||||
:void mouse::center()
|
||||
:void MOUSE::center()
|
||||
{
|
||||
EAX = 18;
|
||||
EBX = 15;
|
||||
$int 0x40
|
||||
}
|
||||
|
||||
//get new attributes mouse
|
||||
:void mouse::get()
|
||||
//get new attributes MOUSE
|
||||
:void MOUSE::get()
|
||||
{
|
||||
EAX = 37;
|
||||
EBX = 1;
|
||||
@ -202,7 +202,7 @@ char program_path[4096];
|
||||
pkm = EBX;
|
||||
mkm = ECX;
|
||||
|
||||
//when you release the mouse button
|
||||
//when you release the MOUSE button
|
||||
// Mouse Up Event
|
||||
if((cmd)&&!(key)){
|
||||
up = true;
|
||||
@ -222,7 +222,7 @@ char program_path[4096];
|
||||
cmd = false;
|
||||
}
|
||||
|
||||
//when you press the mouse button
|
||||
//when you press the MOUSE button
|
||||
// Mouse Down Event/Move Event
|
||||
else {
|
||||
up = false;
|
||||
@ -253,7 +253,7 @@ char program_path[4096];
|
||||
|
||||
|
||||
|
||||
:void mouse::slider()
|
||||
:void MOUSE::slider()
|
||||
{
|
||||
signed _x,_y;
|
||||
if(!handle)hide();
|
||||
@ -881,6 +881,29 @@ inline fastcall dword GetStartTime()
|
||||
dword width,height;
|
||||
} SKIN;
|
||||
|
||||
:void DrawDate(dword x, y, color, in_date)
|
||||
{
|
||||
//char text[15];
|
||||
EDI = in_date;
|
||||
EAX = 47;
|
||||
EBX = 2<<16;
|
||||
EDX = x<<16+y;
|
||||
ESI = 0x80<<24+color;
|
||||
ECX = EDI.date.day;
|
||||
$int 0x40;
|
||||
EDX += 18<<16;
|
||||
ECX = EDI.date.month;
|
||||
$int 0x40;
|
||||
EDX += 18<<16;
|
||||
EBX = 4<<16;
|
||||
ECX = EDI.date.year;
|
||||
$int 0x40;
|
||||
PutPixel(x+14,y+6,color);
|
||||
PutPixel(x+32,y+6,color);
|
||||
//sprintf(#text,"%d",EDI.date.year);
|
||||
//WriteText(x, y, 0x80, 0x000000, #text);
|
||||
}
|
||||
|
||||
dword __generator; // random number generator - äëÿ ãåíåðàöèè ñëó÷àéíûõ ÷èñåë
|
||||
|
||||
:dword program_path_length;
|
||||
|
69
programs/cmm/lib/math.h
Normal file
69
programs/cmm/lib/math.h
Normal file
@ -0,0 +1,69 @@
|
||||
//IO library
|
||||
#ifndef INCLUDE_MATH_H
|
||||
#define INCLUDE_MATH_H
|
||||
|
||||
#ifndef INCLUDE_KOLIBRI_H
|
||||
#include "../lib/kolibri.h"
|
||||
#endif
|
||||
|
||||
:struct MATH
|
||||
{
|
||||
float pi();
|
||||
float cos(float x);
|
||||
float sin(float x);
|
||||
float sqrt(float x);
|
||||
float tan(float x);
|
||||
float abs(float x);
|
||||
}math;
|
||||
:float MATH::abs(float x)
|
||||
{
|
||||
IF(x<0)return -x;
|
||||
return x;
|
||||
}
|
||||
|
||||
:float MATH::cos(float x)
|
||||
{
|
||||
float r;
|
||||
asm
|
||||
{
|
||||
fld x
|
||||
fcos
|
||||
fstp r
|
||||
}
|
||||
return r;
|
||||
}
|
||||
:float MATH::sin(float x)
|
||||
{
|
||||
float r;
|
||||
asm
|
||||
{
|
||||
fld x
|
||||
fsin
|
||||
fstp r
|
||||
}
|
||||
return r;
|
||||
}
|
||||
:float MATH::sqrt(float x)
|
||||
{
|
||||
float r;
|
||||
asm
|
||||
{
|
||||
fld x
|
||||
fsqrt
|
||||
fstp r
|
||||
}
|
||||
return r;
|
||||
}
|
||||
:float MATH::tan(float x)
|
||||
{
|
||||
float r;
|
||||
asm
|
||||
{
|
||||
fld x
|
||||
fld1
|
||||
fpatan
|
||||
fstp r
|
||||
}
|
||||
return r;
|
||||
}
|
||||
#endif
|
@ -1,10 +1,6 @@
|
||||
#ifndef INCLUDE_STRING_H
|
||||
#define INCLUDE_STRING_H
|
||||
|
||||
#ifndef INCLUDE_KOLIBRI_H
|
||||
#include "../lib/kolibri.h"
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_MEM_H
|
||||
#include "../lib/mem.h"
|
||||
#endif
|
||||
|
@ -141,7 +141,6 @@ void MailBoxNetworkProcess() {
|
||||
|
||||
void MailBoxLoop() {
|
||||
int key, id;
|
||||
mouse m;
|
||||
int panels_drag=0, clicked_list=0;
|
||||
dword line_col, text_col;
|
||||
|
||||
@ -160,20 +159,20 @@ void MailBoxLoop() {
|
||||
{
|
||||
case evMouse:
|
||||
IF (!CheckActiveProcess(Form.ID)) break;
|
||||
m.get();
|
||||
mouse.get();
|
||||
|
||||
if (!m.lkm) panels_drag=0;
|
||||
if (m.lkm) && (m.y>mail_list.y+mail_list.h-1) && (m.y<mail_list.y+mail_list.h+6)
|
||||
if (!mouse.lkm) panels_drag=0;
|
||||
if (mouse.lkm) && (mouse.y>mail_list.y+mail_list.h-1) && (mouse.y<mail_list.y+mail_list.h+6)
|
||||
&& (!scroll1.delta2) && (!scroll_wv.delta2) panels_drag = 1;
|
||||
if (panels_drag)
|
||||
{
|
||||
if (m.y<mail_list.y+mail_list.min_h) || (m.y>Form.cheight-WB1.list.min_h-status_bar_h-LIST_INFO_H) break;
|
||||
mail_list.h = m.y - mail_list.y-2;
|
||||
if (mouse.y<mail_list.y+mail_list.min_h) || (mouse.y>Form.cheight-WB1.list.min_h-status_bar_h-LIST_INFO_H) break;
|
||||
mail_list.h = mouse.y - mail_list.y-2;
|
||||
DrawMailBox();
|
||||
break;
|
||||
}
|
||||
|
||||
PageLinks.Hover(m.x, m.y, link_color_inactive, link_color_active, bg_color);
|
||||
PageLinks.Hover(mouse.x, mouse.y, link_color_inactive, link_color_active, bg_color);
|
||||
|
||||
if (!mail_list.count) break;
|
||||
if (!panels_drag) { scrollbar_v_mouse (#scroll1); scrollbar_v_mouse (#scroll_wv); }
|
||||
@ -191,16 +190,16 @@ void MailBoxLoop() {
|
||||
break;
|
||||
};
|
||||
|
||||
if (mail_list.y+mail_list.h + 10 > m.y)
|
||||
if (mail_list.y+mail_list.h + 10 > mouse.y)
|
||||
{
|
||||
if (mail_list.MouseScroll(m.vert)) DrawMailList();
|
||||
if (mail_list.MouseScroll(mouse.vert)) DrawMailList();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (WB1.list.MouseScroll(m.vert)) DrawLetter();
|
||||
if (WB1.list.MouseScroll(mouse.vert)) DrawLetter();
|
||||
}
|
||||
if (m.lkm) && (mail_list.MouseOver(m.x, m.y)) && (!clicked_list) clicked_list=1;
|
||||
if (!m.lkm) && (clicked_list) if (mail_list.ProcessMouse(m.x, m.y))
|
||||
if (mouse.lkm) && (mail_list.MouseOver(mouse.x, mouse.y)) && (!clicked_list) clicked_list=1;
|
||||
if (!mouse.lkm) && (clicked_list) if (mail_list.ProcessMouse(mouse.x, mouse.y))
|
||||
{
|
||||
clicked_list = 0;
|
||||
if (aim) break;
|
||||
|
@ -56,7 +56,6 @@ struct mouse_cfg1 {
|
||||
|
||||
void main() {
|
||||
char id, old_button_clicked;
|
||||
mouse m;
|
||||
|
||||
mem_Init();
|
||||
load_dll(boxlib, #box_lib_init,0);
|
||||
@ -67,13 +66,13 @@ void main() {
|
||||
loop() switch(WaitEvent())
|
||||
{
|
||||
case evMouse:
|
||||
m.get();
|
||||
if (m.y <= mouse_frame.start_y) || (m.y >= mouse_frame.start_y + mouse_frame.size_y)
|
||||
|| (m.x >= mouse_frame.start_x + mouse_frame.size_x) || (m.x <= mouse_frame.start_x) break;
|
||||
mouse.get();
|
||||
if (mouse.y <= mouse_frame.start_y) || (mouse.y >= mouse_frame.start_y + mouse_frame.size_y)
|
||||
|| (mouse.x >= mouse_frame.start_x + mouse_frame.size_x) || (mouse.x <= mouse_frame.start_x) break;
|
||||
old_button_clicked = mouse_cfg.button_clicked;
|
||||
if (m.lkm) mouse_cfg.button_clicked=1;
|
||||
else if (m.pkm) mouse_cfg.button_clicked=2;
|
||||
else if (m.mkm) mouse_cfg.button_clicked=3;
|
||||
if (mouse.lkm) mouse_cfg.button_clicked=1;
|
||||
else if (mouse.pkm) mouse_cfg.button_clicked=2;
|
||||
else if (mouse.mkm) mouse_cfg.button_clicked=3;
|
||||
else mouse_cfg.button_clicked=0;
|
||||
if (mouse_cfg.button_clicked != old_button_clicked) DrawMouseImage();
|
||||
break;
|
||||
|
@ -73,8 +73,10 @@ char work_folder[4096],
|
||||
|
||||
void main()
|
||||
{
|
||||
int id, key, mouse_clicked;
|
||||
mouse m, drag_mouse;
|
||||
int id, key;
|
||||
byte mouse_clicked;
|
||||
dword tmp_x,tmp_y;
|
||||
dword z1,z2;
|
||||
|
||||
mem_Init();
|
||||
SetEventMask(0x27);
|
||||
@ -112,47 +114,62 @@ void main()
|
||||
|
||||
loop()
|
||||
{
|
||||
WaitEventTimeout(60);
|
||||
WaitEventTimeout(10);
|
||||
|
||||
//ActivateWindow(Form.ID);
|
||||
switch(EAX & 0xFF) {
|
||||
case evMouse:
|
||||
if (!CheckActiveProcess(Form.ID)) break;
|
||||
mouse.get();
|
||||
scrollbar_v_mouse (#scroll1);
|
||||
if (list.first <> scroll1.position)
|
||||
if (list.first != scroll1.position)
|
||||
{
|
||||
list.first = scroll1.position;
|
||||
DrawPlayList();
|
||||
break;
|
||||
}
|
||||
m.get();
|
||||
|
||||
if (m.vert) if (list.MouseScroll(m.vert))
|
||||
if(mouse.down)
|
||||
{
|
||||
if (mouse.vert) if (list.MouseScroll(mouse.vert))
|
||||
{
|
||||
DrawPlayList();
|
||||
}
|
||||
|
||||
if (mouse_clicked)
|
||||
if (list.MouseOver(mouse.x, mouse.y)) mouse_clicked = true;
|
||||
else if(mouse.y < skin.h) && (mouse.x < 13)
|
||||
{
|
||||
if (!m.lkm) && (list.ProcessMouse(m.x, m.y)) StartPlayingMp3();
|
||||
mouse_clicked=0;
|
||||
}
|
||||
if (m.lkm) && (list.MouseOver(m.x, m.y)) mouse_clicked=1;
|
||||
//drag window - emulate windows header
|
||||
if (window_mode == WINDOW_MODE_SMALL) && (m.lkm) && (m.y < skin.h) && (m.x < 13)
|
||||
{
|
||||
tmp_x = mouse.x;
|
||||
tmp_y = mouse.y;
|
||||
do {
|
||||
drag_mouse.get();
|
||||
if (drag_mouse.x!=m.x) || (drag_mouse.y!=m.y)
|
||||
mouse.get();
|
||||
if (tmp_x!=mouse.x) || (tmp_y!=mouse.y)
|
||||
{
|
||||
MoveSize(Form.left + drag_mouse.x - m.x, Form.top + drag_mouse.y - m.y, OLD, OLD);
|
||||
z1 = Form.left + mouse.x - tmp_x;
|
||||
z2 = Form.top + mouse.y - tmp_y;
|
||||
if(z1<=10)z1=0;
|
||||
if(z2<=10)z2=0;
|
||||
if(z1>screen.width-Form.width-10)z1=screen.width-Form.width;
|
||||
if(z2>screen.height-Form.height-10)z2=screen.height-Form.height;
|
||||
//if(z2<10)z2=0;
|
||||
MoveSize(z1 , z2, OLD, OLD);
|
||||
DrawWindow();
|
||||
}
|
||||
pause(2);
|
||||
} while (drag_mouse.lkm);
|
||||
}
|
||||
if (m.pkm) && (m.y > skin.h)
|
||||
pause(1);
|
||||
} while (mouse.lkm);
|
||||
if (mouse.pkm) && (mouse.y > skin.h)
|
||||
notify("'Pixies Player v1.11\nChange sound volume: Left/Right key\nChange skin: F1/F2\nMute: M key' -St\n");
|
||||
break;
|
||||
|
||||
}
|
||||
else if(mouse.up)
|
||||
{
|
||||
if (mouse_clicked)&&(list.ProcessMouse(mouse.x, mouse.y))
|
||||
{
|
||||
StartPlayingMp3();
|
||||
mouse_clicked = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
case evButton:
|
||||
id=GetButtonID();
|
||||
switch(id) {
|
||||
@ -217,7 +234,7 @@ void main()
|
||||
if (key==51) SetColorThemeDark();
|
||||
if (key==ASCII_KEY_LEFT) RunProgram("@VOLUME", "-");
|
||||
if (key==ASCII_KEY_RIGHT) RunProgram("@VOLUME", "+");
|
||||
if (key=='m') RunProgram("@VOLUME", "m");
|
||||
if (key=='mouse') RunProgram("@VOLUME", "mouse");
|
||||
if (key==ASCII_KEY_ENTER) StartPlayingMp3();
|
||||
if (key=='p') || (key==ASCII_KEY_SPACE)
|
||||
{
|
||||
@ -228,8 +245,8 @@ void main()
|
||||
break;
|
||||
|
||||
case evReDraw:
|
||||
if (window_mode == WINDOW_MODE_NORMAL) DefineAndDrawWindow(win_x_normal, win_y_normal, skin.w - 1, skin.h + list.h, 0x01,0,0,0);
|
||||
if (window_mode == WINDOW_MODE_SMALL) DefineAndDrawWindow(win_x_small, win_y_small, 99, skin.h - 1, 0x01,0,0,0);
|
||||
if (window_mode == WINDOW_MODE_NORMAL) DefineAndDrawWindow(win_x_normal, win_y_normal, skin.w - 1, skin.h + list.h, 0x41,0,0,0);
|
||||
if (window_mode == WINDOW_MODE_SMALL) DefineAndDrawWindow(win_x_small, win_y_small, 99, skin.h - 1, 0x41,0,0,0);
|
||||
DrawWindow();
|
||||
break;
|
||||
|
||||
|
@ -18,7 +18,6 @@ SOFTWARE CENTER v2.31
|
||||
|
||||
system_colors sc;
|
||||
proc_info Form;
|
||||
mouse m;
|
||||
|
||||
byte kolibrios_mounted;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user