lynx-dev
[Top][All Lists]
Advanced

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

LYNX-DEV Hellen's patch revisited


From: Bill Schiavo
Subject: LYNX-DEV Hellen's patch revisited
Date: Thu, 19 Mar 1998 13:14:44 -0500 (EST)

Hello everyone,

  The following patch is based on a previous patch submitted by
address@hidden  This patch replaces the [LINK], [INLINE] and
[IMAGE] comments (for images without ALT) with filenames of these images. 

I have updated it to work with Lynx version 2-8 release 3 and I also allow
you to enable or disable it by setting VERBOSE_IMAGES in lynx.cfg and/or
userdefs.h.

Apply it by changing to the lynx2-8 directory and type the command patch
-p0 <filename.

Regards!

*** userdefs.h  Thu Mar 19 10:14:03 1998
--- userdefs.h.new      Thu Mar 19 10:13:19 1998
***************
*** 891,896 ****
--- 891,906 ----
  #define SHOW_CURSOR FALSE
  
  /******************************
+ * VERBOSE_IMAGES controls whether or not Lynx replaces the [LINK], [INLINE] 
and
+ * [IMAGE] comments (for images without ALT) with filenames of these images.
+ * This is extremely useful because now we can determin immediately what images
+ * are just decorations (button.gif, line.gif) and what images are important.
+ *
+ * The default defined here can be changed in lynx.cfg.
+ */
+ #define VERBOSE_IMAGES FALSE
+ 
+ /******************************
   * BOXVERT and BOXHORI control the layout of popup menus.  Set to 0 if your
   * curses supports line-drawing characters, set to '*' or any other character
   * to not use line-drawing (e.g., '|' for vertical and '-' for horizontal).
*** lynx.cfg    Thu Mar 19 10:15:35 1998
--- lynx.cfg.new        Thu Mar 19 01:23:39 1998
***************
*** 370,375 ****
--- 370,383 ----
  #
  #SHOW_CURSOR:FALSE
  
+ #  VERBOSE_IMAGES controls whether or not Lynx replaces the [LINK], [INLINE] 
and
+ # [IMAGE] comments (for images without ALT) with filenames of these images.
+ # This is extremely useful because now we can determin immediately what images
+ # are just decorations (button.gif, line.gif) and what images are important.
+ #
+ # If this option is set here, it will override the setting in userdefs.h.
+ #VERBOSE_IMAGES:FALSE
+ 
  # If BOLD_HEADERS is set to TRUE the HT_BOLD default style will be acted
  # upon for <H1> through <H6> headers.  The compilation default is FALSE
  # (only the indentation styles are acted upon, but see BOLD_H1, below).
*** lynx2-8/src/HTML.c  Wed Mar  4 13:49:48 1998
--- ./src/HTML.c        Wed Mar 18 22:03:34 1998
***************
*** 119,124 ****
--- 119,126 ----
        while (*i) { *i=tolower(*i); i++; }
  }
  
+ PRIVATE char * MakeNewTitle(CONST char ** value);
+ 
  /*            Flattening the style structure
  **            ------------------------------
  **
***************
*** 601,606 ****
--- 603,609 ----
  {
      char *alt_string = NULL;
      char *id_string = NULL;
+     char *newtitle = NULL;
      char *href = NULL;
      char *map_href = NULL;
      char *title = NULL;
***************
*** 2739,2752 ****
                    } else if (dest_ismap) {
                        StrAllocCopy(alt_string, (title ?
                                                  title : "[ISMAP]"));
!                   } else if (me->inA == TRUE && dest) {
!                       StrAllocCopy(alt_string, (title ?
!                                                 title : "[LINK]"));
!                   } else {
!                       StrAllocCopy(alt_string,
!                                            (title ? title :
!                               (present[HTML_IMG_ISOBJECT] ?
!                                                "(OBJECT)" : "[INLINE]")));
                    }
                }
            }
--- 2742,2759 ----
                    } else if (dest_ismap) {
                        StrAllocCopy(alt_string, (title ?
                                                  title : "[ISMAP]"));
! 
!       } else if (me->inA == TRUE && dest) {
!           StrAllocCopy(alt_string, (title ?
!                                     title : (verbose_img)?
!                                        
(newtitle=MakeNewTitle(value)):"[LINK]"));
! 
!       } else {
!           StrAllocCopy(alt_string, (title ? title :
!                         ((present &&
!                           present[HTML_IMG_ISOBJECT]) ?
!                                        "(OBJECT)" : (verbose_img)?
!         (newtitle=MakeNewTitle(value)):"[INLINE]")));
                    }
                }
            }
***************
*** 2760,2778 ****
            StrAllocCopy(alt_string, (title ?
                                      title : "[ISMAP]"));
  
!       } else if (me->inA == TRUE && dest) {
!           StrAllocCopy(alt_string, (title ?
!                                     title : "[LINK]"));
  
-       } else {
-           if (pseudo_inline_alts || clickable_images)
-               StrAllocCopy(alt_string, (title ? title :
-                         ((present &&
-                           present[HTML_IMG_ISOBJECT]) ?
-                                            "(OBJECT)" : "[INLINE]")));
-           else
-               StrAllocCopy(alt_string, (title ?
-                                         title : ""));
        }
        if (*alt_string == '\0' && map_href) {
            StrAllocCopy(alt_string, "[USEMAP]");
--- 2767,2788 ----
            StrAllocCopy(alt_string, (title ?
                                      title : "[ISMAP]"));
  
!       } else if (me->inA == TRUE && dest) {
!           StrAllocCopy(alt_string, (title ?
!                                     title : (verbose_img)?
!                                        
(newtitle=MakeNewTitle(value)):"[LINK]"));
! 
!       } else {
!            if (pseudo_inline_alts || clickable_images)
!             StrAllocCopy(alt_string, (title ? title :
!                         ((present &&
!                           present[HTML_IMG_ISOBJECT]) ?
!                                            "(OBJECT)" : (verbose_img)?
!                             (newtitle=MakeNewTitle(value)):"[INLINE]")));
!           else
!               StrAllocCopy(alt_string, (title ?
!                                         title : ""));
  
        }
        if (*alt_string == '\0' && map_href) {
            StrAllocCopy(alt_string, "[USEMAP]");
***************
*** 2897,2906 ****
                me->CurrentANum = 0;
                HTML_put_character(me, '-');
                StrAllocCopy(alt_string,
!                            ((present &&
!                              present[HTML_IMG_ISOBJECT]) ?
!                  ((map_href || dest_ismap) ?
!                                  "(IMAGE)" : "(OBJECT)") : "[IMAGE]"));
                if (id_string && !map_href) {
                    if ((ID_A = HTAnchor_findChildAndLink(
                                  me->node_anchor,      /* Parent */
