Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 484 → Rev 485

/programs/system/icon_new/trunk/build_icon.bat
0,0 → 1,5
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm icon.asm @icon
@erase lang.inc
@pause
/programs/system/icon_new/trunk/build_iconmngr.bat
0,0 → 1,5
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm iconmngr.asm iconmngr
@erase lang.inc
@pause
/programs/system/icon_new/trunk/debug-fdo.inc
0,0 → 1,424
;
; Formatted Debug Output (FDO)
; Copyright (c) 2005-2006, mike.dld
; Created: 2005-01-29, Changed: 2006-11-10
;
; For questions and bug reports, mail to mike.dld@gmail.com
;
; Available format specifiers are: %s, %d, %u, %x (with partial width support)
;
 
; to be defined:
; __DEBUG__ equ 1
; __DEBUG_LEVEL__ equ 5
 
macro debug_func name {
if used name
name@of@func equ name
}
 
macro debug_beginf {
align 4
name@of@func:
}
 
debug_endf fix end if
 
macro DEBUGS _sign,[_str] {
common
local tp
tp equ 0
match _arg:_num,_str \{
DEBUGS_N _sign,_num,_arg
tp equ 1
\}
match =0 _arg,tp _str \{
DEBUGS_N _sign,,_arg
\}
}
 
macro DEBUGS_N _sign,_num,[_str] {
common
pushf
pushad
local ..str,..label,is_str
is_str = 0
forward
if _str eqtype ''
is_str = 1
end if
common
if is_str = 1
jmp ..label
..str db _str,0
..label:
add esp,4*8+4
mov edx,..str
sub esp,4*8+4
else
mov edx,_str
end if
if ~_num eq
if _num eqtype eax
if _num in <eax,ebx,ecx,edx,edi,ebp,esp>
mov esi,_num
else if ~_num eq esi
movzx esi,_num
end if
else if _num eqtype 0
mov esi,_num
else
local tp
tp equ 0
match [_arg],_num \{
mov esi,dword[_arg]
tp equ 1
\}
match =0 =dword[_arg],tp _num \{
mov esi,dword[_arg]
tp equ 1
\}
match =0 =word[_arg],tp _num \{
movzx esi,word[_arg]
tp equ 1
\}
match =0 =byte[_arg],tp _num \{
movzx esi,byte[_arg]
tp equ 1
\}
match =0,tp \{
'Error: specified string width is incorrect'
\}
end if
else
mov esi,0x7FFFFFFF
end if
call fdo_debug_outstr
popad
popf
}
 
macro DEBUGD _sign,_dec {
local tp
tp equ 0
match _arg:_num,_dec \{
DEBUGD_N _sign,_num,_arg
tp equ 1
\}
match =0 _arg,tp _dec \{
DEBUGD_N _sign,,_arg
\}
}
 
macro DEBUGD_N _sign,_num,_dec {
pushf
pushad
if (~_num eq)
if (_dec eqtype eax | _dec eqtype 0)
'Error: precision allowed only for in-memory variables'
end if
if (~_num in <1,2,4>)
if _sign
'Error: 1, 2 and 4 are only allowed for precision in %d'
else
'Error: 1, 2 and 4 are only allowed for precision in %u'
end if
end if
end if
if _dec eqtype eax
if _dec in <ebx,ecx,edx,esi,edi,ebp,esp>
mov eax,_dec
else if ~_dec eq eax
if _sign = 1
movsx eax,_dec
else
movzx eax,_dec
end if
end if
else if _dec eqtype 0
mov eax,_dec
else
add esp,4*8+4
if _num eq
mov eax,dword _dec
else if _num = 1
if _sign = 1
movsx eax,byte _dec
else
movzx eax,byte _dec
end if
else if _num = 2
if _sign = 1
movsx eax,word _dec
else
movzx eax,word _dec
end if
else
mov eax,dword _dec
end if
sub esp,4*8+4
end if
mov cl,_sign
call fdo_debug_outdec
popad
popf
}
 
macro DEBUGH _sign,_hex {
local tp
tp equ 0
match _arg:_num,_hex \{
DEBUGH_N _sign,_num,_arg
tp equ 1
\}
match =0 _arg,tp _hex \{
DEBUGH_N _sign,,_arg
\}
}
 
