}
/* Only resize the pad if the rightmost window column has changed. */
- if (getmaxx(wmeta->pad.curses_win) != lastwincol)
+ if (getmaxx(wmeta->padframe.curses_win) != lastwincol)
{
- wresize(wmeta->pad.curses_win,
- getmaxy(wmeta->pad.curses_win), lastwincol + 2);
+ wresize(wmeta->padframe.curses_win,
+ getmaxy(wmeta->padframe.curses_win), lastwincol + 2);
}
}
}
place_win(wmeta, w);
refit_pad(wmeta);
- w->frame.curses_win = subpad(wmeta->pad.curses_win,
+ w->frame.curses_win = subpad(wmeta->padframe.curses_win,
w->frame.size.y, w->frame.size.x,
w->start.y, w->start.x);
if (0 != w->next)
uint16_t w_prev_maxy = w->prev->start.y
+ getmaxy(w->prev->frame.curses_win);
if ( w->frame.size.x <= w->prev->frame.size.x
- && w->frame.size.y < wmeta->pad.size.y - w_prev_maxy)
+ && w->frame.size.y < wmeta->padframe.size.y - w_prev_maxy)
{
w->start.x = w->prev->start.x;
w->start.y = w_prev_maxy + 1;
+ getmaxy(w_upup->frame.curses_win);
widthdiff = (w_upup->start.x + w_upup->frame.size.x)
- (w_up->start.x + w_up->frame.size.x);
- if ( w->frame.size.y < wmeta->pad.size.y - w_prev_maxy
+ if ( w->frame.size.y < wmeta->padframe.size.y - w_prev_maxy
&& w->frame.size.x < widthdiff)
{
w->start.x = w_up->start.x + w_up->frame.size.x + 1 ;
extern struct WinMeta init_win_meta(WINDOW * screen)
{
struct WinMeta wmeta;
- wmeta.screen = screen;
- wmeta.pad.size.y = getmaxy(screen);
- wmeta.pad.size.x = getmaxx(screen);
- wmeta.chain_start = 0;
- wmeta.chain_end = 0;
- wmeta.pad_offset = 0;
- wmeta.pad.curses_win = newpad(wmeta.pad.size.y, 1);
- wmeta.active = 0;
+ wmeta.screen = screen;
+ wmeta.padframe.size.y = getmaxy(screen);
+ wmeta.padframe.size.x = getmaxx(screen);
+ wmeta.chain_start = 0;
+ wmeta.chain_end = 0;
+ wmeta.pad_offset = 0;
+ wmeta.padframe.curses_win = newpad(wmeta.padframe.size.y, 1);
+ wmeta.active = 0;
return wmeta;
}
w.frame.curses_win = 0;
w.title = title;
w.frame.size.x = 20;
- w.frame.size.y = wmeta->pad.size.y - 1;
+ w.frame.size.y = wmeta->padframe.size.y - 1;
w.data = data;
w.draw = func;
return w;
{
if (new_offset >= 0
&& (new_offset < wmeta->pad_offset
- || new_offset + wmeta->pad.size.x < getmaxx(wmeta->pad.curses_win)))
+ || new_offset + wmeta->padframe.size.x
+ < getmaxx(wmeta->padframe.curses_win)))
{
wmeta->pad_offset = new_offset;
}
{
if (0 != wmeta->active
&& size.x > 0 && size.y > 0
- && size.y < wmeta->pad.size.y)
+ && size.y < wmeta->padframe.size.y)
{
wmeta->active->frame.size = size;
update_wins(wmeta, wmeta->chain_start); /* Positioning of successor */
/* Empty everything before filling it a-new. */
erase();
wnoutrefresh(wmeta->screen);
- werase(wmeta->pad.curses_win);
+ werase(wmeta->padframe.curses_win);
if (wmeta->chain_start)
{
/* Draw windows' contents first, then their borders. */
draw_wins(wmeta->chain_start);
draw_wins_borderlines(wmeta->chain_start, wmeta->active,
- wmeta->pad.curses_win);
- draw_wins_bordercorners(wmeta->chain_start, wmeta->pad.curses_win);
+ wmeta->padframe.curses_win);
+ draw_wins_bordercorners(wmeta->chain_start, wmeta->padframe.curses_win);
/* Draw virtual screen scroll hints. */
if (wmeta->pad_offset > 0)
{
- draw_scroll_hint(&wmeta->pad,
+ draw_scroll_hint(&wmeta->padframe,
wmeta->pad_offset, wmeta->pad_offset + 1, '<');
}
- if (wmeta->pad_offset + wmeta->pad.size.x
- < getmaxx(wmeta->pad.curses_win) - 1)
+ if (wmeta->pad_offset + wmeta->padframe.size.x
+ < getmaxx(wmeta->padframe.curses_win) - 1)
{
- draw_scroll_hint(&wmeta->pad,
- wmeta->pad_offset + wmeta->pad.size.x - 1,
- getmaxx(wmeta->pad.curses_win)
- - (wmeta->pad_offset + wmeta->pad.size.x), '>');
+ draw_scroll_hint(&wmeta->padframe,
+ wmeta->pad_offset + wmeta->padframe.size.x - 1,
+ getmaxx(wmeta->padframe.curses_win)
+ - (wmeta->pad_offset + wmeta->padframe.size.x),
+ '>');
}
/* Write virtual screen segment to be shown on physical screen into */
/* ncurses screen buffer. */
- pnoutrefresh(wmeta->pad.curses_win, 0, wmeta->pad_offset, 0, 0,
- wmeta->pad.size.y, wmeta->pad.size.x-1);
+ pnoutrefresh(wmeta->padframe.curses_win, 0, wmeta->pad_offset, 0, 0,
+ wmeta->padframe.size.y, wmeta->padframe.size.x-1);
}
/* Only at the end write accumulated changes to the physical screen. */
struct Frame
{
WINDOW * curses_win;
- struct yx_uint16 size; /* designated size of curses_win */
-};
+ struct yx_uint16 size; /* the size curses_win fits into; for the virtual */
+}; /* screen padframe: the terminal screen size */
struct Win
{
{
WINDOW * screen; /* terminal screen */
uint16_t pad_offset; /* number of cells view is moved to the right */
- struct Frame pad; /* virtual screen */
+ struct Frame padframe; /* virtual screen fitted into terminal screen */
struct Win * chain_start; /* first Win, whose .prev shall point to 0 */
struct Win * chain_end; /* last Win, whose .next shall point to 0 */
struct Win * active; /* window highlighted/selected for manipulation */
-/* Create on the terminal "screen" an empty WinMeta whose virtual screen at the
- * beginning is sized just like the terminal screen. Note that emptiness is
- * marked by WinMeta.chain_start=0. Other struct values are also initialized 0.
- *
- * TODO: Why is an *empty* virtual screen's size that of the terminal screen?
+/* Create on the terminal "screen" an empty WinMeta. Note that emptiness is
+ * marked by WinMeta.chain_start=0. Other struct values are also initialized 0,
+ * except for the virtual screen (terminal screen height, width = 1) and its
+ * terminal-sized frame.
*/
extern struct WinMeta init_win_meta(WINDOW * screen);