Add balloon help and URL support to daily reminders view.

This commit is contained in:
Dianne Skoll
2025-08-12 15:49:04 -04:00
parent 2391ff4bc7
commit 10f7889ef2

View File

@@ -4249,6 +4249,12 @@ proc DisplayTimeContinuously {} {
}
proc daily_rem_enter { lines } {
global Balloon
balloon_cancel_timer
set Balloon(HelpId) [after $Balloon(HelpTime) [list details_popup $lines]]
}
#***********************************************************************
# %PROCEDURE: ShowTodaysReminders
# %ARGUMENTS:
@@ -4348,7 +4354,9 @@ proc ShowTodaysReminders { force date } {
set arr [lsort -command compare_reminders $arr]
set old_date {}
set did_a_date 0
set t_index 0
foreach thing $arr {
incr t_index
set mydate [dict get $thing date]
if {"$mydate" != "$old_date"} {
if {"$old_date" != ""} {
@@ -4360,7 +4368,7 @@ proc ShowTodaysReminders { force date } {
}
}
set old_date $mydate
set tags {}
set tags [list "l_$t_index"]
if {[dict exists $thing r] && [dict exists $thing g] && [dict exists $thing g]} {
set r [dict get $thing r]
set g [dict get $thing g]
@@ -4385,6 +4393,24 @@ proc ShowTodaysReminders { force date } {
$w.text tag configure "clr$color" -foreground "#$color"
}
set help_lines {}
if {[dict exists $thing info]} {
set info [dict get $thing info]
if {[dict exists $info location]} {
lappend help_lines [list "Location:" [dict get $info location]]
}
if {[dict exists $info description]} {
lappend help_lines [list "Description:" [dict get $info description]]
}
if {[dict exists $info url]} {
lappend help_lines [list "URL:" "Middle-click to open [dict get $info url]"]
$w.text tag bind "l_$t_index" <ButtonPress-2> [list exec xdg-open [dict get $info url]]
}
}
if {[llength $help_lines] >= 1} {
$w.text tag bind "l_$t_index" <Enter> +[list daily_rem_enter $help_lines]
$w.text tag bind "l_$t_index" <Leave> +[list details_leave $w]
}
if {[dict exists $thing filename]} {
set fname [dict get $thing filename]
# Don't make INCLUDECMD output editable
@@ -4395,11 +4421,10 @@ proc ShowTodaysReminders { force date } {
set l [dict get $thing lineno]
}
set fntag [string cat "FILE_" $l "_" $fname]
$w.text tag bind $fntag <Enter> [list $w.text tag configure $fntag -underline 1]
$w.text tag bind $fntag <Leave> [list $w.text tag configure $fntag -underline 0]
$w.text tag bind $fntag <ButtonPress-1> [list FireEditor $w.text $fntag]
$w.text tag bind $fntag <ButtonPress-3> [list FireEditor $w.text $fntag]
lappend tags $fntag
$w.text tag bind "l_$t_index" <Enter> +[list $w.text tag configure "l_$t_index" -underline 1]
$w.text tag bind "l_$t_index" <Leave> +[list $w.text tag configure "l_$t_index" -underline 0]
$w.text tag bind "l_$t_index" <ButtonPress-1> [list FireEditor $w.text $fntag]
$w.text tag bind "l_$t_index" <ButtonPress-3> [list FireEditor $w.text $fntag]
}
}
$w.text insert end [dict get $thing body] $tags
@@ -4437,6 +4462,14 @@ proc compare_reminders { a b } {
if {$a_time > $b_time} {
return 1
}
set a_prio [dict get $a priority]
set b_prio [dict get $b priority]
if {$a_prio < $b_prio} {
return -1;
}
if {$a_prio > $b_prio} {
return 1;
}
return 0
}