/* TUI layout window management.
- Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
- Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2007
+ Free Software Foundation, Inc.
Contributed by Hewlett-Packard Company.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA. */
#include "defs.h"
#include "command.h"
#include "tui/tui-winsource.h"
#include "tui/tui-disasm.h"
+#include "gdb_string.h"
#include "gdb_curses.h"
/*******************************
********************************/
static void show_layout (enum tui_layout_type);
static void init_gen_win_info (struct tui_gen_win_info *, enum tui_win_type, int, int, int, int);
-static void init_and_make_win (void **, enum tui_win_type, int, int, int, int, int);
+static void *init_and_make_win (void *, enum tui_win_type, int, int, int, int, int);
static void show_source_or_disasm_and_command (enum tui_layout_type);
static void make_source_or_disasm_window (struct tui_win_info * *, enum tui_win_type, int, int);
static void make_command_window (struct tui_win_info * *, int, int);
enum tui_layout_type cur_layout = tui_current_layout (), new_layout = UNDEFINED_LAYOUT;
int regs_populate = FALSE;
CORE_ADDR addr = extract_display_start_addr ();
- struct tui_win_info * new_win_with_focus = (struct tui_win_info *) NULL;
struct tui_win_info * win_with_focus = tui_win_with_focus ();
struct tui_layout_def * layout_def = tui_layout_def ();
break;
}
}
- if (new_win_with_focus != (struct tui_win_info *) NULL)
- tui_set_win_focus_to (new_win_with_focus);
/*
- ** Now update the window content
+ * Now update the window content.
*/
if (!regs_populate &&
(new_layout == SRC_DATA_COMMAND ||
}
if (regs_populate)
{
- layout_def->regs_display_type =
- (regs_display_type == TUI_UNDEFINED_REGS ?
- TUI_GENERAL_REGS : regs_display_type);
- tui_show_registers (layout_def->regs_display_type);
+ tui_show_registers (TUI_DATA_WIN->detail.data_display_info.current_group);
}
}
}
void
_initialize_tui_layout (void)
{
- add_com ("layout", class_tui, tui_layout_command,
- "Change the layout of windows.\n\
+ add_com ("layout", class_tui, tui_layout_command, _("\
+Change the layout of windows.\n\
Usage: layout prev | next | <layout_name> \n\
Layout names are:\n\
src : Displays source and command windows.\n\
register window is displayed. If the\n\
source/assembly/command (split) is displayed, \n\
the register window is displayed with \n\
- the window that has current logical focus.\n");
+ the window that has current logical focus.\n"));
if (xdb_commands)
{
- add_com ("td", class_tui, tui_toggle_layout_command,
- "Toggle between Source/Command and Disassembly/Command layouts.\n");
- add_com ("ts", class_tui, tui_toggle_split_layout_command,
- "Toggle between Source/Command or Disassembly/Command and \n\
-Source/Disassembly/Command layouts.\n");
+ add_com ("td", class_tui, tui_toggle_layout_command, _("\
+Toggle between Source/Command and Disassembly/Command layouts.\n"));
+ add_com ("ts", class_tui, tui_toggle_split_layout_command, _("\
+Toggle between Source/Command or Disassembly/Command and \n\
+Source/Disassembly/Command layouts.\n"));
}
}
/* First check for ambiguous input */
if (strlen (buf_ptr) <= 1 && (*buf_ptr == 'S' || *buf_ptr == '$'))
{
- warning ("Ambiguous command input.\n");
+ warning (_("Ambiguous command input."));
status = TUI_FAILURE;
}
else
new_layout = prev_layout ();
else
status = TUI_FAILURE;
- xfree (buf_ptr);
tui_set_layout (new_layout, dpy_type);
}
+ xfree (buf_ptr);
}
else
status = TUI_FAILURE;
case SRC_COMMAND:
case SRC_DATA_COMMAND:
find_line_pc (cursal.symtab,
- TUI_SRC_WIN->detail.source_info.start_line_or_addr.line_no,
+ TUI_SRC_WIN->detail.source_info.start_line_or_addr.u.line_no,
&pc);
addr = pc;
break;
case DISASSEM_COMMAND:
case SRC_DISASSEM_COMMAND:
case DISASSEM_DATA_COMMAND:
- addr = TUI_DISASM_WIN->detail.source_info.start_line_or_addr.addr;
+ addr = TUI_DISASM_WIN->detail.source_info.start_line_or_addr.u.addr;
break;
default:
addr = 0;
/* Switch to the selected layout. */
if (tui_set_layout_for_display_command (arg) != TUI_SUCCESS)
- warning ("Invalid layout specified.\n%s", LAYOUT_USAGE);
+ warning (_("Invalid layout specified.\n%s"), LAYOUT_USAGE);
}
static void
make_command_window (struct tui_win_info * * win_info_ptr, int height, int origin_y)
{
- init_and_make_win ((void **) win_info_ptr,
- CMD_WIN,
- height,
- tui_term_width (),
- 0,
- origin_y,
- DONT_BOX_WINDOW);
+ *win_info_ptr = init_and_make_win (*win_info_ptr,
+ CMD_WIN,
+ height,
+ tui_term_width (),
+ 0,
+ origin_y,
+ DONT_BOX_WINDOW);
(*win_info_ptr)->can_highlight = FALSE;
}
static void
make_data_window (struct tui_win_info * * win_info_ptr, int height, int origin_y)
{
- init_and_make_win ((void **) win_info_ptr,
- DATA_WIN,
- height,
- tui_term_width (),
- 0,
- origin_y,
- BOX_WINDOW);
+ *win_info_ptr = init_and_make_win (*win_info_ptr,
+ DATA_WIN,
+ height,
+ tui_term_width (),
+ 0,
+ origin_y,
+ BOX_WINDOW);
}
if (TUI_DISASM_WIN == NULL)
{
make_disasm_window (&TUI_DISASM_WIN, asm_height, src_height - 1);
- init_and_make_win ((void **) & locator,
- LOCATOR_WIN,
- 2 /* 1 */ ,
- tui_term_width (),
- 0,
- (src_height + asm_height) - 1,
- DONT_BOX_WINDOW);
+ locator = init_and_make_win (locator,
+ LOCATOR_WIN,
+ 2 /* 1 */ ,
+ tui_term_width (),
+ 0,
+ (src_height + asm_height) - 1,
+ DONT_BOX_WINDOW);
}
else
{
make_source_window (&tui_win_list[win_type], src_height, data_height - 1);
else
make_disasm_window (&tui_win_list[win_type], src_height, data_height - 1);
- init_and_make_win ((void **) & locator,
- LOCATOR_WIN,
- 2 /* 1 */ ,
- tui_term_width (),
- 0,
- total_height - 1,
- DONT_BOX_WINDOW);
+ locator = init_and_make_win (locator,
+ LOCATOR_WIN,
+ 2 /* 1 */ ,
+ tui_term_width (),
+ 0,
+ total_height - 1,
+ DONT_BOX_WINDOW);
}
else
{
/*
** init_and_make_win().
*/
-static void
-init_and_make_win (void ** win_info_ptr, enum tui_win_type win_type,
- int height, int width, int origin_x, int origin_y, int box_it)
+static void *
+init_and_make_win (void *opaque_win_info, enum tui_win_type win_type,
+ int height, int width, int origin_x, int origin_y,
+ int box_it)
{
- void *opaque_win_info = *win_info_ptr;
struct tui_gen_win_info * generic;
if (opaque_win_info == NULL)
}
tui_make_window (generic, box_it);
}
- *win_info_ptr = opaque_win_info;
+ return opaque_win_info;
}
execution_info = tui_source_exec_info_win_ptr ();
else
execution_info = tui_disassem_exec_info_win_ptr ();
- init_and_make_win ((void **) & execution_info,
- EXEC_INFO_WIN,
- height,
- 3,
- 0,
- origin_y,
- DONT_BOX_WINDOW);
+ execution_info = init_and_make_win (execution_info,
+ EXEC_INFO_WIN,
+ height,
+ 3,
+ 0,
+ origin_y,
+ DONT_BOX_WINDOW);
/*
** Now create the source window.
*/
- init_and_make_win ((void **) win_info_ptr,
- type,
- height,
- tui_term_width () - execution_info->width,
- execution_info->width,
- origin_y,
- BOX_WINDOW);
+ *win_info_ptr = init_and_make_win (*win_info_ptr,
+ type,
+ height,
+ tui_term_width () - execution_info->width,
+ execution_info->width,
+ origin_y,
+ BOX_WINDOW);
(*win_info_ptr)->detail.source_info.execution_info = execution_info;
}
make_source_window (win_info_ptr, src_height - 1, 0);
else
make_disasm_window (win_info_ptr, src_height - 1, 0);
- init_and_make_win ((void **) & locator,
- LOCATOR_WIN,
- 2 /* 1 */ ,
- tui_term_width (),
- 0,
- src_height - 1,
- DONT_BOX_WINDOW);
+ locator = init_and_make_win (locator,
+ LOCATOR_WIN,
+ 2 /* 1 */ ,
+ tui_term_width (),
+ 0,
+ src_height - 1,
+ DONT_BOX_WINDOW);
}
else
{