fix interface calculating,

fix scroll broken in 6352,
fix keyboard function

git-svn-id: svn://kolibrios.org@6357 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2016-03-19 09:57:37 +00:00
parent 33d91d9843
commit 6f44ae55dd
11 changed files with 183 additions and 216 deletions

View File

@ -43,6 +43,21 @@ include '../../../libio.inc'
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
;---------------------------------------------------------
; *** ª®­áâ ­âë ¤«ï ¨­â¥àä¥©á  ***
; ®ª­® । ªâ®à 
ci_edit_wnd_x_pos equ 5 ;ª®®à¤¨­ â  x ¤«ï ®ª­  । ªâ®à 
ci_edit_wnd_y_pos equ 87 ;ª®®à¤¨­ â  y ¤«ï ®ª­  । ªâ®à 
ci_edit_wnd_border equ 3 ;à ¬ª  ¢®ªà㣠®ª­  । ªâ®à 
; áªà®««¨­£¨
ci_scrollh_coord_x_min equ (ci_edit_wnd_x_pos+3) ;¬¨­¨¬ «ì­ ï ¯®§¨æ¨ï ¯®«§ã­ª 
;£®à¨§®­â «ì­®£® áªà®««¨­£ 
ci_scrollv_coord_y_min equ (ci_edit_wnd_y_pos+3) ;¬¨­¨¬ «ì­ ï ¯®§¨æ¨ï ¯®«§ã­ª 
;¢¥à⨪ «ì­®£® áªà®««¨­£ 
;---------------------------------------------------------
include 'bmplib.inc'
include 'dialog2.inc'
include 'design.inc'
@ -59,9 +74,7 @@ load_libraries l_libs_start,end_l_libs
cmp eax,-1
jz close
;--------------------------------------------------------
;---------------set events mask--------------------------
;--------------------------------------------------------
mcall SF_SET_EVENTS_MASK,0x80000067 ; 1100111b
;---------------------------------------------------------
;-----------------------init data-------------------------
@ -138,9 +151,6 @@ copy_str_1:
jnz @b
ret
;---------------------------------------------------------------------
;---------------------------------------------------------
;---------------------------------------------------------
;---------------------------------------------------------
include 'events.inc'
include 'events_of_window.inc'
include 'events_of_keys.inc'
@ -177,25 +187,18 @@ file 'panel_buttons.png'
;****************cursors******************
brush_cursor:
file 'brush.cur'
;----------------------------------------------------------
flood_fill_cursor:
file 'flood_fill.cur'
;----------------------------------------------------------
lastik_cursor:
file 'lastik.cur'
;----------------------------------------------------------
other_cursor:
file 'other.cur'
;----------------------------------------------------------
pencil_cursor:
file 'pencil.cur'
;----------------------------------------------------------
pipette_cursor:
file 'pipette.cur'
;----------------------------------------------------------
spray_cursor:
file 'spray.cur'
;----------------------------------------------------------
zoom_cursor:
file 'zoom.cur'
;----------------------------------------------------------
@ -268,7 +271,7 @@ Scroll1CoordinatX rd 1 ;scroll x screen position
Scroll1CoordinatY rd 1 ;scroll y screen position
Scroll1MaxSizeX rd 1
Scroll1MaxSizeY rd 1
Scroll1SizeX rd 1
Scroll1SizeX rd 1 ;scroll polzunok size
Scroll1FreeX rd 1
Scroll2CoordinatX rd 1

View File

@ -1,4 +1,10 @@
;----------------------------------------------------------
;input:
; eax - start X
; ebx - start Y
; ecx - size X
; edx - size Y
; esi - colos styles (1...7)
draw_volume_rectangle:
mov [line_x],eax
mov [line_y],ebx
@ -83,7 +89,7 @@ exit_colors:
add ebx,[line_size_x]
add ecx,[line_size_y]
mov edx,[color_rectangle]
call draw_rectangle
mcall SF_DRAW_RECT
;line 1
mov edx,[color_line1]
mov ebx,[line_x]
@ -197,14 +203,13 @@ no_light_rectangle:
mov [line_size_x],ecx
mov [line_size_y],edx
mov edx,esi
mov eax,13
mov ebx,[line_x]
mov ecx,[line_y]
shl ebx,16
shl ecx,16
add ebx,[line_size_x]
add ecx,[line_size_y]
mcall
mcall SF_DRAW_RECT
ret
;----------------------------------------------------------
draw_conture:
@ -280,20 +285,14 @@ columnus_true:
print_text:
mov [text_x],eax
mov [text_y],ebx
mov eax,4
mov ebx,[text_x]
shl ebx,16
add ebx,[text_y]
mcall
mcall SF_DRAW_TEXT
ret
;----------------------------------------------------------
draw_rectangle:
mcall 13
ret
;------------------------
draw_line:
mov eax,38
mcall
mcall SF_DRAW_LINE
ret
;----------------------------------------------------------
;lightlin 12508927

