bugfix a macros load_lib.mac

git-svn-id: svn://kolibrios.org@1068 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Alexey Teplov ( 2009-05-08 17:45:28 +00:00
parent a730579b19
commit ea836f1026
8 changed files with 915 additions and 615 deletions

View File

@ -9,8 +9,8 @@ public EXPORTS
section '.flat' code readable align 16 section '.flat' code readable align 16
include 'macros.inc' include 'macros.inc'
include 'editbox.mac' ;¬ ªà®á ª®â®àë© ¤®«¦¥­ ®¡«¥£ç¨âì ¦¨§­ì :) ᯥ樠«ì­® ¤«ï editbox include 'editbox.mac' ;¬ ªà®á ª®â®àë© ¤®«¦¥­ ®¡«¥£ç¨âì ¦¨§­ì :) ᯥ樠«ì­® ¤«ï editbox
include 'checkbox.mac' ;¬ ªà®á ᮤ¥à¦¨â ॠ«¨§ æ¨î checkbox include 'checkbox.mac' ;¬ ªà®á ᮤ¥à¦¨â ॠ«¨§ æ¨î checkbox
include 'optionbox.mac' ;¬ ªà®á ᮤ¥à¦¨â ॠ«¨§ æ¨î optionbox include 'optionbox.mac' ;¬ ªà®á ᮤ¥à¦¨â ॠ«¨§ æ¨î optionbox
include 'scrollbar.mac' ;¬ ªà®á ᮤ¥à¦¨â ॠ«¨§ æ¨î scrollbar include 'scrollbar.mac' ;¬ ªà®á ᮤ¥à¦¨â ॠ«¨§ æ¨î scrollbar
include 'd_button.mac' ;¬ ªà®á ᮤ¥à¦¨â ॠ«¨§ æ¨î dinamic button include 'd_button.mac' ;¬ ªà®á ᮤ¥à¦¨â ॠ«¨§ æ¨î dinamic button
@ -18,106 +18,129 @@ include 'menubar.mac' ;
;---------------------------------------------------- ;----------------------------------------------------
;EditBox ;EditBox
;---------------------------------------------------- ;----------------------------------------------------
align 4
use_editbox_draw ;¬ ªà®á à ááªà뢠¥â äã­ªæ¨î ®â®¡à ¦¥­¨ï ¡®ªá . use_editbox_draw ;¬ ªà®á à ááªà뢠¥â äã­ªæ¨î ®â®¡à ¦¥­¨ï ¡®ªá .
use_editbox_key ;¬ ªà®á à ááªà뢠¥â äã­ªæ¨î ®¡à ¡®âª¨ ª« ¢¨èì. align 4
use_editbox_mouse ;¬ ªà®á à ááªà뢠¥â äã­ªæ¨î ®¡à ¡®âª¨ ¬ëè¨. use_editbox_key ;¬ ªà®á à ááªà뢠¥â äã­ªæ¨î ®¡à ¡®âª¨ ª« ¢¨èì.
align 4
use_editbox_mouse ;¬ ªà®á à ááªà뢠¥â äã­ªæ¨î ®¡à ¡®âª¨ ¬ëè¨.
;---------------------------------------------------- ;----------------------------------------------------
;CheckBox ;CheckBox
;---------------------------------------------------- ;----------------------------------------------------
use_checkbox_draw ;¬ ªà®á à ááªà뢠¥â äã­ªæ¨î ®â®¡à ¦¥­¨ï ¡®ªá . align 4
use_checkbox_mouse ;¬ ªà®á à ááªà뢠¥â äã­ªæ¨î ®¡à ¡®âª¨ ¬ëè¨. use_checkbox_draw ;¬ ªà®á à ááªà뢠¥â äã­ªæ¨î ®â®¡à ¦¥­¨ï ¡®ªá .
align 4
use_checkbox_mouse ;¬ ªà®á à ááªà뢠¥â äã­ªæ¨î ®¡à ¡®âª¨ ¬ëè¨.
;-------------------------------------------------- ;--------------------------------------------------
;radiobutton Group ;radiobutton Group
;-------------------------------------------------- ;--------------------------------------------------
use_optionbox_driver ;¬ ªà®áë ª®â®àë¥ ã¯à ¢«ïîâ à ¡®â®© ¡®ªá  ) align 4
use_optionbox_draw ;¬ ªà®á à ááªà뢠¥â äã­ªæ¨î ®â®¡à ¦¥­¨ï ¡®ªá . use_optionbox_driver ;¬ ªà®áë ª®â®àë¥ ã¯à ¢«ïîâ à ¡®â®© ¡®ªá  )
use_optionbox_mouse ;¬ ªà®á à ááªà뢠¥â äã­ªæ¨î ®¡à ¡®âª¨ ¬ëè¨. align 4
use_optionbox_draw ;¬ ªà®á à ááªà뢠¥â äã­ªæ¨î ®â®¡à ¦¥­¨ï ¡®ªá .
align 4
use_optionbox_mouse ;¬ ªà®á à ááªà뢠¥â äã­ªæ¨î ®¡à ¡®âª¨ ¬ëè¨.
;-------------------------------------------------- ;--------------------------------------------------
;scrollbar Group ;scrollbar Group
;-------------------------------------------------- ;--------------------------------------------------
align 4
use_scroll_bar use_scroll_bar
align 4
use_scroll_bar_vertical use_scroll_bar_vertical
align 4
use_scroll_bar_horizontal use_scroll_bar_horizontal
;-------------------------------------------------- ;--------------------------------------------------
;dinamic button Group ;dinamic button Group
;-------------------------------------------------- ;--------------------------------------------------
align 4
use_dinamic_button use_dinamic_button
;-------------------------------------------------- ;--------------------------------------------------
;menubar Group ;menubar Group
;-------------------------------------------------- ;--------------------------------------------------
align 4
use_menu_bar use_menu_bar
;-------------------------------------------------- ;--------------------------------------------------
init: init:
ret ret
;;;;;;;;;;;
;;Data
;;;;;;;;;;;
align 4
mouse_flag dd 0x0
align 16 align 16
EXPORTS: EXPORTS:
dd sz_init, init dd sz_init, init
dd sz_version, 0x00000001 dd sz_version, 0x00000001
dd sz_edit_box, edit_box
dd sz_edit_box_key, edit_box_key dd sz_edit_box, edit_box
dd sz_edit_box_mouse, edit_box_mouse dd sz_edit_box_key, edit_box_key
dd szVersion_ed, 0x00000001 dd sz_edit_box_mouse, edit_box_mouse
dd sz_check_box_draw, check_box_draw dd szVersion_ed, 0x00000001
dd sz_check_box_mouse, check_box_mouse
dd szVersion_ch, 0x00000001 dd sz_check_box_draw, check_box_draw
dd sz_option_box_draw, option_box_draw dd sz_check_box_mouse, check_box_mouse
dd sz_option_box_mouse, option_box_mouse dd szVersion_ch, 0x00000001
dd szVersion_op, 0x00000001
dd sz_Scrollbar_ver_draw, scroll_bar_vertical.draw dd sz_option_box_draw, option_box_draw
dd sz_Scrollbar_ver_mouse, scroll_bar_vertical.mouse dd sz_option_box_mouse, option_box_mouse
dd sz_Scrollbar_hor_draw, scroll_bar_horizontal.draw dd szVersion_op, 0x00000001
dd sz_Scrollbar_hor_mouse, scroll_bar_horizontal.mouse
dd szVersion_scrollbar, 0x00010001 dd sz_Scrollbar_ver_draw, scroll_bar_vertical.draw
dd sz_Dbutton_draw, dinamic_button.draw dd sz_Scrollbar_ver_mouse, scroll_bar_vertical.mouse
dd sz_Dbutton_mouse, dinamic_button.mouse dd sz_Scrollbar_hor_draw, scroll_bar_horizontal.draw
dd szVersion_dbutton, 0x00010001 dd sz_Scrollbar_hor_mouse, scroll_bar_horizontal.mouse
dd sz_Menu_bar_draw, menu_bar.draw dd szVersion_scrollbar, 0x00010001
dd sz_Menu_bar_mouse, menu_bar.mouse
dd szVersion_menu_bar, 0x00010001 dd sz_Dbutton_draw, dinamic_button.draw
dd 0,0 dd sz_Dbutton_mouse, dinamic_button.mouse
dd szVersion_dbutton, 0x00010001
dd sz_Menu_bar_draw, menu_bar.draw
dd sz_Menu_bar_mouse, menu_bar.mouse
dd szVersion_menu_bar, 0x00010001
dd 0,0
sz_init db 'lib_init',0 sz_init db 'lib_init',0
sz_version db 'version',0 sz_version db 'version',0
sz_edit_box db 'edit_box',0
sz_edit_box db 'edit_box',0
sz_edit_box_key db 'edit_box_key',0 sz_edit_box_key db 'edit_box_key',0
sz_edit_box_mouse db 'edit_box_mouse',0 sz_edit_box_mouse db 'edit_box_mouse',0
szVersion_ed db 'version_ed',0 szVersion_ed db 'version_ed',0
sz_check_box_draw db 'check_box_draw',0 sz_check_box_draw db 'check_box_draw',0
sz_check_box_mouse db 'check_box_mouse',0 sz_check_box_mouse db 'check_box_mouse',0
szVersion_ch db 'version_ch',0 szVersion_ch db 'version_ch',0
sz_option_box_draw db 'option_box_draw',0 sz_option_box_draw db 'option_box_draw',0
sz_option_box_mouse db 'option_box_mouse',0 sz_option_box_mouse db 'option_box_mouse',0
szVersion_op db 'version_op',0 szVersion_op db 'version_op',0
sz_Scrollbar_ver_draw db 'scrollbar_v_draw',0
sz_Scrollbar_ver_mouse db 'scrollbar_v_mouse',0 sz_Scrollbar_ver_draw db 'scrollbar_v_draw',0
sz_Scrollbar_hor_draw db 'scrollbar_h_draw',0 sz_Scrollbar_ver_mouse db 'scrollbar_v_mouse',0
sz_Scrollbar_hor_mouse db 'scrollbar_h_mouse',0 sz_Scrollbar_hor_draw db 'scrollbar_h_draw',0
szVersion_scrollbar db 'version_scrollbar',0 sz_Scrollbar_hor_mouse db 'scrollbar_h_mouse',0
sz_Dbutton_draw db 'dbutton_draw',0 szVersion_scrollbar db 'version_scrollbar',0
sz_Dbutton_mouse db 'dbutton_mouse',0
szVersion_dbutton db 'version_dbutton',0 sz_Dbutton_draw db 'dbutton_draw',0
sz_Menu_bar_draw db 'menu_bar_draw',0 sz_Dbutton_mouse db 'dbutton_mouse',0
sz_Menu_bar_mouse db 'menu_bar_mouse',0 szVersion_dbutton db 'version_dbutton',0
szVersion_menu_bar db 'version_menu_bar',0
sz_Menu_bar_draw db 'menu_bar_draw',0
sz_Menu_bar_mouse db 'menu_bar_mouse',0
szVersion_menu_bar db 'version_menu_bar',0
;;;;;;;;;;;
;;Data
;;;;;;;;;;;
align 16
mouse_flag dd 0x0

