From 89824f18f7ae7f6f3f7253a553fb717fa6e6bdea Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Fri, 7 Sep 2001 16:52:42 +0000 Subject: [PATCH] * edit.h: Eliminate all code disabled for the text edition. Reorder and simplify includes. * edit.c: Likewise. --- edit/ChangeLog | 6 + edit/edit.c | 130 +-------------- edit/edit.h | 443 +++++++++---------------------------------------- 3 files changed, 88 insertions(+), 491 deletions(-) diff --git a/edit/ChangeLog b/edit/ChangeLog index 30fb20a48..55c550022 100644 --- a/edit/ChangeLog +++ b/edit/ChangeLog @@ -1,3 +1,9 @@ +2001-09-07 Pavel Roskin + + * edit.h: Eliminate all code disabled for the text edition. + Reorder and simplify includes. + * edit.c: Likewise. + 2001-09-06 Pavel Roskin * syntax.c (syntax_text): Add PHP support from Cooledit. diff --git a/edit/edit.c b/edit/edit.c index d8893b447..0c852b448 100644 --- a/edit/edit.c +++ b/edit/edit.c @@ -27,24 +27,13 @@ #include #if defined(NEEDS_IO_H) # include -# include # define CR_LF_TRANSLATION #endif #include "edit.h" -#ifdef SCO_FLAVOR -# include -#endif /* SCO_FLAVOR */ -#include /* for ctime() */ -#if defined (HAVE_MAD) && ! defined (MIDNIGHT) && ! defined (GTK) -#include "mad.h" -#endif - -#include "../src/dialog.h" /* MSG_ERROR */ - #ifdef HAVE_CHARSET -#include "../src/charsets.h" -#include "../src/selcodepage.h" +#include "src/charsets.h" +#include "src/selcodepage.h" #endif extern char *edit_one_file; @@ -373,7 +362,6 @@ int edit_insert_file (WEdit * edit, const char *filename) static int check_file_access (WEdit *edit, const char *filename, struct stat *st) { int file; -#if defined(MIDNIGHT) || defined(GTK) if ((file = open ((char *) filename, O_RDONLY)) < 0) { close (creat ((char *) filename, 0666)); if ((file = open ((char *) filename, O_RDONLY)) < 0) { @@ -381,12 +369,6 @@ static int check_file_access (WEdit *edit, const char *filename, struct stat *st return 2; } } -#else - if ((file = open ((char *) filename, O_RDONLY)) < 0) { - edit_error_dialog (_ (" Error "), get_sys_error (catstrs (_ (" Failed trying to open file for reading: "), filename, " ", 0))); - return 1; - } -#endif if (stat ((char *) filename, st) < 0) { close (file); /* The file-name is printed after the ':' */ @@ -421,10 +403,8 @@ int edit_open_file (WEdit * edit, const char *filename, const char *text, unsign } else { int r; r = check_file_access (edit, filename, &st); -#if defined(MIDNIGHT) || defined(GTK) if (r == 2) return edit->delete_file = 1; -#endif if (r) return 1; edit->stat1 = st; @@ -440,20 +420,7 @@ int edit_open_file (WEdit * edit, const char *filename, const char *text, unsign return init_dynamic_edit_buffers (edit, filename, text); } -#ifdef MIDNIGHT #define space_width 1 -#else -int space_width; -extern int option_long_whitespace; - -void edit_set_space_width (int s) -{ - space_width = s; -} - -int (*edit_file_is_open) (char *) = 0; - -#endif /* fills in the edit struct. returns 0 on fail. Pass edit as NULL for this */ WEdit *edit_init (WEdit * edit, int lines, int columns, const char *filename, const char *text, const char *dir, unsigned long text_size) @@ -461,12 +428,6 @@ WEdit *edit_init (WEdit * edit, int lines, int columns, const char *filename, co char *f; int to_free = 0; int use_filter = 0; -#ifndef MIDNIGHT - if (option_long_whitespace) - edit_set_space_width (FONT_PER_CHAR[' '] * 2); - else - edit_set_space_width (FONT_PER_CHAR[' ']); -#endif if (!edit) { #ifdef ENABLE_NLS /* @@ -497,9 +458,6 @@ WEdit *edit_init (WEdit * edit, int lines, int columns, const char *filename, co to_free = 1; } memset (&(edit->from_here), 0, (unsigned long) &(edit->to_here) - (unsigned long) &(edit->from_here)); -#ifndef MIDNIGHT - edit->max_column = columns * FONT_MEAN_WIDTH; -#endif edit->num_widget_lines = lines; edit->num_widget_columns = columns; edit->stat1.st_mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH; @@ -511,14 +469,6 @@ WEdit *edit_init (WEdit * edit, int lines, int columns, const char *filename, co f = (char *) filename; if (filename) { f = catstrs (dir, filename, 0); -#ifndef MIDNIGHT - if (edit_file_is_open) - if ((*edit_file_is_open) (f)) { - if (to_free) - free (edit); - return 0; - } -#endif } if (edit_find_filter (f) < 0) { #ifdef CR_LF_TRANSLATION @@ -1208,7 +1158,6 @@ long edit_move_backward (WEdit * edit, long current, int lines) return current; } -#ifdef MIDNIGHT /* If cols is zero this returns the count of columns from current to upto. */ /* If upto is zero returns index of cols across from current. */ long edit_move_forward3 (WEdit * edit, long current, int cols, long upto) @@ -1248,7 +1197,6 @@ long edit_move_forward3 (WEdit * edit, long current, int cols, long upto) } return col; } -#endif /* returns the current column position of the cursor */ int edit_get_col (WEdit * edit) @@ -1280,8 +1228,6 @@ void edit_scroll_upward (WEdit * edit, unsigned long i) edit->start_display = edit_move_backward (edit, edit->start_display, i); edit->force |= REDRAW_PAGE; edit->force &= (0xfff - REDRAW_CHAR_ONLY); -#ifndef MIDNIGHT -#endif } edit_update_curs_row (edit); } @@ -1299,8 +1245,6 @@ void edit_scroll_downward (WEdit * edit, int i) edit->start_display = edit_move_forward (edit, edit->start_display, i, 0); edit->force |= REDRAW_PAGE; edit->force &= (0xfff - REDRAW_CHAR_ONLY); -#ifndef MIDNIGHT -#endif } edit_update_curs_row (edit); } @@ -1922,9 +1866,6 @@ int edit_indent_width (WEdit * edit, long p) void edit_insert_indent (WEdit * edit, int indent) { -#ifndef MIDNIGHT - indent /= space_width; -#endif if (!option_fill_tabs_with_spaces) { while (indent >= TAB_SIZE) { edit_insert (edit, '\t'); @@ -1994,16 +1935,8 @@ static void check_and_wrap_line (WEdit * edit) if (!option_typewriter_wrap) return; edit_update_curs_col (edit); -#ifdef MIDNIGHT if (edit->curs_col < option_word_wrap_line_length) return; -#else - CPushFont ("editor", 0); - c = FONT_MEAN_WIDTH; - CPopFont (); - if (edit->curs_col < option_word_wrap_line_length * c) - return; -#endif curs = edit->curs1; for (;;) { curs--; @@ -2027,7 +1960,6 @@ void edit_execute_macro (WEdit * edit, struct macro macro[], int n); /* either command or char_for_insertion must be passed as -1 */ int edit_execute_cmd (WEdit * edit, int command, int char_for_insertion); -#ifdef MIDNIGHT int edit_translate_key (WEdit * edit, unsigned int x_keycode, long x_key, int x_state, int *cmd, int *ch) { int command = -1; @@ -2042,7 +1974,6 @@ int edit_translate_key (WEdit * edit, unsigned int x_keycode, long x_key, int x_ return 0; return 1; } -#endif void edit_push_key_press (WEdit * edit) { @@ -2165,18 +2096,9 @@ int edit_execute_key_command (WEdit * edit, int command, int char_for_insertion) return r; } -#ifdef MIDNIGHT static const char *shell_cmd[] = SHELL_COMMANDS_i void edit_mail_dialog (WEdit * edit); -#else -static void (*user_commamd) (WEdit *, int) = 0; -void edit_set_user_command (void (*func) (WEdit *, int)) -{ - user_commamd = func; -} -#endif - /* This executes a command at a lower level than macro recording. It also does not push a key_press onto the undo stack. This means @@ -2408,13 +2330,6 @@ int edit_execute_cmd (WEdit * edit, int command, int char_for_insertion) case CK_Toggle_Insert: edit->overwrite = (edit->overwrite == 0); -#ifndef MIDNIGHT -#ifdef GTK -/* *** */ -#else - CSetCursorColor (edit->overwrite ? color_palette (24) : color_palette (19)); -#endif -#endif break; case CK_Mark: @@ -2510,25 +2425,12 @@ int edit_execute_cmd (WEdit * edit, int command, int char_for_insertion) break; case CK_Save_As: -#ifndef MIDNIGHT -/* if (COptionsOf (edit->widget) & EDITOR_NO_FILE) */ - if (edit->widget->options & EDITOR_NO_FILE) - break; -#endif edit_save_as_cmd (edit); break; case CK_Save: -#ifndef MIDNIGHT - if (COptionsOf (edit->widget) & EDITOR_NO_FILE) - break; -#endif edit_save_confirm_cmd (edit); break; case CK_Load: -#ifndef MIDNIGHT - if (COptionsOf (edit->widget) & EDITOR_NO_FILE) - break; -#endif edit_load_cmd (edit); break; case CK_Save_Block: @@ -2595,7 +2497,6 @@ int edit_execute_cmd (WEdit * edit, int command, int char_for_insertion) case CK_Match_Bracket: edit_goto_matching_bracket (edit); break; -#ifndef GTK case CK_User_Menu: if (edit_one_file) { message (1, MSG_ERROR, _("User menu available only in mcedit invoked from mc")); @@ -2604,8 +2505,6 @@ int edit_execute_cmd (WEdit * edit, int command, int char_for_insertion) else user_menu (edit); break; -#endif /* !GTK */ -#ifdef MIDNIGHT case CK_Sort: edit_sort_cmd (edit); break; @@ -2615,10 +2514,9 @@ int edit_execute_cmd (WEdit * edit, int command, int char_for_insertion) case CK_Shell: view_other_cmd (); break; -#endif /* MIDNIGHT */ /* These commands are not handled and must be handled by the user application */ -#ifndef MIDNIGHT +#if 0 case CK_Sort: case CK_Mail: case CK_Find_File: @@ -2647,19 +2545,10 @@ int edit_execute_cmd (WEdit * edit, int command, int char_for_insertion) result = 0; break; case CK_Menu: -#ifdef GTK - if (edit->widget->menubar) - gtk_menu_popup (GTK_MENU( - (GTK_MENU_ITEM (g_list_nth_data (GTK_MENU_BAR (edit->widget->menubar)->menu_shell.children, 0)))->submenu - ), 0, 0, 0, 0, 1, 0); - result = 1; -#else result = 0; -#endif break; } -#ifdef MIDNIGHT /* CK_Pipe_Block */ if ((command / 1000) == 1) /* a shell command */ edit_block_process_cmd (edit, shell_cmd[command - 1000], 1); @@ -2669,17 +2558,6 @@ int edit_execute_cmd (WEdit * edit, int command, int char_for_insertion) if ((result = edit_load_macro_cmd (edit, m, &nm, command - 2000))) edit_execute_macro (edit, m, nm); } -#else - if (IS_USER_COMMAND (command)) /* a user defined command */ - if (user_commamd) - (*user_commamd) (edit, command & 0xFFFF); - if (IS_MACRO_COMMAND (command)) { /* a macro command */ - struct macro m[MAX_MACRO_LENGTH]; - int nm; - if ((result = edit_load_macro_cmd (edit, m, &nm, command & 0xFFFF))) - edit_execute_macro (edit, m, nm); - } -#endif /* keys which must set the col position, and the search vars */ switch (command) { @@ -2760,7 +2638,6 @@ void edit_execute_macro (WEdit * edit, struct macro macro[], int n) edit_update_screen (edit); } -#ifndef GTK /* User edit menu, like user menu (F2) but only in editor. */ void user_menu (WEdit *edit) { @@ -2809,4 +2686,3 @@ void user_menu (WEdit *edit) edit->force |= REDRAW_COMPLETELY; return; } -#endif /* !GTK */ diff --git a/edit/edit.h b/edit/edit.h index c706e7d2b..92fb77614 100644 --- a/edit/edit.h +++ b/edit/edit.h @@ -23,160 +23,59 @@ #ifndef __EDIT_H #define __EDIT_H -#ifdef HAVE_SYS_PARAM_H -# include -#endif - -#ifdef MIDNIGHT - #ifdef HAVE_SLANG -#define HAVE_SYNTAXH 1 +# define HAVE_SYNTAXH 1 #endif -# include -# include -# include -# ifdef HAVE_UNISTD_H -# include -# endif -# include -# include -# include -# include "src/tty.h" -# include -# include +#include +#include +#include +#ifdef HAVE_UNISTD_H +# include +#endif +#include +#include +#include +#include +#include -# include +#include -# include -# if !defined(STDC_HEADERS) && defined(HAVE_MALLOC_H) -# include -# endif +#include +#if !defined(STDC_HEADERS) && defined(HAVE_MALLOC_H) +# include +#endif -#else /* ! MIDNIGHT */ - -# include "global.h" -# include -# include -# include - -# ifdef HAVE_UNISTD_H -# include -# endif - -#ifdef GTK -# include +#if defined(HAVE_RX_H) && defined(HAVE_REGCOMP) +# include #else -# include -#endif -# include -# include -# include - -# ifdef HAVE_FCNTL_H -# include -# endif - -# include -# include - -# if TIME_WITH_SYS_TIME -# include -# include -# else -# if HAVE_SYS_TIME_H -# include -# else -# include -# endif -# endif - -# include "regex.h" - -#endif - -#ifndef MIDNIGHT - -# include -# include -# include -# include -# include "lkeysym.h" -#ifndef GTK -# include "coolwidget.h" -# include "app_glob.c" -# include "coollocal.h" -# include "stringtools.h" -#else -# include -# include -# include -# include "gtkedit.h" -# include "editcmddef.h" -# ifndef _ -# define _(x) x -# define N_(x) x -# endif -#endif - -#else - -# include "src/global.h" -# include "src/main.h" /* for char *shell */ -# include "src/mad.h" -# include "src/dlg.h" -# include "src/widget.h" -# include "src/color.h" -# include "src/dialog.h" -# include "src/mouse.h" -# include "src/help.h" -# include "src/key.h" -# include "src/wtools.h" /* for QuickWidgets */ -# include "src/cmd.h" /* for menu_edit_cmd */ -# include "src/win.h" -# include "vfs/vfs.h" -# include "src/menu.h" # include +#endif + +#include "src/global.h" +#include "src/tty.h" +#include "src/main.h" /* for char *shell */ +#include "src/mad.h" +#include "src/dlg.h" +#include "src/widget.h" +#include "src/color.h" +#include "src/dialog.h" +#include "src/mouse.h" +#include "src/help.h" +#include "src/key.h" +#include "src/wtools.h" /* for QuickWidgets */ +#include "src/cmd.h" /* for menu_edit_cmd */ +#include "src/win.h" +#include "vfs/vfs.h" +#include "src/menu.h" +#include "edit-widget.h" +#include "src/user.h" /* for user_menu_cmd, must be after edit-widget.h */ + # define WANT_WIDGETS # define WIDGET_COMMAND (WIDGET_USER + 10) # define N_menus 5 -#endif - -#ifdef GTK -/* unistd.h defines _POSIX_VERSION on POSIX.1 systems. */ -#if defined(HAVE_DIRENT_H) || defined(_POSIX_VERSION) -# include -# define NLENGTH(dirent) (strlen ((dirent)->d_name)) -#else -# define dirent direct -# define NLENGTH(dirent) ((dirent)->d_namlen) - -# ifdef HAVE_SYS_NDIR_H -# include -# endif /* HAVE_SYS_NDIR_H */ - -# ifdef HAVE_SYS_DIR_H -# include -# endif /* HAVE_SYS_DIR_H */ - -# ifdef HAVE_NDIR_H -# include -# endif /* HAVE_NDIR_H */ -#endif /* not (HAVE_DIRENT_H or _POSIX_VERSION) */ -# ifndef _ -# define _(x) x -# define N_(x) x -# endif -#include "vfs/vfs.h" -#include "src/dialog.h" /* for input_dialog() */ -#include "src/util.h" /* for is_printable() */ -# define CDisplay gdk_display -# define CRoot gdk_root_parent -# define Window GtkEdit * -#endif - #define SEARCH_DIALOG_OPTION_NO_SCANF 1 #define SEARCH_DIALOG_OPTION_NO_REGEX 2 #define SEARCH_DIALOG_OPTION_NO_CASE 4 @@ -205,20 +104,10 @@ #define MOD_CURSOR (1 << 6) #define MOD_INVERSE (1 << 7) -#ifndef MIDNIGHT -# ifdef GTK -# define EDIT_TEXT_HORIZONTAL_OFFSET 0 -# define EDIT_TEXT_VERTICAL_OFFSET 0 -# else -# define EDIT_TEXT_HORIZONTAL_OFFSET 4 -# define EDIT_TEXT_VERTICAL_OFFSET 3 -# endif -#else -# define EDIT_TEXT_HORIZONTAL_OFFSET 0 -# define EDIT_TEXT_VERTICAL_OFFSET 1 -# define FONT_OFFSET_X 0 -# define FONT_OFFSET_Y 0 -#endif +#define EDIT_TEXT_HORIZONTAL_OFFSET 0 +#define EDIT_TEXT_VERTICAL_OFFSET 1 +#define FONT_OFFSET_X 0 +#define FONT_OFFSET_Y 0 #define EDIT_RIGHT_EXTREME option_edit_right_extreme #define EDIT_LEFT_EXTREME option_edit_left_extreme @@ -300,34 +189,6 @@ struct context_rule { struct key_word **keyword; }; -#include "edit-widget.h" - -#ifndef MIDNIGHT - -void edit_render_expose (WEdit * edit, XExposeEvent * xexpose); -#ifndef GTK -void edit_render_tidbits (struct cool_widget *w); -int eh_editor (CWidget * w, XEvent * xevent, CEvent * cwevent); -#endif -void edit_draw_menus (Window parent, int x, int y); -void edit_run_make (void); -void edit_change_directory (void); -int edit_man_page_cmd (WEdit * edit); -void edit_search_replace_dialog (Window parent, int x, int y, char **search_text, char **replace_text, char **arg_order, char *heading, int option); -void edit_search_dialog (WEdit * edit, char **search_text); -long edit_find (long search_start, unsigned char *expr, int *len, long last_byte, int (*get_byte) (void *, long), void *data, void *d); -void edit_set_foreground_colors (unsigned long normal, unsigned long bold, unsigned long italic); -void edit_set_background_colors (unsigned long normal, unsigned long abnormal, unsigned long marked, unsigned long marked_abnormal, unsigned long highlighted); -void edit_set_cursor_color (unsigned long c); -void draw_options_dialog (Window parent, int x, int y); -void CRefreshEditor (WEdit * edit); -void edit_set_user_command (void (*func) (WEdit *, int)); -void edit_draw_this_line_proportional (WEdit * edit, long b, int curs_row, int start_column, int end_column); -unsigned char get_international_character (unsigned char key_press); -void edit_set_user_key_function (int (*user_def_key_func) (unsigned int, unsigned int, KeySym keysym)); - -#else - int edit_drop_hotkey_menu (WEdit * e, int key); void edit_menu_cmd (WEdit * e); void edit_init_menu_emacs (void); @@ -338,8 +199,6 @@ char *strcasechr (const unsigned char *s, int c); int edit (const char *_file, int line); int edit_translate_key (WEdit * edit, unsigned int x_keycode, long x_key, int x_state, int *cmd, int *ch); -#endif - #ifndef NO_INLINE_GETBYTE int edit_get_byte (WEdit * edit, long byte_index); #else @@ -443,11 +302,7 @@ void edit_paste_from_history (WEdit *edit); void edit_split_filename (WEdit * edit, const char *name); -#ifdef MIDNIGHT #define CWidget Widget -#elif defined(GTK) -#define CWidget GtkEdit -#endif void edit_set_syntax_change_callback (void (*callback) (CWidget *)); void edit_load_syntax (WEdit * edit, char **names, char *type); void edit_free_syntax_rules (WEdit * edit); @@ -466,200 +321,64 @@ void book_mark_dec (WEdit * edit, int line); void user_menu (WEdit *edit); -#ifdef MIDNIGHT - -#include "src/user.h" /* for user_menu_cmd, must be after edit-widget.h */ - #define CPushFont(x,y) #define CPopFont() #define FIXED_FONT 1 /* put OS2/NT/WIN95 defines here */ -# ifdef USE_O_TEXT -# define MY_O_TEXT O_TEXT -# else -# define MY_O_TEXT 0 -# endif +#ifdef USE_O_TEXT +# define MY_O_TEXT O_TEXT +#else +# define MY_O_TEXT 0 +#endif -# define FONT_PIX_PER_LINE 1 -# define FONT_MEAN_WIDTH 1 +#define FONT_PIX_PER_LINE 1 +#define FONT_MEAN_WIDTH 1 -# define get_sys_error(s) (s) -# define open mc_open -# define close(f) mc_close(f) -# define read(f,b,c) mc_read(f,b,c) -# define write(f,b,c) mc_write(f,b,c) -# define stat(f,s) mc_stat(f,s) -# define mkdir(s,m) mc_mkdir(s,m) -# define itoa MY_itoa +#define get_sys_error(s) (s) +#define open mc_open +#define close(f) mc_close(f) +#define read(f,b,c) mc_read(f,b,c) +#define write(f,b,c) mc_write(f,b,c) +#define stat(f,s) mc_stat(f,s) +#define mkdir(s,m) mc_mkdir(s,m) +#define itoa MY_itoa -# define edit_get_load_file(d,f,h) input_dialog (h, " Enter file name: ", f) -# define edit_get_save_file(d,f,h) input_dialog (h, " Enter file name: ", f) -# define CMalloc(x) malloc(x) +#define edit_get_load_file(d,f,h) input_dialog (h, " Enter file name: ", f) +#define edit_get_save_file(d,f,h) input_dialog (h, " Enter file name: ", f) +#define CMalloc(x) malloc(x) -# define set_error_msg(s) edit_init_error_msg = strdup(s) +#define set_error_msg(s) edit_init_error_msg = strdup(s) -# ifdef _EDIT_C +#ifdef _EDIT_C -# define edit_error_dialog(h,s) set_error_msg(s) +#define edit_error_dialog(h,s) set_error_msg(s) char *edit_init_error_msg = NULL; -# else /* ! _EDIT_C */ +#else /* ! _EDIT_C */ -# define edit_error_dialog(h,s) query_dialog (h, s, 0, 1, _("&Dismiss")) -# define edit_message_dialog(h,s) query_dialog (h, s, 0, 1, _("&Ok")) +#define edit_error_dialog(h,s) query_dialog (h, s, 0, 1, _("&Dismiss")) +#define edit_message_dialog(h,s) query_dialog (h, s, 0, 1, _("&Ok")) extern char *edit_init_error_msg; -# endif /* ! _EDIT_C */ +#endif /* ! _EDIT_C */ -# define get_error_msg(s) edit_init_error_msg -# define edit_query_dialog2(h,t,a,b) query_dialog(h,t,0,2,a,b) -# define edit_query_dialog3(h,t,a,b,c) query_dialog(h,t,0,3,a,b,c) -# define edit_query_dialog4(h,t,a,b,c,d) query_dialog(h,t,0,4,a,b,c,d) +#define get_error_msg(s) edit_init_error_msg +#define edit_query_dialog2(h,t,a,b) query_dialog(h,t,0,2,a,b) +#define edit_query_dialog3(h,t,a,b,c) query_dialog(h,t,0,3,a,b,c) +#define edit_query_dialog4(h,t,a,b,c,d) query_dialog(h,t,0,4,a,b,c,d) -#else /* ! MIDNIGHT */ +#define COLOR_BLACK 0 +#define COLOR_WHITE 1 +#define CURSOR_TYPE_EDITOR 0 -# ifdef GTK -# define CPushFont(x,y) -# define CPopFont() -# define FIXED_FONT gtk_edit_fixed_font -# define get_sys_error(s) (s) - -# define open mc_open -# define close(f) mc_close(f) -# define read(f,b,c) mc_read(f,b,c) -# define write(f,b,c) mc_write(f,b,c) -# define stat(f,s) mc_stat(f,s) -# define mkdir(s,m) mc_mkdir(s,m) - -# define itoa MY_itoa -# define CMalloc(x) malloc(x) - -# define EDITOR_NO_FILE (1<<3) -# define EDITOR_NO_SCROLL (1<<4) -# define EDITOR_NO_TEXT (1<<5) -# define EDITOR_HORIZ_SCROLL (1<<6) - -#include -# define CWindowOf(w) (w) -# define CHeightOf(w) ((w)->editable.widget.allocation.height) -# define CWidthOf(w) ((w)->editable.widget.allocation.width) -# define COptionsOf(w) ((w)->options) - -# define cache_type unsigned int - -/* font dimensions */ -# define FONT_OVERHEAD gtk_edit_option_text_line_spacing -# define FONT_BASE_LINE (FONT_OVERHEAD + gtk_edit_option_font_ascent) -# define FONT_HEIGHT (gtk_edit_option_font_ascent + gtk_edit_option_font_descent) -# define FONT_PIX_PER_LINE (FONT_OVERHEAD + FONT_HEIGHT) -# define FONT_MEAN_WIDTH gtk_edit_option_font_mean_width - -# define EDIT_FRAME_H 3 -# define EDIT_FRAME_W 3 - -# define FONT_OFFSET_X 0 -# define FONT_OFFSET_Y FONT_BASE_LINE - -# define FONT_PER_CHAR gtk_edit_font_width_per_char - -# ifndef _GTK_EDIT_C -extern guchar gtk_edit_font_width_per_char[256]; -extern int gtk_edit_option_text_line_spacing; -extern int gtk_edit_option_font_ascent; -extern int gtk_edit_option_font_descent; -extern int gtk_edit_option_font_mean_width; -extern int gtk_edit_fixed_font; -# endif - -/* start temporary */ - -# define COLOR_BLACK 0 -# define COLOR_WHITE 1 -# define CURSOR_TYPE_EDITOR 0 - -# define WIN_MESSAGES GTK_WINDOW_TOPLEVEL, 20, 20 -# define option_text_line_spacing 1 -# define fixed_font 0 +#define option_text_line_spacing 1 +#define fixed_font 0 #define color_palette(x) win->color[x].pixel -#define DndNotDnd -1 -#define DndUnknown 0 -#define DndRawData 1 -#define DndFile 2 -#define DndFiles 3 -#define DndText 4 -#define DndDir 5 -#define DndLink 6 -#define DndExe 7 -#define DndURL 8 -#define DndMIME 9 - -#define DndEND 10 - -#define dnd_null_term_type(d) \ - ((d) == DndFile || (d) == DndText || (d) == DndDir || \ - (d) == DndLink || (d) == DndExe || (d) == DndURL) - - - -/* end temporary */ - -# else - -# define WIN_MESSAGES edit->widget ? edit->widget->mainid : CRoot, 20, 20 - -# endif - -# define MY_O_TEXT 0 - -# ifdef GTK - -# ifndef min -# define min(x,y) (((x) < (y)) ? (x) : (y)) -# endif - -# ifndef max -# define max(x,y) (((x) > (y)) ? (x) : (y)) -# endif - -/* -extern Display *gdk_display; -extern Window gdk_root_window; -*/ - -# define edit_get_load_file(d,f,h) gtk_edit_dialog_get_load_file(d,f,h) -# define edit_get_save_file(d,f,h) gtk_edit_dialog_get_save_file(d,f,h) -# define edit_error_dialog(h,t) gtk_edit_dialog_error(h,"%s",t) -# define edit_message_dialog(h,t) gtk_edit_dialog_message(h,"%s",t) -# define edit_query_dialog2(h,t,a,b) gtk_edit_dialog_query(h,t,a,b,0) -# define edit_query_dialog3(h,t,a,b,c) gtk_edit_dialog_query(h,t,a,b,c,0) -# define edit_query_dialog4(h,t,a,b,c,d) gtk_edit_dialog_query(h,t,a,b,c,d,0) - -# define CError(x) printf("Error: %s\n",x) -# define CIsDropAcknowledge(a,b) DndNotDnd -# define CGetDrop(e,d,s,x,y) DndNotDnd -# define CDropAcknowledge(x) -/* # define edit_get_syntax_color(e,i,f,b) */ -# define get_international_character(k) 0 -# define compose_key_pressed 0 - -# else - -# define edit_get_load_file(d,f,h) CGetLoadFile(WIN_MESSAGES,d,f,h) -# define edit_get_save_file(d,f,h) CGetSaveFile(WIN_MESSAGES,d,f,h) -# define edit_error_dialog(h,t) CErrorDialog(WIN_MESSAGES,h,"%s",t) -# define edit_message_dialog(h,t) CMessageDialog(WIN_MESSAGES,0,h,"%s",t) -# define edit_query_dialog2(h,t,a,b) CQueryDialog(WIN_MESSAGES,h,t,a,b,0) -# define edit_query_dialog3(h,t,a,b,c) CQueryDialog(WIN_MESSAGES,h,t,a,b,c,0) -# define edit_query_dialog4(h,t,a,b,c,d) CQueryDialog(WIN_MESSAGES,h,t,a,b,c,d,0) -# endif - -#endif /* ! MIDNIGHT */ - extern char *home_dir; #define NUM_SELECTION_HISTORY 64 @@ -689,16 +408,14 @@ struct selection selection_history[NUM_SELECTION_HISTORY] = {0, 0}, {0, 0}, {0, 0}, - {0, 0}, + {0, 0} }; -#ifdef MIDNIGHT /* what editor are we going to emulate? one of EDIT_KEY_EMULATION_NORMAL or EDIT_KEY_EMULATION_EMACS */ int edit_key_emulation = EDIT_KEY_EMULATION_NORMAL; -#endif /* ! MIDNIGHT */ int option_word_wrap_line_length = 72; int option_typewriter_wrap = 0; @@ -740,14 +457,12 @@ extern struct selection selection; extern struct selection selection_history[]; extern int current_selection; -#ifdef MIDNIGHT /* what editor are we going to emulate? one of EDIT_KEY_EMULATION_NORMAL or EDIT_KEY_EMULATION_EMACS */ extern int edit_key_emulation; extern WEdit *wedit; -#endif /* ! MIDNIGHT */ extern int option_word_wrap_line_length; extern int option_typewriter_wrap;