Newsgroups: fj.comp.texhax,fj.sources.d
Path: galaxy.trc.rwcp.or.jp!jaist-news!cs.titech!is.titech!sys.titech.ac.jp!int.titech.ac.jp!ussy
From: ussy@int.titech.ac.jp (Takuya Harakawa)
Subject: Xdvi-17 pagenumber patch fix
Content-Type: text/plain; charset=ISO-2022-JP
Message-ID: <USSY.93Nov18065838@ayame.int.titech.ac.jp>
Followup-To: fj.sources.d
Lines: 469
Sender: news@int.titech.ac.jp
Fcc: |/usr/local/lib/mh/rcvstore +AuthorCopy
Organization: Tokyo Institute of Tech., Dept. of Intelligence Science, Japan
Mime-Version: 1.0
Distribution: fj
Date: Wed, 17 Nov 1993 21:58:38 GMT
Xref: galaxy.trc.rwcp.or.jp fj.comp.texhax:4181 fj.sources.d:2001
X-originally-archived-at: http://galaxy.rwcp.or.jp/text/cgi-bin/newsarticle2?ng=fj.comp.texhax&nb=4181&hd=a
X-reformat-date: Mon, 18 Oct 2004 15:18:22 +0900
X-reformat-comment: Tabs were expanded into 4 column tabstops by the Galaxy's archiver. See http://katsu.watanabe.name/ancientfj/galaxy-format.html for more info.


  $B$O$i$+$o!wEl9)Bg$G$9(B

  xdvi-17+miyu-patcj+markpage+toc+printdvi+tasai-ussy+pagenumber(^^;
$B$N(Bfix & version up$B%Q%C%A$r$*Aw$j$7$^$9!#(B

  $BA02s(B $BN.$7$?$b$N$K$5$i$K%Q%C%A$r$"$F$F$/$@$5$$!#(B

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#"End of shell archive."
# Contents:  xdvi-17.pagenumber-fix.patch
# Wrapped by ussy@ayame on Thu Nov 18 06:56:16 1993
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'xdvi-17.pagenumber-fix.patch' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xdvi-17.pagenumber-fix.patch'\"
else
echo shar: Extracting \"'xdvi-17.pagenumber-fix.patch'\" \(12865 characters\)
sed "s/^X//" >'xdvi-17.pagenumber-fix.patch' <<'END_OF_FILE'
X
X               ** pagenumber-patch for Xdvi PL17 + etc. **
X
X$B!{$O$8$a$K(B
X  xdvi-17.pagenumber.patch$B$O!"(B"xdvi-17+miyu-patch for xdvi PL17"$B$r%Y!<%9$K$7$?(B
X$B%Q%C%A$G$"$k!"(B"xdvi-17+markpage+toc+printdvi"$B$KBP$9$k%Q%C%A$G$9!#(B
X
X$B!{DI2C(B/$BJQ995!G=(B
X  $BK\%Q%C%A$r$"$F$k$3$H$K$h$j0J2<$N5!G=$,DI2C(B/$BJQ99$5$l$^$9!#(B
X
X  1) $B<B:]$N(BPage$BHV9f$K$h$k(BTOC$B%j%9%H(B
X    $B>.Ln!wAa0pED$5$s$i$K$h$k(B xdvi-17+markpage+toc+printdvi $B%Q%C%A$G$O!"%Z!<%8(B
X  $BHV9f%j%9%H(B(toc)$B$rI=<($9$k5!G=$,DI2C$5$l$^$7$?$,!"(Btoc$B$KI=<($5$l$k%Z!<%8HV9f$O(B
X  $B<B:]$N%Z!<%8HV9f$G$O$J$/@hF,$+$i$NKg?t$H$J$C$F$$$^$7$?!#(B
X    $BK\%Q%C%A$G$O!"<B:]$N%Z!<%8HV9f$,I=<($5$l$k$h$&$KJQ99$7$^$7$?!#(B
X
X  2) $B%Z!<%80\F0$K$h$k(Btoc$B$N<+F0%"%C%W%G!<%H(B
X    'g'$B%-!<$J$I$K$h$k%Z!<%80\F0$KH<$C$F!"(Btoc$B$N%9%/%m!<%k%P!<0\F0$r<+F0E*$K9T$&(B
X  $B$h$&$KJQ99$7$^$7$?!#$$$m$$$m$H:Y9)$7$^$7$?$N$G!"<B:]$K;H$C$F$_$F$/$@$5$$(B:-)
X
X  3) $B0lIt%-!<F0:n$NJQ99(B
X    'g'$B%-!<$K$h$k;XDjKg?t$X$N0\F0$r!"<B:]$N%Z!<%8HV9f$X$N0\F0$H$7$^$7$?!#$3$l(B
X  $B$K$H$b$J$$!"(B'P'$B%-!<$K$h$k@dBP%Z!<%8HV9f$r;XDj$9$k5!G=$r:o=|$7!"=>Mh$N(B'g'$B%-!<(B
X  $B$N5!G=$r3d$jEv$F$^$7$?!#(B
X
X$B!{%$%s%9%H!<%k$K$D$$$F(B
X  $BK\%Q%C%A$r;HMQ$9$k$K$"$?$C$F0J2<$N%U%!%$%k$,I,MW$G$9!#(B
X
X        1) xdvi-17.tar.gz
X        2) xdvi-17miyu.patch-beta6
X        3) xdvi-17miyu.beta6-beta.pre7(fj.sources.d)
X        4) xdvi-pl17+markpage+toc+printdvi(fj.sources,fj.comp.texhax)
X        5) $BF1(Bfix-1(fj.sources.d,fj.comp.texhax)
X        6) $BF1(Bfix-2(fj.sources,fj.comp.texhax)
X        7) xdvi-17.tasai-ussy.patch(fj.sources.d,fj.comp.texhax)
X           Message-ID: <USSY.93Nov12211358@ayame.int.titech.ac.jp>
X        8) xdvi-17.pagenumber.patch(fj.sources.d)
X           Message-ID: <USSY.93Nov15175604@kisaragi.int.titech.ac.jp>
X
X  ($BCm0U(B)
X    7)$B$N0lIt(B(expert$B%b!<%I4X78(B)$B$O!"$9$G$K(B6)$B$G=$@5$5$l$F$$$^$9$N$G(Breject$B$5$l$F$b(B
X  $BLdBj$"$j$^$;$s!#K\%Q%C%A$O(B8)$B$KBP$9$k=$@5%Q%C%A$G$9!#(B
X
X  1)$B$N$rE83+$7(B 2)$B!A(B8)$B$^$G$N%Q%C%A$r$"$F$?%=!<%9$,$"$k%G%#%l%/%H%j$G!"(B
X        % patch -p2 < xdvi-17.pagenumber-fix.patch
X$B$H$7$F%Q%C%A$r$"$F$F$/$@$5$$!#(B
X
X$B!{;HMQ>e$NCm0U(B
X  $BK\%Q%C%A$GDI2C$5$l$?5!G=$O!"(BUse_PAGENUM $B$r(B Imakefile $BCf$G(B define/undefine $B$9(B
X$B$k$3$H$K$h$C$F;HMQ$9$k(B/$B$7$J$$$r@ZBX$($k$3$H$,2DG=$G$9!#(B
X  $B$^$?!"(Bxdvi-pl17+markpage+toc+printdvi$B$K$*$$$F(B Use_TOC $B$r(B define $B$7$F$$$J$$$H(B
X$B0UL#$N$J$$$b$N$G$"$k$3$H$KCm0U$7$F$/$@$5$$!#(BUse_TOC $B$rDj5A$;$:$K(B Use_PAGENUM 
X$B$rDj5A$7$?>l9g!"F0:n$NJ]>Z$O$G$-$^$;$s!#(B
X
X$B!{JQ99MzNr(B
X
Nov.12, 1993
X    Message-ID: <USSY.93Nov12231403@ayame.int.titech.ac.jp>
X    --
X    $BN^$N%U%!!<%9%H%j%j!<%9(B(T_T)
X    * toc$B$N%Z!<%8HV9f$r<B:]$N%Z!<%8HV9f$H$J$k$h$&$K$7$?!#(B
X
Nov.15, 1993
X    Message-ID: <USSY.93Nov15175604@kisaragi.int.titech.ac.jp>
X    --
X    * Imakefile$B$G$N:3:Y$J4V0c$$$rJQ99(B
X
Nov.18, 1993
X    --
X    $B@5<0HG%j%j!<%9(B
X    * $B0lIt%-!<$NF0:n$rJQ99(B($BDI2C5!G=$H$N%P%C%F%#%s%0$rKI$0$?$a(B)$B!#(B
X    * $B%Z!<%80\F08e$N(Btoc$B<+F0%"%C%W%G!<%H5!G=$rDI2C$7$?!#(B
X
X--
diff -cr ./xdvi-17.orig/dvi_draw.c ./xdvi-17/dvi_draw.c
X*** ./xdvi-17.orig/dvi_draw.cThu Nov 18 05:36:52 1993
X--- ./xdvi-17/dvi_draw.cTue Nov 16 22:45:15 1993
X***************
X*** 1353,1359 ****
X      ROUNDUP(unshrunk_paper_h, shrink_factor) + 1);
X  
X  #ifdef PAGENUM
X! (void) lseek(fileno(dvi_file), page_index[current_page+1].offset,
X       SEEK_SET);
X  #else
X  (void) lseek(fileno(dvi_file), page_offset[current_page], SEEK_SET);
X--- 1353,1359 ----
X      ROUNDUP(unshrunk_paper_h, shrink_factor) + 1);
X  
X  #ifdef PAGENUM
X! (void) lseek(fileno(dvi_file), page_index[current_page].offset,
X       SEEK_SET);
X  #else
X  (void) lseek(fileno(dvi_file), page_offset[current_page], SEEK_SET);
diff -cr ./xdvi-17.orig/dvi_init.c ./xdvi-17/dvi_init.c
X*** ./xdvi-17.orig/dvi_init.cThu Nov 18 05:36:53 1993
X--- ./xdvi-17/dvi_init.cTue Nov 16 22:44:47 1993
X***************
X*** 673,688 ****
X  #ifdef PAGENUM
X  long offset;
X  
X! page_index = (PAGE_INDEX *)xmalloc((unsigned)(total_pages + 1)
X     * sizeof(PAGE_INDEX),
X     "page directory");
X! for (offset = last_page_offset, i = total_pages; i > 0; --i) {
X      Fseek(dvi_file, offset, 0);
X      if (one(dvi_file) != BOP) {
X  dvi_oops("page description doesn't begin with BOP");
X      }
X!     page_index[i].offset = offset;
X!     page_index[i].number = four(dvi_file); /* Read c[0] */
X  
X      Fseek(dvi_file, (long)(9*4), 1);
X      offset = four(dvi_file);
X--- 673,688 ----
X  #ifdef PAGENUM
X  long offset;
X  
X! page_index = (PAGE_INDEX *)xmalloc((unsigned)total_pages
X     * sizeof(PAGE_INDEX),
X     "page directory");
X! for (offset = last_page_offset, i = total_pages; i > 0; i--) {
X      Fseek(dvi_file, offset, 0);
X      if (one(dvi_file) != BOP) {
X  dvi_oops("page description doesn't begin with BOP");
X      }
X!     page_index[i-1].offset = offset;
X!     page_index[i-1].number = four(dvi_file); /* Read c[0] */
X  
X      Fseek(dvi_file, (long)(9*4), 1);
X      offset = four(dvi_file);
diff -cr ./xdvi-17.orig/toc.c ./xdvi-17/toc.c
X*** ./xdvi-17.orig/toc.cThu Nov 18 05:36:53 1993
X--- ./xdvi-17/toc.cThu Nov 18 00:06:39 1993
X***************
X*** 26,32 ****
X--- 26,36 ----
X  #include "markpage.h"
X  #endif /* MARKPAGE */
X  
X+ #ifdef PAGENUM
X+ static intview_y;
X+ #else
X  externintpageno_correct;
X+ #endif /* PAGENUM */
X  
X  static Widgetlist_widget, viewport=NULL;
X  static char*toc[MAX_PAGE];
X***************
X*** 39,45 ****
X--- 43,53 ----
X    get_Page_size()
X  {
X    int  offset;
X+ #ifdef PAGENUM
X+   int  start_page = -1;
X+ #else
X    int  start_page = pageno_correct - 1;
X+ #endif /* PAGENUM */
X    int  end_page   = start_page + total_pages;
X    int  start_pageno_len;
X    int  end_pageno_len;
X***************
X*** 104,110 ****
X        sprintf(s, "%c %*d%c",
X        i==LastMarkPage() ? LASTMRKPAGESYM : MRKPAGESYM,
X  #ifdef PAGENUM
X!       get_Page_size(), page_index[i+pageno_correct].number,
X  #else
X        get_Page_size(), i+pageno_correct,
X  #endif /* PAGENUM */
X--- 112,118 ----
X        sprintf(s, "%c %*d%c",
X        i==LastMarkPage() ? LASTMRKPAGESYM : MRKPAGESYM,
X  #ifdef PAGENUM
X!       get_Page_size(), page_index[i].number,
X  #else
X        get_Page_size(), i+pageno_correct,
X  #endif /* PAGENUM */
X***************
X*** 114,120 ****
X        sprintf(s, "%c %*d%c",
X        NORMALPAGESYM,
X  #ifdef PAGENUM
X!       get_Page_size(), page_index[i+pageno_correct].number,
X  #else
X        get_Page_size(), i+pageno_correct,
X  #endif /* PAGENUM */
X--- 122,128 ----
X        sprintf(s, "%c %*d%c",
X        NORMALPAGESYM,
X  #ifdef PAGENUM
X!       get_Page_size(), page_index[i].number,
X  #else
X        get_Page_size(), i+pageno_correct,
X  #endif /* PAGENUM */
X***************
X*** 123,129 ****
X  #else
X      sprintf(s, "%*d%c",
X  #ifdef PAGENUM
X!     get_Page_size(), page_index[i+pageno_correct].number,
X  #else
X      get_Page_size(), i+pageno_correct,
X  #endif /* PAGENUM */
X--- 131,137 ----
X  #else
X      sprintf(s, "%*d%c",
X  #ifdef PAGENUM
X!     get_Page_size(), page_index[i].number,
X  #else
X      get_Page_size(), i+pageno_correct,
X  #endif /* PAGENUM */
X***************
X*** 151,159 ****
X--- 159,171 ----
X  {
X    XawListReturnStruct *item = (XawListReturnStruct *)call_data;
X    
X+ #ifdef PAGENUM
X+   keystroke('P', item->list_index, 1, (XEvent *)NULL);
X+ #else
X    keystroke('g', item->list_index+pageno_correct, 1, (XEvent *)NULL);
X    
X    Redraw_TOC();
X+ #endif /* PAGENUM */
X  }
X  
X  
X***************
X*** 313,318 ****
X--- 325,333 ----
X  XtNverticalList,True,
X  NULL);
X    XtAddCallback(list_widget, XtNcallback, SelectThisPage, (XtPointer)NULL);
X+ #ifdef PAGENUM
X+   XtAddCallback(viewport, XtNreportCallback, SendReportProc, (XtPointer)NULL);
X+ #endif /* PAGENUM */
X  #ifdef MARKPAGE
X    XtAddEventHandler(list_widget,
X      ButtonPressMask | ButtonReleaseMask | LeaveWindowMask,
X***************
X*** 341,344 ****
X--- 356,403 ----
X    index = (mouse_y - internal_height) / row_height;
X  
X    return index;
X+ }
X+ 
X+ void
X+   Center_TOC(current_page, next_page)
X+ int current_page, next_page;
X+ {
X+   int i;
X+   Position x, y;
X+   Dimension row_space, view_height, font_height;
X+   XFontStruct *font;
X+   Arg arglist[10];
X+ 
X+   i = 0;
X+   XtSetArg(arglist[i], XtNfont, &font); i++;
X+   XtSetArg(arglist[i], XtNrowSpacing, &row_space); i++;
X+   XtGetValues(list_widget, arglist, i);
X+   font_height = (font->max_bounds.ascent + font->max_bounds.descent
X+  + row_space);
X+   y = font_height * next_page;
X+ 
X+   i = 0;
X+   XtSetArg(arglist[i], XtNheight, &view_height); i++;
X+   XtSetArg(arglist[i], XtNx, &x); i++;
X+   XtGetValues(viewport, arglist, i);
X+ 
X+   if (((next_page > current_page)
X+        && (y >= view_y + view_height - font_height + 1))
X+       || ((next_page < current_page)
X+   && (y < view_y))) {
X+     view_height = (int)(view_height / (font_height * 2)) * font_height;
X+     Redraw_TOC();
X+     XawViewportSetCoordinates(viewport, x,  y - view_height);
X+   }
X+ }
X+ 
X+ staticvoid
X+   SendReportProc(widget, closure, call_data)
X+ Widget widget;
X+ XtPointer closure;
X+ XtPointer call_data;
X+ {
X+   XawPannerReport *rep = (XawPannerReport *)call_data;
X+ 
X+   view_y = rep->slider_y;
X  }
diff -cr ./xdvi-17.orig/toc.h ./xdvi-17/toc.h
X*** ./xdvi-17.orig/toc.hTue Nov 16 21:05:43 1993
X--- ./xdvi-17/toc.hWed Nov 17 23:17:59 1993
X***************
X*** 26,28 ****
X--- 26,30 ----
X  
X  extern  void    Create_TOC();
X  extern  void    Redraw_TOC();
X+ extern  void    Center_TOC();
X+ voidSendReportProc();
diff -cr ./xdvi-17.orig/xdvi.c ./xdvi-17/xdvi.c
X*** ./xdvi-17.orig/xdvi.cTue Nov 16 21:05:38 1993
X--- ./xdvi-17/xdvi.cThu Nov 18 05:32:21 1993
X***************
X*** 321,331 ****
X--- 321,333 ----
X  #defineruleGCforeGC
X  #endif/* X10 */
X  
X+ #ifndef PAGENUM
X  #ifdefTOC
X  EXTERNintpageno_correct = 1;
X  #else
X  staticintpageno_correct = 1;
X  #endif/* TOC */
X+ #endif /* not PAGENUM */
X  staticintbak_shrink;
X  
X  #defineclip_wmane.width
X***************
X*** 1739,1756 ****
X  /* scroll backward */
X  next_page = current_page - (arg0 ? number0 : 1);
X  break;
X      case 'g':
X  /* go to absolute page */
X  next_page = (arg0 ? number0 - pageno_correct :
X      total_pages - 1);
X  break;
X!     case 'P':/* declare current page */
X  pageno_correct = arg0 * number0 - current_page;
X  #ifdefTOC
X  if ( ! resource.expert )
X    Redraw_TOC();
X  #endif/* TOC */ 
X  return;
X  #ifdefMARKPAGE
X      case '<':
X  /* go to the first page */
X--- 1741,1787 ----
X  /* scroll backward */
X  next_page = current_page - (arg0 ? number0 : 1);
X  break;
X+ #ifdef PAGENUM
X+     case 'g':
X+ /* go to page */
X+       {
X+   int i, prev_page = next_page;
X+   if (!arg0) {
X+       next_page = total_pages - 1;
X+   } else {
X+       next_page = -1;
X+       for (i = total_pages - 1; i >= 0; i--) {
X+   if (page_index[i].number == number0) {
X+       next_page = i;
X+       break;
X+   }
X+       }
X+       if (next_page == -1) {
X+   next_page = prev_page;
X+       }
X+   }
X+       }
X+ #else
X      case 'g':
X  /* go to absolute page */
X  next_page = (arg0 ? number0 - pageno_correct :
X      total_pages - 1);
X+ #endif /* PAGENUM */
X  break;
X! #ifdef PAGENUM
X!     case 'P':
X! /* go to absolute page */
X! next_page = (arg0 ? number0 : total_pages - 1);
X! break;
X! #else
X!  case 'P':/* declare current page */
X  pageno_correct = arg0 * number0 - current_page;
X  #ifdefTOC
X  if ( ! resource.expert )
X    Redraw_TOC();
X  #endif/* TOC */ 
X  return;
X+ #endif /* not PAGENUM */
X  #ifdefMARKPAGE
X      case '<':
X  /* go to the first page */
X***************
X*** 1764,1770 ****
X--- 1795,1805 ----
X  break;
X      case 'm':
X  /* Mark a page */
X+ #ifdef PAGENUM
X+ mark_page = (arg0 ? number0 : current_page);
X+ #else
X  mark_page = (arg0 ? number0 - pageno_correct : current_page);
X+ #endif /* PAGENUM */
X  if (0 <= mark_page && mark_page < total_pages) {
X    MarkPage(mark_page);
X  #ifdefTOC
X***************
X*** 1778,1784 ****
X--- 1813,1823 ----
X  return;
X      case 'U':
X  /* Delete the mark */
X+ #ifdef PAGENUM
X+ mark_page = (arg0 ? number0 : current_page);
X+ #else
X  mark_page = (arg0 ? number0 - pageno_correct : current_page);
X+ #endif /* PAGENUM */
X  if (0 <= mark_page && mark_page < total_pages) {
X    if (ThisPageIsMarked(mark_page)) {
X      UnmarkPage(mark_page);
X***************
X*** 2099,2104 ****
X--- 2138,2147 ----
X  }
X  if (0 <= next_page && next_page < total_pages) {
X      if (current_page != next_page) {
X+ #ifdefTOC
X+ if ( ! resource.expert )
X+   Center_TOC(current_page, next_page);
X+ #endif/* TOC */
X  current_page = next_page;
X  hush_spec_now = hush_spec;
X  if (!RESOURCE(keep_flag)) home(False);
END_OF_FILE
echo shar: 140 control characters may be missing from \"'xdvi-17.pagenumber-fix.patch'\"
if test 12865 -ne `wc -c <'xdvi-17.pagenumber-fix.patch'`; then
    echo shar: \"'xdvi-17.pagenumber-fix.patch'\" unpacked with wrong size!
fi
# end of 'xdvi-17.pagenumber-fix.patch'
fi
echo shar: End of shell archive.
exit 0

--
USSY / $B$O$i$+$o(B $B$?$/$d(B       | Tokyo Institute of Tech.,
Email: ussy@int.titech.ac.jp | Dept. of Intelligence Science, Japan
       USSY@Pekin etc...     | Hara Lab.(R1-520) ext.2473 in Nagatsuta