View File

@ -1,15 +1,29 @@
;----------------------------------------------------------
;---------------------system events------------------------
;----------------------------------------------------------
align 4
event:
mov eax,10
mcall
mcall SF_WAIT_EVENT
ret
;---------------------------------------------------------
;---------------SOUND of EVENTS---------------------------
;---------------------------------------------------------
;----------------------------------------------------------
;---------------------sound of events----------------------
;----------------------------------------------------------
align 4
sound:
mov eax,55
mov ebx,eax
mcall
mcall SF_SPEAKER_PLAY,55
ret
;----------------------------------------------------------
;---------------------user events--------------------------
;----------------------------------------------------------
;description:
; ¯¥à¥¬¥é¥­¨¥ áªà®««¨­£®¢ ¢ «¥¢ë© ¢¥àå­¨© 㣮« (0,0)
align 4
scrollbar_move_00:
and [PosX],0
and [PosY],0
mov [Scroll1CoordinatX],ci_scrollh_coord_x_min
mov [Scroll2CoordinatY],ci_scrollv_coord_y_min
ret

View File

@ -1,86 +1,81 @@
;------------------------------------------
;-------------KEYS-------------------------
;------------------------------------------
align 4
keys:
mov eax,2
mcall
mcall SF_GET_KEY
shr eax,8
cmp eax,176
cmp al,176
jne key2
sub [PosX],20
jmp change_screen
key2:
cmp eax,179
cmp al,179
jne key3
add [PosX],20
jmp change_screen
key3:
cmp eax,177
cmp al,177
jne key4
add [PosY],20
jmp change_screen
key4:
cmp eax,178
cmp al,178
jne key5
sub [PosY],20
jmp change_screen
key5:
cmp eax,49
cmp al,49 ;1
jne key6
mov [k],1
mov [Scroll1CoordinatX],9
mov [Scroll2CoordinatY],89
call scrollbar_move_00
call drawwin
jmp change_screen
key6:
cmp eax,50
cmp al,50 ;2
jne key7
mov [k],2
mov [Scroll1CoordinatX],9
mov [Scroll2CoordinatY],89
call scrollbar_move_00
call drawwin
jmp change_screen
key7:
cmp eax,52
cmp al,52 ;4
jne key8
mov [k],4
mov [Scroll1CoordinatX],9
mov [Scroll2CoordinatY],89
call scrollbar_move_00
call drawwin
jmp change_screen
key8:
cmp eax,56
cmp al,56 ;8
jne key9
mov [k],8
mov [Scroll1CoordinatX],9
mov [Scroll2CoordinatY],89
call scrollbar_move_00
call drawwin
jmp change_screen
key9:
cmp eax,48
cmp al,48 ;0
jne key10
mov [k],16
mov [Scroll1CoordinatX],9
mov [Scroll2CoordinatY],89
call scrollbar_move_00
call drawwin
jmp change_screen
key10:
cmp eax,255
cmp al,255
jne key11
call analizing_picture_to_palette
call drawwin
jmp change_screen
key11:
cmp eax,27
jne still
;cmp al,27 ;Esc
;jne still
jmp still
mov eax,CursorsID
call delete_cursors
close:
mov eax,-1
mcall
mcall SF_TERMINATE_PROCESS
jmp still

View File

