Commit 023c643a authored by William Bader's avatar William Bader Committed by Bernhard Link

Patches for gv-3.7.3.90 to fix scrolling and bad memory accesses on Fedora 14

parent 8d8c4056
2011-04-01 William Bader <williambader@hotmail.com>
* src/FileSel.c: Fix use of IIMESSAGE with a real argument. Initialize dirp.
* src/Ghostview.c: Give InterpreterFailed() a way to indicate the type of failure.
* src/Scrollbar.c, src/Scrollbar.h: Let XawScrollbarSetThumb pick its arguments as
double or float depending on NeedWidePrototypes. This is required to make the
scroll bar work in Fedora 14.
* src/Vlist.c: Add some IIMESSAGE() lines for debugging. Add a call to ENDMESSAGE()
before an error return to balance the earlier BEGINMESSAGE().
* src/ Vlist.c, src/Vlist.h: Add VlistMaxEntriesVisible(Widget w, int height) to
return the maximum number of entries that can fit in the list.
* src/actions.c: Fix use of IIMESSAGE with a real argument.
* src/doc_misc.c: Loosen the test for media sizes.
* src/gv_misc_res.dat: Add more space around the mag menu. Implement keypad
enter, insert, delete, home, end, prior. Switch buttons for zoom and pan.
* src/gv_user_res.dat: Turn off scrolling eye guide. Add a margin in the geometry.
Add a 10x24 paper size.
* src/magmenu.c: Fix an attempt to increment a NULL pointer.
* src/main.c: Initialize gv_psfile and toc_text.
* src/media.c: Fix an attempt to increment a NULL pointer.
* src/message.h: Write messages to stderr instead of stdout so they aren't buffered.
Add DDMESSAGE1() debug macro for real numbers.
* src/misc.c: Clean up the toc scrolling to avoid leaving empty space when there are
items to fill the space. Fix a possible NULL pointer reference. Fix a possible -1 array
index. Fix an attempt to increment a NULL pointer.
* src/ps.c: Check for %!PS instead of %!PS-Adobe- to recognize old files.
Do not stop parsing comments at a line starting % space. Implement Seascape orientation.
* src/scale.c: Fix an attempt to increment a NULL pointer.
2012-02-29 Markus Steinborn <gnugv_maintainer@yahoo.de>
* configure.ac, src/versionp.h: Bumped version to 3.7.3.90
......
......@@ -1089,7 +1089,7 @@ static void FS_listAction(Widget w, XEvent *event, String *params, Cardinal *npa
relfactor = relfactor >= 0 ? (relfactor<=100 ? relfactor : 100) : 0;
if (*nparams>=3) absfactor = atof((char*)(params[2]));
absfactor = absfactor >= 0 ? (absfactor<=200 ? absfactor : 200) : 0;
IIMESSAGE1(absfactor,relfactor)
DDMESSAGE1(absfactor,relfactor)
if (REVERSE_SCROLLING) { dx = -dx; } else { dy = -dy; }
childx = (int) (childx-(dx*absfactor)-(relfactor*childw*dx)/clipw);
childy = (int) (childy-(dy*absfactor)-(relfactor*childh*dy)/cliph);
......@@ -1352,7 +1352,7 @@ CombineToPath(String path, char *dir, char *file)
static void SetDirectoryView(FileSelectionWidget fs, char *dir)
{
DIR *dirp;
DIR *dirp=NULL;
struct dirent *dp;
String str;
char *temp;
......
......@@ -199,7 +199,7 @@ static void SetBackground(Widget,Bool);
static Boolean Setup(Widget);
static void StartInterpreter(Widget);
static void StopInterpreter(Widget);
static void InterpreterFailed(Widget);
static void InterpreterFailed(Widget,const char *);
static void ChangeCursor(GhostviewWidget,int);
static XtActionsRec actions[] =
......@@ -521,7 +521,7 @@ Input(XtPointer client_data, int *source _GL_UNUSED, XtInputId *id _GL_UNUSED)
}
if (gvw->ghostview.bytes_left > 0 &&
gvw->ghostview.buffer_bytes_left == 0) {
InterpreterFailed(w); /* Error occurred */
InterpreterFailed(w,"bytes left"); /* Error occurred */
}
gvw->ghostview.input_buffer_ptr = gvw->ghostview.input_buffer;
gvw->ghostview.bytes_left -= gvw->ghostview.buffer_bytes_left;
......@@ -543,10 +543,10 @@ Input(XtPointer client_data, int *source _GL_UNUSED, XtInputId *id _GL_UNUSED)
#endif
if (broken_pipe) {
broken_pipe = False;
InterpreterFailed(w); /* Something bad happened */
InterpreterFailed(w,"broken pope"); /* Something bad happened */
} else if (bytes_written == -1) {
if ((errno != EWOULDBLOCK) && (errno != EAGAIN)) {
InterpreterFailed(w); /* Something bad happened */
InterpreterFailed(w,"write to pipe failed"); /* Something bad happened */
}
} else {
gvw->ghostview.buffer_bytes_left -= bytes_written;
......@@ -566,10 +566,10 @@ Input(XtPointer client_data, int *source _GL_UNUSED, XtInputId *id _GL_UNUSED)
b=write(gvw->ghostview.interpreter_input,"\n",1);
if (broken_pipe) {
broken_pipe = False;
InterpreterFailed(w); /* Something bad happened */
InterpreterFailed(w,"broken pipe writing NL"); /* Something bad happened */
} else if (b == -1) {
if ((errno != EWOULDBLOCK) && (errno != EAGAIN)) {
InterpreterFailed(w); /* Something bad happened */
InterpreterFailed(w,"writing NL to pipe failed"); /* Something bad happened */
}
}
}
......@@ -594,10 +594,10 @@ Input(XtPointer client_data, int *source _GL_UNUSED, XtInputId *id _GL_UNUSED)
b = write(gvw->ghostview.interpreter_input, peek_buf, PEEK_SIZE);
if (broken_pipe) {
broken_pipe = False;
InterpreterFailed(w);
InterpreterFailed(w,"broken pipe writing peek buf");
} else if (b == -1) {
if ((errno != EWOULDBLOCK) && (errno != EAGAIN)) {
InterpreterFailed(w); /* Something bad happened */
InterpreterFailed(w,"writing peek buf to pipe failed"); /* Something bad happened */
}
}
}
......@@ -637,7 +637,7 @@ Output(XtPointer client_data, int *source, XtInputId *id _GL_UNUSED)
return;
} else if (bytes == -1) {
INFMESSAGE(something bad happened in interpreter_output)
InterpreterFailed(w); /* Something bad happened */
InterpreterFailed(w,"read stdout from pipe failed"); /* Something bad happened */
ENDMESSAGE(Output)
return;
}
......@@ -652,7 +652,7 @@ Output(XtPointer client_data, int *source, XtInputId *id _GL_UNUSED)
return;
} else if (bytes == -1) {
INFMESSAGE(something bad happened in interpreter_error)
InterpreterFailed(w); /* Something bad happened */
InterpreterFailed(w,"read stderr from pipe failed"); /* Something bad happened */
ENDMESSAGE(Output)
return;
}
......@@ -1649,11 +1649,12 @@ StopInterpreter(Widget w)
/*###################################################################################*/
static void
InterpreterFailed(Widget w)
InterpreterFailed(Widget w, const char *mesg)
{
GhostviewWidget gvw = (GhostviewWidget) w;
BEGINMESSAGE(InterpreterFailed)
StopInterpreter(w);
fprintf(stderr, "Error: %s, errno %d\n", mesg, errno);
XtCallCallbackList(w, gvw->ghostview.message_callback, "Failed");
ENDMESSAGE(InterpreterFailed)
}
......
......@@ -1385,7 +1385,13 @@ static void NotifyThumb(Widget w, XEvent *event, String *params _GL_UNUSED, Card
Set the scroll bar to the given location.
###############################################################################*/
void XawScrollbarSetThumb (Widget w, double top, double shown)
void XawScrollbarSetThumb (Widget w,
#if NeedWidePrototypes
double top, double shown
#else
float top, float shown
#endif
)
{
SCROLLBARWIDGET w;
......
......@@ -132,8 +132,13 @@ _XFUNCPROTOBEGIN
extern void XawScrollbarSetThumb(
Widget /* scrollbar */,
#if NeedWidePrototypes
double /* top */,
double /* shown */
#else
float /* top */,
float /* shown */
#endif
);
_XFUNCPROTOEND
......
......@@ -367,6 +367,7 @@ PaintMark(Widget w, Region region, int entry, int style, Boolean erase)
GC gc;
BEGINMESSAGE(PaintMark)
IIMESSAGE(entry,erase)
if (entry < 0 || entry >= vw->vlist.entries) {
INFMESSAGE(invalid entry)
ENDMESSAGE(PaintMark)
......@@ -870,12 +871,16 @@ void VlistSetFirstVisible(Widget w, int newf)
unsigned int height;
BEGINMESSAGE(VlistSetFirstVisible)
IIMESSAGE(newf,vw->vlist.entries)
if (newf < 0)
newf = 0;
else if (newf >= vw->vlist.entries)
newf = vw->vlist.entries - 1;
if (newf == -1)
if (newf == -1) {
ENDMESSAGE(VlistSetFirstVisible)
return;
}
IIMESSAGE(newf,vw->vlist.firstVisible)
if (newf != vw->vlist.firstVisible) {
vw->vlist.firstVisible = newf;
/* better not allow the widget to grow that large, but that needs fixing
......@@ -883,6 +888,7 @@ void VlistSetFirstVisible(Widget w, int newf)
height = vw->core.height;
if( height >= 0x8000 )
height = 0x3fff;
IIMESSAGE(vw->core.height,height)
XFillRectangle(XtDisplayOfObject(w), XtWindowOfObject(w), vw->vlist.background_GC,
vw->core.x, vw->core.y, vw->core.width, height);
Redisplay(w, NULL, NULL);
......@@ -904,6 +910,7 @@ void VlistMoveFirstVisible(Widget w, int start, int ydiff)
int newf;
BEGINMESSAGE(VlistMoveFirstVisible)
IIMESSAGE(start,ydiff)
ly = vw->vlist.ydelta;
if (debug_p) fprintf(stderr, "move: start=%d ydiff=%d ly=%d\n", start, ydiff, ly);
......@@ -927,13 +934,18 @@ void VlistMoveFirstVisible(Widget w, int start, int ydiff)
float VlistScrollPosition(Widget w)
{
VlistWidget vw = (VlistWidget)w;
float position;
#if 0
printf("Scroll position %d/%d=%f\n",
vw->vlist.firstVisible,(int)(vw->vlist.entries),
vw->vlist.firstVisible/(float)(vw->vlist.entries));
#endif
return vw->vlist.firstVisible/(float)vw->vlist.entries;
position = vw->vlist.firstVisible/(float)vw->vlist.entries;
INFMESSAGE(VlistScrollPosition)
IIMESSAGE(vw->vlist.firstVisible,vw->vlist.entries)
FMESSAGE(position)
return position;
}
float VlistVisibleLength(Widget w, unsigned int height)
......@@ -957,5 +969,22 @@ float VlistVisibleLength(Widget w, unsigned int height)
entriesvisible/(float)(vw->vlist.entries));
#endif
percent = entriesvisible/(float)(vw->vlist.entries);
INFMESSAGE(VlistVisibleLength)
IIMESSAGE(entriesvisible,vw->vlist.entries)
FMESSAGE(percent)
return percent;
}
int VlistMaxEntriesVisible(Widget w, int height)
{
VlistWidget vw = (VlistWidget)w;
int entriesvisible = -1;
if (vw->vlist.ydelta > 0) {
entriesvisible = (height - vw->label.label_y)/vw->vlist.ydelta;
}
INFIMESSAGE(VlistMaxEntriesVisible,entriesvisible)
return entriesvisible;
}
......@@ -83,5 +83,6 @@ extern void VlistSetFirstVisible(Widget, int);
extern void VlistMoveFirstVisible(Widget, int, int);
extern float VlistScrollPosition(Widget);
extern float VlistVisibleLength(Widget, unsigned int);
extern int VlistMaxEntriesVisible (Widget, int);
#endif /* _Vlist_h_ */
......@@ -99,6 +99,7 @@ action_shellConfigureNotify(Widget w, XEvent *event, String *params _GL_UNUSED,
width = new_width;
height=new_height;
}
INFMESSAGE(action_shellConfigureNotify calling XawScrollbarSetThumb)
XawScrollbarSetThumb(newtocScroll,
VlistScrollPosition(newtoc),
VlistVisibleLength(newtoc,newtocClip->core.height));
......@@ -596,7 +597,7 @@ action_movePage(Widget w, XEvent *event, String *params, Cardinal *num_params)
relfactor = relfactor >= 0 ? (relfactor<=100 ? relfactor : 100) : 0;
if (*num_params>=3) absfactor = atof((char*)(params[2]));
absfactor = absfactor >= 0 ? (absfactor<=200 ? absfactor : 200) : 0;
IIMESSAGE1(absfactor,relfactor)
DDMESSAGE1(absfactor,relfactor)
if (app_res.reverse_scrolling) { dx = -dx; dy = -dy; }
xp = (int) (xp-(dx*absfactor)-(relfactor*pw*dx)/pvw);
yp = (int) (yp-(dy*absfactor)-(relfactor*ph*dy)/pvh);
......
......@@ -134,4 +134,13 @@ Miscellaneous defaults
#define GV_FTELL ftell
#endif
#ifndef HAVE_GCC_VERSION
#ifdef __GNUC__
#define HAVE_GCC_VERSION(MAJOR, MINOR) \
(__GNUC__ > (MAJOR) || (__GNUC__ == (MAJOR) && __GNUC_MINOR__ >= (MINOR)))
#else
#define HAVE_GCC_VERSION(MAJOR, MINOR) 0
#endif
#endif
#endif /* _GV_CONFIG_H_ */
......@@ -221,12 +221,14 @@ doc_preferredMediaOfPage(d,pagenumber,llxP,llyP,urxP,uryP)
/* try to map bounding box to standard or document pagemedia */
if (found==-1 && dbb[LLX]==0 && dbb[LLY]==0) {
for (dm=(Media) d->media,i=0; !media && i<d->nummedia; i++,dm++)
if ((dm->width==dbb[URX] && dm->height==dbb[URY]) ||
(dm->width+1==dbb[URX] && dm->height+1==dbb[URY])) media=dm;
if (dm->used &&
((dm->width==dbb[URX] || dm->width+1==dbb[URX]) &&
(dm->height==dbb[URY] || dm->height+1==dbb[URY]))) media=dm;
for (j=0; gv_medias[j] && !media ; j++) {
dm = gv_medias[j];
if (dm->used==1 && ((dm->width==dbb[URX] && dm->height==dbb[URY]) ||
(dm->width+1==dbb[URX] && dm->height+1==dbb[URY]))) media=dm;
if (dm->used==1 &&
((dm->width==dbb[URX] || dm->width+1==dbb[URX]) &&
(dm->height==dbb[URY] || dm->height+1==dbb[URY]))) media=dm;
}
if (media) found=1;
}
......
......@@ -121,9 +121,9 @@ GV*Scrollbar.thumb: None
!##### Menus
GV*magMenu*VertSpace: 2
GV*magMenu*leftMargin: 15
GV*magMenu*rightMargin: 15
GV*magMenu*VertSpace: 15
GV*magMenu*leftMargin: 30
GV*magMenu*rightMargin: 30
GV*magMenu*justify: center
!##### File Selection widget
......@@ -494,6 +494,12 @@ GV.control.baseTranslations:#replace \n\
<Key>KP_Subtract: GV_Page(highlight-1) \n\
<Key>KP_Add: GV_Page(highlight+1) \n\
<Key>KP_Enter: GV_Page(page=highlighted)\n\
<Key>KP_Insert: GV_Page(page-5) \n\
<Key>KP_Delete: GV_Page(page+5) \n\
<Key>KP_Home: GV_Page(page=0) \n\
<Key>KP_End: GV_Page(page=99999) \n\
<Key>KP_Prior: GV_Page(page-1) \n\
<Key>KP_Next: GV_Page(page+1) \n\
\
~c ~s <Key>Return: GV_Page(down,!page+1,top) \n\
<Key>Return: GV_Page(top,!page-1,down) \n\
......@@ -564,42 +570,42 @@ GV*SimpleMenu.baseTranslations:#replace\n\
!##### Ghostview widget
GV*Ghostview.baseTranslations: #replace \n\
~Button2 ~Button3 <Btn1Down>: cursor(scroll) \
~Button1 ~Button3 <Btn2Down>: cursor(scroll) \
GV_MovePage(start) \
GV_EraseLocator() \n\
~Button2 ~Button3 <Btn1Motion>: GV_MovePage(move,1.0,0) \n\
<Btn1Up>: cursor(normal) \
~Button1 ~Button3 <Btn2Motion>: GV_MovePage(move,1.0,0) \n\
<Btn2Up>: cursor(normal) \
GV_MovePage(stop) \
GV_OtherPage() \
notify() \n\
~Button1 ~Button3 s <Btn2Down>: cursor(scroll) \
~Button2 ~Button3 s <Btn1Down>: cursor(scroll) \
GV_MovePage(start) \
GV_EraseLocator() \
GV_MiscMenu(init) \n\
~Button1 ~Button3 s <Btn2Motion>: GV_MovePage(move,0,1.0) \n\
s <Btn2Up>: cursor(normal) \
~Button2 ~Button3 s <Btn1Motion>: GV_MovePage(move,0,1.0) \n\
s <Btn1Up>: cursor(normal) \
GV_MiscMenu(popup) \
notify() \n\
~Button1 ~Button2 s <Btn3Down>: GV_MagMenu(begin) \n\
~Button1 ~Button2 s <Btn3Motion>: GV_MagMenu(extend) \n\
~Button1 ~Button2 s <Btn3Up>: GV_MagMenu(choose) \n\
~Button1 ~Button3 <Btn2Down>: GV_MagMenu(begin) \n\
Button2 <Btn1Down>: GV_MagMenu(reset) \n\
Button2 <Btn3Down>: GV_MagMenu(reset) \n\
~Button1 ~Button3 <Btn2Motion>: GV_MagMenu(extend) \n\
~Button1 ~Button3 <Btn2Up>: GV_MagMenu(choose) \n\
~Button2 ~Button3 <Btn1Down>: GV_MagMenu(begin) \n\
Button1 <Btn2Down>: GV_MagMenu(reset) \n\
Button1 <Btn3Down>: GV_MagMenu(reset) \n\
~Button2 ~Button3 <Btn1Motion>: GV_MagMenu(extend) \n\
~Button2 ~Button3 <Btn1Up>: GV_MagMenu(choose) \n\
~Button1 ~Button2 <Btn3Down>: cursor(scroll) \
GV_MovePage(start) \
GV_EraseLocator() \
GV_MiscMenu(init) \n\
Button3 <Btn1Down>: GV_MiscMenu(reset) \n\
Button3 <Btn2Down>: GV_MiscMenu(reset) \n\
Button3 <Btn1Down>: GV_MiscMenu(reset) \n\
~Button1 ~Button2 <Btn3Motion>: GV_MovePage(move,0,1.0) \n\
<Btn3Up>: cursor(normal) \
GV_MiscMenu(popup) \
notify() \n\
Button1 ~Button3 <Btn2Down>: GV_Page(redisplay) \n\
Button1 ~Button2 <Btn3Down>: GV_Page(redisplay) \n\
Button2 ~Button3 <Btn1Down>: GV_Page(redisplay) \n\
Button2 ~Button1 <Btn3Down>: GV_Page(redisplay) \n\
<Message>: message() \n\
<EnterWindow>: notify() \n\
<LeaveWindow>: GV_EraseLocator() \n\
......
......@@ -13,12 +13,13 @@ GV.respectDSC: True
GV.ignoreEOF: True
GV.confirmPrint: True
GV.reverseScrolling: False
GV.scrollingEyeGuide: True
GV.scrollingEyeGuide: False
GV.autoResize: True
GV.maximumWidth: screen-20
GV.maximumHeight: screen-44
GV.minimumWidth: 400
GV.minimumHeight: 430
GV.geometry: +5+5
GV.confirmQuit: 1
GV.watchFile: False
GV.watchFileFrequency: 1000
......@@ -68,6 +69,7 @@ GV.medias: Letter, 612 792 \n\
# 9x12, 648 864 \n\
# 10x13, 720 936 \n\
10x14, 720 1008 \n\
14x24, 1008 1728 \n\
Executive, 540 720 \n\
# A0, 2384 3370 \n\
# A1, 1684 2384 \n\
......
......@@ -118,6 +118,7 @@ MagMenuEntry *magmenu_parseMagMenuEntries(s)
*entries++ = entry;
}
n--;
if (!nl) break;
c=++nl;
}
if (!have_entry) {
......
......@@ -346,11 +346,13 @@ int main(int argc, char *argv[])
gv_class = GV_CLASS;
gv_pending_page_request=NO_CURRENT_PAGE;
gv_gs_arguments = NULL;
gv_psfile = NULL;
gv_filename = NULL;
gv_filename_unc = NULL;
gv_filename_dsc = NULL;
gv_filename_old = NULL;
gv_filename_raw = NULL;
toc_text = NULL;
infopopup = NULL;
confirmpopup = NULL;
dialogpopup = NULL;
......
......@@ -120,6 +120,7 @@ Media *media_parseMedias(s)
*medias++ = media;
}
n--;
if (!nl) break;
c=++nl;
}
if (!have_media) {
......
......@@ -76,21 +76,21 @@
#define MESSAGE_PRINTF(format,value) { \
char __indent[100]; unsigned short __len;\
MESSAGE_GETINDENT(__indent,__len); \
printf(__indent); \
printf(format,value); \
fprintf(stderr,__indent); \
fprintf(stderr,format,value); \
}
#define MESSAGE2_PRINTF(format,value1,value2) { \
char __indent[100]; unsigned short __len; \
MESSAGE_GETINDENT(__indent,__len); \
printf(__indent); \
printf(format,value1,value2); \
fprintf(stderr,__indent); \
fprintf(stderr,format,value1,value2); \
}
#define BEGIN_MESSAGE(txt) { \
char __indent[100]; unsigned short __len; \
MESSAGE_GETINDENT(__indent,__len) \
printf("%s\273\273\273 %s%s%s <%s>\n", \
fprintf(stderr,"%s\273\273\273 %s%s%s <%s>\n", \
__indent, \
MESSAGE_B_ESC,MESSAGE_STRING(txt),MESSAGE_E_ESC,\
MESSAGE_FILE \
......@@ -103,7 +103,7 @@
char __indent[100]; unsigned short __len; \
MESSAGE_GETINDENT(__indent,__len) \
if (__len>= 4) __indent[__len-4] = '\0'; \
printf("%s\253\253\253 %s%s%s <%s>\n", \
fprintf(stderr,"%s\253\253\253 %s%s%s <%s>\n", \
__indent, \
MESSAGE_B_ESC,MESSAGE_STRING(txt),MESSAGE_E_ESC,\
MESSAGE_FILE \
......@@ -194,6 +194,7 @@
# define SMESSAGE1(st) MESSAGE_PRINTF(#st "=%s\n",st ? st : MESSAGE_NULL_PTR)
# define INFSMESSAGE1(txt,st) MESSAGE_PRINTF(#txt " " #st "=%s\n",st ? st : MESSAGE_NULL_PTR)
# define IIMESSAGE1(it1,it2) MESSAGE2_PRINTF(#it1 "=%d, " #it2 "=%d\n",it1,it2)
# define DDMESSAGE1(dt1,dt2) MESSAGE2_PRINTF(#dt1 "=%f, " #dt2 "=%f\n",dt1,dt2)
# define INFIIMESSAGE1(txt,it1,it2) MESSAGE2_PRINTF(#txt " " #it1 "=%d, " #it2 "=%d\n",it1,it2)
#else
# define BEGINMESSAGE1(txt) BEGIN_MESSAGE(txt)
......@@ -206,6 +207,7 @@
# define SMESSAGE1(st) MESSAGE_PRINTF("st=%s\n",st ? st : MESSAGE_NULL_PTR)
# define INFSMESSAGE1(txt,st) MESSAGE_PRINTF("txt st=%s\n",st ? st : MESSAGE_NULL_PTR)
# define IIMESSAGE1(it1,it2) MESSAGE2_PRINTF("it1=%d, it2=%d\n",it1,it2)
# define DDMESSAGE1(dt1,dt2) MESSAGE2_PRINTF("dt1=%d, dt2=%d\n",dt1,dt2)
# define INFIIMESSAGE1(txt,it1,it2) MESSAGE2_PRINTF("txt it1=%d, it2=%d\n",it1,it2)
#endif
......@@ -221,6 +223,7 @@
# define SMESSAGE1(st)
# define INFSMESSAGE1(txt,st)
# define IIMESSAGE1(it1,it2)
# define DDMESSAGE1(dt1,dt2)
# define INFIIMESSAGE1(txt,it1,it2)
#endif /* MESSAGES1 */
......
......@@ -288,6 +288,7 @@ misc_setPageMarker(int entry, int kind, XEvent *event, Boolean check_toc)
/* kind: 0 = selected, 1 = highlighted , 2 = bring selected in sight*/
{
int firstvisible, lastvisible;
int maxvisible, numentries;
Boolean b = False;
INFMESSAGE(misc_setPageMarker)
if (toc_text && (entry >= 0)) {
......@@ -300,7 +301,18 @@ misc_setPageMarker(int entry, int kind, XEvent *event, Boolean check_toc)
if (entry<0) return;
}
firstvisible = VlistGetFirstVisible(newtoc);
if (firstvisible > entry || (entry > 0 && firstvisible >= entry)) {
maxvisible = VlistMaxEntriesVisible(newtoc, newtocClip->core.height);
numentries = VlistEntries(newtoc);
IIMESSAGE(entry,firstvisible)
IIMESSAGE(maxvisible,numentries)
if (numentries < maxvisible) {
/* check if everything fits */
/* this can happen if the window size is increased */
if (entry != 0) {
VlistSetFirstVisible(newtoc, 0);
b = True;
}
} else if (firstvisible > entry || (entry > 0 && firstvisible >= entry)) {
if (entry > 0)
VlistSetFirstVisible(newtoc, entry - 1);
else
......@@ -310,8 +322,13 @@ misc_setPageMarker(int entry, int kind, XEvent *event, Boolean check_toc)
/* sadly newtoc does not know it's height, so it cannot be told
* to made an item visible and we need to trick: */
lastvisible = VlistEntryOfPosition(newtoc, newtocClip->core.height);
IIMESSAGE(lastvisible,maxvisible)
if (entry > firstvisible && entry >= lastvisible) {
VlistSetFirstVisible(newtoc, entry - (lastvisible - firstvisible - 1));
int firstentry;
firstentry = entry - (lastvisible - firstvisible - 1); /* make the entry second last */
if (firstentry > numentries - maxvisible) firstentry = numentries - maxvisible; /* avoid empty holes at the end */
if (firstentry < 0) firstentry = 0; /* keep in range */
VlistSetFirstVisible(newtoc, firstentry);
b = True;
}
}
......@@ -1041,6 +1058,7 @@ setup_ghostview(void)
}
XtSetValues(newtoc, args, n);
ClipWidgetSetCoordinates(newtocClip,0,0);
INFMESSAGE(setup_ghostview calling XawScrollbarSetThumb)
XawScrollbarSetThumb(newtocScroll,
VlistScrollPosition(newtoc),
VlistVisibleLength(newtoc,newtocClip->core.height));
......@@ -1197,6 +1215,8 @@ set_new_scale(void)
}
default_xdpi *= ascale;
default_ydpi *= ascale;
INFIMESSAGE(old scale base,gv_scale_base_current);
INFIMESSAGE(new scale base,new_scale_base);
XtSetArg(args[0], XtNleftBitmap, None);
if (gv_scale_base_current >=0) XtSetValues(scaleEntry[gv_scale_base_current],args, ONE);
XtSetArg(args[0], XtNleftBitmap, app_res.selected_bitmap);
......@@ -1319,6 +1339,7 @@ set_newBitmapIfChanged(Widget w, Pixmap new_bitmap)
Pixmap old_bitmap;
BEGINMESSAGE(set_newBitmapIfChanged)
if (!w) return; /* continuing will eventually cause a core dump */
XtSetArg(args[0], XtNleftBitmap, &old_bitmap);
XtGetValues(w, args, ONE);
if (new_bitmap != old_bitmap) {
......@@ -1423,6 +1444,7 @@ set_pagemediaButton_label(int media_id)
if (media_id>=0) {
Widget w;
if (pagemediaEntry[media_id]) w = pagemediaEntry[media_id];
else if (media_id <= 0) w = NULL;
else w = pagemediaEntry[media_id-1];
if (!w)
goto out;
......
......@@ -135,6 +135,7 @@ MiscMenuEntry *miscmenu_parseMiscMenuEntries(s)
}
}
n--;
if (!nl) break;
c=++nl;
}
if (!have_entry) {
......
......@@ -34,10 +34,17 @@
#define _PATHS_H_
#include "config.h"
#if HAVE_GCC_VERSION(2,95)
#define INC_X11(aaa) <X11/aaa>
#define INC_XMU(aaa) <X11/Xmu/aaa>
#define INC_XAW(aaa) <X11/Xaw3d/aaa>
#define INC_EXT(aaa) <X11/extensions/aaa>
#else
#define INC_X11(aaa) <X11/##aaa##>
#define INC_XMU(aaa) <X11/Xmu/##aaa##>
#define INC_XAW(aaa) <X11/Xaw3d/##aaa##>
#define INC_EXT(aaa) <X11/extensions/##aaa##>
#endif
#endif /* _PATHS_H_ */
......@@ -524,7 +524,7 @@ unc_ok:
/* Header comments */
if (line_len>1 && (iscomment(line,"%!PS-Adobe-") || iscomment(line + 1,"%!PS-Adobe-"))) {
if (line_len>1 && (iscomment(line,"%!PS") || iscomment(line + 1,"%!PS"))) {
INFMESSAGE(found "PS-Adobe-" comment)
doc = (struct document *) calloc(1, sizeof(struct document));
......@@ -698,7 +698,8 @@ scan_ok:
preread = 0;
if (line[0] != '%' ||
iscomment(line+1, "%EndComments") ||
line[1] == ' ' || line[1] == '\t' || line[1] == '\n' ||
/* line[1] == ' ' || */ /* 10Jun09 wb allow comments starting percent + space */
line[1] == '\t' || line[1] == '\n' ||
!isprint(line[1])) {
break;
} else if (line[1] != '%') {
......@@ -725,6 +726,9 @@ scan_ok:
} else if (isword(p, "Landscape")) {
doc->orientation = LANDSCAPE;
orientation_set = 1;
} else if (isword(p, "Seascape")) {
doc->orientation = SEASCAPE;
orientation_set = 1;
}
} else if (page_order_set == NONE && iscomment(line+2, "PageOrder:")) {
p = firstword(line + length("%%PageOrder:"));
......@@ -908,7 +912,7 @@ scan_ok:
}
}
section_len += line_len;
if (doc->nummedia != 0) doc->default_page_media = doc->media;
if (doc->nummedia > 0) doc->default_page_media = doc->media;
}
}
......@@ -966,6 +970,8 @@ scan_ok:
doc->default_page_orientation = PORTRAIT;
} else if (isword(p, "Landscape")) {
doc->default_page_orientation = LANDSCAPE;
} else if (isword(p, "Seascape")) {
doc->default_page_orientation = SEASCAPE;
}
} else if (page_media_set == NONE &&
iscomment(line+2, "PageMedia:")) {
......@@ -1066,6 +1072,8 @@ scan_ok:
doc->default_page_orientation = PORTRAIT;
} else if (isword(p, "Landscape")) {
doc->default_page_orientation = LANDSCAPE;
} else if (isword(p, "Seascape")) {
doc->default_page_orientation = SEASCAPE;
}
} else if (page_media_set == NONE &&
iscomment(line+2, "PaperSize:")) {
......@@ -1182,6 +1190,8 @@ continuepage:
doc->pages[doc->numpages].orientation = PORTRAIT;
} else if (isword(p, "Landscape")) {
doc->pages[doc->numpages].orientation = LANDSCAPE;
} else if (isword(p, "Seascape")) {
doc->pages[doc->numpages].orientation = SEASCAPE;
}
} else if (doc->pages[doc->numpages].media == NULL &&
iscomment(line+2, "PageMedia:")) {
......@@ -1280,6 +1290,8 @@ continuepage:
doc->orientation = PORTRAIT;
} else if (isword(p, "Landscape")) {
doc->orientation = LANDSCAPE;
} else if (isword(p, "Seascape")) {
doc->orientation = SEASCAPE;
}
} else if (page_order_set == ATEND && iscomment(line+2, "PageOrder:")) {
p = firstword(line + length("%%PageOrder:"));
......
......@@ -126,6 +126,7 @@ Scale *scale_parseScales(s)
*scales++ = scale;
}
n--;
if (!nl) break;
c=++nl;
}
if (!have_center) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment