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., 675 Mass Ave, Cambridge, MA 02139, USA. */
27 #define HAVE_SYNTAXH 1
32 # include <sys/types.h>
38 # include <sys/stat.h>
46 #else /* ! MIDNIGHT */
51 # include <sys/types.h>
60 # include <my_string.h>
62 # include <sys/stat.h>
71 # if TIME_WITH_SYS_TIME
72 # include <sys/time.h>
76 # include <sys/time.h>
89 # include <X11/Xlib.h>
90 # include <X11/Xutil.h>
91 # include <X11/Xresource.h>
94 # include "coolwidget.h"
95 # include "app_glob.c"
96 # include "coollocal.h"
97 # include "stringtools.h"
100 # include "gdk/gdkprivate.h"
101 # include "gdk/gdk.h"
102 # include "gtkedit.h"
103 # include "editcmddef.h"
112 # include "src/main.h" /* for char *shell */
113 # include "src/dlg.h"
114 # include "src/widget.h"
115 # include "src/color.h"
116 # include "src/dialog.h"
117 # include "src/mouse.h"
118 # include "src/global.h"
119 # include "src/help.h"
120 # include "src/key.h"
121 # include "src/wtools.h" /* for QuickWidgets */
122 # include "src/win.h"
123 # include "vfs/vfs.h"
124 # include "src/menu.h"
126 # define WANT_WIDGETS
128 # define WIDGET_COMMAND (WIDGET_USER + 10)
134 /* unistd.h defines _POSIX_VERSION on POSIX.1 systems. */
135 #if defined(HAVE_DIRENT_H) || defined(_POSIX_VERSION)
137 # define NLENGTH(dirent) (strlen ((dirent)->d_name))
139 # define dirent direct
140 # define NLENGTH(dirent) ((dirent)->d_namlen)
142 # ifdef HAVE_SYS_NDIR_H
143 # include <sys/ndir.h>
144 # endif /* HAVE_SYS_NDIR_H */
146 # ifdef HAVE_SYS_DIR_H
147 # include <sys/dir.h>
148 # endif /* HAVE_SYS_DIR_H */
152 # endif /* HAVE_NDIR_H */
153 #endif /* not (HAVE_DIRENT_H or _POSIX_VERSION) */
159 # define CDisplay gdk_display
160 # define CRoot gdk_root_parent
161 # define Window GtkEdit *
164 #define SEARCH_DIALOG_OPTION_NO_SCANF 1
165 #define SEARCH_DIALOG_OPTION_NO_REGEX 2
166 #define SEARCH_DIALOG_OPTION_NO_CASE 4
167 #define SEARCH_DIALOG_OPTION_BACKWARDS 8
169 #define SYNTAX_FILE "/.cedit/syntax"
170 #define CLIP_FILE "/.cedit/cooledit.clip"
171 #define MACRO_FILE "/.cedit/cooledit.macros"
172 #define BLOCK_FILE "/.cedit/cooledit.block"
173 #define ERROR_FILE "/.cedit/cooledit.error"
174 #define TEMP_FILE "/.cedit/cooledit.temp"
175 #define SCRIPT_FILE "/.cedit/cooledit.script"
176 #define EDIT_DIR "/.cedit"
178 #define EDIT_KEY_EMULATION_NORMAL 0
179 #define EDIT_KEY_EMULATION_EMACS 1
181 #define REDRAW_LINE (1 << 0)
182 #define REDRAW_LINE_ABOVE (1 << 1)
183 #define REDRAW_LINE_BELOW (1 << 2)
184 #define REDRAW_AFTER_CURSOR (1 << 3)
185 #define REDRAW_BEFORE_CURSOR (1 << 4)
186 #define REDRAW_PAGE (1 << 5)
187 #define REDRAW_IN_BOUNDS (1 << 6)
188 #define REDRAW_CHAR_ONLY (1 << 7)
189 #define REDRAW_COMPLETELY (1 << 8)
191 #define MOD_ABNORMAL (1 << 0)
192 #define MOD_UNDERLINED (1 << 1)
193 #define MOD_BOLD (1 << 2)
194 #define MOD_HIGHLIGHTED (1 << 3)
195 #define MOD_MARKED (1 << 4)
196 #define MOD_ITALIC (1 << 5)
197 #define MOD_CURSOR (1 << 6)
198 #define MOD_INVERSE (1 << 7)
202 # define EDIT_TEXT_HORIZONTAL_OFFSET 0
203 # define EDIT_TEXT_VERTICAL_OFFSET 0
205 # define EDIT_TEXT_HORIZONTAL_OFFSET 4
206 # define EDIT_TEXT_VERTICAL_OFFSET 3
209 # define EDIT_TEXT_HORIZONTAL_OFFSET 0
210 # define EDIT_TEXT_VERTICAL_OFFSET 1
211 # define FONT_OFFSET_X 0
212 # define FONT_OFFSET_Y 0
215 #define EDIT_RIGHT_EXTREME option_edit_right_extreme
216 #define EDIT_LEFT_EXTREME option_edit_left_extreme
217 #define EDIT_TOP_EXTREME option_edit_top_extreme
218 #define EDIT_BOTTOM_EXTREME option_edit_bottom_extreme
220 #define MAX_MACRO_LENGTH 1024
222 /*there are a maximum of ... */
224 /*... edit buffers, each of which is ... */
225 #define EDIT_BUF_SIZE 0x10000
226 /* ...bytes in size. */
228 /*x / EDIT_BUF_SIZE equals x >> ... */
229 #define S_EDIT_BUF_SIZE 16
231 /* x % EDIT_BUF_SIZE is equal to x && ... */
232 #define M_EDIT_BUF_SIZE 0xFFFF
234 #define SIZE_LIMIT (EDIT_BUF_SIZE * (MAXBUFF - 2))
235 /* Note a 16k stack is 64k of data and enough to hold (usually) around 10
236 pages of undo info. */
239 #define START_STACK_SIZE 32
242 /*some codes that may be pushed onto or returned from the undo stack: */
243 #define CURS_LEFT 601
244 #define CURS_RIGHT 602
246 #define BACKSPACE 604
247 #define STACK_BOTTOM 605
248 #define CURS_LEFT_LOTS 606
249 #define CURS_RIGHT_LOTS 607
250 #define COLUMN_ON 608
251 #define COLUMN_OFF 609
253 #define MARK_2 700000000
254 #define KEY_PRESS 1400000000
256 /*Tabs spaces: (sofar only HALF_TAB_SIZE is used: */
257 #define TAB_SIZE option_tab_spacing
258 #define HALF_TAB_SIZE ((int) option_tab_spacing / 2)
266 unsigned char * text
;
271 #define RULE_CONTEXT 0x00FFF000UL
272 #define RULE_CONTEXT_SHIFT 12
273 #define RULE_WORD 0x00000FFFUL
274 #define RULE_WORD_SHIFT 0
275 #define RULE_ON_LEFT_BORDER 0x02000000UL
276 #define RULE_ON_RIGHT_BORDER 0x01000000UL
282 char *whole_word_chars_left
;
283 char *whole_word_chars_right
;
284 #define NO_COLOR ((unsigned long) -1);
290 struct context_rule
{
295 char line_start_left
;
299 char line_start_right
;
301 int between_delimiters
;
302 char *whole_word_chars_left
;
303 char *whole_word_chars_right
;
304 char *keyword_first_chars
;
305 char *keyword_last_chars
;
306 /* first word is word[1] */
307 struct key_word
**keyword
;
310 struct _syntax_marker
{
313 struct _syntax_marker
*next
;
316 struct editor_widget
{
322 struct cool_widget
*widget
;
324 #define from_here num_widget_lines
325 int num_widget_lines
;
326 int num_widget_columns
;
334 char *filename
; /* Name of the file */
335 char *dir
; /* current directory */
337 /* dynamic buffers and curser position for editor: */
338 long curs1
; /*position of the cursor from the beginning of the file. */
339 long curs2
; /*position from the end of the file */
340 unsigned char *buffers1
[MAXBUFF
+ 1]; /*all data up to curs1 */
341 unsigned char *buffers2
[MAXBUFF
+ 1]; /*all data from end of file down to curs2 */
343 /* search variables */
344 long search_start
; /* First character to start searching from */
345 int found_len
; /* Length of found string or 0 if none was found */
346 long found_start
; /* the found word from a search - start position */
348 /* display information */
349 long last_byte
; /* Last byte of file */
350 long start_display
; /* First char displayed */
351 long start_col
; /* First displayed column, negative */
352 long max_column
; /* The maximum cursor position ever reached used to calc hori scroll bar */
353 long curs_row
; /*row position of curser on the screen */
354 long curs_col
; /*column position on screen */
355 int force
; /* how much of the screen do we redraw? */
356 unsigned char overwrite
;
357 unsigned char modified
; /*has the file been changed?: 1 if char inserted or
358 deleted at all since last load or save */
359 #if defined(MIDNIGHT) || defined(GTK)
360 int delete_file
; /* has the file been created in edit_load_file? Delete
361 it at end of editing when it hasn't been modified
364 unsigned char highlight
;
365 long prev_col
; /*recent column position of the curser - used when moving
366 up or down past lines that are shorter than the current line */
367 long curs_line
; /*line number of the cursor. */
368 long start_line
; /*line nummber of the top of the page */
371 long total_lines
; /*total lines in the file */
372 long mark1
; /*position of highlight start */
373 long mark2
; /*position of highlight end */
374 int column1
; /*position of column highlight start */
375 int column2
; /*position of column highlight end */
376 long bracket
; /*position of a matching bracket */
378 /* cache speedup for line lookups */
379 #define N_LINE_CACHES 32
381 int line_numbers
[N_LINE_CACHES
];
382 long line_offsets
[N_LINE_CACHES
];
384 /* undo stack and pointers */
385 unsigned long stack_pointer
;
387 unsigned long stack_size
;
388 unsigned long stack_size_mask
;
389 unsigned long stack_bottom
;
392 /* syntax higlighting */
393 struct _syntax_marker
*syntax_marker
;
394 struct context_rule
**rules
;
397 char *syntax_type
; /* description of syntax highlighting type being used */
398 int explicit_syntax
; /* have we forced the syntax hi. type in spite of the filename? */
400 int to_here
; /* dummy marker */
404 int macro_i
; /* -1 if not recording index to macro[] otherwise */
405 struct macro macro
[MAX_MACRO_LENGTH
];
408 typedef struct editor_widget WEdit
;
412 void edit_render_expose (WEdit
* edit
, XExposeEvent
* xexpose
);
414 void edit_render_tidbits (struct cool_widget
*w
);
415 int eh_editor (CWidget
* w
, XEvent
* xevent
, CEvent
* cwevent
);
417 void edit_draw_menus (Window parent
, int x
, int y
);
418 void edit_run_make (void);
419 void edit_change_directory (void);
420 int edit_man_page_cmd (WEdit
* edit
);
421 void edit_search_replace_dialog (Window parent
, int x
, int y
, char **search_text
, char **replace_text
, char **arg_order
, char *heading
, int option
);
422 void edit_search_dialog (WEdit
* edit
, char **search_text
);
423 long edit_find (long search_start
, unsigned char *expr
, int *len
, long last_byte
, int (*get_byte
) (void *, long), void *data
);
424 void edit_set_foreground_colors (unsigned long normal
, unsigned long bold
, unsigned long italic
);
425 void edit_set_background_colors (unsigned long normal
, unsigned long abnormal
, unsigned long marked
, unsigned long marked_abnormal
, unsigned long highlighted
);
426 void edit_set_cursor_color (unsigned long c
);
427 void draw_options_dialog (Window parent
, int x
, int y
);
428 void CRefreshEditor (WEdit
* edit
);
429 void edit_set_user_command (void (*func
) (WEdit
*, int));
430 void edit_draw_this_line_proportional (WEdit
* edit
, long b
, int curs_row
, int start_column
, int end_column
);
431 unsigned char get_international_character (unsigned char key_press
);
432 void edit_set_user_key_function (int (*user_def_key_func
) (unsigned int, unsigned int, KeySym keysym
));
436 int edit_drop_hotkey_menu (WEdit
* e
, int key
);
437 void edit_menu_cmd (WEdit
* e
);
438 void edit_init_menu_emacs (void);
439 void edit_init_menu_normal (void);
440 void edit_done_menu (void);
441 int edit_raw_key_query (char *heading
, char *query
, int cancel
);
442 char *strcasechr (const unsigned char *s
, int c
);
443 int edit (const char *_file
, int line
);
444 int edit_translate_key (WEdit
* edit
, unsigned int x_keycode
, long x_key
, int x_state
, int *cmd
, int *ch
);
448 #ifndef NO_INLINE_GETBYTE
449 int edit_get_byte (WEdit
* edit
, long byte_index
);
451 static inline int edit_get_byte (WEdit
* edit
, long byte_index
)
454 if (byte_index
>= (edit
->curs1
+ edit
->curs2
) || byte_index
< 0)
457 if (byte_index
>= edit
->curs1
) {
458 p
= edit
->curs1
+ edit
->curs2
- byte_index
- 1;
459 return edit
->buffers2
[p
>> S_EDIT_BUF_SIZE
][EDIT_BUF_SIZE
- (p
& M_EDIT_BUF_SIZE
) - 1];
461 return edit
->buffers1
[byte_index
>> S_EDIT_BUF_SIZE
][byte_index
& M_EDIT_BUF_SIZE
];
466 char *edit_get_buffer_as_text (WEdit
* edit
);
467 int edit_load_file (WEdit
* edit
, const char *filename
, const char *text
, unsigned long text_size
);
468 int edit_count_lines (WEdit
* edit
, long current
, int upto
);
469 long edit_move_forward (WEdit
* edit
, long current
, int lines
, long upto
);
470 long edit_move_forward3 (WEdit
* edit
, long current
, int cols
, long upto
);
471 long edit_move_backward (WEdit
* edit
, long current
, int lines
);
472 void edit_scroll_screen_over_cursor (WEdit
* edit
);
473 void edit_render_keypress (WEdit
* edit
);
474 void edit_scroll_upward (WEdit
* edit
, unsigned long i
);
475 void edit_scroll_downward (WEdit
* edit
, int i
);
476 void edit_scroll_right (WEdit
* edit
, int i
);
477 void edit_scroll_left (WEdit
* edit
, int i
);
478 int edit_get_col (WEdit
* edit
);
479 long edit_bol (WEdit
* edit
, long current
);
480 long edit_eol (WEdit
* edit
, long current
);
481 void edit_update_curs_row (WEdit
* edit
);
482 void edit_update_curs_col (WEdit
* edit
);
484 void edit_block_copy_cmd (WEdit
* edit
);
485 void edit_block_move_cmd (WEdit
* edit
);
486 int edit_block_delete_cmd (WEdit
* edit
);
487 int edit_block_delete (WEdit
* edit
);
488 void edit_delete_line (WEdit
* edit
);
490 int edit_delete (WEdit
* edit
);
491 void edit_insert (WEdit
* edit
, int c
);
492 int edit_cursor_move (WEdit
* edit
, long increment
);
493 void edit_push_action (WEdit
* edit
, long c
,...);
494 void edit_push_key_press (WEdit
* edit
);
495 void edit_insert_ahead (WEdit
* edit
, int c
);
496 int edit_save_file (WEdit
* edit
, const char *filename
);
497 int edit_save_cmd (WEdit
* edit
);
498 int edit_save_confirm_cmd (WEdit
* edit
);
499 int edit_save_as_cmd (WEdit
* edit
);
500 WEdit
*edit_init (WEdit
* edit
, int lines
, int columns
, const char *filename
, const char *text
, const char *dir
, unsigned long text_size
);
501 int edit_clean (WEdit
* edit
);
502 int edit_renew (WEdit
* edit
);
503 int edit_new_cmd (WEdit
* edit
);
504 int edit_reload (WEdit
* edit
, const char *filename
, const char *text
, const char *dir
, unsigned long text_size
);
505 int edit_load_cmd (WEdit
* edit
);
506 void edit_mark_cmd (WEdit
* edit
, int unmark
);
507 void edit_set_markers (WEdit
* edit
, long m1
, long m2
, int c1
, int c2
);
508 void edit_push_markers (WEdit
* edit
);
509 void edit_quit_cmd (WEdit
* edit
);
510 void edit_replace_cmd (WEdit
* edit
, int again
);
511 void edit_search_cmd (WEdit
* edit
, int again
);
512 int edit_save_block_cmd (WEdit
* edit
);
513 int edit_insert_file_cmd (WEdit
* edit
);
514 int edit_insert_file (WEdit
* edit
, const char *filename
);
515 void edit_block_process_cmd (WEdit
* edit
, const char *shell_cmd
, int block
);
516 char *catstrs (const char *first
,...);
517 void edit_refresh_cmd (WEdit
* edit
);
518 void edit_date_cmd (WEdit
* edit
);
519 void edit_goto_cmd (WEdit
* edit
);
520 int eval_marks (WEdit
* edit
, long *start_mark
, long *end_mark
);
521 void edit_status (WEdit
* edit
);
522 int edit_execute_command (WEdit
* edit
, int command
, int char_for_insertion
);
523 int edit_execute_key_command (WEdit
* edit
, int command
, int char_for_insertion
);
524 void edit_update_screen (WEdit
* edit
);
525 int edit_printf (WEdit
* e
, const char *fmt
,...);
526 int edit_print_string (WEdit
* e
, const char *s
);
527 void edit_move_to_line (WEdit
* e
, long line
);
528 void edit_move_display (WEdit
* e
, long line
);
529 void edit_word_wrap (WEdit
* edit
);
530 unsigned char *edit_get_block (WEdit
* edit
, long start
, long finish
, int *l
);
531 int edit_sort_cmd (WEdit
* edit
);
532 void edit_help_cmd (WEdit
* edit
);
533 void edit_left_word_move (WEdit
* edit
);
534 void edit_right_word_move (WEdit
* edit
);
535 void edit_get_selection (WEdit
* edit
);
537 int edit_save_macro_cmd (WEdit
* edit
, struct macro macro
[], int n
);
538 int edit_load_macro_cmd (WEdit
* edit
, struct macro macro
[], int *n
, int k
);
539 void edit_delete_macro_cmd (WEdit
* edit
);
541 int edit_copy_to_X_buf_cmd (WEdit
* edit
);
542 int edit_cut_to_X_buf_cmd (WEdit
* edit
);
543 void edit_paste_from_X_buf_cmd (WEdit
* edit
);
545 void edit_paste_from_history (WEdit
*edit
);
547 void edit_split_filename (WEdit
* edit
, char *name
);
550 #define CWidget Widget
552 #define CWidget GtkEdit
554 void edit_set_syntax_change_callback (void (*callback
) (CWidget
*));
555 void edit_load_syntax (WEdit
* edit
, char **names
, char *type
);
556 void edit_free_syntax_rules (WEdit
* edit
);
557 void edit_get_syntax_color (WEdit
* edit
, long byte_index
, int *fg
, int *bg
);
562 /* put OS2/NT/WIN95 defines here */
565 # define MY_O_TEXT O_TEXT
570 # define FONT_PIX_PER_LINE 1
571 # define FONT_MEAN_WIDTH 1
573 # define get_sys_error(s) (s)
574 # define open mc_open
575 # define close(f) mc_close(f)
576 # define read(f,b,c) mc_read(f,b,c)
577 # define write(f,b,c) mc_write(f,b,c)
578 # define stat(f,s) mc_stat(f,s)
579 # define mkdir(s,m) mc_mkdir(s,m)
580 # define itoa MY_itoa
582 # define edit_get_load_file(d,f,h) input_dialog (h, " Enter file name: ", f)
583 # define edit_get_save_file(d,f,h) input_dialog (h, " Enter file name: ", f)
584 # define CMalloc(x) malloc(x)
586 # define set_error_msg(s) edit_init_error_msg = strdup(s)
590 # define edit_error_dialog(h,s) set_error_msg(s)
591 char *edit_init_error_msg
= NULL
;
593 # else /* ! _EDIT_C */
595 # define edit_error_dialog(h,s) query_dialog (h, s, 0, 1, _("&Dismiss"))
596 # define edit_message_dialog(h,s) query_dialog (h, s, 0, 1, _("&Ok"))
597 extern char *edit_init_error_msg
;
599 # endif /* ! _EDIT_C */
602 # define get_error_msg(s) edit_init_error_msg
603 # define edit_query_dialog2(h,t,a,b) query_dialog(h,t,0,2,a,b)
604 # define edit_query_dialog3(h,t,a,b,c) query_dialog(h,t,0,3,a,b,c)
605 # define edit_query_dialog4(h,t,a,b,c,d) query_dialog(h,t,0,4,a,b,c,d)
607 #else /* ! MIDNIGHT */
610 # define get_sys_error(s) (s)
612 # define open mc_open
613 # define close(f) mc_close(f)
614 # define read(f,b,c) mc_read(f,b,c)
615 # define write(f,b,c) mc_write(f,b,c)
616 # define stat(f,s) mc_stat(f,s)
617 # define mkdir(s,m) mc_mkdir(s,m)
619 # define itoa MY_itoa
620 # define CMalloc(x) malloc(x)
622 # define EDITOR_NO_FILE (1<<3)
623 # define EDITOR_NO_SCROLL (1<<4)
624 # define EDITOR_NO_TEXT (1<<5)
625 # define EDITOR_HORIZ_SCROLL (1<<6)
627 #include <gdk/gdkprivate.h>
628 # define CWindowOf(w) (w)
629 # define CHeightOf(w) ((w)->editable.widget.allocation.height)
630 # define CWidthOf(w) ((w)->editable.widget.allocation.width)
631 # define COptionsOf(w) ((w)->options)
633 # define cache_type unsigned int
635 /* font dimensions */
636 # define FONT_OVERHEAD gtk_edit_option_text_line_spacing
637 # define FONT_BASE_LINE (FONT_OVERHEAD + gtk_edit_option_font_ascent)
638 # define FONT_HEIGHT (gtk_edit_option_font_ascent + gtk_edit_option_font_descent)
639 # define FONT_PIX_PER_LINE (FONT_OVERHEAD + FONT_HEIGHT)
640 # define FONT_MEAN_WIDTH gtk_edit_option_font_mean_width
642 # define FONT_OFFSET_X 0
643 # define FONT_OFFSET_Y FONT_BASE_LINE
645 # define per_char gtk_edit_font_width_per_char
648 extern guchar gtk_edit_font_width_per_char
[256];
649 extern int gtk_edit_option_text_line_spacing
;
650 extern int gtk_edit_option_font_ascent
;
651 extern int gtk_edit_option_font_descent
;
652 extern int gtk_edit_option_font_mean_width
;
653 extern int gtk_edit_fixed_font
;
656 /* start temporary */
658 # define COLOR_BLACK 0
659 # define COLOR_WHITE 1
660 # define CURSOR_TYPE_EDITOR 0
662 # define WIN_MESSAGES GTK_WINDOW_TOPLEVEL, 20, 20
663 # define option_text_line_spacing 1
664 # define fixed_font 0
666 #define color_palette(x) win->color[x].pixel
682 #define dnd_null_term_type(d) \
683 ((d) == DndFile || (d) == DndText || (d) == DndDir || \
684 (d) == DndLink || (d) == DndExe || (d) == DndURL)
692 # define WIN_MESSAGES edit->widget ? edit->widget->mainid : CRoot, 20, 20
701 # define min(x,y) (((x) < (y)) ? (x) : (y))
705 # define max(x,y) (((x) > (y)) ? (x) : (y))
709 extern Display *gdk_display;
710 extern Window gdk_root_window;
714 match_file
, match_normal
717 # define edit_get_load_file(d,f,h) gtk_edit_dialog_get_load_file(d,f,h)
718 # define edit_get_save_file(d,f,h) gtk_edit_dialog_get_save_file(d,f,h)
719 # define edit_error_dialog(h,t) gtk_edit_dialog_error(h,"%s",t)
720 # define edit_message_dialog(h,t) gtk_edit_dialog_message(0,h,"%s",t)
721 # define edit_query_dialog2(h,t,a,b) gtk_edit_dialog_query(h,t,a,b,0)
722 # define edit_query_dialog3(h,t,a,b,c) gtk_edit_dialog_query(h,t,a,b,c,0)
723 # define edit_query_dialog4(h,t,a,b,c,d) gtk_edit_dialog_query(h,t,a,b,c,d,0)
725 # define CError(x) printf("Error: %s\n",x)
726 # define CIsDropAcknowledge(a,b) DndNotDnd
727 # define CGetDrop(e,d,s,x,y) DndNotDnd
728 # define CDropAcknowledge(x)
729 /* # define edit_get_syntax_color(e,i,f,b) */
730 # define get_international_character(k) 0
731 # define compose_key_pressed 0
735 # define edit_get_load_file(d,f,h) CGetLoadFile(WIN_MESSAGES,d,f,h)
736 # define edit_get_save_file(d,f,h) CGetSaveFile(WIN_MESSAGES,d,f,h)
737 # define edit_error_dialog(h,t) CErrorDialog(WIN_MESSAGES,h,"%s",t)
738 # define edit_message_dialog(h,t) CMessageDialog(WIN_MESSAGES,0,h,"%s",t)
739 # define edit_query_dialog2(h,t,a,b) CQueryDialog(WIN_MESSAGES,h,t,a,b,0)
740 # define edit_query_dialog3(h,t,a,b,c) CQueryDialog(WIN_MESSAGES,h,t,a,b,c,0)
741 # define edit_query_dialog4(h,t,a,b,c,d) CQueryDialog(WIN_MESSAGES,h,t,a,b,c,d,0)
744 #endif /* ! MIDNIGHT */
746 extern char *home_dir
;
748 #define NUM_SELECTION_HISTORY 32
752 #define MAX_PATH_LEN PATH_MAX
754 #define MAX_PATH_LEN 1024
760 struct selection selection
=
762 int current_selection
= 0;
763 /* Note: selection.text = selection_history[current_selection].text */
764 struct selection selection_history
[NUM_SELECTION_HISTORY
] =
780 what editor are we going to emulate? one of EDIT_KEY_EMULATION_NORMAL
781 or EDIT_KEY_EMULATION_EMACS
783 int edit_key_emulation
= EDIT_KEY_EMULATION_NORMAL
;
784 #endif /* ! MIDNIGHT */
786 int option_word_wrap_line_length
= 72;
787 int option_typewriter_wrap
= 0;
788 int option_auto_para_formatting
= 0;
789 int option_international_characters
= 0;
790 int option_tab_spacing
= 8;
791 int option_fill_tabs_with_spaces
= 0;
792 int option_return_does_auto_indent
= 1;
793 int option_backspace_through_tabs
= 0;
794 int option_fake_half_tabs
= 1;
795 int option_save_mode
= 0;
796 int option_backup_ext_int
= -1;
797 int option_find_bracket
= 1;
798 int option_max_undo
= 32768;
800 int option_editor_fg_normal
= 26;
801 int option_editor_fg_bold
= 8;
802 int option_editor_fg_italic
= 10;
804 int option_edit_right_extreme
= 0;
805 int option_edit_left_extreme
= 0;
806 int option_edit_top_extreme
= 0;
807 int option_edit_bottom_extreme
= 0;
809 int option_editor_bg_normal
= 1;
810 int option_editor_bg_abnormal
= 0;
811 int option_editor_bg_marked
= 2;
812 int option_editor_bg_marked_abnormal
= 9;
813 int option_editor_bg_highlighted
= 12;
814 int option_editor_fg_cursor
= 18;
816 char *option_whole_chars_search
= "0123456789abcdefghijklmnopqrstuvwxyz_";
817 char *option_whole_chars_move
= "0123456789abcdefghijklmnopqrstuvwxyz_; ,[](){}";
818 char *option_backup_ext
= "~";
820 #else /* ! _EDIT_C */
822 extern struct selection selection
;
823 extern struct selection selection_history
[];
824 extern int current_selection
;
828 what editor are we going to emulate? one of EDIT_KEY_EMULATION_NORMAL
829 or EDIT_KEY_EMULATION_EMACS
831 extern int edit_key_emulation
;
832 #endif /* ! MIDNIGHT */
834 extern int option_word_wrap_line_length
;
835 extern int option_typewriter_wrap
;
836 extern int option_auto_para_formatting
;
837 extern int option_international_characters
;
838 extern int option_tab_spacing
;
839 extern int option_fill_tabs_with_spaces
;
840 extern int option_return_does_auto_indent
;
841 extern int option_backspace_through_tabs
;
842 extern int option_fake_half_tabs
;
843 extern int option_save_mode
;
844 extern int option_backup_ext_int
;
845 extern int option_find_bracket
;
846 extern int option_max_undo
;
848 extern int option_editor_fg_normal
;
849 extern int option_editor_fg_bold
;
850 extern int option_editor_fg_italic
;
852 extern int option_edit_right_extreme
;
853 extern int option_edit_left_extreme
;
854 extern int option_edit_top_extreme
;
855 extern int option_edit_bottom_extreme
;
857 extern int option_editor_bg_normal
;
858 extern int option_editor_bg_abnormal
;
859 extern int option_editor_bg_marked
;
860 extern int option_editor_bg_marked_abnormal
;
861 extern int option_editor_bg_highlighted
;
862 extern int option_editor_fg_cursor
;
864 extern char *option_whole_chars_search
;
865 extern char *option_whole_chars_move
;
866 extern char *option_backup_ext
;
868 extern int edit_confirm_save
;
870 #endif /* ! _EDIT_C */
871 #endif /* __EDIT_H */