@ -45,8 +45,8 @@ no_redraw_panel:
mov ebx,[MouseY]
mov ecx,[WorkScreen_SizeX]
mov edx,[WorkScreen_SizeY]
add ecx,9
add edx,89
add ecx,ci_scrollh_coord_x_min
add edx,ci_scrollv_coord_y_min
cmp eax,ecx
jae mouse_scroll
@ -74,13 +74,13 @@ mouse_scroll:
test eax,eax
jz no_horizontal
mov eax,9
mov eax,ci_scrollh_coord_x_min
mov ebx,[Scroll1CoordinatY]
mov ecx,[Scroll1MaxSizeX]
inc ecx
mov edx,14+10
mov esi,7
inc ecx
call draw_volume_rectangle
call draw_volume_rectangle ; horizontal scrollbar clear
mov eax,[MouseX]
mov ebx,[Scroll1SizeX]
@ -88,13 +88,13 @@ mouse_scroll:
sub eax,ebx
mov ecx,[MouseX]
add ecx,ebx
mov edx,8+1
mov edx,ci_scrollh_coord_x_min
add edx,[Scroll1MaxSizeX]
mov [Scroll1CoordinatX],eax
sub eax,9
sub eax,ci_scrollh_coord_x_min
jns no_min_scroll
mov [Scroll1CoordinatX],9
mov [Scroll1CoordinatX],ci_scrollh_coord_x_min
no_min_scroll:
cmp ecx,edx
@ -106,7 +106,7 @@ no_min_scroll:
no_max_scroll:
mov eax,[Scroll1CoordinatX]
sub eax,9
sub eax,ci_scrollh_coord_x_min
mov ebx,[Picture_SizeX]
imul eax,ebx
mov ebx,[Scroll1MaxSizeX]
@ -127,12 +127,12 @@ no_horizontal:
jz no_vertical
mov eax,[Scroll2CoordinatX]
mov ebx,89
mov ebx,ci_scrollv_coord_y_min
mov ecx,14+10
mov edx,[Scroll2MaxSizeY]
mov esi,7
inc edx
call draw_volume_rectangle
mov esi,7
call draw_volume_rectangle ; vertical scrollbar clear
mov eax,[MouseY]
mov ebx,[Scroll2SizeY]
@ -140,14 +140,14 @@ no_horizontal:
sub eax,ebx
mov ecx,[MouseY]
add ecx,ebx
mov edx,89
mov edx,ci_scrollv_coord_y_min
add edx,[Scroll2MaxSizeY]
mov [Scroll2CoordinatY],eax
sub eax,89
sub eax,ci_scrollv_coord_y_min
jns no_min_scroll2
mov [Scroll2CoordinatY],89
mov [Scroll2CoordinatY],ci_scrollv_coord_y_min
no_min_scroll2:
cmp ecx,edx
@ -159,7 +159,7 @@ no_min_scroll2:
no_max_scroll2:
mov eax,[Scroll2CoordinatY]
sub eax,89
sub eax,ci_scrollv_coord_y_min
mov ebx,[Picture_SizeY]
imul eax,ebx
mov ebx,[Scroll2MaxSizeY]
@ -183,13 +183,13 @@ no_scrollers:
sub ecx,36
sub edx,35
cmp eax,9
cmp eax,ci_scrollh_coord_x_min
jle not_work_arrea
cmp eax,ecx
jae not_work_arrea
cmp ebx,20+15+1+50
cmp ebx,ci_scrollv_coord_y_min
jle not_work_arrea
cmp ebx,edx

View File

