From c50ad68d882cbe29f42ccaae77f0f7b94b7c238d Mon Sep 17 00:00:00 2001 From: "Marat Zakiyanov (Mario79)" Date: Tue, 16 Apr 2013 22:39:51 +0000 Subject: [PATCH] ColorDialog - history of selected colors. git-svn-id: svn://kolibrios.org@3473 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/system/colrdial/color_dialog.asm | 142 ++++++++++++++++++++-- programs/system/colrdial/i_data.inc | 27 +++- 2 files changed, 159 insertions(+), 10 deletions(-) diff --git a/programs/system/colrdial/color_dialog.asm b/programs/system/colrdial/color_dialog.asm index 12249df6ae..9fbbbe7015 100644 --- a/programs/system/colrdial/color_dialog.asm +++ b/programs/system/colrdial/color_dialog.asm @@ -58,6 +58,14 @@ ; ; Color value ; +20 ; dd 0 + +; First start flag ; +24 +; dd 0 ; 0 - first start, 1 - subsequent starts +; +; Old colors ; +28 +; rd 10 +; +; Free area ; +68 ;--------------------------------------------------------------------- use32 org 0x0 @@ -108,13 +116,13 @@ START: mcall 40,0x27 ; mcall 40,0x7 call get_communication_area - call get_active_pocess - + call clear_colors_history +;-------------------------------------- load_libraries l_libs_start,end_l_libs test eax,eax jnz button.exit_2 - +;-------------------------------------- xor eax,eax mov al,p_size_x mov [palette_SIZE_X],eax @@ -180,18 +188,45 @@ button: cmp ah, 4 je color_button + cmp ah, 30 + jb @f + + cmp ah, 39 + ja @f + + sub ah,30 + movzx eax,ah + shl eax,2 + add eax,[communication_area] + add eax,28 + mov eax,[eax] + mov [selected_color],eax + call prepare_scrollbars_position_from_color + call draw_selected_color + call draw_scrollbars + jmp still +;-------------------------------------- +align 4 +@@: cmp ah, 1 jne still - +;-------------------------------------- +align 4 .exit: mov eax,[communication_area] mov [eax],word 3 + jmp @f ; dps "CD flag value: cancel " - +;-------------------------------------- +align 4 .exit_1: - - mov ax,[eax] - and eax,0xffff +;-------------------------------------- + call scroll_colors_history +;-------------------------------------- +align 4 +@@: +; mov ax,[eax] +; and eax,0xffff ; dps "CD flag value: " ; dpd eax ; newline @@ -209,9 +244,12 @@ button: shl eax,16 add eax,[ecx+46] mov [ebx+8],eax +;-------------------------------------- +align 4 .exit_2: mcall -1 ;--------------------------------------------------------------------- +align 4 get_window_param: mcall 9,procinfo,-1 mov eax,[ebx+66] @@ -238,7 +276,7 @@ get_communication_area: mov ebx,[eax+4] ; cmp bx,word x_minimal_size ;300 ; jb @f - mov bx,420 + mov bx,450 mov [window_x],ebx mov ebx,[eax+8] ; cmp bx,word y_minimal_size ;200 @@ -262,6 +300,38 @@ get_active_pocess: ret ;--------------------------------------------------------------------- align 4 +clear_colors_history: + mov edi,[communication_area] + cmp [edi+24],dword 1 + je @f + mov [edi+24],dword 1 + add edi,28 + mov ecx,10 + cld + mov eax,0xffffff + rep stosd +@@: + ret +;--------------------------------------------------------------------- +align 4 +scroll_colors_history: + mov edi,[communication_area] + add edi,28 + mov eax,[selected_color] + cmp [edi],eax + je @f + mov ecx,9 + mov esi,edi + add esi,32 + add edi,36 + std + rep movsd + mov edi,[communication_area] + mov [edi+28],eax +@@: + ret +;--------------------------------------------------------------------- +align 4 palette_button: mcall 37,1 and eax,0xffff @@ -406,6 +476,58 @@ draw_scrollbars: call [scrollbar_ver_draw] ret ;--------------------------------------------------------------------- +draw_button_row: + mov edx,0x60000000 + 30 ; BUTTON ROW +; mov ebx,220*65536+14 + mov ebx,(c_start_x+c_size_x*2+10*3)*65536+14 + mov ecx,20*65536+14 + mov eax,8 +;----------------------------------- +.newb: + mcall + add ecx,25*65536 + inc edx + cmp edx,0x60000000 + 39 + jbe .newb + ret +;--------------------------------------------------------------------- +draw_colours: + mov edi,10 + mov esi,[communication_area] + add esi,28 +; mov ebx,220*65536+14 + mov ebx,(c_start_x+c_size_x*2+10*3)*65536+14 + mov ecx,20*65536+14 + mov eax,13 + mov [frame_data.draw_text_flag],dword 0 +;-------------------------------------- +newcol: + mov edx,[esi] + mcall + + push ebx ecx + + sub ebx,2 shl 16 + add bx,4 + sub ecx,2 shl 16 + add cx,4 + + mov [frame_data.x],ebx + mov [frame_data.y],ecx + + push dword frame_data + call [Frame_draw] + + pop ecx ebx + + add ecx,25*65536 + add esi,4 + + dec edi + jnz newcol + + ret +;---------------------------------------------------------------------- align 4 draw_window: mcall 12,1 @@ -425,6 +547,8 @@ draw_window: mov [scroll_bar_data_green.all_redraw],eax mov [scroll_bar_data_blue.all_redraw],eax call draw_scrollbars + call draw_button_row + call draw_colours mcall 12,2 ret ;--------------------------------------------------------------------- diff --git a/programs/system/colrdial/i_data.inc b/programs/system/colrdial/i_data.inc index 95de5e0501..e7644ac188 100644 --- a/programs/system/colrdial/i_data.inc +++ b/programs/system/colrdial/i_data.inc @@ -71,6 +71,10 @@ scrollbar_ver_mouse dd aScrollbar_ver_mouse ;PathShow_prepare dd sz_PathShow_prepare ;PathShow_draw dd sz_PathShow_draw ;Version_path_show dd szVersion_path_show + +Frame_draw dd sz_Frame_draw +;Version_frame dd szVersion_frame + dd 0 dd 0 @@ -113,6 +117,9 @@ aScrollbar_ver_mouse db 'scrollbar_v_mouse',0 ;sz_PathShow_prepare db 'PathShow_prepare',0 ;sz_PathShow_draw db 'PathShow_draw',0 ;szVersion_path_show db 'version_PathShow',0 + +sz_Frame_draw db 'frame_draw',0 +;szVersion_frame db 'version_frame',0 ;--------------------------------------------------------------------- align 4 scroll_bar_data_red: @@ -215,4 +222,22 @@ scroll_bar_data_blue: .work_size dd 0 ;+76 .all_redraw dd 1 ;+80 .ar_offset dd 10 ;+84 -;--------------------------------------------------------------------- \ No newline at end of file +;--------------------------------------------------------------------- +frame_data: +.type dd 0 ;+0 +.x: +.x_size dw 0 ;+4 +.x_start dw 0 ;+6 +.y: +.y_size dw 0 ;+8 +.y_start dw 0 ;+10 +.ext_fr_col dd 0x0 ;+12 +.int_fr_col dd 0xffffff ;+16 +.draw_text_flag dd 1 ;+20 +.text_pointer dd 0 ;+24 +.text_position dd 0 ;+28 +.font_number dd 0 ;+32 +.font_size_y dd 9 ;+36 +.font_color dd 0x0 ;+40 +.font_backgr_color dd 0xffffff ;+44 +;---------------------------------------------------------------------