1 /* TUI layout window management.
3 Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation,
6 Contributed by Hewlett-Packard Company.
8 This file is part of GDB.
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place - Suite 330,
23 Boston, MA 02111-1307, USA. */
25 /* FIXME: cagney/2002-02-28: The GDB coding standard indicates that
26 "defs.h" should be included first. Unfortunatly some systems
27 (currently Debian GNU/Linux) include the <stdbool.h> via <curses.h>
28 and they clash with "bfd.h"'s definiton of true/false. The correct
29 fix is to remove true/false from "bfd.h", however, until that
30 happens, hack around it by including "config.h" and <curses.h>
51 #include "tuiDataWin.h"
52 #include "tuiGeneralWin.h"
56 #include "tuiSourceWin.h"
57 #include "tuiDisassem.h"
59 /*******************************
61 ********************************/
62 static void showLayout (TuiLayoutType);
63 static void _initGenWinInfo (TuiGenWinInfoPtr, TuiWinType, int, int, int, int);
64 static void _initAndMakeWin (Opaque *, TuiWinType, int, int, int, int, int);
65 static void _showSourceOrDisassemAndCommand (TuiLayoutType);
66 static void _makeSourceOrDisassemWindow (TuiWinInfoPtr *, TuiWinType, int, int);
67 static void _makeCommandWindow (TuiWinInfoPtr *, int, int);
68 static void _makeSourceWindow (TuiWinInfoPtr *, int, int);
69 static void _makeDisassemWindow (TuiWinInfoPtr *, int, int);
70 static void _makeDataWindow (TuiWinInfoPtr *, int, int);
71 static void _showSourceCommand (void);
72 static void _showDisassemCommand (void);
73 static void _showSourceDisassemCommand (void);
74 static void _showData (TuiLayoutType);
75 static TuiLayoutType _nextLayout (void);
76 static TuiLayoutType _prevLayout (void);
77 static void _tuiLayout_command (char *, int);
78 static void _tuiToggleLayout_command (char *, int);
79 static void _tuiToggleSplitLayout_command (char *, int);
80 static CORE_ADDR _extractDisplayStartAddr (void);
81 static void _tuiHandleXDBLayout (TuiLayoutDefPtr);
84 /***************************************
86 ***************************************/
88 #define LAYOUT_USAGE "Usage: layout prev | next | <layout_name> \n"
90 /* Show the screen layout defined. */
92 showLayout (TuiLayoutType layout)
94 TuiLayoutType curLayout = currentLayout ();
96 if (layout != curLayout)
99 ** Since the new layout may cause changes in window size, we
100 ** should free the content and reallocate on next display of
103 freeAllSourceWinsContent ();
104 clearSourceWindows ();
105 if (layout == SRC_DATA_COMMAND || layout == DISASSEM_DATA_COMMAND)
108 refreshAll (winList);
112 /* First make the current layout be invisible */
114 m_beInvisible (locatorWinInfoPtr ());
118 /* Now show the new layout */
120 _showSourceCommand ();
121 addToSourceWindows (srcWin);
123 case DISASSEM_COMMAND:
124 _showDisassemCommand ();
125 addToSourceWindows (disassemWin);
127 case SRC_DISASSEM_COMMAND:
128 _showSourceDisassemCommand ();
129 addToSourceWindows (srcWin);
130 addToSourceWindows (disassemWin);
142 ** Function to set the layout to SRC_COMMAND, DISASSEM_COMMAND,
143 ** SRC_DISASSEM_COMMAND, SRC_DATA_COMMAND, or DISASSEM_DATA_COMMAND.
144 ** If the layout is SRC_DATA_COMMAND, DISASSEM_DATA_COMMAND, or
145 ** UNDEFINED_LAYOUT, then the data window is populated according
146 ** to regsDisplayType.
149 tuiSetLayout (TuiLayoutType layoutType,
150 TuiRegisterDisplayType regsDisplayType)
152 TuiStatus status = TUI_SUCCESS;
154 if (layoutType != UNDEFINED_LAYOUT || regsDisplayType != TUI_UNDEFINED_REGS)
156 TuiLayoutType curLayout = currentLayout (), newLayout = UNDEFINED_LAYOUT;
157 int regsPopulate = FALSE;
158 CORE_ADDR addr = _extractDisplayStartAddr ();
159 TuiWinInfoPtr newWinWithFocus = (TuiWinInfoPtr) NULL, winWithFocus = tuiWinWithFocus ();
160 TuiLayoutDefPtr layoutDef = tuiLayoutDef ();
163 if (layoutType == UNDEFINED_LAYOUT &&
164 regsDisplayType != TUI_UNDEFINED_REGS)
166 if (curLayout == SRC_DISASSEM_COMMAND)
167 newLayout = DISASSEM_DATA_COMMAND;
168 else if (curLayout == SRC_COMMAND || curLayout == SRC_DATA_COMMAND)
169 newLayout = SRC_DATA_COMMAND;
170 else if (curLayout == DISASSEM_COMMAND ||
171 curLayout == DISASSEM_DATA_COMMAND)
172 newLayout = DISASSEM_DATA_COMMAND;
175 newLayout = layoutType;
177 regsPopulate = (newLayout == SRC_DATA_COMMAND ||
178 newLayout == DISASSEM_DATA_COMMAND ||
179 regsDisplayType != TUI_UNDEFINED_REGS);
180 if (newLayout != curLayout || regsDisplayType != TUI_UNDEFINED_REGS)
182 if (newLayout != curLayout)
184 showLayout (newLayout);
186 ** Now determine where focus should be
188 if (winWithFocus != cmdWin)
193 tuiSetWinFocusTo (srcWin);
194 layoutDef->displayMode = SRC_WIN;
195 layoutDef->split = FALSE;
197 case DISASSEM_COMMAND:
198 /* the previous layout was not showing
199 ** code. this can happen if there is no
201 ** 1. if the source file is in another dir OR
202 ** 2. if target was compiled without -g
203 ** We still want to show the assembly though!
205 addr = tuiGetBeginAsmAddress ();
206 tuiSetWinFocusTo (disassemWin);
207 layoutDef->displayMode = DISASSEM_WIN;
208 layoutDef->split = FALSE;
210 case SRC_DISASSEM_COMMAND:
211 /* the previous layout was not showing
212 ** code. this can happen if there is no
214 ** 1. if the source file is in another dir OR
215 ** 2. if target was compiled without -g
216 ** We still want to show the assembly though!
218 addr = tuiGetBeginAsmAddress ();
219 if (winWithFocus == srcWin)
220 tuiSetWinFocusTo (srcWin);
222 tuiSetWinFocusTo (disassemWin);
223 layoutDef->split = TRUE;
225 case SRC_DATA_COMMAND:
226 if (winWithFocus != dataWin)
227 tuiSetWinFocusTo (srcWin);
229 tuiSetWinFocusTo (dataWin);
230 layoutDef->displayMode = SRC_WIN;
231 layoutDef->split = FALSE;
233 case DISASSEM_DATA_COMMAND:
234 /* the previous layout was not showing
235 ** code. this can happen if there is no
237 ** 1. if the source file is in another dir OR
238 ** 2. if target was compiled without -g
239 ** We still want to show the assembly though!
241 addr = tuiGetBeginAsmAddress ();
242 if (winWithFocus != dataWin)
243 tuiSetWinFocusTo (disassemWin);
245 tuiSetWinFocusTo (dataWin);
246 layoutDef->displayMode = DISASSEM_WIN;
247 layoutDef->split = FALSE;
253 if (newWinWithFocus != (TuiWinInfoPtr) NULL)
254 tuiSetWinFocusTo (newWinWithFocus);
256 ** Now update the window content
259 (newLayout == SRC_DATA_COMMAND ||
260 newLayout == DISASSEM_DATA_COMMAND))
261 tuiDisplayAllData ();
263 tuiUpdateSourceWindowsWithAddr (addr);
267 layoutDef->regsDisplayType =
268 (regsDisplayType == TUI_UNDEFINED_REGS ?
269 TUI_GENERAL_REGS : regsDisplayType);
270 tuiShowRegisters (layoutDef->regsDisplayType);
275 status = TUI_FAILURE;
281 ** tuiAddWinToLayout().
282 ** Add the specified window to the layout in a logical way.
283 ** This means setting up the most logical layout given the
284 ** window to be added.
287 tuiAddWinToLayout (TuiWinType type)
289 TuiLayoutType curLayout = currentLayout ();
294 if (curLayout != SRC_COMMAND &&
295 curLayout != SRC_DISASSEM_COMMAND &&
296 curLayout != SRC_DATA_COMMAND)
298 clearSourceWindowsDetail ();
299 if (curLayout == DISASSEM_DATA_COMMAND)
300 showLayout (SRC_DATA_COMMAND);
302 showLayout (SRC_COMMAND);
306 if (curLayout != DISASSEM_COMMAND &&
307 curLayout != SRC_DISASSEM_COMMAND &&
308 curLayout != DISASSEM_DATA_COMMAND)
310 clearSourceWindowsDetail ();
311 if (curLayout == SRC_DATA_COMMAND)
312 showLayout (DISASSEM_DATA_COMMAND);
314 showLayout (DISASSEM_COMMAND);
318 if (curLayout != SRC_DATA_COMMAND &&
319 curLayout != DISASSEM_DATA_COMMAND)
321 if (curLayout == DISASSEM_COMMAND)
322 showLayout (DISASSEM_DATA_COMMAND);
324 showLayout (SRC_DATA_COMMAND);
332 } /* tuiAddWinToLayout */
336 ** tuiDefaultWinHeight().
337 ** Answer the height of a window. If it hasn't been created yet,
338 ** answer what the height of a window would be based upon its
339 ** type and the layout.
342 tuiDefaultWinHeight (TuiWinType type, TuiLayoutType layout)
346 if (winList[type] != (TuiWinInfoPtr) NULL)
347 h = winList[type]->generic.height;
353 case DISASSEM_COMMAND:
354 if (m_winPtrIsNull (cmdWin))
355 h = termHeight () / 2;
357 h = termHeight () - cmdWin->generic.height;
359 case SRC_DISASSEM_COMMAND:
360 case SRC_DATA_COMMAND:
361 case DISASSEM_DATA_COMMAND:
362 if (m_winPtrIsNull (cmdWin))
363 h = termHeight () / 3;
365 h = (termHeight () - cmdWin->generic.height) / 2;
374 } /* tuiDefaultWinHeight */
378 ** tuiDefaultWinViewportHeight().
379 ** Answer the height of a window. If it hasn't been created yet,
380 ** answer what the height of a window would be based upon its
381 ** type and the layout.
384 tuiDefaultWinViewportHeight (TuiWinType type, TuiLayoutType layout)
388 h = tuiDefaultWinHeight (type, layout);
390 if (winList[type] == cmdWin)
396 } /* tuiDefaultWinViewportHeight */
400 ** _initialize_tuiLayout().
401 ** Function to initialize gdb commands, for tui window layout
405 _initialize_tuiLayout (void)
407 add_com ("layout", class_tui, _tuiLayout_command,
408 "Change the layout of windows.\n\
409 Usage: layout prev | next | <layout_name> \n\
411 src : Displays source and command windows.\n\
412 asm : Displays disassembly and command windows.\n\
413 split : Displays source, disassembly and command windows.\n\
414 regs : Displays register window. If existing layout\n\
415 is source/command or assembly/command, the \n\
416 register window is displayed. If the\n\
417 source/assembly/command (split) is displayed, \n\
418 the register window is displayed with \n\
419 the window that has current logical focus.\n");
422 add_com ("td", class_tui, _tuiToggleLayout_command,
423 "Toggle between Source/Command and Disassembly/Command layouts.\n");
424 add_com ("ts", class_tui, _tuiToggleSplitLayout_command,
425 "Toggle between Source/Command or Disassembly/Command and \n\
426 Source/Disassembly/Command layouts.\n");
431 /*************************
432 ** STATIC LOCAL FUNCTIONS
433 **************************/
438 ** Function to set the layout to SRC, ASM, SPLIT, NEXT, PREV, DATA, REGS,
439 ** $REGS, $GREGS, $FREGS, $SREGS.
442 tui_set_layout (const char *layoutName)
444 TuiStatus status = TUI_SUCCESS;
446 if (layoutName != (char *) NULL)
449 register char *bufPtr;
450 TuiLayoutType newLayout = UNDEFINED_LAYOUT;
451 TuiRegisterDisplayType dpyType = TUI_UNDEFINED_REGS;
452 TuiLayoutType curLayout = currentLayout ();
454 bufPtr = (char *) xstrdup (layoutName);
455 for (i = 0; (i < strlen (layoutName)); i++)
456 bufPtr[i] = toupper (bufPtr[i]);
458 /* First check for ambiguous input */
459 if (strlen (bufPtr) <= 1 && (*bufPtr == 'S' || *bufPtr == '$'))
461 warning ("Ambiguous command input.\n");
462 status = TUI_FAILURE;
466 if (subset_compare (bufPtr, "SRC"))
467 newLayout = SRC_COMMAND;
468 else if (subset_compare (bufPtr, "ASM"))
469 newLayout = DISASSEM_COMMAND;
470 else if (subset_compare (bufPtr, "SPLIT"))
471 newLayout = SRC_DISASSEM_COMMAND;
472 else if (subset_compare (bufPtr, "REGS") ||
473 subset_compare (bufPtr, TUI_GENERAL_SPECIAL_REGS_NAME) ||
474 subset_compare (bufPtr, TUI_GENERAL_REGS_NAME) ||
475 subset_compare (bufPtr, TUI_FLOAT_REGS_NAME) ||
476 subset_compare (bufPtr, TUI_SPECIAL_REGS_NAME))
478 if (curLayout == SRC_COMMAND || curLayout == SRC_DATA_COMMAND)
479 newLayout = SRC_DATA_COMMAND;
481 newLayout = DISASSEM_DATA_COMMAND;
483 /* could ifdef out the following code. when compile with -z, there are null
484 pointer references that cause a core dump if 'layout regs' is the first
485 layout command issued by the user. HP has asked us to hook up this code
488 if (subset_compare (bufPtr, TUI_FLOAT_REGS_NAME))
490 if (dataWin->detail.dataDisplayInfo.regsDisplayType !=
492 dataWin->detail.dataDisplayInfo.regsDisplayType !=
494 dpyType = TUI_SFLOAT_REGS;
497 dataWin->detail.dataDisplayInfo.regsDisplayType;
499 else if (subset_compare (bufPtr,
500 TUI_GENERAL_SPECIAL_REGS_NAME))
501 dpyType = TUI_GENERAL_AND_SPECIAL_REGS;
502 else if (subset_compare (bufPtr, TUI_GENERAL_REGS_NAME))
503 dpyType = TUI_GENERAL_REGS;
504 else if (subset_compare (bufPtr, TUI_SPECIAL_REGS_NAME))
505 dpyType = TUI_SPECIAL_REGS;
508 if (dataWin->detail.dataDisplayInfo.regsDisplayType !=
511 dataWin->detail.dataDisplayInfo.regsDisplayType;
513 dpyType = TUI_GENERAL_REGS;
516 /* end of potential ifdef
519 /* if ifdefed out code above, then assume that the user wishes to display the
520 general purpose registers
523 /* dpyType = TUI_GENERAL_REGS;
526 else if (subset_compare (bufPtr, "NEXT"))
527 newLayout = _nextLayout ();
528 else if (subset_compare (bufPtr, "PREV"))
529 newLayout = _prevLayout ();
531 status = TUI_FAILURE;
534 tuiSetLayout (newLayout, dpyType);
538 status = TUI_FAILURE;
545 _extractDisplayStartAddr (void)
547 TuiLayoutType curLayout = currentLayout ();
550 struct symtab_and_line cursal = get_current_source_symtab_and_line ();
555 case SRC_DATA_COMMAND:
556 find_line_pc (cursal.symtab,
557 srcWin->detail.sourceInfo.startLineOrAddr.lineNo,
561 case DISASSEM_COMMAND:
562 case SRC_DISASSEM_COMMAND:
563 case DISASSEM_DATA_COMMAND:
564 addr = disassemWin->detail.sourceInfo.startLineOrAddr.addr;
572 } /* _extractDisplayStartAddr */
576 _tuiHandleXDBLayout (TuiLayoutDefPtr layoutDef)
578 if (layoutDef->split)
580 tuiSetLayout (SRC_DISASSEM_COMMAND, TUI_UNDEFINED_REGS);
581 tuiSetWinFocusTo (winList[layoutDef->displayMode]);
585 if (layoutDef->displayMode == SRC_WIN)
586 tuiSetLayout (SRC_COMMAND, TUI_UNDEFINED_REGS);
588 tuiSetLayout (DISASSEM_DATA_COMMAND, layoutDef->regsDisplayType);
593 } /* _tuiHandleXDBLayout */
597 _tuiToggleLayout_command (char *arg, int fromTTY)
599 TuiLayoutDefPtr layoutDef = tuiLayoutDef ();
601 /* Make sure the curses mode is enabled. */
603 if (layoutDef->displayMode == SRC_WIN)
604 layoutDef->displayMode = DISASSEM_WIN;
606 layoutDef->displayMode = SRC_WIN;
608 if (!layoutDef->split)
609 _tuiHandleXDBLayout (layoutDef);
615 _tuiToggleSplitLayout_command (char *arg, int fromTTY)
617 TuiLayoutDefPtr layoutDef = tuiLayoutDef ();
619 /* Make sure the curses mode is enabled. */
621 layoutDef->split = (!layoutDef->split);
622 _tuiHandleXDBLayout (layoutDef);
628 _tuiLayout_command (char *arg, int fromTTY)
630 /* Make sure the curses mode is enabled. */
633 /* Switch to the selected layout. */
634 if (tui_set_layout (arg) != TUI_SUCCESS)
635 warning ("Invalid layout specified.\n%s", LAYOUT_USAGE);
641 ** Answer the previous layout to cycle to.
646 TuiLayoutType newLayout;
648 newLayout = currentLayout ();
649 if (newLayout == UNDEFINED_LAYOUT)
650 newLayout = SRC_COMMAND;
654 if (newLayout == UNDEFINED_LAYOUT)
655 newLayout = SRC_COMMAND;
664 ** Answer the next layout to cycle to.
669 TuiLayoutType newLayout;
671 newLayout = currentLayout ();
672 if (newLayout == SRC_COMMAND)
673 newLayout = DISASSEM_DATA_COMMAND;
677 if (newLayout == UNDEFINED_LAYOUT)
678 newLayout = DISASSEM_DATA_COMMAND;
687 ** _makeCommandWindow().
690 _makeCommandWindow (TuiWinInfoPtr * winInfoPtr, int height, int originY)
692 _initAndMakeWin ((Opaque *) winInfoPtr,
700 (*winInfoPtr)->canHighlight = FALSE;
703 } /* _makeCommandWindow */
707 ** _makeSourceWindow().
710 _makeSourceWindow (TuiWinInfoPtr * winInfoPtr, int height, int originY)
712 _makeSourceOrDisassemWindow (winInfoPtr, SRC_WIN, height, originY);
715 } /* _makeSourceWindow */
719 ** _makeDisassemWindow().
722 _makeDisassemWindow (TuiWinInfoPtr * winInfoPtr, int height, int originY)
724 _makeSourceOrDisassemWindow (winInfoPtr, DISASSEM_WIN, height, originY);
727 } /* _makeDisassemWindow */
731 ** _makeDataWindow().
734 _makeDataWindow (TuiWinInfoPtr * winInfoPtr, int height, int originY)
736 _initAndMakeWin ((Opaque *) winInfoPtr,
745 } /* _makeDataWindow */
750 ** _showSourceCommand().
751 ** Show the Source/Command layout
754 _showSourceCommand (void)
756 _showSourceOrDisassemAndCommand (SRC_COMMAND);
759 } /* _showSourceCommand */
763 ** _showDisassemCommand().
764 ** Show the Dissassem/Command layout
767 _showDisassemCommand (void)
769 _showSourceOrDisassemAndCommand (DISASSEM_COMMAND);
772 } /* _showDisassemCommand */
776 ** _showSourceDisassemCommand().
777 ** Show the Source/Disassem/Command layout
780 _showSourceDisassemCommand (void)
782 if (currentLayout () != SRC_DISASSEM_COMMAND)
784 int cmdHeight, srcHeight, asmHeight;
786 if (m_winPtrNotNull (cmdWin))
787 cmdHeight = cmdWin->generic.height;
789 cmdHeight = termHeight () / 3;
791 srcHeight = (termHeight () - cmdHeight) / 2;
792 asmHeight = termHeight () - (srcHeight + cmdHeight);
794 if (m_winPtrIsNull (srcWin))
795 _makeSourceWindow (&srcWin, srcHeight, 0);
798 _initGenWinInfo (&srcWin->generic,
799 srcWin->generic.type,
801 srcWin->generic.width,
802 srcWin->detail.sourceInfo.executionInfo->width,
804 srcWin->canHighlight = TRUE;
805 _initGenWinInfo (srcWin->detail.sourceInfo.executionInfo,
811 m_beVisible (srcWin);
812 m_beVisible (srcWin->detail.sourceInfo.executionInfo);
813 srcWin->detail.sourceInfo.hasLocator = FALSE;;
815 if (m_winPtrNotNull (srcWin))
817 TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
819 tuiShowSourceContent (srcWin);
820 if (m_winPtrIsNull (disassemWin))
822 _makeDisassemWindow (&disassemWin, asmHeight, srcHeight - 1);
823 _initAndMakeWin ((Opaque *) & locator,
828 (srcHeight + asmHeight) - 1,
833 _initGenWinInfo (locator,
838 (srcHeight + asmHeight) - 1);
839 disassemWin->detail.sourceInfo.hasLocator = TRUE;
841 &disassemWin->generic,
842 disassemWin->generic.type,
844 disassemWin->generic.width,
845 disassemWin->detail.sourceInfo.executionInfo->width,
847 _initGenWinInfo (disassemWin->detail.sourceInfo.executionInfo,
853 disassemWin->canHighlight = TRUE;
854 m_beVisible (disassemWin);
855 m_beVisible (disassemWin->detail.sourceInfo.executionInfo);
857 if (m_winPtrNotNull (disassemWin))
859 srcWin->detail.sourceInfo.hasLocator = FALSE;
860 disassemWin->detail.sourceInfo.hasLocator = TRUE;
861 m_beVisible (locator);
862 tuiShowLocatorContent ();
863 tuiShowSourceContent (disassemWin);
865 if (m_winPtrIsNull (cmdWin))
866 _makeCommandWindow (&cmdWin,
868 termHeight () - cmdHeight);
871 _initGenWinInfo (&cmdWin->generic,
872 cmdWin->generic.type,
873 cmdWin->generic.height,
874 cmdWin->generic.width,
876 cmdWin->generic.origin.y);
877 cmdWin->canHighlight = FALSE;
878 m_beVisible (cmdWin);
880 if (m_winPtrNotNull (cmdWin))
881 tuiRefreshWin (&cmdWin->generic);
884 setCurrentLayoutTo (SRC_DISASSEM_COMMAND);
888 } /* _showSourceDisassemCommand */
893 ** Show the Source/Data/Command or the Dissassembly/Data/Command layout
896 _showData (TuiLayoutType newLayout)
898 int totalHeight = (termHeight () - cmdWin->generic.height);
899 int srcHeight, dataHeight;
901 TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
904 dataHeight = totalHeight / 2;
905 srcHeight = totalHeight - dataHeight;
907 m_beInvisible (locator);
908 _makeDataWindow (&dataWin, dataHeight, 0);
909 dataWin->canHighlight = TRUE;
910 if (newLayout == SRC_DATA_COMMAND)
913 winType = DISASSEM_WIN;
914 if (m_winPtrIsNull (winList[winType]))
916 if (winType == SRC_WIN)
917 _makeSourceWindow (&winList[winType], srcHeight, dataHeight - 1);
919 _makeDisassemWindow (&winList[winType], srcHeight, dataHeight - 1);
920 _initAndMakeWin ((Opaque *) & locator,
930 _initGenWinInfo (&winList[winType]->generic,
931 winList[winType]->generic.type,
933 winList[winType]->generic.width,
934 winList[winType]->detail.sourceInfo.executionInfo->width,
936 _initGenWinInfo (winList[winType]->detail.sourceInfo.executionInfo,
942 m_beVisible (winList[winType]);
943 m_beVisible (winList[winType]->detail.sourceInfo.executionInfo);
944 _initGenWinInfo (locator,
951 winList[winType]->detail.sourceInfo.hasLocator = TRUE;
952 m_beVisible (locator);
953 tuiShowLocatorContent ();
954 addToSourceWindows (winList[winType]);
955 setCurrentLayoutTo (newLayout);
961 ** _initGenWinInfo().
964 _initGenWinInfo (TuiGenWinInfoPtr winInfo, TuiWinType type,
965 int height, int width, int originX, int originY)
969 winInfo->type = type;
970 winInfo->width = width;
974 winInfo->viewportHeight = h - 1;
975 if (winInfo->type != CMD_WIN)
976 winInfo->viewportHeight--;
979 winInfo->viewportHeight = 1;
980 winInfo->origin.x = originX;
981 winInfo->origin.y = originY;
984 } /* _initGenWinInfo */
987 ** _initAndMakeWin().
990 _initAndMakeWin (Opaque * winInfoPtr, TuiWinType winType,
991 int height, int width, int originX, int originY, int boxIt)
993 Opaque opaqueWinInfo = *winInfoPtr;
994 TuiGenWinInfoPtr generic;
996 if (opaqueWinInfo == (Opaque) NULL)
998 if (m_winIsAuxillary (winType))
999 opaqueWinInfo = (Opaque) allocGenericWinInfo ();
1001 opaqueWinInfo = (Opaque) allocWinInfo (winType);
1003 if (m_winIsAuxillary (winType))
1004 generic = (TuiGenWinInfoPtr) opaqueWinInfo;
1006 generic = &((TuiWinInfoPtr) opaqueWinInfo)->generic;
1008 if (opaqueWinInfo != (Opaque) NULL)
1010 _initGenWinInfo (generic, winType, height, width, originX, originY);
1011 if (!m_winIsAuxillary (winType))
1013 if (generic->type == CMD_WIN)
1014 ((TuiWinInfoPtr) opaqueWinInfo)->canHighlight = FALSE;
1016 ((TuiWinInfoPtr) opaqueWinInfo)->canHighlight = TRUE;
1018 makeWindow (generic, boxIt);
1020 *winInfoPtr = opaqueWinInfo;
1025 ** _makeSourceOrDisassemWindow().
1028 _makeSourceOrDisassemWindow (TuiWinInfoPtr * winInfoPtr, TuiWinType type,
1029 int height, int originY)
1031 TuiGenWinInfoPtr executionInfo = (TuiGenWinInfoPtr) NULL;
1034 ** Create the exeuction info window.
1036 if (type == SRC_WIN)
1037 executionInfo = sourceExecInfoWinPtr ();
1039 executionInfo = disassemExecInfoWinPtr ();
1040 _initAndMakeWin ((Opaque *) & executionInfo,
1048 ** Now create the source window.
1050 _initAndMakeWin ((Opaque *) winInfoPtr,
1053 termWidth () - executionInfo->width,
1054 executionInfo->width,
1058 (*winInfoPtr)->detail.sourceInfo.executionInfo = executionInfo;
1061 } /* _makeSourceOrDisassemWindow */
1065 ** _showSourceOrDisassemAndCommand().
1066 ** Show the Source/Command or the Disassem layout
1069 _showSourceOrDisassemAndCommand (TuiLayoutType layoutType)
1071 if (currentLayout () != layoutType)
1073 TuiWinInfoPtr *winInfoPtr;
1074 int srcHeight, cmdHeight;
1075 TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
1077 if (m_winPtrNotNull (cmdWin))
1078 cmdHeight = cmdWin->generic.height;
1080 cmdHeight = termHeight () / 3;
1081 srcHeight = termHeight () - cmdHeight;
1084 if (layoutType == SRC_COMMAND)
1085 winInfoPtr = &srcWin;
1087 winInfoPtr = &disassemWin;
1089 if (m_winPtrIsNull (*winInfoPtr))
1091 if (layoutType == SRC_COMMAND)
1092 _makeSourceWindow (winInfoPtr, srcHeight - 1, 0);
1094 _makeDisassemWindow (winInfoPtr, srcHeight - 1, 0);
1095 _initAndMakeWin ((Opaque *) & locator,
1105 _initGenWinInfo (locator,
1111 (*winInfoPtr)->detail.sourceInfo.hasLocator = TRUE;
1113 &(*winInfoPtr)->generic,
1114 (*winInfoPtr)->generic.type,
1116 (*winInfoPtr)->generic.width,
1117 (*winInfoPtr)->detail.sourceInfo.executionInfo->width,
1119 _initGenWinInfo ((*winInfoPtr)->detail.sourceInfo.executionInfo,
1125 (*winInfoPtr)->canHighlight = TRUE;
1126 m_beVisible (*winInfoPtr);
1127 m_beVisible ((*winInfoPtr)->detail.sourceInfo.executionInfo);
1129 if (m_winPtrNotNull (*winInfoPtr))
1131 (*winInfoPtr)->detail.sourceInfo.hasLocator = TRUE;
1132 m_beVisible (locator);
1133 tuiShowLocatorContent ();
1134 tuiShowSourceContent (*winInfoPtr);
1136 if (m_winPtrIsNull (cmdWin))
1138 _makeCommandWindow (&cmdWin, cmdHeight, srcHeight);
1139 tuiRefreshWin (&cmdWin->generic);
1143 _initGenWinInfo (&cmdWin->generic,
1144 cmdWin->generic.type,
1145 cmdWin->generic.height,
1146 cmdWin->generic.width,
1147 cmdWin->generic.origin.x,
1148 cmdWin->generic.origin.y);
1149 cmdWin->canHighlight = FALSE;
1150 m_beVisible (cmdWin);
1153 setCurrentLayoutTo (layoutType);
1157 } /* _showSourceOrDisassemAndCommand */