This is the mail archive of the
insight@sourceware.cygnus.com
mailing list for the Insight project.
PATCH: Restore code to save window state...
- To: insight at sourceware dot cygnus dot com
- Subject: PATCH: Restore code to save window state...
- From: James Ingham <jingham at cygnus dot com>
- Date: Mon, 27 Mar 2000 18:05:59 -0800 (PST)
Hi, all...
Here is a first cut at code to restore window states when restarting a
gdbtk session. It currently doesn't restore the exact window stacking
order, but it gets the geometry & open windows right. I have checked
it in to sourceware.
Enjoy,
Jim
Index: interface.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/interface.tcl,v
retrieving revision 1.3
diff -p -r1.3 interface.tcl
*** interface.tcl 2000/03/10 18:53:05 1.3
--- interface.tcl 2000/03/28 01:57:03
*************** proc gdbtk_tcl_preloop { } {
*** 93,100 ****
# 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\""
SrcWin::point_to_main
set msg ""
catch {gdb_cmd "info files"} msg
--- 93,100 ----
# 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
! ManagedWin::startup
!
SrcWin::point_to_main
set msg ""
catch {gdb_cmd "info files"} msg
*************** proc gdbtk_tcl_preloop { } {
*** 102,107 ****
--- 102,109 ----
if {[regexp {Symbols from "(.*)"\.} $line1 dummy name]} {
set gdb_exe_name $name
}
+
+
gdbtk_update
}
*************** proc gdbtk_quit_check {} {
*** 211,216 ****
--- 213,219 ----
# ------------------------------------------------------------------
proc gdbtk_quit {} {
if {[gdbtk_quit_check]} {
+ ManagedWin::shutdown
pref_save
gdb_force_quit
}
*************** proc run_executable { {auto_start 1} } {
*** 1053,1058 ****
--- 1056,1062 ----
}
}
+ #
# Run
if {$auto_start} {
Index: managedwin.ith
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/managedwin.ith,v
retrieving revision 1.1.1.1
diff -p -r1.1.1.1 managedwin.ith
*** managedwin.ith 2000/02/07 00:19:42 1.1.1.1
--- managedwin.ith 2000/03/28 01:57:03
*************** class ManagedWin {
*** 20,25 ****
--- 20,26 ----
method destroy_toplevel {}
method quit_if_last {} {return 1}
method enable {on}
+ method pickle {}
method reveal {}
method window_name {wname {iname ""}}
*************** class ManagedWin {
*** 30,35 ****
--- 31,38 ----
proc open_dlg {class args}
proc init {}
proc restart {}
+ proc startup {}
+ proc shutdown {}
}
protected {
Index: managedwin.itb
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/managedwin.itb,v
retrieving revision 1.2
diff -p -r1.2 managedwin.itb
*** managedwin.itb 2000/03/10 23:39:10 1.2
--- managedwin.itb 2000/03/28 01:57:03
*************** body ManagedWin::window_name {wname {ina
*** 25,30 ****
--- 25,37 ----
}
}
+ # ------------------------------------------------------------
+ # 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.
*************** body ManagedWin::restart {} {
*** 51,56 ****
--- 58,92 ----
dbug W "reconfig failed for $obj - $msg"
}
}
+ }
+
+ # ------------------------------------------------------------------
+ # 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} {
Index: prefs.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/prefs.tcl,v
retrieving revision 1.1.1.1
diff -p -r1.1.1.1 prefs.tcl
*** prefs.tcl 2000/02/07 00:19:42 1.1.1.1
--- prefs.tcl 2000/03/28 01:57:03
*************** proc pref_save {{win {}}} {
*** 171,177 ****
}
#now loop through all sections writing out values
! lappend secs load console src reg stack locals watch bp search process ge
ometry help browser kod
foreach section $secs {
puts $fd "\[$section\]"
--- 171,178 ----
}
#now loop through all sections writing out values
! lappend secs load console src reg stack locals watch bp search \
! process geometry help browser kod window
foreach section $secs {
puts $fd "\[$section\]"
*************** proc pref_set_defaults {} {
*** 251,256 ****
--- 252,260 ----
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
*************** proc pref_set_defaults {} {
*** 263,269 ****
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
--- 267,272 ----
*************** proc pref_set_defaults {} {
*** 334,339 ****
--- 337,346 ----
# 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: tclIndex
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/tclIndex,v
retrieving revision 1.2
diff -p -r1.2 tclIndex
*** tclIndex 2000/03/10 18:53:05 1.2
--- tclIndex 2000/03/28 01:57:03
***************
*** 8,13 ****
--- 8,16 ----
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]]
*************** set auto_index(list_element_strcmp) [lis
*** 107,112 ****
--- 110,116 ----
set auto_index(VariableWin) [list source [file join $dir variables.tcl]]
set auto_index(::VariableWin::getLocals) [list source [file join $dir variabl
es.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 warnin
g.tcl]]
set auto_index(WatchWin) [list source [file join $dir watch.tcl]]
set auto_index(AttachDlg) [list source [file join $dir attachdlg.ith]]
*************** set auto_index(::ManagedWin::reconfig) [
*** 310,315 ****
--- 314,321 ----
set auto_index(::ManagedWin::window_name) [list source [file join $dir manage
dwin.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 managedwi
n.itb]]
+ set auto_index(::ManagedWin::startup) [list source [file join $dir managedwin
.itb]]
set auto_index(::ManagedWin::open_dlg) [list source [file join $dir managedwi
n.itb]]
set auto_index(::ManagedWin::open) [list source [file join $dir managedwin.it
b]]
set auto_index(::ManagedWin::_open) [list source [file join $dir managedwin.i
tb]]
*************** set auto_index(::SrcTextWin::_mtime_chan
*** 424,429 ****
--- 430,436 ----
set auto_index(::SrcTextWin::FillSource) [list source [file join $dir srctext
win.itb]]
set auto_index(::SrcTextWin::FillAssembly) [list source [file join $dir srcte
xtwin.itb]]
set auto_index(::SrcTextWin::FillMixed) [list source [file join $dir srctextw
in.itb]]
+ set auto_index(::SrcTextWin::_highlightAsmLine) [list source [file join $dir
srctextwin.itb]]
set auto_index(::SrcTextWin::location) [list source [file join $dir srctextwi
n.itb]]
set auto_index(::SrcTextWin::LoadFile) [list source [file join $dir srctextwi
n.itb]]
set auto_index(::SrcTextWin::display_line) [list source [file join $dir srcte
xtwin.itb]]
--
++==++==++==++==++==++==++==++==++==++==++==++==++==++==++==++==++==++==++
Jim Ingham jingham@cygnus.com
Cygnus Solutions, a Red Hat Company