forked from KolibriOS/kolibrios
@reshare: add UI window, there you can see icon numbers btw
various fixes git-svn-id: svn://kolibrios.org@9594 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
100cb041bb
commit
8d7c71d76f
@ -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
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
@ -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
|
||||
|
@ -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
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
J0 ; не делать начальный jump на main()
|
||||
|
||||
5 ; îďňčěčçŕöč˙ äë˙ Pentium I (no MMX) ďđîöĺńńîđŕ.
|
||||
4 ; îďňčěčçŕöč˙ äë˙ Pentium I (no MMX) ďđîöĺńńîđŕ.
|
||||
|
||||
r- ; запретить изменение доступной памяти в *.com файлах
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
@del *.
|
||||
@For /R %%i In (*.c) Do c-- "%%i"
|
||||
@rename *.com *.
|
||||
@pause
|
||||
@del warning.txt
|
||||
if not exist imgedit ( @pause )
|
||||
|
@ -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;
|
||||
|
@ -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!";
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
};
|
Loading…
Reference in New Issue
Block a user