macro DEBUGH_N _sign,_num,_hex {
pushf
pushad
if (~_num eq) & (~_num in <1,2,3,4,5,6,7,8>)
'Error: 1..8 are only allowed for precision in %x'
end if
if _hex eqtype eax
if _hex in <eax,ebx,ecx,edx,esi,edi,ebp,esp>
if ~_hex eq eax
mov eax,_hex
end if
else if _hex in <ax,bx,cx,dx,si,di,bp,sp>
if ~_hex eq ax
movzx eax,_hex
end if
shl eax,16
if (_num eq)
mov edx,4
end if
else if _hex in <al,ah,bl,bh,cl,ch,dl,dh>
if ~_hex eq al
movzx eax,_hex
end if
shl eax,24
if (_num eq)
mov edx,2
end if
end if
else if _hex eqtype 0
mov eax,_hex
else
add esp,4*8+4
mov eax,dword _hex
sub esp,4*8+4
end if
if ~_num eq
mov edx,_num
else
if ~_hex eqtype eax
mov edx,8
end if
end if
call fdo_debug_outhex
popad
popf
}
 
;-----------------------------------------------------------------------------
 
debug_func fdo_debug_outchar
debug_beginf
pushad
mov cl,al
mov ebx,1
mov eax,63
int 0x40
popad
ret
debug_endf
 
debug_func fdo_debug_outstr
debug_beginf
mov eax,63
mov ebx,1
.l1: dec esi
js .l2
mov cl,[edx]
or cl,cl
jz .l2
int 0x40
inc edx
jmp .l1
.l2: ret
debug_endf
 
debug_func fdo_debug_outdec
debug_beginf
or cl,cl
jz @f
or eax,eax
jns @f
neg eax
push eax
mov al,'-'
call fdo_debug_outchar
pop eax
@@: push 10
pop ecx
push -'0'
.l1: xor edx,edx
div ecx
push edx
test eax,eax
jnz .l1
.l2: pop eax
add al,'0'
jz .l3
call fdo_debug_outchar
jmp .l2
.l3: ret
debug_endf
 
debug_func fdo_debug_outhex
__fdo_hexdigits db '0123456789ABCDEF'
debug_beginf
mov cl,dl
neg cl
add cl,8
shl cl,2
rol eax,cl
.l1: rol eax,4
push eax
and eax,0x0000000F
mov al,[__fdo_hexdigits+eax]
call fdo_debug_outchar
pop eax
dec edx
jnz .l1
ret
debug_endf
 
;-----------------------------------------------------------------------------
 
macro DEBUGF _level,_format,[_arg] {
common
if __DEBUG__ = 1 & _level >= __DEBUG_LEVEL__
local ..f1,f2,a1,a2,c1,c2,c3,..lbl
_debug_str_ equ __debug_str_ # a1
a1 = 0
c2 = 0
c3 = 0
f2 = 0
repeat ..lbl-..f1
virtual at 0
db _format,0,0
load c1 word from %-1
end virtual
if c1 = '%s'
virtual at 0
db _format,0,0
store word 0 at %-1
load c1 from f2-c2
end virtual
if c1 <> 0
DEBUGS 0,_debug_str_+f2-c2
end if
c2 = c2 + 1
f2 = %+1
DEBUGF_HELPER S,a1,0,_arg
else if c1 = '%x'
virtual at 0
db _format,0,0
store word 0 at %-1
load c1 from f2-c2
end virtual
if c1 <> 0
DEBUGS 0,_debug_str_+f2-c2
end if
c2 = c2 + 1
f2 = %+1
DEBUGF_HELPER H,a1,0,_arg
else if c1 = '%d' | c1 = '%u'
local c4
if c1 = '%d'
c4 = 1
else
c4 = 0
end if
virtual at 0
db _format,0,0
store word 0 at %-1
load c1 from f2-c2
end virtual
if c1 <> 0
DEBUGS 0,_debug_str_+f2-c2
end if
c2 = c2 + 1
f2 = %+1
DEBUGF_HELPER D,a1,c4,_arg
else if c1 = '\n'
c3 = c3 + 1
end if
end repeat
virtual at 0
db _format,0,0
load c1 from f2-c2
end virtual
if (c1<>0)&(f2<>..lbl-..f1-1)
DEBUGS 0,_debug_str_+f2-c2
end if
virtual at 0
..f1 db _format,0
..lbl:
__debug_strings equ __debug_strings,_debug_str_,<_format>,..lbl-..f1-1-c2-c3
end virtual
end if
}
 
macro __include_debug_strings dummy,[_id,_fmt,_len] {
common
local c1,a1,a2
forward
if defined _len & ~_len eq
_id:
a1 = 0
a2 = 0
repeat _len
virtual at 0
db _fmt,0,0
load c1 word from %+a2-1
end virtual
if (c1='%s')|(c1='%x')|(c1='%d')|(c1='%u')
db 0
a2 = a2 + 1
else if (c1='\n')
dw $0A0D
a1 = a1 + 1
a2 = a2 + 1
else
db c1 and 0x0FF
end if
end repeat
db 0
end if
}
 
