public inbox for ecos-patches@sourceware.org
 help / color / mirror / Atom feed
* synth host-side fixes
@ 2009-08-23 11:39 Bart Veer
  0 siblings, 0 replies; only message in thread
From: Bart Veer @ 2009-08-23 11:39 UTC (permalink / raw)
  To: ecos-patches

This sorts out the synthetic target's GUI support for balloon help so
that packages can supply help strings for widgets in transient dialogs
and the like. Previously if balloon help had popped up for a widget in
such a dialog and the dialog then went away because of e.g. keyboard
events, things got messed up and the balloon help would never
disappear.

It also fixes a typo and adds a FIXME for the future.

Bart

2009-07-09  Bart Veer  <bartv@ecoscentric.com>

	* host/ecosynth.tcl: fix problems with balloon help when widgets
	are deleted.

Index: arch/current/host/ecosynth.tcl
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/synth/arch/current/host/ecosynth.tcl,v
retrieving revision 1.4
diff -u -p -r1.4 ecosynth.tcl
--- arch/current/host/ecosynth.tcl	29 Jan 2009 17:49:43 -0000	1.4
+++ arch/current/host/ecosynth.tcl	23 Aug 2009 11:39:06 -0000
@@ -938,7 +938,7 @@ namespace eval synth {
     proc tdf_get_all_options { devname } {
         set result [list]
         for { set i 0 } { [info exists synth::_tdf_device_options($devname,$i)] } { incr i } {
-            lappend synth::_tdf_consumed_options "$devname,$index"
+            lappend synth::_tdf_consumed_options "$devname,$i"
             lappend result $synth::_tdf_device_options($devname,$i)
         }
         return $result
@@ -1181,11 +1181,12 @@ namespace eval synth {
 
 namespace eval synth {
 
-    variable _balloon_messages
-    variable _balloon_pending ""
+    variable _balloon_current   ""
+    array set _balloon_messages [list]
+    variable _balloon_pending   ""
     
     toplevel .balloon
-    label .balloon.info -borderwidth 2 -relief groove -background "light yellow"
+    label .balloon.info -borderwidth 2 -relief groove -background "light yellow" -anchor w
     pack .balloon.info -side left -fill both -expand 1
     wm overrideredirect .balloon 1
     wm withdraw .balloon
@@ -1194,6 +1195,7 @@ namespace eval synth {
         set synth::_balloon_messages($widget) $message
         bind $widget <Enter> { synth::_balloonhelp_pending %W }
         bind $widget <Leave> { synth::_balloonhelp_cancel }
+        bind $widget <Destroy> {+synth::_balloonhelp_destroy %W }
     }
     
     proc _balloonhelp_pending { widget } {
@@ -1207,16 +1209,28 @@ namespace eval synth {
             set synth::_balloon_pending ""
         } else {
             wm withdraw .balloon
+            set synth::_balloon_current ""
         }
     }
 
+    proc _balloonhelp_destroy { widget } {
+        if { $synth::_balloon_current == $widget } {
+            wm withdraw .balloon
+            set synth::_balloon_current ""
+        }
+        unset synth::_balloon_messages($widget)
+    }
+
     proc _balloonhelp_show { widget } {
-        .balloon.info configure -text $synth::_balloon_messages($widget)
-        set x [expr [winfo rootx $widget] + 2]
-        set y [expr [winfo rooty $widget] + [winfo height $widget] + 2]
-        wm geometry .balloon +$x+$y
-        wm deiconify .balloon
-        raise .balloon
+        if { [winfo exists $widget] } {
+            set synth::_balloon_current $widget
+            .balloon.info configure -text $synth::_balloon_messages($widget)
+            set x [expr [winfo rootx $widget] + 2]
+            set y [expr [winfo rooty $widget] + [winfo height $widget] + 2]
+            wm geometry .balloon +$x+$y
+            wm deiconify .balloon
+            raise .balloon
+        }
         set synth::_balloon_pending ""
     }
 }
@@ -1586,6 +1600,8 @@ namespace eval synth {
     } else {
         set _repo $synth::_ecos_repository
     }
+    # FIXME: cope with multiple repositories.
+    
     if { ![file exists [file join $_repo "ecos.db"]] } {
         synth::report_warning "Failed to locate eCos component repository.\n   \
         Please define an environment variable ECOS_REPOSITORY.\n"

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-08-23 11:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-23 11:39 synth host-side fixes Bart Veer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).