View File

@ -5,14 +5,14 @@
; ;
; Redistribution and use in source and binary forms, with or without ; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are met: ; modification, are permitted provided that the following conditions are met:
; * Redistributions of source code must retain the above copyright ; * Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer. ; notice, this list of conditions and the following disclaimer.
; * Redistributions in binary form must reproduce the above copyright ; * Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the ; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution. ; documentation and/or other materials provided with the distribution.
; * Neither the name of the <organization> nor the ; * Neither the name of the <organization> nor the
; names of its contributors may be used to endorse or promote products ; names of its contributors may be used to endorse or promote products
; derived from this software without specific prior written permission. ; derived from this software without specific prior written permission.
; ;
; THIS SOFTWARE IS PROVIDED BY Mario79 ''AS IS'' AND ANY ; THIS SOFTWARE IS PROVIDED BY Mario79 ''AS IS'' AND ANY
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
@ -28,404 +28,356 @@
; import_boxlib procedure written by <Lrz> ; import_boxlib procedure written by <Lrz>
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
use32 use32
org 0x0 org 0x0
db 'MENUET01' db 'MENUET01'
dd 0x01 dd 0x01
dd START dd START
dd IM_END dd IM_END
dd I_END dd I_END
dd stacktop dd stacktop
dd 0x0 dd 0x0
dd path dd path
include 'MACROS.INC' include 'MACROS.INC'
include 'load_lib.mac'
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
;--- Start of program ---------------------------------------------- ;--- Start of program ----------------------------------------------
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
START: START:
mcall 68, 11 mcall 68, 11
mcall 66, 1, 1 mcall 66, 1, 1
mcall 40, 0x27 mcall 40, 0x27
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
; Procinfo area for function 9 in MenuBar ; Procinfo area for function 9 in MenuBar
mcall 68,12,1024 mcall 68,12,1024
mov [menu_data_1.procinfo],eax mov [menu_data_1.procinfo],eax
mov [menu_data_2.procinfo],eax mov [menu_data_2.procinfo],eax
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
; loading Box_Lib library ; loading Box_Lib library
mov ebx,boxlib_name load_libraries l_libs_start,end_l_libs
mov esi,path ;sys_load_library boxlib_name, path, file_name, system_dir, \
mov edi,file_name ;er_message_found_lib, ihead_f_l, myimport, er_message_import, ihead_f_i
call copy_path ; test eax,eax
; jnz button.exit
mcall 68,19,file_name ; load of alternative ;----------------------------------old
test eax,eax ; mov ebx,boxlib_name
jnz @f ; mov esi,path
; mov edi,file_name
mcall 68,19,system_dir ; load of sys directory ; call copy_path
test eax,eax ;
jz button.exit ; mcall 68,19,file_name ; load of alternative
@@: ; test eax,eax
call import_boxlib ; 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 ; Load and convert BMP file for DinamicButton
; This procedures use cnv_bmp.obj and this module used only for ; This procedures use cnv_bmp.obj and this module used only for
; demonstration of use DinamicButton ; demonstration of use DinamicButton
; mov ebx,plugin_BMP_name
; mov esi,path
; mov edi,file_name
copy_path plugin_BMP_name,path,file_name
; ;
mcall 68,19,file_name
test eax,eax
jz button.exit
mov ebx,plugin_BMP_name mov eax,[eax+4]
mov esi,path mov [plugin],eax
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 ebp,library01
cmp dword [ebp+ll_struc_size-4],0
jnz button.exit
;
; mov ebp,library02
; cmp dword [ebp+ll_struc_size-4],0x2
; jnz button.exit
; mov eax,dword [ebp+36]
; mov eax,[eax+4]
; mov [plugin],eax
mov [fileinfo+16],eax
mov [image_file],eax ; mov ebx,icons_file_name
; mov esi,path
; mov edi,file_name
copy_path icons_file_name,path,file_name
mcall 70, fileinfo
mov [fileinfo+0],dword 0
mov ecx,[file_info+32]
mov [fileinfo+12],ecx
mov [img_size],ecx
mcall 70, fileinfo mcall 68, 12
xor eax,eax
mov [return_code],eax
mov eax,image_file
call [plugin]
mov ecx,[image_file] mov [fileinfo+16],eax
mcall 68, 13, mov [image_file],eax
cmp [return_code],dword 0
jne button.exit
mov ebx,[raw_pointer] mcall 70, fileinfo
mov eax,[ebx+4]
; set of button size xor eax,eax
mov [dinamic_button_data_1.size_x],ax mov [return_code],eax
mov [dinamic_button_data_1.size_y],ax mov eax,image_file
mov [dinamic_button_data_2.size_x],ax call [plugin]
mov [dinamic_button_data_2.size_y],ax
mov eax,[ebx+12] mov ecx,[image_file]
; set of RAW resolution to pixel mcall 68, 13,
mov [dinamic_button_data_1.resolution_raw],eax
mov [dinamic_button_data_2.resolution_raw],eax cmp [return_code],dword 0
mov eax,[ebx+20] jne button.exit
add eax,ebx
; set RAW palette, use else resolution 8bit or less mov ebx,[raw_pointer]
mov [dinamic_button_data_1.palette_raw],eax mov eax,[ebx+4]
mov [dinamic_button_data_2.palette_raw],eax ; set of button size
mov eax,[ebx+28] mov [dinamic_button_data_1.size_x],ax
add eax,ebx mov [dinamic_button_data_1.size_y],ax
; set RAW area for passive button mov [dinamic_button_data_2.size_x],ax
mov [dinamic_button_data_1.passive_raw],eax mov [dinamic_button_data_2.size_y],ax
mov [dinamic_button_data_2.passive_raw],eax mov eax,[ebx+12]
mov ecx,[ebx+4] ; set of RAW resolution to pixel
imul ecx,[ebx+4] mov [dinamic_button_data_1.resolution_raw],eax
imul ecx,[ebx+12] mov [dinamic_button_data_2.resolution_raw],eax
shr ecx,3 mov eax,[ebx+20]
add eax,ecx add eax,ebx
; set RAW area for active button ; set RAW palette, use else resolution 8bit or less
mov [dinamic_button_data_1.active_raw],eax mov [dinamic_button_data_1.palette_raw],eax
mov [dinamic_button_data_2.active_raw],eax mov [dinamic_button_data_2.palette_raw],eax
add eax,ecx mov eax,[ebx+28]
; RAW area for click button add eax,ebx
mov [dinamic_button_data_1.click_raw],eax ; set RAW area for passive button
mov [dinamic_button_data_2.click_raw],eax 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: red:
call draw_window call draw_window
still: still:
mcall 10 mcall 10
cmp eax,1 cmp eax,1
je red je red
cmp eax,2 cmp eax,2
je key je key
cmp eax,3 cmp eax,3
je button je button
cmp eax,6 cmp eax,6
je mouse je mouse
jmp still jmp still
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
key: key:
mcall 2 mcall 2
jmp still jmp still
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
button: button:
mcall 17 mcall 17
cmp ah, 1 cmp ah, 1
jne still jne still
.exit: .exit:
mcall -1 mcall -1
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
mouse: mouse:
;----------------------------------------------- ;-----------------------------------------------
cmp [scroll_bar_data_horizontal.delta2],0 cmp [scroll_bar_data_horizontal.delta2],0
jne .horizontal jne .horizontal
.vertical: .vertical:
mov eax,[scroll_bar_data_vertical.max_area] mov eax,[scroll_bar_data_vertical.max_area]
cmp eax,[scroll_bar_data_vertical.cur_area] cmp eax,[scroll_bar_data_vertical.cur_area]
jbe .horizontal jbe .horizontal
; mouse event for Vertical ScrollBar ; mouse event for Vertical ScrollBar
push dword scroll_bar_data_vertical push dword scroll_bar_data_vertical
call [scrollbar_ver_mouse] call [scrollbar_ver_mouse]
mov eax,scroll_bar_data_vertical.redraw mov eax,scroll_bar_data_vertical.redraw
xor ebx,ebx xor ebx,ebx
cmp [eax],ebx cmp [eax],ebx
je @f je @f
mov [eax],ebx mov [eax],ebx
jmp .draw_cube jmp .draw_cube
@@: @@:
cmp [scroll_bar_data_vertical.delta2],0 cmp [scroll_bar_data_vertical.delta2],0
jne still jne still
.horizontal: .horizontal:
mov eax,[scroll_bar_data_horizontal.max_area] mov eax,[scroll_bar_data_horizontal.max_area]
cmp eax,[scroll_bar_data_horizontal.cur_area] cmp eax,[scroll_bar_data_horizontal.cur_area]
jbe .other jbe .other
; mouse event for Horizontal ScrollBar ; mouse event for Horizontal ScrollBar
push dword scroll_bar_data_horizontal push dword scroll_bar_data_horizontal
call [scrollbar_hor_mouse] call [scrollbar_hor_mouse]
mov eax,scroll_bar_data_horizontal.redraw mov eax,scroll_bar_data_horizontal.redraw
xor ebx,ebx xor ebx,ebx
cmp [eax],ebx cmp [eax],ebx
je .other je .other
mov [eax],ebx mov [eax],ebx
.draw_cube: .draw_cube:
call draw_cube call draw_cube
jmp still jmp still
.other: .other:
cmp [scroll_bar_data_vertical.delta2],0 cmp [scroll_bar_data_vertical.delta2],0
jne still jne still
cmp [scroll_bar_data_horizontal.delta2],0 cmp [scroll_bar_data_horizontal.delta2],0
jne still jne still
;----------------------------------------------- ;-----------------------------------------------
.menu_bar_1: .menu_bar_1:
call .set_mouse_flag call .set_mouse_flag
@@: @@:
; mouse event for Menu 1 ; mouse event for Menu 1
push dword menu_data_1 push dword menu_data_1
call [menu_bar_mouse] call [menu_bar_mouse]
cmp [menu_data_1.click],dword 1 cmp [menu_data_1.click],dword 1
jne .menu_bar_2 jne .menu_bar_2
cmp [menu_data_1.cursor_out],dword 0 cmp [menu_data_1.cursor_out],dword 0
jne analyse_out_menu_1 jne analyse_out_menu_1
jmp .menu_bar_1 jmp .menu_bar_1
;-------------------------------------------- ;--------------------------------------------
.menu_bar_2: .menu_bar_2:
; mouse event for Menu 2 ; mouse event for Menu 2
push dword menu_data_2 push dword menu_data_2
call [menu_bar_mouse] call [menu_bar_mouse]
cmp [menu_data_2.click],dword 1 cmp [menu_data_2.click],dword 1
jne .mouse_dinamic_button jne .mouse_dinamic_button
cmp [menu_data_2.cursor_out],dword 0 cmp [menu_data_2.cursor_out],dword 0
jne analyse_out_menu_2 jne analyse_out_menu_2
jmp .menu_bar_1 jmp .menu_bar_1
;-------------------------------------------- ;--------------------------------------------
.mouse_dinamic_button: .mouse_dinamic_button:
; mouse event for Dinamic Button 1 ; mouse event for Dinamic Button 1
push dword dinamic_button_data_1 push dword dinamic_button_data_1
call [dinamic_button_mouse] call [dinamic_button_mouse]
mov eax,dinamic_button_data_1.click mov eax,dinamic_button_data_1.click
cmp [eax],dword 1 cmp [eax],dword 1
jne @f jne @f
mov [eax],dword 0 mov [eax],dword 0
jmp about jmp about
@@: @@:
; mouse event for Dinamic Button 2 ; mouse event for Dinamic Button 2
push dword dinamic_button_data_2 push dword dinamic_button_data_2
call [dinamic_button_mouse] call [dinamic_button_mouse]
mov eax,dinamic_button_data_2.click mov eax,dinamic_button_data_2.click
cmp [eax],dword 1 cmp [eax],dword 1
jne still ;@f jne still ;@f
mov [eax],dword 0 mov [eax],dword 0
jmp button.exit jmp button.exit
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
.set_mouse_flag: .set_mouse_flag:
xor eax,eax xor eax,eax
inc eax inc eax
mov [menu_data_1.get_mouse_flag],eax mov [menu_data_1.get_mouse_flag],eax
mov [menu_data_2.get_mouse_flag],eax mov [menu_data_2.get_mouse_flag],eax
ret ret
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
analyse_out_menu_1: analyse_out_menu_1:
; analyse result of Menu 1 ; analyse result of Menu 1
cmp [menu_data_1.cursor_out],dword 3 cmp [menu_data_1.cursor_out],dword 3
je button.exit je button.exit
jmp still jmp still
analyse_out_menu_2: analyse_out_menu_2:
; analyse result of Menu 2 ; analyse result of Menu 2
cmp [menu_data_2.cursor_out],dword 2 cmp [menu_data_2.cursor_out],dword 2
je about je about
jmp still jmp still
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
about: about:
mcall 51,1,thread3,thread mcall 51,1,thread3,thread
jmp still jmp still
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
draw_window: draw_window:
mcall 12, 1 mcall 12, 1
mcall 0, <0,400>, <0,400>, 0x03AABBCC, 0x805080D0, 0x005080D0 mcall 0, <0,400>, <0,400>, 0x03AABBCC, 0x805080D0, 0x005080D0
mcall 71, 1, header_1 mcall 71, 1, header_1
;--------------------------------------------- ;---------------------------------------------
; draw for Menu 1 ; draw for Menu 1
push dword menu_data_1 push dword menu_data_1
call [menu_bar_draw] call [menu_bar_draw]
; draw for Menu 2 ; draw for Menu 2
push dword menu_data_2 push dword menu_data_2
call [menu_bar_draw] call [menu_bar_draw]
;--------------------------------------------- ;---------------------------------------------
; draw for Dinamic Button 1 ; draw for Dinamic Button 1
push dword dinamic_button_data_1 push dword dinamic_button_data_1
call [dinamic_button_draw] call [dinamic_button_draw]
; draw for Dinamic Button 2 ; draw for Dinamic Button 2
push dword dinamic_button_data_2 push dword dinamic_button_data_2
call [dinamic_button_draw] call [dinamic_button_draw]
;--------------------------------------------- ;---------------------------------------------
; set all_redraw flag for draw all ScrollBar ; set all_redraw flag for draw all ScrollBar
; In some cases it is necessity to draw only the area ; In some cases it is necessity to draw only the area
; of moving of a "runner", for acceleration of output - ; of moving of a "runner", for acceleration of output -
; in this case the flag needs to be reset to 0 (zero). ; in this case the flag needs to be reset to 0 (zero).
xor eax,eax xor eax,eax
inc eax inc eax
mov [scroll_bar_data_vertical.all_redraw],eax mov [scroll_bar_data_vertical.all_redraw],eax
mov [scroll_bar_data_horizontal.all_redraw],eax mov [scroll_bar_data_horizontal.all_redraw],eax
; draw for Vertical ScrollBar ; draw for Vertical ScrollBar
push dword scroll_bar_data_vertical push dword scroll_bar_data_vertical
call [scrollbar_ver_draw] call [scrollbar_ver_draw]
; draw for Horizontal ScrollBar ; draw for Horizontal ScrollBar
push dword scroll_bar_data_horizontal push dword scroll_bar_data_horizontal
call [scrollbar_hor_draw] call [scrollbar_hor_draw]
; reset all_redraw flag ; reset all_redraw flag
xor eax,eax xor eax,eax
mov [scroll_bar_data_vertical.all_redraw],eax mov [scroll_bar_data_vertical.all_redraw],eax
mov [scroll_bar_data_horizontal.all_redraw],eax mov [scroll_bar_data_horizontal.all_redraw],eax
;--------------------------------------------- ;---------------------------------------------
call draw_cube call draw_cube
mcall 12, 2 mcall 12, 2
ret ret
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
draw_cube: draw_cube:
mcall 13,<30,301>,<50,301>,0xafafaf mcall 13,<30,301>,<50,301>,0xafafaf
mov ecx,[scroll_bar_data_vertical.position] mov ecx,[scroll_bar_data_vertical.position]
add ecx,50 add ecx,50
shl ecx,16 shl ecx,16
mov cx,30 mov cx,30
mov ebx,[scroll_bar_data_horizontal.position] mov ebx,[scroll_bar_data_horizontal.position]
add ebx,30 add ebx,30
shl ebx,16 shl ebx,16
mov bx,30 mov bx,30
mcall 13, , , 0x0 mcall 13, , , 0x0
ret 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: include 'data.inc'
; initialize import include 'w_about.inc'
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: IM_END:
rb 1024 rb 1024
thread: thread:
rb 1024 rb 1024
stacktop: stacktop:
path: path:
rb 4096 rb 4096
file_name: file_name:
rb 4096 rb 4096
file_info: file_info:
rb 40 rb 40
I_END: I_END:

View File

@ -1,6 +1,7 @@
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
;--- ÄÀÍÍÛÅ ÏÐÎÃÐÀÌÌÛ ---------------------------------------------- ;--- ÄÀÍÍÛÅ ÏÐÎÃÐÀÌÌÛ ----------------------------------------------
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
@use_library
header_1 db 'Box_lib Control Demo by Mario79',0 header_1 db 'Box_lib Control Demo by Mario79',0
ok_btn db 'Ok',0 ok_btn db 'Ok',0
@ -8,11 +9,35 @@ ok_btn db 'Ok',0
labelt3 db 'About program',0 labelt3 db 'About program',0
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
icons_file_name: db 'reload_16x16_8b.bmp',0 icons_file_name: db 'reload_16x16_8b.bmp',0
system_dir1 db '/sys/lib/'
plugin_BMP_name db 'cnv_bmp.obj',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 system_dir db '/sys/lib/'
boxlib_name db 'box_lib.obj',0
; Åñëè åñòü æåëàíèå ðàçúåäèíèòü, òî íóæíî èñïîëüçîâàòü ñëåäóþùèþ êîíñòðóêöèþ
;system_path db '/sys/lib/box_lib.obj',0
;... ëþáàÿ ïîñëåäîâàòåëüíîñòü äðóãèõ êîìàíä è îïðåäåëåíèé.
;library_name db 'box_lib.obj',0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ihead_f_i:
ihead_f_l db 'System error',0
er_message_found_lib db 'Sorry I cannot load library box_lib.obj',0
er_message_import db 'Error on load import library box_lib.obj',0
er_message_found_lib2 db 'Sorry I cannot load library cnv_bmp.obj',0
er_message_import2 db 'Error on load import library cnv_bmp.obj',0
align 4
l_libs_start:
library01 l_libs boxlib_name, path, file_name, system_dir, \
er_message_found_lib, ihead_f_l, myimport, er_message_import, ihead_f_i
;library02 l_libs plugin_BMP_name, path, file_name, system_dir1,\
;er_message_found_lib2, ihead_f_l, myimport, er_message_import2, ihead_f_i
end_l_libs:
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
fileinfo: fileinfo:
dd 5 dd 5
@ -22,7 +47,7 @@ fileinfo:
dd file_info dd file_info
string: string:
db 0 db 0
dd file_name dd file_name
plugin dd 0 plugin dd 0
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
@ -41,6 +66,9 @@ deflate_unpack dd 0
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
align 4 align 4
myimport: myimport:
init_lib dd a_init
version_lib dd a_version
edit_box_draw dd aEdit_box_draw edit_box_draw dd aEdit_box_draw
edit_box_key dd aEdit_box_key edit_box_key dd aEdit_box_key
@ -55,22 +83,25 @@ option_box_draw dd aOption_box_draw
option_box_mouse dd aOption_box_mouse option_box_mouse dd aOption_box_mouse
version_op dd aVersion_op version_op dd aVersion_op
scrollbar_ver_draw dd aScrollbar_ver_draw scrollbar_ver_draw dd aScrollbar_ver_draw
scrollbar_ver_mouse dd aScrollbar_ver_mouse scrollbar_ver_mouse dd aScrollbar_ver_mouse
scrollbar_hor_draw dd aScrollbar_hor_draw scrollbar_hor_draw dd aScrollbar_hor_draw
scrollbar_hor_mouse dd aScrollbar_hor_mouse scrollbar_hor_mouse dd aScrollbar_hor_mouse
version_scrollbar dd aVersion_scrollbar version_scrollbar dd aVersion_scrollbar
dinamic_button_draw dd aDbutton_draw dinamic_button_draw dd aDbutton_draw
dinamic_button_mouse dd aDbutton_mouse dinamic_button_mouse dd aDbutton_mouse
version_dbutton dd aVersion_dbutton version_dbutton dd aVersion_dbutton
menu_bar_draw dd aMenu_bar_draw menu_bar_draw dd aMenu_bar_draw
menu_bar_mouse dd aMenu_bar_mouse menu_bar_mouse dd aMenu_bar_mouse
version_menu_bar dd aVersion_menu_bar version_menu_bar dd aVersion_menu_bar
dd 0 dd 0
dd 0 dd 0
a_init db 'lib_init',0
a_version db 'version',0
aEdit_box_draw db 'edit_box',0 aEdit_box_draw db 'edit_box',0
aEdit_box_key db 'edit_box_key',0 aEdit_box_key db 'edit_box_key',0
aEdit_box_mouse db 'edit_box_mouse',0 aEdit_box_mouse db 'edit_box_mouse',0
@ -84,19 +115,19 @@ aOption_box_draw db 'option_box_draw',0
aOption_box_mouse db 'option_box_mouse',0 aOption_box_mouse db 'option_box_mouse',0
aVersion_op db 'version_op',0 aVersion_op db 'version_op',0
aScrollbar_ver_draw db 'scrollbar_v_draw',0 aScrollbar_ver_draw db 'scrollbar_v_draw',0
aScrollbar_ver_mouse db 'scrollbar_v_mouse',0 aScrollbar_ver_mouse db 'scrollbar_v_mouse',0
aScrollbar_hor_draw db 'scrollbar_h_draw',0 aScrollbar_hor_draw db 'scrollbar_h_draw',0
aScrollbar_hor_mouse db 'scrollbar_h_mouse',0 aScrollbar_hor_mouse db 'scrollbar_h_mouse',0
aVersion_scrollbar db 'version_scrollbar',0 aVersion_scrollbar db 'version_scrollbar',0
aDbutton_draw db 'dbutton_draw',0 aDbutton_draw db 'dbutton_draw',0
aDbutton_mouse db 'dbutton_mouse',0 aDbutton_mouse db 'dbutton_mouse',0
aVersion_dbutton db 'version_dbutton',0 aVersion_dbutton db 'version_dbutton',0
aMenu_bar_draw db 'menu_bar_draw',0 aMenu_bar_draw db 'menu_bar_draw',0
aMenu_bar_mouse db 'menu_bar_mouse',0 aMenu_bar_mouse db 'menu_bar_mouse',0
aVersion_menu_bar db 'version_menu_bar',0 aVersion_menu_bar db 'version_menu_bar',0
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
@ -132,7 +163,7 @@ scroll_bar_data_vertical:
.position2 dd 0 ;+72 .position2 dd 0 ;+72
.work_size dd 0 ;+76 .work_size dd 0 ;+76
.all_redraw dd 0 ;+80 .all_redraw dd 0 ;+80
.ar_offset dd 10 ;+84 .ar_offset dd 10 ;+84
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
align 4 align 4
scroll_bar_data_horizontal: scroll_bar_data_horizontal:
@ -166,48 +197,48 @@ scroll_bar_data_horizontal:
.position2 dd 0 ;+72 .position2 dd 0 ;+72
.work_size dd 0 ;+76 .work_size dd 0 ;+76
.all_redraw dd 0 ;+80 .all_redraw dd 0 ;+80
.ar_offset dd 10 ;+84 .ar_offset dd 10 ;+84
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
align 4 align 4
menu_data_1: menu_data_1:
.type: dd 0 ;+0 .type: dd 0 ;+0
.x: .x:
.size_x dw 40 ;+4 .size_x dw 40 ;+4
.start_x dw 20 ;+6 .start_x dw 20 ;+6
.y: .y:
.size_y dw 15 ;+8 .size_y dw 15 ;+8
.start_y dw 25 ;+10 .start_y dw 25 ;+10
.text_pointer: dd menu_text_area ;0 ;+12 .text_pointer: dd menu_text_area ;0 ;+12
.pos_pointer: dd menu_text_area.1 ;0 ;+16 .pos_pointer: dd menu_text_area.1 ;0 ;+16
.text_end dd menu_text_area.end ;0 ;+20 .text_end dd menu_text_area.end ;0 ;+20
.mouse_pos dd 0 ;+24 .mouse_pos dd 0 ;+24
.mouse_keys dd 0 ;+28 .mouse_keys dd 0 ;+28
.x1: .x1:
.size_x1 dw 40 ;+32 .size_x1 dw 40 ;+32
.start_x1 dw 20 ;+34 .start_x1 dw 20 ;+34
.y1: .y1:
.size_y1 dw 100 ;+36 .size_y1 dw 100 ;+36
.start_y1 dw 40 ;+38 .start_y1 dw 40 ;+38
.bckg_col dd 0xeeeeee ;+40 .bckg_col dd 0xeeeeee ;+40
.frnt_col dd 0xff ;+44 .frnt_col dd 0xff ;+44
.menu_col dd 0xffffff ;+48 .menu_col dd 0xffffff ;+48
.select dd 0 ;+52 .select dd 0 ;+52
.out_select dd 0 ;+56 .out_select dd 0 ;+56
.buf_adress dd 0 ;+60 .buf_adress dd 0 ;+60
.procinfo dd 0 ;+64 .procinfo dd 0 ;+64
.click dd 0 ;+68 .click dd 0 ;+68
.cursor dd 0 ;+72 .cursor dd 0 ;+72
.cursor_old dd 0 ;+76 .cursor_old dd 0 ;+76
.interval dd 16 ;+80 .interval dd 16 ;+80
.cursor_max dd 0 ;+84 .cursor_max dd 0 ;+84
.extended_key dd 0 ;+88 .extended_key dd 0 ;+88
.menu_sel_col dd 0x00cc00 ;+92 .menu_sel_col dd 0x00cc00 ;+92
.bckg_text_col dd 0 ; +96 .bckg_text_col dd 0 ; +96
.frnt_text_col dd 0xffffff ;+100 .frnt_text_col dd 0xffffff ;+100
.mouse_keys_old dd 0 ;+104 .mouse_keys_old dd 0 ;+104
.font_height dd 8 ;+108 .font_height dd 8 ;+108
.cursor_out dd 0 ;+112 .cursor_out dd 0 ;+112
.get_mouse_flag dd 0 ;+116 .get_mouse_flag dd 0 ;+116
;------------------------- ;-------------------------
menu_text_area: menu_text_area:
db 'File',0 db 'File',0
@ -220,44 +251,44 @@ db 0
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
align 4 align 4
menu_data_2: menu_data_2:
.type: dd 0 ;+0 .type: dd 0 ;+0
.x: .x:
.size_x dw 40 ;+4 .size_x dw 40 ;+4
.start_x dw 60 ;+6 .start_x dw 60 ;+6
.y: .y:
.size_y dw 15 ;+8 .size_y dw 15 ;+8
.start_y dw 25 ;+10 .start_y dw 25 ;+10
.text_pointer: dd menu_text_area_2 ;0 ;+12 .text_pointer: dd menu_text_area_2 ;0 ;+12
.pos_pointer: dd menu_text_area_2.1 ;0 ;+16 .pos_pointer: dd menu_text_area_2.1 ;0 ;+16
.text_end dd menu_text_area_2.end ;0 ;+20 .text_end dd menu_text_area_2.end ;0 ;+20
.mouse_pos dd 0 ;+24 .mouse_pos dd 0 ;+24
.mouse_keys dd 0 ;+28 .mouse_keys dd 0 ;+28
.x1: .x1:
.size_x1 dw 50 ;+32 .size_x1 dw 50 ;+32
.start_x1 dw 60 ;+34 .start_x1 dw 60 ;+34
.y1: .y1:
.size_y1 dw 100 ;+36 .size_y1 dw 100 ;+36
.start_y1 dw 40 ;+38 .start_y1 dw 40 ;+38
.bckg_col dd 0xeeeeee ;+40 .bckg_col dd 0xeeeeee ;+40
.frnt_col dd 0xff ;+44 .frnt_col dd 0xff ;+44
.menu_col dd 0xffffff ;+48 .menu_col dd 0xffffff ;+48
.select dd 0 ;+52 .select dd 0 ;+52
.out_select dd 0 ;+56 .out_select dd 0 ;+56
.buf_adress dd 0 ;+60 .buf_adress dd 0 ;+60
.procinfo dd 0 ;+64 .procinfo dd 0 ;+64
.click dd 0 ;+68 .click dd 0 ;+68
.cursor dd 0 ;+72 .cursor dd 0 ;+72
.cursor_old dd 0 ;+76 .cursor_old dd 0 ;+76
.interval dd 16 ;+80 .interval dd 16 ;+80
.cursor_max dd 0 ;+84 .cursor_max dd 0 ;+84
.extended_key dd 0 ;+88 .extended_key dd 0 ;+88
.menu_sel_col dd 0x00cc00 ;+92 .menu_sel_col dd 0x00cc00 ;+92
.bckg_text_col dd 0 ; +96 .bckg_text_col dd 0 ; +96
.frnt_text_col dd 0xffffff ;+100 .frnt_text_col dd 0xffffff ;+100
.mouse_keys_old dd 0 ;+104 .mouse_keys_old dd 0 ;+104
.font_height dd 8 ;+108 .font_height dd 8 ;+108
.cursor_out dd 0 ;+112 .cursor_out dd 0 ;+112
.get_mouse_flag dd 0 ;+116 .get_mouse_flag dd 0 ;+116
;------------------------ ;------------------------
menu_text_area_2: menu_text_area_2:
db 'Help',0 db 'Help',0
@ -269,43 +300,43 @@ db 0
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
align 4 align 4
dinamic_button_data_1: dinamic_button_data_1:
.type dd 0 ;+0 .type dd 0 ;+0
.x: .x:
.size_x dw 20 ;+4 .size_x dw 20 ;+4
.start_x dw 150 ;+6 .start_x dw 150 ;+6
.y: .y:
.size_y dw 20 ;+8 .size_y dw 20 ;+8
.start_y dw 25 ;+10 .start_y dw 25 ;+10
.mouse_pos dd 0 ;+12 .mouse_pos dd 0 ;+12
.mouse_keys dd 0 ;+16 .mouse_keys dd 0 ;+16
.mouse_keys_old dd 0 ;+20 .mouse_keys_old dd 0 ;+20
.active_raw dd 0 ;+24 .active_raw dd 0 ;+24
.passive_raw dd 0 ;+28 .passive_raw dd 0 ;+28
.click_raw dd 0 ;+32 .click_raw dd 0 ;+32
.resolution_raw dd 0 ;+36 .resolution_raw dd 0 ;+36
.palette_raw dd 0 ;+40 .palette_raw dd 0 ;+40
.offset_raw dd 0 ;+44 .offset_raw dd 0 ;+44
.select dd 0 ;+48 .select dd 0 ;+48
.click dd 0 ;+52 .click dd 0 ;+52
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
align 4 align 4
dinamic_button_data_2: dinamic_button_data_2:
.type dd 0 ;+0 .type dd 0 ;+0
.x: .x:
.size_x dw 20 ;+4 .size_x dw 20 ;+4
.start_x dw 180 ;+6 .start_x dw 180 ;+6
.y: .y:
.size_y dw 20 ;+8 .size_y dw 20 ;+8
.start_y dw 25 ;+10 .start_y dw 25 ;+10
.mouse_pos dd 0 ;+12 .mouse_pos dd 0 ;+12
.mouse_keys dd 0 ;+16 .mouse_keys dd 0 ;+16
.mouse_keys_old dd 0 ;+20 .mouse_keys_old dd 0 ;+20
.active_raw dd 0 ;+24 .active_raw dd 0 ;+24
.passive_raw dd 0 ;+28 .passive_raw dd 0 ;+28
.click_raw dd 0 ;+32 .click_raw dd 0 ;+32
.resolution_raw dd 0 ;+36 .resolution_raw dd 0 ;+36
.palette_raw dd 0 ;+40 .palette_raw dd 0 ;+40
.offset_raw dd 0 ;+44 .offset_raw dd 0 ;+44
.select dd 0 ;+48 .select dd 0 ;+48
.click dd 0 ;+52 .click dd 0 ;+52
;--------------------------------------------------------------------- ;---------------------------------------------------------------------