@ -12,27 +12,22 @@ drawwin:
mov edx,[esi+46]
mov [Window_CordinatX],eax
mov [Window_CordinatY],ebx
cmp ecx,585
jae @f
mov ecx,585 ;minimum size x
@@:
cmp [Window_SizeY],400
jae @f
mov edx,400 ;minimum size y
@@:
mov [Window_SizeX],ecx
mov [Window_SizeY],edx
cmp [Window_SizeX],585
jae no_minimum_size_x
mov [Window_SizeX],585
mov ecx,[Window_SizeX]
no_minimum_size_x:
cmp [Window_SizeY],400
jae no_minimum_size_y
mov [Window_SizeY],400
mov edx,[Window_SizeY]
no_minimum_size_y:
mov [MaxWorkScreen_SizeX],ecx
mov [MaxWorkScreen_SizeY],edx
sub [MaxWorkScreen_SizeX],20+10+5+10
sub [MaxWorkScreen_SizeY],20+10+15+1+49+20+10
sub [MaxWorkScreen_SizeX],ci_edit_wnd_x_pos+2*ci_edit_wnd_border+34
sub [MaxWorkScreen_SizeY],ci_edit_wnd_y_pos+2*ci_edit_wnd_border+34
cmp [MaxWorkScreen_SizeX],0
jns no_znak1
@ -88,70 +83,52 @@ no_znak2:
call MovePictureToWorkScreen
;------------------------------------------------
mov ebx,[WorkScreen_SizeX]
add ebx,5+3
mov edx,[Window_SizeX]
sub edx,ebx
sub edx,25+10-3
add ebx,ci_edit_wnd_x_pos+ci_edit_wnd_border
shl ebx,16
mov bx,dx
mov bx,ci_edit_wnd_border ;è¨à¨­  ¡®à¤îà 
mov ecx,20+15+1+49+2
mov ecx,ci_edit_wnd_y_pos+ci_edit_wnd_border
mov edx,[Window_SizeY]
mov eax,[WorkScreen_SizeY]
shr eax,16
sub edx,eax
sub edx,20+15+1+49+2+25+10
sub edx,ci_edit_wnd_y_pos+2*ci_edit_wnd_border+34
shl ecx,16
mov cx,dx
mov cx,dx ;¢ëá®â  ¡®à¤îà 
mcall SF_DRAW_RECT,,,0xc7cbcf
mcall SF_DRAW_RECT,,,0xc7cbcf ;¡®à¤îà á¯à ¢  ®â ®ª­  ¯¥à¥¤ áªà®««¨­£®¬
;------------------------------------------------
mcall ,<5,3>
mcall ,<ci_edit_wnd_x_pos,ci_edit_wnd_border> ;¡®à¤îà á«¥¢  ®â ®ª­ 
;------------------------------------------------
mov ebx,5
mov ebx,ci_edit_wnd_x_pos
mov edx,[Window_SizeX]
mov eax,[WorkScreen_SizeX]
shr eax,16
sub edx,eax
sub edx,25+10
sub edx,25+10+ci_edit_wnd_x_pos
shl ebx,16
mov bx,dx
mov bx,dx ;è¨à¨­  ¡®à¤îà 
mov ecx,[WorkScreen_SizeY]
add ecx,20+15+1+49+2+3
mov edx,[Window_SizeY]
sub edx,ecx
sub edx,25+10-3
add ecx,ci_edit_wnd_y_pos+ci_edit_wnd_border
shl ecx,16
mov cx,dx
mov cx,ci_edit_wnd_border ;¢ëá®â  ¡®à¤îà 
mcall SF_DRAW_RECT,,,0xc7cbcf
mcall SF_DRAW_RECT,,,0xc7cbcf ;¡®à¤îà ¯®¤ ®ª­®¬ ¨ ­ ¤ áªà®««¨­£®¬
;------------------------------------------------
mcall ,,<20+15+1+49+2,3>
mcall ,,<ci_edit_wnd_y_pos,ci_edit_wnd_border> ;¡®à¤îà ¯®¤ ¯ ­¥«ìî ¨ ­ ¤ ®ª­®¬
;------------------------------------------------
; draw_volume_rectangle
; eax - start X
; ebx - start Y
; ecx - size X
; edx - size Y
mov eax,5
mov eax,ci_edit_wnd_x_pos
mov ebx,[Window_SizeY]
mov ecx,[Window_SizeX]
mov edx,20+10
mov esi,3
sub ecx,30
sub ecx,35+ci_edit_wnd_x_pos
sub ebx,25+10
call draw_volume_rectangle ; horizontal scrollbar
call draw_volume_rectangle ; horizontal scrollbar border
;------------------------------------------------
mov eax,[Window_SizeX]
mov ebx,20+15+1+49+2
mov ebx,ci_edit_wnd_y_pos
mov ecx,20+10
mov edx,[Window_SizeY]
mov esi,3
sub eax,25+10
sub edx,20+15+1+49+5+20
call draw_volume_rectangle ; vertical scrollbar
sub edx,35+ci_edit_wnd_y_pos
call draw_volume_rectangle ; vertical scrollbar border
call draw_scrollers
;------------------------------------------------
mov eax,[Window_SizeX]

View File

