ColorDialog - scrollbar from box_lib, for correction selected color

git-svn-id: svn://kolibrios.org@3469 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Marat Zakiyanov (Mario79) 2013-04-14 15:48:43 +00:00
parent b29c5d9e53
commit db28a61d3b
3 changed files with 330 additions and 10 deletions

View File

@ -69,11 +69,14 @@
dd I_END dd I_END
dd stacktop dd stacktop
dd param dd param
dd 0x0 dd path
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
include '../../macros.inc' include '../../macros.inc'
include '../../develop/libraries/box_lib/load_lib.mac'
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
;include 'lang.inc' ;include 'lang.inc'
;include 'debug.inc' ;include '../../debug.inc'
@use_library
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
p_start_x = 10 p_start_x = 10
p_start_y = 10 p_start_y = 10
@ -103,10 +106,15 @@ START:
mcall 68,11 mcall 68,11
mcall 66,1,1 mcall 66,1,1
mcall 40,0x27 mcall 40,0x27
; mcall 40,0x7
call get_communication_area call get_communication_area
call get_active_pocess call get_active_pocess
load_libraries l_libs_start,end_l_libs
test eax,eax
jnz button.exit_2
xor eax,eax xor eax,eax
mov al,p_size_x mov al,p_size_x
mov [palette_SIZE_X],eax mov [palette_SIZE_X],eax
@ -117,6 +125,7 @@ START:
mov eax,0xff0000 mov eax,0xff0000
mov [tone_color],eax mov [tone_color],eax
mov [selected_color],eax mov [selected_color],eax
call prepare_scrollbars_position_from_color
;-------------------------------------- ;--------------------------------------
mov ecx,[palette_SIZE_Y] mov ecx,[palette_SIZE_Y]
imul ecx,[palette_SIZE_X] imul ecx,[palette_SIZE_X]
@ -151,7 +160,12 @@ still:
je key je key
cmp eax,3 cmp eax,3
jne still je button
cmp eax,6
je mouse
jmp still
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
align 4 align 4
button: button:
@ -195,7 +209,7 @@ button:
shl eax,16 shl eax,16
add eax,[ecx+46] add eax,[ecx+46]
mov [ebx+8],eax mov [ebx+8],eax
.exit_2:
mcall -1 mcall -1
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
get_window_param: get_window_param:
@ -222,12 +236,14 @@ get_communication_area:
; mov [color_dialog_type],ebx ; mov [color_dialog_type],ebx
mov ebx,[eax+4] mov ebx,[eax+4]
cmp bx,word x_minimal_size ;300 ; cmp bx,word x_minimal_size ;300
jb @f ; jb @f
mov bx,420
mov [window_x],ebx mov [window_x],ebx
mov ebx,[eax+8] mov ebx,[eax+8]
cmp bx,word y_minimal_size ;200 ; cmp bx,word y_minimal_size ;200
jb @f ; jb @f
mov bx,320
mov [window_y],ebx mov [window_y],ebx
@@: @@:
ret ret
@ -256,8 +272,10 @@ palette_button:
mov eax,[eax] mov eax,[eax]
mov [tone_color],eax mov [tone_color],eax
mov [selected_color],eax mov [selected_color],eax
call prepare_scrollbars_position_from_color
call create_and_draw_tone call create_and_draw_tone
call draw_selected_color call draw_selected_color
call draw_scrollbars
jmp still jmp still
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
align 4 align 4
@ -274,7 +292,9 @@ tone_button:
add eax,[tone_area] add eax,[tone_area]
mov eax,[eax] mov eax,[eax]
mov [selected_color],eax mov [selected_color],eax
call prepare_scrollbars_position_from_color
call draw_selected_color call draw_selected_color
call draw_scrollbars
jmp still jmp still
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
align 4 align 4
@ -288,14 +308,82 @@ color_button:
jmp button.exit_1 jmp button.exit_1
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
align 4 align 4
prepare_scrollbars_position_from_color:
; in: eax = selected color
movzx ebx,al
mov [scroll_bar_data_blue.position],ebx
shr eax,8
mov bl,al
mov [scroll_bar_data_green.position],ebx
shr eax,8
mov bl,al
mov [scroll_bar_data_red.position],ebx
ret
;---------------------------------------------------------------------
align 4
prepare_color_from_scrollbars_position:
; out: ebx = selected color
mov eax,[scroll_bar_data_red.position]
movzx ebx,al
shl ebx,8
mov eax,[scroll_bar_data_green.position]
mov bl,al
shl ebx,8
mov eax,[scroll_bar_data_blue.position]
mov bl,al
ret
;---------------------------------------------------------------------
align 4
key: key:
mcall 2 mcall 2
jmp still jmp still
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
align 4 align 4
mouse:
cmp [scroll_bar_data_red.delta2],0
jne .red
cmp [scroll_bar_data_green.delta2],0
jne .green
cmp [scroll_bar_data_blue.delta2],0
jne .blue
;--------------------------------------
align 4
.red:
push dword scroll_bar_data_red
call [scrollbar_ver_mouse]
cmp [scroll_bar_data_red.delta2],0
jne @f
;--------------------------------------
align 4
.green:
push dword scroll_bar_data_green
call [scrollbar_ver_mouse]
cmp [scroll_bar_data_green.delta2],0
jne @f
;--------------------------------------
align 4
.blue:
push dword scroll_bar_data_blue
call [scrollbar_ver_mouse]
; cmp [scroll_bar_data_blue.delta2],0
; jne @f
;--------------------------------------
align 4
@@:
call prepare_color_from_scrollbars_position
cmp [selected_color],ebx
je still
mov [selected_color],ebx
call draw_selected_color
jmp still
;---------------------------------------------------------------------
align 4
draw_selected_color: draw_selected_color:
mcall 13,<c_start_x,c_size_x>,<c_start_y,c_size_y>,[selected_color] mcall 13,<c_start_x,c_size_x>,<c_start_y,c_size_y>,[selected_color]
mcall 8,<c_start_x,c_size_x>,<c_start_y,c_size_y>,0x60000004 mcall 13,<c_start_x+c_size_x+10,c_size_x>,<c_start_y,c_size_y>,0xffffff
mov ecx,[selected_color]
and ecx,0xffffff
mcall 47,0x00060100,,<c_start_x+c_size_x+13,c_start_y+(c_size_y-6)/2>,0
ret ret
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
align 4 align 4
@ -309,16 +397,34 @@ draw_tone:
mcall 65,[tone_area],<[tone_SIZE_X],[tone_SIZE_Y]>,<t_start_x,t_start_y>,24 mcall 65,[tone_area],<[tone_SIZE_X],[tone_SIZE_Y]>,<t_start_x,t_start_y>,24
ret ret
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
draw_scrollbars:
push dword scroll_bar_data_red
call [scrollbar_ver_draw]
push dword scroll_bar_data_green
call [scrollbar_ver_draw]
push dword scroll_bar_data_blue
call [scrollbar_ver_draw]
ret
;---------------------------------------------------------------------
align 4 align 4
draw_window: draw_window:
mcall 12,1 mcall 12,1
; mcall 0, <w_start_x,w_size_x>, <w_start_y,w_size_y>, 0x33AABBCC,,title ; mcall 0, <w_start_x,w_size_x>, <w_start_y,w_size_y>, 0x33AABBCC,,title
mcall 0,[window_x],[window_y], 0x33AABBCC,,title xor esi,esi
mcall 0,[window_x],[window_y], 0x34AABBCC,,title
mcall 8,<p_start_x,[palette_SIZE_X]>,<p_start_y,[palette_SIZE_Y]>,0x60000002 mcall 8,<p_start_x,[palette_SIZE_X]>,<p_start_y,[palette_SIZE_Y]>,0x60000002
mcall ,<t_start_x,[tone_SIZE_X]>,<t_start_y,[tone_SIZE_Y]>,0x60000003 mcall ,<t_start_x,[tone_SIZE_X]>,<t_start_y,[tone_SIZE_Y]>,0x60000003
mcall ,<c_start_x,c_size_x>,<c_start_y,c_size_y>,0x60000004
xor ebp,ebp
mcall 65,[palette_area],<[palette_SIZE_X],[palette_SIZE_Y]>,<p_start_x,p_start_y>,24 mcall 65,[palette_area],<[palette_SIZE_X],[palette_SIZE_Y]>,<p_start_x,p_start_y>,24
call draw_tone call draw_tone
call draw_selected_color call draw_selected_color
xor eax,eax
inc eax
mov [scroll_bar_data_red.all_redraw],eax
mov [scroll_bar_data_green.all_redraw],eax
mov [scroll_bar_data_blue.all_redraw],eax
call draw_scrollbars
mcall 12,2 mcall 12,2
ret ret
;--------------------------------------------------------------------- ;---------------------------------------------------------------------

