1) Component FileBrowser 
2) Small changes MenuBar component

git-svn-id: svn://kolibrios.org@1199 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Marat Zakiyanov (Mario79)
2009-10-07 18:41:24 +00:00
parent 6507cc5019
commit debc953680
5 changed files with 1871 additions and 452 deletions

View File

@@ -1,7 +1,13 @@
;Libray from Editbox ;*****************************************************************************
; SEE YOU File FAQ.txt and HISTORY. Good Like! ; Box_Lib - library of graphical components
;Last Change 13/02/2009 ;
;;;;;;;;;;;;;;;;;; ; Authors:
; Alexey Teplov aka <Lrz>
; Marat Zakiyanov aka Mario79, aka Mario
; Evtikhov Maxim aka Maxxxx32
; Eugene Grechnikov aka Diamond
; hidnplayr
;*****************************************************************************
format MS COFF format MS COFF
@@ -9,40 +15,41 @@ public EXPORTS
section '.flat' code readable align 16 section '.flat' code readable align 16
include '../../../../macros.inc' include '../../../../macros.inc'
include 'editbox.mac' ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> :) ᯥ樠<E1AFA5><20><><EFBFBD> editbox include 'editbox.mac' ;macro which should make life easier :) specially for editbox
include 'checkbox.mac' ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><EFBFBD><><E0A5A0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> checkbox include 'checkbox.mac' ;macro implements checkbox
include 'optionbox.mac' ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><EFBFBD><><E0A5A0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> optionbox include 'optionbox.mac' ;macro implements optionbox
include 'scrollbar.mac' ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><EFBFBD><><E0A5A0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> scrollbar include 'scrollbar.mac' ;macro implements scrollbar
include 'd_button.mac' ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><EFBFBD><><E0A5A0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> dinamic button include 'd_button.mac' ;macro implements dinamic_button
include 'menubar.mac' ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><EFBFBD><><E0A5A0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> menubar include 'menubar.mac' ;macro implements menubar
include 'filebrowser.mac' ;macro implements filebrowser
;---------------------------------------------------- ;----------------------------------------------------
;EditBox ;EditBox
;---------------------------------------------------- ;----------------------------------------------------
align 4 align 4
use_editbox_draw ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBA2A0> <20><EFBFBD><E3ADAA><EFBFBD> <20>⮡ࠦ<E2AEA1><E0A0A6><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>. use_editbox_draw ;macro reveals the function of the display.
align 4 align 4
use_editbox_key ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBA2A0> <20><EFBFBD><E3ADAA><EFBFBD> <20><><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. use_editbox_key ;macro reveals processing function of the keypad.
align 4 align 4
use_editbox_mouse ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBA2A0> <20><EFBFBD><E3ADAA><EFBFBD> <20><><EFBFBD><20><><EFBFBD><EFBFBD>. use_editbox_mouse ;macro reveals processing function of the mouse.
;---------------------------------------------------- ;----------------------------------------------------
;CheckBox ;CheckBox
;---------------------------------------------------- ;----------------------------------------------------
align 4 align 4
use_checkbox_draw ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBA2A0> <20><EFBFBD><E3ADAA><EFBFBD> <20>⮡ࠦ<E2AEA1><E0A0A6><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>. use_checkbox_draw ;macro reveals the function of the display.
align 4 align 4
use_checkbox_mouse ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBA2A0> <20><EFBFBD><E3ADAA><EFBFBD> <20><><EFBFBD><20><><EFBFBD><EFBFBD>. use_checkbox_mouse ;macro reveals processing function of the mouse.
;-------------------------------------------------- ;--------------------------------------------------
;radiobutton Group ;radiobutton Group
;-------------------------------------------------- ;--------------------------------------------------
align 4 align 4
use_optionbox_driver ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E0A0A2><EFBFBD><EFBFBD><><20><><EFBFBD><EFBFBD><EFBFBD> ) use_optionbox_driver ;macro that control the operating modes
align 4 align 4
use_optionbox_draw ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBA2A0> <20><EFBFBD><E3ADAA><EFBFBD> <20>⮡ࠦ<E2AEA1><E0A0A6><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>. use_optionbox_draw ;macro reveals the function of the display.
align 4 align 4
use_optionbox_mouse ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBA2A0> <20><EFBFBD><E3ADAA><EFBFBD> <20><><EFBFBD><20><><EFBFBD><EFBFBD>. use_optionbox_mouse ;macro reveals processing function of the mouse.
;-------------------------------------------------- ;--------------------------------------------------
;scrollbar Group ;scrollbar Group
@@ -66,7 +73,11 @@ use_dinamic_button
align 4 align 4
use_menu_bar use_menu_bar
;--------------------------------------------------
;filebrowser Group
;--------------------------------------------------
align 4
use_file_browser
;-------------------------------------------------- ;--------------------------------------------------
init: init:
ret ret
@@ -110,7 +121,13 @@ EXPORTS:
dd sz_Menu_bar_draw, menu_bar.draw dd sz_Menu_bar_draw, menu_bar.draw
dd sz_Menu_bar_mouse, menu_bar.mouse dd sz_Menu_bar_mouse, menu_bar.mouse
dd szVersion_menu_bar, 0x00010001 dd sz_Menu_bar_activate, menu_bar.activate
dd szVersion_menu_bar, 0x00010002
dd sz_FileBrowser_draw, fb_draw_panel
dd sz_FileBrowser_mouse, fb_mouse
dd sz_FileBrowser_key, fb_key
dd szVersion_FileBrowser, 0x00010001
dd 0,0 dd 0,0
@@ -142,5 +159,10 @@ szVersion_dbutton db 'version_dbutton',0
sz_Menu_bar_draw db 'menu_bar_draw',0 sz_Menu_bar_draw db 'menu_bar_draw',0
sz_Menu_bar_mouse db 'menu_bar_mouse',0 sz_Menu_bar_mouse db 'menu_bar_mouse',0
sz_Menu_bar_activate db 'menu_bar_activate',0
szVersion_menu_bar db 'version_menu_bar',0 szVersion_menu_bar db 'version_menu_bar',0
sz_FileBrowser_draw db 'FileBrowser_draw',0
sz_FileBrowser_mouse db 'FileBrowser_mouse',0
sz_FileBrowser_key db 'FileBrowser_key',0
szVersion_FileBrowser db 'version_FileBrowser',0