View File

@ -13,10 +13,14 @@ use32 ;
include 'macros.inc' include 'macros.inc'
include 'editbox_ex.mac' include 'editbox_ex.mac'
include 'load_lib.mac' include 'load_lib.mac'
@use_library ;use load lib macros
start: start:
;universal load library/librarys ;universal load library/librarys
load_library library_name, cur_dir_path, library_path, system_path, \ sys_load_library library_name, cur_dir_path, library_path, system_path, \
err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i
;if return code =-1 then exit, else nornary work
cmp eax,-1
jz exit
mcall 40,0x27 ;ãáâ ­®¢¨âì ¬ áªã ¤«ï ®¦¨¤ ¥¬ëå ᮡë⨩ mcall 40,0x27 ;ãáâ ­®¢¨âì ¬ áªã ¤«ï ®¦¨¤ ¥¬ëå ᮡë⨩
red_win: red_win:
call draw_window ;¯¥à¢®­ ç «ì­® ­¥®¡å®¤¨¬® ­ à¨á®¢ âì ®ª­® call draw_window ;¯¥à¢®­ ç «ì­® ­¥®¡å®¤¨¬® ­ à¨á®¢ âì ®ª­®
@ -94,9 +98,16 @@ draw_window: ;
ret ret
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;DATA ¤ ­­ë¥ ;DATA ¤ ­­ë¥
system_path db '/sys/lib/box_lib.obj',0 ;‚ᥣ¤  ᮡ«î¤ âì ¯®á«¥¤®¢ â¥«ì­®áâì ¢ ¨¬¥­¨.
system_path db '/sys/lib/'
library_name db 'box_lib.obj',0 library_name db 'box_lib.obj',0
err_message_found_lib db 'Sorry I cannot found library box_lib.obj',0 ; …᫨ ¥áâì ¦¥« ­¨¥ ࠧꥤ¨­¨âì, â® ­ã¦­® ¨á¯®«ì§®¢ âì á«¥¤ãîé¨î ª®­áâàãªæ¨î
;system_path db '/sys/lib/box_lib.obj',0
;... «î¡ ï ¯®á«¥¤®¢ â¥«ì­®áâì ¤àã£¨å ª®¬ ­¤ ¨ ®¯à¥¤¥«¥­¨©.
;library_name db 'box_lib.obj',0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
err_message_found_lib db 'Sorry I cannot load library box_lib.obj',0
head_f_i: head_f_i:
head_f_l db 'System error',0 head_f_l db 'System error',0
err_message_import db 'Error on load import library box_lib.obj',0 err_message_import db 'Error on load import library box_lib.obj',0
@ -152,7 +163,7 @@ option_group1 dd op1 ;㪠
option_group2 dd op12 ;¯à¨«®¦¥­¨¥ option_group2 dd op12 ;¯à¨«®¦¥­¨¥
Option_boxs dd op1,op2,op3,0 Option_boxs dd op1,op2,op3,0
Option_boxs2 dd op11,op12,op13,0 Option_boxs2 dd op11,op12,op13,0
hed db 'BOXs load from lib <Lrz> date 27.09.2007',0 hed db 'BOXs load from lib <Lrz> date 27.04.2009',0
hed_end: hed_end:
rb 256 rb 256
check_text db 'First checkbox' check_text db 'First checkbox'
@ -166,6 +177,8 @@ op_text: ;
.e3: .e3:
ed_buffer rb 100 ed_buffer rb 100
;----------------------- ;-----------------------
;sc system_colors
p_info process_information
cur_dir_path rb 4096 cur_dir_path rb 4096
library_path rb 4096 library_path rb 4096
i_end: i_end:

