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 0000000000..419eb52374 Binary files /dev/null and b/programs/cmm/barscfg/bars.png differ diff --git a/programs/cmm/barscfg/bars.raw b/programs/cmm/barscfg/bars.raw new file mode 100644 index 0000000000..f758ac501d Binary files /dev/null and b/programs/cmm/barscfg/bars.raw differ 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 76f7e903ce..0000000000 Binary files a/programs/cmm/barscfg/panels_cfg.png and /dev/null differ diff --git a/programs/cmm/barscfg/panels_image.raw b/programs/cmm/barscfg/panels_image.raw deleted file mode 100644 index c1f57802ef..0000000000 Binary files a/programs/cmm/barscfg/panels_image.raw and /dev/null differ 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)); }