macro DEBUGF_HELPER _letter,_num,_sign,[_arg] {
common
local num
num = 0
forward
if num = _num
DEBUG#_letter _sign,_arg
end if
num = num+1
common
_num = _num+1
}
 
macro include_debug_strings {
if __DEBUG__ = 1
match dbg_str,__debug_strings \{
__include_debug_strings dbg_str
\}
end if
}
/programs/system/icon_new/trunk/icon.asm
0,0 → 1,539
;
; ICON APPLICATION
;
; Compile with FASM for Menuet
;
; August 12, 2004 - 32-bit ICO format support (mike.dld)
; March 14, 2007 - rewriten for KolibriOS (heavyiron)
 
use32
 
org 0x0
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd I_END ; size of image
dd 0x8000 ; memory for app
dd 0x8000 ; esp
dd I_PARAM , 0x0 ; I_Param , I_Icon
 
; params 4 xpos 4 ypos 30 iconfile 30 startfile 10 label
; +0 +4 +8 +38 +68
 
include '..\..\..\macros.inc'
;__DEBUG__ fix 1
;__DEBUG_LEVEL__ fix 1
;include 'debug-fdo.inc'
flipdelay = 5
 
START: ; start of execution
 
cmp [I_PARAM],byte 0
jne nohalt
or eax,-1
mcall
nohalt:
 
mov eax,[I_PARAM+0]
sub eax,0x01010101
mov [xpos],eax
mov eax,[I_PARAM+4]
sub eax,0x01010101
mov [ypos],eax
 
mov esi,I_PARAM+8
mov edi,fname
mov ecx,30
cld
rep movsb
call fill_paths
;DEBUGF 1,"fname: '%s'\n",fname
 
mov esi,I_PARAM+8+30
mov edi,start_file
mov ecx,30
rep movsb
call fill_paths
 
mov esi,I_PARAM+8+30+30
mov edi,labelt
mov ecx,10
cld
rep movsb
 
mov eax,40 ; get also event background change
mov ebx,10101b
mcall
 
 
call get_bg
 
red: ; redraw
call draw_window
 
still:
 
mov eax,10 ; wait here for event
mcall
 
cmp eax,1 ; redraw request ?
jz red
cmp eax,3 ; button in buffer ?
jz button
 
check:
call get_bg
call draw_icon
mcall 5,80
jmp still
 
button: ; button
mov al,17 ; get id
mcall
 
mov eax,70
mov ebx,finfo_start
mcall
 
call flip_icon
 
jmp still
 
flip_icon:
 
mov eax,1
call flip
mov eax,2
call flip
mov eax,3
call flip
mov eax,4
call flip
mov eax,5
call flip
mov eax,4
call flip
mov eax,3
call flip
mov eax,2
call flip
mov eax,1
call flip
mov eax,0
call flip
 
ret
 
flip:
mov [iconstate],eax
call get_bg
call draw_icon
mov eax,5
mov ebx,flipdelay
mcall
ret
 
fill_paths:
dec edi
mov ecx,30
std
mov al,' '
repe scasb
cld
mov byte[edi+2],0
ret
 
draw_window:
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
mcall
 
; DRAW WINDOW
xor eax,eax ; function 0 : define and draw window
mov ebx,[xpos-2]
mov ecx,[ypos-2]
add ebx,[yw] ; [x start] *65536 + [x size]
add ecx,67 ; [y start] *65536 + [y size]
mov edx,0x01000000 ; color of work area RRGGBB,8->color gl
mcall
 
mov eax,8 ; button
mov ebx,51
mov ecx,67
mov edx,0x60000001
mcall
 
call draw_icon
 
mov eax,12
mov ebx,2
mcall
 
ret
 
get_bg:
 
mov eax,14
mcall
add eax,0x00010001
mov [scrxy],eax
 
mov eax,39 ; get background type
mov ebx,4
mcall
mov [bgrdrawtype],eax
 
mov eax,39 ; get background size
mov ebx,1
mcall
mov [bgrxy],eax
 
mov eax,70
mov ebx,finfo
mcall
 
mov [itype],0
cmp word[I_END+256],'BM'
je @f
inc [itype]
@@:
 
mov ebx,[yw]
xor ecx,ecx ; 10608 = 52*68*3 - bg image
mov esi,I_END+256+9662 ; 9662 - icon file image
mov edi,51*3
 
