ICON2, @PANEL: changes to perform self-reposition on screen resolution change

@PANEL: display of up to 255 running applications (from Mario79)
VRR: don't kill applications on screen resolution change
GRSCREEN: don't set up system colors (they're taken from skin file now)
DESKTOP: added ability to change window skins 'on the fly' (with preview)

git-svn-id: svn://kolibrios.org@51 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Mihail Semenyako (mike.dld) 2006-03-04 11:44:33 +00:00
parent aa9b0bc44b
commit df5b0209d7
8 changed files with 2506 additions and 2505 deletions

View File

@ -1,9 +1,10 @@
; ;
; UNIFORM WINDOW COLOURS ; UNIFORM WINDOW COLOURS & SKIN
; ;
; Compile with FASM for Menuet ; Compile with FASM for Menuet
; ;
; < russian edition by Ivan Poddubny > ; < russian edition by Ivan Poddubny >
; < skin selection by Mike Semenyako >
; ;
;****************************************************************************** ;******************************************************************************
@ -13,7 +14,7 @@
dd 1 ; header version dd 1 ; header version
dd START ; start address dd START ; start address
dd I_END ; file size dd I_END ; file size
dd 20000h ; memory dd 28000h ; memory
dd 10000h ; stack pointer (0x10000+ - work area for os) dd 10000h ; stack pointer (0x10000+ - work area for os)
dd 0;,0 ; parameters, reserved dd 0;,0 ; parameters, reserved
@ -22,6 +23,46 @@
;****************************************************************************** ;******************************************************************************
struct SKIN_HEADER
.ident dd ?
.version dd ?
.params dd ?
.buttons dd ?
.bitmaps dd ?
ends
struct SKIN_PARAMS
.skin_height dd ?
.margin.right dw ?
.margin.left dw ?
.margin.bottom dw ?
.margin.top dw ?
.colors.inner dd ?
.colors.outer dd ?
.colors.frame dd ?
.colors_1.inner dd ?
.colors_1.outer dd ?
.colors_1.frame dd ?
.dtp.size dd ?
.dtp.data db 40 dup (?)
ends
struct SKIN_BUTTONS
.type dd ?
.pos:
.left dw ?
.top dw ?
.size:
.width dw ?
.height dw ?
ends
struct SKIN_BITMAPS
.kind dw ?
.type dw ?
.data dd ?
ends
START: ; start of execution START: ; start of execution
@ -32,14 +73,14 @@ START: ; start of execution
int 0x40 int 0x40
cld cld
mov esi, default_file mov esi,default_skn
mov edi,fname mov edi,fname
mov ecx, default_file.size mov ecx,default_skn.size
rep movsb rep movsb
mov [skin_info.fname],0
mov [skin_info.workarea],0x10000
call load_skin_file
mov [read_info.address], color_table
mov [read_info.workarea], 0x10000
mov [read_info.start_block], 0
red: red:
call draw_window ; at first, draw the window call draw_window ; at first, draw the window
@ -71,6 +112,25 @@ still:
mov eax,17 ; get id mov eax,17 ; get id
int 0x40 int 0x40
cmp ah,11 ; read string
jne no_string
call read_string
jmp still
no_string:
cmp ah,12 ; load file
jne no_load
call load_file
call draw_window
jmp still
no_load:
cmp ah,13 ; save file
jne no_save
call save_file
jmp still
no_save:
cmp ah,14 ; set 3d buttons cmp ah,14 ; set 3d buttons
jne no_3d jne no_3d
mov eax,48 mov eax,48
@ -91,8 +151,9 @@ still:
jmp still jmp still
no_flat: no_flat:
cmp ah,51 ; apply cmp ah,16 ; apply
jne no_apply jne no_apply
apply_direct:
mov eax,48 mov eax,48
mov ebx,2 mov ebx,2
mov ecx,color_table mov ecx,color_table
@ -104,6 +165,22 @@ still:
int 0x40 int 0x40
no_apply: no_apply:
cmp ah,17 ; load skin file
jne no_load_skin
call load_skin_file
call draw_window
jmp still
no_load_skin:
cmp ah,18 ; apply skin
jne no_apply_skin
cmp [skin_info.fname],0
je no_apply_skin
mcall 48,8,skin_info
call draw_window
jmp still
no_apply_skin:
cmp ah,31 cmp ah,31
jb no_new_colour jb no_new_colour
cmp ah,41 cmp ah,41
@ -124,25 +201,6 @@ still:
int 0x40 int 0x40
noid1: noid1:
cmp ah,11 ; read string
jne no_string
call read_string
jmp still
no_string:
cmp ah,12 ; load file
jne no_load
call load_file
call draw_window
jmp still
no_load:
cmp ah,13 ; save file
jne no_save
call save_file
jmp still
no_save:
jmp still jmp still
@ -174,9 +232,9 @@ draw_cursor:
cmp ebx,32 cmp ebx,32
jbe no_color jbe no_color
cmp ebx,280 ; CHANGE COLOR cmp ebx,266 ; CHANGE COLOR
jb no_color jb no_color
cmp ebx,280+20*3 cmp ebx,266+20*3
jg no_color jg no_color
cmp ecx,30+128 cmp ecx,30+128
@ -184,7 +242,7 @@ draw_cursor:
cmp ecx,30 cmp ecx,30
jb no_color jb no_color
sub ebx,280 sub ebx,266
mov eax,ebx mov eax,ebx
cdq cdq
mov ebx,20 mov ebx,20
@ -212,10 +270,46 @@ load_file:
pushad pushad
mov [read_info.mode] ,0 mov [read_info.mode] ,0
mov [read_info.start_block],0
mov [read_info.blocks] ,1 mov [read_info.blocks] ,1
mov [read_info.address] ,color_table
mov [read_info.workarea] ,0x10000
mcall 58, read_info mcall 58, read_info
call draw_colours popad
ret
load_skin_file:
pushad
mov [read_info.mode] ,0
mov [read_info.start_block],0
mov [read_info.blocks] ,64
mov [read_info.address] ,0x20000
mov [read_info.workarea] ,0x10000
mcall 58, read_info
cmp dword[0x20000+SKIN_HEADER.ident],'SKIN'
jne @f
mov esi,fname
mov edi,skin_info.fname
mov ecx,257
rep movsb
mov esi,0x20000
mov edi,0x18000
mov ecx,0x8000/4
rep movsd
mov ebp,0x18000
mov esi,[ebp+SKIN_HEADER.params]
add esi,ebp
lea esi,[esi+SKIN_PARAMS.dtp.data]
mov edi,color_table
mov ecx,10
rep movsd
@@:
popad popad
ret ret
@ -226,6 +320,8 @@ save_file:
mov [write_info.mode] ,1 mov [write_info.mode] ,1
mov [write_info.bytes2write],10*4 mov [write_info.bytes2write],10*4
mov [write_info.address] ,color_table
mov [write_info.workarea] ,0x10000
mcall 58, write_info mcall 58, write_info
popad popad
@ -238,7 +334,7 @@ read_string:
mov edi,fname mov edi,fname
mov al,'_' mov al,'_'
mov ecx,54 mov ecx,87
cld cld
rep stosb rep stosb
@ -270,13 +366,13 @@ read_string:
call print_text call print_text
inc edi inc edi
cmp edi, fname+54 cmp edi, fname+87
jne f11 jne f11
read_done: read_done:
mov ecx, fname mov ecx, fname
add ecx, 55 add ecx, 88
sub ecx, edi sub ecx, edi
mov eax, 0 mov eax, 0
cld cld
@ -292,12 +388,12 @@ read_string:
print_text: print_text:
pushad pushad
mpack ebx, 16, 6*54+4 mpack ebx,15,6*87+4
mpack ecx, 234, 10 mpack ecx,(30+18*10+2),11
mcall 13,,,[w_work] mcall 13,,,[w_work]
mpack ebx, 17, 235 mpack ebx,17,(30+18*10+4)
mcall 4, , [w_work_text], fname, 54 mcall 4,,[w_work_text],fname,87
popad popad
ret ret
@ -308,13 +404,13 @@ draw_color:
pusha pusha
mov eax,13 mov eax,13
mov ebx,280*65536+60 mov ebx,266*65536+60
mov ecx,170*65536+30 mov ecx,170*65536+30
mov edx,[color] mov edx,[color]
int 0x40 int 0x40
; mov eax,13 ; mov eax,13
mov ebx,280*65536+60 mov ebx,266*65536+60
mov ecx,200*65536+10 mov ecx,200*65536+10
mov edx,[w_work] mov edx,[w_work]
int 0x40 int 0x40
@ -322,7 +418,7 @@ draw_color:
mov eax,47 mov eax,47
mov ebx,0+1*256+8*65536 mov ebx,0+1*256+8*65536
mov ecx,[color] mov ecx,[color]
mov edx,280*65536+201 mov edx,272*65536+201
mov esi,[w_work_text] mov esi,[w_work_text]
int 0x40 int 0x40
@ -338,12 +434,12 @@ draw_colours:
mov esi,color_table mov esi,color_table
mov ebx,225*65536+32 mov ebx,225*65536+32
mov ecx,37*65536+12 mov ecx,32*65536+12
newcol: newcol:
mov eax,13 mov eax,13
mov edx,[esi] mov edx,[esi]
int 0x40 int 0x40
add ecx,20*65536 add ecx,18*65536
add esi,4 add esi,4
cmp esi,color_table+4*9 cmp esi,color_table+4*9
jbe newcol jbe newcol
@ -353,6 +449,189 @@ draw_colours:
ret ret
draw_framerect: ; ebx,ecx
push ebx ecx
add bx,[esp+6]
mov cx,[esp+2]
dec ebx
mcall 38
add cx,[esp]
rol ecx,16
add cx,[esp]
sub ecx,0x00010001
mcall
mov ebx,[esp+4]
mov ecx,[esp]
mov bx,[esp+6]
add cx,[esp+2]
dec ecx
mcall
add bx,[esp+4]
rol ebx,16
add bx,[esp+4]
sub ebx,0x00010001
mcall
add esp,8
ret
find_bitmap:
mov edi,[ebp+SKIN_HEADER.bitmaps]
add edi,ebp
xor ebx,ebx
.lp1: cmp dword[edi],0
je .lp2
cmp dword[edi+0],eax
jne @f
mov ebx,[edi+SKIN_BITMAPS.data]
add ebx,ebp
mov ecx,[ebx-2]
mov cx,[ebx+4]
add ebx,8
.lp2: ret
@@: add edi,8
jmp .lp1
draw_skin:
mcall 13,<345,206>,<20,191>,0x00FFFFFF
mov ebp,0x18000
mov edi,[ebp+SKIN_HEADER.params]
add edi,ebp
mpack ebx,345+45,150
mpack ecx,20+10,140
mov edx,[edi+SKIN_PARAMS.colors_1.outer]
call draw_framerect
mpack ebx,345+45+4,150-8
mpack ecx,20+10+4,140-8
mov edx,[edi+SKIN_PARAMS.colors_1.inner]
call draw_framerect
mcall 13,<345+45+1,148>,<20+10+1,3>,[edi+SKIN_PARAMS.colors_1.frame]
add ecx,135*65536
mcall
mcall ,<345+45+1,3>,<20+10+1,138>
add ebx,145*65536
mcall
mcall ,<345+45+5,140>,<20+10+5,130>,dword[edi+SKIN_PARAMS.dtp.data+system_colors.work]
mov eax,0x00000001 ; left, inactive
call find_bitmap
mcall 7,,,<345+45,20+10>
pushd [ebx-8]
mov eax,0x00000003 ; base, inactive
call find_bitmap
pop edx
mov esi,345+45+150-1
sub esi,edx
shl edx,16
add edx,(345+45)*65536+20+10
mcall 7
@@: rol edx,16
add dx,[ebx-8]
cmp dx,si
ja @f
rol edx,16
mcall 7
jmp @b
@@:
mov eax,0x00000002 ; oper, inactive
call find_bitmap
mov edx,ecx
shr edx,16
neg edx
shl edx,16
add edx,(345+45+150)*65536+20+10
mcall 7
mov ebp,0x18000
mov edi,[ebp+SKIN_HEADER.params]
add edi,ebp
mov eax,dword[edi+SKIN_PARAMS.margin.left-2]
mov ax,word[edi+SKIN_PARAMS.skin_height]
sub ax,[edi+SKIN_PARAMS.margin.bottom]
shr ax,1
add ax,[edi+SKIN_PARAMS.margin.top]
add ax,-4
push eax
lea ebx,[eax+(345+45)*65536+20+10]
mcall 4,,dword[edi+SKIN_PARAMS.dtp.data+system_colors.grab_text],test_text,test_text.size
;---------------------------------------------------------
mov edi,[ebp+SKIN_HEADER.params]
add edi,ebp
mpack ebx,345+10,150
mpack ecx,20+40,140
mov edx,[edi+SKIN_PARAMS.colors.outer]
call draw_framerect
mpack ebx,345+10+4,150-8
mpack ecx,20+40+4,140-8
mov edx,[edi+SKIN_PARAMS.colors.inner]
call draw_framerect
mcall 13,<345+10+1,148>,<20+40+1,3>,[edi+SKIN_PARAMS.colors.frame]
add ecx,135*65536
mcall
mcall ,<345+10+1,3>,<20+40+1,138>
add ebx,145*65536
mcall
mcall ,<345+10+5,140>,<20+40+5,130>,dword[edi+SKIN_PARAMS.dtp.data+system_colors.work]
mov eax,0x00010001 ; left, inactive
call find_bitmap
mcall 7,,,<345+10,20+40>
pushd [ebx-8]
mov eax,0x00010003 ; base, inactive
call find_bitmap
pop edx
mov esi,345+10+150-1
sub esi,edx
shl edx,16
add edx,(345+10)*65536+20+40
mcall 7
@@: rol edx,16
add dx,[ebx-8]
cmp dx,si
ja @f
rol edx,16
mcall 7
jmp @b
@@:
mov eax,0x00010002 ; oper, inactive
call find_bitmap
mov edx,ecx
shr edx,16
neg edx
shl edx,16
add edx,(345+10+150)*65536+20+40
mcall 7
mov ebp,0x18000
mov edi,[ebp+SKIN_HEADER.params]
add edi,ebp
pop eax
lea ebx,[eax+(345+10)*65536+20+40]
mcall 4,,dword[edi+SKIN_PARAMS.dtp.data+system_colors.grab_text],test_text,test_text.size
;----------------------------------------------------------------------
mov edi,[ebp+SKIN_HEADER.buttons]
add edi,ebp
.lp1: cmp dword[edi],0
je .lp2
mov ebx,dword[edi+SKIN_BUTTONS.left-2]
mov bx,[edi+SKIN_BUTTONS.width]
mov ecx,dword[edi+SKIN_BUTTONS.top-2]
mov cx,[edi+SKIN_BUTTONS.height]
add ebx,(345+10+150)*65536
add ecx,(20+40)*65536
dec ebx
dec ecx
mcall 8,,,0x40000000
add edi,12
jmp .lp1
.lp2: ret
; ********************************************* ; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ******** ; ******* WINDOW DEFINITIONS AND DRAW ********
@ -380,8 +659,8 @@ draw_window:
; DRAW WINDOW ; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window mov eax,0 ; function 0 : define and draw window
mov ebx,110*65536+360 ; [x start] *65536 + [x size] mov ebx,110*65536+555 ; [x start] *65536 + [x size]
mov ecx,50*65536+300 ; [y start] *65536 + [y size] mov ecx,50*65536+255 ; [y start] *65536 + [y size]
mov edx,[w_work] ; color of work area RRGGBB,8->color mov edx,[w_work] ; color of work area RRGGBB,8->color
or edx,0x02000000 or edx,0x02000000
mov esi,[w_grab] ; color of grab bar RRGGBB,8->color gl mov esi,[w_grab] ; color of grab bar RRGGBB,8->color gl
@ -401,60 +680,81 @@ end if
int 0x40 int 0x40
; CLOSE BUTTON ; CLOSE BUTTON
mov eax,8 ; function 8 : define and draw button mov eax,8 ; function 8 : define and draw button
mov ebx,(360-19)*65536+12 ; [x start] *65536 + [x size] mov ebx,(555-19)*65536+12 ; [x start] *65536 + [x size]
mov ecx,4*65536+12 ; [y start] *65536 + [y size] mov ecx,4*65536+12 ; [y start] *65536 + [y size]
mov edx,1 ; button id mov edx,1 ; button id
mov esi,[w_grab_button] ; button color RRGGBB mov esi,[w_grab_button] ; button color RRGGBB
int 0x40 int 0x40
if lang eq ru
load_w = (5*2+6*9)
save_w = (5*2+6*9)
flat_w = (5*2+6*7)
apply_w = (5*2+6*9)
else
load_w = (5*2+6*6)
save_w = (5*2+6*6)
flat_w = (5*2+6*4)
apply_w = (5*2+6*7)
end if
; mov eax,8 ; FILENAME BUTTON ; mov eax,8 ; FILENAME BUTTON
mov ebx,280*65536+60 mov ebx,5*65536+545
mov ecx,250*65536+14 mov ecx,212*65536+10
mov edx,11 mov edx,0x4000000B
int 0x40
; mov eax,8 ; LOAD BUTTON
mov ebx,15*65536+load_w
mov ecx,(30+18*11)*65536+14
mov edx,12
mov esi,[w_work_button] mov esi,[w_work_button]
int 0x40 int 0x40
; mov eax,8 ; SAVE BUTTON ; mov eax,8 ; SAVE BUTTON
mov ebx,280*65536+29 add ebx,(load_w+2)*65536-load_w+save_w
mov ecx,270*65536+14
mov edx,12
int 0x40
; mov eax,8 ; LOAD BUTTON
add ebx,30*65536
inc edx inc edx
int 0x40 int 0x40
; mov eax,8 ; 3D ; mov eax,8 ; 3D
mov ebx,15*65536+35 mov ebx,(340-t1.size*6-13)*65536+(5*2+6*4)
mov ecx,275*65536+14
inc edx inc edx
int 0x40 int 0x40
; mov eax,8 ; FLAT ; mov eax,8 ; FLAT
if lang eq ru add ebx,(5*2+6*4+2)*65536-(5*2+6*4)+flat_w
add ebx,40*65536+7
else
add ebx,40*65536
end if
inc edx inc edx
int 0x40 int 0x40
; mov eax,8 ; APPLY BUTTON
add ebx,(flat_w+6+2)*65536-flat_w+apply_w
inc edx
int 0x40
; mov eax,8 ; LOAD SKIN BUTTON
mov ebx,(336+(555-335)/2-t2.size*6/2)*65536+load_w
inc edx
int 0x40
; mov eax,8 ; APPLY SKIN BUTTON
add ebx,(load_w+6+2)*65536-load_w+apply_w
inc edx
int 0x40
mov eax, 4 mov eax, 4
mov ebx, 281*65536+254 mov ebx, (339-t1.size*6-12)*65536+(30+18*11+4)
mov ecx, [w_work_button_text] mov ecx, [w_work_button_text]
mov edx, t1 mov edx, t1
mov esi, t1.size mov esi, t1.size
int 0x40 int 0x40
; mov eax, 4 mov ebx,(336+(555-335)/2-t2.size*6/2)*65536+(30+18*11+4)
mov ebx, 277*65536+274
mov edx,t2 mov edx,t2
mov esi,t2.size mov esi,t2.size
int 0x40 int 0x40
mov eax,38 ; R G B COLOR GLIDES mov eax,38 ; R G B COLOR GLIDES
mov ebx,280*65536+300 ;295 mov ebx,266*65536+285
mov ecx,30*65536+30 mov ecx,30*65536+30
mov edx,0xff0000 mov edx,0xff0000
.newl: .newl:
@ -476,37 +776,50 @@ end if
mov edx,31 ; BUTTON ROW mov edx,31 ; BUTTON ROW
mov ebx,15*65536+200 mov ebx,15*65536+200
mov ecx,35*65536+14 mov ecx,30*65536+14
mov esi,[w_work_button] mov esi,[w_work_button]
newb: newb:
mov eax,8 mov eax,8
int 0x40 int 0x40
add ecx,20*65536 add ecx,18*65536
inc edx inc edx
cmp edx,40 cmp edx,40
jbe newb jbe newb
; mov eax,8 ; APPLY BUTTON mov ebx,15*65536+34 ; ROW OF TEXTS
add ecx,20*65536
mov edx,51
int 0x40
mov ebx,20*65536+39 ; ROW OF TEXTS
mov ecx,[w_work_button_text] mov ecx,[w_work_button_text]
mov edx,text mov edx,text
mov esi,32 mov esi,32
newline: newline:
mov eax,4 mov eax,4
int 0x40 int 0x40
add ebx,20 add ebx,18
add edx,32 add edx,32
cmp [edx],byte 'x' cmp [edx],byte 'x'
jne newline jne newline
call draw_colours call draw_colours
mcall 13,<5,546>,<212,11>,[w_work]
mcall 13,<337,7>,<2,250>,[w_frame]
shr edx,1
and edx,0x007F7F7F
mcall 38,<336,336>,<20,250>
add ebx,0x00080008
mcall
sub ebx,0x00040004
mcall ,,<0,255>
mcall ,<5,550>,<211,211>
add ecx,0x000C000C
mcall
call print_text call print_text
cmp dword[0x18000+SKIN_HEADER.ident],'SKIN'
jne @f
call draw_skin
@@:
mov eax,12 ; function 12:tell os about windowdraw mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw mov ebx,2 ; 2, end of draw
int 0x40 int 0x40
@ -528,8 +841,7 @@ lsz text,\
ru, ' ’…Š‘’ <20><EFBFBD>Ž—…‰ Ž<>ˆ ',\ ru, ' ’…Š‘’ <20><EFBFBD>Ž—…‰ Ž<>ˆ ',\
ru, ' ƒ<>€”ˆŠ€ <20><EFBFBD>Ž—…‰ Ž<>ˆ ',\ ru, ' ƒ<>€”ˆŠ€ <20><EFBFBD>Ž—…‰ Ž<>ˆ ',\
ru, ' ',\ ru, ' ',\
ru, ' <20><>ˆŒ…<C592>ˆœ ',\ ru, ' ‡€ƒ<E282AC>“‡ˆœ Ž•<C5BD><EFBFBD>ˆœ ',\
ru, ' 3D <20>ŽŠ ',\
ru, 'x',\ ru, 'x',\
en, ' WINDOW FRAME ',\ en, ' WINDOW FRAME ',\
en, ' WINDOW GRAB BAR ',\ en, ' WINDOW GRAB BAR ',\
@ -542,25 +854,27 @@ lsz text,\
en, ' WINDOW WORK AREA TEXT ',\ en, ' WINDOW WORK AREA TEXT ',\
en, ' WINDOW WORK AREA GRAPH ',\ en, ' WINDOW WORK AREA GRAPH ',\
en, ' ',\ en, ' ',\
en, ' APPLY CHANGES ',\ en, ' LOAD SAVE ',\
en, ' 3D FLAT ',\
en, 'x' en, 'x'
lsz t2,\
ru, ' ‡€ƒ<E282AC> Ž•<C5BD> ',\
en, ' LOAD SAVE '
lsz t1,\ lsz t1,\
ru, ' ”€‰‹ ',\ ru, ' 3D <20>ŽŠˆ<20><>ˆŒ…<C592>ˆœ ',\
en, ' FILENAME ' en, ' 3D FLAT APPLY '
lsz t2,\
ru, ' ‡€ƒ<E282AC>“‡ˆœ <20><>ˆŒ…<C592>ˆœ ',\
en, ' LOAD APPLY ',\
lsz test_text,\
ru, '‡ £®«®¢®ª',\
en, 'Caption'
lsz labelt,\ lsz labelt,\
ru, '<27><E28098>Ž‰Š€ –‚…’Ž‚',\ ru, '<27><E28098>Ž‰Š€ –‚…’Ž‚',\
en, 'DESKTOP COLOURS - DEFINE COLOR AND CLICK ON TARGET' en, 'DESKTOP COLOURS - DEFINE COLOR AND CLICK ON TARGET'
sz default_skn, '/RD/1/DEFAULT.SKN',0
sz default_file, '/RD/1/DEFAULT.DTP'
color dd 0 color dd 0
@ -583,6 +897,14 @@ virtual at read_info
.workarea dd ? .workarea dd ?
end virtual end virtual
skin_info:
.mode dd ?
.start_block dd ?
.blocks dd ?
.address dd ?
.workarea dd ?
.fname rb 256+1
app_colours: app_colours:
w_frame dd ? w_frame dd ?

View File

@ -197,17 +197,30 @@ macro mov arg1,arg2
} }
macro struct name ; structure definition helper
macro struct name, [arg]
{ {
virtual at 0 common
name name name@struct equ name
sizeof.#name = $ - name struc name arg {
end virtual
} }
; structures used in MeOS macro struct_helper name
struc process_information
{ {
match xname,name
\{
virtual at 0
xname xname
sizeof.#xname = $ - xname
name equ sizeof.#xname
end virtual
\}
}
ends fix } struct_helper name@struct
; structures used in MeOS
struct process_information
.cpu_usage dd ? ; +0 .cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4 .window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6 .window_stack_value dw ? ; +6
@ -222,11 +235,9 @@ struc process_information
.y_size dd ? ; +46 .y_size dd ? ; +46
.slot_state dw ? ; +50 .slot_state dw ? ; +50
rb (1024-52) rb (1024-52)
} ends
struct process_information
struc system_colors struct system_colors
{
.frame dd ? .frame dd ?
.grab dd ? .grab dd ?
.grab_button dd ? .grab_button dd ?
@ -237,8 +248,7 @@ struc system_colors
.work_button_text dd ? .work_button_text dd ?
.work_text dd ? .work_text dd ?
.work_graph dd ? .work_graph dd ?
} ends
struct system_colors
; constants ; constants

View File

@ -30,12 +30,6 @@ include "macros.inc"
db "MenuetOS RE #8",13,10 db "MenuetOS RE #8",13,10
START: START:
; load system colors
mcall 58, read_info
; set system colors
mcall 48, 2, sc, sizeof.system_colors
; set stretch backgound ; set stretch backgound
mcall 15, 4, 2 mcall 15, 4, 2
@ -96,14 +90,6 @@ START:
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
read_info:
.mode dd 0
.start_block dd 0
.blocks dd 1
.address dd sc
.workarea dd work_area
.path db "/rd/1/myblue.dtp",0
start_info: start_info:
.mode dd 16 .mode dd 16
dd 0 dd 0
@ -122,9 +108,6 @@ boot db 'BOOT',0
I_END: I_END:
;rd 256 ;rd 256
sc system_colors
rb 512-40
align 32 align 32
work_area: work_area:

View File

@ -0,0 +1,328 @@
; GIF LITE v2.0 by Willow
; Written in pure assembler by Ivushkin Andrey aka Willow
;
; This include file will contain functions to handle GIF image format
;
; Created: August 15, 2004
; Last changed: September 9, 2004
; Change COLOR_ORDER in your program
; if colors are displayed improperly
if ~ (COLOR_ORDER in <MENUETOS,OTHER>)
; This message may not appear under MenuetOS, so watch...
display 'Please define COLOR_ORDER: MENUETOS or OTHER',13,10
end if
; virtual structure, used internally
struc GIF_list
{
.NextImg rd 1
.Left rw 1
.Top rw 1
.Width rw 1
.Height rw 1
}
struc GIF_info
{
.Left rw 1
.Top rw 1
.Width rw 1
.Height rw 1
}
_null fix 0x1000
; ****************************************
; FUNCTION GetGIFinfo - retrieve Nth image info
; ****************************************
; in:
; esi - pointer to image list header
; ecx - image_index (0...img_count-1)
; edi - pointer to GIF_info structure to be filled
; out:
; eax - pointer to RAW data, or 0, if error
GetGIFinfo:
push esi ecx edi
xor eax,eax
jecxz .eloop
.lp:
mov esi,[esi]
test esi,esi
jz .error
loop .lp
.eloop:
add esi,4
movsd
movsd
mov eax,esi
.error:
pop edi ecx esi
ret
; ****************************************
; FUNCTION ReadGIF - unpacks GIF image
; ****************************************
; in:
; esi - pointer to GIF file in memory
; edi - pointer to output image list
; eax - pointer to work area (MIN 16 KB!)
; out:
; eax - 0, all OK;
; eax - 1, invalid signature;
; eax >=8, unsupported image attributes
;
; ecx - number of images
ReadGIF:
push esi edi
mov [.table_ptr],eax
mov [.cur_info],edi
xor eax,eax
mov [.globalColor],eax
mov [.img_count],eax
inc eax
cmp dword[esi],'GIF8'
jne .er ; signature
mov ecx,[esi+0xa]
inc eax
add esi,0xd
mov edi,esi
bt ecx,7
jnc .nextblock
mov [.globalColor],esi
call .Gif_skipmap
.nextblock:
cmp byte[edi],0x21
jne .noextblock
inc edi
cmp byte[edi],0xf9 ; Graphic Control Ext
jne .no_gc
add edi,7
jmp .nextblock
.no_gc:
cmp byte[edi],0xfe ; Comment Ext
jne .no_comm
inc edi
.block_skip:
movzx eax,byte[edi]
lea edi,[edi+eax+1]
cmp byte[edi],0
jnz .block_skip
inc edi
jmp .nextblock
.no_comm:
cmp byte[edi],0xff ; Application Ext
jne .nextblock
add edi,13
jmp .block_skip
.noextblock:
cmp byte[edi],0x2c ; image beginning
jne .er
inc [.img_count]
inc edi
mov esi,[.cur_info]
add esi,4
xchg esi,edi
movsd
movsd
push edi
movzx ecx,word[esi]
inc esi
bt ecx,7
jc .uselocal
push [.globalColor]
mov edi,esi
jmp .setPal
.uselocal:
call .Gif_skipmap
push esi
.setPal:
movzx ecx,byte[edi]
inc ecx
mov [.codesize],ecx
dec ecx
pop [.Palette]
lea esi,[edi+1]
mov edi,[.table_ptr]
xor eax,eax
cld
lodsb ; eax - block_count
add eax,esi
mov [.block_ofs],eax
mov [.bit_count],8
mov eax,1
shl eax,cl
mov [.CC],eax
inc eax
mov [.EOI],eax
lea ecx,[eax-1]
mov eax, _null shl 16
.filltable:
stosd
inc eax
loop .filltable
pop edi
mov [.img_start],edi
.reinit:
mov edx,[.EOI]
inc edx
push [.codesize]
pop [.compsize]
call .Gif_get_sym
cmp eax,[.CC]
je .reinit
call .Gif_output
.cycle:
movzx ebx,ax
call .Gif_get_sym
cmp eax,edx
jae .notintable
cmp eax,[.CC]
je .reinit
cmp eax,[.EOI]
je .end
call .Gif_output
.add:
push eax
mov eax,[.table_ptr]
mov [eax+edx*4],ebx
pop eax
cmp edx,0xFFF
jae .cycle
inc edx
bsr ebx,edx
cmp ebx,[.compsize]
jne .noinc
inc [.compsize]
.noinc:
jmp .cycle
.notintable:
push eax
mov eax,ebx
call .Gif_output
push ebx
movzx eax,bx
call .Gif_output
pop ebx eax
jmp .add
.er:
pop edi
jmp .ex
.end:
mov eax,[.cur_info]
mov [eax],edi
mov [.cur_info],edi
add esi,2
xchg esi,edi
.nxt:
cmp byte[edi],0
jnz .continue
inc edi
jmp .nxt
.continue:
cmp byte[edi],0x3b
jne .nextblock
xor eax,eax
stosd
mov ecx,[.img_count]
.ex:
pop edi esi
ret
.Gif_skipmap:
; in: ecx - image descriptor, esi - pointer to colormap
; out: edi - pointer to area after colormap
and ecx,111b
inc ecx ; color map size
mov ebx,1
shl ebx,cl
lea ebx,[ebx*2+ebx]
lea edi,[esi+ebx]
ret
.Gif_get_sym:
mov ecx,[.compsize]
push ecx
xor eax,eax
.shift:
ror byte[esi],1
rcr eax,1
dec [.bit_count]
jnz .loop1
inc esi
cmp esi,[.block_ofs]
jb .noblock
push eax
xor eax,eax
lodsb
test eax,eax
jnz .nextbl
mov eax,[.EOI]
sub esi,2
add esp,8
jmp .exx
.nextbl:
add eax,esi
mov [.block_ofs],eax
pop eax
.noblock:
mov [.bit_count],8
.loop1:
loop .shift
pop ecx
rol eax,cl
.exx:
xor ecx,ecx
ret
.Gif_output:
push esi eax edx
mov edx,[.table_ptr]
.next:
push word[edx+eax*4]
mov ax,word[edx+eax*4+2]
inc ecx
cmp ax,_null
jnz .next
shl ebx,16
mov bx,[esp]
.loop2:
pop ax
lea esi,[eax+eax*2]
add esi,[.Palette]
if COLOR_ORDER eq MENUETOS
mov esi,[esi]
bswap esi
shr esi,8
mov [edi],esi
add edi,3
else
movsw
movsb
end if
loop .loop2
pop edx eax esi
ret
.globalColor rd 1
.img_count rd 1
.cur_info rd 1 ; image table pointer
.img_start rd 1
.codesize rd 1
.compsize rd 1
.bit_count rd 1
.CC rd 1
.EOI rd 1
.Palette rd 1
.block_ofs rd 1
.table_ptr rd 1

