1 /* TUI layout window management.
3 Copyright (C) 1998-2019 Free Software Foundation, Inc.
5 Contributed by Hewlett-Packard Company.
7 This file is part of GDB.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
23 #include "arch-utils.h"
31 #include "tui/tui-data.h"
32 #include "tui/tui-windata.h"
33 #include "tui/tui-wingeneral.h"
34 #include "tui/tui-stack.h"
35 #include "tui/tui-regs.h"
36 #include "tui/tui-win.h"
37 #include "tui/tui-winsource.h"
38 #include "tui/tui-disasm.h"
39 #include "tui/tui-layout.h"
40 #include "gdb_curses.h"
42 /*******************************
44 ********************************/
45 static void show_layout (enum tui_layout_type
);
46 static void init_gen_win_info (struct tui_gen_win_info
*,
49 static void *init_and_make_win (void *, enum tui_win_type
,
50 int, int, int, int, int);
51 static void show_source_or_disasm_and_command (enum tui_layout_type
);
52 static struct tui_win_info
*make_source_or_disasm_window (enum tui_win_type
,
54 static struct tui_win_info
*make_command_window (int, int);
55 static struct tui_win_info
*make_source_window (int, int);
56 static struct tui_win_info
*make_disasm_window (int, int);
57 static void make_data_window (struct tui_win_info
**, int, int);
58 static void show_source_command (void);
59 static void show_disasm_command (void);
60 static void show_source_disasm_command (void);
61 static void show_data (enum tui_layout_type
);
62 static enum tui_layout_type
next_layout (void);
63 static enum tui_layout_type
prev_layout (void);
64 static void tui_layout_command (const char *, int);
65 static void extract_display_start_addr (struct gdbarch
**, CORE_ADDR
*);
68 /***************************************
70 ***************************************/
72 #define LAYOUT_USAGE "Usage: layout prev | next | <layout_name> \n"
74 /* Show the screen layout defined. */
76 show_layout (enum tui_layout_type layout
)
78 enum tui_layout_type cur_layout
= tui_current_layout ();
80 if (layout
!= cur_layout
)
82 /* Since the new layout may cause changes in window size, we
83 should free the content and reallocate on next display of
85 tui_free_all_source_wins_content ();
86 tui_clear_source_windows ();
87 if (layout
== SRC_DATA_COMMAND
88 || layout
== DISASSEM_DATA_COMMAND
)
91 tui_refresh_all (tui_win_list
);
95 /* First make the current layout be invisible. */
96 tui_make_all_invisible ();
97 tui_make_invisible (tui_locator_win_info_ptr ());
101 /* Now show the new layout. */
103 show_source_command ();
104 tui_add_to_source_windows (TUI_SRC_WIN
);
106 case DISASSEM_COMMAND
:
107 show_disasm_command ();
108 tui_add_to_source_windows (TUI_DISASM_WIN
);
110 case SRC_DISASSEM_COMMAND
:
111 show_source_disasm_command ();
112 tui_add_to_source_windows (TUI_SRC_WIN
);
113 tui_add_to_source_windows (TUI_DISASM_WIN
);
123 /* Function to set the layout to SRC_COMMAND, DISASSEM_COMMAND,
124 SRC_DISASSEM_COMMAND, SRC_DATA_COMMAND, or DISASSEM_DATA_COMMAND. */
126 tui_set_layout (enum tui_layout_type layout_type
)
128 enum tui_status status
= TUI_SUCCESS
;
130 if (layout_type
!= UNDEFINED_LAYOUT
)
132 enum tui_layout_type cur_layout
= tui_current_layout (),
133 new_layout
= UNDEFINED_LAYOUT
;
134 int regs_populate
= FALSE
;
135 struct gdbarch
*gdbarch
;
137 struct tui_win_info
*win_with_focus
= tui_win_with_focus ();
138 struct tui_layout_def
*layout_def
= tui_layout_def ();
140 extract_display_start_addr (&gdbarch
, &addr
);
142 new_layout
= layout_type
;
144 regs_populate
= (new_layout
== SRC_DATA_COMMAND
145 || new_layout
== DISASSEM_DATA_COMMAND
);
146 if (new_layout
!= cur_layout
)
148 show_layout (new_layout
);
150 /* Now determine where focus should be. */
151 if (win_with_focus
!= TUI_CMD_WIN
)
156 tui_set_win_focus_to (TUI_SRC_WIN
);
157 layout_def
->display_mode
= SRC_WIN
;
158 layout_def
->split
= FALSE
;
160 case DISASSEM_COMMAND
:
161 /* The previous layout was not showing code.
162 This can happen if there is no source
165 1. if the source file is in another dir OR
166 2. if target was compiled without -g
167 We still want to show the assembly though! */
169 tui_get_begin_asm_address (&gdbarch
, &addr
);
170 tui_set_win_focus_to (TUI_DISASM_WIN
);
171 layout_def
->display_mode
= DISASSEM_WIN
;
172 layout_def
->split
= FALSE
;
174 case SRC_DISASSEM_COMMAND
:
175 /* The previous layout was not showing code.
176 This can happen if there is no source
179 1. if the source file is in another dir OR
180 2. if target was compiled without -g
181 We still want to show the assembly though! */
183 tui_get_begin_asm_address (&gdbarch
, &addr
);
184 if (win_with_focus
== TUI_SRC_WIN
)
185 tui_set_win_focus_to (TUI_SRC_WIN
);
187 tui_set_win_focus_to (TUI_DISASM_WIN
);
188 layout_def
->split
= TRUE
;
190 case SRC_DATA_COMMAND
:
191 if (win_with_focus
!= TUI_DATA_WIN
)
192 tui_set_win_focus_to (TUI_SRC_WIN
);
194 tui_set_win_focus_to (TUI_DATA_WIN
);
195 layout_def
->display_mode
= SRC_WIN
;
196 layout_def
->split
= FALSE
;
198 case DISASSEM_DATA_COMMAND
:
199 /* The previous layout was not showing code.
200 This can happen if there is no source
203 1. if the source file is in another dir OR
204 2. if target was compiled without -g
205 We still want to show the assembly though! */
207 tui_get_begin_asm_address (&gdbarch
, &addr
);
208 if (win_with_focus
!= TUI_DATA_WIN
)
209 tui_set_win_focus_to (TUI_DISASM_WIN
);
211 tui_set_win_focus_to (TUI_DATA_WIN
);
212 layout_def
->display_mode
= DISASSEM_WIN
;
213 layout_def
->split
= FALSE
;
220 * Now update the window content.
223 && (new_layout
== SRC_DATA_COMMAND
224 || new_layout
== DISASSEM_DATA_COMMAND
))
225 tui_display_all_data ();
227 tui_update_source_windows_with_addr (gdbarch
, addr
);
231 struct reggroup
*group
=
232 TUI_DATA_WIN
->detail
.data_display_info
.current_group
;
233 tui_show_registers (group
);
238 status
= TUI_FAILURE
;
243 /* Add the specified window to the layout in a logical way. This
244 means setting up the most logical layout given the window to be
247 tui_add_win_to_layout (enum tui_win_type type
)
249 enum tui_layout_type cur_layout
= tui_current_layout ();
254 if (cur_layout
!= SRC_COMMAND
255 && cur_layout
!= SRC_DISASSEM_COMMAND
256 && cur_layout
!= SRC_DATA_COMMAND
)
258 tui_clear_source_windows_detail ();
259 if (cur_layout
== DISASSEM_DATA_COMMAND
)
260 show_layout (SRC_DATA_COMMAND
);
262 show_layout (SRC_COMMAND
);
266 if (cur_layout
!= DISASSEM_COMMAND
267 && cur_layout
!= SRC_DISASSEM_COMMAND
268 && cur_layout
!= DISASSEM_DATA_COMMAND
)
270 tui_clear_source_windows_detail ();
271 if (cur_layout
== SRC_DATA_COMMAND
)
272 show_layout (DISASSEM_DATA_COMMAND
);
274 show_layout (DISASSEM_COMMAND
);
278 if (cur_layout
!= SRC_DATA_COMMAND
279 && cur_layout
!= DISASSEM_DATA_COMMAND
)
281 if (cur_layout
== DISASSEM_COMMAND
)
282 show_layout (DISASSEM_DATA_COMMAND
);
284 show_layout (SRC_DATA_COMMAND
);
293 /* Answer the height of a window. If it hasn't been created yet,
294 answer what the height of a window would be based upon its type and
297 tui_default_win_height (enum tui_win_type type
,
298 enum tui_layout_type layout
)
302 if (tui_win_list
[type
] != NULL
)
303 h
= tui_win_list
[type
]->generic
.height
;
309 case DISASSEM_COMMAND
:
310 if (TUI_CMD_WIN
== NULL
)
311 h
= tui_term_height () / 2;
313 h
= tui_term_height () - TUI_CMD_WIN
->generic
.height
;
315 case SRC_DISASSEM_COMMAND
:
316 case SRC_DATA_COMMAND
:
317 case DISASSEM_DATA_COMMAND
:
318 if (TUI_CMD_WIN
== NULL
)
319 h
= tui_term_height () / 3;
321 h
= (tui_term_height () - TUI_CMD_WIN
->generic
.height
) / 2;
333 /* Answer the height of a window. If it hasn't been created yet,
334 answer what the height of a window would be based upon its type and
337 tui_default_win_viewport_height (enum tui_win_type type
,
338 enum tui_layout_type layout
)
342 h
= tui_default_win_height (type
, layout
);
344 if (tui_win_list
[type
] == TUI_CMD_WIN
)
352 /* Complete possible layout names. TEXT is the complete text entered so
353 far, WORD is the word currently being completed. */
356 layout_completer (struct cmd_list_element
*ignore
,
357 completion_tracker
&tracker
,
358 const char *text
, const char *word
)
360 static const char *layout_names
[] =
361 { "src", "asm", "split", "regs", "next", "prev", NULL
};
363 complete_on_enum (tracker
, layout_names
, text
, word
);
366 /* Function to initialize gdb commands, for tui window layout
370 _initialize_tui_layout (void)
372 struct cmd_list_element
*cmd
;
374 cmd
= add_com ("layout", class_tui
, tui_layout_command
, _("\
375 Change the layout of windows.\n\
376 Usage: layout prev | next | LAYOUT-NAME\n\
378 src : Displays source and command windows.\n\
379 asm : Displays disassembly and command windows.\n\
380 split : Displays source, disassembly and command windows.\n\
381 regs : Displays register window. If existing layout\n\
382 is source/command or assembly/command, the \n\
383 register window is displayed. If the\n\
384 source/assembly/command (split) is displayed, \n\
385 the register window is displayed with \n\
386 the window that has current logical focus."));
387 set_cmd_completer (cmd
, layout_completer
);
391 /*************************
392 ** STATIC LOCAL FUNCTIONS
393 **************************/
396 /* Function to set the layout to SRC, ASM, SPLIT, NEXT, PREV, DATA, or
399 tui_set_layout_by_name (const char *layout_name
)
401 enum tui_status status
= TUI_SUCCESS
;
403 if (layout_name
!= NULL
)
406 enum tui_layout_type new_layout
= UNDEFINED_LAYOUT
;
407 enum tui_layout_type cur_layout
= tui_current_layout ();
409 std::string copy
= layout_name
;
410 for (i
= 0; i
< copy
.size (); i
++)
411 copy
[i
] = toupper (copy
[i
]);
412 const char *buf_ptr
= copy
.c_str ();
414 /* First check for ambiguous input. */
415 if (strlen (buf_ptr
) <= 1 && *buf_ptr
== 'S')
417 warning (_("Ambiguous command input."));
418 status
= TUI_FAILURE
;
422 if (subset_compare (buf_ptr
, "SRC"))
423 new_layout
= SRC_COMMAND
;
424 else if (subset_compare (buf_ptr
, "ASM"))
425 new_layout
= DISASSEM_COMMAND
;
426 else if (subset_compare (buf_ptr
, "SPLIT"))
427 new_layout
= SRC_DISASSEM_COMMAND
;
428 else if (subset_compare (buf_ptr
, "REGS"))
430 if (cur_layout
== SRC_COMMAND
431 || cur_layout
== SRC_DATA_COMMAND
)
432 new_layout
= SRC_DATA_COMMAND
;
434 new_layout
= DISASSEM_DATA_COMMAND
;
436 else if (subset_compare (buf_ptr
, "NEXT"))
437 new_layout
= next_layout ();
438 else if (subset_compare (buf_ptr
, "PREV"))
439 new_layout
= prev_layout ();
441 status
= TUI_FAILURE
;
443 if (status
== TUI_SUCCESS
)
445 /* Make sure the curses mode is enabled. */
447 tui_set_layout (new_layout
);
452 status
= TUI_FAILURE
;
459 extract_display_start_addr (struct gdbarch
**gdbarch_p
, CORE_ADDR
*addr_p
)
461 enum tui_layout_type cur_layout
= tui_current_layout ();
462 struct gdbarch
*gdbarch
= get_current_arch ();
465 struct symtab_and_line cursal
= get_current_source_symtab_and_line ();
470 case SRC_DATA_COMMAND
:
471 gdbarch
= TUI_SRC_WIN
->gdbarch
;
472 find_line_pc (cursal
.symtab
,
473 TUI_SRC_WIN
->start_line_or_addr
.u
.line_no
,
477 case DISASSEM_COMMAND
:
478 case SRC_DISASSEM_COMMAND
:
479 case DISASSEM_DATA_COMMAND
:
480 gdbarch
= TUI_DISASM_WIN
->gdbarch
;
481 addr
= TUI_DISASM_WIN
->start_line_or_addr
.u
.addr
;
488 *gdbarch_p
= gdbarch
;
494 tui_layout_command (const char *arg
, int from_tty
)
496 /* Switch to the selected layout. */
497 if (tui_set_layout_by_name (arg
) != TUI_SUCCESS
)
498 warning (_("Invalid layout specified.\n%s"), LAYOUT_USAGE
);
501 /* Answer the previous layout to cycle to. */
502 static enum tui_layout_type
507 new_layout
= tui_current_layout ();
508 if (new_layout
== UNDEFINED_LAYOUT
)
509 new_layout
= SRC_COMMAND
;
513 if (new_layout
== UNDEFINED_LAYOUT
)
514 new_layout
= SRC_COMMAND
;
517 return (enum tui_layout_type
) new_layout
;
521 /* Answer the next layout to cycle to. */
522 static enum tui_layout_type
527 new_layout
= tui_current_layout ();
528 if (new_layout
== SRC_COMMAND
)
529 new_layout
= DISASSEM_DATA_COMMAND
;
533 if (new_layout
== UNDEFINED_LAYOUT
)
534 new_layout
= DISASSEM_DATA_COMMAND
;
537 return (enum tui_layout_type
) new_layout
;
542 static struct tui_win_info
*
543 make_command_window (int height
, int origin_y
)
545 struct tui_win_info
*result
546 = (struct tui_win_info
*) init_and_make_win (NULL
,
553 result
->can_highlight
= FALSE
;
558 /* make_source_window().
560 static struct tui_win_info
*
561 make_source_window (int height
, int origin_y
)
563 return make_source_or_disasm_window (SRC_WIN
, height
, origin_y
);
564 } /* make_source_window */
567 /* make_disasm_window().
569 static struct tui_win_info
*
570 make_disasm_window (int height
, int origin_y
)
572 return make_source_or_disasm_window (DISASSEM_WIN
, height
, origin_y
);
573 } /* make_disasm_window */
577 make_data_window (struct tui_win_info
**win_info_ptr
,
578 int height
, int origin_y
)
581 = (struct tui_win_info
*) init_and_make_win (*win_info_ptr
,
592 /* Show the Source/Command layout. */
594 show_source_command (void)
596 show_source_or_disasm_and_command (SRC_COMMAND
);
600 /* Show the Dissassem/Command layout. */
602 show_disasm_command (void)
604 show_source_or_disasm_and_command (DISASSEM_COMMAND
);
608 /* Show the Source/Disassem/Command layout. */
610 show_source_disasm_command (void)
612 if (tui_current_layout () != SRC_DISASSEM_COMMAND
)
614 int cmd_height
, src_height
, asm_height
;
616 if (TUI_CMD_WIN
!= NULL
)
617 cmd_height
= TUI_CMD_WIN
->generic
.height
;
619 cmd_height
= tui_term_height () / 3;
621 src_height
= (tui_term_height () - cmd_height
) / 2;
622 asm_height
= tui_term_height () - (src_height
+ cmd_height
);
624 if (TUI_SRC_WIN
== NULL
)
625 tui_win_list
[SRC_WIN
] = make_source_window (src_height
, 0);
628 init_gen_win_info (&TUI_SRC_WIN
->generic
,
629 TUI_SRC_WIN
->generic
.type
,
631 TUI_SRC_WIN
->generic
.width
,
632 TUI_SRC_WIN
->execution_info
->width
,
634 TUI_SRC_WIN
->can_highlight
= TRUE
;
635 init_gen_win_info (TUI_SRC_WIN
->execution_info
,
641 tui_make_visible (&TUI_SRC_WIN
->generic
);
642 tui_make_visible (TUI_SRC_WIN
->execution_info
);
643 TUI_SRC_WIN
->m_has_locator
= false;
646 struct tui_gen_win_info
*locator
= tui_locator_win_info_ptr ();
648 tui_show_source_content (TUI_SRC_WIN
);
649 if (TUI_DISASM_WIN
== NULL
)
651 tui_win_list
[DISASSEM_WIN
]
652 = make_disasm_window (asm_height
, src_height
- 1);
654 = ((struct tui_gen_win_info
*)
655 init_and_make_win (locator
,
660 (src_height
+ asm_height
) - 1,
665 init_gen_win_info (locator
,
670 (src_height
+ asm_height
) - 1);
671 TUI_DISASM_WIN
->m_has_locator
= true;
672 init_gen_win_info (&TUI_DISASM_WIN
->generic
,
673 TUI_DISASM_WIN
->generic
.type
,
675 TUI_DISASM_WIN
->generic
.width
,
676 TUI_DISASM_WIN
->execution_info
->width
,
678 init_gen_win_info (TUI_DISASM_WIN
->execution_info
,
684 TUI_DISASM_WIN
->can_highlight
= TRUE
;
685 tui_make_visible (&TUI_DISASM_WIN
->generic
);
686 tui_make_visible (TUI_DISASM_WIN
->execution_info
);
688 TUI_SRC_WIN
->m_has_locator
= false;
689 TUI_DISASM_WIN
->m_has_locator
= true;
690 tui_make_visible (locator
);
691 tui_show_locator_content ();
692 tui_show_source_content (TUI_DISASM_WIN
);
694 if (TUI_CMD_WIN
== NULL
)
695 TUI_CMD_WIN
= make_command_window (cmd_height
,
696 tui_term_height () - cmd_height
);
699 init_gen_win_info (&TUI_CMD_WIN
->generic
,
700 TUI_CMD_WIN
->generic
.type
,
701 TUI_CMD_WIN
->generic
.height
,
702 TUI_CMD_WIN
->generic
.width
,
704 TUI_CMD_WIN
->generic
.origin
.y
);
705 TUI_CMD_WIN
->can_highlight
= FALSE
;
706 tui_make_visible (&TUI_CMD_WIN
->generic
);
708 tui_refresh_win (&TUI_CMD_WIN
->generic
);
709 tui_set_current_layout_to (SRC_DISASSEM_COMMAND
);
714 /* Show the Source/Data/Command or the Dissassembly/Data/Command
717 show_data (enum tui_layout_type new_layout
)
719 int total_height
= (tui_term_height () - TUI_CMD_WIN
->generic
.height
);
720 int src_height
, data_height
;
721 enum tui_win_type win_type
;
722 struct tui_gen_win_info
*locator
= tui_locator_win_info_ptr ();
725 data_height
= total_height
/ 2;
726 src_height
= total_height
- data_height
;
727 tui_make_all_invisible ();
728 tui_make_invisible (locator
);
729 make_data_window (&TUI_DATA_WIN
, data_height
, 0);
730 TUI_DATA_WIN
->can_highlight
= TRUE
;
731 if (new_layout
== SRC_DATA_COMMAND
)
734 win_type
= DISASSEM_WIN
;
736 tui_source_window_base
*base
;
737 if (tui_win_list
[win_type
] == NULL
)
739 if (win_type
== SRC_WIN
)
740 tui_win_list
[win_type
]
741 = make_source_window (src_height
, data_height
- 1);
743 tui_win_list
[win_type
]
744 = make_disasm_window (src_height
, data_height
- 1);
746 = ((struct tui_gen_win_info
*)
747 init_and_make_win (locator
,
754 base
= (tui_source_window_base
*) tui_win_list
[win_type
];
758 base
= (tui_source_window_base
*) tui_win_list
[win_type
];
759 init_gen_win_info (&tui_win_list
[win_type
]->generic
,
760 tui_win_list
[win_type
]->generic
.type
,
762 tui_win_list
[win_type
]->generic
.width
,
763 base
->execution_info
->width
,
765 init_gen_win_info (base
->execution_info
,
771 tui_make_visible (&tui_win_list
[win_type
]->generic
);
772 tui_make_visible (base
->execution_info
);
773 init_gen_win_info (locator
,
780 base
->m_has_locator
= true;
781 tui_make_visible (locator
);
782 tui_show_locator_content ();
783 tui_add_to_source_windows (tui_win_list
[win_type
]);
784 tui_set_current_layout_to (new_layout
);
787 /* init_gen_win_info().
790 init_gen_win_info (struct tui_gen_win_info
*win_info
,
791 enum tui_win_type type
,
792 int height
, int width
,
793 int origin_x
, int origin_y
)
797 win_info
->type
= type
;
798 win_info
->width
= width
;
799 win_info
->height
= h
;
802 win_info
->viewport_height
= h
- 1;
803 if (win_info
->type
!= CMD_WIN
)
804 win_info
->viewport_height
--;
807 win_info
->viewport_height
= 1;
808 win_info
->origin
.x
= origin_x
;
809 win_info
->origin
.y
= origin_y
;
812 } /* init_gen_win_info */
814 /* init_and_make_win().
817 init_and_make_win (void *opaque_win_info
,
818 enum tui_win_type win_type
,
819 int height
, int width
,
820 int origin_x
, int origin_y
,
823 struct tui_gen_win_info
*generic
;
825 if (opaque_win_info
== NULL
)
827 if (tui_win_is_auxillary (win_type
))
828 opaque_win_info
= (void *) tui_alloc_generic_win_info ();
830 opaque_win_info
= (void *) tui_alloc_win_info (win_type
);
832 if (tui_win_is_auxillary (win_type
))
833 generic
= (struct tui_gen_win_info
*) opaque_win_info
;
835 generic
= &((struct tui_win_info
*) opaque_win_info
)->generic
;
837 init_gen_win_info (generic
, win_type
, height
, width
, origin_x
, origin_y
);
838 if (!tui_win_is_auxillary (win_type
))
840 if (generic
->type
== CMD_WIN
)
841 ((struct tui_win_info
*) opaque_win_info
)->can_highlight
= FALSE
;
843 ((struct tui_win_info
*) opaque_win_info
)->can_highlight
= TRUE
;
845 tui_make_window (generic
, box_it
);
847 return opaque_win_info
;
851 static struct tui_win_info
*
852 make_source_or_disasm_window (enum tui_win_type type
,
853 int height
, int origin_y
)
855 struct tui_gen_win_info
*execution_info
= NULL
;
857 /* Create the exeuction info window. */
859 execution_info
= tui_source_exec_info_win_ptr ();
861 execution_info
= tui_disassem_exec_info_win_ptr ();
863 = ((struct tui_gen_win_info
*)
864 init_and_make_win (execution_info
,
872 /* Now create the source window. */
873 struct tui_source_window_base
*result
874 = ((struct tui_source_window_base
*)
875 init_and_make_win (NULL
,
878 tui_term_width () - execution_info
->width
,
879 execution_info
->width
,
882 result
->execution_info
= execution_info
;
887 /* Show the Source/Command or the Disassem layout. */
889 show_source_or_disasm_and_command (enum tui_layout_type layout_type
)
891 if (tui_current_layout () != layout_type
)
893 struct tui_win_info
**win_info_ptr
;
894 int src_height
, cmd_height
;
895 struct tui_gen_win_info
*locator
= tui_locator_win_info_ptr ();
897 if (TUI_CMD_WIN
!= NULL
)
898 cmd_height
= TUI_CMD_WIN
->generic
.height
;
900 cmd_height
= tui_term_height () / 3;
901 src_height
= tui_term_height () - cmd_height
;
903 if (layout_type
== SRC_COMMAND
)
904 win_info_ptr
= &tui_win_list
[SRC_WIN
];
906 win_info_ptr
= &tui_win_list
[DISASSEM_WIN
];
908 tui_source_window_base
*base
;
909 if ((*win_info_ptr
) == NULL
)
911 if (layout_type
== SRC_COMMAND
)
912 *win_info_ptr
= make_source_window (src_height
- 1, 0);
914 *win_info_ptr
= make_disasm_window (src_height
- 1, 0);
916 = ((struct tui_gen_win_info
*)
917 init_and_make_win (locator
,
924 base
= (tui_source_window_base
*) *win_info_ptr
;
928 base
= (tui_source_window_base
*) *win_info_ptr
;
929 init_gen_win_info (locator
,
935 base
->m_has_locator
= true;
936 init_gen_win_info (&(*win_info_ptr
)->generic
,
937 (*win_info_ptr
)->generic
.type
,
939 (*win_info_ptr
)->generic
.width
,
940 base
->execution_info
->width
,
942 init_gen_win_info (base
->execution_info
,
948 base
->can_highlight
= TRUE
;
949 tui_make_visible (&(*win_info_ptr
)->generic
);
950 tui_make_visible (base
->execution_info
);
952 if ((*win_info_ptr
) != NULL
)
954 base
->m_has_locator
= true;
955 tui_make_visible (locator
);
956 tui_show_locator_content ();
957 tui_show_source_content (*win_info_ptr
);
959 if (TUI_CMD_WIN
== NULL
)
961 TUI_CMD_WIN
= make_command_window (cmd_height
, src_height
);
962 tui_refresh_win (&TUI_CMD_WIN
->generic
);
966 init_gen_win_info (&TUI_CMD_WIN
->generic
,
967 TUI_CMD_WIN
->generic
.type
,
968 TUI_CMD_WIN
->generic
.height
,
969 TUI_CMD_WIN
->generic
.width
,
970 TUI_CMD_WIN
->generic
.origin
.x
,
971 TUI_CMD_WIN
->generic
.origin
.y
);
972 TUI_CMD_WIN
->can_highlight
= FALSE
;
973 tui_make_visible (&TUI_CMD_WIN
->generic
);
976 tui_set_current_layout_to (layout_type
);