newb:
 
push ebx ecx
 
yesbpix:
 
cmp [bgrdrawtype],dword 2
jne nostretch
 
mov eax,[ypos]
add eax,ecx
xor edx,edx
movzx ebx,word [bgrxy]
mul ebx
xor edx,edx
movzx ebx,word [scrxy]
div ebx
xor edx,edx
movzx ebx,word [bgrxy+2]
mul ebx
push eax
 
mov eax,[xpos]
add eax,[esp+8]
xor edx,edx
movzx ebx,word [bgrxy+2]
mul ebx
xor edx,edx
movzx ebx,word [scrxy+2]
div ebx
add eax,[esp]
add esp,4
 
nostretch:
 
cmp [bgrdrawtype],dword 1
jne notiled
 
mov eax,[ypos]
add eax,ecx
xor edx,edx
movzx ebx,word [bgrxy]
div ebx
mov eax,edx
movzx ebx,word [bgrxy+2]
xor edx,edx
mul ebx
push eax
 
mov eax,[xpos]
add eax,[esp+8]
movzx ebx,word [bgrxy+2]
xor edx,edx
div ebx
mov eax,edx
add eax,[esp]
add esp,4
 
notiled:
 
lea ecx,[eax+eax*2]
 
mov eax,39
mov ebx,2
 
mcall
 
nobpix:
 
pop ecx ebx
 
mov [esi+edi+0],al
mov [esi+edi+1],ah
shr eax,16
mov [esi+edi+2],al
sub edi,3
 
dec ebx
jge newb
mov ebx,[yw]
 
add esi,52*3
mov edi,51*3
inc ecx
cmp ecx,68
jne newb
 
;*****************************************************************************
 
mov esi,I_END+256+9662+10608-17*52*3+3 ;! 54+32*3*33-3
mov eax,[iconstate]
mov eax,[add_table0+eax*4]
add esi,eax
mov edi,I_END+256+62
cmp [itype],0
jne @f
mov edi,I_END+256+54
@@:
xor ebp,ebp
mov [pixl],0
newp:
 
virtual at edi
r db ?
g db ?
b db ?
a db ?
end virtual
virtual at esi+ebp
ar db ?
ag db ?
ab db ?
end virtual
 
movzx ecx,[a]
 
push ebp
cmp [iconstate],3
jb @f
neg ebp
@@:
 
cmp [itype],0
jne @f
mov eax,[edi]
and eax,$00FFFFFF
jnz @f
jmp no_transp
@@:
 
movzx eax,[r]
cmp [itype],0
je @f
movzx ebx,byte[ar]
sub eax,ebx
imul eax,ecx
xor edx,edx
or ebx,$0FF
div ebx
movzx ebx,[ar]
add eax,ebx
@@:
mov [esi+ebp+0],al
 
movzx eax,[g]
cmp [itype],0
je @f
movzx ebx,[ag]
sub eax,ebx
imul eax,ecx
xor edx,edx
or ebx,$0FF
div ebx
movzx ebx,[ag]
add eax,ebx
@@:
mov [esi+ebp+1],al
 
movzx eax,[b]
cmp [itype],0
je @f
movzx ebx,[ab]
sub eax,ebx
imul eax,ecx
xor edx,edx
or ebx,$0FF
div ebx
movzx ebx,[ab]
add eax,ebx
@@:
mov [esi+ebp+2],al
 
no_transp:
 
pop ebp
 
movzx eax,[itype]
imul eax,6
add eax,[iconstate]
push eax
mov eax,[add_table1+eax*4]
add edi,eax
 
add ebp,3
pop eax
mov eax,[add_table2+eax*4]
add [pixl],eax
cmp [pixl],48
jl newp
xor ebp,ebp
mov [pixl],0
 
sub esi,52*3
cmp esi,I_END+256+9662+52*4*3
jge newp
 
;*****************************************************************************
 
ret
 
draw_picture:
mov eax,7
mov ebx,I_END+256+9662
mov ecx,52 shl 16 + 68
xor edx,edx
mcall
ret
 
draw_icon:
call draw_picture
call draw_text
ret
 
draw_text:
 
mov eax,labelt ;text_length
news:
cmp [eax],byte 40
jb founde
inc eax
cmp eax,labelt+11
jb news
founde:
sub eax,labelt
 
lea eax,[eax+eax*2] ; eax *= char_width/2
shl eax,16
mov ebx,26*65536+58
sub ebx,eax
movzx ecx,byte [I_PARAM+8+30+30+10]
shl ecx,16
add ebx,ecx
 
