+2001-07-21 Stephane Carrez <Stephane.Carrez@worldnet.fr>
+
+ * tui.c (tui_change_windows): New function.
+ (tui_delete_other_windows): New function.
+ (tui_initialize_readline): Bind them to C-X 1 and C-X 2.
+ (tui_enable): Enable the keypad; call tui_update_variables.
+ (strcat_to_buf_with_fmt): Remove.
+
+2001-07-21 Stephane Carrez <Stephane.Carrez@worldnet.fr>
+
+ * tui.h: Remove old declarations, add the new ones.
+ * tui.c (tui_switch_mode): New function.
+ (tui_initialize_readline): New function.
+ (tui_enable): New function.
+ (tui_disable): New function.
+ (tuiGetLowDisassemblyAddress): Use CORE_ADDR, cleanup.
+ (tui_vSelectSourceSymtab): Remove.
+ (tuiInitWindows): Remove.
+ (_initialize_tui): Remove.
+ (_tuiReset): Keep but put arround #if 0.
+
2001-07-21 Stephane Carrez <Stephane.Carrez@worldnet.fr>
* tuiIO.h: Remove old declarations and add the new ones.
#include "tuiLayout.h"
#include "tuiIO.h"
#include "tuiRegs.h"
+#include "tuiStack.h"
#include "tuiWin.h"
#include "readline/readline.h"
#include "target.h"
return 0;
}
+/* Change the TUI layout to show a next layout.
+ This function is bound to CTRL-X 2. It is intended to provide
+ a functionality close to the Emacs split-window command. We always
+ show two windows (src+asm), (src+regs) or (asm+regs). */
+static int
+tui_change_windows (void)
+{
+ if (!tui_active)
+ tui_switch_mode ();
+
+ if (tui_active)
+ {
+ TuiLayoutType new_layout;
+ TuiRegisterDisplayType regs_type = TUI_UNDEFINED_REGS;
+
+ new_layout = currentLayout ();
+
+ /* Select a new layout to have a rolling layout behavior
+ with always two windows (except when undefined). */
+ switch (new_layout)
+ {
+ case SRC_COMMAND:
+ new_layout = SRC_DISASSEM_COMMAND;
+ break;
+
+ case DISASSEM_COMMAND:
+ new_layout = SRC_DISASSEM_COMMAND;
+ break;
+
+ case SRC_DATA_COMMAND:
+ new_layout = SRC_DISASSEM_COMMAND;
+ break;
+
+ case SRC_DISASSEM_COMMAND:
+ new_layout = DISASSEM_DATA_COMMAND;
+ break;
+
+ case DISASSEM_DATA_COMMAND:
+ new_layout = SRC_DATA_COMMAND;
+ break;
+
+ default:
+ new_layout = SRC_COMMAND;
+ break;
+ }
+ tuiSetLayout (new_layout, regs_type);
+ }
+ return 0;
+}
+
+
+/* Delete the second TUI window to only show one. */
+static int
+tui_delete_other_windows (void)
+{
+ if (!tui_active)
+ tui_switch_mode ();
+
+ if (tui_active)
+ {
+ TuiLayoutType new_layout;
+ TuiRegisterDisplayType regs_type = TUI_UNDEFINED_REGS;
+
+ new_layout = currentLayout ();
+
+ /* Kill one window. */
+ switch (new_layout)
+ {
+ case SRC_COMMAND:
+ case SRC_DATA_COMMAND:
+ case SRC_DISASSEM_COMMAND:
+ default:
+ new_layout = SRC_COMMAND;
+ break;
+
+ case DISASSEM_COMMAND:
+ case DISASSEM_DATA_COMMAND:
+ new_layout = DISASSEM_COMMAND;
+ break;
+ }
+ tuiSetLayout (new_layout, regs_type);
+ }
+ return 0;
+}
+
/* Initialize readline and configure the keymap for the switching
key shortcut. */
void
rl_bind_key_in_map ('a', tui_switch_mode, emacs_ctlx_keymap);
rl_bind_key_in_map ('A', tui_switch_mode, emacs_ctlx_keymap);
rl_bind_key_in_map (CTRL ('A'), tui_switch_mode, emacs_ctlx_keymap);
+ rl_bind_key_in_map ('1', tui_delete_other_windows, emacs_ctlx_keymap);
+ rl_bind_key_in_map ('2', tui_change_windows, emacs_ctlx_keymap);
}
/* Enter in the tui mode (curses).
w = initscr ();
- cbreak();
- noecho();
+ cbreak ();
+ noecho ();
/*timeout (1);*/
nodelay(w, FALSE);
nl();
tuiSetLocatorContent (0);
showLayout (SRC_COMMAND);
tuiSetWinFocusTo (srcWin);
+ keypad (cmdWin->generic.handle, TRUE);
wrefresh (cmdWin->generic.handle);
tui_finish_init = 0;
}
/* Install the TUI specific hooks. */
tui_install_hooks ();
+ tui_update_variables ();
+
tui_setup_io (1);
tui_version = 1;
else
strncat (buf, itemToAdd, (buflen - strlen (buf)));
}
-
- return;
-} /* strcat_to_buf */
-
-/* VARARGS */
-void
-strcat_to_buf_with_fmt (char *buf, int bufLen, char *format, ...)
-{
- char *linebuffer;
- struct cleanup *old_cleanups;
- va_list args;
- va_start (args, format);
- vasprintf (&linebuffer, format, args);
- old_cleanups = make_cleanup (xfree, linebuffer);
- strcat_to_buf (buf, bufLen, linebuffer);
- do_cleanups (old_cleanups);
- va_end (args);
}
#if 0