1 /* TUI layout window management.
2 Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
3 Contributed by Hewlett-Packard Company.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
30 #include "tuiDataWin.h"
31 #include "tuiGeneralWin.h"
35 #include "tuiSourceWin.h"
36 #include "tuiDisassem.h"
38 /*******************************
40 ********************************/
42 static void _initGenWinInfo (TuiGenWinInfoPtr
, TuiWinType
, int, int, int, int);
43 static void _initAndMakeWin (Opaque
*, TuiWinType
, int, int, int, int, int);
44 static void _showSourceOrDisassemAndCommand (TuiLayoutType
);
45 static void _makeSourceOrDisassemWindow (TuiWinInfoPtr
*, TuiWinType
, int, int);
46 static void _makeCommandWindow (TuiWinInfoPtr
*, int, int);
47 static void _makeSourceWindow (TuiWinInfoPtr
*, int, int);
48 static void _makeDisassemWindow (TuiWinInfoPtr
*, int, int);
49 static void _makeDataWindow (TuiWinInfoPtr
*, int, int);
50 static void _showSourceCommand (void);
51 static void _showDisassemCommand (void);
52 static void _showSourceDisassemCommand (void);
53 static void _showData (TuiLayoutType
);
54 static TuiLayoutType
_nextLayout (void);
55 static TuiLayoutType
_prevLayout (void);
56 static void _tuiLayout_command (char *, int);
57 static void _tuiToggleLayout_command (char *, int);
58 static void _tui_vToggleLayout_command (va_list);
59 static void _tuiToggleSplitLayout_command (char *, int);
60 static void _tui_vToggleSplitLayout_command (va_list);
61 static CORE_ADDR
_extractDisplayStartAddr (void);
62 static void _tuiHandleXDBLayout (TuiLayoutDefPtr
);
65 /***************************************
67 ***************************************/
69 #define LAYOUT_USAGE "Usage: layout prev | next | <layout_name> \n"
71 /***************************************
73 ***************************************/
74 static TuiLayoutType lastLayout
= UNDEFINED_LAYOUT
;
76 /***************************************
78 ***************************************/
82 ** Show the screen layout defined
85 showLayout (TuiLayoutType layout
)
87 TuiLayoutType curLayout
= currentLayout ();
89 if (layout
!= curLayout
)
92 ** Since the new layout may cause changes in window size, we
93 ** should free the content and reallocate on next display of
96 tuiClearAllSourceWinsContent (NO_EMPTY_SOURCE_PROMPT
);
97 freeAllSourceWinsContent ();
98 clearSourceWindows ();
99 if (layout
== SRC_DATA_COMMAND
|| layout
== DISASSEM_DATA_COMMAND
)
102 refreshAll (winList
);
106 /* First make the current layout be invisible */
108 m_beInvisible (locatorWinInfoPtr ());
112 /* Now show the new layout */
114 _showSourceCommand ();
115 addToSourceWindows (srcWin
);
117 case DISASSEM_COMMAND
:
118 _showDisassemCommand ();
119 addToSourceWindows (disassemWin
);
121 case SRC_DISASSEM_COMMAND
:
122 _showSourceDisassemCommand ();
123 addToSourceWindows (srcWin
);
124 addToSourceWindows (disassemWin
);
138 ** Function to set the layout to SRC_COMMAND, DISASSEM_COMMAND,
139 ** SRC_DISASSEM_COMMAND, SRC_DATA_COMMAND, or DISASSEM_DATA_COMMAND.
140 ** If the layout is SRC_DATA_COMMAND, DISASSEM_DATA_COMMAND, or
141 ** UNDEFINED_LAYOUT, then the data window is populated according
142 ** to regsDisplayType.
145 tuiSetLayout (TuiLayoutType layoutType
,
146 TuiRegisterDisplayType regsDisplayType
)
148 TuiStatus status
= TUI_SUCCESS
;
150 if (layoutType
!= UNDEFINED_LAYOUT
|| regsDisplayType
!= TUI_UNDEFINED_REGS
)
152 TuiLayoutType curLayout
= currentLayout (), newLayout
= UNDEFINED_LAYOUT
;
153 int regsPopulate
= FALSE
;
154 CORE_ADDR addr
= _extractDisplayStartAddr ();
155 TuiWinInfoPtr newWinWithFocus
= (TuiWinInfoPtr
) NULL
, winWithFocus
= tuiWinWithFocus ();
156 TuiLayoutDefPtr layoutDef
= tuiLayoutDef ();
159 if (layoutType
== UNDEFINED_LAYOUT
&&
160 regsDisplayType
!= TUI_UNDEFINED_REGS
)
162 if (curLayout
== SRC_DISASSEM_COMMAND
)
163 newLayout
= DISASSEM_DATA_COMMAND
;
164 else if (curLayout
== SRC_COMMAND
|| curLayout
== SRC_DATA_COMMAND
)
165 newLayout
= SRC_DATA_COMMAND
;
166 else if (curLayout
== DISASSEM_COMMAND
||
167 curLayout
== DISASSEM_DATA_COMMAND
)
168 newLayout
= DISASSEM_DATA_COMMAND
;
171 newLayout
= layoutType
;
173 regsPopulate
= (newLayout
== SRC_DATA_COMMAND
||
174 newLayout
== DISASSEM_DATA_COMMAND
||
175 regsDisplayType
!= TUI_UNDEFINED_REGS
);
176 if (newLayout
!= curLayout
|| regsDisplayType
!= TUI_UNDEFINED_REGS
)
178 if (newLayout
!= curLayout
)
180 if (winWithFocus
!= cmdWin
)
182 showLayout (newLayout
);
184 ** Now determine where focus should be
186 if (winWithFocus
!= cmdWin
)
191 tuiSetWinFocusTo (srcWin
);
192 layoutDef
->displayMode
= SRC_WIN
;
193 layoutDef
->split
= FALSE
;
195 case DISASSEM_COMMAND
:
196 /* the previous layout was not showing
197 ** code. this can happen if there is no
199 ** 1. if the source file is in another dir OR
200 ** 2. if target was compiled without -g
201 ** We still want to show the assembly though!
203 addr
= tuiGetBeginAsmAddress ();
204 tuiSetWinFocusTo (disassemWin
);
205 layoutDef
->displayMode
= DISASSEM_WIN
;
206 layoutDef
->split
= FALSE
;
208 case SRC_DISASSEM_COMMAND
:
209 /* the previous layout was not showing
210 ** code. this can happen if there is no
212 ** 1. if the source file is in another dir OR
213 ** 2. if target was compiled without -g
214 ** We still want to show the assembly though!
216 addr
= tuiGetBeginAsmAddress ();
217 if (winWithFocus
== srcWin
)
218 tuiSetWinFocusTo (srcWin
);
220 tuiSetWinFocusTo (disassemWin
);
221 layoutDef
->split
= TRUE
;
223 case SRC_DATA_COMMAND
:
224 if (winWithFocus
!= dataWin
)
225 tuiSetWinFocusTo (srcWin
);
227 tuiSetWinFocusTo (dataWin
);
228 layoutDef
->displayMode
= SRC_WIN
;
229 layoutDef
->split
= FALSE
;
231 case DISASSEM_DATA_COMMAND
:
232 /* the previous layout was not showing
233 ** code. this can happen if there is no
235 ** 1. if the source file is in another dir OR
236 ** 2. if target was compiled without -g
237 ** We still want to show the assembly though!
239 addr
= tuiGetBeginAsmAddress ();
240 if (winWithFocus
!= dataWin
)
241 tuiSetWinFocusTo (disassemWin
);
243 tuiSetWinFocusTo (dataWin
);
244 layoutDef
->displayMode
= DISASSEM_WIN
;
245 layoutDef
->split
= FALSE
;
251 if (newWinWithFocus
!= (TuiWinInfoPtr
) NULL
)
252 tuiSetWinFocusTo (newWinWithFocus
);
254 ** Now update the window content
257 (newLayout
== SRC_DATA_COMMAND
||
258 newLayout
== DISASSEM_DATA_COMMAND
))
259 tuiDisplayAllData ();
261 tuiUpdateSourceWindowsWithAddr (addr
);
265 layoutDef
->regsDisplayType
=
266 (regsDisplayType
== TUI_UNDEFINED_REGS
?
267 TUI_GENERAL_REGS
: regsDisplayType
);
268 tuiShowRegisters (layoutDef
->regsDisplayType
);
273 status
= TUI_FAILURE
;
280 ** tui_vSetLayoutTo()
281 ** Function to set the layout to SRC, ASM, SPLIT, NEXT, PREV, DATA,
282 ** REGS, $REGS, $GREGS, $FREGS, $SREGS with arguments in a va_list
285 tui_vSetLayoutTo (va_list args
)
289 layoutName
= va_arg (args
, char *);
291 return (_tuiSetLayoutTo (layoutName
));
292 } /* tui_vSetLayoutTo */
296 ** tuiAddWinToLayout().
297 ** Add the specified window to the layout in a logical way.
298 ** This means setting up the most logical layout given the
299 ** window to be added.
302 tuiAddWinToLayout (TuiWinType type
)
304 TuiLayoutType curLayout
= currentLayout ();
309 if (curLayout
!= SRC_COMMAND
&&
310 curLayout
!= SRC_DISASSEM_COMMAND
&&
311 curLayout
!= SRC_DATA_COMMAND
)
313 clearSourceWindowsDetail ();
314 if (curLayout
== DISASSEM_DATA_COMMAND
)
315 showLayout (SRC_DATA_COMMAND
);
317 showLayout (SRC_COMMAND
);
321 if (curLayout
!= DISASSEM_COMMAND
&&
322 curLayout
!= SRC_DISASSEM_COMMAND
&&
323 curLayout
!= DISASSEM_DATA_COMMAND
)
325 clearSourceWindowsDetail ();
326 if (curLayout
== SRC_DATA_COMMAND
)
327 showLayout (DISASSEM_DATA_COMMAND
);
329 showLayout (DISASSEM_COMMAND
);
333 if (curLayout
!= SRC_DATA_COMMAND
&&
334 curLayout
!= DISASSEM_DATA_COMMAND
)
336 if (curLayout
== DISASSEM_COMMAND
)
337 showLayout (DISASSEM_DATA_COMMAND
);
339 showLayout (SRC_DATA_COMMAND
);
347 } /* tuiAddWinToLayout */
351 ** tui_vAddWinToLayout().
352 ** Add the specified window to the layout in a logical way,
353 ** with arguments in a va_list.
356 tui_vAddWinToLayout (va_list args
)
358 TuiWinType type
= va_arg (args
, TuiWinType
);
360 tuiAddWinToLayout (type
);
363 } /* tui_vAddWinToLayout */
367 ** tuiDefaultWinHeight().
368 ** Answer the height of a window. If it hasn't been created yet,
369 ** answer what the height of a window would be based upon its
370 ** type and the layout.
373 tuiDefaultWinHeight (TuiWinType type
, TuiLayoutType layout
)
377 if (winList
[type
] != (TuiWinInfoPtr
) NULL
)
378 h
= winList
[type
]->generic
.height
;
384 case DISASSEM_COMMAND
:
385 if (m_winPtrIsNull (cmdWin
))
386 h
= termHeight () / 2;
388 h
= termHeight () - cmdWin
->generic
.height
;
390 case SRC_DISASSEM_COMMAND
:
391 case SRC_DATA_COMMAND
:
392 case DISASSEM_DATA_COMMAND
:
393 if (m_winPtrIsNull (cmdWin
))
394 h
= termHeight () / 3;
396 h
= (termHeight () - cmdWin
->generic
.height
) / 2;
405 } /* tuiDefaultWinHeight */
409 ** tuiDefaultWinViewportHeight().
410 ** Answer the height of a window. If it hasn't been created yet,
411 ** answer what the height of a window would be based upon its
412 ** type and the layout.
415 tuiDefaultWinViewportHeight (TuiWinType type
, TuiLayoutType layout
)
419 h
= tuiDefaultWinHeight (type
, layout
);
421 if (winList
[type
] == cmdWin
)
427 } /* tuiDefaultWinViewportHeight */
431 ** _initialize_tuiLayout().
432 ** Function to initialize gdb commands, for tui window layout
436 _initialize_tuiLayout (void)
438 add_com ("layout", class_tui
, _tuiLayout_command
,
439 "Change the layout of windows.\n\
440 Usage: layout prev | next | <layout_name> \n\
442 src : Displays source and command windows.\n\
443 asm : Displays disassembly and command windows.\n\
444 split : Displays source, disassembly and command windows.\n\
445 regs : Displays register window. If existing layout\n\
446 is source/command or assembly/command, the \n\
447 register window is displayed. If the\n\
448 source/assembly/command (split) is displayed, \n\
449 the register window is displayed with \n\
450 the window that has current logical focus.\n");
453 add_com ("td", class_tui
, _tuiToggleLayout_command
,
454 "Toggle between Source/Command and Disassembly/Command layouts.\n");
455 add_com ("ts", class_tui
, _tuiToggleSplitLayout_command
,
456 "Toggle between Source/Command or Disassembly/Command and \n\
457 Source/Disassembly/Command layouts.\n");
462 /*************************
463 ** STATIC LOCAL FUNCTIONS
464 **************************/
469 ** Function to set the layout to SRC, ASM, SPLIT, NEXT, PREV, DATA, REGS,
470 ** $REGS, $GREGS, $FREGS, $SREGS.
473 tui_set_layout (const char *layoutName
)
475 TuiStatus status
= TUI_SUCCESS
;
477 if (layoutName
!= (char *) NULL
)
480 register char *bufPtr
;
481 TuiLayoutType newLayout
= UNDEFINED_LAYOUT
;
482 TuiRegisterDisplayType dpyType
= TUI_UNDEFINED_REGS
;
483 TuiLayoutType curLayout
= currentLayout ();
485 bufPtr
= (char *) tuiStrDup (layoutName
);
486 for (i
= 0; (i
< strlen (layoutName
)); i
++)
487 bufPtr
[i
] = toupper (bufPtr
[i
]);
489 /* First check for ambiguous input */
490 if (strlen (bufPtr
) <= 1 && (*bufPtr
== 'S' || *bufPtr
== '$'))
492 warning ("Ambiguous command input.\n");
493 status
= TUI_FAILURE
;
497 if (subset_compare (bufPtr
, "SRC"))
498 newLayout
= SRC_COMMAND
;
499 else if (subset_compare (bufPtr
, "ASM"))
500 newLayout
= DISASSEM_COMMAND
;
501 else if (subset_compare (bufPtr
, "SPLIT"))
502 newLayout
= SRC_DISASSEM_COMMAND
;
503 else if (subset_compare (bufPtr
, "REGS") ||
504 subset_compare (bufPtr
, TUI_GENERAL_SPECIAL_REGS_NAME
) ||
505 subset_compare (bufPtr
, TUI_GENERAL_REGS_NAME
) ||
506 subset_compare (bufPtr
, TUI_FLOAT_REGS_NAME
) ||
507 subset_compare (bufPtr
, TUI_SPECIAL_REGS_NAME
))
509 if (curLayout
== SRC_COMMAND
|| curLayout
== SRC_DATA_COMMAND
)
510 newLayout
= SRC_DATA_COMMAND
;
512 newLayout
= DISASSEM_DATA_COMMAND
;
514 /* could ifdef out the following code. when compile with -z, there are null
515 pointer references that cause a core dump if 'layout regs' is the first
516 layout command issued by the user. HP has asked us to hook up this code
519 if (subset_compare (bufPtr
, TUI_FLOAT_REGS_NAME
))
521 if (dataWin
->detail
.dataDisplayInfo
.regsDisplayType
!=
523 dataWin
->detail
.dataDisplayInfo
.regsDisplayType
!=
525 dpyType
= TUI_SFLOAT_REGS
;
528 dataWin
->detail
.dataDisplayInfo
.regsDisplayType
;
530 else if (subset_compare (bufPtr
,
531 TUI_GENERAL_SPECIAL_REGS_NAME
))
532 dpyType
= TUI_GENERAL_AND_SPECIAL_REGS
;
533 else if (subset_compare (bufPtr
, TUI_GENERAL_REGS_NAME
))
534 dpyType
= TUI_GENERAL_REGS
;
535 else if (subset_compare (bufPtr
, TUI_SPECIAL_REGS_NAME
))
536 dpyType
= TUI_SPECIAL_REGS
;
539 if (dataWin
->detail
.dataDisplayInfo
.regsDisplayType
!=
542 dataWin
->detail
.dataDisplayInfo
.regsDisplayType
;
544 dpyType
= TUI_GENERAL_REGS
;
547 /* end of potential ifdef
550 /* if ifdefed out code above, then assume that the user wishes to display the
551 general purpose registers
554 /* dpyType = TUI_GENERAL_REGS;
557 else if (subset_compare (bufPtr
, "NEXT"))
558 newLayout
= _nextLayout ();
559 else if (subset_compare (bufPtr
, "PREV"))
560 newLayout
= _prevLayout ();
562 status
= TUI_FAILURE
;
565 tuiSetLayout (newLayout
, dpyType
);
569 status
= TUI_FAILURE
;
576 _extractDisplayStartAddr (void)
578 TuiLayoutType curLayout
= currentLayout ();
585 case SRC_DATA_COMMAND
:
586 find_line_pc (current_source_symtab
,
587 srcWin
->detail
.sourceInfo
.startLineOrAddr
.lineNo
,
591 case DISASSEM_COMMAND
:
592 case SRC_DISASSEM_COMMAND
:
593 case DISASSEM_DATA_COMMAND
:
594 addr
= disassemWin
->detail
.sourceInfo
.startLineOrAddr
.addr
;
602 } /* _extractDisplayStartAddr */
606 _tuiHandleXDBLayout (TuiLayoutDefPtr layoutDef
)
608 if (layoutDef
->split
)
610 tuiSetLayout (SRC_DISASSEM_COMMAND
, TUI_UNDEFINED_REGS
);
611 tuiSetWinFocusTo (winList
[layoutDef
->displayMode
]);
615 if (layoutDef
->displayMode
== SRC_WIN
)
616 tuiSetLayout (SRC_COMMAND
, TUI_UNDEFINED_REGS
);
618 tuiSetLayout (DISASSEM_DATA_COMMAND
, layoutDef
->regsDisplayType
);
623 } /* _tuiHandleXDBLayout */
627 _tuiToggleLayout_command (char *arg
, int fromTTY
)
629 TuiLayoutDefPtr layoutDef
= tuiLayoutDef ();
631 if (layoutDef
->displayMode
== SRC_WIN
)
632 layoutDef
->displayMode
= DISASSEM_WIN
;
634 layoutDef
->displayMode
= SRC_WIN
;
636 if (!layoutDef
->split
)
637 _tuiHandleXDBLayout (layoutDef
);
643 _tuiToggleSplitLayout_command (char *arg
, int fromTTY
)
645 TuiLayoutDefPtr layoutDef
= tuiLayoutDef ();
647 layoutDef
->split
= (!layoutDef
->split
);
648 _tuiHandleXDBLayout (layoutDef
);
654 _tuiLayout_command (char *arg
, int fromTTY
)
656 if (tui_set_layout (arg
) != TUI_SUCCESS
)
657 warning ("Invalid layout specified.\n%s", LAYOUT_USAGE
);
663 ** Answer the previous layout to cycle to.
668 TuiLayoutType newLayout
;
670 newLayout
= currentLayout ();
671 if (newLayout
== UNDEFINED_LAYOUT
)
672 newLayout
= SRC_COMMAND
;
676 if (newLayout
== UNDEFINED_LAYOUT
)
677 newLayout
= SRC_COMMAND
;
686 ** Answer the next layout to cycle to.
691 TuiLayoutType newLayout
;
693 newLayout
= currentLayout ();
694 if (newLayout
== SRC_COMMAND
)
695 newLayout
= DISASSEM_DATA_COMMAND
;
699 if (newLayout
== UNDEFINED_LAYOUT
)
700 newLayout
= DISASSEM_DATA_COMMAND
;
709 ** _makeCommandWindow().
712 _makeCommandWindow (TuiWinInfoPtr
* winInfoPtr
, int height
, int originY
)
714 _initAndMakeWin ((Opaque
*) winInfoPtr
,
722 (*winInfoPtr
)->canHighlight
= FALSE
;
725 } /* _makeCommandWindow */
729 ** _makeSourceWindow().
732 _makeSourceWindow (TuiWinInfoPtr
* winInfoPtr
, int height
, int originY
)
734 _makeSourceOrDisassemWindow (winInfoPtr
, SRC_WIN
, height
, originY
);
737 } /* _makeSourceWindow */
741 ** _makeDisassemWindow().
744 _makeDisassemWindow (TuiWinInfoPtr
* winInfoPtr
, int height
, int originY
)
746 _makeSourceOrDisassemWindow (winInfoPtr
, DISASSEM_WIN
, height
, originY
);
749 } /* _makeDisassemWindow */
753 ** _makeDataWindow().
756 _makeDataWindow (TuiWinInfoPtr
* winInfoPtr
, int height
, int originY
)
758 _initAndMakeWin ((Opaque
*) winInfoPtr
,
767 } /* _makeDataWindow */
772 ** _showSourceCommand().
773 ** Show the Source/Command layout
776 _showSourceCommand (void)
778 _showSourceOrDisassemAndCommand (SRC_COMMAND
);
781 } /* _showSourceCommand */
785 ** _showDisassemCommand().
786 ** Show the Dissassem/Command layout
789 _showDisassemCommand (void)
791 _showSourceOrDisassemAndCommand (DISASSEM_COMMAND
);
794 } /* _showDisassemCommand */
798 ** _showSourceDisassemCommand().
799 ** Show the Source/Disassem/Command layout
802 _showSourceDisassemCommand (void)
804 TuiGenWinInfoPtr locator
= locatorWinInfoPtr ();
806 if (currentLayout () != SRC_DISASSEM_COMMAND
)
808 int cmdHeight
, srcHeight
, asmHeight
;
810 if (m_winPtrNotNull (cmdWin
))
811 cmdHeight
= cmdWin
->generic
.height
;
813 cmdHeight
= termHeight () / 3;
815 srcHeight
= (termHeight () - cmdHeight
) / 2;
816 asmHeight
= termHeight () - (srcHeight
+ cmdHeight
);
818 if (m_winPtrIsNull (srcWin
))
819 _makeSourceWindow (&srcWin
, srcHeight
, 0);
822 _initGenWinInfo (&srcWin
->generic
,
823 srcWin
->generic
.type
,
825 srcWin
->generic
.width
,
826 srcWin
->detail
.sourceInfo
.executionInfo
->width
,
828 srcWin
->canHighlight
= TRUE
;
829 _initGenWinInfo (srcWin
->detail
.sourceInfo
.executionInfo
,
835 m_beVisible (srcWin
);
836 m_beVisible (srcWin
->detail
.sourceInfo
.executionInfo
);
837 srcWin
->detail
.sourceInfo
.hasLocator
= FALSE
;;
839 if (m_winPtrNotNull (srcWin
))
841 TuiGenWinInfoPtr locator
= locatorWinInfoPtr ();
843 tuiShowSourceContent (srcWin
);
844 if (m_winPtrIsNull (disassemWin
))
846 _makeDisassemWindow (&disassemWin
, asmHeight
, srcHeight
- 1);
847 _initAndMakeWin ((Opaque
*) & locator
,
852 (srcHeight
+ asmHeight
) - 1,
857 _initGenWinInfo (locator
,
862 (srcHeight
+ asmHeight
) - 1);
863 disassemWin
->detail
.sourceInfo
.hasLocator
= TRUE
;
865 &disassemWin
->generic
,
866 disassemWin
->generic
.type
,
868 disassemWin
->generic
.width
,
869 disassemWin
->detail
.sourceInfo
.executionInfo
->width
,
871 _initGenWinInfo (disassemWin
->detail
.sourceInfo
.executionInfo
,
877 disassemWin
->canHighlight
= TRUE
;
878 m_beVisible (disassemWin
);
879 m_beVisible (disassemWin
->detail
.sourceInfo
.executionInfo
);
881 if (m_winPtrNotNull (disassemWin
))
883 srcWin
->detail
.sourceInfo
.hasLocator
= FALSE
;
884 disassemWin
->detail
.sourceInfo
.hasLocator
= TRUE
;
885 m_beVisible (locator
);
886 tuiShowLocatorContent ();
887 tuiShowSourceContent (disassemWin
);
889 if (m_winPtrIsNull (cmdWin
))
890 _makeCommandWindow (&cmdWin
,
892 termHeight () - cmdHeight
);
895 _initGenWinInfo (&cmdWin
->generic
,
896 cmdWin
->generic
.type
,
897 cmdWin
->generic
.height
,
898 cmdWin
->generic
.width
,
900 cmdWin
->generic
.origin
.y
);
901 cmdWin
->canHighlight
= FALSE
;
902 m_beVisible (cmdWin
);
904 if (m_winPtrNotNull (cmdWin
))
905 tuiRefreshWin (&cmdWin
->generic
);
908 setCurrentLayoutTo (SRC_DISASSEM_COMMAND
);
912 } /* _showSourceDisassemCommand */
917 ** Show the Source/Data/Command or the Dissassembly/Data/Command layout
920 _showData (TuiLayoutType newLayout
)
922 int totalHeight
= (termHeight () - cmdWin
->generic
.height
);
923 int srcHeight
, dataHeight
;
925 TuiGenWinInfoPtr locator
= locatorWinInfoPtr ();
928 dataHeight
= totalHeight
/ 2;
929 srcHeight
= totalHeight
- dataHeight
;
931 m_beInvisible (locator
);
932 _makeDataWindow (&dataWin
, dataHeight
, 0);
933 dataWin
->canHighlight
= TRUE
;
934 if (newLayout
== SRC_DATA_COMMAND
)
937 winType
= DISASSEM_WIN
;
938 if (m_winPtrIsNull (winList
[winType
]))
940 if (winType
== SRC_WIN
)
941 _makeSourceWindow (&winList
[winType
], srcHeight
, dataHeight
- 1);
943 _makeDisassemWindow (&winList
[winType
], srcHeight
, dataHeight
- 1);
944 _initAndMakeWin ((Opaque
*) & locator
,
954 _initGenWinInfo (&winList
[winType
]->generic
,
955 winList
[winType
]->generic
.type
,
957 winList
[winType
]->generic
.width
,
958 winList
[winType
]->detail
.sourceInfo
.executionInfo
->width
,
960 _initGenWinInfo (winList
[winType
]->detail
.sourceInfo
.executionInfo
,
966 m_beVisible (winList
[winType
]);
967 m_beVisible (winList
[winType
]->detail
.sourceInfo
.executionInfo
);
968 _initGenWinInfo (locator
,
975 winList
[winType
]->detail
.sourceInfo
.hasLocator
= TRUE
;
976 m_beVisible (locator
);
977 tuiShowLocatorContent ();
978 addToSourceWindows (winList
[winType
]);
979 setCurrentLayoutTo (newLayout
);
985 ** _initGenWinInfo().
988 _initGenWinInfo (TuiGenWinInfoPtr winInfo
, TuiWinType type
,
989 int height
, int width
, int originX
, int originY
)
993 winInfo
->type
= type
;
994 winInfo
->width
= width
;
998 winInfo
->viewportHeight
= h
- 1;
999 if (winInfo
->type
!= CMD_WIN
)
1000 winInfo
->viewportHeight
--;
1003 winInfo
->viewportHeight
= 1;
1004 winInfo
->origin
.x
= originX
;
1005 winInfo
->origin
.y
= originY
;
1008 } /* _initGenWinInfo */
1011 ** _initAndMakeWin().
1014 _initAndMakeWin (Opaque
* winInfoPtr
, TuiWinType winType
,
1015 int height
, int width
, int originX
, int originY
, int boxIt
)
1017 Opaque opaqueWinInfo
= *winInfoPtr
;
1018 TuiGenWinInfoPtr generic
;
1020 if (opaqueWinInfo
== (Opaque
) NULL
)
1022 if (m_winIsAuxillary (winType
))
1023 opaqueWinInfo
= (Opaque
) allocGenericWinInfo ();
1025 opaqueWinInfo
= (Opaque
) allocWinInfo (winType
);
1027 if (m_winIsAuxillary (winType
))
1028 generic
= (TuiGenWinInfoPtr
) opaqueWinInfo
;
1030 generic
= &((TuiWinInfoPtr
) opaqueWinInfo
)->generic
;
1032 if (opaqueWinInfo
!= (Opaque
) NULL
)
1034 _initGenWinInfo (generic
, winType
, height
, width
, originX
, originY
);
1035 if (!m_winIsAuxillary (winType
))
1037 if (generic
->type
== CMD_WIN
)
1038 ((TuiWinInfoPtr
) opaqueWinInfo
)->canHighlight
= FALSE
;
1040 ((TuiWinInfoPtr
) opaqueWinInfo
)->canHighlight
= TRUE
;
1042 makeWindow (generic
, boxIt
);
1043 if (winType
== LOCATOR_WIN
)
1044 tuiClearLocatorDisplay ();
1046 *winInfoPtr
= opaqueWinInfo
;
1049 } /* _initAndMakeWin */
1053 ** _makeSourceOrDisassemWindow().
1056 _makeSourceOrDisassemWindow (TuiWinInfoPtr
* winInfoPtr
, TuiWinType type
,
1057 int height
, int originY
)
1059 TuiGenWinInfoPtr executionInfo
= (TuiGenWinInfoPtr
) NULL
;
1062 ** Create the exeuction info window.
1064 if (type
== SRC_WIN
)
1065 executionInfo
= sourceExecInfoWinPtr ();
1067 executionInfo
= disassemExecInfoWinPtr ();
1068 _initAndMakeWin ((Opaque
*) & executionInfo
,
1076 ** Now create the source window.
1078 _initAndMakeWin ((Opaque
*) winInfoPtr
,
1081 termWidth () - executionInfo
->width
,
1082 executionInfo
->width
,
1086 (*winInfoPtr
)->detail
.sourceInfo
.executionInfo
= executionInfo
;
1089 } /* _makeSourceOrDisassemWindow */
1093 ** _showSourceOrDisassemAndCommand().
1094 ** Show the Source/Command or the Disassem layout
1097 _showSourceOrDisassemAndCommand (TuiLayoutType layoutType
)
1099 if (currentLayout () != layoutType
)
1101 TuiWinInfoPtr
*winInfoPtr
;
1103 int srcHeight
, cmdHeight
;
1104 TuiGenWinInfoPtr locator
= locatorWinInfoPtr ();
1106 if (m_winPtrNotNull (cmdWin
))
1107 cmdHeight
= cmdWin
->generic
.height
;
1109 cmdHeight
= termHeight () / 3;
1110 srcHeight
= termHeight () - cmdHeight
;
1113 if (layoutType
== SRC_COMMAND
)
1114 winInfoPtr
= &srcWin
;
1116 winInfoPtr
= &disassemWin
;
1118 if (m_winPtrIsNull (*winInfoPtr
))
1120 if (layoutType
== SRC_COMMAND
)
1121 _makeSourceWindow (winInfoPtr
, srcHeight
- 1, 0);
1123 _makeDisassemWindow (winInfoPtr
, srcHeight
- 1, 0);
1124 _initAndMakeWin ((Opaque
*) & locator
,
1134 _initGenWinInfo (locator
,
1140 (*winInfoPtr
)->detail
.sourceInfo
.hasLocator
= TRUE
;
1142 &(*winInfoPtr
)->generic
,
1143 (*winInfoPtr
)->generic
.type
,
1145 (*winInfoPtr
)->generic
.width
,
1146 (*winInfoPtr
)->detail
.sourceInfo
.executionInfo
->width
,
1148 _initGenWinInfo ((*winInfoPtr
)->detail
.sourceInfo
.executionInfo
,
1154 (*winInfoPtr
)->canHighlight
= TRUE
;
1155 m_beVisible (*winInfoPtr
);
1156 m_beVisible ((*winInfoPtr
)->detail
.sourceInfo
.executionInfo
);
1158 if (m_winPtrNotNull (*winInfoPtr
))
1160 (*winInfoPtr
)->detail
.sourceInfo
.hasLocator
= TRUE
;
1161 m_beVisible (locator
);
1162 tuiShowLocatorContent ();
1163 tuiShowSourceContent (*winInfoPtr
);
1165 if (m_winPtrIsNull (cmdWin
))
1167 _makeCommandWindow (&cmdWin
, cmdHeight
, srcHeight
);
1168 tuiRefreshWin (&cmdWin
->generic
);
1172 _initGenWinInfo (&cmdWin
->generic
,
1173 cmdWin
->generic
.type
,
1174 cmdWin
->generic
.height
,
1175 cmdWin
->generic
.width
,
1176 cmdWin
->generic
.origin
.x
,
1177 cmdWin
->generic
.origin
.y
);
1178 cmdWin
->canHighlight
= FALSE
;
1179 m_beVisible (cmdWin
);
1182 setCurrentLayoutTo (layoutType
);
1186 } /* _showSourceOrDisassemAndCommand */