argv%turnpike@Sun.COM (Dan Heller) (02/28/90)
Submitted-by: Erik M. van der Poel <uunet!kddlab!sran8.sra.co.jp!erik> Posting-number: Volume 6, Issue 3 Archive-name: xdir/patch3 Patch-To: xdir: Volume 4, Issue 14-15,97 Patch-To: xdir: Volume 5, Issue 14 This is the third set of patches for the SelFile directory browser package. These patches are for people with patchlevel 2. People with the R4 version (contrib/clients/selfile) should wait for the next set of patches, which take the patchlevel from 3 to 4. * Athena widget include files have moved to <X11/Xaw> in R4. * R4 Athena widgets use Xaw... instead of Xt... * The R4 Athena Text widget has a new programmer interface. * It is still possible to compile in a pre-R4 environment using -DSEL_FILE_PRE_R4_XAW_XMU. * The patchlevel.h file has been updated to patch level three. -- Erik M. van der Poel erik@sra.co.jp (Japan) SRA, 1-1-1 Hirakawa-cho, Chiyoda-ku erik%sra.co.jp@uunet.uu.net (USA) Tokyo 102 Japan. TEL +81-3-234-2692 erik%sra.co.jp@mcvax.uucp (Europe) Prereq: 2 *** ../old/patchlevel.h Mon Jan 29 13:57:04 1990 --- patchlevel.h Mon Jan 29 13:58:20 1990 *************** *** 1 **** ! #define PATCHLEVEL 2 --- 1 ---- ! #define PATCHLEVEL 3 *** ../old/Draw.c Mon Jan 29 13:57:08 1990 --- Draw.c Mon Jan 29 13:58:18 1990 *************** *** 1,5 **** #ifndef lint ! static char rcsid[] = "$Header: Draw.c,v 1.11 89/09/28 16:32:19 erik Exp $"; #endif /* --- 1,5 ---- #ifndef lint ! static char rcsid[] = "$Header: Draw.c,v 1.2 89/12/15 11:59:08 kit Exp $"; #endif /* *************** *** 34,43 **** --- 34,51 ---- #include <X11/StringDefs.h> #if defined(SEL_FILE_XW) || defined(SEL_FILE_XWSCROLLBAR) + #include <Xw/Xw.h> #include <Xw/ScrollBar.h> + #else /* defined(SEL_FILE_XW) || defined(SEL_FILE_XWSCROLLBAR) */ + + #ifdef SEL_FILE_PRE_R4_XAW_XMU #include <X11/Scroll.h> + #else /* def SEL_FILE_PRE_R4_XAW_XMU */ + #include <X11/Xaw/Scrollbar.h> + #endif /* def SEL_FILE_PRE_R4_XAW_XMU */ + #endif /* defined(SEL_FILE_XW) || defined(SEL_FILE_XWSCROLLBAR) */ #define SF_DEFAULT_FONT "9x15" *************** *** 223,229 **** --- 231,243 ---- XtSetValues(selFileHScrolls[n], arglist, i); #else /* defined(SEL_FILE_XW) || defined(SEL_FILE_XWSCROLLBAR) */ if ((SFdirPtr + n < SFdirEnd) && dir->nEntries && dir->nChars) { + + #ifdef SEL_FILE_PRE_R4_XAW_XMU XtScrollBarSetThumb( + #else /* def SEL_FILE_PRE_R4_XAW_XMU */ + XawScrollBarSetThumb( + #endif /* def SEL_FILE_PRE_R4_XAW_XMU */ + selFileVScrolls[n], (float) (((double) dir->vOrigin) / dir->nEntries), *************** *** 231,237 **** --- 245,257 ---- ? dir->nEntries : SFlistSize)) / dir->nEntries) ); + + #ifdef SEL_FILE_PRE_R4_XAW_XMU XtScrollBarSetThumb( + #else /* def SEL_FILE_PRE_R4_XAW_XMU */ + XawScrollBarSetThumb( + #endif /* def SEL_FILE_PRE_R4_XAW_XMU */ + selFileHScrolls[n], (float) (((double) dir->hOrigin) / dir->nChars), (float) (((double) ((dir->nChars < *************** *** 239,248 **** --- 259,277 ---- SFcharsPerEntry)) / dir->nChars) ); } else { + + #ifdef SEL_FILE_PRE_R4_XAW_XMU XtScrollBarSetThumb(selFileVScrolls[n], (float) 0.0, (float) 1.0); XtScrollBarSetThumb(selFileHScrolls[n], (float) 0.0, (float) 1.0); + #else /* def SEL_FILE_PRE_R4_XAW_XMU */ + XawScrollBarSetThumb(selFileVScrolls[n], (float) 0.0, + (float) 1.0); + XawScrollBarSetThumb(selFileHScrolls[n], (float) 0.0, + (float) 1.0); + #endif /* def SEL_FILE_PRE_R4_XAW_XMU */ + } #endif /* defined(SEL_FILE_XW) || defined(SEL_FILE_XWSCROLLBAR) */ *************** *** 310,316 **** --- 339,350 ---- #else /* defined(SEL_FILE_XW) || defined(SEL_FILE_XWSCROLLBAR) */ + #ifdef SEL_FILE_PRE_R4_XAW_XMU XtScrollBarSetThumb( + #else /* def SEL_FILE_PRE_R4_XAW_XMU */ + XawScrollBarSetThumb( + #endif /* def SEL_FILE_PRE_R4_XAW_XMU */ + selFileVScrolls[n], (float) (((double) dir->vOrigin) / dir->nEntries), (float) (((double) ((dir->nEntries < SFlistSize) ? *************** *** 610,616 **** --- 644,656 ---- XtSetValues(selFileVScrolls[n], arglist, i); #else /* defined(SEL_FILE_XW) || defined(SEL_FILE_XWSCROLLBAR) */ if (dir->nEntries) { + + #ifdef SEL_FILE_PRE_R4_XAW_XMU XtScrollBarSetThumb( + #else /* def SEL_FILE_PRE_R4_XAW_XMU */ + XawScrollBarSetThumb( + #endif /* def SEL_FILE_PRE_R4_XAW_XMU */ + selFileVScrolls[n], (float) (((double) dir->vOrigin) / dir->nEntries), (float) (((double) ((dir->nEntries < SFlistSize) ? *************** *** 904,910 **** --- 944,956 ---- float f; f = ((double) new) / dir->nEntries; + + #ifdef SEL_FILE_PRE_R4_XAW_XMU XtScrollBarSetThumb( + #else /* def SEL_FILE_PRE_R4_XAW_XMU */ + XawScrollBarSetThumb( + #endif /* def SEL_FILE_PRE_R4_XAW_XMU */ + w, f, (float) (((double) ((dir->nEntries < SFlistSize) ? *************** *** 1000,1006 **** --- 1046,1058 ---- float f; f = ((double) new) / dir->nChars; + + #ifdef SEL_FILE_PRE_R4_XAW_XMU XtScrollBarSetThumb( + #else /* def SEL_FILE_PRE_R4_XAW_XMU */ + XawScrollBarSetThumb( + #endif /* def SEL_FILE_PRE_R4_XAW_XMU */ + w, f, (float) (((double) ((dir->nChars < SFcharsPerEntry) ? *************** *** 1029,1037 **** --- 1081,1097 ---- int n; #if defined(SEL_FILE_XW) || defined(SEL_FILE_XWTEXTEDIT) + XwTextPosition pos; + #else /* defined(SEL_FILE_XW) || defined(SEL_FILE_XWTEXTEDIT) */ + + #ifdef SEL_FILE_PRE_R4_XAW_XMU XtTextPosition pos; + #else /* def SEL_FILE_PRE_R4_XAW_XMU */ + XawTextPosition pos; + #endif /* def SEL_FILE_PRE_R4_XAW_XMU */ + #endif /* defined(SEL_FILE_XW) || defined(SEL_FILE_XWTEXTEDIT) */ #if defined(SEL_FILE_XW) || defined(SEL_FILE_XWSCROLLBAR) *************** *** 1067,1075 **** --- 1127,1143 ---- } #if defined(SEL_FILE_XW) || defined(SEL_FILE_XWTEXTEDIT) + XwTextSetInsertPos(selFileField, pos); + #else /* defined(SEL_FILE_XW) || defined(SEL_FILE_XWTEXTEDIT) */ + + #ifdef SEL_FILE_PRE_R4_XAW_XMU XtTextSetInsertionPoint(selFileField, pos); + #else /* def SEL_FILE_PRE_R4_XAW_XMU */ + XawTextSetInsertionPoint(selFileField, pos); + #endif /* def SEL_FILE_PRE_R4_XAW_XMU */ + #endif /* defined(SEL_FILE_XW) || defined(SEL_FILE_XWTEXTEDIT) */ } *************** *** 1122,1128 **** --- 1190,1202 ---- float f; f = ((double) new) / SFdirEnd; + + #ifdef SEL_FILE_PRE_R4_XAW_XMU XtScrollBarSetThumb( + #else /* def SEL_FILE_PRE_R4_XAW_XMU */ + XawScrollBarSetThumb( + #endif /* def SEL_FILE_PRE_R4_XAW_XMU */ + w, f, (float) (((double) ((SFdirEnd < 3) ? SFdirEnd : 3)) / *** ../old/Imakefile Mon Jan 29 13:56:48 1990 --- Imakefile Mon Jan 29 13:58:18 1990 *************** *** 15,20 **** --- 15,25 ---- # # -DSEL_FILE_XW # + # By default, the program compiles correctly in the R4 environment, where Xaw + # header files are under <X11/Xaw/>. To compile in an earlier environment, use: + # + # -DSEL_FILE_PRE_R4_XAW_XMU + # # Normally, the program should be linked with the R3 or a later version of the # Xt Intrinsics, but it can be linked with the R2 Xt by defining the following: # *************** *** 32,37 **** --- 37,43 ---- #------------------------------------------------------------------------------ # # DEFINES = -DSEL_FILE_XW + DEFINES = CompatibilityFlags SRCS = xdir.c SelFile.c Dir.c Path.c Draw.c OBJS = xdir.o SelFile.o Dir.o Path.o Draw.o *** ../old/Path.c Mon Jan 29 13:57:09 1990 --- Path.c Mon Jan 29 13:58:19 1990 *************** *** 1,5 **** #ifndef lint ! static char rcsid[] = "$Header: Path.c,v 1.10 89/09/28 16:33:57 erik Exp $"; #endif /* --- 1,5 ---- #ifndef lint ! static char rcsid[] = "$Header: Path.c,v 1.2 89/12/15 11:59:24 kit Exp $"; #endif /* *************** *** 39,48 **** --- 39,56 ---- #include <sys/stat.h> #if defined(SEL_FILE_XW) || defined(SEL_FILE_XWSCROLLBAR) + #include <Xw/Xw.h> #include <Xw/ScrollBar.h> + #else /* defined(SEL_FILE_XW) || defined(SEL_FILE_XWSCROLLBAR) */ + + #ifdef SEL_FILE_PRE_R4_XAW_XMU #include <X11/Scroll.h> + #else /* def SEL_FILE_PRE_R4_XAW_XMU */ + #include <X11/Xaw/Scrollbar.h> + #endif /* def SEL_FILE_PRE_R4_XAW_XMU */ + #endif /* defined(SEL_FILE_XW) || defined(SEL_FILE_XWSCROLLBAR) */ #if defined(SYSV) || defined(USG) *************** *** 684,690 **** --- 692,704 ---- XtSetArg(arglist[i], XtNsliderOrigin, SFdirPtr); i++; XtSetValues(selFileHScroll, arglist, i); #else /* defined(SEL_FILE_XW) || defined(SEL_FILE_XWSCROLLBAR) */ + + #ifdef SEL_FILE_PRE_R4_XAW_XMU XtScrollBarSetThumb( + #else /* def SEL_FILE_PRE_R4_XAW_XMU */ + XawScrollBarSetThumb( + #endif /* def SEL_FILE_PRE_R4_XAW_XMU */ + selFileHScroll, (float) (((double) SFdirPtr) / SFdirEnd), (float) (((double) ((SFdirEnd < 3) ? SFdirEnd : 3)) / *************** *** 738,750 **** --- 752,775 ---- #else /* defined(SEL_FILE_XW) || defined(SEL_FILE_XWTEXTEDIT) */ { + + #ifdef SEL_FILE_PRE_R4_XAW_XMU XtTextBlock text; + #else /* def SEL_FILE_PRE_R4_XAW_XMU */ + XawTextBlock text; + #endif /* def SEL_FILE_PRE_R4_XAW_XMU */ text.firstPos = 0; text.length = strlen(path); text.ptr = path; text.format = FMT8BIT; + + #ifdef SEL_FILE_PRE_R4_XAW_XMU XtTextReplace(selFileField, 0, strlen(SFtextBuffer), &text); + #else /* def SEL_FILE_PRE_R4_XAW_XMU */ + XawTextReplace(selFileField, 0, strlen(SFtextBuffer), &text); + #endif /* def SEL_FILE_PRE_R4_XAW_XMU */ + } #endif /* defined(SEL_FILE_XW) || defined(SEL_FILE_XWTEXTEDIT) */ *** ../old/SFinternal.h Mon Jan 29 13:56:50 1990 --- SFinternal.h Mon Jan 29 13:58:19 1990 *************** *** 1,4 **** ! /* $Header: SFinternal.h,v 1.6 89/08/30 15:59:46 erik Exp $ */ /* * Copyright 1989 Software Research Associates, Inc., Tokyo, Japan --- 1,4 ---- ! /* $Header: SFinternal.h,v 1.7 89/10/31 18:36:41 erik Exp $ */ /* * Copyright 1989 Software Research Associates, Inc., Tokyo, Japan *************** *** 30,40 **** --- 30,49 ---- #include <X11/Xos.h> #if defined(SEL_FILE_XW) || defined(SEL_FILE_XWTEXTEDIT) + #include <Xw/Xw.h> #include <Xw/TextEdit.h> + #else /* defined(SEL_FILE_XW) || defined(SEL_FILE_XWTEXTEDIT) */ + + #ifdef SEL_FILE_PRE_R4_XAW_XMU #include <X11/Text.h> #include <X11/AsciiText.h> + #else /* def SEL_FILE_PRE_R4_XAW_XMU */ + #include <X11/Xaw/Text.h> + #include <X11/Xaw/AsciiText.h> + #endif /* def SEL_FILE_PRE_R4_XAW_XMU */ + #endif /* defined(SEL_FILE_XW) || defined(SEL_FILE_XWTEXTEDIT) */ #define SEL_FILE_CANCEL -1 *************** *** 94,102 **** --- 103,119 ---- extern XSegment SFsegs[], SFcompletionSegs[]; #if defined(SEL_FILE_XW) || defined(SEL_FILE_XWTEXTEDIT) + extern XwTextPosition SFtextPos; + #else /* defined(SEL_FILE_XW) || defined(SEL_FILE_XWTEXTEDIT) */ + + #ifdef SEL_FILE_PRE_R4_XAW_XMU extern XtTextPosition SFtextPos; + #else /* def SEL_FILE_PRE_R4_XAW_XMU */ + extern XawTextPosition SFtextPos; + #endif /* def SEL_FILE_PRE_R4_XAW_XMU */ + #endif /* defined(SEL_FILE_XW) || defined(SEL_FILE_XWTEXTEDIT) */ extern void *** ../old/SelFile.c Mon Jan 29 13:57:06 1990 --- SelFile.c Mon Jan 29 13:58:19 1990 *************** *** 1,5 **** #ifndef lint ! static char rcsid[] = "$Header: SelFile.c,v 1.13 89/10/27 15:41:26 erik Exp $"; #endif /* --- 1,5 ---- #ifndef lint ! static char rcsid[] = "$Header: SelFile.c,v 1.2 89/12/15 11:59:32 kit Exp $"; #endif /* *************** *** 54,84 **** --- 54,116 ---- #include <X11/Shell.h> #if defined(SEL_FILE_XW) || defined(SEL_FILE_XWFORM) + #include <Xw/Xw.h> #include <Xw/Form.h> + #else /* defined(SEL_FILE_XW) || defined(SEL_FILE_XWFORM) */ + + #ifdef SEL_FILE_PRE_R4_XAW_XMU #include <X11/Form.h> + #else /* def SEL_FILE_PRE_R4_XAW_XMU */ + #include <X11/Xaw/Form.h> + #endif /* def SEL_FILE_PRE_R4_XAW_XMU */ + #endif /* defined(SEL_FILE_XW) || defined(SEL_FILE_XWFORM) */ #if defined(SEL_FILE_XW) || defined(SEL_FILE_XWPUSHBUTTON) + #include <Xw/Xw.h> #include <Xw/PButton.h> + #else /* defined(SEL_FILE_XW) || defined(SEL_FILE_XWPUSHBUTTON) */ + + #ifdef SEL_FILE_PRE_R4_XAW_XMU #include <X11/Command.h> + #else /* def SEL_FILE_PRE_R4_XAW_XMU */ + #include <X11/Xaw/Command.h> + #endif /* def SEL_FILE_PRE_R4_XAW_XMU */ + #endif /* defined(SEL_FILE_XW) || defined(SEL_FILE_XWPUSHBUTTON) */ #if defined(SEL_FILE_XW) || defined(SEL_FILE_XWSCROLLBAR) + #include <Xw/Xw.h> #include <Xw/ScrollBar.h> + #else /* defined(SEL_FILE_XW) || defined(SEL_FILE_XWSCROLLBAR) */ + + #ifdef SEL_FILE_PRE_R4_XAW_XMU #include <X11/Scroll.h> + #else /* def SEL_FILE_PRE_R4_XAW_XMU */ + #include <X11/Xaw/Scrollbar.h> + #endif /* def SEL_FILE_PRE_R4_XAW_XMU */ + #endif /* defined(SEL_FILE_XW) || defined(SEL_FILE_XWSCROLLBAR) */ #if defined(SEL_FILE_XW) || defined(SEL_FILE_XWSTATICTEXT) + #include <Xw/Xw.h> #include <Xw/SText.h> + #else /* defined(SEL_FILE_XW) || defined(SEL_FILE_XWSTATICTEXT) */ + + #ifdef SEL_FILE_PRE_R4_XAW_XMU #include <X11/Label.h> + #else /* def SEL_FILE_PRE_R4_XAW_XMU */ + #include <X11/Xaw/Label.h> + #endif /* def SEL_FILE_PRE_R4_XAW_XMU */ + #endif /* defined(SEL_FILE_XW) || defined(SEL_FILE_XWSTATICTEXT) */ #include "SFinternal.h" *************** *** 123,131 **** --- 155,171 ---- XSegment SFsegs[2], SFcompletionSegs[2]; #if defined(SEL_FILE_XW) || defined(SEL_FILE_XWTEXTEDIT) + XwTextPosition SFtextPos; + #else /* defined(SEL_FILE_XW) || defined(SEL_FILE_XWTEXTEDIT) */ + + #ifdef SEL_FILE_PRE_R4_XAW_XMU XtTextPosition SFtextPos; + #else /* def SEL_FILE_PRE_R4_XAW_XMU */ + XawTextPosition SFtextPos; + #endif /* def SEL_FILE_PRE_R4_XAW_XMU */ + #endif /* defined(SEL_FILE_XW) || defined(SEL_FILE_XWTEXTEDIT) */ int SFupperX, SFlowerY, SFupperY; *************** *** 341,347 **** u_char cstr[256]; #endif /* def SEL_FILE_JAPANESE */ ! Arg arglist[20]; #if defined(SEL_FILE_XW) || defined(SEL_FILE_XWTEXTEDIT) SFfieldData *data; --- 381,387 ---- u_char cstr[256]; #endif /* def SEL_FILE_JAPANESE */ ! Arg arglist[24]; #if defined(SEL_FILE_XW) || defined(SEL_FILE_XWTEXTEDIT) SFfieldData *data; *************** *** 488,493 **** --- 528,535 ---- #else /* defined(SEL_FILE_XW) || defined(SEL_FILE_XWTEXTEDIT) */ XtSetArg(arglist[i], XtNstring, SFtextBuffer); i++; XtSetArg(arglist[i], XtNlength, MAXPATHLEN); i++; + + #ifdef SEL_FILE_PRE_R4_XAW_XMU XtSetArg(arglist[i], XtNeditType, XttextEdit); i++; XtSetArg(arglist[i], XtNtextOptions, 0 | editable | *************** *** 494,501 **** --- 536,555 ---- resizeHeight | wordBreak | 0); i++; + #else /* def SEL_FILE_PRE_R4_XAW_XMU */ + XtSetArg(arglist[i], XtNeditType, XawtextEdit); i++; + XtSetArg(arglist[i], XtNwrap, XawtextWrapWord); i++; + XtSetArg(arglist[i], XtNresize, XawtextResizeHeight); i++; + #endif /* def SEL_FILE_PRE_R4_XAW_XMU */ + + #ifdef SEL_FILE_PRE_R4_XAW_XMU selFileField = XtCreateManagedWidget("selFileField", asciiStringWidgetClass, selFileForm, arglist, i); + #else + selFileField = XtCreateManagedWidget("selFileField", + asciiTextWidgetClass, selFileForm, arglist, i); + #endif + #endif /* defined(SEL_FILE_XW) || defined(SEL_FILE_XWTEXTEDIT) */ XtOverrideTranslations(selFileField, *************** *** 930,938 **** --- 984,1000 ---- (void) strcpy(SFcurrentPath, SFtextBuffer); #if defined(SEL_FILE_XW) || defined(SEL_FILE_XWTEXTEDIT) + SFtextPos = XwTextGetInsertPos(selFileField); + #else /* defined(SEL_FILE_XW) || defined(SEL_FILE_XWTEXTEDIT) */ + + #ifdef SEL_FILE_PRE_R4_XAW_XMU SFtextPos = XtTextGetInsertionPoint(selFileField); + #else /* def SEL_FILE_PRE_R4_XAW_XMU */ + SFtextPos = XawTextGetInsertionPoint(selFileField); + #endif /* def SEL_FILE_PRE_R4_XAW_XMU */ + #endif /* defined(SEL_FILE_XW) || defined(SEL_FILE_XWTEXTEDIT) */ } else { *************** *** 939,949 **** --- 1001,1020 ---- (void) strcat(strcpy(SFcurrentPath, SFstartDir), SFtextBuffer); #if defined(SEL_FILE_XW) || defined(SEL_FILE_XWTEXTEDIT) + SFtextPos = XwTextGetInsertPos(selFileField) + strlen(SFstartDir); + #else /* defined(SEL_FILE_XW) || defined(SEL_FILE_XWTEXTEDIT) */ + + #ifdef SEL_FILE_PRE_R4_XAW_XMU SFtextPos = XtTextGetInsertionPoint(selFileField) + strlen(SFstartDir); + #else /* def SEL_FILE_PRE_R4_XAW_XMU */ + SFtextPos = XawTextGetInsertionPoint(selFileField) + + strlen(SFstartDir); + #endif /* def SEL_FILE_PRE_R4_XAW_XMU */ + #endif /* defined(SEL_FILE_XW) || defined(SEL_FILE_XWTEXTEDIT) */ } dan ----------------------------------------------------------- O'Reilly && Associates argv@sun.com / argv@ora.com 632 Petaluma Ave, Sebastopol, CA 95472 800-338-NUTS, in CA: 800-533-NUTS, FAX 707-829-0104 Opinions expressed reflect those of the author only.