1) Drawing selection rectangle.
2) Using new kernel function: 15.9

git-svn-id: svn://kolibrios.org@2548 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Marat Zakiyanov (Mario79) 2012-04-02 22:46:20 +00:00
parent 60bd1cf7b6
commit c6044e1fc1
3 changed files with 117 additions and 14 deletions

View File

@ -26,6 +26,7 @@ current_X_mouse_thread: rd 1
current_Y_mouse_thread: rd 1 current_Y_mouse_thread: rd 1
draw_area: rd 1 draw_area: rd 1
draw_area_2: rd 1
x_left: rd 1 x_left: rd 1
x_right: rd 1 x_right: rd 1
@ -36,6 +37,8 @@ curx1 rd 1
cury1 rd 1 cury1 rd 1
curx2 rd 1 curx2 rd 1
cury2 rd 1 cury2 rd 1
curx_restore rd 1
cury_restore rd 1
click_pos rd 1 click_pos rd 1
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------

View File

@ -5,6 +5,12 @@
;* Compile with flat assembler * ;* 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 ; version: 3.01
; last update: 02/04/2012 ; last update: 02/04/2012
; changed by: Marat Zakiyanov aka Mario79, aka Mario ; changed by: Marat Zakiyanov aka Mario79, aka Mario
@ -14,9 +20,9 @@
; version: 3.00 ; version: 3.00
; last update: 02/04/2012 ; last update: 02/04/2012
; changed by: Marat Zakiyanov aka Mario79, aka Mario ; changed by: Marat Zakiyanov aka Mario79, aka Mario
; changes: Program used only 2 threads: draw and mouse ; changes: Program use only 2 threads: draw and mouse
; Used new kernel functions: 25, 34, 15.8, 4 (redirect). ; Using new kernel functions: 25, 34, 15.8, 4 (redirect).
; Used PNG icons with transparent. ; Using PNG icons with transparent.
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
; version: 2.11 ; version: 2.11
; last update: 19/03/2012 ; last update: 19/03/2012
@ -53,7 +59,7 @@
ICON_SIZE equ 32*32*4 ICON_SIZE equ 32*32*4
REC_SIZE equ 80 REC_SIZE equ 80
ICONS_DAT equ '/sys/icons.dat' ICONS_DAT equ '/sys/icons.dat'
ICON_APP equ '/sys/icon' ICON_APP equ '/sys/ICON'
ICON_STRIP equ '/rd/1/iconstrp.png' ICON_STRIP equ '/rd/1/iconstrp.png'
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
use32 use32
@ -70,7 +76,6 @@ ICON_STRIP equ '/rd/1/iconstrp.png'
include 'lang.inc' include 'lang.inc'
include '../../../macros.inc' include '../../../macros.inc'
include '../../../develop/libraries/box_lib/load_lib.mac' include '../../../develop/libraries/box_lib/load_lib.mac'
COLOR_ORDER equ MENUETOS
;include 'debug.inc' ;include 'debug.inc'
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@use_library ;use load lib macros @use_library ;use load lib macros
@ -900,7 +905,7 @@ draw_picture:
;-------------------------------------- ;--------------------------------------
align 4 align 4
@@: @@:
mov edi,[adress_of_icon_data] ;[ebp+8] mov edi,[adress_of_icon_data]
lea esi,[edi+12] lea esi,[edi+12]
call ASCII_to_icon_number call ASCII_to_icon_number
; protect for icon area RAW size limit ; protect for icon area RAW size limit
@ -941,9 +946,9 @@ align 4
call draw_text call draw_text
mov edx,[current_X] ;[ebp+0] mov edx,[current_X]
shl edx,16 shl edx,16
add edx,[current_Y] ;[ebp+4] add edx,[current_Y]
mov ebx,[draw_area] mov ebx,[draw_area]
add ebx,8 add ebx,8
mcall 25,,<52,52> mcall 25,,<52,52>
@ -952,7 +957,7 @@ align 4
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
align 4 align 4
draw_text: draw_text:
mov esi,[adress_of_icon_data] ;[ebp+8] mov esi,[adress_of_icon_data]
add esi,3 add esi,3
push edi push edi
mov edi,title mov edi,title

View File

@ -25,6 +25,19 @@ mouse:
mcall 34,[curx1],[cury1] mcall 34,[curx1],[cury1]
cmp al,1 ; 1 - ÿäðî cmp al,1 ; 1 - ÿäðî
jne still_mouse 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 align 4
@@: ; ïîäîæä¸ì, ïîêà ïîëüçîâàòåëü íå îòïóñòèë ïðàâóþ êíîïêó ìûøè @@: ; ïîäîæä¸ì, ïîêà ïîëüçîâàòåëü íå îòïóñòèë ïðàâóþ êíîïêó ìûøè
@ -50,7 +63,12 @@ align 4
; êîìó ïðèíàäëåæèò òî÷êà? ; êîìó ïðèíàäëåæèò òî÷êà?
mcall 34,[curx2],[cury2] mcall 34,[curx2],[cury2]
cmp al,1 ; 1 - ÿäðî cmp al,1 ; 1 - ÿäðî
jne still_mouse je @f
call restore_background
jmp still_mouse
;--------------------------------------
align 4
@@:
; check for icon by click down ; check for icon by click down
call check_icons_position call check_icons_position
mov eax,[click_pos] mov eax,[click_pos]
@ -66,6 +84,8 @@ align 4
call check_icons_position call check_icons_position
pop eax pop eax
call restore_background
mov ebx,[click_pos] mov ebx,[click_pos]
test ebx,ebx test ebx,ebx
@ -74,9 +94,8 @@ align 4
cmp eax,ebx cmp eax,ebx
jne still_mouse jne still_mouse
;-------------------------------------- ;--------------------------------------
align 4 ;start_appl:
start_appl: mov esi,[adress_of_icon_data_2]
mov esi,[adress_of_icon_data_2] ;[ebp+8]
mov ebx,1 mov ebx,1
mov edi,finfo.path mov edi,finfo.path
call fill_paths call fill_paths
@ -172,3 +191,79 @@ align 4
mov [click_pos],eax mov [click_pos],eax
ret 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
;------------------------------------------------------------------------------