mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-18 07:18:47 +02:00
More work on supporting weekly calendar views.
This commit is contained in:
@@ -544,7 +544,7 @@ proc CalEntryOffset { firstDay } {
|
||||
}
|
||||
|
||||
#***********************************************************************
|
||||
# %PROCEDURE: CreateCalFrame
|
||||
# %PROCEDURE: CreateCalFrameMonthly
|
||||
# %ARGUMENTS:
|
||||
# w -- name of frame window
|
||||
# dayNames -- names of weekdays
|
||||
@@ -553,7 +553,7 @@ proc CalEntryOffset { firstDay } {
|
||||
# %DESCRIPTION:
|
||||
# Creates a frame holding a grid of labels and a grid of text entries
|
||||
#***********************************************************************
|
||||
proc CreateCalFrame { w dayNames } {
|
||||
proc CreateCalFrameMonthly { w dayNames } {
|
||||
# Figure out reasonable height for text frames
|
||||
global SetFontsWorked
|
||||
global Option
|
||||
@@ -593,6 +593,8 @@ proc CreateCalFrame { w dayNames } {
|
||||
-highlightthickness 0
|
||||
frame $w.f$f -padx 0 -pady 0 -highlightthickness 0 -relief flat -bd 0 -background $Option(BackgroundColor)
|
||||
$w.t$f tag bind TAGGED <ButtonPress-1> "EditTaggedReminder $w.t$f"
|
||||
$w.t$f tag bind TAGGED <Enter> [list TaggedEnter $w.t$f]
|
||||
$w.t$f tag bind TAGGED <Leave> [list TaggedLeave $w.t$f]
|
||||
$w.t$f tag bind REM <ButtonPress-2> "OpenUrl $w.t$f"
|
||||
$w.t$f tag bind REM <ButtonPress-3> "FireEditor $w.t$f"
|
||||
pack $w.l$f -in $w.f$f -side top -expand 0 -fill x
|
||||
@@ -646,6 +648,8 @@ proc ConfigureCalFrame { w firstDay numDays } {
|
||||
$w.t$i tag delete $t
|
||||
}
|
||||
$w.t$i tag bind TAGGED <ButtonPress-1> "EditTaggedReminder $w.t$i"
|
||||
$w.t$i tag bind TAGGED <Enter> [list TaggedEnter $w.t$i]
|
||||
$w.t$i tag bind TAGGED <Leave> [list TaggedLeave $w.t$i]
|
||||
$w.t$i tag bind REM <ButtonPress-2> "OpenUrl $w.t$i"
|
||||
$w.t$i tag bind REM <ButtonPress-3> "FireEditor $w.t$i"
|
||||
$w.t$i configure -state disabled -takefocus 0
|
||||
@@ -670,6 +674,8 @@ proc ConfigureCalFrame { w firstDay numDays } {
|
||||
$w.t$i tag delete $t
|
||||
}
|
||||
$w.t$i tag bind TAGGED <ButtonPress-1> "EditTaggedReminder $w.t$i"
|
||||
$w.t$i tag bind TAGGED <Enter> [list TaggedEnter $w.t$i]
|
||||
$w.t$i tag bind TAGGED <Leave> [list TaggedLeave $w.t$i]
|
||||
$w.t$i tag bind REM <ButtonPress-2> "OpenUrl $w.t$i"
|
||||
$w.t$i tag bind REM <ButtonPress-3> "FireEditor $w.t$i"
|
||||
$w.t$i configure -state disabled -takefocus 0
|
||||
@@ -701,6 +707,8 @@ proc ConfigureCalFrame { w firstDay numDays } {
|
||||
$w.t$i tag delete $t
|
||||
}
|
||||
$w.t$i tag bind TAGGED <ButtonPress-1> "EditTaggedReminder $w.t$i"
|
||||
$w.t$i tag bind TAGGED <Enter> [list TaggedEnter $w.t$i]
|
||||
$w.t$i tag bind TAGGED <Leave> [list TaggedLeave $w.t$i]
|
||||
$w.t$i tag bind REM <ButtonPress-2> "OpenUrl $w.t$i"
|
||||
$w.t$i tag bind REM <ButtonPress-3> "FireEditor $w.t$i"
|
||||
$w.t$i configure -state disabled -takefocus 0
|
||||
@@ -745,7 +753,7 @@ proc CreateCalWindow { dayNames } {
|
||||
pack .h.title -side top -fill x -pady 1 -padx 1
|
||||
pack .h -side top -expand 0 -fill x
|
||||
. configure -background $Option(LineColor)
|
||||
CreateCalFrame .cal $dayNames
|
||||
CreateCalFrameMonthly .cal $dayNames
|
||||
|
||||
frame .b -background $Option(LineColor)
|
||||
button .b.prev -text "\u2b9c" -command {MoveMonth -1} -bd 0 -foreground $Option(LabelColor) -background $Option(WinBackground) -highlightthickness 1 -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
|
||||
@@ -1022,7 +1030,7 @@ proc ApplyOptions { w } {
|
||||
set Option($name) $tmpOpt($name)
|
||||
}
|
||||
if {$need_restart != 0} {
|
||||
FillCalWindow
|
||||
FillCalWindowMonthly
|
||||
StopBackgroundRemindDaemon
|
||||
StartBackgroundRemindDaemon
|
||||
}
|
||||
@@ -1041,7 +1049,7 @@ proc SaveOptions { w } {
|
||||
global Option OptDescr
|
||||
ApplyOptions $w
|
||||
WriteOptionsToFile
|
||||
FillCalWindow
|
||||
FillCalWindowMonthly
|
||||
.h.title configure -background $Option(WinBackground) -foreground $Option(LabelColor)
|
||||
for {set i 0} {$i < 7} {incr i} {
|
||||
.cal.day$i configure -foreground $Option(LabelColor) -background $Option(WinBackground)
|
||||
@@ -1137,7 +1145,7 @@ proc LoadOptions {} {
|
||||
|
||||
|
||||
#***********************************************************************
|
||||
# %PROCEDURE: ConfigureCalWindow
|
||||
# %PROCEDURE: ConfigureCalWindowMonthly
|
||||
# %ARGUMENTS:
|
||||
# month -- month name
|
||||
# year -- the year
|
||||
@@ -1154,7 +1162,7 @@ proc LoadOptions {} {
|
||||
# %SIDE EFFECTS:
|
||||
# Any side effects
|
||||
#***********************************************************************
|
||||
proc ConfigureCalWindow { month year firstDay numDays } {
|
||||
proc ConfigureCalWindowMonthly { month year firstDay numDays } {
|
||||
global Hostname
|
||||
.h.title configure -text "$month $year"
|
||||
if {[info exists Hostname]} {
|
||||
@@ -1167,9 +1175,9 @@ proc ConfigureCalWindow { month year firstDay numDays } {
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# FillCalWindow -- Fill in the calendar for global CurMonth and CurYear.
|
||||
# FillCalWindowMonthly -- Fill in the calendar for global CurMonth and CurYear.
|
||||
#---------------------------------------------------------------------------
|
||||
proc FillCalWindow {} {
|
||||
proc FillCalWindowMonthly {} {
|
||||
set FileName ""
|
||||
set LineNo 0
|
||||
global DayNames CurYear CurMonth MonthNames CommandLine Option TagToObj SynToObj RemindErrors MondayFirst
|
||||
@@ -1211,7 +1219,7 @@ proc FillCalWindow {} {
|
||||
set firstWkday [dict get $hash firstwkday]
|
||||
set daysInMonth [dict get $hash daysinmonth]
|
||||
|
||||
ConfigureCalWindow $monthName $year $firstWkday $daysInMonth
|
||||
ConfigureCalWindowMonthly $monthName $year $firstWkday $daysInMonth
|
||||
|
||||
# Update the day names in the calendar window
|
||||
for {set i 0} {$i < 7} {incr i} {
|
||||
@@ -1224,6 +1232,17 @@ proc FillCalWindow {} {
|
||||
}
|
||||
set entries [dict get $hash entries]
|
||||
foreach obj $entries {
|
||||
AddReminderToCalendar $obj
|
||||
}
|
||||
if {$problem} {
|
||||
set RemindErrors [unique_lines $errmsg]
|
||||
set_button_to_errors
|
||||
}
|
||||
DisplayTime
|
||||
}
|
||||
|
||||
proc AddReminderToCalendar { obj } {
|
||||
global TagToObj
|
||||
set fntag "x"
|
||||
if {[dict exists $obj filename]} {
|
||||
set fname [dict get $obj filename]
|
||||
@@ -1264,15 +1283,15 @@ proc FillCalWindow {} {
|
||||
set stuff [string trimleft $stuff]
|
||||
set stuff [string trimright $stuff]
|
||||
.cal.l$n configure -text "$day $stuff"
|
||||
continue
|
||||
return
|
||||
}
|
||||
"SHADE" {
|
||||
DoShadeSpecial $n [dict get $obj r] [dict get $obj g] [dict get $obj b]
|
||||
continue
|
||||
return
|
||||
}
|
||||
"MOON" {
|
||||
DoMoonSpecial $n $stuff $fntag $day
|
||||
continue
|
||||
return
|
||||
}
|
||||
"COLOUR" -
|
||||
"COLOR" {
|
||||
@@ -1304,7 +1323,7 @@ proc FillCalWindow {} {
|
||||
}
|
||||
}
|
||||
if { $type != "*" && $type != "COLOR" && $type != "COLOUR"} {
|
||||
continue
|
||||
return
|
||||
}
|
||||
.cal.t$n configure -state normal
|
||||
|
||||
@@ -1323,10 +1342,13 @@ proc FillCalWindow {} {
|
||||
set syntag ""
|
||||
}
|
||||
|
||||
if {[regexp {TKTAG([0-9]+)} $tag all tagno] && "$fntag" != "x"} {
|
||||
if {[regexp {TKTAG([0-9]+)} $tag all tagno]} {
|
||||
if {"$fntag" != "x"} {
|
||||
.cal.t$n insert end [string trim $stuff] [concat REM TAGGED "TKTAG$tagno" "date_$date" $extratags $fntag]
|
||||
.cal.t$n tag bind "TKTAG$tagno" <Enter> [list TaggedEnter .cal.t$n]
|
||||
.cal.t$n tag bind "TKTAG$tagno" <Leave> [list TaggedLeave .cal.t$n]
|
||||
.cal.t$n tag bind $fntag <ButtonPress-3> "FireEditor .cal.t$n"
|
||||
} else {
|
||||
.cal.t$n insert end [string trim $stuff] [concat REM TAGGED "TKTAG$tagno" "date_$date" $extratags]
|
||||
}
|
||||
set TagToObj($all) $obj
|
||||
} else {
|
||||
if {"$fntag" == "x" } {
|
||||
@@ -1340,12 +1362,6 @@ proc FillCalWindow {} {
|
||||
}
|
||||
.cal.t$n insert end "\n"
|
||||
.cal.t$n configure -state disabled -takefocus 0
|
||||
}
|
||||
if {$problem} {
|
||||
set RemindErrors [unique_lines $errmsg]
|
||||
set_button_to_errors
|
||||
}
|
||||
DisplayTime
|
||||
}
|
||||
|
||||
proc unique_lines { s } {
|
||||
@@ -1376,7 +1392,7 @@ proc MoveMonth {delta} {
|
||||
incr CurYear
|
||||
}
|
||||
|
||||
FillCalWindow
|
||||
FillCalWindowMonthly
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -1391,7 +1407,7 @@ proc ThisMonth {} {
|
||||
}
|
||||
set CurMonth $TodayMonth
|
||||
set CurYear $TodayYear
|
||||
FillCalWindow
|
||||
FillCalWindowMonthly
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -1729,7 +1745,7 @@ proc DoGoto {} {
|
||||
set CurMonth $month
|
||||
set CurYear $year
|
||||
catch { destroy .g }
|
||||
FillCalWindow
|
||||
FillCalWindowMonthly
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -3137,7 +3153,7 @@ proc DaemonReadable { file } {
|
||||
# Date has rolled over -- clear "ignore" list
|
||||
catch { unset Ignore }
|
||||
Initialize
|
||||
FillCalWindow
|
||||
FillCalWindowMonthly
|
||||
ShowTodaysReminders 0 ""
|
||||
}
|
||||
"reread" {
|
||||
@@ -3340,7 +3356,7 @@ proc main {} {
|
||||
ShowTodaysReminders 0 ""
|
||||
ScanForTags $AppendFile
|
||||
CreateCalWindow $DayNames
|
||||
FillCalWindow
|
||||
FillCalWindowMonthly
|
||||
StartBackgroundRemindDaemon
|
||||
DisplayTimeContinuously
|
||||
}
|
||||
@@ -3962,6 +3978,7 @@ proc EditTaggedReminderHelper { w } {
|
||||
if {$index < 0} {
|
||||
return
|
||||
}
|
||||
|
||||
set date [string range [lindex [$w tag names current] $index] 5 end]
|
||||
# Read in options
|
||||
set opts [ReadTaggedOptions $tag $date]
|
||||
@@ -4041,7 +4058,7 @@ proc EditTaggedReminderHelper { w } {
|
||||
proc UpdateForChanges {} {
|
||||
global TimerUpdateForChanges
|
||||
catch { after cancel $TimerUpdateForChanges }
|
||||
FillCalWindow
|
||||
FillCalWindowMonthly
|
||||
RestartBackgroundRemindDaemon
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user