View File

@@ -1,6 +1,6 @@
;************************************************************** ;**************************************************************
; Dinamic Button Macro for Kolibri OS ; Dinamic Button Macro for Kolibri OS
; Copyright (c) 2009, Mario79 ; Copyright (c) 2009, Marat Zakiyanov aka Mario79, aka Mario
; All rights reserved. ; All rights reserved.
; ;
; Redistribution and use in source and binary forms, with or without ; Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
; 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 Marat Zakiyanov ''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
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY ; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
@@ -67,10 +67,10 @@ dinamic_button_exit
cmp db_select,dword 2 cmp db_select,dword 2
je .click_2 je .click_2
mov ebx,db_passive_raw mov ebx,db_passive_raw
jmp .draw_2 ;@f jmp .draw_2
.active_1: .active_1:
mov ebx,db_active_raw mov ebx,db_active_raw
jmp .draw_2 ;@f jmp .draw_2
.click_2: .click_2:
mov ebx,db_click_raw mov ebx,db_click_raw
@@: @@:

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
;************************************************************** ;**************************************************************
; MenuBar Macro for Kolibri OS ; MenuBar Macro for Kolibri OS
; Copyright (c) 2009, Mario79 ; Copyright (c) 2009, Marat Zakiyanov aka Mario79, aka Mario
; All rights reserved. ; All rights reserved.
; ;
; Redistribution and use in source and binary forms, with or without ; Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
; 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 Marat Zakiyanov ''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
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY ; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
@@ -34,31 +34,31 @@ ret 4
macro use_menu_bar macro use_menu_bar
{ {
menu_bar: menu_bar:
m_type equ [edi] m_type equ [edi]
m_size_x equ [edi+4] m_size_x equ [edi+4]
m_start_x equ [edi+6] m_start_x equ [edi+6]
m_size_y equ [edi+8] m_size_y equ [edi+8]
m_start_y equ [edi+10] m_start_y equ [edi+10]
m_text_pointer equ [edi+12] m_text_pointer equ [edi+12]
m_pos_pointer equ [edi+16] m_pos_pointer equ [edi+16]
m_text_end equ [edi+20] m_text_end equ [edi+20]
m_mouse_pos equ [edi+24] m_ret_key equ [edi+24]
m_mouse_keys equ [edi+28] m_mouse_keys equ [edi+28]
m_size_x1 equ [edi+32] m_size_x1 equ [edi+32]
m_start_x1 equ [edi+34] m_start_x1 equ [edi+34]
m_size_y1 equ [edi+36] m_size_y1 equ [edi+36]
m_start_y1 equ [edi+38] m_start_y1 equ [edi+38]
m_bckg_col equ [edi+40] m_bckg_col equ [edi+40]
m_frnt_col equ [edi+44] m_frnt_col equ [edi+44]
m_menu_col equ [edi+48] m_menu_col equ [edi+48]
m_select equ [edi+52] m_select equ [edi+52]
m_out_select equ [edi+56] m_out_select equ [edi+56]
m_buf_adress equ [edi+60] m_buf_adress equ [edi+60]
m_procinfo equ [edi+64] m_procinfo equ [edi+64]
m_click equ [edi+68] m_click equ [edi+68]
m_cursor equ [edi+72] m_cursor equ [edi+72]
m_cursor_old equ [edi+76] m_cursor_old equ [edi+76]
m_interval equ [edi+80] m_interval equ [edi+80]
m_cursor_max equ [edi+84] m_cursor_max equ [edi+84]
m_extended_key equ [edi+88] m_extended_key equ [edi+88]
m_menu_sel_col equ [edi+92] m_menu_sel_col equ [edi+92]
@@ -74,499 +74,517 @@ m_get_mouse_flag equ [edi+116]
;***************************************************************************** ;*****************************************************************************
;***************************************************************************** ;*****************************************************************************
.draw: .draw:
pusha pusha
mov edi,dword [esp+36] mov edi,dword [esp+36]
call .draw_1 call .draw_1
menu_bar_exit menu_bar_exit
.draw_1: .draw_1:
call .calc_m_cursor_max call .calc_m_cursor_max
dec dword m_cursor_max dec dword m_cursor_max
mov eax,m_cursor_max mov eax,m_cursor_max
imul eax,m_interval imul eax,m_interval
mov m_size_y1,ax mov m_size_y1,ax
mov ebx,m_size_x mov ebx,m_size_x
mov ecx,m_size_y mov ecx,m_size_y
cmp m_select,dword 1 cmp m_select,dword 1
je .active je .active
mov edx,m_bckg_col mov edx,m_bckg_col
jmp @f jmp @f
.active: .active:
mov edx,m_frnt_col mov edx,m_frnt_col
@@: @@:
mcall 13 mcall 13
shr ecx,16 shr ecx,16
mov bx,cx mov bx,cx
movzx eax,word m_size_y movzx eax,word m_size_y
call .calculate_font_offset call .calculate_font_offset
cmp m_select,dword 1 cmp m_select,dword 1
je .active_1 je .active_1
mov ecx,m_bckg_text_col mov ecx,m_bckg_text_col
add ecx,0x80000000 add ecx,0x80000000
jmp @f jmp @f
.active_1: .active_1:
mov ecx,m_frnt_text_col mov ecx,m_frnt_text_col
add ecx,0x80000000 add ecx,0x80000000
@@: @@:
mov edx,m_text_pointer mov edx,m_text_pointer
mcall 4 mcall 4
ret ret
.draw_2: .draw_2:
mov ebx,m_size_x1 mov ebx,m_size_x1
mov ecx,m_size_y1 mov ecx,m_size_y1
mov edx,m_menu_col mov edx,m_menu_col
mcall 13 mcall 13
ret ret
.calculate_font_offset: .calculate_font_offset:
sub eax,m_font_height sub eax,m_font_height
shr eax,1 shr eax,1
add ebx,eax add ebx,eax
add ebx,4 shl 16 add ebx,4 shl 16
ret ret
.draw_3: .draw_3:
mov ebx,m_size_x1 mov ebx,m_size_x1
mov ecx,m_size_y1 mov ecx,m_size_y1
push ebx ecx push ebx ecx
mov eax,m_cursor_old mov eax,m_cursor_old
imul eax,m_interval imul eax,m_interval
shl eax,16 shl eax,16
add ecx,eax add ecx,eax
mov cx,m_interval mov cx,m_interval
mov edx,m_menu_col mov edx,m_menu_col
mcall 13 mcall 13
pop ecx ebx pop ecx ebx
push ebx ecx push ebx ecx
mov eax,m_cursor mov eax,m_cursor
imul eax,m_interval imul eax,m_interval
shl eax,16 shl eax,16
add ecx,eax add ecx,eax
mov cx,m_interval mov cx,m_interval
mov edx,m_menu_sel_col mov edx,m_menu_sel_col
mcall 13 mcall 13
pop ecx ebx pop ecx ebx
shr ecx,16 shr ecx,16
mov bx,cx mov bx,cx
mov eax,m_interval mov eax,m_interval
call .calculate_font_offset call .calculate_font_offset
mov edx,m_pos_pointer mov edx,m_pos_pointer
xor ebp,ebp xor ebp,ebp
@@: @@:
cmp ebp,m_cursor cmp ebp,m_cursor
jne .no_active_text jne .no_active_text
mov ecx,m_frnt_text_col mov ecx,m_frnt_text_col
jmp .active_text jmp .active_text
.no_active_text: .no_active_text:
mov ecx,m_bckg_text_col mov ecx,m_bckg_text_col
.active_text: .active_text:
add ecx,0x80000000 add ecx,0x80000000
mcall 4 mcall 4
call .get_next_text call .get_next_text
inc ebp inc ebp
add ebx,m_interval add ebx,m_interval
jmp @r jmp @r
.draw_end: .draw_end:
ret ret
.calc_m_cursor_max: .calc_m_cursor_max:
mov edx,m_pos_pointer mov edx,m_pos_pointer
mov m_cursor_max,dword 0 mov m_cursor_max,dword 0
@@: @@:
inc dword m_cursor_max inc dword m_cursor_max
call .get_next_text call .get_next_text
jmp @r jmp @r
;***************************************************************************** ;*****************************************************************************
.get_next_text: .get_next_text:
mov esi,edx mov esi,edx
@@: @@:
cmp esi,m_text_end cmp esi,m_text_end
je .get_next_text_end je .get_next_text_end
cld cld
lodsb lodsb
test al,al test al,al
jnz @r jnz @r
mov edx,esi mov edx,esi
ret ret
.get_next_text_end: .get_next_text_end:
add esp,4 add esp,4
ret ret
;***************************************************************************** ;*****************************************************************************
;***************************************************************************** ;*****************************************************************************
; mouse event ; mouse event
;***************************************************************************** ;*****************************************************************************
;***************************************************************************** ;*****************************************************************************
.activate:
pusha
mov edi,dword [esp+36]
jmp .start_loop
.mouse: .mouse:
pusha pusha
mov edi,dword [esp+36] mov edi,dword [esp+36]
;.mouse_1:
; mov eax,m_mouse_pos
; cmp m_get_mouse_flag,dword 0
; je @f
call .processing_real_mouse
;@@:
test eax,0x80000000
jnz .exit_menu
test eax,0x8000
jnz .exit_menu
mov ebx,eax call .processing_real_mouse
shr ebx,16 ; x position
shl eax,16 test eax,0x80000000
shr eax,16 ; y position jnz .exit_menu
test eax,0x8000
jnz .exit_menu
mov ebx,eax
shr ebx,16 ; x position
shl eax,16
shr eax,16 ; y position
mov cx,m_start_x mov cx,m_start_x
cmp bx,cx cmp bx,cx
jb .exit_menu jb .exit_menu
add cx,m_size_x add cx,m_size_x
dec cx dec cx
cmp bx,cx cmp bx,cx
ja .exit_menu ja .exit_menu
mov cx,m_start_y mov cx,m_start_y
cmp ax,cx cmp ax,cx
jb .exit_menu jb .exit_menu
add cx,m_size_y add cx,m_size_y
cmp ax,cx cmp ax,cx
ja .exit_menu ja .exit_menu
test m_mouse_keys,dword 1b test m_mouse_keys,dword 1b
jnz @f jnz @f
cmp m_select,dword 1 cmp m_select,dword 1
je .exit_menu_1 je .exit_menu_1
mov m_select,dword 1 mov m_select,dword 1
call .draw_1 call .draw_1
jmp .exit_menu_1 jmp .exit_menu_1
@@: @@:
cmp m_get_mouse_flag,dword 1 cmp m_get_mouse_flag,dword 1
mov m_get_mouse_flag,dword 0 mov m_get_mouse_flag,dword 0
je @f je @f
mov eax,m_mouse_keys mov eax,m_mouse_keys
cmp eax,m_mouse_keys_old cmp eax,m_mouse_keys_old
je .exit_menu_1 je .exit_menu_1
@@: @@:
mov m_select,dword 1 .start_loop:
call .draw_1 mov m_select,dword 1
call .allocate_menu_area call .draw_1
call .get_menu_area call .allocate_menu_area
call .get_menu_area
call .draw_2 call .draw_2
.red: .red:
call .draw_3 call .draw_3
.still: .still:
mcall 10 mcall 10
cmp eax,1 cmp eax,1
je .exit_menu_3 ;red je .exit_menu_3
cmp eax,2 cmp eax,2
je .key_menu je .key_menu
cmp eax,3 cmp eax,3
je .exit_menu_3 je .exit_menu_3
cmp eax,6 cmp eax,6
je .mouse_menu je .mouse_menu
jmp .still jmp .still
.key_menu: .key_menu:
mcall 2 mcall 2
cmp m_extended_key,dword 1
je .extended_key
test al,al
jnz .key_menu_end
cmp ah, 0xE0
jne @f
mov m_extended_key,dword 1
.key_menu_end:
jmp .still
@@:
cmp ah,72 ;Arrow Up
je .menu_key_72_1
cmp ah,80 ; Arrow Down
je .menu_key_80_1
cmp ah,28 ; Enter
je .menu_key_28_1
cmp ah,1 ; Esc
je .menu_key_1_1
.key_menu_end_1:
cmp ah,208 ; Arrow Down
je .key_menu_end
cmp ah,200 ; Arrow Up
je .key_menu_end
cmp ah,156 ; Enter
je .key_menu_end
cmp ah,129 ; Esc
je .key_menu_end
; cmp ah,184 ;Alt to Up
; je .end_5
; cmp ah,187 ; F1 to Up
; je .end_1
; cmp ah,188 ; F2 to Up
; je .end_1
cmp ah,199 ;Home
je .key_menu_end
cmp ah,207 ;End
je .key_menu_end
cmp ah,201 ;Page UP
je .key_menu_end
cmp ah,209 ;Page Down
je .key_menu_end
cmp ah,42 ; NumLock ON
je .key_menu_end
cmp ah,170 ; NumLock ON
je .key_menu_end
cmp ah,210 ; Insert
je .key_menu_end
cmp ah,211 ; Delete
je .key_menu_end
; cmp ah,56 ;Alt to Up
; je .end_4
; cmp ah,59 ; F1 to Down
; je .end_2
; cmp ah,60 ; F2 to Down
; je .end_3
;.for_all_key: cmp m_extended_key,dword 1
; mov [close_menu],1 je .extended_key
; ret test al,al
jmp .exit_menu_3 ;.still jnz .key_menu_end
cmp ah, 0xE0
jne @f
mov m_extended_key,dword 1
.key_menu_end:
jmp .still
@@:
cmp ah,72 ;Arrow Up
je .menu_key_72_1
cmp ah,80 ; Arrow Down
je .menu_key_80_1
cmp ah,28 ; Enter
je .menu_key_28_1
cmp ah,1 ; Esc
je .menu_key_1_1
cmp ah,75 ; L-Arrow down
je .menu_key_75_1
cmp ah,77 ; R-Arrow down
je .menu_key_77_1
.key_menu_end_1:
cmp ah,208 ; Arrow Down
je .key_menu_end
cmp ah,200 ; Arrow Up
je .key_menu_end
cmp ah,156 ; Enter
je .key_menu_end
cmp ah,129 ; Esc
je .key_menu_end
cmp ah,199 ;Home
je .key_menu_end
cmp ah,207 ;End
je .key_menu_end
cmp ah,201 ;Page UP
je .key_menu_end
cmp ah,209 ;Page Down
je .key_menu_end
cmp ah,42 ; NumLock ON
je .key_menu_end
cmp ah,170 ; NumLock ON
je .key_menu_end
cmp ah,210 ; Insert
je .key_menu_end
cmp ah,211 ; Delete
je .key_menu_end
cmp ah,157 ; Ctrl up
je .key_menu_end
cmp ah,184 ; Alt up
je .key_menu_end
cmp ah,170 ; L-Shift up
je .key_menu_end
cmp ah,182 ; R-Shift up
je .key_menu_end
cmp ah,203 ; L-Arrow up
je .key_menu_end
cmp ah,205 ; R-Arrow up
je .key_menu_end
jmp .exit_menu_3
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
.extended_key: .extended_key:
mov m_extended_key, dword 0 mov m_extended_key, dword 0
.menu_key_80: .menu_key_80:
cmp ah,80 ; arrow down cmp ah,80 ; arrow down
jne .menu_key_72 jne .menu_key_72
.menu_key_80_1: .menu_key_80_1:
mov eax,m_cursor_max mov eax,m_cursor_max
dec eax dec eax
cmp eax,m_cursor cmp eax,m_cursor
je .still ;@f je .still ;@f
mov ebx,m_cursor mov ebx,m_cursor
mov m_cursor_old,ebx mov m_cursor_old,ebx
inc dword m_cursor inc dword m_cursor
;@@: ;@@:
jmp .red jmp .red
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
.menu_key_72: .menu_key_72:
cmp ah,72 ;arrow up cmp ah,72 ;arrow up
jne .menu_key_71 jne .menu_key_71
.menu_key_72_1: .menu_key_72_1:
cmp m_cursor,dword 0 cmp m_cursor,dword 0
je .still ;@f je .still ;@f
mov ebx,m_cursor mov ebx,m_cursor
mov m_cursor_old,ebx mov m_cursor_old,ebx
dec dword m_cursor dec dword m_cursor
;@@: ;@@:
jmp .red jmp .red
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
.menu_key_71: .menu_key_71:
cmp ah,71 ;Home cmp ah,71 ;Home
je @f je @f
cmp ah,73 ;PageUp cmp ah,73 ;PageUp
jne .menu_key_79 jne .menu_key_79
@@: @@:
cmp m_cursor,dword 0 cmp m_cursor,dword 0
je .still je .still
mov ebx,m_cursor mov ebx,m_cursor
mov m_cursor_old,ebx mov m_cursor_old,ebx
mov m_cursor,dword 0 mov m_cursor,dword 0
jmp .red jmp .red
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
.menu_key_79: .menu_key_79:
cmp ah,79 ; End cmp ah,79 ; End
je @f je @f
cmp ah,81 ; PageDown cmp ah,81 ; PageDown
jne .menu_key_1 jne .menu_key_1
@@: @@:
mov ecx,m_cursor_max mov ecx,m_cursor_max
dec ecx dec ecx
cmp m_cursor,ecx cmp m_cursor,ecx
je .still je .still
mov ebx,m_cursor mov ebx,m_cursor
mov m_cursor_old,ebx mov m_cursor_old,ebx
mov m_cursor,ecx mov m_cursor,ecx
jmp .red jmp .red
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
.menu_key_1: .menu_key_1:
cmp ah,1 ; Esc cmp ah,1 ; Esc
jne .menu_key_28 jne .menu_key_28
.menu_key_1_1: .menu_key_1_1:
jmp .exit_menu_3 jmp .exit_menu_3
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
.menu_key_28: .menu_key_28:
cmp ah,28 ; Enter cmp ah,28 ; Enter
jne .menu_key_end jne .menu_key_75
.menu_key_28_1: .menu_key_28_1:
; mov [press_enter_menu],1 xor eax,eax
; ret mov m_mouse_keys_old,eax
jmp .exit_menu_2 inc eax
.menu_key_end: mov m_mouse_keys,eax
jmp .key_menu_end_1 jmp .exit_menu_2
;---------------------------------------------------------------------
.menu_key_75:
cmp ah,75 ; L-Arrow down
jne .menu_key_77
.menu_key_75_1:
mov m_ret_key,dword 1
jmp .exit_menu_3
;---------------------------------------------------------------------
.menu_key_77:
cmp ah,77 ; R-Arrow down
jne .key_menu_end_1
.menu_key_77_1:
mov m_ret_key,dword 2
jmp .exit_menu_3
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
.processing_real_mouse: .processing_real_mouse:
mcall 37,2 mcall 37,2
mov ebx,m_mouse_keys mov ebx,m_mouse_keys
mov m_mouse_keys_old,ebx mov m_mouse_keys_old,ebx
mov m_mouse_keys,eax mov m_mouse_keys,eax
mcall 37,1 mcall 37,1
mov m_mouse_pos,eax ret
ret
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
.allocate_menu_area: .allocate_menu_area:
cmp m_buf_adress,dword 0 cmp m_buf_adress,dword 0
je @f je @f
call .free_menu_area call .free_menu_area
@@: @@:
movzx ecx,word m_size_x1 movzx ecx,word m_size_x1
movzx eax,word m_size_y1 movzx eax,word m_size_y1
imul ecx,eax imul ecx,eax
lea ecx,[ecx*3] lea ecx,[ecx*3]
mcall 68, 12 mcall 68, 12
mov m_buf_adress,eax mov m_buf_adress,eax
ret ret
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
.free_menu_area: .free_menu_area:
mcall 68,13,m_buf_adress mcall 68,13,m_buf_adress
xor eax,eax xor eax,eax
mov m_buf_adress,eax mov m_buf_adress,eax
ret ret
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
.get_menu_area: .get_menu_area:
mcall 9, m_procinfo,-1 mcall 9, m_procinfo,-1
mov cx,m_size_x1 mov cx,m_size_x1
shl ecx,16 shl ecx,16
mov cx,m_size_y1 mov cx,m_size_y1
mov dx,m_start_x1 mov dx,m_start_x1
mov eax,m_procinfo mov eax,m_procinfo
add dx,[eax+34] add dx,[eax+34]
add dx,[eax+54] add dx,[eax+54]
shl edx,16 shl edx,16
mov dx,m_start_y1 mov dx,m_start_y1
add dx,[eax+38] add dx,[eax+38]
add dx,[eax+58] add dx,[eax+58]
mcall 36, m_buf_adress mcall 36, m_buf_adress
ret ret
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
.put_menu_area: .put_menu_area:
mov cx,m_size_x1 mov cx,m_size_x1
shl ecx,16 shl ecx,16
mov cx,m_size_y1 mov cx,m_size_y1
mov dx,m_start_x1 mov dx,m_start_x1
shl edx,16 shl edx,16
mov dx,m_start_y1 mov dx,m_start_y1
mcall 7, m_buf_adress mcall 7, m_buf_adress
ret ret
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
.mouse_menu: .mouse_menu:
call .processing_real_mouse call .processing_real_mouse
test eax,0x80000000 test eax,0x80000000
jnz .still jnz .still
test eax,0x8000 test eax,0x8000
jnz .still jnz .still
mov ebx,eax mov ebx,eax
shr ebx,16 shr ebx,16
shl eax,16 shl eax,16
shr eax,16 shr eax,16
xor ecx,ecx xor ecx,ecx
mov cx,m_start_y1 mov cx,m_start_y1
cmp ax,cx cmp ax,cx
jbe .close jbe .close
add cx,m_size_y1 add cx,m_size_y1
cmp ax,cx cmp ax,cx
jae .close jae .close
mov cx,m_start_x1 mov cx,m_start_x1
cmp bx,cx cmp bx,cx
jbe .close jbe .close
add cx,m_size_x1 add cx,m_size_x1
cmp bx,cx cmp bx,cx
jae .close jae .close
sub ax,m_start_y1 sub ax,m_start_y1
mov ebx,m_interval mov ebx,m_interval
xor edx,edx xor edx,edx
div ebx div ebx
mov ebx,m_cursor mov ebx,m_cursor
cmp eax,ebx cmp eax,ebx
je .no_red je .no_red
mov m_cursor_old,ebx mov m_cursor_old,ebx
cmp eax,m_cursor_max cmp eax,m_cursor_max
jb @f jb @f
mov eax,m_cursor_max mov eax,m_cursor_max
@@: @@:
mov m_cursor,eax mov m_cursor,eax
test m_mouse_keys,dword 1b test m_mouse_keys,dword 1b
jz .red jz .red
jmp .exit_menu_2 jmp .exit_menu_2
.no_red: .no_red:
test m_mouse_keys,dword 1b test m_mouse_keys,dword 1b
jz .still jz .still
jmp .exit_menu_2 jmp .exit_menu_2
.close: .close:
test m_mouse_keys,dword 1b test m_mouse_keys,dword 1b
jz .still jz .still
jmp .exit_menu_3 jmp .exit_menu_3
.exit_menu: .exit_menu:
cmp m_select,dword 0 cmp m_select,dword 0
je .exit_menu_1 je .exit_menu_1
mov m_select,dword 0 mov m_select,dword 0
call .draw_1 call .draw_1
; jmp .exit_menu_1
test m_mouse_keys,dword 1b test m_mouse_keys,dword 1b
jz .exit_menu_1 jz .exit_menu_1
.exit_menu_3: .exit_menu_3:
mov m_select,dword 0 mov m_select,dword 0
call .put_menu_area call .put_menu_area
xor eax,eax xor eax,eax
mov m_cursor_out,eax mov m_cursor_out,eax
jmp .exit jmp .exit
.exit_menu_2: .exit_menu_2:
mov m_select,dword 0 mov m_select,dword 0
call .put_menu_area call .put_menu_area
mov edx,m_pos_pointer mov edx,m_pos_pointer
mov ebx,m_cursor mov ebx,m_cursor
@@: @@:
cmp ebx,0 cmp ebx,0
jz @f jz @f
dec ebx dec ebx
call .get_next_text call .get_next_text
jmp @r jmp @r
@@: @@:
mov m_out_select,edx mov m_out_select,edx
mov eax,m_cursor mov eax,m_cursor
inc eax inc eax
mov m_cursor_out,eax mov m_cursor_out,eax
mov eax,m_mouse_keys mov eax,m_mouse_keys
cmp eax,m_mouse_keys_old cmp eax,m_mouse_keys_old
jne .exit jne .exit
xor eax,eax xor eax,eax
mov m_cursor_out,eax mov m_cursor_out,eax
.exit: .exit:
call .draw_1 call .draw_1
mov m_click,dword 1 mov m_click,dword 1
jmp @f jmp @f
.exit_menu_1: .exit_menu_1:
mov m_click,dword 0 mov m_click,dword 0
@@: @@:
menu_bar_exit menu_bar_exit
} }

