1 /* TUI layout window management.
3 Copyright (C) 1998-2016 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 void make_source_or_disasm_window (struct tui_win_info
**,
55 static void make_command_window (struct tui_win_info
**, int, int);
56 static void make_source_window (struct tui_win_info
**, int, int);
57 static void make_disasm_window (struct tui_win_info
**, int, int);
58 static void make_data_window (struct tui_win_info
**, int, int);
59 static void show_source_command (void);
60 static void show_disasm_command (void);
61 static void show_source_disasm_command (void);
62 static void show_data (enum tui_layout_type
);
63 static enum tui_layout_type
next_layout (void);
64 static enum tui_layout_type
prev_layout (void);
65 static void tui_layout_command (char *, int);
66 static void extract_display_start_addr (struct gdbarch
**, CORE_ADDR
*);
69 /***************************************
71 ***************************************/
73 #define LAYOUT_USAGE "Usage: layout prev | next | <layout_name> \n"
75 /* Show the screen layout defined. */
77 show_layout (enum tui_layout_type layout
)
79 enum tui_layout_type cur_layout
= tui_current_layout ();
81 if (layout
!= cur_layout
)
83 /* Since the new layout may cause changes in window size, we
84 should free the content and reallocate on next display of
86 tui_free_all_source_wins_content ();
87 tui_clear_source_windows ();
88 if (layout
== SRC_DATA_COMMAND
89 || layout
== DISASSEM_DATA_COMMAND
)
92 tui_refresh_all (tui_win_list
);
96 /* First make the current layout be invisible. */
97 tui_make_all_invisible ();
98 tui_make_invisible (tui_locator_win_info_ptr ());
102 /* Now show the new layout. */
104 show_source_command ();
105 tui_add_to_source_windows (TUI_SRC_WIN
);
107 case DISASSEM_COMMAND
:
108 show_disasm_command ();
109 tui_add_to_source_windows (TUI_DISASM_WIN
);
111 case SRC_DISASSEM_COMMAND
:
112 show_source_disasm_command ();
113 tui_add_to_source_windows (TUI_SRC_WIN
);
114 tui_add_to_source_windows (TUI_DISASM_WIN
);
124 /* Function to set the layout to SRC_COMMAND, DISASSEM_COMMAND,
125 SRC_DISASSEM_COMMAND, SRC_DATA_COMMAND, or DISASSEM_DATA_COMMAND. */
127 tui_set_layout (enum tui_layout_type layout_type
)
129 enum tui_status status
= TUI_SUCCESS
;
131 if (layout_type
!= UNDEFINED_LAYOUT
)
133 enum tui_layout_type cur_layout
= tui_current_layout (),
134 new_layout
= UNDEFINED_LAYOUT
;
135 int regs_populate
= FALSE
;
136 struct gdbarch
*gdbarch
;
138 struct tui_win_info
*win_with_focus
= tui_win_with_focus ();
139 struct tui_layout_def
*layout_def
= tui_layout_def ();
141 extract_display_start_addr (&gdbarch
, &addr
);
143 new_layout
= layout_type
;
145 regs_populate
= (new_layout
== SRC_DATA_COMMAND
146 || new_layout
== DISASSEM_DATA_COMMAND
);
147 if (new_layout
!= cur_layout
)
149 show_layout (new_layout
);
151 /* Now determine where focus should be. */
152 if (win_with_focus
!= TUI_CMD_WIN
)
157 tui_set_win_focus_to (TUI_SRC_WIN
);
158 layout_def
->display_mode
= SRC_WIN
;
159 layout_def
->split
= FALSE
;
161 case DISASSEM_COMMAND
:
162 /* The previous layout was not showing code.
163 This can happen if there is no source
166 1. if the source file is in another dir OR
167 2. if target was compiled without -g
168 We still want to show the assembly though! */
170 tui_get_begin_asm_address (&gdbarch
, &addr
);
171 tui_set_win_focus_to (TUI_DISASM_WIN
);
172 layout_def
->display_mode
= DISASSEM_WIN
;
173 layout_def
->split
= FALSE
;
175 case SRC_DISASSEM_COMMAND
:
176 /* The previous layout was not showing code.
177 This can happen if there is no source
180 1. if the source file is in another dir OR
181 2. if target was compiled without -g
182 We still want to show the assembly though! */
184 tui_get_begin_asm_address (&gdbarch
, &addr
);
185 if (win_with_focus
== TUI_SRC_WIN
)
186 tui_set_win_focus_to (TUI_SRC_WIN
);
188 tui_set_win_focus_to (TUI_DISASM_WIN
);
189 layout_def
->split
= TRUE
;
191 case SRC_DATA_COMMAND
:
192 if (win_with_focus
!= TUI_DATA_WIN
)
193 tui_set_win_focus_to (TUI_SRC_WIN
);
195 tui_set_win_focus_to (TUI_DATA_WIN
);
196 layout_def
->display_mode
= SRC_WIN
;
197 layout_def
->split
= FALSE
;
199 case DISASSEM_DATA_COMMAND
:
200 /* The previous layout was not showing code.
201 This can happen if there is no source
204 1. if the source file is in another dir OR
205 2. if target was compiled without -g
206 We still want to show the assembly though! */
208 tui_get_begin_asm_address (&gdbarch
, &addr
);
209 if (win_with_focus
!= TUI_DATA_WIN
)
210 tui_set_win_focus_to (TUI_DISASM_WIN
);
212 tui_set_win_focus_to (TUI_DATA_WIN
);
213 layout_def
->display_mode
= DISASSEM_WIN
;
214 layout_def
->split
= FALSE
;
221 * Now update the window content.
224 && (new_layout
== SRC_DATA_COMMAND
225 || new_layout
== DISASSEM_DATA_COMMAND
))
226 tui_display_all_data ();
228 tui_update_source_windows_with_addr (gdbarch
, addr
);
232 struct reggroup
*group
=
233 TUI_DATA_WIN
->detail
.data_display_info
.current_group
;
234 tui_show_registers (group
);
239 status
= TUI_FAILURE
;
244 /* Add the specified window to the layout in a logical way. This
245 means setting up the most logical layout given the window to be
248 tui_add_win_to_layout (enum tui_win_type type
)
250 enum tui_layout_type cur_layout
= tui_current_layout ();
255 if (cur_layout
!= SRC_COMMAND
256 && cur_layout
!= SRC_DISASSEM_COMMAND
257 && cur_layout
!= SRC_DATA_COMMAND
)
259 tui_clear_source_windows_detail ();
260 if (cur_layout
== DISASSEM_DATA_COMMAND
)
261 show_layout (SRC_DATA_COMMAND
);
263 show_layout (SRC_COMMAND
);
267 if (cur_layout
!= DISASSEM_COMMAND
268 && cur_layout
!= SRC_DISASSEM_COMMAND
269 && cur_layout
!= DISASSEM_DATA_COMMAND
)
271 tui_clear_source_windows_detail ();
272 if (cur_layout
== SRC_DATA_COMMAND
)
273 show_layout (DISASSEM_DATA_COMMAND
);
275 show_layout (DISASSEM_COMMAND
);
279 if (cur_layout
!= SRC_DATA_COMMAND
280 && cur_layout
!= DISASSEM_DATA_COMMAND
)
282 if (cur_layout
== DISASSEM_COMMAND
)
283 show_layout (DISASSEM_DATA_COMMAND
);
285 show_layout (SRC_DATA_COMMAND
);
294 /* Answer the height of a window. If it hasn't been created yet,
295 answer what the height of a window would be based upon its type and
298 tui_default_win_height (enum tui_win_type type
,
299 enum tui_layout_type layout
)
303 if (tui_win_list
[type
] != (struct tui_win_info
*) NULL
)
304 h
= tui_win_list
[type
]->generic
.height
;
310 case DISASSEM_COMMAND
:
311 if (TUI_CMD_WIN
== NULL
)
312 h
= tui_term_height () / 2;
314 h
= tui_term_height () - TUI_CMD_WIN
->generic
.height
;
316 case SRC_DISASSEM_COMMAND
:
317 case SRC_DATA_COMMAND
:
318 case DISASSEM_DATA_COMMAND
:
319 if (TUI_CMD_WIN
== NULL
)
320 h
= tui_term_height () / 3;
322 h
= (tui_term_height () - TUI_CMD_WIN
->generic
.height
) / 2;
334 /* Answer the height of a window. If it hasn't been created yet,
335 answer what the height of a window would be based upon its type and
338 tui_default_win_viewport_height (enum tui_win_type type
,
339 enum tui_layout_type layout
)
343 h
= tui_default_win_height (type
, layout
);
345 if (tui_win_list
[type
] == TUI_CMD_WIN
)
353 /* Complete possible layout names. TEXT is the complete text entered so
354 far, WORD is the word currently being completed. */
356 static VEC (char_ptr
) *
357 layout_completer (struct cmd_list_element
*ignore
,
358 const char *text
, const char *word
)
360 static const char *layout_names
[] =
361 { "src", "asm", "split", "regs", "next", "prev", NULL
};
363 return complete_on_enum (layout_names
, text
, word
);
366 /* Function to initialize gdb commands, for tui window layout
369 /* Provide a prototype to silence -Wmissing-prototypes. */
370 extern initialize_file_ftype _initialize_tui_layout
;
373 _initialize_tui_layout (void)
375 struct cmd_list_element
*cmd
;
377 cmd
= add_com ("layout", class_tui
, tui_layout_command
, _("\
378 Change the layout of windows.\n\
379 Usage: layout prev | next | <layout_name> \n\
381 src : Displays source and command windows.\n\
382 asm : Displays disassembly and command windows.\n\
383 split : Displays source, disassembly and command windows.\n\
384 regs : Displays register window. If existing layout\n\
385 is source/command or assembly/command, the \n\
386 register window is displayed. If the\n\
387 source/assembly/command (split) is displayed, \n\
388 the register window is displayed with \n\
389 the window that has current logical focus.\n"));
390 set_cmd_completer (cmd
, layout_completer
);
394 /*************************
395 ** STATIC LOCAL FUNCTIONS
396 **************************/
399 /* Function to set the layout to SRC, ASM, SPLIT, NEXT, PREV, DATA, or
402 tui_set_layout_by_name (const char *layout_name
)
404 enum tui_status status
= TUI_SUCCESS
;
406 if (layout_name
!= (char *) NULL
)
410 enum tui_layout_type new_layout
= UNDEFINED_LAYOUT
;
411 enum tui_layout_type cur_layout
= tui_current_layout ();
412 struct cleanup
*old_chain
;
414 buf_ptr
= (char *) xstrdup (layout_name
);
415 for (i
= 0; (i
< strlen (layout_name
)); i
++)
416 buf_ptr
[i
] = toupper (buf_ptr
[i
]);
417 old_chain
= make_cleanup (xfree
, buf_ptr
);
419 /* First check for ambiguous input. */
420 if (strlen (buf_ptr
) <= 1 && *buf_ptr
== 'S')
422 warning (_("Ambiguous command input."));
423 status
= TUI_FAILURE
;
427 if (subset_compare (buf_ptr
, "SRC"))
428 new_layout
= SRC_COMMAND
;
429 else if (subset_compare (buf_ptr
, "ASM"))
430 new_layout
= DISASSEM_COMMAND
;
431 else if (subset_compare (buf_ptr
, "SPLIT"))
432 new_layout
= SRC_DISASSEM_COMMAND
;
433 else if (subset_compare (buf_ptr
, "REGS"))
435 if (cur_layout
== SRC_COMMAND
436 || cur_layout
== SRC_DATA_COMMAND
)
437 new_layout
= SRC_DATA_COMMAND
;
439 new_layout
= DISASSEM_DATA_COMMAND
;
441 else if (subset_compare (buf_ptr
, "NEXT"))
442 new_layout
= next_layout ();
443 else if (subset_compare (buf_ptr
, "PREV"))
444 new_layout
= prev_layout ();
446 status
= TUI_FAILURE
;
448 if (status
== TUI_SUCCESS
)
450 /* Make sure the curses mode is enabled. */
452 tui_set_layout (new_layout
);
455 do_cleanups (old_chain
);
458 status
= TUI_FAILURE
;
465 extract_display_start_addr (struct gdbarch
**gdbarch_p
, CORE_ADDR
*addr_p
)
467 enum tui_layout_type cur_layout
= tui_current_layout ();
468 struct gdbarch
*gdbarch
= get_current_arch ();
471 struct symtab_and_line cursal
= get_current_source_symtab_and_line ();
476 case SRC_DATA_COMMAND
:
477 gdbarch
= TUI_SRC_WIN
->detail
.source_info
.gdbarch
;
478 find_line_pc (cursal
.symtab
,
479 TUI_SRC_WIN
->detail
.source_info
.start_line_or_addr
.u
.line_no
,
483 case DISASSEM_COMMAND
:
484 case SRC_DISASSEM_COMMAND
:
485 case DISASSEM_DATA_COMMAND
:
486 gdbarch
= TUI_DISASM_WIN
->detail
.source_info
.gdbarch
;
487 addr
= TUI_DISASM_WIN
->detail
.source_info
.start_line_or_addr
.u
.addr
;
494 *gdbarch_p
= gdbarch
;
500 tui_layout_command (char *arg
, int from_tty
)
502 /* Switch to the selected layout. */
503 if (tui_set_layout_by_name (arg
) != TUI_SUCCESS
)
504 warning (_("Invalid layout specified.\n%s"), LAYOUT_USAGE
);
508 /* Answer the previous layout to cycle to. */
509 static enum tui_layout_type
514 new_layout
= tui_current_layout ();
515 if (new_layout
== UNDEFINED_LAYOUT
)
516 new_layout
= SRC_COMMAND
;
520 if (new_layout
== UNDEFINED_LAYOUT
)
521 new_layout
= SRC_COMMAND
;
524 return (enum tui_layout_type
) new_layout
;
528 /* Answer the next layout to cycle to. */
529 static enum tui_layout_type
534 new_layout
= tui_current_layout ();
535 if (new_layout
== SRC_COMMAND
)
536 new_layout
= DISASSEM_DATA_COMMAND
;
540 if (new_layout
== UNDEFINED_LAYOUT
)
541 new_layout
= DISASSEM_DATA_COMMAND
;
544 return (enum tui_layout_type
) new_layout
;
550 make_command_window (struct tui_win_info
**win_info_ptr
,
551 int height
, int origin_y
)
554 = (struct tui_win_info
*) init_and_make_win (*win_info_ptr
,
562 (*win_info_ptr
)->can_highlight
= FALSE
;
566 /* make_source_window().
569 make_source_window (struct tui_win_info
**win_info_ptr
,
570 int height
, int origin_y
)
572 make_source_or_disasm_window (win_info_ptr
, SRC_WIN
, height
, origin_y
);
575 } /* make_source_window */
578 /* make_disasm_window().
581 make_disasm_window (struct tui_win_info
**win_info_ptr
,
582 int height
, int origin_y
)
584 make_source_or_disasm_window (win_info_ptr
, DISASSEM_WIN
, height
, origin_y
);
587 } /* make_disasm_window */
591 make_data_window (struct tui_win_info
**win_info_ptr
,
592 int height
, int origin_y
)
595 = (struct tui_win_info
*) init_and_make_win (*win_info_ptr
,
606 /* Show the Source/Command layout. */
608 show_source_command (void)
610 show_source_or_disasm_and_command (SRC_COMMAND
);
614 /* Show the Dissassem/Command layout. */
616 show_disasm_command (void)
618 show_source_or_disasm_and_command (DISASSEM_COMMAND
);
622 /* Show the Source/Disassem/Command layout. */
624 show_source_disasm_command (void)
626 if (tui_current_layout () != SRC_DISASSEM_COMMAND
)
628 int cmd_height
, src_height
, asm_height
;
630 if (TUI_CMD_WIN
!= NULL
)
631 cmd_height
= TUI_CMD_WIN
->generic
.height
;
633 cmd_height
= tui_term_height () / 3;
635 src_height
= (tui_term_height () - cmd_height
) / 2;
636 asm_height
= tui_term_height () - (src_height
+ cmd_height
);
638 if (TUI_SRC_WIN
== NULL
)
639 make_source_window (&TUI_SRC_WIN
, src_height
, 0);
642 init_gen_win_info (&TUI_SRC_WIN
->generic
,
643 TUI_SRC_WIN
->generic
.type
,
645 TUI_SRC_WIN
->generic
.width
,
646 TUI_SRC_WIN
->detail
.source_info
.execution_info
->width
,
648 TUI_SRC_WIN
->can_highlight
= TRUE
;
649 init_gen_win_info (TUI_SRC_WIN
->detail
.source_info
.execution_info
,
655 tui_make_visible (&TUI_SRC_WIN
->generic
);
656 tui_make_visible (TUI_SRC_WIN
->detail
.source_info
.execution_info
);
657 TUI_SRC_WIN
->detail
.source_info
.has_locator
= FALSE
;;
659 if (TUI_SRC_WIN
!= NULL
)
661 struct tui_gen_win_info
*locator
= tui_locator_win_info_ptr ();
663 tui_show_source_content (TUI_SRC_WIN
);
664 if (TUI_DISASM_WIN
== NULL
)
666 make_disasm_window (&TUI_DISASM_WIN
, asm_height
, src_height
- 1);
668 = ((struct tui_gen_win_info
*)
669 init_and_make_win (locator
,
674 (src_height
+ asm_height
) - 1,
679 init_gen_win_info (locator
,
684 (src_height
+ asm_height
) - 1);
685 TUI_DISASM_WIN
->detail
.source_info
.has_locator
= TRUE
;
686 init_gen_win_info (&TUI_DISASM_WIN
->generic
,
687 TUI_DISASM_WIN
->generic
.type
,
689 TUI_DISASM_WIN
->generic
.width
,
690 TUI_DISASM_WIN
->detail
.source_info
.execution_info
->width
,
692 init_gen_win_info (TUI_DISASM_WIN
->detail
.source_info
.execution_info
,
698 TUI_DISASM_WIN
->can_highlight
= TRUE
;
699 tui_make_visible (&TUI_DISASM_WIN
->generic
);
700 tui_make_visible (TUI_DISASM_WIN
->detail
.source_info
.execution_info
);
702 if (TUI_DISASM_WIN
!= NULL
)
704 TUI_SRC_WIN
->detail
.source_info
.has_locator
= FALSE
;
705 TUI_DISASM_WIN
->detail
.source_info
.has_locator
= TRUE
;
706 tui_make_visible (locator
);
707 tui_show_locator_content ();
708 tui_show_source_content (TUI_DISASM_WIN
);
710 if (TUI_CMD_WIN
== NULL
)
711 make_command_window (&TUI_CMD_WIN
,
713 tui_term_height () - cmd_height
);
716 init_gen_win_info (&TUI_CMD_WIN
->generic
,
717 TUI_CMD_WIN
->generic
.type
,
718 TUI_CMD_WIN
->generic
.height
,
719 TUI_CMD_WIN
->generic
.width
,
721 TUI_CMD_WIN
->generic
.origin
.y
);
722 TUI_CMD_WIN
->can_highlight
= FALSE
;
723 tui_make_visible (&TUI_CMD_WIN
->generic
);
725 if (TUI_CMD_WIN
!= NULL
)
726 tui_refresh_win (&TUI_CMD_WIN
->generic
);
729 tui_set_current_layout_to (SRC_DISASSEM_COMMAND
);
734 /* Show the Source/Data/Command or the Dissassembly/Data/Command
737 show_data (enum tui_layout_type new_layout
)
739 int total_height
= (tui_term_height () - TUI_CMD_WIN
->generic
.height
);
740 int src_height
, data_height
;
741 enum tui_win_type win_type
;
742 struct tui_gen_win_info
*locator
= tui_locator_win_info_ptr ();
745 data_height
= total_height
/ 2;
746 src_height
= total_height
- data_height
;
747 tui_make_all_invisible ();
748 tui_make_invisible (locator
);
749 make_data_window (&TUI_DATA_WIN
, data_height
, 0);
750 TUI_DATA_WIN
->can_highlight
= TRUE
;
751 if (new_layout
== SRC_DATA_COMMAND
)
754 win_type
= DISASSEM_WIN
;
755 if (tui_win_list
[win_type
] == NULL
)
757 if (win_type
== SRC_WIN
)
758 make_source_window (&tui_win_list
[win_type
], src_height
, data_height
- 1);
760 make_disasm_window (&tui_win_list
[win_type
], src_height
, data_height
- 1);
762 = ((struct tui_gen_win_info
*)
763 init_and_make_win (locator
,
773 init_gen_win_info (&tui_win_list
[win_type
]->generic
,
774 tui_win_list
[win_type
]->generic
.type
,
776 tui_win_list
[win_type
]->generic
.width
,
777 tui_win_list
[win_type
]->detail
.source_info
.execution_info
->width
,
779 init_gen_win_info (tui_win_list
[win_type
]->detail
.source_info
.execution_info
,
785 tui_make_visible (&tui_win_list
[win_type
]->generic
);
786 tui_make_visible (tui_win_list
[win_type
]->detail
.source_info
.execution_info
);
787 init_gen_win_info (locator
,
794 tui_win_list
[win_type
]->detail
.source_info
.has_locator
= TRUE
;
795 tui_make_visible (locator
);
796 tui_show_locator_content ();
797 tui_add_to_source_windows (tui_win_list
[win_type
]);
798 tui_set_current_layout_to (new_layout
);
801 /* init_gen_win_info().
804 init_gen_win_info (struct tui_gen_win_info
*win_info
,
805 enum tui_win_type type
,
806 int height
, int width
,
807 int origin_x
, int origin_y
)
811 win_info
->type
= type
;
812 win_info
->width
= width
;
813 win_info
->height
= h
;
816 win_info
->viewport_height
= h
- 1;
817 if (win_info
->type
!= CMD_WIN
)
818 win_info
->viewport_height
--;
821 win_info
->viewport_height
= 1;
822 win_info
->origin
.x
= origin_x
;
823 win_info
->origin
.y
= origin_y
;
826 } /* init_gen_win_info */
828 /* init_and_make_win().
831 init_and_make_win (void *opaque_win_info
,
832 enum tui_win_type win_type
,
833 int height
, int width
,
834 int origin_x
, int origin_y
,
837 struct tui_gen_win_info
*generic
;
839 if (opaque_win_info
== NULL
)
841 if (tui_win_is_auxillary (win_type
))
842 opaque_win_info
= (void *) tui_alloc_generic_win_info ();
844 opaque_win_info
= (void *) tui_alloc_win_info (win_type
);
846 if (tui_win_is_auxillary (win_type
))
847 generic
= (struct tui_gen_win_info
*) opaque_win_info
;
849 generic
= &((struct tui_win_info
*) opaque_win_info
)->generic
;
851 if (opaque_win_info
!= NULL
)
853 init_gen_win_info (generic
, win_type
, height
, width
, origin_x
, origin_y
);
854 if (!tui_win_is_auxillary (win_type
))
856 if (generic
->type
== CMD_WIN
)
857 ((struct tui_win_info
*) opaque_win_info
)->can_highlight
= FALSE
;
859 ((struct tui_win_info
*) opaque_win_info
)->can_highlight
= TRUE
;
861 tui_make_window (generic
, box_it
);
863 return opaque_win_info
;
868 make_source_or_disasm_window (struct tui_win_info
**win_info_ptr
,
869 enum tui_win_type type
,
870 int height
, int origin_y
)
872 struct tui_gen_win_info
*execution_info
= NULL
;
874 /* Create the exeuction info window. */
876 execution_info
= tui_source_exec_info_win_ptr ();
878 execution_info
= tui_disassem_exec_info_win_ptr ();
880 = ((struct tui_gen_win_info
*)
881 init_and_make_win (execution_info
,
889 /* Now create the source window. */
891 = ((struct tui_win_info
*)
892 init_and_make_win (*win_info_ptr
,
895 tui_term_width () - execution_info
->width
,
896 execution_info
->width
,
900 (*win_info_ptr
)->detail
.source_info
.execution_info
= execution_info
;
904 /* Show the Source/Command or the Disassem layout. */
906 show_source_or_disasm_and_command (enum tui_layout_type layout_type
)
908 if (tui_current_layout () != layout_type
)
910 struct tui_win_info
**win_info_ptr
;
911 int src_height
, cmd_height
;
912 struct tui_gen_win_info
*locator
= tui_locator_win_info_ptr ();
914 if (TUI_CMD_WIN
!= NULL
)
915 cmd_height
= TUI_CMD_WIN
->generic
.height
;
917 cmd_height
= tui_term_height () / 3;
918 src_height
= tui_term_height () - cmd_height
;
920 if (layout_type
== SRC_COMMAND
)
921 win_info_ptr
= &TUI_SRC_WIN
;
923 win_info_ptr
= &TUI_DISASM_WIN
;
925 if ((*win_info_ptr
) == NULL
)
927 if (layout_type
== SRC_COMMAND
)
928 make_source_window (win_info_ptr
, src_height
- 1, 0);
930 make_disasm_window (win_info_ptr
, src_height
- 1, 0);
932 = ((struct tui_gen_win_info
*)
933 init_and_make_win (locator
,
943 init_gen_win_info (locator
,
949 (*win_info_ptr
)->detail
.source_info
.has_locator
= TRUE
;
950 init_gen_win_info (&(*win_info_ptr
)->generic
,
951 (*win_info_ptr
)->generic
.type
,
953 (*win_info_ptr
)->generic
.width
,
954 (*win_info_ptr
)->detail
.source_info
.execution_info
->width
,
956 init_gen_win_info ((*win_info_ptr
)->detail
.source_info
.execution_info
,
962 (*win_info_ptr
)->can_highlight
= TRUE
;
963 tui_make_visible (&(*win_info_ptr
)->generic
);
964 tui_make_visible ((*win_info_ptr
)->detail
.source_info
.execution_info
);
966 if ((*win_info_ptr
) != NULL
)
968 (*win_info_ptr
)->detail
.source_info
.has_locator
= TRUE
;
969 tui_make_visible (locator
);
970 tui_show_locator_content ();
971 tui_show_source_content (*win_info_ptr
);
973 if (TUI_CMD_WIN
== NULL
)
975 make_command_window (&TUI_CMD_WIN
, cmd_height
, src_height
);
976 tui_refresh_win (&TUI_CMD_WIN
->generic
);
980 init_gen_win_info (&TUI_CMD_WIN
->generic
,
981 TUI_CMD_WIN
->generic
.type
,
982 TUI_CMD_WIN
->generic
.height
,
983 TUI_CMD_WIN
->generic
.width
,
984 TUI_CMD_WIN
->generic
.origin
.x
,
985 TUI_CMD_WIN
->generic
.origin
.y
);
986 TUI_CMD_WIN
->can_highlight
= FALSE
;
987 tui_make_visible (&TUI_CMD_WIN
->generic
);
990 tui_set_current_layout_to (layout_type
);