summaryrefslogtreecommitdiff
path: root/xedit.h
blob: 88cec65e9bdb26f4f09c0fad4f8b12c1eb41c528 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
/*
 *	rcs_id[] = "$XConsortium: xedit.h,v 1.19 89/10/07 14:59:46 kit Exp $";
 */
 
/*
 *			  COPYRIGHT 1987
 *		   DIGITAL EQUIPMENT CORPORATION
 *		       MAYNARD, MASSACHUSETTS
 *			ALL RIGHTS RESERVED.
 *
 * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND
 * SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION.
 * DIGITAL MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR
 * ANY PURPOSE.  IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
 *
 * IF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT RIGHTS,
 * APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN ADDITION TO THAT
 * SET FORTH ABOVE.
 *
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose and without fee is hereby granted, provided
 * that the above copyright notice appear in all copies and that both that
 * copyright notice and this permission notice appear in supporting
 * documentation, and that the name of Digital Equipment Corporation not be 
 * used in advertising or publicity pertaining to distribution of the software
 * without specific, written prior permission.
 */
/* $XFree86: xc/programs/xedit/xedit.h,v 1.17 2002/10/06 17:11:39 paulo Exp $ */

#include <stdio.h>
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/cursorfont.h>
#include <X11/Xatom.h>

#include <X11/Xaw/Box.h>
#include <X11/Xaw/Command.h>
#include <X11/Xaw/Label.h>
#include <X11/Xaw/List.h>
#include <X11/Xaw/AsciiText.h>
#include <X11/Xaw/Paned.h>
#include <X11/Xaw/Viewport.h>
#include <X11/Xaw/Cardinals.h>
#include <X11/Xaw/SimpleMenu.h>

#include <X11/IntrinsicP.h>
#include <X11/Xaw/TextSinkP.h>		/* for the property list definition */

#include <X11/Xmu/SysUtil.h>

typedef struct _xedit_hints {
    char *resource;
    unsigned long interval;
    XtIntervalId timer;
    char **hints;
    unsigned num_hints;
    unsigned cur_hint;
} xedit_hints;

typedef enum {NO_READ, READ_OK, WRITE_OK} FileAccess;

typedef struct _XeditLispData XeditLispData;

#define CHANGED_BIT	0x01
#define EXISTS_BIT	0x02
#define WRAP_BIT	0x10
typedef struct _xedit_flist_item {
    Widget source, sme;
    String name;
    String filename;
    int flags;
    FileAccess file_access;
    XawTextPosition display_position, insert_position;
    int mode;
    XawTextPropertyList *properties;
    XawTextWrapMode wrap;
    XeditLispData *xldata;
} xedit_flist_item;

extern struct _xedit_flist {
    Widget popup;
    Pixmap pixmap;
    xedit_flist_item **itens;
    xedit_flist_item *current, *other;
    Cardinal num_itens;
} flist;

extern Widget options_popup;

extern struct _app_resources {
    Boolean enableBackups;
    char *backupNamePrefix;
    char *backupNameSuffix;
    xedit_hints hints;
    char *changed_pixmap_name;
    char *position_format;
    char *auto_replace;
} app_resources;

extern Widget topwindow, textwindow, labelwindow, filenamewindow, messwidget;
extern Widget dirlabel, dirwindow;
extern Boolean line_edit;

/*	externals in xedit.c 	*/
void Feep(void);

/*	externals in util.c 	*/
void XeditPrintf(char*);
Widget MakeCommandButton(Widget, char*, XtCallbackProc);
Widget MakeStringBox(Widget, String, String);
String GetString(Widget);
FileAccess MaybeCreateFile(char*), CheckFilePermissions(char*, Boolean*);
xedit_flist_item *AddTextSource(Widget, String, String, int, FileAccess);
xedit_flist_item *FindTextSource(Widget, char*);
Bool KillTextSource(xedit_flist_item*);
char *ResolveName(char*);
void DeleteWindow(Widget, XEvent*, String*, Cardinal*);
void SplitWindow(Widget, XEvent*, String*, Cardinal*);
void SwitchTextSource(xedit_flist_item*);
void PopupMenu(Widget, XEvent*, String*, Cardinal*);
void OtherWindow(Widget, XEvent*, String*, Cardinal*);
void SwitchSource(Widget, XEvent*, String*, Cardinal*);
void XeditFocus(Widget, XEvent*, String*, Cardinal*);
void SwitchDirWindow(Bool);
void DirWindow(Widget, XEvent*, String*, Cardinal*);

/*	externs in commands.c 	*/
void DoQuit(Widget, XtPointer, XtPointer);
void QuitAction(Widget, XEvent*, String*, Cardinal*);
void DoSave(Widget, XtPointer, XtPointer);
void SaveFile(Widget, XEvent*, String*, Cardinal*);
void DoLoad(Widget, XtPointer, XtPointer);
void DoPrint(Widget, XtPointer, XtPointer);
void CancelFindFile(Widget, XEvent*, String*, Cardinal*);
void FindFile(Widget, XEvent*, String*, Cardinal*);
void LoadFile(Widget, XEvent*, String*, Cardinal*);
void PrintFile(Widget, XEvent*, String*, Cardinal*);
void FileCompletion(Widget, XEvent*, String*, Cardinal*);
void KillFile(Widget, XEvent*, String*, Cardinal*);
void DirWindowCB(Widget, XtPointer, XtPointer);
void SourceChanged(Widget, XtPointer, XtPointer);

/*	externs in ispell.c	*/
void IspellAction(Widget, XEvent*, String*, Cardinal*);
void IspellCallback(Widget, XtPointer, XtPointer);

/*	externs in options.c	*/
void CreateEditPopup(void);
void SetEditMenu(void);
void UpdateTextProperties(int);

/*	externs in hook.c	*/
Bool StartHooks(XtAppContext);
void LineEditAction(Widget, XEvent*, String*, Cardinal*);
void LineEdit(Widget);

/*	externs in lisp.c	*/
void XeditLispInitialize(void);
void XeditLispEval(Widget, XEvent*, String*, Cardinal*);
void XeditPrintLispEval(Widget, XEvent*, String*, Cardinal*);
void XeditKeyboardReset(Widget, XEvent*, String*, Cardinal*);
void XeditLispCleanUp(void);
void SetTextProperties(xedit_flist_item*);
void UnsetTextProperties(xedit_flist_item*);
void CreateEditModePopup(Widget);
void SetEditModeMenu(void);

/*	externs for system replacement functions */
#ifdef NEED_STRCASECMP
int strcasecmp(const char *s1, const char *s2);
int strncasecmp(const char *s1, const char *s2, size_t n);
#endif
#ifdef NEED_REALPATH
#include <sys/param.h>
#if defined(ISC)
#ifndef MAXPATHLEN
#define MAXPATHLEN      1024
#endif
#endif
char *realpath(const char *pathname, char resolvedname[MAXPATHLEN]);
#endif