; replaced - delete commented lines below if you like that style
mov eax,4 ; white text
 
xor ecx,ecx
mov edx,labelt
mov esi,labellen-labelt
add ebx,1 shl 16 ;*65536+1
mcall
inc ebx
mcall
add ebx,1 shl 16
mcall
inc ebx
mcall
sub ebx,1 shl 16
mcall
dec ebx
sub ebx,1 shl 16
mcall
sub ebx,1 shl 16
dec ebx
mcall
dec ebx
add ebx,1 shl 16
mcall
inc ebx
mov ecx,0xffffff
mcall
 
;xor ecx,ecx ; black shade of text
;mov edx,labelt
;mov esi,labellen-labelt
;add ebx,1*65536+1
;mcall
;sub ebx,1*65536+1
;mov ecx,0xffffff
;mcall
 
ret
 
 
; DATA AREA
 
itype db 0
 
align 4
 
tl dd 2
yw dd 51
 
xpos dd 15
ypos dd 185
 
bgrxy dd 0x0
scrxy dd 0x0
bgrdrawtype dd 0x0
 
iconstate dd 0
 
add_table0 dd (24-6*4)*3,(24-6*2)*3,(24-6*1)*3,\
(24+6*1)*3,(24+6*2)*3,(24+6*4)*3
 
add_table1 dd 3,6,12,12,6,3
dd 4,8,16,16,8,4
 
add_table2 dd 1,2,4,4,2,1
dd 1,2,4,4,2,1
 
finfo_start:
dd 7
dd 0
dd 0
dd 0
dd 0
db 0
dd start_file
 
finfo:
dd 0
dd 0
dd 0
dd 9662
dd I_END+256
db 0
dd fname
 
start_file rb 30
fname rb 30
 
labelt:
rb 10
labellen:
 
pixl dd ?
 
;include_debug_strings
I_PARAM:
 
I_END:
/programs/system/icon_new/trunk/iconmngr.asm
0,0 → 1,780
;
; DESKTOP ICON MANAGER
;
; Compile with FASM for Menuet
;
 
use32
 
org 0x0
 
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd I_END ; size of image
dd 0x4000 ; memory for app
dd 0x4000 ; esp
dd I_Param , 0x0 ; I_Param , I_Icon
 
include '..\..\..\macros.inc'
include 'lang.inc'
 
START: ; start of execution
 
call load_icon_list
 
call check_parameters
 
red: ; redraw
call draw_window ; at first, draw the window
 
still:
 
mov eax,10 ; wait here for event
mcall
 
dec eax ; redraw request ?
jz red
dec eax ; key in buffer ?
jz key
 
button: ; button
mov al,17 ; get id
mcall
 
shr eax,8
 
cmp eax,1 ; button id=1 ?
jne noclose
or eax,-1 ; close this program
mcall
noclose:
 
cmp eax,11
jb no_str
cmp eax,13
jg no_str
call read_string
jmp still
no_str:
 
 
cmp eax,21 ; apply changes
jne no_apply
 
; (1) save list
 
mov eax,70
mov ebx,finfo
mov dword[ebx],2
mov edx,78
imul edx,dword [icons]
mov dword[ebx+12],edx
mcall
 
 
; (2) terminate all icons
 
mov esi,1
newread:
inc esi
mov eax,9
mov ebx,I_END
mov ecx,esi
mcall
cmp esi,eax
jg all_terminated
 
cmp [I_END+10],dword '@ICO'
jne newread
 
mov eax,18
mov ebx,2
mov ecx,esi
mcall
 
mov esi,1
 
jmp newread
 
all_terminated:
 
apply_changes:
 
; (3) start icons from icon_data
 
mov edi,[icons]
mov esi,icon_data
start_new:
 
push edi
push esi
 
movzx eax,byte [esi] ; x position
cmp eax,'E'
jg no_left
sub eax,65
imul eax,70
add eax,15
jmp x_done
no_left:
sub eax,65
mov ebx,9
sub ebx,eax
imul ebx,70
push ebx
mov eax,14
mcall
pop ebx
shr eax,16
sub eax,51+15
sub eax,ebx
x_done:
add eax,0x01010101
mov [icon_start_parameters],eax
 
movzx eax,byte [esi+1] ; y position
cmp eax,'E'
jg no_up
sub eax,65
imul eax,80
add eax,12
jmp y_done
no_up:
sub eax,65
mov ebx,9
sub ebx,eax
imul ebx,80
push ebx
mov eax,14
mcall
pop ebx
and eax,0xffff
sub eax,-1+20
sub eax,ebx
y_done:
add eax,0x01010101
mov [icon_start_parameters+4],eax
 
