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
58typedef 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
67typedef enum {NO_READ, READ_OK, WRITE_OK} FileAccess;
68
69typedef struct _XeditLispData XeditLispData;
70typedef struct _XeditTagsInfo XeditTagsInfo;
71
72#define CHANGED_BIT	0x01
73#define EXISTS_BIT	0x02
74#define WRAP_BIT	0x10
75typedef 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
90extern 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
98extern Widget options_popup;
99
100extern 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
112extern Widget topwindow, textwindow, labelwindow, filenamewindow, messwidget;
113extern Widget dirlabel, dirwindow;
114extern Boolean international;
115extern Boolean line_edit;
116
117/*	externals in xedit.c 	*/
118void Feep(void);
119
120/*	externals in util.c 	*/
121void XeditPrintf(const char *format, ...);
122Widget MakeCommandButton(Widget, char*, XtCallbackProc);
123Widget MakeStringBox(Widget, String, String);
124String GetString(Widget);
125FileAccess MaybeCreateFile(const char*), CheckFilePermissions(const char*, Boolean*);
126xedit_flist_item *AddTextSource(Widget, const char *, const char *, int, FileAccess);
127xedit_flist_item *FindTextSource(Widget, const char*);
128Bool KillTextSource(xedit_flist_item*);
129char *ResolveName(char*);
130void DeleteWindow(Widget, XEvent*, String*, Cardinal*);
131void SplitWindow(Widget, XEvent*, String*, Cardinal*);
132void SwitchTextSource(xedit_flist_item*);
133void PopupMenu(Widget, XEvent*, String*, Cardinal*);
134void OtherWindow(Widget, XEvent*, String*, Cardinal*);
135void SwitchSource(Widget, XEvent*, String*, Cardinal*);
136void XeditFocus(Widget, XEvent*, String*, Cardinal*);
137void SwitchDirWindow(Bool);
138void DirWindow(Widget, XEvent*, String*, Cardinal*);
139
140/*	externs in commands.c 	*/
141void DoQuit(Widget, XtPointer, XtPointer);
142void QuitAction(Widget, XEvent*, String*, Cardinal*);
143void DoSave(Widget, XtPointer, XtPointer);
144void SaveFile(Widget, XEvent*, String*, Cardinal*);
145void DoLoad(Widget, XtPointer, XtPointer);
146void CancelFindFile(Widget, XEvent*, String*, Cardinal*);
147void FindFile(Widget, XEvent*, String*, Cardinal*);
148void LoadFile(Widget, XEvent*, String*, Cardinal*);
149Bool LoadFileInTextwindow(char *name, char *resolved_name);
150void FileCompletion(Widget, XEvent*, String*, Cardinal*);
151void KillFile(Widget, XEvent*, String*, Cardinal*);
152void DirWindowCB(Widget, XtPointer, XtPointer);
153void SourceChanged(Widget, XtPointer, XtPointer);
154
155/*	externs in ispell.c	*/
156void IspellAction(Widget, XEvent*, String*, Cardinal*);
157void IspellCallback(Widget, XtPointer, XtPointer);
158
159/*	externs in options.c	*/
160void CreateEditPopup(void);
161void SetEditMenu(void);
162void UpdateTextProperties(int);
163
164/*	externs in hook.c	*/
165Bool StartHooks(XtAppContext);
166void LineEditAction(Widget, XEvent*, String*, Cardinal*);
167void LineEdit(Widget);
168
169/*	externs in lisp.c	*/
170void XeditLispInitialize(void);
171void XeditLispEval(Widget, XEvent*, String*, Cardinal*);
172void XeditPrintLispEval(Widget, XEvent*, String*, Cardinal*);
173void XeditKeyboardReset(Widget, XEvent*, String*, Cardinal*);
174void XeditLispCleanUp(void);
175void SetTextProperties(xedit_flist_item*);
176void UnsetTextProperties(xedit_flist_item*);
177void CreateEditModePopup(Widget);
178void SetEditModeMenu(void);
179
180/* tags.c */
181void TagsAction(Widget, XEvent*, String*, Cardinal*);
182void SearchTagsFile(xedit_flist_item *item);
183
184/*	externs for system replacement functions */
185#ifdef NEED_STRCASECMP
186int strcasecmp(const char *s1, const char *s2);
187int strncasecmp(const char *s1, const char *s2, size_t n);
188#endif
189#ifdef NEED_REALPATH
190#include <sys/param.h>
191char *realpath(const char *pathname, char resolvedname[MAXPATHLEN]);
192#endif
193
194