View File

@ -10,3 +10,209 @@ window_y:
.y_size dw 320 .y_size dw 320
.y_start dw 10 .y_start dw 10
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
;plugins_directory db 'plugins/',0
plugins_directory db 0
system_dir_Boxlib db '/sys/lib/box_lib.obj',0
ihead_f_i:
ihead_f_l db 'System error',0
er_message_found_lib db 'box_lib.obj - Not found!',0
er_message_import db 'box_lib.obj - Wrong import!',0
align 4
l_libs_start:
library01 l_libs system_dir_Boxlib+9,path,file_name,system_dir_Boxlib,\
er_message_found_lib,ihead_f_l,Box_lib_import,er_message_import,ihead_f_i,plugins_directory
end_l_libs:
;---------------------------------------------------------------------
;---------------------------------------------------------------------
align 4
Box_lib_import:
;init_lib dd a_init
;version_lib dd a_version
;edit_box_draw dd aEdit_box_draw
;edit_box_key dd aEdit_box_key
;edit_box_mouse dd aEdit_box_mouse
;version_ed dd aVersion_ed
;check_box_draw dd aCheck_box_draw
;check_box_mouse dd aCheck_box_mouse
;version_ch dd aVersion_ch
;option_box_draw dd aOption_box_draw
;option_box_mouse dd aOption_box_mouse
;version_op dd aVersion_op
scrollbar_ver_draw dd aScrollbar_ver_draw
scrollbar_ver_mouse dd aScrollbar_ver_mouse
;scrollbar_hor_draw dd aScrollbar_hor_draw
;scrollbar_hor_mouse dd aScrollbar_hor_mouse
;version_scrollbar dd aVersion_scrollbar
;dinamic_button_draw dd aDbutton_draw
;dinamic_button_mouse dd aDbutton_mouse
;version_dbutton dd aVersion_dbutton
;menu_bar_draw dd aMenu_bar_draw
;menu_bar_mouse dd aMenu_bar_mouse
;menu_bar_activate dd aMenu_bar_activate
;version_menu_bar dd aVersion_menu_bar
;FileBrowser_draw dd aFileBrowser_draw
;FileBrowser_mouse dd aFileBrowser_mouse
;FileBrowser_key dd aFileBrowser_key
;Version_FileBrowser dd aVersion_FileBrowser
;PathShow_prepare dd sz_PathShow_prepare
;PathShow_draw dd sz_PathShow_draw
;Version_path_show dd szVersion_path_show
dd 0
dd 0
;a_init db 'lib_init',0
;a_version db 'version',0
;aEdit_box_draw db 'edit_box',0
;aEdit_box_key db 'edit_box_key',0
;aEdit_box_mouse db 'edit_box_mouse',0
;aVersion_ed db 'version_ed',0
;aCheck_box_draw db 'check_box_draw',0
;aCheck_box_mouse db 'check_box_mouse',0
;aVersion_ch db 'version_ch',0
;aOption_box_draw db 'option_box_draw',0
;aOption_box_mouse db 'option_box_mouse',0
;aVersion_op db 'version_op',0
aScrollbar_ver_draw db 'scrollbar_v_draw',0
aScrollbar_ver_mouse db 'scrollbar_v_mouse',0
;aScrollbar_hor_draw db 'scrollbar_h_draw',0
;aScrollbar_hor_mouse db 'scrollbar_h_mouse',0
;aVersion_scrollbar db 'version_scrollbar',0
;aDbutton_draw db 'dbutton_draw',0
;aDbutton_mouse db 'dbutton_mouse',0
;aVersion_dbutton db 'version_dbutton',0
;aMenu_bar_draw db 'menu_bar_draw',0
;aMenu_bar_mouse db 'menu_bar_mouse',0
;aMenu_bar_activate db 'menu_bar_activate',0
;aVersion_menu_bar db 'version_menu_bar',0
;aFileBrowser_draw db 'FileBrowser_draw',0
;aFileBrowser_mouse db 'FileBrowser_mouse',0
;aFileBrowser_key db 'FileBrowser_key',0
;aVersion_FileBrowser db 'version_FileBrowser',0
;sz_PathShow_prepare db 'PathShow_prepare',0
;sz_PathShow_draw db 'PathShow_draw',0
;szVersion_path_show db 'version_PathShow',0
;---------------------------------------------------------------------
align 4
scroll_bar_data_red:
.x:
.size_x dw 15 ;+0
.start_x dw t_start_x + p_size_y + 20
.y:
.size_y dw p_size_y + p_start_y - (c_start_y + c_size_y + 10)
.start_y dw c_start_y + c_size_y + 10
.btn_high dd 15 ;+8
.type dd 2 ;+12
.max_area dd 255 ;+16
.cur_area dd 0 ;+20
.position dd 128 ;+24
.bckg_col dd 0xFFDBDB ;+28
.frnt_col dd 0xFF7777 ;0xbbddff ;+32
.line_col dd 0 ;+36
.redraw dd 0 ;+40
.delta dw 0 ;+44
.delta2 dw 0 ;+46
.run_x:
.r_size_x dw 0 ;+48
.r_start_x dw 0 ;+50
.run_y:
.r_size_y dw 0 ;+52
.r_start_y dw 0 ;+54
.m_pos dd 0 ;+56
.m_pos_2 dd 0 ;+60
.m_keys dd 0 ;+64
.run_size dd 0 ;+68
.position2 dd 0 ;+72
.work_size dd 0 ;+76
.all_redraw dd 1 ;+80
.ar_offset dd 10 ;+84
;---------------------------------------------------------------------
align 4
scroll_bar_data_green:
.x:
.size_x dw 15 ;+0
.start_x dw t_start_x + p_size_y + 45
.y:
.size_y dw p_size_y + p_start_y - (c_start_y + c_size_y + 10)
.start_y dw c_start_y + c_size_y + 10
.btn_high dd 15 ;+8
.type dd 2 ;+12
.max_area dd 255 ;+16
.cur_area dd 0 ;+20
.position dd 128 ;+24
.bckg_col dd 0xDBFFDB ;+28
.frnt_col dd 0x77FF77 ;0xbbddff ;+32
.line_col dd 0 ;+36
.redraw dd 0 ;+40
.delta dw 0 ;+44
.delta2 dw 0 ;+46
.run_x:
.r_size_x dw 0 ;+48
.r_start_x dw 0 ;+50
.run_y:
.r_size_y dw 0 ;+52
.r_start_y dw 0 ;+54
.m_pos dd 0 ;+56
.m_pos_2 dd 0 ;+60
.m_keys dd 0 ;+64
.run_size dd 0 ;+68
.position2 dd 0 ;+72
.work_size dd 0 ;+76
.all_redraw dd 1 ;+80
.ar_offset dd 10 ;+84
;---------------------------------------------------------------------
align 4
scroll_bar_data_blue:
.x:
.size_x dw 15 ;+0
.start_x dw t_start_x + p_size_y + 70
.y:
.size_y dw p_size_y + p_start_y - (c_start_y + c_size_y + 10)
.start_y dw c_start_y + c_size_y + 10
.btn_high dd 15 ;+8
.type dd 2 ;+12
.max_area dd 255 ;+16
.cur_area dd 0 ;+20
.position dd 128 ;+24
.bckg_col dd 0xDBDBFF ;+28
.frnt_col dd 0x7777FF ;0xbbddff ;+32
.line_col dd 0 ;+36
.redraw dd 0 ;+40
.delta dw 0 ;+44
.delta2 dw 0 ;+46
.run_x:
.r_size_x dw 0 ;+48
.r_start_x dw 0 ;+50
.run_y:
.r_size_y dw 0 ;+52
.r_start_y dw 0 ;+54
.m_pos dd 0 ;+56
.m_pos_2 dd 0 ;+60
.m_keys dd 0 ;+64
.run_size dd 0 ;+68
.position2 dd 0 ;+72
.work_size dd 0 ;+76
.all_redraw dd 1 ;+80
.ar_offset dd 10 ;+84
;---------------------------------------------------------------------

View File

@ -43,6 +43,14 @@ align 4
param: param:
rb 256 rb 256
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
align 4
path:
rb 4096
;---------------------------------------------------------------------
align 4
file_name:
rb 4096
;---------------------------------------------------------------------
align 4 align 4
rb 4096 rb 4096
stacktop: stacktop: