aboutsummaryrefslogtreecommitdiff
path: root/src/display.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/display.cpp')
-rw-r--r--src/display.cpp107
1 files changed, 79 insertions, 28 deletions
diff --git a/src/display.cpp b/src/display.cpp
index f48b53f..c76ba27 100644
--- a/src/display.cpp
+++ b/src/display.cpp
@@ -95,7 +95,7 @@ static int current_tab;
void show_tab(unsigned int tab)
{
- WINDOW *win;
+ class tab_window *win;
unsigned int i;
int tab_pos = 17;
const char *c;
@@ -145,11 +145,11 @@ void show_tab(unsigned int tab)
wrefresh(tab_bar);
wrefresh(bottom_line);
- win = get_ncurses_win(tab_names[tab]);
+ win = tab_windows[tab_names[tab]];
if (!win)
return;
- prefresh(win, 0, 0, 1, 0, LINES - 3, COLS - 1);
+ prefresh(win->win, win->ypad_pos, win->xpad_pos, 1, 0, LINES - 3, COLS - 1);
}
WINDOW *get_ncurses_win(const char *name)
@@ -185,42 +185,41 @@ WINDOW *get_ncurses_win(const string &name)
return get_ncurses_win(name.c_str());
}
-
-void show_next_tab(void)
+void show_prev_tab(void)
{
- class tab_window *w;
+ class tab_window *w;
- if (!display)
- return;
+ if (!display)
+ return;
+ w = tab_windows[tab_names[current_tab]];
+ if (w)
+ w->hide();
- w = tab_windows[tab_names[current_tab]];
- if (w)
- w->hide();
+ current_tab --;
+ if (current_tab < 0)
+ current_tab = tab_names.size() - 1;
- current_tab ++;
- if (current_tab >= (int)tab_names.size())
- current_tab = 0;
-
- w = tab_windows[tab_names[current_tab]];
- if (w)
- w->expose();
+ w = tab_windows[tab_names[current_tab]];
+ if (w)
+ w->expose();
- show_tab(current_tab);
+ show_tab(current_tab);
}
-void show_prev_tab(void)
+void show_next_tab(void)
{
class tab_window *w;
if (!display)
return;
+
w = tab_windows[tab_names[current_tab]];
if (w)
w->hide();
- current_tab --;
- if (current_tab < 0)
- current_tab = tab_names.size() - 1;
+ current_tab ++;
+ if (current_tab >= (int)tab_names.size())
+ current_tab = 0;
w = tab_windows[tab_names[current_tab]];
if (w)
@@ -241,8 +240,20 @@ void cursor_down(void)
class tab_window *w;
w = tab_windows[tab_names[current_tab]];
- if (w)
- w->cursor_down();
+ if (w) {
+ if (w->ypad_pos < 1000) {
+ if (tab_names[current_tab] == "Tunables") {
+ if ((w->cursor_pos + 7) >= LINES) {
+ prefresh(w->win, ++w->ypad_pos, w->xpad_pos,
+ 1, 0, LINES - 3, COLS - 1);
+ }
+ w->cursor_down();
+ } else {
+ prefresh(w->win, ++w->ypad_pos, w->xpad_pos,
+ 1, 0, LINES - 3, COLS - 1);
+ }
+ }
+ }
show_cur_tab();
}
@@ -253,12 +264,50 @@ void cursor_up(void)
w = tab_windows[tab_names[current_tab]];
- if (w)
- w->cursor_up();
-
+ if (w) {
+ w->cursor_up();
+ if(w->ypad_pos > 0) {
+ if (tab_names[current_tab] == "Tunables") {
+ prefresh(w->win, --w->ypad_pos, w->xpad_pos,
+ 1, 0, LINES - 3, COLS - 1);
+ } else {
+ prefresh(w->win, --w->ypad_pos, w->xpad_pos,
+ 1, 0, LINES - 3, COLS - 1);
+ }
+ }
+ }
+
show_cur_tab();
}
+void cursor_left(void)
+{
+ class tab_window *w;
+
+ w = tab_windows[tab_names[current_tab]];
+
+ if (w) {
+ if (w->xpad_pos > 0) {
+ prefresh(w->win, w->ypad_pos,--w->xpad_pos,
+ 1, 0, LINES - 3, COLS - 1);
+ }
+ }
+}
+
+void cursor_right(void)
+{
+ class tab_window *w;
+
+ w = tab_windows[tab_names[current_tab]];
+
+ if (w) {
+ if (w->xpad_pos < 1000) {
+ prefresh(w->win, w->ypad_pos, ++w->xpad_pos,
+ 1, 0, LINES - 3, COLS - 1);
+ }
+ }
+}
+
void cursor_enter(void)
{
class tab_window *w;
@@ -279,6 +328,8 @@ void window_refresh()
w = tab_windows[tab_names[current_tab]];
if (w) {
+ w->ypad_pos = 0;
+ w->xpad_pos = 0;
w->window_refresh();
w->repaint();
}