forked from KolibriOS/kolibrios
That new in this version:
1) Transfer of parameters to functions of library is copied on the convention stdcall. 2) Now functions link on names. 3)Now, if to guide the mouse on a component and to press the left button of the mouse all messages from the mouse are sent only to this component.If to release(let off) the left button of the mouse messages from the mouse again become accessible to all components. 4) In library new functions are added. int Version (void) - to receive the version of library. The version comes back in a format: year + month + day. The current library has version 71014. void RemoveComponent (void *Control, int new_x, int new_y) - moves a component to new coordinates. void ResizeComponent (void *Control, int new_sizex, int new_sizey) - changes the size of a component. Examples of use of these functions look in example Bookmark. 5) The example of work with libGUI in programming language C is added. This example is a part of the interface written by me for my scientific program. git-svn-id: svn://kolibrios.org@648 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
16
programs/develop/libGUI/src/VERSION.INC
Normal file
16
programs/develop/libGUI/src/VERSION.INC
Normal file
@@ -0,0 +1,16 @@
|
||||
;****************************************************
|
||||
;****************get version of library**************
|
||||
;****************************************************
|
||||
;IN
|
||||
;not
|
||||
;OUT
|
||||
;version of library
|
||||
;fersion format year:mouth:day
|
||||
align 4
|
||||
|
||||
get_version:
|
||||
|
||||
xor eax,eax
|
||||
mov eax,dword 071014 ;07.10.13
|
||||
|
||||
ret
|
1647
programs/develop/libGUI/src/bookmark.inc
Normal file
1647
programs/develop/libGUI/src/bookmark.inc
Normal file
File diff suppressed because it is too large
Load Diff
1437
programs/develop/libGUI/src/button.inc
Normal file
1437
programs/develop/libGUI/src/button.inc
Normal file
File diff suppressed because it is too large
Load Diff
234
programs/develop/libGUI/src/check_box.inc
Normal file
234
programs/develop/libGUI/src/check_box.inc
Normal file
@@ -0,0 +1,234 @@
|
||||
|
||||
cb_control_data_dize = 44
|
||||
|
||||
;****************************************************
|
||||
;****************craete CheckBox**********************
|
||||
;****************************************************
|
||||
;IN
|
||||
;pointer to parend
|
||||
;pointer to CheckBox's structure
|
||||
;OUT
|
||||
;pointer to initialized control
|
||||
align 4
|
||||
|
||||
craete_check_box:
|
||||
|
||||
mov ebx,[esp+4]
|
||||
mov eax,[esp+8]
|
||||
|
||||
mov [PointerToStructureForCheckBox],eax
|
||||
|
||||
mov eax,control_header_size+cb_control_data_dize
|
||||
call craete_control
|
||||
|
||||
;set all CheckBox's parameters in control
|
||||
mov [eax],dword check_box
|
||||
|
||||
mov ecx,cb_control_data_dize
|
||||
mov esi,[PointerToStructureForCheckBox]
|
||||
mov edi,eax
|
||||
add edi,control_header_size
|
||||
rep movsb
|
||||
|
||||
call get_skin_height
|
||||
|
||||
mov ebx,[PointerToStructureForCheckBox]
|
||||
xor ecx,ecx
|
||||
xor edx,edx
|
||||
mov cx,[ebx+2] ;CheckBox x
|
||||
mov dx,[ebx+4] ;CheckBox y
|
||||
mov esi,[ebx+10] ;CheckBox size
|
||||
add ecx,border_width
|
||||
add edx,[skin_height]
|
||||
;copy information to control
|
||||
mov [eax+24],ecx
|
||||
mov [eax+28],edx
|
||||
mov [eax+32],esi
|
||||
mov [eax+36],esi
|
||||
|
||||
ret 8
|
||||
|
||||
;****************************************************
|
||||
;*****************Draw CheckBox**********************
|
||||
;****************************************************
|
||||
;IN
|
||||
;pointer to control of CheckBox
|
||||
;message
|
||||
;OUT
|
||||
;not returned value
|
||||
align 4
|
||||
|
||||
check_box:
|
||||
|
||||
;get message
|
||||
mov eax,[esp+8]
|
||||
|
||||
;get pointer to control of CheckBox
|
||||
mov esi,[esp+4]
|
||||
mov [PointerForCheckBox],esi
|
||||
|
||||
;copy information from control to structure
|
||||
add esi,control_header_size
|
||||
mov edi,dword CheckBox
|
||||
mov ecx,control_header_size+cb_control_data_dize
|
||||
rep movsb
|
||||
|
||||
push eax
|
||||
;load coordinats and size from control
|
||||
mov eax,[PointerForCheckBox]
|
||||
mov ebx,[eax+24] ;x
|
||||
mov ecx,[eax+28] ;y
|
||||
mov edx,[eax+32] ;size
|
||||
;set current coordinats and sizes in CheckBox
|
||||
mov [CheckBox.ch_left],bx
|
||||
mov [CheckBox.ch_top],cx
|
||||
mov [CheckBox.ch_size],edx
|
||||
pop eax
|
||||
|
||||
cmp [eax],dword 1
|
||||
jne no_redraw_all_check_box
|
||||
|
||||
mov eax,13
|
||||
mov bx,[CheckBox.ch_left]
|
||||
mov cx,[CheckBox.ch_top]
|
||||
shl ebx,16
|
||||
shl ecx,16
|
||||
add ebx,[CheckBox.ch_size]
|
||||
add ecx,[CheckBox.ch_size]
|
||||
mov edx,[CheckBox.ch_border_color]
|
||||
mcall
|
||||
|
||||
mov edx,[CheckBox.ch_color]
|
||||
add ebx,1 shl 16 - 2
|
||||
add ecx,1 shl 16 - 2
|
||||
mcall
|
||||
|
||||
mov eax,[CheckBox.ch_size]
|
||||
mov ebx,eax
|
||||
mov ecx,3
|
||||
shr ebx,1
|
||||
cdq
|
||||
idiv ecx
|
||||
mov [CheckBox.ch_size_2],bx
|
||||
mov [CheckBox.ch_size_3],ax
|
||||
|
||||
test word [CheckBox.ch_flags],2
|
||||
jz @f
|
||||
call draw_ch
|
||||
@@:
|
||||
|
||||
movzx ebx,word[CheckBox.ch_left]
|
||||
add ebx,[CheckBox.ch_size]
|
||||
add ebx,[CheckBox.ch_text_margin]
|
||||
shl ebx,16
|
||||
mov bx,[CheckBox.ch_top]
|
||||
add ebx,[CheckBox.ch_size]
|
||||
add ebx,(-9+1)
|
||||
mov ecx,[CheckBox.ch_text_color]
|
||||
|
||||
mov edx,[CheckBox.ch_text_ptr]
|
||||
movzx esi,word [CheckBox.ch_text_length]
|
||||
|
||||
mov eax,4
|
||||
mcall
|
||||
|
||||
jmp exit_check_box
|
||||
no_redraw_all_check_box:
|
||||
|
||||
|
||||
cmp [eax],dword 6
|
||||
jne no_mouse_check_box
|
||||
|
||||
mov esi,[eax+4]
|
||||
mov edi,[eax+8]
|
||||
mov ebx,[eax+12] ;buttons of mouse state
|
||||
mov [CheckBox.mouseX],esi
|
||||
mov [CheckBox.mouseY],edi
|
||||
mov eax,ebx
|
||||
|
||||
test eax,eax
|
||||
jnz @f
|
||||
btr word [CheckBox.ch_flags],2
|
||||
jmp exit_check_box
|
||||
@@:
|
||||
bts word [CheckBox.ch_flags],2
|
||||
jc .mouse_end
|
||||
movzx esi,word [CheckBox.ch_text_length]
|
||||
|
||||
imul esi,6
|
||||
add esi,[CheckBox.ch_text_margin]
|
||||
|
||||
mov eax,[CheckBox.mouseX]
|
||||
shl eax,16
|
||||
add eax,[CheckBox.mouseY]
|
||||
|
||||
xor ebx,ebx
|
||||
|
||||
movzx ebx,word[CheckBox.ch_top]
|
||||
cmp ax,bx
|
||||
jl .mouse_end
|
||||
add ebx,[CheckBox.ch_size]
|
||||
cmp ax,bx
|
||||
jg .mouse_end
|
||||
|
||||
shr eax,16
|
||||
movzx ebx,word[CheckBox.ch_left]
|
||||
cmp ax,bx
|
||||
jl .mouse_end
|
||||
add ebx,[CheckBox.ch_size]
|
||||
add ebx,esi
|
||||
cmp ax,bx
|
||||
jg .mouse_end
|
||||
|
||||
bts word[CheckBox.ch_flags],1
|
||||
jc @f
|
||||
|
||||
call draw_ch
|
||||
|
||||
jmp .mouse_end
|
||||
@@:
|
||||
btr word[CheckBox.ch_flags],1
|
||||
call clear_ch
|
||||
|
||||
.mouse_end:
|
||||
|
||||
no_mouse_check_box:
|
||||
|
||||
exit_check_box:
|
||||
|
||||
;save resultat of work in control
|
||||
mov ecx,cb_control_data_dize ;save in control only flags
|
||||
mov esi,dword CheckBox
|
||||
mov edi,[PointerForCheckBox]
|
||||
add edi,control_header_size
|
||||
cld
|
||||
rep movsb
|
||||
|
||||
ret 8
|
||||
|
||||
;ch_text_margin=4
|
||||
;ch_size=11
|
||||
|
||||
clear_ch:
|
||||
mov edx,[CheckBox.ch_color]
|
||||
jmp @f
|
||||
|
||||
draw_ch:
|
||||
mov edx,[CheckBox.ch_border_color]
|
||||
@@:
|
||||
|
||||
movzx ebx,word[CheckBox.ch_left]
|
||||
add bx,[CheckBox.ch_size_3]
|
||||
shl ebx,16
|
||||
mov bx,[CheckBox.ch_size_2]
|
||||
;mov bp,bx
|
||||
;push bx
|
||||
movzx ecx,word [CheckBox.ch_top]
|
||||
mov eax,13
|
||||
add cx,[CheckBox.ch_size_3]
|
||||
shl ecx,16
|
||||
;mov cx,bp
|
||||
mov cx,[CheckBox.ch_size_2]
|
||||
mcall
|
||||
|
||||
ret
|
26
programs/develop/libGUI/src/check_crossing_box.inc
Normal file
26
programs/develop/libGUI/src/check_crossing_box.inc
Normal file
@@ -0,0 +1,26 @@
|
||||
;eax - x1
|
||||
;ebx - y1
|
||||
;ecx - size x
|
||||
;edx - size y
|
||||
;esi - x2
|
||||
;edi - y2
|
||||
;if crossing than eax=0xffffff
|
||||
|
||||
CheckCrossingBox:
|
||||
|
||||
add ecx,eax
|
||||
add edx,ebx
|
||||
|
||||
cmp esi,eax
|
||||
jl exit_crossing
|
||||
cmp esi,ecx
|
||||
ja exit_crossing
|
||||
cmp edi,ebx
|
||||
jl exit_crossing
|
||||
cmp edi,edx
|
||||
ja exit_crossing
|
||||
xor eax,eax
|
||||
mov eax,0xffffff
|
||||
exit_crossing:
|
||||
|
||||
ret
|
1
programs/develop/libGUI/src/config.inc
Normal file
1
programs/develop/libGUI/src/config.inc
Normal file
@@ -0,0 +1 @@
|
||||
__CPU_type fix p5
|
131
programs/develop/libGUI/src/debug.inc
Normal file
131
programs/develop/libGUI/src/debug.inc
Normal file
@@ -0,0 +1,131 @@
|
||||
macro debug_print str
|
||||
{
|
||||
local ..string, ..label
|
||||
|
||||
jmp ..label
|
||||
..string db str,0
|
||||
..label:
|
||||
|
||||
pushf
|
||||
pushad
|
||||
mov edx,..string
|
||||
call debug_outstr
|
||||
popad
|
||||
popf
|
||||
}
|
||||
|
||||
dps fix debug_print
|
||||
|
||||
macro debug_print_dec arg
|
||||
{
|
||||
pushf
|
||||
pushad
|
||||
if ~arg eq eax
|
||||
mov eax,arg
|
||||
end if
|
||||
call debug_outdec
|
||||
popad
|
||||
popf
|
||||
}
|
||||
|
||||
dpd fix debug_print_dec
|
||||
|
||||
;---------------------------------
|
||||
debug_outdec: ;(eax - num, edi-str)
|
||||
push 10 ;2
|
||||
pop ecx ;1
|
||||
push -'0' ;2
|
||||
.l0:
|
||||
xor edx,edx ;2
|
||||
div ecx ;2
|
||||
push edx ;1
|
||||
test eax,eax ;2
|
||||
jnz .l0 ;2
|
||||
.l1:
|
||||
pop eax ;1
|
||||
add al,'0' ;2
|
||||
call debug_outchar ; stosb
|
||||
jnz .l1 ;2
|
||||
ret ;1
|
||||
;---------------------------------
|
||||
|
||||
debug_outchar: ; al - char
|
||||
pushf
|
||||
pushad
|
||||
mov cl,al
|
||||
mov eax,63
|
||||
mov ebx,1
|
||||
int 0x40
|
||||
popad
|
||||
popf
|
||||
ret
|
||||
|
||||
debug_outstr:
|
||||
mov eax,63
|
||||
mov ebx,1
|
||||
@@:
|
||||
mov cl,[edx]
|
||||
test cl,cl
|
||||
jz @f
|
||||
int 40h
|
||||
inc edx
|
||||
jmp @b
|
||||
@@:
|
||||
ret
|
||||
|
||||
|
||||
macro newline
|
||||
{
|
||||
dps <13,10>
|
||||
}
|
||||
|
||||
macro print message
|
||||
{
|
||||
dps message
|
||||
newline
|
||||
}
|
||||
|
||||
macro pregs
|
||||
{
|
||||
dps "EAX: "
|
||||
dpd eax
|
||||
dps " EBX: "
|
||||
dpd ebx
|
||||
newline
|
||||
dps "ECX: "
|
||||
dpd ecx
|
||||
dps " EDX: "
|
||||
dpd edx
|
||||
newline
|
||||
}
|
||||
|
||||
macro debug_print_hex arg
|
||||
{
|
||||
pushf
|
||||
pushad
|
||||
if ~arg eq eax
|
||||
mov eax, arg
|
||||
end if
|
||||
call debug_outhex
|
||||
popad
|
||||
popf
|
||||
}
|
||||
dph fix debug_print_hex
|
||||
|
||||
debug_outhex:
|
||||
; eax - number
|
||||
mov edx, 8
|
||||
.new_char:
|
||||
rol eax, 4
|
||||
movzx ecx, al
|
||||
and cl, 0x0f
|
||||
mov cl, [__hexdigits + ecx]
|
||||
pushad
|
||||
mcall 63, 1
|
||||
popad
|
||||
dec edx
|
||||
jnz .new_char
|
||||
ret
|
||||
|
||||
__hexdigits:
|
||||
db '0123456789ABCDEF'
|
595
programs/develop/libGUI/src/draw.inc
Normal file
595
programs/develop/libGUI/src/draw.inc
Normal file
@@ -0,0 +1,595 @@
|
||||
|
||||
DrawLine:
|
||||
|
||||
mov eax,38
|
||||
mov ebx,[Line.x1]
|
||||
mov ecx,[Line.y1]
|
||||
mov edx,[Line.color]
|
||||
shl ebx,16
|
||||
shl ecx,16
|
||||
add ebx,[Line.x2]
|
||||
add ecx,[Line.y2]
|
||||
mcall
|
||||
|
||||
ret
|
||||
|
||||
DrawPixel:
|
||||
|
||||
xor eax,eax
|
||||
inc al
|
||||
mov ebx,[Pixel.x]
|
||||
mov ecx,[Pixel.y]
|
||||
mov edx,[Pixel.color]
|
||||
mcall
|
||||
|
||||
ret
|
||||
|
||||
RectangleContour:
|
||||
|
||||
mov eax,38
|
||||
mov ebx,[Rectangle.x]
|
||||
mov ecx,[Rectangle.y]
|
||||
mov edx,[Rectangle.color]
|
||||
mov esi,ebx
|
||||
mov edi,ecx
|
||||
shl ebx,16
|
||||
shl ecx,16
|
||||
add ebx,esi
|
||||
add ecx,edi
|
||||
add ebx,[Rectangle.width]
|
||||
mcall
|
||||
|
||||
mov eax,38
|
||||
mov ebx,[Rectangle.x]
|
||||
mov ecx,[Rectangle.y]
|
||||
mov edx,[Rectangle.color]
|
||||
add ecx,[Rectangle.height]
|
||||
mov esi,ebx
|
||||
mov edi,ecx
|
||||
shl ebx,16
|
||||
shl ecx,16
|
||||
add ebx,esi
|
||||
add ecx,edi
|
||||
add ebx,[Rectangle.width]
|
||||
mcall
|
||||
|
||||
mov eax,38
|
||||
mov ebx,[Rectangle.x]
|
||||
mov ecx,[Rectangle.y]
|
||||
mov edx,[Rectangle.color]
|
||||
mov esi,ebx
|
||||
mov edi,ecx
|
||||
shl ebx,16
|
||||
shl ecx,16
|
||||
add ebx,esi
|
||||
add ecx,edi
|
||||
add ecx,[Rectangle.height]
|
||||
mcall
|
||||
|
||||
mov eax,38
|
||||
mov ebx,[Rectangle.x]
|
||||
mov ecx,[Rectangle.y]
|
||||
mov edx,[Rectangle.color]
|
||||
add ebx,[Rectangle.width]
|
||||
mov esi,ebx
|
||||
mov edi,ecx
|
||||
shl ebx,16
|
||||
shl ecx,16
|
||||
add ebx,esi
|
||||
add ecx,edi
|
||||
add ecx,[Rectangle.height]
|
||||
mcall
|
||||
|
||||
ret
|
||||
|
||||
;eax -first color
|
||||
;ebx- second color
|
||||
;OUT
|
||||
;eax - averege color
|
||||
calculate_average_color:
|
||||
|
||||
and eax,0xffffff
|
||||
and ebx,0xffffff
|
||||
|
||||
mov [b_min],al
|
||||
mov [b_max],bl
|
||||
shr eax,8
|
||||
shr ebx,8
|
||||
mov [g_min],al
|
||||
mov [g_max],bl
|
||||
shr eax,8
|
||||
shr ebx,8
|
||||
mov [r_min],al
|
||||
mov [r_max],bl
|
||||
|
||||
xor eax,eax
|
||||
xor ebx,ebx
|
||||
mov al,[r_max]
|
||||
mov bl,[r_min]
|
||||
add eax,ebx
|
||||
shr eax,1
|
||||
mov [r],al
|
||||
|
||||
xor eax,eax
|
||||
xor ebx,ebx
|
||||
mov al,[g_max]
|
||||
mov bl,[g_min]
|
||||
add eax,ebx
|
||||
shr eax,1
|
||||
mov [g],al
|
||||
|
||||
xor eax,eax
|
||||
xor ebx,ebx
|
||||
mov al,[b_max]
|
||||
mov bl,[b_min]
|
||||
add eax,ebx
|
||||
shr eax,1
|
||||
mov [b],al
|
||||
|
||||
xor eax,eax
|
||||
mov al,[r]
|
||||
shl eax,8
|
||||
mov al,[g]
|
||||
shl eax,8
|
||||
mov al,[b]
|
||||
|
||||
ret
|
||||
|
||||
;eax -color
|
||||
;ebx- sub value
|
||||
;OUT
|
||||
;eax - sabved color
|
||||
calculate_sabved_color:
|
||||
|
||||
and eax,0xffffff
|
||||
|
||||
mov [b],al
|
||||
shr eax,8
|
||||
mov [g],al
|
||||
shr eax,8
|
||||
mov [r],al
|
||||
|
||||
sub [r],bl
|
||||
sub [g],bl
|
||||
sub [b],bl
|
||||
|
||||
xor eax,eax
|
||||
mov al,[r]
|
||||
shl eax,8
|
||||
mov al,[g]
|
||||
shl eax,8
|
||||
mov al,[b]
|
||||
|
||||
ret
|
||||
|
||||
DrawString:
|
||||
|
||||
mov ebx,[Button.text]
|
||||
call GetLengthString
|
||||
mov esi,eax
|
||||
|
||||
mov eax,4
|
||||
mov ebx,[Font.x]
|
||||
shl ebx,16
|
||||
add ebx,[Font.y]
|
||||
mov ecx,[Button.textcolor]
|
||||
mov edx,[Button.text]
|
||||
mcall
|
||||
|
||||
ret
|
||||
|
||||
;eax -first color
|
||||
;ebx- second color
|
||||
;ecx- x coordinat of rectangle
|
||||
;edx- y coordinat of rectangle
|
||||
;esi- rectangle size x
|
||||
;edi- rectangle size y
|
||||
|
||||
rectangle_gradient_right:
|
||||
|
||||
mov [line_coordinat_x],ecx
|
||||
mov [line_coordinat_y],edx
|
||||
mov [line_size_x],esi
|
||||
mov [line_size_y],edi
|
||||
|
||||
mov ecx,esi
|
||||
mov edx,dword pointer
|
||||
call gradient
|
||||
|
||||
mov ecx,[line_coordinat_y]
|
||||
shl ecx,16
|
||||
add ecx,[line_coordinat_y]
|
||||
add ecx,[line_size_y]
|
||||
|
||||
mov eax,[line_size_x]
|
||||
add [line_coordinat_x],eax
|
||||
|
||||
mov esi,dword pointer
|
||||
mov edi,[line_size_x]
|
||||
|
||||
next_vertical_line_draw_right:
|
||||
|
||||
mov eax,38
|
||||
mov ebx,[line_coordinat_x]
|
||||
shl ebx,16
|
||||
add ebx,[line_coordinat_x]
|
||||
mov edx,[esi]
|
||||
and edx,0xffffff
|
||||
mcall
|
||||
|
||||
add esi,3
|
||||
sub [line_coordinat_x],1
|
||||
|
||||
dec edi
|
||||
jnz next_vertical_line_draw_right
|
||||
|
||||
ret
|
||||
|
||||
;eax -first color
|
||||
;ebx- second color
|
||||
;ecx- x coordinat of rectangle
|
||||
;edx- y coordinat of rectangle
|
||||
;esi- rectangle size x
|
||||
;edi- rectangle size y
|
||||
|
||||
rectangle_gradient_left:
|
||||
|
||||
mov [line_coordinat_x],ecx
|
||||
mov [line_coordinat_y],edx
|
||||
mov [line_size_x],esi
|
||||
mov [line_size_y],edi
|
||||
|
||||
mov ecx,esi
|
||||
mov edx,dword pointer
|
||||
call gradient
|
||||
|
||||
mov ecx,[line_coordinat_y]
|
||||
shl ecx,16
|
||||
add ecx,[line_coordinat_y]
|
||||
add ecx,[line_size_y]
|
||||
|
||||
mov esi,dword pointer
|
||||
mov edi,[line_size_x]
|
||||
|
||||
next_vertical_line_draw_left:
|
||||
|
||||
mov eax,38
|
||||
mov ebx,[line_coordinat_x]
|
||||
shl ebx,16
|
||||
add ebx,[line_coordinat_x]
|
||||
mov edx,[esi]
|
||||
and edx,0xffffff
|
||||
mcall
|
||||
|
||||
add esi,3
|
||||
add [line_coordinat_x],1
|
||||
|
||||
dec edi
|
||||
jnz next_vertical_line_draw_left
|
||||
|
||||
ret
|
||||
|
||||
;eax -first color
|
||||
;ebx- second color
|
||||
;ecx- x coordinat of rectangle
|
||||
;edx- y coordinat of rectangle
|
||||
;esi- rectangle size x
|
||||
;edi- rectangle size y
|
||||
|
||||
rectangle_gradient_up:
|
||||
|
||||
mov [line_coordinat_x],ecx
|
||||
mov [line_coordinat_y],edx
|
||||
mov [line_size_x],esi
|
||||
mov [line_size_y],edi
|
||||
|
||||
mov ecx,edi
|
||||
mov edx,dword pointer
|
||||
call gradient
|
||||
|
||||
mov ebx,[line_coordinat_x]
|
||||
shl ebx,16
|
||||
add ebx,[line_coordinat_x]
|
||||
add ebx,[line_size_x]
|
||||
|
||||
mov eax,[line_size_y]
|
||||
add [line_coordinat_y],eax
|
||||
|
||||
mov esi,dword pointer
|
||||
mov edi,[line_size_y]
|
||||
|
||||
next_horizontal_line_draw_up:
|
||||
|
||||
mov eax,38
|
||||
mov ecx,[line_coordinat_y]
|
||||
shl ecx,16
|
||||
add ecx,[line_coordinat_y]
|
||||
mov edx,[esi]
|
||||
and edx,0xffffff
|
||||
mcall
|
||||
|
||||
add esi,3
|
||||
sub [line_coordinat_y],1
|
||||
|
||||
dec edi
|
||||
jnz next_horizontal_line_draw_up
|
||||
|
||||
ret
|
||||
|
||||
;eax -first color
|
||||
;ebx- second color
|
||||
;ecx- x coordinat of rectangle
|
||||
;edx- y coordinat of rectangle
|
||||
;esi- rectangle size x
|
||||
;edi- rectangle size y
|
||||
|
||||
rectangle_gradient_down:
|
||||
|
||||
mov [line_coordinat_x],ecx
|
||||
mov [line_coordinat_y],edx
|
||||
mov [line_size_x],esi
|
||||
mov [line_size_y],edi
|
||||
|
||||
mov ecx,edi
|
||||
mov edx,dword pointer
|
||||
call gradient
|
||||
|
||||
mov ebx,[line_coordinat_x]
|
||||
shl ebx,16
|
||||
add ebx,[line_coordinat_x]
|
||||
add ebx,[line_size_x]
|
||||
|
||||
mov esi,dword pointer
|
||||
mov edi,[line_size_y]
|
||||
|
||||
next_horizontal_line_draw_down:
|
||||
|
||||
mov eax,38
|
||||
mov ecx,[line_coordinat_y]
|
||||
shl ecx,16
|
||||
add ecx,[line_coordinat_y]
|
||||
mov edx,[esi]
|
||||
and edx,0xffffff
|
||||
mcall
|
||||
|
||||
add esi,3
|
||||
add [line_coordinat_y],1
|
||||
|
||||
dec edi
|
||||
jnz next_horizontal_line_draw_down
|
||||
|
||||
ret
|
||||
|
||||
;eax -first color
|
||||
;ebx- second color
|
||||
;ecx- length of line
|
||||
;edx- pointer to memory for colors of gradient
|
||||
|
||||
gradient:
|
||||
|
||||
mov [length],ecx
|
||||
|
||||
and eax,0xffffff
|
||||
and eax,0xffffff
|
||||
|
||||
mov [b_min],al
|
||||
mov [b_max],bl
|
||||
shr eax,8
|
||||
shr ebx,8
|
||||
mov [g_min],al
|
||||
mov [g_max],bl
|
||||
shr eax,8
|
||||
shr ebx,8
|
||||
mov [r_min],al
|
||||
mov [r_max],bl
|
||||
|
||||
mov eax,[length]
|
||||
dec eax
|
||||
mov [v],eax
|
||||
fild [v]
|
||||
|
||||
xor eax,eax
|
||||
mov al,[r_max]
|
||||
sub al,[r_min]
|
||||
mov [v],eax
|
||||
fild [v]
|
||||
fdiv st0,st1
|
||||
fstp [step_r]
|
||||
|
||||
xor eax,eax
|
||||
mov al,[g_max]
|
||||
sub al,[g_min]
|
||||
mov [v],eax
|
||||
fild [v]
|
||||
fdiv st0,st1
|
||||
fstp [step_g]
|
||||
|
||||
xor eax,eax
|
||||
mov al,[b_max]
|
||||
sub al,[b_min]
|
||||
mov [v],eax
|
||||
fild [v]
|
||||
fdiv st0,st1
|
||||
fstp [step_b]
|
||||
|
||||
fstp [v]
|
||||
|
||||
xor eax,eax
|
||||
mov al,[r_min]
|
||||
mov [r],al
|
||||
mov [v],eax
|
||||
fild [v]
|
||||
fstp [r_f]
|
||||
|
||||
xor eax,eax
|
||||
mov al,[g_min]
|
||||
mov [g],al
|
||||
mov [v],eax
|
||||
fild [v]
|
||||
fstp [g_f]
|
||||
|
||||
xor eax,eax
|
||||
mov al,[b_min]
|
||||
mov [b],al
|
||||
mov [v],eax
|
||||
fild [v]
|
||||
fstp [b_f]
|
||||
|
||||
next_gradient_color_save:
|
||||
|
||||
xor ebx,ebx
|
||||
xor eax,eax
|
||||
mov al,[r]
|
||||
mov bl,al
|
||||
shl eax,8
|
||||
mov al,[g]
|
||||
shl eax,8
|
||||
mov al,[b]
|
||||
|
||||
mov [edx],ax
|
||||
mov [edx+2],bl
|
||||
|
||||
fld [step_r]
|
||||
fld [r_f]
|
||||
fadd st0,st1
|
||||
fst [r_f]
|
||||
fistp [v]
|
||||
xor eax,eax
|
||||
mov eax,[v]
|
||||
mov [r],al
|
||||
fstp [v]
|
||||
|
||||
fld [step_g]
|
||||
fld [g_f]
|
||||
fadd st0,st1
|
||||
fst [g_f]
|
||||
fistp [v]
|
||||
xor eax,eax
|
||||
mov eax,[v]
|
||||
mov [g],al
|
||||
fstp [v]
|
||||
|
||||
fld [step_b]
|
||||
fld [b_f]
|
||||
fadd st0,st1
|
||||
fst [b_f]
|
||||
fistp [v]
|
||||
xor eax,eax
|
||||
mov eax,[v]
|
||||
mov [b],al
|
||||
fstp [v]
|
||||
|
||||
add edx,3
|
||||
|
||||
dec ecx
|
||||
jnz next_gradient_color_save
|
||||
|
||||
ret
|
||||
|
||||
;IN
|
||||
;NON
|
||||
;OUT
|
||||
;variable [skin_height]
|
||||
|
||||
get_skin_height:
|
||||
|
||||
pushad
|
||||
|
||||
mov eax,48
|
||||
mov ebx,4
|
||||
int 0x40
|
||||
|
||||
mov [skin_height],eax
|
||||
popad
|
||||
|
||||
ret
|
||||
;eax - x
|
||||
;ebx - y
|
||||
;ecx - size x
|
||||
;edx - size y
|
||||
;esi - pointer to memory for rectangle
|
||||
SaveFonForRectangle:
|
||||
|
||||
mov [Rectangle.x],eax
|
||||
mov [Rectangle.y],ebx
|
||||
mov [Rectangle.width],ecx
|
||||
mov [Rectangle.height],edx
|
||||
mov [PointerToMem],esi
|
||||
|
||||
;get bytes per string
|
||||
mov eax,61
|
||||
mov ebx,2
|
||||
mcall
|
||||
mov [BitsPerPixel],eax
|
||||
|
||||
mov eax,61
|
||||
mov ebx,3
|
||||
mcall
|
||||
mov [BytesPerString],eax
|
||||
|
||||
|
||||
;get window coordinats
|
||||
mov eax,9
|
||||
mov ebx,dword IPC_table
|
||||
or ecx,-1
|
||||
mcall
|
||||
|
||||
mov eax,dword[IPC_table+34]
|
||||
mov ebx,dword[IPC_table+38]
|
||||
;mov ecx,dword[IPC_table+42]
|
||||
;mov edx,dword[IPC_table+46]
|
||||
;mov [WindowCoordinatX],eax
|
||||
;mov [WindowCoordinatY],ebx
|
||||
;mov [WindowSizeX],ecx
|
||||
;mov [WindowSizeY],edx
|
||||
|
||||
add eax,[Rectangle.x]
|
||||
add ebx,[Rectangle.y]
|
||||
|
||||
imul ebx,[BytesPerString]
|
||||
mov esi,[Rectangle.width]
|
||||
|
||||
cmp [BitsPerPixel],24
|
||||
jne no_24
|
||||
|
||||
lea eax,[eax+eax*2]
|
||||
lea esi,[esi+esi*2]
|
||||
mov edi,3
|
||||
jmp exit_bits_per_pixel
|
||||
no_24:
|
||||
|
||||
shl eax,2
|
||||
shl esi,2
|
||||
mov edi,4
|
||||
exit_bits_per_pixel:
|
||||
|
||||
add eax,ebx
|
||||
|
||||
mov ebx,[BytesPerString]
|
||||
sub ebx,esi
|
||||
mov [offset],ebx
|
||||
|
||||
mov esi,[PointerToMem]
|
||||
mov edx,[Rectangle.height]
|
||||
next_string_pixels_save:
|
||||
|
||||
mov ecx,[Rectangle.width]
|
||||
next_pixel_save:
|
||||
|
||||
mov ebx,[gs:eax]
|
||||
and ebx,0xffffff
|
||||
mov [esi],bx
|
||||
shr ebx,16
|
||||
mov [esi+2],bl
|
||||
|
||||
add esi,3
|
||||
add eax,edi
|
||||
dec ecx
|
||||
jnz next_pixel_save
|
||||
|
||||
add eax,[offset]
|
||||
dec edx
|
||||
jnz next_string_pixels_save
|
||||
|
||||
exit_:
|
||||
ret
|
249
programs/develop/libGUI/src/edit_box.inc
Normal file
249
programs/develop/libGUI/src/edit_box.inc
Normal file
@@ -0,0 +1,249 @@
|
||||
|
||||
eb_control_data_size = 82
|
||||
|
||||
;****************************************************
|
||||
;******************craete EditBox*********************
|
||||
;****************************************************
|
||||
;IN
|
||||
;pointer to parend
|
||||
;pointer to EditBox's structure
|
||||
;OUT
|
||||
;pointer to initialized control
|
||||
align 4
|
||||
|
||||
craete_edit_box:
|
||||
|
||||
mov ebx,[esp+4]
|
||||
mov eax,[esp+8]
|
||||
|
||||
mov [PointerToStructureForEditBox],eax
|
||||
|
||||
mov eax,control_header_size+eb_control_data_size
|
||||
call craete_control
|
||||
|
||||
;set all EditBox's parameters in control
|
||||
mov [eax],dword edit_box
|
||||
|
||||
mov ecx,eb_control_data_size
|
||||
mov esi,[PointerToStructureForEditBox]
|
||||
mov edi,eax
|
||||
add edi,control_header_size
|
||||
rep movsb
|
||||
|
||||
call get_skin_height
|
||||
|
||||
mov ebx,[PointerToStructureForEditBox]
|
||||
mov ecx,[ebx+4] ;x
|
||||
mov edx,[ebx+8] ;y
|
||||
mov esi,[ebx] ;size x
|
||||
mov edi,[ebx+70] ;size y
|
||||
add ecx,border_width
|
||||
add edx,[skin_height]
|
||||
;copy information to control
|
||||
mov [eax+24],ecx
|
||||
mov [eax+28],edx
|
||||
mov [eax+32],esi
|
||||
mov [eax+36],edi
|
||||
|
||||
ret 8
|
||||
|
||||
;****************************************************
|
||||
;******************Draw EditBox**********************
|
||||
;****************************************************
|
||||
;include 'editbox_mac.inc'
|
||||
;IN
|
||||
;pointer to control of EditBox
|
||||
;message
|
||||
;OUT
|
||||
;not returned value
|
||||
align 4
|
||||
|
||||
include 'editbox_mac.inc'
|
||||
|
||||
edit_box:
|
||||
;;;;;;;;;;;;
|
||||
;Structure from libGui <EFBFBD><EFBFBD><EFBFBD>樠<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
;;;;;;;;;;;;
|
||||
|
||||
;get message
|
||||
mov eax,[esp+8]
|
||||
|
||||
;get pointer to control of button
|
||||
mov esi,[esp+4]
|
||||
mov [PointerForEditBox],esi
|
||||
|
||||
;copy control to local control
|
||||
add esi,control_header_size
|
||||
mov edi,dword EditBox
|
||||
mov ecx,eb_control_data_size
|
||||
rep movsb
|
||||
|
||||
;;;;;;;;;;;;
|
||||
;Structure from libGui <EFBFBD><EFBFBD><EFBFBD>樠<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
;;;;;;;;;;;;
|
||||
srt_ed_libgui
|
||||
|
||||
push eax
|
||||
;load coordinats and size from control
|
||||
mov eax,[PointerForEditBox]
|
||||
mov ebx,[eax+24] ;x
|
||||
mov ecx,[eax+28] ;y
|
||||
mov edx,[eax+32] ;size x
|
||||
mov esi,[eax+36] ;size y
|
||||
;set current coordinats and sizes in EeditBox
|
||||
mov [EditBox.ed_left],ebx
|
||||
mov [EditBox.ed_top],ecx
|
||||
mov [EditBox.ed_width],edx
|
||||
mov [EditBox.ed_height],esi
|
||||
pop eax
|
||||
|
||||
;events of redraw all EditBox
|
||||
|
||||
cmp [eax],dword 1
|
||||
jne .no_redraw_all_edit_box
|
||||
|
||||
|
||||
call .draw_border
|
||||
.draw_bg_cursor_text:
|
||||
|
||||
call .check_offset
|
||||
|
||||
call .draw_bg
|
||||
|
||||
call .draw_shift
|
||||
.draw_cursor_text:
|
||||
|
||||
test word[EditBox.ed_flags],ed_focus
|
||||
je @f
|
||||
call .draw_cursor
|
||||
@@:
|
||||
call .draw_text
|
||||
|
||||
jmp .editbox_exit;exit_edit_box
|
||||
.no_redraw_all_edit_box:
|
||||
|
||||
|
||||
;events of keys for EditBox
|
||||
|
||||
cmp [eax],dword 2
|
||||
jne .no_keys_edit_box
|
||||
|
||||
mov ebx,[eax+4]
|
||||
shl ebx,8
|
||||
mov eax,ebx
|
||||
|
||||
test word [EditBox.ed_flags],ed_focus
|
||||
je .editbox_exit;exit_edit_box;@b
|
||||
|
||||
call .check_shift
|
||||
|
||||
;----------------------------------------------------------
|
||||
;--- <EFBFBD><EFBFBD><EFBFBD>塞, <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> --------------------------------
|
||||
;----------------------------------------------------------
|
||||
|
||||
use_key_process backspase,delete,left,right,home,end,insert
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>誠 <EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ࠡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>.<EFBFBD>. <EFBFBD><EFBFBD><EFBFBD>
|
||||
;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㦥<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ந<EFBFBD>室<EFBFBD><EFBFBD> <EFBFBD><EFBFBD>室 <EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ࠡ<EFBFBD><EFBFBD>稪<EFBFBD>
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
srt_ed_libgui
|
||||
use_key_no_process up,down,esc
|
||||
|
||||
;--- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>㣠<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ---
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;<EFBFBD><EFBFBD>ઠ <EFBFBD><EFBFBD>⠭<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> 䫠<EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>㦭<EFBFBD> <EFBFBD>뢮<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
;⮫쪮 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD>㦭<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> ⠪<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>室<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>
|
||||
;<EFBFBD>㦭<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
use_key_figures_only
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;<EFBFBD><EFBFBD>ઠ <EFBFBD><EFBFBD> shift <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
are_key_shift_press
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; <EFBFBD><EFBFBD><EFBFBD>塞, <EFBFBD><EFBFBD>室<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> + <EFBFBD><EFBFBD><EFBFBD>쭥<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ࠡ<EFBFBD>⪠
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
are_key_cur_end
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;<EFBFBD><EFBFBD>ࠡ<EFBFBD>⪠ <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> insert,delete.backspase,home,end,left,right
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
use_work_key
|
||||
|
||||
|
||||
.no_keys_edit_box:
|
||||
|
||||
;events of mouse for EditBox
|
||||
|
||||
cmp [eax],dword 6
|
||||
jne .editbox_exit
|
||||
|
||||
mov esi,[eax+4]
|
||||
mov edi,[eax+8]
|
||||
mov ecx,[eax+12]
|
||||
mov [EditBox.mouseX],esi
|
||||
mov [EditBox.mouseY],edi
|
||||
mov [ButtonsOfMouse],ecx
|
||||
|
||||
mov eax,ecx
|
||||
|
||||
test eax,1
|
||||
jnz .mouse_left_button
|
||||
and word [EditBox.ed_flags],ed_mouse_on_off
|
||||
jmp .editbox_exit
|
||||
|
||||
.mouse_left_button:
|
||||
|
||||
mov eax,[EditBox.mouseX]
|
||||
shl eax,16
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;<EFBFBD>㭪<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ࠡ<EFBFBD>⪨ <EFBFBD><EFBFBD>誨 <EFBFBD><EFBFBD><EFBFBD><EFBFBD>祭<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>न<EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD>ઠ <EFBFBD><EFBFBD> + <EFBFBD>뤥<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
use_work_mouse ;scr_h,scr_w
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;<EFBFBD><EFBFBD>騥 <EFBFBD>㭪樨 <EFBFBD><EFBFBD>ࠡ<EFBFBD>⪨
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
use_general_func
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;<EFBFBD>㭪樨 <EFBFBD><EFBFBD><EFBFBD> ࠡ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD> key
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
use_key_func
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;<EFBFBD>㭪樨 <EFBFBD><EFBFBD><EFBFBD> ࠡ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD> mouse
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
use_mouse_func ;scr_w
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;<EFBFBD><EFBFBD>騩 <EFBFBD><EFBFBD>室 <EFBFBD><EFBFBD> editbox <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>㭪権 <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ࠡ<EFBFBD><EFBFBD>稪<EFBFBD><EFBFBD>
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
.editbox_exit:
|
||||
|
||||
exit_edit_box:
|
||||
|
||||
;save resulatat of work in control
|
||||
mov esi,dword EditBox
|
||||
mov edi,[PointerForEditBox]
|
||||
add edi,control_header_size
|
||||
mov ecx,eb_control_data_size
|
||||
rep movsb
|
||||
|
||||
ret 8
|
||||
|
1143
programs/develop/libGUI/src/editbox_mac.inc
Normal file
1143
programs/develop/libGUI/src/editbox_mac.inc
Normal file
File diff suppressed because it is too large
Load Diff
140
programs/develop/libGUI/src/image.inc
Normal file
140
programs/develop/libGUI/src/image.inc
Normal file
@@ -0,0 +1,140 @@
|
||||
|
||||
im_control_data_size = 26
|
||||
im_redraw_all = 10000000b
|
||||
im_redraw_all_off = 01111111b
|
||||
im_special_redraw_on = 1b
|
||||
im_special_redraw_off = 11111110b
|
||||
|
||||
;****************************************************
|
||||
;*******************craete Image**********************
|
||||
;****************************************************
|
||||
;IN
|
||||
;pointer to parend
|
||||
;pointer to Image's structure
|
||||
;OUT
|
||||
;pointer to initialized Image's structure
|
||||
align 4
|
||||
|
||||
craete_image:
|
||||
|
||||
mov ebx,[esp+4]
|
||||
mov eax,[esp+8]
|
||||
|
||||
mov [PointerToStructureForImage],eax
|
||||
|
||||
mov eax,control_header_size+im_control_data_size
|
||||
call craete_control
|
||||
|
||||
;set all image's parameters in control
|
||||
mov [eax],dword image
|
||||
|
||||
mov ecx,im_control_data_size
|
||||
mov esi,[PointerToStructureForImage]
|
||||
mov edi,eax
|
||||
add edi,control_header_size
|
||||
rep movsb
|
||||
|
||||
call get_skin_height
|
||||
|
||||
mov ebx,[PointerToStructureForImage]
|
||||
mov ecx,[ebx+6] ;x
|
||||
mov edx,[ebx+10] ;y
|
||||
mov esi,[ebx+14] ;size x
|
||||
mov edi,[ebx+18] ;size y
|
||||
add ecx,border_width
|
||||
add edx,[skin_height]
|
||||
;copy information to control
|
||||
mov [eax+24],ecx
|
||||
mov [eax+28],edx
|
||||
mov [eax+32],esi
|
||||
mov [eax+36],edi
|
||||
|
||||
ret 8
|
||||
|
||||
;****************************************************
|
||||
;********************Draw Image**********************
|
||||
;****************************************************
|
||||
;IN
|
||||
;pointer to control of button
|
||||
;message
|
||||
;OUT
|
||||
;not returned value
|
||||
align 4
|
||||
|
||||
image:
|
||||
|
||||
;get message
|
||||
mov eax,[esp+8]
|
||||
|
||||
;get pointer to control of image
|
||||
mov esi,[esp+4]
|
||||
mov [PointerForImage],esi
|
||||
;copy control to local control
|
||||
add esi,control_header_size
|
||||
mov edi,dword Image
|
||||
mov ecx,im_control_data_size
|
||||
rep movsb
|
||||
|
||||
|
||||
cmp [eax],dword 1
|
||||
jne no_redraw_all_image
|
||||
|
||||
or [Image.type],im_redraw_all
|
||||
no_redraw_all_image:
|
||||
|
||||
cmp [eax],dword 3
|
||||
jne no_special_message_image
|
||||
|
||||
xor eax,eax
|
||||
mov al,[Image.type]
|
||||
and al,im_special_redraw_on
|
||||
test al,al
|
||||
jz no_activate_redraw_image
|
||||
|
||||
and [Image.type],im_special_redraw_off
|
||||
or [Image.type],im_redraw_all
|
||||
no_activate_redraw_image:
|
||||
|
||||
no_special_message_image:
|
||||
|
||||
;load coordinats and size from control
|
||||
mov eax,[PointerForImage]
|
||||
mov ebx,[eax+24] ;x
|
||||
mov ecx,[eax+28] ;y
|
||||
mov edx,[eax+32] ;size x
|
||||
mov esi,[eax+36] ;size y
|
||||
;set current coordinats and sizes in zakladka
|
||||
mov [Image.x],ebx
|
||||
mov [Image.y],ecx
|
||||
mov [Image.sizex],edx
|
||||
mov [Image.sizey],esi
|
||||
|
||||
xor eax,eax
|
||||
mov al,[Image.type]
|
||||
and al,im_redraw_all
|
||||
test al,al
|
||||
jz no_redraw_image_
|
||||
|
||||
and [Image.type],im_redraw_all_off
|
||||
|
||||
mov esi,dword Image
|
||||
mov edi,[PointerForImage]
|
||||
add edi,control_header_size
|
||||
mov ecx,2
|
||||
rep movsb
|
||||
|
||||
mov eax,7
|
||||
mov ebx,[Image.pointer]
|
||||
mov ecx,[Image.sizex]
|
||||
shl ecx,16
|
||||
add ecx,[Image.sizey]
|
||||
mov edx,[Image.x]
|
||||
shl edx,16
|
||||
add edx,[Image.y]
|
||||
mcall
|
||||
|
||||
no_redraw_image_:
|
||||
|
||||
exit_image:
|
||||
|
||||
ret 8
|
537
programs/develop/libGUI/src/libGUI.asm
Normal file
537
programs/develop/libGUI/src/libGUI.asm
Normal file
@@ -0,0 +1,537 @@
|
||||
;**********************************************************************
|
||||
; library of Graphics Universal Interface for Kolibri operation system
|
||||
;
|
||||
; version 071001
|
||||
; 2007 year
|
||||
;
|
||||
;autors:
|
||||
;
|
||||
;andrew_programmer polynki@mail.ru
|
||||
;
|
||||
;menegement of controls : destroy_control, send_message
|
||||
;GUI components : button,scroller,Bookmark,text,image,number,progres bar
|
||||
;
|
||||
;<Lrz> and Maxxxx32
|
||||
;
|
||||
;GUI components : CheckBox,EditBox
|
||||
;
|
||||
;**********************************************************************
|
||||
|
||||
format MS COFF
|
||||
|
||||
public EXPORTS
|
||||
|
||||
control_header_size = 44
|
||||
|
||||
border_width = 5
|
||||
|
||||
section '.flat' code readable align 16
|
||||
|
||||
include 'macros.inc'
|
||||
include 'debug.inc'
|
||||
|
||||
;GUI components
|
||||
|
||||
include 'button.inc'
|
||||
|
||||
include 'scroller.inc'
|
||||
|
||||
include 'bookmark.inc'
|
||||
|
||||
include 'image.inc'
|
||||
|
||||
include 'text.inc'
|
||||
|
||||
include 'number.inc'
|
||||
|
||||
include 'check_box.inc'
|
||||
|
||||
include 'edit_box.inc'
|
||||
|
||||
include 'progress_bar.inc'
|
||||
|
||||
;engen of libGUI(menegment of controls)
|
||||
|
||||
include 'menegment_of_controls.inc'
|
||||
|
||||
;functions which proved work of GUI components
|
||||
|
||||
include 'draw.inc'
|
||||
|
||||
include 'string.inc'
|
||||
|
||||
include 'check_crossing_box.inc'
|
||||
|
||||
include 'memory.inc'
|
||||
|
||||
;function for get version of library
|
||||
include 'version.inc'
|
||||
|
||||
;function for resize GUI component
|
||||
include 'resize_component.inc'
|
||||
|
||||
;function for remove GUI component
|
||||
include 'remove_component.inc'
|
||||
|
||||
align 16
|
||||
EXPORTS:
|
||||
dd szDestroyControl,destroy_control
|
||||
dd szSendMessage,send_message
|
||||
dd szVersion,get_version
|
||||
dd szResizeComponent,resize_component
|
||||
dd szRemoveComponent,remove_component
|
||||
dd szcraeteButton,craete_button
|
||||
dd szcraeteScroller,craete_scroller
|
||||
dd szcraeteBookmark,craete_Bookmark
|
||||
dd szcraeteImage,craete_image
|
||||
dd szcraeteText,craete_text
|
||||
dd szcraeteNumber,craete_number
|
||||
dd szcraeteCheckBox,craete_check_box
|
||||
dd szcraeteEditBox,craete_edit_box
|
||||
dd szcraeteProgressBar,craete_progress_bar
|
||||
dd 0,0
|
||||
|
||||
szDestroyControl db 'DestroyControl',0
|
||||
szSendMessage db 'SendMessage',0
|
||||
szVersion db 'Version',0
|
||||
szResizeComponent db 'ResizeComponent',0
|
||||
szRemoveComponent db 'RemoveComponent',0
|
||||
szcraeteButton db 'CraeteButton',0
|
||||
szcraeteScroller db 'CraeteScroller',0
|
||||
szcraeteBookmark db 'CraeteBookmark',0
|
||||
szcraeteImage db 'CraeteImage',0
|
||||
szcraeteText db 'CraeteText',0
|
||||
szcraeteNumber db 'CraeteNumber',0
|
||||
szcraeteCheckBox db 'CraeteCheckbox',0
|
||||
szcraeteEditBox db 'CraeteEditbox',0
|
||||
szcraeteProgressBar db 'CraeteProgressbar',0
|
||||
|
||||
section '.data' data readable writable align 16
|
||||
;************************************************
|
||||
;******************DLL DATA**********************
|
||||
;************************************************
|
||||
|
||||
point db '.',0
|
||||
signum db '-',0
|
||||
|
||||
BitsPerPixel rd 1
|
||||
BytesPerString rd 1
|
||||
WindowCoordinatX rd 1
|
||||
WindowCoordinatY rd 1
|
||||
WindowSizeX rd 1
|
||||
WindowSizeY rd 1
|
||||
|
||||
PointerToMem rd 1
|
||||
offset rd 1
|
||||
|
||||
v rd 1
|
||||
v2 rd 1
|
||||
v3 rd 1
|
||||
|
||||
r_min rb 1
|
||||
r_max rb 1
|
||||
g_min rb 1
|
||||
g_max rb 1
|
||||
b_min rb 1
|
||||
b_max rb 1
|
||||
r rb 1
|
||||
g rb 1
|
||||
b rb 1
|
||||
r_f rd 1
|
||||
g_f rd 1
|
||||
b_f rd 1
|
||||
step_r rd 1
|
||||
step_g rd 1
|
||||
step_b rd 1
|
||||
length rd 1
|
||||
length2 rd 1
|
||||
Color rd 1
|
||||
AveregeColor rd 1
|
||||
|
||||
line_coordinat_x rd 1
|
||||
line_coordinat_y rd 1
|
||||
line_size_x rd 1
|
||||
line_size_y rd 1
|
||||
line_size_y_f rd 1
|
||||
|
||||
x rd 1
|
||||
y rd 1
|
||||
xo rd 1
|
||||
yo rd 1
|
||||
x_ctl rd 1
|
||||
y_ctl rd 1
|
||||
|
||||
;ReturnAddresButton rd 1
|
||||
;ReturnAddresScroller rd 1
|
||||
;ReturnAddresBookmark rd 1
|
||||
;ReturnAddresImage rd 1
|
||||
;ReturnAddresText rd 1
|
||||
;ReturnAddresNumber rd 1
|
||||
;ReturnAddresCheckBox rd 1
|
||||
;ReturnAddresEditBox rd 1
|
||||
;ReturnAddresProgressBar rd 1
|
||||
|
||||
Button_Flag rb 1
|
||||
|
||||
Scrollersize rd 1
|
||||
ControlID rd 1
|
||||
Message rd 4
|
||||
Parend rd 1
|
||||
Control rd 1
|
||||
ReturnControl rd 1
|
||||
PointerToControl rd 1
|
||||
ActiveControl rd 1
|
||||
ActiveControlForKeys rd 1
|
||||
ButtonsOfMouse rd 1
|
||||
|
||||
PointerToStructureForBookmark rd 1
|
||||
ParendForBookmark rd 1
|
||||
PointerToStructureForButton rd 1
|
||||
ParendForButton rd 1
|
||||
PointerToStructureForScroller rd 1
|
||||
ParendForScroller rd 1
|
||||
PointerToStructureForImage rd 1
|
||||
PointerToStructureForText rd 1
|
||||
PointerToStructureForNumber rd 1
|
||||
PointerToStructureForCheckBox rd 1
|
||||
PointerToStructureForEditBox rd 1
|
||||
PointerToStructureForProgressBar rd 1
|
||||
|
||||
PointerForButton rd 1
|
||||
PointerForScroller rd 1
|
||||
PointerForBookmark rd 1
|
||||
PointerForImage rd 1
|
||||
PointerForText rd 1
|
||||
PointerForNumber rd 1
|
||||
PointerForCheckBox rd 1
|
||||
PointerForEditBox rd 1
|
||||
PointerForProgressBar rd 1
|
||||
|
||||
ChisloZakladok rd 1
|
||||
|
||||
integer_part rd 1
|
||||
float_part rd 1
|
||||
tochnost1 rd 1
|
||||
tochnost2 rd 1
|
||||
signum_float_number rb 1
|
||||
|
||||
skin_height rd 1
|
||||
|
||||
;*********************************
|
||||
;**********GUI structures*********
|
||||
;*********************************
|
||||
|
||||
;struc CONTROL
|
||||
;{
|
||||
; .ctrl_proc rd 0 ;0
|
||||
; .ctrl_fd rd 0 ;4
|
||||
; .ctrl_bk rd 0 ;8
|
||||
; .child_fd rd 0 ;12
|
||||
; .child_bk rd 0 ;16
|
||||
; .parend rd 0 ;20
|
||||
; .x rd 0 ;24
|
||||
; .y rd 0 ;28
|
||||
; .sizex rd 0 ;32
|
||||
; .sizey rd 0 ;36
|
||||
; .ID rd 0 ;40
|
||||
;}
|
||||
|
||||
struc BUTTON
|
||||
{
|
||||
.ctrl_proc rd 1
|
||||
.ctrl_fd rd 1
|
||||
.ctrl_bk rd 1
|
||||
.child_fd rd 1
|
||||
.child_bk rd 1
|
||||
.parend rd 1
|
||||
.ctrl_x rd 1
|
||||
.ctrl_y rd 1
|
||||
.ctrl_sizex rd 1
|
||||
.ctrl_sizey rd 1
|
||||
.ctrl_ID rd 1
|
||||
|
||||
.type rb 1
|
||||
.flag rb 1
|
||||
.x rw 1
|
||||
.y rw 1
|
||||
.width rw 1
|
||||
.height rw 1
|
||||
.image rd 1
|
||||
.imageX rw 1
|
||||
.imageY rw 1
|
||||
.imageSizeX rw 1
|
||||
.imageSizeY rw 1
|
||||
.transparentColor rd 1
|
||||
.text rd 1
|
||||
.textX rw 1
|
||||
.textY rw 1
|
||||
.textcolor rd 1
|
||||
.color1 rd 1
|
||||
.color2 rd 1
|
||||
.mouseX rw 1
|
||||
.mouseY rw 1
|
||||
}
|
||||
|
||||
struc SCROLLER
|
||||
{
|
||||
.ctrl_proc rd 1
|
||||
.ctrl_fd rd 1
|
||||
.ctrl_bk rd 1
|
||||
.child_fd rd 1
|
||||
.child_bk rd 1
|
||||
.parend rd 1
|
||||
.ctrl_x rd 1
|
||||
.ctrl_y rd 1
|
||||
.ctrl_sizex rd 1
|
||||
.ctrl_sizey rd 1
|
||||
.ctrl_ID rd 1
|
||||
|
||||
.type rb 1
|
||||
.x rw 1
|
||||
.y rw 1
|
||||
.length rw 1
|
||||
.color1 rd 1
|
||||
.size rd 1
|
||||
.pos rd 1
|
||||
.buttons_flags rw 1
|
||||
.ChildButton1 rd 1
|
||||
.ChildButton2 rd 1
|
||||
.mouseX rw 1
|
||||
.mouseY rw 1
|
||||
}
|
||||
|
||||
;********************************
|
||||
;*********Child Buttons**********
|
||||
;********************************
|
||||
struc CHILDBUTTON
|
||||
{
|
||||
.type rb 1
|
||||
.flag rb 1
|
||||
.x rw 1
|
||||
.y rw 1
|
||||
.width rw 1
|
||||
.height rw 1
|
||||
.image rd 1
|
||||
.imageX rw 1
|
||||
.imageY rw 1
|
||||
.imageSizeX rw 1
|
||||
.imageSizeY rw 1
|
||||
.transparentColor rd 1
|
||||
.text rd 1
|
||||
.textX rw 1
|
||||
.textY rw 1
|
||||
.textcolor rd 1
|
||||
.color1 rd 1
|
||||
.color2 rd 1
|
||||
.mouseX rw 1
|
||||
.mouseY rw 1
|
||||
}
|
||||
|
||||
struc BOOKMARK
|
||||
{
|
||||
.type rb 1
|
||||
.flag rb 1
|
||||
.x rd 1
|
||||
.y rd 1
|
||||
.sizex rd 1
|
||||
.sizey rd 1
|
||||
.color1 rd 1
|
||||
.reserved rd 1
|
||||
.color2 rd 1
|
||||
|
||||
.FullBookmarkSizeX rd 1
|
||||
.BookmarkSizeX rd 1
|
||||
.PointerToTextForBookmark rd 1
|
||||
.BookmarkX rd 1
|
||||
.BookmarkY rd 1
|
||||
.ChildButtonsForBookmark rd 1
|
||||
.CounterChildButtons rd 1
|
||||
.ChisloZakladok rd 1
|
||||
.ChisloStrokeZakladok rd 1
|
||||
.MessageForChildButton rd 5
|
||||
.ChildControlForBookmark rd 1
|
||||
.NumberBookmarksInActiveString rd 1
|
||||
.NumberBookmarksInEndString rd 1
|
||||
.PointerToActiveBookmarks rd 1
|
||||
.PointerToEndBookmarks rd 1
|
||||
.BookmarkFlag rb 1
|
||||
.y_end_stroke rd 1
|
||||
|
||||
.CounterChildControls rd 1
|
||||
.ActiveChildControl rd 1
|
||||
.AddresOfActiveChildControl rd 1
|
||||
.MouseX rd 1
|
||||
.MouseY rd 1
|
||||
|
||||
.DefectSizeX rd 1
|
||||
.ControlAddres rd 1
|
||||
|
||||
.counter1 rd 1
|
||||
.counter2 rd 1
|
||||
|
||||
.NumberActiveControl rd 1
|
||||
|
||||
.WorkPlace_x rd 1
|
||||
.WorkPlace_y rd 1
|
||||
.WorkPlace_sizex rd 1
|
||||
.WorkPlace_sizey rd 1
|
||||
.WorkPlace_windowx rd 1
|
||||
.WorkPlace_windowsizex rd 1
|
||||
|
||||
}
|
||||
|
||||
struc IMAGE
|
||||
{
|
||||
.type rb 1
|
||||
.flag rb 1
|
||||
.color rd 1
|
||||
.x rd 1
|
||||
.y rd 1
|
||||
.sizex rd 1
|
||||
.sizey rd 1
|
||||
.pointer rd 1
|
||||
}
|
||||
|
||||
struc TEXT
|
||||
{
|
||||
.type rb 1
|
||||
.flag rb 1
|
||||
.color rd 1
|
||||
.x rd 1
|
||||
.y rd 1
|
||||
.length rd 1
|
||||
.pointer rd 1
|
||||
}
|
||||
|
||||
struc NUMBER
|
||||
{
|
||||
.type rb 1
|
||||
.flag rb 1
|
||||
.color rd 1
|
||||
.x rd 1
|
||||
.y rd 1
|
||||
.number rd 1
|
||||
.parameters rd 1
|
||||
}
|
||||
|
||||
struc CHECKBOX
|
||||
{
|
||||
.ch_flags rw 1
|
||||
.ch_left rw 1
|
||||
.ch_top rw 1
|
||||
.ch_text_margin rd 1
|
||||
.ch_size rd 1
|
||||
.ch_size_2 rw 1
|
||||
.ch_size_3 rw 1
|
||||
.ch_color rd 1
|
||||
.ch_border_color rd 1
|
||||
.ch_text_color rd 1
|
||||
.ch_text_ptr rd 1
|
||||
.ch_text_length rw 1
|
||||
.mouseX rd 1
|
||||
.mouseY rd 1
|
||||
}
|
||||
|
||||
struc EDITBOX
|
||||
{
|
||||
.ed_width rd 1
|
||||
.ed_left rd 1
|
||||
.ed_top rd 1
|
||||
.ed_color rd 1
|
||||
.shift_color rd 1
|
||||
.ed_focus_border_color rd 1
|
||||
.ed_blur_border_color rd 1
|
||||
.ed_text_color rd 1
|
||||
.ed_max rd 1
|
||||
.ed_text rd 1
|
||||
.ed_flags rw 1
|
||||
.ed_size rd 1
|
||||
.ed_pos rd 1
|
||||
.ed_offset rd 1
|
||||
.cl_curs_x rd 1
|
||||
.cl_curs_y rd 1
|
||||
.ed_shift_pos rd 1
|
||||
.ed_shift_pos_old rd 1
|
||||
.ed_height rd 1
|
||||
.mouseX rd 1
|
||||
.mouseY rd 1
|
||||
}
|
||||
|
||||
struc PROGRESSBAR
|
||||
{
|
||||
.type rb 1
|
||||
.flag rb 1
|
||||
.color1 rd 1
|
||||
.color2 rd 1
|
||||
.x rd 1
|
||||
.y rd 1
|
||||
.sizex rd 1
|
||||
.sizey rd 1
|
||||
.progress rd 1
|
||||
.color3 rd 1
|
||||
}
|
||||
|
||||
;********************************
|
||||
;*Graphics primitives structures*
|
||||
;********************************
|
||||
struc LINE
|
||||
{
|
||||
.x1 rd 1
|
||||
.y1 rd 1
|
||||
.x2 rd 1
|
||||
.y2 rd 1
|
||||
.color rd 1
|
||||
}
|
||||
|
||||
struc PIXEL
|
||||
{
|
||||
.x rd 1
|
||||
.y rd 1
|
||||
.color rd 1
|
||||
}
|
||||
|
||||
struc FONT1
|
||||
{
|
||||
.sizeX rd 6
|
||||
.sizeY rd 9
|
||||
.x rd 1
|
||||
.y rd 1
|
||||
}
|
||||
|
||||
struc RECTANGLE
|
||||
{
|
||||
.x rd 1
|
||||
.y rd 1
|
||||
.width rd 1
|
||||
.height rd 1
|
||||
.color rd 1
|
||||
}
|
||||
|
||||
struc SCROLLBAR
|
||||
{
|
||||
.x rd 1
|
||||
.y rd 1
|
||||
}
|
||||
|
||||
Line LINE
|
||||
Pixel PIXEL
|
||||
Font FONT1
|
||||
Rectangle RECTANGLE
|
||||
ScrollBar SCROLLBAR
|
||||
ChildButton CHILDBUTTON
|
||||
|
||||
Button BUTTON
|
||||
Scroller SCROLLER
|
||||
Bookmark BOOKMARK
|
||||
Image IMAGE
|
||||
Text TEXT
|
||||
Number NUMBER
|
||||
CheckBox CHECKBOX
|
||||
EditBox EDITBOX
|
||||
ProgressBar PROGRESSBAR
|
||||
|
||||
pointer rd 50
|
||||
pointer2 rd 13
|
||||
IPC_table process_information; rb 1024
|
||||
colors_table1 rd 15
|
||||
colors_table2 rd 15
|
269
programs/develop/libGUI/src/macros.inc
Normal file
269
programs/develop/libGUI/src/macros.inc
Normal file
@@ -0,0 +1,269 @@
|
||||
; new application structure
|
||||
macro meos_app_start
|
||||
{
|
||||
use32
|
||||
org 0x0
|
||||
|
||||
db 'MENUET01'
|
||||
dd 0x01
|
||||
dd __start
|
||||
dd __end
|
||||
dd __memory
|
||||
dd __stack
|
||||
|
||||
if used __params & ~defined __params
|
||||
dd __params
|
||||
else
|
||||
dd 0x0
|
||||
end if
|
||||
|
||||
dd 0x0
|
||||
}
|
||||
MEOS_APP_START fix meos_app_start
|
||||
|
||||
macro code
|
||||
{
|
||||
__start:
|
||||
}
|
||||
CODE fix code
|
||||
|
||||
macro data
|
||||
{
|
||||
__data:
|
||||
}
|
||||
DATA fix data
|
||||
|
||||
macro udata
|
||||
{
|
||||
if used __params & ~defined __params
|
||||
__params:
|
||||
db 0
|
||||
__end:
|
||||
rb 255
|
||||
else
|
||||
__end:
|
||||
end if
|
||||
__udata:
|
||||
}
|
||||
UDATA fix udata
|
||||
|
||||
macro meos_app_end
|
||||
{
|
||||
align 32
|
||||
rb 2048
|
||||
__stack:
|
||||
__memory:
|
||||
}
|
||||
MEOS_APP_END fix meos_app_end
|
||||
|
||||
|
||||
; macro for defining multiline text data
|
||||
struc mstr [sstring]
|
||||
{
|
||||
forward
|
||||
local ssize
|
||||
virtual at 0
|
||||
db sstring
|
||||
ssize = $
|
||||
end virtual
|
||||
dd ssize
|
||||
db sstring
|
||||
common
|
||||
dd -1
|
||||
}
|
||||
|
||||
|
||||
; strings
|
||||
macro sz name,[data] { ; from MFAR [mike.dld]
|
||||
common
|
||||
if used name
|
||||
label name
|
||||
end if
|
||||
forward
|
||||
if used name
|
||||
db data
|
||||
end if
|
||||
common
|
||||
if used name
|
||||
.size = $-name
|
||||
end if
|
||||
}
|
||||
|
||||
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
|
||||
common
|
||||
if used name
|
||||
label name
|
||||
end if
|
||||
forward
|
||||
if (used name)&(lang eq lng)
|
||||
db data
|
||||
end if
|
||||
common
|
||||
if used name
|
||||
.size = $-name
|
||||
end if
|
||||
}
|
||||
|
||||
|
||||
|
||||
; easy system call macro
|
||||
macro mpack dest, hsrc, lsrc
|
||||
{
|
||||
if (hsrc eqtype 0) & (lsrc eqtype 0)
|
||||
mov dest, (hsrc) shl 16 + lsrc
|
||||
else
|
||||
if (hsrc eqtype 0) & (~lsrc eqtype 0)
|
||||
mov dest, (hsrc) shl 16
|
||||
add dest, lsrc
|
||||
else
|
||||
mov dest, hsrc
|
||||
shl dest, 16
|
||||
add dest, lsrc
|
||||
end if
|
||||
end if
|
||||
}
|
||||
|
||||
macro __mov reg,a,b { ; mike.dld
|
||||
if (~a eq)&(~b eq)
|
||||
mpack reg,a,b
|
||||
else if (~a eq)&(b eq)
|
||||
mov reg,a
|
||||
end if
|
||||
}
|
||||
|
||||
macro mcall a,b,c,d,e,f { ; mike.dld
|
||||
__mov eax,a
|
||||
__mov ebx,b
|
||||
__mov ecx,c
|
||||
__mov edx,d
|
||||
__mov esi,e
|
||||
__mov edi,f
|
||||
int 0x40
|
||||
}
|
||||
|
||||
|
||||
|
||||
; optimize the code for size
|
||||
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
|
||||
|
||||
macro add arg1,arg2
|
||||
{
|
||||
if (arg2 eqtype 0)
|
||||
if (arg2) = 1
|
||||
inc arg1
|
||||
else
|
||||
add arg1,arg2
|
||||
end if
|
||||
else
|
||||
add arg1,arg2
|
||||
end if
|
||||
}
|
||||
|
||||
macro sub arg1,arg2
|
||||
{
|
||||
if (arg2 eqtype 0)
|
||||
if (arg2) = 1
|
||||
dec arg1
|
||||
else
|
||||
sub arg1,arg2
|
||||
end if
|
||||
else
|
||||
sub arg1,arg2
|
||||
end if
|
||||
}
|
||||
|
||||
macro mov arg1,arg2
|
||||
{
|
||||
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0'))
|
||||
if (arg2) = 0
|
||||
xor arg1,arg1
|
||||
else if (arg2) = 1
|
||||
xor arg1,arg1
|
||||
inc arg1
|
||||
else if (arg2) = -1
|
||||
or arg1,-1
|
||||
else if (arg2) > -128 & (arg2) < 128
|
||||
push arg2
|
||||
pop arg1
|
||||
else
|
||||
mov arg1,arg2
|
||||
end if
|
||||
else
|
||||
mov arg1,arg2
|
||||
end if
|
||||
}
|
||||
|
||||
|
||||
macro struct name
|
||||
{
|
||||
virtual at 0
|
||||
name name
|
||||
sizeof.#name = $ - name
|
||||
end virtual
|
||||
}
|
||||
|
||||
; structures used in MeOS
|
||||
struc process_information
|
||||
{
|
||||
.cpu_usage dd ? ; +0
|
||||
.window_stack_position dw ? ; +4
|
||||
.window_stack_value dw ? ; +6
|
||||
.not_used1 dw ? ; +8
|
||||
.process_name rb 12 ; +10
|
||||
.memory_start dd ? ; +22
|
||||
.used_memory dd ? ; +26
|
||||
.PID dd ? ; +30
|
||||
.x_start dd ? ; +34
|
||||
.y_start dd ? ; +38
|
||||
.x_size dd ? ; +42
|
||||
.y_size dd ? ; +46
|
||||
.slot_state dw ? ; +50
|
||||
dw ? ; +52 - reserved
|
||||
.client_left dd ? ; +54
|
||||
.client_top dd ? ; +58
|
||||
.client_width dd ? ; +62
|
||||
.client_height dd ? ; +66
|
||||
.wnd_state db ? ; +70
|
||||
rb (1024-71)
|
||||
}
|
||||
struct process_information
|
||||
|
||||
struc system_colors
|
||||
{
|
||||
.frame dd ?
|
||||
.grab dd ?
|
||||
.grab_button dd ?
|
||||
.grab_button_text dd ?
|
||||
.grab_text dd ?
|
||||
.work dd ?
|
||||
.work_button dd ?
|
||||
.work_button_text dd ?
|
||||
.work_text dd ?
|
||||
.work_graph dd ?
|
||||
}
|
||||
struct system_colors
|
||||
|
||||
|
||||
; constants
|
||||
|
||||
; events
|
||||
EV_IDLE = 0
|
||||
EV_TIMER = 0
|
||||
EV_REDRAW = 1
|
||||
EV_KEY = 2
|
||||
EV_BUTTON = 3
|
||||
EV_EXIT = 4
|
||||
EV_BACKGROUND = 5
|
||||
EV_MOUSE = 6
|
||||
EV_IPC = 7
|
||||
EV_STACK = 8
|
||||
|
||||
; event mask bits for function 40
|
||||
EVM_REDRAW = 1b
|
||||
EVM_KEY = 10b
|
||||
EVM_BUTTON = 100b
|
||||
EVM_EXIT = 1000b
|
||||
EVM_BACKGROUND = 10000b
|
||||
EVM_MOUSE = 100000b
|
||||
EVM_IPC = 1000000b
|
||||
EVM_STACK = 10000000b
|
32
programs/develop/libGUI/src/memory.inc
Normal file
32
programs/develop/libGUI/src/memory.inc
Normal file
@@ -0,0 +1,32 @@
|
||||
;eax - size
|
||||
;OUT
|
||||
;eax - pointer
|
||||
malloc:
|
||||
|
||||
push ebx
|
||||
push ecx
|
||||
|
||||
mov ecx,eax
|
||||
mov eax,68
|
||||
mov ebx,12
|
||||
mcall
|
||||
|
||||
pop ecx
|
||||
pop ebx
|
||||
|
||||
ret
|
||||
|
||||
;eax - pointer
|
||||
free:
|
||||
push ebx
|
||||
push ecx
|
||||
|
||||
mov ecx,eax
|
||||
mov eax,68
|
||||
mov ebx,13
|
||||
mcall
|
||||
|
||||
pop ecx
|
||||
pop ebx
|
||||
|
||||
ret
|
503
programs/develop/libGUI/src/menegment_of_controls.inc
Normal file
503
programs/develop/libGUI/src/menegment_of_controls.inc
Normal file
@@ -0,0 +1,503 @@
|
||||
;****************************************************************
|
||||
;***************Elements of menegment for Controls***************
|
||||
;****************************************************************
|
||||
|
||||
;**********************************************************
|
||||
;********************craete control*************************
|
||||
;**********************************************************
|
||||
|
||||
;IN
|
||||
;eax - ctructure's size
|
||||
;ebx - Parend(pointer to structure for parend)
|
||||
;OUT
|
||||
;eax - pointer to new control
|
||||
|
||||
craete_control:
|
||||
|
||||
test eax,eax
|
||||
jnz no_null_size
|
||||
|
||||
mov eax,1
|
||||
no_null_size:
|
||||
|
||||
call malloc
|
||||
mov [ReturnControl],eax
|
||||
|
||||
push ebx ;parend
|
||||
push eax ;control
|
||||
call AddObject
|
||||
|
||||
mov eax,[ReturnControl]
|
||||
|
||||
;information about craete control output to debug board
|
||||
call new_line
|
||||
mov [s_p],s_craete
|
||||
call print_string
|
||||
debug_print_dec [ReturnControl]
|
||||
mov [s_p],s_parend
|
||||
call print_string
|
||||
debug_print_dec dword[eax+20]
|
||||
mov [s_p],s_last
|
||||
call print_string
|
||||
debug_print_dec dword[eax+4]
|
||||
;--------------------------------
|
||||
|
||||
ret
|
||||
|
||||
AddObject:
|
||||
|
||||
mov ecx,[esp+4] ;control
|
||||
mov edx,[esp+8] ;parend
|
||||
|
||||
mov eax,[edx+12] ;eax=parend->child_fd
|
||||
test eax,eax
|
||||
jnz else_parend_add_object
|
||||
|
||||
add [ControlID],1
|
||||
mov esi,[ControlID]
|
||||
|
||||
mov [edx+12],ecx ;Parend->child_fd=control
|
||||
mov [edx+16],ecx ;Parend->child_bk=control
|
||||
|
||||
mov [ecx+20],edx ;control->parend=Parend
|
||||
mov [ecx+4],edx ;control->ctrl_fd=Parend
|
||||
mov [ecx+40],esi ;control->ctrl_ID=ID
|
||||
|
||||
jmp exit_if_parend_add_object
|
||||
else_parend_add_object:
|
||||
|
||||
add [ControlID],1
|
||||
mov esi,[ControlID]
|
||||
|
||||
mov edi,[edx+16] ;last_control=Parend->child_bk
|
||||
mov [edx+16],ecx ;Parend->child_bk=control
|
||||
|
||||
mov [edi+8],ecx ;last_control->ctrl_bk=control
|
||||
mov [ecx+4],edi ;control->ctrl_fd=last_control;
|
||||
mov [ecx+20],edx ;control->parend=Parend;
|
||||
mov [ecx+40],esi ;control->ctrl_ID=ID
|
||||
|
||||
exit_if_parend_add_object:
|
||||
|
||||
ret 8
|
||||
|
||||
|
||||
;************************************************************
|
||||
;***********************Destroy control**********************
|
||||
;************************************************************
|
||||
|
||||
;Delete Control.
|
||||
;IN
|
||||
;pointer to control for delete
|
||||
;OUT
|
||||
;not returned value
|
||||
align 4
|
||||
|
||||
destroy_control:
|
||||
|
||||
mov eax,[esp+4]
|
||||
|
||||
mov ebx,[eax+20] ;get parend for control
|
||||
|
||||
;checking pointer of control to 0
|
||||
test eax,eax
|
||||
jz exit_destroy_control
|
||||
|
||||
;checking parend to main parend(parend of window)
|
||||
;if parend equ main parend than exit
|
||||
test ebx,ebx
|
||||
jz exit_destroy_control
|
||||
|
||||
mov ecx,[ebx+12] ;Parend->child_fd
|
||||
test ecx,ecx
|
||||
jz exit_destroy_control
|
||||
|
||||
mov ecx,[ebx+12] ;Parend->child_fd
|
||||
mov edx,[ebx+16] ;Parend->child_bk
|
||||
|
||||
cmp ecx,edx
|
||||
jne no_if_parend_child_fd_child_bk
|
||||
|
||||
cmp ecx,eax
|
||||
jne no_if_parend_child_fd_control
|
||||
|
||||
mov [ebx+12],dword 0 ;Parend->child_fd=0
|
||||
mov [ebx+16],dword 0 ;Parend->child_bk=0
|
||||
|
||||
;send message to control for deleting
|
||||
push eax
|
||||
|
||||
mov [Message],dword -1
|
||||
mov ebx,[eax] ;load .... for control
|
||||
push Message
|
||||
push eax
|
||||
call ebx
|
||||
|
||||
pop eax
|
||||
|
||||
push eax
|
||||
call free
|
||||
pop eax
|
||||
|
||||
call new_line
|
||||
mov [s_p],s_destroy
|
||||
call print_string
|
||||
debug_print_dec eax
|
||||
mov [s_p],s_1
|
||||
call print_string
|
||||
|
||||
jmp exit_destroy_control
|
||||
no_if_parend_child_fd_control:
|
||||
|
||||
no_if_parend_child_fd_child_bk:
|
||||
;----------------------------------------------
|
||||
mov esi,ecx ;seek_control=Parend->child_fd
|
||||
|
||||
while_seek_control:
|
||||
cmp esi,0
|
||||
je exit_destroy_control
|
||||
;*******************************************************************
|
||||
cmp esi,eax
|
||||
jne no_if_seek_control_control
|
||||
;***************************************************************
|
||||
mov edi,[esi+8]
|
||||
test edi,edi
|
||||
jz no_if_seek_control_ctrl_bk
|
||||
;***********************************************************
|
||||
mov ecx,[esi+4]
|
||||
mov edx,[esi+8]
|
||||
mov [edx+4],ecx
|
||||
|
||||
cmp ecx,ebx
|
||||
je no_if_last_control_parend
|
||||
;*******************************************************
|
||||
mov [ecx+8],edx
|
||||
jmp else_seek_control_ctrl_bk
|
||||
;*******************************************************
|
||||
no_if_last_control_parend:
|
||||
|
||||
mov [ebx+12],edx
|
||||
|
||||
jmp else_seek_control_ctrl_bk
|
||||
;*********************************************************
|
||||
no_if_seek_control_ctrl_bk:
|
||||
;**********************************************************
|
||||
|
||||
mov ecx,[esi+4] ;last_control=seek_control->ctrl_fd
|
||||
mov [ecx+8],dword 0 ;last_control->ctrl_bk=0
|
||||
mov [ebx+16],ecx ;Parend->child_bk=last_control
|
||||
|
||||
else_seek_control_ctrl_bk:
|
||||
;**********************************************************
|
||||
|
||||
;send message to control for deleting
|
||||
push eax
|
||||
|
||||
mov [Message],dword -1
|
||||
mov ebx,[eax] ;load .... for control
|
||||
push Message
|
||||
push eax
|
||||
call ebx
|
||||
|
||||
pop eax
|
||||
|
||||
push eax
|
||||
call free
|
||||
pop eax
|
||||
|
||||
call new_line
|
||||
mov [s_p],s_destroy
|
||||
call print_string
|
||||
debug_print_dec eax
|
||||
mov [s_p],s_2
|
||||
call print_string
|
||||
|
||||
jmp exit_destroy_control
|
||||
|
||||
no_if_seek_control_control:
|
||||
;****************************************************************
|
||||
|
||||
mov edi,[esi+8] ;exchange_control=seek_control->ctrl_bk
|
||||
mov esi,edi ;seek_control=exchange_control
|
||||
|
||||
jmp while_seek_control
|
||||
;*******************************************************************
|
||||
exit_destroy_control:
|
||||
|
||||
ret 4
|
||||
|
||||
;***********************************************************
|
||||
;*****************Send message to Control*******************
|
||||
;***********************************************************
|
||||
|
||||
;IN
|
||||
;pointer to message
|
||||
;pointer to parend(structure)
|
||||
;OUT
|
||||
;not returned value
|
||||
align 4
|
||||
|
||||
send_message:
|
||||
|
||||
;get pointer to parend
|
||||
mov eax,[esp+4]
|
||||
mov [Parend],eax
|
||||
|
||||
;get message
|
||||
mov esi,[esp+8]
|
||||
mov edi,dword Message
|
||||
mov ecx,4
|
||||
rep movsd
|
||||
|
||||
;load event type
|
||||
mov eax,[Message]
|
||||
|
||||
|
||||
;check for event type and get parameters for Control
|
||||
dec eax
|
||||
jnz no_window_redraw
|
||||
|
||||
mov ebx,[Parend]
|
||||
mov esi,[ebx+12] ;get pointer to first child control of parend
|
||||
mov ebx,esi
|
||||
|
||||
send_message_for_redraw_to_next_control:
|
||||
|
||||
;if esi=0 than exit
|
||||
test esi,esi
|
||||
jz exit_check_event_type
|
||||
|
||||
push ebx
|
||||
push esi
|
||||
|
||||
mov eax,ebx
|
||||
mov ebx,[eax] ;load .... for control
|
||||
push Message
|
||||
push eax
|
||||
call ebx
|
||||
|
||||
pop esi
|
||||
pop ebx
|
||||
|
||||
mov esi,[ebx+8]
|
||||
mov ebx,esi
|
||||
|
||||
jmp send_message_for_redraw_to_next_control
|
||||
|
||||
no_window_redraw:
|
||||
|
||||
dec eax
|
||||
jnz no_keys
|
||||
|
||||
|
||||
;if have active control than send message
|
||||
;checking for active control
|
||||
mov ebx,[ActiveControlForKeys]
|
||||
test ebx,ebx
|
||||
jz exit_check_event_type
|
||||
|
||||
mov eax,[ActiveControlForKeys]
|
||||
mov ebx,[eax] ;load proc for control
|
||||
push Message
|
||||
push eax
|
||||
call ebx
|
||||
|
||||
jmp exit_check_event_type
|
||||
no_keys:
|
||||
|
||||
dec eax
|
||||
jnz no_special_system_message
|
||||
|
||||
mov ebx,[Parend];
|
||||
mov esi,[ebx+12]
|
||||
mov ebx,esi
|
||||
|
||||
send_special_message_to_next_control:
|
||||
|
||||
;if esi=0 than exit
|
||||
test esi,esi
|
||||
jz exit_check_event_type
|
||||
|
||||
push ebx
|
||||
push esi
|
||||
|
||||
mov eax,ebx
|
||||
mov ebx,[eax] ;load .... for control
|
||||
push Message
|
||||
push eax
|
||||
call ebx
|
||||
|
||||
pop esi
|
||||
pop ebx
|
||||
|
||||
mov esi,[ebx+8]
|
||||
mov ebx,esi
|
||||
|
||||
jmp send_special_message_to_next_control
|
||||
|
||||
no_special_system_message:
|
||||
|
||||
;*************************************************
|
||||
;****************Mouse send message***************
|
||||
;*************************************************
|
||||
|
||||
cmp eax,3
|
||||
jne no_mouse
|
||||
|
||||
;check childrens of parend for crossing
|
||||
mov ebx,[Parend]
|
||||
mov esi,[ebx+12] ;esi =first child control
|
||||
mov ebx,esi ;ebx =first child control
|
||||
|
||||
mov eax,[Message+12]
|
||||
and eax,1b
|
||||
test eax,eax
|
||||
jz left_button_of_mouse_not_pressed
|
||||
|
||||
mov eax,[ActiveControl]
|
||||
test eax,eax
|
||||
jz havent_active_control
|
||||
|
||||
mov eax,[ActiveControl]
|
||||
mov ebx,[eax] ;load proc for control
|
||||
push Message
|
||||
push eax
|
||||
call ebx
|
||||
|
||||
jmp exit_check_event_type
|
||||
havent_active_control:
|
||||
|
||||
jmp exit_if_left_button_of_mouse__pressed
|
||||
left_button_of_mouse_not_pressed:
|
||||
|
||||
mov eax,[ActiveControl]
|
||||
test eax,eax
|
||||
jz havent_active_control_
|
||||
|
||||
mov [ActiveControl],dword 0
|
||||
|
||||
havent_active_control_:
|
||||
|
||||
exit_if_left_button_of_mouse__pressed:
|
||||
|
||||
|
||||
next_conrol_check_for_crossing_with_mouse:
|
||||
|
||||
test esi,esi
|
||||
jz exit_next_conrol_check_for_crossing_with_mouse
|
||||
|
||||
mov [PointerToControl],ebx
|
||||
|
||||
|
||||
push ebx
|
||||
push esi
|
||||
|
||||
mov eax,[ebx+28] ;eax = y coordinat of control
|
||||
mov [y_ctl],eax
|
||||
mov eax,[ebx+24] ;eax = x coordinat of control
|
||||
|
||||
mov ecx,[ebx+32] ;ecx = size x of control
|
||||
mov edx,[ebx+36] ;edx = size y of control
|
||||
mov esi,[Message+4] ;mouse x
|
||||
mov edi,[Message+8] ;mouse y
|
||||
mov ebx,[y_ctl]
|
||||
|
||||
call CheckCrossingBox
|
||||
|
||||
cmp eax,0xffffff
|
||||
jne no_activate_control
|
||||
|
||||
mov eax,[Message+12]
|
||||
and eax,1b
|
||||
test eax,eax
|
||||
jz no_activate_control
|
||||
|
||||
mov eax,[PointerToControl]
|
||||
mov [ActiveControl],eax
|
||||
mov [ActiveControlForKeys],eax
|
||||
|
||||
no_activate_control:
|
||||
|
||||
mov eax,[PointerToControl]
|
||||
mov ebx,[eax] ;load proc for control
|
||||
push Message
|
||||
push eax
|
||||
call ebx
|
||||
|
||||
pop esi
|
||||
pop ebx
|
||||
|
||||
mov esi,[ebx+8] ;16 but not 8
|
||||
mov ebx,esi
|
||||
|
||||
jmp next_conrol_check_for_crossing_with_mouse
|
||||
|
||||
exit_next_conrol_check_for_crossing_with_mouse:
|
||||
|
||||
no_mouse:
|
||||
|
||||
exit_check_event_type:
|
||||
|
||||
ret 8
|
||||
|
||||
|
||||
new_line:
|
||||
|
||||
pushad
|
||||
|
||||
mov eax,63
|
||||
mov ebx,1
|
||||
xor ecx,ecx
|
||||
mov cl,13
|
||||
int 0x40
|
||||
|
||||
mov eax,63
|
||||
mov ebx,1
|
||||
xor ecx,ecx
|
||||
mov cl,10
|
||||
int 0x40
|
||||
|
||||
popad
|
||||
|
||||
ret
|
||||
|
||||
print_string:
|
||||
|
||||
pushad
|
||||
|
||||
xor esi,esi
|
||||
|
||||
next_symbol_print:
|
||||
|
||||
mov edi,[s_p]
|
||||
add edi,esi
|
||||
|
||||
xor edx,edx
|
||||
mov dl,byte[edi]
|
||||
test dl,dl
|
||||
jz exit_print_str
|
||||
|
||||
mov eax,63
|
||||
mov ebx,1
|
||||
xor ecx,ecx
|
||||
mov cl,byte[edi]
|
||||
int 0x40
|
||||
|
||||
inc esi
|
||||
jmp next_symbol_print
|
||||
|
||||
exit_print_str:
|
||||
|
||||
popad
|
||||
|
||||
|
||||
ret
|
||||
|
||||
s_p dd 0
|
||||
s_craete db 'craete ',0
|
||||
s_destroy db 'destroy ',0
|
||||
s_parend db ' parend ',0
|
||||
s_last db ' ctrl_fd ',0
|
||||
s_next db ' ctrl_bk ',0
|
||||
s_1 db ' 1',0
|
||||
s_2 db ' 2',0
|
383
programs/develop/libGUI/src/number.inc
Normal file
383
programs/develop/libGUI/src/number.inc
Normal file
@@ -0,0 +1,383 @@
|
||||
|
||||
nm_control_data_size = 22
|
||||
nm_redraw_all = 10000000b
|
||||
nm_redraw_off = 01111111b
|
||||
nm_special_redraw_on = 100b
|
||||
nm_special_redraw_off = 11111011b
|
||||
nm_integer_type = 10b
|
||||
nm_no_show_number = 1b
|
||||
|
||||
;****************************************************
|
||||
;********************craete Number**********************
|
||||
;****************************************************
|
||||
;IN
|
||||
;pointer to parend
|
||||
;pointer to Number's structure
|
||||
;OUT
|
||||
;pointer to initialized Number's structure
|
||||
align 4
|
||||
|
||||
craete_number:
|
||||
|
||||
mov ebx,[esp+4]
|
||||
mov eax,[esp+8]
|
||||
|
||||
mov [PointerToStructureForNumber],eax
|
||||
|
||||
mov eax,control_header_size+nm_control_data_size
|
||||
call craete_control
|
||||
|
||||
;set all image's parameters in control
|
||||
mov [eax],dword number
|
||||
|
||||
mov ecx,nm_control_data_size
|
||||
mov esi,[PointerToStructureForNumber]
|
||||
mov edi,eax
|
||||
add edi,control_header_size
|
||||
rep movsb
|
||||
|
||||
call get_skin_height
|
||||
|
||||
mov ebx,[PointerToStructureForNumber]
|
||||
mov ecx,[ebx+6] ;x
|
||||
mov edx,[ebx+10] ;y
|
||||
add ecx,border_width
|
||||
add edx,[skin_height]
|
||||
;copy information to control
|
||||
mov [eax+24],ecx
|
||||
mov [eax+28],edx
|
||||
|
||||
ret 8
|
||||
|
||||
;****************************************************
|
||||
;********************Draw Number*********************
|
||||
;****************************************************
|
||||
;IN
|
||||
;pointer to control of number
|
||||
;message
|
||||
;OUT
|
||||
;not returned value
|
||||
align 4
|
||||
|
||||
number:
|
||||
|
||||
;get message
|
||||
mov eax,[esp+8]
|
||||
|
||||
;get pointer to control of image
|
||||
mov esi,[esp+4]
|
||||
mov [PointerForNumber],esi
|
||||
;copy control to local control
|
||||
add esi,control_header_size
|
||||
mov edi,dword Number
|
||||
mov ecx,nm_control_data_size
|
||||
rep movsb
|
||||
|
||||
|
||||
cmp [eax],dword 1
|
||||
jne no_redraw_all_number
|
||||
|
||||
xor ebx,ebx
|
||||
mov bl,[Number.type]
|
||||
and bl,nm_no_show_number
|
||||
test bl,bl
|
||||
jnz no_redraw_all_number
|
||||
|
||||
or [Number.type],nm_redraw_all
|
||||
|
||||
no_redraw_all_number:
|
||||
|
||||
cmp [eax],dword 3
|
||||
jne no_special_message_for_number
|
||||
|
||||
xor ebx,ebx
|
||||
mov bl,[Number.type]
|
||||
and bl,nm_special_redraw_on
|
||||
test bl,bl
|
||||
jz no_special_message_for_number
|
||||
|
||||
or [Number.type],nm_redraw_all
|
||||
and [Number.type],nm_special_redraw_off
|
||||
|
||||
no_special_message_for_number:
|
||||
|
||||
cmp [eax],dword -1
|
||||
jne no_destroy_control_of_number
|
||||
|
||||
jmp exit_number
|
||||
no_destroy_control_of_number:
|
||||
|
||||
;load coordinats and size from control
|
||||
mov eax,[PointerForNumber]
|
||||
mov ebx,[eax+24] ;x
|
||||
mov ecx,[eax+28] ;y
|
||||
;set current coordinats and sizes in zakladka
|
||||
mov [Number.x],ebx
|
||||
mov [Number.y],ecx
|
||||
|
||||
xor eax,eax
|
||||
mov al,[Number.type]
|
||||
and al,nm_redraw_all
|
||||
test al,al
|
||||
jz no_redraw_number_
|
||||
|
||||
and [Number.type],nm_redraw_off
|
||||
|
||||
mov esi,dword Number
|
||||
mov edi,[PointerForNumber]
|
||||
add edi,control_header_size
|
||||
mov ecx,2
|
||||
rep movsb
|
||||
|
||||
;get standart colors table
|
||||
mov eax,48
|
||||
mov ebx,3
|
||||
mov ecx,dword pointer2
|
||||
mov edx,40
|
||||
mcall
|
||||
|
||||
xor eax,eax
|
||||
mov al,[Number.type]
|
||||
and al,nm_integer_type
|
||||
test al,al
|
||||
jnz no_integer_number
|
||||
|
||||
mov eax,47
|
||||
mov ebx,[Number.parameters]
|
||||
mov ecx,[Number.number]
|
||||
mov edx,[Number.x]
|
||||
shl edx,16
|
||||
add edx,[Number.y]
|
||||
mov esi,[Number.color]
|
||||
mov edi,[pointer2+8]
|
||||
mcall
|
||||
|
||||
jmp no_redraw_number_
|
||||
no_integer_number:
|
||||
;---------------------------------------
|
||||
|
||||
mov ebx,[Number.parameters]
|
||||
mov ecx,ebx
|
||||
shr ebx,16 ;format for integer
|
||||
and ecx,0xffff ;format for float
|
||||
|
||||
;get integer part of float number
|
||||
mov eax,1
|
||||
mov edi,ecx
|
||||
pow_10__:
|
||||
|
||||
;eax=eax*10
|
||||
lea eax,[eax+eax*4]
|
||||
shl eax,1
|
||||
|
||||
dec edi
|
||||
jnz pow_10__
|
||||
mov edx,eax
|
||||
|
||||
;check for signum
|
||||
mov [v2],0
|
||||
fld [Number.number]
|
||||
fcom [v2]
|
||||
fstsw ax
|
||||
sahf
|
||||
jae no_signum_float_number
|
||||
|
||||
fabs
|
||||
mov [signum_float_number],byte 1
|
||||
|
||||
no_signum_float_number:
|
||||
fstp [Number.number]
|
||||
|
||||
mov [v2],edx ;v2=10^ecx
|
||||
fild [v2]
|
||||
fld [Number.number]
|
||||
fmul st0,st1
|
||||
fistp [v]
|
||||
fstp st0
|
||||
|
||||
mov esi,edx
|
||||
mov eax,[v]
|
||||
cdq
|
||||
idiv esi
|
||||
mov [v],eax
|
||||
|
||||
and [integer_part],0
|
||||
and [tochnost1],0
|
||||
|
||||
;save v in v2
|
||||
mov eax,[v]
|
||||
mov [v2],eax
|
||||
|
||||
mov [Number.flag],0
|
||||
mov esi,ebx
|
||||
get_next_razryd_of_number_integer:
|
||||
|
||||
mov eax,1
|
||||
|
||||
mov edi,esi
|
||||
pow_10_integer:
|
||||
|
||||
;eax=eax*10
|
||||
lea eax,[eax+eax*4]
|
||||
shl eax,1
|
||||
|
||||
dec edi
|
||||
jnz pow_10_integer
|
||||
|
||||
mov edi,eax
|
||||
mov eax,[v]
|
||||
cdq
|
||||
idiv edi
|
||||
and eax,0xf
|
||||
|
||||
test eax,eax
|
||||
jz no_save_pos_for_integer
|
||||
|
||||
cmp [Number.flag],0
|
||||
jne no_save_pos_for_integer
|
||||
|
||||
mov [Number.flag],1b
|
||||
mov [tochnost1],esi
|
||||
add [tochnost1],1
|
||||
|
||||
no_save_pos_for_integer:
|
||||
|
||||
imul eax,edi
|
||||
sub [v],eax
|
||||
add [integer_part],eax
|
||||
|
||||
dec esi
|
||||
jnz get_next_razryd_of_number_integer
|
||||
mov eax,[v]
|
||||
add [integer_part],eax
|
||||
|
||||
cmp [tochnost1],0
|
||||
jnz all_ok_with_tochnost
|
||||
|
||||
mov [tochnost1],1
|
||||
all_ok_with_tochnost:
|
||||
|
||||
;get float part of float number
|
||||
mov eax,[v2]
|
||||
mov [v],eax
|
||||
|
||||
mov eax,1
|
||||
mov edi,ecx
|
||||
pow_10_float__:
|
||||
|
||||
;eax=eax*10
|
||||
lea eax,[eax+eax*4]
|
||||
shl eax,1
|
||||
|
||||
dec edi
|
||||
jnz pow_10_float__
|
||||
|
||||
mov [v2],eax ;v2=10^ecx
|
||||
|
||||
fild [v2]
|
||||
fild [v]
|
||||
fld [Number.number]
|
||||
fsub st0,st1
|
||||
fmul st0,st2
|
||||
fistp [v]
|
||||
fstp st0
|
||||
fstp st0
|
||||
|
||||
and [float_part],0
|
||||
|
||||
mov esi,ecx
|
||||
get_next_razryd_of_number_float:
|
||||
|
||||
mov eax,1
|
||||
|
||||
mov edi,esi
|
||||
pow_10_float:
|
||||
|
||||
;eax=eax*10
|
||||
lea eax,[eax+eax*4]
|
||||
shl eax,1
|
||||
|
||||
dec edi
|
||||
jnz pow_10_float
|
||||
|
||||
mov edi,eax
|
||||
mov eax,[v]
|
||||
cdq
|
||||
idiv edi
|
||||
and eax,0xf
|
||||
imul eax,edi
|
||||
sub [v],eax
|
||||
add [float_part],eax
|
||||
|
||||
dec esi
|
||||
jnz get_next_razryd_of_number_float
|
||||
mov eax,[v]
|
||||
add [float_part],eax
|
||||
|
||||
mov [tochnost2],ecx
|
||||
cmp [signum_float_number],byte 1
|
||||
jne no_draw_signum_for_float_number
|
||||
|
||||
;draw signum
|
||||
mov eax,4
|
||||
mov ebx,[Number.x]
|
||||
mov ecx,[Number.color]
|
||||
mov edx,dword signum
|
||||
mov esi,1
|
||||
mov edi,[pointer2+8]
|
||||
shl ebx,16
|
||||
add ebx,[Number.y]
|
||||
mcall
|
||||
|
||||
add [Number.x],6
|
||||
mov [signum_float_number],0
|
||||
no_draw_signum_for_float_number:
|
||||
|
||||
;draw integer part of float number
|
||||
mov eax,47
|
||||
mov ebx,[tochnost1]
|
||||
mov ecx,[integer_part]
|
||||
mov edx,[Number.x]
|
||||
mov esi,[Number.color]
|
||||
mov edi,[pointer2+8]
|
||||
shl edx,16
|
||||
shl ebx,16
|
||||
add edx,[Number.y]
|
||||
mcall
|
||||
|
||||
mov edx,[tochnost1]
|
||||
add edx,1
|
||||
lea edx,[edx+edx*2]
|
||||
shl edx,1 ;edx=edx*6
|
||||
add edx,[Number.x]
|
||||
mov [x],edx
|
||||
|
||||
;draw float part of float number
|
||||
mov eax,47
|
||||
mov ebx,[tochnost2]
|
||||
mov ecx,[float_part]
|
||||
mov esi,[Number.color]
|
||||
mov edi,[pointer2+8]
|
||||
shl edx,16
|
||||
shl ebx,16
|
||||
add edx,[Number.y]
|
||||
mcall
|
||||
|
||||
;draw point betwen integer part of number and float part of number
|
||||
mov eax,4
|
||||
mov ebx,[x]
|
||||
mov ecx,[Number.color]
|
||||
mov edx,dword point
|
||||
mov esi,1
|
||||
mov edi,[pointer2+8]
|
||||
sub ebx,6
|
||||
shl ebx,16
|
||||
add ebx,[Number.y]
|
||||
mcall
|
||||
|
||||
no_redraw_number_:
|
||||
;-----------------------------------------
|
||||
|
||||
exit_number:
|
||||
|
||||
ret 8
|
459
programs/develop/libGUI/src/progress_bar.inc
Normal file
459
programs/develop/libGUI/src/progress_bar.inc
Normal file
@@ -0,0 +1,459 @@
|
||||
|
||||
pb_control_data_size = 34
|
||||
pb_redraw_all = 10000000b
|
||||
pb_redraw_all_off = 01111111b
|
||||
pb_special_progress_on = 1b
|
||||
pb_special_progress_off = 11111110b
|
||||
|
||||
;****************************************************
|
||||
;****************craete ProgressBar********************
|
||||
;****************************************************
|
||||
;IN
|
||||
;pointer to parend
|
||||
;pointer to ProgressBar's structure
|
||||
;OUT
|
||||
;pointer to initialized control
|
||||
align 4
|
||||
|
||||
craete_progress_bar:
|
||||
|
||||
mov ebx,[esp+4]
|
||||
mov eax,[esp+8]
|
||||
|
||||
mov [PointerToStructureForProgressBar],eax
|
||||
|
||||
mov eax,control_header_size+pb_control_data_size
|
||||
call craete_control
|
||||
|
||||
;set all EditBox's parameters in control
|
||||
mov [eax],dword progress_bar
|
||||
|
||||
mov ecx,pb_control_data_size
|
||||
mov esi,[PointerToStructureForProgressBar]
|
||||
mov edi,eax
|
||||
add edi,control_header_size
|
||||
rep movsb
|
||||
|
||||
call get_skin_height
|
||||
|
||||
mov ebx,[PointerToStructureForProgressBar]
|
||||
mov ecx,[ebx+10] ;x
|
||||
mov edx,[ebx+14] ;y
|
||||
mov esi,[ebx+18] ;size x
|
||||
mov edi,[ebx+22] ;size y
|
||||
add ecx,border_width
|
||||
add edx,[skin_height]
|
||||
;copy information to control
|
||||
mov [eax+24],ecx
|
||||
mov [eax+28],edx
|
||||
mov [eax+32],esi
|
||||
mov [eax+36],edi
|
||||
|
||||
ret 8
|
||||
|
||||
;****************************************************
|
||||
;*****************Draw ProgressBar********************
|
||||
;****************************************************
|
||||
;IN
|
||||
;pointer to control of ProgressBar
|
||||
;message
|
||||
;OUT
|
||||
;not returned value
|
||||
align 4
|
||||
|
||||
progress_bar:
|
||||
|
||||
;get message
|
||||
mov eax,[esp+8]
|
||||
|
||||
;get pointer to control of button
|
||||
mov esi,[esp+4]
|
||||
mov [PointerForProgressBar],esi
|
||||
|
||||
;copy control to local control
|
||||
add esi,control_header_size
|
||||
mov edi,dword ProgressBar
|
||||
mov ecx,pb_control_data_size
|
||||
rep movsb
|
||||
|
||||
|
||||
push eax
|
||||
;load coordinats and size from control
|
||||
mov eax,[PointerForProgressBar]
|
||||
mov ebx,[eax+24] ;x
|
||||
mov ecx,[eax+28] ;y
|
||||
mov edx,[eax+32] ;size x
|
||||
mov esi,[eax+36] ;size y
|
||||
;set current coordinats and sizes in EeditBox
|
||||
mov [ProgressBar.x],ebx
|
||||
mov [ProgressBar.y],ecx
|
||||
mov [ProgressBar.sizex],edx
|
||||
mov [ProgressBar.sizey],esi
|
||||
|
||||
pop eax
|
||||
|
||||
|
||||
cmp [eax],dword -1
|
||||
jne no_destroy_progress_bar
|
||||
|
||||
jmp exit_progress_bar
|
||||
no_destroy_progress_bar:
|
||||
|
||||
cmp [eax],dword 1
|
||||
jne no_redraw_all_progress_bar
|
||||
|
||||
or [ProgressBar.type],pb_redraw_all
|
||||
|
||||
no_redraw_all_progress_bar:
|
||||
|
||||
cmp [eax],dword 3
|
||||
jne no_special_message_progress_bar
|
||||
|
||||
or [ProgressBar.type],pb_special_progress_on
|
||||
|
||||
no_special_message_progress_bar:
|
||||
|
||||
xor eax,eax
|
||||
mov al,[ProgressBar.type]
|
||||
and al,pb_redraw_all
|
||||
test al,al
|
||||
jz no_draw_all_progress_bar
|
||||
|
||||
and [ProgressBar.type],pb_redraw_all_off
|
||||
|
||||
call draw_all_progress_bar
|
||||
|
||||
jmp exit_progress_bar
|
||||
|
||||
no_draw_all_progress_bar:
|
||||
|
||||
xor eax,eax
|
||||
mov al,[ProgressBar.type]
|
||||
and al,pb_special_progress_on
|
||||
test al,al
|
||||
jz no_draw_progress_bar
|
||||
|
||||
and [ProgressBar.type],pb_special_progress_off
|
||||
|
||||
call draw_progress
|
||||
|
||||
no_draw_progress_bar:
|
||||
|
||||
exit_progress_bar:
|
||||
|
||||
ret 8
|
||||
|
||||
draw_all_progress_bar:
|
||||
|
||||
mov eax,[ProgressBar.color3]
|
||||
mov ebx,dword 0xffffff
|
||||
mov ecx,20
|
||||
mov edx,dword colors_table1
|
||||
call gradient
|
||||
|
||||
mov eax,13
|
||||
mov ebx,[ProgressBar.x]
|
||||
mov ecx,[ProgressBar.y]
|
||||
mov edx,[ProgressBar.color1]
|
||||
shl ebx,16
|
||||
shl ecx,16
|
||||
add ebx,[ProgressBar.sizex]
|
||||
add ecx,[ProgressBar.sizey]
|
||||
mcall
|
||||
|
||||
mov eax,[ProgressBar.x]
|
||||
mov ebx,[ProgressBar.y]
|
||||
add eax,[ProgressBar.sizex]
|
||||
add ebx,[ProgressBar.sizey]
|
||||
mov [v],eax ;v=x+sizex
|
||||
mov [v2],ebx ;v2=y+sizey
|
||||
|
||||
;dark lines
|
||||
mov eax,[ProgressBar.color3]
|
||||
and eax,0xffffff
|
||||
mov [Line.color],eax
|
||||
mov [Pixel.color],eax
|
||||
|
||||
;(x+1,y)-(x+sizex-1,y)
|
||||
mov eax,[ProgressBar.x]
|
||||
mov ebx,[ProgressBar.y]
|
||||
mov ecx,[v]
|
||||
add eax,1
|
||||
sub ecx,1
|
||||
mov [Line.x1],eax
|
||||
mov [Line.x2],ecx
|
||||
mov [Line.y1],ebx
|
||||
mov [Line.y2],ebx
|
||||
call DrawLine
|
||||
|
||||
;(x+sizex,y+1)-(x+sizex,y+sizey-1)
|
||||
mov eax,[v]
|
||||
mov ebx,[v2]
|
||||
mov ecx,[ProgressBar.y]
|
||||
add ecx,1
|
||||
sub ebx,1
|
||||
mov [Line.x1],eax
|
||||
mov [Line.x2],eax
|
||||
mov [Line.y1],ecx
|
||||
mov [Line.y2],ebx
|
||||
call DrawLine
|
||||
|
||||
;(x+1,y+sizey)-(x+sizex-1,y+sizey)
|
||||
mov eax,[ProgressBar.x]
|
||||
mov ebx,[v]
|
||||
mov ecx,[v2]
|
||||
add eax,1
|
||||
sub ebx,1
|
||||
mov [Line.x1],eax
|
||||
mov [Line.x2],ebx
|
||||
mov [Line.y1],ecx
|
||||
mov [Line.y2],ecx
|
||||
call DrawLine
|
||||
|
||||
;(x,y+1)-(x,y_sizey-1)
|
||||
mov eax,[ProgressBar.x]
|
||||
mov ebx,[ProgressBar.y]
|
||||
mov ecx,[v2]
|
||||
add ebx,1
|
||||
sub ecx,1
|
||||
mov [Line.x1],eax
|
||||
mov [Line.x2],eax
|
||||
mov [Line.y1],ebx
|
||||
mov [Line.y2],ecx
|
||||
call DrawLine
|
||||
|
||||
;(x+1,y+1)-(x+1,y+2)
|
||||
mov eax,[ProgressBar.x]
|
||||
mov ebx,[ProgressBar.y]
|
||||
mov ecx,ebx
|
||||
add eax,1
|
||||
add ebx,1
|
||||
add ecx,2
|
||||
mov [Line.x1],eax
|
||||
mov [Line.x2],eax
|
||||
mov [Line.y1],ebx
|
||||
mov [Line.y2],ecx
|
||||
call DrawLine
|
||||
|
||||
;(x+2,y+1)
|
||||
mov eax,[ProgressBar.x]
|
||||
mov ebx,[ProgressBar.y]
|
||||
add eax,2
|
||||
add ebx,1
|
||||
mov [Pixel.x],eax
|
||||
mov [Pixel.y],ebx
|
||||
call DrawPixel
|
||||
|
||||
;(x+1,y+sizey-1)-(x+1,y+sizey-2)
|
||||
mov eax,[ProgressBar.x]
|
||||
mov ebx,[v2]
|
||||
mov ecx,ebx
|
||||
add eax,1
|
||||
sub ebx,1
|
||||
sub ecx,2
|
||||
mov [Line.x1],eax
|
||||
mov [Line.x2],eax
|
||||
mov [Line.y1],ebx
|
||||
mov [Line.y2],ecx
|
||||
call DrawLine
|
||||
|
||||
;(x+2,y+sizey-1)
|
||||
mov eax,[ProgressBar.x]
|
||||
mov ebx,[v2]
|
||||
add eax,2
|
||||
sub ebx,1
|
||||
mov [Pixel.x],eax
|
||||
mov [Pixel.y],ebx
|
||||
call DrawPixel
|
||||
|
||||
;(x+sizex-1,y+1)-(x+sizex-1,y+2)
|
||||
mov eax,[v]
|
||||
mov ebx,[ProgressBar.y]
|
||||
mov ecx,ebx
|
||||
sub eax,1
|
||||
add ebx,1
|
||||
add ecx,2
|
||||
mov [Line.x1],eax
|
||||
mov [Line.x2],eax
|
||||
mov [Line.y1],ebx
|
||||
mov [Line.y2],ecx
|
||||
call DrawLine
|
||||
|
||||
;(x+sizex-2,y+1)
|
||||
mov eax,[v]
|
||||
mov ebx,[ProgressBar.y]
|
||||
sub eax,2
|
||||
add ebx,1
|
||||
mov [Pixel.x],eax
|
||||
mov [Pixel.y],ebx
|
||||
call DrawPixel
|
||||
|
||||
;(x+sizex-1,y+sizey-2)-(x+sizex-1,y+sizey-1)
|
||||
mov eax,[v]
|
||||
mov ebx,[v2]
|
||||
mov ecx,ebx
|
||||
sub eax,1
|
||||
sub ebx,2
|
||||
sub ecx,1
|
||||
mov [Line.x1],eax
|
||||
mov [Line.x2],eax
|
||||
mov [Line.y1],ebx
|
||||
mov [Line.y2],ecx
|
||||
call DrawLine
|
||||
|
||||
;(x+sizex-2,y+sizey-1)
|
||||
mov eax,[v]
|
||||
mov ebx,[v2]
|
||||
sub eax,2
|
||||
sub ebx,1
|
||||
mov [Pixel.x],eax
|
||||
mov [Pixel.y],ebx
|
||||
call DrawPixel
|
||||
|
||||
mov eax,[colors_table1+10*3]
|
||||
and eax,0xffffff
|
||||
mov [Line.color],eax
|
||||
mov [Pixel.color],eax
|
||||
|
||||
;(x+3,y+1)-(x+sizex-3,y+1)
|
||||
mov eax,[ProgressBar.x]
|
||||
mov ebx,[v]
|
||||
mov ecx,[ProgressBar.y]
|
||||
add ecx,1
|
||||
add eax,3
|
||||
sub ebx,3
|
||||
mov [Line.x1],eax
|
||||
mov [Line.x2],ebx
|
||||
mov [Line.y1],ecx
|
||||
mov [Line.y2],ecx
|
||||
call DrawLine
|
||||
|
||||
;(x+2,y+2)
|
||||
mov eax,[ProgressBar.x]
|
||||
mov ebx,[ProgressBar.y]
|
||||
add eax,2
|
||||
add ebx,2
|
||||
mov [Pixel.x],eax
|
||||
mov [Pixel.y],ebx
|
||||
call DrawPixel
|
||||
|
||||
;(x+sizex-1,y+3)-(x+sizex-1,y+sizey-3)
|
||||
mov eax,[v]
|
||||
mov ebx,[v2]
|
||||
mov ecx,[ProgressBar.y]
|
||||
sub eax,1
|
||||
sub ebx,3
|
||||
add ecx,3
|
||||
mov [Line.x1],eax
|
||||
mov [Line.x2],eax
|
||||
mov [Line.y1],ecx
|
||||
mov [Line.y2],ebx
|
||||
call DrawLine
|
||||
|
||||
;(x+sizex-2,y+2)
|
||||
mov eax,[v]
|
||||
mov ebx,[ProgressBar.y]
|
||||
sub eax,2
|
||||
add ebx,2
|
||||
mov [Pixel.x],eax
|
||||
mov [Pixel.y],ebx
|
||||
call DrawPixel
|
||||
|
||||
;(x+3,y+sizey-1)-(x+sizex-3,y+sizey-1)
|
||||
mov eax,[ProgressBar.x]
|
||||
mov ebx,[v]
|
||||
mov ecx,[v2]
|
||||
sub ebx,3
|
||||
sub ecx,1
|
||||
add eax,3
|
||||
mov [Line.x1],eax
|
||||
mov [Line.x2],ebx
|
||||
mov [Line.y1],ecx
|
||||
mov [Line.y2],ecx
|
||||
call DrawLine
|
||||
|
||||
;(x+sizex-2,y+sizey-2)
|
||||
mov eax,[v]
|
||||
mov ebx,[v2]
|
||||
sub eax,2
|
||||
sub ebx,2
|
||||
mov [Pixel.x],eax
|
||||
mov [Pixel.y],ebx
|
||||
call DrawPixel
|
||||
|
||||
;(x+1,y+3)-(x+1,y+sizey-3)
|
||||
mov eax,[ProgressBar.x]
|
||||
mov ebx,[ProgressBar.y]
|
||||
mov ecx,[v2]
|
||||
add eax,1
|
||||
add ebx,3
|
||||
sub ecx,3
|
||||
mov [Line.x1],eax
|
||||
mov [Line.x2],eax
|
||||
mov [Line.y1],ebx
|
||||
mov [Line.y2],ecx
|
||||
call DrawLine
|
||||
|
||||
;(x+2,y+sizey-2)
|
||||
mov eax,[ProgressBar.x]
|
||||
mov ebx,[v2]
|
||||
add eax,2
|
||||
sub ebx,2
|
||||
mov [Pixel.x],eax
|
||||
mov [Pixel.y],ebx
|
||||
call DrawPixel
|
||||
|
||||
ret
|
||||
|
||||
draw_progress:
|
||||
|
||||
cmp [ProgressBar.progress],dword 0.02
|
||||
jae min_size_ok
|
||||
|
||||
mov [ProgressBar.progress],dword 0.02
|
||||
min_size_ok:
|
||||
|
||||
cmp [ProgressBar.progress],dword 1.0
|
||||
jle max_size_ok
|
||||
|
||||
mov [ProgressBar.progress],dword 1.0
|
||||
max_size_ok:
|
||||
|
||||
mov eax,[ProgressBar.sizex]
|
||||
sub eax,6
|
||||
mov [v2],eax
|
||||
|
||||
fld [ProgressBar.progress]
|
||||
fild [v2]
|
||||
fmul st0,st1
|
||||
fistp [v3]
|
||||
fstp st0
|
||||
|
||||
mov eax,[ProgressBar.color2]
|
||||
mov ebx,0xffffff
|
||||
mov ecx,[ProgressBar.x]
|
||||
mov edx,[ProgressBar.y]
|
||||
mov esi,[v3]
|
||||
mov edi,[ProgressBar.sizey]
|
||||
sub edi,4
|
||||
shr edi,1
|
||||
add ecx,3
|
||||
add edx,1
|
||||
|
||||
call rectangle_gradient_up
|
||||
|
||||
mov eax,[ProgressBar.color2]
|
||||
mov ebx,0xffffff
|
||||
mov ecx,[ProgressBar.x]
|
||||
mov edx,[ProgressBar.y]
|
||||
mov esi,[v3]
|
||||
mov edi,[ProgressBar.sizey]
|
||||
sub edi,4
|
||||
shr edi,1
|
||||
add ecx,3
|
||||
add edx,2
|
||||
add edx,edi
|
||||
|
||||
call rectangle_gradient_down
|
||||
|
||||
ret
|
24
programs/develop/libGUI/src/remove_component.inc
Normal file
24
programs/develop/libGUI/src/remove_component.inc
Normal file
@@ -0,0 +1,24 @@
|
||||
;****************************************************
|
||||
;***************Resize of GUI component**************
|
||||
;****************************************************
|
||||
;IN
|
||||
;ResizeComponent(dword Parend,dword Control,dword newx,dword newy)
|
||||
;newy
|
||||
;newx
|
||||
;Control
|
||||
;Parend
|
||||
;OUT
|
||||
;not
|
||||
|
||||
align 4
|
||||
|
||||
remove_component:
|
||||
|
||||
mov ebx,[esp+4] ;Control
|
||||
mov ecx,[esp+8] ;new x
|
||||
mov edx,[esp+12] ;new y
|
||||
|
||||
mov [ebx+24],ecx
|
||||
mov [ebx+28],edx
|
||||
|
||||
ret 12
|
24
programs/develop/libGUI/src/resize_component.inc
Normal file
24
programs/develop/libGUI/src/resize_component.inc
Normal file
@@ -0,0 +1,24 @@
|
||||
;****************************************************
|
||||
;***************Resize of GUI component**************
|
||||
;****************************************************
|
||||
;IN
|
||||
;ResizeComponent(dword Parend,dword Control,dword newx,dword newy)
|
||||
;newy
|
||||
;newx
|
||||
;Control
|
||||
;Parend
|
||||
;OUT
|
||||
;not
|
||||
|
||||
align 4
|
||||
|
||||
resize_component:
|
||||
|
||||
mov ebx,[esp+4] ;Control
|
||||
mov ecx,[esp+8] ;new size x
|
||||
mov edx,[esp+12] ;new size y
|
||||
|
||||
mov [ebx+32],ecx
|
||||
mov [ebx+36],edx
|
||||
|
||||
ret 12
|
4195
programs/develop/libGUI/src/scroller.inc
Normal file
4195
programs/develop/libGUI/src/scroller.inc
Normal file
File diff suppressed because it is too large
Load Diff
19
programs/develop/libGUI/src/string.inc
Normal file
19
programs/develop/libGUI/src/string.inc
Normal file
@@ -0,0 +1,19 @@
|
||||
;ebx - pointer to string
|
||||
GetLengthString:
|
||||
|
||||
xor ecx,ecx
|
||||
|
||||
next_simvol:
|
||||
inc ecx
|
||||
xor eax,eax
|
||||
mov al,[ebx]
|
||||
test al,al
|
||||
jz null
|
||||
inc ebx
|
||||
jmp next_simvol
|
||||
|
||||
null:
|
||||
mov eax,ecx
|
||||
dec eax
|
||||
|
||||
ret
|
180
programs/develop/libGUI/src/struct.inc
Normal file
180
programs/develop/libGUI/src/struct.inc
Normal file
@@ -0,0 +1,180 @@
|
||||
|
||||
; Macroinstructions for defining data structures
|
||||
|
||||
macro struct name
|
||||
{ fields@struct equ name
|
||||
match child parent, name \{ fields@struct equ child,fields@\#parent \}
|
||||
sub@struct equ
|
||||
struc db [val] \{ \common fields@struct equ fields@struct,.,db,<val> \}
|
||||
struc dw [val] \{ \common fields@struct equ fields@struct,.,dw,<val> \}
|
||||
struc du [val] \{ \common fields@struct equ fields@struct,.,du,<val> \}
|
||||
struc dd [val] \{ \common fields@struct equ fields@struct,.,dd,<val> \}
|
||||
struc dp [val] \{ \common fields@struct equ fields@struct,.,dp,<val> \}
|
||||
struc dq [val] \{ \common fields@struct equ fields@struct,.,dq,<val> \}
|
||||
struc dt [val] \{ \common fields@struct equ fields@struct,.,dt,<val> \}
|
||||
struc rb count \{ fields@struct equ fields@struct,.,db,count dup (?) \}
|
||||
struc rw count \{ fields@struct equ fields@struct,.,dw,count dup (?) \}
|
||||
struc rd count \{ fields@struct equ fields@struct,.,dd,count dup (?) \}
|
||||
struc rp count \{ fields@struct equ fields@struct,.,dp,count dup (?) \}
|
||||
struc rq count \{ fields@struct equ fields@struct,.,dq,count dup (?) \}
|
||||
struc rt count \{ fields@struct equ fields@struct,.,dt,count dup (?) \}
|
||||
macro db [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,db,<val> \}
|
||||
macro dw [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dw,<val> \}
|
||||
macro du [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,du,<val> \}
|
||||
macro dd [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dd,<val> \}
|
||||
macro dp [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dp,<val> \}
|
||||
macro dq [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dq,<val> \}
|
||||
macro dt [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dt,<val> \}
|
||||
macro rb count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,db,count dup (?) \}
|
||||
macro rw count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dw,count dup (?) \}
|
||||
macro rd count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dd,count dup (?) \}
|
||||
macro rp count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dp,count dup (?) \}
|
||||
macro rq count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dq,count dup (?) \}
|
||||
macro rt count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dt,count dup (?) \}
|
||||
macro union \{ fields@struct equ fields@struct,,union,<
|
||||
sub@struct equ union \}
|
||||
macro struct \{ fields@struct equ fields@struct,,substruct,<
|
||||
sub@struct equ substruct \}
|
||||
virtual at 0 }
|
||||
|
||||
macro ends
|
||||
{ match , sub@struct \{ restruc db,dw,du,dd,dp,dq,dt
|
||||
restruc rb,rw,rd,rp,rq,rt
|
||||
purge db,dw,du,dd,dp,dq,dt
|
||||
purge rb,rw,rd,rp,rq,rt
|
||||
purge union,struct
|
||||
match name=,fields,fields@struct \\{ fields@struct equ
|
||||
make@struct name,fields
|
||||
fields@\\#name equ fields \\}
|
||||
end virtual \}
|
||||
match any, sub@struct \{ fields@struct equ fields@struct> \}
|
||||
restore sub@struct }
|
||||
|
||||
macro make@struct name,[field,type,def]
|
||||
{ common
|
||||
if $
|
||||
display 'Error: definition of ',`name,' contains illegal instructions.',0Dh,0Ah
|
||||
err
|
||||
end if
|
||||
local define
|
||||
define equ name
|
||||
forward
|
||||
local sub
|
||||
match , field \{ make@substruct type,name,sub def
|
||||
define equ define,.,sub, \}
|
||||
match any, field \{ define equ define,.#field,type,<def> \}
|
||||
common
|
||||
match fields, define \{ define@struct fields \} }
|
||||
|
||||
macro define@struct name,[field,type,def]
|
||||
{ common
|
||||
local list
|
||||
list equ
|
||||
forward
|
||||
if ~ field eq .
|
||||
name#field type def
|
||||
sizeof.#name#field = $ - name#field
|
||||
else
|
||||
rb sizeof.#type
|
||||
end if
|
||||
local value
|
||||
match any, list \{ list equ list, \}
|
||||
list equ list <value>
|
||||
common
|
||||
sizeof.#name = $
|
||||
restruc name
|
||||
match values, list \{
|
||||
struc name value \\{
|
||||
match any, fields@struct \\\{ fields@struct equ fields@struct,.,name,<values> \\\}
|
||||
match , fields@struct \\\{ label .
|
||||
forward
|
||||
match , value \\\\{ field type def \\\\}
|
||||
match any, value \\\\{ field type value
|
||||
if ~ field eq .
|
||||
rb sizeof.#name#field - ($-field)
|
||||
end if \\\\}
|
||||
common \\\} \\} \} }
|
||||
|
||||
macro enable@substruct
|
||||
{ macro make@substruct substruct,parent,name,[field,type,def]
|
||||
\{ \common
|
||||
\local define
|
||||
define equ parent,name
|
||||
\forward
|
||||
\local sub
|
||||
match , field \\{ match any, type \\\{ enable@substruct
|
||||
make@substruct type,name,sub def
|
||||
purge make@substruct
|
||||
define equ define,.,sub, \\\} \\}
|
||||
match any, field \\{ define equ define,.\#field,type,<def> \\}
|
||||
\common
|
||||
match fields, define \\{ define@\#substruct fields \\} \} }
|
||||
|
||||
enable@substruct
|
||||
|
||||
macro define@union parent,name,[field,type,def]
|
||||
{ common
|
||||
virtual at 0
|
||||
forward
|
||||
if ~ field eq .
|
||||
virtual at 0
|
||||
parent#field type def
|
||||
sizeof.#parent#field = $ - parent#field
|
||||
end virtual
|
||||
if sizeof.#parent#field > $
|
||||
rb sizeof.#parent#field - $
|
||||
end if
|
||||
else if sizeof.#type > $
|
||||
rb sizeof.#type - $
|
||||
end if
|
||||
common
|
||||
sizeof.#name = $
|
||||
end virtual
|
||||
struc name [value] \{ \common
|
||||
label .\#name
|
||||
last@union equ
|
||||
forward
|
||||
match any, last@union \\{ virtual at .\#name
|
||||
field type def
|
||||
end virtual \\}
|
||||
match , last@union \\{ match , value \\\{ field type def \\\}
|
||||
match any, value \\\{ field type value \\\} \\}
|
||||
last@union equ field
|
||||
common rb sizeof.#name - ($ - .\#name) \} }
|
||||
|
||||
macro define@substruct parent,name,[field,type,def]
|
||||
{ common
|
||||
virtual at 0
|
||||
forward
|
||||
if ~ field eq .
|
||||
parent#field type def
|
||||
sizeof.#parent#field = $ - parent#field
|
||||
else
|
||||
rb sizeof.#type
|
||||
end if
|
||||
local value
|
||||
common
|
||||
sizeof.#name = $
|
||||
end virtual
|
||||
struc name value \{
|
||||
label .\#name
|
||||
forward
|
||||
match , value \\{ field type def \\}
|
||||
match any, value \\{ field type value
|
||||
if ~ field eq .
|
||||
rb sizeof.#parent#field - ($-field)
|
||||
end if \\}
|
||||
common \} }
|
150
programs/develop/libGUI/src/text.inc
Normal file
150
programs/develop/libGUI/src/text.inc
Normal file
@@ -0,0 +1,150 @@
|
||||
|
||||
tx_control_data_size = 22
|
||||
tx_no_show_text = 1b
|
||||
tx_redraw_all = 10000000b
|
||||
tx_redraw_all_off = 01111111b
|
||||
tx_special_redraw_on = 100b
|
||||
tx_special_redraw_off = 11111011b
|
||||
|
||||
;****************************************************
|
||||
;********************craete Text**********************
|
||||
;****************************************************
|
||||
;IN
|
||||
;pointer to parend
|
||||
;pointer to Text's structure
|
||||
;OUT
|
||||
;pointer to initialized Texr's structure
|
||||
align 4
|
||||
|
||||
craete_text:
|
||||
|
||||
mov ebx,[esp+4]
|
||||
mov eax,[esp+8]
|
||||
|
||||
mov [PointerToStructureForText],eax
|
||||
|
||||
mov eax,control_header_size+tx_control_data_size
|
||||
call craete_control
|
||||
|
||||
;set all image's parameters in control
|
||||
mov [eax],dword text
|
||||
|
||||
mov ecx,tx_control_data_size
|
||||
mov esi,[PointerToStructureForText]
|
||||
mov edi,eax
|
||||
add edi,control_header_size
|
||||
rep movsb
|
||||
|
||||
call get_skin_height
|
||||
|
||||
mov ebx,[PointerToStructureForText]
|
||||
mov ecx,[ebx+6] ;x
|
||||
mov edx,[ebx+10] ;y
|
||||
mov esi,[ebx+14] ;length x
|
||||
imul esi,6
|
||||
add ecx,border_width
|
||||
add edx,[skin_height]
|
||||
;copy information to control
|
||||
mov [eax+24],ecx
|
||||
mov [eax+28],edx
|
||||
mov [eax+32],esi
|
||||
mov [eax+36],dword 9
|
||||
|
||||
ret 8
|
||||
|
||||
;****************************************************
|
||||
;********************Draw Text**********************
|
||||
;****************************************************
|
||||
;IN
|
||||
;pointer to control of text
|
||||
;message
|
||||
;OUT
|
||||
;not returned value
|
||||
align 4
|
||||
|
||||
text:
|
||||
|
||||
;get message
|
||||
mov eax,[esp+8]
|
||||
|
||||
;get pointer to control of image
|
||||
mov esi,[esp+4]
|
||||
mov [PointerForText],esi
|
||||
;copy control to local control
|
||||
add esi,control_header_size
|
||||
mov edi,dword Text
|
||||
mov ecx,tx_control_data_size
|
||||
rep movsb
|
||||
|
||||
|
||||
cmp [eax],dword 1
|
||||
jne no_redraw_all_text
|
||||
|
||||
xor ebx,ebx
|
||||
mov bl,[Text.type]
|
||||
and bl,tx_no_show_text
|
||||
test bl,bl
|
||||
jnz no_redraw_all_text
|
||||
|
||||
or [Text.type],tx_redraw_all
|
||||
|
||||
no_redraw_all_text:
|
||||
|
||||
cmp [eax],dword 3
|
||||
jne no_special_message_for_text
|
||||
|
||||
xor ebx,ebx
|
||||
mov bl,[Text.type]
|
||||
and bl,tx_special_redraw_on
|
||||
test bl,bl
|
||||
jz no_special_message_for_text
|
||||
|
||||
or [Text.type],tx_redraw_all
|
||||
and [Text.type],tx_special_redraw_off
|
||||
|
||||
no_special_message_for_text:
|
||||
|
||||
;load coordinats and size from control
|
||||
mov eax,[PointerForText]
|
||||
mov ebx,[eax+24] ;x
|
||||
mov ecx,[eax+28] ;y
|
||||
;set current coordinats and sizes in zakladka
|
||||
mov [Text.x],ebx
|
||||
mov [Text.y],ecx
|
||||
|
||||
;get standart colors table
|
||||
mov eax,48
|
||||
mov ebx,3
|
||||
mov ecx,dword pointer2
|
||||
mov edx,40
|
||||
mcall
|
||||
|
||||
xor eax,eax
|
||||
mov al,[Text.type]
|
||||
and al,tx_redraw_all
|
||||
test al,al
|
||||
jz no_redraw_text_
|
||||
|
||||
and [Text.type],tx_redraw_all_off
|
||||
|
||||
mov esi,dword Text
|
||||
mov edi,[PointerForText]
|
||||
add edi,control_header_size
|
||||
mov ecx,2
|
||||
rep movsb
|
||||
|
||||
mov eax,4
|
||||
mov ebx,[Text.x]
|
||||
shl ebx,16
|
||||
add ebx,[Text.y]
|
||||
mov ecx,[Text.color]
|
||||
mov edx,[Text.pointer]
|
||||
mov esi,[Text.length]
|
||||
mov edi,[pointer2+8]
|
||||
mcall
|
||||
|
||||
no_redraw_text_:
|
||||
|
||||
exit_text:
|
||||
|
||||
ret 8
|
Reference in New Issue
Block a user