From 7a6c5c33a6449958530dd441de1d058b41c7fa65 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Thu, 28 May 2020 00:55:16 +0000 Subject: [PATCH] cmm: global rework of libimg wrappers git-svn-id: svn://kolibrios.org@7995 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/TWB/img_cache.h | 5 +- programs/cmm/barscfg/bars.png | Bin 0 -> 1174 bytes programs/cmm/barscfg/bars.raw | Bin 0 -> 17982 bytes programs/cmm/barscfg/barscfg.c | 2 +- programs/cmm/barscfg/panels_cfg.png | Bin 1236 -> 0 bytes programs/cmm/barscfg/panels_image.raw | Bin 17982 -> 0 bytes programs/cmm/codeview/codeview.c | 1 - programs/cmm/iconedit/colors_mas.h | 8 +- programs/cmm/iconedit/iconedit.c | 4 +- programs/cmm/lib/obj/libimg.h | 158 ++++++++++++------ programs/cmm/misc/mblocks.c | 27 +-- programs/cmm/misc/software_widget.c | 32 +--- programs/cmm/pixie2/pixie.c | 45 +++-- .../cmm/taskbar2/{compile.bat => build.bat} | 0 programs/cmm/taskbar2/taskbar2.c | 30 +--- programs/cmm/the_bus/the_bus.c | 12 +- 16 files changed, 172 insertions(+), 152 deletions(-) create mode 100644 programs/cmm/barscfg/bars.png create mode 100644 programs/cmm/barscfg/bars.raw delete mode 100644 programs/cmm/barscfg/panels_cfg.png delete mode 100644 programs/cmm/barscfg/panels_image.raw rename programs/cmm/taskbar2/{compile.bat => build.bat} (100%) diff --git a/programs/cmm/TWB/img_cache.h b/programs/cmm/TWB/img_cache.h index 130aa4372e..d6db1d24c5 100644 --- a/programs/cmm/TWB/img_cache.h +++ b/programs/cmm/TWB/img_cache.h @@ -25,11 +25,12 @@ void ImageCache::Free() int ImageCache::GetImage(dword i_path) { int i; + return 0; for (i=0; i<=pics_count; i++) if (!strcmp(#pics[i].path, i_path)) return i; //image exists // Load image and add it to Cache pics_count++; - pics[pics_count].image = load_image(i_path); - strcpy(#pics[pics_count].path, i_path); + //pics[pics_count].image = load_EEERRRR_image(i_path); + //strcpy(#pics[pics_count].path, i_path); return pics_count; } diff --git a/programs/cmm/barscfg/bars.png b/programs/cmm/barscfg/bars.png new file mode 100644 index 0000000000000000000000000000000000000000..419eb5237416b023d937bb628b7f9d59cb070f58 GIT binary patch literal 1174 zcmeAS@N?(olHy`uVBq!ia0vp^szAJmgBeJE{Q4!3fq|JJz$e5N$n}U!bBHZr68g)q zh2atl%Q@S5r#l#WX3uHe{-EVg%aj98=N)@~ht_FfLyy*Gwl>!0ab!^0Tpub z=bgyoD_~>*nh69DW4VDWumYad+(*EMoB^u5SLF5o|G(AT4M6P-3_d``{7e@>Dw(c; zH8Q9$$TKjA0}+3rfE+te3TS%^#Lztd19?z0#ejD3C%#}{5L(T{;}u{WKy<;}e>L|91_l5n0XCu$q6yYW|Az@9tr!feUB=)c`sCI}Ly&Fb;rVwc-shJ>rPG*$&`@ zhnyw_R`XqerpehJ3=9H)Lpu|I0mE1l;uumf=k4^{e9a01F0AWA zH2?g+F18{pYiCbqUhXLy6E)k5g^BH3A9ZNe6$fcXt}@(pmtFb&^OehXUN6-(o^nn9 zl;^S(jWc`GgIY{~PI;2Vlf`ZtEz`#QuJodM75BsiHmVx+x{pGB%&%XvY|n#t2Ue^O zd$dYq+v1JyK78h0P-o=3Z+860V8+*d_wD4%RT>^VoG$DgDt_ulNbUXA>t0W}7PU3E zT2EB(;54pm=c8ZTR6|!d&GnVFU^Z|OWv#ZBF1LIFQ1nI|rY_;5Jp7fQwYAk`x3j1@n$?Vbaei{)E0<4~i9Fg|G%sLn?lvsA-EOyEZ?0HYZ()#J z z#l)aOATm3rhR63fyIQsw#V*L~%oa|SB9lBgJTs}-7e2?9xn_atWKz~$zblOgj-AH1 z-zMPtIb;t9LMEo^BMU3ZG+%M@m?{U7nWh}F^B|L{=vVedrgQVKx?YWKjcOe`jpJq9 z;EeVNwFw%*anCH3*x%{PpUWJ9lN_=hWHyk=>=hL%bIn4xY{RizUBt#3BO^x-ohZc;yiO~O1u(pNvWcI@M8T*nEWVn-PPdukQ~sPFF#12 z-@bn!flf!<_=J9R^pgZSUO3=DEXA(4e(DEzC9^+`^|6EH5Rpk(%S>rAP!G5uQ^`Q2 zijpXeS&*q=Nof;gDv8pV9SE72rjPVDB)fX}boRknG>_-W4OH0sLgINI80Lt%})Oh07XlRopj4&;;V@T)0FjSrxS-3 za0_dN5gg_s*9T-2Emo#*yjBEUbCx1i_7Xc@+kIj;HyoFq51IU19B^;0?zngIiQU|A e&UMGVu21adhVzVFv0FxKG+grK2oObd)4>;&fY(j{ literal 0 HcmV?d00001 diff --git a/programs/cmm/barscfg/barscfg.c b/programs/cmm/barscfg/barscfg.c index 8b968c0dce..a199f021ec 100644 --- a/programs/cmm/barscfg/barscfg.c +++ b/programs/cmm/barscfg/barscfg.c @@ -60,7 +60,7 @@ _ini taskbar_vars_ini = { #taskbar_ini_path, "Variables" }; _ini docky_ini = { "/sys/settings/docky.ini", "@" }; -unsigned char panels_img_data[] = FROM "panels_image.raw"; +unsigned char panels_img_data[] = FROM "bars.raw"; #define PIMG_W 37 #define PIMG_H 27 //27*5 diff --git a/programs/cmm/barscfg/panels_cfg.png b/programs/cmm/barscfg/panels_cfg.png deleted file mode 100644 index 76f7e903cec91dd5255fcc69bd04dd31d81fe9a5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1236 zcmeAS@N?(olHy`uVBq!ia0vp^szAJmgBeJE{Q4!3fq|JJz$e5N$PMxJjfjc$h)i>c zEnyP+%dmyPbZPP>7M63i^X{!y?U_BNb^C+e`wz7IX_<21>AYjlZ``~8|NO6n= zQ2nzci`CpWnC@(Y7z81Kva7kj0Fkh{|7z|J3=Aw_aqZPS2K>Rg5bkOo4Wajjt9g2W zQgcjsgx*0s4pNx0+5@Z}Xd?)$=4n{XKVvn2h0wcu5D_2=Qv(;!0IC6Up6&PnBtcOQ z)Tnp^OpiF?SggRYU=9WbHDE#ldY(m7aW&roa3}y%AOi!N3yWs;1eU)|KsIAZkY6x^ z!?PP{Kz5U-i(^Q|oVU|o_cbdBv_5?l7Q6lHrSJ9ESXsK+W+XdB%zFFtqRC6~Dw!u| zE^xT??vP%qnfc25<-Qv2O8MD&+n46vp1EM&`ME~3f`g{$S57NFZ#y|TV)B<2kv;tj z^aAYtB(JUdBLBTMB52BX$3m}P)q=|p?f>JRwP>k^i$-X+YSz*P=2F(O?SGh7Z1z7qQ4xkDBqss_;!lsofA#`$9?9i_Xn9>Pn5W}?|t~Oo3~139ShGfYV8W! zz+!z=S9DFo(j|+NtO7i1SDX&n>KUg!wUCXWnCXM6)NHAV4@#%Zh~GGI(U*(*?w%*6 zFDsFmy3`$V!iuMZ3Aa;mv`%{!oIQ@pl!L)6MB>-+6RA^-He z&K6DUI=}%Z~eJQV{2xs=9%eL6S;zC=zlF@o?@kO^V*@BmCWHYnrdzuPuatoqhrPVhiOT# VzSe@6kD&64!PC{xWt~$(69CaJR^tEw diff --git a/programs/cmm/barscfg/panels_image.raw b/programs/cmm/barscfg/panels_image.raw deleted file mode 100644 index c1f57802ef82d11ca4c9c625d40b36c37f3a4a67..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 17982 zcmeI1v5pim42DC)CiL!((k7Sw4QNSS6!kD6y$h7S5 zEQwCn5x9dHOcYksU^UCd`5U*jRo~bz1HgVd%%s6Bd*pPON#o!x3dJ?fGi$*O=s!Dq z&?vP*7HgB`15o26!~%A5%d9&YK;B6^!KFiTpzplB5utr`@3RPP%#w9wcqb=cM5NyX z4lEHM0^oXirzBF#qgw2sVm5ZQd1dUMg(LCK!V%>zk~@+EH$8rxfu32uz6*tIpjVk~t!sx{654Ki6ok+Dl~`EJoKcK-=nT68o5$SijEPFW?z z?zrKCW5@Jhlg@9vj_SNnDi*Vd0k~RtAbOO-X zUBC(!YL#G_GU?GnXv8lM<5QahZpz8(9wBpj^u5}k{vvQJx&f!NWPCcvG!kV|8)RBo zGU{wXCW*y3yhb(gZgaRU|4WLIoRFG#X!4bxR)b4>it15;!*X8eu4rSy2nPcKm!He! z=RCzmo==$Q>l=-lcZ=Y_5`lpLIQ&}b9d70#-dX>t9oB4Y5Ys=U?;A*)7L?<}Hm*)rOm8*9GmvY4>a7<2DG7Im#;Zpd7OmDc9+Xvk0 z48t;?U3cEGOW)#{*c~@q@VaBdNOchtyHq>Hzy*639J^F}#*lg3aFMZNS{5QHn);!y MOg|;q2P;_q0+>m?UH||9 diff --git a/programs/cmm/codeview/codeview.c b/programs/cmm/codeview/codeview.c index d530e731c1..1e10ae4198 100644 --- a/programs/cmm/codeview/codeview.c +++ b/programs/cmm/codeview/codeview.c @@ -214,7 +214,6 @@ DrawEditBoxWebView() address_box.offset = 0; edit_box_draw stdcall(#address_box); skin_x_offset = 51; - img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, skin_x_offset, SKIN_Y); } void LoadInternalPage(dword _bufpos, _bufsize) diff --git a/programs/cmm/iconedit/colors_mas.h b/programs/cmm/iconedit/colors_mas.h index c9eda2639d..daf664a4d4 100644 --- a/programs/cmm/iconedit/colors_mas.h +++ b/programs/cmm/iconedit/colors_mas.h @@ -165,10 +165,14 @@ dword _image::get_pixel(int _r, _c) void _image::set_image(dword _inbuf) { dword i; - for (i = 0; i < columns*rows-1; i++;) + for (i = 0; i < columns*rows; i++;) { // mas[i] = ESDWORD[i*4+_inbuf] & 0x00FFFFFF; //for x32 bit color - mas[i] = ESDWORD[i*3+_inbuf] & 0xFFFFFF; + if (i == MAX_CELL_SIZE*MAX_CELL_SIZE-1) { + mas[i] = 0; + } else { + mas[i] = ESDWORD[i*3+_inbuf] & 0xFFFFFF; + } } } diff --git a/programs/cmm/iconedit/iconedit.c b/programs/cmm/iconedit/iconedit.c index 6534010c2e..95465b7812 100644 --- a/programs/cmm/iconedit/iconedit.c +++ b/programs/cmm/iconedit/iconedit.c @@ -17,7 +17,6 @@ #include "../lib/obj/box_lib.h" #include "../lib/patterns/rgb.h" -#include "../lib/patterns/libimg_load_skin.h" #include "colors_mas.h" @@ -196,7 +195,8 @@ void main() } else { - open_image.load_as24b(#param); + open_image.load(#param); + open_image.convert_into(IMAGE_BPP24); if (open_image.w*open_image.h>MAX_CELL_SIZE*MAX_CELL_SIZE) { notify(T_ERROR_IMA_ICONEDIT); diff --git a/programs/cmm/lib/obj/libimg.h b/programs/cmm/lib/obj/libimg.h index dc78c29885..ac5b02d07a 100644 --- a/programs/cmm/lib/obj/libimg.h +++ b/programs/cmm/lib/obj/libimg.h @@ -66,36 +66,91 @@ char aimg_convert[] = "img_convert"; #define LIBIMG_FORMAT_XBM 13 #define LIBIMG_FORMAT_Z80 14 -struct _Image -{ - dword Checksum; // ((Width ROL 16) OR Height) XOR Data[0] ; ignored so far - dword Width; - dword Height; - dword Next; - dword Previous; - dword Type; // one of Image.bppN - dword Data; - dword Palette; // used iff Type eq Image.bpp1, Image.bpp2, Image.bpp4 or Image.bpp8i - dword Extended; - dword Flags; // bitfield - dword Delay; // used iff Image.IsAnimated is set in Flags -}; - // values for Image.Type // must be consecutive to allow fast switch on Image.Type in support functions -#define Image_bpp8i 1 // indexed -#define Image_bpp24 2 -#define Image_bpp32 3 -#define Image_bpp15 4 -#define Image_bpp16 5 -#define Image_bpp1 6 -#define Image_bpp8g 7 // grayscale -#define Image_bpp2i 8 -#define Image_bpp4i 9 -#define Image_bpp8a 10 // grayscale with alpha channel; application layer only!!! +#define IMAGE_BPP8i 1 // indexed +#define IMAGE_BPP24 2 +#define IMAGE_BPP32 3 +#define IMAGE_BPP15 4 +#define IMAGE_BPP16 5 +#define IMAGE_BPP1 6 +#define IMAGE_BPP8g 7 // grayscale +#define IMAGE_BPP2i 8 +#define IMAGE_BPP4i 9 +#define IMAGE_BPP8a 10 // grayscale with alpha channel; application layer only!!! // kernel doesn't handle this image type, // libimg can only create and destroy such images +struct libimg_image +{ + dword checksum; // ((Width ROL 16) OR Height) XOR Data[0] ; ignored so far + dword w; + dword h; + dword next; + dword previous; + dword type; // one of Image.bppN + dword imgsrc; + dword palette; // used iff Type eq Image.bpp1, Image.bpp2, Image.bpp4 or Image.bpp8i + dword extended; + dword flags; // bitfield + dword delay; // used iff Image.IsAnimated is set in Flags + dword image; + void load(); + void convert_into(); + void replace_color(); + void set_vars(); + void draw(); +}; + +:void libimg_image::set_vars() +{ + $push edi + EDI = image; + checksum = DSWORD[EDI]; + w = ESDWORD[EDI+4]; + h = ESDWORD[EDI+8]; + next = ESDWORD[EDI+12]; + previous = ESDWORD[EDI+16]; + imgsrc = ESDWORD[EDI+24]; + palette = ESDWORD[EDI+28]; + extended = ESDWORD[EDI+32]; + flags = ESDWORD[EDI+36]; + delay = ESDWORD[EDI+40]; + $pop edi +} + +:void libimg_image::load(dword file_path) +{ + load_image(file_path); + if (!EAX) { + notify("'Error: Image not loaded'E"); + } else { + image = EAX; + set_vars(); + } +} + +:void libimg_image::replace_color(dword old_color, new_color) +{ + EDX = w * h * 4 + imgsrc; + for (ESI = imgsrc; ESI < EDX; ESI += 4) if (DSDWORD[ESI]==old_color) DSDWORD[ESI] = new_color; +} + +:void libimg_image::draw(dword _x, _y, _w, _h, _xoff, _yoff) +{ + if (image) img_draw stdcall(image, _x, _y, _w, _h, _xoff, _yoff); +} + +:void libimg_image::convert_into(dword _to) +{ + img_convert stdcall(image, 0, _to, 0, 0); + if (!EAX) { + notify("'LibImg convertation error!'E"); + } else { + image = EAX; + set_vars(); + } +} :dword load_image(dword filename) { @@ -185,18 +240,6 @@ struct _Image return EAX; } -:void DrawLibImage(dword image_pointer,x,y,w,h,offx,offy) { - img_draw stdcall ( - image_pointer, - x, - y, - w, - h, - offx, - offy - ); -} - //NOTICE: DO NOT FORGET TO INIT libio AND libimg!!! #ifdef LANG_RUS #define TEXT_FILE_SAVED_AS "'Файл сохранен как " @@ -210,14 +253,14 @@ struct _Image dword encoded_size=0; dword image_ptr = 0; - image_ptr = create_image(Image_bpp24, _w, _h); + image_ptr = create_image(IMAGE_BPP24, _w, _h); if (image_ptr == 0) { notify("'Error saving file, probably not enought memory!' -E"); } else { EDI = image_ptr; - memmov(EDI._Image.Data, _image_pointer, _w * _h * 3); + memmov(EDI.libimg_image.imgsrc, _image_pointer, _w * _h * 3); encoded_data = encode_image(image_ptr, LIBIMG_FORMAT_PNG, 0, #encoded_size); @@ -240,16 +283,37 @@ struct _Image } } -:dword convert_image(dword _image_pointer, _w, _h, _path) -{ - img_convert stdcall(_image_pointer, 0, Image_bpp32, 0, 0); - if (EAX!=0) - mov [image_converted], eax + + +///////////////////////////// +/* +// DRAW ICON PATTERN / TEMP +*/ +///////////////////////////// + +:void DrawIcon32(dword x,y, _bg, icon_n) { + static libimg_image i32; + static dword bg; + //load_dll(libimg, #libimg_init,1); + if (!i32.image) || (bg!=_bg) { + bg = _bg; + i32.load("/sys/icons32.png"); + i32.replace_color(0x00000000, bg); + debugln("wolo"); + } + if (icon_n>=0) i32.draw(x, y, 32, 32, 0, icon_n*32); } -#ifndef INCLUDE_LIBIMG_LOAD_SKIN_H -#include "../lib/patterns/libimg_load_skin.h" -#endif +:void DrawIcon16(dword x,y, bg, icon_n) { + static libimg_image i16; + //load_dll(libimg, #libimg_init,1); + if (!i16.image) { + i16.load("/sys/icons16.png"); + i16.replace_color(0xffFFFfff, bg); + i16.replace_color(0xffCACBD6, MixColors(bg, 0, 220)); + } + if (icon_n>=0) i16.draw(x, y, 16, 16, 0, icon_n*16); +} #endif \ No newline at end of file diff --git a/programs/cmm/misc/mblocks.c b/programs/cmm/misc/mblocks.c index 8c87ecde91..c1ca1895b9 100644 --- a/programs/cmm/misc/mblocks.c +++ b/programs/cmm/misc/mblocks.c @@ -42,22 +42,18 @@ dword butonsx[COUNT], butonsy[COUNT]; dword firstbit, secondbit; int count; - void main() { dword id; load_dll(libio, #libio_init,1); load_dll(libimg, #libimg_init,1); - skin.load("/sys/icons32.png"); - skin.replace_color(0x00000000, 0xFFFfff); - NewGame(); loop() switch(@WaitEvent()) { case evKey: - if (@GetKeyScancode()==SCAN_CODE_F2) NewGame(); + //if (@GetKeyScancode()==SCAN_CODE_F2) NewGame(); break; case evButton: @@ -80,26 +76,18 @@ void main() ReDraw_Game_Button(secondbit); secondbit = 0x0BAD; firstbit = id; - bitstat[id] = BTN_PRESSED; - ReDraw_Game_Button(id); count++; - } - else if (firstbit != id) - { + } else if (firstbit != id) { secondbit = id; - bitstat[id] = BTN_PRESSED; - ReDraw_Game_Button(id); count++; } - } - else - { + } else { firstbit = id; - bitstat[id] = BTN_PRESSED; - ReDraw_Game_Button(id); count++; } } + bitstat[id] = BTN_PRESSED; + ReDraw_Game_Button(id); Draw_Count(); } break; @@ -161,16 +149,15 @@ void ReDraw_Game_Button(int id) case BTN_CLOSED: DrawRectangle3D(xx + 1, yy + 1, CELL_SIZE-2, CELL_SIZE-2, 0xFFFFFF, 0xDEDEDE);//bump DrawBar(xx + 2, yy + 2, CELL_SIZE-3, CELL_SIZE-3, 0xBDC7D6);//background - break; + return; case BTN_PRESSED: DrawWideRectangle(xx + 1, yy + 1, CELL_SIZE-1, CELL_SIZE-1, 2, 0x94DB00);//border green DrawBar(xx + 3, yy + 3, CELL_SIZE-5, CELL_SIZE-5, 0xFFFfff);//background - img_draw stdcall(skin.image, xx+6, yy+6, 32, 32, 0, bitpict[id]*32); BREAK; case BTN_OPEN: DrawBar(xx+1, yy+1, CELL_SIZE-1, CELL_SIZE-1, 0xFFFfff);//background - img_draw stdcall(skin.image, xx+6, yy+6, 32, 32, 0, bitpict[id]*32); } + DrawIcon32(xx+6, yy+6, 0xFFFfff, bitpict[id]); } void Draw_Panel() diff --git a/programs/cmm/misc/software_widget.c b/programs/cmm/misc/software_widget.c index 015f1c93be..ac2bce5ef4 100644 --- a/programs/cmm/misc/software_widget.c +++ b/programs/cmm/misc/software_widget.c @@ -87,10 +87,10 @@ void main() small_screen = true; } - loop() switch(WaitEvent()) + loop() switch(@WaitEvent()) { case evKey: - GetKeys(); + key_scancode = @GetKeyScancode(); if (SCAN_CODE_LEFT == key_scancode) key_scancode = SCAN_CODE_UP; if (SCAN_CODE_RIGHT == key_scancode) key_scancode = SCAN_CODE_DOWN; if (list.ProcessKey(key_scancode)) DrawSelection(); @@ -98,7 +98,7 @@ void main() break; case evButton: - id=GetButtonID(); + id = @GetButtonID(); if (id==1) ExitProcess(); if (id>=100) EventIconClick(id-100); break; @@ -144,18 +144,8 @@ void SetAppColors() swc.dark = 0xDCDCDC; swc.light = 0xFCFCFC; } - - if (!skin.image) LoadImages(); - else if (swc.list_bg != old_list_bg_color) LoadImages(); } -void LoadImages() -{ - skin.load("/sys/icons32.png"); - skin.replace_color(0x00000000, swc.list_bg); -} - - void DrawList() { list.count = 0; row = -1; @@ -198,35 +188,29 @@ byte draw_icons_from_section(dword key_value, key_name, sec_name, f_name) text_y = list.item_h - 40 / 2; if (!strchr(key_name, ' ')) {//|| (kfont.getsize(key_name)+30skin_height) && (mouse.key&MOUSE_RIGHT) EventShowAbout(); break; case evButton: - switch(GetButtonID()) { + switch(@GetButtonID()) { case BUTTON_WINDOW_CLOSE: EventExitApp(); break; case BUTTON_WINDOW_MINIMIZE: MinimizeWindow(); break; case BUTTON_WINDOW_REDUCE: EventChangeWindowMode(); break; @@ -204,8 +204,7 @@ void main() break; default: EventCheckSongFinished(); - } - } + } } @@ -341,35 +340,29 @@ void DrawPixieTitle(dword _t) void DrawAboutWindow() { - proc_info pop_up; - loop() switch(WaitEvent()) + #define ABOUT_W 400 + #define ABOUT_H 410 + loop() switch(@WaitEvent()) { - case evButton: - ExitProcess(); - break; - case evKey: - GetKeys(); - if (key_scancode == SCAN_CODE_ESC) ExitProcess(); - break; + case evButton: ExitProcess(); break; + case evKey: if (GetKeyScancode() == SCAN_CODE_ESC) ExitProcess(); break; case evReDraw: - DefineDragableWindow(150, 200, 400, 400); - GetProcessInfo(#pop_up, SelfInfo); + DefineDragableWindow(150, 200, ABOUT_W, ABOUT_H); - DrawBar(0, 0, pop_up.width, pop_up.height, theme.color_top_panel_bg); - DrawRectangle(0, 0, pop_up.width, pop_up.height, theme.color_list_border); + DrawBar(0, 0, ABOUT_W, ABOUT_H, theme.color_top_panel_bg); + DrawRectangle(0, 0, ABOUT_W, ABOUT_H, theme.color_list_border); - DefineHiddenButton(pop_up.width - 27, 1, 26, 15, BUTTON_WINDOW_CLOSE); - //img_draw stdcall(skin.image, pop_up.width-28, 0, 28, 18, skin.w - 29, 0); - DrawCaptButton(pop_up.width-10-80, pop_up.height - 34, 80, 24, 2, - 0x171717, 0xF5EFB3, "Cool"); + //DefineHiddenButton(ABOUT_W - 27, 1, 26, 15, BUTTON_WINDOW_CLOSE); + //skin.draw(ABOUT_W-28, 0, 28, 18, skin.w - 29, 0); + DrawCaptButton(ABOUT_W-10-80, ABOUT_H - 34, 80, 24, 2, + theme.color_top_panel_bg, 0xF5EFB3, "Cool"); WriteText(131,16, 0x81, 0x8E7C61, "Pixie Player"); WriteText(130,15, 0x81, 0xF5EFB3, "Pixie Player"); WriteTextLines(10, 40, 0x90, theme.color_top_panel_song_name, ABOUT_MESSAGE, 19); DrawIcon32(45, 15, theme.color_top_panel_bg, 65); - DrawIcon32(pop_up.width-32-45, 15, theme.color_top_panel_bg, 65); - + DrawIcon32(ABOUT_W-32-45, 15, theme.color_top_panel_bg, 65); } } diff --git a/programs/cmm/taskbar2/compile.bat b/programs/cmm/taskbar2/build.bat similarity index 100% rename from programs/cmm/taskbar2/compile.bat rename to programs/cmm/taskbar2/build.bat diff --git a/programs/cmm/taskbar2/taskbar2.c b/programs/cmm/taskbar2/taskbar2.c index 59623c34f6..54dc46875f 100644 --- a/programs/cmm/taskbar2/taskbar2.c +++ b/programs/cmm/taskbar2/taskbar2.c @@ -1,4 +1,4 @@ -#define MEMSIZE 4096*20 +#define MEMSIZE 1024*80 //===================================================// // // @@ -30,6 +30,8 @@ collection attached=0; llist list; +_ini ini = { "/sys/settings/appicons.ini", "icons"}; + proc_info Form; proc_info Process; @@ -64,9 +66,6 @@ void main() load_dll(libimg, #libimg_init,1); load_dll(libini, #lib_init,1); - skin.load("/sys/icons32.png"); - skin.replace_color(0x00000000, COLOR_BG); - ini_get_int stdcall ("/sys/appicons.ini", "taskbar", "attachement", ATTACHEMENT_BOTTOM); attachement = EAX; @@ -76,11 +75,8 @@ void main() GetProcessInfo(#Form, SelfInfo); SetWindowLayerBehaviour(-1, ZPOS_DESKTOP); SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER); - loop() + loop() switch(@WaitEventTimeout(50)) { - WaitEventTimeout(50); - switch(EAX & 0xFF) - { case evMouse: if (!CheckActiveProcess(Form.ID)) break; mouse.get(); @@ -95,7 +91,7 @@ void main() } break; case evButton: - btn = GetButtonID(); + btn = @GetButtonID(); btn -= 100; if (btn < attached.count) RunProgram(attached.get(btn), NULL); else EventSetActiveProcess(btn); @@ -105,7 +101,6 @@ void main() list.SetSizes(0, 0, Form.width+1, Form.height+2, CELLH); default: DrawProcessList(); - } } } @@ -158,19 +153,12 @@ void DrawProcessList() { if (proc_list[i+list.first]==0) { status_color = COLOR_BG; - ini_get_int stdcall ( - "/sys/appicons.ini", - "icons", - attached.get(i+list.first)+strrchr(attached.get(i+list.first),'/'), - 0 - ); - icon_n = EAX; + icon_n = ini.GetInt(attached.get(i+list.first)+strrchr(attached.get(i+list.first),'/'), 2); } else { GetProcessInfo(#Process, proc_list[i+list.first]); strlwr(#Process.name); - ini_get_int stdcall ("/sys/appicons.ini", "icons", #Process.name, 0); - icon_n = EAX; + icon_n = ini.GetInt(#Process.name, 2); if (CheckActiveProcess(Process.ID)) && (Process.status_window!=2) { current_process_id = Process.ID; status_color = COLOR_ACTIVE; @@ -181,7 +169,7 @@ void DrawProcessList() } DrawWideRectangle(posx, posy, 40, 40, CELL_PADDING, COLOR_BG); DefineButton(posx, posy, CELLW-1, CELLH, 100+i+BT_HIDE+BT_NOFRAME, NULL); - img_draw stdcall(skin.image, posx+CELL_PADDING, posy+CELL_PADDING, 32, 32, 0, 32*icon_n); + DrawIcon32(posx+CELL_PADDING, posy+CELL_PADDING, COLOR_BG, icon_n); if (ATTACHEMENT_BOTTOM==attachement) DrawBar(posx, posy+CELLH-ACTIVE_SIZE, CELLW, ACTIVE_SIZE, status_color); if (ATTACHEMENT_LEFT ==attachement) DrawBar(posx, posy, ACTIVE_SIZE, CELLH, status_color); @@ -231,7 +219,7 @@ byte draw_icons_from_section(dword key_value, key_name, sec_name, f_name) void GetAttachedItems() { attached.drop(); - ini_enum_keys stdcall ("/sys/appicons.ini", "attached", #draw_icons_from_section); + ini_enum_keys stdcall ("/sys/settings/appicons.ini", "attached", #draw_icons_from_section); } //===================================================// // // diff --git a/programs/cmm/the_bus/the_bus.c b/programs/cmm/the_bus/the_bus.c index a73b60b510..26400fd5b8 100644 --- a/programs/cmm/the_bus/the_bus.c +++ b/programs/cmm/the_bus/the_bus.c @@ -112,12 +112,12 @@ void DrawObstacle(signed int x, y) { } DrawBar(x, y-don_step_y, don_w, don_step_y, COLOR_ROAD); if (y>0) && (y0) DrawLibImage(objects.image, x, y, don_w, image_h, 0, don_offset_y); + if (image_h>0) objects.draw(x, y, don_w, image_h, 0, don_offset_y); } -void DrawBus(dword x, y) { DrawLibImage(objects.image, x, y, bus_w, bus_h, 0, 444); } -void DrawBoom(dword x, y) { DrawLibImage(objects.image, x, y, 78, 66, 0, 536); } -void DrawHighway() { DrawLibImage(road.image, 0,0, WIN_X, WIN_Y, 0, 0); } -void DrawMenuBackground() { DrawLibImage(menu.image, 0, 0, WIN_X, WIN_Y, 0, 0); } +void DrawBus(dword x, y) { objects.draw(x, y, bus_w, bus_h, 0, 444); } +void DrawBoom(dword x, y) { objects.draw(x, y, 78, 66, 0, 536); } +void DrawHighway() { road.draw(0,0, WIN_X, WIN_Y, 0, 0); } +void DrawMenuBackground() { menu.draw(0, 0, WIN_X, WIN_Y, 0, 0); } void main() { @@ -252,7 +252,7 @@ void StartNewGame() } void WriteScore() { - DrawLibImage(road.image, 20, 166, 120, 24, 20, 164); + road.draw(20, 166, 120, 24, 20, 164); WriteText(20, 140, 0x81, 0xFFFFFF, SCORE_TEXT); WriteText(20, 166, 0x81, 0xFFFFFF, itoa(score)); }