File diff suppressed because it is too large Load Diff

View File

@ -124,6 +124,7 @@ start_end:
start_menu: start_menu:
mcall 18,12 mcall 18,12
mov [button_presssed_alt],eax mov [button_presssed_alt],eax
mov [draw_window_1],1
; mov ecx,eax ; mov ecx,eax
; mcall 47,0x40100, ,10 shl 16+5,0 ; mcall 47,0x40100, ,10 shl 16+5,0
; mov eax,ecx ; mov eax,ecx
@ -159,6 +160,27 @@ start_menu:
je start_menu_application je start_menu_application
cmp ah,83 ;62 cmp ah,83 ;62
je kill_active_application je kill_active_application
cmp ah,71 ;179
jne no_test_179
cmp [page_list],15
je @f
inc [page_list]
mov [draw_window_1],1
@@:
jmp begin
no_test_179:
cmp ah,72 ;180
jne no_test_180
cmp [page_list],0
je @f
dec [page_list]
mov [draw_window_1],1
@@:
jmp begin
no_test_180:
jmp begin jmp begin
button_presssed_alt dd 0 button_presssed_alt dd 0
@ -239,6 +261,9 @@ START:
cmp [esi],byte 'x' cmp [esi],byte 'x'
jne new_number jne new_number
mcall 14
mov [screen_size],eax
mcall 48,5 mcall 48,5
mov ecx,eax mov ecx,eax
lea edx,[ebx-PANEL_HEIGHT-1] lea edx,[ebx-PANEL_HEIGHT-1]
@ -280,6 +305,22 @@ still:
jmp still jmp still
red: ; redraw window red: ; redraw window
mcall 14
movzx ecx,ax
mov edx,eax
shr edx,16
cmp [screen_size.height],ax
jne @f
rol eax,16
cmp [screen_size.width],ax
je .lp1
rol eax,16
@@: mov [screen_size],eax
sub ecx,PANEL_HEIGHT
mcall 67,0,,,PANEL_HEIGHT
.lp1:
call draw_window call draw_window
call draw_info call draw_info
jmp still jmp still
@ -419,6 +460,26 @@ still:
call setup_music call setup_music
noid20: noid20:
cmp ah,21
jnz noid21
cmp [page_list],15
je @f
inc [page_list]
jmp red
@@:
jmp still
noid21:
cmp ah,22
jnz noid22
cmp [page_list],0
je @f
dec [page_list]
jmp red
@@:
jmp still
noid22:
jmp still jmp still
@ -449,6 +510,16 @@ draw_running_applications:
mov edi,0 mov edi,0
mov ecx,2 mov ecx,2
mov [contrast],0 mov [contrast],0
mov eax,[max_applications]
mov ebx,[page_list]
xor edx,edx
mul ebx
cmp eax,0
je @f
inc eax
@@:
mov [draw_start_position],eax
newpr: newpr:
@ -464,15 +535,22 @@ draw_running_applications:
cmp byte [0x8000+10], '@' cmp byte [0x8000+10], '@'
je norpl je norpl
cmp [0x8000+11],dword 'CON ' cmp [0x8000+10],dword 'ICON'
jne .noicon
cmp dword[0x8000+42],51
jne .noicon
cmp dword[0x8000+46],51
je norpl je norpl
.noicon:
cmp [0x8000+11],dword 'ENU ' cmp [0x8000+11],dword 'ENU '
je norpl je norpl
; cmp [0x8000+12],dword 'NEL ' ; cmp [0x8000+12],dword 'NEL '
; je norpl ; je norpl
cmp [0x8000+10],dword ' ' cmp [0x8000+10],dword ' '
je norpl je norpl
dec [draw_start_position]
cmp [draw_start_position],0
jg norpl
mov eax,13 mov eax,13
mov ebx,edi mov ebx,edi
inc ebx inc ebx
@ -562,6 +640,16 @@ contrast2:
calculate_applications: calculate_applications:
mov eax,[max_applications]
mov ebx,[page_list]
xor edx,edx
mul ebx
cmp eax,0
je @f
inc eax
@@:
mov [draw_start_position],eax
mov edi,app_list mov edi,app_list
mov ecx,20 mov ecx,20
mov eax,0xff mov eax,0xff
@ -579,6 +667,13 @@ calculate_applications:
cmp byte [0x8000+10], '@' cmp byte [0x8000+10], '@'
je cnorpl je cnorpl
cmp [0x8000+10],dword 'ICON'
jne .noicon
cmp dword[0x8000+42],51
jne .noicon
cmp dword[0x8000+46],51
je cnorpl
.noicon:
cmp [0x8000+11],dword 'CON ' cmp [0x8000+11],dword 'CON '
je cnorpl je cnorpl
cmp [0x8000+11],dword 'ENU ' cmp [0x8000+11],dword 'ENU '
@ -587,6 +682,9 @@ calculate_applications:
; je cnorpl ; je cnorpl
cmp [0x8000+10],dword ' ' cmp [0x8000+10],dword ' '
je cnorpl je cnorpl
dec [draw_start_position]
cmp [draw_start_position],0
jg cnorpl
mov [app_list+edi*4],ecx mov [app_list+edi*4],ecx
@ -619,15 +717,15 @@ draw_application_buttons:
now1: now1:
cmp eax,799 cmp eax,799
jne now2 jne now2
mov [max_applications],10 ;8 mov [max_applications],9 ;10 ;8
now2: now2:
cmp eax,1023 cmp eax,1023
jne now3 jne now3
mov [max_applications],13 ;8 mov [max_applications],12 ;13 ;8
now3: now3:
cmp eax,1279 cmp eax,1279
jne now4 jne now4
mov [max_applications],18 ;8 mov [max_applications],17 ;18 ;8
now4: now4:
mov edi,1 mov edi,1
@ -1041,6 +1139,7 @@ draw_window:
mov eax,38 mov eax,38
cmp [soften_up],1 cmp [soften_up],1
jne no_su jne no_su
and edx,0x00FFFFFF
int 0x40 int 0x40
no_su: no_su:
@ -1053,6 +1152,7 @@ draw_window:
add edi,[b_size_y] add edi,[b_size_y]
add ecx,edi add ecx,edi
sub ecx,3*65536+3 sub ecx,3*65536+3
and edx,0x00FFFFFF
int 0x40 int 0x40
no_sd: no_sd:
popa popa
@ -1073,6 +1173,7 @@ draw_window:
add esi,4 add esi,4
mov eax,38 mov eax,38
and edx,0x00FFFFFF
int 0x40 int 0x40
add ecx,1*65536+1 add ecx,1*65536+1
cmp cx,15 cmp cx,15
@ -1551,6 +1652,15 @@ draw_info: ; draw cpu usage, time, date
sub ebx,14 shl 16 sub ebx,14 shl 16
inc edx ;button 20 inc edx ;button 20
int 0x40 int 0x40
sub ebx,12 shl 16
mov bx,8
mov ecx,6 shl 16+10
inc edx ;button 21
int 0x40
sub ebx,18 shl 16
inc edx ;button 22
int 0x40
; flags ; flags
mov eax,26 mov eax,26
@ -1655,6 +1765,45 @@ dalshe:
add ebx,1 shl 16 add ebx,1 shl 16
int 0x40 int 0x40
mov edx,0
mov eax,13
mov ebx,[maxx]
sub ebx,134
shl ebx,16
mov bx,9
mov ecx,6 shl 16+11
int 0x40
sub ebx,18 shl 16
int 0x40
add ebx,19 shl 16
sub bx,2
mov ecx,7 shl 16+9
mov edx,0xffffff
int 0x40
sub ebx,18 shl 16
int 0x40
mov eax,4
mov edx,page_a1
mov ebx,[maxx]
sub ebx,150
shl ebx,16
mov bx,8
mov esi,4
int 0x40
add ebx,1 shl 16
int 0x40
mov eax,47
mov ebx,0x10100
mov ecx,[page_list]
mov edx,[maxx]
sub edx,141
shl edx,16
mov dx,7
mov esi,0xffffff
int 0x40
; sub ebx,14 shl 16 ; sub ebx,14 shl 16
; mov bx,7 ; mov bx,7
; mov edx,turn_text ; mov edx,turn_text
@ -1857,9 +2006,6 @@ draw_cpu_usage:
ret ret
; DATA ; DATA
stripe: stripe:
@ -1923,6 +2069,10 @@ contrast db 0
running_applications dd 0x100 running_applications dd 0x100
max_applications dd 11 max_applications dd 11
page_list dd 0
draw_start_position dd 0
draw_window_1 db 0
b_size_y: dd 0x0 b_size_y: dd 0x0
ysi dd 0 ysi dd 0
small_draw dd 0x0 small_draw dd 0x0
@ -1930,6 +2080,7 @@ small_draw dd 0x0
ptime dd 0x0 ptime dd 0x0
maxx dd 0x0 maxx dd 0x0
text db '0123456789' text db '0123456789'
page_a1 db '< >'
bte dd 0xccddee bte dd 0xccddee
wcolor dd 0x506070 wcolor dd 0x506070
@ -1942,6 +2093,11 @@ screenxy dd 0x0
stcount dd 0x0 stcount dd 0x0
I_END: I_END:
screen_size:
.height dw ?
.width dw ?
area9 rb 100 area9 rb 100
system_colours rd 10 system_colours rd 10
app_list rd 50 app_list rd 50

