* Make-mc.in: Include necessary parts of Make.common to
[midnight-commander.git] / gtkedit / edit.h
blobc706e7d2bac2642b17a62098a7b27d32cb053786
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
20 02111-1307, USA.
23 #ifndef __EDIT_H
24 #define __EDIT_H
26 #ifdef HAVE_SYS_PARAM_H
27 # include <sys/param.h>
28 #endif
30 #ifdef MIDNIGHT
32 #ifdef HAVE_SLANG
33 #define HAVE_SYNTAXH 1
34 #endif
36 # include <stdio.h>
37 # include <stdarg.h>
38 # include <sys/types.h>
39 # ifdef HAVE_UNISTD_H
40 # include <unistd.h>
41 # endif
42 # include <string.h>
43 # include <ctype.h>
44 # include <errno.h>
45 # include "src/tty.h"
46 # include <sys/stat.h>
47 # include <errno.h>
49 # include <fcntl.h>
51 # include <stdlib.h>
52 # if !defined(STDC_HEADERS) && defined(HAVE_MALLOC_H)
53 # include <malloc.h>
54 # endif
56 #else /* ! MIDNIGHT */
58 # include "global.h"
59 # include <stdio.h>
60 # include <stdarg.h>
61 # include <sys/types.h>
63 # ifdef HAVE_UNISTD_H
64 # include <unistd.h>
65 # endif
67 #ifdef GTK
68 # include <string.h>
69 #else
70 # include <my_string.h>
71 #endif
72 # include <ctype.h>
73 # include <errno.h>
74 # include <sys/stat.h>
76 # ifdef HAVE_FCNTL_H
77 # include <fcntl.h>
78 # endif
80 # include <stdlib.h>
81 # include <stdarg.h>
83 # if TIME_WITH_SYS_TIME
84 # include <sys/time.h>
85 # include <time.h>
86 # else
87 # if HAVE_SYS_TIME_H
88 # include <sys/time.h>
89 # else
90 # include <time.h>
91 # endif
92 # endif
94 # include "regex.h"
96 #endif
98 #ifndef MIDNIGHT
100 # include <signal.h>
101 # include <X11/Xlib.h>
102 # include <X11/Xutil.h>
103 # include <X11/Xresource.h>
104 # include "lkeysym.h"
105 #ifndef GTK
106 # include "coolwidget.h"
107 # include "app_glob.c"
108 # include "coollocal.h"
109 # include "stringtools.h"
110 #else
111 # include <gtk/gtk.h>
112 # include <gdk/gdkprivate.h>
113 # include <gdk/gdk.h>
114 # include "gtkedit.h"
115 # include "editcmddef.h"
116 # ifndef _
117 # define _(x) x
118 # define N_(x) x
119 # endif
120 #endif
122 #else
124 # include "src/global.h"
125 # include "src/main.h" /* for char *shell */
126 # include "src/mad.h"
127 # include "src/dlg.h"
128 # include "src/widget.h"
129 # include "src/color.h"
130 # include "src/dialog.h"
131 # include "src/mouse.h"
132 # include "src/help.h"
133 # include "src/key.h"
134 # include "src/wtools.h" /* for QuickWidgets */
135 # include "src/cmd.h" /* for menu_edit_cmd */
136 # include "src/win.h"
137 # include "vfs/vfs.h"
138 # include "src/menu.h"
139 # include <regex.h>
140 # define WANT_WIDGETS
142 # define WIDGET_COMMAND (WIDGET_USER + 10)
143 # define N_menus 5
145 #endif
147 #ifdef GTK
148 /* unistd.h defines _POSIX_VERSION on POSIX.1 systems. */
149 #if defined(HAVE_DIRENT_H) || defined(_POSIX_VERSION)
150 # include <dirent.h>
151 # define NLENGTH(dirent) (strlen ((dirent)->d_name))
152 #else
153 # define dirent direct
154 # define NLENGTH(dirent) ((dirent)->d_namlen)
156 # ifdef HAVE_SYS_NDIR_H
157 # include <sys/ndir.h>
158 # endif /* HAVE_SYS_NDIR_H */
160 # ifdef HAVE_SYS_DIR_H
161 # include <sys/dir.h>
162 # endif /* HAVE_SYS_DIR_H */
164 # ifdef HAVE_NDIR_H
165 # include <ndir.h>
166 # endif /* HAVE_NDIR_H */
167 #endif /* not (HAVE_DIRENT_H or _POSIX_VERSION) */
168 # ifndef _
169 # define _(x) x
170 # define N_(x) x
171 # endif
172 #include "vfs/vfs.h"
173 #include "src/dialog.h" /* for input_dialog() */
174 #include "src/util.h" /* for is_printable() */
175 # define CDisplay gdk_display
176 # define CRoot gdk_root_parent
177 # define Window GtkEdit *
178 #endif
180 #define SEARCH_DIALOG_OPTION_NO_SCANF 1
181 #define SEARCH_DIALOG_OPTION_NO_REGEX 2
182 #define SEARCH_DIALOG_OPTION_NO_CASE 4
183 #define SEARCH_DIALOG_OPTION_BACKWARDS 8
184 #define SEARCH_DIALOG_OPTION_BOOKMARK 16
186 #define EDIT_KEY_EMULATION_NORMAL 0
187 #define EDIT_KEY_EMULATION_EMACS 1
189 #define REDRAW_LINE (1 << 0)
190 #define REDRAW_LINE_ABOVE (1 << 1)
191 #define REDRAW_LINE_BELOW (1 << 2)
192 #define REDRAW_AFTER_CURSOR (1 << 3)
193 #define REDRAW_BEFORE_CURSOR (1 << 4)
194 #define REDRAW_PAGE (1 << 5)
195 #define REDRAW_IN_BOUNDS (1 << 6)
196 #define REDRAW_CHAR_ONLY (1 << 7)
197 #define REDRAW_COMPLETELY (1 << 8)
199 #define MOD_ABNORMAL (1 << 0)
200 #define MOD_UNDERLINED (1 << 1)
201 #define MOD_BOLD (1 << 2)
202 #define MOD_HIGHLIGHTED (1 << 3)
203 #define MOD_MARKED (1 << 4)
204 #define MOD_ITALIC (1 << 5)
205 #define MOD_CURSOR (1 << 6)
206 #define MOD_INVERSE (1 << 7)
208 #ifndef MIDNIGHT
209 # ifdef GTK
210 # define EDIT_TEXT_HORIZONTAL_OFFSET 0
211 # define EDIT_TEXT_VERTICAL_OFFSET 0
212 # else
213 # define EDIT_TEXT_HORIZONTAL_OFFSET 4
214 # define EDIT_TEXT_VERTICAL_OFFSET 3
215 # endif
216 #else
217 # define EDIT_TEXT_HORIZONTAL_OFFSET 0
218 # define EDIT_TEXT_VERTICAL_OFFSET 1
219 # define FONT_OFFSET_X 0
220 # define FONT_OFFSET_Y 0
221 #endif
223 #define EDIT_RIGHT_EXTREME option_edit_right_extreme
224 #define EDIT_LEFT_EXTREME option_edit_left_extreme
225 #define EDIT_TOP_EXTREME option_edit_top_extreme
226 #define EDIT_BOTTOM_EXTREME option_edit_bottom_extreme
228 /*there are a maximum of ... */
229 /*... edit buffers, each of which is ... */
230 #define EDIT_BUF_SIZE 0x10000
231 /* ...bytes in size. */
233 /*x / EDIT_BUF_SIZE equals x >> ... */
234 #define S_EDIT_BUF_SIZE 16
236 /* x % EDIT_BUF_SIZE is equal to x && ... */
237 #define M_EDIT_BUF_SIZE 0xFFFF
239 #define SIZE_LIMIT (EDIT_BUF_SIZE * (MAXBUFF - 2))
240 /* Note a 16k stack is 64k of data and enough to hold (usually) around 10
241 pages of undo info. */
243 /* undo stack */
244 #define START_STACK_SIZE 32
247 /*some codes that may be pushed onto or returned from the undo stack: */
248 #define CURS_LEFT 601
249 #define CURS_RIGHT 602
250 #define DELETE 603
251 #define BACKSPACE 604
252 #define STACK_BOTTOM 605
253 #define CURS_LEFT_LOTS 606
254 #define CURS_RIGHT_LOTS 607
255 #define COLUMN_ON 608
256 #define COLUMN_OFF 609
257 #define MARK_1 1000
258 #define MARK_2 700000000
259 #define KEY_PRESS 1400000000
261 /*Tabs spaces: (sofar only HALF_TAB_SIZE is used: */
262 #define TAB_SIZE option_tab_spacing
263 #define HALF_TAB_SIZE ((int) option_tab_spacing / 2)
265 struct selection {
266 unsigned char * text;
267 int len;
270 #define MAX_WORDS_PER_CONTEXT 1024
271 #define MAX_CONTEXTS 128
273 struct key_word {
274 char *keyword;
275 unsigned char first;
276 char *whole_word_chars_left;
277 char *whole_word_chars_right;
278 time_t time;
279 #define NO_COLOR 0x7FFFFFFF
280 #define SPELLING_ERROR 0x7EFEFEFE
281 int line_start;
282 int bg;
283 int fg;
286 struct context_rule {
287 char *left;
288 unsigned char first_left;
289 char *right;
290 unsigned char first_right;
291 char line_start_left;
292 char line_start_right;
293 int single_char;
294 int between_delimiters;
295 char *whole_word_chars_left;
296 char *whole_word_chars_right;
297 char *keyword_first_chars;
298 int spelling;
299 /* first word is word[1] */
300 struct key_word **keyword;
303 #include "edit-widget.h"
305 #ifndef MIDNIGHT
307 void edit_render_expose (WEdit * edit, XExposeEvent * xexpose);
308 #ifndef GTK
309 void edit_render_tidbits (struct cool_widget *w);
310 int eh_editor (CWidget * w, XEvent * xevent, CEvent * cwevent);
311 #endif
312 void edit_draw_menus (Window parent, int x, int y);
313 void edit_run_make (void);
314 void edit_change_directory (void);
315 int edit_man_page_cmd (WEdit * edit);
316 void edit_search_replace_dialog (Window parent, int x, int y, char **search_text, char **replace_text, char **arg_order, char *heading, int option);
317 void edit_search_dialog (WEdit * edit, char **search_text);
318 long edit_find (long search_start, unsigned char *expr, int *len, long last_byte, int (*get_byte) (void *, long), void *data, void *d);
319 void edit_set_foreground_colors (unsigned long normal, unsigned long bold, unsigned long italic);
320 void edit_set_background_colors (unsigned long normal, unsigned long abnormal, unsigned long marked, unsigned long marked_abnormal, unsigned long highlighted);
321 void edit_set_cursor_color (unsigned long c);
322 void draw_options_dialog (Window parent, int x, int y);
323 void CRefreshEditor (WEdit * edit);
324 void edit_set_user_command (void (*func) (WEdit *, int));
325 void edit_draw_this_line_proportional (WEdit * edit, long b, int curs_row, int start_column, int end_column);
326 unsigned char get_international_character (unsigned char key_press);
327 void edit_set_user_key_function (int (*user_def_key_func) (unsigned int, unsigned int, KeySym keysym));
329 #else
331 int edit_drop_hotkey_menu (WEdit * e, int key);
332 void edit_menu_cmd (WEdit * e);
333 void edit_init_menu_emacs (void);
334 void edit_init_menu_normal (void);
335 void edit_done_menu (void);
336 int edit_raw_key_query (char *heading, char *query, int cancel);
337 char *strcasechr (const unsigned char *s, int c);
338 int edit (const char *_file, int line);
339 int edit_translate_key (WEdit * edit, unsigned int x_keycode, long x_key, int x_state, int *cmd, int *ch);
341 #endif
343 #ifndef NO_INLINE_GETBYTE
344 int edit_get_byte (WEdit * edit, long byte_index);
345 #else
346 static inline int edit_get_byte (WEdit * edit, long byte_index)
348 unsigned long p;
349 if (byte_index >= (edit->curs1 + edit->curs2) || byte_index < 0)
350 return '\n';
352 if (byte_index >= edit->curs1) {
353 p = edit->curs1 + edit->curs2 - byte_index - 1;
354 return edit->buffers2[p >> S_EDIT_BUF_SIZE][EDIT_BUF_SIZE - (p & M_EDIT_BUF_SIZE) - 1];
355 } else {
356 return edit->buffers1[byte_index >> S_EDIT_BUF_SIZE][byte_index & M_EDIT_BUF_SIZE];
359 #endif
361 char *edit_get_buffer_as_text (WEdit * edit);
362 int edit_count_lines (WEdit * edit, long current, int upto);
363 long edit_move_forward (WEdit * edit, long current, int lines, long upto);
364 long edit_move_forward3 (WEdit * edit, long current, int cols, long upto);
365 long edit_move_backward (WEdit * edit, long current, int lines);
366 void edit_scroll_screen_over_cursor (WEdit * edit);
367 void edit_render_keypress (WEdit * edit);
368 void edit_scroll_upward (WEdit * edit, unsigned long i);
369 void edit_scroll_downward (WEdit * edit, int i);
370 void edit_scroll_right (WEdit * edit, int i);
371 void edit_scroll_left (WEdit * edit, int i);
372 int edit_get_col (WEdit * edit);
373 long edit_bol (WEdit * edit, long current);
374 long edit_eol (WEdit * edit, long current);
375 void edit_update_curs_row (WEdit * edit);
376 void edit_update_curs_col (WEdit * edit);
378 void edit_block_copy_cmd (WEdit * edit);
379 void edit_block_move_cmd (WEdit * edit);
380 int edit_block_delete_cmd (WEdit * edit);
381 int edit_block_delete (WEdit * edit);
382 void edit_delete_line (WEdit * edit);
384 int edit_delete (WEdit * edit);
385 void edit_insert (WEdit * edit, int c);
386 int edit_cursor_move (WEdit * edit, long increment);
387 void edit_push_action (WEdit * edit, long c,...);
388 void edit_push_key_press (WEdit * edit);
389 void edit_insert_ahead (WEdit * edit, int c);
390 int edit_save_file (WEdit * edit, const char *filename);
391 long edit_write_stream (WEdit * edit, FILE * f);
392 char *edit_get_write_filter (char *writename, const char *filename);
393 int edit_save_cmd (WEdit * edit);
394 int edit_save_confirm_cmd (WEdit * edit);
395 int edit_save_as_cmd (WEdit * edit);
396 WEdit *edit_init (WEdit * edit, int lines, int columns, const char *filename, const char *text, const char *dir, unsigned long text_size);
397 int edit_clean (WEdit * edit);
398 int edit_renew (WEdit * edit);
399 int edit_new_cmd (WEdit * edit);
400 int edit_reload (WEdit * edit, const char *filename, const char *text, const char *dir, unsigned long text_size);
401 int edit_load_cmd (WEdit * edit);
402 void edit_mark_cmd (WEdit * edit, int unmark);
403 void edit_set_markers (WEdit * edit, long m1, long m2, int c1, int c2);
404 void edit_push_markers (WEdit * edit);
405 void edit_quit_cmd (WEdit * edit);
406 void edit_replace_cmd (WEdit * edit, int again);
407 void edit_search_cmd (WEdit * edit, int again);
408 int edit_save_block (WEdit * edit, const char *filename, long start, long finish);
409 int edit_save_block_cmd (WEdit * edit);
410 int edit_insert_file_cmd (WEdit * edit);
411 int edit_insert_file (WEdit * edit, const char *filename);
412 void edit_block_process_cmd (WEdit * edit, const char *shell_cmd, int block);
413 char *catstrs (const char *first,...);
414 void edit_refresh_cmd (WEdit * edit);
415 void edit_date_cmd (WEdit * edit);
416 void edit_goto_cmd (WEdit * edit);
417 int eval_marks (WEdit * edit, long *start_mark, long *end_mark);
418 void edit_status (WEdit * edit);
419 int edit_execute_command (WEdit * edit, int command, int char_for_insertion);
420 int edit_execute_key_command (WEdit * edit, int command, int char_for_insertion);
421 void edit_update_screen (WEdit * edit);
422 int edit_printf (WEdit * e, const char *fmt,...);
423 int edit_print_string (WEdit * e, const char *s);
424 void edit_move_to_line (WEdit * e, long line);
425 void edit_move_display (WEdit * e, long line);
426 void edit_word_wrap (WEdit * edit);
427 unsigned char *edit_get_block (WEdit * edit, long start, long finish, int *l);
428 int edit_sort_cmd (WEdit * edit);
429 void edit_help_cmd (WEdit * edit);
430 void edit_left_word_move (WEdit * edit, int s);
431 void edit_right_word_move (WEdit * edit, int s);
432 void edit_get_selection (WEdit * edit);
434 int edit_save_macro_cmd (WEdit * edit, struct macro macro[], int n);
435 int edit_load_macro_cmd (WEdit * edit, struct macro macro[], int *n, int k);
436 void edit_delete_macro_cmd (WEdit * edit);
438 int edit_copy_to_X_buf_cmd (WEdit * edit);
439 int edit_cut_to_X_buf_cmd (WEdit * edit);
440 void edit_paste_from_X_buf_cmd (WEdit * edit);
442 void edit_paste_from_history (WEdit *edit);
444 void edit_split_filename (WEdit * edit, const char *name);
446 #ifdef MIDNIGHT
447 #define CWidget Widget
448 #elif defined(GTK)
449 #define CWidget GtkEdit
450 #endif
451 void edit_set_syntax_change_callback (void (*callback) (CWidget *));
452 void edit_load_syntax (WEdit * edit, char **names, char *type);
453 void edit_free_syntax_rules (WEdit * edit);
454 void edit_get_syntax_color (WEdit * edit, long byte_index, int *fg, int *bg);
455 int edit_check_spelling (WEdit * edit);
458 void book_mark_insert (WEdit * edit, int line, int c);
459 int book_mark_query_color (WEdit * edit, int line, int c);
460 int book_mark_query_all (WEdit * edit, int line, int *c);
461 struct _book_mark *book_mark_find (WEdit * edit, int line);
462 int book_mark_clear (WEdit * edit, int line, int c);
463 void book_mark_flush (WEdit * edit, int c);
464 void book_mark_inc (WEdit * edit, int line);
465 void book_mark_dec (WEdit * edit, int line);
467 void user_menu (WEdit *edit);
469 #ifdef MIDNIGHT
471 #include "src/user.h" /* for user_menu_cmd, must be after edit-widget.h */
473 #define CPushFont(x,y)
474 #define CPopFont()
475 #define FIXED_FONT 1
477 /* put OS2/NT/WIN95 defines here */
479 # ifdef USE_O_TEXT
480 # define MY_O_TEXT O_TEXT
481 # else
482 # define MY_O_TEXT 0
483 # endif
485 # define FONT_PIX_PER_LINE 1
486 # define FONT_MEAN_WIDTH 1
488 # define get_sys_error(s) (s)
489 # define open mc_open
490 # define close(f) mc_close(f)
491 # define read(f,b,c) mc_read(f,b,c)
492 # define write(f,b,c) mc_write(f,b,c)
493 # define stat(f,s) mc_stat(f,s)
494 # define mkdir(s,m) mc_mkdir(s,m)
495 # define itoa MY_itoa
497 # define edit_get_load_file(d,f,h) input_dialog (h, " Enter file name: ", f)
498 # define edit_get_save_file(d,f,h) input_dialog (h, " Enter file name: ", f)
499 # define CMalloc(x) malloc(x)
501 # define set_error_msg(s) edit_init_error_msg = strdup(s)
503 # ifdef _EDIT_C
505 # define edit_error_dialog(h,s) set_error_msg(s)
506 char *edit_init_error_msg = NULL;
508 # else /* ! _EDIT_C */
510 # define edit_error_dialog(h,s) query_dialog (h, s, 0, 1, _("&Dismiss"))
511 # define edit_message_dialog(h,s) query_dialog (h, s, 0, 1, _("&Ok"))
512 extern char *edit_init_error_msg;
514 # endif /* ! _EDIT_C */
517 # define get_error_msg(s) edit_init_error_msg
518 # define edit_query_dialog2(h,t,a,b) query_dialog(h,t,0,2,a,b)
519 # define edit_query_dialog3(h,t,a,b,c) query_dialog(h,t,0,3,a,b,c)
520 # define edit_query_dialog4(h,t,a,b,c,d) query_dialog(h,t,0,4,a,b,c,d)
522 #else /* ! MIDNIGHT */
524 # ifdef GTK
525 # define CPushFont(x,y)
526 # define CPopFont()
527 # define FIXED_FONT gtk_edit_fixed_font
528 # define get_sys_error(s) (s)
530 # define open mc_open
531 # define close(f) mc_close(f)
532 # define read(f,b,c) mc_read(f,b,c)
533 # define write(f,b,c) mc_write(f,b,c)
534 # define stat(f,s) mc_stat(f,s)
535 # define mkdir(s,m) mc_mkdir(s,m)
537 # define itoa MY_itoa
538 # define CMalloc(x) malloc(x)
540 # define EDITOR_NO_FILE (1<<3)
541 # define EDITOR_NO_SCROLL (1<<4)
542 # define EDITOR_NO_TEXT (1<<5)
543 # define EDITOR_HORIZ_SCROLL (1<<6)
545 #include <gdk/gdkprivate.h>
546 # define CWindowOf(w) (w)
547 # define CHeightOf(w) ((w)->editable.widget.allocation.height)
548 # define CWidthOf(w) ((w)->editable.widget.allocation.width)
549 # define COptionsOf(w) ((w)->options)
551 # define cache_type unsigned int
553 /* font dimensions */
554 # define FONT_OVERHEAD gtk_edit_option_text_line_spacing
555 # define FONT_BASE_LINE (FONT_OVERHEAD + gtk_edit_option_font_ascent)
556 # define FONT_HEIGHT (gtk_edit_option_font_ascent + gtk_edit_option_font_descent)
557 # define FONT_PIX_PER_LINE (FONT_OVERHEAD + FONT_HEIGHT)
558 # define FONT_MEAN_WIDTH gtk_edit_option_font_mean_width
560 # define EDIT_FRAME_H 3
561 # define EDIT_FRAME_W 3
563 # define FONT_OFFSET_X 0
564 # define FONT_OFFSET_Y FONT_BASE_LINE
566 # define FONT_PER_CHAR gtk_edit_font_width_per_char
568 # ifndef _GTK_EDIT_C
569 extern guchar gtk_edit_font_width_per_char[256];
570 extern int gtk_edit_option_text_line_spacing;
571 extern int gtk_edit_option_font_ascent;
572 extern int gtk_edit_option_font_descent;
573 extern int gtk_edit_option_font_mean_width;
574 extern int gtk_edit_fixed_font;
575 # endif
577 /* start temporary */
579 # define COLOR_BLACK 0
580 # define COLOR_WHITE 1
581 # define CURSOR_TYPE_EDITOR 0
583 # define WIN_MESSAGES GTK_WINDOW_TOPLEVEL, 20, 20
584 # define option_text_line_spacing 1
585 # define fixed_font 0
587 #define color_palette(x) win->color[x].pixel
589 #define DndNotDnd -1
590 #define DndUnknown 0
591 #define DndRawData 1
592 #define DndFile 2
593 #define DndFiles 3
594 #define DndText 4
595 #define DndDir 5
596 #define DndLink 6
597 #define DndExe 7
598 #define DndURL 8
599 #define DndMIME 9
601 #define DndEND 10
603 #define dnd_null_term_type(d) \
604 ((d) == DndFile || (d) == DndText || (d) == DndDir || \
605 (d) == DndLink || (d) == DndExe || (d) == DndURL)
609 /* end temporary */
611 # else
613 # define WIN_MESSAGES edit->widget ? edit->widget->mainid : CRoot, 20, 20
615 # endif
617 # define MY_O_TEXT 0
619 # ifdef GTK
621 # ifndef min
622 # define min(x,y) (((x) < (y)) ? (x) : (y))
623 # endif
625 # ifndef max
626 # define max(x,y) (((x) > (y)) ? (x) : (y))
627 # endif
630 extern Display *gdk_display;
631 extern Window gdk_root_window;
634 # define edit_get_load_file(d,f,h) gtk_edit_dialog_get_load_file(d,f,h)
635 # define edit_get_save_file(d,f,h) gtk_edit_dialog_get_save_file(d,f,h)
636 # define edit_error_dialog(h,t) gtk_edit_dialog_error(h,"%s",t)
637 # define edit_message_dialog(h,t) gtk_edit_dialog_message(h,"%s",t)
638 # define edit_query_dialog2(h,t,a,b) gtk_edit_dialog_query(h,t,a,b,0)
639 # define edit_query_dialog3(h,t,a,b,c) gtk_edit_dialog_query(h,t,a,b,c,0)
640 # define edit_query_dialog4(h,t,a,b,c,d) gtk_edit_dialog_query(h,t,a,b,c,d,0)
642 # define CError(x) printf("Error: %s\n",x)
643 # define CIsDropAcknowledge(a,b) DndNotDnd
644 # define CGetDrop(e,d,s,x,y) DndNotDnd
645 # define CDropAcknowledge(x)
646 /* # define edit_get_syntax_color(e,i,f,b) */
647 # define get_international_character(k) 0
648 # define compose_key_pressed 0
650 # else
652 # define edit_get_load_file(d,f,h) CGetLoadFile(WIN_MESSAGES,d,f,h)
653 # define edit_get_save_file(d,f,h) CGetSaveFile(WIN_MESSAGES,d,f,h)
654 # define edit_error_dialog(h,t) CErrorDialog(WIN_MESSAGES,h,"%s",t)
655 # define edit_message_dialog(h,t) CMessageDialog(WIN_MESSAGES,0,h,"%s",t)
656 # define edit_query_dialog2(h,t,a,b) CQueryDialog(WIN_MESSAGES,h,t,a,b,0)
657 # define edit_query_dialog3(h,t,a,b,c) CQueryDialog(WIN_MESSAGES,h,t,a,b,c,0)
658 # define edit_query_dialog4(h,t,a,b,c,d) CQueryDialog(WIN_MESSAGES,h,t,a,b,c,d,0)
659 # endif
661 #endif /* ! MIDNIGHT */
663 extern char *home_dir;
665 #define NUM_SELECTION_HISTORY 64
667 #ifndef MAX_PATH_LEN
668 #ifdef PATH_MAX
669 #define MAX_PATH_LEN PATH_MAX
670 #else
671 #define MAX_PATH_LEN 1024
672 #endif
673 #endif
675 #ifdef _EDIT_C
677 struct selection selection =
678 {0, 0};
679 int current_selection = 0;
680 /* Note: selection.text = selection_history[current_selection].text */
681 struct selection selection_history[NUM_SELECTION_HISTORY] =
683 {0, 0},
684 {0, 0},
685 {0, 0},
686 {0, 0},
687 {0, 0},
688 {0, 0},
689 {0, 0},
690 {0, 0},
691 {0, 0},
692 {0, 0},
695 #ifdef MIDNIGHT
697 what editor are we going to emulate? one of EDIT_KEY_EMULATION_NORMAL
698 or EDIT_KEY_EMULATION_EMACS
700 int edit_key_emulation = EDIT_KEY_EMULATION_NORMAL;
701 #endif /* ! MIDNIGHT */
703 int option_word_wrap_line_length = 72;
704 int option_typewriter_wrap = 0;
705 int option_auto_para_formatting = 0;
706 int option_international_characters = 0;
707 int option_tab_spacing = 8;
708 int option_fill_tabs_with_spaces = 0;
709 int option_return_does_auto_indent = 1;
710 int option_backspace_through_tabs = 0;
711 int option_fake_half_tabs = 1;
712 int option_save_mode = 0;
713 int option_backup_ext_int = -1;
714 int option_find_bracket = 1;
715 int option_max_undo = 32768;
717 int option_editor_fg_normal = 26;
718 int option_editor_fg_bold = 8;
719 int option_editor_fg_italic = 10;
721 int option_edit_right_extreme = 0;
722 int option_edit_left_extreme = 0;
723 int option_edit_top_extreme = 0;
724 int option_edit_bottom_extreme = 0;
726 int option_editor_bg_normal = 1;
727 int option_editor_bg_abnormal = 0;
728 int option_editor_bg_marked = 2;
729 int option_editor_bg_marked_abnormal = 9;
730 int option_editor_bg_highlighted = 12;
731 int option_editor_fg_cursor = 18;
733 char *option_whole_chars_search = "0123456789abcdefghijklmnopqrstuvwxyz_";
734 char *option_chars_move_whole_word = "!=&|<>^~ !:;, !'!`!.?!\"!( !) !Aa0 !+-*/= |<> ![ !] !\\#! ";
735 char *option_backup_ext = "~";
737 #else /* ! _EDIT_C */
739 extern struct selection selection;
740 extern struct selection selection_history[];
741 extern int current_selection;
743 #ifdef MIDNIGHT
745 what editor are we going to emulate? one of EDIT_KEY_EMULATION_NORMAL
746 or EDIT_KEY_EMULATION_EMACS
748 extern int edit_key_emulation;
749 extern WEdit *wedit;
750 #endif /* ! MIDNIGHT */
752 extern int option_word_wrap_line_length;
753 extern int option_typewriter_wrap;
754 extern int option_auto_para_formatting;
755 extern int option_international_characters;
756 extern int option_tab_spacing;
757 extern int option_fill_tabs_with_spaces;
758 extern int option_return_does_auto_indent;
759 extern int option_backspace_through_tabs;
760 extern int option_fake_half_tabs;
761 extern int option_save_mode;
762 extern int option_backup_ext_int;
763 extern int option_find_bracket;
764 extern int option_max_undo;
766 extern int option_editor_fg_normal;
767 extern int option_editor_fg_bold;
768 extern int option_editor_fg_italic;
770 extern int option_edit_right_extreme;
771 extern int option_edit_left_extreme;
772 extern int option_edit_top_extreme;
773 extern int option_edit_bottom_extreme;
775 extern int option_editor_bg_normal;
776 extern int option_editor_bg_abnormal;
777 extern int option_editor_bg_marked;
778 extern int option_editor_bg_marked_abnormal;
779 extern int option_editor_bg_highlighted;
780 extern int option_editor_fg_cursor;
782 extern char *option_whole_chars_search;
783 extern char *option_chars_move_whole_word;
784 extern char *option_backup_ext;
786 extern int edit_confirm_save;
788 #endif /* ! _EDIT_C */
789 #endif /* __EDIT_H */