I was going to make a nice little addon out of this, but I don't have the motivation. If you want to use this be my guest, as of right now, it doesn't really serve a purpose.
Have fun.
Edit: Updated Slightly, Added support for custom colors. Also added underlining for event days, todays event, ect.
Right now you must do /cal_defaults for default colors, it won't save new colors, use cal_eadd to add an event. (as a test event) /cal_eadd dec 25 2008
The hash table that controls the event is formated as followed:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Cal_Event ------------------------------------------- |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| caleventctime@00:00:00_ | event note -|
| caleventctime@00:00:00_ | event note -|
| caleventctime@00:00:00_ | event note -|
| caleventctime@00:00:00_ | event note -|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Jonsey PM me if you need any more info
alias calendar {
if ($hget(Cal_gUI)) hfree Cal_gUI
hadd -m Cal_gUI title $asctime($ctime($+(1/,$$1,/,$$2) 00:00:00),mmmm)
hadd Cal_gUI month $asctime($ctime($+(1/,$1,/,$2) 00:00:00),m)
hadd Cal_gUI year $asctime($ctime($+(1/,$1,/,$2) 00:00:00),yyyy)
hadd Cal_gUI myyyy $asctime($ctime($+(1/,$1,/,$2) 00:00:00),m yyyy)
If (!$window(@Calendar)) window -k0dBpC +d @Calendar 10 10 421 392
Else window -a @calendar
drawrect -nrf @calendar $clr(main_bg) 1 0 0 421 392
drawrect -nrf @calendar $clr(main_box) 1 1 71 419 300
; Header
drawrect -nrf @Calendar $clr(header_1) 1 1 1 419 20
drawrect -nrf @Calendar $clr(header_2) 1 1 21 419 20
; Header text
drawtext -nro @Calendar $clr(header_text) Arial 22 $round($calc((419 - $width($hget(Cal_gUI,title), Arial, 22)) / 2),0) 7 $hget(Cal_gUI,title)
; Header Nav
drawtext -nro @calendar $clr(header_nav) Arial 22 10 8 <
drawtext -nro @calendar $clr(header_nav) Arial 22 398 8 >
; Footer Text
drawtext -nro @calendar $clr(footer_text) Arial 12 $calc(416 - $width($hget(Cal_gUI,year),arial,12,1)) 374 $hget(Cal_gUI,year)
; Days
var %x = 1, %y = 20 80 140 200 260 322 380, %z = Sun Mon Tue Wed Thu Fri Sat
while ($gettok(%y,%x,32)) { drawtext -nr @calendar $clr(day_text) Arial 12 $gettok(%y,%x,32) 48 $gettok(%z,%x,32) | inc %x }
;vertical lines
var %x = 1, %y = 60 120 180 240 300 360, %clr = $clr(lines)
while ($gettok(%y,%x,32)) { drawline -nr @calendar %clr 1 $v1 71 $v1 371 | inc %x }
; horiz lines
var %x = 1, %y = 121 171 221 271 321
while ($gettok(%y,%x,32)) { drawline -nr @calendar %clr 1 1 $v1 421 $v1 | inc %x }
var %r = $cal.start($1,$2), %e = $cal.end($1,$2), %c = 1, %i = 1, %clr = $clr(date_text)
while (%i <= %e) {
drawtext -nro @calendar %clr Arial 12 $calc(5 + 60 * (%r - 1)) $calc(75 + 50 * (%c - 1)) %i
hadd -m Cal_gUI $+(B_,%r,_,%c) %i
cal_underline %r %c 1
If (7 // %r) { inc %c | %r = 1 }
Else { inc %r }
inc %i
}
drawrect @calendar
}
menu @calendar {
mouse:{
var %x = $mouse.x, %y = $mouse.y
If (%x isnum 1-420) && (%y isnum 72-371) {
var %r = $ceil($calc((%x + 1) / 60)), %c = $ceil($calc((%y - 71) / 50))
If ($hget(Cal_gUI,cur) != %r %c) {
If ($v1) cal_underline $v1
If ($hget(cal_gui,$+(B_,%r,_,%c))) { drawrect -rf @calendar $clr(mouse_hover) 1 $calc(-59 + 60 * %r) $calc(65 + 50 * %c) 59 6 }
hadd -m Cal_gUI cur %r %c
}
}
Else {
If ($hget(cal_gui,cur)) { cal_underline $v1 | hdel cal_gui cur }
If (%cal.mx) {
var %x = $calc(%cal.wx - (%cal.mx - $mouse.dx ))
var %y = $calc(%cal.wy - (%cal.my - $mouse.dy))
window -p @Calendar %x %y
}
}
}
sclick:{
var %x = $mouse.x, %y = $mouse.y
If (%x isnum 10-23) && (%y isnum 8-34) { calendar $iif($hget(Cal_gUI,month) == 1,12,$calc($v1 - 1)) $iif($hget(Cal_gUI,month) == 1,$calc($hget(Cal_gUI,year) - 1),$hget(Cal_gUI,year)) }
ElseIf (%x isnum 398-411) && (%y isnum 8-34) { calendar $iif($hget(Cal_gUI,month) == 12,1,$calc($v1 + 1)) $iif($hget(Cal_gUI,month) == 12,$calc($hget(Cal_gUI,year) + 1),$hget(Cal_gUI,year)) }
ElseIf (%x isnum 1-420) && (%y isnum 72-371) { }
Else {
set %cal.mx $mouse.dx
set %cal.my $mouse.dy
set %cal.wx $window(@calendar).x
set %cal.wy $window(@calendar).y
}
}
uclick:{ unset %cal.* }
leave:{ unset %cal.* }
Close:window -c @Calendar
}
alias h2r {
if ($regex($1,/^#?([\da-f]{6})$/i)) {
tokenize 32 $regsubex($regml(1),/(.)/g,$replace(\1,a,10,b,11,c,12,d,13,e,14,f,15) $chr(32))
return $calc(($1 * 16 + $2) + ($3 * 16 + $4) * 256 + ($5 * 16 + $6) * 65536)
}
}
alias cal_defaults {
If (!$clr(event)) clr event c05b5b
If (!$clr(event_today)) clr event_today 207b70
If (!$clr(mouse_hover)) clr mouse_hover 5e88bc
If (!$clr(main_bg)) clr main_bg 4c4c4c
If (!$clr(today)) clr today 78b0a9
If (!$clr(main_box)) clr main_box ebebeb
If (!$clr(header_1)) clr header_1 a3cd39
If (!$clr(header_2)) clr header_2 93ba3e
If (!$clr(header_text)) clr header_text ffffff
If (!$clr(header_nav)) clr header_nav ffffff
If (!$clr(footer_text)) clr footer_text ffffff
If (!$clr(day_text)) clr day_text ffffff
If (!$clr(lines)) clr lines 4c4c4c
If (!$clr(date_text)) clr date_text 4c4c4c
}
alias clr {
if ($isid) return $hget(cal_cfg,color_ $+ $1)
else hadd -m cal_cfg color_ $+ $1 $h2r($2)
}
alias cal_eadd {
hadd -m cal_event Event_ $+ $ctime($1- 00:00:00) $+ _testing asdasdasd
}
alias cal_underline {
var %ctime = $ctime($hget(cal_gui,$+(B_,$1,_,$2)) $hget(cal_gui,title) $hget(cal_gui,year) 00:00:00)
var %event = $hfind(Cal_Event,Event_ $+ %ctime $+ _*,0,w)
var %today = $iif($asctime(d m yyyy) == $hget(cal_gui,$+(B_,$1,_,$2)) $hget(Cal_gUI,myyyy),1,)
If (%event) && (%today) { var %clr = 7371552 }
ElseIf (%event) { var %clr = $clr(event) }
ElseIf (%today) { var %clr = $clr(today) }
Else { var %clr = $clr(main_box) }
drawrect $iif($3,-rnf,-rf) @calendar %clr 1 $calc(-59 + 60 * $1) $calc(65 + 50 * $2) 59 6
}
menu status,channel,query {
-
Calendar:/calendar $asctime(mm yy)
-
}
alias fade {
var %x = $vol(master), %y = $calc(%x / 500), %z = 1
while (%z <= 500) { vol -v $round($calc(%x - %y * %z),0) | inc %z }
}
alias cal.start { return $replace($asctime($ctime($+(1/,$1,/,$2) 00:00:00),ddd),sun,1,mon,2,tue,3,wed,4,thu,5,fri,6,sat,7) }
alias cal.end { return $asctime($calc($ctime($+(1/,$iif($1 == 12,1,$calc($v1 + 1)),/,$iif($1 == 12,$calc($2 + 1),$2)) 00:00:00) - 1),d) }
Could do alot with this, although sadly I have no clue on picwins so I guess I can't do anything with it =[.
I'd like to be able to:
Guess I won't see this happen though. =[