From dcc2877e84b3c7d1317f74d9d0480880c565c7c4 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Wed, 4 Sep 2013 20:59:29 +0000 Subject: [PATCH] calendar 1.35: usability optimization, bug fixed, code clean git-svn-id: svn://kolibrios.org@3890 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/system/calendar/trunk/calendar.asm | 82 +++++++-------------- programs/system/calendar/trunk/data.inc | 10 +-- 2 files changed, 30 insertions(+), 62 deletions(-) diff --git a/programs/system/calendar/trunk/calendar.asm b/programs/system/calendar/trunk/calendar.asm index 7a958b67a4..24f661c405 100644 --- a/programs/system/calendar/trunk/calendar.asm +++ b/programs/system/calendar/trunk/calendar.asm @@ -1,6 +1,6 @@ ; 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.0 - written in pure assembler by Ivushkin Andrey aka Willow ; also - diamond, spraid, fedesco @@ -32,9 +32,9 @@ macro ShowFocus field,reg cmp [focus],field jne .nofocus if reg eq - mov ecx,0x10e7c750;0x10ddeeff + mov ecx,COL_ACTIVE_TEXT else - mov reg,0x10e7c750;0x10ddeeff + mov reg,COL_ACTIVE_TEXT end if jmp .exit .nofocus: @@ -107,7 +107,7 @@ still: ; jne no_tab .tab: cmp ebp,FOCUSABLE - je foc_cycle + JAE foc_cycle inc [focus] upd: call calculate @@ -127,13 +127,6 @@ still: ; mov [Month],edi jmp upd .noFkey: - cmp ebp,4 - jne no_spinner - cmp ah,176 - je year_dec - cmp ah,179 - je year_inc - no_spinner: cmp ebp,2 jne .nomonth cmp ah,177 @@ -142,7 +135,7 @@ still: ; .nomonth: cmp ebp,3 je noy_up.year_evt - cmp ebp,5 + cmp ebp,4 jne still mov ebx,[day_sel] 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 jmp still .redraw: - mov [focus],5 + mov [focus],4 jmp red nodayselect: 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 year_dec: dec [Year] - mov [focus],4 + mov [focus],3 jmp upd noy_dn: cmp ah,4 ; year+1 jne noy_up year_inc: inc [Year] - mov [focus],4 + mov [focus],3 jmp upd noy_up: 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 mcall 2 .year_evt: + cmp ah,176 + je year_dec + cmp ah,179 + je year_inc + mov ebx,10 cmp ah,9 je key.tab @@ -310,23 +308,17 @@ day_bounds db -1,0,7,0,-7,0,1,0 ; left,down,up,right reset: - - mov eax,3 - mcall + mcall 3 mov ecx,eax shl ecx,16 shr ecx,16 - mov eax,22 - mov ebx,0x00000000 - mcall - + mcall 22,0x00000000 jmp still plus_hd: mcall 3 mov ecx,eax add ecx,1 - mov eax,22 mcall 22,0x00000000 jmp still @@ -341,38 +333,24 @@ minus_hd: mcall 3 mov ecx,eax sub ecx,1 - mov eax,22 - mov ebx,0x00000000 - mcall - + mcall 22,0x00000000 jmp still minus_he: - - mov eax,3 - mcall + mcall 3 mov ecx,eax sub ecx,16 - mov eax,22 - mov ebx,0x00000000 - mcall - + mcall 22,0x00000000 jmp still plus_md: - - mov eax,3 - mcall + mcall 3 mov ecx,eax add ecx,256 - mov eax,22 - mov ebx,0x00000000 - mcall - + mcall 22,0x00000000 jmp still plus_me: - mcall 3 mov ecx,eax add ecx,4096 @@ -380,7 +358,6 @@ plus_me: jmp still minus_md: - mcall 3 mov ecx,eax sub ecx,256 @@ -388,7 +365,6 @@ minus_md: jmp still minus_me: - mcall 3 mov ecx,eax sub ecx,4096 @@ -396,7 +372,6 @@ minus_me: jmp still set_date: - mov eax,0x00000000 mov ebx,[day_sel] call additem @@ -408,20 +383,15 @@ set_date: mov ebx,[Year] call additem mov ecx,eax - mov eax,22 - mov ebx,1 - mcall - + mcall 22,1 jmp still additem: - add eax,1 daa sub ebx,1 cmp ebx,0 jne additem - ret @@ -550,7 +520,7 @@ draw_window: mov ebx,B_SPIN mov edx,spinner mov esi,12 - ShowFocus 4 + mov ecx,COL_DROPDOWN_T mcall mov edx,[Month] @@ -672,10 +642,10 @@ draw_days: mov esi,COL_DATE_BUTTONS jmp .draw_but .draw_sel: - mov esi,COL_DATE_CURRENT - cmp [focus],5 + mov esi,COL_DATE_INACTIV + cmp [focus],4 jne .draw_but - mov esi,COL_DATE_CHANGED + mov esi,COL_DATE_ACTIVE .draw_but: add edx,200+1 shl 29 mcall 8 @@ -798,9 +768,7 @@ firstday dd ? Year dd ? Month dd ? day_sel dd ? -all_days dd ? datestr dd ? leap_year dd ? number dd ? -year_input dd ? diff --git a/programs/system/calendar/trunk/data.inc b/programs/system/calendar/trunk/data.inc index 577d5aae7b..d9ec61c843 100644 --- a/programs/system/calendar/trunk/data.inc +++ b/programs/system/calendar/trunk/data.inc @@ -1,18 +1,18 @@ -; program data: colors, text, vars (todo) +; program data: colors, text, vars ; colors COL_WINDOW_BG equ 0x14E7E7E7 COL_TOOLBAR_BG equ 0x555555 +COL_ACTIVE_TEXT equ 0x10e7c750 COL_WEEKDAY_BG equ 0xCCCDDD COL_DATE_BUTTONS equ 0xF3F3F3 -COL_DATE_CURRENT equ 0x31A4D0 -COL_DATE_CHANGED equ 0xef7840 +COL_DATE_INACTIV equ 0x31A4D0 +COL_DATE_ACTIVE equ COL_ACTIVE_TEXT COL_TIME_BUTTONS equ 0x5555dd COL_GO_TODAY_T equ 0xd048c8 COL_MONTH_YEAR_B equ 0x0555555 ; 0 for time? COL_DROPDOWN_BG equ 0x666666 COL_DROPDOWN_T equ 0x10CCCccc - COL_NEW_STYLE_T equ 0xef3333 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 equ 190 shl 16+50 -FOCUSABLE equ 5 +FOCUSABLE equ 4 ; multilanguage interface - configuratable in lang.inc day_count db 3,0,3,2,3,2,3,3,2,3,2,3