OSDN Git Service

Reintroduce the code that saves away window state, and restores it
authorJim Ingham <jingham@apple.com>
Tue, 28 Mar 2000 01:59:40 +0000 (01:59 +0000)
committerJim Ingham <jingham@apple.com>
Tue, 28 Mar 2000 01:59:40 +0000 (01:59 +0000)
when you restart gdbtk.

2000-03-27  James Ingham  <jingham@leda.cygnus.com>

* interface.tcl (gdbtk_quit): Let the window manager store away
the list of active windows before quitting.
(gdbtk_tcl_preloop): Open all the windows that were active in the
former session.
* prefs.tcl (pref_set_defaults): Set the default value of the
"gdb/window/active" pref.  Stores the list of active windows.
* managedwin.itb (ManagedWin::pickle): New method - store away
instructions to recreate this window.
(ManagedWin::shutdown): New Method - run through the active windows
pickling them all.
(ManagedWin::startup): Restore all the saved active windows.
* managedwin.ith: Declare pickle, shutdown & startup.
* tclIndex: regenerate.

gdb/gdbtk/library/ChangeLog
gdb/gdbtk/library/interface.tcl
gdb/gdbtk/library/managedwin.itb
gdb/gdbtk/library/managedwin.ith
gdb/gdbtk/library/prefs.tcl
gdb/gdbtk/library/tclIndex

index 9c8e629..c1e61d0 100644 (file)
@@ -1,3 +1,19 @@
+2000-03-27  James Ingham  <jingham@leda.cygnus.com>
+
+       * interface.tcl (gdbtk_quit): Let the window manager store away
+       the list of active windows before quitting.
+       (gdbtk_tcl_preloop): Open all the windows that were active in the
+       former session.
+       * prefs.tcl (pref_set_defaults): Set the default value of the
+       "gdb/window/active" pref.  Stores the list of active windows.
+       * managedwin.itb (ManagedWin::pickle): New method - store away
+       instructions to recreate this window.
+       (ManagedWin::shutdown): New Method - run through the active windows
+       pickling them all.
+       (ManagedWin::startup): Restore all the saved active windows.
+       * managedwin.ith: Declare pickle, shutdown & startup.
+       * tclIndex: regenerate.
+
 2000-03-10  James Ingham  <jingham@leda.cygnus.com>
 
        * targetselection.ith (get_target_list): Should be a proc, since
