A library box_lib.obj is reentrant dll.

git-svn-id: svn://kolibrios.org@1214 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Alexey Teplov ( 2009-10-13 18:29:41 +00:00
parent 00c7719786
commit c2639e880a
11 changed files with 101 additions and 58 deletions

View File

@ -151,8 +151,8 @@ aVersion_op db 'version_op',0
check1 check_box 10,45,6,12,0x80AABBCC,0,0,check_text,14,ch_flag_en
check2 check_box 10,60,6,12,0x80AABBCC,0,0,check_text2,15
edit1 edit_box 350,3,5,0xffffff,0x6f9480,0,0xAABBCC,0,308,hed,ed_focus,hed_end-hed-1,hed_end-hed-1
edit2 edit_box 350,3,25,0xffffff,0x6a9480,0,0,0,99,ed_buffer,ed_figure_only
edit1 edit_box 350,3,5,0xffffff,0x6f9480,0,0xAABBCC,0,308,hed,mouse_dd,ed_focus,hed_end-hed-1,hed_end-hed-1
edit2 edit_box 350,3,25,0xffffff,0x6a9480,0,0,0,99,ed_buffer,mouse_dd,ed_figure_only
op1 option_box option_group1,10,90,6,12,0xffffff,0,0,op_text.1,op_text.e1-op_text.1
op2 option_box option_group1,10,105,6,12,0xFFFFFF,0,0,op_text.2,op_text.e2-op_text.2
@ -180,6 +180,8 @@ op_text: ;
ed_buffer rb 100
;-----------------------
;sc system_colors
mouse_dd rd 1
p_info process_information
cur_dir_path rb 4096
library_path rb 4096

View File

