forked from KolibriOS/kolibrios
1) Example for Box_lib: ScrollBar, MenuBar, DinamicButton
2) Small change of ScrollBar git-svn-id: svn://kolibrios.org@1041 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
0c97a9c69c
commit
29efd28b74
BIN
programs/develop/libraries/box_lib/trunk/cnv_bmp.obj
Normal file
BIN
programs/develop/libraries/box_lib/trunk/cnv_bmp.obj
Normal file
Binary file not shown.
431
programs/develop/libraries/box_lib/trunk/ctrldemo.asm
Normal file
431
programs/develop/libraries/box_lib/trunk/ctrldemo.asm
Normal file
@ -0,0 +1,431 @@
|
||||
;
|
||||
; Example for Box_lib: scrollbar, menubar, dinamic_button
|
||||
; Copyright (c) 2009, Mario79
|
||||
; All rights reserved.
|
||||
;
|
||||
; Redistribution and use in source and binary forms, with or without
|
||||
; modification, are permitted provided that the following conditions are met:
|
||||
; * Redistributions of source code must retain the above copyright
|
||||
; notice, this list of conditions and the following disclaimer.
|
||||
; * Redistributions in binary form must reproduce the above copyright
|
||||
; notice, this list of conditions and the following disclaimer in the
|
||||
; documentation and/or other materials provided with the distribution.
|
||||
; * Neither the name of the <organization> nor the
|
||||
; names of its contributors may be used to endorse or promote products
|
||||
; derived from this software without specific prior written permission.
|
||||
;
|
||||
; THIS SOFTWARE IS PROVIDED BY Mario79 ''AS IS'' AND ANY
|
||||
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
|
||||
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
;*****************************************************************************
|
||||
; import_boxlib procedure written by <Lrz>
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
use32
|
||||
org 0x0
|
||||
|
||||
db 'MENUET01'
|
||||
dd 0x01
|
||||
dd START
|
||||
dd IM_END
|
||||
dd I_END
|
||||
dd stacktop
|
||||
dd 0x0
|
||||
dd path
|
||||
|
||||
include 'MACROS.INC'
|
||||
;---------------------------------------------------------------------
|
||||
;--- Start of program ----------------------------------------------
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
START:
|
||||
mcall 68, 11
|
||||
mcall 66, 1, 1
|
||||
mcall 40, 0x27
|
||||
;---------------------------------------------------------------------
|
||||
; Procinfo area for function 9 in MenuBar
|
||||
mcall 68,12,1024
|
||||
mov [menu_data_1.procinfo],eax
|
||||
mov [menu_data_2.procinfo],eax
|
||||
;---------------------------------------------------------------------
|
||||
; loading Box_Lib library
|
||||
mov ebx,boxlib_name
|
||||
mov esi,path
|
||||
mov edi,file_name
|
||||
call copy_path
|
||||
|
||||
mcall 68,19,file_name ; load of alternative
|
||||
test eax,eax
|
||||
jnz @f
|
||||
|
||||
mcall 68,19,system_dir ; load of sys directory
|
||||
test eax,eax
|
||||
jz button.exit
|
||||
@@:
|
||||
call import_boxlib
|
||||
;---------------------------------------------------------------------
|
||||
; Load and convert BMP file for DinamicButton
|
||||
; This procedures use cnv_bmp.obj and this module used only for
|
||||
; demonstration of use DinamicButton
|
||||
;
|
||||
|
||||
mov ebx,plugin_BMP_name
|
||||
mov esi,path
|
||||
mov edi,file_name
|
||||
call copy_path
|
||||
|
||||
mcall 68,19,file_name
|
||||
test eax,eax
|
||||
jz button.exit
|
||||
|
||||
mov eax,[eax+4]
|
||||
mov [plugin],eax
|
||||
|
||||
mov ebx,icons_file_name
|
||||
mov esi,path
|
||||
mov edi,file_name
|
||||
call copy_path
|
||||
|
||||
mcall 70, fileinfo
|
||||
|
||||
mov [fileinfo+0],dword 0
|
||||
|
||||
mov ecx,[file_info+32]
|
||||
mov [fileinfo+12],ecx
|
||||
mov [img_size],ecx
|
||||
|
||||
|
||||
mcall 68, 12
|
||||
|
||||
|
||||
mov [fileinfo+16],eax
|
||||
mov [image_file],eax
|
||||
|
||||
|
||||
mcall 70, fileinfo
|
||||
|
||||
xor eax,eax
|
||||
mov [return_code],eax
|
||||
mov eax,image_file
|
||||
call [plugin]
|
||||
|
||||
mov ecx,[image_file]
|
||||
mcall 68, 13,
|
||||
|
||||
cmp [return_code],dword 0
|
||||
jne button.exit
|
||||
|
||||
mov ebx,[raw_pointer]
|
||||
mov eax,[ebx+4]
|
||||
; set of button size
|
||||
mov [dinamic_button_data_1.size_x],ax
|
||||
mov [dinamic_button_data_1.size_y],ax
|
||||
mov [dinamic_button_data_2.size_x],ax
|
||||
mov [dinamic_button_data_2.size_y],ax
|
||||
mov eax,[ebx+12]
|
||||
; set of RAW resolution to pixel
|
||||
mov [dinamic_button_data_1.resolution_raw],eax
|
||||
mov [dinamic_button_data_2.resolution_raw],eax
|
||||
mov eax,[ebx+20]
|
||||
add eax,ebx
|
||||
; set RAW palette, use else resolution 8bit or less
|
||||
mov [dinamic_button_data_1.palette_raw],eax
|
||||
mov [dinamic_button_data_2.palette_raw],eax
|
||||
mov eax,[ebx+28]
|
||||
add eax,ebx
|
||||
; set RAW area for passive button
|
||||
mov [dinamic_button_data_1.passive_raw],eax
|
||||
mov [dinamic_button_data_2.passive_raw],eax
|
||||
mov ecx,[ebx+4]
|
||||
imul ecx,[ebx+4]
|
||||
imul ecx,[ebx+12]
|
||||
shr ecx,3
|
||||
add eax,ecx
|
||||
; set RAW area for active button
|
||||
mov [dinamic_button_data_1.active_raw],eax
|
||||
mov [dinamic_button_data_2.active_raw],eax
|
||||
add eax,ecx
|
||||
; RAW area for click button
|
||||
mov [dinamic_button_data_1.click_raw],eax
|
||||
mov [dinamic_button_data_2.click_raw],eax
|
||||
;---------------------------------------------------------------------
|
||||
red:
|
||||
call draw_window
|
||||
still:
|
||||
mcall 10
|
||||
|
||||
cmp eax,1
|
||||
je red
|
||||
cmp eax,2
|
||||
je key
|
||||
cmp eax,3
|
||||
je button
|
||||
cmp eax,6
|
||||
je mouse
|
||||
jmp still
|
||||
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
key:
|
||||
mcall 2
|
||||
jmp still
|
||||
;---------------------------------------------------------------------
|
||||
button:
|
||||
mcall 17
|
||||
cmp ah, 1
|
||||
jne still
|
||||
.exit:
|
||||
mcall -1
|
||||
;---------------------------------------------------------------------
|
||||
mouse:
|
||||
;-----------------------------------------------
|
||||
cmp [scroll_bar_data_horizontal.delta2],0
|
||||
jne .horizontal
|
||||
.vertical:
|
||||
mov eax,[scroll_bar_data_vertical.max_area]
|
||||
cmp eax,[scroll_bar_data_vertical.cur_area]
|
||||
jbe .horizontal
|
||||
; mouse event for Vertical ScrollBar
|
||||
push dword scroll_bar_data_vertical
|
||||
call [scrollbar_ver_mouse]
|
||||
mov eax,scroll_bar_data_vertical.redraw
|
||||
xor ebx,ebx
|
||||
cmp [eax],ebx
|
||||
je @f
|
||||
mov [eax],ebx
|
||||
jmp .draw_cube
|
||||
@@:
|
||||
cmp [scroll_bar_data_vertical.delta2],0
|
||||
jne still
|
||||
.horizontal:
|
||||
mov eax,[scroll_bar_data_horizontal.max_area]
|
||||
cmp eax,[scroll_bar_data_horizontal.cur_area]
|
||||
jbe .other
|
||||
; mouse event for Horizontal ScrollBar
|
||||
push dword scroll_bar_data_horizontal
|
||||
call [scrollbar_hor_mouse]
|
||||
mov eax,scroll_bar_data_horizontal.redraw
|
||||
xor ebx,ebx
|
||||
cmp [eax],ebx
|
||||
je .other
|
||||
mov [eax],ebx
|
||||
.draw_cube:
|
||||
call draw_cube
|
||||
jmp still
|
||||
.other:
|
||||
cmp [scroll_bar_data_vertical.delta2],0
|
||||
jne still
|
||||
cmp [scroll_bar_data_horizontal.delta2],0
|
||||
jne still
|
||||
;-----------------------------------------------
|
||||
.menu_bar_1:
|
||||
call .set_mouse_flag
|
||||
@@:
|
||||
; mouse event for Menu 1
|
||||
push dword menu_data_1
|
||||
call [menu_bar_mouse]
|
||||
cmp [menu_data_1.click],dword 1
|
||||
jne .menu_bar_2
|
||||
cmp [menu_data_1.cursor_out],dword 0
|
||||
jne analyse_out_menu_1
|
||||
jmp .menu_bar_1
|
||||
;--------------------------------------------
|
||||
.menu_bar_2:
|
||||
; mouse event for Menu 2
|
||||
push dword menu_data_2
|
||||
call [menu_bar_mouse]
|
||||
cmp [menu_data_2.click],dword 1
|
||||
jne .mouse_dinamic_button
|
||||
cmp [menu_data_2.cursor_out],dword 0
|
||||
jne analyse_out_menu_2
|
||||
jmp .menu_bar_1
|
||||
;--------------------------------------------
|
||||
.mouse_dinamic_button:
|
||||
; mouse event for Dinamic Button 1
|
||||
push dword dinamic_button_data_1
|
||||
call [dinamic_button_mouse]
|
||||
mov eax,dinamic_button_data_1.click
|
||||
cmp [eax],dword 1
|
||||
jne @f
|
||||
mov [eax],dword 0
|
||||
jmp about
|
||||
@@:
|
||||
; mouse event for Dinamic Button 2
|
||||
push dword dinamic_button_data_2
|
||||
call [dinamic_button_mouse]
|
||||
mov eax,dinamic_button_data_2.click
|
||||
cmp [eax],dword 1
|
||||
jne still ;@f
|
||||
mov [eax],dword 0
|
||||
jmp button.exit
|
||||
;---------------------------------------------------------------------
|
||||
.set_mouse_flag:
|
||||
xor eax,eax
|
||||
inc eax
|
||||
mov [menu_data_1.get_mouse_flag],eax
|
||||
mov [menu_data_2.get_mouse_flag],eax
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
analyse_out_menu_1:
|
||||
; analyse result of Menu 1
|
||||
cmp [menu_data_1.cursor_out],dword 3
|
||||
je button.exit
|
||||
jmp still
|
||||
|
||||
analyse_out_menu_2:
|
||||
; analyse result of Menu 2
|
||||
cmp [menu_data_2.cursor_out],dword 2
|
||||
je about
|
||||
jmp still
|
||||
;---------------------------------------------------------------------
|
||||
about:
|
||||
mcall 51,1,thread3,thread
|
||||
jmp still
|
||||
;---------------------------------------------------------------------
|
||||
draw_window:
|
||||
mcall 12, 1
|
||||
mcall 0, <0,400>, <0,400>, 0x03AABBCC, 0x805080D0, 0x005080D0
|
||||
mcall 71, 1, header_1
|
||||
;---------------------------------------------
|
||||
; draw for Menu 1
|
||||
push dword menu_data_1
|
||||
call [menu_bar_draw]
|
||||
; draw for Menu 2
|
||||
push dword menu_data_2
|
||||
call [menu_bar_draw]
|
||||
;---------------------------------------------
|
||||
; draw for Dinamic Button 1
|
||||
push dword dinamic_button_data_1
|
||||
call [dinamic_button_draw]
|
||||
; draw for Dinamic Button 2
|
||||
push dword dinamic_button_data_2
|
||||
call [dinamic_button_draw]
|
||||
;---------------------------------------------
|
||||
; set all_redraw flag for draw all ScrollBar
|
||||
; In some cases it is necessity to draw only the area
|
||||
; of moving of a "runner", for acceleration of output -
|
||||
; in this case the flag needs to be reset to 0 (zero).
|
||||
xor eax,eax
|
||||
inc eax
|
||||
mov [scroll_bar_data_vertical.all_redraw],eax
|
||||
mov [scroll_bar_data_horizontal.all_redraw],eax
|
||||
|
||||
; draw for Vertical ScrollBar
|
||||
push dword scroll_bar_data_vertical
|
||||
call [scrollbar_ver_draw]
|
||||
; draw for Horizontal ScrollBar
|
||||
push dword scroll_bar_data_horizontal
|
||||
call [scrollbar_hor_draw]
|
||||
; reset all_redraw flag
|
||||
xor eax,eax
|
||||
mov [scroll_bar_data_vertical.all_redraw],eax
|
||||
mov [scroll_bar_data_horizontal.all_redraw],eax
|
||||
;---------------------------------------------
|
||||
call draw_cube
|
||||
mcall 12, 2
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
draw_cube:
|
||||
mcall 13,<30,301>,<50,301>,0xafafaf
|
||||
mov ecx,[scroll_bar_data_vertical.position]
|
||||
add ecx,50
|
||||
shl ecx,16
|
||||
mov cx,30
|
||||
mov ebx,[scroll_bar_data_horizontal.position]
|
||||
add ebx,30
|
||||
shl ebx,16
|
||||
mov bx,30
|
||||
mcall 13, , , 0x0
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
copy_path:
|
||||
xor eax,eax
|
||||
@@:
|
||||
cld
|
||||
lodsb
|
||||
stosb
|
||||
test eax,eax
|
||||
jnz @b
|
||||
mov esi,edi
|
||||
@@:
|
||||
std
|
||||
lodsb
|
||||
cmp al,'/'
|
||||
jnz @b
|
||||
mov edi,esi
|
||||
add edi,2
|
||||
mov esi,ebx
|
||||
@@:
|
||||
cld
|
||||
lodsb
|
||||
stosb
|
||||
test eax,eax
|
||||
jnz @b
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
; Import procedure written by <Lrz>
|
||||
; Copyright (c) 2008, 2009, <Lrz>
|
||||
; All rights reserved.
|
||||
; importing Box_lib entry
|
||||
|
||||
import_boxlib:
|
||||
; initialize import
|
||||
mov edx, eax
|
||||
mov esi,myimport
|
||||
.import_loop:
|
||||
lodsd
|
||||
test eax, eax
|
||||
jz .import_done
|
||||
push edx
|
||||
.import_find:
|
||||
mov ebx, [edx]
|
||||
test ebx, ebx
|
||||
jz .exit ;import_not_found
|
||||
push eax
|
||||
@@:
|
||||
mov cl, [eax]
|
||||
cmp cl, [ebx]
|
||||
jnz .import_find_next
|
||||
test cl, cl
|
||||
jz .import_found
|
||||
inc eax
|
||||
inc ebx
|
||||
jmp @b
|
||||
.import_find_next:
|
||||
pop eax
|
||||
add edx, 8
|
||||
jmp .import_find
|
||||
.import_found:
|
||||
pop eax
|
||||
mov eax, [edx+4]
|
||||
mov [esi-4], eax
|
||||
pop edx
|
||||
jmp .import_loop
|
||||
.import_done:
|
||||
ret
|
||||
.exit:
|
||||
add esp,4
|
||||
jmp button.exit
|
||||
;---------------------------------------------------------------------
|
||||
include 'data.inc'
|
||||
include 'w_about.inc'
|
||||
IM_END:
|
||||
rb 1024
|
||||
thread:
|
||||
rb 1024
|
||||
stacktop:
|
||||
path:
|
||||
rb 4096
|
||||
file_name:
|
||||
rb 4096
|
||||
file_info:
|
||||
rb 40
|
||||
I_END:
|
||||
|
311
programs/develop/libraries/box_lib/trunk/data.inc
Normal file
311
programs/develop/libraries/box_lib/trunk/data.inc
Normal file
@ -0,0 +1,311 @@
|
||||
;---------------------------------------------------------------------
|
||||
;--- ÄÀÍÍÛÅ ÏÐÎÃÐÀÌÌÛ ----------------------------------------------
|
||||
;---------------------------------------------------------------------
|
||||
header_1 db 'Box_lib Control Demo by Mario79',0
|
||||
|
||||
ok_btn db 'Ok',0
|
||||
|
||||
labelt3 db 'About program',0
|
||||
;---------------------------------------------------------------------
|
||||
icons_file_name: db 'reload_16x16_8b.bmp',0
|
||||
|
||||
plugin_BMP_name db 'cnv_bmp.obj',0
|
||||
boxlib_name db 'box_lib.obj',0
|
||||
|
||||
system_dir db '/sys/lib/box_lib.obj',0
|
||||
;---------------------------------------------------------------------
|
||||
fileinfo:
|
||||
dd 5
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd file_info
|
||||
string:
|
||||
db 0
|
||||
dd file_name
|
||||
|
||||
plugin dd 0
|
||||
;---------------------------------------------------------------------
|
||||
; not change this section!!!
|
||||
; start section
|
||||
;---------------------------------------------------------------------
|
||||
image_file dd 0
|
||||
raw_pointer dd 0
|
||||
return_code dd 0
|
||||
img_size dd 0
|
||||
deflate_unpack dd 0
|
||||
;---------------------------------------------------------------------
|
||||
; end section
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
myimport:
|
||||
|
||||
edit_box_draw dd aEdit_box_draw
|
||||
edit_box_key dd aEdit_box_key
|
||||
edit_box_mouse dd aEdit_box_mouse
|
||||
version_ed dd aVersion_ed
|
||||
|
||||
check_box_draw dd aCheck_box_draw
|
||||
check_box_mouse dd aCheck_box_mouse
|
||||
version_ch dd aVersion_ch
|
||||
|
||||
option_box_draw dd aOption_box_draw
|
||||
option_box_mouse dd aOption_box_mouse
|
||||
version_op dd aVersion_op
|
||||
|
||||
scrollbar_ver_draw dd aScrollbar_ver_draw
|
||||
scrollbar_ver_mouse dd aScrollbar_ver_mouse
|
||||
scrollbar_hor_draw dd aScrollbar_hor_draw
|
||||
scrollbar_hor_mouse dd aScrollbar_hor_mouse
|
||||
version_scrollbar dd aVersion_scrollbar
|
||||
|
||||
dinamic_button_draw dd aDbutton_draw
|
||||
dinamic_button_mouse dd aDbutton_mouse
|
||||
version_dbutton dd aVersion_dbutton
|
||||
|
||||
menu_bar_draw dd aMenu_bar_draw
|
||||
menu_bar_mouse dd aMenu_bar_mouse
|
||||
version_menu_bar dd aVersion_menu_bar
|
||||
dd 0
|
||||
dd 0
|
||||
|
||||
aEdit_box_draw db 'edit_box',0
|
||||
aEdit_box_key db 'edit_box_key',0
|
||||
aEdit_box_mouse db 'edit_box_mouse',0
|
||||
aVersion_ed db 'version_ed',0
|
||||
|
||||
aCheck_box_draw db 'check_box_draw',0
|
||||
aCheck_box_mouse db 'check_box_mouse',0
|
||||
aVersion_ch db 'version_ch',0
|
||||
|
||||
aOption_box_draw db 'option_box_draw',0
|
||||
aOption_box_mouse db 'option_box_mouse',0
|
||||
aVersion_op db 'version_op',0
|
||||
|
||||
aScrollbar_ver_draw db 'scrollbar_v_draw',0
|
||||
aScrollbar_ver_mouse db 'scrollbar_v_mouse',0
|
||||
aScrollbar_hor_draw db 'scrollbar_h_draw',0
|
||||
aScrollbar_hor_mouse db 'scrollbar_h_mouse',0
|
||||
aVersion_scrollbar db 'version_scrollbar',0
|
||||
|
||||
aDbutton_draw db 'dbutton_draw',0
|
||||
aDbutton_mouse db 'dbutton_mouse',0
|
||||
aVersion_dbutton db 'version_dbutton',0
|
||||
|
||||
aMenu_bar_draw db 'menu_bar_draw',0
|
||||
aMenu_bar_mouse db 'menu_bar_mouse',0
|
||||
aVersion_menu_bar db 'version_menu_bar',0
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
scroll_bar_data_vertical:
|
||||
.x:
|
||||
.size_x dw 15 ;+0
|
||||
.start_x dw 370 ;+2
|
||||
.y:
|
||||
.size_y dw 300 ;+4
|
||||
.start_y dw 50 ;+6
|
||||
.btn_high dd 15 ;+8
|
||||
.type dd 1 ;+12
|
||||
.max_area dd 300 ;+16
|
||||
.cur_area dd 30 ;+20
|
||||
.position dd 140 ;+24
|
||||
.bckg_col dd 0xeeeeee ;+28
|
||||
.frnt_col dd 0xbbddff ;+32
|
||||
.line_col dd 0 ;+36
|
||||
.redraw dd 0 ;+40
|
||||
.delta dw 0 ;+44
|
||||
.delta2 dw 0 ;+46
|
||||
.run_x:
|
||||
.r_size_x dw 0 ;+48
|
||||
.r_start_x dw 0 ;+50
|
||||
.run_y:
|
||||
.r_size_y dw 0 ;+52
|
||||
.r_start_y dw 0 ;+54
|
||||
.m_pos dd 0 ;+56
|
||||
.m_pos_2 dd 0 ;+60
|
||||
.m_keys dd 0 ;+64
|
||||
.run_size dd 0 ;+68
|
||||
.position2 dd 0 ;+72
|
||||
.work_size dd 0 ;+76
|
||||
.all_redraw dd 0 ;+80
|
||||
.ar_offset dd 10 ;+84
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
scroll_bar_data_horizontal:
|
||||
.x:
|
||||
.size_x dw 300 ;0 ;+0
|
||||
.start_x dw 30 ;0 ;+2
|
||||
.y:
|
||||
.size_y dw 15 ;0 ;+4
|
||||
.start_y dw 370 ;0 ;+6
|
||||
.btn_high dd 15 ;+8
|
||||
.type dd 1 ;+12
|
||||
.max_area dd 300 ;+16
|
||||
.cur_area dd 30 ;+20
|
||||
.position dd 140 ;+24
|
||||
.bckg_col dd 0xeeeeee ;+28
|
||||
.frnt_col dd 0xbbddff ;+32
|
||||
.line_col dd 0 ;+36
|
||||
.redraw dd 0 ;+40
|
||||
.delta dw 0 ;+44
|
||||
.delta2 dw 0 ;+46
|
||||
.run_x:
|
||||
.r_size_x dw 0 ;+48
|
||||
.r_start_x dw 0 ;+50
|
||||
.run_y:
|
||||
.r_size_y dw 0 ;+52
|
||||
.r_start_y dw 0 ;+54
|
||||
.m_pos dd 0 ;+56
|
||||
.m_pos_2 dd 0 ;+60
|
||||
.m_keys dd 0 ;+64
|
||||
.run_size dd 0 ;+68
|
||||
.position2 dd 0 ;+72
|
||||
.work_size dd 0 ;+76
|
||||
.all_redraw dd 0 ;+80
|
||||
.ar_offset dd 10 ;+84
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
menu_data_1:
|
||||
.type: dd 0 ;+0
|
||||
.x:
|
||||
.size_x dw 40 ;+4
|
||||
.start_x dw 20 ;+6
|
||||
.y:
|
||||
.size_y dw 15 ;+8
|
||||
.start_y dw 25 ;+10
|
||||
.text_pointer: dd menu_text_area ;0 ;+12
|
||||
.pos_pointer: dd menu_text_area.1 ;0 ;+16
|
||||
.text_end dd menu_text_area.end ;0 ;+20
|
||||
.mouse_pos dd 0 ;+24
|
||||
.mouse_keys dd 0 ;+28
|
||||
.x1:
|
||||
.size_x1 dw 40 ;+32
|
||||
.start_x1 dw 20 ;+34
|
||||
.y1:
|
||||
.size_y1 dw 100 ;+36
|
||||
.start_y1 dw 40 ;+38
|
||||
.bckg_col dd 0xeeeeee ;+40
|
||||
.frnt_col dd 0xff ;+44
|
||||
.menu_col dd 0xffffff ;+48
|
||||
.select dd 0 ;+52
|
||||
.out_select dd 0 ;+56
|
||||
.buf_adress dd 0 ;+60
|
||||
.procinfo dd 0 ;+64
|
||||
.click dd 0 ;+68
|
||||
.cursor dd 0 ;+72
|
||||
.cursor_old dd 0 ;+76
|
||||
.interval dd 16 ;+80
|
||||
.cursor_max dd 0 ;+84
|
||||
.extended_key dd 0 ;+88
|
||||
.menu_sel_col dd 0x00cc00 ;+92
|
||||
.bckg_text_col dd 0 ; +96
|
||||
.frnt_text_col dd 0xffffff ;+100
|
||||
.mouse_keys_old dd 0 ;+104
|
||||
.font_height dd 8 ;+108
|
||||
.cursor_out dd 0 ;+112
|
||||
.get_mouse_flag dd 0 ;+116
|
||||
;-------------------------
|
||||
menu_text_area:
|
||||
db 'File',0
|
||||
.1:
|
||||
db 'Test1',0
|
||||
db 'Test2',0
|
||||
db 'Exit',0
|
||||
.end:
|
||||
db 0
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
menu_data_2:
|
||||
.type: dd 0 ;+0
|
||||
.x:
|
||||
.size_x dw 40 ;+4
|
||||
.start_x dw 60 ;+6
|
||||
.y:
|
||||
.size_y dw 15 ;+8
|
||||
.start_y dw 25 ;+10
|
||||
.text_pointer: dd menu_text_area_2 ;0 ;+12
|
||||
.pos_pointer: dd menu_text_area_2.1 ;0 ;+16
|
||||
.text_end dd menu_text_area_2.end ;0 ;+20
|
||||
.mouse_pos dd 0 ;+24
|
||||
.mouse_keys dd 0 ;+28
|
||||
.x1:
|
||||
.size_x1 dw 50 ;+32
|
||||
.start_x1 dw 60 ;+34
|
||||
.y1:
|
||||
.size_y1 dw 100 ;+36
|
||||
.start_y1 dw 40 ;+38
|
||||
.bckg_col dd 0xeeeeee ;+40
|
||||
.frnt_col dd 0xff ;+44
|
||||
.menu_col dd 0xffffff ;+48
|
||||
.select dd 0 ;+52
|
||||
.out_select dd 0 ;+56
|
||||
.buf_adress dd 0 ;+60
|
||||
.procinfo dd 0 ;+64
|
||||
.click dd 0 ;+68
|
||||
.cursor dd 0 ;+72
|
||||
.cursor_old dd 0 ;+76
|
||||
.interval dd 16 ;+80
|
||||
.cursor_max dd 0 ;+84
|
||||
.extended_key dd 0 ;+88
|
||||
.menu_sel_col dd 0x00cc00 ;+92
|
||||
.bckg_text_col dd 0 ; +96
|
||||
.frnt_text_col dd 0xffffff ;+100
|
||||
.mouse_keys_old dd 0 ;+104
|
||||
.font_height dd 8 ;+108
|
||||
.cursor_out dd 0 ;+112
|
||||
.get_mouse_flag dd 0 ;+116
|
||||
;------------------------
|
||||
menu_text_area_2:
|
||||
db 'Help',0
|
||||
.1:
|
||||
db 'Test1',0
|
||||
db 'About',0
|
||||
.end:
|
||||
db 0
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
dinamic_button_data_1:
|
||||
.type dd 0 ;+0
|
||||
.x:
|
||||
.size_x dw 20 ;+4
|
||||
.start_x dw 150 ;+6
|
||||
.y:
|
||||
.size_y dw 20 ;+8
|
||||
.start_y dw 25 ;+10
|
||||
.mouse_pos dd 0 ;+12
|
||||
.mouse_keys dd 0 ;+16
|
||||
.mouse_keys_old dd 0 ;+20
|
||||
.active_raw dd 0 ;+24
|
||||
.passive_raw dd 0 ;+28
|
||||
.click_raw dd 0 ;+32
|
||||
.resolution_raw dd 0 ;+36
|
||||
.palette_raw dd 0 ;+40
|
||||
.offset_raw dd 0 ;+44
|
||||
.select dd 0 ;+48
|
||||
.click dd 0 ;+52
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
dinamic_button_data_2:
|
||||
.type dd 0 ;+0
|
||||
.x:
|
||||
.size_x dw 20 ;+4
|
||||
.start_x dw 180 ;+6
|
||||
.y:
|
||||
.size_y dw 20 ;+8
|
||||
.start_y dw 25 ;+10
|
||||
.mouse_pos dd 0 ;+12
|
||||
.mouse_keys dd 0 ;+16
|
||||
.mouse_keys_old dd 0 ;+20
|
||||
.active_raw dd 0 ;+24
|
||||
.passive_raw dd 0 ;+28
|
||||
.click_raw dd 0 ;+32
|
||||
.resolution_raw dd 0 ;+36
|
||||
.palette_raw dd 0 ;+40
|
||||
.offset_raw dd 0 ;+44
|
||||
.select dd 0 ;+48
|
||||
.click dd 0 ;+52
|
||||
;---------------------------------------------------------------------
|
BIN
programs/develop/libraries/box_lib/trunk/reload_16x16_8b.bmp
Normal file
BIN
programs/develop/libraries/box_lib/trunk/reload_16x16_8b.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
@ -1,4 +1,6 @@
|
||||
@fasm.exe -m 16384 box_lib.asm
|
||||
@fasm.exe -m 16384 editbox_ex.asm editbox_ex.kex
|
||||
@fasm.exe -m 16384 ctrldemo.asm ctrldemo.kex
|
||||
REM ..\FASM\kpack.exe editbox_ex
|
||||
@klbrinwin.exe editbox_ex.kex
|
||||
rem @klbrinwin.exe editbox_ex.kex
|
||||
pause
|
@ -5,14 +5,14 @@
|
||||
;
|
||||
; Redistribution and use in source and binary forms, with or without
|
||||
; modification, are permitted provided that the following conditions are met:
|
||||
; * Redistributions of source code must retain the above copyright
|
||||
; notice, this list of conditions and the following disclaimer.
|
||||
; * Redistributions in binary form must reproduce the above copyright
|
||||
; notice, this list of conditions and the following disclaimer in the
|
||||
; documentation and/or other materials provided with the distribution.
|
||||
; * Neither the name of the <organization> nor the
|
||||
; names of its contributors may be used to endorse or promote products
|
||||
; derived from this software without specific prior written permission.
|
||||
; * Redistributions of source code must retain the above copyright
|
||||
; notice, this list of conditions and the following disclaimer.
|
||||
; * Redistributions in binary form must reproduce the above copyright
|
||||
; notice, this list of conditions and the following disclaimer in the
|
||||
; documentation and/or other materials provided with the distribution.
|
||||
; * Neither the name of the <organization> nor the
|
||||
; names of its contributors may be used to endorse or promote products
|
||||
; derived from this software without specific prior written permission.
|
||||
;
|
||||
; THIS SOFTWARE IS PROVIDED BY Mario79 ''AS IS'' AND ANY
|
||||
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
@ -87,7 +87,7 @@ macro draw_down_arrow_vertical
|
||||
mov edx,sb_line_col
|
||||
sub ebx,4 shl 16
|
||||
mov bx,7
|
||||
sub ecx,2 shl 16
|
||||
sub ecx,2 shl 16
|
||||
mov cx,1
|
||||
mov eax,13
|
||||
int 0x40
|
||||
@ -123,7 +123,7 @@ macro draw_runner_center_vertical
|
||||
add ecx,edx
|
||||
mov edx,sb_line_col
|
||||
sub ecx,8 shl 16
|
||||
sub ebx,5 shl 16
|
||||
sub ebx,5 shl 16
|
||||
mov bx,10
|
||||
add ecx,4 shl 16
|
||||
mov cx,1
|
||||
@ -255,32 +255,33 @@ macro draw_runner_center_horizontal
|
||||
macro use_scroll_bar
|
||||
{
|
||||
scroll_bar:
|
||||
sb_size_x equ [edi]
|
||||
sb_start_x equ [edi+2]
|
||||
sb_size_y equ [edi+4]
|
||||
sb_start_y equ [edi+6]
|
||||
sb_btn_high equ [edi+8]
|
||||
sb_type equ [edi+12]
|
||||
sb_max_area equ [edi+16]
|
||||
sb_cur_area equ [edi+20]
|
||||
sb_position equ [edi+24]
|
||||
sb_bckg_col equ [edi+28]
|
||||
sb_frnt_col equ [edi+32]
|
||||
sb_line_col equ [edi+36]
|
||||
sb_redraw equ [edi+40]
|
||||
sb_delta equ [edi+44]
|
||||
sb_delta2 equ [edi+46]
|
||||
sb_r_size_x equ [edi+48]
|
||||
sb_r_start_x equ [edi+50]
|
||||
sb_r_size_y equ [edi+52]
|
||||
sb_r_start_y equ [edi+54]
|
||||
sb_m_pos equ [edi+56]
|
||||
sb_m_pos_2 equ [edi+60]
|
||||
sb_m_keys equ [edi+64]
|
||||
sb_run_size equ [edi+68]
|
||||
sb_position2 equ [edi+72]
|
||||
sb_work_size equ [edi+76]
|
||||
sb_all_redraw equ [edi+80]
|
||||
sb_size_x equ [edi]
|
||||
sb_start_x equ [edi+2]
|
||||
sb_size_y equ [edi+4]
|
||||
sb_start_y equ [edi+6]
|
||||
sb_btn_high equ [edi+8]
|
||||
sb_type equ [edi+12]
|
||||
sb_max_area equ [edi+16]
|
||||
sb_cur_area equ [edi+20]
|
||||
sb_position equ [edi+24]
|
||||
sb_bckg_col equ [edi+28]
|
||||
sb_frnt_col equ [edi+32]
|
||||
sb_line_col equ [edi+36]
|
||||
sb_redraw equ [edi+40]
|
||||
sb_delta equ [edi+44]
|
||||
sb_delta2 equ [edi+46]
|
||||
sb_r_size_x equ [edi+48]
|
||||
sb_r_start_x equ [edi+50]
|
||||
sb_r_size_y equ [edi+52]
|
||||
sb_r_start_y equ [edi+54]
|
||||
sb_m_pos equ [edi+56]
|
||||
sb_m_pos_2 equ [edi+60]
|
||||
sb_m_keys equ [edi+64]
|
||||
sb_run_size equ [edi+68]
|
||||
sb_position2 equ [edi+72]
|
||||
sb_work_size equ [edi+76]
|
||||
sb_all_redraw equ [edi+80]
|
||||
sb_ar_offset equ [edi+84]
|
||||
}
|
||||
;*****************************************************************************
|
||||
;*****************************************************************************
|
||||
@ -293,7 +294,8 @@ scroll_bar_vertical:
|
||||
.draw:
|
||||
pusha
|
||||
mov edi,dword [esp+36]
|
||||
mov sb_all_redraw,dword 1
|
||||
; mov sb_all_redraw,dword 1
|
||||
mov sb_delta,word 0
|
||||
call .draw_1
|
||||
mov sb_all_redraw,dword 0
|
||||
scroll_bar_exit
|
||||
@ -310,7 +312,7 @@ scroll_bar_exit
|
||||
mov eax,sb_work_size ;sb_max_area
|
||||
mov ebx,sb_max_area
|
||||
cmp ebx,sb_cur_area
|
||||
ja @f
|
||||
ja @f
|
||||
|
||||
jmp .no_size
|
||||
|
||||
@ -326,12 +328,12 @@ scroll_bar_exit
|
||||
mov sb_run_size,eax
|
||||
;*********************************
|
||||
cmp sb_delta,word 1
|
||||
je .@@_3
|
||||
je .@@_3
|
||||
mov eax,sb_work_size
|
||||
sub eax,sb_run_size
|
||||
mov ebx,sb_max_area
|
||||
cmp ebx,sb_cur_area
|
||||
ja @f
|
||||
ja @f
|
||||
xor eax,eax
|
||||
jmp .@@_1
|
||||
@@:
|
||||
@ -419,7 +421,7 @@ draw_up_arrow_vertical
|
||||
test cx,0x8000
|
||||
jnz @f
|
||||
mov edx,sb_bckg_col
|
||||
int 0x40 ; top interval
|
||||
int 0x40 ; top interval
|
||||
@@:
|
||||
;*********************************
|
||||
shr ecx,16
|
||||
@ -428,7 +430,7 @@ draw_up_arrow_vertical
|
||||
shl ecx,16
|
||||
inc ecx
|
||||
mov edx,sb_line_col
|
||||
int 0x40 ; runner - top extreme line
|
||||
int 0x40 ; runner - top extreme line
|
||||
|
||||
add ecx,1 shl 16
|
||||
mov cx,0
|
||||
@ -510,16 +512,16 @@ draw_down_arrow_vertical
|
||||
;*****************************************************************************
|
||||
.mouse:
|
||||
pusha
|
||||
mov edi,dword [esp+36]
|
||||
mov edi,dword [esp+36]
|
||||
mcall 37,1
|
||||
mov sb_m_pos,eax
|
||||
cmp sb_m_pos_2,dword 0
|
||||
jne @f
|
||||
|
||||
mov sb_m_pos_2,eax
|
||||
mov sb_m_pos_2,eax
|
||||
@@:
|
||||
mcall 37,2
|
||||
mov sb_m_keys,eax
|
||||
mov sb_m_keys,eax
|
||||
|
||||
cmp sb_m_keys,eax
|
||||
je @f
|
||||
@ -537,7 +539,7 @@ draw_down_arrow_vertical
|
||||
jne @f ;.continue_2
|
||||
mov eax,sb_m_pos
|
||||
mov sb_m_pos_2,eax
|
||||
jmp .correct_1 ;.exit_sb
|
||||
jmp .correct_1 ;.exit_sb
|
||||
@@:
|
||||
mov sb_delta,word 1
|
||||
|
||||
@ -556,56 +558,56 @@ draw_down_arrow_vertical
|
||||
|
||||
mov cx,sb_start_y
|
||||
cmp ax,cx
|
||||
jb .exit_sb
|
||||
jb .exit_sb
|
||||
|
||||
cmp sb_delta2,word 0
|
||||
je @f
|
||||
je @f
|
||||
push ecx
|
||||
add cx,sb_btn_high
|
||||
cmp ax,cx
|
||||
pop ecx
|
||||
jb .exit_sb
|
||||
jb .exit_sb
|
||||
|
||||
@@:
|
||||
add cx,sb_size_y
|
||||
cmp ax,cx
|
||||
ja .exit_sb
|
||||
ja .exit_sb
|
||||
|
||||
cmp sb_delta2,word 0
|
||||
je @f
|
||||
je @f
|
||||
sub cx,sb_btn_high
|
||||
cmp ax,cx
|
||||
ja .exit_sb
|
||||
ja .exit_sb
|
||||
|
||||
@@:
|
||||
cmp sb_delta2,word 1
|
||||
je @f
|
||||
je @f
|
||||
|
||||
cmp sb_m_keys,dword 0
|
||||
je .exit_sb
|
||||
|
||||
je .exit_sb
|
||||
|
||||
mov cx,sb_start_x
|
||||
cmp bx,cx
|
||||
jb .exit_sb
|
||||
jb .exit_sb
|
||||
|
||||
add cx,sb_size_x
|
||||
cmp bx,cx
|
||||
ja .exit_sb
|
||||
ja .exit_sb
|
||||
|
||||
mov cx,sb_r_start_y
|
||||
cmp ax,cx
|
||||
jb .no_runner
|
||||
jb .no_runner
|
||||
|
||||
add cx,sb_r_size_y
|
||||
cmp ax,cx
|
||||
ja .no_runner
|
||||
ja .no_runner
|
||||
|
||||
mov sb_delta2,word 1
|
||||
@@:
|
||||
push eax
|
||||
mov ax,sb_m_pos
|
||||
cmp ax,sb_m_pos_2
|
||||
je .correct ;.exit_sb
|
||||
je .correct ;.exit_sb
|
||||
|
||||
shl eax,16
|
||||
shr eax,16
|
||||
@ -663,22 +665,26 @@ draw_down_arrow_vertical
|
||||
mov cx,sb_start_y
|
||||
add cx,sb_btn_high ;15
|
||||
cmp sb_delta,word 1
|
||||
je .scroll_sb
|
||||
je .scroll_sb
|
||||
|
||||
cmp ax,cx
|
||||
ja .scroll_sb
|
||||
ja .scroll_sb
|
||||
|
||||
cmp sb_m_keys,dword 0
|
||||
je .exit_sb
|
||||
|
||||
cmp sb_position,dword 0
|
||||
; je .exit_sb
|
||||
je @f
|
||||
mov eax,sb_ar_offset
|
||||
cmp sb_position,eax ;dword 0
|
||||
; je .exit_sb
|
||||
jbe @f
|
||||
|
||||
dec dword sb_position
|
||||
; dec dword sb_position
|
||||
sub sb_position,eax
|
||||
jmp .all_sb
|
||||
@@:
|
||||
mov sb_position2,dword 0
|
||||
xor eax,eax
|
||||
mov sb_position,eax ;dword 0
|
||||
mov sb_position2,eax ;dword 0
|
||||
jmp .all_sb
|
||||
;*****************************************************************************
|
||||
.scroll_sb:
|
||||
@ -686,10 +692,10 @@ draw_down_arrow_vertical
|
||||
sub cx,sb_btn_high
|
||||
sub cx,sb_btn_high
|
||||
cmp sb_delta,word 1
|
||||
je @f
|
||||
je @f
|
||||
|
||||
cmp ax,cx
|
||||
ja .down_sb
|
||||
ja .down_sb
|
||||
|
||||
@@:
|
||||
mov ebx,sb_btn_high ;16 ;15
|
||||
@ -702,7 +708,7 @@ draw_down_arrow_vertical
|
||||
mov ebx,sb_run_size
|
||||
;*****************************************************************************
|
||||
cmp sb_delta,word 1
|
||||
je .continue
|
||||
je .continue
|
||||
|
||||
@@:
|
||||
mov edx,eax
|
||||
@ -739,7 +745,7 @@ draw_down_arrow_vertical
|
||||
|
||||
mov eax,sb_max_area
|
||||
cmp eax,sb_cur_area
|
||||
ja @f
|
||||
ja @f
|
||||
|
||||
xor eax,eax
|
||||
inc eax
|
||||
@ -753,7 +759,7 @@ draw_down_arrow_vertical
|
||||
div ecx
|
||||
shl edx,1
|
||||
cmp edx,ecx
|
||||
jb @f
|
||||
jb @f
|
||||
|
||||
inc eax
|
||||
|
||||
@ -762,10 +768,10 @@ draw_down_arrow_vertical
|
||||
shr eax,10
|
||||
|
||||
cmp sb_position,eax
|
||||
je .exit_sb
|
||||
je .exit_sb
|
||||
|
||||
cmp eax,0
|
||||
ja @f
|
||||
ja @f
|
||||
|
||||
xor eax,eax
|
||||
|
||||
@ -784,14 +790,20 @@ draw_down_arrow_vertical
|
||||
je .exit_sb
|
||||
|
||||
mov eax,sb_max_area
|
||||
mov ebx,sb_ar_offset
|
||||
sub eax,sb_cur_area
|
||||
push eax
|
||||
sub eax,ebx
|
||||
cmp sb_position,eax
|
||||
pop eax
|
||||
; jae .exit_sb
|
||||
jae @f
|
||||
|
||||
inc dword sb_position
|
||||
; inc dword sb_position
|
||||
add sb_position,ebx
|
||||
jmp .all_sb
|
||||
@@:
|
||||
mov sb_position,eax
|
||||
xor eax,eax
|
||||
mov ax,sb_size_y
|
||||
sub eax,sb_btn_high
|
||||
@ -799,7 +811,7 @@ draw_down_arrow_vertical
|
||||
sub eax,sb_run_size
|
||||
mov sb_position2,eax
|
||||
jmp .all_sb
|
||||
.exit_sb:
|
||||
.exit_sb:
|
||||
scroll_bar_exit
|
||||
}
|
||||
|
||||
@ -814,7 +826,8 @@ scroll_bar_horizontal:
|
||||
.draw:
|
||||
pusha
|
||||
mov edi,dword [esp+36]
|
||||
mov sb_all_redraw,dword 1
|
||||
; mov sb_all_redraw,dword 1
|
||||
mov sb_delta,word 0
|
||||
call .draw_1
|
||||
mov sb_all_redraw,dword 0
|
||||
scroll_bar_exit
|
||||
@ -831,7 +844,7 @@ scroll_bar_exit
|
||||
mov eax,sb_work_size ;sb_max_area
|
||||
mov ebx,sb_max_area
|
||||
cmp ebx,sb_cur_area
|
||||
ja @f
|
||||
ja @f
|
||||
|
||||
jmp .no_size
|
||||
|
||||
@ -847,12 +860,12 @@ scroll_bar_exit
|
||||
mov sb_run_size,eax
|
||||
;*********************************
|
||||
cmp sb_delta,word 1
|
||||
je .@@_3
|
||||
je .@@_3
|
||||
mov eax,sb_work_size
|
||||
sub eax,sb_run_size
|
||||
mov ebx,sb_max_area
|
||||
cmp ebx,sb_cur_area
|
||||
ja @f
|
||||
ja @f
|
||||
xor eax,eax
|
||||
jmp .@@_1
|
||||
@@:
|
||||
@ -940,7 +953,7 @@ draw_up_arrow_horizontal
|
||||
test bx,0x8000
|
||||
jnz @f
|
||||
mov edx,sb_bckg_col
|
||||
int 0x40 ; left interval
|
||||
int 0x40 ; left interval
|
||||
@@:
|
||||
;*********************************
|
||||
shr ebx,16
|
||||
@ -949,7 +962,7 @@ draw_up_arrow_horizontal
|
||||
shl ebx,16
|
||||
inc ebx
|
||||
mov edx,sb_line_col
|
||||
int 0x40 ; runner - left extreme line
|
||||
int 0x40 ; runner - left extreme line
|
||||
|
||||
add ebx,1 shl 16
|
||||
mov bx,0
|
||||
@ -996,7 +1009,7 @@ draw_runner_center_horizontal
|
||||
mov eax,13
|
||||
cmp sb_all_redraw,dword 0
|
||||
je @f
|
||||
int 0x40 ; bottom button - top line
|
||||
int 0x40 ; bottom button - top line
|
||||
@@:
|
||||
push ebx
|
||||
add ebx,1 shl 16
|
||||
@ -1029,16 +1042,16 @@ draw_down_arrow_horizontal
|
||||
;*****************************************************************************
|
||||
.mouse:
|
||||
pusha
|
||||
mov edi,dword [esp+36]
|
||||
mov edi,dword [esp+36]
|
||||
mcall 37,1
|
||||
mov sb_m_pos,eax
|
||||
cmp sb_m_pos_2,dword 0
|
||||
jne @f
|
||||
|
||||
mov sb_m_pos_2,eax
|
||||
mov sb_m_pos_2,eax
|
||||
@@:
|
||||
mcall 37,2
|
||||
mov sb_m_keys,eax
|
||||
mov sb_m_keys,eax
|
||||
|
||||
cmp sb_m_keys,eax
|
||||
je @f
|
||||
@ -1056,7 +1069,7 @@ draw_down_arrow_horizontal
|
||||
jne @f ;.continue_2
|
||||
mov eax,sb_m_pos
|
||||
mov sb_m_pos_2,eax
|
||||
jmp .correct_1 ;.exit_sb
|
||||
jmp .correct_1 ;.exit_sb
|
||||
@@:
|
||||
mov sb_delta,word 1
|
||||
|
||||
@ -1075,49 +1088,49 @@ draw_down_arrow_horizontal
|
||||
|
||||
mov cx,sb_start_x ;y
|
||||
cmp ax,cx
|
||||
jb .exit_sb
|
||||
jb .exit_sb
|
||||
|
||||
cmp sb_delta2,word 0
|
||||
je @f
|
||||
je @f
|
||||
push ecx
|
||||
add cx,sb_btn_high
|
||||
cmp ax,cx
|
||||
pop ecx
|
||||
jb .exit_sb
|
||||
jb .exit_sb
|
||||
|
||||
@@:
|
||||
add cx,sb_size_x ;y
|
||||
add cx,sb_size_x ;y
|
||||
cmp ax,cx
|
||||
ja .exit_sb
|
||||
ja .exit_sb
|
||||
|
||||
cmp sb_delta2,word 0
|
||||
je @f
|
||||
je @f
|
||||
sub cx,sb_btn_high
|
||||
cmp ax,cx
|
||||
ja .exit_sb
|
||||
ja .exit_sb
|
||||
|
||||
@@:
|
||||
cmp sb_delta2,word 1
|
||||
je @f
|
||||
je @f
|
||||
|
||||
cmp sb_m_keys,dword 0
|
||||
je .exit_sb
|
||||
|
||||
je .exit_sb
|
||||
|
||||
mov cx,sb_start_y ;x
|
||||
cmp bx,cx
|
||||
jb .exit_sb
|
||||
jb .exit_sb
|
||||
|
||||
add cx,sb_size_y ;x
|
||||
add cx,sb_size_y ;x
|
||||
cmp bx,cx
|
||||
ja .exit_sb
|
||||
ja .exit_sb
|
||||
|
||||
mov cx,sb_r_start_x
|
||||
cmp ax,cx
|
||||
jb .no_runner
|
||||
jb .no_runner
|
||||
|
||||
add cx,sb_r_size_x
|
||||
cmp ax,cx
|
||||
ja .no_runner
|
||||
ja .no_runner
|
||||
|
||||
mov sb_delta2,word 1
|
||||
@@:
|
||||
@ -1127,7 +1140,7 @@ draw_down_arrow_horizontal
|
||||
shr eax,16
|
||||
shr ebx,16
|
||||
cmp eax,ebx
|
||||
je .correct ;.exit_sb
|
||||
je .correct ;.exit_sb
|
||||
|
||||
; shl eax,16
|
||||
; shr eax,16
|
||||
@ -1141,7 +1154,7 @@ draw_down_arrow_horizontal
|
||||
mov ebx,eax
|
||||
add sb_position2,ebx
|
||||
xor eax,eax
|
||||
mov ax,sb_size_x ;y
|
||||
mov ax,sb_size_x ;y
|
||||
sub eax,sb_btn_high
|
||||
sub eax,sb_btn_high
|
||||
sub eax,sb_run_size
|
||||
@ -1185,22 +1198,26 @@ draw_down_arrow_horizontal
|
||||
mov cx,sb_start_x ;y
|
||||
add cx,sb_btn_high ;15
|
||||
cmp sb_delta,word 1
|
||||
je .scroll_sb
|
||||
je .scroll_sb
|
||||
|
||||
cmp ax,cx
|
||||
ja .scroll_sb
|
||||
ja .scroll_sb
|
||||
|
||||
cmp sb_m_keys,dword 0
|
||||
je .exit_sb
|
||||
|
||||
cmp sb_position,dword 0
|
||||
; je .exit_sb
|
||||
je @f
|
||||
mov eax,sb_ar_offset
|
||||
cmp sb_position,eax ;dword 0
|
||||
; je .exit_sb
|
||||
jbe @f
|
||||
|
||||
dec dword sb_position
|
||||
; dec dword sb_position
|
||||
sub sb_position,eax
|
||||
jmp .all_sb
|
||||
@@:
|
||||
mov sb_position2,dword 0
|
||||
xor eax,eax
|
||||
mov sb_position,eax ;dword 0
|
||||
mov sb_position2,eax ;dword 0
|
||||
jmp .all_sb
|
||||
;*****************************************************************************
|
||||
.scroll_sb:
|
||||
@ -1208,10 +1225,10 @@ draw_down_arrow_horizontal
|
||||
sub cx,sb_btn_high
|
||||
sub cx,sb_btn_high
|
||||
cmp sb_delta,word 1
|
||||
je @f
|
||||
je @f
|
||||
|
||||
cmp ax,cx
|
||||
ja .down_sb
|
||||
ja .down_sb
|
||||
|
||||
@@:
|
||||
mov ebx,sb_btn_high ;16 ;15
|
||||
@ -1224,7 +1241,7 @@ draw_down_arrow_horizontal
|
||||
mov ebx,sb_run_size
|
||||
;*****************************************************************************
|
||||
cmp sb_delta,word 1
|
||||
je .continue
|
||||
je .continue
|
||||
|
||||
@@:
|
||||
mov edx,eax
|
||||
@ -1261,7 +1278,7 @@ draw_down_arrow_horizontal
|
||||
|
||||
mov eax,sb_max_area
|
||||
cmp eax,sb_cur_area
|
||||
ja @f
|
||||
ja @f
|
||||
|
||||
xor eax,eax
|
||||
inc eax
|
||||
@ -1275,7 +1292,7 @@ draw_down_arrow_horizontal
|
||||
div ecx
|
||||
shl edx,1
|
||||
cmp edx,ecx
|
||||
jb @f
|
||||
jb @f
|
||||
|
||||
inc eax
|
||||
|
||||
@ -1284,10 +1301,10 @@ draw_down_arrow_horizontal
|
||||
shr eax,10
|
||||
|
||||
cmp sb_position,eax
|
||||
je .exit_sb
|
||||
je .exit_sb
|
||||
|
||||
cmp eax,0
|
||||
ja @f
|
||||
ja @f
|
||||
|
||||
xor eax,eax
|
||||
|
||||
@ -1306,14 +1323,20 @@ draw_down_arrow_horizontal
|
||||
je .exit_sb
|
||||
|
||||
mov eax,sb_max_area
|
||||
mov ebx,sb_ar_offset
|
||||
sub eax,sb_cur_area
|
||||
push eax
|
||||
sub eax,ebx
|
||||
cmp sb_position,eax
|
||||
pop eax
|
||||
; jae .exit_sb
|
||||
jae @f
|
||||
|
||||
inc dword sb_position
|
||||
; inc dword sb_position
|
||||
add sb_position,ebx
|
||||
jmp .all_sb
|
||||
@@:
|
||||
mov sb_position,eax
|
||||
xor eax,eax
|
||||
mov ax,sb_size_x
|
||||
sub eax,sb_btn_high
|
||||
|
89
programs/develop/libraries/box_lib/trunk/w_about.inc
Normal file
89
programs/develop/libraries/box_lib/trunk/w_about.inc
Normal file
@ -0,0 +1,89 @@
|
||||
;---------------------------------------------------------------------
|
||||
thread3:
|
||||
|
||||
call draw_window3
|
||||
|
||||
still3:
|
||||
|
||||
mov eax,10 ; wait here for event
|
||||
mcall
|
||||
|
||||
cmp eax,1 ; redraw request ?
|
||||
je thread3
|
||||
cmp eax,2 ; key in buffer ?
|
||||
je key3
|
||||
cmp eax,3 ; button in buffer ?
|
||||
je button3
|
||||
|
||||
jmp still3
|
||||
|
||||
key3:
|
||||
mcall
|
||||
cmp ah,27
|
||||
je close3
|
||||
jmp still3
|
||||
|
||||
|
||||
button3: ; button
|
||||
mov eax,17 ; get id
|
||||
mcall
|
||||
|
||||
cmp ah,1 ; button id=1 ?
|
||||
je close3
|
||||
cmp ah,2
|
||||
jne noclose3
|
||||
close3:
|
||||
mov eax,-1 ; close this program
|
||||
mcall
|
||||
noclose3:
|
||||
jmp still3
|
||||
|
||||
|
||||
|
||||
|
||||
; *********************************************
|
||||
; ******* WINDOW DEFINITIONS AND DRAW ********
|
||||
; *********************************************
|
||||
|
||||
|
||||
draw_window3:
|
||||
|
||||
|
||||
mov eax,12 ; function 12:tell os about windowdraw
|
||||
mov ebx,1 ; 1, start of draw
|
||||
mcall
|
||||
|
||||
; DRAW WINDOW
|
||||
xor eax,eax ; function 0 : define and draw window
|
||||
mov ebx,100*65536+200 ; [x start] *65536 + [x size]
|
||||
mov ecx,100*65536+100 ; [y start] *65536 + [y size]
|
||||
mov edx,0x03eeeeee ; color of work area RRGGBB,8->color gl
|
||||
mcall
|
||||
|
||||
mcall 4,<10,40>,0x80000000,header_1
|
||||
|
||||
mov ebx,70*65536+40
|
||||
mov ecx,70*65536+20
|
||||
mov edx,2
|
||||
mov esi,0xdddddd
|
||||
mcall 8
|
||||
|
||||
add ebx,15 shl 16
|
||||
shr ecx,16
|
||||
mov bx,cx
|
||||
add ebx,6
|
||||
|
||||
mov ecx,0
|
||||
mov edx, ok_btn
|
||||
mov esi,2
|
||||
mcall 4
|
||||
|
||||
; WINDOW LABEL
|
||||
mcall 71,1, labelt3
|
||||
|
||||
mov eax,12 ; function 12:tell os about windowdraw
|
||||
mov ebx,2 ; 2, end of draw
|
||||
mcall
|
||||
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
Loading…
Reference in New Issue
Block a user