mov esi,[esp] ; icon picture
add esi,3
mov edi,icon_start_parameters+8
mov ecx,30
cld
rep movsb
 
mov esi,[esp] ; icon application
add esi,34
mov edi,icon_start_parameters+8+30
mov ecx,30
cld
rep movsb
 
mov esi,[esp] ; icon text
add esi,65
mov edi,icon_start_parameters+8+30+30
mov ecx,10
cld
rep movsb
 
mov byte[edi],0 ; ASCII -> ASCIIZ
 
mov eax,70
mov ebx,finfo_start
mcall
 
pop esi edi
 
add esi,76+2
 
dec edi
jnz start_new
 
cmp [I_Param],byte 0
je still
 
or eax,-1
mcall
 
no_apply:
 
 
cmp eax,22 ; user pressed the 'add icon' button
jne no_add_icon
 
mov eax,13
mov ebx,19*65536+260
mov ecx,225*65536+10
mov edx,0xffffff
mcall
mov eax,4
mov ebx,19*65536+225
mov ecx,0xff0000
mov edx,add_text
mov esi,add_text_len-add_text
mcall
 
mov eax,10
mcall
cmp eax,3
jne still
mov al,17
mcall
shr eax,8
cmp eax,40
jb no_f
sub eax,40
 
xor edx,edx ; bcd -> 10
mov ebx,16
div ebx
imul eax,10
add eax,edx
 
mov ebx,eax
add ebx,icons_reserved
cmp [ebx],byte 'x'
je no_f
mov [ebx],byte 'x'
 
xor edx,edx
mov ebx,10
div ebx
add eax,65
add edx,65
mov [icon_default+0],dl
mov [icon_default+1],al
 
inc dword [icons]
mov edi,[icons]
dec edi
imul edi,76+2
add edi,icon_data
 
mov [current_icon],edi
 
mov esi,icon_default
mov ecx,76+2
cld
rep movsb
 
no_f:
 
call draw_window
 
jmp still
 
no_add_icon:
 
 
cmp eax,23 ; user pressed the remove icon button
jne no_remove_icon
 
mov eax,13
mov ebx,19*65536+260
mov ecx,225*65536+10
mov edx,0xffffff
mcall
mov eax,4
mov ebx,19*65536+225
mov ecx,0xff0000
mov edx,rem_text
mov esi,rem_text_len-rem_text
mcall
 
mov eax,10
mcall
cmp eax,3
jne no_found
mov al,17
mcall
shr eax,8
cmp eax,40
jb no_found
sub eax,40
 
xor edx,edx
mov ebx,16
div ebx
imul eax,10
add eax,edx
 
mov ebx,eax
add ebx,icons_reserved
cmp [ebx],byte 'x'
jne no_found
mov [ebx],byte ' '
 
xor edx,edx
mov ebx,10
div ebx
shl eax,8
mov al,dl
 
add eax,65*256+65
 
mov esi,icon_data
mov edi,76+2
imul edi,[icons]
add edi,icon_data
news:
cmp word [esi],ax
je foundi
add esi,76+2
cmp esi,edi
jb news
jmp no_found
 
foundi:
 
mov ecx,edi
sub ecx,esi
 
mov edi,esi
add esi,76+2
 
cld
rep movsb
 
dec [icons]
 
mov eax,icon_data
mov [current_icon],eax
 
no_found:
 
call draw_window
 
jmp still
 
 
 
no_remove_icon:
 
 
cmp eax,40 ; user pressed button for icon position
jb no_on_screen_button
 
sub eax,40
mov edx,eax
shl eax,4
and edx,0xf
mov dh,ah
add edx,65*256+65
 
mov esi,icon_data
mov ecx,[icons]
cld
findl1:
cmp dx,[esi]
je foundl1
add esi,76+2
loop findl1
jmp still
 
foundl1:
 
mov [current_icon],esi
 
call print_strings
 
jmp still
 
no_on_screen_button:
 
 
jmp still
 
 
key: ; key
mov al,2 ; just read it and ignore
mcall
jmp still
 
current_icon dd icon_data
 
 
print_strings:
 
pusha
 
mov eax,13 ; clear text area
mov ebx,95*65536+180
mov ecx,253*65536+40
mov edx,0xffffff
mcall
 
mov eax,4 ; icon text
mov ebx,95*65536+253
mov ecx,0x000000
mov edx,[current_icon]
add edx,65
mov esi,10
mcall
 
