1 /* edit.h - main include file
3 Copyright (C) 1996, 1997 the Free Software Foundation
5 Authors: 1996, 1997 Paul Sheer
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
29 #define HAVE_SYNTAXH 1
34 # include <sys/types.h>
42 # include <sys/stat.h>
50 #else /* ! MIDNIGHT */
55 # include <sys/types.h>
64 # include <my_string.h>
68 # include <sys/stat.h>
77 # if TIME_WITH_SYS_TIME
78 # include <sys/time.h>
82 # include <sys/time.h>
95 # include <X11/Xlib.h>
96 # include <X11/Xutil.h>
97 # include <X11/Xresource.h>
100 # include "coolwidget.h"
101 # include "app_glob.c"
102 # include "coollocal.h"
103 # include "stringtools.h"
105 # include "gtk/gtk.h"
106 # include "gdk/gdkprivate.h"
107 # include "gdk/gdk.h"
108 # include "gtkedit.h"
109 # include "editcmddef.h"
118 # include "src/global.h"
119 # include "src/main.h" /* for char *shell */
120 # include "src/mad.h"
121 # include "src/dlg.h"
122 # include "src/widget.h"
123 # include "src/color.h"
124 # include "src/dialog.h"
125 # include "src/mouse.h"
126 # include "src/help.h"
127 # include "src/key.h"
128 # include "src/wtools.h" /* for QuickWidgets */
129 # include "src/win.h"
130 # include "vfs/vfs.h"
131 # include "src/menu.h"
133 # define WANT_WIDGETS
135 # define WIDGET_COMMAND (WIDGET_USER + 10)
141 /* unistd.h defines _POSIX_VERSION on POSIX.1 systems. */
142 #if defined(HAVE_DIRENT_H) || defined(_POSIX_VERSION)
144 # define NLENGTH(dirent) (strlen ((dirent)->d_name))
146 # define dirent direct
147 # define NLENGTH(dirent) ((dirent)->d_namlen)
149 # ifdef HAVE_SYS_NDIR_H
150 # include <sys/ndir.h>
151 # endif /* HAVE_SYS_NDIR_H */
153 # ifdef HAVE_SYS_DIR_H
154 # include <sys/dir.h>
155 # endif /* HAVE_SYS_DIR_H */
159 # endif /* HAVE_NDIR_H */
160 #endif /* not (HAVE_DIRENT_H or _POSIX_VERSION) */
166 # define CDisplay gdk_display
167 # define CRoot gdk_root_parent
168 # define Window GtkEdit *
171 #define SEARCH_DIALOG_OPTION_NO_SCANF 1
172 #define SEARCH_DIALOG_OPTION_NO_REGEX 2
173 #define SEARCH_DIALOG_OPTION_NO_CASE 4
174 #define SEARCH_DIALOG_OPTION_BACKWARDS 8
176 #define SYNTAX_FILE "/.cedit/Syntax"
177 #define CLIP_FILE "/.cedit/cooledit.clip"
178 #define MACRO_FILE "/.cedit/cooledit.macros"
179 #define BLOCK_FILE "/.cedit/cooledit.block"
180 #define ERROR_FILE "/.cedit/cooledit.error"
181 #define TEMP_FILE "/.cedit/cooledit.temp"
182 #define SCRIPT_FILE "/.cedit/cooledit.script"
183 #define EDIT_DIR "/.cedit"
185 #define EDIT_KEY_EMULATION_NORMAL 0
186 #define EDIT_KEY_EMULATION_EMACS 1
188 #define REDRAW_LINE (1 << 0)
189 #define REDRAW_LINE_ABOVE (1 << 1)
190 #define REDRAW_LINE_BELOW (1 << 2)
191 #define REDRAW_AFTER_CURSOR (1 << 3)
192 #define REDRAW_BEFORE_CURSOR (1 << 4)
193 #define REDRAW_PAGE (1 << 5)
194 #define REDRAW_IN_BOUNDS (1 << 6)
195 #define REDRAW_CHAR_ONLY (1 << 7)
196 #define REDRAW_COMPLETELY (1 << 8)
198 #define MOD_ABNORMAL (1 << 0)
199 #define MOD_UNDERLINED (1 << 1)
200 #define MOD_BOLD (1 << 2)
201 #define MOD_HIGHLIGHTED (1 << 3)
202 #define MOD_MARKED (1 << 4)
203 #define MOD_ITALIC (1 << 5)
204 #define MOD_CURSOR (1 << 6)
205 #define MOD_INVERSE (1 << 7)
209 # define EDIT_TEXT_HORIZONTAL_OFFSET 0
210 # define EDIT_TEXT_VERTICAL_OFFSET 0
212 # define EDIT_TEXT_HORIZONTAL_OFFSET 4
213 # define EDIT_TEXT_VERTICAL_OFFSET 3
216 # define EDIT_TEXT_HORIZONTAL_OFFSET 0
217 # define EDIT_TEXT_VERTICAL_OFFSET 1
218 # define FONT_OFFSET_X 0
219 # define FONT_OFFSET_Y 0
222 #define EDIT_RIGHT_EXTREME option_edit_right_extreme
223 #define EDIT_LEFT_EXTREME option_edit_left_extreme
224 #define EDIT_TOP_EXTREME option_edit_top_extreme
225 #define EDIT_BOTTOM_EXTREME option_edit_bottom_extreme
227 #define MAX_MACRO_LENGTH 1024
229 /*there are a maximum of ... */
231 /*... edit buffers, each of which is ... */
232 #define EDIT_BUF_SIZE 0x10000
233 /* ...bytes in size. */
235 /*x / EDIT_BUF_SIZE equals x >> ... */
236 #define S_EDIT_BUF_SIZE 16
238 /* x % EDIT_BUF_SIZE is equal to x && ... */
239 #define M_EDIT_BUF_SIZE 0xFFFF
241 #define SIZE_LIMIT (EDIT_BUF_SIZE * (MAXBUFF - 2))
242 /* Note a 16k stack is 64k of data and enough to hold (usually) around 10
243 pages of undo info. */
246 #define START_STACK_SIZE 32
249 /*some codes that may be pushed onto or returned from the undo stack: */
250 #define CURS_LEFT 601
251 #define CURS_RIGHT 602
253 #define BACKSPACE 604
254 #define STACK_BOTTOM 605
255 #define CURS_LEFT_LOTS 606
256 #define CURS_RIGHT_LOTS 607
257 #define COLUMN_ON 608
258 #define COLUMN_OFF 609
260 #define MARK_2 700000000
261 #define KEY_PRESS 1400000000
263 /*Tabs spaces: (sofar only HALF_TAB_SIZE is used: */
264 #define TAB_SIZE option_tab_spacing
265 #define HALF_TAB_SIZE ((int) option_tab_spacing / 2)
273 unsigned char * text
;
278 unsigned short keyword
;
280 unsigned char context
;
281 unsigned char _context
;
282 #define RULE_ON_LEFT_BORDER 1
283 #define RULE_ON_RIGHT_BORDER 2
284 unsigned char border
;
287 #define MAX_WORDS_PER_CONTEXT 1024
288 #define MAX_CONTEXTS 128
293 char *whole_word_chars_left
;
294 char *whole_word_chars_right
;
296 #define NO_COLOR 0x7FFFFFFF
297 #define SPELLING_ERROR 0x7EFEFEFE
303 struct context_rule
{
305 unsigned char first_left
;
307 unsigned char first_right
;
308 char line_start_left
;
309 char line_start_right
;
311 int between_delimiters
;
312 char *whole_word_chars_left
;
313 char *whole_word_chars_right
;
314 char *keyword_first_chars
;
316 /* first word is word[1] */
317 struct key_word
**keyword
;
320 struct _syntax_marker
{
322 struct syntax_rule rule
;
323 struct _syntax_marker
*next
;
327 int line
; /* line number */
328 #define BOOK_MARK_COLOR ((0 << 8) | 26) /* black on white */
330 struct _book_mark
*next
;
331 struct _book_mark
*prev
;
334 struct editor_widget
{
340 struct cool_widget
*widget
;
342 #define from_here num_widget_lines
343 int num_widget_lines
;
344 int num_widget_columns
;
352 char *filename
; /* Name of the file */
353 char *dir
; /* current directory */
355 /* dynamic buffers and cursor position for editor: */
356 long curs1
; /*position of the cursor from the beginning of the file. */
357 long curs2
; /*position from the end of the file */
358 unsigned char *buffers1
[MAXBUFF
+ 1]; /*all data up to curs1 */
359 unsigned char *buffers2
[MAXBUFF
+ 1]; /*all data from end of file down to curs2 */
361 /* search variables */
362 long search_start
; /* First character to start searching from */
363 int found_len
; /* Length of found string or 0 if none was found */
364 long found_start
; /* the found word from a search - start position */
366 /* display information */
367 long last_byte
; /* Last byte of file */
368 long start_display
; /* First char displayed */
369 long start_col
; /* First displayed column, negative */
370 long max_column
; /* The maximum cursor position ever reached used to calc hori scroll bar */
371 long curs_row
; /*row position of cursor on the screen */
372 long curs_col
; /*column position on screen */
373 int force
; /* how much of the screen do we redraw? */
374 unsigned char overwrite
;
375 unsigned char modified
; /*has the file been changed?: 1 if char inserted or
376 deleted at all since last load or save */
377 #if defined(MIDNIGHT) || defined(GTK)
378 int delete_file
; /* has the file been created in edit_load_file? Delete
379 it at end of editing when it hasn't been modified
382 unsigned char highlight
;
383 long prev_col
; /*recent column position of the cursor - used when moving
384 up or down past lines that are shorter than the current line */
385 long curs_line
; /*line number of the cursor. */
386 long start_line
; /*line nummber of the top of the page */
389 long total_lines
; /*total lines in the file */
390 long mark1
; /*position of highlight start */
391 long mark2
; /*position of highlight end */
392 int column1
; /*position of column highlight start */
393 int column2
; /*position of column highlight end */
394 long bracket
; /*position of a matching bracket */
396 /* cache speedup for line lookups */
397 #define N_LINE_CACHES 32
399 int line_numbers
[N_LINE_CACHES
];
400 long line_offsets
[N_LINE_CACHES
];
402 struct _book_mark
*book_mark
;
404 /* undo stack and pointers */
405 unsigned long stack_pointer
;
407 unsigned long stack_size
;
408 unsigned long stack_size_mask
;
409 unsigned long stack_bottom
;
412 /* syntax higlighting */
413 struct _syntax_marker
*syntax_marker
;
414 struct context_rule
**rules
;
416 struct syntax_rule rule
;
417 char *syntax_type
; /* description of syntax highlighting type being used */
418 int explicit_syntax
; /* have we forced the syntax hi. type in spite of the filename? */
420 int to_here
; /* dummy marker */
424 int macro_i
; /* -1 if not recording index to macro[] otherwise */
425 struct macro macro
[MAX_MACRO_LENGTH
];
428 typedef struct editor_widget WEdit
;
432 void edit_render_expose (WEdit
* edit
, XExposeEvent
* xexpose
);
434 void edit_render_tidbits (struct cool_widget
*w
);
435 int eh_editor (CWidget
* w
, XEvent
* xevent
, CEvent
* cwevent
);
437 void edit_draw_menus (Window parent
, int x
, int y
);
438 void edit_run_make (void);
439 void edit_change_directory (void);
440 int edit_man_page_cmd (WEdit
* edit
);
441 void edit_search_replace_dialog (Window parent
, int x
, int y
, char **search_text
, char **replace_text
, char **arg_order
, char *heading
, int option
);
442 void edit_search_dialog (WEdit
* edit
, char **search_text
);
443 long edit_find (long search_start
, unsigned char *expr
, int *len
, long last_byte
, int (*get_byte
) (void *, long), void *data
, void *d
);
444 void edit_set_foreground_colors (unsigned long normal
, unsigned long bold
, unsigned long italic
);
445 void edit_set_background_colors (unsigned long normal
, unsigned long abnormal
, unsigned long marked
, unsigned long marked_abnormal
, unsigned long highlighted
);
446 void edit_set_cursor_color (unsigned long c
);
447 void draw_options_dialog (Window parent
, int x
, int y
);
448 void CRefreshEditor (WEdit
* edit
);
449 void edit_set_user_command (void (*func
) (WEdit
*, int));
450 void edit_draw_this_line_proportional (WEdit
* edit
, long b
, int curs_row
, int start_column
, int end_column
);
451 unsigned char get_international_character (unsigned char key_press
);
452 void edit_set_user_key_function (int (*user_def_key_func
) (unsigned int, unsigned int, KeySym keysym
));
456 int edit_drop_hotkey_menu (WEdit
* e
, int key
);
457 void edit_menu_cmd (WEdit
* e
);
458 void edit_init_menu_emacs (void);
459 void edit_init_menu_normal (void);
460 void edit_done_menu (void);
461 int edit_raw_key_query (char *heading
, char *query
, int cancel
);
462 char *strcasechr (const unsigned char *s
, int c
);
463 int edit (const char *_file
, int line
);
464 int edit_translate_key (WEdit
* edit
, unsigned int x_keycode
, long x_key
, int x_state
, int *cmd
, int *ch
);
468 #ifndef NO_INLINE_GETBYTE
469 int edit_get_byte (WEdit
* edit
, long byte_index
);
471 static inline int edit_get_byte (WEdit
* edit
, long byte_index
)
474 if (byte_index
>= (edit
->curs1
+ edit
->curs2
) || byte_index
< 0)
477 if (byte_index
>= edit
->curs1
) {
478 p
= edit
->curs1
+ edit
->curs2
- byte_index
- 1;
479 return edit
->buffers2
[p
>> S_EDIT_BUF_SIZE
][EDIT_BUF_SIZE
- (p
& M_EDIT_BUF_SIZE
) - 1];
481 return edit
->buffers1
[byte_index
>> S_EDIT_BUF_SIZE
][byte_index
& M_EDIT_BUF_SIZE
];
486 char *edit_get_buffer_as_text (WEdit
* edit
);
487 int edit_load_file (WEdit
* edit
, const char *filename
, const char *text
, unsigned long text_size
);
488 int edit_count_lines (WEdit
* edit
, long current
, int upto
);
489 long edit_move_forward (WEdit
* edit
, long current
, int lines
, long upto
);
490 long edit_move_forward3 (WEdit
* edit
, long current
, int cols
, long upto
);
491 long edit_move_backward (WEdit
* edit
, long current
, int lines
);
492 void edit_scroll_screen_over_cursor (WEdit
* edit
);
493 void edit_render_keypress (WEdit
* edit
);
494 void edit_scroll_upward (WEdit
* edit
, unsigned long i
);
495 void edit_scroll_downward (WEdit
* edit
, int i
);
496 void edit_scroll_right (WEdit
* edit
, int i
);
497 void edit_scroll_left (WEdit
* edit
, int i
);
498 int edit_get_col (WEdit
* edit
);
499 long edit_bol (WEdit
* edit
, long current
);
500 long edit_eol (WEdit
* edit
, long current
);
501 void edit_update_curs_row (WEdit
* edit
);
502 void edit_update_curs_col (WEdit
* edit
);
504 void edit_block_copy_cmd (WEdit
* edit
);
505 void edit_block_move_cmd (WEdit
* edit
);
506 int edit_block_delete_cmd (WEdit
* edit
);
507 int edit_block_delete (WEdit
* edit
);
508 void edit_delete_line (WEdit
* edit
);
510 int edit_delete (WEdit
* edit
);
511 void edit_insert (WEdit
* edit
, int c
);
512 int edit_cursor_move (WEdit
* edit
, long increment
);
513 void edit_push_action (WEdit
* edit
, long c
,...);
514 void edit_push_key_press (WEdit
* edit
);
515 void edit_insert_ahead (WEdit
* edit
, int c
);
516 int edit_save_file (WEdit
* edit
, const char *filename
);
517 int edit_save_cmd (WEdit
* edit
);
518 int edit_save_confirm_cmd (WEdit
* edit
);
519 int edit_save_as_cmd (WEdit
* edit
);
520 WEdit
*edit_init (WEdit
* edit
, int lines
, int columns
, const char *filename
, const char *text
, const char *dir
, unsigned long text_size
);
521 int edit_clean (WEdit
* edit
);
522 int edit_renew (WEdit
* edit
);
523 int edit_new_cmd (WEdit
* edit
);
524 int edit_reload (WEdit
* edit
, const char *filename
, const char *text
, const char *dir
, unsigned long text_size
);
525 int edit_load_cmd (WEdit
* edit
);
526 void edit_mark_cmd (WEdit
* edit
, int unmark
);
527 void edit_set_markers (WEdit
* edit
, long m1
, long m2
, int c1
, int c2
);
528 void edit_push_markers (WEdit
* edit
);
529 void edit_quit_cmd (WEdit
* edit
);
530 void edit_replace_cmd (WEdit
* edit
, int again
);
531 void edit_search_cmd (WEdit
* edit
, int again
);
532 int edit_save_block_cmd (WEdit
* edit
);
533 int edit_insert_file_cmd (WEdit
* edit
);
534 int edit_insert_file (WEdit
* edit
, const char *filename
);
535 void edit_block_process_cmd (WEdit
* edit
, const char *shell_cmd
, int block
);
536 char *catstrs (const char *first
,...);
537 void edit_refresh_cmd (WEdit
* edit
);
538 void edit_date_cmd (WEdit
* edit
);
539 void edit_goto_cmd (WEdit
* edit
);
540 int eval_marks (WEdit
* edit
, long *start_mark
, long *end_mark
);
541 void edit_status (WEdit
* edit
);
542 int edit_execute_command (WEdit
* edit
, int command
, int char_for_insertion
);
543 int edit_execute_key_command (WEdit
* edit
, int command
, int char_for_insertion
);
544 void edit_update_screen (WEdit
* edit
);
545 int edit_printf (WEdit
* e
, const char *fmt
,...);
546 int edit_print_string (WEdit
* e
, const char *s
);
547 void edit_move_to_line (WEdit
* e
, long line
);
548 void edit_move_display (WEdit
* e
, long line
);
549 void edit_word_wrap (WEdit
* edit
);
550 unsigned char *edit_get_block (WEdit
* edit
, long start
, long finish
, int *l
);
551 int edit_sort_cmd (WEdit
* edit
);
552 void edit_help_cmd (WEdit
* edit
);
553 void edit_left_word_move (WEdit
* edit
, int s
);
554 void edit_right_word_move (WEdit
* edit
, int s
);
555 void edit_get_selection (WEdit
* edit
);
557 int edit_save_macro_cmd (WEdit
* edit
, struct macro macro
[], int n
);
558 int edit_load_macro_cmd (WEdit
* edit
, struct macro macro
[], int *n
, int k
);
559 void edit_delete_macro_cmd (WEdit
* edit
);
561 int edit_copy_to_X_buf_cmd (WEdit
* edit
);
562 int edit_cut_to_X_buf_cmd (WEdit
* edit
);
563 void edit_paste_from_X_buf_cmd (WEdit
* edit
);
565 void edit_paste_from_history (WEdit
*edit
);
567 void edit_split_filename (WEdit
* edit
, char *name
);
570 #define CWidget Widget
572 #define CWidget GtkEdit
574 void edit_set_syntax_change_callback (void (*callback
) (CWidget
*));
575 void edit_load_syntax (WEdit
* edit
, char **names
, char *type
);
576 void edit_free_syntax_rules (WEdit
* edit
);
577 void edit_get_syntax_color (WEdit
* edit
, long byte_index
, int *fg
, int *bg
);
578 int edit_check_spelling (WEdit
* edit
);
581 void book_mark_insert (WEdit
* edit
, int line
, int c
);
582 int book_mark_query_color (WEdit
* edit
, int line
, int c
);
583 int book_mark_query_all (WEdit
* edit
, int line
, int *c
);
584 struct _book_mark
*book_mark_find (WEdit
* edit
, int line
);
585 int book_mark_clear (WEdit
* edit
, int line
, int c
);
586 void book_mark_flush (WEdit
* edit
, int c
);
587 void book_mark_inc (WEdit
* edit
, int line
);
588 void book_mark_dec (WEdit
* edit
, int line
);
593 /* put OS2/NT/WIN95 defines here */
596 # define MY_O_TEXT O_TEXT
601 # define FONT_PIX_PER_LINE 1
602 # define FONT_MEAN_WIDTH 1
604 # define get_sys_error(s) (s)
605 # define open mc_open
606 # define close(f) mc_close(f)
607 # define read(f,b,c) mc_read(f,b,c)
608 # define write(f,b,c) mc_write(f,b,c)
609 # define stat(f,s) mc_stat(f,s)
610 # define mkdir(s,m) mc_mkdir(s,m)
611 # define itoa MY_itoa
613 # define edit_get_load_file(d,f,h) input_dialog (h, " Enter file name: ", f)
614 # define edit_get_save_file(d,f,h) input_dialog (h, " Enter file name: ", f)
615 # define CMalloc(x) malloc(x)
617 # define set_error_msg(s) edit_init_error_msg = strdup(s)
621 # define edit_error_dialog(h,s) set_error_msg(s)
622 char *edit_init_error_msg
= NULL
;
624 # else /* ! _EDIT_C */
626 # define edit_error_dialog(h,s) query_dialog (h, s, 0, 1, _("&Dismiss"))
627 # define edit_message_dialog(h,s) query_dialog (h, s, 0, 1, _("&Ok"))
628 extern char *edit_init_error_msg
;
630 # endif /* ! _EDIT_C */
633 # define get_error_msg(s) edit_init_error_msg
634 # define edit_query_dialog2(h,t,a,b) query_dialog(h,t,0,2,a,b)
635 # define edit_query_dialog3(h,t,a,b,c) query_dialog(h,t,0,3,a,b,c)
636 # define edit_query_dialog4(h,t,a,b,c,d) query_dialog(h,t,0,4,a,b,c,d)
638 #else /* ! MIDNIGHT */
641 # define get_sys_error(s) (s)
643 # define open mc_open
644 # define close(f) mc_close(f)
645 # define read(f,b,c) mc_read(f,b,c)
646 # define write(f,b,c) mc_write(f,b,c)
647 # define stat(f,s) mc_stat(f,s)
648 # define mkdir(s,m) mc_mkdir(s,m)
650 # define itoa MY_itoa
651 # define CMalloc(x) malloc(x)
653 # define EDITOR_NO_FILE (1<<3)
654 # define EDITOR_NO_SCROLL (1<<4)
655 # define EDITOR_NO_TEXT (1<<5)
656 # define EDITOR_HORIZ_SCROLL (1<<6)
658 #include <gdk/gdkprivate.h>
659 # define CWindowOf(w) (w)
660 # define CHeightOf(w) ((w)->editable.widget.allocation.height)
661 # define CWidthOf(w) ((w)->editable.widget.allocation.width)
662 # define COptionsOf(w) ((w)->options)
664 # define cache_type unsigned int
666 /* font dimensions */
667 # define FONT_OVERHEAD gtk_edit_option_text_line_spacing
668 # define FONT_BASE_LINE (FONT_OVERHEAD + gtk_edit_option_font_ascent)
669 # define FONT_HEIGHT (gtk_edit_option_font_ascent + gtk_edit_option_font_descent)
670 # define FONT_PIX_PER_LINE (FONT_OVERHEAD + FONT_HEIGHT)
671 # define FONT_MEAN_WIDTH gtk_edit_option_font_mean_width
673 # define EDIT_FRAME_H 3
674 # define EDIT_FRAME_W 3
676 # define FONT_OFFSET_X 0
677 # define FONT_OFFSET_Y FONT_BASE_LINE
679 # define per_char gtk_edit_font_width_per_char
682 extern guchar gtk_edit_font_width_per_char
[256];
683 extern int gtk_edit_option_text_line_spacing
;
684 extern int gtk_edit_option_font_ascent
;
685 extern int gtk_edit_option_font_descent
;
686 extern int gtk_edit_option_font_mean_width
;
687 extern int gtk_edit_fixed_font
;
690 /* start temporary */
692 # define COLOR_BLACK 0
693 # define COLOR_WHITE 1
694 # define CURSOR_TYPE_EDITOR 0
696 # define WIN_MESSAGES GTK_WINDOW_TOPLEVEL, 20, 20
697 # define option_text_line_spacing 1
698 # define fixed_font 0
700 #define color_palette(x) win->color[x].pixel
716 #define dnd_null_term_type(d) \
717 ((d) == DndFile || (d) == DndText || (d) == DndDir || \
718 (d) == DndLink || (d) == DndExe || (d) == DndURL)
726 # define WIN_MESSAGES edit->widget ? edit->widget->mainid : CRoot, 20, 20
735 # define min(x,y) (((x) < (y)) ? (x) : (y))
739 # define max(x,y) (((x) > (y)) ? (x) : (y))
743 extern Display *gdk_display;
744 extern Window gdk_root_window;
748 match_file
, match_normal
751 # define edit_get_load_file(d,f,h) gtk_edit_dialog_get_load_file(d,f,h)
752 # define edit_get_save_file(d,f,h) gtk_edit_dialog_get_save_file(d,f,h)
753 # define edit_error_dialog(h,t) gtk_edit_dialog_error(h,"%s",t)
754 # define edit_message_dialog(h,t) gtk_edit_dialog_message(0,h,"%s",t)
755 # define edit_query_dialog2(h,t,a,b) gtk_edit_dialog_query(h,t,a,b,0)
756 # define edit_query_dialog3(h,t,a,b,c) gtk_edit_dialog_query(h,t,a,b,c,0)
757 # define edit_query_dialog4(h,t,a,b,c,d) gtk_edit_dialog_query(h,t,a,b,c,d,0)
759 # define CError(x) printf("Error: %s\n",x)
760 # define CIsDropAcknowledge(a,b) DndNotDnd
761 # define CGetDrop(e,d,s,x,y) DndNotDnd
762 # define CDropAcknowledge(x)
763 /* # define edit_get_syntax_color(e,i,f,b) */
764 # define get_international_character(k) 0
765 # define compose_key_pressed 0
769 # define edit_get_load_file(d,f,h) CGetLoadFile(WIN_MESSAGES,d,f,h)
770 # define edit_get_save_file(d,f,h) CGetSaveFile(WIN_MESSAGES,d,f,h)
771 # define edit_error_dialog(h,t) CErrorDialog(WIN_MESSAGES,h,"%s",t)
772 # define edit_message_dialog(h,t) CMessageDialog(WIN_MESSAGES,0,h,"%s",t)
773 # define edit_query_dialog2(h,t,a,b) CQueryDialog(WIN_MESSAGES,h,t,a,b,0)
774 # define edit_query_dialog3(h,t,a,b,c) CQueryDialog(WIN_MESSAGES,h,t,a,b,c,0)
775 # define edit_query_dialog4(h,t,a,b,c,d) CQueryDialog(WIN_MESSAGES,h,t,a,b,c,d,0)
778 #endif /* ! MIDNIGHT */
780 extern char *home_dir
;
782 #define NUM_SELECTION_HISTORY 64
786 #define MAX_PATH_LEN PATH_MAX
788 #define MAX_PATH_LEN 1024
794 struct selection selection
=
796 int current_selection
= 0;
797 /* Note: selection.text = selection_history[current_selection].text */
798 struct selection selection_history
[NUM_SELECTION_HISTORY
] =
814 what editor are we going to emulate? one of EDIT_KEY_EMULATION_NORMAL
815 or EDIT_KEY_EMULATION_EMACS
817 int edit_key_emulation
= EDIT_KEY_EMULATION_NORMAL
;
818 #endif /* ! MIDNIGHT */
820 int option_word_wrap_line_length
= 72;
821 int option_typewriter_wrap
= 0;
822 int option_auto_para_formatting
= 0;
823 int option_international_characters
= 0;
824 int option_tab_spacing
= 8;
825 int option_fill_tabs_with_spaces
= 0;
826 int option_return_does_auto_indent
= 1;
827 int option_backspace_through_tabs
= 0;
828 int option_fake_half_tabs
= 1;
829 int option_save_mode
= 0;
830 int option_backup_ext_int
= -1;
831 int option_find_bracket
= 1;
832 int option_max_undo
= 32768;
834 int option_editor_fg_normal
= 26;
835 int option_editor_fg_bold
= 8;
836 int option_editor_fg_italic
= 10;
838 int option_edit_right_extreme
= 0;
839 int option_edit_left_extreme
= 0;
840 int option_edit_top_extreme
= 0;
841 int option_edit_bottom_extreme
= 0;
843 int option_editor_bg_normal
= 1;
844 int option_editor_bg_abnormal
= 0;
845 int option_editor_bg_marked
= 2;
846 int option_editor_bg_marked_abnormal
= 9;
847 int option_editor_bg_highlighted
= 12;
848 int option_editor_fg_cursor
= 18;
850 char *option_whole_chars_search
= "0123456789abcdefghijklmnopqrstuvwxyz_";
851 char *option_chars_move_whole_word
= "!=&|<>^~ !:;, !'!`!.?!\"!( !) !Aa0 !+-*/= |<> ![ !] !\\#! ";
852 char *option_backup_ext
= "~";
854 #else /* ! _EDIT_C */
856 extern struct selection selection
;
857 extern struct selection selection_history
[];
858 extern int current_selection
;
862 what editor are we going to emulate? one of EDIT_KEY_EMULATION_NORMAL
863 or EDIT_KEY_EMULATION_EMACS
865 extern int edit_key_emulation
;
866 #endif /* ! MIDNIGHT */
868 extern int option_word_wrap_line_length
;
869 extern int option_typewriter_wrap
;
870 extern int option_auto_para_formatting
;
871 extern int option_international_characters
;
872 extern int option_tab_spacing
;
873 extern int option_fill_tabs_with_spaces
;
874 extern int option_return_does_auto_indent
;
875 extern int option_backspace_through_tabs
;
876 extern int option_fake_half_tabs
;
877 extern int option_save_mode
;
878 extern int option_backup_ext_int
;
879 extern int option_find_bracket
;
880 extern int option_max_undo
;
882 extern int option_editor_fg_normal
;
883 extern int option_editor_fg_bold
;
884 extern int option_editor_fg_italic
;
886 extern int option_edit_right_extreme
;
887 extern int option_edit_left_extreme
;
888 extern int option_edit_top_extreme
;
889 extern int option_edit_bottom_extreme
;
891 extern int option_editor_bg_normal
;
892 extern int option_editor_bg_abnormal
;
893 extern int option_editor_bg_marked
;
894 extern int option_editor_bg_marked_abnormal
;
895 extern int option_editor_bg_highlighted
;
896 extern int option_editor_fg_cursor
;
898 extern char *option_whole_chars_search
;
899 extern char *option_chars_move_whole_word
;
900 extern char *option_backup_ext
;
902 extern int edit_confirm_save
;
904 #endif /* ! _EDIT_C */
905 #endif /* __EDIT_H */