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 75911682cc..32db009d43 100644 Binary files a/data/common/icons16.png and b/data/common/icons16.png differ diff --git a/data/eng/settings/menu.dat b/data/eng/settings/menu.dat index bb9266fa50..56719b9d4d 100644 --- a/data/eng/settings/menu.dat +++ b/data/eng/settings/menu.dat @@ -54,6 +54,7 @@ 13 Debug Board |develop/board 09 KPack Archiver |kpack 20 Diff Tool |develop/diff +52 Shared resources |@reshare 34 Base Converter |develop/h2d2b 59 Character table |develop/ASCIIVju 59 Key ASCII-codes |develop/keyascii diff --git a/data/rus/settings/menu.dat b/data/rus/settings/menu.dat index 0e2ea85239..1896b51041 100644 --- a/data/rus/settings/menu.dat +++ b/data/rus/settings/menu.dat @@ -55,6 +55,7 @@ 13 „®бЄ  ®в« ¤ЄЁ |develop/board 16 HEX-। Єв®а |develop/heed 20 Diff tool |develop/diff +52 Shared resources |@reshare 34 Hex2Dec2Bin |develop/h2d2b 59 ’ Ў«Ёж  бЁ¬ў®«®ў |develop/ASCIIVju 59 ASCII-Є®¤л |develop/keyascii diff --git a/programs/cmm/c--/c--.ini b/programs/cmm/c--/c--.ini index e5b8457c40..e0fb6db86a 100644 --- a/programs/cmm/c--/c--.ini +++ b/programs/cmm/c--/c--.ini @@ -2,7 +2,7 @@ J0 ; не делать начальный jump на main() -5 ; оптимизация для Pentium I (no MMX) процессора. +4 ; оптимизация для Pentium I (no MMX) процессора. r- ; запретить изменение доступной памяти в *.com файлах diff --git a/programs/cmm/imgedit/build.bat b/programs/cmm/imgedit/build.bat index 8d79a654cf..92781aa3c7 100644 --- a/programs/cmm/imgedit/build.bat +++ b/programs/cmm/imgedit/build.bat @@ -1,5 +1,4 @@ @del *. @For /R %%i In (*.c) Do c-- "%%i" @rename *.com *. -@pause -@del warning.txt +if not exist imgedit ( @pause ) diff --git a/programs/cmm/lib/kolibri.h b/programs/cmm/lib/kolibri.h index 79426990d7..227d77923f 100644 --- a/programs/cmm/lib/kolibri.h +++ b/programs/cmm/lib/kolibri.h @@ -553,7 +553,6 @@ inline fastcall void PutPixel( EBX,ECX,EDX) :void DrawBar(dword x,y,w,h,color) { - //if (h<=0) || (h>60000) || (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