From 4a6ba684a54095209c532de115a72e224aa26a38 Mon Sep 17 00:00:00 2001 From: Jonathan Wilkes <jancsika@yahoo.com> Date: Sat, 7 Jun 2014 20:48:21 -0400 Subject: [PATCH] made a simple animation (toggle visibility) when tracking an error associated with a toplevel canvas. Use broken box font colors for error link in console. --- pd/src/dialog_gui.tcl | 2 +- pd/src/dialog_prefs.tcl | 21 +++++++++++++++------ pd/src/g_editor.c | 19 ++++++++++++++++++- pd/src/pd.tk | 6 +++--- 4 files changed, 37 insertions(+), 11 deletions(-) diff --git a/pd/src/dialog_gui.tcl b/pd/src/dialog_gui.tcl index f951f50ec..7164430b0 100644 --- a/pd/src/dialog_gui.tcl +++ b/pd/src/dialog_gui.tcl @@ -210,7 +210,7 @@ proc ::dialog_gui::set_gui_preset {args} { set ::pd_colors(selection_rectangle) #7c71da set ::pd_colors(highlighted_text) #3e32a2 set ::pd_colors(highlighted_text_bg) #a49aea - set ::pd_colors(dash_outline) "#f00" + set ::pd_colors(dash_outline) "#ff9933" set ::pd_colors(dash_fill) "#3e32a2" set ::pd_colors(graph_border) "#777" set ::pd_colors(graph) "#3e32a2" diff --git a/pd/src/dialog_prefs.tcl b/pd/src/dialog_prefs.tcl index cb838dbbe..19b1af4fd 100644 --- a/pd/src/dialog_prefs.tcl +++ b/pd/src/dialog_prefs.tcl @@ -211,9 +211,21 @@ proc ::dialog_prefs::set_color {array key op} { graph_border {set commands [list "itemconfigure \ graph&&(!label) -stroke $c"]} graph {set commands [list "itemconfigure graph&&(!label) -fill $c"]} - dash_fill {set commands [list "itemconfigure broken&&box -fill $c"]} - dash_outline {set commands [list "itemconfigure \ - broken&&box -stroke $c"]} + dash_fill { + set commands [list "itemconfigure broken&&box -fill $c"] + if {[winfo exists .printout.frame.text]} { + .printout.frame.text tag configure errorlink -background $c + } + } + dash_outline { + set commands [list "itemconfigure broken&&box -stroke $c"] + if {[winfo exists .printout.frame.text]} { + .printout.frame.text tag configure errorlink -foreground $c + } + } + + + magic_glass_bg {set commands [list "itemconfigure \ magicGlassBg -fill $c"]} magic_glass_bd {set commands [list "itemconfigure \ @@ -226,9 +238,6 @@ proc ::dialog_prefs::set_color {array key op} { .search.navtext tag configure link -foreground $c .search.f.advancedlabel configure -foreground $c } - if {[winfo exists .printout.frame.text]} { - .printout.frame.text tag configure link -foreground $c - } # return } default {} diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c index d75207c07..2fac3814b 100644 --- a/pd/src/g_editor.c +++ b/pd/src/g_editor.c @@ -5665,6 +5665,7 @@ static int glist_dofinderror(t_glist *gl, void *error_object) } extern t_class *messresponder_class; +extern t_class *message_class; void canvas_finderror(void *error_object) { t_canvas *x; @@ -5672,10 +5673,26 @@ void canvas_finderror(void *error_object) /* Since the messresponder_class isn't patchable, we climb up to the parent message_class addy. */ if(((t_gobj *)error_object)->g_pd == messresponder_class) - error_gobj = error_object - sizeof(t_text); + { + /* do pointer math to potentially get the parent message */ + void *msg = error_object - sizeof(t_text); + /* if it looks like a message, it must be a message */ + if(((t_gobj *)msg)->g_pd == message_class) + error_gobj = msg; + } /* find all root canvases */ for (x = canvas_list; x; x = x->gl_next) { + if ((void *)x == error_gobj) + { + /* If the error is associated with a toplevel canvas, we + do a quick-and-dirty unvis and vis to give some basic + visual feedback to the user */ + glist_noselect(x); + canvas_vis(glist_getcanvas(x), 0); + canvas_vis(glist_getcanvas(x), 1); + return; + } if (glist_dofinderror(x, error_gobj)) return; } diff --git a/pd/src/pd.tk b/pd/src/pd.tk index 7826b450b..328687f21 100644 --- a/pd/src/pd.tk +++ b/pd/src/pd.tk @@ -956,12 +956,12 @@ proc pdtk_posterror {objectid loglevel errormsg} { $t configure -state normal # if we have an object id, make a friendly link... if {$objectid ne ""} { - $t insert end "error" [list obj$objectid link] + $t insert end "error" [list obj$objectid errorlink] $t tag bind obj$objectid <1> "pderror_select_by_id $objectid; break" $t tag bind obj$objectid <Enter> "$t configure -cursor hand2" $t tag bind obj$objectid <Leave> "$t configure -cursor xterm" - $t tag configure link -foreground "$::pd_colors(link)" \ - -underline on + $t tag configure errorlink -foreground "$::pd_colors(dash_outline)" \ + -underline on -background "$::pd_colors(dash_fill)" } else { $t insert end "error" } -- GitLab