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
);
230 tui_show_registers (TUI_DATA_WIN
->current_group
);
234 status
= TUI_FAILURE
;
239 /* Add the specified window to the layout in a logical way. This
240 means setting up the most logical layout given the window to be
243 tui_add_win_to_layout (enum tui_win_type type
)
245 enum tui_layout_type cur_layout
= tui_current_layout ();
250 if (cur_layout
!= SRC_COMMAND
251 && cur_layout
!= SRC_DISASSEM_COMMAND
252 && cur_layout
!= SRC_DATA_COMMAND
)
254 tui_clear_source_windows_detail ();
255 if (cur_layout
== DISASSEM_DATA_COMMAND
)
256 show_layout (SRC_DATA_COMMAND
);
258 show_layout (SRC_COMMAND
);
262 if (cur_layout
!= DISASSEM_COMMAND
263 && cur_layout
!= SRC_DISASSEM_COMMAND
264 && cur_layout
!= DISASSEM_DATA_COMMAND
)
266 tui_clear_source_windows_detail ();
267 if (cur_layout
== SRC_DATA_COMMAND
)
268 show_layout (DISASSEM_DATA_COMMAND
);
270 show_layout (DISASSEM_COMMAND
);
274 if (cur_layout
!= SRC_DATA_COMMAND
275 && cur_layout
!= DISASSEM_DATA_COMMAND
)
277 if (cur_layout
== DISASSEM_COMMAND
)
278 show_layout (DISASSEM_DATA_COMMAND
);
280 show_layout (SRC_DATA_COMMAND
);
289 /* Answer the height of a window. If it hasn't been created yet,
290 answer what the height of a window would be based upon its type and
293 tui_default_win_height (enum tui_win_type type
,
294 enum tui_layout_type layout
)
298 if (tui_win_list
[type
] != NULL
)
299 h
= tui_win_list
[type
]->generic
.height
;
305 case DISASSEM_COMMAND
:
306 if (TUI_CMD_WIN
== NULL
)
307 h
= tui_term_height () / 2;
309 h
= tui_term_height () - TUI_CMD_WIN
->generic
.height
;
311 case SRC_DISASSEM_COMMAND
:
312 case SRC_DATA_COMMAND
:
313 case DISASSEM_DATA_COMMAND
:
314 if (TUI_CMD_WIN
== NULL
)
315 h
= tui_term_height () / 3;
317 h
= (tui_term_height () - TUI_CMD_WIN
->generic
.height
) / 2;
329 /* Answer the height of a window. If it hasn't been created yet,
330 answer what the height of a window would be based upon its type and
333 tui_default_win_viewport_height (enum tui_win_type type
,
334 enum tui_layout_type layout
)
338 h
= tui_default_win_height (type
, layout
);
340 if (tui_win_list
[type
] == TUI_CMD_WIN
)
348 /* Complete possible layout names. TEXT is the complete text entered so
349 far, WORD is the word currently being completed. */
352 layout_completer (struct cmd_list_element
*ignore
,
353 completion_tracker
&tracker
,
354 const char *text
, const char *word
)
356 static const char *layout_names
[] =
357 { "src", "asm", "split", "regs", "next", "prev", NULL
};
359 complete_on_enum (tracker
, layout_names
, text
, word
);
362 /* Function to initialize gdb commands, for tui window layout
366 _initialize_tui_layout (void)
368 struct cmd_list_element
*cmd
;
370 cmd
= add_com ("layout", class_tui
, tui_layout_command
, _("\
371 Change the layout of windows.\n\
372 Usage: layout prev | next | LAYOUT-NAME\n\
374 src : Displays source and command windows.\n\
375 asm : Displays disassembly and command windows.\n\
376 split : Displays source, disassembly and command windows.\n\
377 regs : Displays register window. If existing layout\n\
378 is source/command or assembly/command, the \n\
379 register window is displayed. If the\n\
380 source/assembly/command (split) is displayed, \n\
381 the register window is displayed with \n\
382 the window that has current logical focus."));
383 set_cmd_completer (cmd
, layout_completer
);
387 /*************************
388 ** STATIC LOCAL FUNCTIONS
389 **************************/
392 /* Function to set the layout to SRC, ASM, SPLIT, NEXT, PREV, DATA, or
395 tui_set_layout_by_name (const char *layout_name
)
397 enum tui_status status
= TUI_SUCCESS
;
399 if (layout_name
!= NULL
)
402 enum tui_layout_type new_layout
= UNDEFINED_LAYOUT
;
403 enum tui_layout_type cur_layout
= tui_current_layout ();
405 std::string copy
= layout_name
;
406 for (i
= 0; i
< copy
.size (); i
++)
407 copy
[i
] = toupper (copy
[i
]);
408 const char *buf_ptr
= copy
.c_str ();
410 /* First check for ambiguous input. */
411 if (strlen (buf_ptr
) <= 1 && *buf_ptr
== 'S')
413 warning (_("Ambiguous command input."));
414 status
= TUI_FAILURE
;
418 if (subset_compare (buf_ptr
, "SRC"))
419 new_layout
= SRC_COMMAND
;
420 else if (subset_compare (buf_ptr
, "ASM"))
421 new_layout
= DISASSEM_COMMAND
;
422 else if (subset_compare (buf_ptr
, "SPLIT"))
423 new_layout
= SRC_DISASSEM_COMMAND
;
424 else if (subset_compare (buf_ptr
, "REGS"))
426 if (cur_layout
== SRC_COMMAND
427 || cur_layout
== SRC_DATA_COMMAND
)
428 new_layout
= SRC_DATA_COMMAND
;
430 new_layout
= DISASSEM_DATA_COMMAND
;
432 else if (subset_compare (buf_ptr
, "NEXT"))
433 new_layout
= next_layout ();
434 else if (subset_compare (buf_ptr
, "PREV"))
435 new_layout
= prev_layout ();
437 status
= TUI_FAILURE
;
439 if (status
== TUI_SUCCESS
)
441 /* Make sure the curses mode is enabled. */
443 tui_set_layout (new_layout
);
448 status
= TUI_FAILURE
;
455 extract_display_start_addr (struct gdbarch
**gdbarch_p
, CORE_ADDR
*addr_p
)
457 enum tui_layout_type cur_layout
= tui_current_layout ();
458 struct gdbarch
*gdbarch
= get_current_arch ();
461 struct symtab_and_line cursal
= get_current_source_symtab_and_line ();
466 case SRC_DATA_COMMAND
:
467 gdbarch
= TUI_SRC_WIN
->gdbarch
;
468 find_line_pc (cursal
.symtab
,
469 TUI_SRC_WIN
->start_line_or_addr
.u
.line_no
,
473 case DISASSEM_COMMAND
:
474 case SRC_DISASSEM_COMMAND
:
475 case DISASSEM_DATA_COMMAND
:
476 gdbarch
= TUI_DISASM_WIN
->gdbarch
;
477 addr
= TUI_DISASM_WIN
->start_line_or_addr
.u
.addr
;
484 *gdbarch_p
= gdbarch
;
490 tui_layout_command (const char *arg
, int from_tty
)
492 /* Switch to the selected layout. */
493 if (tui_set_layout_by_name (arg
) != TUI_SUCCESS
)
494 warning (_("Invalid layout specified.\n%s"), LAYOUT_USAGE
);
497 /* Answer the previous layout to cycle to. */
498 static enum tui_layout_type
503 new_layout
= tui_current_layout ();
504 if (new_layout
== UNDEFINED_LAYOUT
)
505 new_layout
= SRC_COMMAND
;
509 if (new_layout
== UNDEFINED_LAYOUT
)
510 new_layout
= SRC_COMMAND
;
513 return (enum tui_layout_type
) new_layout
;
517 /* Answer the next layout to cycle to. */
518 static enum tui_layout_type
523 new_layout
= tui_current_layout ();
524 if (new_layout
== SRC_COMMAND
)
525 new_layout
= DISASSEM_DATA_COMMAND
;
529 if (new_layout
== UNDEFINED_LAYOUT
)
530 new_layout
= DISASSEM_DATA_COMMAND
;
533 return (enum tui_layout_type
) new_layout
;
538 static struct tui_win_info
*
539 make_command_window (int height
, int origin_y
)
541 struct tui_win_info
*result
542 = (struct tui_win_info
*) init_and_make_win (NULL
,
549 result
->can_highlight
= FALSE
;
554 /* make_source_window().
556 static struct tui_win_info
*
557 make_source_window (int height
, int origin_y
)
559 return make_source_or_disasm_window (SRC_WIN
, height
, origin_y
);
560 } /* make_source_window */
563 /* make_disasm_window().
565 static struct tui_win_info
*
566 make_disasm_window (int height
, int origin_y
)
568 return make_source_or_disasm_window (DISASSEM_WIN
, height
, origin_y
);
569 } /* make_disasm_window */
573 make_data_window (struct tui_win_info
**win_info_ptr
,
574 int height
, int origin_y
)
577 = (struct tui_win_info
*) init_and_make_win (*win_info_ptr
,
588 /* Show the Source/Command layout. */
590 show_source_command (void)
592 show_source_or_disasm_and_command (SRC_COMMAND
);
596 /* Show the Dissassem/Command layout. */
598 show_disasm_command (void)
600 show_source_or_disasm_and_command (DISASSEM_COMMAND
);
604 /* Show the Source/Disassem/Command layout. */
606 show_source_disasm_command (void)
608 if (tui_current_layout () != SRC_DISASSEM_COMMAND
)
610 int cmd_height
, src_height
, asm_height
;
612 if (TUI_CMD_WIN
!= NULL
)
613 cmd_height
= TUI_CMD_WIN
->generic
.height
;
615 cmd_height
= tui_term_height () / 3;
617 src_height
= (tui_term_height () - cmd_height
) / 2;
618 asm_height
= tui_term_height () - (src_height
+ cmd_height
);
620 if (TUI_SRC_WIN
== NULL
)
621 tui_win_list
[SRC_WIN
] = make_source_window (src_height
, 0);
624 init_gen_win_info (&TUI_SRC_WIN
->generic
,
625 TUI_SRC_WIN
->generic
.type
,
627 TUI_SRC_WIN
->generic
.width
,
628 TUI_SRC_WIN
->execution_info
->width
,
630 TUI_SRC_WIN
->can_highlight
= TRUE
;
631 init_gen_win_info (TUI_SRC_WIN
->execution_info
,
637 tui_make_visible (&TUI_SRC_WIN
->generic
);
638 tui_make_visible (TUI_SRC_WIN
->execution_info
);
639 TUI_SRC_WIN
->m_has_locator
= false;
642 struct tui_gen_win_info
*locator
= tui_locator_win_info_ptr ();
644 tui_show_source_content (TUI_SRC_WIN
);
645 if (TUI_DISASM_WIN
== NULL
)
647 tui_win_list
[DISASSEM_WIN
]
648 = make_disasm_window (asm_height
, src_height
- 1);
650 = ((struct tui_gen_win_info
*)
651 init_and_make_win (locator
,
656 (src_height
+ asm_height
) - 1,
661 init_gen_win_info (locator
,
666 (src_height
+ asm_height
) - 1);
667 TUI_DISASM_WIN
->m_has_locator
= true;
668 init_gen_win_info (&TUI_DISASM_WIN
->generic
,
669 TUI_DISASM_WIN
->generic
.type
,
671 TUI_DISASM_WIN
->generic
.width
,
672 TUI_DISASM_WIN
->execution_info
->width
,
674 init_gen_win_info (TUI_DISASM_WIN
->execution_info
,
680 TUI_DISASM_WIN
->can_highlight
= TRUE
;
681 tui_make_visible (&TUI_DISASM_WIN
->generic
);
682 tui_make_visible (TUI_DISASM_WIN
->execution_info
);
684 TUI_SRC_WIN
->m_has_locator
= false;
685 TUI_DISASM_WIN
->m_has_locator
= true;
686 tui_make_visible (locator
);
687 tui_show_locator_content ();
688 tui_show_source_content (TUI_DISASM_WIN
);
690 if (TUI_CMD_WIN
== NULL
)
691 tui_win_list
[CMD_WIN
]
692 = make_command_window (cmd_height
, tui_term_height () - cmd_height
);
695 init_gen_win_info (&TUI_CMD_WIN
->generic
,
696 TUI_CMD_WIN
->generic
.type
,
697 TUI_CMD_WIN
->generic
.height
,
698 TUI_CMD_WIN
->generic
.width
,
700 TUI_CMD_WIN
->generic
.origin
.y
);
701 TUI_CMD_WIN
->can_highlight
= FALSE
;
702 tui_make_visible (&TUI_CMD_WIN
->generic
);
704 tui_refresh_win (&TUI_CMD_WIN
->generic
);
705 tui_set_current_layout_to (SRC_DISASSEM_COMMAND
);
710 /* Show the Source/Data/Command or the Dissassembly/Data/Command
713 show_data (enum tui_layout_type new_layout
)
715 int total_height
= (tui_term_height () - TUI_CMD_WIN
->generic
.height
);
716 int src_height
, data_height
;
717 enum tui_win_type win_type
;
718 struct tui_gen_win_info
*locator
= tui_locator_win_info_ptr ();
721 data_height
= total_height
/ 2;
722 src_height
= total_height
- data_height
;
723 tui_make_all_invisible ();
724 tui_make_invisible (locator
);
725 make_data_window (&tui_win_list
[DATA_WIN
], data_height
, 0);
726 TUI_DATA_WIN
->can_highlight
= TRUE
;
727 if (new_layout
== SRC_DATA_COMMAND
)
730 win_type
= DISASSEM_WIN
;
732 tui_source_window_base
*base
;
733 if (tui_win_list
[win_type
] == NULL
)
735 if (win_type
== SRC_WIN
)
736 tui_win_list
[win_type
]
737 = make_source_window (src_height
, data_height
- 1);
739 tui_win_list
[win_type
]
740 = make_disasm_window (src_height
, data_height
- 1);
742 = ((struct tui_gen_win_info
*)
743 init_and_make_win (locator
,
750 base
= (tui_source_window_base
*) tui_win_list
[win_type
];
754 base
= (tui_source_window_base
*) tui_win_list
[win_type
];
755 init_gen_win_info (&tui_win_list
[win_type
]->generic
,
756 tui_win_list
[win_type
]->generic
.type
,
758 tui_win_list
[win_type
]->generic
.width
,
759 base
->execution_info
->width
,
761 init_gen_win_info (base
->execution_info
,
767 tui_make_visible (&tui_win_list
[win_type
]->generic
);
768 tui_make_visible (base
->execution_info
);
769 init_gen_win_info (locator
,
776 base
->m_has_locator
= true;
777 tui_make_visible (locator
);
778 tui_show_locator_content ();
779 tui_add_to_source_windows
780 ((tui_source_window_base
*) tui_win_list
[win_type
]);
781 tui_set_current_layout_to (new_layout
);
784 /* init_gen_win_info().
787 init_gen_win_info (struct tui_gen_win_info
*win_info
,
788 enum tui_win_type type
,
789 int height
, int width
,
790 int origin_x
, int origin_y
)
794 win_info
->type
= type
;
795 win_info
->width
= width
;
796 win_info
->height
= h
;
799 win_info
->viewport_height
= h
- 1;
800 if (win_info
->type
!= CMD_WIN
)
801 win_info
->viewport_height
--;
804 win_info
->viewport_height
= 1;
805 win_info
->origin
.x
= origin_x
;
806 win_info
->origin
.y
= origin_y
;
809 } /* init_gen_win_info */
811 /* init_and_make_win().
814 init_and_make_win (void *opaque_win_info
,
815 enum tui_win_type win_type
,
816 int height
, int width
,
817 int origin_x
, int origin_y
,
820 struct tui_gen_win_info
*generic
;
822 if (opaque_win_info
== NULL
)
824 if (tui_win_is_auxillary (win_type
))
825 opaque_win_info
= (void *) tui_alloc_generic_win_info ();
827 opaque_win_info
= (void *) tui_alloc_win_info (win_type
);
829 if (tui_win_is_auxillary (win_type
))
830 generic
= (struct tui_gen_win_info
*) opaque_win_info
;
832 generic
= &((struct tui_win_info
*) opaque_win_info
)->generic
;
834 init_gen_win_info (generic
, win_type
, height
, width
, origin_x
, origin_y
);
835 if (!tui_win_is_auxillary (win_type
))
837 if (generic
->type
== CMD_WIN
)
838 ((struct tui_win_info
*) opaque_win_info
)->can_highlight
= FALSE
;
840 ((struct tui_win_info
*) opaque_win_info
)->can_highlight
= TRUE
;
842 tui_make_window (generic
, box_it
);
844 return opaque_win_info
;
848 static struct tui_win_info
*
849 make_source_or_disasm_window (enum tui_win_type type
,
850 int height
, int origin_y
)
852 struct tui_gen_win_info
*execution_info
= NULL
;
854 /* Create the exeuction info window. */
856 execution_info
= tui_source_exec_info_win_ptr ();
858 execution_info
= tui_disassem_exec_info_win_ptr ();
860 = ((struct tui_gen_win_info
*)
861 init_and_make_win (execution_info
,
869 /* Now create the source window. */
870 struct tui_source_window_base
*result
871 = ((struct tui_source_window_base
*)
872 init_and_make_win (NULL
,
875 tui_term_width () - execution_info
->width
,
876 execution_info
->width
,
879 result
->execution_info
= execution_info
;
884 /* Show the Source/Command or the Disassem layout. */
886 show_source_or_disasm_and_command (enum tui_layout_type layout_type
)
888 if (tui_current_layout () != layout_type
)
890 struct tui_win_info
**win_info_ptr
;
891 int src_height
, cmd_height
;
892 struct tui_gen_win_info
*locator
= tui_locator_win_info_ptr ();
894 if (TUI_CMD_WIN
!= NULL
)
895 cmd_height
= TUI_CMD_WIN
->generic
.height
;
897 cmd_height
= tui_term_height () / 3;
898 src_height
= tui_term_height () - cmd_height
;
900 if (layout_type
== SRC_COMMAND
)
901 win_info_ptr
= &tui_win_list
[SRC_WIN
];
903 win_info_ptr
= &tui_win_list
[DISASSEM_WIN
];
905 tui_source_window_base
*base
;
906 if ((*win_info_ptr
) == NULL
)
908 if (layout_type
== SRC_COMMAND
)
909 *win_info_ptr
= make_source_window (src_height
- 1, 0);
911 *win_info_ptr
= make_disasm_window (src_height
- 1, 0);
913 = ((struct tui_gen_win_info
*)
914 init_and_make_win (locator
,
921 base
= (tui_source_window_base
*) *win_info_ptr
;
925 base
= (tui_source_window_base
*) *win_info_ptr
;
926 init_gen_win_info (locator
,
932 base
->m_has_locator
= true;
933 init_gen_win_info (&(*win_info_ptr
)->generic
,
934 (*win_info_ptr
)->generic
.type
,
936 (*win_info_ptr
)->generic
.width
,
937 base
->execution_info
->width
,
939 init_gen_win_info (base
->execution_info
,
945 base
->can_highlight
= TRUE
;
946 tui_make_visible (&(*win_info_ptr
)->generic
);
947 tui_make_visible (base
->execution_info
);
950 base
->m_has_locator
= true;
951 tui_make_visible (locator
);
952 tui_show_locator_content ();
953 tui_show_source_content (*win_info_ptr
);
955 if (TUI_CMD_WIN
== NULL
)
957 tui_win_list
[CMD_WIN
] = make_command_window (cmd_height
,
959 tui_refresh_win (&TUI_CMD_WIN
->generic
);
963 init_gen_win_info (&TUI_CMD_WIN
->generic
,
964 TUI_CMD_WIN
->generic
.type
,
965 TUI_CMD_WIN
->generic
.height
,
966 TUI_CMD_WIN
->generic
.width
,
967 TUI_CMD_WIN
->generic
.origin
.x
,
968 TUI_CMD_WIN
->generic
.origin
.y
);
969 TUI_CMD_WIN
->can_highlight
= FALSE
;
970 tui_make_visible (&TUI_CMD_WIN
->generic
);
972 tui_set_current_layout_to (layout_type
);