comparison lisp/gdb-ui.el @ 48600:88be03de9df4

(gdb-many-windows): Define as a minor mode. (toggle-gdb-windows): Remove. (Patch from Stefan Monnier)
author Nick Roberts <nickrob@snap.net.nz>
date Sat, 30 Nov 2002 20:57:48 +0000
parents 4934b8352621
children 00993d9b9cb7
comparison
equal deleted inserted replaced
48599:1ebb5dbaf4be 48600:88be03de9df4
28 ;; Extension of gdba.el written by Jim Kingdon from gdb 5.0 28 ;; Extension of gdba.el written by Jim Kingdon from gdb 5.0
29 29
30 ;;; Code: 30 ;;; Code:
31 31
32 (require 'gud) 32 (require 'gud)
33
34 (defcustom gdb-many-windows t
35 "If t, using gdba, start gdb with ancillary buffers visible.
36 Use `toggle-gdb-windows' to change this value during a gdb session"
37 :type 'boolean
38 :group 'gud)
39 33
40 (defvar gdb-main-or-pc nil "Initialisation for Assembler buffer.") 34 (defvar gdb-main-or-pc nil "Initialisation for Assembler buffer.")
41 (defvar gdb-current-address nil) 35 (defvar gdb-current-address nil)
42 (defvar gdb-display-in-progress nil) 36 (defvar gdb-display-in-progress nil)
43 (defvar gdb-dive nil) 37 (defvar gdb-dive nil)
88 If `gdb-many-windows' is set to nil then gdb starts with just two windows : 82 If `gdb-many-windows' is set to nil then gdb starts with just two windows :
89 the GUD and the source buffer. 83 the GUD and the source buffer.
90 84
91 The following interactive lisp functions help control operation : 85 The following interactive lisp functions help control operation :
92 86
93 `toggle-gdb-windows' - Toggle the number of windows gdb uses. 87 `gdb-many-windows' - Toggle the number of windows gdb uses.
94 `gdb-restore-windows' - to restore the layout if its lost. 88 `gdb-restore-windows' - to restore the layout if its lost.
95 `gdb-quit' - to delete (most) of the buffers used by gdb." 89 `gdb-quit' - to delete (most) of the buffers used by gdb."
96 90
97 (interactive (list (gud-query-cmdline 'gdba))) 91 (interactive (list (gud-query-cmdline 'gdba)))
98 92
2072 '("Assembler" . gdb-frame-assembler-buffer))) 2066 '("Assembler" . gdb-frame-assembler-buffer)))
2073 2067
2074 (if (display-graphic-p) 2068 (if (display-graphic-p)
2075 (gdb-make-frames-menu gud-minor-mode-map)) 2069 (gdb-make-frames-menu gud-minor-mode-map))
2076 2070
2077 ;; end of functions from gdba.el
2078
2079 ;; new functions for gdb-ui.el
2080
2081 (defvar gdb-main-file nil "Source file from which program execution begins.") 2071 (defvar gdb-main-file nil "Source file from which program execution begins.")
2082 2072
2083 ;; layout for all the windows 2073 ;; layout for all the windows
2084 (defun gdb-setup-windows () 2074 (defun gdb-setup-windows ()
2085 (gdb-display-locals-buffer) 2075 (gdb-display-locals-buffer)
2107 (split-window-horizontally) 2097 (split-window-horizontally)
2108 (other-window 1) 2098 (other-window 1)
2109 (switch-to-buffer (gdb-breakpoints-buffer-name)) 2099 (switch-to-buffer (gdb-breakpoints-buffer-name))
2110 (other-window 1)) 2100 (other-window 1))
2111 2101
2102 (define-minor-mode gdb-many-windows
2103 "Toggle the number of windows in the basic arrangement."
2104 :group 'gud
2105 :init-value t
2106 (gdb-restore-windows))
2107
2112 (defun gdb-restore-windows () 2108 (defun gdb-restore-windows ()
2113 "Restore the basic arrangement of windows used by gdba. 2109 "Restore the basic arrangement of windows used by gdba.
2114 This arrangement depends on the value of `gdb-many-windows'." 2110 This arrangement depends on the value of `gdb-many-windows'."
2115 (interactive) 2111 (interactive)
2116 (if gdb-many-windows 2112 (if gdb-many-windows
2126 (switch-to-buffer 2122 (switch-to-buffer
2127 (if gud-last-last-frame 2123 (if gud-last-last-frame
2128 (gud-find-file (car gud-last-last-frame)) 2124 (gud-find-file (car gud-last-last-frame))
2129 (gud-find-file gdb-main-file))) 2125 (gud-find-file gdb-main-file)))
2130 (other-window 1))) 2126 (other-window 1)))
2131
2132 (defun toggle-gdb-windows ()
2133 "Toggle the number of windows in the basic arrangement."
2134 (interactive)
2135 (if gdb-many-windows
2136 (progn
2137 (switch-to-buffer gud-comint-buffer)
2138 (delete-other-windows)
2139 (split-window)
2140 (other-window 1)
2141 (switch-to-buffer
2142 (if gud-last-last-frame
2143 (gud-find-file (car gud-last-last-frame))
2144 (gud-find-file gdb-main-file)))
2145 (other-window 1)
2146 (setq gdb-many-windows nil))
2147 ;else
2148 (switch-to-buffer gud-comint-buffer)
2149 (delete-other-windows)
2150 (gdb-setup-windows)
2151 (setq gdb-many-windows t)))
2152 2127
2153 (defconst breakpoint-xpm-data "/* XPM */ 2128 (defconst breakpoint-xpm-data "/* XPM */
2154 static char *magick[] = { 2129 static char *magick[] = {
2155 /* columns rows colors chars-per-pixel */ 2130 /* columns rows colors chars-per-pixel */
2156 \"12 12 2 1\", 2131 \"12 12 2 1\",