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 #ifndef NEDIT_NEDIT_H_INCLUDED
28 #define NEDIT_NEDIT_H_INCLUDED
29
30 #include "textBuf.h"
31 #include "textDisp.h"
32 #include <sys/types.h>
33
34 #include <X11/Intrinsic.h>
35 #include <Xm/Xm.h>
36 #include <Xm/XmStrDefs.h>
37 #include <X11/Xft/Xft.h>
38 #ifndef __MVS__
39 #include <sys/param.h>
40 #endif
41
42 #define NEDIT_VERSION 5
43 #define NEDIT_REVISION 7
44
45
46 #define NEDIT_DEFAULT_FG "black"
47 #define NEDIT_DEFAULT_TEXT_BG "rgb:e5/e5/e5"
48 #define NEDIT_DEFAULT_SEL_FG "black"
49 #define NEDIT_DEFAULT_SEL_BG "rgb:cc/cc/cc"
50 #define NEDIT_DEFAULT_HI_FG "white"
51 #define NEDIT_DEFAULT_HI_BG "red"
52 #define NEDIT_DEFAULT_LINENO_FG "black"
53 #define NEDIT_DEFAULT_LINENO_BG "#eff0f1"
54 #define NEDIT_DEFAULT_CURSOR_FG "black"
55 #define NEDIT_DEFAULT_HELP_FG "black"
56 #define NEDIT_DEFAULT_HELP_BG "rgb:cc/cc/cc"
57 #define NEDIT_DEFAULT_CURSOR_LINE_BG "rgb:ee/ee/ee"
58
59
60
61 #define SEARCHMAX 5119
62 #define MAX_SEARCH_HISTORY 100
63 #define MAX_PANES 6
64
65
66 #define AUTOSAVE_CHAR_LIMIT 30
67
68 #define AUTOSAVE_OP_LIMIT 8
69
70 #define MAX_FONT_LEN 100
71 #define MAX_COLOR_LEN 30
72 #define MAX_MARKS 36
73 #define MIN_LINE_NUM_COLS 4
74 #define APP_NAME GetAppName()
75 #define APP_CLASS "XNEdit"
76
77 #ifdef SGI_CUSTOM
78 #define MAX_SHORTENED_ITEMS 100
79 #endif
80
81 typedef enum {
NO_AUTO_INDENT,
AUTO_INDENT,
SMART_INDENT} IndentStyle;
82 typedef enum {
NO_WRAP,
NEWLINE_WRAP,
CONTINUOUS_WRAP} WrapStyle;
83 typedef enum {
NO_FLASH,
FLASH_DELIMIT,
FLASH_RANGE} ShowMatchingStyle;
84 enum virtKeyOverride {
VIRT_KEY_OVERRIDE_NEVER,
VIRT_KEY_OVERRIDE_AUTO,
85 VIRT_KEY_OVERRIDE_ALWAYS };
86
87
88
89 enum truncSubstitution {
TRUNCSUBST_SILENT,
TRUNCSUBST_FAIL,
TRUNCSUBST_WARN,
TRUNCSUBST_IGNORE};
90
91 #define NO_FLASH_STRING "off"
92 #define FLASH_DELIMIT_STRING "delimiter"
93 #define FLASH_RANGE_STRING "range"
94
95 #define CHARSET (XmStringCharSet)XmSTRING_DEFAULT_CHARSET
96
97 #define MKSTRING(string) \
98 XmStringCreateLtoR(string, XmSTRING_DEFAULT_CHARSET)
99
100 #define SET_ONE_RSRC(widget, name, newValue) \
101 { \
102 static Arg args[
1] = {{name, (XtArgVal)
0}}; \
103 args[
0].value = (XtArgVal)newValue; \
104 XtSetValues(widget, args,
1); \
105 }
106
107 #define GET_ONE_RSRC(widget, name, valueAddr) \
108 { \
109 static Arg args[
1] = {{name, (XtArgVal)
0}}; \
110 args[
0].value = (XtArgVal)valueAddr; \
111 XtGetValues(widget, args,
1); \
112 }
113
114
115 #define USER_LOCKED_BIT 0
116 #define PERM_LOCKED_BIT 1
117 #define TOO_MUCH_BINARY_DATA_LOCKED_BIT 2
118
119 #define ENCODING_ERROR_LOCKED_BIT 7
120
121 #define LOCKED_BIT_TO_MASK(bitNum) (
1 << (bitNum))
122 #define SET_LOCKED_BY_REASON(reasons, onOrOff, reasonBit) ((onOrOff) ? \
123 ((reasons) |=
LOCKED_BIT_TO_MASK(reasonBit)) : \
124 ((reasons) &= ~
LOCKED_BIT_TO_MASK(reasonBit)))
125
126 #define IS_USER_LOCKED(reasons) (((reasons) &
LOCKED_BIT_TO_MASK(
USER_LOCKED_BIT)) !=
0)
127 #define SET_USER_LOCKED(reasons, onOrOff)
SET_LOCKED_BY_REASON(reasons, onOrOff,
USER_LOCKED_BIT)
128 #define IS_PERM_LOCKED(reasons) (((reasons) &
LOCKED_BIT_TO_MASK(
PERM_LOCKED_BIT)) !=
0)
129 #define SET_PERM_LOCKED(reasons, onOrOff)
SET_LOCKED_BY_REASON(reasons, onOrOff,
PERM_LOCKED_BIT)
130 #define IS_TMBD_LOCKED(reasons) (((reasons) &
LOCKED_BIT_TO_MASK(
TOO_MUCH_BINARY_DATA_LOCKED_BIT)) !=
0)
131 #define SET_TMBD_LOCKED(reasons, onOrOff)
SET_LOCKED_BY_REASON(reasons, onOrOff,
TOO_MUCH_BINARY_DATA_LOCKED_BIT)
132
133 #define IS_ENCODING_LOCKED(reasons) (((reasons) &
LOCKED_BIT_TO_MASK(
ENCODING_ERROR_LOCKED_BIT)) !=
0)
134 #define SET_ENCODING_LOCKED(reasons, onOrOff)
SET_LOCKED_BY_REASON(reasons, onOrOff,
ENCODING_ERROR_LOCKED_BIT)
135
136 #define IS_ANY_LOCKED_IGNORING_USER(reasons) (((reasons) & ~
LOCKED_BIT_TO_MASK(
USER_LOCKED_BIT) & ~
LOCKED_BIT_TO_MASK(
ENCODING_ERROR_LOCKED_BIT)) !=
0)
137 #define IS_ANY_LOCKED_IGNORING_PERM(reasons) (((reasons) & ~
LOCKED_BIT_TO_MASK(
PERM_LOCKED_BIT) & ~
LOCKED_BIT_TO_MASK(
ENCODING_ERROR_LOCKED_BIT)) !=
0)
138 #define IS_ANY_LOCKED(reasons) ((reasons) !=
0)
139 #define CLEAR_ALL_LOCKS(reasons) ((reasons) =
0)
140
141
142 #define TYPE_INT_STR_SIZE(xType) ((
sizeof(xType) *
3) +
2)
143
144
145 #define MAX_ENCODING_LENGTH 64
146
147
148 #define DISABLE_WRAPPING_THRESHOLD 0xA00000
149
150
151 #define DISABLE_LANG_THRESHOLD 0x8000000
152
153
154 #ifndef ENABLE_COLORPROFILES
155 #define DISABLE_COLORPROFILES
156 #endif
157
158
159 typedef struct _UndoInfo {
160 struct _UndoInfo *next;
161 int type;
162 int startPos;
163 int endPos;
164 int oldLen;
165 char *oldText;
166 short numOp;
167
168
169 char inUndo;
170
171
172
173
174 char restoresToSaved;
175
176
177 } UndoInfo;
178
179
180 typedef struct {
181 char label;
182 int cursorPos;
183 selection sel;
184 } Bookmark;
185
186
187 enum colorTypes {
188 TEXT_FG_COLOR,
189 TEXT_BG_COLOR,
190 SELECT_FG_COLOR,
191 SELECT_BG_COLOR,
192 HILITE_FG_COLOR,
193 HILITE_BG_COLOR,
194 LINENO_FG_COLOR,
195 LINENO_BG_COLOR,
196 CURSOR_FG_COLOR,
197 CURSOR_LINE_BG_COLOR,
198 NUM_COLORS
199 };
200
201
202 typedef enum {
203 UMMM_UNMANAGE,
204 UMMM_UNMANAGE_ALL,
205
206
207 UMMM_MANAGE,
208
209
210 UMMM_MANAGE_ALL
211
212 } UserMenuManageMode;
213
214
215 typedef struct _UserMenuListElement {
216 UserMenuManageMode umleManageMode;
217 UserMenuManageMode umlePrevManageMode;
218 char *umleAccKeys;
219 Boolean umleAccLockPatchApplied;
220
221 Widget umleMenuItem;
222
223 Widget umleSubMenuPane;
224
225 struct _UserMenuList *umleSubMenuList;
226
227 } UserMenuListElement;
228
229
230 typedef struct _UserMenuList {
231 int umlNbrItems;
232 UserMenuListElement **umlItems;
233 } UserMenuList;
234
235
236
237
238 typedef struct _UserMenuCache {
239 int umcLanguageMode;
240
241 Boolean umcShellMenuCreated;
242
243 Boolean umcMacroMenuCreated;
244
245 UserMenuList umcShellMenuList;
246 UserMenuList umcMacroMenuList;
247 } UserMenuCache;
248
249
250
251
252 typedef struct _UserBGMenuCache {
253 int ubmcLanguageMode;
254
255 Boolean ubmcMenuCreated;
256
257 UserMenuList ubmcMenuList;
258 } UserBGMenuCache;
259
260
261
262
263 typedef struct _EncError {
264 size_t pos;
265 int c;
266 } EncError;
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287 typedef struct _WindowInfo {
288 struct _WindowInfo *next;
289 Widget shell;
290 Widget mainWin;
291 Widget splitPane;
292 Widget textArea;
293 Widget textPanes[
MAX_PANES];
294 Widget lastFocus;
295 Widget statsLine;
296 Widget statsLineForm;
297 Widget statsLineColNo;
298 Widget iSearchForm;
299 Widget iSearchFindButton;
300 Widget iSearchText;
301 Widget iSearchClearButton;
302 Widget iSearchRegexToggle;
303 Widget iSearchCaseToggle;
304 Widget iSearchRevToggle;
305 Widget encodingInfoBar;
306 Widget encInfoBarLabel;
307 Widget encInfoErrorList;
308 Widget encInfoBarList;
309 Widget menuBar;
310 Widget tabBar;
311 Widget tab;
312 Widget replaceDlog;
313 Widget replaceText;
314 Widget replaceWithText;
315 Widget replaceCaseToggle;
316 Widget replaceWordToggle;
317 Widget replaceRegexToggle;
318 Widget replaceRevToggle;
319 Widget replaceKeepBtn;
320 Widget replaceBtns;
321 Widget replaceBtn;
322 Widget replaceAllBtn;
323 #ifndef REPLACE_SCOPE
324 Widget replaceInWinBtn;
325 Widget replaceInSelBtn;
326 #endif
327 Widget replaceSearchTypeBox;
328 Widget replaceFindBtn;
329 Widget replaceAndFindBtn;
330 Widget findDlog;
331 Widget findText;
332 Widget findCaseToggle;
333 Widget findWordToggle;
334 Widget findRegexToggle;
335 Widget findRevToggle;
336 Widget findKeepBtn;
337 Widget findBtns;
338 Widget findBtn;
339 Widget findSearchTypeBox;
340 Widget replaceMultiFileDlog;
341 Widget replaceMultiFileList;
342 Widget replaceMultiFilePathBtn;
343 Widget fontDialog;
344 void *colorDialog;
345 Widget readOnlyItem;
346 Widget autoSaveItem;
347 Widget saveLastItem;
348 Widget openSelItem;
349 Widget newOppositeItem;
350 Widget closeItem;
351 Widget printSelItem;
352 Widget undoItem;
353 Widget redoItem;
354 Widget cutItem;
355 Widget delItem;
356 Widget copyItem;
357 Widget lowerItem;
358 Widget upperItem;
359 Widget findSelItem;
360 Widget findAgainItem;
361 Widget replaceFindAgainItem;
362 Widget replaceAgainItem;
363 Widget gotoSelItem;
364 Widget colorProfileMenuPane;
365 Widget langModeCascade;
366 Widget findDefItem;
367 Widget showTipItem;
368 Widget autoIndentOffItem;
369 Widget autoIndentItem;
370 Widget smartIndentItem;
371 Widget noWrapItem;
372 Widget newlineWrapItem;
373 Widget continuousWrapItem;
374 Widget statsLineItem;
375 Widget iSearchLineItem;
376 Widget lineNumsItem;
377 Widget showMatchingOffItem;
378 Widget showMatchingDelimitItem;
379 Widget showMatchingRangeItem;
380 Widget matchSyntaxBasedItem;
381 Widget overtypeModeItem;
382 Widget resetZoomItem;
383 Widget highlightItem;
384 Widget windowMenuPane;
385 Widget shellMenuPane;
386 Widget macroMenuPane;
387 Widget bgMenuPane;
388 Widget tabMenuPane;
389 Widget prevOpenMenuPane;
390 Widget prevOpenMenuItem;
391 Widget unloadTagsMenuPane;
392 Widget unloadTagsMenuItem;
393 Widget unloadTipsMenuPane;
394 Widget unloadTipsMenuItem;
395 Widget filterItem;
396 Widget autoIndentOffDefItem;
397 Widget autoIndentDefItem;
398 Widget smartIndentDefItem;
399 Widget autoSaveDefItem;
400 Widget saveLastDefItem;
401 Widget noWrapDefItem;
402 Widget newlineWrapDefItem;
403 Widget contWrapDefItem;
404 Widget showMatchingOffDefItem;
405 Widget showMatchingDelimitDefItem;
406 Widget showMatchingRangeDefItem;
407 Widget matchSyntaxBasedDefItem;
408 Widget highlightOffDefItem;
409 Widget highlightDefItem;
410 Widget highlightCursorLineItem;
411 Widget indentRainbowItem;
412 Widget ansiColorsItem;
413 Widget backlightCharsItem;
414 Widget backlightCharsDefItem;
415 Widget highlightCursorLineDefItem;
416 Widget indentRainbowDefItem;
417 Widget ansiColorsDefItem;
418 Widget searchDlogsDefItem;
419 Widget beepOnSearchWrapDefItem;
420 Widget keepSearchDlogsDefItem;
421 Widget saveSearchHistoryDefItem;
422 Widget searchWrapsDefItem;
423 Widget appendLFItem;
424 Widget sortOpenPrevDefItem;
425 Widget allTagsDefItem;
426 Widget smartTagsDefItem;
427 Widget reposDlogsDefItem;
428 Widget autoScrollDefItem;
429 Widget editorConfigDefItem;
430 Widget lockEncodingErrorDefItem;
431 Widget openInTabDefItem;
432 Widget tabBarDefItem;
433 Widget tabBarHideDefItem;
434 Widget toolTipsDefItem;
435 Widget tabNavigateDefItem;
436 Widget tabSortDefItem;
437 Widget statsLineDefItem;
438 Widget iSearchLineDefItem;
439 Widget lineNumsDefItem;
440 Widget pathInWindowsMenuDefItem;
441 Widget modWarnDefItem;
442 Widget modWarnRealDefItem;
443 Widget exitWarnDefItem;
444 Widget searchLiteralDefItem;
445 Widget searchCaseSenseDefItem;
446 Widget searchLiteralWordDefItem;
447 Widget searchCaseSenseWordDefItem;
448 Widget searchRegexNoCaseDefItem;
449 Widget searchRegexDefItem;
450 #ifdef REPLACE_SCOPE
451 Widget replScopeWinDefItem;
452 Widget replScopeSelDefItem;
453 Widget replScopeSmartDefItem;
454 #endif
455 Widget size24x80DefItem;
456 Widget size40x80DefItem;
457 Widget size60x80DefItem;
458 Widget size80x80DefItem;
459 Widget sizeCustomDefItem;
460 Widget cancelShellItem;
461 Widget learnItem;
462 Widget finishLearnItem;
463 Widget cancelMacroItem;
464 Widget replayItem;
465 Widget repeatItem;
466 Widget splitPaneItem;
467 Widget closePaneItem;
468 Widget detachDocumentItem;
469 Widget moveDocumentItem;
470 Widget contextMoveDocumentItem;
471 Widget contextDetachDocumentItem;
472 Widget bgMenuUndoItem;
473 Widget bgMenuRedoItem;
474 #ifdef SGI_CUSTOM
475 Widget shortMenusDefItem;
476 Widget toggleShortItems[
MAX_SHORTENED_ITEMS];
477
478
479 int nToggleShortItems;
480 #endif
481 char filename[
MAXPATHLEN];
482 char path[
MAXPATHLEN];
483 char encoding[
MAX_ENCODING_LENGTH];
484 char *filter;
485 Boolean bom;
486 unsigned fileMode;
487 uid_t fileUid;
488 gid_t fileGid;
489 int fileFormat;
490
491
492 time_t lastModTime;
493 dev_t device;
494 ino_t inode;
495 UndoInfo *undo;
496 UndoInfo *redo;
497 UndoInfo *undo_batch_begin;
498 int undo_batch_count;
499 int undo_op_batch_size;
500 textBuffer *buffer;
501 int nPanes;
502
503 int autoSaveCharCount;
504
505 int autoSaveOpCount;
506 int undoOpCount;
507 int undoMemUsed;
508
509 char fontName[
MAX_FONT_LEN];
510 char italicFontName[
MAX_FONT_LEN];
511 char boldFontName[
MAX_FONT_LEN];
512 char boldItalicFontName[
MAX_FONT_LEN];
513
514 int zoom;
515
516 NFont *font;
517 NFont *italicFont;
518 NFont *boldFont;
519 NFont *boldItalicFont;
520
521 ColorProfile *colorProfile;
522
523 Boolean resizeOnFontChange;
524
525 EncError *encErrors;
526 size_t numEncErrors;
527 size_t posEncErrors;
528
529 XtIntervalId flashTimeoutID;
530
531
532 int flashPos;
533
534 int wasSelected;
535
536 Boolean filenameSet;
537 Boolean fileChanged;
538 Boolean fileMissing;
539 int lockReasons;
540 Boolean autoSave;
541 Boolean saveOldVersion;
542 IndentStyle indentStyle;
543 WrapStyle wrapMode;
544
545 Boolean overstrike;
546 ShowMatchingStyle showMatchingStyle;
547
548
549 char matchSyntaxBased;
550 Boolean showStats;
551 Boolean showISearchLine;
552 Boolean showLineNumbers;
553 Boolean showInfoBar;
554 Boolean highlightSyntax;
555 Boolean backlightChars;
556 Boolean highlightCursorLine;
557 char *backlightCharTypes;
558 Boolean indentRainbow;
559 char *indentRainbowColors;
560 Boolean ansiColors;
561 XftColor ansiColorList[
16];
562
563 Boolean modeMessageDisplayed;
564
565 char *modeMessage;
566
567 Boolean ignoreModify;
568 Boolean windowMenuValid;
569 int rHistIndex, fHistIndex;
570 int iSearchHistIndex;
571 int iSearchStartPos;
572 int iSearchLastBeginPos;
573 int nMarks;
574 XtIntervalId markTimeoutID;
575 Bookmark markTable[
MAX_MARKS];
576 void *highlightData;
577 void *shellCmdData;
578
579 void *macroCmdData;
580 Boolean macroBlocking;
581 void *smartIndentData;
582 Atom fileClosedAtom;
583 int languageMode;
584
585 Boolean multiFileReplSelected;
586
587 struct _WindowInfo**
588 writableWindows;
589 int nWritableWindows;
590 Bool multiFileBusy;
591
592 Bool replaceFailed;
593
594 Bool replaceLastRegexCase;
595
596 Bool replaceLastLiteralCase;
597 Bool iSearchLastRegexCase;
598
599 Bool iSearchLastLiteralCase;
600 Bool findLastRegexCase;
601 Bool findLastLiteralCase;
602
603 #ifdef REPLACE_SCOPE
604 int replaceScope;
605 Widget replaceScopeWinToggle;
606 Widget replaceScopeSelToggle;
607 Widget replaceScopeMultiToggle;
608 #endif
609 UserMenuCache *userMenuCache;
610 UserBGMenuCache userBGMenuCache;
611
612
613 Boolean wrapModeNoneForced;
614
615 Boolean opened;
616 Boolean mapped;
617 } WindowInfo;
618
619 extern WindowInfo *WindowList;
620 extern Display *TheDisplay;
621 extern Widget TheAppShell;
622 extern char *ArgV0;
623 extern Boolean IsServer;
624
625 char* GetAppName(
void);
626
627 int XNEditDefaultCharsetIsUTF8(
void);
628
629 XrmDatabase GetDefaultResourceDB(
void);
630
631 #endif
632