@ -1,6 +1,6 @@
ed_struc_size=72
ed_struc_size=76
struc edit_box width,left,top,color,shift_color,focus_border_color,\
blur_border_color,text_color,max,text,flags,size,pos
blur_border_color,text_color,max,text,mouse_variable,flags,size,pos
{
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Bit mask from editbox
@ -37,6 +37,7 @@ ed_height=14 ;
.text_color dd text_color
.max dd max
.text dd text
.mouse_variable dd mouse_variable
.flags dd flags+0
.size dd size+0
.pos dd pos+0

View File

@ -25,68 +25,69 @@ include 'filebrowser.mac' ;macro implements filebrowser
;----------------------------------------------------
;EditBox
;----------------------------------------------------
align 4
align 16
use_editbox_draw ;macro reveals the function of the display.
align 4
align 16
use_editbox_key ;macro reveals processing function of the keypad.
align 4
align 16
use_editbox_mouse ;macro reveals processing function of the mouse.
;----------------------------------------------------
;CheckBox
;----------------------------------------------------
align 4
align 16
use_checkbox_draw ;macro reveals the function of the display.
align 4
align 16
use_checkbox_mouse ;macro reveals processing function of the mouse.
;--------------------------------------------------
;radiobutton Group
;--------------------------------------------------
align 4
align 16
use_optionbox_driver ;macro that control the operating modes
align 4
align 16
use_optionbox_draw ;macro reveals the function of the display.
align 4
align 16
use_optionbox_mouse ;macro reveals processing function of the mouse.
;--------------------------------------------------
;scrollbar Group
;--------------------------------------------------
align 4
align 16
use_scroll_bar
align 4
align 16
use_scroll_bar_vertical
align 4
align 16
use_scroll_bar_horizontal
;--------------------------------------------------
;dinamic button Group
;--------------------------------------------------
align 4
align 16
use_dinamic_button
;--------------------------------------------------
;menubar Group
;--------------------------------------------------
align 4
align 16
use_menu_bar
;--------------------------------------------------
;filebrowser Group
;--------------------------------------------------
align 4
align 16
use_file_browser
;--------------------------------------------------
;align 16
init:
ret
;;;;;;;;;;;
;;Data
;;;;;;;;;;;
align 4
mouse_flag dd 0x0
;align 16
;mouse_flag dd 0x0
align 16

View File

@ -111,9 +111,9 @@ pusha
jc check_box_mouse_end ;если CF=1 то перейти в конец т.е. это выход
mov esi,dword ch_text_length ;загрузить кол-во символов в текстовой строке
;Умножение на 6 Быстрое умножение можно воспользоваться любым мз методов, но на старых Процессорах (386,486,P1)быстрее будет с инструкцией Lea
;lea esi,[eax*2+eax]
;shl eax,1
imul esi,6 ; или можно и так умножить на 6
lea esi,[eax*3]
shl esi,1
; imul esi,6 ; или можно и так умножить на 6
add esi,dword ch_text_margin ;добавить 3 - расстояние от чек бокса до надписи
mov eax,37 ;получим координаты мышки

View File

@ -1,6 +1,15 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Basic macros for use editbox ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
macro init_editbox
{
pushad
mcall
popad
}
macro use_editbox_draw
{
edit_box:
@ -14,14 +23,15 @@ ed_blur_border_color equ [edi+24] ;梥
ed_text_color equ [edi+28] ;梥â ⥪áâ 
ed_max equ [edi+32] ;ª®«-¢® ᨬ¢®«®¢ ª®â®àë¥ ¬®¦­® ¬ ªá¨¬ «ì­® ¢¢¥áâ¨
ed_text equ [edi+36] ;㪠§ â¥«ì ­  ¡ãä¥à
ed_flags equ [edi+40] ;ä« £¨
ed_size equ [edi+44] ;ª®«-¢® ᨬ¢®«®¢
ed_pos equ [edi+48] ;¯®§¨æ¨ï ªãàá®à 
ed_offset equ [edi+52] ;ᬥ饭¨¥
cl_curs_x equ [edi+56] ;¯à¥¤ë¤ã饥 ª®®à¤¨­ â  ªãàá®à  ¯® å
cl_curs_y equ [edi+60] ;¯à¥¤ë¤ã饥 ª®®à¤¨­ â  ªãàá®à  ¯® ã
ed_shift_pos equ [edi+64] ;¯®«®¦¥­¨¥ ªãàá®à 
ed_shift_pos_old equ [edi+68] ;áâ à®¥ ¯®«®¦¥­¨¥ ªãàá®à 
ed_mouse_variable equ [edi+40] ; 㪠§ â¥«ì ­  ¯¥à¥¬¥­­ãî ¤«ï ¡®ªá /£à㯯ë
ed_flags equ [edi+44] ;ä« £¨
ed_size equ [edi+48] ;ª®«-¢® ᨬ¢®«®¢
ed_pos equ [edi+52] ;¯®§¨æ¨ï ªãàá®à 
ed_offset equ [edi+56] ;ᬥ饭¨¥
cl_curs_x equ [edi+60] ;¯à¥¤ë¤ã饥 ª®®à¤¨­ â  ªãàá®à  ¯® å
cl_curs_y equ [edi+64] ;¯à¥¤ë¤ã饥 ª®®à¤¨­ â  ªãàá®à  ¯® ã
ed_shift_pos equ [edi+68] ;¯®«®¦¥­¨¥ ªãàá®à 
ed_shift_pos_old equ [edi+72] ;áâ à®¥ ¯®«®¦¥­¨¥ ªãàá®à 
ed_figure_only= 1000000000000000b ;®¤­¨ ᨬ¢®«ë
ed_always_focus= 100000000000000b
@ -62,7 +72,7 @@ ed_height=14 ;
;--- à¨á㥬 ªãàá®à ---
;--- ¬®¦¥â ¥£® ­¥ ­ ¤® à¨á®¢ âì ----
test word ed_flags,ed_focus
je @f
jz @f
call .draw_cursor
@@:
call .draw_text
@ -138,14 +148,18 @@ pushad
test eax,1
jnz edit_box_mouse.mouse_left_button
and word ed_flags,ed_mouse_on_off
xor ebx,ebx
mov dword [mouse_flag],ebx
mov ebx,dword ed_mouse_variable
push 0
pop dword [ebx]
; mov dword [ebx],ebx
jmp edit_box.editbox_exit
.mouse_left_button:
;----------------------------------------------------------
;--- ¡«®ª¨à®¢ª  ®â 䮪ãá¨à®¢ª¨ ¢ ¤àã£¨å ¡®ªá å ¯à¨ ¯®¯ ¤ ­¨¨ ­  ­¨å ªãàá®à 
;----------------------------------------------------------
mov eax,dword [mouse_flag]
mov eax,dword ed_mouse_variable
push dword [eax]
pop eax
test eax,eax
jz @f
cmp eax,edi
@ -435,7 +449,8 @@ edit_box_key.sh_cl_:
push ebx ;¡®«ì襥
jmp edit_box_key.sh_n1
;¥á«¨ ¨­ ç¥
edit_box_key.sh_n: push ebx
edit_box_key.sh_n:
push ebx
push eax
edit_box_key.sh_n1:
call edit_box.check_offset
@ -920,7 +935,8 @@ popa
stosb
;--------
loop @b
edit_box_key.In_k: cld
edit_box_key.In_k:
cld
pop eax
mov al,ah
stosb
@ -1015,7 +1031,8 @@ edit_box_key.draw_all2:
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;--- ­ ¦ â  ª« ¢¨è  left ---
edit_box_key.left: mov ebx,ed_pos
edit_box_key.left:
mov ebx,ed_pos
test ebx,ebx
jz edit_box_key.sh_st_of
or word ed_flags,ed_left_fl
@ -1025,7 +1042,8 @@ edit_box_key.left: mov ebx,ed_pos
jmp edit_box.draw_cursor_text
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;--- ­ ¦ â  ª« ¢¨è  right ---
edit_box_key.right: mov ebx,ed_pos
edit_box_key.right:
mov ebx,ed_pos
cmp ebx,ed_size
je edit_box_key.sh_st_of
and word ed_flags,ed_right_fl
@ -1218,7 +1236,16 @@ edit_box_mouse._mshift:
mov dword ed_shift_pos,eax
or word ed_flags,ed_mouse_on
mov dword ed_pos,eax
mov dword [mouse_flag],edi ;ãáâ ­®¢¨¬ ¨¤¥­â¨ä¨ª â®à
; mov dword [mouse_flag],edi ;ãáâ ­®¢¨¬ ¨¤¥­â¨ä¨ª â®à
mov ebx,dword ed_mouse_variable
push edi
pop dword [ebx]
bts word ed_flags,1 ;ãáâ ­®¢ª  䮪ãá 
jmp edit_box_mouse.m_sh
@@:
@ -1229,7 +1256,8 @@ edit_box_mouse._mshift:
mov ebx,dword ed_shift_pos
call edit_box_key.sh_cl_
or word ed_flags,ed_mous_adn_b ;ãáâ ­®¢¨¬ ¡¨â çâ® ¬ë ¢ë¤¥«¨«¨ +shift_on +
edit_box_mouse.m_sh: call edit_box.draw_text
edit_box_mouse.m_sh:
call edit_box.draw_text
call edit_box.draw_cursor
;----------------------------------------------------------
;--- ¯à®æ¥¤ãà  ãáâ ­®¢ª¨ 䮪ãá  ---------------------------
@ -1350,9 +1378,9 @@ ed_mouse_on_off=1111111011111111b
ed_height=24 ; ¢ëá®â 
}
ed_struc_size=72
ed_struc_size=76
struc edit_box width,left,top,color,shift_color,focus_border_color,\
blur_border_color,text_color,max,text,flags,size,pos
blur_border_color,text_color,max,text,mouse_variable,flags,size,pos
{
.width dd width
.left dd left
@ -1364,6 +1392,7 @@ struc edit_box width,left,top,color,shift_color,focus_border_color,\
.text_color dd text_color
.max dd max
.text dd text
.mouse_variable dd mouse_variable
.flags dd flags+0
.size dd size+0
.pos dd pos+0

View File

@ -1,6 +1,15 @@
<Lrz> Теплов Алексей, Челябинск.
Пример простого использования editbox в библиотеке,
EditBox переписан для работы в библиотеке.
Дата 14.10.2009
Библиотека польностью реентерабельна. Для edit_box необходиом внести в текущем приложении переменную типа mouse_dd dd ?
а в структуре макроса бокса добавить 1 элемент <указатель на переменную mouse_dd>
ed_struc_size=76
struc edit_box width,left,top,color,shift_color,focus_border_color,\
blur_border_color,text_color,max,text,<указатель на переменную mouse_dd>,flags,size,pos
Дата 25.06.2008
сделана поддержка запуска ассемблерного примера при расположении текущей библиотеки по 2-м местам
1. /sys/lib/box_lib.obj и когда библиотека находиться в папке с программой.

View File

@ -602,10 +602,10 @@ status label 5,201,0,no_shoot
labels_end:
editboxes:
edit1 edit_box 300,5,35,cl_white,0xaabbcc,0,0,0,300,ed_buffer.1,ed_focus,10,10 ; ¯ãâì ª ä ©«ã
edit2 edit_box 35,75,134,cl_white,0xaabbcc,0,0,0,9,ed_buffer.2,ed_figure_only,3,3 ; § ¤¥à¦ª 
edit3 edit_box 35,165,164,cl_white,0xaabbcc,0,0,0,9,ed_buffer.3,ed_figure_only ;  ¢â®­ã¬¥à æ¨ï
edit4 edit_box 16,165,181,cl_white,0xaabbcc,0,0,0,1,sign_n_input,ed_figure_only,1
edit1 edit_box 300,5,35,cl_white,0xaabbcc,0,0,0,300,ed_buffer.1,mouse_dd,ed_focus,10,10 ; ¯ãâì ª ä ©«ã
edit2 edit_box 35,75,134,cl_white,0xaabbcc,0,0,0,9,ed_buffer.2,mouse_dd,ed_figure_only,3,3 ; § ¤¥à¦ª 
edit3 edit_box 35,165,164,cl_white,0xaabbcc,0,0,0,9,ed_buffer.3,mouse_dd,ed_figure_only ;  ¢â®­ã¬¥à æ¨ï
edit4 edit_box 16,165,181,cl_white,0xaabbcc,0,0,0,1,sign_n_input,mouse_dd,ed_figure_only,1
editboxes_end:
buttons:
@ -806,6 +806,7 @@ set_rect_window_procinfo procinfo ;
shoot_esp rb 512 ; á⥪ ¯®â®ª  ä®âª ­ìï
set_rect_window_esp rb 512 ; á⥪ ®ª­  ®¡« áâ¨
; app_end ; ª®­¥æ ¯à®£à ¬¬ë
mouse_dd rd 1
align 4
cur_dir_path rb 4096
library_path rb 4096

View File

@ -264,15 +264,15 @@ aVersion_op db 'version_op',0
rect_input:
.left edit_box 35,95,5,cl_white,0,0,0,5,rect_input_buffer.left,\
ed_figure_only+ed_focus
mouse_dd1,ed_figure_only+ed_focus
.top edit_box 35,95,25,cl_white,0,0,0,5,rect_input_buffer.top,\
ed_figure_only
mouse_dd1,ed_figure_only
.width edit_box 35,95,45,cl_white,0,0,0,5,rect_input_buffer.width,\
ed_figure_only
mouse_dd1,ed_figure_only
.height edit_box 35,95,65,cl_white,0,0,0,5,rect_input_buffer.height,\
ed_figure_only
mouse_dd1,ed_figure_only
rect_input_end:
mouse_dd1 rd 1
rect_input_labels:
.left label 10,10,0,rect_input_labels_text.left
.top label 10,30,0,rect_input_labels_text.top

View File

@ -658,7 +658,7 @@ aEdit_box_mouse db 'edit_box_mouse',0
;aOption_box_mouse db 'option_box_mouse',0
;aVersion_op db 'version_op',0
edit1 edit_box 350,(64-offset_x),(398-offset_y),0xffffff,0x6f9480,0,0xAABBCC,0,start_application_c,start_application,ed_focus,start_application_e,start_application_e
edit1 edit_box 350,(64-offset_x),(398-offset_y),0xffffff,0x6f9480,0,0xAABBCC,0,start_application_c,start_application,mouse_dd,ed_focus,start_application_e,start_application_e
list_start dd 0
@ -724,7 +724,7 @@ start_application_c=$-start_application-1
I_END:
winxpos rd 1
winypos rd 1
mouse_dd rd 1
cpu_percent rd 1
tcolor rd 1
list_add rd 1

View File

@ -281,7 +281,7 @@ draw_window:
title db appname,version,0
editbox:
edit1 edit_box 170,10,113,0xffffff,0xaabbcc,0,0,0,512,path4,ed_focus,26,26
edit1 edit_box 170,10,113,0xffffff,0xaabbcc,0,0,0,512,path4,mouse_dd,ed_focus,26,26
editbox_end:
if lang eq ru
@ -366,7 +366,7 @@ path4 db '/hd0/1/kolibri/kolibri.img',0 ;
rb 514
sc system_colors
mouse_dd rd 1
cur_dir_path rb 4096
library_path rb 4096
align 4

View File

@ -238,7 +238,7 @@ draw_status_text:
ret
run_but txt_button 0,5,15,25,2,0,0,run_but_text,
input_fn edit_box 0,5,5,0xffffff,0x6a9480,0,0xaaaaaa,0,511,fn,ed_focus+ed_always_focus
input_fn edit_box 0,5,5,0xffffff,0x6a9480,0,0xaaaaaa,0,511,fn,mouse_dd,ed_focus+ed_always_focus
;mouse_flag: dd 0x0
if lang eq ru
@ -316,7 +316,7 @@ procinfo process_information
run_par rb 256
par rb 256
fn rb 512
mouse_dd rd 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cur_dir_path rb 4096
library_path rb 4096