docky: colors change on fly, use reshare, refactoring

appearance: remove "Update Dock" checkbox, UI inprovements

git-svn-id: svn://kolibrios.org@9530 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2021-12-30 20:54:18 +00:00
parent ee947e3840
commit 106b86b0d0
7 changed files with 291 additions and 476 deletions

View File

@ -28,8 +28,6 @@ dword fmas;
int active_skin=-1, active_wallpaper=-1, active_screensaver=-1; int active_skin=-1, active_wallpaper=-1, active_screensaver=-1;
checkbox update_docky = { T_UPDATE_DOCK, false };
checkbox optionbox_stretch = { T_CHECKBOX_STRETCH, false }; checkbox optionbox_stretch = { T_CHECKBOX_STRETCH, false };
checkbox optionbox_tiled = { T_CHECKBOX_TILED, false }; checkbox optionbox_tiled = { T_CHECKBOX_TILED, false };
checkbox optionbox_auto = { T_CHECKBOX_AUTO, true }; checkbox optionbox_auto = { T_CHECKBOX_AUTO, true };
@ -81,7 +79,6 @@ void main()
if (tabs.active_tab == TAB_SKINS) { if (tabs.active_tab == TAB_SKINS) {
checkbox1.click(id); checkbox1.click(id);
spinbox1.click(id); spinbox1.click(id);
if (update_docky.click(id)) EventUpdateDocky();
} }
if (tabs.active_tab == TAB_WALLPAPERS) { if (tabs.active_tab == TAB_WALLPAPERS) {
if (id==BTN_SELECT_WALLP_FOLDER) EventSelectWallpFolder(); if (id==BTN_SELECT_WALLP_FOLDER) EventSelectWallpFolder();
@ -127,32 +124,22 @@ void main()
void draw_window() void draw_window()
{ {
sc.get(); sc.get();
DefineAndDrawWindow(screen.width-WIN_W-9/2,80,WIN_W+9,WIN_H+4+skin_height,0x34,sc.work,WINDOW_HEADER,0); DefineAndDrawWindow(screen.width-WIN_W-9/2,80,WIN_W+9,WIN_H+4+skin_height,0x74,sc.work,WINDOW_HEADER,0);
DrawBar(0, 0, WIN_W, PANEL_H-2, sc.work); //top
DrawBar(0, PANEL_H-2, LP-2, WIN_H-PANEL_H-LP+4, EDX); //left
DrawBar(LIST_W+LP+20, PANEL_H-2, WIN_W-LIST_W-26, WIN_H-PANEL_H-LP+4, EDX); //right
DrawBar(0, WIN_H-LP+2, WIN_W, LP-2, EDX); //bottom
tabs.draw(); tabs.draw();
draw_icon_16w(tabs.x + TAB_P, LP+5, 17); draw_icon_16w(tabs.x + TAB_P, LP+5, 17);
draw_icon_16w(sizeof(t_skins)-1*8 + TAB_P + TAB_P + tabs.x, LP+5, 6); draw_icon_16w(sizeof(t_skins)-1*8 + TAB_P + TAB_P + tabs.x, LP+5, 6);
draw_icon_16w(sizeof(t_wallpapers)+sizeof(t_skins)-2*8 + TAB_P + TAB_P + TAB_P + tabs.x, LP+5, 61); draw_icon_16w(sizeof(t_wallpapers)+sizeof(t_skins)-2*8 + TAB_P + TAB_P + TAB_P + tabs.x, LP+5, 61);
$push select_list.cur_y
SelectList_Init(
LP,
PANEL_H,
LIST_W,
WIN_H - LP - PANEL_H
);
$pop select_list.cur_y
DrawBar(RIGHTx, PANEL_H, RIGHTw, WIN_H-PANEL_H-LP, sc.work);
SelectList_Draw();
SelectList_DrawBorder();
if (tabs.active_tab == TAB_SKINS) if (tabs.active_tab == TAB_SKINS)
{ {
DrawFrame(RIGHTx, PANEL_H+5, RIGHTw, RIGHTh, T_UI_PREVIEW); DrawFrame(RIGHTx, PANEL_H+5, RIGHTw, RIGHTh, T_UI_PREVIEW);
DrawUiElementsPreview(RIGHTx+20, PANEL_H+5, RIGHTh); DrawUiElementsPreview(RIGHTx+20, PANEL_H+5, RIGHTh);
if (CheckProcessExists("@DOCKY")) update_docky.draw(RIGHTx, PANEL_H+250);
} }
if (tabs.active_tab == TAB_WALLPAPERS) if (tabs.active_tab == TAB_WALLPAPERS)
{ {
@ -172,6 +159,18 @@ void draw_window()
ESI = DrawStandartCaptButton(RIGHTx, PANEL_H + 65, BTN_TEST_SCREENSAVER, T_SS_PREVIEW); ESI = DrawStandartCaptButton(RIGHTx, PANEL_H + 65, BTN_TEST_SCREENSAVER, T_SS_PREVIEW);
DrawStandartCaptButton(RIGHTx+ESI, PANEL_H + 65, BTN_SET_SCREENSAVER, T_SS_SET); DrawStandartCaptButton(RIGHTx+ESI, PANEL_H + 65, BTN_SET_SCREENSAVER, T_SS_SET);
} }
$push select_list.cur_y
SelectList_Init(
LP,
PANEL_H,
LIST_W,
WIN_H - LP - PANEL_H
);
$pop select_list.cur_y
SelectList_Draw();
SelectList_DrawBorder();
} }
void draw_timeout() void draw_timeout()
@ -399,10 +398,9 @@ void EventApply()
strcpy(#cur_file_path, list.get(select_list.cur_y)); strcpy(#cur_file_path, list.get(select_list.cur_y));
if (tabs.active_tab==TAB_SKINS) if (tabs.active_tab==TAB_SKINS)
{ {
SetSystemSkin(#cur_file_path);
SelectList_Draw();
strcpy(#cur_skin_path, #cur_file_path); strcpy(#cur_skin_path, #cur_file_path);
EventUpdateDocky(); SetSystemSkin(#cur_file_path);
MoveSize(OLD, OLD, OLD, WIN_H+4+GetSkinHeight());
} }
if (tabs.active_tab==TAB_WALLPAPERS) if (tabs.active_tab==TAB_WALLPAPERS)
{ {
@ -423,15 +421,6 @@ void EventApply()
} }
} }
void EventUpdateDocky()
{
if (update_docky.checked) {
RestartProcessByName("/sys/@docky", MULTIPLE);
pause(50);
ActivateWindow_Self();
}
}
void EventOpenFile() void EventOpenFile()
{ {
switch (tabs.active_tab) { switch (tabs.active_tab) {

View File

@ -4,6 +4,8 @@
/* /*
BUGS: BUGS:
- F1 in KFM (move Properties to an external app) - F1 in KFM (move Properties to an external app)
- Ctrl+1+2+3+4 in KFM
- Highlight another commands on Ctrl|Shift in KFM like in Classic KFM
TODO: TODO:
- add option Preserve all timestamps (Created, Opened, Modified) - add option Preserve all timestamps (Created, Opened, Modified)
http://board.kolibrios.org/viewtopic.php?f=23&t=4521&p=77334#p77334 http://board.kolibrios.org/viewtopic.php?f=23&t=4521&p=77334#p77334

View File

@ -1,97 +1,37 @@
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
img_data:
.file_name:
db "/sys/icons32.png", 0
;-------------------------------------------------------------------------------
ini_data: ini_data:
.file_name: .file_name db "/sys/settings/Docky.ini", 0
db "/sys/settings/Docky.ini", 0 .path_name db "path", 0
.path_name: .param_name db "param", 0
db "path", 0 .icon_name db "icon", 0
.param_name: .separator_name db "$", 0
db "param", 0
.icon_name:
db "icon", 0
.separator_name:
db "$", 0
.settings_name: .settings_name db "@", 0
db "@", 0 .location_name db "location", 0
.location_name: .fsize_name db "fsize", 0
db "location", 0 .ashow_name db "ashow", 0
.fsize_name:
db "fsize", 0
.ashow_name:
db "ashow", 0
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
load_lib_start: load_lib_start:
lib1 l_libs img.name, \ lib2 l_libs ini.name, file_name, ini.dir, ini
file_name, \
img.dir, \
img
lib2 l_libs ini.name, \
file_name, \
ini.dir, \
ini
load_lib_end: load_lib_end:
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
img:
.init \
dd .init_T
.toRGB \
dd .toRGB_T
.decode \
dd .decode_T
.destroy \
dd .destroy_T
dd 0, 0
.init_T:
db "lib_init", 0
.toRGB_T:
db "img_to_rgb2", 0
.decode_T:
db "img_decode", 0
.destroy_T:
db "img_destroy", 0
.dir:
db "/sys/lib/"
.name:
db "libimg.obj", 0
;-------------------------------------------------------------------------------
ini: ini:
.init \ .init dd .init_T
dd .init_T .sections dd .sections_T
.sections \ .get_int dd .get_int_T
dd .sections_T .get_str dd .get_str_T
.get_int \
dd .get_int_T
.get_str \
dd .get_str_T
dd 0, 0 dd 0,0
.init_T: .init_T db "lib_init", 0
db "lib_init", 0 .sections_T db "ini_enum_sections", 0
.sections_T: .get_int_T db "ini_get_int", 0
db "ini_enum_sections", 0 .get_str_T db "ini_get_str", 0
.get_int_T:
db "ini_get_int", 0
.get_str_T:
db "ini_get_str", 0
.dir: .dir db "/sys/lib/"
db "/sys/lib/" .name db "libini.obj", 0
.name:
db "libini.obj", 0
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
ICON_SIZE equ 32 * 32 ICON_SIZE equ 32 * 32
ICON_SIZE_BGR equ ICON_SIZE * 3 BUTTON_SIZE equ 44
ICON_SIZE_RGB equ ICON_SIZE * 4
BUTTON_SIZE equ 44
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
__dataend: __dataend:

View File

@ -1,149 +1,77 @@
rb 1024 rb 1024
__stackend: __stackend:
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
sel_img: sc system_colors
rb 32 * 32 * 3
;-------------------------------------------------------------------------------
error:
rb 0
;-------------------------------------------------------------------------------
color:
rd 1
rd 1
.frame:
rd 1
rd 1
rd 1
.bg:
rd 1
.bt:
rd 1
rd 1
.text:
rd 1
rd 1
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
win: win:
.x: .x rd 1
rd 1 .y rd 1
.y: .w rd 1
rd 1 .h rd 1
.width:
rd 1 .x_hdn rd 1
.height: .y_hdn rd 1
rd 1 .w_hdn rd 1
.h_hdn rd 1
.x_hdn: .x_opn rd 1
rd 1 .y_opn rd 1
.y_hdn: .w_opn rd 1
rd 1 .h_opn rd 1
.width_hdn:
rd 1 .sid rd 1
.height_hdn: .psid rd 1
rd 1 .procinfo: rb 1024
.state rb 1
.btn_index rd 1
.prev_index rd 1
.x_opn: .isvert rb 1
rd 1
.y_opn:
rd 1
.width_opn:
rd 1
.height_opn:
rd 1
.sid:
rd 1
.psid:
rd 1
.procinfo:
rb 1024
.state:
rb 1
.button_index:
rd 1
.prev_index:
rd 1
.isvert:
rb 1
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
nwin: nwin:
.x: .x rd 1
rd 1 .y rd 1
.y: .w rd 1
rd 1 .h rd 1
.width:
rd 1
.height:
rd 1
.bgx: .bgx rd 1
rd 1 .bgy rd 1
.bgy: .bgwidth rd 1
rd 1 .bgheight rd 1
.bgwidth:
rd 1
.bgheight:
rd 1
.visible: .visible rd 1
rd 1 .sid rd 1
.sid: .swap_shape rb 1
rd 1 .close rb 1
.change_shape:
rb 1
.close:
rb 1
;-------------------------------------------------------------------------------
img_data.object:
rd 1
img_data.rgb_object:
rd 1
img_data.size:
rd 1
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
fi: fi:
.p00: .p00 rd 1
rd 1 .p04 rd 1
.p04: .p08 rd 1
rd 1 .p12 rd 1
.p08: .p16 rd 1
rd 1 .p20 rb 1
.p12: .p21 rd 1
rd 1
.p16:
rd 1
.p20:
rb 1
.p21:
rd 1
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
dock_items: dock_items:
.count: .count rd 1
rd 1 .name rb 16 * 20
.name: .path rb 256 * 20
rb 16 * 20 .param rb 256 * 20
.path: .icon rd 1 * 20
rb 256 * 20 .separator rb 1 * 20
.param: .location rd 1
rb 256 * 20 .fsize: rb 1
.icon: .ashow: rb 1
rd 1 * 20
.separator:
rb 1 * 20
.location:
rd 1
.fsize:
rb 1
.ashow:
rb 1
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
buf_128: sys_path rb 4096
rb 128 file_name rb 4096
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
sys_path: icons_resname db 'ICONS32', 0
rb 4096 shr_icons_ptr dd ?
file_name: shr_icons_len dd ?
rb 4096 icons_inactive dd ?
icons_active dd ?
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
__memend: __memend:

View File

@ -1,20 +1,20 @@
n_main: n_main:
mov dword[nwin.width], 67 mov dword[nwin.w], 67
mov dword[nwin.height], 16 mov dword[nwin.h], 16
mov dword[nwin.bgwidth], 66 mov dword[nwin.bgwidth], 66
mov dword[nwin.bgheight], 1 mov dword[nwin.bgheight], 1
cmp dword[dock_items.location], 1 cmp dword[dock_items.location], 1
je .top je .top
cmp dword[dock_items.location], 4 cmp dword[dock_items.location], 4
je .right je .right
cmp dword[dock_items.location], 3 cmp dword[dock_items.location], 3
je .bottom je .bottom
jmp .left jmp .left
.top: .top:
mov eax, [win.height_opn] mov eax, [win.h_opn]
mov [nwin.y], eax mov [nwin.y], eax
mov dword[nwin.bgx], 1 mov dword[nwin.bgx], 1
@ -22,12 +22,12 @@
jmp @f jmp @f
.left: .left:
mov eax, [win.width_opn] mov eax, [win.w_opn]
mov [nwin.x], eax mov [nwin.x], eax
mov dword[nwin.bgy], 1 mov dword[nwin.bgy], 1
mov dword[nwin.bgwidth], 1 mov dword[nwin.bgwidth], 1
mov eax, [nwin.height] mov eax, [nwin.h]
dec eax dec eax
mov dword[nwin.bgheight], eax mov dword[nwin.bgheight], eax
@ -39,9 +39,9 @@
mov [nwin.y], eax mov [nwin.y], eax
mov dword[nwin.bgx], 1 mov dword[nwin.bgx], 1
mov eax, [nwin.height] mov eax, [nwin.h]
mov eax, [nwin.height] mov eax, [nwin.h]
mov [nwin.bgy], eax mov [nwin.bgy], eax
jmp @f jmp @f
@ -51,11 +51,11 @@
sub eax, 68 sub eax, 68
mov [nwin.x], eax mov [nwin.x], eax
mov eax, [nwin.width] mov eax, [nwin.w]
mov [nwin.bgx], eax mov [nwin.bgx], eax
mov dword[nwin.bgy], 1 mov dword[nwin.bgy], 1
mov dword[nwin.bgwidth], 1 mov dword[nwin.bgwidth], 1
mov eax, [nwin.height] mov eax, [nwin.h]
dec eax dec eax
mov dword[nwin.bgheight], eax mov dword[nwin.bgheight], eax
@ -73,9 +73,9 @@ n_main_loop:
mcall 23, 1 mcall 23, 1
cmp eax, EV_IDLE cmp eax, EV_IDLE
je n_event_idle je n_event_idle
cmp eax, EV_REDRAW cmp eax, EV_REDRAW
je n_event_redraw je n_event_redraw
jmp n_main_loop jmp n_main_loop
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
@ -83,24 +83,24 @@ n_event_idle:
cmp byte[nwin.close], 1 cmp byte[nwin.close], 1
jne @f jne @f
mcall 13, <0, [win.width]>, <[win.height], 1>, [color.frame] mcall 13, <0, [win.w]>, <[win.h], 1>, [sc.work_dark]
mov byte[nwin.close], 0 mov byte[nwin.close], 0
mcall -1 mcall -1
@@: @@:
cmp byte[win.button_index], 100 cmp byte[win.btn_index], 100
jne @f jne @f
mcall 67, 0, 0, 0, 0 mcall 67, 0, 0, 0, 0
jmp .end jmp .end
@@: @@:
cmp byte[nwin.change_shape], 1 cmp byte[nwin.swap_shape], 1
jne .end jne .end
mov byte[nwin.change_shape], 0 mov byte[nwin.swap_shape], 0
mcall 67, [nwin.x], [nwin.y], [nwin.width], [nwin.height] mcall 67, [nwin.x], [nwin.y], [nwin.w], [nwin.h]
.end: .end:
jmp n_main_loop jmp n_main_loop
@ -108,11 +108,11 @@ n_event_idle:
n_event_redraw: n_event_redraw:
mcall 12, 1 mcall 12, 1
mcall 0, <[nwin.x], [nwin.width]>, <[nwin.y], [nwin.height]>, [color.bg], [color.bg], [color.frame] mcall 0, <[nwin.x], [nwin.w]>, <[nwin.y], [nwin.h]>, [sc.work], [sc.work], [sc.work_dark]
mcall 13, <[nwin.bgx], [nwin.bgwidth]>, <[nwin.bgy], [nwin.bgheight]>, [color.bg] mcall 13, <[nwin.bgx], [nwin.bgwidth]>, <[nwin.bgy], [nwin.bgheight]>, [sc.work]
mov edx, [win.button_index] mov edx, [win.btn_index]
imul edx, 16 imul edx, 16
add edx, dock_items.name add edx, dock_items.name
@ -129,7 +129,7 @@ n_event_redraw:
shl ebx, 16 shl ebx, 16
add ebx, 5 add ebx, 5
mcall 4, , [color.text] mcall 4, , [sc.work_text]
mcall 12, 2 mcall 12, 2

View File

@ -1,3 +1,3 @@
del @docky
@fasm docky.asm @docky @fasm docky.asm @docky
@kpack @docky if not exist @docky ( @pause )
@pause

View File

@ -1,39 +1,41 @@
use32 use32
org 0x0 org 0x0
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
db "MENUET01" db "MENUET01"
dd 1, main, __dataend, __memend, __stackend, 0, sys_path dd 1, main, __dataend, __memend, __stackend, 0, sys_path
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
include "../../../macros.inc" include "../../../macros.inc"
include "../../../proc32.inc" include "../../../proc32.inc"
include "../../../dll.inc" include "../../../dll.inc"
include "../../../KOSfuncs.inc" include "../../../KOSfuncs.inc"
include "../../../load_lib.mac" include "../../../load_lib.mac"
;include "../../../debug.inc" ;include "../../../debug.inc"
include "DATA.INC" include "DATA.INC"
include "NAME.INC" include "NAME.INC"
@use_library \ @use_library \
mem.Alloc, \ mem.Alloc, mem.Free, mem.ReAlloc, dll.Load
mem.Free, \
mem.ReAlloc, \
dll.Load
;================================================================================ ;================================================================================
main: main:
; ==== Init ==== ; ==== Init ====
mcall SF_SYS_MISC, SSF_HEAP_INIT
mcall SF_STYLE_SETTINGS, SSF_GET_COLORS, sc, sizeof.system_colors
call LOAD_ICONS
mcall SF_SYSTEM, SSF_GET_ACTIVE_WINDOW mcall SF_SYSTEM, SSF_GET_ACTIVE_WINDOW
mov [win.psid], eax mov [win.psid], eax
mcall SF_SET_EVENTS_MASK, EVM_REDRAW+EVM_BUTTON+EVM_MOUSE ;+EVM_DEKSTOP to update colors on skin change mcall SF_SET_EVENTS_MASK, EVM_REDRAW+EVM_BUTTON+EVM_MOUSE ;+EVM_DEKSTOP to update colors on skin change
; ==== Load libs ==== ; ==== Load libs ====
load_libraries load_lib_start, load_lib_end load_libraries load_lib_start, load_lib_end
; ==== Config LibINI ==== ; ==== Config LibINI ====
invoke ini.get_int, ini_data.file_name, ini_data.settings_name, ini_data.location_name, 2 invoke ini.get_int, ini_data.file_name, ini_data.settings_name, ini_data.location_name, 2
test eax,eax test eax,eax
jz exit jz exit
mov [dock_items.location], eax mov [dock_items.location], eax
invoke ini.get_int, ini_data.file_name, ini_data.settings_name, ini_data.fsize_name, 0 invoke ini.get_int, ini_data.file_name, ini_data.settings_name, ini_data.fsize_name, 0
mov [dock_items.fsize], eax mov [dock_items.fsize], eax
@ -42,69 +44,11 @@ main:
invoke ini.sections, ini_data.file_name, sections_callback invoke ini.sections, ini_data.file_name, sections_callback
; ==== Load colors ====
mcall SF_STYLE_SETTINGS, SSF_GET_COLORS, color
or dword[color.bg], 0x10000000
or dword[color.frame], 0x10000000
or dword[color.text], 0x80000000
; ==== Config LibIMG ====
mov dword[fi.p00], SSF_GET_INFO
mov dword[fi.p16], buf_128
mov dword[fi.p21], img_data.file_name
mcall SF_FILE, fi
mov edx, [buf_128 + 32]
imul edx, 10
stdcall mem.Alloc, edx
mov [img_data.rgb_object], eax
mov dword[fi.p00], SSF_READ_FILE
mov dword[fi.p12], edx
m2m dword[fi.p16], dword[img_data.rgb_object]
mov dword[fi.p21], img_data.file_name
mcall SF_FILE, fi
cmp ebx, 0xFFFFFFFF
je @f
stdcall dword[img.decode], dword[img_data.rgb_object], ebx, 0
mov dword[img_data.object], eax
; === ALPHA ===
mov edi, eax
add edi, 8
mov edi, [edi]
imul edi, 128
sub edi, 4
add eax, 24
mov eax, [eax]
.setalpha:
mov ebx, [eax + edi]
shr ebx, 24
cmp ebx, 0
jne .nonalpha
mov ecx, [color.bg]
mov [eax + edi], ecx
.nonalpha:
sub edi, 4
cmp edi, 0
jne .setalpha
; === CONVERTING TO BGR
stdcall dword[img.toRGB], dword[img_data.object], dword[img_data.rgb_object]
stdcall dword[img.destroy], dword[img_data.object]
; ==== Config window ==== ; ==== Config window ====
mov eax, dword[dock_items.location] mov eax, dword[dock_items.location]
and eax, 1b and eax, 1b
cmp eax, 0 cmp eax, 0
je .vert je .vert
jmp .setshape jmp .setshape
.vert: .vert:
@ -112,14 +56,14 @@ main:
.setshape: .setshape:
cmp byte[win.isvert], 1 cmp byte[win.isvert], 1
je .vert_sp je .vert_sp
.horz_sp: .horz_sp:
call .HORZ_WIDTH call .HORZ_WIDTH
call .HORZ_X call .HORZ_X
call .HORZ_HEIGHT call .HORZ_HEIGHT
cmp dword[dock_items.location], 1 cmp dword[dock_items.location], 1
je .settop je .settop
.setbottom: .setbottom:
call .HORZ_Y_BOTTOM call .HORZ_Y_BOTTOM
@ -135,7 +79,7 @@ main:
call .VERT_HEIGHT call .VERT_HEIGHT
call .VERT_Y call .VERT_Y
cmp dword[dock_items.location], 2 cmp dword[dock_items.location], 2
je .setleft je .setleft
.setright: .setright:
call .VERT_X_RIGHT call .VERT_X_RIGHT
@ -148,7 +92,7 @@ main:
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
.HORZ_WIDTH: .HORZ_WIDTH:
cmp [dock_items.fsize], byte 1 cmp [dock_items.fsize], byte 1
je @f je @f
mov eax, BUTTON_SIZE mov eax, BUTTON_SIZE
mov ebx, [dock_items.count] mov ebx, [dock_items.count]
imul eax, ebx imul eax, ebx
@ -159,8 +103,8 @@ main:
mcall SF_GET_SCREEN_SIZE mcall SF_GET_SCREEN_SIZE
shr eax, 16 shr eax, 16
.set_hw: .set_hw:
mov [win.width_opn], eax mov [win.w_opn], eax
mov [win.width_hdn], eax mov [win.w_hdn], eax
ret ret
@ -168,7 +112,7 @@ main:
.HORZ_X: .HORZ_X:
mcall SF_GET_SCREEN_SIZE mcall SF_GET_SCREEN_SIZE
shr eax, 17 shr eax, 17
mov ecx, [win.width_opn] mov ecx, [win.w_opn]
shr ecx, 1 shr ecx, 1
sub eax, ecx sub eax, ecx
mov [win.x_opn], eax mov [win.x_opn], eax
@ -178,8 +122,8 @@ main:
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
.HORZ_HEIGHT: .HORZ_HEIGHT:
mov dword[win.height_hdn], 3 mov dword[win.h_hdn], 3
mov dword[win.height_opn], BUTTON_SIZE mov dword[win.h_opn], BUTTON_SIZE
ret ret
@ -202,8 +146,8 @@ main:
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
.VERT_WIDTH: .VERT_WIDTH:
mov dword[win.width_opn], BUTTON_SIZE mov dword[win.w_opn], BUTTON_SIZE
mov dword[win.width_hdn], 3 mov dword[win.w_hdn], 3
ret ret
@ -227,7 +171,7 @@ main:
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
.VERT_HEIGHT: .VERT_HEIGHT:
cmp [dock_items.fsize], byte 1 cmp [dock_items.fsize], byte 1
je @f je @f
mov eax, BUTTON_SIZE mov eax, BUTTON_SIZE
mov ebx, [dock_items.count] mov ebx, [dock_items.count]
imul eax, ebx imul eax, ebx
@ -237,8 +181,8 @@ main:
mcall SF_GET_SCREEN_SIZE mcall SF_GET_SCREEN_SIZE
and eax, 0xFFFF and eax, 0xFFFF
.set_vh: .set_vh:
mov [win.height_opn], eax mov [win.h_opn], eax
mov [win.height_hdn], eax mov [win.h_hdn], eax
ret ret
@ -248,7 +192,7 @@ main:
and eax, 0xFFFF and eax, 0xFFFF
shr eax, 1 shr eax, 1
mov esi, [win.height_opn] mov esi, [win.h_opn]
shr esi, 1 shr esi, 1
sub eax, esi sub eax, esi
@ -259,29 +203,29 @@ main:
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
.SETDEF: .SETDEF:
mov eax, [win.width_hdn] mov eax, [win.w_hdn]
mov [win.width], eax mov [win.w], eax
mov eax, [win.x_hdn] mov eax, [win.x_hdn]
mov [win.x], eax mov [win.x], eax
mov eax, [win.height_hdn] mov eax, [win.h_hdn]
mov [win.height], eax mov [win.h], eax
mov eax, [win.y_hdn] mov eax, [win.y_hdn]
mov [win.y], eax mov [win.y], eax
cmp byte[dock_items.ashow],1 cmp byte[dock_items.ashow],1
jne .not_ashow jne .not_ashow
mov eax, [win.width_opn] mov eax, [win.w_opn]
mov [win.width], eax mov [win.w], eax
mov eax, [win.x_opn] mov eax, [win.x_opn]
mov [win.x], eax mov [win.x], eax
mov eax, [win.height_opn] mov eax, [win.h_opn]
mov [win.height], eax mov [win.h], eax
mov eax, [win.y_opn] mov eax, [win.y_opn]
mov [win.y], eax mov [win.y], eax
@ -300,7 +244,6 @@ main:
call main_loop call main_loop
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
exit: exit:
stdcall mem.Free, [img_data.rgb_object]
mcall SF_SYSTEM, SSF_TERMINATE_THREAD, [nwin.sid] mcall SF_SYSTEM, SSF_TERMINATE_THREAD, [nwin.sid]
mcall SF_TERMINATE_PROCESS mcall SF_TERMINATE_PROCESS
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
@ -309,13 +252,13 @@ main_loop:
mcall SF_WAIT_EVENT mcall SF_WAIT_EVENT
cmp eax, EV_REDRAW cmp eax, EV_REDRAW
je event_redraw je event_redraw
cmp eax, EV_BUTTON cmp eax, EV_BUTTON
je event_button je event_button
cmp eax, EV_MOUSE cmp eax, EV_MOUSE
je event_mouse je event_mouse
jmp main_loop jmp main_loop
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
@ -325,26 +268,33 @@ event_redraw:
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
DRAW_WINDOW: DRAW_WINDOW:
mcall SF_REDRAW, SSF_BEGIN_DRAW mcall SF_REDRAW, SSF_BEGIN_DRAW
mov esi, [color.bg] push dword [sc.work]
or esi, 0x01000000 mcall SF_STYLE_SETTINGS, SSF_GET_COLORS, sc, sizeof.system_colors
mcall SF_CREATE_WINDOW, <[win.x], [win.width]>, <[win.y], [win.height]>, [color.bg], , [color.frame] pop eax
cmp dword [sc.work], eax
je @f
call LOAD_ICONS
@@:
mov esi, [sc.work]
or esi, 0x01000000
mcall SF_CREATE_WINDOW, <[win.x], [win.w]>, <[win.y], [win.h]>, [sc.work], , [sc.work_dark]
xor edi, edi xor edi, edi
@@: @@:
cmp edi, [dock_items.count] cmp edi, [dock_items.count]
je @f je @f
push edi push edi
mov eax, SF_DEFINE_BUTTON mov eax, SF_DEFINE_BUTTON
mov edx, 0x60000002 mov edx, 0x60000002
mov esi, [color.bg] mov esi, [sc.work]
imul edi, BUTTON_SIZE imul edi, BUTTON_SIZE
add edi, 12 add edi, 12
shl edi, 16 shl edi, 16
add edi, BUTTON_SIZE add edi, BUTTON_SIZE
cmp byte[win.isvert], 1 cmp byte[win.isvert], 1
je .vert_btn je .vert_btn
mcall , edi, <0, BUTTON_SIZE> mcall , edi, <0, BUTTON_SIZE>
jmp .endbtn jmp .endbtn
.vert_btn: .vert_btn:
@ -369,20 +319,20 @@ DRAW_WINDOW:
add ebx, 2 add ebx, 2
cmp byte[win.isvert], 1 cmp byte[win.isvert], 1
je .vert_draw_sep je .vert_draw_sep
mcall , , <4, 36>, [color.frame] mcall , , <4, 36>, [sc.work_dark]
jmp .end_inner_sep jmp .end_inner_sep
.vert_draw_sep: .vert_draw_sep:
sub ebx, 12 shl 16 sub ebx, 12 shl 16
mov ecx, ebx mov ecx, ebx
mcall , <4, 36>, , [color.frame] mcall , <4, 36>, , [sc.work_dark]
.end_inner_sep: .end_inner_sep:
pop ecx pop ecx
pop ebx pop ebx
.end_separator: .end_separator:
cmp byte[win.isvert], 1 cmp byte[win.isvert], 1
je .vert_dig je .vert_dig
mov edx, ebx mov edx, ebx
and edx, 0xFFFF0000 and edx, 0xFFFF0000
add edx, 0x00060006 add edx, 0x00060006
@ -397,10 +347,12 @@ DRAW_WINDOW:
imul ebx, edi, 4 imul ebx, edi, 4
add ebx, dock_items.icon add ebx, dock_items.icon
mov ebx, [ebx] mov ebx, [ebx]
imul ebx, ICON_SIZE_BGR
add ebx, [img_data.rgb_object]
mcall SF_PUT_IMAGE, , <32, 32> push edi
imul ebx, 32*32*4
add ebx, [icons_inactive]
mcall SF_PUT_IMAGE_EXT, , <32, 32>, , 32, 0, 0
pop edi
inc edi inc edi
jmp @b jmp @b
@ -413,12 +365,12 @@ DRAW_WINDOW:
event_button: event_button:
mcall SF_GET_BUTTON mcall SF_GET_BUTTON
;; it must not be possible to close dock ;; it must not be possible to close dock
;cmp ah, 1 ;cmp ah, 1
;je .button_close ;je .button_close
cmp ah, 2 cmp ah, 2
je .button_dock je .button_dock
jmp @f jmp @f
@ -426,7 +378,7 @@ event_button:
; jmp exit ; jmp exit
.button_dock: .button_dock:
mov edi, [win.button_index] mov edi, [win.btn_index]
imul edi, 256 imul edi, 256
mov dword[fi.p00], SSF_START_APP mov dword[fi.p00], SSF_START_APP
@ -460,15 +412,15 @@ event_mouse:
and esi, 0xFFFF and esi, 0xFFFF
cmp edi, 0 cmp edi, 0
jl wnd_hide jl wnd_hide
dec edi dec edi
cmp edi, [win.width] cmp edi, [win.w]
jg wnd_hide jg wnd_hide
cmp esi, 0 cmp esi, 0
jl wnd_hide jl wnd_hide
dec esi dec esi
cmp esi, [win.height] cmp esi, [win.h]
jg wnd_hide jg wnd_hide
; ==== COUNT INDEX ==== ; ==== COUNT INDEX ====
@ -497,38 +449,38 @@ event_mouse:
mov eax, 100 mov eax, 100
.nxtcmp: .nxtcmp:
cmp [win.button_index], eax cmp [win.btn_index], eax
je .nxt2 je .nxt2
push dword[win.button_index] push dword[win.btn_index]
pop dword[win.prev_index] pop dword[win.prev_index]
mov [win.button_index], eax mov [win.btn_index], eax
; ==== DRAW SELECTION ==== ; ==== DRAW SELECTION ====
call DRAW_SELECTION call DRAW_SELECTION
.nxt2: .nxt2:
mov eax, [win.button_index] mov eax, [win.btn_index]
imul eax, BUTTON_SIZE imul eax, BUTTON_SIZE
cmp byte[win.isvert], 1 cmp byte[win.isvert], 1
je .vert_name je .vert_name
add eax, [win.x] add eax, [win.x]
mov [nwin.x], eax mov [nwin.x], eax
mov byte[nwin.change_shape], 1 mov byte[nwin.swap_shape], 1
mcall SF_DRAW_RECT, <0, [win.width]>, <[win.height], 1>, [color.frame] mcall SF_DRAW_RECT, <0, [win.w]>, <[win.h], 1>, [sc.work_dark]
jmp .vert_end jmp .vert_end
.vert_name: .vert_name:
add eax, [win.y] add eax, [win.y]
add eax, 14 add eax, 14
mov [nwin.y], eax mov [nwin.y], eax
mov byte[nwin.change_shape], 1 mov byte[nwin.swap_shape], 1
mcall SF_DRAW_RECT, <[win.width], 1>, <0, [win.height]>, [color.frame] mcall SF_DRAW_RECT, <[win.w], 1>, <0, [win.h]>, [sc.work_dark]
.vert_end: .vert_end:
; ==== OPEN/CLOSE WINDOW ==== ; ==== OPEN/CLOSE WINDOW ====
cmp byte[win.state], 1 cmp byte[win.state], 1
je main_loop je main_loop
mov edx, esp mov edx, esp
add edx, 512 add edx, 512
@ -541,22 +493,14 @@ event_mouse:
mov byte[win.state], 1 mov byte[win.state], 1
mov eax, [win.width_opn] m2m dword [win.x], dword [win.x_opn]
mov [win.width], eax m2m dword [win.y], dword [win.y_opn]
m2m dword [win.w], dword [win.w_opn]
mov eax, [win.x_opn] m2m dword [win.h], dword [win.h_opn]
mov [win.x], eax
mov eax, [win.height_opn]
mov [win.height], eax
mov eax, [win.y_opn]
mov [win.y], eax
cmp byte[dock_items.ashow],1 cmp byte[dock_items.ashow],1
je .change_nothing je .change_nothing
mcall SF_CHANGE_WINDOW, [win.x], [win.y], [win.width], [win.height] mcall SF_CHANGE_WINDOW, [win.x], [win.y], [win.w], [win.h]
.change_nothing: .change_nothing:
call DRAW_WINDOW call DRAW_WINDOW
@ -566,31 +510,24 @@ event_mouse:
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
wnd_hide: wnd_hide:
cmp byte[win.state], 0 cmp byte[win.state], 0
je main_loop je main_loop
mov byte[nwin.close], 1 mov byte[nwin.close], 1
mcall SF_SYSTEM, SSF_FOCUS_WINDOW, [win.psid] mcall SF_SYSTEM, SSF_FOCUS_WINDOW, [win.psid]
mov byte[win.state], 0 mov byte[win.state], 0
mov byte[win.button_index], -1 mov byte[win.btn_index], -1
cmp byte[dock_items.ashow],1 cmp byte[dock_items.ashow],1
je .do_no_hide je .do_no_hide
mov eax, [win.width_hdn] m2m dword [win.x], dword [win.x_hdn]
mov [win.width], eax m2m dword [win.y], dword [win.y_hdn]
m2m dword [win.w], dword [win.w_hdn]
m2m dword [win.h], dword [win.h_hdn]
mov eax, [win.x_hdn] mcall SF_CHANGE_WINDOW, [win.x], [win.y], [win.w], [win.h]
mov [win.x], eax
mov eax, [win.height_hdn]
mov [win.height], eax
mov eax, [win.y_hdn]
mov [win.y], eax
mcall SF_CHANGE_WINDOW, [win.x], [win.y], [win.width], [win.height]
.do_no_hide: .do_no_hide:
call DRAW_WINDOW call DRAW_WINDOW
@ -610,23 +547,22 @@ DRAW_SELECTION:
sub ecx, 0x000C0000 sub ecx, 0x000C0000
@@: @@:
mcall SF_DRAW_RECT, , , [color.bg] mcall SF_DRAW_RECT, , , [sc.work]
mov edx, ebx mov edx, ebx
shr ecx, 16 shr ecx, 16
mov dx, cx mov dx, cx
add edx, 0x00040004 add edx, 0x00040004
mov ebx, [win.prev_index] mov ebx, [win.prev_index]
imul ebx, 4 imul ebx, 4
add ebx, dock_items.icon add ebx, dock_items.icon
mov ebx, [ebx] mov ebx, [ebx]
imul ebx, ICON_SIZE_BGR imul ebx, 32*32*4
add ebx, [img_data.rgb_object] add ebx, [icons_inactive]
mcall SF_PUT_IMAGE_EXT, , <32, 32>, , 32, 0, 0
mcall SF_PUT_IMAGE, , <32, 32> mov ebx, [win.btn_index]
mov ebx, [win.button_index]
imul ebx, BUTTON_SIZE imul ebx, BUTTON_SIZE
add ebx, 14 add ebx, 14
shl ebx, 16 shl ebx, 16
@ -639,52 +575,72 @@ DRAW_SELECTION:
sub ecx, 0x000C0000 sub ecx, 0x000C0000
@@: @@:
mcall SF_DRAW_RECT, , , [color.bt] mcall SF_DRAW_RECT, , , [sc.work_button]
mov edx, ebx mov edx, ebx
shr ecx, 16 shr ecx, 16
mov dx, cx mov dx, cx
add edx, 0x00040004 add edx, 0x00040004
mov ecx, [win.button_index] mov ebx, [win.btn_index]
imul ecx, 4 imul ebx, 4
add ecx, dock_items.icon add ebx, dock_items.icon
mov ecx, [ecx] mov ebx, [ebx]
imul ecx, ICON_SIZE_BGR imul ebx, 32*32*4
add ecx, [img_data.rgb_object] add ebx, [icons_active]
mcall SF_PUT_IMAGE_EXT, , <32, 32>, , 32, 0, 0
ret
;-------------------------------------------------------------------------------
proc icon32cpy uses ecx edx edi esi, dest:dword, src:dword, len:dword, bgcol:dword
mov edi, [dest]
mov esi, [src]
mov ecx, [len]
mov edx, [bgcol]
.loop:
m2m dword [edi], dword [esi]
cmp dword [edi], 0
jne @f
mov dword [edi], edx
@@:
add edi, 4
add esi, 4
sub ecx, 4
cmp ecx, 4
jg .loop
mov ebx, sel_img ret
endp
mov edi, 0 ;-------------------------------------------------------------------------------
LOAD_ICONS:
mov esi, 0 ; esi is a counter of mem_open attempts
@@: @@:
mov al, byte[ecx + 2] ; try to open shr memory, if failed then make 5 attempts more
shl eax, 8 mcall SF_SYS_MISC, SSF_MEM_OPEN,icons_resname ; 0 = SHM_READ
mov al, byte[ecx + 1] cmp eax,0
shl eax, 8 jne @f
mov al, byte[ecx + 0] inc esi
cmp esi,10
or eax, 0x10000000 je exit
cmp eax, [color.bg] mcall SF_SLEEP, 70
jne .notbg jmp @b
mov eax, [color.bt] @@:
.notbg: mov [shr_icons_ptr], eax
mov [shr_icons_len], edx
mov byte[ebx + 0], al
shr eax, 8 mcall SF_SYS_MISC, SSF_MEM_FREE, [icons_active]
mov byte[ebx + 1], al mcall SF_SYS_MISC, SSF_MEM_ALLOC, [shr_icons_len]
shr eax, 8 mov [icons_active], eax
mov byte[ebx + 2], al
mcall SF_SYS_MISC, SSF_MEM_FREE, [icons_inactive]
add ebx, 3 mcall SF_SYS_MISC, SSF_MEM_ALLOC, [shr_icons_len]
add ecx, 3 mov [icons_inactive], eax
add edi, 3 stdcall icon32cpy, [icons_inactive], [shr_icons_ptr], [shr_icons_len], [sc.work]
stdcall icon32cpy, [icons_active], [shr_icons_ptr], [shr_icons_len], [sc.work_button]
cmp edi, 1024 * 3
jne @b mcall SF_SYS_MISC, SSF_MEM_CLOSE,icons_resname
mcall SF_PUT_IMAGE, sel_img, <32, 32>
ret ret
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
proc sections_callback, _file_name, _section_name proc sections_callback, _file_name, _section_name