diff options
Diffstat (limited to 'app/xedit/xedit.c')
-rw-r--r-- | app/xedit/xedit.c | 46 |
1 files changed, 13 insertions, 33 deletions
diff --git a/app/xedit/xedit.c b/app/xedit/xedit.c index 0b49226b6..f7a8b68c1 100644 --- a/app/xedit/xedit.c +++ b/app/xedit/xedit.c @@ -40,9 +40,6 @@ static XtActionsRec actions[] = { {"quit", QuitAction}, {"save-file", SaveFile}, {"load-file", LoadFile}, -#ifdef INCLUDE_XPRINT_SUPPORT -{"print-file", PrintFile}, -#endif /* INCLUDE_XPRINT_SUPPORT */ {"find-file", FindFile}, {"cancel-find-file", CancelFindFile}, {"file-completion", FileCompletion}, @@ -118,13 +115,6 @@ 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[]) { @@ -133,19 +123,16 @@ main(int argc, char *argv[]) FileAccess file_access; Widget source; XtAppContext appcon; - unsigned int i, num_loaded, lineno; + Boolean show_dir; + xedit_flist_item *first_item; + unsigned int i, lineno; - num_loaded = lineno = 0; + lineno = 0; + show_dir = FALSE; + first_item = NULL; -#ifdef INCLUDE_XPRINT_SUPPORT - XtSetLanguageProc(NULL, NULL, NULL); -#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)); @@ -205,7 +192,7 @@ main(int argc, char *argv[]) char *endptr; lineno = strtol(argv[i], &endptr, 10); - /* Don't warn or anything about incorrect input? */ + /* Don't warn about incorrect input? */ if (*endptr) lineno = 0; continue; @@ -218,7 +205,7 @@ main(int argc, char *argv[]) num_args = 0; if (stat(filename, &st) == 0 && !S_ISREG(st.st_mode)) { if (S_ISDIR(st.st_mode)) { - if (!num_loaded) { + if (!first_item) { char path[BUFSIZ + 1]; strncpy(path, filename, sizeof(path) - 2); @@ -233,7 +220,7 @@ main(int argc, char *argv[]) XtSetValues(dirlabel, args, 1); SwitchDirWindow(True); DirWindowCB(dirwindow, path, NULL); - ++num_loaded; + show_dir = True; } continue; } @@ -283,9 +270,8 @@ main(int argc, char *argv[]) item->mode = st.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); item->mtime = st.st_mtime; } - if (!num_loaded) - SwitchTextSource(item); - ++num_loaded; + if (!first_item && !show_dir) + first_item = item; ResetSourceChanged(item); } } @@ -302,11 +288,12 @@ main(int argc, char *argv[]) XtConvertAndStore(flist.popup, XtRString, &from, XtRBitmap, &to); } - if (num_loaded == 0) { + if (first_item == NULL) { XtSetKeyboardFocus(topwindow, filenamewindow); XtVaSetValues(textwindow, XtNwrap, XawtextWrapLine, NULL); } else { + SwitchTextSource(first_item); XtSetKeyboardFocus(topwindow, textwindow); if (lineno) { XawTextPosition position; @@ -341,9 +328,6 @@ makeButtonsAndBoxes(Widget parent) MakeCommandButton(b_row, "quit", DoQuit); MakeCommandButton(b_row, "save", DoSave); MakeCommandButton(b_row, "load", DoLoad); -#ifdef INCLUDE_XPRINT_SUPPORT - MakeCommandButton(b_row, "print", DoPrint); -#endif /* INCLUDE_XPRINT_SUPPORT */ filenamewindow = MakeStringBox(b_row, "filename", NULL); } hintswindow = XtCreateManagedWidget("bc_label", labelWidgetClass, @@ -389,14 +373,10 @@ makeButtonsAndBoxes(Widget parent) 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; |