lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lynx-dev [PATCH 2.8.4dev.18] NEXT/PREV feedback/mouse


From: Ilya Zakharevich
Subject: lynx-dev [PATCH 2.8.4dev.18] NEXT/PREV feedback/mouse
Date: Thu, 22 Feb 2001 01:04:38 -0500
User-agent: Mutt/1.2.5i

This patch has the following effects:

  a) # at the UL corner is shown even at the beginning-of-the document
     (this simplifies the logic a lot, and does not decrease the value);

  b) With mouse enabled, the first 6 chars in the UL corner were
     "always" sensitive to Click-1, behaving as PREV_DOC (usually on
     Left).  This patch changes this logic:

       If '#' is shown there, clicking on it behaves as pressing #;

       Clicking on the next 6 chars behaves as PREV_DOC/NEXT_DOC (3+3);

  c) If you define a style for forwbackw.arrow, then suitable arrow
     are shown in these 3+3 positions; in fact they are shown only it
     makes sense to do PREV_DOC/NEXT_DOC, providing additional feedback;

  d) This additional feedback had immediately shown that my
     implementation of NEXT_DOC is not 100% intuitive (the tail of the
     queue is cleaned too late).  I'm thinking about how to fix it;

  e) significant cleanup of mouse-handling logic;

Enjoy,
Ilya

--- ./src/GridText.c-pre-fb     Tue Feb 13 00:46:16 2001
+++ ./src/GridText.c    Wed Feb 21 22:58:20 2001
@@ -33,6 +33,7 @@
 #include <LYPrint.h>
 #include <LYPrettySrc.h>
 #include <TRSTable.h>
+#include <LYHistory.h>
 #ifdef EXP_CHARTRANS_AUTOSWITCH
 #include <UCAuto.h>
 #endif /* EXP_CHARTRANS_AUTOSWITCH */