;mov eax,4 ; icon application
add ebx,14
mov edx,[current_icon]
add edx,34
mov esi,30
mcall
 
;mov eax,4 ; icon file
add ebx,14
mov edx,[current_icon]
add edx,3
mov esi,30
mcall
 
popa
 
ret
 
 
load_icon_list:
 
;pusha
 
mov eax,70
mov ebx,finfo
mov dword[ebx],0
mov dword[ebx+12],4096 ; max size of icons.dat (in current format) is 4 kb
mcall
 
mov eax,ebx
add eax,2
xor edx,edx
mov ebx,76+2
div ebx
mov [icons],eax
 
mov edi,icons_reserved ; clear reserved area
mov eax,32
mov ecx,10*10
cld
rep stosb
 
mov ecx,[icons] ; set used icons to reserved area
mov esi,icon_data
cld
ldl1:
movzx ebx,byte [esi+1]
sub ebx,65
imul ebx,10
movzx eax,byte [esi]
add ebx,eax
sub ebx,65
add ebx,icons_reserved
mov [ebx],byte 'x'
add esi,76+2
loop ldl1
 
;popa
 
ret
 
 
check_parameters:
 
cmp [I_Param],dword 'BOOT'
je chpl1
ret
 
chpl1:
mov eax,21
jmp apply_changes
 
 
positions dd 65,34,3
 
read_string:
 
;pusha
 
sub eax,11
shl eax,2
add eax,positions
mov eax,[eax]
 
mov esi,[current_icon]
add esi,eax
mov [addr],esi
 
mov edi,[addr]
mov eax,'_'
mov ecx,30
cld
rep stosb
 
call print_strings
 
mov edi,[addr]
f11:
mov eax,10
mcall
cmp eax,2
jz fbu
jmp rs_done
fbu:
mov eax,2
mcall
shr eax,8
cmp eax,13
je rs_done
cmp eax,8
jnz nobsl
cmp edi,[addr]
jz f11
dec edi
mov [edi],byte ' '
call print_strings
jmp f11
nobsl:
cmp eax,31
jbe f11
 
keyok:
mov [edi],al
call print_strings
 
add edi,1
mov esi,[addr]
add esi,30
cmp esi,edi
jnz f11
 
rs_done:
 
mov ecx,[addr]
add ecx,30
sub ecx,edi
mov eax,32
cld
rep stosb
 
call print_strings
 
;popa
 
ret
 
 
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
 
 
draw_window:
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
mcall
 
; DRAW WINDOW
xor eax,eax
mov ebx,210*65536+300
mov ecx,30*65536+390
mov edx,0x33ffffff
mov edi,title
mcall
 
mov eax,13 ; WINDOW AREA
mov ebx,15*65536+260
mov ecx,10*65536+200
mov edx,0x3366cc
mcall
 
mov eax,38 ; VERTICAL LINE ON WINDOW AREA
mov ebx,145*65536+145
mov ecx,10*65536+235
mov edx,0xffffff
mcall
 
;mov eax,38 ; HOROZONTAL LINE ON WINDOW AREA
mov ebx,15*65536+280
mov ecx,110*65536+110
mov edx,0xffffff
mcall
 
mov eax,8 ; TEXT ENTER BUTTONS
mov ebx,15*65536+72
mov ecx,250*65536+13
mov edx,11
mov esi,[bcolor]
mcall
inc edx
add ecx,14*65536
mcall
inc edx
add ecx,14*65536
mcall
 
;mov eax,8 ; APPLY AND SAVE CHANGES BUTTON
mov ebx,15*65536+259
mov ecx,304*65536+15
mov edx,21
mov esi,[bcolor]
mcall
 
;mov eax,8 ; ADD ICON BUTTON
mov ebx,15*65536+129
add ecx,14*2*65536
inc edx
mcall
 
;mov eax,8 ; REMOVE ICON BUTTON
add ebx,130*65536
inc edx
mcall
 
xor eax,eax ; DRAW BUTTONS ON WINDOW AREA
mov ebx,15*65536+25
mov ecx,10*65536+19
mov edi,icon_table
mov edx,40
newbline:
 
cmp [edi],byte 'x'
jne no_button
 
mov esi,0x5577cc
cmp [edi+100],byte 'x'
jne nores
mov esi,0xcc5555
nores:
 
push eax
mov eax,8
mcall
pop eax
 
no_button:
 
add ebx,26*65536
 
inc edi
inc edx
 
inc al
cmp al,9
jbe newbline
mov al,0
 
add edx,6
 
ror ebx,16
mov bx,15
ror ebx,16
add ecx,20*65536
 
