forked from KolibriOS/kolibrios
Calendar 1.4
git-svn-id: svn://kolibrios.org@3891 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
dcc2877e84
commit
6d61491177
@ -1,6 +1,6 @@
|
|||||||
; Calendar for KolibriOS
|
; Calendar for KolibriOS
|
||||||
;
|
;
|
||||||
; v1.35 - code update, redesign by Leency
|
; v1.2 - v1.4 - new desighn and functionality 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
|
||||||
@ -8,20 +8,20 @@
|
|||||||
; Created: November 1, 2004
|
; Created: November 1, 2004
|
||||||
|
|
||||||
|
|
||||||
use32 ; ¢ª«îç¨âì 32-¡¨âë© à¥¦¨¬ áᥬ¡«¥à
|
use32
|
||||||
|
|
||||||
org 0x0 ; ¤à¥á æ¨ï á ã«ï
|
org 0x0
|
||||||
|
|
||||||
db 'MENUET01' ; 8-¡ ©âë© ¨¤¥â¨ä¨ª â®à MenuetOS
|
db 'MENUET01'
|
||||||
dd 0x01 ; ¢¥àá¨ï § £®«®¢ª (¢á¥£¤ 1)
|
dd 0x01
|
||||||
dd start ; ¤à¥á ¬¥âª¨, á ª®â®à®© ç¨ ¥âáï ¢ë¯®«¥¨¥ ¯à®£à ¬¬
|
dd START
|
||||||
dd I_END ; à §¬¥à ¯à®£à ¬¬ë
|
dd I_END
|
||||||
dd 0x1000 ; ª®«¨ç¥á⢮ ¯ ¬ïâ¨
|
dd 0x1000
|
||||||
dd 0x1000 ; ¤à¥á ¢¥àè¨ë áâíª
|
dd 0x1000
|
||||||
dd 0x0 ; ¤à¥á ¡ãä¥à ¤«ï áâப¨ ¯ à ¬¥â஢ (¥ ¨á¯®«ì§ã¥âáï)
|
dd 0x0
|
||||||
dd 0x0 ; § १¥à¢¨à®¢ ®
|
dd 0x0
|
||||||
|
include '..\..\..\macros.inc'
|
||||||
include 'lang.inc'
|
include 'lang.inc'
|
||||||
include '..\..\..\macros.inc' ; 㬥ìè ¥â à §¬¥à ¯à®£à ¬¬ë
|
|
||||||
include 'data.inc'
|
include 'data.inc'
|
||||||
|
|
||||||
|
|
||||||
@ -53,6 +53,68 @@ macro GetSkinHeight
|
|||||||
int 0x40
|
int 0x40
|
||||||
}
|
}
|
||||||
|
|
||||||
|
macro DrawRect color1,color2,color3,color4 ; pizdec... but optimized well
|
||||||
|
{
|
||||||
|
; top border-outer
|
||||||
|
push ebx
|
||||||
|
push ecx
|
||||||
|
mov eax,13
|
||||||
|
mov bx,DATE_BUTTON_WIDTH
|
||||||
|
mov edx,color1
|
||||||
|
mov cx,1
|
||||||
|
mcall
|
||||||
|
; left border-outer
|
||||||
|
mov bx,1
|
||||||
|
mov cx,DATE_BUTTON_HEIGHT
|
||||||
|
mcall
|
||||||
|
; top border-inner
|
||||||
|
mov edx,color2
|
||||||
|
add ebx,1 shl 16
|
||||||
|
add ecx,1 shl 16
|
||||||
|
mov bx,DATE_BUTTON_WIDTH-1
|
||||||
|
mov cx,1
|
||||||
|
; left border-inner
|
||||||
|
mcall
|
||||||
|
mov bx,1
|
||||||
|
mov cx,DATE_BUTTON_HEIGHT-2
|
||||||
|
mcall
|
||||||
|
; inner
|
||||||
|
mov edx,color3
|
||||||
|
add ebx,1 shl 16
|
||||||
|
add ecx,1 shl 16
|
||||||
|
mov bx,DATE_BUTTON_WIDTH-4
|
||||||
|
mov cx,DATE_BUTTON_HEIGHT-4
|
||||||
|
mcall
|
||||||
|
; bottom border-inner
|
||||||
|
mov edx,color4
|
||||||
|
add ebx,DATE_BUTTON_WIDTH shl 16
|
||||||
|
sub ebx,4 shl 16
|
||||||
|
mov bx,1
|
||||||
|
mov cx,DATE_BUTTON_HEIGHT-3
|
||||||
|
mcall
|
||||||
|
; rgiht border-outer
|
||||||
|
mov edx,color2
|
||||||
|
add ebx,1 shl 16
|
||||||
|
sub ecx,1 shl 16
|
||||||
|
add cx,1
|
||||||
|
mcall
|
||||||
|
; bottom border-outer
|
||||||
|
mov edx,color2
|
||||||
|
pop ecx
|
||||||
|
pop ebx
|
||||||
|
add ecx,DATE_BUTTON_HEIGHT shl 16
|
||||||
|
sub ecx,1 shl 16
|
||||||
|
add ebx,1 shl 16
|
||||||
|
mov cx,1
|
||||||
|
mcall
|
||||||
|
; left border-outer
|
||||||
|
mov edx,color4
|
||||||
|
add ebx,1 shl 16
|
||||||
|
sub ecx,1 shl 16
|
||||||
|
sub bx,2
|
||||||
|
mcall
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
str2int:
|
str2int:
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
@ -64,7 +126,7 @@ str2int:
|
|||||||
add al,bl
|
add al,bl
|
||||||
ret
|
ret
|
||||||
|
|
||||||
start:
|
START:
|
||||||
mcall 29
|
mcall 29
|
||||||
mov [datestr],eax
|
mov [datestr],eax
|
||||||
mov esi,datestr
|
mov esi,datestr
|
||||||
@ -79,27 +141,33 @@ start:
|
|||||||
test byte[esi],0
|
test byte[esi],0
|
||||||
jnz .no2000
|
jnz .no2000
|
||||||
add [Year],100
|
add [Year],100
|
||||||
|
mov eax,[Year]
|
||||||
|
mov [curYear], eax
|
||||||
|
mov eax,[Month]
|
||||||
|
mov [curMonth], eax
|
||||||
|
mov eax,[day_sel]
|
||||||
|
mov [curDay], eax
|
||||||
.no2000:
|
.no2000:
|
||||||
jmp upd ; §¤¥áì ç¨ ¥âáï ¢ë¯®«¥¨¥ ¯à®£à ¬¬ë
|
jmp upd
|
||||||
red: ; ¯¥à¥à¨á®¢ âì ®ª®
|
red:
|
||||||
|
|
||||||
call draw_window
|
call draw_window
|
||||||
|
|
||||||
still: ; ƒ‹€‚<E282AC>›‰ –ˆŠ‹ <20><>Žƒ<C5BD>€ŒŒ›
|
still:
|
||||||
|
|
||||||
mcall 23,50 ; wait here for event
|
mcall 23,50 ; wait here for event
|
||||||
.evt:
|
.evt:
|
||||||
mov ebp,[focus]
|
mov ebp,[focus]
|
||||||
cmp eax,1 ; ¯¥à¥à¨á®¢ âì ®ª® ?
|
cmp eax,1
|
||||||
je red ; ¥á«¨ ¤ - ¬¥âªã red
|
je red
|
||||||
cmp eax,2 ; ¦ â ª« ¢¨è ?
|
cmp eax,2
|
||||||
je key ; ¥á«¨ ¤ - key
|
je key
|
||||||
cmp eax,3 ; ¦ â ª®¯ª ?
|
cmp eax,3
|
||||||
je button ; ¥á«¨ ¤ - button
|
je button
|
||||||
|
|
||||||
call draw_clock
|
call draw_clock
|
||||||
|
|
||||||
jmp still ; ¥á«¨ ¤à㣮¥ ᮡë⨥ - ¢ ç «® 横«
|
jmp still
|
||||||
|
|
||||||
key:
|
key:
|
||||||
mcall 2 ; get pressed key
|
mcall 2 ; get pressed key
|
||||||
@ -154,7 +222,7 @@ still: ;
|
|||||||
.ok:
|
.ok:
|
||||||
mov [day_sel],ecx
|
mov [day_sel],ecx
|
||||||
call draw_days
|
call draw_days
|
||||||
jmp still ; ¢¥àãâìáï ª ç «ã 横«
|
jmp still
|
||||||
.chk0:
|
.chk0:
|
||||||
cmp ecx,eax
|
cmp ecx,eax
|
||||||
jle still
|
jle still
|
||||||
@ -163,7 +231,7 @@ still: ;
|
|||||||
day_bounds db -1,0,7,0,-7,0,1,0 ; left,down,up,right
|
day_bounds db -1,0,7,0,-7,0,1,0 ; left,down,up,right
|
||||||
|
|
||||||
button:
|
button:
|
||||||
mcall 17 ; 17 - ¯®«ãç¨âì ¨¤¥â¨ä¨ª â®à ¦ ⮩ ª®¯ª¨
|
mcall 17
|
||||||
movzx ebx,ah
|
movzx ebx,ah
|
||||||
cmp ah,200
|
cmp ah,200
|
||||||
jbe nodayselect
|
jbe nodayselect
|
||||||
@ -184,11 +252,10 @@ day_bounds db -1,0,7,0,-7,0,1,0 ; left,down,up,right
|
|||||||
mov [focus],2
|
mov [focus],2
|
||||||
jmp upd
|
jmp upd
|
||||||
no_list:
|
no_list:
|
||||||
cmp ah,1 ; ¨¤¥â¨ä¨ª â®à == 1 ?
|
cmp ah,1
|
||||||
jne noclose ; ¥á«¨ ¥â - ¨¤¨ ¢¯¥àñ¤ noclose
|
jne noclose
|
||||||
close:
|
close:
|
||||||
or eax,-1 ; ¢ë室 ¨§ ¯à®£à ¬¬ë
|
mcall -1 ; clore programm
|
||||||
mcall ; ¢ë§®¢ á¨á⥬ë
|
|
||||||
|
|
||||||
noclose:
|
noclose:
|
||||||
|
|
||||||
@ -302,7 +369,7 @@ day_bounds db -1,0,7,0,-7,0,1,0 ; left,down,up,right
|
|||||||
jmp .ch_year
|
jmp .ch_year
|
||||||
noy_click:
|
noy_click:
|
||||||
cmp ah,10
|
cmp ah,10
|
||||||
jne start
|
jne START
|
||||||
xor [new_style],1
|
xor [new_style],1
|
||||||
jmp upd
|
jmp upd
|
||||||
|
|
||||||
@ -396,7 +463,7 @@ additem:
|
|||||||
|
|
||||||
|
|
||||||
; *********************************************
|
; *********************************************
|
||||||
; ******* Ž<EFBFBD><EFBFBD>…„…‹…<EFBFBD>ˆ… ˆ Ž’<C5BD>ˆ‘Ž‚Š€ ŽŠ<C5BD>€ *******
|
; ******* DRAW WINDOW *******
|
||||||
; *********************************************
|
; *********************************************
|
||||||
|
|
||||||
draw_clock:
|
draw_clock:
|
||||||
@ -491,14 +558,13 @@ draw_window:
|
|||||||
mcall
|
mcall
|
||||||
call draw_days
|
call draw_days
|
||||||
|
|
||||||
; äãªæ¨ï 4 : ¯¨á âì ¢ ®ª¥ ⥪áâ
|
; draw text in window
|
||||||
mcall 4,162*65536+280,0x800000ff,sys_text
|
mcall 4,162*65536+280,0x800000ff,sys_text
|
||||||
mcall ,180*65536+302,0x800000ff,minus
|
mcall ,180*65536+302,0x800000ff,minus
|
||||||
mcall ,180*65536+292,0x80ff0000,plus
|
mcall ,180*65536+292,0x80ff0000,plus
|
||||||
mcall , 24*65536+292,0x00000000,set_date_t,15 ;set date text
|
mcall , 24*65536+292,0x00000000,set_date_t,15 ;set date text
|
||||||
|
|
||||||
mov ecx,0x10ddeeff ; èà¨äâ 1 ¨ 梥â ( 0xF0RRGGBB )
|
mov ecx,0x10ddeeff
|
||||||
|
|
||||||
mov edx,n_style
|
mov edx,n_style
|
||||||
mov esi,ns_end-n_style
|
mov esi,ns_end-n_style
|
||||||
mov ebx,B_NS
|
mov ebx,B_NS
|
||||||
@ -622,7 +688,7 @@ draw_days:
|
|||||||
add cl,[week_days+1]
|
add cl,[week_days+1]
|
||||||
cmp ecx,7
|
cmp ecx,7
|
||||||
je .holiday
|
je .holiday
|
||||||
mov esi,0x10000000 ; COL_DATE_TEXT
|
mov esi,0x10313138 ; COL_DATE_TEXT
|
||||||
jmp .noholiday
|
jmp .noholiday
|
||||||
.holiday:
|
.holiday:
|
||||||
mov esi,0x10cc1010
|
mov esi,0x10cc1010
|
||||||
@ -631,24 +697,44 @@ draw_days:
|
|||||||
inc dword[ecx]
|
inc dword[ecx]
|
||||||
pusha
|
pusha
|
||||||
mov ebx,edx
|
mov ebx,edx
|
||||||
mov bx,31 ; width
|
mov bx,DATE_BUTTON_WIDTH-1
|
||||||
sub ebx,8 shl 16
|
sub ebx,8 shl 16
|
||||||
shrd ecx,edx,16
|
shrd ecx,edx,16
|
||||||
mov cx,29 ; height
|
mov cx,DATE_BUTTON_HEIGHT-1
|
||||||
sub ecx,12 shl 16
|
sub ecx,12 shl 16
|
||||||
mov edx,[number]
|
mov edx,[number]
|
||||||
cmp edx,[day_sel]
|
cmp edx,[day_sel]
|
||||||
je .draw_sel
|
je .draw_sel
|
||||||
mov esi,COL_DATE_BUTTONS
|
mov esi,COL_DATE_BUTTONS
|
||||||
jmp .draw_but
|
jmp .draw_but
|
||||||
.draw_sel:
|
.draw_sel: ;draw selected button
|
||||||
mov esi,COL_DATE_INACTIV
|
add edx,1 shl 30
|
||||||
cmp [focus],4
|
|
||||||
jne .draw_but
|
|
||||||
mov esi,COL_DATE_ACTIVE
|
|
||||||
.draw_but:
|
|
||||||
add edx,200+1 shl 29
|
add edx,200+1 shl 29
|
||||||
mcall 8
|
mcall 8
|
||||||
|
cmp [focus],4
|
||||||
|
jne .not_active
|
||||||
|
DrawRect COL_DATE_ACTIVE_1,COL_DATE_ACTIVE_2,COL_DATE_ACTIVE_3,COL_DATE_ACTIVE_4
|
||||||
|
jmp .after_draw_but
|
||||||
|
.not_active:
|
||||||
|
DrawRect COL_DATE_INACTIVE_1,COL_DATE_INACTIVE_2,COL_DATE_INACTIVE_3,COL_DATE_INACTIVE_4
|
||||||
|
jmp .after_draw_but
|
||||||
|
.draw_but: ;draw non selected button
|
||||||
|
add edx,200+1 shl 29
|
||||||
|
mcall 8
|
||||||
|
.after_draw_but:
|
||||||
|
mov eax,[Year]
|
||||||
|
cmp [curYear],eax
|
||||||
|
jne .out
|
||||||
|
mov eax,[Month]
|
||||||
|
cmp [curMonth],eax
|
||||||
|
jne .out
|
||||||
|
mov eax,[number]
|
||||||
|
cmp [curDay],eax
|
||||||
|
jne .out
|
||||||
|
;DrawRect COL_DATE_INACTIVE_1,COL_DATE_INACTIVE_2,COL_DATE_INACTIVE_3,COL_DATE_INACTIVE_4
|
||||||
|
.out:
|
||||||
|
|
||||||
|
|
||||||
mov eax, [number]
|
mov eax, [number]
|
||||||
xor edx, edx
|
xor edx, edx
|
||||||
mov ecx, 10
|
mov ecx, 10
|
||||||
|
@ -1,4 +1,10 @@
|
|||||||
; program data: colors, text, vars
|
; program data: colors, text, vars
|
||||||
|
DATE_BUTTON_WIDTH equ 32
|
||||||
|
DATE_BUTTON_HEIGHT equ 30
|
||||||
|
|
||||||
|
curMonth dd ?
|
||||||
|
curYear dd ?
|
||||||
|
curDay dd ?
|
||||||
|
|
||||||
; colors
|
; colors
|
||||||
COL_WINDOW_BG equ 0x14E7E7E7
|
COL_WINDOW_BG equ 0x14E7E7E7
|
||||||
@ -6,8 +12,6 @@ COL_TOOLBAR_BG equ 0x555555
|
|||||||
COL_ACTIVE_TEXT equ 0x10e7c750
|
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_INACTIV equ 0x31A4D0
|
|
||||||
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?
|
||||||
@ -15,6 +19,15 @@ 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
|
||||||
|
|
||||||
|
COL_DATE_INACTIVE_1 equ 0x1585B8
|
||||||
|
COL_DATE_INACTIVE_2 equ 0x4EA4CA
|
||||||
|
COL_DATE_INACTIVE_3 equ 0x5FB2D6
|
||||||
|
COL_DATE_INACTIVE_4 equ 0x81C1DE
|
||||||
|
COL_DATE_ACTIVE_1 equ 0xBB8C00
|
||||||
|
COL_DATE_ACTIVE_2 equ 0xEAB10F
|
||||||
|
COL_DATE_ACTIVE_3 equ 0xF7C22D
|
||||||
|
COL_DATE_ACTIVE_4 equ 0xF7CB4B
|
||||||
|
|
||||||
remainder dd 1
|
remainder dd 1
|
||||||
quotient dd 1
|
quotient dd 1
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user