From 211966e1dd901327d2321211be98707d9b06ad29 Mon Sep 17 00:00:00 2001 From: pavelyakov Date: Sat, 1 Aug 2015 22:08:58 +0000 Subject: [PATCH] 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 --- programs/cmm/Calypte/Calypte.c | 5 +- programs/cmm/appearance/appearance.c | 15 +- programs/cmm/browser/WebView.c | 32 +- programs/cmm/browser/downloader.h | 2 +- programs/cmm/browser/menu_rmb.h | 9 +- programs/cmm/downloader/Downloader.c | 2 +- programs/cmm/end/end.c | 14 +- programs/cmm/eolite/Eolite.c | 67 ++- programs/cmm/eolite/include/menu.h | 9 +- programs/cmm/example/example.c | 16 +- programs/cmm/lib/date.h | 16 + programs/cmm/lib/file_system.h | 79 +-- programs/cmm/lib/io.h | 473 ++++++++++++++++++ programs/cmm/lib/kolibri.h | 61 ++- programs/cmm/lib/math.h | 69 +++ programs/cmm/lib/strings.h | 4 - programs/cmm/liza/mail_box.c | 23 +- programs/cmm/mouse_cfg/mouse_cfg.c | 13 +- programs/cmm/pixie/pixie.c | 85 ++-- .../cmm/software_widget/software_widget.c | 1 - 20 files changed, 773 insertions(+), 222 deletions(-) create mode 100644 programs/cmm/lib/date.h create mode 100644 programs/cmm/lib/io.h create mode 100644 programs/cmm/lib/math.h diff --git a/programs/cmm/Calypte/Calypte.c b/programs/cmm/Calypte/Calypte.c index 49f573ee2f..6617eb22e5 100644 --- a/programs/cmm/Calypte/Calypte.c +++ b/programs/cmm/Calypte/Calypte.c @@ -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) diff --git a/programs/cmm/appearance/appearance.c b/programs/cmm/appearance/appearance.c index 795b6ed445..76272ce148 100644 --- a/programs/cmm/appearance/appearance.c +++ b/programs/cmm/appearance/appearance.c @@ -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; diff --git a/programs/cmm/browser/WebView.c b/programs/cmm/browser/WebView.c index 869d88bc62..b4127a3e2f 100644 --- a/programs/cmm/browser/WebView.c +++ b/programs/cmm/browser/WebView.c @@ -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.yWB1.list.y) && (mouse.y=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: diff --git a/programs/cmm/browser/downloader.h b/programs/cmm/browser/downloader.h index 0af589bbcd..6247ef3c1b 100644 --- a/programs/cmm/browser/downloader.h +++ b/programs/cmm/browser/downloader.h @@ -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]) { diff --git a/programs/cmm/browser/menu_rmb.h b/programs/cmm/browser/menu_rmb.h index b60721a009..baa47a0e61 100644 --- a/programs/cmm/browser/menu_rmb.h +++ b/programs/cmm/browser/menu_rmb.h @@ -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(); } diff --git a/programs/cmm/downloader/Downloader.c b/programs/cmm/downloader/Downloader.c index cd722cda90..94b8658185 100644 --- a/programs/cmm/downloader/Downloader.c +++ b/programs/cmm/downloader/Downloader.c @@ -44,7 +44,7 @@ DrawBufer diagram; void main() { int key, btn; - mouse m; + char filepath[4096]; char notify_message[4296]; diff --git a/programs/cmm/end/end.c b/programs/cmm/end/end.c index d957a4b1c9..c4f8115e0b 100644 --- a/programs/cmm/end/end.c +++ b/programs/cmm/end/end.c @@ -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; - } + _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); draw_main_area(PANEL_X, PANEL_Y, PANEL_SIZE_X, PANEL_SIZE_Y); break; default: _DRAW: diff --git a/programs/cmm/eolite/Eolite.c b/programs/cmm/eolite/Eolite.c index 082d2b3217..4ee4a7629a 100644 --- a/programs/cmm/eolite/Eolite.c +++ b/programs/cmm/eolite/Eolite.c @@ -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.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=Form.width-26) && (mouse.x<=Form.width-6) && (mouse.y>40) && (mouse.y0) + 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=Form.width-26) && (mouse.x<=Form.width-6) && (mouse.y>onTop(22,0)+1) && (mouse.y=Form.width-26) && (m.x<=Form.width-6) && (m.y>56) && (m.y=Form.width-26) && (mouse.x<=Form.width-6) && (mouse.y>56) && (mouse.ym.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(); diff --git a/programs/cmm/eolite/include/menu.h b/programs/cmm/eolite/include/menu.h index ed3c115687..92cc801bba 100644 --- a/programs/cmm/eolite/include/menu.h +++ b/programs/cmm/eolite/include/menu.h @@ -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); diff --git a/programs/cmm/example/example.c b/programs/cmm/example/example.c index a33527e486..be5bec7142 100644 --- a/programs/cmm/example/example.c +++ b/programs/cmm/example/example.c @@ -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: diff --git a/programs/cmm/lib/date.h b/programs/cmm/lib/date.h new file mode 100644 index 0000000000..9e35b1499c --- /dev/null +++ b/programs/cmm/lib/date.h @@ -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 \ No newline at end of file diff --git a/programs/cmm/lib/file_system.h b/programs/cmm/lib/file_system.h index 9c984c4ee8..b48206ecd0 100644 --- a/programs/cmm/lib/file_system.h +++ b/programs/cmm/lib/file_system.h @@ -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,32 +31,11 @@ }; -: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); -} -/////////////////////////// -// Параметры файла // + + /////////////////////////// + // Параметры файла // /////////////////////////// :f70 getinfo_file_70; :dword GetFileInfo(dword file_path, bdvk_struct) @@ -83,9 +52,9 @@ $int 0x40 } -/////////////////////////// -// Изменение параметров файла // -/////////////////////////// + ///////////////////////////////////// + // Изменение параметров файла // +///////////////////////////////////// :f70 setinfo_file_70; :dword SetFileInfo(dword file_path, bdvk_struct) { @@ -101,8 +70,8 @@ $int 0x40 } -/////////////////////////// -// Запуск программы // + /////////////////////////// + // Запуск программы // /////////////////////////// :f70 run_file_70; :signed int RunProgram(dword run_path, run_param) @@ -119,8 +88,8 @@ $int 0x40 } -/////////////////////////// -// Создание папки // + /////////////////////////// + // Создание папки // /////////////////////////// :f70 create_dir_70; :int CreateDir(dword new_folder_path) @@ -137,8 +106,8 @@ $int 0x40 } -//////////////////////////// -// Удаление файла/папки // + //////////////////////////// + // Удаление файла/папки // //////////////////////////// :f70 del_file_70; :int DeleteFile(dword del_file_path) @@ -155,8 +124,8 @@ $int 0x40 } -//////////////////////////// -// Прочитать файл // + //////////////////////////// + // Прочитать файл // //////////////////////////// :f70 read_file_70; :int ReadFile(dword read_pos, read_file_size, read_buffer, read_file_path) @@ -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 // -////////////////////////////////////////// + //////////////////////////////////////// + // WriteInFileThatAlredyExists // +//////////////////////////////////////// :f70 write_file_offset_70; :int WriteFileWithOffset(dword write_data_size, write_buffer, write_file_path, offset) { @@ -209,8 +178,8 @@ $int 0x40 } -/////////////////////////// -// Прочитать папку // + /////////////////////////// + // Прочитать папку // /////////////////////////// :f70 read_dir_70; :int ReadDir(dword file_count, read_buffer, dir_path) diff --git a/programs/cmm/lib/io.h b/programs/cmm/lib/io.h new file mode 100644 index 0000000000..0ce2dc201a --- /dev/null +++ b/programs/cmm/lib/io.h @@ -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 "Ѓ" +#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>=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(imail_list.y+mail_list.h-1) && (m.ymail_list.y+mail_list.h-1) && (mouse.yForm.cheight-WB1.list.min_h-status_bar_h-LIST_INFO_H) break; - mail_list.h = m.y - mail_list.y-2; + if (mouse.yForm.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; diff --git a/programs/cmm/mouse_cfg/mouse_cfg.c b/programs/cmm/mouse_cfg/mouse_cfg.c index 2ce65356e8..4d6b4eaa3c 100644 --- a/programs/cmm/mouse_cfg/mouse_cfg.c +++ b/programs/cmm/mouse_cfg/mouse_cfg.c @@ -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; diff --git a/programs/cmm/pixie/pixie.c b/programs/cmm/pixie/pixie.c index e5e35c060a..95d4f2e3c7 100644 --- a/programs/cmm/pixie/pixie.c +++ b/programs/cmm/pixie/pixie.c @@ -73,9 +73,11 @@ 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); load_dll(boxlib, #box_lib_init,0); @@ -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)) - { - DrawPlayList(); - } - - if (mouse_clicked) - { - 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) + if(mouse.down) { - do { - drag_mouse.get(); - if (drag_mouse.x!=m.x) || (drag_mouse.y!=m.y) + if (mouse.vert) if (list.MouseScroll(mouse.vert)) + { + DrawPlayList(); + } + if (list.MouseOver(mouse.x, mouse.y)) mouse_clicked = true; + else if(mouse.y < skin.h) && (mouse.x < 13) + { + //drag window - emulate windows header + tmp_x = mouse.x; + tmp_y = mouse.y; + do { + mouse.get(); + if (tmp_x!=mouse.x) || (tmp_y!=mouse.y) + { + 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(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)) { - MoveSize(Form.left + drag_mouse.x - m.x, Form.top + drag_mouse.y - m.y, OLD, OLD); - DrawWindow(); + StartPlayingMp3(); + mouse_clicked = false; } - pause(2); - } while (drag_mouse.lkm); + break; + } } - if (m.pkm) && (m.y > skin.h) - notify("'Pixies Player v1.11\nChange sound volume: Left/Right key\nChange skin: F1/F2\nMute: M key' -St\n"); - 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; diff --git a/programs/cmm/software_widget/software_widget.c b/programs/cmm/software_widget/software_widget.c index a8723f5a41..de0cced32e 100644 --- a/programs/cmm/software_widget/software_widget.c +++ b/programs/cmm/software_widget/software_widget.c @@ -18,7 +18,6 @@ SOFTWARE CENTER v2.31 system_colors sc; proc_info Form; -mouse m; byte kolibrios_mounted;