inc ah
cmp ah,9
jbe newbline
 
mov ebx,19*65536+225
mov ecx,0xffffff
mov edx,text
mov esi,37
mov eax,4
newline:
mov ecx,[edx]
add edx,4
mcall
add ebx,14
add edx,37
cmp [edx],byte 'x'
jne newline
 
call print_strings
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
mcall
 
ret
 
 
; DATA AREA
 
bcolor dd 0x335599
 
icon_table:
 
times 4 db 'xxxx xxxx'
times 2 db ' '
times 3 db 'xxxx xxxx'
times 1 db ' '
 
icons_reserved:
 
times 10 db ' '
 
 
text:
db 0,0,0,0, 'CLICK ON ICON POSITION TO EDIT '
db 0,0,0,0, ' '
db 255,255,255,0 , ' ICON TEXT '
db 255,255,255,0 , ' ICON APP '
db 255,255,255,0 , ' ICON FILE '
db 0,0,0,0, ' '
db 255,255,255,0, ' SAVE AND APPLY ALL CHANGES '
db 0,0,0,0, ' '
db 255,255,255,0, ' ADD ICON REMOVE ICON'
db 'x' ; <- END MARKER, DONT DELETE
 
 
title db 'Icon manager',0
 
icons dd 0
 
addr dd 0
ya dd 0
 
add_text db 'PRESS BUTTON OF UNUSED ICON POSITION'
add_text_len:
 
rem_text db 'PRESS BUTTON OF USED ICON'
rem_text_len:
 
finfo_start:
dd 7
dd 0
dd icon_start_parameters
dd 0
dd 0
db 0
dd icon_path
 
icon_path db '/rd/1/@ICON',0
 
finfo:
dd 0
dd 0
dd 0
dd 0
dd icon_data
db 0
dd icon_list
 
icon_list db '/rd/1/icons.dat',0
 
icon_start_parameters:
db 25,1,1,1
db 35,1,1,1
db '/rd/1/icons/fs.ico',0
rb 12
db '/rd/1/kfar',0
rb 20
db 'KFAR '
 
icon_default:
db 'AA-/rd/1/icons/fs.ico -/rd/1/kfar -KFAR *',13,10
 
icon_data: ; data length 76+2
 
rb 4096
 
I_Param:
 
I_END:
/programs/system/icon_new/trunk/icons/board.ico
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/system/icon_new/trunk/icons/bug.ico
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/system/icon_new/trunk/icons/calc.ico
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/system/icon_new/trunk/icons/fasm.ico
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/system/icon_new/trunk/icons/floppy.ico
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/system/icon_new/trunk/icons/fs.ico
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/system/icon_new/trunk/icons/vrr.ico
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/system/icon_new/trunk/icons/write.ico
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/system/icon_new/trunk/icons.dat
0,0 → 1,8
AA-/rd/1/icons/FS.ICO -/rd/1/KFAR -FAR *
BA-/rd/1/icons/FASM.ICO -/rd/1/develop/FASM -Fasm *
CA-/rd/1/icons/WRITE.ICO -/rd/1/TINYPAD -Tinypad *
AB-/rd/1/icons/FLOPPY.ICO -/rd/1/RDSAVE -RDsave *
BB-/rd/1/icons/CALC.ICO -/rd/1/CALC -Calc *
HA-/rd/1/icons/BUG.ICO -/rd/1/develop/MTDBG -Debuger *
IA-/rd/1/icons/BOARD.ICO -/rd/1/develop/BOARD -Board *
JA-/rd/1/icons/VRR.ICO -/rd/1/VRR -VRR *
/programs/system/icon_new/trunk/readme.txt
0,0 → 1,3
„«ï ¨á¯®«ì§®¢ ­¨ï í⮩ ¢¥àᨨ ICON ­¥®¡å®¤¨¬® § ¬¥­¨âì icons.dat ¢ ®¡à §¥, § ª¨­ãâì â㤠 ¢áî ¯ ¯ªã icons,
᪮¬¯¨«¨à®¢ ­­ë¥ @icon ¨ iconmngr, ¯®¯à ¢¨âì autorun.dat (ICON § ¬¥­¨âì ­  ICONMNGR), ¯¥à¥ª®¬¯¨«¨à®¢ âì @RB,
§ ¬¥­¨¢ ¢ ¨á室­¨ª¥ ICON ­  ICONMNGR. ‚த¥ ¢á¥ :) ”®à¬ â ¨ª®­®ª *.ico - 48X48X32 bit (¯à®§à ç­®áâì ¯®¤¤¥à¦¨¢ ¥âáï)