From c6044e1fc16fb5cc23482c200236c72fbeea77cb Mon Sep 17 00:00:00 2001 From: "Marat Zakiyanov (Mario79)" Date: Mon, 2 Apr 2012 22:46:20 +0000 Subject: [PATCH] ICON: 1) Drawing selection rectangle. 2) Using new kernel function: 15.9 git-svn-id: svn://kolibrios.org@2548 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/system/icon/trunk/dat_area.inc | 5 +- programs/system/icon/trunk/icon.asm | 23 +++--- programs/system/icon/trunk/mouse.inc | 103 +++++++++++++++++++++++- 3 files changed, 117 insertions(+), 14 deletions(-) diff --git a/programs/system/icon/trunk/dat_area.inc b/programs/system/icon/trunk/dat_area.inc index bec80a508d..f8f1d3d14e 100644 --- a/programs/system/icon/trunk/dat_area.inc +++ b/programs/system/icon/trunk/dat_area.inc @@ -26,6 +26,7 @@ current_X_mouse_thread: rd 1 current_Y_mouse_thread: rd 1 draw_area: rd 1 +draw_area_2: rd 1 x_left: rd 1 x_right: rd 1 @@ -36,7 +37,9 @@ curx1 rd 1 cury1 rd 1 curx2 rd 1 cury2 rd 1 - +curx_restore rd 1 +cury_restore rd 1 + click_pos rd 1 ;------------------------------------------------------------------------------ align 4 diff --git a/programs/system/icon/trunk/icon.asm b/programs/system/icon/trunk/icon.asm index af4b0ea783..2ce909f73e 100644 --- a/programs/system/icon/trunk/icon.asm +++ b/programs/system/icon/trunk/icon.asm @@ -5,6 +5,12 @@ ;* Compile with flat assembler * ;* * ;******************************** +; version: 3.10 +; last update: 03/04/2012 +; changed by: Marat Zakiyanov aka Mario79, aka Mario +; changes: Drawing selection rectangle. +; Using new kernel function: 15.9 +;--------------------------------------------------------------------- ; version: 3.01 ; last update: 02/04/2012 ; changed by: Marat Zakiyanov aka Mario79, aka Mario @@ -14,9 +20,9 @@ ; version: 3.00 ; last update: 02/04/2012 ; changed by: Marat Zakiyanov aka Mario79, aka Mario -; changes: Program used only 2 threads: draw and mouse -; Used new kernel functions: 25, 34, 15.8, 4 (redirect). -; Used PNG icons with transparent. +; changes: Program use only 2 threads: draw and mouse +; Using new kernel functions: 25, 34, 15.8, 4 (redirect). +; Using PNG icons with transparent. ;--------------------------------------------------------------------- ; version: 2.11 ; last update: 19/03/2012 @@ -53,7 +59,7 @@ ICON_SIZE equ 32*32*4 REC_SIZE equ 80 ICONS_DAT equ '/sys/icons.dat' -ICON_APP equ '/sys/icon' +ICON_APP equ '/sys/ICON' ICON_STRIP equ '/rd/1/iconstrp.png' ;------------------------------------------------------------------------------ use32 @@ -70,7 +76,6 @@ ICON_STRIP equ '/rd/1/iconstrp.png' include 'lang.inc' include '../../../macros.inc' include '../../../develop/libraries/box_lib/load_lib.mac' -COLOR_ORDER equ MENUETOS ;include 'debug.inc' ;------------------------------------------------------------------------------ @use_library ;use load lib macros @@ -900,7 +905,7 @@ draw_picture: ;-------------------------------------- align 4 @@: - mov edi,[adress_of_icon_data] ;[ebp+8] + mov edi,[adress_of_icon_data] lea esi,[edi+12] call ASCII_to_icon_number ; protect for icon area RAW size limit @@ -941,9 +946,9 @@ align 4 call draw_text - mov edx,[current_X] ;[ebp+0] + mov edx,[current_X] shl edx,16 - add edx,[current_Y] ;[ebp+4] + add edx,[current_Y] mov ebx,[draw_area] add ebx,8 mcall 25,,<52,52> @@ -952,7 +957,7 @@ align 4 ;------------------------------------------------------------------------------ align 4 draw_text: - mov esi,[adress_of_icon_data] ;[ebp+8] + mov esi,[adress_of_icon_data] add esi,3 push edi mov edi,title diff --git a/programs/system/icon/trunk/mouse.inc b/programs/system/icon/trunk/mouse.inc index 1f24b95c73..39cb5ddda4 100644 --- a/programs/system/icon/trunk/mouse.inc +++ b/programs/system/icon/trunk/mouse.inc @@ -25,6 +25,19 @@ mouse: mcall 34,[curx1],[cury1] cmp al,1 ; 1 - ядро jne still_mouse + +; check for icon by click down + call check_icons_position + mov eax,[click_pos] + test eax,eax + jz still_mouse + + mov eax,[current_X_mouse_thread] + mov [curx_restore],eax + mov eax,[current_Y_mouse_thread] + mov [cury_restore],eax + + call draw_select ;-------------------------------------- align 4 @@: ; подождём, пока пользователь не отпустил правую кнопку мыши @@ -50,7 +63,12 @@ align 4 ; кому принадлежит точка? mcall 34,[curx2],[cury2] cmp al,1 ; 1 - ядро - jne still_mouse + je @f + call restore_background + jmp still_mouse +;-------------------------------------- +align 4 +@@: ; check for icon by click down call check_icons_position mov eax,[click_pos] @@ -66,6 +84,8 @@ align 4 call check_icons_position pop eax + call restore_background + mov ebx,[click_pos] test ebx,ebx @@ -74,9 +94,8 @@ align 4 cmp eax,ebx jne still_mouse ;-------------------------------------- -align 4 -start_appl: - mov esi,[adress_of_icon_data_2] ;[ebp+8] +;start_appl: + mov esi,[adress_of_icon_data_2] mov ebx,1 mov edi,finfo.path call fill_paths @@ -172,3 +191,79 @@ align 4 mov [click_pos],eax ret ;------------------------------------------------------------------------------ +align 4 +draw_select: + mcall 68,12,52*52*4+8 + mov [draw_area_2],eax + mov ebx,52 + mov [eax],ebx + mov [eax+4],ebx +;-------------------------------------- +; draw black square + mov eax,-1 + mov edi,[draw_area_2] + add edi,8 + cld + mov ecx,52*52 + rep stosd +;-------------------------------------- +; draw white square + mov eax,0xff000000 + mov edi,[draw_area_2] + add edi,8+(4*1)+(52*4*1) + mov ebx,50 + cld +;-------------------------------------- +align 4 +@@: + mov ecx,50 + rep stosd + + add edi,2*4 + dec ebx + jnz @b +;-------------------------------------- +; draw black square + xor eax,eax + mov edi,[draw_area_2] + add edi,8+(4*2)+(52*4*2) + mov ebx,48 + cld +;-------------------------------------- +align 4 +@@: + mov ecx,48 + rep stosd + + add edi,4*4 + dec ebx + jnz @b +;-------------------------------------- + mov edx,[current_X_mouse_thread] + shl edx,16 + add edx,[current_Y_mouse_thread] + mov ebx,[draw_area_2] + add ebx,8 + mcall 25,,<52,52> + mcall 68,13,[draw_area_2] + ret +;------------------------------------------------------------------------------ +align 4 +restore_background: + pusha + mov eax,[curx_restore] + mov ecx,eax + shl ecx,16 + add ecx,eax + add ecx,52 + + mov eax,[cury_restore] + mov edx,eax + shl edx,16 + add edx,eax + add edx,52 + + mcall 15,9 + popa + ret +;------------------------------------------------------------------------------ \ No newline at end of file