calendar 1.35: usability optimization, bug fixed, code clean

git-svn-id: svn://kolibrios.org@3890 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2013-09-04 20:59:29 +00:00
parent 8cea9d046a
commit dcc2877e84
2 changed files with 30 additions and 62 deletions

View File

@ -1,6 +1,6 @@
; Calendar for KolibriOS ; Calendar for KolibriOS
; ;
; v1.3 - code update, redesign by Leency ; v1.35 - code update, redesign by Leency
; v1.1 - add change time support by DedOK ; v1.1 - add change time support by DedOK
; v1.0 - written in pure assembler by Ivushkin Andrey aka Willow ; v1.0 - written in pure assembler by Ivushkin Andrey aka Willow
; also - diamond, spraid, fedesco ; also - diamond, spraid, fedesco
@ -32,9 +32,9 @@ macro ShowFocus field,reg
cmp [focus],field cmp [focus],field
jne .nofocus jne .nofocus
if reg eq if reg eq
mov ecx,0x10e7c750;0x10ddeeff mov ecx,COL_ACTIVE_TEXT
else else
mov reg,0x10e7c750;0x10ddeeff mov reg,COL_ACTIVE_TEXT
end if end if
jmp .exit jmp .exit
.nofocus: .nofocus:
@ -107,7 +107,7 @@ still: ;
jne no_tab jne no_tab
.tab: .tab:
cmp ebp,FOCUSABLE cmp ebp,FOCUSABLE
je foc_cycle JAE foc_cycle
inc [focus] inc [focus]
upd: upd:
call calculate call calculate
@ -127,13 +127,6 @@ still: ;
mov [Month],edi mov [Month],edi
jmp upd jmp upd
.noFkey: .noFkey:
cmp ebp,4
jne no_spinner
cmp ah,176
je year_dec
cmp ah,179
je year_inc
no_spinner:
cmp ebp,2 cmp ebp,2
jne .nomonth jne .nomonth
cmp ah,177 cmp ah,177
@ -142,7 +135,7 @@ still: ;
.nomonth: .nomonth:
cmp ebp,3 cmp ebp,3
je noy_up.year_evt je noy_up.year_evt
cmp ebp,5 cmp ebp,4
jne still jne still
mov ebx,[day_sel] mov ebx,[day_sel]
cmp ah,176 ; left arrow cmp ah,176 ; left arrow
@ -181,7 +174,7 @@ day_bounds db -1,0,7,0,-7,0,1,0 ; left,down,up,right
call draw_days call draw_days
jmp still jmp still
.redraw: .redraw:
mov [focus],5 mov [focus],4
jmp red jmp red
nodayselect: nodayselect:
cmp ah,100 cmp ah,100
@ -250,14 +243,14 @@ day_bounds db -1,0,7,0,-7,0,1,0 ; left,down,up,right
jne noy_dn jne noy_dn
year_dec: year_dec:
dec [Year] dec [Year]
mov [focus],4 mov [focus],3
jmp upd jmp upd
noy_dn: noy_dn:
cmp ah,4 ; year+1 cmp ah,4 ; year+1
jne noy_up jne noy_up
year_inc: year_inc:
inc [Year] inc [Year]
mov [focus],4 mov [focus],3
jmp upd jmp upd
noy_up: noy_up:
cmp ah,5 cmp ah,5
@ -270,6 +263,11 @@ day_bounds db -1,0,7,0,-7,0,1,0 ; left,down,up,right
jne still.evt jne still.evt
mcall 2 mcall 2
.year_evt: .year_evt:
cmp ah,176
je year_dec
cmp ah,179
je year_inc
mov ebx,10 mov ebx,10
cmp ah,9 cmp ah,9
je key.tab je key.tab
@ -310,23 +308,17 @@ day_bounds db -1,0,7,0,-7,0,1,0 ; left,down,up,right
reset: reset:
mcall 3
mov eax,3
mcall
mov ecx,eax mov ecx,eax
shl ecx,16 shl ecx,16
shr ecx,16 shr ecx,16
mov eax,22 mcall 22,0x00000000
mov ebx,0x00000000
mcall
jmp still jmp still
plus_hd: plus_hd:
mcall 3 mcall 3
mov ecx,eax mov ecx,eax
add ecx,1 add ecx,1
mov eax,22
mcall 22,0x00000000 mcall 22,0x00000000
jmp still jmp still
@ -341,38 +333,24 @@ minus_hd:
mcall 3 mcall 3
mov ecx,eax mov ecx,eax
sub ecx,1 sub ecx,1
mov eax,22 mcall 22,0x00000000
mov ebx,0x00000000
mcall
jmp still jmp still
minus_he: minus_he:
mcall 3
mov eax,3
mcall
mov ecx,eax mov ecx,eax
sub ecx,16 sub ecx,16
mov eax,22 mcall 22,0x00000000
mov ebx,0x00000000
mcall
jmp still jmp still
plus_md: plus_md:
mcall 3
mov eax,3
mcall
mov ecx,eax mov ecx,eax
add ecx,256 add ecx,256
mov eax,22 mcall 22,0x00000000
mov ebx,0x00000000
mcall
jmp still jmp still
plus_me: plus_me:
mcall 3 mcall 3
mov ecx,eax mov ecx,eax
add ecx,4096 add ecx,4096
@ -380,7 +358,6 @@ plus_me:
jmp still jmp still
minus_md: minus_md:
mcall 3 mcall 3
mov ecx,eax mov ecx,eax
sub ecx,256 sub ecx,256
@ -388,7 +365,6 @@ minus_md:
jmp still jmp still
minus_me: minus_me:
mcall 3 mcall 3
mov ecx,eax mov ecx,eax
sub ecx,4096 sub ecx,4096
@ -396,7 +372,6 @@ minus_me:
jmp still jmp still
set_date: set_date:
mov eax,0x00000000 mov eax,0x00000000
mov ebx,[day_sel] mov ebx,[day_sel]
call additem call additem
@ -408,20 +383,15 @@ set_date:
mov ebx,[Year] mov ebx,[Year]
call additem call additem
mov ecx,eax mov ecx,eax
mov eax,22 mcall 22,1
mov ebx,1
mcall
jmp still jmp still
additem: additem:
add eax,1 add eax,1
daa daa
sub ebx,1 sub ebx,1
cmp ebx,0 cmp ebx,0
jne additem jne additem
ret ret
@ -550,7 +520,7 @@ draw_window:
mov ebx,B_SPIN mov ebx,B_SPIN
mov edx,spinner mov edx,spinner
mov esi,12 mov esi,12
ShowFocus 4 mov ecx,COL_DROPDOWN_T
mcall mcall
mov edx,[Month] mov edx,[Month]
@ -672,10 +642,10 @@ draw_days:
mov esi,COL_DATE_BUTTONS mov esi,COL_DATE_BUTTONS
jmp .draw_but jmp .draw_but
.draw_sel: .draw_sel:
mov esi,COL_DATE_CURRENT mov esi,COL_DATE_INACTIV
cmp [focus],5 cmp [focus],4
jne .draw_but jne .draw_but
mov esi,COL_DATE_CHANGED mov esi,COL_DATE_ACTIVE
.draw_but: .draw_but:
add edx,200+1 shl 29 add edx,200+1 shl 29
mcall 8 mcall 8
@ -798,9 +768,7 @@ firstday dd ?
Year dd ? Year dd ?
Month dd ? Month dd ?
day_sel dd ? day_sel dd ?
all_days dd ?
datestr dd ? datestr dd ?
leap_year dd ? leap_year dd ?
number dd ? number dd ?
year_input dd ?