View File

@@ -1,6 +1,6 @@
;************************************************************** ;**************************************************************
; ScrollBar Macro for Kolibri OS ; ScrollBar Macro for Kolibri OS
; Copyright (c) 2009, Mario79 ; Copyright (c) 2009, Marat Zakiyanov aka Mario79, aka Mario
; All rights reserved. ; All rights reserved.
; ;
; Redistribution and use in source and binary forms, with or without ; Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
; 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 Marat Zakiyanov ''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
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY ; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
@@ -294,7 +294,6 @@ scroll_bar_vertical:
.draw: .draw:
pusha pusha
mov edi,dword [esp+36] mov edi,dword [esp+36]
; mov sb_all_redraw,dword 1
mov sb_delta,word 0 mov sb_delta,word 0
call .draw_1 call .draw_1
mov sb_all_redraw,dword 0 mov sb_all_redraw,dword 0
@@ -309,7 +308,7 @@ scroll_bar_exit
sub eax,edx sub eax,edx
mov sb_work_size,eax mov sb_work_size,eax
;********************************* ;*********************************
mov eax,sb_work_size ;sb_max_area mov eax,sb_work_size
mov ebx,sb_max_area mov ebx,sb_max_area
cmp ebx,sb_cur_area cmp ebx,sb_cur_area
ja @f ja @f
@@ -494,7 +493,7 @@ draw_down_arrow_vertical
pop ecx pop ecx
ror ecx,16 ror ecx,16
add ecx,sb_btn_high ;14 shl 16 add ecx,sb_btn_high
rol ecx,16 rol ecx,16
mov edx,sb_line_col mov edx,sb_line_col
@@ -536,7 +535,7 @@ draw_down_arrow_vertical
@@: @@:
cmp sb_m_keys,dword 0 cmp sb_m_keys,dword 0
jne @f ;.continue_2 jne @f
mov eax,sb_m_pos mov eax,sb_m_pos
mov sb_m_pos_2,eax mov sb_m_pos_2,eax
jmp .correct_1 ;.exit_sb jmp .correct_1 ;.exit_sb
@@ -607,7 +606,7 @@ draw_down_arrow_vertical
push eax push eax
mov ax,sb_m_pos mov ax,sb_m_pos
cmp ax,sb_m_pos_2 cmp ax,sb_m_pos_2
je .correct ;.exit_sb je .correct
shl eax,16 shl eax,16
shr eax,16 shr eax,16
@@ -675,10 +674,8 @@ draw_down_arrow_vertical
mov eax,sb_ar_offset mov eax,sb_ar_offset
cmp sb_position,eax ;dword 0 cmp sb_position,eax ;dword 0
; je .exit_sb
jbe @f jbe @f
; dec dword sb_position
sub sb_position,eax sub sb_position,eax
jmp .all_sb jmp .all_sb
@@: @@:
@@ -699,7 +696,6 @@ draw_down_arrow_vertical
@@: @@:
mov ebx,sb_btn_high ;16 ;15 mov ebx,sb_btn_high ;16 ;15
; inc ebx
add bx,sb_start_y add bx,sb_start_y
sub cx,bx sub cx,bx
sub ax,bx sub ax,bx
@@ -712,7 +708,6 @@ draw_down_arrow_vertical
@@: @@:
mov edx,eax mov edx,eax
; sub edx,sb_btn_high
push ebx push ebx
shr ebx,1 shr ebx,1
sub edx,ebx sub edx,ebx
@@ -734,8 +729,7 @@ draw_down_arrow_vertical
jbe .continue jbe .continue
mov sb_position2,edx mov sb_position2,edx
; jmp .continue_1
.continue: .continue:
mov eax,sb_position2 mov eax,sb_position2
sub ecx,ebx sub ecx,ebx
@@ -750,7 +744,7 @@ draw_down_arrow_vertical
xor eax,eax xor eax,eax
inc eax inc eax
mov sb_position2,eax mov sb_position2,eax
jmp .all_sb ;.store_position jmp .all_sb
@@: @@:
sub eax,sb_cur_area sub eax,sb_cur_area
inc eax inc eax
@@ -796,10 +790,8 @@ draw_down_arrow_vertical
sub eax,ebx sub eax,ebx
cmp sb_position,eax cmp sb_position,eax
pop eax pop eax
; jae .exit_sb
jae @f jae @f
; inc dword sb_position
add sb_position,ebx add sb_position,ebx
jmp .all_sb jmp .all_sb
@@: @@:
@@ -826,7 +818,6 @@ scroll_bar_horizontal:
.draw: .draw:
pusha pusha
mov edi,dword [esp+36] mov edi,dword [esp+36]
; mov sb_all_redraw,dword 1
mov sb_delta,word 0 mov sb_delta,word 0
call .draw_1 call .draw_1
mov sb_all_redraw,dword 0 mov sb_all_redraw,dword 0
@@ -1066,7 +1057,7 @@ draw_down_arrow_horizontal
@@: @@:
cmp sb_m_keys,dword 0 cmp sb_m_keys,dword 0
jne @f ;.continue_2 jne @f
mov eax,sb_m_pos mov eax,sb_m_pos
mov sb_m_pos_2,eax mov sb_m_pos_2,eax
jmp .correct_1 ;.exit_sb jmp .correct_1 ;.exit_sb
@@ -1140,7 +1131,7 @@ draw_down_arrow_horizontal
shr eax,16 shr eax,16
shr ebx,16 shr ebx,16
cmp eax,ebx cmp eax,ebx
je .correct ;.exit_sb je .correct
; shl eax,16 ; shl eax,16
; shr eax,16 ; shr eax,16
@@ -1208,10 +1199,8 @@ draw_down_arrow_horizontal
mov eax,sb_ar_offset mov eax,sb_ar_offset
cmp sb_position,eax ;dword 0 cmp sb_position,eax ;dword 0
; je .exit_sb
jbe @f jbe @f
; dec dword sb_position
sub sb_position,eax sub sb_position,eax
jmp .all_sb jmp .all_sb
@@: @@:
@@ -1232,7 +1221,6 @@ draw_down_arrow_horizontal
@@: @@:
mov ebx,sb_btn_high ;16 ;15 mov ebx,sb_btn_high ;16 ;15
; inc ebx
add bx,sb_start_x ;y add bx,sb_start_x ;y
sub cx,bx sub cx,bx
sub ax,bx sub ax,bx
@@ -1245,7 +1233,7 @@ draw_down_arrow_horizontal
@@: @@:
mov edx,eax mov edx,eax
; sub edx,sb_btn_high
push ebx push ebx
shr ebx,1 shr ebx,1
sub edx,ebx sub edx,ebx
@@ -1267,8 +1255,7 @@ draw_down_arrow_horizontal
jbe .continue jbe .continue
mov sb_position2,edx mov sb_position2,edx
; jmp .continue_1
.continue: .continue:
mov eax,sb_position2 mov eax,sb_position2
sub ecx,ebx sub ecx,ebx
@@ -1283,7 +1270,7 @@ draw_down_arrow_horizontal
xor eax,eax xor eax,eax
inc eax inc eax
mov sb_position2,eax mov sb_position2,eax
jmp .all_sb ;.store_position jmp .all_sb
@@: @@:
sub eax,sb_cur_area sub eax,sb_cur_area
inc eax inc eax
@@ -1329,10 +1316,8 @@ draw_down_arrow_horizontal
sub eax,ebx sub eax,ebx
cmp sb_position,eax cmp sb_position,eax
pop eax pop eax
; jae .exit_sb
jae @f jae @f
; inc dword sb_position
add sb_position,ebx add sb_position,ebx
jmp .all_sb jmp .all_sb
@@: @@: