2013-10-28 21:47:26 +01:00
|
|
|
use32
|
|
|
|
org 0x0
|
|
|
|
;-------------------------------------------------------------------------------
|
|
|
|
db "MENUET01"
|
|
|
|
dd 1, main, __dataend, __memend, __stackend, 0, sys_path
|
|
|
|
;-------------------------------------------------------------------------------
|
|
|
|
include "../../../macros.inc"
|
|
|
|
include "../../../proc32.inc"
|
|
|
|
include "../../../dll.inc"
|
2021-02-02 23:32:19 +01:00
|
|
|
include "../../../KOSfuncs.inc"
|
|
|
|
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-02-02 23:32:19 +01:00
|
|
|
@use_library \
|
2013-10-28 21:47:26 +01:00
|
|
|
mem.Alloc, \
|
|
|
|
mem.Free, \
|
|
|
|
mem.ReAlloc, \
|
|
|
|
dll.Load
|
|
|
|
;================================================================================
|
2013-10-31 21:04:03 +01:00
|
|
|
main:
|
2013-10-28 21:47:26 +01:00
|
|
|
; ==== Init ====
|
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
|
2013-10-28 21:47:26 +01:00
|
|
|
|
|
|
|
; ==== Load libs ====
|
|
|
|
load_libraries load_lib_start, load_lib_end
|
|
|
|
|
|
|
|
; ==== Config LibINI ====
|
2013-11-08 19:38:06 +01:00
|
|
|
invoke ini.get_int, ini_data.file_name, ini_data.settings_name, ini_data.location_name, 1
|
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
|
|
|
|
|
|
|
|
; ==== Load colors ====
|
2021-02-02 23:32:19 +01:00
|
|
|
mcall SF_STYLE_SETTINGS, SSF_GET_COLORS, color
|
2013-10-31 21:04:03 +01:00
|
|
|
or dword[color.bg], 0x10000000
|
|
|
|
or dword[color.frame], 0x10000000
|
|
|
|
or dword[color.text], 0x80000000
|
2013-10-28 21:47:26 +01:00
|
|
|
|
|
|
|
; ==== Config LibIMG ====
|
2021-02-02 23:32:19 +01:00
|
|
|
mov dword[fi.p00], SSF_GET_INFO
|
2013-10-31 21:04:03 +01:00
|
|
|
mov dword[fi.p16], buf_128
|
|
|
|
mov dword[fi.p21], img_data.file_name
|
|
|
|
|
2021-02-02 23:32:19 +01:00
|
|
|
mcall SF_FILE, fi
|
2013-10-31 21:04:03 +01:00
|
|
|
|
|
|
|
mov edx, [buf_128 + 32]
|
|
|
|
imul edx, 10
|
|
|
|
|
|
|
|
stdcall mem.Alloc, edx
|
2013-10-28 21:47:26 +01:00
|
|
|
mov [img_data.rgb_object], eax
|
|
|
|
|
2021-02-02 23:32:19 +01:00
|
|
|
mov dword[fi.p00], SSF_READ_FILE
|
2013-10-31 21:04:03 +01:00
|
|
|
mov dword[fi.p12], edx
|
|
|
|
m2m dword[fi.p16], dword[img_data.rgb_object]
|
|
|
|
mov dword[fi.p21], img_data.file_name
|
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
|
|
|
|
|
|
|
cmp ebx, 0xFFFFFFFF
|
|
|
|
je @f
|
|
|
|
|
|
|
|
stdcall dword[img.decode], dword[img_data.rgb_object], ebx, 0
|
|
|
|
mov dword[img_data.object], eax
|
|
|
|
|
|
|
|
; === ALPHA ===
|
2013-11-08 19:38:06 +01:00
|
|
|
mov edi, eax
|
|
|
|
add edi, 8
|
|
|
|
mov edi, [edi]
|
|
|
|
imul edi, 128
|
|
|
|
sub edi, 4
|
|
|
|
|
2013-10-28 21:47:26 +01:00
|
|
|
add eax, 24
|
|
|
|
mov eax, [eax]
|
|
|
|
.setalpha:
|
|
|
|
mov ebx, [eax + edi]
|
|
|
|
shr ebx, 24
|
|
|
|
cmp ebx, 0
|
|
|
|
jne .nonalpha
|
2013-10-29 20:18:52 +01:00
|
|
|
|
|
|
|
mov ecx, [color.bg]
|
2013-10-28 21:47:26 +01:00
|
|
|
mov [eax + edi], ecx
|
|
|
|
.nonalpha:
|
2013-11-08 19:38:06 +01:00
|
|
|
sub edi, 4
|
|
|
|
cmp edi, 0
|
2013-10-28 21:47:26 +01:00
|
|
|
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 ====
|
|
|
|
mov eax, dword[dock_items.location]
|
|
|
|
and eax, 1b
|
|
|
|
cmp eax, 0
|
|
|
|
je .vert
|
|
|
|
jmp .setshape
|
|
|
|
|
|
|
|
.vert:
|
|
|
|
mov byte[win.isvert], 1
|
|
|
|
|
|
|
|
.setshape:
|
|
|
|
cmp byte[win.isvert], 1
|
|
|
|
je .vert_sp
|
|
|
|
|
|
|
|
.horz_sp:
|
|
|
|
call .HORZ_WIDTH
|
|
|
|
call .HORZ_X
|
|
|
|
call .HORZ_HEIGHT
|
|
|
|
cmp dword[dock_items.location], 1
|
|
|
|
je .settop
|
|
|
|
|
|
|
|
.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
|
|
|
|
je .setleft
|
|
|
|
|
|
|
|
.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
|
|
|
|
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:
|
2013-10-28 21:47:26 +01:00
|
|
|
mov [win.width_opn], eax
|
|
|
|
mov [win.width_hdn], eax
|
|
|
|
|
|
|
|
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
|
|
|
|
mov ecx, [win.width_opn]
|
|
|
|
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:
|
2013-11-03 17:32:45 +01:00
|
|
|
mov dword[win.height_hdn], 3
|
2013-11-08 19:38:06 +01:00
|
|
|
mov dword[win.height_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:
|
2013-10-31 21:04:03 +01:00
|
|
|
mov dword[win.width_opn], BUTTON_SIZE
|
2013-11-03 17:32:45 +01:00
|
|
|
mov dword[win.width_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
|
|
|
|
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:
|
2013-10-28 21:47:26 +01:00
|
|
|
mov [win.height_opn], eax
|
|
|
|
mov [win.height_hdn], eax
|
|
|
|
|
|
|
|
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
|
|
|
|
2013-11-08 19:38:06 +01:00
|
|
|
mov esi, [win.height_opn]
|
|
|
|
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:
|
|
|
|
mov eax, [win.width_hdn]
|
|
|
|
mov [win.width], eax
|
|
|
|
|
|
|
|
mov eax, [win.x_hdn]
|
|
|
|
mov [win.x], eax
|
|
|
|
|
|
|
|
mov eax, [win.height_hdn]
|
|
|
|
mov [win.height], eax
|
|
|
|
|
|
|
|
mov eax, [win.y_hdn]
|
|
|
|
mov [win.y], eax
|
2015-02-26 14:03:17 +01:00
|
|
|
|
|
|
|
cmp byte[dock_items.ashow],1
|
|
|
|
jne .not_ashow
|
|
|
|
|
|
|
|
mov eax, [win.width_opn]
|
|
|
|
mov [win.width], eax
|
|
|
|
|
|
|
|
mov eax, [win.x_opn]
|
|
|
|
mov [win.x], eax
|
|
|
|
|
|
|
|
mov eax, [win.height_opn]
|
|
|
|
mov [win.height], eax
|
|
|
|
|
|
|
|
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:
|
|
|
|
stdcall mem.Free, [img_data.rgb_object]
|
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
|
|
|
;-------------------------------------------------------------------------------
|
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
|
|
|
|
je event_redraw
|
|
|
|
|
|
|
|
cmp eax, EV_BUTTON
|
|
|
|
je event_button
|
|
|
|
|
|
|
|
cmp eax, EV_MOUSE
|
|
|
|
je event_mouse
|
|
|
|
|
|
|
|
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
|
2013-10-28 21:47:26 +01:00
|
|
|
|
2013-11-08 19:38:06 +01:00
|
|
|
mov esi, [color.bg]
|
|
|
|
or esi, 0x01000000
|
2021-02-02 23:32:19 +01:00
|
|
|
mcall SF_CREATE_WINDOW, <[win.x], [win.width]>, <[win.y], [win.height]>, [color.bg], , [color.frame]
|
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]
|
|
|
|
je @f
|
|
|
|
|
|
|
|
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
|
|
|
|
mov esi, [color.bg]
|
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
|
|
|
|
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
|
|
|
|
je .vert_draw_sep
|
2013-11-09 19:13:05 +01:00
|
|
|
mcall , , <4, 36>, [color.frame]
|
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
|
2013-10-31 21:04:03 +01:00
|
|
|
mcall , <4, 36>, , [color.frame]
|
2013-10-28 21:47:26 +01:00
|
|
|
.end_inner_sep:
|
|
|
|
pop ecx
|
|
|
|
pop ebx
|
|
|
|
.end_separator:
|
|
|
|
|
|
|
|
cmp byte[win.isvert], 1
|
|
|
|
je .vert_dig
|
|
|
|
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]
|
2013-10-31 21:04:03 +01:00
|
|
|
imul ebx, ICON_SIZE_BGR
|
2013-10-28 21:47:26 +01:00
|
|
|
add ebx, [img_data.rgb_object]
|
|
|
|
|
2021-02-02 23:32:19 +01:00
|
|
|
mcall SF_PUT_IMAGE, , <32, 32>
|
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
|
|
|
|
2018-10-01 17:18:07 +02:00
|
|
|
;; it must not be possible to close dock
|
|
|
|
;cmp ah, 1
|
|
|
|
;je .button_close
|
2013-10-28 21:47:26 +01:00
|
|
|
|
|
|
|
cmp ah, 2
|
|
|
|
je .button_dock
|
|
|
|
|
|
|
|
jmp @f
|
|
|
|
|
2018-10-01 17:18:07 +02:00
|
|
|
;.button_close:
|
|
|
|
; jmp exit
|
2013-10-28 21:47:26 +01:00
|
|
|
|
|
|
|
.button_dock:
|
|
|
|
mov edi, [win.button_index]
|
|
|
|
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
|
2013-10-31 21:04:03 +01:00
|
|
|
jl wnd_hide
|
2013-10-28 21:47:26 +01:00
|
|
|
dec edi
|
|
|
|
cmp edi, [win.width]
|
2013-10-31 21:04:03 +01:00
|
|
|
jg wnd_hide
|
2013-10-28 21:47:26 +01:00
|
|
|
cmp esi, 0
|
2013-10-31 21:04:03 +01:00
|
|
|
jl wnd_hide
|
2013-10-28 21:47:26 +01:00
|
|
|
dec esi
|
|
|
|
cmp esi, [win.height]
|
2013-10-31 21:04:03 +01:00
|
|
|
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:
|
|
|
|
cmp [win.button_index], eax
|
|
|
|
je .nxt2
|
|
|
|
|
2013-11-09 19:13:05 +01:00
|
|
|
push dword[win.button_index]
|
|
|
|
pop dword[win.prev_index]
|
|
|
|
|
2013-10-28 21:47:26 +01:00
|
|
|
mov [win.button_index], eax
|
|
|
|
|
2013-11-09 19:13:05 +01:00
|
|
|
; ==== DRAW SELECTION ====
|
|
|
|
call DRAW_SELECTION
|
|
|
|
|
2013-10-28 21:47:26 +01:00
|
|
|
.nxt2:
|
|
|
|
mov eax, [win.button_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
|
|
|
|
je .vert_name
|
|
|
|
add eax, [win.x]
|
|
|
|
mov [nwin.x], eax
|
2013-11-03 17:32:45 +01:00
|
|
|
mov byte[nwin.change_shape], 1
|
2021-02-02 23:32:19 +01:00
|
|
|
mcall SF_DRAW_RECT, <0, [win.width]>, <[win.height], 1>, [color.frame]
|
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
|
|
|
|
mov byte[nwin.change_shape], 1
|
2021-02-02 23:32:19 +01:00
|
|
|
mcall SF_DRAW_RECT, <[win.width], 1>, <0, [win.height]>, [color.frame]
|
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
|
2013-10-31 21:04:03 +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
|
|
|
|
|
|
|
|
mov eax, [win.width_opn]
|
|
|
|
mov [win.width], eax
|
|
|
|
|
|
|
|
mov eax, [win.x_opn]
|
|
|
|
mov [win.x], eax
|
|
|
|
|
|
|
|
mov eax, [win.height_opn]
|
|
|
|
mov [win.height], eax
|
|
|
|
|
|
|
|
mov eax, [win.y_opn]
|
|
|
|
mov [win.y], eax
|
|
|
|
|
2015-02-26 14:03:17 +01:00
|
|
|
|
|
|
|
cmp byte[dock_items.ashow],1
|
|
|
|
je .change_nothing
|
2021-02-02 23:32:19 +01:00
|
|
|
mcall SF_CHANGE_WINDOW, [win.x], [win.y], [win.width], [win.height]
|
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
|
2013-10-31 21:04:03 +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
|
|
|
|
mov byte[win.button_index], -1
|
|
|
|
|
2015-02-26 14:03:17 +01:00
|
|
|
cmp byte[dock_items.ashow],1
|
|
|
|
je .do_no_hide
|
|
|
|
|
2013-10-28 21:47:26 +01:00
|
|
|
mov eax, [win.width_hdn]
|
|
|
|
mov [win.width], eax
|
|
|
|
|
|
|
|
mov eax, [win.x_hdn]
|
|
|
|
mov [win.x], eax
|
|
|
|
|
|
|
|
mov eax, [win.height_hdn]
|
|
|
|
mov [win.height], eax
|
|
|
|
|
|
|
|
mov eax, [win.y_hdn]
|
|
|
|
mov [win.y], eax
|
|
|
|
|
2021-02-02 23:32:19 +01:00
|
|
|
mcall SF_CHANGE_WINDOW, [win.x], [win.y], [win.width], [win.height]
|
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-02-02 23:32:19 +01:00
|
|
|
mcall SF_DRAW_RECT, , , [color.bg]
|
2013-11-09 19:13:05 +01:00
|
|
|
|
|
|
|
mov edx, ebx
|
|
|
|
shr ecx, 16
|
|
|
|
mov dx, cx
|
|
|
|
add edx, 0x00040004
|
|
|
|
|
|
|
|
mov ebx, [win.prev_index]
|
|
|
|
imul ebx, 4
|
|
|
|
add ebx, dock_items.icon
|
|
|
|
mov ebx, [ebx]
|
|
|
|
imul ebx, ICON_SIZE_BGR
|
|
|
|
add ebx, [img_data.rgb_object]
|
|
|
|
|
2021-02-02 23:32:19 +01:00
|
|
|
mcall SF_PUT_IMAGE, , <32, 32>
|
2013-11-09 19:13:05 +01:00
|
|
|
|
|
|
|
mov ebx, [win.button_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-02-02 23:32:19 +01:00
|
|
|
mcall SF_DRAW_RECT, , , [color.bt]
|
2013-11-09 19:13:05 +01:00
|
|
|
|
|
|
|
mov edx, ebx
|
|
|
|
shr ecx, 16
|
|
|
|
mov dx, cx
|
|
|
|
add edx, 0x00040004
|
|
|
|
|
|
|
|
mov ecx, [win.button_index]
|
|
|
|
imul ecx, 4
|
|
|
|
add ecx, dock_items.icon
|
|
|
|
mov ecx, [ecx]
|
|
|
|
imul ecx, ICON_SIZE_BGR
|
|
|
|
add ecx, [img_data.rgb_object]
|
|
|
|
|
|
|
|
mov ebx, sel_img
|
|
|
|
|
|
|
|
mov edi, 0
|
|
|
|
@@:
|
|
|
|
mov al, byte[ecx + 2]
|
|
|
|
shl eax, 8
|
|
|
|
mov al, byte[ecx + 1]
|
|
|
|
shl eax, 8
|
|
|
|
mov al, byte[ecx + 0]
|
|
|
|
|
|
|
|
or eax, 0x10000000
|
|
|
|
cmp eax, [color.bg]
|
|
|
|
jne .notbg
|
|
|
|
mov eax, [color.bt]
|
|
|
|
.notbg:
|
|
|
|
|
|
|
|
mov byte[ebx + 0], al
|
|
|
|
shr eax, 8
|
|
|
|
mov byte[ebx + 1], al
|
|
|
|
shr eax, 8
|
|
|
|
mov byte[ebx + 2], al
|
|
|
|
|
|
|
|
add ebx, 3
|
|
|
|
add ecx, 3
|
|
|
|
|
|
|
|
add edi, 3
|
|
|
|
|
|
|
|
cmp edi, 1024 * 3
|
|
|
|
jne @b
|
|
|
|
|
2021-02-02 23:32:19 +01:00
|
|
|
mcall SF_PUT_IMAGE, sel_img, <32, 32>
|
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"
|