From f2e38b2c3a47cb5c16b6f0af0d4edf4934baea14 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Sun, 16 Sep 2001 01:10:09 +0000 Subject: [PATCH] * textconf.h: Get rid of all PORT_HAS_*. Adjust all users. Continued eliminating GNOME code. --- src/ChangeLog | 3 +++ src/filegui.c | 1 - src/key.h | 2 -- src/main.c | 6 ------ src/screen.c | 58 ++------------------------------------------------ src/setup.c | 6 ++---- src/textconf.h | 4 ---- src/utilunix.c | 6 ------ src/view.c | 32 ++++------------------------ src/widget.c | 44 ++++++++++++++------------------------ 10 files changed, 27 insertions(+), 135 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 4cdff5e5d..972ea76ce 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2001-09-15 Pavel Roskin + * textconf.h: Get rid of all PORT_HAS_*. Adjust all users. + Continued eliminating GNOME code. + * cmd.c: Clean up unused GNOME code and some ifdef's. * dlg.c: Likewise. * dlg.h: Likewise. diff --git a/src/filegui.c b/src/filegui.c index 977f18baa..4a84251de 100644 --- a/src/filegui.c +++ b/src/filegui.c @@ -171,7 +171,6 @@ check_progress_buttons (FileOpContext *ctx) ui = ctx->ui; - x_flush_events (); event.x = -1; /* Don't show the GPM cursor */ c = get_event (&event, 0, 0); if (c == EV_NONE) diff --git a/src/key.h b/src/key.h index 367047421..8cf12ea67 100644 --- a/src/key.h +++ b/src/key.h @@ -9,9 +9,7 @@ int get_event (Gpm_Event *event, int redo_event, int block); int is_idle (void); int ctrl_pressed (void); -#ifndef PORT_HAS_GETCH int mi_getch (void); -#endif /* Possible return values from get_event: */ #define EV_MOUSE -2 #define EV_NONE -1 diff --git a/src/main.c b/src/main.c index fea9d43e7..9d572c064 100644 --- a/src/main.c +++ b/src/main.c @@ -439,7 +439,6 @@ panel_clean_dir (WPanel *panel) clean_dir (&panel->dir, count); } -#ifndef PORT_HAS_UPDATE_PANELS static void update_one_panel (int which, int force_update, char *current_file) { @@ -477,7 +476,6 @@ update_panels (int force_update, char *current_file) mc_chdir (panel->cwd); } -#endif #ifdef WANT_PARSE static void select_by_index (WPanel *panel, int i); @@ -1361,7 +1359,6 @@ toggle_align_extensions (void) * Just a hack for allowing url-like pathnames to be accepted from the * command line. */ -#ifndef PORT_HAS_CREATE_PANELS static void translated_mc_chdir (char *dir) { @@ -1437,7 +1434,6 @@ create_panels (void) the_menubar = menubar_new (0, 0, COLS, MenuBar, 5); } -#endif static void copy_current_pathname (void) { @@ -1988,7 +1984,6 @@ midnight_callback (struct Dlg_head *h, int id, int msg) #define xtoolkit_panel_setup() -#ifndef PORT_HAS_LOAD_HINT void load_hint (void) { char *hint; @@ -2010,7 +2005,6 @@ void load_hint (void) " (C) 1995-1997 the Free Software Foundation"); } } -#endif static void setup_panels_and_run_mc (void) diff --git a/src/screen.c b/src/screen.c index c2a372823..174687334 100644 --- a/src/screen.c +++ b/src/screen.c @@ -77,26 +77,13 @@ Hook *select_file_hook = 0; static int panel_callback (Dlg_head *h, WPanel *p, int Msg, int Par); -#ifndef HAVE_X static int panel_event (Gpm_Event *event, WPanel *panel); -#else -#define panel_event NULL -#endif /* HAVE_X */ -#ifndef PORT_HAS_PANEL_ADJUST_TOP_FILE -# define x_adjust_top_file(p) -#endif - -#ifndef PORT_HAS_PANEL_RESET_SORT_LABELS -# define x_reset_sort_labels(x) -#endif +#define x_adjust_top_file(p) +#define x_reset_sort_labels(x) /* This macro extracts the number of available lines in a panel */ -#ifndef PORT_HAS_LLINES #define llines(p) (p->widget.lines-3 - (show_mini_info ? 2 : 0)) -#else -#define llines(p) (p->widget.lines) -#endif #ifdef PORT_NOT_FOCUS_SELECT_ITEM # define focus_select_item(x) @@ -577,7 +564,6 @@ format_file (char *dest, WPanel *panel, int file_index, int width, int attr, int } } -#ifndef HAVE_X void repaint_file (WPanel *panel, int file_index, int mv, int attr, int isstatus) { @@ -619,9 +605,7 @@ repaint_file (WPanel *panel, int file_index, int mv, int attr, int isstatus) } } } -#endif -#ifndef PORT_HAS_DISPLAY_MINI_INFO void display_mini_info (WPanel *panel) { @@ -682,9 +666,7 @@ display_mini_info (WPanel *panel) repaint_file (panel, panel->selected, 0, STATUS, 1); return; } -#endif -#ifndef HAVE_X void paint_dir (WPanel *panel) { @@ -706,11 +688,7 @@ paint_dir (WPanel *panel) standend (); panel->dirty = 0; } -#endif -#ifdef HAVE_X -#define mini_info_separator(x) -#else static void mini_info_separator (WPanel *panel) { @@ -774,9 +752,7 @@ show_dir (WPanel *panel) if (panel->active) standend (); } -#endif -#ifndef PORT_HAS_PAINT_FRAME /* To be used only by long_frame and full_frame to adjust top_file */ static void adjust_top_file (WPanel *panel) @@ -788,7 +764,6 @@ adjust_top_file (WPanel *panel) if (old_top - panel->count > llines (panel)) panel->top_file = panel->count - llines (panel); } -#endif /* Repaints the information that changes after a command */ void @@ -854,7 +829,6 @@ Xtry_to_select (WPanel *panel, char *name) g_free (subdir); } -#ifndef PORT_HAS_PANEL_UPDATE_COLS void panel_update_cols (Widget *widget, int frame_size) { @@ -881,7 +855,6 @@ panel_update_cols (Widget *widget, int frame_size) widget->cols = cols; widget->x = origin; } -#endif static char * panel_save_name (WPanel *panel) @@ -1065,7 +1038,6 @@ panel_reload (WPanel *panel) recalculate_panel_summary (panel); } -#ifndef PORT_HAS_PAINT_FRAME void paint_frame (WPanel *panel) { @@ -1124,7 +1096,6 @@ paint_frame (WPanel *panel) printw ("%*s", width, ""); } } -#endif static char * parse_panel_size (WPanel *panel, char *format, int isstatus) @@ -2449,27 +2420,6 @@ file_mark (WPanel *panel, int index, int val) x_panel_select_item (panel, index, val); } -#ifdef HAVE_X -sortfn * -get_sort_fn (char *name) -{ - int i; - - /* First, try the long name options, from dir.c */ - for (i = 0; i < SORT_TYPES_TOTAL; i++) - if (strcmp (name, sort_orders [i].sort_name) == 0) - return (sortfn *)sort_orders [i].sort_fn; - - /* Then try the short name options, from our local table */ - for (i = 0; i < ELEMENTS (formats); i++){ - if (strcmp (name, formats [i].id) == 0 && formats [i].sort_routine) - return formats [i].sort_routine; - } - return NULL; -} - -#else - /* */ /* Panel mouse events support routines */ /* */ @@ -2574,14 +2524,10 @@ panel_event (Gpm_Event *event, WPanel *panel) } return MOU_NORMAL; } -#endif /* !HAVE_X */ void panel_update_marks (WPanel *panel) { -#ifdef PORT_HAS_UPDATE_MARKS - x_panel_update_marks (panel); -#endif } void diff --git a/src/setup.c b/src/setup.c index b68ae55ad..3e434d09d 100644 --- a/src/setup.c +++ b/src/setup.c @@ -311,7 +311,6 @@ save_configure (void) g_free (profile); } -#ifndef PORT_HAS_SAVE_PANEL_TYPES static void panel_save_type (char *section, int type) { @@ -339,7 +338,6 @@ save_panel_types () if (type == view_listing) panel_save_setup (right_panel, right_panel->panel_name); } -#endif void save_setup (void) @@ -407,10 +405,10 @@ panel_load_setup (WPanel *panel, char *section) panel->list_type = list_types [i].list_type; break; } -#ifndef PORT_HAS_ICON_VIEW + if (panel->list_type == list_icons) panel->list_type = list_full; -#endif + /* User formats */ if (panel->user_format){ g_free (panel->user_format); diff --git a/src/textconf.h b/src/textconf.h index 93bac090c..fd7c91fe6 100644 --- a/src/textconf.h +++ b/src/textconf.h @@ -3,11 +3,7 @@ /* Features of the text mode edition */ -#define COMPUTE_FORMAT_ALLOCATIONS 1 -#define PORT_WIDGET_WANTS_HISTORY 1 -#define PORT_NEEDS_CHANGE_SCREEN_SIZE 1 #define x_flush_events() -#define port_shutdown_extra_fds() extern void version (int verbose); diff --git a/src/utilunix.c b/src/utilunix.c index 46b7abac9..d99e5ab0b 100644 --- a/src/utilunix.c +++ b/src/utilunix.c @@ -240,11 +240,6 @@ void save_stop_handler (void) } #endif /* VFS_STANDALONE */ -#ifdef HAVE_GNOME -#define PORT_HAS_MY_SYSTEM 1 -#endif - -#ifndef PORT_HAS_MY_SYSTEM int my_system (int flags, const char *shell, const char *command) { struct sigaction ignore, save_intr, save_quit, save_stop; @@ -310,7 +305,6 @@ int my_system (int flags, const char *shell, const char *command) return WEXITSTATUS(status); } -#endif /* Returns a newly allocated string, if directory does not exist, return 0 */ char *tilde_expand (const char *directory) diff --git a/src/view.c b/src/view.c index eadc5122d..563c132aa 100644 --- a/src/view.c +++ b/src/view.c @@ -778,28 +778,17 @@ view_display_clean (WView *view, int height, int width) #define MARK_COLOR SELECTED_COLOR #define DEF_COLOR NORMAL_COLOR -#ifndef PORT_HAS_VIEW_FREEZE -# define view_freeze(view) -# define view_thaw(view) -#endif +#define view_freeze(view) +#define view_thaw(view) -#ifdef HAVE_GNOME -# define PICK_COLOR(a,b) BOLD_COLOR : DEF_COLOR -#else -# define PICK_COLOR(a,b) a : b -#endif +#define PICK_COLOR(a,b) a : b +#define STATUS_LINES 1 /* Shows the file pointed to by *start_display on view_win */ static long display (WView *view) { -#ifdef HAVE_X -# define frame_shift 0 -# define STATUS_LINES 0 -#else const int frame_shift = view->have_frame; -# define STATUS_LINES 1 -#endif int col = 0 + frame_shift; int row = STATUS_LINES + frame_shift; int height, width; @@ -1540,19 +1529,6 @@ search (WView *view, char *text, int (*search)(WView *, char *, char *, int)) update_activate = 0; for (; ; g_free (s)){ -#ifdef PORT_HAS_FLUSH_EVENTS - static int count; - - if ((count++ % 32) == 0) - x_flush_events (); -#ifdef HAVE_GNOME - if (abort) - break; -#else - if (verbose && !d->running) - break; -#endif -#endif if (p >= update_activate){ update_activate += update_steps; if (verbose){ diff --git a/src/widget.c b/src/widget.c index 70af9ddc7..322d647f7 100644 --- a/src/widget.c +++ b/src/widget.c @@ -43,31 +43,21 @@ #include "key.h" /* XCTRL and ALT macros */ #include "profile.h" /* for history loading and saving */ -#ifndef HAVE_X -# define x_create_button(a,b,c) 1 -# define x_create_radio(a,b,c) 1 -# define x_create_check(a,b,c) 1 -# define x_create_label(a,b,c) 1 -# define x_create_input(a,b,c) 1 -# define x_create_listbox(a,b,c) 1 -# define x_create_buttonbar(a,b,c) 1 -# define x_create_gauge(a,b,c) 1 -# define x_listbox_select_nth(a,b) -# define x_list_insert(a,b,c) -# define x_redefine_label(a,b) -#endif +#define x_create_button(a,b,c) 1 +#define x_create_radio(a,b,c) 1 +#define x_create_check(a,b,c) 1 +#define x_create_label(a,b,c) 1 +#define x_create_input(a,b,c) 1 +#define x_create_listbox(a,b,c) 1 +#define x_create_buttonbar(a,b,c) 1 +#define x_create_gauge(a,b,c) 1 +#define x_listbox_select_nth(a,b) +#define x_list_insert(a,b,c) +#define x_redefine_label(a,b) -#ifndef PORT_HAS_DESTROY_CMD -# define x_destroy_cmd(w) -#endif - -#ifndef PORT_HAS_RADIO_FOCUS_ITEM -# define x_radio_focus_item(r) -#endif - -#ifndef PORT_HAS_RADIO_TOGGLE -# define x_radio_toggle(r) -#endif +#define x_destroy_cmd(w) +#define x_radio_focus_item(r) +#define x_radio_toggle(r) static int button_event (Gpm_Event *event, WButton *b); @@ -924,7 +914,6 @@ Hist *history_get (char *input_name) void history_put (char *input_name, Hist *h) { -#ifdef PORT_WIDGET_WANTS_HISTORY int i; char *profile; @@ -973,7 +962,6 @@ void history_put (char *input_name, Hist *h) } } g_free (profile); -#endif } /* }}} history saving and loading */ @@ -1111,7 +1099,7 @@ input_destroy (WInput *in) if (in->history){ Hist *current, *old; - if (!in->is_password && PORT_WIDGET_WANTS_HISTORY) /* don't save passwords ;-) */ + if (!in->is_password) /* don't save passwords ;-) */ history_put (in->history_name, in->history); current = in->history; @@ -1730,7 +1718,7 @@ input_new (int y, int x, int color, int len, const char *def_text, char *tkname) /* history setup */ in->history = NULL; in->history_name = 0; - if (tkname && PORT_WIDGET_WANTS_HISTORY){ + if (tkname) { if (*tkname) { in->history_name = g_strdup (tkname); in->history = history_get (tkname);