package gv
tags 95266 + confirmed pending patch
thanks
I'm intending to apply the attached patch to the next upload of gv,
which changes showTitle into a triState value: no title, document title
or filename.
Hochachtungsvoll,
Bernhard R. Link
Index: gv-3.6.3dfsg/src/callbacks.c
===================================================================
--- gv-3.6.3dfsg.orig/src/callbacks.c 2007-07-16 23:21:34.000000000 +0200
+++ gv-3.6.3dfsg/src/callbacks.c 2007-07-16 23:21:36.000000000 +0200
@@ -102,13 +102,15 @@
String t=NULL,s;
Arg args[2];
Cardinal n;
+ Pixmap bitmap=None;
BEGINMESSAGE(cb_showTitle)
- if (client_data) {
- app_res.show_title = app_res.show_title ? False : True;
- }
- if (app_res.show_title) {
- if (doc && doc->title) t = doc->title;
+ if (app_res.title_style != 0) {
+ if (app_res.title_style == 1 && doc && doc->title)
+ {
+ t = doc->title;
+ bitmap = app_res.document_bitmap;
+ }
else if (gv_filename)
{
t = gv_filename;
@@ -125,6 +127,14 @@
XtSetArg(args[n], XtNtitle, s); n++;
XtSetArg(args[n], XtNiconName, t); n++;
XtSetValues(toplevel,args,n);
+
+ if (show_title) {
+ n=0;
+ XtSetArg(args[n], XtNlabel, t); n++;
+ XtSetValues(titlebutton, args, n);
+ if (titlemenu) XtDestroyWidget(titlemenu);
+ titlemenu = build_label_menu(titlebutton, "title", t, bitmap);
+ }
GV_XtFree(s);
ENDMESSAGE(cb_showTitle)
}
Index: gv-3.6.3dfsg/src/main_resources.h
===================================================================
--- gv-3.6.3dfsg.orig/src/main_resources.h 2007-07-16 23:21:34.000000000
+0200
+++ gv-3.6.3dfsg/src/main_resources.h 2007-07-16 23:21:36.000000000 +0200
@@ -74,7 +74,8 @@
String style;
String ad;
String misc_menu;
- Boolean show_title;
+ int title_style;
+ Boolean filename_as_title;
Boolean use_bpixmap;
} AppResources;
@@ -140,7 +141,7 @@
DECLARE_STRING(style)
DECLARE_STRING(ad)
DECLARE_STRING(miscMenu)
-DECLARE_STRING(showTitle)
+DECLARE_STRING(titleStyle)
DECLARE_STRING(useBackingPixmap)
/*-------------------------------------------------------------*/
@@ -226,8 +227,8 @@
XtOffsetOf(AppResources, ad), XtRImmediate,(XtPointer)""},
{n_miscMenu, n_miscMenu, XtRString, sizeof(String),
XtOffsetOf(AppResources, misc_menu), XtRImmediate,"update"},
- {n_showTitle, n_showTitle, XtRBoolean, sizeof(Boolean),
- XtOffsetOf(AppResources, show_title), XtRImmediate, (XtPointer)True},
+ {n_titleStyle, n_titleStyle, XtRInt, sizeof(int),
+ XtOffsetOf(AppResources, title_style), XtRImmediate, (XtPointer)1},
{n_useBackingPixmap,n_useBackingPixmap, XtRBoolean, sizeof(Boolean),
XtOffsetOf(AppResources, use_bpixmap), XtRImmediate, (XtPointer)True},
};
Index: gv-3.6.3dfsg/src/misc.c
===================================================================
--- gv-3.6.3dfsg.orig/src/misc.c 2007-07-16 23:21:34.000000000 +0200
+++ gv-3.6.3dfsg/src/misc.c 2007-07-16 23:21:36.000000000 +0200
@@ -146,7 +146,6 @@
static Boolean set_new_scale PT(());
static Boolean set_new_orientation PT((int));
static Boolean set_new_pagemedia PT((int));
-static Widget build_label_menu PT((Widget,String,String,Pixmap));
static void layout_ghostview PT(());
#undef PT
@@ -886,7 +885,7 @@
int toc_length;
char *tocp;
Pixmap bitmap;
- String label,buttonlabel;
+ String label;
BEGINMESSAGE(setup_ghostview)
/* Reset to a known state. */
@@ -933,27 +932,6 @@
}
}
cb_showTitle(NULL,NULL,NULL);
- if (show_title) {
- if (doc && doc->title) {
- buttonlabel = doc->title;
- label = doc->title;
- bitmap = app_res.document_bitmap;
- }
- else if (gv_filename) {
-
- buttonlabel = gv_filename;
- label = gv_filename;
- bitmap = None;
- } else {
- buttonlabel = ""; label = "";
- bitmap = None;
- }
- n=0;
- XtSetArg(args[n], XtNlabel, buttonlabel); n++;
- XtSetValues(titlebutton, args, n);
- if (titlemenu) XtDestroyWidget(titlemenu);
- titlemenu = build_label_menu(titlebutton, "title", label, bitmap);
- }
if (show_date) {
if (doc && doc->date) {
@@ -1595,7 +1573,7 @@
/* build_label_menu */
/*------------------------------------------------------------*/
-static Widget
+Widget
build_label_menu(parent, name, label, bitmap)
Widget parent;
String name, label;
Index: gv-3.6.3dfsg/src/options_setup.c
===================================================================
--- gv-3.6.3dfsg.orig/src/options_setup.c 2007-07-16 23:21:34.000000000
+0200
+++ gv-3.6.3dfsg/src/options_setup.c 2007-07-16 23:21:36.000000000 +0200
@@ -79,10 +79,12 @@
static Widget popup=NULL,optionControl;
static Widget
eyeGuideToggle,reverseScrollingToggle,confirmPrintToggle,autoCenterToggle;
static Widget pixmapToggle,miscLabel;
-static Widget confirmLabel,confirmButton,confirmMenu,showTitleToggle;
+static Widget confirmLabel,confirmButton,confirmMenu;
+static Widget titleLabel,titleButton,titleMenu;
static Widget print_command,scales,screenSize,medias,magmenu,miscmenu;
static String confirm_quit_styles[4] = { "Never","When processing","Always",
NULL };
+static String title_styles[4] = { "No title","Document title","File name",
NULL };
static void options_setup_setOptionsAtEntry();
static void options_setup_create();
@@ -118,7 +120,6 @@
widgets_setToggle(confirmPrintToggle, (app_res.confirm_print ? 1 : 0));
widgets_setToggle(reverseScrollingToggle, (app_res.reverse_scrolling ? 1 :
0));
widgets_setToggle(eyeGuideToggle, (app_res.scrolling_eye_guide ? 1 : 0));
- widgets_setToggle(showTitleToggle, (app_res.show_title ? 1 : 0));
widgets_setToggle(pixmapToggle, (app_res.use_bpixmap ? 1 : 0));
widgets_setToggle(autoCenterToggle, (app_res.auto_center ? 1 : 0));
@@ -148,6 +149,11 @@
XtSetArg(args[n], XtNlabel, s); n++;
XtSetValues(confirmButton, args, n);
+ s=title_styles[app_res.title_style];
+ n=0;
+ XtSetArg(args[n], XtNlabel, s); n++;
+ XtSetValues(titleButton, args, n);
+
ENDMESSAGE(options_setup_setOptionsAtEntry)
}
@@ -179,9 +185,17 @@
cb_useBackingPixmap(NULL,(XtPointer)2,NULL);
if (b != app_res.use_bpixmap) reopen=True;
- b = SwitchIsSet(showTitleToggle) ? True : False;
- if (b != app_res.show_title) {
- cb_showTitle(NULL,(XtPointer)1,NULL);
+ n=0;
+ XtSetArg(args[n], XtNlabel, &l); n++;
+ XtGetValues(titleButton, args, n);
+ i=0;j=0;
+ while (i<3) {
+ if (!strcmp(title_styles[i],l)) j = i;
+ ++i;
+ }
+ if (j != app_res.title_style) {
+ app_res.title_style = j;
+ cb_showTitle(NULL,NULL,NULL);
}
options_textApply(print_command,NULL,&gv_print_command);
@@ -322,14 +336,21 @@
++argn;
options_setArg(&(argi[argn]),&(argv[argn]),s_scrollingEyeGuide ,gv_class
,SwitchIsSet(eyeGuideToggle) ? t : f);
++argn;
- options_setArg(&(argi[argn]),&(argv[argn]),s_showTitle ,gv_class
,SwitchIsSet(showTitleToggle) ? t : f);
- ++argn;
options_setArg(&(argi[argn]),&(argv[argn]),s_autoCenter ,gv_class
,SwitchIsSet(autoCenterToggle) ? t : f);
++argn;
options_setArg(&(argi[argn]),&(argv[argn]),s_useBackingPixmap ,gv_class
,SwitchIsSet(pixmapToggle) ? t : f);
++argn;
n=0;
XtSetArg(args[n], XtNlabel, &l); n++;
+ XtGetValues(titleButton, args, n);
+ i=0; while (i<3) {
+ if (!strcmp(title_styles[i],l)) sprintf(tmp,"%d",i);
+ ++i;
+ }
+ options_setArg(&(argi[argn]),&(argv[argn]),s_titleStyle ,gv_class
,tmp);
+ ++argn;
+ n=0;
+ XtSetArg(args[n], XtNlabel, &l); n++;
XtGetValues(confirmButton, args, n);
i=0; while (i<3) {
if (!strcmp(confirm_quit_styles[i],l)) sprintf(tmp,"%d",i);
@@ -386,9 +407,13 @@
reverseScrollingToggle =
XtCreateManagedWidget("scrolling",switchWidgetClass,optionControl,NULL,(Cardinal)0);
eyeGuideToggle =
XtCreateManagedWidget("eyeGuide",switchWidgetClass,optionControl,NULL,(Cardinal)0);
autoCenterToggle =
XtCreateManagedWidget("autoCenter",switchWidgetClass,optionControl,NULL,(Cardinal)0);
- showTitleToggle =
XtCreateManagedWidget("showTitle",switchWidgetClass,optionControl,NULL,(Cardinal)0);
pixmapToggle =
XtCreateManagedWidget("pixmap",switchWidgetClass,optionControl,NULL,(Cardinal)0);
+
options_createLabeledMenu("title",optionControl,&titleLabel,&titleButton,&titleMenu);
+ for (i = 0; title_styles[i]; i++) {
+ w = XtCreateManagedWidget(title_styles[i],smeBSBObjectClass,
titleMenu,NULL,(Cardinal)0);
+ XtAddCallback(w, XtNcallback,options_cb_changeMenuLabel,NULL);
+ }
options_createLabeledMenu("confirm",optionControl,&confirmLabel,&confirmButton,&confirmMenu);
for (i = 0; confirm_quit_styles[i]; i++) {
w = XtCreateManagedWidget(confirm_quit_styles[i],smeBSBObjectClass,
confirmMenu,NULL,(Cardinal)0);
Index: gv-3.6.3dfsg/src/gv_layout_res.dat
===================================================================
--- gv-3.6.3dfsg.orig/src/gv_layout_res.dat 2007-07-16 23:21:34.000000000
+0200
+++ gv-3.6.3dfsg/src/gv_layout_res.dat 2007-07-16 23:21:36.000000000 +0200
@@ -247,6 +247,10 @@
$sss\
confirmButton<+[1]*>\
$sss\
+ titleLabel<+[1]*>\
+ $sss\
+ titleButton<+[1]*>\
+ $sss\
misc<+[1]*>\
$sss\
scrolling<+[1]*>\
@@ -257,8 +261,6 @@
$sss\
autoCenter<+[1]*>\
$sss\
- showTitle<+[1]*>\
- $sss\
pixmap<+[1]*>\
$sss\
magmenuLabel<+[1]*>\
Index: gv-3.6.3dfsg/src/gv_misc_res.dat
===================================================================
--- gv-3.6.3dfsg.orig/src/gv_misc_res.dat 2007-07-16 23:21:34.000000000
+0200
+++ gv-3.6.3dfsg/src/gv_misc_res.dat 2007-07-16 23:21:36.000000000 +0200
@@ -273,7 +273,7 @@
GV*eof.Label: Ignore EOF comments
GV*antialias.Label: Antialias
GV*watchFile.Label: Watch file
-GV*showTitle.Label: Show Title
+GV*titleLabel.Label: Show Title
GV*pixmap.Label: Backing Pixmap
GV*size.Label: Automatic resizing
GV*watch.Label: Watch File
Index: gv-3.6.3dfsg/src/misc.h
===================================================================
--- gv-3.6.3dfsg.orig/src/misc.h 2007-07-16 23:21:34.000000000 +0200
+++ gv-3.6.3dfsg/src/misc.h 2007-07-16 23:21:36.000000000 +0200
@@ -127,6 +127,8 @@
#endif
);
+Widget build_label_menu(Widget,String,String,Pixmap);
+
#endif /* _GV_MISC_H_ */
Index: gv-3.6.3dfsg/src/gv_user_res.dat
===================================================================
--- gv-3.6.3dfsg.orig/src/gv_user_res.dat 2007-07-16 23:21:34.000000000
+0200
+++ gv-3.6.3dfsg/src/gv_user_res.dat 2007-07-16 23:21:36.000000000 +0200
@@ -22,7 +22,7 @@
GV.confirmQuit: 1
GV.watchFile: False
GV.watchFileFrequency: 1000
-GV.showTitle: True
+GV.titleStyle: 1
GV.miscMenuEntries: redisplay \n\
# update \n\
stop \n\
Index: gv-3.6.3dfsg/ChangeLog
===================================================================
--- gv-3.6.3dfsg.orig/ChangeLog 2007-07-16 23:21:34.000000000 +0200
+++ gv-3.6.3dfsg/ChangeLog 2007-07-16 23:21:36.000000000 +0200
@@ -1,3 +1,14 @@
+2007-07-16 Bernhard R. Link <[EMAIL PROTECTED]>
+
+ * src/main_resources.h: replace showTitle with titleStyle
+ * src/callbacks.c (cb_showTitle): also set the titlebutton,
+ depending on title_style instead of show_title
+ * src/misc.h (build_label_menu): new prototype
+ * src/misc.c (setup_ghostview): move titlebutton setting code to
cb_showTitle
+ * src/options_setup.c: allow setting titleStyle instead of showTitle
+ * src/gv_layout_res.dat: titleStyle instead of showTitle
+ * src/texinfo.tex: document titleStyle
+
2007-06-28 Jose E. Marchesi <[EMAIL PROTECTED]>
* src/ps.c (ps_gettext): Bypass trailing ')' when scanning a
Index: gv-3.6.3dfsg/doc/gv.texi
===================================================================
--- gv-3.6.3dfsg.orig/doc/gv.texi 2007-07-16 23:21:34.000000000 +0200
+++ gv-3.6.3dfsg/doc/gv.texi 2007-07-16 23:21:36.000000000 +0200
@@ -474,12 +474,17 @@
@code{line}
@end itemize
[EMAIL PROTECTED] showTitle
[EMAIL PROTECTED] titleStyle
Whether the name of the displayed document should be shown in the
title bar of the window. The name of gv's icon will also change
accordingly if this resource is set to @code{True}.
-It defaults to @code{True}.
+If this is @code{0}, no title will be shown.
[EMAIL PROTECTED] means to show a the document title or the file name if there
is
+no document title.
+Only the file name is shown with @code{2}.
+
+It defaults to @code{1}.
@item maximumWidth, maximumHeight
When resizing gv will not attempt to exceed the size specified
by these resources.