summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2004-08-16 16:36:26 +0000
committerKristian Høgsberg <krh@redhat.com>2004-08-16 16:36:26 +0000
commit50a3e1e4269fe2ef6c97ff40a6dc02d074e7ba95 (patch)
treedeba100f815168d0228073836112e61ffc3cb6ca
parent6b0d9917116797e38b554397b815c555bf55a721 (diff)
As discussed and agreed on on the release-wranglers meeting of August 16,XORG-6_7_99_903XORG-6_7_99_902XORG-6_7_99_901
I'm committing the patch from bug #1060 to back out unconditional Xprint functionality. Back out Xprint changes. Revert xman to CVS of June 5, revert xlogo to CVS of May 8, revert xedit to CVS of April 25, to back out unconditional Xprint support. Fix up Xprint config logic to be like the rest of the extensions: BuildXprint is a one-stop option for disabling everything Xprint related. XprtServer controls building Xprt, BuildXprintLib controls building Xprint libs and BuildXprintClients controls building clients related to Xprint. BuiltXprint defaults to YES and the other options respects relevant settings, i.e. BuildServer and BuildServersOnly. Build Xaw regardless of BuildXprintLib setting. Only build xphelloworld, xplsprinters and xprehashprinterlist when BuildXprintClients it YES. Disable building xmore, it has always supported XawPrintShell. Make Xprint support depend on BuildXprintLib.
-rw-r--r--ScrollByL.c33
-rw-r--r--ScrollByL.h4
-rw-r--r--ScrollByLP.h4
-rw-r--r--buttons.c15
-rw-r--r--defs.h3
-rw-r--r--handler.c114
-rw-r--r--man.h26
-rw-r--r--misc.c9
-rw-r--r--search.c2
9 files changed, 33 insertions, 177 deletions
diff --git a/ScrollByL.c b/ScrollByL.c
index c679145..9f8c359 100644
--- a/ScrollByL.c
+++ b/ScrollByL.c
@@ -93,10 +93,6 @@ static XtResource resources[] = {
Offset(symbol_font), XtRString, MANPAGE_SYMBOL},
{XtNfile, XtCFile, XtRFile, sizeof(FILE *),
Offset(file), XtRImmediate, (caddr_t) NULL},
- {XtNNumTotalLines, XtCNumTotalLines, XtRInt, sizeof(int),
- Offset(lines), XtRImmediate, (caddr_t) 0},
- {XtNNumVisibleLines, XtCNumVisibleLines, XtRInt, sizeof(int),
- Offset(num_visible_lines), XtRImmediate, (caddr_t) 0},
};
#undef Offset
@@ -108,7 +104,6 @@ static XtResource resources[] = {
*
****************************************************************/
-static void CreateScrollbar(Widget w);
static Boolean ScrollVerticalText(Widget w, int new_line, Boolean force_redisp);
static void Layout(Widget w);
static void LoadFile(Widget w);
@@ -202,8 +197,6 @@ Layout(Widget w)
Widget bar;
Position bar_bw;
- CreateScrollbar(w);
-
/*
* For now always show the bar.
*/
@@ -229,8 +222,6 @@ Layout(Widget w)
XtResizeWidget(bar, bar->core.width, height, bar->core.border_width);
SetThumbHeight(w);
-
- sblw->scroll.num_visible_lines = height / sblw->scroll.font_height + 1;
}
/* ARGSUSED */
@@ -286,20 +277,22 @@ static void
PaintText(Widget w, int y_loc, int height)
{
ScrollByLineWidget sblw = (ScrollByLineWidget) w;
- int start_line, location;
+ int start_line, num_lines, location;
start_line = y_loc / sblw->scroll.font_height + sblw->scroll.line_pointer;
if (start_line >= sblw->scroll.lines)
return;
+ num_lines = height / sblw->scroll.font_height + 1;
+
/*
* Only integer arithmetic makes this possible.
*/
location = y_loc / sblw->scroll.font_height * sblw->scroll.font_height;
- PrintText(w, start_line, sblw->scroll.num_visible_lines, location);
+ PrintText(w, start_line, num_lines, location);
}
/* Function Name: Page
@@ -391,7 +384,7 @@ int new_line,
Boolean force_redisp)
{
ScrollByLineWidget sblw = (ScrollByLineWidget) w;
- int num_lines = sblw->scroll.num_visible_lines;
+ int num_lines = (int)w->core.height / sblw->scroll.font_height + 1;
int max_lines, old_line;
Boolean move_thumb = FALSE;
@@ -605,6 +598,8 @@ VerticalScroll(Widget w, XtPointer client_data, XtPointer call_data)
SetThumb( (Widget) sblw);
}
+int h_width; /* main font width */
+
/* ARGSUSED */
static void
Initialize(Widget req, Widget new, ArgList args, Cardinal *num_args)
@@ -624,9 +619,12 @@ Initialize(Widget req, Widget new, ArgList args, Cardinal *num_args)
atomNum = XInternAtom(XtDisplay(req), "FIGURE_WIDTH", False);
if (XGetFontProperty(sblw->scroll.normal_font, atomNum, &figWidth))
- sblw->scroll.h_width = figWidth;
+ h_width = figWidth;
else
- sblw->scroll.h_width = XTextWidth(sblw->scroll.normal_font, "$", 1);
+ h_width = XTextWidth(sblw->scroll.normal_font, "$", 1);
+
+
+
} /* Initialize. */
/* Function Name: CreateGCs
@@ -723,7 +721,7 @@ static Boolean
SetValuesHook(Widget w, ArgList args, Cardinal *num_args)
{
Boolean ret = TRUE;
- Cardinal i;
+ int i;
for (i = 0; i < *num_args; i++) {
if (strcmp(XtNfile, args[i].name) == 0) {
@@ -821,7 +819,6 @@ LoadFile(Widget w)
* Copy the file into memory.
*/
- fseek(file, 0L, SEEK_SET);
if (fread(page, sizeof(char), fileinfo.st_size, file) == 0)
XtAppError(XtWidgetToApplicationContext(w),
"SBLW LoadFile: Failure in fread.");
@@ -1024,7 +1021,7 @@ PrintText(Widget w, int start_line, int num_lines, int location)
italicflag = FALSE;
x_loc = sblw->scroll.offset + sblw->scroll.indent;
h_col = h_col + 8 - (h_col%8);
- x_loc += sblw->scroll.h_width * h_col;
+ x_loc += h_width * h_col;
break;
case ' ':
@@ -1045,7 +1042,7 @@ PrintText(Widget w, int start_line, int num_lines, int location)
x_loc = sblw->scroll.offset + sblw->scroll.indent;
h_col += (h_c - c);
- x_loc += sblw->scroll.h_width * h_col;
+ x_loc += h_width * h_col;
c = h_c - 1;
break;
diff --git a/ScrollByL.h b/ScrollByL.h
index 0283893..cdf8e2e 100644
--- a/ScrollByL.h
+++ b/ScrollByL.h
@@ -60,12 +60,8 @@ from the X Consortium.
#define XtNmanualFontBold "manualFontBold"
#define XtNmanualFontItalic "manualFontItalic"
#define XtNmanualFontSymbol "manualFontSymbol"
-#define XtNNumTotalLines "numTotalLines"
-#define XtNNumVisibleLines "numVisibleLines"
#define XtCIndent "Indent"
-#define XtCNumTotalLines "NumTotalLines"
-#define XtCNumVisibleLines "NumVisibleLines"
/* Class record constants */
diff --git a/ScrollByLP.h b/ScrollByLP.h
index 25402d7..0947707 100644
--- a/ScrollByLP.h
+++ b/ScrollByLP.h
@@ -68,7 +68,6 @@ typedef struct _ScrollByLinePart {
* normal_font,
* italic_font,
* symbol_font;
- int h_width; /* Main font width */
/* variables not in resource list. */
@@ -81,8 +80,7 @@ typedef struct _ScrollByLinePart {
GC bold_gc, normal_gc, italic_gc, symbol_gc; /* gc for drawing. */
char ** top_line; /* The top line of the file. */
- int lines; /* Total number of line in the file. */
- int num_visible_lines; /* Number of lines visible */
+ int lines; /* number of line in the file. */
} ScrollByLinePart;
/****************************************************************
diff --git a/buttons.c b/buttons.c
index ca0d514..d30d52f 100644
--- a/buttons.c
+++ b/buttons.c
@@ -121,7 +121,13 @@ MakeTopBox(void)
/* add WM_COMMAND property */
XSetCommand(XtDisplay(top), XtWindow(top), saved_argv, saved_argc);
- man_globals = (ManpageGlobals*) XtCalloc(ONE, (Cardinal) sizeof(ManpageGlobals));
+ man_globals = (ManpageGlobals*) XtMalloc( (Cardinal) sizeof(ManpageGlobals));
+ man_globals->label = NULL;
+ man_globals->search_widget = NULL;
+ man_globals->manpagewidgets.directory = NULL;
+ man_globals->manpagewidgets.manpage = NULL;
+ man_globals->manpagewidgets.box = NULL;
+ man_globals->current_directory = 0;
MakeSearchWidget(man_globals, top);
MakeSaveWidgets(man_globals, top);
@@ -429,7 +435,6 @@ CreateOptionMenu(ManpageGlobals * man_globals, Widget parent)
BOTH_SCREENS,
REMOVE_MANPAGE,
OPEN_MANPAGE,
- PRINT_MANPAGE,
SHOW_VERSION,
QUIT
};
@@ -465,16 +470,12 @@ CreateOptionMenu(ManpageGlobals * man_globals, Widget parent)
man_globals->open_entry = entry;
break;
case 7:
- man_globals->print_entry = entry;
- break;
- case 8:
man_globals->version_entry = entry;
break;
- case 9:
+ case 8:
man_globals->quit_entry = entry;
break;
default:
- Error(("CreateOptionMenu: Unknown id=%d\n", i));
break;
}
}
diff --git a/defs.h b/defs.h
index 812c3c8..3077f79 100644
--- a/defs.h
+++ b/defs.h
@@ -67,7 +67,7 @@ from the X Consortium.
/* Names of the menu buttons */
-#define NUM_OPTIONS 10 /* Number of menu options. */
+#define NUM_OPTIONS 9 /* Number of menu options. */
#define DIRECTORY "displayDirectory"
#define MANPAGE "displayManualPage"
@@ -76,7 +76,6 @@ from the X Consortium.
#define BOTH_SCREENS "showBothScreens"
#define REMOVE_MANPAGE "removeThisManpage"
#define OPEN_MANPAGE "openNewManpage"
-#define PRINT_MANPAGE "printManualPage"
#define SHOW_VERSION "showVersion"
#define QUIT "quit"
diff --git a/handler.c b/handler.c
index 83b8f3f..8a8f4f9 100644
--- a/handler.c
+++ b/handler.c
@@ -40,8 +40,6 @@ from the X Consortium.
#include <sys/stat.h>
#include "globals.h"
#include "vendor.h"
-#include "printdialog.h"
-#include "print.h"
static void PutUpManpage(ManpageGlobals * man_globals, FILE * file);
static void ToggleBothShownState(ManpageGlobals * man_globals);
@@ -81,8 +79,6 @@ OptionCallback(Widget w, XtPointer pointer, XtPointer junk)
RemoveThisManpage(XtParent(w), NULL, NULL, NULL);
else if ( w == man_globals->open_entry) /* Open new manpage */
CreateNewManpage(XtParent(w), NULL, NULL, NULL);
- else if ( w == man_globals->print_entry) /* Print current manpage */
- PrintThisManpage(man_globals);
else if ( w == man_globals->version_entry) /* Get version */
ShowVersion(XtParent(w), NULL, NULL, NULL);
else if ( w == man_globals->quit_entry) /* Quit. */
@@ -219,9 +215,7 @@ DirectoryHandler(Widget w, XtPointer global_pointer, XtPointer ret_val)
file = FindManualFile(man_globals, man_globals->current_directory,
ret_struct->list_index);
PutUpManpage(man_globals, file);
- if ((file != NULL) && (file != man_globals->curr_file)) {
- fclose(file);
- }
+ fclose(file);
}
/* Function Name: DirPopupCallback
@@ -595,112 +589,10 @@ Search(Widget w, XEvent * event, String * params, Cardinal * num_params)
else {
PutUpManpage(man_globals, file);
}
- if ((file != NULL) && (file != man_globals->curr_file)) {
- fclose(file);
- }
-}
-
-static void
-printshellDestroyXtProc(Widget w, XtPointer client_data, XtPointer callData)
-{
- ManpageGlobals *mg = GetGlobals(w);
- XawPrintDialogClosePrinterConnection(mg->printdialog, False);
-}
-
-static void
-printOKXtProc(Widget w, XtPointer client_data, XtPointer callData)
-{
- XawPrintDialogCallbackStruct *pdcs = (XawPrintDialogCallbackStruct *)callData;
- Cardinal n;
- Arg args[2];
- ManpageGlobals *mg = GetGlobals(w);
- Widget topwindow = mg->This_Manpage;
- FILE *file;
-
- Log(("printOKXtProc: OK.\n"));
-
- /* Get file object */
- n = 0;
- XtSetArg(args[n], XtNfile, &file); n++;
- XtGetValues(mg->manpagewidgets.manpage, args, n);
- Assertion(file != NULL, (("printOKXtProc: file == NULL.\n")));
-
- DoPrintManpage("Xman",
- file, topwindow,
- pdcs->pdpy, pdcs->pcontext, printshellDestroyXtProc,
- mg->manpage_title,
- pdcs->printToFile?pdcs->printToFileName:NULL);
-
- XtPopdown(mg->printdialog_shell);
+ if (file != NULL)
+ fclose(file);
}
-static void
-printCancelXtProc(Widget w, XtPointer client_data, XtPointer callData)
-{
- ManpageGlobals * mg = GetGlobals(w);
-
- Log(("printCancelXtProc: cancel.\n"));
- XtPopdown(mg->printdialog_shell);
-
- Log(("destroying print dialog shell...\n"));
- XtDestroyWidget(mg->printdialog_shell);
- mg->printdialog_shell = NULL;
- mg->printdialog = NULL;
- Log(("... done\n"));
-}
-
-/* Function Name: PrintThisManpage
- * Description: Print the current manual page.
- * Arguments: mg - manpage globals
- * Returns: none.
- */
-
-/*ARGSUSED*/
-void
-PrintThisManpage(ManpageGlobals *mg)
-{
- Dimension width, height;
- Position x, y;
- Widget parent = mg->This_Manpage;
- Widget topwindow = mg->This_Manpage;
- Log(("print!\n"));
-
- if (!mg->printdialog) {
- int n;
- Arg args[20];
-
- n = 0;
- XtSetArg(args[n], XtNallowShellResize, True); n++;
- mg->printdialog_shell = XtCreatePopupShell("printdialogshell",
- transientShellWidgetClass,
- topwindow, args, n);
- n = 0;
- mg->printdialog = XtCreateManagedWidget("printdialog", printDialogWidgetClass,
- mg->printdialog_shell, args, n);
- XtAddCallback(mg->printdialog, XawNOkCallback, printOKXtProc, NULL);
- XtAddCallback(mg->printdialog, XawNCancelCallback, printCancelXtProc, NULL);
-
- XtRealizeWidget(mg->printdialog_shell);
- }
-
- /* Center dialog */
- XtVaGetValues(mg->printdialog_shell,
- XtNwidth, &width,
- XtNheight, &height,
- NULL);
-
- x = (Position)(XWidthOfScreen( XtScreen(parent)) - width) / 2;
- y = (Position)(XHeightOfScreen(XtScreen(parent)) - height) / 3;
-
- XtVaSetValues(mg->printdialog_shell,
- XtNx, x,
- XtNy, y,
- NULL);
-
- XtPopup(mg->printdialog_shell, XtGrabNonexclusive);
-}
-
-
/* Function Name: ShowVersion
* Description: Show current version.
* Arguments: w - any widget in the manpage.
diff --git a/man.h b/man.h
index 0188409..ea8054a 100644
--- a/man.h
+++ b/man.h
@@ -1,5 +1,5 @@
/* $XConsortium: man.h,v 1.31 94/12/16 21:36:53 gildea Exp $ */
-/* $XdotOrg: xc/programs/xman/man.h,v 1.5 2004/07/01 13:54:46 alanh Exp $ */
+/* $XdotOrg: xc/programs/xman/man.h,v 1.3 2004/05/22 19:20:06 alanc Exp $ */
/*
Copyright (c) 1987, 1988 X Consortium
@@ -43,7 +43,6 @@ from the X Consortium.
/* Std system and C header files */
#include <stdio.h>
-#include <limits.h>
#include <X11/Xfuncs.h>
#include <X11/Xos.h>
@@ -73,17 +72,6 @@ from the X Consortium.
#include "version.h"
#include "defs.h"
-/* Turn a NULL pointer string into an empty string */
-#define NULLSTR(x) (((x)!=NULL)?(x):(""))
-
-#define Error(x) { printf x ; exit(EXIT_FAILURE); }
-#define Assertion(expr, msg) { if (!(expr)) { Error msg } }
-#ifdef DEBUG
-# define Log(x) { if(True) printf x; }
-#else
-# define Log(x) { if(False) printf x; }
-#endif /* DEBUG */
-
/*
* Assigning values here allows the user of Bitwise Or.
*/
@@ -149,13 +137,7 @@ typedef struct _ManpageGlobals{
Widget dir_entry, manpage_entry, help_entry,
search_entry, both_screens_entry, remove_entry, open_entry,
- print_entry, version_entry, quit_entry;
-
- /* Print objects and data */
- Widget printdialog_shell; /* Shell for the print dialog */
- Widget printdialog; /* Print dialog */
-
- /* Misc. */
+ version_entry, quit_entry;
char manpage_title[80]; /* The label to use for the current manpage. */
@@ -175,7 +157,6 @@ typedef struct _ManpageGlobals{
Widget This_Manpage; /* a pointer to the root of
this manpage. */
- FILE *curr_file; /* Current file shown in manpage widget */
} ManpageGlobals;
@@ -240,7 +221,6 @@ void Quit(Widget w, XEvent * event, String * params, Cardinal * num_params);
void RemoveThisManpage(Widget w, XEvent * event, String * params, Cardinal * num_params);
void SaveFormattedPage(Widget w, XEvent * event, String * params, Cardinal * num_params);
void Search(Widget w, XEvent * event, String * params, Cardinal * num_params);
-void PrintThisManpage(ManpageGlobals *mg);
void ShowVersion(Widget w, XEvent * event, String * params, Cardinal * num_params);
/* help.c */
@@ -253,6 +233,7 @@ Bool ReadManConfig(char manpath[]);
int Man(void);
/* misc.c */
+FILE * DoSearch(ManpageGlobals * man_globals, int type);
FILE * FindManualFile(ManpageGlobals * man_globals, int section_num, int entry_num);
ManpageGlobals * GetGlobals(Widget w);
void AddCursor(Widget w, Cursor cursor);
@@ -267,7 +248,6 @@ void ParseEntry(char *entry, char *path, char *sect, char *page);
FILE * Format(ManpageGlobals * man_globals, char * entry);
/* search */
-FILE * DoSearch(ManpageGlobals * man_globals, int type);
void MakeSearchWidget(ManpageGlobals * man_globals, Widget parent);
/* tkfunctions.c */
diff --git a/misc.c b/misc.c
index 77aafea..105da90 100644
--- a/misc.c
+++ b/misc.c
@@ -153,15 +153,8 @@ OpenFile(ManpageGlobals * man_globals, FILE * file)
{
Arg arglist[1];
Cardinal num_args = 0;
-
- if (man_globals->curr_file) {
-#if 0 /* Ownership rules need to be fixed first */
- fclose(man_globals->curr_file);
-#endif
- }
- man_globals->curr_file = file;
- XtSetArg(arglist[num_args], XtNfile, man_globals->curr_file); num_args++;
+ XtSetArg(arglist[num_args], XtNfile, file); num_args++;
XtSetValues(man_globals->manpagewidgets.manpage, arglist, num_args);
}
diff --git a/search.c b/search.c
index 542d2de..48d048a 100644
--- a/search.c
+++ b/search.c
@@ -265,7 +265,7 @@ DoSearch(ManpageGlobals * man_globals, int type)
strcpy(man_globals->manpage_title,label);
ChangeLabel(man_globals->label,label);
- fseek(file, 0L, SEEK_SET); /* reset file to point at top. */
+ fseek(file, 0L, 0); /* reset file to point at top. */
}
else { /* MANUAL SEACH */
file = DoManualSearch(man_globals, search_string);