From f1d58be104f4020ef718a542d7f5ca72cd1f531b Mon Sep 17 00:00:00 2001 From: Paulo Cesar Pereira de Andrade Date: Tue, 11 Mar 2008 21:44:25 -0300 Subject: Readd support for *international resource and default to false. This allows several features, like syntax highlight and indentation, turned off to be enabled again. --- Xedit-noxprint.ad | 5 +++-- Xedit-xprint.ad | 3 ++- commands.c | 10 ++++++---- xedit.c | 33 ++++++++++++++++++++++++++++----- xedit.h | 1 + 5 files changed, 40 insertions(+), 12 deletions(-) diff --git a/Xedit-noxprint.ad b/Xedit-noxprint.ad index 16334a3..2b8bf25 100644 --- a/Xedit-noxprint.ad +++ b/Xedit-noxprint.ad @@ -5,7 +5,7 @@ *enableBackups: True *backupNameSuffix: ~ *changedBitmap: xlogo11 -*international: True +*international: False *hints:\ Use Control-S and Control-R to Search.\n\ @@ -257,7 +257,8 @@ cG: cancel-find-file()\n\ !*ispell.dictionary: br !*ispell.dictionaries: br american americanmed+ english !*ispell*br.wordChars: áéíóúçÁÉÍÓÚÇàÀâêôÂÊÔüÜãõÃÕ- -!*ispell.ispellCommand: /usr/local/bin/ispell -B -m +*ispell.ispellCommand: /usr/bin/aspell -B -m +*ispell.lookCommand: /bin/egrep !*ispell*text.skipLines: .# *ispell.geometry: 0x0 diff --git a/Xedit-xprint.ad b/Xedit-xprint.ad index cb8445f..cbc272b 100644 --- a/Xedit-xprint.ad +++ b/Xedit-xprint.ad @@ -261,7 +261,8 @@ cG: cancel-find-file()\n\ !*ispell.dictionary: br !*ispell.dictionaries: br american americanmed+ english !*ispell*br.wordChars: áéíóúçÁÉÍÓÚÇàÀâêôÂÊÔüÜãõÃÕ- -!*ispell.ispellCommand: /usr/local/bin/ispell -B -m +*ispell.ispellCommand: /usr/bin/aspell -B -m +*ispell.lookCommand: /bin/egrep !*ispell*text.skipLines: .# *ispell.geometry: 0x0 diff --git a/commands.c b/commands.c index 7fa14d1..e7f23b1 100644 --- a/commands.c +++ b/commands.c @@ -357,8 +357,9 @@ 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, @@ -495,8 +496,9 @@ 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, diff --git a/xedit.c b/xedit.c index 8d96258..384b16f 100644 --- a/xedit.c +++ b/xedit.c @@ -73,6 +73,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]; @@ -112,10 +113,12 @@ static XtResource resources[] = { #undef Offset +#ifdef INCLUDE_XPRINT_SUPPORT String fallback_resources[] = { "*international: True", /* set this globally for ALL widgets to avoid wiered crashes */ NULL }; +#endif int main(int argc, char *argv[]) @@ -123,8 +126,16 @@ main(int argc, char *argv[]) XtAppContext appcon; unsigned num_loaded = 0; +#ifdef INCLUDE_XPRINT_SUPPORT XtSetLanguageProc(NULL, NULL, NULL); - topwindow = XtAppInitialize(&appcon, "Xedit", NULL, 0, &argc, argv, fallback_resources, NULL, 0); +#endif + topwindow = XtAppInitialize(&appcon, "Xedit", NULL, 0, &argc, argv, +#ifdef INCLUDE_XPRINT_SUPPORT + fallback_resources, +#else + NULL, +#endif + NULL, 0); XtAppAddActions(appcon, actions, XtNumber(actions)); XtOverrideTranslations @@ -246,8 +257,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); @@ -354,11 +366,22 @@ makeButtonsAndBoxes(Widget parent) XtSetArg(arglist[num_args], XtNeditType, XawtextEdit); ++num_args; textwindow = XtCreateManagedWidget(editWindow, asciiTextWidgetClass, vpanes[0], arglist, num_args); + +#ifdef INCLUDE_XPRINT_SUPPORT + international = True; +#else + /* Get international resource value form the textwindow */ + num_args = 0; + XtSetArg(arglist[num_args], XtNinternational, &international); ++num_args; + XtGetValues(textwindow, arglist, num_args); +#endif + 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 eeb7ca3..8d93611 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 */ -- cgit v1.2.3