2013-10-28 21:47:26 +01:00
|
|
|
use32
|
|
|
|
org 0x0
|
|
|
|
;-------------------------------------------------------------------------------
|
2021-12-30 21:54:18 +01:00
|
|
|
db "MENUET01"
|
|
|
|
dd 1, main, __dataend, __memend, __stackend, 0, sys_path
|
2013-10-28 21:47:26 +01:00
|
|
|
;-------------------------------------------------------------------------------
|
|
|
|
include "../../../macros.inc"
|
|
|
|
include "../../../proc32.inc"
|
|
|
|
include "../../../dll.inc"
|
2021-12-30 21:54:18 +01:00
|
|
|
include "../../../KOSfuncs.inc"
|
2021-02-02 23:32:19 +01:00
|
|
|
include "../../../load_lib.mac"
|
2013-11-03 17:32:45 +01:00
|
|
|
;include "../../../debug.inc"
|
2013-10-31 21:04:03 +01:00
|
|
|
|
|
|
|
include "DATA.INC"
|
|
|
|
include "NAME.INC"
|
2013-10-28 21:47:26 +01:00
|
|
|
|
2021-12-30 21:54:18 +01:00
|
|
|
@use_library \
|
|
|
|
mem.Alloc, mem.Free, mem.ReAlloc, dll.Load
|
2013-10-28 21:47:26 +01:00
|
|
|
;================================================================================
|
2021-12-30 21:54:18 +01:00
|
|
|
|
2013-10-31 21:04:03 +01:00
|
|
|
main:
|
2013-10-28 21:47:26 +01:00
|
|
|
; ==== Init ====
|
2021-12-30 21:54:18 +01:00
|
|
|
mcall SF_SYS_MISC, SSF_HEAP_INIT
|
|
|
|
mcall SF_STYLE_SETTINGS, SSF_GET_COLORS, sc, sizeof.system_colors
|
|
|
|
call LOAD_ICONS
|
|
|
|
|
2021-02-02 23:32:19 +01:00
|
|
|
mcall SF_SYSTEM, SSF_GET_ACTIVE_WINDOW
|
2013-10-28 21:47:26 +01:00
|
|
|
mov [win.psid], eax
|
|
|
|
|
2021-02-02 23:32:19 +01:00
|
|
|
mcall SF_SET_EVENTS_MASK, EVM_REDRAW+EVM_BUTTON+EVM_MOUSE ;+EVM_DEKSTOP to update colors on skin change
|
2021-12-30 21:54:18 +01:00
|
|
|
|
2013-10-28 21:47:26 +01:00
|
|
|
; ==== Load libs ====
|
|
|
|
load_libraries load_lib_start, load_lib_end
|
|
|
|
|
|
|
|
; ==== Config LibINI ====
|
2021-12-19 12:48:59 +01:00
|
|
|
invoke ini.get_int, ini_data.file_name, ini_data.settings_name, ini_data.location_name, 2
|
|
|
|
test eax,eax
|
2021-12-30 21:54:18 +01:00
|
|
|
jz exit
|
2013-10-28 21:47:26 +01:00
|
|
|
mov [dock_items.location], eax
|
2013-11-15 18:54:11 +01:00
|
|
|
invoke ini.get_int, ini_data.file_name, ini_data.settings_name, ini_data.fsize_name, 0
|
|
|
|
mov [dock_items.fsize], eax
|
2015-02-26 14:03:17 +01:00
|
|
|
invoke ini.get_int, ini_data.file_name, ini_data.settings_name, ini_data.ashow_name, 0
|
|
|
|
mov [dock_items.ashow], eax
|
2013-10-28 21:47:26 +01:00
|
|
|
|
2013-11-08 19:38:06 +01:00
|
|
|
invoke ini.sections, ini_data.file_name, sections_callback
|
|
|
|
|
2013-10-28 21:47:26 +01:00
|
|
|
; ==== Config window ====
|
|
|
|
mov eax, dword[dock_items.location]
|
|
|
|
and eax, 1b
|
|
|
|
cmp eax, 0
|
2021-12-30 21:54:18 +01:00
|
|
|
je .vert
|
2013-10-28 21:47:26 +01:00
|
|
|
jmp .setshape
|
|
|
|
|
|
|
|
.vert:
|
|
|
|
mov byte[win.isvert], 1
|
|
|
|
|
|
|
|
.setshape:
|
|
|
|
cmp byte[win.isvert], 1
|
2021-12-30 21:54:18 +01:00
|
|
|
je .vert_sp
|
2013-10-28 21:47:26 +01:00
|
|
|
|
|
|
|
.horz_sp:
|
|
|
|
call .HORZ_WIDTH
|
|
|
|
call .HORZ_X
|
|
|
|
call .HORZ_HEIGHT
|
|
|
|
cmp dword[dock_items.location], 1
|
2021-12-30 21:54:18 +01:00
|
|
|
je .settop
|
2013-10-28 21:47:26 +01:00
|
|
|
|
|
|
|
.setbottom:
|
|
|
|
call .HORZ_Y_BOTTOM
|
|
|
|
jmp .SETDEF
|
|
|
|
|
|
|
|
.settop:
|
|
|
|
call .HORZ_Y_TOP
|
|
|
|
jmp .SETDEF
|
|
|
|
|
|
|
|
|
|
|
|
.vert_sp:
|
|
|
|
call .VERT_WIDTH
|
|
|
|
call .VERT_HEIGHT
|
|
|
|
call .VERT_Y
|
|
|
|
cmp dword[dock_items.location], 2
|
2021-12-30 21:54:18 +01:00
|
|
|
je .setleft
|
2013-10-28 21:47:26 +01:00
|
|
|
|
|
|
|
.setright:
|
|
|
|
call .VERT_X_RIGHT
|
|
|
|
jmp .SETDEF
|
|
|
|
|
|
|
|
.setleft:
|
|
|
|
call .VERT_X_LEFT
|
|
|
|
jmp .SETDEF
|
|
|
|
|
2013-11-08 19:38:06 +01:00
|
|
|
;-------------------------------------------------------------------------------
|
2013-10-28 21:47:26 +01:00
|
|
|
.HORZ_WIDTH:
|
2013-11-15 18:54:11 +01:00
|
|
|
cmp [dock_items.fsize], byte 1
|
2021-12-30 21:54:18 +01:00
|
|
|
je @f
|
2013-10-31 21:04:03 +01:00
|
|
|
mov eax, BUTTON_SIZE
|
2013-10-28 21:47:26 +01:00
|
|
|
mov ebx, [dock_items.count]
|
|
|
|
imul eax, ebx
|
2013-10-31 21:04:03 +01:00
|
|
|
add eax, 24
|
2013-10-28 21:47:26 +01:00
|
|
|
dec eax
|
2013-11-15 18:54:11 +01:00
|
|
|
jmp .set_hw
|
|
|
|
@@:
|
2021-02-02 23:32:19 +01:00
|
|
|
mcall SF_GET_SCREEN_SIZE
|
2013-11-15 18:54:11 +01:00
|
|
|
shr eax, 16
|
|
|
|
.set_hw:
|
2021-12-30 21:54:18 +01:00
|
|
|
mov [win.w_opn], eax
|
|
|
|
mov [win.w_hdn], eax
|
2013-10-28 21:47:26 +01:00
|
|
|
|
|
|
|
ret
|
|
|
|
|
2013-11-08 19:38:06 +01:00
|
|
|
;-------------------------------------------------------------------------------
|
2013-10-28 21:47:26 +01:00
|
|
|
.HORZ_X:
|
2021-02-02 23:32:19 +01:00
|
|
|
mcall SF_GET_SCREEN_SIZE
|
2013-11-08 19:38:06 +01:00
|
|
|
shr eax, 17
|
2021-12-30 21:54:18 +01:00
|
|
|
mov ecx, [win.w_opn]
|
2013-11-08 19:38:06 +01:00
|
|
|
shr ecx, 1
|
|
|
|
sub eax, ecx
|
|
|
|
mov [win.x_opn], eax
|
|
|
|
mov [win.x_hdn], eax
|
2013-10-28 21:47:26 +01:00
|
|
|
|
|
|
|
ret
|
|
|
|
|
2013-11-08 19:38:06 +01:00
|
|
|
;-------------------------------------------------------------------------------
|
2013-10-28 21:47:26 +01:00
|
|
|
.HORZ_HEIGHT:
|
2021-12-30 21:54:18 +01:00
|
|
|
mov dword[win.h_hdn], 3
|
|
|
|
mov dword[win.h_opn], BUTTON_SIZE
|
2013-10-28 21:47:26 +01:00
|
|
|
|
|
|
|
ret
|
|
|
|
|
2013-11-08 19:38:06 +01:00
|
|
|
;-------------------------------------------------------------------------------
|
2013-10-28 21:47:26 +01:00
|
|
|
.HORZ_Y_BOTTOM:
|
2021-02-02 23:32:19 +01:00
|
|
|
mcall SF_GET_SCREEN_SIZE
|
2013-10-28 21:47:26 +01:00
|
|
|
and eax, 0xFFFF
|
|
|
|
dec eax
|
|
|
|
mov [win.y_hdn], eax
|
2013-11-03 17:32:45 +01:00
|
|
|
sub eax, 43
|
2013-10-28 21:47:26 +01:00
|
|
|
mov [win.y_opn], eax
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
.HORZ_Y_TOP:
|
|
|
|
mov dword[win.y_opn], 0
|
|
|
|
mov dword[win.y_hdn], 0
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
2013-11-08 19:38:06 +01:00
|
|
|
;-------------------------------------------------------------------------------
|
2013-10-28 21:47:26 +01:00
|
|
|
.VERT_WIDTH:
|
2021-12-30 21:54:18 +01:00
|
|
|
mov dword[win.w_opn], BUTTON_SIZE
|
|
|
|
mov dword[win.w_hdn], 3
|
2013-10-28 21:47:26 +01:00
|
|
|
|
|
|
|
ret
|
|
|
|
|
2013-11-08 19:38:06 +01:00
|
|
|
;-------------------------------------------------------------------------------
|
2013-10-28 21:47:26 +01:00
|
|
|
.VERT_X_LEFT:
|
|
|
|
mov dword[win.x_opn], 0
|
|
|
|
mov dword[win.x_hdn], 0
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
.VERT_X_RIGHT:
|
2021-02-02 23:32:19 +01:00
|
|
|
mcall SF_GET_SCREEN_SIZE
|
2013-10-28 21:47:26 +01:00
|
|
|
and eax, 0xFFFF0000
|
|
|
|
shr eax, 16
|
|
|
|
mov [win.x_hdn], eax
|
2013-10-31 21:04:03 +01:00
|
|
|
sub eax, BUTTON_SIZE
|
2013-10-28 21:47:26 +01:00
|
|
|
mov [win.x_opn], eax
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
2013-11-08 19:38:06 +01:00
|
|
|
;-------------------------------------------------------------------------------
|
2013-10-28 21:47:26 +01:00
|
|
|
.VERT_HEIGHT:
|
2013-11-15 18:54:11 +01:00
|
|
|
cmp [dock_items.fsize], byte 1
|
2021-12-30 21:54:18 +01:00
|
|
|
je @f
|
2013-10-31 21:04:03 +01:00
|
|
|
mov eax, BUTTON_SIZE
|
2013-10-28 21:47:26 +01:00
|
|
|
mov ebx, [dock_items.count]
|
|
|
|
imul eax, ebx
|
|
|
|
dec eax
|
2013-11-15 18:54:11 +01:00
|
|
|
jmp .set_vh
|
|
|
|
@@:
|
2021-02-02 23:32:19 +01:00
|
|
|
mcall SF_GET_SCREEN_SIZE
|
2013-11-15 18:54:11 +01:00
|
|
|
and eax, 0xFFFF
|
|
|
|
.set_vh:
|
2021-12-30 21:54:18 +01:00
|
|
|
mov [win.h_opn], eax
|
|
|
|
mov [win.h_hdn], eax
|
2013-10-28 21:47:26 +01:00
|
|
|
|
|
|
|
ret
|
|
|
|
|
2013-11-08 19:38:06 +01:00
|
|
|
;-------------------------------------------------------------------------------
|
2013-10-28 21:47:26 +01:00
|
|
|
.VERT_Y:
|
2021-02-02 23:32:19 +01:00
|
|
|
mcall SF_GET_SCREEN_SIZE
|
2013-10-28 21:47:26 +01:00
|
|
|
and eax, 0xFFFF
|
2013-11-08 19:38:06 +01:00
|
|
|
shr eax, 1
|
2013-10-28 21:47:26 +01:00
|
|
|
|
2021-12-30 21:54:18 +01:00
|
|
|
mov esi, [win.h_opn]
|
2013-11-08 19:38:06 +01:00
|
|
|
shr esi, 1
|
|
|
|
sub eax, esi
|
2013-10-28 21:47:26 +01:00
|
|
|
|
2013-11-08 19:38:06 +01:00
|
|
|
mov [win.y_hdn], eax
|
|
|
|
mov [win.y_opn], eax
|
2013-10-28 21:47:26 +01:00
|
|
|
|
|
|
|
ret
|
|
|
|
|
2013-11-08 19:38:06 +01:00
|
|
|
;-------------------------------------------------------------------------------
|
2013-10-28 21:47:26 +01:00
|
|
|
.SETDEF:
|
2021-12-30 21:54:18 +01:00
|
|
|
mov eax, [win.w_hdn]
|
|
|
|
mov [win.w], eax
|
2013-10-28 21:47:26 +01:00
|
|
|
|
|
|
|
mov eax, [win.x_hdn]
|
|
|
|
mov [win.x], eax
|
|
|
|
|
2021-12-30 21:54:18 +01:00
|
|
|
mov eax, [win.h_hdn]
|
|
|
|
mov [win.h], eax
|
2013-10-28 21:47:26 +01:00
|
|
|
|
|
|
|
mov eax, [win.y_hdn]
|
|
|
|
mov [win.y], eax
|
2021-12-30 21:54:18 +01:00
|
|
|
|
2015-02-26 14:03:17 +01:00
|
|
|
cmp byte[dock_items.ashow],1
|
|
|
|
jne .not_ashow
|
|
|
|
|
2021-12-30 21:54:18 +01:00
|
|
|
mov eax, [win.w_opn]
|
|
|
|
mov [win.w], eax
|
2015-02-26 14:03:17 +01:00
|
|
|
|
|
|
|
mov eax, [win.x_opn]
|
|
|
|
mov [win.x], eax
|
|
|
|
|
2021-12-30 21:54:18 +01:00
|
|
|
mov eax, [win.h_opn]
|
|
|
|
mov [win.h], eax
|
2015-02-26 14:03:17 +01:00
|
|
|
|
|
|
|
mov eax, [win.y_opn]
|
|
|
|
mov [win.y], eax
|
|
|
|
|
|
|
|
.not_ashow:
|
|
|
|
|
2013-10-28 21:47:26 +01:00
|
|
|
|
2013-11-08 19:38:06 +01:00
|
|
|
;-------------------------------------------------------------------------------
|
2013-10-28 21:47:26 +01:00
|
|
|
; ==== START ====
|
2021-02-02 23:32:19 +01:00
|
|
|
mcall SF_THREAD_INFO, win.procinfo, -1
|
2013-10-28 21:47:26 +01:00
|
|
|
mov ecx, [win.procinfo + 30]
|
2021-02-02 23:32:19 +01:00
|
|
|
mcall SF_SYSTEM, SSF_GET_THREAD_SLOT
|
2013-10-28 21:47:26 +01:00
|
|
|
and eax, 0xFFFF
|
|
|
|
mov [win.sid], eax
|
|
|
|
|
|
|
|
call main_loop
|
2013-10-31 21:04:03 +01:00
|
|
|
;-------------------------------------------------------------------------------
|
2013-10-28 21:47:26 +01:00
|
|
|
exit:
|
2021-02-02 23:32:19 +01:00
|
|
|
mcall SF_SYSTEM, SSF_TERMINATE_THREAD, [nwin.sid]
|
|
|
|
mcall SF_TERMINATE_PROCESS
|
2013-10-28 21:47:26 +01:00
|
|
|
;-------------------------------------------------------------------------------
|
2022-09-11 01:18:50 +02:00
|
|
|
error_exit:
|
|
|
|
push .notify
|
|
|
|
dec esp
|
|
|
|
push 0
|
|
|
|
push 0
|
|
|
|
push .error_message
|
|
|
|
push 0
|
|
|
|
push SSF_START_APP
|
|
|
|
|
|
|
|
mcall SF_FILE, esp
|
|
|
|
add esp, 6*4 + 1
|
|
|
|
mcall SF_SYSTEM, SSF_TERMINATE_THREAD, [nwin.sid]
|
|
|
|
mcall SF_TERMINATE_PROCESS
|
|
|
|
.error_message:
|
|
|
|
db '"@DOCKY\nError load @RESHARE" -tdE',0
|
|
|
|
.notify:
|
|
|
|
db '/sys/@notify',0
|
|
|
|
;-------------------------------------------------------------------------------
|
2021-02-02 23:32:19 +01:00
|
|
|
align 4
|
2013-11-08 19:38:06 +01:00
|
|
|
main_loop:
|
2021-02-02 23:32:19 +01:00
|
|
|
mcall SF_WAIT_EVENT
|
2013-10-28 21:47:26 +01:00
|
|
|
|
|
|
|
cmp eax, EV_REDRAW
|
2021-12-30 21:54:18 +01:00
|
|
|
je event_redraw
|
2013-10-28 21:47:26 +01:00
|
|
|
|
|
|
|
cmp eax, EV_BUTTON
|
2021-12-30 21:54:18 +01:00
|
|
|
je event_button
|
2013-10-28 21:47:26 +01:00
|
|
|
|
|
|
|
cmp eax, EV_MOUSE
|
2021-12-30 21:54:18 +01:00
|
|
|
je event_mouse
|
2013-10-28 21:47:26 +01:00
|
|
|
|
|
|
|
jmp main_loop
|
|
|
|
;-------------------------------------------------------------------------------
|
2013-10-31 21:04:03 +01:00
|
|
|
event_redraw:
|
2013-11-09 19:13:05 +01:00
|
|
|
call DRAW_WINDOW
|
|
|
|
jmp main_loop
|
|
|
|
;-------------------------------------------------------------------------------
|
|
|
|
DRAW_WINDOW:
|
2021-02-02 23:32:19 +01:00
|
|
|
mcall SF_REDRAW, SSF_BEGIN_DRAW
|
2021-12-30 21:54:18 +01:00
|
|
|
|
|
|
|
push dword [sc.work]
|
|
|
|
mcall SF_STYLE_SETTINGS, SSF_GET_COLORS, sc, sizeof.system_colors
|
|
|
|
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]
|
2013-10-29 20:18:52 +01:00
|
|
|
|
2021-02-02 23:32:19 +01:00
|
|
|
xor edi, edi
|
2013-10-28 21:47:26 +01:00
|
|
|
@@:
|
|
|
|
cmp edi, [dock_items.count]
|
2021-12-30 21:54:18 +01:00
|
|
|
je @f
|
2013-10-28 21:47:26 +01:00
|
|
|
|
|
|
|
push edi
|
2021-02-02 23:32:19 +01:00
|
|
|
mov eax, SF_DEFINE_BUTTON
|
2013-10-28 23:17:24 +01:00
|
|
|
mov edx, 0x60000002
|
2021-12-30 21:54:18 +01:00
|
|
|
mov esi, [sc.work]
|
2013-10-31 21:04:03 +01:00
|
|
|
imul edi, BUTTON_SIZE
|
|
|
|
add edi, 12
|
2013-10-28 23:17:24 +01:00
|
|
|
shl edi, 16
|
2013-10-31 21:04:03 +01:00
|
|
|
add edi, BUTTON_SIZE
|
2013-10-28 21:47:26 +01:00
|
|
|
cmp byte[win.isvert], 1
|
2021-12-30 21:54:18 +01:00
|
|
|
je .vert_btn
|
2013-10-31 21:04:03 +01:00
|
|
|
mcall , edi, <0, BUTTON_SIZE>
|
2013-10-28 21:47:26 +01:00
|
|
|
jmp .endbtn
|
|
|
|
.vert_btn:
|
2013-11-03 17:32:45 +01:00
|
|
|
sub edi, 12 shl 16
|
2013-10-31 21:04:03 +01:00
|
|
|
mcall , <0, BUTTON_SIZE>, edi
|
2013-10-28 21:47:26 +01:00
|
|
|
.endbtn:
|
|
|
|
pop edi
|
|
|
|
|
|
|
|
cmp byte[dock_items.separator + edi], 1
|
2013-10-29 20:18:52 +01:00
|
|
|
jne .end_separator
|
2013-10-28 21:47:26 +01:00
|
|
|
|
|
|
|
.draw_separator:
|
|
|
|
push ebx
|
|
|
|
push ecx
|
2013-10-31 21:04:03 +01:00
|
|
|
|
2021-02-02 23:32:19 +01:00
|
|
|
mov eax, SF_DRAW_RECT
|
2013-10-28 21:47:26 +01:00
|
|
|
mov ebx, edi
|
2013-10-31 21:04:03 +01:00
|
|
|
imul ebx, BUTTON_SIZE
|
|
|
|
add ebx, BUTTON_SIZE
|
2021-02-02 23:32:19 +01:00
|
|
|
add ebx, 12-1
|
2013-10-28 21:47:26 +01:00
|
|
|
shl ebx, 16
|
2013-11-09 19:13:05 +01:00
|
|
|
add ebx, 2
|
2013-10-31 21:04:03 +01:00
|
|
|
|
2013-10-28 21:47:26 +01:00
|
|
|
cmp byte[win.isvert], 1
|
2021-12-30 21:54:18 +01:00
|
|
|
je .vert_draw_sep
|
|
|
|
mcall , , <4, 36>, [sc.work_dark]
|
2013-10-28 21:47:26 +01:00
|
|
|
jmp .end_inner_sep
|
|
|
|
.vert_draw_sep:
|
2013-11-03 17:32:45 +01:00
|
|
|
sub ebx, 12 shl 16
|
2013-10-28 21:47:26 +01:00
|
|
|
mov ecx, ebx
|
2021-12-30 21:54:18 +01:00
|
|
|
mcall , <4, 36>, , [sc.work_dark]
|
2013-10-28 21:47:26 +01:00
|
|
|
.end_inner_sep:
|
|
|
|
pop ecx
|
|
|
|
pop ebx
|
|
|
|
.end_separator:
|
|
|
|
|
|
|
|
cmp byte[win.isvert], 1
|
2021-12-30 21:54:18 +01:00
|
|
|
je .vert_dig
|
2013-10-28 21:47:26 +01:00
|
|
|
mov edx, ebx
|
|
|
|
and edx, 0xFFFF0000
|
2013-10-31 21:04:03 +01:00
|
|
|
add edx, 0x00060006
|
2013-10-28 21:47:26 +01:00
|
|
|
jmp .digend
|
|
|
|
.vert_dig:
|
|
|
|
mov edx, ecx
|
|
|
|
and edx, 0xFFFF0000
|
|
|
|
shr edx, 16
|
2013-10-31 21:04:03 +01:00
|
|
|
add edx, 0x00060006
|
2013-10-28 21:47:26 +01:00
|
|
|
.digend:
|
|
|
|
|
|
|
|
imul ebx, edi, 4
|
|
|
|
add ebx, dock_items.icon
|
|
|
|
mov ebx, [ebx]
|
|
|
|
|
2021-12-30 21:54:18 +01:00
|
|
|
push edi
|
|
|
|
imul ebx, 32*32*4
|
|
|
|
add ebx, [icons_inactive]
|
|
|
|
mcall SF_PUT_IMAGE_EXT, , <32, 32>, , 32, 0, 0
|
|
|
|
pop edi
|
2013-10-28 21:47:26 +01:00
|
|
|
|
|
|
|
inc edi
|
|
|
|
jmp @b
|
|
|
|
@@:
|
|
|
|
|
2021-02-02 23:32:19 +01:00
|
|
|
mcall SF_REDRAW, SSF_END_DRAW
|
2013-10-28 21:47:26 +01:00
|
|
|
|
2013-11-09 19:13:05 +01:00
|
|
|
ret
|
2013-10-28 21:47:26 +01:00
|
|
|
;-------------------------------------------------------------------------------
|
2013-10-31 21:04:03 +01:00
|
|
|
event_button:
|
2021-02-02 23:32:19 +01:00
|
|
|
mcall SF_GET_BUTTON
|
2013-10-28 21:47:26 +01:00
|
|
|
|
2021-12-30 21:54:18 +01:00
|
|
|
;; it must not be possible to close dock
|
2018-10-01 17:18:07 +02:00
|
|
|
;cmp ah, 1
|
2021-12-30 21:54:18 +01:00
|
|
|
;je .button_close
|
2013-10-28 21:47:26 +01:00
|
|
|
|
|
|
|
cmp ah, 2
|
2021-12-30 21:54:18 +01:00
|
|
|
je .button_dock
|
2013-10-28 21:47:26 +01:00
|
|
|
|
|
|
|
jmp @f
|
|
|
|
|
2018-10-01 17:18:07 +02:00
|
|
|
;.button_close:
|
|
|
|
; jmp exit
|
2013-10-28 21:47:26 +01:00
|
|
|
|
|
|
|
.button_dock:
|
2021-12-30 21:54:18 +01:00
|
|
|
mov edi, [win.btn_index]
|
2013-10-28 21:47:26 +01:00
|
|
|
imul edi, 256
|
|
|
|
|
2021-02-02 23:32:19 +01:00
|
|
|
mov dword[fi.p00], SSF_START_APP
|
2013-10-31 21:04:03 +01:00
|
|
|
|
2013-10-28 21:47:26 +01:00
|
|
|
mov esi, edi
|
|
|
|
add esi, dock_items.path
|
2013-10-31 21:04:03 +01:00
|
|
|
mov dword[fi.p21], esi
|
2013-10-28 21:47:26 +01:00
|
|
|
|
|
|
|
mov esi, edi
|
|
|
|
add esi, dock_items.param
|
2013-10-31 21:04:03 +01:00
|
|
|
mov dword[fi.p08], esi
|
2013-10-28 21:47:26 +01:00
|
|
|
|
2021-02-02 23:32:19 +01:00
|
|
|
mcall SF_FILE, fi
|
2013-10-28 21:47:26 +01:00
|
|
|
|
2013-10-29 20:18:52 +01:00
|
|
|
mov ecx, eax
|
2021-02-02 23:32:19 +01:00
|
|
|
mcall SF_SYSTEM, SSF_GET_THREAD_SLOT
|
2013-10-29 20:18:52 +01:00
|
|
|
and eax, 0xFFFF
|
|
|
|
mov [win.psid], eax
|
|
|
|
|
2013-10-31 21:04:03 +01:00
|
|
|
jmp wnd_hide
|
|
|
|
|
2013-10-28 21:47:26 +01:00
|
|
|
@@:
|
|
|
|
jmp main_loop
|
|
|
|
;-------------------------------------------------------------------------------
|
2013-10-31 21:04:03 +01:00
|
|
|
event_mouse:
|
2013-11-09 19:13:05 +01:00
|
|
|
; ==== IS MOUSE INNER ====
|
2021-02-02 23:32:19 +01:00
|
|
|
mcall SF_MOUSE_GET, SSF_WINDOW_POSITION
|
2013-10-28 21:47:26 +01:00
|
|
|
mov edi, eax
|
|
|
|
mov esi, eax
|
|
|
|
shr edi, 16
|
|
|
|
and esi, 0xFFFF
|
|
|
|
|
|
|
|
cmp edi, 0
|
2021-12-30 21:54:18 +01:00
|
|
|
jl wnd_hide
|
2013-10-28 21:47:26 +01:00
|
|
|
dec edi
|
2021-12-30 21:54:18 +01:00
|
|
|
cmp edi, [win.w]
|
|
|
|
jg wnd_hide
|
2013-10-28 21:47:26 +01:00
|
|
|
cmp esi, 0
|
2021-12-30 21:54:18 +01:00
|
|
|
jl wnd_hide
|
2013-10-28 21:47:26 +01:00
|
|
|
dec esi
|
2021-12-30 21:54:18 +01:00
|
|
|
cmp esi, [win.h]
|
|
|
|
jg wnd_hide
|
2013-10-28 21:47:26 +01:00
|
|
|
|
2013-11-09 19:13:05 +01:00
|
|
|
; ==== COUNT INDEX ====
|
|
|
|
|
2013-10-28 21:47:26 +01:00
|
|
|
mov eax, [dock_items.location]
|
|
|
|
and eax, 1b
|
|
|
|
cmp eax, 1
|
|
|
|
jne .vert
|
|
|
|
mov eax, edi
|
|
|
|
jmp .nxt
|
|
|
|
|
|
|
|
.vert:
|
|
|
|
mov eax, esi
|
2013-11-03 17:32:45 +01:00
|
|
|
add eax, 12
|
2013-10-28 21:47:26 +01:00
|
|
|
|
|
|
|
.nxt:
|
2013-10-31 21:04:03 +01:00
|
|
|
sub eax, 12
|
2013-10-28 21:47:26 +01:00
|
|
|
mov edx, 0
|
2013-10-31 21:04:03 +01:00
|
|
|
mov ebx, BUTTON_SIZE
|
2013-10-28 21:47:26 +01:00
|
|
|
div ebx
|
|
|
|
|
|
|
|
cmp eax, [dock_items.count]
|
|
|
|
jge .set0
|
|
|
|
jmp .nxtcmp
|
|
|
|
|
|
|
|
.set0:
|
|
|
|
mov eax, 100
|
|
|
|
|
|
|
|
.nxtcmp:
|
2021-12-30 21:54:18 +01:00
|
|
|
cmp [win.btn_index], eax
|
|
|
|
je .nxt2
|
2013-10-28 21:47:26 +01:00
|
|
|
|
2021-12-30 21:54:18 +01:00
|
|
|
push dword[win.btn_index]
|
2013-11-09 19:13:05 +01:00
|
|
|
pop dword[win.prev_index]
|
|
|
|
|
2021-12-30 21:54:18 +01:00
|
|
|
mov [win.btn_index], eax
|
2013-10-28 21:47:26 +01:00
|
|
|
|
2013-11-09 19:13:05 +01:00
|
|
|
; ==== DRAW SELECTION ====
|
|
|
|
call DRAW_SELECTION
|
|
|
|
|
2013-10-28 21:47:26 +01:00
|
|
|
.nxt2:
|
2021-12-30 21:54:18 +01:00
|
|
|
mov eax, [win.btn_index]
|
2013-10-31 21:04:03 +01:00
|
|
|
imul eax, BUTTON_SIZE
|
2013-10-28 21:47:26 +01:00
|
|
|
cmp byte[win.isvert], 1
|
2021-12-30 21:54:18 +01:00
|
|
|
je .vert_name
|
2013-10-28 21:47:26 +01:00
|
|
|
add eax, [win.x]
|
|
|
|
mov [nwin.x], eax
|
2021-12-30 21:54:18 +01:00
|
|
|
mov byte[nwin.swap_shape], 1
|
|
|
|
mcall SF_DRAW_RECT, <0, [win.w]>, <[win.h], 1>, [sc.work_dark]
|
2013-10-28 21:47:26 +01:00
|
|
|
jmp .vert_end
|
|
|
|
.vert_name:
|
|
|
|
add eax, [win.y]
|
2013-11-03 17:32:45 +01:00
|
|
|
add eax, 14
|
2013-10-28 21:47:26 +01:00
|
|
|
mov [nwin.y], eax
|
2021-12-30 21:54:18 +01:00
|
|
|
mov byte[nwin.swap_shape], 1
|
|
|
|
mcall SF_DRAW_RECT, <[win.w], 1>, <0, [win.h]>, [sc.work_dark]
|
2013-11-03 17:32:45 +01:00
|
|
|
.vert_end:
|
2013-10-28 21:47:26 +01:00
|
|
|
|
2013-11-09 19:13:05 +01:00
|
|
|
; ==== OPEN/CLOSE WINDOW ====
|
2013-10-28 21:47:26 +01:00
|
|
|
cmp byte[win.state], 1
|
2021-12-30 21:54:18 +01:00
|
|
|
je main_loop
|
2013-10-28 21:47:26 +01:00
|
|
|
|
|
|
|
mov edx, esp
|
|
|
|
add edx, 512
|
2021-02-02 23:32:19 +01:00
|
|
|
mcall SF_CREATE_THREAD, 1, n_main
|
2013-10-28 23:17:24 +01:00
|
|
|
|
2021-02-02 23:32:19 +01:00
|
|
|
mcall SF_SYSTEM, SSF_GET_ACTIVE_WINDOW
|
2013-10-28 21:47:26 +01:00
|
|
|
mov [win.psid], eax
|
|
|
|
|
2021-02-02 23:32:19 +01:00
|
|
|
mcall SF_SYSTEM, SSF_FOCUS_WINDOW, [win.sid]
|
2013-10-28 21:47:26 +01:00
|
|
|
|
|
|
|
mov byte[win.state], 1
|
|
|
|
|
2021-12-30 21:54:18 +01:00
|
|
|
m2m dword [win.x], dword [win.x_opn]
|
|
|
|
m2m dword [win.y], dword [win.y_opn]
|
|
|
|
m2m dword [win.w], dword [win.w_opn]
|
|
|
|
m2m dword [win.h], dword [win.h_opn]
|
2015-02-26 14:03:17 +01:00
|
|
|
|
|
|
|
cmp byte[dock_items.ashow],1
|
2021-12-30 21:54:18 +01:00
|
|
|
je .change_nothing
|
|
|
|
mcall SF_CHANGE_WINDOW, [win.x], [win.y], [win.w], [win.h]
|
2013-10-28 21:47:26 +01:00
|
|
|
|
2015-02-26 14:03:17 +01:00
|
|
|
.change_nothing:
|
2013-11-09 19:13:05 +01:00
|
|
|
call DRAW_WINDOW
|
|
|
|
call DRAW_SELECTION
|
|
|
|
jmp main_loop
|
2013-10-28 21:47:26 +01:00
|
|
|
|
2013-10-31 21:04:03 +01:00
|
|
|
;-------------------------------------------------------------------------------
|
|
|
|
wnd_hide:
|
2013-10-28 21:47:26 +01:00
|
|
|
cmp byte[win.state], 0
|
2021-12-30 21:54:18 +01:00
|
|
|
je main_loop
|
2013-10-28 21:47:26 +01:00
|
|
|
|
|
|
|
mov byte[nwin.close], 1
|
|
|
|
|
2021-02-02 23:32:19 +01:00
|
|
|
mcall SF_SYSTEM, SSF_FOCUS_WINDOW, [win.psid]
|
2013-10-28 21:47:26 +01:00
|
|
|
|
|
|
|
mov byte[win.state], 0
|
2021-12-30 21:54:18 +01:00
|
|
|
mov byte[win.btn_index], -1
|
2013-10-28 21:47:26 +01:00
|
|
|
|
2015-02-26 14:03:17 +01:00
|
|
|
cmp byte[dock_items.ashow],1
|
2021-12-30 21:54:18 +01:00
|
|
|
je .do_no_hide
|
2013-10-28 21:47:26 +01:00
|
|
|
|
2021-12-30 21:54:18 +01:00
|
|
|
m2m dword [win.x], dword [win.x_hdn]
|
|
|
|
m2m dword [win.y], dword [win.y_hdn]
|
|
|
|
m2m dword [win.w], dword [win.w_hdn]
|
|
|
|
m2m dword [win.h], dword [win.h_hdn]
|
2013-10-28 21:47:26 +01:00
|
|
|
|
2021-12-30 21:54:18 +01:00
|
|
|
mcall SF_CHANGE_WINDOW, [win.x], [win.y], [win.w], [win.h]
|
2013-10-28 21:47:26 +01:00
|
|
|
|
2015-02-26 14:03:17 +01:00
|
|
|
.do_no_hide:
|
2013-11-09 19:13:05 +01:00
|
|
|
call DRAW_WINDOW
|
|
|
|
jmp main_loop
|
|
|
|
;-------------------------------------------------------------------------------
|
|
|
|
DRAW_SELECTION:
|
|
|
|
mov ebx, [win.prev_index]
|
|
|
|
imul ebx, BUTTON_SIZE
|
|
|
|
add ebx, 14
|
|
|
|
shl ebx, 16
|
|
|
|
add ebx, 40
|
|
|
|
mov ecx, 0x00020028
|
|
|
|
|
|
|
|
cmp byte[win.isvert], 1
|
|
|
|
jne @f
|
|
|
|
xchg ebx, ecx
|
|
|
|
sub ecx, 0x000C0000
|
|
|
|
@@:
|
|
|
|
|
2021-12-30 21:54:18 +01:00
|
|
|
mcall SF_DRAW_RECT, , , [sc.work]
|
2013-11-09 19:13:05 +01:00
|
|
|
|
|
|
|
mov edx, ebx
|
|
|
|
shr ecx, 16
|
2021-12-30 21:54:18 +01:00
|
|
|
mov dx, cx
|
2013-11-09 19:13:05 +01:00
|
|
|
add edx, 0x00040004
|
|
|
|
|
|
|
|
mov ebx, [win.prev_index]
|
|
|
|
imul ebx, 4
|
|
|
|
add ebx, dock_items.icon
|
|
|
|
mov ebx, [ebx]
|
2021-12-30 21:54:18 +01:00
|
|
|
imul ebx, 32*32*4
|
|
|
|
add ebx, [icons_inactive]
|
|
|
|
mcall SF_PUT_IMAGE_EXT, , <32, 32>, , 32, 0, 0
|
2013-11-09 19:13:05 +01:00
|
|
|
|
2021-12-30 21:54:18 +01:00
|
|
|
mov ebx, [win.btn_index]
|
2013-11-09 19:13:05 +01:00
|
|
|
imul ebx, BUTTON_SIZE
|
|
|
|
add ebx, 14
|
|
|
|
shl ebx, 16
|
|
|
|
add ebx, 40
|
|
|
|
mov ecx, 0x00020028
|
|
|
|
|
|
|
|
cmp byte[win.isvert], 1
|
|
|
|
jne @f
|
|
|
|
xchg ebx, ecx
|
|
|
|
sub ecx, 0x000C0000
|
|
|
|
@@:
|
|
|
|
|
2021-12-30 21:54:18 +01:00
|
|
|
mcall SF_DRAW_RECT, , , [sc.work_button]
|
2013-11-09 19:13:05 +01:00
|
|
|
|
|
|
|
mov edx, ebx
|
|
|
|
shr ecx, 16
|
|
|
|
mov dx, cx
|
|
|
|
add edx, 0x00040004
|
|
|
|
|
2021-12-30 21:54:18 +01:00
|
|
|
mov ebx, [win.btn_index]
|
|
|
|
imul ebx, 4
|
|
|
|
add ebx, dock_items.icon
|
|
|
|
mov ebx, [ebx]
|
|
|
|
imul ebx, 32*32*4
|
|
|
|
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
|
|
|
|
|
|
|
|
ret
|
|
|
|
endp
|
|
|
|
;-------------------------------------------------------------------------------
|
|
|
|
LOAD_ICONS:
|
|
|
|
mov esi, 0 ; esi is a counter of mem_open attempts
|
2013-11-09 19:13:05 +01:00
|
|
|
@@:
|
2021-12-30 21:54:18 +01:00
|
|
|
; try to open shr memory, if failed then make 5 attempts more
|
|
|
|
mcall SF_SYS_MISC, SSF_MEM_OPEN,icons_resname ; 0 = SHM_READ
|
2022-09-11 01:18:50 +02:00
|
|
|
cmp edx, 5
|
|
|
|
jz error_exit
|
|
|
|
|
2021-12-30 21:54:18 +01:00
|
|
|
cmp eax,0
|
|
|
|
jne @f
|
|
|
|
inc esi
|
|
|
|
cmp esi,10
|
|
|
|
je exit
|
|
|
|
mcall SF_SLEEP, 70
|
|
|
|
jmp @b
|
|
|
|
@@:
|
|
|
|
mov [shr_icons_ptr], eax
|
|
|
|
mov [shr_icons_len], edx
|
|
|
|
|
|
|
|
mcall SF_SYS_MISC, SSF_MEM_FREE, [icons_active]
|
|
|
|
mcall SF_SYS_MISC, SSF_MEM_ALLOC, [shr_icons_len]
|
|
|
|
mov [icons_active], eax
|
|
|
|
|
|
|
|
mcall SF_SYS_MISC, SSF_MEM_FREE, [icons_inactive]
|
|
|
|
mcall SF_SYS_MISC, SSF_MEM_ALLOC, [shr_icons_len]
|
|
|
|
mov [icons_inactive], eax
|
|
|
|
|
|
|
|
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]
|
|
|
|
|
|
|
|
mcall SF_SYS_MISC, SSF_MEM_CLOSE,icons_resname
|
|
|
|
|
2013-11-09 19:13:05 +01:00
|
|
|
ret
|
2013-10-28 21:47:26 +01:00
|
|
|
;-------------------------------------------------------------------------------
|
|
|
|
proc sections_callback, _file_name, _section_name
|
|
|
|
mov eax, [_section_name]
|
|
|
|
cmp byte[eax], '@'
|
|
|
|
jne @f
|
|
|
|
|
|
|
|
dec dword[dock_items.count]
|
|
|
|
jmp .endproc
|
|
|
|
|
|
|
|
@@:
|
|
|
|
; ==== GET NAME ====
|
|
|
|
mov ebx, [dock_items.count]
|
|
|
|
imul ebx, 16
|
|
|
|
add ebx, dock_items.name
|
|
|
|
|
|
|
|
mov eax, [_section_name]
|
|
|
|
|
|
|
|
mov edi, 0
|
|
|
|
@@:
|
|
|
|
mov cl, byte[eax]
|
|
|
|
mov byte[ebx + edi], cl
|
|
|
|
|
|
|
|
inc eax
|
|
|
|
inc edi
|
|
|
|
cmp edi, 10
|
|
|
|
jne @b
|
|
|
|
|
|
|
|
; ==== GET PATH ====
|
|
|
|
mov ebx, [dock_items.count]
|
|
|
|
imul ebx, 256
|
|
|
|
add ebx, dock_items.path
|
|
|
|
|
|
|
|
invoke ini.get_str, [_file_name], [_section_name], ini_data.path_name, ebx, 256, 0
|
|
|
|
|
|
|
|
; === GET PARAM ===
|
|
|
|
mov ebx, [dock_items.count]
|
|
|
|
imul ebx, 256
|
|
|
|
add ebx, dock_items.param
|
|
|
|
|
|
|
|
invoke ini.get_str, [_file_name], [_section_name], ini_data.param_name, ebx, 256, 0
|
|
|
|
|
|
|
|
; ==== GET ICON ====
|
|
|
|
invoke ini.get_int, [_file_name], [_section_name], ini_data.icon_name, 0
|
|
|
|
|
|
|
|
mov ebx, [dock_items.count]
|
|
|
|
imul ebx, 4
|
|
|
|
mov [dock_items.icon + ebx], eax
|
|
|
|
|
|
|
|
; ==== GET SEPARATOR ====
|
|
|
|
invoke ini.get_int, [_file_name], [_section_name], ini_data.separator_name, 0
|
|
|
|
|
|
|
|
mov ebx, [dock_items.count]
|
|
|
|
mov byte[dock_items.separator + ebx], al
|
|
|
|
|
|
|
|
; ====== END =======
|
|
|
|
.endproc:
|
|
|
|
mov eax, 1
|
|
|
|
inc dword[dock_items.count]
|
|
|
|
ret
|
|
|
|
endp
|
|
|
|
;-------------------------------------------------------------------------------
|
2013-10-31 21:04:03 +01:00
|
|
|
include "MEMORY.INC"
|