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