--- 2907,2917 ----
                me->CurrentANum = 0;
                HTML_put_character(me, '-');
                StrAllocCopy(alt_string,
!                            ((present &&
!                              present[HTML_IMG_ISOBJECT]) ?
!                  ((map_href || dest_ismap) ?
!                                  "(IMAGE)" : "(OBJECT)") : (verbose_img)?
!                                (newtitle=MakeNewTitle(value)):"[IMAGE]"));
                if (id_string && !map_href) {
                    if ((ID_A = HTAnchor_findChildAndLink(
                                  me->node_anchor,      /* Parent */
***************
*** 2952,2960 ****
                me->CurrentANum = 0;
                HTML_put_character(me, '-');
                StrAllocCopy(alt_string,
!                            ((present &&
!                              present[HTML_IMG_ISOBJECT]) ?
!                                                 "(IMAGE)" : "[IMAGE]"));
            } else {
                HTML_put_character(me, ' ');  /* space char may be ignored */
                me->in_word = NO;
--- 2963,2972 ----
                me->CurrentANum = 0;
                HTML_put_character(me, '-');
                StrAllocCopy(alt_string,
!                            ((present &&
!                              present[HTML_IMG_ISOBJECT]) ?
!                                                 "(IMAGE)" : (verbose_img)?
!                                (newtitle=MakeNewTitle(value)): "[IMAGE]"));
            } else {
                HTML_put_character(me, ' ');  /* space char may be ignored */
                me->in_word = NO;
***************
*** 3080,3085 ****
--- 3092,3098 ----
        FREE(alt_string);
        FREE(id_string);
        FREE(title);
+       FREE(newtitle);
        dest = NULL;
        dest_ismap = FALSE;
        break;
***************
*** 4437,4443 ****
                    HText_beginAnchor(me->text, me->inUnderline, me->CurrentA);
                    if (me->inBoldH == FALSE)
                        HText_appendCharacter(me->text, LY_BOLD_START_CHAR);
!                   HTML_put_string(me, "[IMAGE]");
                    if (me->inBoldH == FALSE)
                        HText_appendCharacter(me->text, LY_BOLD_END_CHAR);
                    HText_endAnchor(me->text, 0);
--- 4450,4456 ----
                    HText_beginAnchor(me->text, me->inUnderline, me->CurrentA);
                    if (me->inBoldH == FALSE)
                        HText_appendCharacter(me->text, LY_BOLD_START_CHAR);
!                   HTML_put_string(me, 
(verbose_img)?(newtitle=MakeNewTitle(value)):"[IMAGE]");
                    if (me->inBoldH == FALSE)
                        HText_appendCharacter(me->text, LY_BOLD_END_CHAR);
                    HText_endAnchor(me->text, 0);
***************
*** 7488,7491 ****
--- 7501,7522 ----
  {
      HTAlert(message);         /* @@@@@@@@@@@@@@@@@@@ */
      return -number;
+ }
+ 
+ 
+ PRIVATE char * MakeNewTitle(CONST char ** value)
+ {
+   char *ptr;
+   char *newtitle=NULL;
+ 
+   StrAllocCopy(newtitle,"[");
+   ptr=strrchr(value[HTML_IMG_SRC],'/');
+   if(!ptr){
+     StrAllocCat(newtitle,value[HTML_IMG_SRC]);
+   }
+   else{
+     StrAllocCat(newtitle,ptr+1);
+   }
+   StrAllocCat(newtitle,"]");
+   return newtitle;
  }
*** lynx2-8/src/LYGlobalDefs.h  Fri Feb 13 08:53:42 1998
--- ./src/LYGlobalDefs.h        Wed Mar 18 22:17:34 1998
***************
*** 112,117 ****
--- 112,118 ----
  extern int LYrcShowColor;     /* ... as read or last written      */
  
  extern BOOLEAN LYShowCursor;  /* Show the cursor or hide it?      */
+ extern BOOLEAN verbose_img;   /* display filenames of images?     */  
  extern BOOLEAN LYUseDefShoCur;        /* Command line -show_cursor toggle */
  extern BOOLEAN LYCursesON;  /* start_curses()->TRUE, stop_curses()->FALSE */
  extern BOOLEAN LYUserSpecifiedURL;  /* URL from a goto or document? */
*** lynx2-8/src/LYMain.c        Fri Feb 27 13:25:07 1998
--- ./src/LYMain.c      Wed Mar 18 22:38:32 1998
***************
*** 164,169 ****
--- 164,170 ----
  PUBLIC int LYChosenShowColor = SHOW_COLOR_UNKNOWN; /* whether to show and 
save */
  PUBLIC int LYrcShowColor = SHOW_COLOR_UNKNOWN;        /* ... as last read or 
written */
  PUBLIC BOOLEAN LYShowCursor = SHOW_CURSOR; /* to show or not to show */
+ PUBLIC BOOLEAN verbose_img = VERBOSE_IMAGES;  /* show filenames or not */
  PUBLIC BOOLEAN LYUseDefShoCur = TRUE; /* Command line -show_cursor toggle */
  PUBLIC BOOLEAN LYforce_no_cache = FALSE;
  PUBLIC BOOLEAN LYoverride_no_cache = FALSE;/*override no-cache b/c history 
etc*/
*** lynx2-8/src/LYReadCFG.c     Fri Feb 27 13:25:07 1998
--- ./src/LYReadCFG.c   Wed Mar 18 23:12:07 1998
***************
*** 1218,1224 ****
        break;
  
        case 'V':
!       if (!strncasecomp(buffer, "VI_KEYS_ALWAYS_ON:", 18)) {
            vi_keys = is_true(buffer+18);
  
        } else if (!strncasecomp(buffer, "VIEWER:", 7)) {
--- 1218,1227 ----
        break;
  
        case 'V':
!       if (!strncasecomp(buffer, "VERBOSE_IMAGES:", 15)) {
!           verbose_img = is_true(buffer+15);
! 
!       } else if (!strncasecomp(buffer, "VI_KEYS_ALWAYS_ON:", 18)) {
            vi_keys = is_true(buffer+18);
  
        } else if (!strncasecomp(buffer, "VIEWER:", 7)) {


reply via email to

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