Fix for DESKTOP colors select.

git-svn-id: svn://kolibrios.org@3271 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Marat Zakiyanov (Mario79) 2013-02-24 19:52:43 +00:00
parent 4fe36c5853
commit b4d539ba9c
2 changed files with 539 additions and 597 deletions

View File

@ -1,5 +0,0 @@
@echo lang fix en >lang.inc
@fasm -m 16384 tinypad.asm tinypad
@erase lang.inc
@kpack tinypad
@pause

View File

@ -16,7 +16,7 @@
dd 1 ; header version
dd START ; start address
dd I_END ; file size
dd i_end ;28000h ; memory
dd i_end ; memory
dd stacktop ; stack pointer
dd skin_info ; parameters
dd cur_dir_path ; path to file
@ -71,7 +71,7 @@ struct SKIN_BITMAPS
_data dd ?
ends
;---------------------------------------------------------------------
START: ; start of execution
;---------------------------------------------------------------------
mcall 68,11
@ -82,11 +82,9 @@ START: ; start of execution
load_libraries l_libs_start,end_l_libs
;if return code =-1 then exit, else nornary work
; cmp eax,-1
inc eax
test eax,eax
jz close
;---------------------------------------------------------------------
mov edi,filename_area
mov esi,start_temp_file_name
@ -109,21 +107,6 @@ load_libraries l_libs_start,end_l_libs
test eax,eax
jnz @b
;---------------------------------------------------------------------
; mov esi, param
; cmp byte [esi], 0
; je @f
; jnz has_param
; mov esi,default_skn
; mov edi,fname
; mov ecx,default_skn.size
; rep movsb
; jmp skin_path_ready
;has_param:
; mov ecx, 256/4
; mov edi, fname
; rep movsd
; skin_path_ready
;---------------------------------------------------------------------
mov edi,skin_info
cmp byte [edi], 0
@ -152,27 +135,14 @@ skin_path_ready:
push dword PathShow_data_2
call [PathShow_prepare]
;---------------------------------------------------------------------
mov eax,48 ; get current colors
mov ebx,3
mov ecx,color_table
mov edx,4*10
mcall
mcall 48,3,color_table,4*10 ; get current colors
call load_skin_file.2
; mov esi, default_dtp
; mov edi, fname
; mov ecx, default_dtp.size
; rep movsb
;---------------------------------------------------------------------
red:
call draw_window ; at first, draw the window
;---------------------------------------------------------------------
still:
mov eax,23 ; wait here for event
mov ebx,5
mcall
mcall 23,5 ; wait here for event
dec eax ; redraw request ?
jz red
@ -184,84 +154,79 @@ still:
call draw_cursor
jmp still
key: ; key
mov al,2 ; just read it and ignore
mcall
;---------------------------------------------------------------------
key: ; key
mcall 2 ; just read it and ignore
jmp still
button: ; button
mov al,17 ; get id
mcall
; cmp ah,11 ; read string
; jne no_string
; call read_string
; jmp still
; no_string:
;---------------------------------------------------------------------
button: ; button
mcall 17 ; get id
cmp ah,12 ; load file
jne no_load
call load_file
call draw_window
jmp still
no_load:
;--------------------------------------
no_load:
cmp ah,13 ; save file
jne no_save
call save_file
jmp still
no_save:
;--------------------------------------
no_save:
cmp ah,14 ; set 3d buttons
jne no_3d
mov eax,48
mov ebx,1
mov ecx,1
mcall
jmp doapply
no_3d:
mcall 48,1,1
jmp doapply
;--------------------------------------
no_3d:
cmp ah,15 ; set flat buttons
jne no_flat
mcall 48, 1, 0
;--------------------------------------
doapply:
mcall 48, 0, 0
jmp still
no_flat:
;--------------------------------------
no_flat:
cmp ah,16 ; apply
jne no_apply
apply_direct:
mov eax,48
mov ebx,2
mov ecx,color_table
mov edx,10*4
mcall
;--------------------------------------
apply_direct:
mcall 48,2,color_table,10*4
jmp doapply
;--------------------------------------
no_apply:
cmp ah,17 ; load skin file
jne no_load_skin
call load_skin_file
call draw_window
jmp still
no_load_skin:
;--------------------------------------
no_load_skin:
cmp ah,18 ; apply skin
jne no_apply_skin
cmp [skin_info],0
je no_apply_skin
mcall 48,8,skin_info
call draw_window
jmp still
no_apply_skin:
;--------------------------------------
no_apply_skin:
cmp ah,31
jb no_new_colour
cmp ah,41
jg no_new_colour
shr eax,8
sub eax,31
shl eax,2
@ -269,59 +234,56 @@ doapply:
mov [eax+color_table],ebx
cmp dword[not_packed_area+SKIN_HEADER.ident],'SKIN'
jne @f
mov edi,[not_packed_area+SKIN_HEADER.params]
mov dword[edi+not_packed_area+SKIN_PARAMS.dtp.data+eax],ebx
call draw_skin
@@: call draw_colours
;--------------------------------------
@@:
call draw_colours
jmp still
no_new_colour:
;--------------------------------------
no_new_colour:
cmp ah,1 ; terminate
jnz noid1
;--------------------------------------
close:
or eax,-1
mcall
noid1:
;--------------------------------------
noid1:
jmp still
;---------------------------------------------------------------------
draw_cursor:
pusha
mov eax,37
mov ebx,2
mcall
mcall 37,2
cmp eax,0
jne dc1
popa
ret
dc1:
mov eax,37
mov ebx,1
mcall
;--------------------------------------
dc1:
mcall 37,1
mov ebx,eax
shr ebx,16
mov ecx,eax
and ecx,0xffff
cmp ecx,32
cmp ecx,29
jbe no_color
cmp ebx,32
jbe no_color
cmp ebx,266 ; CHANGE COLOR
jb no_color
cmp ebx,266+20*3
jg no_color
cmp ecx,30+128
jge no_color
cmp ecx,30
cmp ecx,29
jb no_color
sub ebx,266
@ -331,22 +293,15 @@ draw_cursor:
div ebx
mov ebx,2
sub ebx,eax
add ecx,-30
not ecx
shl ecx,1
mov byte [ebx+color],cl
call draw_color
no_color:
popa
ret
no_color:
popa
ret
;---------------------------------------------------------------------
load_file:
;---------------------------------------------------------------------
@ -390,8 +345,8 @@ load_skin_file:
call draw_PathShow
;---------------------------------------------------------------------
.2:
xor eax, eax
mov ebx, read_info2
xor eax,eax
mov ebx,read_info2
mov dword [ebx], eax ; subfunction: read
mov dword [ebx+4], eax ; offset (low dword)
mov dword [ebx+8], eax ; offset (high dword)
@ -403,26 +358,23 @@ load_skin_file:
cmp dword [esi], 'KPCK'
jnz notpacked
cmp dword [esi+4], 32*1024 ; max 32 KBytes
ja doret
push unpack_area
push esi
call unpack
mov esi, unpack_area
mov esi,unpack_area
;--------------------------------------
notpacked:
cmp dword[esi+SKIN_HEADER.ident],'SKIN'
cmp [esi+SKIN_HEADER.ident],dword 'SKIN'
jne doret
mov edi,not_packed_area
mov ecx,0x8000/4
rep movsd
; mov esi,fname
; mov edi,skin_info.fname
; mov ecx,257
; rep movsb
mov ebp,not_packed_area
mov esi,[ebp+SKIN_HEADER.params]
add esi,ebp
@ -430,10 +382,9 @@ notpacked:
mov edi,color_table
mov ecx,10
rep movsd
doret:
ret
;--------------------------------------
doret:
ret
;---------------------------------------------------------------------
save_file:
;---------------------------------------------------------------------
@ -451,53 +402,33 @@ save_file:
call draw_PathShow
;---------------------------------------------------------------------
mov ebx, write_info
mov dword [ebx], 2 ; subfunction: write
and dword [ebx+4], 0 ; (reserved)
and dword [ebx+8], 0 ; (reserved)
mov dword [ebx+12], 10*4 ; bytes to write
mov dword [ebx+16], color_table ; address
xor eax,eax
mov ebx,write_info
mov [ebx],dword 2 ; subfunction: write
and [ebx+4],eax ; (reserved)
and [ebx+8],eax ; (reserved)
mov [ebx+12],dword 10*4 ; bytes to write
mov [ebx+16],dword color_table ; address
mcall 70
ret
;---------------------------------------------------------------------
draw_color:
pusha
mov eax,13
mov ebx,266*65536+60
mov ecx,170*65536+30
mov edx,[color]
mcall
; mov eax,13
mov ebx,266*65536+60
mov ecx,200*65536+10
mov edx,[w_work]
mcall
mov eax,47
mov ebx,0+1*256+8*65536
mov ecx,[color]
mov edx,272*65536+201
mov esi,[w_work_text]
mcall
mcall 13,<266,60>,<170,30>,[color]
mcall ,,<200,10>,[w_work]
mcall 47,<8,0+1*256>,[color],<272,201>,[w_work_text]
popa
ret
;----------------------------------------------------------------------
draw_colours:
pusha
mov esi,color_table
mov ebx,225*65536+32
mov ecx,32*65536+12
newcol:
mov eax,13
;--------------------------------------
newcol:
mov edx,[esi]
mcall
mcall 13
add ecx,18*65536
add esi,4
cmp esi,color_table+4*9
@ -535,31 +466,48 @@ find_bitmap:
mov edi,[ebp+SKIN_HEADER.bitmaps]
add edi,ebp
xor ebx,ebx
.lp1: cmp dword[edi],0
;--------------------------------------
.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
;--------------------------------------
.lp2:
ret
;--------------------------------------
@@:
add edi,8
jmp .lp1
;----------------------------------------------------------------------
dec_edx:
sub dl,4
jnc @f
xor dl,dl
@@: sub dh,4
;--------------------------------------
@@:
sub dh,4
jnc @f
xor dh,dh
@@: rol edx,16
;--------------------------------------
@@:
rol edx,16
sub dl,4
jnc @f
xor dl,dl
@@: rol edx,16
;--------------------------------------
@@:
rol edx,16
ret
;----------------------------------------------------------------------
area:
@ -567,35 +515,37 @@ area:
.y = 20
.width = 206
.height = 191
;--------------------------------------
wnd1:
.x = area.x+49
.y = area.y+5
.width = 150
.height = 90
;--------------------------------------
wnd2:
.x = area.x+35
.y = area.y+35
.width = 150
.height = 90
;--------------------------------------
wnd3:
.x = area.x+21
.y = area.y+65
.width = 150
.height = 90
;--------------------------------------
wnd4:
.x = area.x+7
.y = area.y+95
.width = 150
.height = 90
;--------------------------------------
virtual at edi+SKIN_PARAMS.dtp.data
dtp system_colors
end virtual
;----------------------------------------------------------------------
draw_skin:
mcall 13,<area.x,area.width>,<area.y+2,area.height-2>,0x00FFFFFF
mov ebp,not_packed_area
mov edi,[ebp+SKIN_HEADER.params]
add edi,ebp
@ -604,13 +554,14 @@ draw_skin:
mov edx,[dtp.frame]
call draw_framerect
mcall 13,<wnd1.x+1,wnd1.width-2>,<wnd1.y+1,wnd1.height-2>,dword[dtp.work]
mov eax,38
mpack ebx,wnd1.x+1,wnd1.x+wnd1.width-2
mpack ecx,wnd1.y+1,wnd1.y+1
mov edx,[dtp.grab]
mov esi,20
@@: mcall
;--------------------------------------
@@:
mcall
call dec_edx
add ecx,0x00010001
dec esi
@ -619,12 +570,9 @@ draw_skin:
mov edi,[ebp+SKIN_HEADER.params]
add edi,ebp
mcall 4,<wnd1.x+6,wnd1.y+7>,dword[dtp.grab_text],caption_text,caption_text.size
mcall 8,<wnd1.x+wnd1.width-18,12>,<wnd1.y+4,12>,0,[dtp.grab_button]
mcall 4,<wnd1.x+wnd1.width-18+4,wnd1.y+4+2>,dword[dtp.grab_button_text],close_text,close_text.size
;----------------------------------------------------------------------
mov edi,[ebp+SKIN_HEADER.params]
add edi,ebp
mpack ebx,wnd2.x,wnd2.width
@ -649,7 +597,9 @@ draw_skin:
mpack ecx,wnd2.y+4,wnd2.y+4
mov edx,[dtp.grab]
mov esi,16
@@: mcall
;--------------------------------------
@@:
mcall
call dec_edx
add ecx,0x00010001
dec esi
@ -658,12 +608,9 @@ draw_skin:
mov edi,[ebp+SKIN_HEADER.params]
add edi,ebp
mcall 4,<wnd2.x+8,wnd2.y+7>,dword[dtp.grab_text],caption_text,caption_text.size
mcall 8,<wnd2.x+wnd2.width-20,12>,<wnd2.y+4,12>,0,[dtp.grab_button]
mcall 4,<wnd2.x+wnd2.width-20+4,wnd2.y+4+2>,dword[dtp.grab_button_text],close_text,close_text.size
;----------------------------------------------------------------------
mov edi,[ebp+SKIN_HEADER.params]
add edi,ebp
mpack ebx,wnd3.x,wnd3.width
@ -695,15 +642,18 @@ draw_skin:
shl edx,16
add edx,wnd3.x*65536+wnd3.y
mcall 7
@@: rol edx,16
;--------------------------------------
@@:
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
@ -725,9 +675,7 @@ draw_skin:
push eax
lea ebx,[eax+wnd3.x*65536+wnd3.y]
mcall 4,,dword[dtp.grab_text],caption_text,caption_text.size
;---------------------------------------------------------
mov edi,[ebp+SKIN_HEADER.params]
add edi,ebp
mpack ebx,wnd4.x,wnd4.width
@ -759,15 +707,18 @@ draw_skin:
shl edx,16
add edx,wnd4.x*65536+wnd4.y
mcall 7
@@: rol edx,16
;--------------------------------------
@@:
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
@ -783,13 +734,14 @@ draw_skin:
pop eax
lea ebx,[eax+wnd4.x*65536+wnd4.y]
mcall 4,,dword[dtp.grab_text],caption_text,caption_text.size
;----------------------------------------------------------------------
mov edi,[ebp+SKIN_HEADER.buttons]
add edi,ebp
.lp1: cmp dword[edi],0
;--------------------------------------
.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]
@ -801,8 +753,8 @@ draw_skin:
mcall 8,,,0x40000000
add edi,12
jmp .lp1
.lp2:
;--------------------------------------
.lp2:
mov edi,[ebp+SKIN_HEADER.params]
add edi,ebp
mpack ebx,wnd4.x+10,wnd4.y+10
@ -823,7 +775,6 @@ draw_skin:
mov bx,cx
add ebx,0x00060006
mcall 4,,[dtp.work_button_text],button_text,button_text.size
ret
;---------------------------------------------------------------------
draw_PathShow:
@ -872,8 +823,6 @@ else
end if
; LOAD BUTTON
; mov ebx,15*65536+load_w
; mov ecx,(35+18*12)*65536+14
mcall 8,<15,load_w>,<35+18*12,14>,12,[w_work_button]
; SAVE BUTTON
add ebx,(load_w+2)*65536-load_w+save_w
@ -1254,20 +1203,21 @@ communication_area_default_pach:
db '/sys',0
Filter:
dd Filter.end - Filter
dd Filter.end - Filter
.1:
db 'DTP',0
db 'DTP',0
.end:
db 0
db 0
Filter2:
dd Filter.end - Filter
dd Filter.end - Filter
.1:
db 'SKN',0
db 'SKN',0
.end:
db 0
db 0
start_temp_file_name: db 'default.dtp',0
start_temp_file_name:
db 'default.dtp',0
default_skin:
db '/sys/default.skn',0
@ -1331,9 +1281,6 @@ cur_dir_path:
library_path:
rb 4096
;---------------------------------------------------------------------
;fname_buf:
; rb 4096
;---------------------------------------------------------------------
temp_dir_pach:
rb 4096
;---------------------------------------------------------------------