CMM APPS: use img_file_load (at least mblocks -1 sector)

git-svn-id: svn://kolibrios.org@8381 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2020-12-13 00:32:34 +00:00
parent 99103794f2
commit 82dc2376da
11 changed files with 66 additions and 64 deletions

View File

@ -106,7 +106,6 @@ void main()
load_dll(boxlib, #box_lib_init,0); load_dll(boxlib, #box_lib_init,0);
load_dll(libini, #lib_init,1); load_dll(libini, #lib_init,1);
load_dll(libio, #libio_init,1);
load_dll(libimg, #libimg_init,1); load_dll(libimg, #libimg_init,1);
load_dll(Proc_lib, #OpenDialog_init,0); load_dll(Proc_lib, #OpenDialog_init,0);
o_dialog.type = 2; //select folder o_dialog.type = 2; //select folder

View File

@ -48,10 +48,10 @@ char *unicode_symbols[]={
"#8594", "->", "#8594", "->",
"uarr", "\24", "uarr", "^",
"darr", "\25", "darr", "v",
"rarr", "\26", "rarr", "->",
"larr", "\27", "larr", "<-",
"bull", "\31", "bull", "\31",
"percnt","%", "percnt","%",

View File

@ -13,7 +13,6 @@
#include "../lib/gui.h" #include "../lib/gui.h"
#include "../lib/list_box.h" #include "../lib/list_box.h"
#include "../lib/obj/box_lib.h" #include "../lib/obj/box_lib.h"
#include "../lib/obj/libio.h"
#include "../lib/obj/libimg.h" #include "../lib/obj/libimg.h"
#include "../lib/obj/libini.h" #include "../lib/obj/libini.h"
#include "../lib/collection.h" #include "../lib/collection.h"
@ -88,7 +87,6 @@ byte process_sections(dword sec_name, f_name)
void main() void main()
{ {
load_dll(libio, #libio_init,1);
load_dll(libini, #lib_init,1); load_dll(libini, #lib_init,1);
load_dll(boxlib, #box_lib_init,0); load_dll(boxlib, #box_lib_init,0);
load_dll(libimg, #libimg_init,1); load_dll(libimg, #libimg_init,1);

View File

@ -23,6 +23,7 @@
#include "../lib/collection.h" #include "../lib/collection.h"
#include "../lib/copyf.h" #include "../lib/copyf.h"
#include "../lib/obj/libio.h"
#include "../lib/obj/libini.h" #include "../lib/obj/libini.h"
#include "../lib/obj/box_lib.h" #include "../lib/obj/box_lib.h"
#include "../lib/obj/libimg.h" #include "../lib/obj/libimg.h"

View File

@ -13,6 +13,7 @@
#include "../lib/list_box.h" #include "../lib/list_box.h"
#include "../lib/events.h" #include "../lib/events.h"
#include "../lib/obj/libio.h"
#include "../lib/obj/libimg.h" #include "../lib/obj/libimg.h"
#include "../lib/obj/box_lib.h" #include "../lib/obj/box_lib.h"

View File

@ -47,7 +47,7 @@ void DrawBufer::Fill(dword start_pointer, i_fill_color)
dword i; dword i;
dword max_i = bufw * bufh * 4 + buf_data + 8; dword max_i = bufw * bufh * 4 + buf_data + 8;
fill_color = i_fill_color; fill_color = i_fill_color;
MEMSETD(buf_data+start_pointer+8, max_i-buf_data-start_pointer-8/4, fill_color); @MEMSETD(buf_data+start_pointer+8, max_i-buf_data-start_pointer-8/4, fill_color);
} }
void DrawBufer::DrawBar(dword x, y, w, h, color) void DrawBufer::DrawBar(dword x, y, w, h, color)
@ -158,9 +158,9 @@ void DrawBufer::Zoom2x(int zoom)
*/ */
void DrawBufer::Show() void DrawBufer::Show(dword _y_offset)
{ {
PutPaletteImage(buf_data+8, bufw, bufh, bufx, bufy, 32, 0); PutPaletteImage(_y_offset * bufw * 4 + buf_data+8, bufw, bufh, bufx, bufy, 32, 0);
} }
void DrawBufer::IncreaseBufSize() void DrawBufer::IncreaseBufSize()

View File

@ -14,38 +14,36 @@
#include "../lib/dll.h" #include "../lib/dll.h"
#endif #endif
#ifndef INCLUDE_LIBIO_H
#include "../lib/obj/libio.h"
#endif
//library //library
dword libimg = #alibimg; dword libimg = #alibimg;
char alibimg[] = "/sys/lib/libimg.obj"; char alibimg[] = "/sys/lib/libimg.obj";
dword libimg_init = #alibimg_init; dword libimg_init = #alibimg_init;
dword img_is_img = #aimg_is_img; dword img_is_img = #aimg_is_img;
dword img_to_rgb2 = #aimg_to_rgb2; dword img_to_rgb2 = #aimg_to_rgb2;
dword img_decode = #aimg_decode; dword img_decode = #aimg_decode;
dword img_destroy = #aimg_destroy; dword img_destroy = #aimg_destroy;
dword img_draw = #aimg_draw; dword img_draw = #aimg_draw;
dword img_create = #aimg_create; dword img_create = #aimg_create;
dword img_encode = #aimg_encode; dword img_encode = #aimg_encode;
dword img_convert = #aimg_convert; dword img_convert = #aimg_convert;
dword img_from_file = #aimg_from_file;
//dword img_flip = #aimg_flip; //dword img_flip = #aimg_flip;
//dword img_rotate = #aimg_rotate; //dword img_rotate = #aimg_rotate;
$DD 2 dup 0 $DD 2 dup 0
//import libimg , \ //import libimg , \
char alibimg_init[] = "lib_init"; char alibimg_init[] = "lib_init";
char aimg_is_img[] = "img_is_img"; char aimg_is_img[] = "img_is_img";
char aimg_to_rgb2[] = "img_to_rgb2"; char aimg_to_rgb2[] = "img_to_rgb2";
char aimg_decode[] = "img_decode"; char aimg_decode[] = "img_decode";
char aimg_destroy[] = "img_destroy"; char aimg_destroy[] = "img_destroy";
char aimg_draw[] = "img_draw"; char aimg_draw[] = "img_draw";
char aimg_create[] = "img_create"; char aimg_create[] = "img_create";
char aimg_encode[] = "img_encode"; char aimg_encode[] = "img_encode";
char aimg_convert[] = "img_convert"; char aimg_convert[] = "img_convert";
char aimg_from_file[] = "img_from_file";
//char aimg_flip[] = "img_flip"; //char aimg_flip[] = "img_flip";
//char aimg_rotate[] = "img_rotate "; //char aimg_rotate[] = "img_rotate ";
@ -292,27 +290,38 @@ struct libimg_image
///////////////////////////// /////////////////////////////
:void DrawIcon32(dword x,y, _bg, icon_n) { :void DrawIcon32(dword x,y, _bg, icon_n) {
static libimg_image i32;
static dword bg; static dword bg;
//load_dll(libimg, #libimg_init,1); static dword pure_img32;
if (!i32.image) || (bg!=_bg) { if (!pure_img32) || (bg!=_bg) {
bg = _bg; bg = _bg;
i32.load("/sys/icons32.png"); img_from_file stdcall("/sys/icons32.png");
i32.replace_color(0x00000000, bg); pure_img32 = EAX;
//now fill transparent with another color
EDX = ESDWORD[EAX+4] * ESDWORD[EAX+8] * 4 + ESDWORD[EAX+24];
for (ESI = ESDWORD[EAX+24]; ESI < EDX; ESI += 4) {
if (DSDWORD[ESI]==0x00000000) DSDWORD[ESI] = bg;
}
} }
if (icon_n>=0) i32.draw(x, y, 32, 32, 0, icon_n*32); img_draw stdcall(pure_img32, x, y, 32, 32, 0, icon_n*32);
} }
:void DrawIcon16(dword x,y, bg, icon_n) { :void DrawIcon16(dword x,y, _bg, icon_n) {
static libimg_image i16; static dword bg;
//load_dll(libimg, #libimg_init,1); static dword pure_img16;
if (!i16.image) { dword bgshadow;
i16.load("/sys/icons16.png"); if (!pure_img16) || (bg!=_bg) {
i16.replace_color(0xffFFFfff, bg); bg = _bg;
i16.replace_color(0xffCACBD6, MixColors(bg, 0, 220)); bgshadow = MixColors(bg, 0, 220);
img_from_file stdcall("/sys/icons16.png");
pure_img16 = EAX;
//now fill transparent with another color
EDX = ESDWORD[EAX+4] * ESDWORD[EAX+8] * 4 + ESDWORD[EAX+24];
for (ESI = ESDWORD[EAX+24]; ESI < EDX; ESI += 4) {
if (DSDWORD[ESI]==0xffFFFfff) DSDWORD[ESI] = bg;
if (DSDWORD[ESI]==0xffCACBD6) DSDWORD[ESI] = bgshadow;
}
} }
if (icon_n>=0) i16.draw(x, y, 16, 16, 0, icon_n*16); img_draw stdcall(pure_img16, x, y, 16, 16, 0, icon_n*16);
} }
#endif #endif

View File

@ -4,6 +4,7 @@
#include "../lib/mem.h" #include "../lib/mem.h"
#include "../lib/gui.h" #include "../lib/gui.h"
#include "../lib/obj/libio.h"
#include "../lib/obj/libimg.h" #include "../lib/obj/libimg.h"
#include "../lib/obj/box_lib.h" #include "../lib/obj/box_lib.h"
#include "../lib/obj/proc_lib.h" #include "../lib/obj/proc_lib.h"

View File

@ -10,7 +10,6 @@
#include "..\lib\gui.h" #include "..\lib\gui.h"
#include "..\lib\random.h" #include "..\lib\random.h"
#include "..\lib\obj\libio.h"
#include "..\lib\obj\libimg.h" #include "..\lib\obj\libimg.h"
#ifndef AUTOBUILD #ifndef AUTOBUILD
@ -45,7 +44,6 @@ int count;
void main() void main()
{ {
dword id; dword id;
load_dll(libio, #libio_init,1);
load_dll(libimg, #libimg_init,1); load_dll(libimg, #libimg_init,1);
NewGame(); NewGame();
@ -157,7 +155,7 @@ void ReDraw_Game_Button(int id)
case BTN_OPEN: case BTN_OPEN:
DrawBar(xx+1, yy+1, CELL_SIZE-1, CELL_SIZE-1, 0xFFFfff);//background DrawBar(xx+1, yy+1, CELL_SIZE-1, CELL_SIZE-1, 0xFFFfff);//background
} }
DrawIcon32(xx+6, yy+6, 0xFFFfff, bitpict[id]); DrawIcon32(xx+6, yy+6, 0xFFFfff, bitpict[id]+51); //skip first 51 icons as they are boring for game
} }
void Draw_Panel() void Draw_Panel()

View File

@ -28,6 +28,7 @@
#include "../lib/obj/box_lib.h" #include "../lib/obj/box_lib.h"
#include "../lib/obj/libini.h" #include "../lib/obj/libini.h"
#include "../lib/obj/libio.h"
#include "../lib/obj/libimg.h" #include "../lib/obj/libimg.h"
#include "../lib/obj/iconv.h" #include "../lib/obj/iconv.h"
#include "../lib/obj/proc_lib.h" #include "../lib/obj/proc_lib.h"

View File

@ -1,6 +1,6 @@
/* /*
* System Monitor * System Monitor
* version 1.35 * version 1.36
* Author: Leency * Author: Leency
*/ */
@ -43,9 +43,6 @@
#define BOTPANEL_H 36 #define BOTPANEL_H 36
#ifdef LANG_RUS #ifdef LANG_RUS
#define T_CPU_AND_RAM "<22>à®æ¥áá®à ¨ Ž‡“"
#define T_DRIVES "„¨áª¨"
#define T_PROCESSES "<22>à®æ¥ááë"
#define T_APP_TITLE "‘¨á⥬­ë© ¬®­¨â®à" #define T_APP_TITLE "‘¨á⥬­ë© ¬®­¨â®à"
#define T_SHOW_SYSTEM "‘¨á⥬­ë¥" #define T_SHOW_SYSTEM "‘¨á⥬­ë¥"
#define T_DETAILS "<22>®¤à®¡­¥¥" #define T_DETAILS "<22>®¤à®¡­¥¥"
@ -57,9 +54,6 @@
#define T_RD_USAGE "‘¨á⥬­ë© ¤¨áª: %i Š¡ ᢮¡®¤­® ¨§ 1.4 Œ¡" #define T_RD_USAGE "‘¨á⥬­ë© ¤¨áª: %i Š¡ ᢮¡®¤­® ¨§ 1.4 Œ¡"
#define T_TMP_USAGE "TMP%i ¤¨áª: %i Œ¡ ᢮¡®¤­® ¨§ %i Œ¡" #define T_TMP_USAGE "TMP%i ¤¨áª: %i Œ¡ ᢮¡®¤­® ¨§ %i Œ¡"
#else #else
#define T_CPU_AND_RAM "CPU & RAM"
#define T_DRIVES "Drives"
#define T_PROCESSES "Processes"
#define T_APP_TITLE "System Monitor" #define T_APP_TITLE "System Monitor"
#define T_SHOW_SYSTEM "System" #define T_SHOW_SYSTEM "System"
#define T_DETAILS "Details" #define T_DETAILS "Details"
@ -118,7 +112,7 @@ void main()
//dword cpu_frequency = GetCpuFrequency()/1000; //dword cpu_frequency = GetCpuFrequency()/1000;
load_lib(); load_lib();
SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER); SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);
loop() switch(@WaitEventTimeout(120)) loop() switch(@WaitEventTimeout(50))
{ {
case evMouse: case evMouse:
SelectList_ProcessMouse(); SelectList_ProcessMouse();
@ -175,9 +169,9 @@ void main()
ram.set_size(RIGHT_X, WIN_CONTENT_Y+170, right_w, 23); ram.set_size(RIGHT_X, WIN_CONTENT_Y+170, right_w, 23);
rd.set_size(RIGHT_X, WIN_CONTENT_Y+240, right_w, 23); rd.set_size(RIGHT_X, WIN_CONTENT_Y+240, right_w, 23);
default: default:
SelectList_LineChanged();
MonitorCpu(); MonitorCpu();
MonitorRam(); MonitorRam();
SelectList_LineChanged();
MonitorRd(); MonitorRd();
MonitorTmp(); MonitorTmp();
} }
@ -343,11 +337,11 @@ void MonitorCpu()
sprintf(#param, T_CPU_LOAD, cpu_stack[pos]); sprintf(#param, T_CPU_LOAD, cpu_stack[pos]);
DrawIconWithText(RIGHT_X, cpu.y - 25, 48, #param); DrawIconWithText(RIGHT_X, cpu.y - 25, 48, #param);
for (i=0; i<right_w; i+=2) { #define LINEW 8
DrawBar(i+cpu.x, cpu.y, 1, cpu.h-cpu_stack[i], PROGRESS_BG); for (i=0; i<right_w; i+=LINEW) {
DrawBar(i+cpu.x, cpu.h-cpu_stack[i]+cpu.y, 1, cpu_stack[i], LOAD_CPU); DrawBar(i+cpu.x, cpu.y, LINEW, cpu.h-cpu_stack[i], PROGRESS_BG);
DrawBar(i+cpu.x, cpu.h-cpu_stack[i]+cpu.y, LINEW, cpu_stack[i], 0xDFA13B);
DrawBar(i+1+cpu.x, cpu.y, 1, cpu.h, PROGRESS_BG); //DrawBar(i+LINEW+cpu.x, cpu.y, 1, cpu.h, PROGRESS_BG);
} }
pos++; pos++;