1 /* 2 * rcs_id[] = "$XConsortium: xedit.h,v 1.19 89/10/07 14:59:46 kit Exp $"; 3 */ 4 5 /* 6 * COPYRIGHT 1987 7 * DIGITAL EQUIPMENT CORPORATION 8 * MAYNARD, MASSACHUSETTS 9 * ALL RIGHTS RESERVED. 10 * 11 * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND 12 * SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION. 13 * DIGITAL MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR 14 * ANY PURPOSE. IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. 15 * 16 * IF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT RIGHTS, 17 * APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN ADDITION TO THAT 18 * SET FORTH ABOVE. 19 * 20 * 21 * Permission to use, copy, modify, and distribute this software and its 22 * documentation for any purpose and without fee is hereby granted, provided 23 * that the above copyright notice appear in all copies and that both that 24 * copyright notice and this permission notice appear in supporting 25 * documentation, and that the name of Digital Equipment Corporation not be 26 * used in advertising or publicity pertaining to distribution of the software 27 * without specific, written prior permission. 28 */ 29 /* $XFree86: xc/programs/xedit/xedit.h,v 1.17 2002/10/06 17:11:39 paulo Exp $ */ 30 31 #include <stdio.h> 32 #include <time.h> 33 #include <X11/Intrinsic.h> 34 #include <X11/StringDefs.h> 35 #include <X11/cursorfont.h> 36 #include <X11/Xatom.h> 37 38 #include <X11/Xaw/Box.h> 39 #include <X11/Xaw/Command.h> 40 #include <X11/Xaw/Label.h> 41 #include <X11/Xaw/List.h> 42 #include <X11/Xaw/AsciiText.h> 43 #include <X11/Xaw/Paned.h> 44 #include <X11/Xaw/Viewport.h> 45 #include <X11/Xaw/Cardinals.h> 46 #include <X11/Xaw/SimpleMenu.h> 47 48 #include <X11/IntrinsicP.h> 49 #include <X11/Xaw/TextSinkP.h> /* for the property list definition */ 50 51 #include <X11/Xmu/SysUtil.h> 52 53 #define LSCAN(from, count, include) \ 54 XawTextSourceScan(source, from, XawstEOL, XawsdLeft, count, include) 55 #define RSCAN(from, count, include) \ 56 XawTextSourceScan(source, from, XawstEOL, XawsdRight, count, include) 57 58 typedef struct _xedit_hints { 59 char *resource; 60 unsigned long interval; 61 XtIntervalId timer; 62 char **hints; 63 unsigned num_hints; 64 unsigned cur_hint; 65 } xedit_hints; 66 67 typedef enum {NO_READ, READ_OK, WRITE_OK} FileAccess; 68 69 typedef struct _XeditLispData XeditLispData; 70 typedef struct _XeditTagsInfo XeditTagsInfo; 71 72 #define CHANGED_BIT 0x01 73 #define EXISTS_BIT 0x02 74 #define WRAP_BIT 0x10 75 typedef struct _xedit_flist_item { 76 Widget source, sme; 77 String name; 78 String filename; 79 int flags; 80 FileAccess file_access; 81 XawTextPosition display_position, insert_position; 82 int mode; 83 time_t mtime; 84 XawTextPropertyList *properties; 85 XawTextWrapMode wrap; 86 XeditLispData *xldata; 87 XeditTagsInfo *tags; 88 } xedit_flist_item; 89 90 extern struct _xedit_flist { 91 Widget popup; 92 Pixmap pixmap; 93 xedit_flist_item **itens; 94 xedit_flist_item *current, *other; 95 Cardinal num_itens; 96 } flist; 97 98 extern Widget options_popup; 99 100 extern struct _app_resources { 101 Boolean enableBackups; 102 char *backupNamePrefix; 103 char *backupNameSuffix; 104 xedit_hints hints; 105 char *changed_pixmap_name; 106 char *position_format; 107 char *auto_replace; 108 char *tagsName; 109 Boolean loadTags; 110 } app_resources; 111 112 extern Widget topwindow, textwindow, labelwindow, filenamewindow, messwidget; 113 extern Widget dirlabel, dirwindow; 114 extern Boolean international; 115 extern Boolean line_edit; 116 117 /* externals in xedit.c */ 118 void Feep(void); 119 120 /* externals in util.c */ 121 void XeditPrintf(const char *format, ...); 122 Widget MakeCommandButton(Widget, char*, XtCallbackProc); 123 Widget MakeStringBox(Widget, String, String); 124 String GetString(Widget); 125 FileAccess MaybeCreateFile(const char*), CheckFilePermissions(const char*, Boolean*); 126 xedit_flist_item *AddTextSource(Widget, const char *, const char *, int, FileAccess); 127 xedit_flist_item *FindTextSource(Widget, const char*); 128 Bool KillTextSource(xedit_flist_item*); 129 char *ResolveName(char*); 130 void DeleteWindow(Widget, XEvent*, String*, Cardinal*); 131 void SplitWindow(Widget, XEvent*, String*, Cardinal*); 132 void SwitchTextSource(xedit_flist_item*); 133 void PopupMenu(Widget, XEvent*, String*, Cardinal*); 134 void OtherWindow(Widget, XEvent*, String*, Cardinal*); 135 void SwitchSource(Widget, XEvent*, String*, Cardinal*); 136 void XeditFocus(Widget, XEvent*, String*, Cardinal*); 137 void SwitchDirWindow(Bool); 138 void DirWindow(Widget, XEvent*, String*, Cardinal*); 139 140 /* externs in commands.c */ 141 void DoQuit(Widget, XtPointer, XtPointer); 142 void QuitAction(Widget, XEvent*, String*, Cardinal*); 143 void DoSave(Widget, XtPointer, XtPointer); 144 void SaveFile(Widget, XEvent*, String*, Cardinal*); 145 void DoLoad(Widget, XtPointer, XtPointer); 146 void CancelFindFile(Widget, XEvent*, String*, Cardinal*); 147 void FindFile(Widget, XEvent*, String*, Cardinal*); 148 void LoadFile(Widget, XEvent*, String*, Cardinal*); 149 Bool LoadFileInTextwindow(char *name, char *resolved_name); 150 void FileCompletion(Widget, XEvent*, String*, Cardinal*); 151 void KillFile(Widget, XEvent*, String*, Cardinal*); 152 void DirWindowCB(Widget, XtPointer, XtPointer); 153 void SourceChanged(Widget, XtPointer, XtPointer); 154 155 /* externs in ispell.c */ 156 void IspellAction(Widget, XEvent*, String*, Cardinal*); 157 void IspellCallback(Widget, XtPointer, XtPointer); 158 159 /* externs in options.c */ 160 void CreateEditPopup(void); 161 void SetEditMenu(void); 162 void UpdateTextProperties(int); 163 164 /* externs in hook.c */ 165 Bool StartHooks(XtAppContext); 166 void LineEditAction(Widget, XEvent*, String*, Cardinal*); 167 void LineEdit(Widget); 168 169 /* externs in lisp.c */ 170 void XeditLispInitialize(void); 171 void XeditLispEval(Widget, XEvent*, String*, Cardinal*); 172 void XeditPrintLispEval(Widget, XEvent*, String*, Cardinal*); 173 void XeditKeyboardReset(Widget, XEvent*, String*, Cardinal*); 174 void XeditLispCleanUp(void); 175 void SetTextProperties(xedit_flist_item*); 176 void UnsetTextProperties(xedit_flist_item*); 177 void CreateEditModePopup(Widget); 178 void SetEditModeMenu(void); 179 180 /* tags.c */ 181 void TagsAction(Widget, XEvent*, String*, Cardinal*); 182 void SearchTagsFile(xedit_flist_item *item); 183 184 /* externs for system replacement functions */ 185 #ifdef NEED_STRCASECMP 186 int strcasecmp(const char *s1, const char *s2); 187 int strncasecmp(const char *s1, const char *s2, size_t n); 188 #endif 189 #ifdef NEED_REALPATH 190 #include <sys/param.h> 191 char *realpath(const char *pathname, char resolvedname[MAXPATHLEN]); 192 #endif 193 194