From: Jim Ingham Date: Tue, 28 Mar 2000 01:59:40 +0000 (+0000) Subject: Reintroduce the code that saves away window state, and restores it X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=a7046152a9ebf199b3e5710cd5c75773e8d48a1f;p=pf3gnuchains%2Fpf3gnuchains3x.git Reintroduce the code that saves away window state, and restores it when you restart gdbtk. 2000-03-27 James Ingham * 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. --- diff --git a/gdb/gdbtk/library/ChangeLog b/gdb/gdbtk/library/ChangeLog index 9c8e629d93..c1e61d0fb0 100644 --- a/gdb/gdbtk/library/ChangeLog +++ b/gdb/gdbtk/library/ChangeLog @@ -1,3 +1,19 @@ +2000-03-27 James Ingham + + * 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 * targetselection.ith (get_target_list): Should be a proc, since diff --git a/gdb/gdbtk/library/interface.tcl b/gdb/gdbtk/library/interface.tcl index b7b9ddf858..248d1fec53 100644 --- a/gdb/gdbtk/library/interface.tcl +++ b/gdb/gdbtk/library/interface.tcl @@ -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} { diff --git a/gdb/gdbtk/library/managedwin.itb b/gdb/gdbtk/library/managedwin.itb index bdecd1020f..e082f090fa 100644 --- a/gdb/gdbtk/library/managedwin.itb +++ b/gdb/gdbtk/library/managedwin.itb @@ -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] diff --git a/gdb/gdbtk/library/managedwin.ith b/gdb/gdbtk/library/managedwin.ith index a25cee41e9..521320ee1c 100644 --- a/gdb/gdbtk/library/managedwin.ith +++ b/gdb/gdbtk/library/managedwin.ith @@ -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 { diff --git a/gdb/gdbtk/library/prefs.tcl b/gdb/gdbtk/library/prefs.tcl index bc69b131f5..668fbddec5 100644 --- a/gdb/gdbtk/library/prefs.tcl +++ b/gdb/gdbtk/library/prefs.tcl @@ -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 diff --git a/gdb/gdbtk/library/tclIndex b/gdb/gdbtk/library/tclIndex index 35d05d6485..c44b0d9e7c 100644 --- a/gdb/gdbtk/library/tclIndex +++ b/gdb/gdbtk/library/tclIndex @@ -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]]