View File

@ -75,3 +75,4 @@ op_flag_en=10b
.ch_text_length: dd op_text_length ;¤«¨­­  áâப¨ á ᨬ¢®« ¬¨ .ch_text_length: dd op_text_length ;¤«¨­­  áâப¨ á ᨬ¢®« ¬¨
.flags: dd flags+0 ; ä« £¨ .flags: dd flags+0 ; ä« £¨
} }

View File

@ -1,3 +1,4 @@
;08.05.2009 - bugfix
;14.04.2009 - a macros for code load library the box_lib.obj from '/sys/lib/' or current dirrectory. ;14.04.2009 - a macros for code load library the box_lib.obj from '/sys/lib/' or current dirrectory.
; The macros for load any library/libraries: ; The macros for load any library/libraries:
; Copyright (c) 2009, <Lrz> ; Copyright (c) 2009, <Lrz>
@ -39,113 +40,199 @@
; "I'm sorry,the programm cannot found system library box_lib.obj." ; "I'm sorry,the programm cannot found system library box_lib.obj."
; "The find was make on 2 ways: /sys/lib/ and current dirrectory." ; "The find was make on 2 ways: /sys/lib/ and current dirrectory."
; ;
; ebx,library_name ;
; esi,cur_dir_path
; edi,library_path
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
; Macro test_load_library ; Macro sys_load_library
; A first time we must to check own path in current dirrectory the program, where I belive find a system library. ; A first time we must to check own path in current dirrectory the program, where I belive find a system library.
; If I cannot found my library, i must to check second way. Second way is system path a "/sys/lib/". ; If I cannot found my library, i must to check second way. Second way is system path a "/sys/lib/".
; If we cannot load library, we must show the error message: ; If we cannot load library, we must show the error message:
; "I'm sorry,the programm cannot found system library box_lib.obj." ; "I'm sorry,the programm cannot found system library box_lib.obj."
; "The find was make on 2 ways: /sys/lib/ and current dirrectory." ; "The find was make on 2 ways: /sys/lib/ and current dirrectory."
;
;---------------------------------------------------------------------
; How can I use it?
;---------------------------------------------------------------------
;-Example using single load library
;-universal load library/librarys
;load_library library_name, cur_dir_path, library_path, system_path, \
;err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i
;-if return code =-1 then exit, else normally work
; cmp eax,-1
; jz exit
;- Well, if you get
;
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;DATA äàííûå
;Âñåãäà ñîáëþäàòü ïîñëåäîâàòåëüíîñòü â èìåíè.
;system_path db '/sys/lib/'
;library_name db 'box_lib.obj',0
; Åñëè åñòü æåëàíèå ðàçúåäèíèòü, òî íóæíî èñïîëüçîâàòü ñëåäóþùèþ êîíñòðóêöèþ
;system_path db '/sys/lib/box_lib.obj',0
;... ëþáàÿ ïîñëåäîâàòåëüíîñòü äðóãèõ êîìàíä è îïðåäåëåíèé.
;library_name db 'box_lib.obj',0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
macro load_library library_name, cur_dir_path, library_path, system_path, err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i ;err_message_found_lib db 'Sorry I cannot found library box_lib.obj',0
;head_f_i:
;head_f_l db 'System error',0
;err_message_import db 'Error on load import library box_lib.obj',0
;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
; 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
;---------------------------------------------------------------------
macro @use_library
{ {
local end_steep show_err_:
;--------------------------------------------------------------------- local red_win
; loading Box_Lib library local still
local button
local __sc
local start
local ex_lp
local lp
local correction
;/equ
err_message1 equ dword [esp+8]
head1 equ dword [esp+4]
mcall 68,19,system_path ; load of sys directory
__sc.frame equ dword [__sc+0]
__sc.grab equ dword [__sc+4]
__sc.grab_button equ dword [__sc+8]
__sc.grab_button_text equ dword [__sc+12]
__sc.grab_text equ dword [__sc+16]
__sc.work equ dword [__sc+20]
__sc.work_button equ dword [__sc+24]
__sc.work_button_text equ dword [__sc+28]
__sc.work_text equ dword [__sc+32]
__sc.work_graph equ dword [__sc+36]
;local on_x
;local on_y
;;;;;;;;;;;CALC WIDTH & HIGHT WINDOW & CENTER MONITOR POSITION;;;;;;;;;;
mov eax,48 ;get system color
mov ebx,3
mov ecx,__sc
mov edx,sizeof.system_colors
mcall
;---------------------------------------------------------------------
;get with text imul on 6 pix
xor eax,eax
mov esi,err_message1
mov ecx,30
align 4
lp: lodsb
test eax,eax test eax,eax
jnz end_steep jz ex_lp
add ecx,7
mov ebx,library_name jmp lp
mov esi,cur_dir_path
mov edi,library_path
copy_path ;the macros making way /current pach a program/+ name system library
mcall 68,19,library_path ; load of alternative
test eax,eax
jnz end_steep
show_error_window err_message_found_lib, head_f_l ;show error message /create window
end_steep:
import_boxlib myimport, err_message_import, head_f_i ;import
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
} ex_lp:
mcall 48,5 ;get system window
sub eax,ecx
sub bx,90
shl eax,15
shl ebx,15
mov ax,cx
mov bx,90
mov dword [on_x],eax
mov dword [on_y],ebx
; mov eax,dword [esp+4]
; mov dword [header_xx],eax
; mov eax,dword [esp+8]
; mov dword [message_xx],eax
jmp start
__sc system_colors
on_x dd ?
on_y dd ?
message_xx dd ?
header_xx dd ?
;;;;;;;;;;;DRAW WINDOW;;;;;;;;;;;;;;
start:
mcall 40,0x5 ;set mask on events rewraw window and get id button.
red_win:
;draw_window:
mcall 12,1
xor eax,eax
mov ebx,dword [on_x]
mov ecx,dword [on_y]
mov edx,__sc.work
or edx,0x33000000
mov esi,__sc.grab_text
mov edi,head1
mcall
mov eax,4
mov ebx,(10*65536+25)
mov ecx,__sc.grab_text
or ecx,0x90000000
mov edx,err_message1
mcall
mcall 12,2
align 4
still: ;main loop
mcall 10 ;wait event
dec eax
jz red_win
sub eax,2
jnz still ;go to main loop
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
button:
mcall 17 ;get id button
test ah,ah ;if in ah 0, then go to still
jz still
or dword [esp+40],-1; modify eax in stack (pushad)
ret
macro test_load_library library_name, cur_dir_path, library_path, system_path, err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i
{
local end_steep
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
; loading Box_Lib library @library_name equ dword [esp+12]
mov ebx,library_name @cur_dir_path equ dword [esp+8]
mov esi,cur_dir_path @library_path equ dword [esp+4]
mov edi,library_path
copy_path ;the macros making way /current pach a program/+ name system library align 4
@copy_path:
mov ebx,@library_name
mov esi,@cur_dir_path
mov edi,@library_path
mcall 68,19,library_path ; load of alternative
test eax,eax
jnz end_steep
mcall 68,19,system_path ; load of sys directory
test eax,eax
jnz end_steep
show_error_window err_message_found_lib, head_f_l ;show error message /create window
end_steep:
import_boxlib myimport, err_message_import, head_f_i ;import
;---------------------------------------------------------------------
}
macro load_libraries library_name, cur_dir_path, library_path, system_path, err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i
{
local end_steep
;---------------------------------------------------------------------
; loading Box_Lib library
mcall 68,19,system_path ; load of sys directory
test eax,eax
jnz end_steep
mov ebx,library_name
mov esi,cur_dir_path
mov edi,library_path
copy_path ;the macros making way /current pach a program/+ name system library
mcall 68,19,library_path ; load of alternative
test eax,eax
jnz end_steep
show_error_window err_message_found_lib, head_f_l ;show error message /create window
end_steep:
import_boxlib myimport, err_message_import, head_f_i ;import
;---------------------------------------------------------------------
}
macro copy_path
{
local copy_path
;---------------------------------------------------------------------
; mov ebx,library_name
; mov esi,cur_dir_path
; mov edi,library_path
copy_path:
xor eax,eax xor eax,eax
cld cld
.lp1: .lp1:
@ -172,37 +259,208 @@ copy_path:
test eax,eax test eax,eax
jnz .lp3 jnz .lp3
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
ret
}
macro sys_load_library library_name, cur_dir_path, library_path, system_path, err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i
{
local end_steep
local exit
;---------------------------------------------------------------------
; loading Box_Lib library
mcall 68,19,system_path ; load of sys directory
test eax,eax
jnz end_steep
copy_path library_name, cur_dir_path, library_path ;the macros making way /current pach a program/+ name system library
mcall 68,19,library_path ; load of alternative
test eax,eax
jnz end_steep
show_error_window err_message_found_lib, head_f_l ;show error message /create window
jmp exit
align 4
end_steep:
import_boxlib myimport, err_message_import, head_f_i ;import
exit:
;---------------------------------------------------------------------
}
macro load_library library_name, cur_dir_path, library_path, system_path, err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i
{
local end_steep
local exit
;---------------------------------------------------------------------
; loading Box_Lib library
copy_path library_name, cur_dir_path, library_path ;the macros making way /current pach a program/+ name system library
mcall 68,19,library_path ; load of alternative
test eax,eax
jnz end_steep
mcall 68,19,system_path ; load of sys directory
test eax,eax
jnz end_steep
show_error_window err_message_found_lib, head_f_l ;show error message /create window
jmp exit
align 4
end_steep:
import_boxlib myimport, err_message_import, head_f_i ;import
exit:
;---------------------------------------------------------------------
}
macro sys_load_libraries _start,_end
{
local lp
local end_steep
local next
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
library_name equ [ebp]
cur_dir_path equ [ebp+4]
library_path equ [ebp+8]
system_path equ [ebp+12]
err_message_found_lib equ [ebp+16]
head_f_l equ [ebp+20]
my_import equ [ebp+24]
err_message_import equ [ebp+28]
head_f_i equ [ebp+32]
adr_load_lib equ dword [ebp+36]
status_lib equ dword [ebp+40]
; show_error_window err_message_found_lib, head_f_l ;show error message /create window
; int 0x40
mov ebp,_start
mov ecx,((_end-_start)/ll_struc_size)
align 4
lp: push ecx
mcall 68,19,system_path ; load of sys directory
test eax,eax
jnz end_steep
copy_path library_name, cur_dir_path, library_path ;the macros making way /current pach a program/+ name system library
mcall 68,19,library_path ; load of alternative
test eax,eax
jnz end_steep
or status_lib,0x1 ; status of code - enable error - not found library
show_error_window err_message_found_lib, head_f_l ;show error message /create window
jmp next
align 4
end_steep:
mov adr_load_lib,eax ;save adr lib in memory
import_boxlib my_import, err_message_import, head_f_i ;import
test eax,eax
jz next
or status_lib,0x2 ; status of code - enable error - import error
next:
pop ecx
add ebp,ll_struc_size
dec ecx
jnz lp
}
macro load_libraries _start,_end
{
local lp
local end_steep
local next
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
library_name equ [ebp]
cur_dir_path equ [ebp+4]
library_path equ [ebp+8]
system_path equ [ebp+12]
err_message_found_lib equ [ebp+16]
head_f_l equ [ebp+20]
my_import equ [ebp+24]
err_message_import equ [ebp+28]
head_f_i equ [ebp+32]
adr_load_lib equ dword [ebp+36]
status_lib equ dword [ebp+40]
mov ebp,_start
mov ecx,((_end-_start)/ll_struc_size)
align 4
lp: push ecx
copy_path library_name, cur_dir_path, library_path ;the macros making way /current pach a program/+ name system library
mcall 68,19,library_path ; load of alternative
test eax,eax
jnz end_steep
mcall 68,19,system_path ; load of sys directory
test eax,eax
jnz end_steep
or status_lib,0x1 ; status of code - enable error - not found library
show_error_window err_message_found_lib, head_f_l ;show error message /create window
jmp next
align 4
end_steep:
mov adr_load_lib,eax ;save adr lib in memory
import_boxlib my_import, err_message_import, head_f_i ;import
test eax,eax
jz next
or status_lib,0x2 ; status of code - enable error - import error
next:
pop ecx
add ebp,ll_struc_size
dec ecx
jnz lp
}
macro copy_path lib_name,dir_path,lib_path
{
pushad ;save all registers
push dword lib_name
push dword dir_path
push dword lib_path
call @copy_path
add esp,12
popad ;restore all registers
} }
macro show_error_window err_message, head macro show_error_window err_message, head
{ { pushad ;save all registers
local red_win push dword err_message
local still push dword head
local button
mcall 40,0x5 ;set mask on events rewraw window and get id button. call show_err_
red_win:
;draw_window:
mcall 12, 1
mcall 0, <0,300>, <0,100>, 0x33AABBCC, 0x805080D0, head
mcall 4, <10,10>, 0x90000000, err_message; _found_lib
mcall 12, 2
align 4
still: ;main loop
mcall 10 ;wait event
dec eax
jz red_win
sub eax,2 add esp,8
jnz still ;go to main loop popad ;restore all registers
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
button:
mcall 17 ;get id button
test ah,ah ;if in ah 0, then go to still
jz still
mcall -1
} }
macro import_boxlib myimport, err_message_import, head_f_i macro import_boxlib myimport, err_message_import, head_f_i
{ {
local import_loop local import_loop
@ -212,7 +470,10 @@ local import_find_next
local import_found local import_found
local import_done local import_done
local exit local exit
local e.exit
local import_not_found
; initialize import ; initialize import
mov edx, eax mov edx, eax
mov esi,myimport mov esi,myimport
import_loop: import_loop:
@ -223,7 +484,7 @@ import_loop:
import_find: import_find:
mov ebx, [ds:edx] mov ebx, [ds:edx]
test ebx, ebx test ebx, ebx
jz exit ;import_not_found jz import_not_found
push eax push eax
lp: lp:
mov cl, [ds:eax] mov cl, [ds:eax]
@ -244,11 +505,29 @@ import_found:
mov [esi-4], eax mov [esi-4], eax
pop edx pop edx
jmp import_loop jmp import_loop
exit: import_not_found:
add esp,4 add esp,4
show_error_window err_message_import, head_f_i ;show error message /create window show_error_window err_message_import, head_f_i ;show error message /create window
jmp e.exit
import_done: import_done:
xor eax,eax
e.exit:
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
} }
ll_struc_size = 44;($-library_name) ; constant size of struct
struc l_libs library_name, cur_dir_path, library_path, system_path, err_message_found_lib, head_f_l, my_import, err_message_import, head_f_i; struct for loading libraries
{
.library_name dd library_name
.cur_dir_path dd cur_dir_path
.library_path dd library_path
.system_path dd system_path
.err_message_found_lib dd err_message_found_lib
.head_f_l dd head_f_l
.my_import dd my_import
.err_message_import dd err_message_import
.head_f_i dd head_f_i
.adr_load_lib dd 0x0
.status_lib dd 0x0 ;status of load library
;
}

