From 8d7c71d76f026ef4b7c44082152175883530e7df Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Sat, 8 Jan 2022 17:31:08 +0000 Subject: [PATCH] @reshare: add UI window, there you can see icon numbers btw various fixes git-svn-id: svn://kolibrios.org@9594 a494cfbc-eb01-0410-851d-a64ba20cac60 --- data/common/File Managers/icons.ini | 3 +- data/common/icons16.png | Bin 11927 -> 11926 bytes data/eng/settings/menu.dat | 1 + data/rus/settings/menu.dat | 1 + programs/cmm/c--/c--.ini | 2 +- programs/cmm/imgedit/build.bat | 3 +- programs/cmm/lib/kolibri.h | 1 - programs/cmm/lib/obj/libimg.h | 8 +- programs/cmm/lib/patterns/toolbar_button.h | 1 + programs/cmm/misc/reshare.c | 249 +++++++++++++++++---- 10 files changed, 209 insertions(+), 60 deletions(-) diff --git a/data/common/File Managers/icons.ini b/data/common/File Managers/icons.ini index ab7e660efa..2731225057 100644 --- a/data/common/File Managers/icons.ini +++ b/data/common/File Managers/icons.ini @@ -136,6 +136,7 @@ html=12 mht=12 eml=12 url=12 +cpp=14 js=14 json=14 lif=15 @@ -171,7 +172,7 @@ java=27 pas=27 pp=27 xml=27 -cpp=14 +bas=28 fb2=29 ob7=29 grf=47 diff --git a/data/common/icons16.png b/data/common/icons16.png index 75911682cc54a08b6c37f44264ba6619df8c0b0c..32db009d43846ee1db03ab8248a11dfae639264d 100644 GIT binary patch delta 5281 zcmV;S6kh9>U6x&tBmrHqB?cOQzCB;pZ-07Xpfpbq3b=vXV1_R9PVty4H;~&tLzi*Q zmP6*z?ZQ4C%+Nug&$l0;g0GIqaLv|3r{fj-?J$EOUyCPpA;aR&_XZO3q71_fL}oAE zMhjMc9Z6$nu9Ywe!UkX}khkqp_fMI(fqD#IP!5u>-Lt`hNQGGLWiu>)W7&3@anhVZ zt#lCQ3jr0&TJ~SzIQ2-=L9`x{VVqGF(sU4459v2VLU~9x(Ajw!W2Jz+Tt{FKk3n@z zMe>k5knICBl!s&p4+%e*;RS)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zFU{<2bMbln5Eg$;p(HS3m`S8#jup!o?0@AEeudGS~-(1PvIPM(I;# zY1Oo4ODVVgC@Vo2xroFg--#Am!wNmoa;pX_5GZJMTzxivY9GeE+RI1~5^y>Z2K}>_ zk!Nk#^;d{@&6S5?#AW1JLnQA%U1TCcXlHtVU#Vrlkf5Ae)#b*rKVK&G+28$zd}>*L z6U30PvVamHqf5_JS=V?3h6F|ZO*Tt{+P~UO_J{IkjaWl_yr`&1n->fT(m@cSAmT8e zhlVb%3DP+&=*B19!*SIePb@zGp-~>N1E?E+kW(* zviNKyL>a6rKi_0pX@a;45Hhf`a`L5SWi6vASvmC1=&2StK<&E>Fbmo}AawN`ZcUQ9u4Zj1-qr~a%dNvp>(rw}NP?<~MJ4gb3Nl>81w8gU zK(SagQ#z2_{>rn+Qphb$v%kusbK0W7poCeJ5KtlpE#Fw;ctYGr*lmkN32|(ddZz}y z__CTcwF>kr9~E$Amo8Ly{t~Kxo{}PU@9JE-<^AEVK*J6J0EON=cz{0s=7>c|1Dt`{ z1t?w+Y(uRM@1Zw~57I+BH<&QT^cabD2p2@iak}bSX%(beWvJHZAg#sG5eGm@lt5m) zRVD~WKmmpT;D87vB_+wc_iijOt+IenEfi!cxM92D4NJ%+Ae(QyPg((gYXCwS2MDJa z1=$LO#uFq37$C3)0PF_@WwaJG+Pl+)04hO7`8%WdKoX+B93Yqs5VwsALE~aSpL&KN z-2&p%k0bKgU60000) || (w<=0) || (w>60000) return; //bad boy :) EAX = 13; EBX = x<<16+w; ECX = y<<16+h; diff --git a/programs/cmm/lib/obj/libimg.h b/programs/cmm/lib/obj/libimg.h index cc26554a55..5338947c33 100644 --- a/programs/cmm/lib/obj/libimg.h +++ b/programs/cmm/lib/obj/libimg.h @@ -184,11 +184,6 @@ struct libimg_image } } -:dword create_image(dword type, dword width, dword height) { - img_create stdcall(width, height, type); - return EAX; -} - // size - output parameter, error code / the size of encoded data :dword encode_image(dword image_ptr, dword options, dword specific_options, dword* size) { img_encode stdcall(image_ptr, options, specific_options); @@ -203,7 +198,8 @@ struct libimg_image dword encoded_size=0; dword image_ptr = 0; - image_ptr = create_image(IMAGE_BPP24, _w, _h); + img_create stdcall(_w, _h, IMAGE_BPP24); + image_ptr = EAX; if (!image_ptr) { return "Error creating image!"; diff --git a/programs/cmm/lib/patterns/toolbar_button.h b/programs/cmm/lib/patterns/toolbar_button.h index b753bb0331..2602c34730 100644 --- a/programs/cmm/lib/patterns/toolbar_button.h +++ b/programs/cmm/lib/patterns/toolbar_button.h @@ -1,3 +1,4 @@ +//<= imgsrc, imgsize, color_old_1, color_new_1, color_old_2, color_new_2 inline fastcall replace_2cols(EDI, EDX, ESI, ECX, EBX, EAX) { EDX += EDI; //imgsrc + imgsize; diff --git a/programs/cmm/misc/reshare.c b/programs/cmm/misc/reshare.c index d0dfaeca5c..ffab31733b 100644 --- a/programs/cmm/misc/reshare.c +++ b/programs/cmm/misc/reshare.c @@ -1,10 +1,209 @@ #define MEMSIZE 1024*20 #define ENTRY_POINT #main +//===================================================// +// // +// LIB // +// // +//===================================================// + #include "../lib/fs.h" #include "../lib/mem.h" #include "../lib/obj/libimg.h" #include "../lib/patterns/rgb.h" +#include "../lib/patterns/restart_process.h" +#include "../lib/patterns/toolbar_button.h" + +//===================================================// +// // +// GLOBAL VARS // +// // +//===================================================// + +libimg_image icons32; +libimg_image icons16; +libimg_image icons16w; +unsigned int size32; +unsigned int size16; + +//===================================================// +// // +// MAIN // +// // +//===================================================// + +void main() +{ + mem_init(); + load_dll(libimg, #libimg_init, 1); + + icons32.load("/SYS/ICONS32.PNG"); size32 = icons32.h * 32 * 4; + icons16.load("/SYS/ICONS16.PNG"); size16 = icons16.h * 18 * 4; + + if (GetProcessesCount("@RESHARE")>1) { + start_ui(); + } else { + start_daemon(); + } +} + +//===================================================// +// // +// DAEMON // +// // +//===================================================// + +void start_daemon() +{ + char* shared_i32; + char* shared_i16; + char* shared_i16w; + char* shared_chbox; + + shared_chbox = memopen("CHECKBOX", 507, SHM_CREATE+SHM_WRITE); + memmov(shared_chbox, #checkbox_flag, 507); + + shared_i32 = memopen("ICONS32", size32, SHM_CREATE+SHM_WRITE); + memmov(shared_i32, icons32.imgsrc, size32); + img_destroy stdcall(icons32.image); + + shared_i16 = memopen("ICONS18", size16, SHM_CREATE + SHM_WRITE); + memmov(shared_i16, icons16.imgsrc, size16); + //img_destroy stdcall(icons16.image); + + shared_i16w = memopen("ICONS18W", size16, SHM_CREATE + SHM_WRITE); + + @SetEventMask(EVM_DESKTOPBG); + do { + $push sc.work + sc.get(); + $pop eax + if (sc.work != EAX) { + memmov(shared_i16w, icons16.imgsrc, size16); + replace_2cols(shared_i16w, size16, 0xffFFFfff, sc.work, 0xffCACBD6, sc.work_dark); + } + } while(WaitEvent()==evDesktop); +} + +//===================================================// +// // +// UI // +// // +//===================================================// + +#define WINW 775 +#define WINH 660 +#define PAD 10 +#define BTNW 100 +#define BTNH 24 +#define RESY PAD+30+BTNH+BTNH + +enum { ACTIVE_ICONS32=1, ACTIVE_ICONS16=2, ACTIVE_ICONS16W=4, ACTIVE_CHECKBOX=8 }; +int active_tab = ACTIVE_ICONS32; + +void start_ui() +{ + loop() switch(WaitEvent()) + { + case evKey: + @GetKeyScancode(); + if (AL == SCAN_CODE_ESC) ExitProcess(); + if (AL == SCAN_CODE_TAB) { + active_tab <<= 1; + if (active_tab > ACTIVE_CHECKBOX) active_tab = 1; + draw_tabs(); + } + break; + + case evButton: + GetButtonID(); + if (1==EAX) { + ExitProcess(); + } else { + active_tab = EAX - 10; + draw_tabs(); + } + break; + + case evReDraw: + sc.get(); + DefineAndDrawWindow(80, 50, WINW+9, WINH+4+GetSkinHeight(), 0x74, 0, "@RESHARE - A service that provides shared resorces", 0); + DrawBar(0, 0, WINW, RESY-PAD-1, sc.work); //top bg + DrawBar(0, RESY-PAD-1, WINW, 1, sc.work_graph); + WriteText(PAD, PAD, 0x90, sc.work_text, "Each tab name corresponds to memory name that can be accessed by sysfunc 68.22. Now availabe:"); + draw_tabs(); + } +} + +void DrawFlatButton(dword _x, _y, _text, _id, _active) +{ + if (_active) EDX = sc.button; else EDX = sc.work_light; + DrawBar(_x, _y, BTNW, BTNH+1, EDX); + + if (_active) EDX = sc.button_text; else EDX = sc.work_text; + WriteText(-strlen(_text)*8+BTNW/2+_x, _y+6, 0x90, EDX, _text); + + PutPixel(_x,_y,sc.work); + PutPixel(_x,_y+BTNH,EDX); + PutPixel(_x+BTNW-1,_y,EDX); + PutPixel(_x+BTNW-1,_y+BTNH,EDX); + + DefineHiddenButton(_x, _y, BTNW-1, BTNH, _id); +} + +void draw_tabs() +{ + #define TABX WINW-BTNW-PAD-BTNW-PAD-BTNW-PAD-BTNW/2 + DrawFlatButton( TABX, PAD+30, "ICONS32", 10+ACTIVE_ICONS32, active_tab & ACTIVE_ICONS32); + DrawFlatButton(PAD+BTNW*1+TABX, PAD+30, "ICONS16", 10+ACTIVE_ICONS16, active_tab & ACTIVE_ICONS16); + DrawFlatButton(PAD+BTNW*2+TABX, PAD+30, "ICONS16W", 10+ACTIVE_ICONS16W, active_tab & ACTIVE_ICONS16W); + DrawFlatButton(PAD+BTNW*3+TABX, PAD+30, "CHECKBOX", 10+ACTIVE_CHECKBOX, active_tab & ACTIVE_CHECKBOX); + draw_tab_icons32(); +} + +void draw_tab_icons32() +{ + int i; + int x=PAD, y; + int iconimg; + int iconh; + int iconw; + + DrawBar(0, RESY-PAD, WINW, WINH-RESY+PAD, sc.work); + if (active_tab & ACTIVE_ICONS32) { + iconimg = icons32.imgsrc; + iconw = 32; + iconh = icons32.h; + } else if (active_tab & ACTIVE_ICONS16) { + iconimg = icons16.imgsrc; + iconw = 18; + iconh = icons16.h; + } else if (active_tab & ACTIVE_ICONS16W) { + iconimg = memopen("ICONS18W", NULL, SHM_READ); + iconw = 18; + iconh = icons16.h; + } else { + _PutImage(WINW-13/2, WINH-RESY-13/2+RESY, 13, 13, #checkbox_flag); + return; + } + + for (i = 0; i < iconh/iconw; i++) + { + PutPaletteImage(iconw*iconw*4*i + iconimg, iconw, iconw, 50-iconw/2+x, y+RESY, 32, 0); + WriteText(-strlen(itoa(i))*8+50/2+x, y+RESY+iconw+5, 0x90, sc.work_graph, itoa(i)); + x += 50; + if (x + 50 > WINW) { + x = PAD; + y += iconw + 30; + } + } +} + +//===================================================// +// // +// DATA // +// // +//===================================================// :unsigned char checkbox_flag[507] = { 0xFC, 0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC, 0xD4, 0x04, 0xFC, @@ -39,52 +238,4 @@ 0x04, 0xF9, 0x98, 0x04, 0xFC, 0xB4, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04, 0xF9, 0x98, 0x04 -}; - -void main() -{ - libimg_image icons32; - libimg_image icons16; - libimg_image icons16w; - unsigned int size32; - unsigned int size16; - char* shared_i32; - char* shared_i16; - char* shared_i16w; - char* shared_chbox; - - mem_init(); - load_dll(libimg, #libimg_init, 1); - @SetEventMask(EVM_DESKTOPBG); - - shared_chbox = memopen("CHECKBOX", sizeof(checkbox_flag), SHM_CREATE+SHM_WRITE); - memmov(shared_chbox, #checkbox_flag, sizeof(checkbox_flag)); - - icons32.load("/sys/icons32.png"); size32 = icons32.h * 32 * 4; - icons16.load("/sys/icons16.png"); size16 = icons16.h * 18 * 4; - - shared_i32 = memopen("ICONS32", size32, SHM_CREATE+SHM_WRITE); - memmov(shared_i32, icons32.imgsrc, size32); - img_destroy stdcall(icons32.image); - - shared_i16 = memopen("ICONS18", size16, SHM_CREATE + SHM_WRITE); - memmov(shared_i16, icons16.imgsrc, size16); - img_destroy stdcall(icons16.image); - - shared_i16w = memopen("ICONS18W", size16, SHM_CREATE + SHM_WRITE); - -UPDATE_ICONS18WORK: - $push sc.work - sc.get(); - $pop eax - if (sc.work != EAX) { - icons16w.load("/sys/icons16.png"); - icons16w.replace_2colors(0xffFFFfff, sc.work, 0xffCACBD6, MixColors(sc.work, 0, 200)); - memmov(shared_i16w, icons16w.imgsrc, size16); - img_destroy stdcall(icons16w.image); - icons16w.image = NULL; - } - - loop() IF(WaitEvent()==evDesktop) GOTO UPDATE_ICONS18WORK; -} - +}; \ No newline at end of file