From 824b7198ea60eef0d02947e17aa84f93d387c656 Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Fri, 8 May 1998 02:25:00 +0000 Subject: [PATCH] Icon View mode for GNOME/mc: 1. My icons suck. 2. Keyboard handling is not finished. 3. Save current-mode, load current-mode is not implemented yet. 4. Listing mode is not working, as I have hardcoded the icon view for now. 5. Will finish this tomorrow. Not much is missing. 6. No, this is not the final implementation. 7. Yes, later I will put some scheme for using more icons as discussed in the ethernal "Re: Icons" thread. Miguel. 1998-05-07 Miguel de Icaza * gscreen.c (panel_icon_list_realized): Add drag and drop support to the icon list view; 1998-05-06 Miguel de Icaza * gscreen.c (panel_fill_panel_icons): New function: Fill up the icon list. (x_create_panel): Change in the approach: we create both of the widget views at creation time and we now carefully show every component. I attach everything to the table, but not necesarly show it. --- gnome/ChangeLog | 18 ++ gnome/Makefile.in | 18 +- gnome/gblist.c | 68 ++++++ gnome/gblist.h | 40 ++++ gnome/gmain.c | 6 +- gnome/gscreen.c | 419 +++++++++++++++++++++++++++++------ gnome/gscreen.h | 1 - gnome/i-core.png | Bin 0 -> 1135 bytes gnome/i-device.png | Bin 0 -> 1199 bytes gnome/i-directory.png | Bin 0 -> 1028 bytes gnome/i-executable.png | Bin 0 -> 1048 bytes gnome/i-regular.png | Bin 0 -> 1345 bytes gnome/i-sock.png | Bin 0 -> 1401 bytes gnome/i-symlink.png | Bin 0 -> 1152 bytes lib/mc.ext.in | 2 +- po/mc.pot | 308 +++++++++++++++----------- src/file.c | 482 ++++++++++++++++++++++++++++++++--------- src/layout.c | 36 ++- src/menu.c | 21 +- src/textconf.h | 6 +- src/user.c | 2 +- 21 files changed, 1109 insertions(+), 318 deletions(-) create mode 100644 gnome/gblist.c create mode 100644 gnome/gblist.h create mode 100644 gnome/i-core.png create mode 100644 gnome/i-device.png create mode 100644 gnome/i-directory.png create mode 100644 gnome/i-executable.png create mode 100644 gnome/i-regular.png create mode 100644 gnome/i-sock.png create mode 100644 gnome/i-symlink.png diff --git a/gnome/ChangeLog b/gnome/ChangeLog index 1d4a60b78..a19a2c547 100644 --- a/gnome/ChangeLog +++ b/gnome/ChangeLog @@ -1,3 +1,21 @@ +1998-05-07 Miguel de Icaza + + * gscreen.c (panel_icon_list_realized): Add drag and drop support + to the icon list view; + +1998-05-06 Miguel de Icaza + + * gscreen.c (panel_fill_panel_icons): New function: Fill up the + icon list. + (x_create_panel): Change in the approach: we create both of the + widget views at creation time and we now carefully show every + component. I attach everything to the table, but not necesarly + show it. + + * gblist.c (blist_select_row): New widget derived from GtkClist. + replace select_row and unselect_row with null functions, as the + gmc code takes care of the rest. + 1998-05-04 Miguel de Icaza * gdesktop.c (desktop_icon_drag_start): Do not attempt to use diff --git a/gnome/Makefile.in b/gnome/Makefile.in index 1dba966dc..0868b314c 100644 --- a/gnome/Makefile.in +++ b/gnome/Makefile.in @@ -33,7 +33,8 @@ GNOMESRCS = \ gmc-chargrid.c \ gpageprop.c \ gcliplabel.c \ - gcache.c + gcache.c \ + gblist.c GNOMEHDRS = \ gmain.h \ @@ -46,7 +47,8 @@ GNOMEHDRS = \ gpageprop.h \ gmc-chargrid.h \ gcliplabel.h \ - gcache.h + gcache.h \ + gblist.h ICONS = \ $(srcdir)/directory-ok.xpm \ @@ -54,7 +56,14 @@ ICONS = \ $(srcdir)/multi.xpm \ $(srcdir)/multi-ok.png \ $(srcdir)/not.png \ - $(srcdir)/multi-ok.xpm + $(srcdir)/multi-ok.xpm \ + $(srcdir)/i-directory.png \ + $(srcdir)/i-executable.png \ + $(srcdir)/i-symlink.png \ + $(srcdir)/i-device.png \ + $(srcdir)/i-regular.png \ + $(srcdir)/i-core.png \ + $(srcdir)/i-sock.png # # These objects from ../src do not depend on HAVE_X / HAVE_GNOME?? @@ -91,7 +100,8 @@ OBJS = $(LOBJS) $(OOBJS) \ gprop.o \ gpageprop.o \ gcliplabel.o \ - gcache.o + gcache.o \ + gblist.o # # Distribution variables diff --git a/gnome/gblist.c b/gnome/gblist.c new file mode 100644 index 000000000..03d1bf3a1 --- /dev/null +++ b/gnome/gblist.c @@ -0,0 +1,68 @@ +/* + * gblist: Implements a GtkCList derived widget that does not take any action + * on select and unselect calls. + * + * Author: Miguel de Icaza (miguel@kernel.org) + * (C) 1998 the Free Software Foundation. + */ +#include +#include "config.h" +#include "gblist.h" + +static void +blist_select_row (GtkCList *clist, gint row, gint column, GdkEventButton *event) +{ + /* nothing */ +} + +static void +blist_unselect_row (GtkCList *clist, gint row, gint column, GdkEventButton *event) +{ + /* nothing */ +} + +static void +gtk_blist_class_init (GtkBListClass *klass) +{ + GtkCListClass *clist_class = (GtkCListClass *) klass; + + clist_class->select_row = blist_select_row; + clist_class->unselect_row = blist_unselect_row; +} + +GtkType +gtk_blist_get_type (void) +{ + static GtkType blist_type = 0; + + if (!blist_type){ + GtkTypeInfo blist_info = + { + "GtkBList", + sizeof (GtkBList), + sizeof (GtkBListClass), + (GtkClassInitFunc) gtk_blist_class_init, + (GtkObjectInitFunc) NULL, + (GtkArgSetFunc) NULL, + (GtkArgGetFunc) NULL, + }; + + blist_type = gtk_type_unique (gtk_clist_get_type (), &blist_info); + } + + return blist_type; +} + +GtkWidget * +gtk_blist_new_with_titles (gint columns, gchar * titles[]) +{ + GtkWidget *widget; + + g_return_val_if_fail (titles != NULL, NULL); + + widget = gtk_type_new (gtk_blist_get_type ()); + + gtk_clist_construct (GTK_CLIST (widget), columns, titles); + + return widget; +} diff --git a/gnome/gblist.h b/gnome/gblist.h new file mode 100644 index 000000000..09f98b8b2 --- /dev/null +++ b/gnome/gblist.h @@ -0,0 +1,40 @@ +#ifndef __MC_BLIST_H__ +#define __MC_BLIST_H__ + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#define GTK_BLIST(obj) (GTK_CHECK_CAST ((obj), gtk_blist_get_type (), GtkBList)) +#define GTK_BLIST_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), gtk_blist_get_type (), GtkBListClass)) +#define GTK_IS_BLIST(obj) (GTK_CHECK_TYPE ((obj), gtk_blist_get_type ())) + +typedef struct +{ + GtkCList clist; +} GtkBList; + +typedef struct +{ + GtkCListClass parent_class; +} GtkBListClass; + +GtkType gtk_blist_get_type (void); +GtkWidget *gtk_blist_new_with_titles (gint columns, gchar * titles[]); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __GTK_CLIST_H__ */ diff --git a/gnome/gmain.c b/gnome/gmain.c index e4ecc9742..cf3fece7a 100644 --- a/gnome/gmain.c +++ b/gnome/gmain.c @@ -31,16 +31,18 @@ struct gmc_color_pairs_s gmc_color_pairs [MAX_COLOR_PAIRS]; char *default_edition_colors = "normal=black:" -"selected=red:" +"selected=white,darkblue:" "viewunderline=brightred,blue:" "directory=blue:" -"markselect=red,yellow:" +"markselect=yellow,darkblue:" "marked=yellow,seagreen:" "execute=slateblue:" "link=green:" "device=magenta:" "core=red:" "menuhotsel=cyan,black:" +"errors=white,red:" +"reverse=black,lightcyan:" "special=black"; /* The Dlg_head for the whole desktop */ diff --git a/gnome/gscreen.c b/gnome/gscreen.c index 194823a9b..65991cbc3 100644 --- a/gnome/gscreen.c +++ b/gnome/gscreen.c @@ -30,6 +30,7 @@ #include "gdesktop.h" #include "gpageprop.h" #include "gcliplabel.h" +#include "gblist.h" #include "../vfs/vfs.h" #include @@ -47,6 +48,15 @@ GdkBitmap *icon_link_mask; GdkPixmap *icon_dev_pixmap; GdkBitmap *icon_dev_mask; +/* These are big images used in the Icon View, for the gnome_icon_list */ +static GdkImlibImage *icon_view_directory; +static GdkImlibImage *icon_view_executable; +static GdkImlibImage *icon_view_symlink; +static GdkImlibImage *icon_view_device; +static GdkImlibImage *icon_view_regular; +static GdkImlibImage *icon_view_core; +static GdkImlibImage *icon_view_sock; + static char *drag_types [] = { "text/plain", "url:ALL" }; static char *drop_types [] = { "url:ALL" }; @@ -60,17 +70,25 @@ GtkWidget *drag_multiple_ok = NULL; typedef void (*context_menu_callback)(GtkWidget *, WPanel *); +/* + * Flags for the context-sensitive popup menus + */ #define F_ALL 1 #define F_REGULAR 2 #define F_SYMLINK 4 #define F_SINGLE 8 #define F_NOTDIR 16 +static void panel_file_list_configure_contents (GtkWidget *file_list, WPanel *panel, int main_width, int height); + void repaint_file (WPanel *panel, int file_index, int move, int attr, int isstatus) { } +/* + * Invoked by the generic code: show current working directory + */ void show_dir (WPanel *panel) { @@ -79,6 +97,9 @@ show_dir (WPanel *panel) gtk_window_set_title (GTK_WINDOW (panel->xwindow), panel->cwd); } +/* + * Utility routine: Try to load a bitmap for a file_entry + */ static void panel_file_list_set_type_bitmap (GtkCList *cl, int row, int column, int color, file_entry *fe) { @@ -96,6 +117,9 @@ panel_file_list_set_type_bitmap (GtkCList *cl, int row, int column, int color, f } } +/* + * Sets the color attributes for a given row. + */ static void panel_file_list_set_row_colors (GtkCList *cl, int row, int color_pair) { @@ -103,6 +127,10 @@ panel_file_list_set_row_colors (GtkCList *cl, int row, int color_pair) gtk_clist_set_background (cl, row, gmc_color_pairs [color_pair].back); } +/* + * Update the status of the back and forward history buttons. + * Called from the generic code + */ void x_panel_update_marks (WPanel *panel) { @@ -116,8 +144,11 @@ x_panel_update_marks (WPanel *panel) gtk_widget_set_sensitive (panel->back_b, bf); } -void -x_fill_panel (WPanel *panel) +/* + * Listing view: Load the contents + */ +static void +panel_fill_panel_list (WPanel *panel) { const int top = panel->count; const int items = panel->format->items; @@ -166,6 +197,75 @@ x_fill_panel (WPanel *panel) free (texts); } +/* + * Icon view: load the panel contents + */ +static void +panel_fill_panel_icons (WPanel *panel) +{ + GnomeIconList *icons = GNOME_ICON_LIST (panel->icons); + const int top = panel->count; + const int selected = panel->selected; + int i; + GdkImlibImage *image; + + gnome_icon_list_freeze (icons); + gnome_icon_list_clear (icons); + + for (i = 0; i < top; i++){ + file_entry *fe = &panel->dir.list [i]; + + + switch (file_entry_color (fe)){ + case DIRECTORY_COLOR: + image = icon_view_directory; + break; + + case LINK_COLOR: + image = icon_view_symlink; + break; + + case DEVICE_COLOR: + image = icon_view_device; + break; + + case SPECIAL_COLOR: + image = icon_view_sock; + break; + + case EXECUTABLE_COLOR: + image = icon_view_executable; + break; + + case CORE_COLOR: + image = icon_view_core; + break; + + case STALLED_COLOR: + case NORMAL_COLOR: + default: + image = icon_view_regular; + } + gnome_icon_list_append_imlib (icons, image, fe->fname); + } + /* This is needed as the gtk_clist_append changes selected under us :-( */ + panel->selected = selected; + select_item (panel); + gnome_icon_list_thaw (icons); +} + +/* + * Invoked from the generic code to fill the display + */ +void +x_fill_panel (WPanel *panel) +{ + if (panel->list_type == list_icons) + panel_fill_panel_icons (panel); + else + panel_fill_panel_list (panel); +} + static void gmc_panel_set_size (int index, int boot) { @@ -192,13 +292,15 @@ x_panel_set_size (int index) gmc_panel_set_size (index, 1); } +/* + * Invoked when the f.mark field of a file item changes + */ void x_panel_select_item (WPanel *panel, int index, int value) { int color; color = file_compute_color (value ? MARKED : NORMAL, &panel->dir.list[index]); - panel_file_list_set_row_colors (GTK_CLIST (panel->list), index, color); } @@ -206,18 +308,30 @@ void x_select_item (WPanel *panel) { GtkCList *clist = GTK_CLIST (panel->list); + int color, marked; - gtk_clist_select_row (clist, panel->selected, 0); + if (panel->dir.list [panel->selected].f.marked) + marked = 1; + else + marked = 0; + + color = file_compute_color (marked ? MARKED_SELECTED : SELECTED, &panel->dir.list [panel->selected]); + panel_file_list_set_row_colors (GTK_CLIST (panel->list), panel->selected, color); - if (gtk_clist_row_is_visible (clist, panel->selected) != GTK_VISIBILITY_FULL){ + /* Make it visible */ + if (gtk_clist_row_is_visible (clist, panel->selected) != GTK_VISIBILITY_FULL) gtk_clist_moveto (clist, panel->selected, 0, 0.5, 0.0); - } } void x_unselect_item (WPanel *panel) { - gtk_clist_unselect_row (GTK_CLIST (panel->list), panel->selected, 0); + int color; + int val; + + val = panel->dir.list [panel->selected].f.marked ? MARKED : NORMAL; + color = file_compute_color (val, &panel->dir.list [panel->selected]); + panel_file_list_set_row_colors (GTK_CLIST (panel->list), panel->selected, color); } void @@ -233,10 +347,17 @@ x_adjust_top_file (WPanel *panel) /* gtk_clist_moveto (GTK_CLIST (panel->list), panel->top_file, 0, 0.0, 0.0); */ } +/* + * These two constants taken from Gtk sources, hack to figure out how much + * of the clist is visible + */ #define COLUMN_INSET 3 #define CELL_SPACING 1 -void +/* + * Configures the columns title sizes for the panel->list CList widget + */ +static void panel_file_list_configure_contents (GtkWidget *file_list, WPanel *panel, int main_width, int height) { format_e *format = panel->format; @@ -357,6 +478,10 @@ panel_action_properties (GtkWidget *widget, WPanel *panel) free (full_name); } +/* + * The context menu: text displayed, condition that must be met and + * the routine that gets invoked upon activation. + */ static struct { char *text; int flags; @@ -375,6 +500,8 @@ static struct { { NULL, 0, NULL }, }; +/* + * context menu, constant entries */ static struct { char *text; context_menu_callback callback; @@ -563,6 +690,7 @@ panel_file_list_select_row (GtkWidget *file_list, int row, int column, GdkEvent switch (event->type) { case GDK_BUTTON_PRESS: + gtk_clist_unselect_row (GTK_CLIST (panel->list), row, 0); internal_select_item (file_list, panel, row); switch (event->button.button) { @@ -585,6 +713,7 @@ panel_file_list_select_row (GtkWidget *file_list, int row, int column, GdkEvent break; case GDK_2BUTTON_PRESS: + gtk_clist_unselect_row (GTK_CLIST (panel->list), row, 0); if (event->button.button == 1) do_enter (panel); break; @@ -681,7 +810,7 @@ panel_configure_file_list (WPanel *panel, GtkWidget *file_list) /* Configure the CList */ - gtk_clist_set_selection_mode (cl, GTK_SELECTION_BROWSE); + gtk_clist_set_selection_mode (cl, GTK_SELECTION_SINGLE); gtk_clist_set_policy (cl, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); for (i = 0, format = panel->format; format; format = format->next){ @@ -738,7 +867,7 @@ panel_build_selected_file_list (WPanel *panel, int *file_list_len) } static void -panel_drag_request (GtkWidget *widget, GdkEventDragRequest *event, WPanel *panel) +panel_clist_drag_request (GtkWidget *widget, GdkEventDragRequest *event, WPanel *panel) { void *data; int len; @@ -758,16 +887,11 @@ panel_drag_request (GtkWidget *widget, GdkEventDragRequest *event, WPanel *panel } } -static void -panel_drop_enter (GtkWidget *widget, GdkEvent *event) -{ -} - /* * Invoked when a drop has happened on the panel */ static void -panel_drop_data_available (GtkWidget *widget, GdkEventDropDataAvailable *data, WPanel *panel) +panel_clist_drop_data_available (GtkWidget *widget, GdkEventDropDataAvailable *data, WPanel *panel) { gint winx, winy; gint dropx, dropy; @@ -800,27 +924,12 @@ panel_drop_data_available (GtkWidget *widget, GdkEventDropDataAvailable *data, W panel_update_contents (panel); } -/* Workaround for the CList that is not adding its clist-window to the DND windows */ -static void -fixed_gtk_widget_dnd_drop_set (GtkCList *clist, int drop_enable, char **drop_types, int count, int is_destructive) -{ -/* gtk_widget_dnd_drop_set (GTK_WIDGET (clist), drop_enable, drop_types, count, is_destructive); */ - gdk_window_dnd_drop_set (clist->clist_window, drop_enable, drop_types, count, is_destructive); -} - -static void -fixed_gtk_widget_dnd_drag_set (GtkCList *clist, int drag_enable, gchar **type_accept_list, int numtypes) -{ -/* gtk_widget_dnd_drag_set (GTK_WIDGET (clist), drag_enable, type_accept_list, numtypes); */ - gdk_window_dnd_drag_set (clist->clist_window, drag_enable, type_accept_list, numtypes); -} - static void panel_drag_begin (GtkWidget *widget, GdkEvent *event, WPanel *panel) { GdkPoint hotspot = { 15, 15 }; - if (panel->marked){ + if (panel->marked > 1){ if (drag_multiple && drag_multiple_ok){ gdk_dnd_set_drag_shape (drag_multiple->window, &hotspot, drag_multiple_ok->window, &hotspot); @@ -855,14 +964,9 @@ load_transparent_image (char *base) return w; } -/* - * Pixmaps can only be loaded once the window has been realized, so - * this is why this hook is here - */ static void -panel_realized (GtkWidget *file_list, WPanel *panel) +load_dnd_icons (void) { - GtkObject *obj = GTK_OBJECT (file_list); GdkPoint hotspot = { 5, 5 }; if (!drag_directory) @@ -880,29 +984,32 @@ panel_realized (GtkWidget *file_list, WPanel *panel) if (drag_directory && drag_directory_ok) gdk_dnd_set_drag_shape (drag_directory->window, &hotspot, drag_directory_ok->window, &hotspot); +} + +/* + * Pixmaps can only be loaded once the window has been realized, so + * this is why this hook is here + */ +static void +panel_realized (GtkWidget *file_list, WPanel *panel) +{ + GtkObject *obj = GTK_OBJECT (file_list); + + load_dnd_icons (); /* DND: Drag setup */ - gtk_signal_connect (obj, "drag_request_event", - GTK_SIGNAL_FUNC (panel_drag_request), panel); - gtk_signal_connect (obj, "drag_begin_event", - GTK_SIGNAL_FUNC (panel_drag_begin), panel); + gtk_signal_connect (obj, "drag_request_event", GTK_SIGNAL_FUNC (panel_clist_drag_request), panel); + gtk_signal_connect (obj, "drag_begin_event", GTK_SIGNAL_FUNC (panel_drag_begin), panel); - fixed_gtk_widget_dnd_drag_set (GTK_CLIST (file_list), TRUE, drag_types, ELEMENTS (drag_types)); + gdk_window_dnd_drag_set (GTK_CLIST (file_list)->clist_window, TRUE, drag_types, ELEMENTS (drag_types)); /* DND: Drop setup */ - gtk_signal_connect (obj, "drop_enter_event", - GTK_SIGNAL_FUNC (panel_drop_enter), panel); - - gtk_signal_connect (obj, "drop_leave_event", - GTK_SIGNAL_FUNC (panel_drop_enter), panel); - - gtk_signal_connect (obj, "drop_data_available_event", - GTK_SIGNAL_FUNC (panel_drop_data_available), panel); + gtk_signal_connect (obj, "drop_data_available_event", GTK_SIGNAL_FUNC (panel_clist_drop_data_available), panel); /* Artificial way of getting drag to start without leaving the widget boundary */ gtk_signal_connect (obj, "motion_notify_event", GTK_SIGNAL_FUNC (panel_artificial_drag_start), panel); - fixed_gtk_widget_dnd_drop_set (GTK_CLIST (file_list), TRUE, drop_types, ELEMENTS (drop_types), FALSE); + gdk_window_dnd_drop_set (GTK_CLIST (file_list)->clist_window, TRUE, drop_types, ELEMENTS (drop_types), FALSE); } /* @@ -923,7 +1030,7 @@ panel_create_file_list (WPanel *panel) if (format->use_in_gui) titles [i++] = format->title; - file_list = gtk_clist_new_with_titles (items, titles); + file_list = gtk_blist_new_with_titles (items, titles); clist = GTK_CLIST (file_list); panel_configure_file_list (panel, file_list); free (titles); @@ -947,7 +1054,152 @@ panel_create_file_list (WPanel *panel) static void panel_icon_list_select_icon (GtkWidget *widget, int index, GdkEvent *event, WPanel *panel) { - printf ("ícono %d seleccionado\n", index); + panel->selected = index; + do_file_mark (panel, index, 1); + display_mini_info (panel); + execute_hooks (select_file_hook); + + switch (event->type){ + case GDK_BUTTON_PRESS: + if (event->button.button == 3){ + file_popup (event, panel, index, panel->dir.list [index].fname); + return; + } + break; + + case GDK_2BUTTON_PRESS: + if (event->button.button == 1) + do_enter (panel); + break; + + default: + break; + } +} + +static void +panel_icon_list_unselect_icon (GtkWidget *widget, int index, GdkEvent *event, WPanel *panel) +{ + do_file_mark (panel, index, 0); + display_mini_info (panel); + if (panel->marked == 0) + panel->selected = 0; +} + +static GdkImlibImage * +load_image_icon_view (char *base) +{ + GdkImlibImage *im; + char *f = concat_dir_and_file (ICONDIR, base); + + im = gdk_imlib_load_image (base); + g_free (f); + return im; +} + +void +load_imlib_icons (void) +{ + static int loaded; + + if (loaded) + return; + + icon_view_directory = load_image_icon_view ("i-directory.png"); + icon_view_executable = load_image_icon_view ("i-executable.png"); + icon_view_symlink = load_image_icon_view ("i-symlink.png"); + icon_view_device = load_image_icon_view ("i-device.png"); + icon_view_regular = load_image_icon_view ("i-regular.png"); + icon_view_core = load_image_icon_view ("i-core.png"); + icon_view_sock = load_image_icon_view ("i-sock.png"); + + loaded = 1; +} + +static void +panel_icon_list_artificial_drag_start (GtkObject *obj, GdkEventMotion *event) +{ + GnomeIconList *ilist = GNOME_ICON_LIST (obj); + + artificial_drag_start (ilist->ilist_window, event->x, event->y); +} + +static void +panel_icon_list_drag_request (GtkWidget *widget, GdkEventDragRequest *event, WPanel *panel) +{ + GnomeIconList *ilist = GNOME_ICON_LIST (widget); + void *data; + int len; + + if (!((strcmp (event->data_type, "text/plain") == 0) || + (strcmp (event->data_type, "url:ALL") == 0))) + return; + + data = panel_build_selected_file_list (panel, &len); + + gdk_window_dnd_data_set (ilist->ilist_window, (GdkEvent *) event, data, len); + free (data); +} + +static void +panel_icon_list_drop_data_available (GtkWidget *widget, GdkEventDropDataAvailable *data, WPanel *panel) +{ + GnomeIconList *ilist = GNOME_ICON_LIST (widget); + gint winx, winy; + gint dropx, dropy; + gint item; + char *drop_dir; + + gdk_window_get_origin (ilist->ilist_window, &winx, &winy); + dropx = data->coords.x - winx; + dropy = data->coords.y - winy; + + if (dropx < 0 || dropy < 0) + return; + + item = gnome_icon_list_get_icon_at (ilist, dropx, dropy); + if (item == -1) + drop_dir = panel->cwd; + else { + g_assert (item < panel->count); + + if (S_ISDIR (panel->dir.list [item].buf.st_mode)) + drop_dir = concat_dir_and_file (panel->cwd, panel->dir.list [item].fname); + else + drop_dir = panel->cwd; + } + drop_on_directory (data, drop_dir, 0); + + if (drop_dir != panel->cwd) + free (drop_dir); + + update_one_panel_widget (panel, 0, UP_KEEPSEL); + panel_update_contents (panel); +} + +/* + * Setup for the icon view + */ +static void +panel_icon_list_realized (GtkObject *obj, WPanel *panel) +{ + GnomeIconList *icon = GNOME_ICON_LIST (obj); + + load_imlib_icons (); + load_dnd_icons (); + + /* DND: Drag setup */ + gtk_signal_connect (obj, "drag_request_event", GTK_SIGNAL_FUNC (panel_icon_list_drag_request), panel); + gtk_signal_connect (obj, "drag_begin_event", GTK_SIGNAL_FUNC (panel_drag_begin), panel); + gdk_window_dnd_drag_set (icon->ilist_window, TRUE, drag_types, ELEMENTS (drag_types)); + + /* DND: Drop setup */ + gtk_signal_connect (obj, "drop_data_available_event", + GTK_SIGNAL_FUNC (panel_icon_list_drop_data_available), panel); + + gtk_signal_connect (obj, "motion_notify_event", + GTK_SIGNAL_FUNC (panel_icon_list_artificial_drag_start), panel); + gdk_window_dnd_drop_set (icon->ilist_window, TRUE, drop_types, ELEMENTS (drop_types), FALSE); } /* @@ -956,14 +1208,19 @@ panel_icon_list_select_icon (GtkWidget *widget, int index, GdkEvent *event, WPan static GtkWidget * panel_create_icon_display (WPanel *panel) { - GtkWidget *icon_field; - - icon_field = gnome_icon_list_new (); + GnomeIconList *icon_field; + icon_field = GNOME_ICON_LIST (gnome_icon_list_new ()); + + gnome_icon_list_set_selection_mode (icon_field, GTK_SELECTION_MULTIPLE); + gtk_signal_connect (GTK_OBJECT (icon_field), "select_icon", - GTK_SIGNAL_FUNC (panel_icon_list_select_icon), - panel); - return icon_field; + GTK_SIGNAL_FUNC (panel_icon_list_select_icon), panel); + gtk_signal_connect (GTK_OBJECT (icon_field), "unselect_icon", + GTK_SIGNAL_FUNC (panel_icon_list_unselect_icon), panel); + gtk_signal_connect (GTK_OBJECT (icon_field), "realize", + GTK_SIGNAL_FUNC (panel_icon_list_realized), panel); + return GTK_WIDGET (icon_field); } void @@ -1211,6 +1468,11 @@ display_mini_info (WPanel *panel) gtk_clip_label_set (label, buffer); free (buffer); } + if (panel->list_type == list_icons){ + if (panel->marked == 0){ + gtk_clip_label_set (label, ""); + } + } } static GtkWidget * @@ -1290,10 +1552,23 @@ x_create_panel (Dlg_head *h, widget_data parent, WPanel *panel) panel->table = gtk_table_new (2, 1, 0); + panel->list_type = list_icons; + printf ("\n\n *** NOTICE ***\n\n\n" + " You are running a version of GNOME/mc with a hardcoded\n" + " value for running in the under-development icon-view mode.\n" + " To fix this you have to edit gnome/gscreen.c around line %d \n" + " and remove the line that reads: panel->list_type = list_icons\n\n" + " You can alternatively wait for me to finish this.\n", __LINE__ -6); + + panel->icons = panel_create_icon_display (panel); + panel->list = panel_create_file_list (panel); + gtk_widget_ref (panel->icons); + gtk_widget_ref (panel->list); + if (panel->list_type == list_icons) - display = panel->icons = panel_create_icon_display (panel); + display = panel->icons; else - display = panel->list = panel_create_file_list (panel); + display = panel->list; filter = panel_create_filter (h, panel, &panel->filter_w); cwd = panel_create_cwd (h, panel, &panel->current_dir); @@ -1319,6 +1594,7 @@ x_create_panel (Dlg_head *h, widget_data parent, WPanel *panel) panel->ministatus = gtk_clip_label_new (""); gtk_misc_set_alignment (GTK_MISC (panel->ministatus), 0.0, 0.0); gtk_misc_set_padding (GTK_MISC (panel->ministatus), 3, 0); + gtk_widget_show (panel->ministatus); status_line = gtk_hbox_new (0, 0); gtk_label_set_justify (GTK_LABEL (panel->ministatus), GTK_JUSTIFY_LEFT); @@ -1327,6 +1603,7 @@ x_create_panel (Dlg_head *h, widget_data parent, WPanel *panel) gtk_box_pack_start (GTK_BOX (status_line), panel->fwd_b, 0, 0, 2); gtk_box_pack_start (GTK_BOX (status_line), cwd, 1, 1, 5); gtk_box_pack_end (GTK_BOX (status_line), filter, 0, 0, 0); + gtk_widget_show_all (status_line); /* The statusbar */ frame = gtk_frame_new (NULL); @@ -1338,11 +1615,18 @@ x_create_panel (Dlg_head *h, widget_data parent, WPanel *panel) gtk_misc_set_padding (GTK_MISC (panel->status), 3, 0); gtk_container_add (GTK_CONTAINER (frame), panel->status); gtk_label_set_justify (GTK_LABEL (panel->status), GTK_JUSTIFY_LEFT); - - gtk_table_attach (GTK_TABLE (panel->table), display, 0, 1, 1, 2, + gtk_widget_show_all (frame); + + /* Add both the icon view and the listing view */ + gtk_table_attach (GTK_TABLE (panel->table), panel->icons, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL | GTK_SHRINK, GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0, 0); + gtk_table_attach (GTK_TABLE (panel->table), panel->list, 0, 1, 1, 2, + GTK_EXPAND | GTK_FILL | GTK_SHRINK, + GTK_EXPAND | GTK_FILL | GTK_SHRINK, + 0, 0); + gtk_widget_show (display); gtk_table_attach (GTK_TABLE (panel->table), status_line, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0); @@ -1362,9 +1646,14 @@ x_create_panel (Dlg_head *h, widget_data parent, WPanel *panel) /* Now, insert our table in our parent */ gtk_container_add (GTK_CONTAINER (vbox), panel->table); + gtk_widget_show (vbox); + gtk_widget_show (panel->table); if (!(panel->widget.options & W_PANEL_HIDDEN)) - gtk_widget_show_all (gtk_widget_get_toplevel (panel->table)); + gtk_widget_show (gtk_widget_get_toplevel (panel->table)); + + /* This is a bug workaround for the icon list, as the icon */ + gtk_widget_queue_resize (panel->icons); if (!pixmaps_ready){ if (!GTK_WIDGET_REALIZED (panel->list)) diff --git a/gnome/gscreen.h b/gnome/gscreen.h index 13e384282..e686445ce 100644 --- a/gnome/gscreen.h +++ b/gnome/gscreen.h @@ -5,7 +5,6 @@ void panel_action_view_unfiltered (GtkWidget *widget, WPanel *panel); void panel_action_view (GtkWidget *widget, WPanel *panel); WPanel *create_container (Dlg_head *h, char *str, char *geometry); -void panel_file_list_configure_contents (GtkWidget *file_list, WPanel *panel, int main_width, int height); typedef struct { int splitted; diff --git a/gnome/i-core.png b/gnome/i-core.png new file mode 100644 index 0000000000000000000000000000000000000000..a3a2de404db9bd34e0763bd1db21190b0d828f1e GIT binary patch literal 1135 zcmV-#1d#iQP)IY6qFn?Dl3obajX@F# zA!5)~H$fK_LE0B~6@3vVE@o7MSS_1DrsW!mvb9@=Eq;_%=FGY~bLM!_|AmK__w3A> z&WRPy125<7Ip_WO&+|P0=VPIeLJGO8r7z)m8MqU;1DFfcfl=TG;M`0HRR%WepiMI- zfVXD);VZyiAO_lj@n@H73}}rQ7y(`bR_VvdO-jI4vvCak1)Kmb2*6+$+8glJh=G>Y z+MFkd6~K8NGzJa>HNC3>%XOVj)&dQ)hOfz38m{C4;0++sMyGn*WLWbf;78yE;1l4a zr;&j?G_gw?N5Ho|`p={Qw4@CuHEGmoq%MvAXPIU0&u9aHt9n@L9$>ca8^EXL-8aBW zL%~;yqB8|>Q~>&<-n1&7Ywj-w;>Eatg}%=Oz_3gJV4gU?mSU|DnIFLQz_x(X&o=k< zJObE$!x)hOjqCXy(dd5Q{Q$TUaL~+e0sDY^^{#5@crq&=@Z}-kS8d+*z}Qg-o(#;t zPnxjvCV;b=-|3rDm$Bs~6-Q0Y{~P#Hbel_1`@)N;EfdV#^W(tX z9oAW|bR_gcL`wV)>$^;W95Wj=foC*!>u>jb?KI}{q8E`}ByZ?>)C{GQX_E_ZegjUO-VXS>Jk#>g>DcMWa4Vje^(3>hyoGeQy zY;MpsR!e2fm{jQC6TnBnh6IiFoK8?Cs+~otOQe)b&K5S9FtnZjl;cZD8j#4TWH&?3crq0s-i$0JXNo zD*bZqt#VL5_vvM{fM@e4++XG2e}1@4hCDuZDZ@_S7x`8zC7`ov_f+!gN-R`^w*h?J zffg&k{c77R0OqT069)q6sBHhkqN7nrA%)C5xdh|^uvO)KKGFaH002ovPDHLkV1mi@ BAhiGh literal 0 HcmV?d00001 diff --git a/gnome/i-device.png b/gnome/i-device.png new file mode 100644 index 0000000000000000000000000000000000000000..447345921ee5080dfafa257cef8a6707caa202bf GIT binary patch literal 1199 zcmV;g1W@~lP)!6Ha4ihU3&VtnyI zTWNhLDhPs4>Vq#nC|-hELRG{IB5EU2S`n{QjaF?zYl@dPjnp-by2)NXU;ZB)#yQ`& zjoFn?GO(~YXU{n^bN(~)pA(pud6}0&OHToGJP}w4ECZ^*PT+f>UKA(a3XB5NGT=pE zphzfr7ia)2eQLnQbh1KO1+)}|xQf*NpE z2MibzMF`LO4meXcafWW+I&(wTrYU@qV9~eo#$3xAj3t=U~!~yo(_B-F(PrszKR{b*aTF%c;qNNdX2b?hue=$h6&|D;4`x> zbYi&ItFgn^N4#*Yx$?Ued_ziui-P&Bj`ATScADRZ>GD#=L^A^8%yeD`zH|;fY~b^N zV3BUN8@MExAB!j--o&{X5MBbjpx=2na0ux477vIr*aNq;QP!Ub=6}mEpatC0Mh|?a zVklJpCt%RVQA*}kJH##lo-|_%odefs(^i{t(w{S51s(&Q1fq#)16Op^YHd3?OvaQwJ zl*0^@01jTj?oqs4rs~-|O0ORQ9#%ZG^=@T1Xs8z@LT?*Vek9V2%qXRnMFoaL!WtPk zpAijzP(j^x``Y7hi@yY$x(>Bo*a18$PcIcew=jGKSf{)q3Q|U~W9(v4g-f!uwdHj`VfwOCM8ju7BuQRRQfehud z((2Z38;}4WnyW7ZH|w1=rhLqZ(QX?srKY>&ykA}pylE{U^85<@6XIA=@C8b>!|^YVX@zX6!iY>j#XIA#C< N002ovPDHLkV1lI1BYOY< literal 0 HcmV?d00001 diff --git a/gnome/i-directory.png b/gnome/i-directory.png new file mode 100644 index 0000000000000000000000000000000000000000..82e01bae504ca2d50f385298bcf214cf5ce30043 GIT binary patch literal 1028 zcmV+f1pE7mP)C`M`0Y+r@UGKx^14by%_Rs0U+A z2a09<2Lmcq0;b^4b@<5-_^g10xy$6Jk3? zYyj~l_C=ZlI)@yf7U;8|ce;(t^06`BH|nmofWfUk0x*$;bBCXgR0|vs2@L>6z)2?+>UTLan4p-C zbmWjly>fwrZZ_~f2{z!BmI7I}zAQHYZ8NCkQ>Hl)IszC-!p73PY)p}*B58+fB#ws+ zAYaj^ip~oa#vKnM&+!v;ih*s4cYPjHn79|Fu&4;QD(SVI?wg9lVbyQ4fwMq`;@t?) zWD3CY5F&4ZRQ;+oI(<{B8Ad$9I*$hC^{ejz&Hzg^JZ-?KAQ^xiz*+^*XaZ6#5|!Bv z%+>I90Q)t`UBUoVzW0yMIg7IqfQ5XB5#sDRg>87i~InjB=JVPRBC6#M7@f0}0)U8V% zFi&_d0E6NRol1zW(APno=(45|wo^Bt4)+U-s7w;I0EXHlF(}RE(tqj(4C4O^$u5BroJ;3^r~-J*RKYnao4*aL)SX3p zUEH6ORK~?tPRp-}tE5b^wat=Rw+o;yom89n_hMoM_#)@zA)A3mg|`E^$kgR`(rzQ2 y(%lA8rPshNTU9OstdJ^NIj}g%>G&+oNcsyV39rt;Z%(uT0000WilW@;B2yy_vkxnU%F1ji({ZLn=fUI7x$n*BjLwh;F2lTg z-+AYM&bjB~UKpd)qAXw)a2xmx1c9G1j2}Q3a2Y5XO#rKb4?uW`qYt<=ngD8tA-prb zjikVt#{aSe@az~(3-k_C`>%njkra5m@jpXZQxDYn@EHI)fu}&rXj}5;6lIB1wcTCNpI5yz)TB(rgQrz!Iv67Y>|pahr%dBj0Ti4A|wLGTFi9=dj+sVt;)JKpu!TioyMvJD3=O3->+&2 z#3`uP=rGE1TZQ`$SYg?hYk`N-5xxO-8%l|y*_MwC1yoQp=g>_LKJCCfL%YRdHTOI3 z{d$!ui||fQ9Ewr+0pOmP-=Rg~?=}#(fEltj54fhR?KhMX6@}(1bA7-%pa7U6zZ2zm z7BE>{FGrq-fJWf7xQ9c{KqYVl*rXJU6+ks`4%i25P}cOyA%m3;E1F4k63Y{9YnJE% zu8O8LPq;1{+e$}A0DzM$n>^evY>8Nl{W9@LH8$^n?UE-<8mBz_1niVO%mY9jFg>1Xv_P5b zOd^0>V5!G^DKI}ChCPZFE+i2^wS>or@?GcI-FO&&R~Q{nlJJG1u!w88g?GjuOOK+u zkanChm;~Viz(MH^%(C8;VFGYc`iYb|*jfT?Rzm1+@dEQep%Pe`Dgg3;Goo2sARsO+Od;B8$nyJJhScBmn+0uz= zd|!G2*kUPV!VS zD{!8F_srQ!xXu?#l*^vTN;7>&{YKz{*PUK&S3 S3xj?D0000|W^Ks|ix%c$oy0BTSefGY` ztBl|u4&1xX-us;YUVHu5+Uw-7(F$A!Tm`fN1HjL~KR}I1jy!M|&;wL}DsTuW05drO zFbDWWR@%Laz(Xejffc}nL7)a~0$L_JfsZ^dUz4pgKQMkS@DA`V&h-2r zpaztI>r%!K8)IJdsNF(ft1O1LbP@OhSO%QgOae9F-IVboM*o6(@dd!!YODFKMB>n$ zVy&hSIG8e7h`=1+%M_*4FJHfgft6Yi@)>>SoWM3p!+k(!#Itki|7pO>;$saHNQ}u> zWF+vgM?4T;D0`lnh%Y?vT0fRR$!NPLqrP9`ar_s6izQuoLX@axkhubAZ`23&d169m z1|O&z_wV+|>q<}mXB)M^VVTI?LiLys+HRrPk^nz?tp2`4e~m?r5|{w`m2>5Q`^BMA zE39!rz*!&jY{yXvW*RfHsL*;t8O{bCP;LJiW9J3@X|-(A)xh<@H1UPUfeRyjGSvrq zf%AYdrOh>9ms*IQjPZlc{mm&_uYJrHAJ%2DzyS&SiQ4N|0<)ZcdyKJXIltG)LRea# zONj$@j7uQQ6vzsOqqYD`o&Vd7ac*+=ok-@WN9#lJs2lh`%ND9j+dx+=2$7K9c)jR3#~&*bwRlGOkK*LoemtFj0s>07@hL`Js&%SALYC37x; zn>~rxs+3?=J)Q@e5PC!^ryHronxm|SoGYnDyJ-Em#GhUfhf*^v0PvO3XUOq`SPSHV z*}#*sFeQ(Cjsb6qln2pgOt4G!SrzbuSOS*-AIeIHoOm2~+FAjPsYY8_{qHtjDz9_( z$P&(y$Wl!U@JP(0e;MpQHzpf0`h6orY7rJ_1@=d*ye{hmEnp>8e;NmmKBM0afyB+l zMdGwpuqunvrA1^f0jteQ&^8%urvvv!60jVyDjDuviPSkoqCe(kEm*agZfBL;{AHOZ zf3Y&kA+_>75^a~N{HZ?o2U!VN=of#{xY2V;(-;6gb+o-KMdhnSZ4!g`W$Z1vn@M-DNfsT;5Ic+B3rN!>%@)V zH{e_2sHyS0XM9^kJ*aN2!DB(7BKc1)@De*Ci&s9(0=h(cn@RvVT#Td~OcFU}9xd8| z=XBI=27yuFGvlb~O6Z;@WzP>vVJnqD61i7hyzZQ=G>WlluwYC|DZ|FSX~0I{Z+YHs zJPu=h8%skg@Pj9R`8s7>(dhq@lWH6YGN*BVMD4U-MCPhg*LWT9R}V4X6KmvXpvgb5;^b}B@^!Ur1>Xt5{=-0xA!rn2qCcJ00000NkvXXu0mjf DGq!R! literal 0 HcmV?d00001 diff --git a/gnome/i-sock.png b/gnome/i-sock.png new file mode 100644 index 0000000000000000000000000000000000000000..721363d9763e191b9df5745ede4188d1c4ca29e5 GIT binary patch literal 1401 zcmV-<1%~>GP)77>jj?I6*Z7eC(BtRK z?CkDz-FV<*XNKAHo%5Y@{^v5V$f?2SSu?O2SOQEgCS_g##(;UCpx=4mcVIWLrd9<{ z0B-;}Bec8Hz^+;pzFsH0S=aM=e$l*B(5gvl1iFB0bbkRz0sCZ`yMg^~fk#mqGZxrU zCA7;pLg#@ja0!@ko`)W49dHP^Q};8#Dd3zKW(1?BoWOQz1{eX36v-XW18)OM4M6-M zYkUF>0}lb4faQAUPvA+#r7v|$bE~yoIVn?Y&FV0^0(>_iCB1znfbBri=iLVcDBior zlwf_S3Fy%uvJ%);qEN#6ONZi8n{k~S&>q3n?B0DrF61e(8fXPtfEB>iDkrW7mMKpJ z(NewRl_n>F`vedky$);>pVPpq2=USC*v=48OE=A;fT)|zCx3u|XVoNtk%Ufi=%@I!Mai9~p z&6Fa)%8lZnVRLCbY zVm45L)8_gH`CrxqXq{nFZk4E!*Z$qfW5vpR#*wFizwrD<~kSU4;z3XAxYL`Sznb3jUB+#$`6Sc0&=^7+JZ`y&Je^~=QLJbL5Zwd)U2%EZuZX0!aoUdjssJ2 zofL4p-kkt$t%W{43G@o33O-e7&XhCuc~31hQB87(0iA3%q~^*h=8|Ex(0{GWqbj3s z7V0%hwi)1aV5eN`|3?i~^!qKqM!Ch&#dc6@P5(Poq|q;@m<)uxtx6uF`rR7V8HG@b zX=dg^gzHkWn*?5~#N6A|tNNkB;WEaI3E;fx#yWihxm#B9U~_Ld!mj}i2)e@B#sg)T zc*qF1$0(Kp24xwK|CCCal3nJolRRcLF?bL7-pp_^KBriW_L+|CTi`7X)w0f>6MiK_ z6x!n?k1y4OCXAVfeNHjz;r!^6b?tpxmPnObciAz<`vIeoy(ZQ7Mu?>z#nOC$E9NEm zFN%StasxMEs>ECf(mbc8WklCO)UH`)!Ko&#@T0`|-J#X^;%t$$->MaMTCX_5&O0tM z6;pZsk728)z?m5MwVQEB(CRHSr})w)gD~SU7HQq`?>V0-v}c)tINYeiSl~)D3`xOm z-VxqgM=Dh!X;OVUZvQl7XQStxz&^{uc)x77nl;Q*S6G1zmxs!8j$4hDlZBD5dQ1i@ z!Q>E1n?#w^9y|E=2ahRb#mrg$jdNaUNVH>10ys~I7OK%>AmTDyF{y<*g@FtB;@_00000NkvXX Hu0mjf!se6S literal 0 HcmV?d00001 diff --git a/gnome/i-symlink.png b/gnome/i-symlink.png new file mode 100644 index 0000000000000000000000000000000000000000..48e73f8a0c9018a91ea92213c4564a6f20fc4aab GIT binary patch literal 1152 zcmV-`1b_R9P)`<%1(`tQBg+H0*1H;?WEz68dAio>J89^gT4VOj~?FqDsY3^)L^XPuxO zSOfeDjA&IZ06oAwpf!i`1z>-I@)4JS)mbLE8~9L)TY|3w8-W=)%;#DFfC_LPxHqlv zuYqz6!T$lPG6HzkBeUN#{z|CeslcuPa~c3(Fwn8<0^m)Z(DkHpqX1kqqQ%p|8^EkUzcHMxn2_P7XgW&&TaRUtlieCSqrR?Lb$+D!${%ZUJ7_|Kl+pO#@@DT78&}Pi>i~*peXL~&bR4Qr%mH@kz zC6+US7?2#7W*aigI&=D*)vqX#%oP+;rScig`7v`Z}iIUdkBSd=%JOH1cGVcDuP zdTPiTRyo^L0Oi0E5|yi^1X+D@;-&#;13HXxpOTlwzLfeWcu~rx>8yQjgwCit z-C2)<68&NuXa)#{gI|yv{gu&^+ z{TWXAhgA&y4eYbF^;pg#CgLL`U(j^`e;5_n`GDGEMCNBwcaGvEDkpc<@SA9{o)?H= zs&@h_w9|V9#-~R=@KU{t`m&1p?wqM_K@saot@0Q0m6Cj55ZED8N-XL_9jv6hz8*K1 zNeAQuO6nHr@7APl*i_&NsuvlHsoq2uVljG1(cpk`nX@(WnF*Sp37VkWnEnS;H&%%q SHpuD#0000\n" "Content-Type: text/plain; charset=\n" "Xgettext-Options: --default-domain=mc --directory=.. --add-comments --keyword=_ --keyword=N_ --files-from=./POTFILES.in\n" @@ -62,7 +62,7 @@ msgstr "" msgid " Save As " msgstr "" -#: edit/editcmd.c:413 edit/editcmd.c:722 edit/editcmd.c:734 edit/editcmd.c:835 edit/editcmd.c:918 gnome/gdesktop.c:1301 src/ext.c:295 src/help.c:320 src/main.c:685 src/subshell.c:696 src/subshell.c:722 src/utilunix.c:374 src/utilunix.c:378 src/utilunix.c:444 +#: edit/editcmd.c:413 edit/editcmd.c:722 edit/editcmd.c:734 edit/editcmd.c:835 edit/editcmd.c:918 gnome/gdesktop.c:1303 src/ext.c:295 src/help.c:320 src/main.c:685 src/subshell.c:696 src/subshell.c:722 src/utilunix.c:374 src/utilunix.c:378 src/utilunix.c:444 msgid " Warning " msgstr "" @@ -308,11 +308,11 @@ msgstr "" msgid "Cancel quit" msgstr "" -#: edit/editcmd.c:1969 gnome/gcmd.c:94 gnome/gdesktop.c:804 gnome/gdesktop.c:1116 src/cmd.c:248 src/file.c:2124 src/file.c:2477 src/file.c:2557 src/hotlist.c:1027 src/main.c:840 src/screen.c:1989 src/subshell.c:697 src/subshell.c:723 src/tree.c:1195 src/view.c:410 +#: edit/editcmd.c:1969 gnome/gcmd.c:94 gnome/gdesktop.c:806 gnome/gdesktop.c:1118 src/cmd.c:248 src/file.c:2323 src/file.c:2649 src/file.c:2839 src/hotlist.c:1027 src/main.c:840 src/screen.c:1989 src/subshell.c:697 src/subshell.c:723 src/tree.c:1195 src/view.c:410 msgid "&Yes" msgstr "" -#: edit/editcmd.c:1969 gnome/gcmd.c:94 gnome/gdesktop.c:804 gnome/gdesktop.c:1116 src/cmd.c:248 src/file.c:2124 src/file.c:2474 src/file.c:2557 src/hotlist.c:1027 src/main.c:840 src/screen.c:1989 src/subshell.c:697 src/subshell.c:723 src/tree.c:1195 src/view.c:410 +#: edit/editcmd.c:1969 gnome/gcmd.c:94 gnome/gdesktop.c:806 gnome/gdesktop.c:1118 src/cmd.c:248 src/file.c:2323 src/file.c:2648 src/file.c:2839 src/hotlist.c:1027 src/main.c:840 src/screen.c:1989 src/subshell.c:697 src/subshell.c:723 src/tree.c:1195 src/view.c:410 msgid "&No" msgstr "" @@ -782,7 +782,7 @@ msgstr "" msgid "Search" msgstr "" -#: edit/editwidget.c:999 gnome/gdesktop.c:803 gnome/gdesktop.c:1013 src/screen.c:2212 src/screen.c:2246 +#: edit/editwidget.c:999 gnome/gdesktop.c:805 gnome/gdesktop.c:1015 src/screen.c:2212 src/screen.c:2246 msgid "Delete" msgstr "" @@ -810,7 +810,7 @@ msgid "" "\n" msgstr "" -#: src/achown.c:72 src/boxes.c:139 src/boxes.c:274 src/boxes.c:371 src/boxes.c:458 src/boxes.c:637 src/boxes.c:758 src/boxes.c:800 src/chmod.c:115 src/chown.c:81 src/cmd.c:840 src/file.c:1961 src/find.c:158 src/hotlist.c:140 src/hotlist.c:810 src/hotlist.c:903 src/layout.c:365 src/learn.c:58 src/option.c:143 src/panelize.c:89 src/view.c:410 src/wtools.c:114 src/wtools.c:408 src/wtools.c:581 src/wtools.c:661 +#: src/achown.c:72 src/boxes.c:139 src/boxes.c:274 src/boxes.c:371 src/boxes.c:458 src/boxes.c:637 src/boxes.c:758 src/boxes.c:811 src/chmod.c:115 src/chown.c:81 src/cmd.c:840 src/file.c:1956 src/find.c:158 src/hotlist.c:140 src/hotlist.c:810 src/hotlist.c:903 src/layout.c:365 src/learn.c:58 src/option.c:143 src/panelize.c:89 src/view.c:410 src/wtools.c:114 src/wtools.c:408 src/wtools.c:581 src/wtools.c:661 msgid "&Cancel" msgstr "" @@ -886,7 +886,7 @@ msgstr "" msgid "Background process:" msgstr "" -#: src/background.c:284 src/file.c:2362 +#: src/background.c:284 src/file.c:2561 msgid " Background process error " msgstr "" @@ -932,7 +932,8 @@ msgstr "" msgid "user &Mini status" msgstr "" -#: gnome/gtools.c:130 src/boxes.c:138 src/boxes.c:273 src/boxes.c:373 src/boxes.c:460 src/boxes.c:639 src/boxes.c:759 src/boxes.c:802 src/boxes.c:911 src/file.c:1968 src/find.c:158 src/layout.c:364 src/option.c:142 src/wtools.c:302 src/wtools.c:583 +#. WITH_BACKGROUND +#: gnome/gtools.c:130 src/boxes.c:138 src/boxes.c:273 src/boxes.c:373 src/boxes.c:460 src/boxes.c:639 src/boxes.c:759 src/boxes.c:813 src/boxes.c:924 src/file.c:1973 src/find.c:158 src/layout.c:364 src/option.c:142 src/wtools.c:302 src/wtools.c:583 msgid "&Ok" msgstr "" @@ -1028,36 +1029,45 @@ msgstr "" msgid " Virtual File System Setting " msgstr "" -#: src/boxes.c:820 +#: src/boxes.c:771 +msgid "Quick cd" +msgstr "" + +#. want cd like completion +#: src/boxes.c:776 +msgid "cd" +msgstr "" + +#: src/boxes.c:831 msgid "Symbolic link filename:" msgstr "" -#: src/boxes.c:822 +#: src/boxes.c:833 msgid "Existing filename (filename symlink will point to):" msgstr "" -#: src/boxes.c:851 +#: src/boxes.c:862 msgid "Running " msgstr "" -#: src/boxes.c:852 src/find.c:664 +#: src/boxes.c:863 src/find.c:664 msgid "Stopped" msgstr "" -#: src/boxes.c:906 -msgid "Background Jobs" +#: src/boxes.c:921 +msgid "&Stop" msgstr "" -#: src/boxes.c:913 -msgid "&Kill" -msgstr "" - -#: src/boxes.c:915 +#: src/boxes.c:922 msgid "&Resume" msgstr "" -#: src/boxes.c:917 -msgid "&Stop" +#: src/boxes.c:923 +msgid "&Kill" +msgstr "" + +#: src/boxes.c:962 +msgid "Background Jobs" msgstr "" #: src/chmod.c:96 @@ -1577,11 +1587,23 @@ msgstr "" msgid "mc.ext will be used for this moment." msgstr "" -#: src/file.c:391 src/file.c:2363 src/file.c:2442 src/file.c:2557 +#: src/file.c:250 src/tree.c:1100 +msgid " Copy " +msgstr "" + +#: src/file.c:250 src/tree.c:1133 +msgid " Move " +msgstr "" + +#: src/file.c:250 src/tree.c:1195 +msgid " Delete " +msgstr "" + +#: src/file.c:391 src/file.c:2562 src/file.c:2638 src/file.c:2839 msgid "&Abort" msgstr "" -#: src/file.c:394 src/file.c:2363 +#: src/file.c:394 src/file.c:2562 msgid "&Skip" msgstr "" @@ -1821,173 +1843,210 @@ msgid " Internal error: get_file \n" msgstr "" #. follow symlinks and preserve Attributes must be the first -#: src/file.c:1935 +#: src/file.c:1930 msgid "preserve &Attributes" msgstr "" -#: src/file.c:1937 +#: src/file.c:1932 msgid "follow &Links" msgstr "" -#: src/file.c:1946 +#: src/file.c:1941 msgid "to:" msgstr "" -#: src/file.c:1947 +#: src/file.c:1942 msgid "&Using shell patterns" msgstr "" -#: src/file.c:1966 +#: src/file.c:1965 msgid "&Background" msgstr "" -#: src/file.c:1969 +#: src/file.c:1974 msgid "&Stable Symlinks" msgstr "" -#: src/file.c:1971 +#: src/file.c:1976 msgid "&Dive into subdir if exists" msgstr "" -#: src/file.c:2038 +#: src/file.c:2123 msgid "" "Invalid source pattern `%s' \n" " %s " msgstr "" -#: src/file.c:2097 -msgid " Can't operate on \"..\"! " +#. +#. * This array introduced to avoid translation problems. The former (op_names) +#. * is assumed to be nouns, suitable in dialog box titles; this one should +#. * contain whatever is used in prompt itself (i.e. in russian, it's verb). +#. * Notice first symbol - it is to fool gettext and force these strings to +#. * be different for it. First symbol is skipped while building a prompt. +#. * (I don't use spaces around the words, because someday they could be +#. * dropped, when widgets get smarter) +#. +#: src/file.c:2163 +msgid "1Copy" msgstr "" -#: src/file.c:2108 -msgid "directories" +#: src/file.c:2163 +msgid "1Move" msgstr "" -#: src/file.c:2109 -msgid "files/directories" +#: src/file.c:2163 +msgid "1Delete" msgstr "" -#: src/file.c:2109 -msgid "files" +#. +#. * These are formats for building a prompt. Parts encoded as follows: +#. * %o - operation from op_names1 +#. * %f - file/files or files/directories, as appropriate +#. * %m - "with source mask" or question mark for delete +#. * %s - source name (truncated) +#. * %d - number of marked files +#. +#: src/file.c:2173 +msgid "%o %f \"%s\"%m" msgstr "" -#: src/file.c:2110 src/file.c:2116 -msgid " with source mask:" +#: src/file.c:2174 +msgid "%o %d %f%m" msgstr "" -#: src/file.c:2114 -msgid "directory" -msgstr "" - -#: src/file.c:2114 +#: src/file.c:2178 msgid "file" msgstr "" -#: src/file.c:2159 +#: src/file.c:2178 +msgid "files" +msgstr "" + +#: src/file.c:2178 +msgid "directory" +msgstr "" + +#: src/file.c:2178 +msgid "directories" +msgstr "" + +#: src/file.c:2179 +msgid "files/directories" +msgstr "" + +#: src/file.c:2179 +msgid " with source mask:" +msgstr "" + +#: src/file.c:2308 +msgid " Can't operate on \"..\"! " +msgstr "" + +#: src/file.c:2358 msgid " Sorry, I could not put the job in background " msgstr "" -#: src/file.c:2222 src/file.c:2292 +#: src/file.c:2421 src/file.c:2491 msgid " Internal failure " msgstr "" -#: src/file.c:2222 src/file.c:2293 +#: src/file.c:2421 src/file.c:2492 msgid " Unknown file operation " msgstr "" -#: src/file.c:2238 +#: src/file.c:2437 msgid "" " Destination \"%s\" must be a directory \n" " %s " msgstr "" -#: src/file.c:2363 +#: src/file.c:2562 msgid "&Retry" msgstr "" -#: src/file.c:2401 +#: src/file.c:2600 src/file.c:2636 msgid "Target file \"%s\" already exists!" msgstr "" -#: src/file.c:2431 -msgid " File exists " -msgstr "" - -#: src/file.c:2431 -msgid " Background process: File exists " -msgstr "" - -#: src/file.c:2447 +#: src/file.c:2639 msgid "if &Size differs" msgstr "" -#: src/file.c:2450 src/file.c:2557 +#: src/file.c:2641 src/file.c:2839 msgid "non&E" msgstr "" -#: src/file.c:2453 +#: src/file.c:2642 msgid "&Update" msgstr "" -#: src/file.c:2456 +#: src/file.c:2643 msgid "al&L" msgstr "" -#: src/file.c:2459 +#: src/file.c:2644 msgid "Overwrite all targets?" msgstr "" -#: src/file.c:2468 +#: src/file.c:2646 msgid "&Reget" msgstr "" -#: src/file.c:2470 +#: src/file.c:2647 msgid "ap&Pend" msgstr "" -#: src/file.c:2479 +#: src/file.c:2650 msgid "Overwrite this target?" msgstr "" -#: src/file.c:2483 +#: src/file.c:2652 msgid "Target date: %s, size %d" msgstr "" -#: src/file.c:2486 +#: src/file.c:2654 msgid "Source date: %s, size %d" msgstr "" -#: src/file.c:2550 +#: src/file.c:2742 +msgid " File exists " +msgstr "" + +#: src/file.c:2742 +msgid " Background process: File exists " +msgstr "" + +#: src/file.c:2832 msgid "" "\n" " Directory not empty. \n" " Delete it recursively? " msgstr "" -#: src/file.c:2551 +#: src/file.c:2833 msgid "" "\n" " Background process: Directory not empty \n" " Delete it recursively? " msgstr "" -#: src/file.c:2557 +#: src/file.c:2839 msgid "a&ll" msgstr "" -#: src/file.c:2565 +#: src/file.c:2847 msgid " Type 'yes' if you REALLY want to delete " msgstr "" -#: src/file.c:2567 +#: src/file.c:2849 msgid "all the directories " msgstr "" -#: src/file.c:2568 +#: src/file.c:2850 msgid " Recursive Delete " msgstr "" -#: src/file.c:2569 +#: src/file.c:2851 msgid " Background process: Recursive Delete " msgstr "" @@ -2542,7 +2601,7 @@ msgstr "" msgid " The shell is already running a command " msgstr "" -#: gnome/gcmd.c:92 gnome/gdesktop.c:1114 src/main.c:838 src/screen.c:1987 +#: gnome/gcmd.c:92 gnome/gdesktop.c:1116 src/main.c:838 src/screen.c:1987 msgid " The Midnight Commander " msgstr "" @@ -3145,7 +3204,7 @@ msgstr "" msgid " %s bytes in %d file%s" msgstr "" -#: gnome/gscreen.c:1200 src/screen.c:667 +#: gnome/gscreen.c:1288 src/screen.c:667 msgid "" msgstr "" @@ -3153,11 +3212,11 @@ msgstr "" msgid "Unknow tag on display format: " msgstr "" -#: gnome/gdesktop.c:1115 src/screen.c:1988 +#: gnome/gdesktop.c:1117 src/screen.c:1988 msgid " Do you really want to execute? " msgstr "" -#: gnome/glayout.c:274 gnome/gscreen.c:369 src/screen.c:2207 src/screen.c:2241 +#: gnome/glayout.c:274 gnome/gscreen.c:452 src/screen.c:2207 src/screen.c:2241 msgid "View" msgstr "" @@ -3209,18 +3268,10 @@ msgstr "" msgid "Copy \"%s\" directory to:" msgstr "" -#: src/tree.c:1100 -msgid " Copy " -msgstr "" - #: src/tree.c:1131 msgid "Move \"%s\" directory to:" msgstr "" -#: src/tree.c:1133 -msgid " Move " -msgstr "" - #: src/tree.c:1138 msgid "" " Can't stat the destination \n" @@ -3235,10 +3286,6 @@ msgstr "" msgid " Delete %s? " msgstr "" -#: src/tree.c:1195 -msgid " Delete " -msgstr "" - #: src/tree.c:1232 msgid "Static" msgstr "" @@ -3299,6 +3346,11 @@ msgstr "" msgid " I can't run programs while logged on a non local directory " msgstr "" +#. Create listbox +#: src/user.c:713 +msgid " User menu " +msgstr "" + #: src/util.c:232 msgid "name_trunc: too big" msgstr "" @@ -3672,23 +3724,23 @@ msgstr "" msgid "Link" msgstr "" -#: gnome/gdesktop.c:802 +#: gnome/gdesktop.c:804 msgid "Do you want to delete " msgstr "" -#: gnome/gdesktop.c:1006 gnome/gscreen.c:365 +#: gnome/gdesktop.c:1008 gnome/gscreen.c:448 msgid "Properties" msgstr "" -#: gnome/gdesktop.c:1125 +#: gnome/gdesktop.c:1127 msgid "Open with..." msgstr "" -#: gnome/gdesktop.c:1126 gnome/gscreen.c:321 +#: gnome/gdesktop.c:1128 gnome/gscreen.c:400 msgid "Enter extra arguments:" msgstr "" -#: gnome/gdesktop.c:1301 +#: gnome/gdesktop.c:1303 msgid " Could not open %s directory" msgstr "" @@ -3700,7 +3752,7 @@ msgstr "" msgid "Opens a terminal" msgstr "" -#: gnome/glayout.c:269 gnome/gscreen.c:382 +#: gnome/glayout.c:269 gnome/gscreen.c:467 msgid "Copy..." msgstr "" @@ -3724,7 +3776,7 @@ msgstr "" msgid "Creates a new folder" msgstr "" -#: gnome/glayout.c:272 gnome/gscreen.c:384 +#: gnome/glayout.c:272 gnome/gscreen.c:469 msgid "Delete..." msgstr "" @@ -4021,115 +4073,115 @@ msgstr "" msgid "Select icon" msgstr "" -#: gnome/gscreen.c:320 +#: gnome/gscreen.c:399 msgid " Open with..." msgstr "" -#: gnome/gscreen.c:367 +#: gnome/gscreen.c:450 msgid "Open" msgstr "" -#: gnome/gscreen.c:368 +#: gnome/gscreen.c:451 msgid "Open with" msgstr "" -#: gnome/gscreen.c:370 +#: gnome/gscreen.c:453 msgid "View unfiltered" msgstr "" -#: gnome/gscreen.c:372 +#: gnome/gscreen.c:455 msgid "Link..." msgstr "" -#: gnome/gscreen.c:373 +#: gnome/gscreen.c:456 msgid "Symlink..." msgstr "" -#: gnome/gscreen.c:374 +#: gnome/gscreen.c:457 msgid "Edit symlink..." msgstr "" -#: gnome/gscreen.c:383 +#: gnome/gscreen.c:468 msgid "Rename/move.." msgstr "" -#: gnome/gscreen.c:1008 +#: gnome/gscreen.c:1096 msgid "All files" msgstr "" -#: gnome/gscreen.c:1010 +#: gnome/gscreen.c:1098 msgid "Archives and compressed files" msgstr "" -#: gnome/gscreen.c:1012 +#: gnome/gscreen.c:1100 msgid "RPM/DEB files" msgstr "" -#: gnome/gscreen.c:1014 +#: gnome/gscreen.c:1102 msgid "Text/Document files" msgstr "" -#: gnome/gscreen.c:1016 +#: gnome/gscreen.c:1104 msgid "HTML and SGML files" msgstr "" -#: gnome/gscreen.c:1018 +#: gnome/gscreen.c:1106 msgid "Postscript and PDF files" msgstr "" -#: gnome/gscreen.c:1020 +#: gnome/gscreen.c:1108 msgid "Spreadsheet files" msgstr "" -#: gnome/gscreen.c:1022 +#: gnome/gscreen.c:1110 msgid "Image files" msgstr "" -#: gnome/gscreen.c:1025 +#: gnome/gscreen.c:1113 msgid "Video/animation files" msgstr "" -#: gnome/gscreen.c:1027 +#: gnome/gscreen.c:1115 msgid "Audio files" msgstr "" -#: gnome/gscreen.c:1029 +#: gnome/gscreen.c:1117 msgid "C program files" msgstr "" -#: gnome/gscreen.c:1031 +#: gnome/gscreen.c:1119 msgid "C++ program files" msgstr "" -#: gnome/gscreen.c:1033 +#: gnome/gscreen.c:1121 msgid "Objective-C program files" msgstr "" -#: gnome/gscreen.c:1035 +#: gnome/gscreen.c:1123 msgid "Scheme program files" msgstr "" -#: gnome/gscreen.c:1037 +#: gnome/gscreen.c:1125 msgid "Assembler program files" msgstr "" -#: gnome/gscreen.c:1039 +#: gnome/gscreen.c:1127 msgid "Misc. program files" msgstr "" -#: gnome/gscreen.c:1041 +#: gnome/gscreen.c:1129 msgid "Font files" msgstr "" -#: gnome/gscreen.c:1166 +#: gnome/gscreen.c:1254 msgid "Search: " msgstr "" -#: gnome/gscreen.c:1176 +#: gnome/gscreen.c:1264 msgid " %s bytes in %d file%s" msgstr "" -#: gnome/gscreen.c:1246 +#: gnome/gscreen.c:1334 msgid "Filter" msgstr "" diff --git a/src/file.c b/src/file.c index 4f200bc16..ae559a5cc 100644 --- a/src/file.c +++ b/src/file.c @@ -247,7 +247,7 @@ int showing_eta; int showing_bps; unsigned long bps = 0, bps_time = 0; -static char *op_names [] = { " Copy ", " Move ", " Delete " }; +static char *op_names [] = { N_(" Copy "), N_(" Move "), N_(" Delete ") }; static int selected_button; static int last_percentage [3]; @@ -1918,20 +1918,15 @@ file_mask_defaults (void) preserve_uidgid = (geteuid () == 0) ? 1 : 0; } -char * -file_mask_dialog (int operation, char *text, char *def_text, int only_one, int *do_background) -{ #define FMDY 13 - int source_easy_patterns = easy_patterns; - char *source_mask, *orig_mask, *dest_dir; - const char *error; - struct stat buf; - int val; - char *header = op_names [operation]; - - QuickDialog Quick_input; - static QuickWidget quick_widgets [] = { -/* follow symlinks and preserve Attributes must be the first */ +#define FMD_XLEN 64 +static int fmd_xlen = FMD_XLEN, fmd_i18n_flag = 0; +static QuickWidget fmd_widgets [] = { + +#define FMCB0 FMDC +#define FMCB12 0 +#define FMCB11 1 + /* follow symlinks and preserve Attributes must be the first */ { quick_checkbox, 3, 64, 8, FMDY, N_("preserve &Attributes"), 9, 0, &op_preserve, 0, XV_WLAY_BELOWCLOSE, "preserve" }, { quick_checkbox, 3, 64, 7, FMDY, N_("follow &Links"), 7, 0, @@ -1956,14 +1951,24 @@ file_mask_dialog (int operation, char *text, char *def_text, int only_one, int * 0, 0, XV_WLAY_BELOWCLOSE, "input2" }, #endif #define FMDI0 6 - { quick_label, 2, 64, 2, FMDY, "", 0, 0, 0, 0, XV_WLAY_DONTCARE, "ql" }, -#define SKIP 4 + { quick_label, 3, 64, 2, FMDY, "", 0, 0, 0, 0, XV_WLAY_DONTCARE, "ql" }, +#define FMBRGT 7 { quick_button, 42, 64, 9, FMDY, N_("&Cancel"), 0, B_CANCEL, 0, 0, XV_WLAY_DONTCARE, "cancel" }, -#ifdef WITH_BACKGROUND #undef SKIP -#define SKIP 5 +#ifdef WITH_BACKGROUND +# define SKIP 5 +# define FMCB21 11 +# define FMCB22 10 +# define FMBLFT 9 +# define FMBMID 8 { quick_button, 25, 64, 9, FMDY, N_("&Background"), 0, B_USER, 0, 0, XV_WLAY_DONTCARE, "back" }, +#else /* WITH_BACKGROUND */ +# define SKIP 4 +# define FMCB21 10 +# define FMCB22 9 +# define FMBLFT 8 +# undef FMBMID #endif { quick_button, 14, 64, 9, FMDY, N_("&Ok"), 0, B_ENTER, 0, 0, XV_WLAY_NEXTROW, "ok" }, { quick_checkbox, 42, 64, 8, FMDY, N_("&Stable Symlinks"), 0, 0, @@ -1972,27 +1977,107 @@ file_mask_dialog (int operation, char *text, char *def_text, int only_one, int * &dive_into_subdirs, 0, XV_WLAY_BELOWOF, "dive" }, { 0 } }; +void +fmd_init_i18n() +{ +#ifdef ENABLE_NLS + + register int i; + int len; + + for (i = sizeof (op_names) / sizeof (op_names[0]); i--;) + op_names [i] = _(op_names [i]); + + i = sizeof (fmd_widgets) / sizeof (fmd_widgets [0]) - 1; + while (i--) + if (fmd_widgets [i].text[0] != '\0') + fmd_widgets [i].text = _(fmd_widgets [i].text); + + len = strlen (fmd_widgets [FMCB11].text) + + strlen (fmd_widgets [FMCB21].text) + 15; + fmd_xlen = max (fmd_xlen, len); + + len = strlen (fmd_widgets [FMCB12].text) + + strlen (fmd_widgets [FMCB22].text) + 15; + fmd_xlen = max (fmd_xlen, len); + + len = strlen (fmd_widgets [FMBRGT].text) + + strlen (fmd_widgets [FMBLFT].text) + 11; + +#ifdef FMBMID + len += strlen (fmd_widgets [FMBMID].text) + 6; +#endif + + fmd_xlen = max (fmd_xlen, len + 4); + + len = (fmd_xlen - (len + 6)) / 2; + i = fmd_widgets [FMBLFT].relative_x = len + 3; + i += strlen (fmd_widgets [FMBLFT].text) + 8; + +#ifdef FMBMID + fmd_widgets [FMBMID].relative_x = i; + i += strlen (fmd_widgets [FMBMID].text) + 6; +#endif + + fmd_widgets [FMBRGT].relative_x = i; + +#define chkbox_xpos(i) \ + fmd_widgets [i].relative_x = fmd_xlen - strlen (fmd_widgets [i].text) - 6 + + chkbox_xpos(FMCB0); + chkbox_xpos(FMCB21); + chkbox_xpos(FMCB22); + + if (fmd_xlen != FMD_XLEN) + { + i = sizeof (fmd_widgets) / sizeof (fmd_widgets [0]) - 1; + while (i--) + fmd_widgets [i].x_divisions = fmd_xlen; + + fmd_widgets [FMDI1].hotkey_pos = + fmd_widgets [FMDI2].hotkey_pos = fmd_xlen - 6; + } +#undef chkbox_xpos +#endif /* ENABLE_NLS */ + + fmd_i18n_flag = 1; +} + +char * +file_mask_dialog (int operation, char *text, char *def_text, int only_one, int *do_background) +{ + int source_easy_patterns = easy_patterns; + char *source_mask, *orig_mask, *dest_dir; + const char *error; + struct stat buf; + int val; + + QuickDialog Quick_input; + + if (!fmd_i18n_flag) + fmd_init_i18n(); + stable_symlinks = 0; - quick_widgets [FMDC].result = &source_easy_patterns; - quick_widgets [FMDI1].text = easy_patterns ? "*" : "^\\(.*\\)$"; - Quick_input.xlen = 64; + fmd_widgets [FMDC].result = &source_easy_patterns; + fmd_widgets [FMDI1].text = easy_patterns ? "*" : "^\\(.*\\)$"; + Quick_input.xlen = fmd_xlen; Quick_input.xpos = -1; - Quick_input.title = header; + Quick_input.title = op_names [operation]; Quick_input.help = "[Mask Copy/Rename]"; Quick_input.ylen = FMDY; - Quick_input.i18n = 0; + Quick_input.i18n = 1; if (operation == OP_COPY) { Quick_input.class = "quick_file_mask_copy"; - Quick_input.widgets = quick_widgets; + Quick_input.widgets = fmd_widgets; } else { /* operation == OP_MOVE */ Quick_input.class = "quick_file_mask_move"; - Quick_input.widgets = quick_widgets + 2; + Quick_input.widgets = fmd_widgets + 2; } - quick_widgets [FMDI0].text = text; - quick_widgets [FMDI2].text = def_text; - quick_widgets [FMDI2].str_result = &dest_dir; - quick_widgets [FMDI1].str_result = &source_mask; + fmd_widgets [FMDI0].text = text; + fmd_widgets [FMDI2].text = def_text; + fmd_widgets [FMDI2].str_result = &dest_dir; + fmd_widgets [FMDI1].str_result = &source_mask; *do_background = 0; ask_file_mask: @@ -2066,6 +2151,132 @@ ask_file_mask: return dest_dir; } +/* + * This array introduced to avoid translation problems. The former (op_names) + * is assumed to be nouns, suitable in dialog box titles; this one should + * contain whatever is used in prompt itself (i.e. in russian, it's verb). + * Notice first symbol - it is to fool gettext and force these strings to + * be different for it. First symbol is skipped while building a prompt. + * (I don't use spaces around the words, because someday they could be + * dropped, when widgets get smarter) + */ +static char *op_names1 [] = { N_("1Copy"), N_("1Move"), N_("1Delete") }; + +/* + * These are formats for building a prompt. Parts encoded as follows: + * %o - operation from op_names1 + * %f - file/files or files/directories, as appropriate + * %m - "with source mask" or question mark for delete + * %s - source name (truncated) + * %d - number of marked files + */ +static char* one_format = N_("%o %f \"%s\"%m"); +static char* many_format = N_("%o %d %f%m"); + +static char* prompt_parts [] = +{ + N_("file"), N_("files"), N_("directory"), N_("directories"), + N_("files/directories"), N_(" with source mask:") +}; + +static char* +generate_prompt(char* cmd_buf, WPanel* panel, int operation, int only_one, + struct stat* src_stat) +{ + register char *sp, *cp; + register int i; + char format_string [200]; + char *dp = format_string; + char* source = NULL; + +#ifdef ENABLE_NLS + static int i18n_flag = 0; + if (!i18n_flag) + { + if (!fmd_i18n_flag) + fmd_init_i18n(); /* to get proper fmd_xlen */ + + for (i = sizeof (op_names1) / sizeof (op_names1 [0]); i--;) + op_names1 [i] = _(op_names1 [i]); + + for (i = sizeof (prompt_parts) / sizeof (prompt_parts [0]); i--;) + prompt_parts [i] = _(prompt_parts [i]); + + one_format = _(one_format); + many_format = _(many_format); + i18n_flag = 1; + } +#endif /* ENABLE_NLS */ + + sp = only_one ? one_format : many_format; + + if (only_one) + source = get_file (panel, src_stat); + + while (*sp) + { + switch (*sp) + { + case '%': + cp = NULL; + switch (sp[1]) + { + case 'o': + cp = op_names1 [operation] + 1; + break; + case 'm': + cp = operation == OP_DELETE ? "?" : prompt_parts [5]; + break; + case 'f': + if (only_one) + { + cp = S_ISDIR (src_stat->st_mode) ? + prompt_parts [2] : prompt_parts [0]; + } + else + { + cp = (panel->marked == panel->dirs_marked) + ? prompt_parts [3] + : (panel->dirs_marked ? prompt_parts [4] + : prompt_parts [1]); + } + break; + default: + *dp++ = *sp++; + } + if (cp) + { + sp += 2; + while (*cp) + *dp++ = *cp++; + } + break; + default: + *dp++ = *sp++; + } + } + *dp = '\0'; + + if (only_one) + { + i = fmd_xlen - strlen(format_string) - 4; + sprintf (cmd_buf, format_string, name_trunc (source, i)); + } + else + { + sprintf (cmd_buf, format_string, panel->marked); + i = strlen (cmd_buf) + 6 - fmd_xlen; + if (i > 0) + { + fmd_xlen += i; + fmd_init_i18n(); /* to recalculate positions of child widgets */ + } + } + + return source; +} + + /* Returns 1 if did change the directory structure, Returns 0 if user aborted */ int @@ -2102,19 +2313,7 @@ panel_operate (void *source_panel, int operation, char *thedefault) return 0; /* Generate confirmation prompt */ - - if (!only_one){ - sprintf (cmd_buf, "%s%d %s%s ", _(op_names [operation]), panel->marked, - (panel->marked == panel->dirs_marked) ? _("directories") : - (panel->dirs_marked) ? _("files/directories") : _("files"), - (operation == OP_DELETE) ? "?" : _(" with source mask:")); - } else { - source = get_file (panel, &src_stat); - sprintf (cmd_buf,"%s%s \"%s\"%s ", _(op_names [operation]), - S_ISDIR (src_stat.st_mode) ? _("directory") : _("file"), - name_trunc (source, S_ISDIR (src_stat.st_mode) ? 23 : 28), - (operation == OP_DELETE) ? "?" : _(" with source mask:")); - } + source = generate_prompt(cmd_buf, panel, operation, only_one, &src_stat); /* Show confirmation dialog */ if (operation == OP_DELETE && confirm_delete){ @@ -2413,79 +2612,162 @@ replace_callback (struct Dlg_head *h, int Id, int Msg) return 0; } -static void -init_replace (enum OperationMode mode) -{ - char buffer [128]; - - replace_colors [0] = ERROR_COLOR; - replace_colors [1] = COLOR_NORMAL; - replace_colors [2] = ERROR_COLOR; - replace_colors [3] = COLOR_NORMAL; - - replace_dlg = create_dlg (0, 0, 16, 60, replace_colors, replace_callback, - "[ Replace ]", "replace", DLG_CENTER); - - - x_set_dialog_title (replace_dlg, - mode == Foreground ? _(" File exists ") : _(" Background process: File exists ")); - #ifdef HAVE_X #define X_TRUNC 128 #else #define X_TRUNC 52 #endif - sprintf (buffer, _(format), name_trunc (replace_filename, X_TRUNC - strlen (format))); - add_widgetl (replace_dlg, label_new (3, 5, buffer, "target-e"), XV_WLAY_CENTERROW); + +/* + * FIXME: probably it is better to replace this with quick dialog machinery, + * but actually I'm not familiar with it and have not much time :( + * alex + */ +static struct +{ + char* text; + int ypos, xpos; + int value; /* 0 for labels */ + char* tkname; + WLay layout; +} +rd_widgets [] = +{ + {N_("Target file \"%s\" already exists!"), + 3, 4, 0, "target-e", XV_WLAY_CENTERROW}, + {N_("&Abort"), BY + 3, 25, REPLACE_ABORT, "abort", XV_WLAY_CENTERROW}, + {N_("if &Size differs"), + BY + 1, 28, REPLACE_SIZE, "if-size", XV_WLAY_RIGHTOF}, + {N_("non&E"), BY, 47, REPLACE_NEVER, "none", XV_WLAY_RIGHTOF}, + {N_("&Update"), BY, 36, REPLACE_UPDATE, "update", XV_WLAY_RIGHTOF}, + {N_("al&L"), BY, 28, REPLACE_ALWAYS, "all", XV_WLAY_RIGHTOF}, + {N_("Overwrite all targets?"), + BY, 4, 0, "over-label", XV_WLAY_CENTERROW}, + {N_("&Reget"), BY - 1, 28, REPLACE_REGET, "reget", XV_WLAY_RIGHTOF}, + {N_("ap&Pend"), BY - 2, 45, REPLACE_APPEND, "append", XV_WLAY_RIGHTOF}, + {N_("&No"), BY - 2, 37, REPLACE_NO, "no", XV_WLAY_RIGHTOF}, + {N_("&Yes"), BY - 2, 28, REPLACE_YES, "yes", XV_WLAY_RIGHTOF}, + {N_("Overwrite this target?"), + BY - 2, 4, 0, "overlab", XV_WLAY_CENTERROW}, + {N_("Target date: %s, size %d"), + 6, 4, 0, "target-date",XV_WLAY_CENTERROW}, + {N_("Source date: %s, size %d"), + 5, 4, 0, "source-date",XV_WLAY_CENTERROW} +}; + +#define ADD_RD_BUTTON(i)\ + add_widgetl (replace_dlg,\ + button_new (rd_widgets [i].ypos, rd_widgets [i].xpos, rd_widgets [i].value,\ + NORMAL_BUTTON, rd_widgets [i].text, 0, 0, rd_widgets [i].tkname), \ + rd_widgets [i].layout) + +#define ADD_RD_LABEL(i,p1,p2)\ + sprintf (buffer, rd_widgets [i].text, p1, p2);\ + add_widgetl (replace_dlg,\ + label_new (rd_widgets [i].ypos, rd_widgets [i].xpos, buffer, rd_widgets [i].tkname),\ + rd_widgets [i].layout) + +static void +init_replace (enum OperationMode mode) +{ + char buffer [128]; + static int rd_xlen = 60, rd_trunc = X_TRUNC; + +#ifdef ENABLE_NLS + static int i18n_flag; + if (!i18n_flag) + { + int l1, l2, l, row; + register int i = sizeof (rd_widgets) / sizeof (rd_widgets [0]); + while (i--) + rd_widgets [i].text = _(rd_widgets [i].text); + + /* + *longest of "Overwrite..." labels + * (assume "Target date..." are short enough) + */ + l1 = max (strlen (rd_widgets [6].text), strlen (rd_widgets [11].text)); + + /* longest of button rows */ + i = sizeof (rd_widgets) / sizeof (rd_widgets [0]); + for (row = l = l2 = 0; i--;) + { + if (rd_widgets [i].value != 0) + { + if (row != rd_widgets [i].ypos) + { + row = rd_widgets [i].ypos; + l2 = max (l2, l); + l = 0; + } + l += strlen (rd_widgets [i].text) + 4; + } + } + l2 = max (l2, l); /* last row */ + rd_xlen = max (rd_xlen, l1 + l2 + 8); + rd_trunc = rd_xlen - 6; + + /* Now place buttons */ + l1 += 5; /* start of first button in the row */ + i = sizeof (rd_widgets) / sizeof (rd_widgets [0]); + + for (l = l1, row = 0; --i > 1;) + { + if (rd_widgets [i].value != 0) + { + if (row != rd_widgets [i].ypos) + { + row = rd_widgets [i].ypos; + l = l1; + } + rd_widgets [i].xpos = l; + l += strlen (rd_widgets [i].text) + 4; + } + } + /* Abort button is centered */ + rd_widgets [1].xpos = (rd_xlen - strlen (rd_widgets [1].text) - 3) / 2; + + } +#endif /* ENABLE_NLS */ + + replace_colors [0] = ERROR_COLOR; + replace_colors [1] = COLOR_NORMAL; + replace_colors [2] = ERROR_COLOR; + replace_colors [3] = COLOR_NORMAL; - add_widgetl (replace_dlg, - button_new (BY + 3, 25, REPLACE_ABORT, NORMAL_BUTTON, _("&Abort"), - 0, 0, "abort"), XV_WLAY_CENTERROW); + replace_dlg = create_dlg (0, 0, 16, rd_xlen, replace_colors, replace_callback, + "[ Replace ]", "replace", DLG_CENTER); + + x_set_dialog_title (replace_dlg, + mode == Foreground ? _(" File exists ") : _(" Background process: File exists ")); + + + ADD_RD_LABEL(0, name_trunc (replace_filename, rd_trunc - strlen (rd_widgets [0].text)), 0 ); + ADD_RD_BUTTON(1); tk_new_frame (replace_dlg, "a."); - add_widgetl (replace_dlg, - button_new (BY + 1, 28, REPLACE_SIZE, NORMAL_BUTTON, _("if &Size differs"), - 0, 0, "if-size"), XV_WLAY_RIGHTOF); - add_widgetl (replace_dlg, - button_new (BY, 47, REPLACE_NEVER, NORMAL_BUTTON, _("non&E"), - 0, 0, "none"), XV_WLAY_RIGHTOF); - add_widgetl (replace_dlg, - button_new (BY, 36, REPLACE_UPDATE, NORMAL_BUTTON, _("&Update"), - 0, 0, "update"), XV_WLAY_RIGHTOF); - add_widgetl (replace_dlg, - button_new (BY, 28, REPLACE_ALWAYS, NORMAL_BUTTON, _("al&L"), - 0, 0, "all"), XV_WLAY_RIGHTOF); - add_widgetl (replace_dlg, label_new (BY, 5, _("Overwrite all targets?"), "over-label"), - XV_WLAY_CENTERROW); + ADD_RD_BUTTON(2); + ADD_RD_BUTTON(3); + ADD_RD_BUTTON(4); + ADD_RD_BUTTON(5); + ADD_RD_LABEL(6,0,0); /* "this target..." widgets */ tk_new_frame (replace_dlg, "p."); - if (!S_ISDIR (d_stat->st_mode)){ - if ((do_reget == -1 && d_stat->st_size && s_stat->st_size > d_stat->st_size)) - add_widgetl (replace_dlg, - button_new (BY - 1, 28, REPLACE_REGET, NORMAL_BUTTON, - _("&Reget"), 0, 0, "reget"), XV_WLAY_RIGHTOF); - add_widgetl (replace_dlg, - button_new (BY - 2, 45, REPLACE_APPEND, NORMAL_BUTTON, _("ap&Pend"), - 0, 0, "append"), XV_WLAY_RIGHTOF); + if (!S_ISDIR (d_stat->st_mode)){ + if ((do_reget == -1 && d_stat->st_size && s_stat->st_size > d_stat->st_size)) + ADD_RD_BUTTON(7); + + ADD_RD_BUTTON(8); } - add_widgetl (replace_dlg, - button_new (BY - 2, 37, REPLACE_NO, NORMAL_BUTTON, _("&No"), - 0, 0, "no"), XV_WLAY_RIGHTOF); - add_widgetl (replace_dlg, - button_new (BY - 2, 28, REPLACE_YES, NORMAL_BUTTON, _("&Yes"), - 0, 0, "yes"), XV_WLAY_RIGHTOF); - add_widgetl (replace_dlg, label_new (BY-2,5, _("Overwrite this target?"), "overlab"), - XV_WLAY_CENTERROW); + ADD_RD_BUTTON(9); + ADD_RD_BUTTON(10); + ADD_RD_LABEL(11,0,0); tk_new_frame (replace_dlg, "i."); - sprintf (buffer, _("Target date: %s, size %d"), - file_date (d_stat->st_mtime), (int) d_stat->st_size); - add_widgetl (replace_dlg, label_new (6, 5, buffer, "target-date"), XV_WLAY_CENTERROW); - sprintf (buffer, _("Source date: %s, size %d"), - file_date (s_stat->st_mtime), (int) s_stat->st_size); - add_widgetl (replace_dlg, label_new (5, 5, buffer, "source-date"), XV_WLAY_CENTERROW); + ADD_RD_LABEL(12, file_date (d_stat->st_mtime), (int) d_stat->st_size); + ADD_RD_LABEL(13, file_date (s_stat->st_mtime), (int) s_stat->st_size); tk_end_frame (); } diff --git a/src/layout.c b/src/layout.c index aba7e1081..8306ba0ac 100644 --- a/src/layout.c +++ b/src/layout.c @@ -521,8 +521,12 @@ void layout_change (void) how the panel are split (horizontal/vertical). */ done_menu(); init_menu(); + +#ifdef RESIZABLE_MENUBAR menubar_arrange(the_menubar); #endif + +#endif } void layout_cmd (void) @@ -752,21 +756,14 @@ void flag_winch (int dummy) void edit_adjust_size (Dlg_head * h); -void change_screen_size (void) +#ifdef PORT_NEEDS_CHANGE_SCREEN_SIZE +void low_level_change_screen_size (void) { -#ifndef HAVE_X #if defined(HAVE_SLANG) || NCURSES_VERSION_MAJOR >= 4 #if defined TIOCGWINSZ && !defined SCO_FLAVOR struct winsize winsz; - extern Dlg_head *view_dlg; - extern Dlg_head *edit_dlg; - -#ifndef NCURSES_VERSION - mc_noraw_mode (); - endwin (); -#endif - winsz.ws_col = winsz.ws_row = 0; + winsz.ws_col = winsz.ws_row = 0; /* Ioctl on the STDIN_FILENO */ ioctl (0, TIOCGWINSZ, &winsz); if (winsz.ws_col && winsz.ws_row){ @@ -781,7 +778,22 @@ void change_screen_size (void) resize_subshell (); #endif } +#endif /* TIOCGWINSZ && !SCO_FLAVOR */ +#endif /* defined(HAVE_SLANG) || NCURSES_VERSION_MAJOR >= 4 */ +} +void change_screen_size (void) +{ +#if defined(HAVE_SLANG) || NCURSES_VERSION_MAJOR >= 4 +#if defined TIOCGWINSZ && !defined SCO_FLAVOR + extern Dlg_head *view_dlg; + extern Dlg_head *edit_dlg; + +#ifndef NCURSES_VERSION + mc_noraw_mode (); + endwin (); +#endif + low_level_change_screen_size (); check_split (); #ifndef NCURSES_VERSION /* XSI Curses spec states that portable applications shall not invoke @@ -800,16 +812,18 @@ void change_screen_size (void) edit_adjust_size (edit_dlg); #endif +#ifdef RESIZABLE_MENUBAR menubar_arrange(the_menubar); +#endif /* Now, force the redraw */ do_refresh (); touchwin (stdscr); #endif /* TIOCGWINSZ && !SCO_FLAVOR */ #endif /* defined(HAVE_SLANG) || NCURSES_VERSION_MAJOR >= 4 */ -#endif /* HAVE_X */ winch_flag = 0; } +#endif /* HAVE_X */ extern int verbose; static int ok_to_refresh = 1; diff --git a/src/menu.c b/src/menu.c index 19f3ba130..32d764103 100644 --- a/src/menu.c +++ b/src/menu.c @@ -462,8 +462,21 @@ static void menubar_destroy (WMenu *menubar) void menubar_arrange(WMenu* menubar) { - register int i, start_x; + register int i, start_x = 1; int items = menubar->items; + +#ifndef RESIZABLE_MENUBAR + int gap = 3; + + for (i = 0; i < items; i++) + { + int len = strlen(menubar->menu[i]->name); + menubar->menu[i]->start_x = start_x; + start_x += len + gap; + } + +#else /* RESIZABLE_MENUBAR */ + int gap = menubar->widget.cols - 2; /* First, calculate gap between items... */ @@ -472,6 +485,7 @@ menubar_arrange(WMenu* menubar) /* preserve length here, to be used below */ gap -= (menubar->menu[i]->start_x = strlen(menubar->menu[i]->name)); } + gap /= (items - 1); if (gap <= 0) @@ -481,13 +495,14 @@ menubar_arrange(WMenu* menubar) } /* ...and now fix start positions of menubar items */ - for (i = 0, start_x = 1; i < items; i++) + for (i = 0; i < items; i++) { int len = menubar->menu[i]->start_x; menubar->menu[i]->start_x = start_x; start_x += len + gap; } - } +#endif /* RESIZABLE_MENUBAR */ +} void destroy_menu (Menu menu) diff --git a/src/textconf.h b/src/textconf.h index 25032db6f..63992341b 100644 --- a/src/textconf.h +++ b/src/textconf.h @@ -1,5 +1,7 @@ /* Defines what features are to be includes in the text mode edition */ -#define COMPUTE_FORMAT_ALLOCATIONS -#define PORT_WIDGET_WANTS_HISTORY 1 +#define COMPUTE_FORMAT_ALLOCATIONS 1 +#define PORT_WIDGET_WANTS_HISTORY 1 +#define PORT_NEEDS_CHANGE_SCREEN_SIZE 1 + #define port_shutdown_extra_fds() diff --git a/src/user.c b/src/user.c index b12feb0c4..cd56b4e6e 100644 --- a/src/user.c +++ b/src/user.c @@ -710,7 +710,7 @@ void user_menu_cmd (void) max_cols = min (max (max_cols, col), MAX_ENTRY_LEN); /* Create listbox */ - listbox = create_listbox_window (max_cols+2, menu_lines, " User menu ", + listbox = create_listbox_window (max_cols+2, menu_lines, _(" User menu "), "[Menu File Edit]"); /* insert all the items found */