View File

@ -10,6 +10,7 @@ EditBox
На данный момент, носит эксперементальный, тестовый характер. На данный момент, носит эксперементальный, тестовый характер.
Библиотеку box_lib.obj нужно поместить в папку с выполняющейся программой editbox_ex, или по адресу /sys/lib/? но тогда нужно подменить путь в файле ini_file на путь к библиотеке Библиотеку box_lib.obj нужно поместить в папку с выполняющейся программой editbox_ex, или по адресу /sys/lib/? но тогда нужно подменить путь в файле ini_file на путь к библиотеке
. Пример сам вычисляет путь к библиотеке, не зависимо от своего месторасположения . Пример сам вычисляет путь к библиотеке, не зависимо от своего месторасположения
08.05.2009 - пофиксены баги общее улучшение кода
15.04.2009 - добавлен макрос load_lib.mac - универсальный для загрузки любой библиотеки/библиотек. 15.04.2009 - добавлен макрос load_lib.mac - универсальный для загрузки любой библиотеки/библиотек.
13.09.2009 - обработка клавишь NUM, Caps,Scroll Lock. При нажатии на них, не происходит отображение символа. 13.09.2009 - обработка клавишь NUM, Caps,Scroll Lock. При нажатии на них, не происходит отображение символа.
24.09.2007 - сделал поддрежку checkbox. Добавил ошибки, программа глючит очень серьезно :( 24.09.2007 - сделал поддрежку checkbox. Добавил ошибки, программа глючит очень серьезно :(

View File

@ -1,6 +1,6 @@
@fasm.exe -m 16384 box_lib.asm @fasm.exe -m 16384 box_lib.asm
@fasm.exe -m 16384 editbox_ex.asm editbox_ex.kex @fasm.exe -m 16834 editbox_ex.asm editbox_ex.kex
@fasm.exe -m 16384 ctrldemo.asm ctrldemo.kex @fasm.exe -m 16384 ctrldemo.asm ctrldemo.kex
REM ..\FASM\kpack.exe editbox_ex REM ..\FASM\kpack.exe editbox_ex
rem @klbrinwin.exe editbox_ex.kex REM @klbrinwin.exe editbox_ex.kex
pause pause