View File

@ -1,18 +1,18 @@
; program data: colors, text, vars (todo) ; program data: colors, text, vars
; colors ; colors
COL_WINDOW_BG equ 0x14E7E7E7 COL_WINDOW_BG equ 0x14E7E7E7
COL_TOOLBAR_BG equ 0x555555 COL_TOOLBAR_BG equ 0x555555
COL_ACTIVE_TEXT equ 0x10e7c750
COL_WEEKDAY_BG equ 0xCCCDDD COL_WEEKDAY_BG equ 0xCCCDDD
COL_DATE_BUTTONS equ 0xF3F3F3 COL_DATE_BUTTONS equ 0xF3F3F3
COL_DATE_CURRENT equ 0x31A4D0 COL_DATE_INACTIV equ 0x31A4D0
COL_DATE_CHANGED equ 0xef7840 COL_DATE_ACTIVE equ COL_ACTIVE_TEXT
COL_TIME_BUTTONS equ 0x5555dd COL_TIME_BUTTONS equ 0x5555dd
COL_GO_TODAY_T equ 0xd048c8 COL_GO_TODAY_T equ 0xd048c8
COL_MONTH_YEAR_B equ 0x0555555 ; 0 for time? COL_MONTH_YEAR_B equ 0x0555555 ; 0 for time?
COL_DROPDOWN_BG equ 0x666666 COL_DROPDOWN_BG equ 0x666666
COL_DROPDOWN_T equ 0x10CCCccc COL_DROPDOWN_T equ 0x10CCCccc
COL_NEW_STYLE_T equ 0xef3333 COL_NEW_STYLE_T equ 0xef3333
remainder dd 1 remainder dd 1
@ -53,7 +53,7 @@ B_NS_X equ 185 shl 16+75
B_NS_Y equ 48 shl 16+10 B_NS_Y equ 48 shl 16+10
B_NS equ 190 shl 16+50 B_NS equ 190 shl 16+50
FOCUSABLE equ 5 FOCUSABLE equ 4
; multilanguage interface - configuratable in lang.inc ; multilanguage interface - configuratable in lang.inc
day_count db 3,0,3,2,3,2,3,3,2,3,2,3 day_count db 3,0,3,2,3,2,3,3,2,3,2,3