forked from KolibriOS/kolibrios
BoxLib:
A new component PathShow - displaying the path for the files and directories. If the entire path to display in the show area is not possible, then the path is displayed in the compressed form. git-svn-id: svn://kolibrios.org@1433 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
79c0315dca
commit
47a917da42
@ -303,6 +303,10 @@ start_OpenDialog OpenDialog_data
|
||||
cmp [OpenDialog_data.status],1
|
||||
jne still ; OpenDialog user say cancel
|
||||
; copy path
|
||||
; prepare path - PathShow
|
||||
push dword PathShow_data_1
|
||||
call [PathShow_prepare]
|
||||
|
||||
call draw_window
|
||||
jmp still ; OpenDialog user selected the target file
|
||||
; [OpenDialog_data.openfile_pach] pointer of area the target file
|
||||
@ -344,9 +348,12 @@ draw_window:
|
||||
call [dinamic_button_draw]
|
||||
;---------------------------------------------
|
||||
mcall 13,<170,200>,<25,15>,0xffffb0
|
||||
mov bx,28
|
||||
add ebx,2 shl 16
|
||||
mcall 4,,0xC0000000,openfile_pach,,0xffffb0
|
||||
; mov bx,28
|
||||
; add ebx,2 shl 16
|
||||
; mcall 4,,0xC0000000,text_work_area,,0xffffb0
|
||||
; draw for PathShow
|
||||
push dword PathShow_data_1
|
||||
call [PathShow_draw]
|
||||
;---------------------------------------------
|
||||
; set all_redraw flag for draw all ScrollBar
|
||||
; In some cases it is necessity to draw only the area
|
||||
@ -408,6 +415,9 @@ library_path:
|
||||
plugin_pach:
|
||||
rb 4096
|
||||
;---------------------------------------------------------------------
|
||||
text_work_area:
|
||||
rb 4096
|
||||
;---------------------------------------------------------------------
|
||||
file_info:
|
||||
rb 40
|
||||
;---------------------------------------------------------------------
|
||||
|
@ -1,5 +1,5 @@
|
||||
;---------------------------------------------------------------------
|
||||
;--- ДАННЫЕ ПРОГРАММЫ ----------------------------------------------
|
||||
;--- data area -------------------------------------------------------
|
||||
;---------------------------------------------------------------------
|
||||
header_1 db 'Box_lib Control Demo by Mario79',0
|
||||
|
||||
@ -19,9 +19,10 @@ plugins_directory db 0
|
||||
system_dir_Boxlib db '/sys/lib/box_lib.obj',0
|
||||
system_dir_CnvPNG db '/sys/lib/cnv_png.obj',0
|
||||
system_dir_UNPACK db '/sys/lib/archiver.obj',0
|
||||
; Если есть желание разъединить, то нужно использовать следующию конструкцию
|
||||
; …᫨ ¥áâì ¦¥« ¨¥ à §ê¥¤¨¨âì, ⮠㦮 ¨á¯®«ì§®¢ âì á«¥¤ãîé¨î ª®áâàãªæ¨î
|
||||
;system_path db '/sys/lib/box_lib.obj',0
|
||||
;... любая последовательность других команд и определений.
|
||||
;... «î¡ ï ¯®á«¥¤®¢ ⥫ì®áâì ¤àã£¨å ª®¬ ¤ ¨ ®¯à¥¤¥«¥¨©.
|
||||
;library_name db 'box_lib.obj',0
|
||||
;library_name db 'box_lib.obj',0
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
ihead_f_i:
|
||||
@ -163,6 +164,10 @@ menu_bar_activate dd aMenu_bar_activate
|
||||
;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
|
||||
|
||||
dd 0
|
||||
dd 0
|
||||
|
||||
@ -201,6 +206,11 @@ aMenu_bar_activate db 'menu_bar_activate',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
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
@ -445,3 +455,17 @@ db 'KEX',0
|
||||
.end:
|
||||
db 0
|
||||
;---------------------------------------------------------------------
|
||||
PathShow_data_1:
|
||||
.type dd 0 ;+0
|
||||
.start_y dw 28 ;+4
|
||||
.start_x dw 172 ;+6
|
||||
.font_size_x dw 6 ;+8 ; 6 - for font 0, 8 - for font 1
|
||||
.area_size_x dw 200 ;+10
|
||||
.font_number dd 0 ;+12 ; 0 - monospace, 1 - variable
|
||||
.background_flag dd 0 ;+16
|
||||
.font_color dd 0x0 ;+20
|
||||
.background_color dd 0x0 ;+24
|
||||
.text_pointer dd openfile_pach ;+28
|
||||
.work_area_pointer dd text_work_area ;+32
|
||||
.temp_text_length dd 0 ;+36
|
||||
;---------------------------------------------------------------------
|
||||
|
@ -6,3 +6,4 @@ include 'd_button.mac' ;macro implements dinamic_button
|
||||
include 'menubar.mac' ;macro implements menubar
|
||||
include 'filebrowser.mac' ;macro implements filebrowser
|
||||
include 'tree_list.mac' ;macro implements tree_list, image_list, list_box
|
||||
include 'pathshow.mac' ;macro implements pathshow
|
@ -82,14 +82,13 @@ use_file_browser
|
||||
align 16
|
||||
use_tree_list
|
||||
|
||||
;;;;;;;;;;;
|
||||
;;Data
|
||||
;;;;;;;;;;;
|
||||
;align 16
|
||||
;mouse_flag dd 0x0
|
||||
|
||||
;--------------------------------------------------
|
||||
;align 16
|
||||
;PathShow Group
|
||||
;--------------------------------------------------
|
||||
align 16
|
||||
use_path_show
|
||||
|
||||
align 16
|
||||
init:
|
||||
ret
|
||||
|
||||
@ -162,6 +161,10 @@ EXPORTS:
|
||||
dd sz_tl_get_mem_size, tl_get_mem_size
|
||||
dd sz_tl_version_tree_list, 0x00000001
|
||||
|
||||
dd sz_PathShow_prepare, path_show.prepare
|
||||
dd sz_PathShow_draw, path_show.draw
|
||||
dd szVersion_path_show, 0x00010001
|
||||
|
||||
dd 0,0
|
||||
|
||||
|
||||
@ -228,3 +231,7 @@ szVersion_FileBrowser db 'version_FileBrowser',0
|
||||
sz_tl_load_mem db 'tl_load_mem',0
|
||||
sz_tl_get_mem_size db 'tl_get_mem_size',0
|
||||
sz_tl_version_tree_list db 'version_tree_list',0
|
||||
|
||||
sz_PathShow_prepare db 'PathShow_prepare',0
|
||||
sz_PathShow_draw db 'PathShow_draw',0
|
||||
szVersion_path_show db 'version_PathShow',0
|
||||
|
152
programs/develop/libraries/box_lib/trunk/pathshow.mac
Normal file
152
programs/develop/libraries/box_lib/trunk/pathshow.mac
Normal file
@ -0,0 +1,152 @@
|
||||
;**************************************************************
|
||||
; Path Show Macro for Kolibri OS
|
||||
; Copyright (c) 2010, Marat Zakiyanov aka Mario79, aka Mario
|
||||
; All rights reserved.
|
||||
;
|
||||
; Redistribution and use in source and binary forms, with or without
|
||||
; modification, are permitted provided that the following conditions are met:
|
||||
; * Redistributions of source code must retain the above copyright
|
||||
; notice, this list of conditions and the following disclaimer.
|
||||
; * Redistributions in binary form must reproduce the above copyright
|
||||
; notice, this list of conditions and the following disclaimer in the
|
||||
; documentation and/or other materials provided with the distribution.
|
||||
; * Neither the name of the <organization> nor the
|
||||
; names of its contributors may be used to endorse or promote products
|
||||
; derived from this software without specific prior written permission.
|
||||
;
|
||||
; THIS SOFTWARE IS PROVIDED BY Marat Zakiyanov ''AS IS'' AND ANY
|
||||
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
|
||||
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
;*****************************************************************************
|
||||
macro path_show_start
|
||||
{
|
||||
pusha
|
||||
mov edi,dword [esp+36]
|
||||
}
|
||||
;*****************************************************************************
|
||||
macro path_show_exit
|
||||
{
|
||||
popa
|
||||
ret 4
|
||||
}
|
||||
;*****************************************************************************
|
||||
macro use_path_show
|
||||
{
|
||||
path_show:
|
||||
ps_type equ [edi] ;dword
|
||||
ps_start_y equ [edi+4] ;word
|
||||
ps_start_x equ [edi+6] ;word
|
||||
ps_font_size_x equ [edi+8] ;word
|
||||
ps_area_size_x equ [edi+10] ;word
|
||||
ps_font_number equ [edi+12] ;dword
|
||||
ps_background_flag equ [edi+16] ;dword
|
||||
ps_font_color equ [edi+20] ;dword
|
||||
ps_background_color equ [edi+24] ;dword
|
||||
ps_text_pointer equ [edi+28] ;dword
|
||||
ps_work_area_pointer equ [edi+32] ;dword
|
||||
ps_temp_text_length equ [edi+36] ;dword
|
||||
;*****************************************************************************
|
||||
;*****************************************************************************
|
||||
; draw event
|
||||
;*****************************************************************************
|
||||
;*****************************************************************************
|
||||
.prepare:
|
||||
path_show_start
|
||||
;-------------------------------------
|
||||
mov esi,ps_text_pointer
|
||||
xor eax,eax
|
||||
xor ecx,ecx
|
||||
dec ecx
|
||||
cld
|
||||
@@:
|
||||
lodsb
|
||||
inc ecx
|
||||
test eax,eax
|
||||
jnz @b
|
||||
mov ps_temp_text_length,ecx
|
||||
movzx eax,word ps_font_size_x
|
||||
imul ecx,eax
|
||||
movzx eax,word ps_area_size_x
|
||||
cmp ecx,eax
|
||||
jae .cut
|
||||
;-------------------------------------
|
||||
mov esi,ps_text_pointer
|
||||
mov edi,ps_work_area_pointer
|
||||
xor eax,eax
|
||||
@@:
|
||||
lodsb
|
||||
stosb
|
||||
test eax,eax
|
||||
jnz @b
|
||||
jmp .exit
|
||||
;-------------------------------------
|
||||
.cut:
|
||||
; copy the first 6 characters of path
|
||||
mov esi,ps_text_pointer
|
||||
push edi
|
||||
mov edi,ps_work_area_pointer
|
||||
mov ecx,6
|
||||
rep movsb
|
||||
; insert a line break '...'
|
||||
mov al,byte '.'
|
||||
mov ecx,3
|
||||
rep stosb
|
||||
mov ecx,edi
|
||||
; calculate the display length, in characters
|
||||
pop edi
|
||||
movzx ebx,word ps_font_size_x
|
||||
movzx eax,word ps_area_size_x
|
||||
xor edx,edx
|
||||
div ebx
|
||||
sub eax,9
|
||||
; eax - maximum length of display area, the number of characters
|
||||
mov esi,ps_temp_text_length
|
||||
add esi,ps_text_pointer
|
||||
sub esi,eax
|
||||
; esi - pointer of the last segment of the displayed text
|
||||
mov edi,ecx
|
||||
mov ecx,eax
|
||||
rep movsb
|
||||
xor eax,eax
|
||||
stosb
|
||||
;-------------------------------------
|
||||
.exit:
|
||||
path_show_exit
|
||||
;*****************************************************************************
|
||||
;*****************************************************************************
|
||||
; draw event
|
||||
;*****************************************************************************
|
||||
;*****************************************************************************
|
||||
.draw:
|
||||
path_show_start
|
||||
;-------------------------------------
|
||||
mov ebx,ps_start_y
|
||||
xor ecx,ecx
|
||||
or ecx,0x80000000
|
||||
mov eax,ps_background_flag
|
||||
and eax,1b
|
||||
shl eax,30
|
||||
add ecx,eax
|
||||
mov eax,ps_font_number
|
||||
and eax,11b
|
||||
shl eax,28
|
||||
add ecx,eax
|
||||
mov eax,ps_font_color
|
||||
and eax,0xffffff
|
||||
add ecx,eax
|
||||
mov edx,ps_work_area_pointer
|
||||
mov eax,ps_background_color
|
||||
and eax,0xffffff
|
||||
xor esi,esi
|
||||
mov edi,eax
|
||||
mcall 4
|
||||
path_show_exit
|
||||
}
|
||||
;*****************************************************************************
|
Loading…
Reference in New Issue
Block a user