From 63e302c544c2842804534bd753e9eda741ad4df1 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Mon, 16 Apr 2018 09:30:24 +0000 Subject: [PATCH] CMM: easy icon set in program git-svn-id: svn://kolibrios.org@7229 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/aelia/aelia.c | 1 - programs/cmm/browser/WebView.c | 1 - programs/cmm/easyshot/easyshot.c | 2 - programs/cmm/eolite/Eolite.c | 1 - programs/cmm/iconedit/compile_en.bat | 7 ++-- programs/cmm/iconedit/iconedit.c | 1 - programs/cmm/lib/obj/libimg.h | 10 +++-- programs/cmm/lib/patterns/libimg_load_skin.h | 23 +++++++---- programs/cmm/mblocks/mblocks.c | 3 +- programs/cmm/pixie/pixie.c | 2 - programs/cmm/pixie2/pixie.c | 39 ++++++++++++------- .../cmm/software_widget/software_widget.c | 1 - programs/cmm/taskbar2/taskbar2.c | 3 -- programs/cmm/the_bus/the_bus.c | 1 - programs/cmm/txtread/txtread.c | 1 - 15 files changed, 50 insertions(+), 46 deletions(-) diff --git a/programs/cmm/aelia/aelia.c b/programs/cmm/aelia/aelia.c index 4a404d494f..4fca838985 100644 --- a/programs/cmm/aelia/aelia.c +++ b/programs/cmm/aelia/aelia.c @@ -11,7 +11,6 @@ #include "../lib/obj/proc_lib.h" #include "../lib/obj/http.h" #include "../lib/cursor.h" -#include "../lib/patterns/libimg_load_skin.h" #include "../lib/patterns/simple_open_dialog.h" #include "../lib/patterns/history.h" #include "../lib/patterns/http_downloader.h" diff --git a/programs/cmm/browser/WebView.c b/programs/cmm/browser/WebView.c index 4336d58abe..9b62bc2f6c 100644 --- a/programs/cmm/browser/WebView.c +++ b/programs/cmm/browser/WebView.c @@ -24,7 +24,6 @@ #include "..\lib\obj\http.h" #include "..\lib\obj\iconv.h" //useful patterns -#include "..\lib\patterns\libimg_load_skin.h" #include "..\lib\patterns\history.h" #include "..\lib\patterns\http_downloader.h" diff --git a/programs/cmm/easyshot/easyshot.c b/programs/cmm/easyshot/easyshot.c index b4cc2b3c5d..42e78bff6f 100644 --- a/programs/cmm/easyshot/easyshot.c +++ b/programs/cmm/easyshot/easyshot.c @@ -7,8 +7,6 @@ #include "../lib/obj/libimg.h" #include "../lib/obj/box_lib.h" -#include "../lib/patterns/libimg_load_skin.h" - #ifndef AUTOBUILD #include "lang.h--" #endif diff --git a/programs/cmm/eolite/Eolite.c b/programs/cmm/eolite/Eolite.c index 638482cbac..f62d04cf98 100644 --- a/programs/cmm/eolite/Eolite.c +++ b/programs/cmm/eolite/Eolite.c @@ -23,7 +23,6 @@ #include "../lib/obj/box_lib.h" #include "../lib/patterns/history.h" -#include "../lib/patterns/libimg_load_skin.h" //images #include "imgs/left_p.txt" diff --git a/programs/cmm/iconedit/compile_en.bat b/programs/cmm/iconedit/compile_en.bat index 3672d0c74b..331ea4abae 100644 --- a/programs/cmm/iconedit/compile_en.bat +++ b/programs/cmm/iconedit/compile_en.bat @@ -5,9 +5,10 @@ if exist iconedit ( - "C:\Program Files (x86)\WinImage\winimage.exe" "C:\Users\Leency\Desktop\kolibri.img" /H /Q /I iconedit - cd D:\Kolibri\Infrastructure\QEMU - call "D:\Kolibri\Infrastructure\QEMU\qemu-kos-img.bat" + "C:\Program Files\WinImage\winimage.exe" "D:\Soft\Kolibri\QEMU\kolibri.img" /H /Q /I iconedit + d: + cd "D:\Soft\Kolibri\QEMU" + call "D:\Soft\Kolibri\QEMU\qemu-kos-img.bat" ) else ( @pause ) diff --git a/programs/cmm/iconedit/iconedit.c b/programs/cmm/iconedit/iconedit.c index c6081f4dd6..d77bcddfbd 100644 --- a/programs/cmm/iconedit/iconedit.c +++ b/programs/cmm/iconedit/iconedit.c @@ -18,7 +18,6 @@ pipet aside color view #include "../lib/mem.h" #include "../lib/obj/libimg.h" #include "../lib/patterns/rgb.h" -#include "../lib/patterns/libimg_load_skin.h" #include "colors_mas.h" diff --git a/programs/cmm/lib/obj/libimg.h b/programs/cmm/lib/obj/libimg.h index 2fe46c5a3c..435f403b33 100644 --- a/programs/cmm/lib/obj/libimg.h +++ b/programs/cmm/lib/obj/libimg.h @@ -18,8 +18,6 @@ #include "../lib/obj/libio.h" #endif -:byte init_imglib_check; - //library dword libimg = #alibimg; char alibimg[21] = "/sys/lib/libimg.obj\0"; @@ -30,8 +28,8 @@ dword img_to_rgb2 = #aimg_to_rgb2; dword img_decode = #aimg_decode; dword img_destroy = #aimg_destroy; dword img_draw = #aimg_draw; -dword img_create = #aimg_create; -dword img_encode = #aimg_encode; +dword img_create = #aimg_create; +dword img_encode = #aimg_encode; //dword img_flip = #aimg_flip; //dword img_rotate = #aimg_rotate; @@ -229,5 +227,9 @@ struct _Image } } +#ifndef INCLUDE_LIBIMG_LOAD_SKIN_H +#include "../lib/patterns/libimg_load_skin.h" +#endif + #endif \ No newline at end of file diff --git a/programs/cmm/lib/patterns/libimg_load_skin.h b/programs/cmm/lib/patterns/libimg_load_skin.h index 938a0bae01..a9f1d0e972 100644 --- a/programs/cmm/lib/patterns/libimg_load_skin.h +++ b/programs/cmm/lib/patterns/libimg_load_skin.h @@ -20,14 +20,6 @@ ESDWORD[struct_pointer+12] = ESDWORD[image_pointer+24]; } -:void Libimg_FillTransparent(dword struct_pointer, w, h, new_transparent_color) -{ - dword i, max_i, image_data; - image_data = ESDWORD[struct_pointer + 24]; - max_i = w * h * 4 + image_data; - for (i = image_data; i < max_i; i += 4) if (DSDWORD[i]==0) DSDWORD[i] = new_transparent_color; -} - :void Libimg_ReplaceColor(dword struct_pointer, w, h, old_color, new_color) { dword i, max_i, image_data; @@ -36,4 +28,19 @@ for (i = image_data; i < max_i; i += 4) if (DSDWORD[i]==old_color) DSDWORD[i] = new_color; } +:void Libimg_FillTransparent(dword struct_pointer, w, h, new_color) +{ + Libimg_ReplaceColor(struct_pointer, w, h, 0, new_color); +} + +:libimg_image icons32draw; +:void DrawIcon32(dword x,y, bg, icon_n) { + //load_dll(libimg, #libimg_init,1); + if (!icons32draw.image) { + Libimg_LoadImage(#icons32draw, "/sys/icons32.png"); + Libimg_FillTransparent(icons32draw.image, icons32draw.w, icons32draw.h, bg); + } + if (icon_n>=0) img_draw stdcall(icons32draw.image, x, y, 32, 32, 0, icon_n*32); +} + #endif \ No newline at end of file diff --git a/programs/cmm/mblocks/mblocks.c b/programs/cmm/mblocks/mblocks.c index 68256a33e4..3dbedb6672 100644 --- a/programs/cmm/mblocks/mblocks.c +++ b/programs/cmm/mblocks/mblocks.c @@ -4,13 +4,12 @@ 2008-2017 */ -#define MEMSIZE 4096 * 12 +#define MEMSIZE 4096 * 15 #include "..\lib\gui.h" #include "..\lib\random.h" #include "..\lib\obj\libio.h" #include "..\lib\obj\libimg.h" -#include "..\lib\patterns\libimg_load_skin.h" proc_info Form; diff --git a/programs/cmm/pixie/pixie.c b/programs/cmm/pixie/pixie.c index e6b15aa56b..b6baf3ec8d 100644 --- a/programs/cmm/pixie/pixie.c +++ b/programs/cmm/pixie/pixie.c @@ -18,8 +18,6 @@ od_filter filter2 = { 8, "MP3\0\0" }; #include "..\lib\obj\libimg.h" #include "..\lib\obj\libini.h" -#include "..\lib\patterns\libimg_load_skin.h" - #define ABOUT_MESSAGE "'Pixies Player v1.4\n\nOpen file: O key\nChange skin: F1/F2 Play/Stop: Space or P key\nStart playing selected file: Enter Goto next/previous track: Ctrl + Left/Right diff --git a/programs/cmm/pixie2/pixie.c b/programs/cmm/pixie2/pixie.c index 1bfd516422..c4fde8fe3d 100644 --- a/programs/cmm/pixie2/pixie.c +++ b/programs/cmm/pixie2/pixie.c @@ -18,7 +18,6 @@ #include "../lib/obj/proc_lib.h" #include "../lib/obj/box_lib.h" -#include "../lib/patterns/libimg_load_skin.h" #include "../lib/patterns/simple_open_dialog.h" //===================================================// @@ -33,19 +32,19 @@ od_filter filter2 = { 15, "MP3\0WAV\0XM\0\0" }; #define ABOUT_MESSAGE "Pixie Player v2.81 -A tiny music folder player. -Supports MP3, WAV, XM audio file formats. + A tiny music folder player. + Supports MP3, WAV, XM audio file formats. -Controls: -Open file: O key -Play/Stop: Space or P key -Start playing selected file: Enter -Goto next/previous track: Ctrl + Left/Right -Change sound volume: Left/Right key -Remove from the list: Delete -Repeat: R -Shuffle: S -Mute: M +Hot keys: + Open file: O key + Play/Stop: Space or P key + Start playing selected file: Enter + Goto next/previous track: Ctrl + Left/Right + Change sound volume: Left/Right key + Remove from the list: Delete + Repeat: R + Shuffle: S + Mute: M kolibri-n.org & aspero.pro" @@ -145,7 +144,7 @@ void main() if (mouse.dblclick) EventStartPlayingSelectedItem(); if (mouse.down) && (mouse.key&MOUSE_LEFT) && (list.ProcessMouse(mouse.x, mouse.y)) DrawPlayList(); - if (mouse.down) && (mouse.key&MOUSE_RIGHT) CreateThread(#EventShowAbout,#menu_stak+4092); + if (mouse.down) && (mouse.key&MOUSE_RIGHT) EventShowAbout(); } if(mouse.key&MOUSE_LEFT) && (mouse.x<14) && (window_mode == WINDOW_MODE_SMALL) EventDragWindow(); @@ -180,6 +179,7 @@ void main() if (key_scancode==SCAN_CODE_ENTER) EventStartPlayingSelectedItem(); if (key_scancode==SCAN_CODE_DEL) EventDeleteItem(); if (key_scancode==SCAN_CODE_KEY_P)||(key_scancode==SCAN_CODE_SPACE) EventPlayAndPause(); + if (key_scancode==SCAN_CODE_F1) EventShowAbout(); if (list.ProcessKey(key_scancode)) DrawPlayList(); break; case evReDraw: @@ -518,6 +518,11 @@ void EventDeleteItem() } void EventShowAbout() +{ + CreateThread(#ShowAboutThread,#menu_stak+4092); +} + +void ShowAboutThread() { proc_info pop_up; loop() switch(WaitEvent()) @@ -532,14 +537,18 @@ void EventShowAbout() case evReDraw: DefineDragableWindow(150, 200, 400, 346); GetProcessInfo(#pop_up, SelfInfo); + 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); - WriteTextLines(10, 10, 0x90, theme.color_top_panel_song_name, ABOUT_MESSAGE, 19); 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, theme.color_list_active_bg, theme.color_top_panel_song_name, "Cool"); + + WriteTextLines(10, 10, 0x90, theme.color_top_panel_song_name, ABOUT_MESSAGE, 19); + DrawIcon32(10, 48, theme.color_top_panel_bg, 65); + } } diff --git a/programs/cmm/software_widget/software_widget.c b/programs/cmm/software_widget/software_widget.c index 43aa5b21fa..5e8fc3381f 100644 --- a/programs/cmm/software_widget/software_widget.c +++ b/programs/cmm/software_widget/software_widget.c @@ -14,7 +14,6 @@ SOFTWARE CENTER v2.8 #include "..\lib\kfont.h" #include "..\lib\list_box.h" #include "..\lib\collection.h" -#include "..\lib\patterns\libimg_load_skin.h" proc_info Form; llist list; diff --git a/programs/cmm/taskbar2/taskbar2.c b/programs/cmm/taskbar2/taskbar2.c index e543bed95b..0c7d3a75cf 100644 --- a/programs/cmm/taskbar2/taskbar2.c +++ b/programs/cmm/taskbar2/taskbar2.c @@ -18,9 +18,6 @@ #include "../lib/obj/libimg.h" #include "../lib/obj/libini.h" -#include "../lib/patterns/libimg_load_skin.h" - - //===================================================// // // // DATA // diff --git a/programs/cmm/the_bus/the_bus.c b/programs/cmm/the_bus/the_bus.c index ef95ad729e..317701fec8 100644 --- a/programs/cmm/the_bus/the_bus.c +++ b/programs/cmm/the_bus/the_bus.c @@ -17,7 +17,6 @@ Copyright (C) 2008 O.Bogomaz #include "..\lib\obj\libio.h" #include "..\lib\obj\libimg.h" -#include "..\lib\patterns\libimg_load_skin.h" libimg_image menu; libimg_image road; diff --git a/programs/cmm/txtread/txtread.c b/programs/cmm/txtread/txtread.c index 0c54206597..760e886d0e 100644 --- a/programs/cmm/txtread/txtread.c +++ b/programs/cmm/txtread/txtread.c @@ -9,7 +9,6 @@ #include "../lib/obj/libini.h" #include "../lib/obj/iconv.h" #include "../lib/obj/proc_lib.h" -#include "../lib/patterns/libimg_load_skin.h" #include "../lib/patterns/simple_open_dialog.h" #define TOOLBAR_H 34