aboutsummaryrefslogtreecommitdiffstats
path: root/display.c
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2002-11-05 17:10:04 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2002-11-05 17:10:04 +0000
commita772c51a1672e5dd7c9c70ee7e50cfa79e13b023 (patch)
tree9e6b4139be67b7562324f19728db83d0d19ae7ba /display.c
parentfix indent (diff)
downloadw3m-a772c51a1672e5dd7c9c70ee7e50cfa79e13b023.tar.gz
w3m-a772c51a1672e5dd7c9c70ee7e50cfa79e13b023.zip
[w3m-dev 03372] tab browser
* display.c (displayBuffer): add ny rootY offset by tab tab line (cursorDown): offset rootY (arrangeCursor): offset rootY * etc.c (columnSkip): offset rootY (lineSkip): offset rootY (currentLineSkip): offset rootY * file.c (HTMLlineproc2body): ATTR_TARGET * fm.h (MapArea): add target (Buffer): add rootY (TabBuffer): added (Currentbuf): comment out (Firstbuf): comment out (CurrentTab): added (FirstTab): added (LastTab): added (open_tab_blank): added (close_tab_back): added (nTab): added (TabCols): added (N_TAB): added (Currentbuf): CurrentTab->currentBuffer (Firstbuf): CurrentTab->firstBuffer * funcname.tab (CLOSE_TAB): added (NEW_TAB): added (NEXT_TAB): added (PREV_TAB): added (TAB_GOTO): added (TAB_GOTO_RELATIVE): added (TAB_LEFT): added (TAB_LINK): added (TAB_MENU): added (TAB_RIGHT): added * html.c (ALST_AREA): add ATTR_TARGET * image.c (showImageProgress): offset rootY * main.c (_newT): added (followTab): added (moveTab): added (check_target): added (MAIN): init tab related values buf => tab (nscroll): offset rootY (pgFore): offset rootY (pgBack): offset rootY (ctrCsrV): offset rootY (_movD): offset rootY (_movU): offset rootY (_goLine): offset rootY (_mark): offset rootY (followA): check target (_followForm): offset rootY (drawAnchorCursor0): offset rootY (drawAnchorCursor): offset rootY (backBf): check close_tab_back (follow_map): rewrite for tab, check target (posTab): added (process_mouse): tab operation offset rootY (deleteFiles): for all buffers in all tabs (newTab): added (newT): added (numTab): added (deleteTab): added (closeT): added (nextT): added (prevT): added (followTab): added (tabA): added (tabURL0): added (tabURL): added (tabrURL): added (moveTab): added (tabR): added (tabL): added * map.c (follow_map_menu): return MapArea (newMapArea): add target args * menu.c (SelTabMenu): added (SelTabV): added (initSelTabMenu): added (smChTab): added (smDelTab): added (MainMenuItem): add Select Tab on New Tab (popupMenu): add initSelTabMenu() offset rootY (mainMn): offset rootY (selMn): offset rootY (initSelectMenu): offset rootY (tabMn): added * proto.h (newT): added (closeT): added (nextT): added (prevT): added (tabA): added (tabURL): added (tabrURL): added (tabR): added (tabL): added (newTab): added (deleteTab): added (follow_map_menu): return MapArea (newMapArea): add target arg (tabMn): added * rc.c (CMT_OPEN_TAB_BLANK): added (CMT_CLOSE_TAB_BACK): added (open_tab_blank): added (close_tab_back): added * doc/README.func (CLOSE_TAB): added (NEW_TAB): added (NEXT_TAB): added (PREV_TAB): added (TAB_GOTO): added (TAB_GOTO_RELATIVE): added (TAB_LEFT): added (TAB_LINK): added (TAB_MENU): added (TAB_RIGHT): added * doc-jp/README.func: ditto doc/README.func From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat (limited to '')
-rw-r--r--display.c63
1 files changed, 53 insertions, 10 deletions
diff --git a/display.c b/display.c
index d9924f5..7f62f00 100644
--- a/display.c
+++ b/display.c
@@ -1,4 +1,4 @@
-/* $Id: display.c,v 1.25 2002/10/29 16:19:41 ukai Exp $ */
+/* $Id: display.c,v 1.26 2002/11/05 17:10:05 ukai Exp $ */
#include <signal.h>
#include "fm.h"
@@ -227,6 +227,7 @@ displayBuffer(Buffer *buf, int mode)
{
Str msg;
Anchor *aa = NULL;
+ int ny = 0;
if (buf->topLine == NULL && readBufferCache(buf) == 0) { /* clear_buffer */
mode = B_FORCE_REDRAW;
@@ -253,6 +254,12 @@ displayBuffer(Buffer *buf, int mode)
else
buf->rootX = 0;
buf->COLS = COLS - buf->rootX;
+ if (nTab > 1)
+ ny = (nTab - 1) / N_TAB + 2;
+ if (buf->rootY != ny) {
+ buf->rootY = ny;
+ arrangeCursor(buf);
+ }
if (mode == B_FORCE_REDRAW || mode == B_SCROLL ||
#ifdef USE_IMAGE
mode == B_REDRAW_IMAGE ||
@@ -388,7 +395,7 @@ displayBuffer(Buffer *buf, int mode)
refresh();
}
standout();
- message(msg->ptr, buf->cursorX + buf->rootX, buf->cursorY);
+ message(msg->ptr, buf->cursorX + buf->rootX, buf->cursorY + buf->rootY);
standend();
term_title(buf->buffername);
refresh();
@@ -428,8 +435,41 @@ redrawNLine(Buffer *buf, int n)
#endif /* USE_BG_COLOR */
}
#endif /* USE_COLOR */
- for (i = 0, l = buf->topLine; i < LASTLINE; i++) {
- if (i >= LASTLINE - n || i < -n)
+ if (nTab > 1) {
+ TabBuffer *t;
+ int nx = N_TAB, col = COLS - 2, x, l;
+
+ move(0, 0);
+ for (t = FirstTab, i = 0; t; t = t->nextTab, i++) {
+ x = col * (i % nx) / nx;
+ move(i / nx, x);
+ if (t == CurrentTab)
+ bold();
+ addch('[');
+ l = strlen(t->currentBuffer->buffername);
+ if (col / nx - 2 > l)
+ addnstr_sup(" ", (col / nx - 2 - l) / 2);
+ if (t == CurrentTab)
+ EFFECT_ACTIVE_START;
+ addstr(t->currentBuffer->buffername);
+ if (t == CurrentTab)
+ EFFECT_ACTIVE_END;
+ clrtoeol();
+ x = col * (i % nx + 1) / nx - 1;
+ move(i / nx, x);
+ addch(']');
+ if (t == CurrentTab)
+ boldend();
+ clrtoeol();
+ }
+ move(0, col);
+ addstr(" x");
+ move((nTab - 1) / nx + 1, 0);
+ for (i = 0; i < COLS; i++)
+ addch('~');
+ }
+ for (i = buf->rootY, l = buf->topLine; i < LASTLINE; i++) {
+ if (i >= LASTLINE - n || (i - buf->rootY) < -n)
l0 = redrawLine(buf, l, i);
else {
l0 = (l) ? l->next : NULL;
@@ -444,7 +484,7 @@ redrawNLine(Buffer *buf, int n)
#ifdef USE_IMAGE
if (!(activeImage && displayImage && buf->img))
return;
- move(buf->cursorY, buf->cursorX);
+ move(buf->cursorY + buf->rootY, buf->cursorX + buf->rootX);
for (i = 0, l = buf->topLine; i < LASTLINE; i++) {
if (i >= LASTLINE - n || i < -n)
l0 = redrawLineImage(buf, l, i);
@@ -666,7 +706,7 @@ redrawLineImage(Buffer *buf, Line *l, int i)
buf->need_reshape = TRUE;
}
x = (int)((rcol - column + buf->rootX) * pixel_per_char);
- y = (int)(i * pixel_per_line);
+ y = (int)((i + buf->rootY) * pixel_per_line);
sx = (int)((rcol - COLPOS(l, a->start.pos)) * pixel_per_char);
sy = (int)((l->linenumber - image->y) * pixel_per_line);
if (sx == 0 && x + image->xoffset >= 0)
@@ -1009,7 +1049,7 @@ disp_message_nsec(char *s, int redraw_current, int sec, int purge, int mouse)
}
if (Currentbuf != NULL)
message(s, Currentbuf->cursorX + Currentbuf->rootX,
- Currentbuf->cursorY);
+ Currentbuf->cursorY + Currentbuf->rootY);
else
message(s, LASTLINE, 0);
refresh();
@@ -1065,7 +1105,7 @@ cursorDown(Buffer *buf, int n)
{
if (buf->firstLine == NULL)
return;
- if (buf->cursorY < LASTLINE - 1)
+ if (buf->cursorY + buf->rootY < LASTLINE - 1)
cursorUpDown(buf, 1);
else {
buf->topLine = lineSkip(buf, buf->topLine, n, FALSE);
@@ -1180,9 +1220,12 @@ arrangeCursor(Buffer *buf)
if (buf == NULL || buf->currentLine == NULL)
return;
/* Arrange line */
- if (buf->currentLine->linenumber - buf->topLine->linenumber >= LASTLINE ||
- buf->currentLine->linenumber < buf->topLine->linenumber) {
+ if (buf->currentLine->linenumber - buf->topLine->linenumber >= LASTLINE -
+ buf->rootY || buf->currentLine->linenumber < buf->topLine->linenumber) {
+/*
buf->topLine = buf->currentLine;
+*/
+ buf->topLine = lineSkip(buf, buf->currentLine, 0, FALSE);
}
/* Arrange column */
if (buf->currentLine->len == 0)