dd1abb8c9e
* tui/tui-data.h (struct tui_list): Rename _TuiList. (enum tui_data_type): Rename _TuiDataType. (struct tui_layout_def): Rename _TuiLayoutDef. (struct tui_source_element): Rename _TuiSourceElement. (struct tui_data_element): Rename _TuiDataElement. (struct tui_command_element): Rename _TuiCommandElement. (struct tui_locator_element): Rename _TuiLocatorElement. (union tui_which_element): Define. (struct tui_win_element): Rename _TuiWinElement. (struct tui_data_info): Rename _TuiDataInfo. (struct tui_source_info): Rename _TuiSourceInfo. (struct tui_command_info): Rename _TuiCommandInfo. (tui_initialize_static_data): Rename initializeStaticData. (tui_alloc_generic_win_info): Rename allocGenericWinInfo. (tui_alloc_win_info): Rename allocWinInfo. (tui_init_generic_part): Rename initGenericPart. (tui_init_win_info): Rename initWinInfo. (tui_alloc_content): Rename allocContent. (tui_add_content_elements): Rename addContentElements. (tui_init_content_element): Rename initContentElement. (tui_free_window): Rename freeWindow. (tui_free_win_content): Rename freeWinContent. (tui_free_data_content): Rename freeDataContent. (tui_free_all_source_wins_content): Rename freeAllSourceWinsContent. (tui_del_window): Rename tuiDelWindow. (tui_del_data_windows): Rename tuiDelDataWindows. (tui_partial_win_by_name): Rename partialWinByName. (tui_win_name): Rename winName. (tui_current_layout): Rename currentLayout. (tui_set_current_layout_to): Rename setCurrentLayoutTo. (tui_term_height): Rename termHeight. (tui_set_term_height_to): Rename setTermHeightTo. (tui_term_width): Rename termWidth. (tui_set_term_width_to): Rename setTermWidthTo. (tui_set_gen_win_origin): Rename setGenWinOrigin. (tui_locator_win_info_ptr): Rename locatorWinInfoPtr. (tui_source_exec_info_win_ptr): Rename tui_gen_win_info. (tui_disassem_exec_info_win_ptr): Rename disassemExecInfoWinPtr. (tui_source_windows): Rename sourceWindows. (tui_clear_source_windows): Rename clearSourceWindows. (tui_clear_source_windows_detail): Rename clearSourceWindowsDetail. (tui_clear_win_detail): Rename clearWinDetail. (tui_add_to_source_windows): Rename tuiAddToSourceWindows. (tui_default_tab_len): Rename tuiDefaultTabLen. (tui_set_default_tab_len): Rename tuiSetDefaultTabLen. (tui_win_with_focus): Rename tuiWinWithFocus. (tui_set_win_with_focus): Rename tuiSetWinWithFocus. (tui_layout_def): Rename tuiLayoutDef. (tui_win_resized): Rename tuiWinResized. (tui_set_win_resized_to): Rename tuiSetWinResizedTo. (tui_next_win): Rename tuiNextWin. (tui_prev_win): Rename tuiPrevWin. (tui_add_to_source_windows): Rename addToSourceWindows. * tui/tui-winsource.c, tui/tui-win.c: Update references. * tui/tui-layout.c, tui/tui-source.c: Ditto. * tui/tui-stack.c, tui/tui-io.c: Ditto. * tui/tui.c, tui/tui-data.c: Ditto. * tui/tui-interp.c, tui/tui-data.c: Ditto. * tui/tui-disasm.c, tui/tui-command.c: Ditto.
135 lines
3.2 KiB
C
135 lines
3.2 KiB
C
/* Specific command window processing.
|
|
|
|
Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
|
|
Foundation, Inc.
|
|
|
|
Contributed by Hewlett-Packard Company.
|
|
|
|
This file is part of GDB.
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
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. */
|
|
|
|
#include "defs.h"
|
|
#include <ctype.h>
|
|
#include "tui/tui.h"
|
|
#include "tui/tui-data.h"
|
|
#include "tui/tui-win.h"
|
|
#include "tui/tui-io.h"
|
|
|
|
#ifdef HAVE_NCURSES_H
|
|
#include <ncurses.h>
|
|
#else
|
|
#ifdef HAVE_CURSES_H
|
|
#include <curses.h>
|
|
#endif
|
|
#endif
|
|
|
|
|
|
/*****************************************
|
|
** STATIC LOCAL FUNCTIONS FORWARD DECLS **
|
|
******************************************/
|
|
|
|
|
|
|
|
/*****************************************
|
|
** PUBLIC FUNCTIONS **
|
|
******************************************/
|
|
|
|
/* Dispatch the correct tui function based upon the control character. */
|
|
unsigned int
|
|
tui_dispatch_ctrl_char (unsigned int ch)
|
|
{
|
|
TuiWinInfoPtr winInfo = tui_win_with_focus ();
|
|
WINDOW *w = cmdWin->generic.handle;
|
|
|
|
/*
|
|
** If the command window has the logical focus, or no-one does
|
|
** assume it is the command window; in this case, pass the
|
|
** character on through and do nothing here.
|
|
*/
|
|
if (winInfo == (TuiWinInfoPtr) NULL || winInfo == cmdWin)
|
|
return ch;
|
|
else
|
|
{
|
|
unsigned int c = 0, chCopy = ch;
|
|
register int i;
|
|
char *term;
|
|
|
|
/* If this is an xterm, page next/prev keys aren't returned
|
|
** by keypad as a single char, so we must handle them here.
|
|
** Seems like a bug in the curses library?
|
|
*/
|
|
term = (char *) getenv ("TERM");
|
|
for (i = 0; (term && term[i]); i++)
|
|
term[i] = toupper (term[i]);
|
|
if ((strcmp (term, "XTERM") == 0) && key_is_start_sequence (ch))
|
|
{
|
|
unsigned int pageCh = 0, tmpChar;
|
|
|
|
tmpChar = 0;
|
|
while (!key_is_end_sequence (tmpChar))
|
|
{
|
|
tmpChar = (int) wgetch (w);
|
|
if (tmpChar == ERR)
|
|
{
|
|
return ch;
|
|
}
|
|
if (!tmpChar)
|
|
break;
|
|
if (tmpChar == 53)
|
|
pageCh = KEY_PPAGE;
|
|
else if (tmpChar == 54)
|
|
pageCh = KEY_NPAGE;
|
|
else
|
|
{
|
|
return 0;
|
|
}
|
|
}
|
|
chCopy = pageCh;
|
|
}
|
|
|
|
switch (chCopy)
|
|
{
|
|
case KEY_NPAGE:
|
|
tui_scroll_forward (winInfo, 0);
|
|
break;
|
|
case KEY_PPAGE:
|
|
tui_scroll_backward (winInfo, 0);
|
|
break;
|
|
case KEY_DOWN:
|
|
case KEY_SF:
|
|
tui_scroll_forward (winInfo, 1);
|
|
break;
|
|
case KEY_UP:
|
|
case KEY_SR:
|
|
tui_scroll_backward (winInfo, 1);
|
|
break;
|
|
case KEY_RIGHT:
|
|
tui_scroll_left (winInfo, 1);
|
|
break;
|
|
case KEY_LEFT:
|
|
tui_scroll_right (winInfo, 1);
|
|
break;
|
|
case '\f':
|
|
tui_refresh_all_win ();
|
|
break;
|
|
default:
|
|
c = chCopy;
|
|
break;
|
|
}
|
|
return c;
|
|
}
|
|
}
|