index b7b9ddf..248d1fe 100644 (file)
@@ -93,8 +93,8 @@ proc gdbtk_tcl_preloop { } {
   # then we will have called pre_add_symbol, which would set us to busy,
   # but not the corresponding post_add_symbol.  Do this here just in case...
   after idle gdbtk_idle 
-  set src [ManagedWin::open SrcWin]
-  debug "In preloop, with src: \"$src\" & error: \"$::errorInfo\""
+  ManagedWin::startup
+
   SrcWin::point_to_main
   set msg ""
   catch {gdb_cmd "info files"} msg
@@ -102,6 +102,8 @@ proc gdbtk_tcl_preloop { } {
   if {[regexp {Symbols from "(.*)"\.} $line1 dummy name]} {
     set gdb_exe_name $name
   }
+
+  
   gdbtk_update
 }
 
@@ -211,6 +213,7 @@ proc gdbtk_quit_check {} {
 # ------------------------------------------------------------------
 proc gdbtk_quit {} {
   if {[gdbtk_quit_check]} {
+    ManagedWin::shutdown
     pref_save
     gdb_force_quit
   }
@@ -1053,6 +1056,7 @@ proc run_executable { {auto_start 1} } {
       }
     }
 
+    # 
     # Run
 
     if {$auto_start} {
index bdecd10..e082f09 100644 (file)
@@ -25,6 +25,13 @@ body ManagedWin::window_name {wname {iname ""}} {
   }
 }
 
+# ------------------------------------------------------------
+# pickle - This is the base class pickle method.  It returns a
+#  a command that can be used to recreate this particular window.  
+# ------------------------------------------------------------
+body ManagedWin::pickle {} {
+  return [list ManagedWin::open [namespace tail [info class]]]
+}
 
 body ManagedWin::reveal {} {
   # Do this update to flush all changes before deiconifying the window.
@@ -53,6 +60,35 @@ body ManagedWin::restart {} {
   }
 }
 
+# ------------------------------------------------------------------
+#  shutdown - This writes all the active windows to the preferences file,
+#  so they can be restored at startup.
+#  FIXME: Currently assumes only ONE window per type...
+# ------------------------------------------------------------------
+
+body ManagedWin::shutdown {} {
+  set activeWins {}
+  foreach win $manage_active {
+    if {[$win isa ManagedWin]} {
+      lappend activeWins [$win pickle]
+    }
+  }
+  pref set gdb/window/active $activeWins
+}
+
+# ------------------------------------------------------------------
+#  startup - This restores all the windows that were opened at shutdown.
+#  FIXME: Currently assumes only ONE window per type...
+# ------------------------------------------------------------------
+
+body ManagedWin::startup {} {
+  debug "Got active list [pref get gdb/window/active]"
+
+  foreach cmd [pref get gdb/window/active] {
+    eval $cmd
+  }  
+}
+
 body ManagedWin::open_dlg {class args} {
   
   set newwin [eval _open $class $args]
index a25cee4..521320e 100644 (file)
@@ -20,6 +20,7 @@ class ManagedWin {
     method destroy_toplevel {}
     method quit_if_last {} {return 1}
     method enable {on}
+    method pickle {}
     method reveal {}
     method window_name {wname {iname ""}}
 
@@ -30,6 +31,8 @@ class ManagedWin {
     proc open_dlg {class args}
     proc init {}
     proc restart {}
+    proc startup {}
+    proc shutdown {}
   }
 
   protected {
index bc69b13..668fbdd 100644 (file)
@@ -171,7 +171,8 @@ proc pref_save {{win {}}} {
     }
 
     #now loop through all sections writing out values
-    lappend secs load console src reg stack locals watch bp search process geometry help browser kod
+    lappend secs load console src reg stack locals watch bp search \
+      process geometry help browser kod window
 
     foreach section $secs {
       puts $fd "\[$section\]"
@@ -251,6 +252,9 @@ proc pref_set_defaults {} {
     pref define gdb/load/port "/dev/ttyS0"
   }
 
+  # The list of active windows:
+  pref define gdb/window/active           {}
+
   # Console defaults
   pref define gdb/console/prompt          "(gdb) "
   pref define gdb/console/deleteLeft      1
@@ -263,7 +267,6 @@ proc pref_set_defaults {} {
   pref define gdb/src/PC_TAG              green
   pref define gdb/src/STACK_TAG           gold
   pref define gdb/src/BROWSE_TAG          \#9595e2
-  pref define gdb/src/active              1
   pref define gdb/src/handlebg            red
   pref define gdb/src/bp_fg               red
   pref define gdb/src/temp_bp_fg          orange
@@ -334,6 +337,10 @@ proc pref_set_defaults {} {
 
   # Various possible "main" functions. What's for Java?
   pref define gdb/main_names              [list MAIN___ MAIN__ main]
+
+  # These are the classes of warning dialogs, and whether the user plans
+  # to ignore them.
+  pref define gdb/warnings/signal         0
 }
 
 # This traces the global/fixed font and forces src-font to
index 35d05d6..c44b0d9 100644 (file)
@@ -8,6 +8,9 @@
 
 set auto_index(About) [list source [file join $dir about.tcl]]
 set auto_index(ActionDlg) [list source [file join $dir actiondlg.tcl]]
+set auto_index(::tty::_xterm_rgb) [list source [file join $dir inferior_term.tcl]]
+set auto_index(::tty::create) [list source [file join $dir inferior_term.tcl]]
+set auto_index(::tty::destroy) [list source [file join $dir inferior_term.tcl]]
 set auto_index(gdbtk_tcl_preloop) [list source [file join $dir interface.tcl]]
 set auto_index(gdbtk_busy) [list source [file join $dir interface.tcl]]
 set auto_index(gdbtk_update) [list source [file join $dir interface.tcl]]
@@ -107,6 +110,7 @@ set auto_index(list_element_strcmp) [list source [file join $dir util.tcl]]
 set auto_index(VariableWin) [list source [file join $dir variables.tcl]]
 set auto_index(::VariableWin::getLocals) [list source [file join $dir variables.tcl]]
 set auto_index(WarningDlg) [list source [file join $dir warning.tcl]]
+set auto_index(::WarningDlg::destructor) [list source [file join $dir warning.tcl]]
 set auto_index(::WarningDlg::constructor) [list source [file join $dir warning.tcl]]
 set auto_index(WatchWin) [list source [file join $dir watch.tcl]]
 set auto_index(AttachDlg) [list source [file join $dir attachdlg.ith]]
@@ -310,6 +314,8 @@ set auto_index(::ManagedWin::reconfig) [list source [file join $dir managedwin.i
 set auto_index(::ManagedWin::window_name) [list source [file join $dir managedwin.itb]]
 set auto_index(::ManagedWin::reveal) [list source [file join $dir managedwin.itb]]
 set auto_index(::ManagedWin::restart) [list source [file join $dir managedwin.itb]]
+set auto_index(::ManagedWin::shutdown) [list source [file join $dir managedwin.itb]]
+set auto_index(::ManagedWin::startup) [list source [file join $dir managedwin.itb]]
 set auto_index(::ManagedWin::open_dlg) [list source [file join $dir managedwin.itb]]
 set auto_index(::ManagedWin::open) [list source [file join $dir managedwin.itb]]
 set auto_index(::ManagedWin::_open) [list source [file join $dir managedwin.itb]]
@@ -424,6 +430,7 @@ set auto_index(::SrcTextWin::_mtime_changed) [list source [file join $dir srctex
 set auto_index(::SrcTextWin::FillSource) [list source [file join $dir srctextwin.itb]]
 set auto_index(::SrcTextWin::FillAssembly) [list source [file join $dir srctextwin.itb]]
 set auto_index(::SrcTextWin::FillMixed) [list source [file join $dir srctextwin.itb]]
+set auto_index(::SrcTextWin::_highlightAsmLine) [list source [file join $dir srctextwin.itb]]
 set auto_index(::SrcTextWin::location) [list source [file join $dir srctextwin.itb]]
 set auto_index(::SrcTextWin::LoadFile) [list source [file join $dir srctextwin.itb]]
 set auto_index(::SrcTextWin::display_line) [list source [file join $dir srctextwin.itb]]