summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--commands.c124
-rw-r--r--hook.c4
-rw-r--r--ispell.c20
-rw-r--r--lisp/lisp.c3
-rw-r--r--xedit.c24
-rw-r--r--xedit.h3
6 files changed, 35 insertions, 143 deletions
diff --git a/commands.c b/commands.c
index 7fd5990..f3d889e 100644
--- a/commands.c
+++ b/commands.c
@@ -29,14 +29,10 @@
#include <X11/Xfuncs.h>
#include <X11/Xos.h>
#include "xedit.h"
-#include "printdialog.h"
-#include "print.h"
#ifdef CRAY
#include <unistd.h>
#endif
#include <stdlib.h>
-#include <stdio.h>
-#include <limits.h>
#include <string.h>
#include <dirent.h>
#include <pwd.h>
@@ -45,17 +41,6 @@
#include <X11/IntrinsicP.h>
#include <X11/Xaw/TextSrcP.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 } }
-#define Log(x) { if (True) printf x; }
-
-static Widget printdialog_shell = NULL;
-static Widget printdialog = NULL;
-static char printJobNameBuffer[PATH_MAX+256];
-
void ResetSourceChanged(xedit_flist_item*);
static void ResetDC(Widget, XtPointer, XtPointer);
@@ -353,8 +338,8 @@ DoSave(Widget w, XtPointer client_data, XtPointer call_data)
XtRemoveCallback(scratch, XtNcallback, SourceChanged,
(XtPointer)item);
item->source = scratch =
- XtVaCreateWidget("textSource",
- multiSrcObjectClass,
+ XtVaCreateWidget("textSource", international ?
+ multiSrcObjectClass : asciiSrcObjectClass,
topwindow,
XtNtype, XawAsciiFile,
XtNeditType, XawtextEdit,
@@ -491,8 +476,8 @@ ReallyDoLoad(char *name, char *filename)
XtSetArg(args[num_args], XtNstring, NULL); num_args++;
}
- source = XtVaCreateWidget("textSource",
- multiSrcObjectClass,
+ source = XtVaCreateWidget("textSource", international ?
+ multiSrcObjectClass : asciiSrcObjectClass,
topwindow,
XtNtype, XawAsciiFile,
XtNeditType, XawtextEdit,
@@ -515,107 +500,6 @@ ReallyDoLoad(char *name, char *filename)
return (True);
}
-static void
-printshellDestroyXtProc(Widget w, XtPointer client_data, XtPointer callData)
-{
- XawPrintDialogClosePrinterConnection(printdialog, False);
-}
-
-static void
-printOKXtProc(Widget w, XtPointer client_data, XtPointer callData)
-{
- XawPrintDialogCallbackStruct *pdcs = (XawPrintDialogCallbackStruct *)callData;
- Cardinal n;
- Arg args[2];
- Widget textsource;
-
- Log(("printOKXtProc: OK.\n"));
-
- /* Get TextSource object */
- n = 0;
- XtSetArg(args[n], XtNtextSource, &textsource); n++;
- XtGetValues(textwindow, args, n);
-
- Assertion(textsource != NULL, (("printOKXtProc: textsource == NULL.\n")));
-
- /* ||printJobNameBuffer| must live as long the print job prints
- * because it is used for the job title AND the page headers... */
- sprintf(printJobNameBuffer, "Xedit print job");
-
- DoPrintTextSource("Xedit",
- textsource, topwindow,
- pdcs->pdpy, pdcs->pcontext, printshellDestroyXtProc,
- printJobNameBuffer,
- pdcs->printToFile?pdcs->printToFileName:NULL);
-
- XtPopdown(printdialog_shell);
-}
-
-static void
-printCancelXtProc(Widget w, XtPointer client_data, XtPointer callData)
-{
- Log(("printCancelXtProc: cancel.\n"));
- XtPopdown(printdialog_shell);
-
- Log(("destroying print dialog shell...\n"));
- XtDestroyWidget(printdialog_shell);
- printdialog_shell = NULL;
- printdialog = NULL;
- Log(("... done\n"));
-}
-
-
-/*ARGSUSED*/
-void
-PrintFile(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- DoPrint(w, NULL, NULL);
-}
-
-/*ARGSUSED*/
-void
-DoPrint(Widget w, XtPointer client_data, XtPointer call_data)
-{
- Dimension width, height;
- Position x, y;
- Widget parent = topwindow;
- Log(("print!\n"));
-
- if (!printdialog) {
- int n;
- Arg args[20];
-
- n = 0;
- XtSetArg(args[n], XtNallowShellResize, True); n++;
- printdialog_shell = XtCreatePopupShell("printdialogshell",
- transientShellWidgetClass,
- topwindow, args, n);
- n = 0;
- printdialog = XtCreateManagedWidget("printdialog", printDialogWidgetClass,
- printdialog_shell, args, n);
- XtAddCallback(printdialog, XawNOkCallback, printOKXtProc, NULL);
- XtAddCallback(printdialog, XawNCancelCallback, printCancelXtProc, NULL);
-
- XtRealizeWidget(printdialog_shell);
- }
-
- /* Center dialog */
- XtVaGetValues(printdialog_shell,
- XtNwidth, &width,
- XtNheight, &height,
- NULL);
-
- x = (Position)(XWidthOfScreen( XtScreen(parent)) - width) / 2;
- y = (Position)(XHeightOfScreen(XtScreen(parent)) - height) / 3;
-
- XtVaSetValues(printdialog_shell,
- XtNx, x,
- XtNy, y,
- NULL);
-
- XtPopup(printdialog_shell, XtGrabNonexclusive);
-}
-
/* Function Name: SourceChanged
* Description: A callback routine called when the source has changed.
* Arguments: w - the text source that has changed.
diff --git a/hook.c b/hook.c
index 9352ea4..5e10a39 100644
--- a/hook.c
+++ b/hook.c
@@ -388,11 +388,9 @@ LineEditAction(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
XawTextBlock block;
- if (True) {
+ if (international)
/* XXX FIXME */
- fprintf(stderr, "LineEditAction: Not working in international mode.\n");
return;
- }
block.firstPos = 0;
block.format = FMT8BIT;
diff --git a/ispell.c b/ispell.c
index 3706c34..c03d631 100644
--- a/ispell.c
+++ b/ispell.c
@@ -938,7 +938,10 @@ IspellSend(void)
return (-1);
}
for (i = 0; i < block.length; i++) {
- wctomb(mb, ((wchar_t*)block.ptr)[i]);
+ if (international)
+ wctomb(mb, ((wchar_t*)block.ptr)[i]);
+ else
+ *mb = block.ptr[i];
if (amplen) {
if (amplen + 2 >= sizeof(ampbuf)) {
if (!ispell.terse_mode)
@@ -1036,7 +1039,10 @@ IspellSend(void)
return (-1);
}
for (i = 0; i < block.length; i++) {
- wctomb(mb, ((wchar_t*)block.ptr)[i]);
+ if (international)
+ wctomb(mb, ((wchar_t*)block.ptr)[i]);
+ else
+ *mb = block.ptr[i];
if (amplen) {
if (amplen + 2 >= sizeof(ampbuf)) {
if (!ispell.terse_mode)
@@ -1560,12 +1566,18 @@ ReplaceIspell(Widget w, XtPointer client_data, XtPointer call_data)
char mb[sizeof(wchar_t)];
if (XawTextSourceRead(ispell.source, pos - 1, &check, 1) > 0) {
- wctomb(mb, *(wchar_t*)check.ptr);
+ if (international)
+ wctomb(mb, *(wchar_t*)check.ptr);
+ else
+ *mb = *check.ptr;
do_replace = !isalpha(*mb) && *mb && !strchr(ispell.wchars, *mb);
}
if (do_replace &&
XawTextSourceRead(ispell.source, pos + search.length, &check, 1) > 0) {
- wctomb(mb, *(wchar_t*)check.ptr);
+ if (international)
+ wctomb(mb, *(wchar_t*)check.ptr);
+ else
+ *mb = *check.ptr;
do_replace = !isalpha(*mb) && *mb && !strchr(ispell.wchars, *mb);
}
if (do_replace) {
diff --git a/lisp/lisp.c b/lisp/lisp.c
index 0231727..da5d1c8 100644
--- a/lisp/lisp.c
+++ b/lisp/lisp.c
@@ -46,8 +46,7 @@
#endif
#if defined(linux)
-/* kernel header doesn't work with -ansi */
-/* #include <asm/page.h> */ /* for PAGE_SIZE */
+#include <asm/page.h> /* for PAGE_SIZE */
#define HAS_GETPAGESIZE
#define HAS_SC_PAGESIZE /* _SC_PAGESIZE may be an enum for Linux */
#endif
diff --git a/xedit.c b/xedit.c
index ccab87d..8648c06 100644
--- a/xedit.c
+++ b/xedit.c
@@ -41,7 +41,6 @@ static XtActionsRec actions[] = {
{"quit", QuitAction},
{"save-file", SaveFile},
{"load-file", LoadFile},
-{"print-file", PrintFile},
{"find-file", FindFile},
{"cancel-find-file", CancelFindFile},
{"file-completion", FileCompletion},
@@ -72,6 +71,7 @@ static XawTextPositionInfo infos[3];
Widget topwindow, textwindow, messwidget, labelwindow, filenamewindow;
Widget scratch, hpane, vpanes[2], labels[3], texts[3], forms[3], positions[3];
Widget options_popup, dirlabel, dirwindow;
+Boolean international;
Boolean line_edit;
XawTextWrapMode wrapmodes[3];
@@ -111,11 +111,6 @@ static XtResource resources[] = {
#undef Offset
-String fallback_resources[] = {
- "*international: True", /* set this globally for ALL widgets to avoid wiered crashes */
- NULL
-};
-
int
main(int argc, char *argv[])
{
@@ -123,7 +118,7 @@ main(int argc, char *argv[])
unsigned num_loaded = 0;
XtSetLanguageProc(NULL, NULL, NULL);
- topwindow = XtAppInitialize(&appcon, "Xedit", NULL, 0, &argc, argv, fallback_resources, NULL, 0);
+ topwindow = XtAppInitialize(&appcon, "Xedit", NULL, 0, &argc, argv, NULL, NULL, 0);
XtAppAddActions(appcon, actions, XtNumber(actions));
XtOverrideTranslations
@@ -245,8 +240,9 @@ main(int argc, char *argv[])
flags = 0;
XtSetArg(args[num_args], XtNstring, NULL); num_args++;
}
- source = XtVaCreateWidget("textSource",
- multiSrcObjectClass, topwindow,
+ source = XtVaCreateWidget("textSource", international ?
+ multiSrcObjectClass
+ : asciiSrcObjectClass, topwindow,
XtNtype, XawAsciiFile,
XtNeditType, XawtextEdit,
NULL, NULL);
@@ -306,7 +302,6 @@ makeButtonsAndBoxes(Widget parent)
MakeCommandButton(b_row, "quit", DoQuit);
MakeCommandButton(b_row, "save", DoSave);
MakeCommandButton(b_row, "load", DoLoad);
- MakeCommandButton(b_row, "print", DoPrint);
filenamewindow = MakeStringBox(b_row, "filename", NULL);
}
hintswindow = XtCreateManagedWidget("bc_label", labelWidgetClass,
@@ -352,10 +347,15 @@ makeButtonsAndBoxes(Widget parent)
textwindow = XtCreateManagedWidget(editWindow, asciiTextWidgetClass,
vpanes[0], arglist, num_args);
num_args = 0;
+ XtSetArg(arglist[num_args], XtNinternational, &international); ++num_args;
+ XtGetValues(textwindow, arglist, num_args);
+
+ num_args = 0;
XtSetArg(arglist[num_args], XtNtype, XawAsciiFile); ++num_args;
XtSetArg(arglist[num_args], XtNeditType, XawtextEdit); ++num_args;
- scratch = XtVaCreateWidget("textSource",
- multiSrcObjectClass, topwindow,
+ scratch = XtVaCreateWidget("textSource", international ?
+ multiSrcObjectClass
+ : asciiSrcObjectClass, topwindow,
XtNtype, XawAsciiFile,
XtNeditType, XawtextEdit,
NULL, NULL);
diff --git a/xedit.h b/xedit.h
index 88cec65..f347aa3 100644
--- a/xedit.h
+++ b/xedit.h
@@ -100,6 +100,7 @@ extern struct _app_resources {
extern Widget topwindow, textwindow, labelwindow, filenamewindow, messwidget;
extern Widget dirlabel, dirwindow;
+extern Boolean international;
extern Boolean line_edit;
/* externals in xedit.c */
@@ -131,11 +132,9 @@ void QuitAction(Widget, XEvent*, String*, Cardinal*);
void DoSave(Widget, XtPointer, XtPointer);
void SaveFile(Widget, XEvent*, String*, Cardinal*);
void DoLoad(Widget, XtPointer, XtPointer);
-void DoPrint(Widget, XtPointer, XtPointer);
void CancelFindFile(Widget, XEvent*, String*, Cardinal*);
void FindFile(Widget, XEvent*, String*, Cardinal*);
void LoadFile(Widget, XEvent*, String*, Cardinal*);
-void PrintFile(Widget, XEvent*, String*, Cardinal*);
void FileCompletion(Widget, XEvent*, String*, Cardinal*);
void KillFile(Widget, XEvent*, String*, Cardinal*);
void DirWindowCB(Widget, XtPointer, XtPointer);