@ -33,7 +33,6 @@ draw_icons:
main_buttons:
mov eax,8
mov ebx,[Icon_X]
mov ecx,[Icon_Y]
dec ebx
@ -45,7 +44,7 @@ draw_icons:
mov edx,[counter]
add edx,10
add edx,1000000000000000000000000000000b
mcall
mcall SF_DEFINE_BUTTON
add [Icon_X],22
@ -63,7 +62,6 @@ draw_icons:
next_button_brush:
mov eax,8
mov ebx,[Icon_X]
mov ecx,[Icon_Y]
dec ebx
@ -75,7 +73,7 @@ draw_icons:
mov edx,[counter]
add edx,40
add edx,1000000000000000000000000000000b
mcall
mcall SF_DEFINE_BUTTON
add [Icon_X],19
@ -92,7 +90,6 @@ draw_icons:
next_button_zoom:
mov eax,8
mov ebx,[Icon_X]
mov ecx,[Icon_Y]
dec ebx
@ -104,7 +101,7 @@ draw_icons:
mov edx,[counter]
add edx,45
add edx,1000000000000000000000000000000b
mcall
mcall SF_DEFINE_BUTTON
add [Icon_X],19
@ -117,7 +114,6 @@ draw_icons:
mov [Icon_X],7+105+1
mov [Icon_Y],19+15+4+25+1
mov eax,8
mov ebx,[Icon_X]
mov ecx,[Icon_Y]
dec ebx
@ -128,13 +124,12 @@ draw_icons:
add ecx,21
mov edx,51
add edx,1000000000000000000000000000000b
mcall
mcall SF_DEFINE_BUTTON
; button of color
mov [Icon_X],7+128+1
mov [Icon_Y],19+15+4+25+1
mov eax,8
mov ebx,[Icon_X]
mov ecx,[Icon_Y]
dec ebx
@ -145,12 +140,8 @@ draw_icons:
add ecx,20
mov edx,52
add edx,1000000000000000000000000000000b
mcall
mcall SF_DEFINE_BUTTON
mov eax,13
mov ebx,136*65536+19
mov ecx,64*65536+19
mov edx,[Color]
mcall
mcall SF_DRAW_RECT, 136*65536+19,64*65536+19,[Color]
ret

View File

@ -1005,8 +1005,7 @@ TakeButtonInstruments:
cmp eax,45
jne no_1_
mov [k],1
mov [Scroll1CoordinatX],9
mov [Scroll2CoordinatY],89
call scrollbar_move_00
and [Current_instrument],0
call drawwin
jmp still
@ -1017,8 +1016,7 @@ TakeButtonInstruments:
jne no_2_
mov [k],2
call drawwin
mov [Scroll1CoordinatX],9
mov [Scroll2CoordinatY],89
call scrollbar_move_00
and [Current_instrument],0
jmp still
no_2_:
@ -1029,8 +1027,7 @@ TakeButtonInstruments:
jne no_3_
mov [k],3
call drawwin
mov [Scroll1CoordinatX],9
mov [Scroll2CoordinatY],89
call scrollbar_move_00
and [Current_instrument],0
jmp still
no_3_:
@ -1040,8 +1037,7 @@ TakeButtonInstruments:
jne no_4_
mov [k],4
call drawwin
mov [Scroll1CoordinatX],9
mov [Scroll2CoordinatY],89
call scrollbar_move_00
and [Current_instrument],0
jmp still
no_4_:
@ -1051,8 +1047,7 @@ TakeButtonInstruments:
jne no_8_
mov [k],8
call drawwin
mov [Scroll1CoordinatX],9
mov [Scroll2CoordinatY],89
call scrollbar_move_00
and [Current_instrument],0
jmp still
no_8_:
@ -1062,8 +1057,7 @@ TakeButtonInstruments:
jne no_16_
mov [k],16
call drawwin
mov [Scroll1CoordinatX],9
mov [Scroll2CoordinatY],89
call scrollbar_move_00
and [Current_instrument],0
jmp still
no_16_:

View File

@ -60,10 +60,6 @@ prepare_data_pointers:
mov [PointerToPalette],eax
mov [ReserveArray],eax
;®¡­ã«¥­¨¥ áªà®««¨­£ 
and [PosX],0
and [PosY],0
mov [Scroll1CoordinatX],9 ;8+1
mov [Scroll2CoordinatY],89 ;20+15+1+50+3
call scrollbar_move_00 ;®¡­ã«¥­¨¥ áªà®««¨­£ 
ret
;---------------------------------------------------------

View File

