forked from KolibriOS/kolibrios
cmm: global rework of libimg wrappers
git-svn-id: svn://kolibrios.org@7995 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
f14c7a99a7
commit
7a6c5c33a6
@ -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;
|
||||
}
|
||||
|
||||
|
BIN
programs/cmm/barscfg/bars.png
Normal file
BIN
programs/cmm/barscfg/bars.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
programs/cmm/barscfg/bars.raw
Normal file
BIN
programs/cmm/barscfg/bars.raw
Normal file
Binary file not shown.
@ -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
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
@ -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)
|
||||
|
@ -165,12 +165,16 @@ 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
|
||||
if (i == MAX_CELL_SIZE*MAX_CELL_SIZE-1) {
|
||||
mas[i] = 0;
|
||||
} else {
|
||||
mas[i] = ESDWORD[i*3+_inbuf] & 0xFFFFFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dword _image::get_image()
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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
|
@ -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()
|
||||
|
@ -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)+30<list.item_w) <== too slow
|
||||
kfont.WriteIntoWindowCenter(text_x, row*list.item_h+46 + list_pos, list.item_w,0, swc.list_bg, swc.text, 12, key_name);
|
||||
//WriteTextCenter(text_x, row*list.item_h+46 + list_pos+3, list.item_w, swc.text, key_name);
|
||||
} else {
|
||||
space_pos = strrchr(key_name, ' ');
|
||||
ESBYTE[key_name+space_pos-1] = '\0';
|
||||
kfont.WriteIntoWindowCenter(text_x, row*list.item_h+46 + list_pos - 2, list.item_w,0, swc.list_bg, swc.text, 12, key_name);
|
||||
kfont.WriteIntoWindowCenter(text_x, row*list.item_h+46 + list_pos + 13, list.item_w,0, swc.list_bg, swc.text, 12, key_name+space_pos);
|
||||
//WriteTextCenter(text_x, row*list.item_h+46 + list_pos, list.item_w, swc.text, key_name);
|
||||
//WriteTextCenter(text_x, row*list.item_h+46 + list_pos + 10, list.item_w, swc.text, key_name+space_pos);
|
||||
}
|
||||
if (icon_char_pos) icon_id = atoi(icon_char_pos+1);
|
||||
img_draw stdcall(skin.image, icon_x, icon_y, 32, 32, 0, icon_id*32);
|
||||
if (Form.cwidth) DrawIcon32(icon_x, icon_y, swc.list_bg, icon_id);
|
||||
list.count++;
|
||||
col++;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int old_row; //to detect empty sections
|
||||
byte process_sections(dword sec_name, f_name)
|
||||
{
|
||||
static int old_row; //to detect empty sections
|
||||
int text_len;
|
||||
if (!strcmp(sec_name, "Config")) return true;
|
||||
|
||||
if ((col==0) && (row==old_row))
|
||||
{
|
||||
if ((col==0) && (row==old_row)) {
|
||||
list_pos -= 28;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
row++;
|
||||
}
|
||||
col = 0;
|
||||
@ -253,7 +237,7 @@ void DrawTopBar()
|
||||
|
||||
void EventIconClick(dword appid)
|
||||
{
|
||||
char run_app_path[4096]=0;
|
||||
char run_app_path[4096];
|
||||
dword app_path = app_path_collection.get(appid);
|
||||
dword param_pos = strchr(app_path, '|');
|
||||
if (param_pos) {
|
||||
|
@ -96,6 +96,8 @@ enum {
|
||||
PLAYBACK_MODE_PLAYING
|
||||
};
|
||||
|
||||
libimg_image skin;
|
||||
|
||||
#define LAST_FOLDER_EXISTS 1
|
||||
|
||||
//===================================================//
|
||||
@ -127,11 +129,9 @@ void main()
|
||||
if (work_folder) param=LAST_FOLDER_EXISTS;
|
||||
}
|
||||
kfont.init(DEFAULT_FONT);
|
||||
SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);
|
||||
loop()
|
||||
@SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);
|
||||
loop() switch(@WaitEventTimeout(10))
|
||||
{
|
||||
WaitEventTimeout(10);
|
||||
switch(EAX & 0xFF) {
|
||||
case evMouse:
|
||||
mouse.get();
|
||||
scrollbar_v_mouse (#scroll1);
|
||||
@ -153,7 +153,7 @@ void main()
|
||||
if (mouse.down) && (mouse.y>skin_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;
|
||||
@ -206,7 +206,6 @@ void main()
|
||||
EventCheckSongFinished();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DrawPlayList()
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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,10 +75,7 @@ void main()
|
||||
GetProcessInfo(#Form, SelfInfo);
|
||||
SetWindowLayerBehaviour(-1, ZPOS_DESKTOP);
|
||||
SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER);
|
||||
loop()
|
||||
{
|
||||
WaitEventTimeout(50);
|
||||
switch(EAX & 0xFF)
|
||||
loop() switch(@WaitEventTimeout(50))
|
||||
{
|
||||
case evMouse:
|
||||
if (!CheckActiveProcess(Form.ID)) break;
|
||||
@ -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);
|
||||
@ -107,7 +103,6 @@ void main()
|
||||
DrawProcessList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GetProcessList()
|
||||
@ -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);
|
||||
}
|
||||
//===================================================//
|
||||
// //
|
||||
|
@ -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) && (y<don_step_y) DrawBar(x, 0, don_w, y, COLOR_ROAD);
|
||||
if (image_h>0) 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));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user