1 /* asedit.h - the main include file for the asedit program,
2 		(C) A.Stochniol, 1991-1994
3 		Note: that for asedit 1.2 type of the data in the as_menuh_struct
4 		was changed from "XtPointer" to int
5 		& asClientDataStruct was introduced
6 */
7 /*
8  * Copyright 1991 - 1994,  Andrzej Stochniol, London, UK
9  *
10  * ASEDIT text editor, both binary and source (hereafter, Software) is
11  * copyrighted by Andrzej Stochniol (hereafter, AS) and ownership remains
12  * with AS.
13  *
14  * AS grants you (hereafter, Licensee) a license to use the Software
15  * for academic, research and internal business purposes only, without a
16  * fee.  Licensee may distribute the binary and source code (if released)
17  * to third parties provided that the copyright notice and this statement
18  * appears on all copies and that no charge is associated with such copies.
19  *
20  * Licensee may make derivative works.  However, if Licensee distributes
21  * any derivative work based on or derived from the Software, then
22  * Licensee will:
23  * (1) notify AS regarding its distribution of the derivative work, and
24  * (2) clearly notify users that such derivative work is a modified version
25  *      and not the original ASEDIT distributed by AS.
26  *
27  * Any Licensee wishing to make commercial use of the Software should
28  * contact AS to negotiate an appropriate license for such commercial use.
29  * Commercial use includes:
30  * (1) integration of all or part of the source code into a product for sale
31  *     or license by or on behalf of Licensee to third parties, or
32  * (2) distribution of the binary code or source code to third parties that
33  *     need it to utilize a commercial product sold or licensed by or on
34  *     behalf of Licensee.
35  *
36  * A. STOCHNIOL MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS
37  * SOFTWARE FOR ANY PURPOSE.  IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR
38  * IMPLIED WARRANTY.  IN NO EVENT SHALL A. STOCHNIOL BE LIABLE FOR ANY
39  * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
40  * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
41  * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
42  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
43  *
44  * By using or copying this Software, Licensee agrees to abide by the
45  * copyright law and all other applicable laws, and the terms of this
46  * license.
47  * AS shall have the right to terminate this license immediately by
48  * written notice upon Licensee's breach of, or non-compliance with, any
49  * of its terms.  Licensee may be held legally responsible for any
50  * copyright infringement that is caused or encouraged by Licensee's
51  * failure to abide by the terms of this license.
52  *
53  *
54  * 	Andrzej Stochniol	(A.Stochniol@ic.ac.uk)
55  * 	30 Hatch Road
56  * 	London SW16 4PN
57  * 	UK
58  */
59 
60 #ifndef _asedit_h
61 #define _asedit_h
62 
63 #include <Xm/Xm.h>
64 
65 typedef struct _as_menuh_struct{
66    char*                  name;           /* name of the button */
67    void                  (*func)();       /* Callback to be invoked */
68    void                  (*helpCB)();     /* help Callback to be invoked */
69    int	                  data;           /* Data (id) for the callback (transformed with mk_asdat) */
70    unsigned int mnemonic;		  /* mnemonic for the button */
71    char*		  acceleratorText;  /* text of the accelerator ... */
72    char*		  accelerator;	    /* accelerator itself (in a special X11 format) */
73    struct _as_menuh_struct *sub_menu;       /* data for submenu of this button */
74    int                    n_sub_items;    /* How many items in sub_menu */
75    char                  *sub_menu_title; /* Title of submenu */
76    Widget		  w;		  /* pointer to the created widget button */
77  } as_menuh_struct;
78 
79 /* definition of undo/redo data structures */
80 /* size of the undo/redo stacks*/
81 #if (XmVersion >= 1002)
82 #   define EditSTACK_SIZE          500
83 #else
84 #   define EditSTACK_SIZE          250
85 #endif
86 
87 /* in Motif XmTextBlock's are used to pass text around and the internal
88    structure is as follow
89   typedef struct {
90     char *ptr;                  |* Pointer to data. *|
91     int length;                 |* Number of bytes of data. *|
92     XmTextFormat format;        |* Representation format. *|
93   } XmTextBlockRec, *XmTextBlock;
94 */
95 
96 typedef struct
97 {
98    int reason;
99    long currInsert, newInsert;
100    long startPos, endPos;
101    char *del_text, *ins_text;
102    Boolean undo_sequence, redo_sequence;
103 }  EditAction, *EditActionPtr;
104 
105 typedef struct
106 {
107    int          bottom;                 /* bootom (head) of the stack */
108    int          top;                    /* top (tail) of the stack */
109    EditActionPtr el[EditSTACK_SIZE];    /* pointers to stack elements */
110 }  EditStack;
111 
112 #define MAX_TABSIZE	    32
113 #define MAX_SEL_TOOLS	    10
114 
115 
116 
117 /* define data structure to hold some static information for
118    Search|Change|Change All sequence
119 */
120 
121 typedef struct
122 {
123     Boolean searchForward;		/* search direction */
124     Boolean caseSensitive;
125     Boolean wholeWordsOnly;
126     int itemsChanged;
127     long startPosition;	/* it remembers the starting position
128 			and it is used to detect that the change has been finished;
129 			this value is updated to take into account replacement
130 			with different length of the new string */
131 
132 }  ChangeAllPar;
133 
134 /* define data structure to hold some static information for
135    Search|Change or Search|Find and continue search cases
136 */
137 
138 typedef struct
139 {
140     Boolean forward;			/* search direction */
141     Boolean on;				/* used to show that standard
142 				continuation is taking place as opposite
143 				to ChangeAll continuation */
144     long startPosition;	/* it remembers the starting position */
145 
146 }  ContinueSearchPar;
147 
148 /* we support total number of TOTAL_MARKS bookmarks */
149 #define TOTAL_MARKS	10
150 
151 /* define data structure that contains all information for one, fully
152    functioning, self contained asedit window
153  */
154 typedef struct aseditWindowStruct
155 {
156 
157   Widget menu_bar;		/* menu_bar, used as a parent for dialogs */
158   Widget topshell;		/* top level shell for that asedit window */
159 
160   Widget edit_text;
161   Widget edit_text1;		/* multi-line main editable text widget	    */
162 
163   Widget frame_bottom;         /*  Frame       */
164 
165   Widget menu_cut_button;      /* some menu_... widgets follows:		*/
166   Widget menu_copy_button;	/*   they represent buttons in the pull-down menus */
167   Widget menu_paste_button;	/*   that must be globally accessible (to change   */
168   Widget menu_clear_button;	/*   their sensitivity etc. )			 */
169   Widget menu_undo_button;
170   Widget menu_redo_button;
171 
172   Widget menu_save_button;
173   Widget menu_save_as_button;
174   Widget menu_close_button;
175   Widget menu_insert_button;
176   Widget menu_print_button;
177 
178   Widget menu_find_button;
179   Widget menu_replace_button;
180   Widget menu_find_again_button;
181   Widget menu_gotoline_button;
182   Widget menu_mark_button;
183   Widget menu_match_button;
184 
185   Widget open_dialog;		/* file selection dialog used to open a file	*/
186   Widget save_as_dialog;		/* save as prompt dialog	 	    */
187   Widget save_changes_dialog;	/* question if save file before opening a new one,
188 				   starting a new one, closing the file or exiting the
189 				   program, asked when the changes has not been saved */
190   Widget insert_dialog;		/* insert dialog (NEW in 1.2) */
191   Widget print_dialog;		/* print dialog (NEW in 1.2) */
192   Widget overwrite_question;	/* question if write over an existing file for save as option */
193   Widget error_message;		/* general error message; should be accessed
194 				   via show_error_message procedure */
195 
196   Widget gotoline_dialog;	/* go to line prompt dialog 			*/
197   Widget replace_dialog;	/* replace (change) 4-buttons prompt dialog;
198 				   the same dialog after dynamic changes
199 				   is used for the find dialog 	*/
200   Widget change_prompt;		/* prompt for change action: Change | Skip | Cancel | Help */
201   Widget continue_search_question;/* a widget to pop-up when the end or the beginning of
202 				   the file has been reached during the search */
203   Widget search_end_message;	/* message about end of the search */
204 
205   Widget help_dialog;		/* hypertext on-line help */
206   Widget about_program_message;	/* widget with the message about the program*/
207 
208   Widget changes_status;	/* widget displaying a star when file has been changed */
209   Widget line_number;		/* widget displaying line number */
210   Widget column_number;		/* widget displaying column number */
211 
212 
213   Widget text_to_find;		/* following 8 widgets are initialized in CreateReplaceDialog */
214   Widget new_text_title;
215   Widget new_text;
216   Widget case_sensitive_toggle;
217   Widget whole_words_only_toggle;
218   Widget forward_toggle;
219   Widget change_all_button;
220   Widget change_verify_button;
221   Widget cancel_replace_dialog_button;
222 
223   Widget view_only_toggle;
224 
225 
226   Widget menu_spell_button;		/* spell button (in the pulldown menu) */
227   Widget menu_commands_button;		/* tool's commands button */
228   Widget toolsSelNeeded[MAX_SEL_TOOLS];	/* menu buttons that need selection to be active */
229   int    nToolsSelNeeded;		/* numbers of the above */
230 
231   int		tabsize;	/* current tab size value */
232 
233   Widget moveLeft_dialog;
234   Widget moveRight_dialog;
235   Widget indentWith_dialog;
236   Widget reformat_dialog;
237   Widget left_margin;
238   Widget right_margin;
239 
240   Widget quick_access_popup;
241   Widget popup_undo_button;
242   Widget popup_cut_button;
243   Widget popup_copy_button;
244   Widget popup_paste_button;
245   Widget popup_save_button;
246 
247   Widget filter_dialog;
248   Widget command_dialog;
249   Widget print_complete_toggle;
250 
251   int	  filterOutDepot;	/* flag where goes the child (filter) output */
252   int	  commandOutDepot;	/* flag where goes the command output */
253 
254   long    changes_counter;	/* counter of changes made to a file since last
255 				   save; if != 0 the present file is not saved;
256 				   replaces file_saved for the version without
257 				   undo/redo */
258   Boolean file_read_only;	/* status of the read in file */
259   char    *filename;		/* string containing file name 		    */
260   int     reason_save_question;	/* gives the reason for prompting save_changes_dialog
261 				   (i.e. is equal to MENU_OPEN, MENU_NEW etc.) */
262   char    *search_string;       /*  string to be searched for */
263   char    *new_string;		/*  a new string after replacement */
264   long    start_search_position;/*  starting position for a new search or change */
265 
266   Time	  timestamp_search_request;	/* timestamp from an event that trigerred
267 					   the search request (used to set the
268 					   selection i.e. highlighting of the found text) */
269   int 	  search_reason;
270   long	  found_string_start_pos;	/* start position of the found string */
271   long	  found_string_end_pos;		/* end position of the found string */
272   long    line;				/* current line position of a cursor */
273   long    column;			/* current column position of a cursor */
274   long    column_ntab;
275 
276 
277   Boolean   nextSelectionSearch;	/* to distinguish Find/Replace and Find Selection/Find next */
278   Boolean   weOwnPrimarySelection;
279   Boolean   file_just_loaded;
280 
281   Boolean   do_undo_redo_action;
282   Boolean   status_line_on;
283 
284   struct    aseditWindowStruct *prev;	/* pointer to the previous asedit...*/
285 
286   /* undo/redo data follows ... */
287   Boolean    can_undo, can_redo;	/* new in 1.27 to support undo/redo actions */
288   EditStack  undo_stack;
289   EditStack  redo_stack;
290   EditAction edit_history[EditSTACK_SIZE];
291   Boolean    edit_history_initialized;
292 
293   /* bookmarks data follow ... */
294   Boolean	 marks_used;		/* true if at least one mark is set */
295   Boolean 	 mark_set[TOTAL_MARKS];
296   XmTextPosition mark_pos[TOTAL_MARKS];
297   Widget	 menu_mark_set_button[TOTAL_MARKS];
298   Widget	 menu_mark_go_button[TOTAL_MARKS];
299 
300   ChangeAllPar  chgAll;
301   ContinueSearchPar cntSearch;
302 
303 } aseditWindowStruct, *aseditWindowStructPtr;
304 
305 
306 typedef struct
307 {
308     int  	id;	/* the "classic" client_data (integer id) used in GUI
309 			   programming to identify where the call comes from */
310     aseditWindowStruct *win;	/* pointer to the data structure that contains
311 				   all information for one, fully functioning,
312 				   self contained asedit window
313 				*/
314 
315 } asClientDataStruct, *asClientDataStructPtr;
316 
317 
318 /*
319  * lstr - local definitions, language dependent message strings and some
320 	  other new resources in asedit.
321  */
322 typedef struct
323 {
324     /* first resources that are most probable to be changed, then the i18n resources,
325        then the special resources */
326     String noname;		/* noname string ... ("NoName")	*/
327     String tmpDir;            /* default NULL; if not set, $TMPDIR or system tmp dir is used */
328     String helpDir;           /* default NULL; if not set a value set during
329 				 the installation procedure is used */
330     String helpName;           /* default NULL; if not set a help file name (without path) */
331     String backupFileSuffix;  /* default NULL; if not se a value set during
332 				 the installation process is used */
333 
334     /* fm_... file messages ...*/
335     String fm_unable_to_open;	/* "Error: unable to open file:\n" 	*/
336     String fm_unable_to_save;	/* "Error: unable to save file:\n" 	*/
337     String fm_not_closed;	/* " .\nFile not closed!"		*/
338     String fm_print_failed;	/* "Print failed !"                    	*/
339     String fm_exit_aborted;	/* " .\nExit aborted!"			*/
340     String fm_not_printed;	/* " .\nFile not printed."		*/
341     String fm_not_regular;	/* "not a regular file."		*/
342     String fm_no_selection;	/* "Cannot print selection. Text not selected!" */
343     String fm_no_printer;	/* "Select or specify a printer, please!" */
344     String fm_no_filename;	/* "Select or specify a filename, please!" */
345 
346     /* fq_... file questions ... */
347     String fq_overwrite;	/* "Overwrite existing file:\n" */
348     String fq_save_changes;	/* "Save Current Changes?"		*/
349 
350     /* labels for find/change buttons (shared widget) */
351     String find_label;		/* "Find"				*/
352     String find_next_label;	/* " Find Next "			*/
353     String change_label;	/* "Change"				*/
354     String find_n_verify_label; /* "Find & Verify"			*/
355 
356     /* titles for find/change dialogs (shared widget) */
357     String find_dialogTitle;	/* "asedit - find"			*/
358     String change_dialogTitle;  /* "asedit - change"			*/
359 
360     /* sm_... search messages ... */
361     String sm_have_to_enter;	/* "You have to enter a string to search for!" */
362     String sm_have_to_select;
363     String sm_not_found; 	/* "Search string not found"		*/
364     String sm_change_all_completed; /* "Change All has been completed.\nNumber of items changed: %d." */
365     String sm_line_range;	/* "Line number is not within the legal range.\nLegal range is:" */
366 
367     /* sq_... search questions ... */
368     String sq_change;     	/* "Change this occurrence ?"		*/
369     String sq_doc_end;		/* "Reached end of document.\nContinue search at beginning ?" */
370     String sq_doc_beg;		/* "Reached beginning of document.\nContinue search at end ?" */
371 
372     /* flt_... filter messages */
373     String flt_no_selection;     /* "Cannot filter selection. Text not selected!" */
374     String flt_no_filter;	 /* "Specify a filter command, please!" */
375     String flt_no_text;	 	 /* "Enter a text, please!" */
376     String flt_no_value;	 /* "Enter a value, please!" */
377     String flt_wrong_margins;	 /* "Wrong margin values!" */
378     String flt_missing_margins;	 /* "Missing margin values!" */
379 
380     String cant_find_lf;	 /* "Can't find closing line feed!" */
381 
382     /* string (character) to be shown for read-only files */
383     String read_only_marker;	/* "R"					*/
384 
385     /* text used in the ht_help.c (hypertext help) */
386     String help_err_fopen;	/* "Help ERROR. Can't open Help file '%s'." */
387     String help_err_finc;	/* "Help ERROR. Incorrect Help file '%s'."	*/
388     String help_no_info;	/* "SORRY. No help information for this item." */
389 
390     /* other locale dependent messages */
391     String load_font_err;	/* "Could not open font '%s'\n"	*/
392     String open_tmp_err;	/* "Warning: unable to open temp file '%s'... */
393     String close_tmp_err;	/* "Warning: unable to close temp file '%s'... */
394     String backup_file_err;	/* "Unable to create ... '%s'\n. ... '%s'\n" */
395     String file_close_err;	/* "Warning: unable to close file '%s'.\n"	*/
396     String file_move_err;	/* "Warning: unable to move temp file. File '%s' not saved\n" */
397     String open_tmp_print_err;  /* Warning: unable to open temp file '%s', text not printed.\n */
398 
399 
400     String initial_geometry;	/* defaults to NULL */
401     Boolean first_window_iconic;	/* defaults to False */
402     String changeHint;			/* (Changed) extra text used to show that file was changed */
403     String wrong_syntax;	/* "Unrecognized option: '%s'.\n" */
404     String syntax;		/* string showing syntax of the command line */
405     String oldAppDefs;		/* "Warning: old application defaults file loaded!" */
406     String noAppDefs;		/* "Warning: application defaults file not found!" */
407     String fallAppDefs;		/* "Warning: fallback resources used!" */
408 
409 
410     int tabSize;		/* tab size; default 8 */
411 
412 
413     Boolean defaultWrap;		/* initial value for the wrap mode */
414     Boolean autoAddEOFnewline;		/* when True, automatically add a newline to the
415 					   end of any saved file if the file does
416 					   not end in one already */
417     Boolean selectDelimitedText;	/* when True, the text between matched pair (e.g. { } )
418 					   will be selected after search; default is False */
419     Boolean defaultStatus;		/* default value of the status option toogle */
420     Boolean defaultAutoIndent;		/* default value of the auto indent */
421     Boolean useOldColorSetup;		/* new in 1.27; since version 1.27 defaults to False
422 					   and colours of all recessed widgets
423 					   have to be set via resources; the same
424 					   goes for the colour of edit widgets in read
425 					   only mode
426 					*/
427     Pixel readOnlyBackground;		/* new in 1.27; used to specify the
428 					   colour of a read only text widget
429 					   when the new color setup is used, i.e.
430 					   useOldColorSetup is False
431 					*/
432     int    startLine;
433     int    appDefaultsVersion;
434 
435     int    progressInterval;	/* interval for progress working dialog */
436     int    progressInitialDelay;
437     int    progressShortInitialDelay;
438 
439     String sortCmd;		/* sort filter command definition */
440     String spellCmd;		/* spell filter command definition */
441     String expandCmd;		/* expand filter command definition */
442     String unexpandCmd;		/* unexpand filter command definition */
443     XmStringTable sortExt;	/* filter extension definition for sort */
444     XmStringTable spellExt;	/* filter extension definition for spell */
445     XmStringTable expandExt;	/* filter extension definition for expand */
446     XmStringTable unexpandExt;	/* filter extension definition for unexpand */
447 
448     String fmtCmd;		/* fmt filter command definition (used internally) */
449 
450     XmStringTable allFormatExt;	/* extension for *All* filters in Format menu */
451 
452     int filterNum;               /* number of user definable filters; give us a number
453 				    of filter's & filterExt's to take into account */
454     String filter0;		/* definition of a filter 0 command (system command string) */
455     String filter1;
456     String filter2;
457     String filter3;
458     String filter4;
459     String filter5;
460     String filter6;
461     String filter7;
462     String filter8;
463     String filter9;
464 
465     XmStringTable filterExt0;	/* definition of filter extended parameters; (filterDepot \, dlgTitle) */
466     XmStringTable filterExt1;
467     XmStringTable filterExt2;
468     XmStringTable filterExt3;
469     XmStringTable filterExt4;
470     XmStringTable filterExt5;
471     XmStringTable filterExt6;
472     XmStringTable filterExt7;
473     XmStringTable filterExt8;
474     XmStringTable filterExt9;
475 
476     int cmdNum;               	/* number of user definable commands; give us a number
477 				    of cmdDef to take into account */
478     String cmdDef0;		/* definition of a command 0  (system command string) */
479     String cmdDef1;
480     String cmdDef2;
481     String cmdDef3;
482     String cmdDef4;
483     String cmdDef5;
484     String cmdDef6;
485     String cmdDef7;
486     String cmdDef8;
487     String cmdDef9;
488 
489     XmStringTable cmdExt0;   	/* definition of command extended parameters  */
490     XmStringTable cmdExt1;
491     XmStringTable cmdExt2;
492     XmStringTable cmdExt3;
493     XmStringTable cmdExt4;
494     XmStringTable cmdExt5;
495     XmStringTable cmdExt6;
496     XmStringTable cmdExt7;
497     XmStringTable cmdExt8;
498     XmStringTable cmdExt9;
499 
500 
501 
502 }   as_lstr, *as_lstr_ptr;
503     /* above:  the offset calculation macro XtOffset needs a pointer to a structure,
504      therefore as_lstr_ptr has been also defined */
505 
506 
507 
508 /*****************************	Forward Declarations  ***********************/
509 
510 #ifdef _NO_PROTO	/* prototypes for non-ANSI systems follow ... */
511 
512 extern Widget CreateEditWorkArea();
513 extern Boolean SaveFile();
514 extern Boolean OpenFile();
515 extern void CloseFile();
516 extern char * ReadFile();
517 extern long find_line_pos();
518 extern void calc_text_lcn ();
519 extern void textPosToLineColumn();
520 extern void back_textPosToLineColumn();
521 extern void find_string();
522 extern long find_string_pos_in_buffer();
523 extern void set_asedit_icon();
524 
525 extern void set_change_buttons_sensitivity();
526 extern void change_all_found_strings();
527 extern void set_dialog_title();
528 extern void MenuCB ();
529 extern void TextCB ();
530 extern void HelpCB ();
531 extern void DialogOkCB ();
532 extern void DialogApplyCB ();
533 extern void DialogCancelCB ();
534 extern void allowOnlyNumbersCB();
535 extern Boolean acceptChildOutput();
536 
537 extern void set_titles_mwindow_icon();
538 extern void TurnWatchCursor();
539 
540 extern void UndoRedo ();
541 extern void reset_undo_redo();
542 extern void SaveActionForUndo();
543 
544 extern Widget CreateHyperTextHelp();
545 extern void focusCB();
546 extern void as_create_menuh();
547 extern void as_create_popup_menu();
548 
549 
550 extern char *make_tmpnam ();
551 extern void asManageDialog();
552 extern XtPointer mk_asdat();
553 extern XtPointer mk_asdat_w();
554 extern int get_id_from_asdat();
555 extern aseditWindowStruct *get_win_from_asdat();
556 extern void next_window();
557 extern void show_error_message();
558 extern aseditWindowStruct *new_asedit_win();
559 extern void remove_asedit_win ();
560 extern void open_file_in_last_window();
561 extern void create_set_font_list();
562 extern void create_set2_font_list();
563 extern XImage * CreateDefaultImage ();
564 extern Widget create_4buttons_dialog ();
565 extern Widget create_4buttons_image_dialog ();
566 extern void install_as_images ();
567 extern char *getTextSubstring();
568 extern void checkRadioBoxSetting();
569 extern void show_open_dialog ();
570 extern void show_save_as_dialog ();
571 extern void show_save_changes_dialog ();
572 extern void show_overwrite_question ();
573 extern void show_insert_dialog ();
574 
575 extern void show_replace_dialog ();
576 extern void show_change_prompt ();
577 extern void create_continue_search_question ();
578 extern void create_search_end_message ();
579 extern void show_gotoline_dialog ();
580 extern void show_print_dialog ();
581 extern void show_filter_dialog ();
582 extern void show_tabsize_dialog ();
583 extern void show_spell_dialog ();
584 extern void setDefaultHomeEndTranslations();
585 extern void disableRedisplay();
586 extern void enableRedisplay();
587 extern Boolean extendSelectionToLF ();
588 extern Boolean extendSelectionToBOL ();
589 extern Boolean extendSelectionToLines ();
590 extern Boolean extendSelectionToWholeFile ();
591 
592 
593 extern Boolean empty_name();
594 extern Boolean isFileRegular();
595 extern Boolean checkSyntax();
596 extern Boolean checkCommandForOption();
597 extern void go_to_line();
598 
599 extern get_option_id();
600 extern void set_option_id();
601 extern void cnv_lang_code();
602 
603 extern void show_about_message();
604 
605 extern void write_ll();
606 extern void write_ls();
607 
608 #else  /* ! _NO_PROTO, ANSI prototypes follow */
609 
610 extern Widget CreateEditWorkArea(aseditWindowStruct *win, Widget parent);
611 extern Boolean SaveFile(aseditWindowStruct *win);
612 extern Boolean OpenFile(aseditWindowStruct *win, Boolean only_existing_files);
613 extern void CloseFile(aseditWindowStruct *win);
614 extern char * ReadFile(char *file_name, Boolean *read_only);
615 extern long find_line_pos(long line, char *buf, long *found_lines);
616 extern void calc_text_lcn (Widget w, XtPointer client_data, XtPointer call_data);
617 extern void textPosToLineColumn(char *buf, long buf_size, long pos, int tab_size,
618 	long *line, long *column, long *column_ntab);
619 extern void back_textPosToLineColumn(char *buf, long buf_size, long pos, int tab_size,
620 	long *line, long *column, long *column_ntab);
621 extern void find_string(aseditWindowStruct *win, Boolean start);
622 extern long find_string_pos_in_buffer(char *searchstring, char *buf,
623 			long startpos, long endpos, Boolean forward,
624 			Boolean case_sensitive, Boolean whole_words_only);
625 extern void set_asedit_icon(Widget shell, Widget colours_source, char *icon_name);
626 
627 extern void set_change_buttons_sensitivity(aseditWindowStruct *win, Boolean state);
628 extern void change_all_found_strings(aseditWindowStruct *win, Boolean start);
629 extern void set_dialog_title(Widget w, char *title);
630 extern void MenuCB (Widget w, XtPointer client_data, XtPointer call_data);
631 extern void TextCB (Widget w, XtPointer client_data, XtPointer call_data);
632 extern void HelpCB (Widget w, XtPointer client_data, XtPointer call_data);
633 extern void DialogOkCB (Widget w, XtPointer client_data, XtPointer call_data);
634 extern void DialogApplyCB (Widget w, XtPointer client_data, XtPointer call_data);
635 extern void DialogCancelCB (Widget w, XtPointer client_data, XtPointer call_data);
636 extern void allowOnlyNumbersCB (Widget w, XtPointer client_data, XtPointer call_data);
637 extern Boolean acceptChildOutput(Widget parent,  char *errstr, int defaultButtonType);
638 
639 extern void set_titles_mwindow_icon(aseditWindowStruct *win, char *filename, char *extra);
640 extern void TurnWatchCursor(Boolean turn_on);
641 
642 extern void UndoRedo (aseditWindowStruct *win, int action_type);
643 extern void reset_undo_redo( aseditWindowStruct *win);
644 extern void SaveActionForUndo(Widget w, XtPointer client_data, XtPointer call_data);
645 
646 extern Widget CreateHyperTextHelp( Widget parent, String name,
647 		Arg arglist[], int argcount );
648 extern void focusCB(Widget w, XtPointer data, XtPointer dummy);
649 extern void as_create_menuh(char *title, Widget menu, as_menuh_struct *menulist, int nitems,
650 		       XmStringCharSet charset );
651 extern void as_create_popup_menu(char *title, Widget menu, as_menuh_struct *menulist, int nitems,
652 		       XmStringCharSet charset );
653 
654 extern char *make_tmpnam (void);
655 extern void asManageDialog(Widget w);
656 extern XtPointer mk_asdat(int client_data);
657 extern XtPointer mk_asdat_w(aseditWindowStruct *win , int client_data);
658 extern int get_id_from_asdat(XtPointer as_client_data);
659 extern aseditWindowStruct *get_win_from_asdat(XtPointer as_client_data);
660 extern void next_window(aseditWindowStruct *win_prev);
661 extern void show_error_message(aseditWindowStruct *win, char *message);
662 extern aseditWindowStruct *new_asedit_win(aseditWindowStruct *win_prev);
663 extern void remove_asedit_win (aseditWindowStruct *win);
664 extern void open_file_in_last_window(char *filename);
665 extern void create_set_font_list(Widget w, char *font_name);
666 extern void create_set2_font_list(Widget w, Widget w2, char *font_name);
667 extern XImage * CreateDefaultImage (char *bits, int width, int height);
668 extern Widget create_4buttons_dialog (Widget parent, String name, Pixmap pixmap,
669 	String message, Arg arglist[], int argcount);
670 extern Widget create_4buttons_image_dialog (Widget parent, String name,
671 	String image_string, String message, Arg arglist[], int argcount);
672 extern char *getTextSubstring(Widget w, XmTextPosition start, int num_chars);
673 extern void checkRadioBoxSetting(Widget w, int deflt);
674 extern void install_as_images (Widget parent);
675 extern void show_open_dialog (aseditWindowStruct *win);
676 extern void show_save_as_dialog (aseditWindowStruct *win, char *proposed_fname);
677 extern void show_save_changes_dialog (aseditWindowStruct *win);
678 extern void show_overwrite_question (aseditWindowStruct *win, char *filename);
679 extern void show_insert_dialog (aseditWindowStruct *win);
680 
681 extern void show_replace_dialog (aseditWindowStruct *win);
682 extern void show_change_prompt (aseditWindowStruct *win);
683 extern void create_continue_search_question (aseditWindowStruct *win);
684 extern void create_search_end_message (aseditWindowStruct *win);
685 extern void show_gotoline_dialog (aseditWindowStruct *win);
686 extern void show_print_dialog (aseditWindowStruct *win);
687 extern void show_filter_dialog (aseditWindowStruct *win);
688 extern void show_tabsize_dialog (aseditWindowStruct *win);
689 extern void show_spell_dialog (aseditWindowStruct *win);
690 extern void setDefaultHomeEndTranslations(Widget w);
691 extern void disableRedisplay(aseditWindowStruct *win);
692 extern void enableRedisplay(aseditWindowStruct *win);
693 extern Boolean extendSelectionToLF (aseditWindowStruct *win, XmTextPosition *left, XmTextPosition *right);
694 extern Boolean extendSelectionToBOL (aseditWindowStruct *win, XmTextPosition *left, XmTextPosition *right);
695 extern Boolean extendSelectionToLines (aseditWindowStruct *win, XmTextPosition *left, XmTextPosition *right);
696 extern Boolean extendSelectionToWholeFile (aseditWindowStruct *win, XmTextPosition *left, XmTextPosition *right);
697 
698 
699 
700 extern Boolean empty_name(char *str);
701 extern Boolean isFileRegular(char *file_name);
702 extern Boolean checkSyntax(unsigned int argc, char *argv[], char *program_name, char *introStr, char *syntaxStr);
703 extern Boolean checkCommandForOption(unsigned int argc, char *argv[], char *option );
704 extern void go_to_line(aseditWindowStruct *win, long line_no, Boolean setTopCharacter);
705 
706 extern void write_ll(Widget label, XmStringCharSet charset, char *format, long n);
707 extern void write_ls(Widget label, XmStringCharSet charset, char *format, char *s);
708 
709 
710 extern void show_about_message (aseditWindowStruct *win);
711 
712 #endif	/* end of conditional _NO_PROTO prototypes  compilation */
713 
714 
715 /************************    Global Definitions & Data   **********************/
716 
717 
718 /* special hypertext link definitions  ***/
719 
720 #define HTEXT_KEYS              8000
721 #define HTEXT_INDEX             8001
722 #define HTEXT_HELP              8002
723 #define HTEXT_ABOUT             8003
724 
725 
726 #define MENU_FILE		  10
727 #define MENU_NEW                1000
728 #define MENU_OPEN		1001
729 #define MENU_CLOSE		1002
730 #define MENU_SAVE		1003
731 #define MENU_SAVE_AS		1004
732 #define MENU_INSERT		1005
733 #define MENU_PRINT		1006
734 #define MENU_EXIT		1007
735 
736 #define MENU_EDIT		  20
737 #define MENU_UNDO	        2000
738 #define MENU_REDO               2001
739 #define MENU_CUT		2002
740 #define MENU_COPY		2003
741 #define MENU_PASTE		2004
742 #define MENU_CLEAR		2005
743 
744 #define MENU_SEARCH		  30
745 #define	MENU_FIND		3000
746 #define	MENU_FIND_NEXT		3001
747 #define	MENU_CHANGE		3002
748 #define	MENU_GOTOLINE		3003
749 #define MENU_MARK       	3004
750 #define MENU_MATCH       	3005
751 
752 #define MENU_MARK_SET   	300400
753 #define MENU_MARK_GO    	300401
754 
755 #define MENU_MARK_SET0  	30040000
756 #define MENU_MARK_SET1  	30040001
757 #define MENU_MARK_SET2  	30040002
758 #define MENU_MARK_SET3  	30040003
759 #define MENU_MARK_SET4  	30040004
760 #define MENU_MARK_SET5  	30040005
761 #define MENU_MARK_SET6  	30040006
762 #define MENU_MARK_SET7  	30040007
763 #define MENU_MARK_SET8  	30040008
764 #define MENU_MARK_SET9  	30040009
765 
766 #define MENU_MARK_GO0   	30040100
767 #define MENU_MARK_GO1   	30040101
768 #define MENU_MARK_GO2   	30040102
769 #define MENU_MARK_GO3   	30040103
770 #define MENU_MARK_GO4   	30040104
771 #define MENU_MARK_GO5   	30040105
772 #define MENU_MARK_GO6   	30040106
773 #define MENU_MARK_GO7   	30040107
774 #define MENU_MARK_GO8   	30040108
775 #define MENU_MARK_GO9   	30040109
776 
777 #define MENU_MATCH_FORWARD   	300500
778 #define MENU_MATCH_BACKWARD    	300501
779 
780 
781 
782 #define MENU_TOOLS		50
783 #define MENU_SPELL		5000
784 #define MENU_SORT		5001
785 #define MENU_FORMAT		5002
786 #define MENU_CASE		5003
787 
788 #define MENU_FILTER		5004
789 #define MENU_COMMAND		5005
790 
791 #define DIALOG_SPELL		500000
792 
793 #define MENU_FORMAT_MOVE_LEFT	500200
794 #define MENU_FORMAT_MOVE_RIGHT	500201
795 #define MENU_FORMAT_INDENT_WITH	500202
796 #define MENU_FORMAT_REFORMAT	500203
797 
798 #define MENU_EXPAND		500204
799 #define MENU_UNEXPAND		500205
800 
801 #define DIALOG_MOVE_LEFT	50020000
802 #define DIALOG_MOVE_RIGHT	50020100
803 #define DIALOG_INDENT_WITH	50020200
804 #define DIALOG_REFORMAT		50020300
805 
806 #define MENU_CASE_UPPER		500300
807 #define MENU_CASE_LOWER		500301
808 #define MENU_CASE_TITLE		500302
809 #define MENU_CASE_TOGGLE	500303
810 
811 #define MENU_FILTER_EXTRA	500400
812 #define MENU_FILTER_0		500401
813 #define MENU_FILTER_1		500402
814 #define MENU_FILTER_2		500403
815 #define MENU_FILTER_3		500404
816 #define MENU_FILTER_4		500405
817 #define MENU_FILTER_5		500406
818 #define MENU_FILTER_6		500407
819 #define MENU_FILTER_7		500408
820 #define MENU_FILTER_8		500409
821 #define MENU_FILTER_9		500410
822 
823 #define MENU_COMMAND_EXTRA	500500
824 #define MENU_COMMAND_0		500501
825 #define MENU_COMMAND_1		500502
826 #define MENU_COMMAND_2		500503
827 #define MENU_COMMAND_3		500504
828 #define MENU_COMMAND_4		500505
829 #define MENU_COMMAND_5		500506
830 #define MENU_COMMAND_6		500507
831 #define MENU_COMMAND_7		500508
832 #define MENU_COMMAND_8		500509
833 #define MENU_COMMAND_9		500510
834 
835 #define DIALOG_FILTER		50040000
836 #define DIALOG_COMMAND		50050000
837 
838 
839 #define MENU_HELP		  80
840 
841 #define	MENU_H_ON_KEYS		HTEXT_KEYS
842 #define	MENU_H_INDEX            HTEXT_INDEX
843 #define	MENU_H_ON_HELP          HTEXT_HELP
844 #define	MENU_H_ABOUT            HTEXT_ABOUT
845 
846 
847 #define MENU_QACCESS		90
848 
849 #define DIALOG_OPEN		100100
850 #define DIALOG_SAVE_AS		100400
851 #define DIALOG_INSERT		100500
852 #define DIALOG_PRINT_NEW	100600
853 
854 #define DIALOG_SAVE_CHANGES	100101
855 #define QUESTION_OVERWRITE      100401
856 #define DIALOG_FIND_OR_CHANGE	300000
857 #define DIALOG_GOTOLINE		300300
858 #define DIALOG_CHANGE_PROMPT	 30020001
859 #define QUESTION_CONTINUE_SEARCH 30020002
860 #define MESSAGE_SEARCH_END	 30020003
861 #define ERROR_MESSAGE		 7777
862 
863 
864 enum childOutDepot { TO_NONE, TO_STDOUT, TO_STDERR, TO_CURRENT, TO_NEW, TO_TEXT_DIALOG};
865 
866 enum changeCaseToFlag { TO_UPPER_CASE, TO_LOWER_CASE, TO_TITLE_CASE, TO_TOGGLE_CASE};
867 
868 extern Display	*display;	/*  Display		*/
869 extern XmStringCharSet charset;
870 extern char *PROGRAM_CLASS;
871 extern char *PROGRAM_NAME;
872 
873 extern Display		*display;	/*  Display		*/
874 extern Widget toplevel;			/* application shell (top level)*/
875 extern Widget help_dialog;		/* global help for all asedit windows */
876 extern int    aseditWinCount;		/* global count of active windows */
877 
878 extern aseditWindowStruct *asedit_last_window;	/* the last asedit win structure in the chain */
879 
880 extern Boolean	clipboard_filled; 	/* to show if there is something in clipbboard to paste from */
881 
882 extern Pixel	text_edit_background;	/* background colour of the main text widget
883 				   ( it is the colour of a recessed widget) */
884 extern Pixel   text_read_only_background;	/* a lighter colour to show that the file
885 					   is read only */
886 extern Pixel	select_menu_background;	/* background for editable widgets pop down
887 				   from the menus; it is equal to the menu buttons
888 				   arm colour */
889 extern Pixmap	xm_question_mark, xm_excl_mark;	/* Motif pixmaps (initialized in install_as_images) */
890 
891 extern XmFontList default_fontlist;	/* default font list for the edit text widget */
892 
893 
894 extern XmStringCharSet charset;		/* used to set up XmStrings */
895 
896 extern as_lstr		lstr;		/* language dependent messages */
897 
898 
899 
900 #endif	/* do NOT add any stuff after this line */
901 
902 
903