@ -267,7 +267,7 @@ PrintMousePos:
mov ecx,52
mov edx,18
mov esi,4
call draw_volume_rectangle
call draw_volume_rectangle ; border for mouse x pos
mov eax,[Window_SizeX]
sub eax,75
@ -275,7 +275,7 @@ PrintMousePos:
mov ecx,52
mov edx,18
mov esi,4
call draw_volume_rectangle
call draw_volume_rectangle ; border for mouse y pos
mov eax,[Window_SizeX]
sub eax,70
@ -344,10 +344,9 @@ draw_scrollers:
mov ebx,[Window_SizeY]
sub ebx,22+10
mov ecx,[Window_SizeX]
sub ecx,10+5+20+10+1
sub ecx,39+ci_scrollh_coord_x_min
mov edx,14+10
mov esi,1
mov [Scroll1CoordinatX],eax
mov [Scroll1CoordinatY],ebx
mov [Scroll1MaxSizeY],edx
mov [Scroll1MaxSizeX],ecx
@ -363,17 +362,16 @@ draw_scrollers:
mov edi,[Scroll1MaxSizeX]
sub edi,ecx
mov [Scroll1FreeX],edi
call draw_volume_rectangle
call draw_volume_rectangle ; horizontal scrollbar polzunok
mov eax,[Window_SizeX]
sub eax,22+10
mov ebx,[Scroll2CoordinatY]
mov ecx,14+10
mov edx,[Window_SizeY]
sub edx,20+15+1+49+10+20+11
sub edx,39+ci_scrollv_coord_y_min
mov esi,1
mov [Scroll2CoordinatX],eax
mov [Scroll2CoordinatY],ebx
mov [Scroll2MaxSizeX],ecx
mov [Scroll2MaxSizeY],edx
@ -389,8 +387,7 @@ draw_scrollers:
mov edi,[Scroll2MaxSizeY]
sub edi,edx
mov [Scroll2FreeY],edi
call draw_volume_rectangle
call draw_volume_rectangle ; vertical scrollbar polzunok
ret

View File

@ -243,14 +243,13 @@ big_pixel_x:
jnz screen_y
fps:
;mcall 18,14
mov ebx,[ScreenPointer]
mov ecx,[WorkScreen_SizeX]
mov edx,[WorkScreen_SizeY]
shl ecx,16
add ecx,edx
mov edx,8*65536+20+15+49+5+1
mov edx,((ci_edit_wnd_x_pos+ci_edit_wnd_border) shl 16)\
+ (ci_edit_wnd_y_pos+ci_edit_wnd_border)
mcall SF_PUT_IMAGE
ret
;----------------------------------------------------------
@ -290,31 +289,25 @@ cleare_work_arrea:
;-----------------------------------------------------------
CalculatePositionScreen:
mov eax,[Picture_SizeX]
mov ebx,[Picture_SizeY]
mov ecx,[CounterX]
mov edx,[CounterY]
sub eax,ecx
sub ebx,edx
sub eax,[CounterX]
cmp [PosX],eax
jle no_limit_screen_x
jle @f
mov [PosX],eax
no_limit_screen_x:
cmp [PosY],ebx
jle no_limit_screen_y
mov [PosY],ebx
no_limit_screen_y:
@@:
cmp [PosX],0
jns no_minimum_screen_x
jns @f
mov [PosX],0
no_minimum_screen_x:
@@:
mov ebx,[Picture_SizeY]
sub ebx,[CounterY]
cmp [PosY],ebx
jle @f
mov [PosY],ebx
@@:
cmp [PosY],0
jns no_minimum_screen_y
jns @f
mov [PosY],0
no_minimum_screen_y:
@@:
ret
;-----------------------------------------------------------
;-----------calculate cordinats on work picture--------------
@ -322,8 +315,16 @@ no_minimum_screen_y:
GetScreenCordinats:
mov eax,[MouseX]
mov ebx,[MouseY]
sub eax,9
sub ebx,87
sub eax,ci_edit_wnd_x_pos+ci_edit_wnd_border
cmp eax,0
jge @f
xor eax,eax
@@:
sub ebx,ci_edit_wnd_y_pos+ci_edit_wnd_border
cmp ebx,0
jge @f
xor ebx,ebx
@@:
mov ecx,[k]
cdq
idiv ecx