apps/reshare: rewrite to fasm #305
@@ -1,40 +1,23 @@
|
||||
; SPDX-License-Identifier: GPL-2.0-only
|
||||
;
|
||||
; Reshare - Shared Resources Daemon
|
||||
; Copyright (C) 2024 KolibriOS-NG Team
|
||||
;
|
||||
|
|
||||
; Contributor rgmaid - Main code
|
||||
; Contributor Burer - Image conversion from 8bpp
|
||||
; Copyright (C) 2024-2026 KolibriOS Team
|
||||
; Copyright (C) 2024-2026 KolibriOS-NG Team
|
||||
|
mxlgv
commented
just add as a co-author to a pull request or commit just add as a co-author to a pull request or commit
|
||||
|
||||
; ====================================================================
|
||||
|
||||
CBOX_WIDTH = 13
|
||||
CBOX_HEIGHT = 13
|
||||
CBOX_PIXELS = CBOX_WIDTH * CBOX_HEIGHT
|
||||
CBOX_IMG_SIZE = CBOX_PIXELS * 3 ; 24-bpp RGB, tight rows
|
||||
CBOX_IMG_SIZE = CBOX_PIXELS * 3 ; 24-bpp BGR, tight rows
|
||||
|
||||
; ====================================================================
|
||||
|
||||
macro RGB24 c
|
||||
; Palette entry: 4 bytes BGR0 (padded for dword-indexed lookup)
|
||||
macro BGRA c
|
||||
{
|
||||
db (c) and 0xFF, (c shr 8) and 0xFF, (c shr 16) and 0xFF
|
||||
}
|
||||
|
||||
macro ROW13 c00, c01, c02, c03, c04, c05, c06, c07, c08, c09, c10, c11, c12
|
||||
{
|
||||
RGB24 c00
|
||||
RGB24 c01
|
||||
RGB24 c02
|
||||
RGB24 c03
|
||||
RGB24 c04
|
||||
RGB24 c05
|
||||
RGB24 c06
|
||||
RGB24 c07
|
||||
RGB24 c08
|
||||
RGB24 c09
|
||||
RGB24 c10
|
||||
RGB24 c11
|
||||
RGB24 c12
|
||||
db (c) and 0xFF, (c shr 8) and 0xFF, (c shr 16) and 0xFF, 0
|
||||
}
|
||||
|
||||
P00 = 0x04D4FC ; 0xRRGGBB
|
||||
@@ -54,18 +37,36 @@ P13 = 0x0464BC
|
||||
P14 = 0x2CDCFC
|
||||
P15 = 0x049FFA
|
||||
|
||||
cbox_image:
|
||||
ROW13 P00, P00, P00, P00, P00, P00, P00, P00, P00, P00, P00, P00, P01
|
||||
ROW13 P02, P01, P01, P01, P01, P01, P01, P01, P01, P01, P01, P01, P03
|
||||
ROW13 P02, P01, P01, P01, P01, P04, P04, P04, P03, P05, P05, P03, P03
|
||||
ROW13 P00, P01, P01, P01, P04, P04, P03, P03, P06, P07, P07, P08, P03
|
||||
ROW13 P00, P03, P05, P05, P03, P03, P03, P06, P09, P10, P11, P06, P03
|
||||
ROW13 P00, P05, P07, P07, P06, P03, P06, P09, P10, P12, P13, P06, P05
|
||||
ROW13 P00, P06, P10, P09, P14, P06, P09, P10, P12, P13, P06, P15, P05
|
||||
ROW13 P00, P06, P12, P10, P09, P09, P10, P12, P13, P06, P15, P05, P05
|
||||
ROW13 P00, P06, P13, P12, P10, P10, P12, P13, P06, P15, P05, P05, P05
|
||||
ROW13 P01, P08, P06, P13, P12, P12, P13, P06, P15, P05, P05, P05, P15
|
||||
ROW13 P01, P05, P15, P06, P13, P13, P06, P15, P05, P05, P05, P15, P15
|
||||
ROW13 P01, P05, P05, P15, P06, P06, P15, P05, P05, P05, P15, P15, P06
|
||||
ROW13 P03, P06, P06, P06, P06, P06, P06, P06, P06, P06, P06, P06, P06
|
||||
align 4
|
||||
cbox_palette:
|
||||
BGRA P00
|
||||
BGRA P01
|
||||
BGRA P02
|
||||
BGRA P03
|
||||
BGRA P04
|
||||
BGRA P05
|
||||
BGRA P06
|
||||
BGRA P07
|
||||
BGRA P08
|
||||
BGRA P09
|
||||
BGRA P10
|
||||
BGRA P11
|
||||
BGRA P12
|
||||
BGRA P13
|
||||
BGRA P14
|
||||
BGRA P15
|
||||
|
||||
; 4-bit palette indices, one byte per pixel (upper nibble unused — values 0..15)
|
||||
cbox_indexed:
|
||||
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 ; row 1
|
||||
db 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ; row 2
|
||||
db 2, 1, 1, 1, 1, 4, 4, 4, 3, 5, 5, 3, 3 ; row 3
|
||||
db 0, 1, 1, 1, 4, 4, 3, 3, 6, 7, 7, 8, 3 ; row 4
|
||||
db 0, 3, 5, 5, 3, 3, 3, 6, 9,10,11, 6, 3 ; row 5
|
||||
db 0, 5, 7, 7, 6, 3, 6, 9,10,12,13, 6, 5 ; row 6
|
||||
db 0, 6,10, 9,14, 6, 9,10,12,13, 6,15, 5 ; row 7
|
||||
db 0, 6,12,10, 9, 9,10,12,13, 6,15, 5, 5 ; row 8
|
||||
db 0, 6,13,12,10,10,12,13, 6,15, 5, 5, 5 ; row 9
|
||||
db 1, 8, 6,13,12,12,13, 6,15, 5, 5, 5,15 ; row 10
|
||||
db 1, 5,15, 6,13,13, 6,15, 5, 5, 5,15,15 ; row 11
|
||||
db 1, 5, 5,15, 6, 6,15, 5, 5, 5,15,15, 6 ; row 12
|
||||
db 3, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 ; row 13
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
; SPDX-License-Identifier: GPL-2.0-only
|
||||
;
|
||||
; Reshare - Shared Resources Daemon
|
||||
; Copyright (C) 2024-2025 KolibriOS/-NG Team
|
||||
;
|
||||
|
mxlgv
commented
Although NG was a mistake, it’s not necessary to write through a slash, just add a second copyright after NG Although NG was a mistake, it’s not necessary to write through a slash, just add a second copyright after NG
|
||||
; Contributor Leency - Original version in C--
|
||||
; Contributor rgmaid - Main code
|
||||
; Contributor Burer - Refactoring and localization
|
||||
; Copyright (C) 2024-2026 KolibriOS Team
|
||||
; Copyright (C) 2024-2026 KolibriOS-NG Team
|
||||
|
mxlgv
commented
Already in the change history Already in the change history
|
||||
|
||||
|
mxlgv
commented
just add as a co-author to a pull request or commit just add as a co-author to a pull request or commit
|
||||
; ====================================================================
|
||||
|
||||
@@ -25,14 +23,14 @@ dd 0
|
||||
|
||||
; ====================================================================
|
||||
|
||||
include "../../macros.inc"
|
||||
include "../../KOSfuncs.inc"
|
||||
include "../../encoding.inc"
|
||||
include "../../proc32.inc"
|
||||
include "../../dll.inc"
|
||||
include "../../debug-fdo.inc"
|
||||
include "../macros.inc"
|
||||
include "../KOSfuncs.inc"
|
||||
include "../encoding.inc"
|
||||
include "../proc32.inc"
|
||||
include "../dll.inc"
|
||||
include "../debug-fdo.inc"
|
||||
|
||||
include "../../develop/libraries/libs-dev/libimg/libimg.inc"
|
||||
include "../libimg.inc"
|
||||
|
||||
include "checkbox.inc"
|
||||
|
||||
@@ -52,9 +50,10 @@ START:
|
||||
mcall SF_KEYBOARD, SSF_SET_INPUT_MODE, 1
|
||||
|
||||
; check if this is second instance of app. if so - run gui, else - run daemon
|
||||
mcall SF_SYS_MISC, SSF_MEM_OPEN, meta_name, 0, SHM_OPEN + SHM_READ
|
||||
mcall SF_SYS_MISC, SSF_MEM_OPEN, meta_name, 0, SHM_READ
|
||||
test eax, eax
|
||||
jz MODE_DAEMON
|
||||
mcall SF_SYS_MISC, SSF_MEM_CLOSE, meta_name
|
||||
jmp MODE_GUI
|
||||
|
||||
.exit:
|
||||
@@ -87,41 +86,75 @@ MODE_GUI:
|
||||
mcall SF_STYLE_SETTINGS, SSF_GET_COLORS, sc, sizeof.system_colors
|
||||
mcall , SSF_GET_SKIN_HEIGHT
|
||||
|
||||
mov ecx, WIN.Y shl 16 + WIN.H
|
||||
add ecx, eax
|
||||
add eax, WIN.H
|
||||
mov esi, eax
|
||||
mcall SF_GET_SCREEN_SIZE
|
||||
movzx ecx, ax
|
||||
shr eax, 16
|
||||
sub eax, WIN.W
|
||||
shr eax, 1
|
||||
shl eax, 16
|
||||
add eax, WIN.W
|
||||
mov ebx, eax
|
||||
sub ecx, esi
|
||||
shr ecx, 1
|
||||
shl ecx, 16
|
||||
add ecx, esi
|
||||
mov edx, [sc.work]
|
||||
add edx, 0x34000000
|
||||
add edx, WIN_STYLE
|
||||
|
||||
mcall SF_CREATE_WINDOW, <WIN.X, WIN.W>, , , , title
|
||||
mcall SF_CREATE_WINDOW, , , , , title
|
||||
|
||||
; visual dividers
|
||||
mcall SF_DRAW_RECT, <PAD, GRID.W>, <BTN.Y + BTN.H + GAP, 1>, [sc.work_graph]
|
||||
mcall SF_DRAW_RECT, <PAD, GRID.W>, <BTN.Y + BTN.H + PAD, 1>, [sc.work_graph]
|
||||
mcall , , <GRID.Y + GRID.H, 1>,
|
||||
|
||||
; info row
|
||||
mov ecx, FONT_TYPE shl 24
|
||||
add ecx, [sc.work_text]
|
||||
mcall SF_DRAW_TEXT, <PAD, GRID.Y + GRID.H + 1 + GAP>, , lb_info
|
||||
mcall SF_DRAW_TEXT, <PAD, GRID.Y + GRID.H + PAD - 1>, , lb_info
|
||||
|
||||
; tabs labels
|
||||
mcall , <TAB_STEP * 0 + PAD * 2, BTN.Y>, , lb_tab_i32
|
||||
mcall , <TAB_STEP * 0 + PAD * 2 + 1, BTN.Y>, ,
|
||||
mcall , <TAB_STEP * 0 + PAD *11, BTN.Y>, , lb_tab_i32_res
|
||||
mcall , <TAB_STEP * 1 + PAD * 2, BTN.Y>, , lb_tab_i18
|
||||
mcall , <TAB_STEP * 1 + PAD * 2 + 1, BTN.Y>, ,
|
||||
mcall , <TAB_STEP * 1 + PAD *11, BTN.Y>, , lb_tab_i18_res
|
||||
mcall , <TAB_STEP * 2 + PAD * 2, BTN.Y>, , lb_tab_i18w
|
||||
mcall , <TAB_STEP * 2 + PAD * 2 + 1, BTN.Y>, ,
|
||||
mcall , <TAB_STEP * 2 + PAD *11, BTN.Y>, , lb_tab_i18_res
|
||||
mcall , <TAB_STEP * 3 + PAD * 2, BTN.Y>, , lb_tab_cbox
|
||||
mcall , <TAB_STEP * 3 + PAD * 2 + 1, BTN.Y>, ,
|
||||
mcall , <TAB_STEP * 3 + PAD *11, BTN.Y>, , lb_tab_cbox_res
|
||||
mov esi, tab_label_strs
|
||||
xor edi, edi
|
||||
.tab_label_loop:
|
||||
mov ebx, edi
|
||||
imul ebx, TAB_STEP
|
||||
push ebx
|
||||
add ebx, PAD * 2
|
||||
shl ebx, 16
|
||||
add ebx, BTN.Y
|
||||
mov edx, [esi]
|
||||
mcall SF_DRAW_TEXT
|
||||
add ebx, 1 shl 16 ; bold: x+1, same string
|
||||
mcall SF_DRAW_TEXT
|
||||
pop ebx
|
||||
add ebx, PAD * 11
|
||||
shl ebx, 16
|
||||
add ebx, BTN.Y
|
||||
mov edx, [esi + 4]
|
||||
mcall SF_DRAW_TEXT
|
||||
add esi, 8
|
||||
inc edi
|
||||
cmp edi, TAB_COUNT
|
||||
jb .tab_label_loop
|
||||
|
||||
; tabs buttons
|
||||
mcall SF_DEFINE_BUTTON, <TAB_STEP * 0 + PAD, BTN.W>, <BTN.Y, BTN.H>, 10 + BTN_HIDE + ACTIVE_ICONS32
|
||||
mcall , <TAB_STEP * 1 + PAD, BTN.W>, , 10 + BTN_HIDE + ACTIVE_ICONS18
|
||||
mcall , <TAB_STEP * 2 + PAD, BTN.W>, , 10 + BTN_HIDE + ACTIVE_ICONS18W
|
||||
mcall , <TAB_STEP * 3 + PAD, BTN.W>, , 10 + BTN_HIDE + ACTIVE_CHECKBOX
|
||||
mov ecx, BTN.Y shl 16 + BTN.H
|
||||
mov esi, ACTIVE_ICONS32
|
||||
xor edi, edi
|
||||
.btn_loop:
|
||||
mov ebx, edi
|
||||
imul ebx, TAB_STEP
|
||||
add ebx, PAD
|
||||
shl ebx, 16
|
||||
add ebx, BTN.W
|
||||
lea edx, [esi + BTN_BASE + BTN_HIDE]
|
||||
mcall SF_DEFINE_BUTTON
|
||||
add esi, esi ; 1→2→4→8 (next ACTIVE bit)
|
||||
inc edi
|
||||
cmp edi, TAB_COUNT
|
||||
jb .btn_loop
|
||||
|
||||
; tabs content
|
||||
call draw_tabs
|
||||
@@ -134,7 +167,7 @@ MODE_GUI:
|
||||
.event_key:
|
||||
|
||||
mcall SF_GET_KEY
|
||||
cmp ah, 15 ; TAB
|
||||
cmp ah, KEY_TAB
|
||||
jne .event_loop
|
||||
|
||||
shl [active_tab], 1 ; * 2
|
||||
@@ -156,7 +189,7 @@ MODE_GUI:
|
||||
je .event_exit
|
||||
|
||||
movzx eax, ah
|
||||
sub eax, 10
|
||||
sub eax, BTN_BASE
|
||||
mov [active_tab], eax
|
||||
call draw_tabs
|
||||
|
||||
@@ -170,14 +203,13 @@ MODE_GUI:
|
||||
|
||||
draw_tabs:
|
||||
|
||||
; draw tabs headers underlines
|
||||
mov esi, [active_tab]
|
||||
; draw tab underlines; active tab gets highlight color
|
||||
xor edi, edi
|
||||
mov esi, 1 ; current tab bit (ACTIVE_ICONS32=1, then 2, 4, 8)
|
||||
|
||||
.loop:
|
||||
mov edx, [sc.work_dark]
|
||||
mov eax, [tab_masks + edi * 4]
|
||||
test esi, eax
|
||||
test [active_tab], esi
|
||||
jz .color_ok
|
||||
mov edx, [sc.work_button]
|
||||
|
||||
@@ -190,6 +222,7 @@ draw_tabs:
|
||||
mcall SF_DRAW_RECT, ebx, ecx, edx
|
||||
|
||||
inc edi
|
||||
add esi, esi ; shift to next tab bit (1→2→4→8)
|
||||
cmp edi, TAB_COUNT
|
||||
jb .loop
|
||||
|
||||
@@ -197,59 +230,46 @@ draw_tabs:
|
||||
mcall SF_DRAW_RECT, <GRID.X, GRID.W>, <GRID.Y, GRID.H>, [sc.work]
|
||||
|
||||
mov eax, [active_tab]
|
||||
|
||||
.tab_i32:
|
||||
cmp eax, ACTIVE_ICONS32
|
||||
jne .tab_i18
|
||||
stdcall draw_tab_icons, lb_tab_i32, META_I32_C, META_I32_W
|
||||
bsf eax, eax ; 0=i32, 1=i18, 2=i18w, 3=cbox
|
||||
cmp eax, 3
|
||||
je .cbox
|
||||
lea esi, [tab_icon_args + eax * 8]
|
||||
stdcall draw_tab_icons, [esi], [esi + 4]
|
||||
ret
|
||||
|
||||
.tab_i18:
|
||||
cmp eax, ACTIVE_ICONS18
|
||||
jne .tab_i18w
|
||||
stdcall draw_tab_icons, lb_tab_i18, META_I18_C, META_I18_W
|
||||
ret
|
||||
|
||||
.tab_i18w:
|
||||
cmp eax, ACTIVE_ICONS18W
|
||||
jne .tab_cbox
|
||||
stdcall draw_tab_icons, lb_tab_i18w, META_I18W_C, META_I18W_W
|
||||
ret
|
||||
|
||||
.tab_cbox:
|
||||
.cbox:
|
||||
stdcall draw_tab_cbox
|
||||
ret
|
||||
|
||||
|
||||
proc draw_tab_icons stdcall uses ebx ecx, _shm_name, _meta_c_off, _meta_w_off
|
||||
mcall SF_SYS_MISC, SSF_MEM_OPEN, meta_name, 0, SHM_OPEN + SHM_READ
|
||||
proc draw_tab_icons stdcall, _shm_name, _meta_off
|
||||
mcall SF_SYS_MISC, SSF_MEM_OPEN, meta_name, 0, SHM_READ
|
||||
test eax, eax
|
||||
jz .done
|
||||
|
||||
mov ebx, [_meta_c_off]
|
||||
mov ecx, [eax + ebx] ; icon_c
|
||||
mov ebx, [_meta_w_off]
|
||||
mov edx, [eax + ebx] ; icon_w
|
||||
add eax, [_meta_off]
|
||||
mov ecx, [eax] ; icon_c
|
||||
mov edx, [eax + 4] ; icon_w (always next field: _meta_off + 4)
|
||||
|
||||
test ecx, ecx
|
||||
jz .done
|
||||
jz .close_meta
|
||||
test edx, edx
|
||||
jz .done
|
||||
jz .close_meta
|
||||
|
||||
push ecx
|
||||
push edx
|
||||
mcall SF_SYS_MISC, SSF_MEM_OPEN, [_shm_name], 0, SHM_OPEN + SHM_READ
|
||||
mcall SF_SYS_MISC, SSF_MEM_OPEN, [_shm_name], 0, SHM_READ
|
||||
pop edx
|
||||
pop ecx
|
||||
|
||||
test eax, eax
|
||||
jz .done
|
||||
jz .close_meta
|
||||
|
||||
mov ebx, eax
|
||||
|
||||
stdcall draw_tab_icons_grid, ebx, ecx, edx
|
||||
stdcall draw_tab_icons_grid, eax, ecx, edx
|
||||
|
||||
mcall SF_SYS_MISC, SSF_MEM_CLOSE, [_shm_name]
|
||||
|
||||
.close_meta:
|
||||
mcall SF_SYS_MISC, SSF_MEM_CLOSE, meta_name
|
||||
|
||||
.done:
|
||||
@@ -257,7 +277,7 @@ proc draw_tab_icons stdcall uses ebx ecx, _shm_name, _meta_c_off, _meta_w_off
|
||||
endp
|
||||
|
||||
|
||||
proc draw_tab_icons_grid stdcall uses eax ebx ecx edx esi edi, _icon_img, _icon_c, _icon_w
|
||||
proc draw_tab_icons_grid stdcall uses ebx esi edi, _icon_img, _icon_c, _icon_w
|
||||
locals
|
||||
x dd 0
|
||||
x_off dd 0
|
||||
@@ -276,10 +296,8 @@ endl
|
||||
shr eax, 1
|
||||
mov [x_off], eax
|
||||
|
||||
; y_step = icon_w + 28
|
||||
mov eax, [_icon_w]
|
||||
add eax, 28
|
||||
mov edi, eax
|
||||
; y_step = CELL.H
|
||||
mov edi, CELL.H
|
||||
|
||||
xor ecx, ecx
|
||||
|
||||
@@ -288,7 +306,7 @@ endl
|
||||
jae .end_for_icons
|
||||
push ecx
|
||||
|
||||
; SF_PUT_IMAGE_EXT _icon_img+icon_size*index, <_icon_w, _icon_w>, <x+x_off, y+RES_Y>, 32, 0, 0
|
||||
; SF_PUT_IMAGE_EXT _icon_img+icon_size*index, <_icon_w, _icon_w>, <x+x_off, y+GRID_Y>, 32, 0, 0
|
||||
mov ebx, [icon_size]
|
||||
imul ebx, ecx
|
||||
add ebx, [_icon_img]
|
||||
@@ -309,18 +327,18 @@ endl
|
||||
pop ebp
|
||||
pop edi
|
||||
|
||||
; DrawNumber with no leading zeros, centered in CELL.W
|
||||
; draw number with no leading zeros, centered in CELL.W
|
||||
mov edx, [x]
|
||||
add edx, GAP
|
||||
shl edx, 16
|
||||
add edx, [y]
|
||||
add edx, [_icon_w]
|
||||
add edx, GRID.Y + 4
|
||||
mov esi, 0x10000000
|
||||
add edx, GRID.Y + 2
|
||||
mov esi, DRAWNUM_NOZERO
|
||||
add esi, [sc.work_graph]
|
||||
|
||||
pop ecx
|
||||
mcall SF_DRAW_NUMBER, 0x00030000, , , ,
|
||||
mcall SF_DRAW_NUMBER, DRAWNUM_DEC3, , , ,
|
||||
inc ecx
|
||||
|
||||
add [x], CELL.W
|
||||
@@ -337,16 +355,14 @@ endp
|
||||
|
||||
|
||||
proc draw_tab_cbox stdcall
|
||||
mcall SF_SYS_MISC, SSF_MEM_OPEN, lb_tab_cbox, 0, SHM_OPEN + SHM_READ
|
||||
mcall SF_SYS_MISC, SSF_MEM_OPEN, lb_tab_cbox, 0, SHM_READ
|
||||
test eax, eax
|
||||
jz .done
|
||||
mov ebx, eax
|
||||
mcall SF_PUT_IMAGE, , \
|
||||
<CBOX_WIDTH, CBOX_HEIGHT>, \
|
||||
<(WIN.W - CBOX_WIDTH)/2, (WIN.H - RES_Y - CBOX_HEIGHT)/2 + RES_Y>
|
||||
|
||||
<(WIN.W - CBOX_WIDTH)/2, (WIN.H - CBOX_HEIGHT)/2>
|
||||
mcall SF_SYS_MISC, SSF_MEM_CLOSE, lb_tab_cbox
|
||||
|
||||
.done:
|
||||
ret
|
||||
endp
|
||||
@@ -359,7 +375,6 @@ MODE_DAEMON:
|
||||
|
||||
; load shared resources from files
|
||||
DEBUGF DBG_INFO, "I: @reshare: loading resources...\n"
|
||||
|
||||
stdcall load_icons, icons32_path, icons32_image, size32
|
||||
stdcall load_icons, icons18_path, icons18_image, size18
|
||||
|
||||
@@ -391,6 +406,7 @@ MODE_DAEMON:
|
||||
mov eax, [icons18_image]
|
||||
test eax, eax
|
||||
jz .i18_set
|
||||
|
||||
mov ebx, [eax + Image.Width]
|
||||
mov eax, [eax + Image.Height]
|
||||
test ebx, ebx
|
||||
@@ -415,14 +431,24 @@ MODE_DAEMON:
|
||||
mcall SF_SYS_MISC, SSF_MEM_OPEN, lb_tab_cbox, CBOX_IMG_SIZE, SHM_CREATE + SHM_WRITE
|
||||
test eax, eax
|
||||
jz .skip_cbox
|
||||
mov esi, cbox_image
|
||||
mov edi, eax
|
||||
mov ecx, CBOX_IMG_SIZE
|
||||
mov esi, cbox_indexed
|
||||
mov ecx, CBOX_PIXELS
|
||||
cld
|
||||
rep movsb
|
||||
.cbox_expand:
|
||||
movzx ebx, byte [esi]
|
||||
inc esi
|
||||
mov eax, [cbox_palette + ebx * 4]
|
||||
stosb ; B
|
||||
shr eax, 8
|
||||
stosb ; G
|
||||
shr eax, 8
|
||||
stosb ; R
|
||||
dec ecx
|
||||
jnz .cbox_expand
|
||||
.skip_cbox:
|
||||
|
||||
cmp [icons32_image], 0
|
||||
cmp [icons32_image], 0
|
||||
jz .skip_i32
|
||||
stdcall copy_image_to_shm, lb_tab_i32, size32, icons32_image
|
||||
test eax, eax
|
||||
@@ -472,7 +498,6 @@ MODE_DAEMON:
|
||||
je .event_loop
|
||||
jmp .wait_event
|
||||
|
||||
; ====================================================================
|
||||
|
||||
proc load_icons stdcall uses ebx ecx, _path, _img_ptr, _size_ptr
|
||||
invoke img.from_file, [_path]
|
||||
@@ -484,15 +509,13 @@ proc load_icons stdcall uses ebx ecx, _path, _img_ptr, _size_ptr
|
||||
mov ebx, [eax + Image.Width]
|
||||
mov ecx, [eax + Image.Height]
|
||||
imul ecx, ebx
|
||||
shl ecx, 2 ; * 4 to get size in bytes
|
||||
shl ecx, 2
|
||||
mov ebx, [_size_ptr]
|
||||
mov [ebx], ecx
|
||||
|
||||
ret
|
||||
|
||||
.fail:
|
||||
DEBUGF DBG_ERR, "E: @reshare: error loading icons from %s\n", [_path]
|
||||
|
||||
ret
|
||||
endp
|
||||
|
||||
@@ -509,41 +532,36 @@ proc copy_image_to_shm stdcall uses ebx ecx edx esi edi, _shm_name, _size_ptr, _
|
||||
mov edi, eax
|
||||
mov ecx, [_size_ptr]
|
||||
mov ecx, [ecx]
|
||||
shr ecx, 2 ; / 4 to get size in dwords
|
||||
shr ecx, 2
|
||||
cld
|
||||
rep movsd
|
||||
|
||||
.done:
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
proc replace_2cols stdcall uses edi, imgsrc, imgsize, color_old_1, color_new_1, color_old_2, color_new_2
|
||||
mov edx, [imgsize]
|
||||
add edx, [imgsrc]
|
||||
mov edi, [imgsrc]
|
||||
|
||||
proc replace_2cols stdcall uses edi, _imgsrc, _imgsize, _col_old1, _col_new1, _col_old2, _col_new2
|
||||
mov edx, [_imgsize]
|
||||
add edx, [_imgsrc]
|
||||
mov edi, [_imgsrc]
|
||||
.loop:
|
||||
cmp edi, edx
|
||||
jae .done
|
||||
mov eax, [edi]
|
||||
cmp eax, [color_old_1]
|
||||
jne .check_second
|
||||
mov eax, [color_new_1]
|
||||
cmp eax, [_col_old1]
|
||||
jne .check2
|
||||
mov eax, [_col_new1]
|
||||
mov [edi], eax
|
||||
jmp .next
|
||||
|
||||
.check_second:
|
||||
cmp eax, [color_old_2]
|
||||
.check2:
|
||||
cmp eax, [_col_old2]
|
||||
jne .next
|
||||
mov eax, [color_new_2]
|
||||
mov eax, [_col_new2]
|
||||
mov [edi], eax
|
||||
|
||||
.next:
|
||||
add edi, 4
|
||||
jmp .loop
|
||||
.done:
|
||||
|
||||
ret
|
||||
endp
|
||||
|
||||
@@ -556,17 +574,25 @@ GAP = 12
|
||||
GRID_COLS = 16
|
||||
GRID_ROWS = 9
|
||||
|
||||
RES_Y = BTN.Y + BTN.H + PAD * 2 + 1
|
||||
GRID_Y = BTN.Y + BTN.H + PAD * 2 + 1
|
||||
TAB_STEP = BTN.W + PAD * 2
|
||||
|
||||
WIN RECT 80, 50, GRID.W + PAD * 2 + BORD * 2, 638
|
||||
BTN RECT 0, PAD + 4, CELL.W * 4 - PAD * 2 , 22
|
||||
CELL RECT 0, 0, 32 + PAD * 2 , 60
|
||||
WIN RECT 0, 0, GRID.W + PAD * 2 + BORD * 2, GRID.H + GRID_Y + 1 + PAD + 10 + GAP
|
||||
BTN RECT 0, PAD + 4, CELL.W * 4 - PAD * 2 , 22
|
||||
CELL RECT 0, 0, 32 + PAD * 2 , 32 + 4 + 10 + PAD
|
||||
|
||||
GRID RECT PAD, RES_Y + PAD, CELL.W * GRID_COLS - PAD * 2, CELL.H * GRID_ROWS
|
||||
GRID RECT PAD, GRID_Y, CELL.W * GRID_COLS - PAD * 2, CELL.H * GRID_ROWS
|
||||
|
||||
FONT_TYPE = 0x90
|
||||
WIN_STYLE = 0x34000000 ; skinned window, draws itself
|
||||
|
||||
BTN_HIDE = 0x60000000
|
||||
BTN_BASE = 10 ; first user-defined button ID
|
||||
|
||||
DRAWNUM_DEC3 = 0x00030000 ; SF_DRAW_NUMBER: decimal, 3 digits
|
||||
DRAWNUM_NOZERO = 0x10000000 ; SF_DRAW_NUMBER: no leading zeros
|
||||
|
||||
KEY_TAB = 15 ; Tab key scan code
|
||||
|
||||
; ====================================================================
|
||||
|
||||
@@ -605,10 +631,8 @@ DBG_ERR = 2 ; only errors
|
||||
__DEBUG__ = 1
|
||||
__DEBUG_LEVEL__ = DBG_ERR
|
||||
|
||||
SHM_OPEN = 0x00
|
||||
SHM_READ = 0x00
|
||||
SHM_WRITE = 0x01
|
||||
SHM_OPEN_ALWAYS = 0x04
|
||||
SHM_CREATE = 0x08
|
||||
|
||||
ACTIVE_ICONS32 = 1
|
||||
@@ -629,8 +653,6 @@ META_CBOX_H = 28
|
||||
META_CBOX_SIZE = 32
|
||||
META_SIZE = 36
|
||||
|
||||
tab_masks dd ACTIVE_ICONS32, ACTIVE_ICONS18, ACTIVE_ICONS18W, ACTIVE_CHECKBOX
|
||||
|
||||
; ====================================================================
|
||||
|
||||
meta_name db "RESHARE_META", 0
|
||||
@@ -652,7 +674,18 @@ shared_i18w dd 0
|
||||
|
||||
active_tab dd ACTIVE_ICONS32
|
||||
|
||||
sc system_colors
|
||||
tab_icon_args:
|
||||
dd lb_tab_i32, META_I32_C ; META_I32_W = META_I32_C + 4
|
||||
dd lb_tab_i18, META_I18_C ; META_I18_W = META_I18_C + 4
|
||||
dd lb_tab_i18w, META_I18W_C ; META_I18W_W = META_I18W_C + 4
|
||||
|
||||
tab_label_strs:
|
||||
dd lb_tab_i32, lb_tab_i32_res
|
||||
dd lb_tab_i18, lb_tab_i18_res
|
||||
dd lb_tab_i18w, lb_tab_i18_res
|
||||
dd lb_tab_cbox, lb_tab_cbox_res
|
||||
|
||||
sc system_colors
|
||||
|
||||
include_debug_strings
|
||||
|
||||
|
||||
Reference in New Issue
Block a user
Add copyright KolibriOS 2026