@@ -1430,7 +1431,7 @@ PRIVATE void display_title ARGS1(
     char percent[20];
     char *cp = NULL;
     unsigned char *tmp = NULL;
-    int i = 0, j = 0;
+    int i = 0, j = 0, toolbar = 0;
     int limit;
 
     /*
@@ -1530,9 +1531,26 @@ PRIVATE void display_title ARGS1(
 #if defined(SH_EX) && defined(KANJI_CODE_OVERRIDE)
     LYaddstr(str_kcode(last_kcode));
 #endif
-    if (text->top_of_screen > 0 && HText_hasToolbar(text)) {
+    if (HText_hasToolbar(text)) {
        LYaddch('#');
+       toolbar = 1;
     }
+#ifdef USE_COLOR_STYLE
+    if (s_forw_backw != NOSTYLE && (nhist || nhist_extra > 1)) {
+       int c = nhist ? ACS_LARROW : ' ';
+       
+       /* turn the FORWBACKW.ARROW style on */
+       LynxChangeStyle(s_forw_backw, STACK_ON);
+       if (nhist) {
+           LYaddch(c); LYaddch(c); LYaddch(c);
+       } else
+           LYmove(0, 3 + toolbar);
+       if (nhist_extra > 1) {
+           LYaddch(ACS_RARROW); LYaddch(ACS_RARROW); LYaddch(ACS_RARROW);
+       }
+       LynxChangeStyle(s_forw_backw, STACK_OFF);
+    }
+#endif /* USE_COLOR_STYLE */
     i = (limit - 1) - strlen(percent) - strlen(title);
     if (i >= CHAR_WIDTH) {
        LYmove(0, i);
--- ./src/LYCurses.h-pre-fb     Mon Feb 12 22:57:42 2001
+++ ./src/LYCurses.h    Thu Feb 22 00:43:50 2001
@@ -66,6 +66,14 @@ typedef struct {
 #define ACS_DARROW  SLSMG_DARROW_CHAR
 #endif
 
+#ifndef ACS_LARROW
+#define ACS_LARROW  SLSMG_LARROW_CHAR
+#endif
+
+#ifndef ACS_RARROW
+#define ACS_RARROW  SLSMG_RARROW_CHAR
+#endif
+
 #ifndef ACS_CKBOARD
 #define ACS_CKBOARD SLSMG_CKBRD_CHAR
 #endif
--- ./src/LYHash.h-pre-fb       Mon Feb 12 22:57:42 2001
+++ ./src/LYHash.h      Tue Feb 20 03:38:30 2001
@@ -49,6 +49,7 @@ extern int    s_prompt_sel;
 extern int     s_status;
 extern int     s_title;
 extern int     s_whereis;
+extern int     s_forw_backw;
 
 #ifdef USE_SCROLLBAR
 extern int     s_sb_aa;
--- ./src/LYHistory.c-pre-fb    Sun Feb 18 01:33:50 2001
+++ ./src/LYHistory.c   Tue Feb 20 03:51:14 2001
@@ -38,7 +38,7 @@ PRIVATE VisitedLink *Latest_tree;
 PRIVATE VisitedLink *First_tree;
 PRIVATE VisitedLink *Last_by_first;
 
-PRIVATE int nhist_extra;
+int nhist_extra;
 
 #ifdef LY_FIND_LEAKS
 /*
--- ./src/LYHistory.h-pre-fb    Sat Feb 17 17:12:40 2001
+++ ./src/LYHistory.h   Tue Feb 20 03:51:38 2001
@@ -21,4 +21,6 @@ extern void LYstore_message2 PARAMS((CON
 extern void LYstore_message PARAMS((CONST char *message));
 extern void LYstatusline_messages_on_exit PARAMS((char **buf));
 
+extern int nhist_extra;
+
 #endif /* LYHISTORY_H */
--- ./src/LYStrings.c-pre-fb    Tue Feb 20 03:00:54 2001
+++ ./src/LYStrings.c   Tue Feb 20 04:37:42 2001
@@ -364,24 +364,39 @@ PRIVATE int set_clicked_link ARGS4(
     int i;
     int c = -1;
 
-    if (y == (LYlines-1)) {
-       mouse_link = -2;
-       if (x < left)
-           c = (code==FOR_PROMPT) ? LTARROW : LAC_TO_LKC0(LYK_PREV_DOC);
-       else if (x > right)
-           c = (code==FOR_PROMPT) ? RTARROW : LAC_TO_LKC0(LYK_HISTORY);
-       else
-           c = LAC_TO_LKC0(LYK_NEXT_PAGE);
-    } else if (y == 0) {
+    if (y == (LYlines-1) || y == 0) {  /* First or last row */
+       /* XXXX In fact # is not always at x==0?  KANJI_CODE_OVERRIDE? */
+       int toolbar = (y == 0 && HText_hasToolbar(HTMainText));
+
        mouse_link = -2;
-       if (x == 0 && HText_hasToolbar(HTMainText))
+       if (x == 0 && toolbar)          /* On '#' */
            c = LAC_TO_LKC0(LYK_TOOLBAR);
-       else if (x < left)
-           c = LAC_TO_LKC0(LYK_PREV_DOC);
-       else if (x > right)
-           c = LAC_TO_LKC0(LYK_HISTORY);
-       else
-           c = LAC_TO_LKC0(LYK_PREV_PAGE);
+       else if (clicks > 1) {
+           if (x < left + toolbar)
+               c = (code==FOR_PROMPT && y)
+                   ? HOME : LAC_TO_LKC0(LYK_MAIN_MENU);
+           else if (x > right)
+               c = (code==FOR_PROMPT && y)
+                   ? END_KEY : LAC_TO_LKC0(LYK_VLINKS);
+           else if (y)                 /* Last row */
+               c = LAC_TO_LKC0(LYK_END);
+           else                        /* First row */
+               c = LAC_TO_LKC0(LYK_HOME);
+       } else {
+           if (x < left + toolbar)
+               c = (code==FOR_PROMPT && y)
+                   ? LTARROW
+                   : ( (s_forw_backw != NOSTYLE && x - toolbar >= 3)
+                       ? LAC_TO_LKC0(LYK_NEXT_DOC)
+                       : LAC_TO_LKC0(LYK_PREV_DOC) );
+           else if (x > right)
+               c = (code==FOR_PROMPT && y)
+                   ? RTARROW : LAC_TO_LKC0(LYK_HISTORY);
+           else if (y)                 /* Last row */
+               c = LAC_TO_LKC0(LYK_NEXT_PAGE);
+           else                        /* First row */
+               c = LAC_TO_LKC0(LYK_PREV_PAGE);
+       }
 #ifdef USE_SCROLLBAR
     } else if (x == LYcols - 1 && LYsb && LYsb_begin >= 0) {
        int h = display_lines - 2*(LYsb_arrow != 0);
@@ -507,7 +522,7 @@ PRIVATE int set_clicked_link ARGS4(
        if (mouse_link >= 0) {
            if (mouse_err == 0) {
                if (c == -1)
-                   c = lookup_keymap(LYK_ACTIVATE);
+                   c = LAC_TO_LKC0(LYK_ACTIVATE);
            } else if (mouse_err >= 0)
                c = lookup_keymap(LYK_CHANGE_LINK);
        }
@@ -2086,23 +2101,7 @@ re_read:
                    c = set_clicked_link(event.x, event.y, code, 1);
                } else if (event.bstate & BUTTON1_DOUBLE_CLICKED) {
                    c = set_clicked_link(event.x, event.y, code, 2);
-                   if (c == PGDOWN)
-                       c = END_KEY;
-                   else if (c == PGUP)
-                       c = HOME;
-                   else if (c == REMOVE_KEY)
-                       c = END_KEY;
-                   else if (c == INSERT_KEY)
-                       c = HOME;
-                   else if (c == RTARROW)
-                       c = END_KEY;
-                   else if (c == LTARROW && code == FOR_PROMPT)
-                       c = HOME;
-                   else if (c == LTARROW)
-                       c = LYReverseKeymap(LYK_MAIN_MENU);
-                   else if (c == '\b' && (code == FOR_PANEL || code == 
FOR_INPUT))
-                       c = LAC_TO_LKC0(LYK_VLINKS);
-                   else if (c == LAC_TO_LKC0(LYK_SUBMIT) && code == FOR_INPUT)
+                   if (c == LAC_TO_LKC0(LYK_SUBMIT) && code == FOR_INPUT)
                        lac = LYK_SUBMIT;
                } else if (event.bstate & BUTTON3_CLICKED) {
                    c = LAC_TO_LKC0(LYK_PREV_DOC);
@@ -2119,7 +2118,7 @@ re_read:
                    int atlink;
 
                    c = set_clicked_link(event.x, event.y, code, 1);
-                   atlink = (c == LYReverseKeymap(LYK_ACTIVATE));
+                   atlink = (c == LAC_TO_LKC0(LYK_ACTIVATE));
                    if (!atlink)
                        mouse_link = -1; /* Forget about approx stuff. */
 
--- ./src/LYStyle.c-pre-fb      Mon Feb 12 22:57:46 2001
+++ ./src/LYStyle.c     Tue Feb 20 03:40:58 2001
@@ -66,6 +66,7 @@ PUBLIC int s_prompt_sel               = NOSTYLE;
 PUBLIC int s_status            = NOSTYLE;
 PUBLIC int s_title             = NOSTYLE;
 PUBLIC int s_whereis           = NOSTYLE;
+PUBLIC int s_forw_backw                = NOSTYLE;
 
 #ifdef USE_SCROLLBAR
 PUBLIC int s_sb_aa             = NOSTYLE;
@@ -207,6 +208,7 @@ PRIVATE void parse_style ARGS1(char*,buf
        { "edit.prompt.arrow",  DSTYLE_ELEMENTS,        &s_prompt_edit_arr },
        { "edit.prompt.marked", DSTYLE_ELEMENTS,        &s_prompt_sel },
        { "edit.prompt",        DSTYLE_ELEMENTS,        &s_prompt_edit },
+       { "forwbackw.arrow",    DSTYLE_ELEMENTS,        &s_forw_backw },
     };
     unsigned n;
     BOOL found = FALSE;

; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]