File diff suppressed because it is too large Load Diff

View File

@ -258,12 +258,10 @@ restore_mode:
push eax push eax
push ebx push ebx
push edx push edx
call kill_all
mov eax,21 mov eax,21
mov ebx,13 mov ebx,13
mov ecx,4 mov ecx,4
int 40h int 40h
call ref_screen
pop edx pop edx
pop ecx pop ecx
pop eax pop eax
@ -279,7 +277,6 @@ set_my_mode:
mov eax,[currvm] mov eax,[currvm]
mov [oldvm],eax mov [oldvm],eax
mov [currvm],edx mov [currvm],edx
call kill_all
pop edx pop edx
push edx push edx
mov eax,21 mov eax,21
@ -289,7 +286,6 @@ set_my_mode:
pop edx pop edx
pop ebx pop ebx
pop ecx pop ecx
call ref_screen
retn retn
; IN: eax = 0/1 - -/+ 1Hz ; IN: eax = 0/1 - -/+ 1Hz
@ -307,23 +303,6 @@ inc_dec_rate:
pop ebx pop ebx
retn retn
ref_screen:
push eax
push ebx
push ecx
mov eax,5
mov ebx,100
int 40h
mov eax,19
mov ebx,strt
xor ecx,ecx
int 40h
pop ecx
pop ebx
pop eax
retn
get_pid: get_pid:
mov eax,9 mov eax,9
mov ebx,buffer mov ebx,buffer
@ -353,28 +332,6 @@ get_vert_rate:
mov [currvm],ecx mov [currvm],ecx
retn retn
kill_all:
call get_pid
mov ecx,[totp]
ka_loc_00:
push ecx
push ecx
mov eax,9
mov ebx,buffer
int 40h
pop ecx
mov eax,[mypid]
cmp eax,[ebx+30]
je ka_loc_02
mov eax,18
mov ebx,2
int 40h
ka_loc_02:
pop ecx
loop ka_loc_00
retn
get_initial_videomode: get_initial_videomode:
retn retn