forked from KolibriOS/kolibrios
tooltip widget+demo
git-svn-id: svn://kolibrios.org@6689 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
ce0f47388b
commit
14032d12c8
187
programs/develop/libraries/box_lib/asm/trunk/tooltip_demo.asm
Normal file
187
programs/develop/libraries/box_lib/asm/trunk/tooltip_demo.asm
Normal file
@ -0,0 +1,187 @@
|
||||
; <20>à®á⮩ ¯à¨¬¥à ¯à®£à ¬¬ë ¤«ï KolibriOS
|
||||
; ®§¢ã稢 ¥â ª®¤ ¦ ⮩ ª« ¢¨è¨
|
||||
; - ¯¥à¥¤¥« ª ª ¯à¨¬¥à ¨á¯®«ì§®¢ ¨ï tooltip
|
||||
|
||||
use32 ; ¢ª«îç¨âì 32-¡¨âë© à¥¦¨¬ áᥬ¡«¥à
|
||||
org 0x0 ; ¤à¥á æ¨ï á ã«ï
|
||||
|
||||
db 'MENUET01' ; 8-¡ ©âë© ¨¤¥â¨ä¨ª â®à MenuetOS
|
||||
dd 0x01 ; ¢¥àá¨ï § £®«®¢ª (¢á¥£¤ 1)
|
||||
dd START ; ¤à¥á ¯¥à¢®© ª®¬ ¤ë
|
||||
dd CODE_END ; à §¬¥à ¯à®£à ¬¬ë
|
||||
dd DATA_END ; ª®«¨ç¥á⢮ ¯ ¬ïâ¨
|
||||
dd STACK_END ; ¤à¥á ¢¥àè¨ë áâíª
|
||||
dd 0x0 ; ¤à¥á ¡ãä¥à ¤«ï ¯ à ¬¥â஢
|
||||
dd cur_dir_path ; 㪠§ â¥«ì ¤à¥á, ªã¤ ¯®¬¥é ¥âáï áâப , ᮤ¥à¦ é ï ¯ãâì ¤® ¯à®£à ¬¬ë ¢ ¬®¬¥â § ¯ã᪠.
|
||||
|
||||
include '../../../../../proc32.inc'
|
||||
include '../../../../../macros.inc'
|
||||
include '../../../../../KOSfuncs.inc'
|
||||
include '../../../../../Dll.inc' ; malloc fn
|
||||
include '../../trunk/box_lib.mac'
|
||||
include '../../load_lib.mac'
|
||||
;include 'proc32.inc'
|
||||
;include 'macros.inc'
|
||||
;include 'KOSfuncs.inc'
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
;--- <20>€—€‹Ž <20><>Žƒ<C5BD>€ŒŒ› ----------------------------------------------
|
||||
;---------------------------------------------------------------------
|
||||
; íâ®â ¬ ªà®á ®¡ï§ ⥫¥ ¤«ï ¢á¥å ª®¬¯®¥â®¢, ¨á¯®«ì§ãîé¨å heap
|
||||
; ªà®¬¥ ⮣®, ®¡ï§ â¥«ì® ¨¬®àâ¨à®¢ âì lib_init - ¯à¨ ¨¬¯®à⥠®¯à¥¤¥«ïîâáï
|
||||
; äãªæ¨¨ 娯 ¤«ï ¡¨¡«¨®â¥ª¨
|
||||
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
|
||||
|
||||
START:
|
||||
;---------------------------------------------------------------------
|
||||
;--- ˆ<>ˆ–ˆ€‹ˆ‡€–ˆŸ ----------------------------------------
|
||||
;---------------------------------------------------------------------
|
||||
;mov eax, mem_alloc
|
||||
;mov [mem.alloc], eax
|
||||
;mov eax, mem_realloc
|
||||
;mov [mem.realloc], eax
|
||||
;mov eax, mem_free
|
||||
;mov [mem.free], eax
|
||||
mcall 68, 11
|
||||
|
||||
mcall 40, $C0000027 ; ¬ ᪠ᮡë⨩ - ¬ëèì ⮫쪮 ¢ ªâ¨¢®¬ ®ª¥
|
||||
|
||||
sys_load_library lib_name, cur_dir_path, lib_path, sys_path, \
|
||||
e_notfound_lib, head_f_l, myimport, e_import, head_f_i
|
||||
test eax,eax
|
||||
jz @f
|
||||
mcall -1 ; alarm exit
|
||||
@@:
|
||||
|
||||
|
||||
invoke tooltip_init, redbox_tt ; only begin of list
|
||||
|
||||
red: ; ¯¥à¥à¨á®¢ âì ®ª®
|
||||
|
||||
call draw_window ; ¢ë§ë¢ ¥¬ ¯à®æ¥¤ãàã ®âà¨á®¢ª¨ ®ª
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
;--- –ˆŠ‹ Ž<><C5BD>€<EFBFBD>Ž’Šˆ ‘Ž<E28098>›’ˆ‰ ----------------------------------------
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
still:
|
||||
mcall 23, 5 ; äãªæ¨ï 23 - ¦¤ âì ᮡëâ¨ï <20>¥ ¡®«¥¥ 祬 0.05á
|
||||
test eax, eax ; ¥â ᮡë⨩ - ¯à®¢¥à¨âì à¨á®¢ ¨¥ âã«â¨¯®¢ ¯® â ©¬¥àã
|
||||
je yield
|
||||
cmp eax,1 ; ¯¥à¥à¨á®¢ âì ®ª® ?
|
||||
je red ; ¥á«¨ ¤ - ¬¥âªã red
|
||||
cmp eax,2 ; ¦ â ª« ¢¨è ?
|
||||
je key ; ¥á«¨ ¤ - key
|
||||
cmp eax,3 ; ¦ â ª®¯ª ?
|
||||
je button ; ¥á«¨ ¤ - button
|
||||
cmp eax,6 ; ᮡë⨥ ¬ëè¨
|
||||
je mouse ; ¥á«¨ ¤ - mouse
|
||||
|
||||
jmp still ; ¥á«¨ ¤à㣮¥ ᮡë⨥ - ¢ ç «® 横«
|
||||
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
yield:
|
||||
invoke tooltip_test_show, redbox_tt
|
||||
jmp still ; ¢¥àãâìáï ª ç «ã 横«
|
||||
|
||||
mouse:
|
||||
invoke tooltip_mouse, redbox_tt
|
||||
jmp still ; ¢¥àãâìáï ª ç «ã 横«
|
||||
|
||||
key: ; ¦ â ª« ¢¨è ª« ¢¨ âãà¥
|
||||
mcall 2 ; äãªæ¨ï 2 - áç¨â âì ª®¤ ᨬ¢®« (¢ ah)
|
||||
|
||||
jmp still ; ¢¥àãâìáï ª ç «ã 横«
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
button:
|
||||
mcall 17 ; 17 - ¯®«ãç¨âì ¨¤¥â¨ä¨ª â®à ¦ ⮩ ª®¯ª¨
|
||||
|
||||
cmp ah, 1 ; ¥á«¨ <20>… ¦ â ª®¯ª á ®¬¥à®¬ 1,
|
||||
jne still ; ¢¥àãâìáï
|
||||
|
||||
pexit:
|
||||
invoke tooltip_delete, redbox_tt ; ®á¢®¡®¦¤ ¥¬ ¯ ¬ïâì
|
||||
mcall -1 ; ¨ ç¥ ª®¥æ ¯à®£à ¬¬ë
|
||||
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
;--- Ž<><C5BD>…„…‹…<E280B9>ˆ… ˆ Ž’<C5BD>ˆ‘Ž‚Š€ ŽŠ<C5BD>€ ----------------------------------
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
draw_window:
|
||||
|
||||
mcall 12, 1 ; äãªæ¨ï 12: á®®¡é¨âì Ž‘ ® ç «¥ ®âà¨á®¢ª¨
|
||||
|
||||
mcall 48, 3, sc,sizeof.system_colors
|
||||
|
||||
mov edx, [sc.work] ; 梥â ä®
|
||||
or edx, 0x33000000 ; ¨ ⨯ ®ª 3
|
||||
mcall 0, <200,300>, <200,150>, , ,title
|
||||
|
||||
; ¢ë¢®¤ ª¢ ¤à ⨪®¢
|
||||
mcall 13, <60,50>, <50,50>, $FF0000
|
||||
mcall 13, <140,50>, <50,50>, $FF
|
||||
|
||||
|
||||
mcall 12, 2 ; äãªæ¨ï 12.2, § ª®ç¨«¨ à¨á®¢ âì
|
||||
|
||||
ret ; ¢ë室¨¬ ¨§ ¯à®æ¥¤ãàë
|
||||
|
||||
|
||||
CODE_END: ; ¬¥âª ª®æ ¯à®£à ¬¬ë; --------------------------------------------;
|
||||
|
||||
; ---------------------------------------------------------------------------- ;
|
||||
;---------------------------------------------------------------------
|
||||
;--- „€<E2809E><E282AC>›… <20><>Žƒ<C5BD>€ŒŒ› ----------------------------------------------
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
sys_path db '/sys/lib/'
|
||||
;sys_path db '/tmp0/1/'
|
||||
lib_name db 'box_lib.obj',0
|
||||
cur_dir_path rb 4096
|
||||
lib_path rb 4096
|
||||
|
||||
e_notfound_lib db 'Sorry I cannot load library box_lib.obj',0
|
||||
|
||||
head_f_i:
|
||||
head_f_l db 'System error',0
|
||||
e_import db 'Error on load import library box_lib.obj',0
|
||||
|
||||
myimport:
|
||||
dd sz_lib_init ;äãªæ¨ï § ¯ã᪠¥âáï ¬ ªà®á®¬ 1 à § ¯à¨ ¯®¤ª«î票¨
|
||||
;¡¨¡«¨®â¥ª¨, ¯®â®¬ã ¢ ¯à®£à ¬¬¥ ¬¥âª ¥¥ ¥ ã¦
|
||||
tooltip_init dd sz_tooltip_init
|
||||
tooltip_delete dd sz_tooltip_delete
|
||||
tooltip_test_show dd sz_tooltip_test_show
|
||||
tooltip_mouse dd sz_tooltip_mouse
|
||||
get_font_size dd sz_get_font_size
|
||||
dd 0
|
||||
dd 0
|
||||
|
||||
sz_lib_init db 'lib_init',0
|
||||
sz_tooltip_init db 'tooltip_init', 0
|
||||
sz_tooltip_delete db 'tooltip_delete', 0
|
||||
sz_tooltip_test_show db 'tooltip_test_show', 0
|
||||
sz_tooltip_mouse db 'tooltip_mouse', 0
|
||||
sz_get_font_size db 'get_font_size', 0
|
||||
|
||||
|
||||
;tooltip txt, next, zone_x, zone_w, zone_y, zone_h, col_txt, col_bkg, tm_wait
|
||||
redbox_tt tooltip redboxtxt, blubox_tt, 60, 50, 50, 50, 0, $FFF473, 100
|
||||
blubox_tt tooltip bluboxtxt, 0, 140, 50, 50, 50, $110000FF, $FFF473, 100
|
||||
|
||||
redboxtxt db 'Red Box Tooltip', 13, 'May be multilined', 13, 13, 'Even with empty lines', 0
|
||||
bluboxtxt db 'Blue Box Tooltip', 0
|
||||
|
||||
sc system_colors
|
||||
|
||||
title db 'Toooltip demo',0
|
||||
|
||||
; stack----------------------------------------------------------------------- ;
|
||||
rb 4096
|
||||
STACK_END dd ?
|
||||
|
||||
DATA_END: ; ¬¥âª ª®æ ¤ ëå ¯à®£à ¬¬ë; ------------------------------------ ;
|
@ -9,4 +9,4 @@ include 'tree_list.mac' ;macro implements tree_list, image_list, list_box
|
||||
include 'pathshow.mac' ;macro implements pathshow
|
||||
include 't_edit.mac' ;macro implements text_editor
|
||||
include 'frame.mac' ;macro implements frame
|
||||
include 'progressbar.mac' ;macro implements progressbar
|
||||
include 'progressbar.mac' ;macro implements progressbar
|
||||
|
@ -114,6 +114,9 @@ use_frame
|
||||
;--------------------------------------------------
|
||||
use_progressbar
|
||||
|
||||
;--------------------------------------------------
|
||||
include 'tooltip.asm' ;tooltip
|
||||
|
||||
;input:
|
||||
; eax = óêàçàòåëü íà ôóíêöèþ âûäåëåíèÿ ïàìÿòè
|
||||
; ebx = ... îñâîáîæäåíèÿ ïàìÿòè
|
||||
@ -346,6 +349,12 @@ dd szVersion_frame, 0x00010001
|
||||
dd sz_progressbar_draw, progressbar_draw
|
||||
dd sz_progressbar_progress, progressbar_progress
|
||||
|
||||
dd sz_tooltip_init, tooltip_init
|
||||
dd sz_tooltip_delete, tooltip_delete
|
||||
dd sz_tooltip_test_show, tooltip_test_show
|
||||
dd sz_tooltip_mouse, tooltip_mouse
|
||||
dd sz_get_font_size, get_font_size
|
||||
|
||||
dd 0,0
|
||||
|
||||
|
||||
@ -450,4 +459,10 @@ sz_Frame_draw db 'frame_draw',0
|
||||
szVersion_frame db 'version_frame',0
|
||||
|
||||
sz_progressbar_draw db 'progressbar_draw', 0
|
||||
sz_progressbar_progress db 'progressbar_progress', 0
|
||||
sz_progressbar_progress db 'progressbar_progress', 0
|
||||
|
||||
sz_tooltip_init db 'tooltip_init', 0
|
||||
sz_tooltip_delete db 'tooltip_delete', 0
|
||||
sz_tooltip_test_show db 'tooltip_test_show', 0
|
||||
sz_tooltip_mouse db 'tooltip_mouse', 0
|
||||
sz_get_font_size db 'get_font_size', 0
|
||||
|
@ -530,4 +530,28 @@ FR_FILLED equ 10000b ; [x]
|
||||
|
||||
; FR_TEXT_POSITION
|
||||
FR_TEXT_POS_BOTTOM equ 1
|
||||
FR_TEXT_POS_TOP equ 0
|
||||
FR_TEXT_POS_TOP equ 0
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
|
||||
struc tooltip txt, next, zone_x, zone_w, zone_y, zone_h, col_txt, col_bkg, tm_wait
|
||||
{
|
||||
.txt dd txt ; 㪠§ ⥫ì ⥪áâ asciiz, à §¤¥«¨â¥«ì \r 13
|
||||
.next dd next ; á«¥¤ãî騨© tooltip ¢ 楯®çª¥ ¨«¨ 0
|
||||
.zone_y dw zone_y ; §® ª®â஫ï (¢ 90% á«ãç ¥¢ ᮢ¯ ¤ ¥â á à §¬¥à®¬ ª®â஫ )
|
||||
.zone_x dw zone_x ;
|
||||
.zone_h dw zone_h ;
|
||||
.zone_w dw zone_w ;
|
||||
.col_txt dd col_txt ; 梥â ⥪áâ âã«â¨¯ , ¢ª«îç ï à §¬¥à SysFn4
|
||||
.col_bkg dd col_bkg ; 梥â ä® âã«â¨¯
|
||||
.tm_wait dw tm_wait ; ¢à¥¬ï ®¦¨¤ ¨ï å10¬á
|
||||
;¢à¥¬¥ë¥ ¯¥à¥¬¥ë¥
|
||||
.font_sz dd ? ; font size
|
||||
.mouse dd ? ; ¯à¥¤ë¤ã饥 ¯®«®¦¥¨¥ (x, y)
|
||||
.tm_strt dd ? ; ¢à¥¬ï § ¯ã᪠⠩¬¥à (¢å®¤ ¬ëè¨ ¢ §®ã) å10¬á
|
||||
.video dd ? ; ¯ ¬ïâì ¤«ï á®åà ¥®£® ¯®¤ âã«â¨¯®¬
|
||||
.video_y dw ? ; ª®®à¤¨ âë § ¯®¬¥®© ®¡« á⨠íªà , ¨«¨ 0 ¥á«¨ ¯ãáâ®
|
||||
.video_x dw ?
|
||||
.video_h dw ? ; à §¬¥à ¯à¥¤à áç¨âë¢ ¥âáï ¯à¨ init
|
||||
.video_w dw ?
|
||||
}
|
||||
|
348
programs/develop/libraries/box_lib/trunk/tooltip.asm
Normal file
348
programs/develop/libraries/box_lib/trunk/tooltip.asm
Normal file
@ -0,0 +1,348 @@
|
||||
; ---------------------------------------------------------------------------- ;
|
||||
; Tooltip widget
|
||||
;
|
||||
; Created by Siemargl, 2016
|
||||
;
|
||||
; Changelist
|
||||
; 161107 - initial version + test
|
||||
|
||||
|
||||
; http://stackoverflow.com/questions/8976600/fasm-how-to-send-struct-to-proc
|
||||
virtual at edi
|
||||
ttip tooltip ?, ?, ?, ?, ?, ?, ?, ?, ?
|
||||
end virtual
|
||||
|
||||
; ---------------------------------------------------------------------------- ;
|
||||
; ¨¨æ¨ «¨§ æ¨ï ¢á¥© 楯®çª¨ âã«â¨¯®¢, ä®à¬¨à®¢ ¨¥ à §¬¥à®¢ ¨ ¡ãä¥à®¢ ¯ ¬ïâ¨
|
||||
; return eax zero if fails
|
||||
align 16
|
||||
proc tooltip_init uses esi edi, ttip:dword
|
||||
locals
|
||||
max_len dw ? ;maximum chars in line
|
||||
lines dw ? ;lines in tooltip
|
||||
endl
|
||||
|
||||
mov edi, [ttip]
|
||||
jmp .tail_call
|
||||
.list_next:
|
||||
; init statics
|
||||
mov [ttip.mouse], 0
|
||||
mov [ttip.tm_strt], 0
|
||||
mov [ttip.video_y], 0
|
||||
mov [ttip.video_x], 0
|
||||
mov [ttip.video], 0
|
||||
stdcall get_font_size, [ttip.col_txt]
|
||||
mov [ttip.font_sz], eax
|
||||
|
||||
; count num of lines and max len
|
||||
mov esi, [ttip.txt]
|
||||
mov [lines], 1 ; lines
|
||||
mov [max_len], 0 ; max_len
|
||||
.line:
|
||||
mov ecx, 0 ; len
|
||||
.symb:
|
||||
mov al, [esi]
|
||||
cmp al, 0
|
||||
je .eos
|
||||
cmp al, 13
|
||||
jne .next
|
||||
inc [lines]
|
||||
inc esi
|
||||
cmp cx, [max_len] ; detect max
|
||||
jle @f
|
||||
mov [max_len], cx
|
||||
@@:
|
||||
jmp .line
|
||||
.next:
|
||||
inc ecx
|
||||
inc esi
|
||||
jmp .symb
|
||||
.eos:; string ended, we have correct width and hight
|
||||
cmp cx, [max_len] ; detect max
|
||||
jle @f
|
||||
mov [max_len], cx
|
||||
@@:
|
||||
|
||||
mov eax, [ttip.font_sz]
|
||||
shr eax, 16
|
||||
imul [max_len]
|
||||
mov dx, ax ; width in pixels
|
||||
mov [ttip.video_w], ax
|
||||
mov eax, [ttip.font_sz] ; lo word == h
|
||||
and eax, $FFFF
|
||||
imul ax, [lines]
|
||||
mov [ttip.video_h], ax
|
||||
imul [ttip.video_w]
|
||||
imul eax, 3 ; eax have now width * height in pixels *3
|
||||
; getmem
|
||||
invoke mem.alloc, eax
|
||||
mov [ttip.video], eax
|
||||
test eax, eax
|
||||
je .exitp ; malloc fails
|
||||
|
||||
; cycle list
|
||||
mov edi, [ttip.next]
|
||||
.tail_call:
|
||||
test edi, edi
|
||||
jne .list_next
|
||||
xor eax, eax
|
||||
inc eax ; god return
|
||||
.exitp:
|
||||
ret
|
||||
endp
|
||||
|
||||
; ---------------------------------------------------------------------------- ;
|
||||
; ®ç¨á⪠¯ ¬ï⨠¢á¥© 楯®çª¨ âã«â¨¯®¢
|
||||
align 4
|
||||
proc tooltip_delete uses edi, ttip:dword
|
||||
mov edi, [ttip]
|
||||
jmp .tail_call
|
||||
.list_next:
|
||||
mov eax, [ttip.video]
|
||||
test eax, eax
|
||||
je @f
|
||||
invoke mem.free, eax
|
||||
@@:
|
||||
mov edi, [ttip.next]
|
||||
.tail_call:
|
||||
test edi, edi
|
||||
jne .list_next
|
||||
ret
|
||||
endp
|
||||
|
||||
; ---------------------------------------------------------------------------- ;
|
||||
; ¯®ª § 㦮£® ¨§ ¢á¥© 楯®çª¨ âã«â¨¯®¢ ¯à¨ ¡¥§¤¥©á⢨¨ (event 0)
|
||||
align 4
|
||||
proc tooltip_test_show uses edi ebx, ttip:dword
|
||||
mov edi, [ttip]
|
||||
jmp .tail_call
|
||||
.list_next:
|
||||
cmp [ttip.tm_strt], 0 ; â ©¬¥à 0, § ç¨â ¬ë ¥ ¢ §®¥
|
||||
je .nextp
|
||||
cmp [ttip.video_y], 0 ; âã«â¨¯ 㦥 ®â®¡à ¦¥
|
||||
;;; jne .redraw
|
||||
jne .nextp
|
||||
mcall SF_SYSTEM_GET, SSF_TIME_COUNT
|
||||
movzx ebx, [ttip.tm_wait]
|
||||
sub eax, ebx
|
||||
cmp eax, [ttip.tm_strt]
|
||||
jl .exitp ; ¬®£ ¡ëâì ⮫쪮 ®¤¨
|
||||
; ¢à¥¬ï ®â⨪ «®, á®åà 塞 ®¡« áâì ¨ à¨á㥬áï
|
||||
;CopyScreen(shadow_buf, 5*skinned+x+wForm.left, GetSkinHeight()*skinned+y+wForm.top, w, h);
|
||||
mcall SF_THREAD_INFO, proc_info, -1
|
||||
movzx edx, word [proc_info + 34] ; window x position
|
||||
add edx, 5
|
||||
shl edx, 16
|
||||
mcall SF_STYLE_SETTINGS, SSF_GET_SKIN_HEIGHT
|
||||
movzx ebx, word [proc_info + 38] ; window y position
|
||||
add eax, ebx
|
||||
add edx, eax ; x_y
|
||||
add edx, [ttip.mouse]
|
||||
add edx, 20 ; pixels below mouse
|
||||
mov ecx, dword [ttip.video_h] ; w_h
|
||||
mcall SF_GET_IMAGE, [ttip.video]
|
||||
|
||||
mov eax, [ttip.mouse] ; á®åà ¨¬ ¯®§¨æ¨î £¤¥ à¨á㥬áï
|
||||
add eax, 20 ; pixels below mouse
|
||||
mov [ttip.video_y], ax
|
||||
shr eax, 16
|
||||
mov [ttip.video_x], ax
|
||||
.redraw: ; à¨á㥬áï ®â®á¨â¥«ì® ¬ëè¨!!!
|
||||
stdcall tooltip_draw, edi
|
||||
|
||||
jmp .exitp ; ¬®£ ¡ëâì ⮫쪮 ®¤¨
|
||||
.nextp:
|
||||
mov edi, [ttip.next]
|
||||
.tail_call:
|
||||
test edi, edi
|
||||
jne .list_next
|
||||
.exitp:
|
||||
ret
|
||||
endp
|
||||
|
||||
; à¨á㥬áï ®â®á¨â¥«ì® ¬ëè¨!!!
|
||||
; internal func
|
||||
proc tooltip_draw uses esi edi ebx, ttip:dword
|
||||
locals
|
||||
line dw ? ;line # drawing
|
||||
ptr_li dd ? ;line begin
|
||||
endl
|
||||
mov edi, [ttip]
|
||||
; draw square
|
||||
movzx ebx, [ttip.video_x]
|
||||
shl ebx, 16
|
||||
mov bx, [ttip.video_w]
|
||||
movzx ecx, [ttip.video_y]
|
||||
shl ecx, 16
|
||||
mov cx, [ttip.video_h]
|
||||
mcall SF_DRAW_RECT, , , [ttip.col_bkg]
|
||||
|
||||
; 横« ¯® áâப ¬
|
||||
; count num of lines and max len
|
||||
mov esi, [ttip.txt]
|
||||
mov [line], 0 ; line #
|
||||
.line:
|
||||
mov ecx, 0 ; len
|
||||
mov [ptr_li], esi
|
||||
.symb:
|
||||
mov al, [esi]
|
||||
cmp al, 0
|
||||
je @f
|
||||
cmp al, 13
|
||||
jne .next
|
||||
@@:
|
||||
; draw line if len > 0
|
||||
test ecx, ecx
|
||||
je @f
|
||||
; draw single line
|
||||
pushad
|
||||
mov esi, ecx ; length
|
||||
movzx ebx, [ttip.video_x]
|
||||
shl ebx, 16
|
||||
mov eax, [ttip.font_sz]
|
||||
and eax, $FFFF
|
||||
imul ax, [line]
|
||||
add ax, [ttip.video_y]
|
||||
add ebx, eax
|
||||
mov ecx, [ttip.col_txt]
|
||||
and ecx, $37FFFFFF
|
||||
mov edx, [ptr_li]
|
||||
mcall SF_DRAW_TEXT
|
||||
popad
|
||||
@@:
|
||||
cmp byte ptr esi, 0
|
||||
je .exitp
|
||||
inc [line]
|
||||
inc esi
|
||||
jmp .line
|
||||
.next:
|
||||
inc ecx
|
||||
inc esi
|
||||
jmp .symb
|
||||
.exitp:
|
||||
ret
|
||||
endp
|
||||
|
||||
; ---------------------------------------------------------------------------- ;
|
||||
; ã¡à âì âã«â¨¯ë ¯à¨ 饫窥 ¬ëè¨ ¨«¨ áꥧ¤¥ ¨§ §®ë. ¤«ï ¢á¥© 楯®çª¨ âã«â¨¯®¢ ¯à¨ ᮡë⨨ ¬ëè¨
|
||||
; ¥á«¨ mouse_coord == -1 ®¯à®á¨â ¬ëèì
|
||||
align 4
|
||||
proc tooltip_mouse, ttip:dword
|
||||
locals
|
||||
mouse_coord dd ?
|
||||
mouse_but dd ?
|
||||
endl
|
||||
pushad
|
||||
; ®¯à®á¨¬ ¬ëèì ¨ à áá㥬 ¯® âã«â¨¯ ¬
|
||||
mcall SF_MOUSE_GET, SSF_WINDOW_POSITION
|
||||
mov [mouse_coord], eax
|
||||
mcall SF_MOUSE_GET, SSF_BUTTON
|
||||
mov [mouse_but], eax
|
||||
mov edi, [ttip]
|
||||
.list_next:
|
||||
test edi, edi
|
||||
je .exitp
|
||||
cmp [mouse_but], 0 ; ¯à¨ 饫窥 áâ¨à ¥¬áï
|
||||
jne @f
|
||||
; ¯®¯ ¤ ¥¬ «¨ ¢ §®ã ª®â஫ï
|
||||
mov eax, [mouse_coord]
|
||||
mov [ttip.mouse], eax ; ¬¥áâ® £¤¥ ¡ë« § ¬¥ç¥ ¬ëèì! (å§ § 祬)
|
||||
mov ecx, eax
|
||||
shr ecx, 16
|
||||
cmp cx, [ttip.zone_x] ; zone_x is higher word
|
||||
jl @f
|
||||
cmp ax, [ttip.zone_y]
|
||||
jl @f
|
||||
mov cx, [ttip.zone_w]
|
||||
add cx, [ttip.zone_x]
|
||||
shl ecx, 16
|
||||
cmp eax, ecx ; x+w < mouse_x (mouse_y in low word ignored)
|
||||
jge @f
|
||||
mov cx, [ttip.zone_y]
|
||||
add cx, [ttip.zone_h]
|
||||
cmp ax, cx
|
||||
jge @f
|
||||
; ¬ë ¢ §®¥ - § ᥪ ¥¬ áâ àâ, ¥á«¨ ¥£® ¥ ¡ë«®
|
||||
cmp [ttip.tm_strt], 0
|
||||
jne .nextp
|
||||
mcall SF_SYSTEM_GET, SSF_TIME_COUNT
|
||||
mov [ttip.tm_strt], eax
|
||||
jmp .nextp
|
||||
@@:
|
||||
; ¥á«¨ ¥áâì ¡ãä¥à, ¢¥àãâì ª à⨪㠢§ ¤, ¨ ç¥ ¨¤¥¬ ¤ «ìè¥ ¯® 楯®çª¥
|
||||
mov [ttip.tm_strt], 0
|
||||
cmp [ttip.video_y], 0
|
||||
je .nextp
|
||||
movzx ecx, [ttip.video_w]
|
||||
shl ecx, 16
|
||||
mov cx, [ttip.video_h]
|
||||
movzx edx, [ttip.video_x]
|
||||
shl edx, 16
|
||||
mov dx, [ttip.video_y]
|
||||
mcall SF_PUT_IMAGE, [ttip.video]
|
||||
mov [ttip.video_y], 0
|
||||
;jmp exitp ; ¬®£ ¡ëâì ⮫쪮 ®¤¨ - ®â¬¥ - ®¡à ¡®â âì 㦮 ¢á¥ á¡à®áë â ©¬¥à®¢
|
||||
.nextp:
|
||||
;mov eax, [ttip].next
|
||||
;stdcall tooltip_mouse, [ttip].next, [mouse_coord], [mouse_but]
|
||||
; tail call unroll recursion
|
||||
mov edi, [ttip.next]
|
||||
jmp .list_next
|
||||
.exitp:
|
||||
popad
|
||||
ret
|
||||
endp
|
||||
|
||||
; ---------------------------------------------------------------------------- ;
|
||||
; decrypt font size as of SysFn 4
|
||||
; returns eax = (x,y)
|
||||
align 4
|
||||
proc get_font_size, color:dword ; x86 calling convention uses eax ecx edx
|
||||
;font = color >> 24;
|
||||
;int font_multipl = (font & 7) + 1;
|
||||
;if (font & 0x10) // 8x16
|
||||
;{
|
||||
; ed->width_sym = 8 * font_multipl;
|
||||
; ed->hight_sym = 16 * font_multipl;
|
||||
;} else // 6x9
|
||||
;{
|
||||
; ed->width_sym = 6 * font_multipl;
|
||||
; ed->hight_sym = 9 * font_multipl;
|
||||
;}
|
||||
mov edx, [color]
|
||||
shr edx, 24 ; font
|
||||
|
||||
mov ecx, edx ; font_multipl
|
||||
and ecx, 7
|
||||
inc ecx
|
||||
|
||||
test edx, $10
|
||||
mov edx, ecx
|
||||
jz @f
|
||||
; 8x16
|
||||
shl edx, 3 + 16 ; x == width
|
||||
mov eax, edx
|
||||
mov edx, ecx
|
||||
shl edx, 4 ; y == hight
|
||||
jmp .exitp
|
||||
@@:
|
||||
; 6x9
|
||||
imul edx, 6 ; x == width
|
||||
shl edx, 16
|
||||
mov eax, edx
|
||||
mov edx, ecx
|
||||
imul edx, 9 ; y == hight
|
||||
.exitp:
|
||||
or eax, edx
|
||||
ret
|
||||
endp
|
||||
|
||||
CODE_END: ; ¬¥âª ª®æ ¯à®£à ¬¬ë; ---------------------------------------------------------------------------- ;
|
||||
; ---------------------------------------------------------------------------- ;
|
||||
;---------------------------------------------------------------------
|
||||
;--- „€<E2809E><E282AC>›… <20><>Žƒ<C5BD>€ŒŒ› ----------------------------------------------
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
proc_info rd 1024
|
||||
|
||||
DATA_END: ; ¬¥âª ª®æ ¤ ëå ¯à®£à ¬¬ë; ---------------------------------------------------------------------------- ;
|
Loading…
Reference in New Issue
Block a user