Pixie 2.2, Taskbar 2

git-svn-id: svn://kolibrios.org@7166 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2018-02-20 23:23:57 +00:00
parent 43e84d7672
commit 4116e20492
7 changed files with 446 additions and 27 deletions

View File

@ -333,6 +333,15 @@ inline fastcall int TestBit( EAX, CL)
$and eax,1
}
:void SetClientScreenArea(dword _left, _right, _top, _bottom)
{
EAX = 48;
EBX = 6;
ECX = _left * 65536 + _right;
EDX = _top * 65536 + _bottom;
$int 64;
}
//------------------------------------------------------------------------------
:void DefineAndDrawWindow(dword _x, _y, _w, _h, _window_type, _bgcolor, _title, _flags)
@ -544,6 +553,11 @@ inline RefreshWindow(dword ID_REFRESH,ID_ACTIVE)
DefineAndDrawWindow(_x, _y, _w, _h, 0x41,0x000000,NULL,0b);
}
:void DefineUnDragableWindow(dword _x, _y, _w, _h)
{
DefineAndDrawWindow(_x, _y, _w, _h, 0x01, 0, 0, 0x01fffFFF);
}
:void EventDragWindow()
{
dword tmp_x,tmp_y;

View File

@ -34,7 +34,7 @@
char default_dir[] = "/rd/1";
od_filter filter2 = { 8, "MP3\0\0" };
#define ABOUT_MESSAGE "'Pixies Player v2.0
#define ABOUT_MESSAGE "'Pixies Player v2.3
A tiny MP3 folder player.
Controls:
@ -43,9 +43,7 @@ Play/Stop: Space or P key
Start playing selected file: Enter
Goto next/previous track: Ctrl + Left/Right
Change sound volume: Left/Right key
Mute: M key' -Std"
#define WIN_W_SMALL 127
#define WIN_H_SMALL 39
Mute: M key' -td"
scroll_bar scroll1 = { 5,200,398,44,0,2,115,15,0,0xeeeeee,0xBBBbbb,0xeeeeee,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1};
@ -167,7 +165,7 @@ void main()
if (list.ProcessKey(key_scancode)) DrawPlayList();
break;
case evReDraw:
if (window_mode == WINDOW_MODE_NORMAL) DefineDragableWindow(win_x_normal, win_y_normal, skin.w - 1, skin.h + list.h);
if (window_mode == WINDOW_MODE_NORMAL) DefineDragableWindow(win_x_normal, win_y_normal, skin.w - 1, skin.h + list.h-1);
if (window_mode == WINDOW_MODE_SMALL) DefineDragableWindow(win_x_small, win_y_small, WIN_W_SMALL, WIN_H_SMALL);
draw_window();
if (param[0]) {
@ -232,40 +230,54 @@ void draw_window() {
}
}
dword GetSongTitle()
{
char cur_y_playing_title[245];
strcpy(#cur_y_playing_title, #current_filename);
cur_y_playing_title[strlen(#cur_y_playing_title)-4] = '\0';
if (strlen(#cur_y_playing_title) > 36) strcpy(#cur_y_playing_title + 34, "...");
return #cur_y_playing_title;
}
void DrawTopPanel()
{
char cur_y_playing_title[245];
int button_y;
//if (playback_mode == PLAYBACK_MODE_STOPED) img_draw stdcall(skin.image, 13, 0, 22, skin.h, 300, 0);
//Mode depended
if (window_mode == WINDOW_MODE_NORMAL)
{
button_y = 47;
img_draw stdcall(skin.image, 0, 0, skin.w, skin.h, 0, 0);
strcpy(#cur_y_playing_title, #current_filename);
cur_y_playing_title[strlen(#cur_y_playing_title)-4] = '\0';
if (strlen(#cur_y_playing_title) > 36) strcpy(#cur_y_playing_title + 33, "...");
DrawPixieTitle(#work_folder + strrchr(#work_folder, '/'));
WriteText(10, 26, list.font_type, theme.color_top_panel_text, #cur_y_playing_title);
button_y = 45;
if (playback_mode != PLAYBACK_MODE_STOPED) img_draw stdcall(skin.image, 38, button_y, 33, 17, skin.w+1, WIN_H_SMALL+1);
if /*(!list.count) && */ (!work_folder) DrawPixieTitle("Pixie");
else DrawPixieTitle(#work_folder + strrchr(#work_folder, '/'));
WriteText(10, 26, list.font_type, theme.color_top_panel_song_name, GetSongTitle());
//Playing control buttons
DefineHiddenButton(7, button_y, 30, 16, BUTTON_PLAYBACK_PREV);
DefineHiddenButton(39, button_y, 30, 16, BUTTON_PLAYBACK_PLAY_PAUSE);
DefineHiddenButton(71, button_y, 30, 16, BUTTON_PLAYBACK_NEXT);
//Window control buttons
DefineHiddenButton(Form.width - 21, 1, 20, 13, BUTTON_WINDOW_CLOSE);
DefineHiddenButton(Form.width - 43, 1, 20, 13, BUTTON_WINDOW_MINIMIZE);
DefineHiddenButton(Form.width - 65, 1, 20, 13, BUTTON_WINDOW_REDUCE);
//Open and volume
DefineHiddenButton(Form.width - 56, button_y, 23, 23, BUTTON_OPEN_DIALOG);
DefineHiddenButton(Form.width - 27, button_y, 23, 23, BUTTON_SHOW_VOLUME);
}
else if (window_mode == WINDOW_MODE_SMALL)
{
button_y = 7;
img_draw stdcall(skin.image, 0, 0, WIN_W_SMALL, WIN_H_SMALL, skin.w-1, 0);
DefineHiddenButton(0, 0, WIN_W_SMALL, WIN_H_SMALL, 99 + BT_NOFRAME);
button_y = 9;
//Playing control buttons
DefineHiddenButton(8, button_y, 24, 16, BUTTON_PLAYBACK_PREV);
DefineHiddenButton(34, button_y, 24, 16, BUTTON_PLAYBACK_PLAY_PAUSE);
DefineHiddenButton(60, button_y, 24, 16, BUTTON_PLAYBACK_NEXT);
//Window control buttons
DefineHiddenButton(Form.width - 20, 1, 19, 13, BUTTON_WINDOW_CLOSE);
DefineHiddenButton(Form.width - 20, 16, 19, 13, BUTTON_WINDOW_REDUCE);
}
if (!list.count) DrawPixieTitle("Pixie");
//Playing control buttons
DefineHiddenButton(5, button_y, 23, 23, BUTTON_PLAYBACK_PREV);
DefineHiddenButton(34, button_y-2, 27, 25, BUTTON_PLAYBACK_PLAY_PAUSE);
DefineHiddenButton(65, button_y, 23, 23, BUTTON_PLAYBACK_NEXT);
//Window control buttons
DefineHiddenButton(Form.width - 18, 1, 15, 15, BUTTON_WINDOW_CLOSE);
DefineHiddenButton(Form.width - 18, 16, 15, 15, BUTTON_WINDOW_REDUCE);
DefineHiddenButton(Form.width - 32, 1, 15, 15, BUTTON_WINDOW_MINIMIZE);
}
@ -283,7 +295,7 @@ void DrawScroller()
void DrawPixieTitle(dword _title)
{
WriteTextB(10, 6, list.font_type, theme.color_top_panel_text, _title);
WriteTextB(10, 6, list.font_type, theme.color_top_panel_folder_name, _title);
}
//===================================================//

View File

@ -1,5 +1,6 @@
struct struct_pixie_colors {
dword color_top_panel_text,
dword color_top_panel_folder_name,
color_top_panel_song_name,
color_list_bg,
color_list_text,
color_list_active_bg,
@ -11,6 +12,9 @@ struct struct_pixie_colors {
char config_section[] = "Config";
#define WIN_W_SMALL 114
#define WIN_H_SMALL 31
void LoadIniConfig()
{
ini_get_int stdcall (#pixie_ini_path, #config_section, "window_mode", WINDOW_MODE_NORMAL); window_mode = EAX;
@ -22,14 +26,15 @@ void LoadIniConfig()
Libimg_LoadImage(#skin, abspath("skin.png"));
skin.w = 322;
theme.color_top_panel_text = 0x5C5146;
theme.color_top_panel_folder_name = 0xDDDDDB;
theme.color_top_panel_song_name = 0xBEBEBE;
theme.color_list_bg = 0xE2E2E2;
theme.color_list_text = 0x595959;
theme.color_list_active_bg = 0xFAF3AF;
theme.color_list_active_text = 0x85663F;
theme.color_list_active_pointer = 0x85663F;
theme.color_list_scroller = 0xBBBbbb;
theme.color_list_border = 0x736D65;
theme.color_list_border = 0x010101;
scroll1.bckg_col = theme.color_list_bg;
scroll1.frnt_col = theme.color_list_border;
scroll1.line_col = theme.color_list_border;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -0,0 +1,123 @@
[icons]
tmpdisk=36
vmode=7
netcfg=33
setup=5
calendar=52
appearance.kex=62
palitra=61
skincfg=80
@volume=64
panels_cfg=63
mousecfg=54
drvinst.kex=71
board=19
netstat=33
gmon=57
cpu=60
clipview=83
test=37
cpuid=37
disptest=7
fspeed=45
hdd_info=50
kbd=37
mgb=38
pcidev=38
tinypad=9
eolite=1
shell=2
kfar=16
rdsave=17
fb2read=44
animage=15
kpack=10
snake=32
mine=14
seawar=66
tetris=47
pong=12
15=34
docpack=8
board=19
hexedit=22
debug=39
pipes=26
sudoku=25
gomoku=24
xonix=21
checkers=20
kosilka=23
flood-it=59
fasm=10
clicks=18
webview=31
syspanel=6
app+=27
diff=84
textreader=85
calc=4
sdlquake=56
doom=43
doom=43
lasertank=72
lrl=41
kosilka=23
bomber=14
tanks=67
sw=66
almaz=81
klavisha=69
clicks=18
checkers=20
sudoku=25
mine=14
flood-it=59
knight=82
15=34
gomoku=24
msquare=25
lines=59
2048=53
fara=42
tetris=47
pipes=26
snake=32
xonix=21
freecell=68
pong=12
pong3=12
arcanii=12
tinypad=9
webview=31
t_edit=58
txtread=85
zsea=46
kiv=70
font_viewer=76
animage=15
pixie=65
fplay=40
ac97snd=64
midamp=74
rtfread=55
graph=28
heed=22
shell=2
fasm=10
kpack=10
view3ds=75
fb2read=44
cobj=2
eolite=1
@menu=49
[attached]
/sys/@menu=?
/sys/File managers/eolite=?
/sys/tinypad=?
/sys/media/pixie/pixie=?
/sys/network/webview=?
[taskbar]
attachement=0

View File

@ -0,0 +1,5 @@
C-- taskbar2.c
@del @taskbar
@rename taskbar2.com @taskbar
@del warning.txt
@pause

View File

@ -0,0 +1,260 @@
#define MEMSIZE 4096*20
//===================================================//
// //
// LIB //
// //
//===================================================//
#include "../lib/gui.h"
#include "../lib/list_box.h"
#include "../lib/io.h"
#include "../lib/collection.h"
#include "../lib/patterns/restart_process.h"
#include "../lib/mem.h"
#include "../lib/obj/libio.h"
#include "../lib/obj/libimg.h"
#include "../lib/obj/libini.h"
#include "../lib/patterns/libimg_load_skin.h"
//===================================================//
// //
// DATA //
// //
//===================================================//
int current_process_id = 0;
int proc_list[256];
collection attached;
llist list;
proc_info Form;
proc_info Process;
enum {
ATTACHEMENT_BOTTOM,
ATTACHEMENT_LEFT,
ATTACHEMENT_TOP,
ATTACHEMENT_RIGHT
};
int attachement = ATTACHEMENT_BOTTOM;
#define CELLW 40
#define CELLH 40
dword COLOR_BG = 0x3B3B3B;
dword COLOR_MENU_BG = 0x323232;
dword COLOR_OPENED = 0x999999;
dword COLOR_ACTIVE = 0x0099FF;
dword COLOR_TEXT = 0xFFFfff;
//===================================================//
// //
// CODE //
// //
//===================================================//
void main()
{
byte btn;
load_dll(libio, #libio_init,1);
load_dll(libimg, #libimg_init,1);
load_dll(libini, #lib_init,1);
Libimg_LoadImage(#skin, "/sys/icons32.png");
Libimg_FillTransparent(skin.image, skin.w, skin.h, COLOR_BG);
ini_get_int stdcall ("/sys/appicons.ini", "taskbar", "attachement", ATTACHEMENT_BOTTOM);
attachement = EAX;
SetAttachement();
GetAttachedItems();
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)
{
case evMouse:
if (!CheckActiveProcess(Form.ID)) break;
mouse.get();
if (mouse.down) {}
//if (list.ProcessMouse()) DrawProcessList();
break;
case evKey:
GetKeys();
if (key_scancode == SCAN_CODE_ESC) {
RunProgram(#program_path, NULL);
ExitProcess();
}
break;
case evButton:
btn = GetButtonID();
btn -= 100;
if (btn < attached.count) RunProgram(attached.get(btn), NULL);
else EventSetActiveProcess(btn);
break;
case evReDraw:
DefineUnDragableWindow(NULL, NULL, NULL, NULL);
list.SetSizes(0, 0, Form.width+1, Form.height+2, CELLH);
default:
DrawProcessList();
}
}
}
void GetProcessList()
{
int i, j;
list.count=0;
for (i=0; i<attached.count; i++)
{
proc_list[list.count] = 0;
list.count++;
}
for (i=0; i<MAX_PROCESS_COUNT; i++)
{
GetProcessInfo(#Process, i);
if (Process.name)
{
for (j=0; j<11; j++) if (Process.name[j]!=' ') {
//do not show system process
if (Process.name[0]=='@') break;
if (!strcmp(#Process.name, "IDLE")) break;
if (!strcmp(#Process.name, "OS")) break;
if (!Process.width) && (!Process.height) break;
proc_list[list.count] = i;
list.count++;
break;
}
}
}
}
void DrawProcessList()
{
#define ACTIVE_SIZE 3
#define CELL_MARGIN_X 10
#define CELL_MARGIN_Y 4
#define CELL_PADDING 4
int i;
int posy=list.y;
int posx=list.x;
int icon_n;
dword status_color;
GetProcessList();
for (i=0; i<list.count; i++)
{
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;
}
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;
if (CheckActiveProcess(Process.ID)) && (Process.status_window!=2) {
current_process_id = Process.ID;
status_color = COLOR_ACTIVE;
}
else {
status_color = COLOR_OPENED;
}
}
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);
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);
if (ATTACHEMENT_TOP ==attachement) DrawBar(posx, posy, CELLW, ACTIVE_SIZE, status_color);
if (ATTACHEMENT_RIGHT ==attachement) DrawBar(posx+CELLW-ACTIVE_SIZE, posy, ACTIVE_SIZE, CELLH, status_color);
if (ATTACHEMENT_TOP==attachement) || (ATTACHEMENT_BOTTOM==attachement) {
posx += CELLW;
DrawBar(posx, posy, CELL_MARGIN_X, list.h, COLOR_BG);
posx += CELL_MARGIN_X;
}
if (ATTACHEMENT_LEFT==attachement) || (ATTACHEMENT_RIGHT==attachement) {
posy += CELLH;
DrawBar(posx, posy, list.w, CELL_MARGIN_Y, COLOR_BG);
posy += CELL_MARGIN_Y;
}
}
DrawBar(posx, posy, list.w, list.h, COLOR_BG);
}
void SetAttachement()
{
if (attachement==ATTACHEMENT_LEFT) {
DefineUnDragableWindow(0, 0, CELLW-1, screen.height);
SetClientScreenArea(CELLW, screen.width-CELLW, 0, screen.height);
}
if (attachement==ATTACHEMENT_RIGHT) {
DefineUnDragableWindow(screen.width - CELLW, 0, CELLW, screen.height);
SetClientScreenArea(0, screen.width-CELLW, 0, screen.height);
}
if (attachement==ATTACHEMENT_TOP) {
DefineUnDragableWindow(0, 0, screen.width, CELLH-1);
SetClientScreenArea(0, 0, CELLH, screen.height);
}
if (attachement==ATTACHEMENT_BOTTOM) {
DefineUnDragableWindow(0, screen.height, screen.width, CELLH);
SetClientScreenArea(0, 0, 0, screen.height - CELLH);
}
}
byte draw_icons_from_section(dword key_value, key_name, sec_name, f_name)
{
attached.add(key_name);
return true;
}
void GetAttachedItems()
{
attached.drop();
ini_enum_keys stdcall ("/sys/appicons.ini", "attached", #draw_icons_from_section);
}
//===================================================//
// //
// EVENTS //
// //
//===================================================//
//If we clicked on current active process then minimize it
//else set active
void EventSetActiveProcess(dword i)
{
GetProcessInfo(#Process, proc_list[i+list.first]);
Process.num_slot = GetProcessSlot(Process.ID);
if (Process.ID) ActivateWindow(Process.num_slot);
if (current_process_id == Process.ID) && (Process.status_window!=2) {
MinimizeWindow();
//TODO: make another window active
}
DrawProcessList();
}
stop: