1) new function 'edit_box_set_text' in 'box_lib'

2) small updates in 'fasm', 'planet_v', 'nu_pogodi'

git-svn-id: svn://kolibrios.org@1619 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2010-09-17 16:05:21 +00:00
parent 1362808317
commit 37863c906d
9 changed files with 138 additions and 29 deletions

View File

@ -334,21 +334,9 @@ fun_opn_dlg: ;
mov [edit3.size],edi
mov [edit3.pos],edi
;xor al,al
mov edi,dword[OpenDialog_data.filename_area]
mov ebx,edi ;copy text pointer
mov ecx,dword[edit1.max]
;cld
repne scasb
sub edi,ebx ;edi = strlen(OpenDialog_data.filename_area)
mov ecx,edi
dec edi
mov [edit1.size],edi
mov [edit1.pos],edi
mov esi,dword[OpenDialog_data.filename_area]
mov edi,dword[edit1.text]
;cld
rep movsb
push dword [OpenDialog_data.filename_area]
push dword edit1
call dword [edit_box_set_text]
push dword edit1
call dword [edit_box_draw]
@ -456,10 +444,11 @@ end if
align 4
import_box_lib:
edit_box_draw dd aEdit_box_draw
edit_box_key dd aEdit_box_key
edit_box_mouse dd aEdit_box_mouse
;version_ed dd aVersion_ed
edit_box_draw dd aEdit_box_draw
edit_box_key dd aEdit_box_key
edit_box_mouse dd aEdit_box_mouse
edit_box_set_text dd aEdit_box_set_text
;version_ed dd aVersion_ed
check_box_draw dd aCheck_box_draw
check_box_mouse dd aCheck_box_mouse
@ -470,6 +459,7 @@ import_box_lib:
aEdit_box_draw db 'edit_box',0
aEdit_box_key db 'edit_box_key',0
aEdit_box_mouse db 'edit_box_mouse',0
aEdit_box_set_text db 'edit_box_set_text',0
;aVersion_ed db 'version_ed',0
aCheck_box_draw db 'check_box_draw',0

View File

@ -125,6 +125,7 @@ dd sz_version, 0x00000001
dd sz_edit_box, edit_box
dd sz_edit_box_key, edit_box_key
dd sz_edit_box_mouse, edit_box_mouse
dd sz_edit_box_set_text, edit_box_set_text
dd szVersion_ed, 0x00000001
dd sz_check_box_draw, check_box_draw
@ -222,6 +223,7 @@ sz_version db 'version',0
sz_edit_box db 'edit_box',0
sz_edit_box_key db 'edit_box_key',0
sz_edit_box_mouse db 'edit_box_mouse',0
sz_edit_box_set_text db 'edit_box_set_text',0
szVersion_ed db 'version_ed',0
sz_check_box_draw db 'check_box_draw',0

View File

@ -257,6 +257,7 @@ tl_err_load_caption equ 1b ;
tl_err_load_info_size equ 100b ;­¥ ᮢ¯ ¤ ¥â à §¬¥à ¨­ä®à¬ æ¨®­­®© áâàãªâãàë ¯à¨ ®âªàë⨨
tl_load_mode_add equ 0x20000 ;®¯æ¨ï áç¨â뢠­¨ï ¢ ०¨¬¥ ¤®¡ ¢«¥­¨ï ¨­ä®à¬ æ¨¨
tl_save_load_heder_size equ 26 ;à §¬¥à § £®«®¢ª  ¤«ï § ¯¨á¨/ç⥭¨ï í«¥¬¥­â®¢
tl_offs_box equ 58 ;­ ç «® BOX áâàãªâãàë ¤«ï tree_list
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Basic macros for use TextEditor ;

View File

@ -12,6 +12,8 @@
<ul>
<li><a href="#fun_key">edit_box_key</a></li>
<li><a href="#fun_mouse">edit_box_mouse</a></li>
<li><a href="#fun_draw">edit_box_draw</a></li>
<li><a href="#fun_set_text">edit_box_set_text</a></li>
<li><a href="#version">version_ed</a></li>
</ul>
<p><a href="#struc_editbox">Ñòðóêòóðà editbox</a></p>
@ -30,6 +32,18 @@
<h2><a name="fun_mouse">edit_box_mouse</a></h2>
<p>Ýòà ôóíêöèÿ äîëæíà âûçûâàòñÿ ïðè ââîäå èíôîðìàöèè ñ ìûøè.</p>
<h2><a name="fun_draw">edit_box_draw</a></h2>
<p>Эта функция должна вызыватся при вводе перерисовке элемента.</p>
<h2><a name="fun_set_text">edit_box_set_text</a></h2>
<p>Эта функция копирует текст из указателя в текстовое поле. Если текст в указателе окажется длиннее чем допустимый в элементе edit_box, то он запишется не весь. После вызова данной функции необходимо перерисовать окно функцией edit_box_draw, иначе изменения будут сразу не видны. Пример использования:</p>
<pre> push dword buf
push dword edit1
call dword [edit_box_set_text]
.........
buf db '111-222-333',0</pre>
<p>где <b>edit1</b> - структура элемента edit_box; <b>buf</b> - буфер, в котором содержится устанавливаемый текст.</p>
<h2><a name="version">version_ed</a></h2>
<p>Âåðñèÿ ýëåìåíòà</p>
@ -74,6 +88,6 @@
<p>Òåêñòîâîå ïîëå â ôîêóñå.</p>
<hr>
<p>Документация обновлялась последний раз 10.01.10.</p>
<p>Документация обновлялась последний раз 17.09.10.</p>
</body>
</html>

View File

@ -327,7 +327,7 @@ ret
;--- ¨§¬¥­ï¥¬ ᬥ饭¨¥ ------------------------------------
;--- ¥á«¨ ᬥ饭¨¥ ¡ë«® ãáâ ­®¢ª  ä« £  ed_offset_cl ¨­ ç¥
; ¥á«¨ ­¨ç¥£® ­¥ ¨§¬¥­¨«®áì â® ¢ëáâ ¢«¥­¨¥ ed_offset_fl
; <20>ι₯© ¨β<C2A8><EFBFBD>© ¬ ΰΰ¨ζ₯ α<>αβ<CEB1>ο­¨ο ͺ<>¬―<C2AC>­­β<C2AD> word ed_flags
; ¢ ®¡é¥© ¡¨â®¢®© ¬ âà¨æ¥ á®áâ®ï­¨ï ª®¬¯®­¥­â®¢ word ed_flags
;----------------------------------------------------------
edit_box.check_offset:
pushad
@ -378,6 +378,31 @@ edit_ex
or word ed_flags,ed_offset_fl
edit_ex
align 4
proc edit_box_set_text, edit:dword, text:dword
pushad
mov edi,dword[edit]
mov ecx,ed_max
inc ecx ;ãç¨â뢠¥¬ ¡ã¤ã饥 ®¡à¥§ ­¨¥ áâப¨ ¤«ï ascii 0
mov edi,dword[text]
xor al,al
cld
repne scasb ;¯®¨áª ¢ áâப¥ edi ᨬ¢®«  al
mov ecx,edi ;ecx = text + ¬¨­. §­ ç¥­¨¥ ¨§: 1) ed_max ¨«¨ 2) ¤«¨­­ë áâப¨ text
mov edi,dword[edit]
mov esi,dword[text]
sub ecx,esi ;ecx = ¤«¨­­  áâப¨ text (­® ­¥ ¡®«ìè¥ ç¥¬ ed_max)
dec ecx
mov ed_size,ecx ;áâ ¢¨¬ ­®¢ë© à §¬¥à áâப¨
mov ed_pos,ecx ;áâ ¢¨¬ ªãàá®à ¢ ª®­¥æ ­®¢®© áâப¨
mov edi,ed_text
repne movsb ;ª®¯¨à®¢ ­¨¥ ⥪á⮢®© áâப¨ text ¢ edit_box
mov byte[edi],0 ;áâ ¢¨¬ ascii 0 ¢ ª®­æ¥ áâப¨
popad
ret
endp
}
macro use_key_func

View File

@ -1,4 +1,5 @@
[Files]
count=2
count=3
g0=nu_pogod.ini
g1=kvaka_za.ini
g1=nu_pogod_n.ini
g2=kvaka_za.ini

View File

@ -918,11 +918,11 @@ draw_window:
or edx,0x73000000
mov edi,hed
mcall ;ᮧ¤ ­¨¥ ®ª­ 
mcall 9,procinfo,-1
cmp byte[game_select_mode],0
jne .select_mode
mcall 9,procinfo,-1
mov edi,buf_displ
mov eax,dword[procinfo.client_box.width]
cmp eax,dword[displ_w]
@ -1015,12 +1015,67 @@ pop esi
jmp @f
.select_mode:
stdcall dword[tl_draw],dword tree1
mov edi,tree1
add edi,tl_offs_box
stdcall draw_rect_border, procinfo.client_box, edi
@@:
mcall 12,2
popad
ret
; äã­ªæ¨ï à¨áã¥â ¯®«ï ¢®ªà㣠¯àאַ㣮«ì­¨ª  user_box
; à §¬¥à ¯®«¥© ¢ëç¨á«ï¥âáï ¨áå®¤ï ¨§ à §¬¥à®¢ client_rect
; ¯à¥¤¯®« £ ¥âáï, çâ® ¢ ¡®«ì設á⢥ á«ãç ¥¢ client_rect > user_box
align 4
proc draw_rect_border, client_rect:dword, user_box:dword
pushad
mov edi,dword[client_rect]
mov esi,dword[user_box]
cmp esi,0
je @f
mov ebx,dword[edi+8] ;+8 = width
inc bx
mov ecx,dword[esi+4] ;+4 = top
mov edx,[sc.work]
mov eax,13
int 0x40 ;top
mov eax,dword[esi+4] ;+4 = top
add eax,dword[esi+12] ;+12 = height
cmp eax,dword[edi+12]
jge .no_bottom
mov ecx,eax
shl ecx,16
mov cx,word[edi+12] ;+12 = bottom
inc cx
sub cx,ax
mov eax,13
int 0x40 ;bottom
.no_bottom:
mov ebx,dword[esi] ;+0 left
mov ecx,dword[esi+4] ;+4 = top
shl ecx,16
mov cx,word[esi+12] ;+12 = height
inc cx
mov eax,13
int 0x40 ;left
mov eax,dword[esi] ;+0 left
add eax,dword[esi+8] ;+8 = width
mov ebx,eax
shl ebx,16
mov bx,word[edi+8] ;+8 = right
sub bx,ax
inc bx
mov eax,13
int 0x40 ;right
@@:
popad
ret
endp
align 4
draw_display:
@ -1168,7 +1223,7 @@ image_data dd 0 ;
image_data_gray dd 0 ;¯ ¬ïâì á ¢à¥¬¥­­ë¬¨ á¥à묨 ¨§®¡à ¦¥­¨ï¬¨ ¢ ä®à¬ â¥ 24-bit, ¨§ ª®â®àëå ¡ã¤ãâ ᮧ¤ ¢ âìáï âà ä à¥âë
run_file_70 FileInfoBlock
hed db 'Nu pogodi 08.09.10',0 ;ŻŽ¤Ż¨áě ŽŞ­ 
hed db 'Nu pogodi 17.09.10',0 ;¯®¤¯¨áì ®ª­ 
sc system_colors ;á¨á⥬­ë¥ 梥â 
count_of_dir_list_files equ 10

View File

@ -0,0 +1,22 @@
[Files]
displ_w=315
displ_h=210
file_decorat=curici.png
file_unit=wolf.png
file_objects=eggs.png
file_lost=chi.png
offs_shadow_x=1
offs_shadow_y=1
[Game]
delay_a=65
delay_b=35
delay_min=15
[Colors]
background=0,0,0 ;öâåò ôîíà
shadows=255,255,255 ;öâåò òåíåé
unit=255,255,255 ;öâåò èãðàêà
objects=0,255,255 ;öâåò äâèãàþùèõñÿ ïðåäìåòîâ
lost=255,0,0 ;öâåò ïðîïóùåííûõ ïðåäìåòîâ
dec0=0,0,128
dec1=128,128,128
dec2=0,128,0

View File

@ -428,13 +428,13 @@ pushad
mov edx,txt_met_sh
int 0x40
mov ecx,[sc.work_text]
or ecx,0x80000000
mov ebx,175*65536+13
mov edx,txt_cache
int 0x40
mov ecx,[sc.work_text]
or ecx,0x80000000
mov bx,di
;add bx,450-otst_panel_left
shl ebx,16
@ -856,7 +856,6 @@ fun_opn_dlg: ;
stdcall [OpenDialog_Start],OpenDialog_data
cmp [OpenDialog_data.status],2
je @f
mov esi,[OpenDialog_data.openfile_path]
stdcall [str_len],dword[edit1.text],dword[edit1.max]
mov [edit1.size],eax
mov [edit1.pos],eax