A bunch of extra TODO items from DrMike have been adressed.

- Double click should work.
- Dragging to other panels shoudl work
- Scrollbar in the viewer
- Entry widgets get their text selected at startup
- Prompts for command if default action does not exist for a filename
- Updated spanish translation.

Plus some other bugs I fixed.

Miguel
This commit is contained in:
Miguel de Icaza 1998-04-09 04:58:24 +00:00
parent 450203f8a2
commit e0c843048c
26 changed files with 1895 additions and 1154 deletions

View File

@ -1,3 +1,16 @@
1998-04-08 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gscreen.c (x_create_panel): Added back and forward buttons. I
need a "Home" icon too.
* gwidget.c (x_create_input): Make the selection if the input has
not yet been touched.
* gscreen.c (panel_action_open): If opening an item fails, try
panel_action_open_with.
* gview.c: Implement the viewer scrollbar.
1998-04-07 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gscreen.c (panel_drop_data_available): Reload the panel contents

View File

@ -27,6 +27,8 @@
#define PORT_HAS_RADIO_FOCUS_ITEM 1
#define PORT_HAS_DIALOG_STOP 1
#define PORT_HAS_DISPLAY_MINI_INFO 1
#define PORT_WANTS_ARGP 1
#define PORT_WIDGET_WANTS_HISTORY 0
#define mi_getch() fprintf (stderr, "mi_getch is not implemented in this port\n")
#define frontend_run_dlg(x) gtkrundlg_event (x)

View File

@ -823,7 +823,18 @@ desktop_file_exec (GtkWidget *widget, GdkEventButton *event, desktop_icon_t *di)
execute (tmp);
free (tmp);
} else {
regex_command (di->pathname, "Open", NULL, 0);
char *result, *command;
result = regex_command (di->pathname, "Open", NULL, 0);
if (result && (strcmp (result, "Success") == 0))
return TRUE;
command = input_expand_dialog (_("Open with..."),
_("Enter extra arguments:"),
di->pathname);
if (command){
execute (command);
free (command);
}
}
}
return TRUE;

View File

@ -93,7 +93,6 @@ set_new_current_panel (WPanel *panel)
other_panel_ptr = current_panel_ptr;
for (p = containers; p; p = p->next){
if (((PanelContainer *)p->data)->panel == panel){
printf ("Setting current panel to %p\n", p);
current_panel_ptr = p->data;
}
}

View File

@ -79,7 +79,8 @@ xtoolkit_init (int *argc, char *argv [])
{
LINES = 40;
COLS = 80;
gnome_init ("gmc", NULL, *argc, argv, 0, NULL);
/* gnome_init ("gmc", NULL, *argc, argv, 0, NULL); */
gmc_color_init ();
/* FIXME: Maybe this should return something from gnome_init() */
return 0;
@ -366,7 +367,7 @@ dialog_panel_callback (struct Dlg_head *h, int id, int msg)
do_panel_cd (p, in->buffer, cd_parse_command);
assign_text (in, p->cwd);
update_input (in);
update_input (in, 1);
return MSG_HANDLED;
}

View File

@ -1,13 +1,11 @@
All:
- It leaks objects.
- argp handling.
- Session management
Desktop:
- Add special destkop entries ("Network neighborhood")
- Double clicking on some objects on the desktop does not do anything.
- Solid icons on the desktop are required
Panels:
@ -23,7 +21,6 @@ Panels:
Viewer:
- Toolbar
- Scrollbar
- Enable editor.
- Fix colors.
- Add cursor
@ -112,12 +109,9 @@ Panel comments
seem to do anything. I thought they might act as a history of the
last few directories visited or something.
- the 'Filter' pulldown is handy - this is all user configurable, right?
- a toobar with a 'back' type button would be handy - I realize the '..'
folder does the same thing, but in a long file listing its nice to
just have a button to do it.
DONE - a toobar with a 'back' type button would be handy - I realize the '..'
DONE folder does the same thing, but in a long file listing its nice to
DONE just have a button to do it.
DONE - I got several 'sigpipes' when trying to view a ftpfs file, or
DONE when trying to view RPM tags via the rpmfs.
@ -135,26 +129,13 @@ DONE over? Sortof a interactive 'select group' option.
- internal viewer - search should hilight the matching text
- some files when I try to 'Open' them, it just does nothing. I'm
guessing no association existed - if so it should tell me and let
me create an association
DONE - some files when I try to 'Open' them, it just does nothing. I'm
DONE guessing no association existed - if so it should tell me and let
DONE me create an association
DONE - I couldnt view files inside of a RPM which I was browsing via the ftpfs
DONE is this just cause I'm nuts to try?
- I couldnt get the drag from one panel to another to work reliably -
I would drag and get a 'Copy Link Move' window, but I couldn't
select any of the 3 choices and the drag just failed. No errors, etc.
During the drag, when I left the first panel and hit the root window,
I got these errors:
** WARNING **: file gtkwidget.c: line 1237 (gtk_widget_show): "widget != NULL"
** WARNING **: file gtkwidget.c: line 1237 (gtk_widget_show): "widget != NULL"
When the drag entered the other window, I got a 'Setting current panel to...'
DONE - it might be good to do a rescan after a panel accepts a drag event. Is
DONE that an option?
@ -204,6 +185,6 @@ VFS Options
Internal Viewer
---------------
- no vertical scrollbar!
DONE - no vertical scrollbar!

View File

@ -73,7 +73,7 @@ void
show_dir (WPanel *panel)
{
assign_text (panel->current_dir, panel->cwd);
update_input (panel->current_dir);
update_input (panel->current_dir, 1);
}
static void
@ -100,6 +100,13 @@ 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);
}
void
panel_update_marks (WPanel *panel)
{
gtk_widget_set_sensitive (panel->fwd_b, panel->dir_history->next ? 1 : 0);
gtk_widget_set_sensitive (panel->back_b, panel->dir_history->prev ? 1 : 0);
}
void
x_fill_panel (WPanel *panel)
{
@ -148,6 +155,7 @@ x_fill_panel (WPanel *panel)
select_item (panel);
gtk_clist_thaw (GTK_CLIST (cl));
free (texts);
panel_update_marks (panel);
}
static void
@ -208,7 +216,7 @@ void
x_filter_changed (WPanel *panel)
{
assign_text (panel->filter_w, panel->filter ? panel->filter : "");
update_input (panel->filter_w);
update_input (panel->filter_w, 1);
}
void
@ -296,12 +304,6 @@ panel_file_list_configure_contents (GtkWidget *file_list, WPanel *panel, int mai
gtk_clist_thaw (GTK_CLIST (file_list));
}
static void
panel_action_open (GtkWidget *widget, WPanel *panel)
{
do_enter (panel);
}
static void
panel_action_open_with (GtkWidget *widget, WPanel *panel)
{
@ -309,10 +311,20 @@ panel_action_open_with (GtkWidget *widget, WPanel *panel)
command = input_expand_dialog (_(" Open with..."),
_("Enter extra arguments:"), panel->dir.list [panel->selected].fname);
if (!command)
return;
execute (command);
free (command);
}
static void
panel_action_open (GtkWidget *widget, WPanel *panel)
{
if (do_enter (panel))
return;
panel_action_open_with (widget, panel);
}
void
panel_action_view (GtkWidget *widget, WPanel *panel)
{
@ -1204,11 +1216,26 @@ panel_create_filter (Dlg_head *h, WPanel *panel, void **filter_w)
return fhbox;
}
void
panel_back (GtkWidget *button, WPanel *panel)
{
directory_history_prev (panel);
}
void
panel_fwd (GtkWidget *button, WPanel *panel)
{
directory_history_next (panel);
}
void
x_create_panel (Dlg_head *h, widget_data parent, WPanel *panel)
{
GtkWidget *status_line, *filter, *vbox;
GtkWidget *frame, *cwd;
GtkWidget *frame, *cwd, *back, *home, *fwd, *back_p, *fwd_p;
GtkWidget *very_top;
very_top = gtk_widget_get_toplevel (GTK_WIDGET (panel->widget.wdata));
panel->table = gtk_table_new (2, 1, 0);
@ -1220,13 +1247,27 @@ x_create_panel (Dlg_head *h, widget_data parent, WPanel *panel)
/* We do not want the focus by default (and the previos add_widget just gave it to us) */
h->current = h->current->prev;
/* buttons */
back_p = gnome_stock_pixmap_widget_new (very_top, GNOME_STOCK_MENU_BACK);
fwd_p = gnome_stock_pixmap_widget_new (very_top, GNOME_STOCK_MENU_FORWARD);
panel->back_b = gtk_button_new ();
panel->fwd_b = gtk_button_new ();
gtk_container_add (GTK_CONTAINER (panel->back_b), back_p);
gtk_container_add (GTK_CONTAINER (panel->fwd_b), fwd_p);
gtk_signal_connect (GTK_OBJECT (panel->back_b), "clicked", GTK_SIGNAL_FUNC(panel_back), panel);
gtk_signal_connect (GTK_OBJECT (panel->fwd_b), "clicked", GTK_SIGNAL_FUNC(panel_fwd), panel);
panel_update_marks (panel);
/* ministatus */
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);
status_line = gtk_hbox_new (0, 0);
gtk_label_set_justify (GTK_LABEL (panel->ministatus), GTK_JUSTIFY_LEFT);
gtk_box_pack_start (GTK_BOX (status_line), cwd, 1, 1, 0);
gtk_box_pack_start (GTK_BOX (status_line), panel->back_b, 0, 0, 2);
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);
/* The statusbar */

View File

@ -13,6 +13,8 @@
/* The spacing between the cute little icon and the text */
#define SPACING 2
int want_transparent = 0;
/*
* Most of this code was yanked from the gtktooltips module in Gtk+.
* I have tweaked it a bit for MC's purposes - Federico

View File

@ -59,6 +59,16 @@ x_focus_view (WView *view)
{
}
static void
scrollbar_moved (GtkAdjustment *adj, WView *view)
{
view->start_display = adj->value;
/* To force a display */
view->dirty = max_dirt_limit + 1;
view_update (view);
}
void
view_percent (WView *view, int p)
{
@ -73,6 +83,21 @@ view_percent (WView *view, int p)
sprintf (buffer, "%3d%%", percent);
gtk_label_set (GTK_LABEL (view->gtk_percent), buffer);
if (view->sadj){
GtkAdjustment *adj = GTK_ADJUSTMENT (view->sadj);
printf ("adj\n");
if ((int) adj->upper != view->last_byte){
adj->upper = view->last_byte;
adj->step_increment = 1.0;
adj->page_increment =
adj->page_size = view->last - view->start_display;
gtk_signal_emit_by_name (GTK_OBJECT (adj), "changed");
}
if ((int) adj->value != view->start_display){
gtk_adjustment_set_value (adj, view->start_display);
}
}
}
void
@ -290,7 +315,7 @@ int
view (char *_command, char *_file, int *move_dir_p, int start_line)
{
Dlg_head *our_dlg;
GtkWidget *toplevel, *status, *scrollbar;
GtkWidget *toplevel, *status, *scrollbar, *hbox;
GtkVBox *vbox;
WView *wview;
int midnight_colors [4];
@ -336,7 +361,17 @@ view (char *_command, char *_file, int *move_dir_p, int start_line)
init_dlg (our_dlg);
gtk_box_pack_start (GTK_BOX (vbox), status, 0, 1, 0);
gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (wview->widget.wdata), 1, 1, 0);
wview->sadj = gtk_adjustment_new (0.0, 0.0, 1000000.0, 1.0, 25.0, 25.0);
scrollbar = gtk_vscrollbar_new (wview->sadj);
gtk_signal_connect (GTK_OBJECT (wview->sadj), "value_changed",
GTK_SIGNAL_FUNC(scrollbar_moved), wview);
hbox = gtk_hbox_new (0, 0);
gtk_box_pack_start (GTK_BOX (vbox), hbox, 1, 1, 0);
gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (wview->widget.wdata), 1, 1, 0);
gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (scrollbar), 0, 1, 0);
gtk_widget_show_all (toplevel);
return 1;

View File

@ -247,6 +247,7 @@ x_create_input (Dlg_head *h, widget_data parent, WInput *in)
entry = GTK_ENTRY (gnome_entry_gtk_entry (GNOME_ENTRY (gnome_entry)));
gtk_entry_set_text (entry, in->buffer);
gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1);
gtk_entry_set_position (entry, in->point);
gtk_signal_connect (GTK_OBJECT (entry), "button_press_event",
@ -262,6 +263,8 @@ x_update_input (WInput *in)
{
GnomeEntry *gnome_entry;
GtkEntry *entry;
char *text;
int draw;
/* If the widget has not been initialized yet (done by WIDGET_INIT) */
if (!in->widget.wdata)
@ -270,8 +273,24 @@ x_update_input (WInput *in)
gnome_entry = GNOME_ENTRY (in->widget.wdata);
entry = GTK_ENTRY (gnome_entry_gtk_entry (gnome_entry));
if (in->first == -1){
gtk_editable_select_region (GTK_EDITABLE (entry), 0, 0);
in->first = 0;
}
text = GTK_ENTRY (entry)->text;
if (text && strcmp (text, in->buffer)){
gtk_entry_set_text (entry, in->buffer);
draw = 1;
}
if (GTK_EDITABLE (entry)->current_pos != in->point){
gtk_entry_set_position (entry, in->point);
draw = 1;
}
if (draw)
gtk_widget_draw (GTK_WIDGET (gnome_entry), NULL);
}

1740
po/es.po

File diff suppressed because it is too large Load Diff

535
po/mc.pot

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,18 @@
1998-04-08 Miguel de Icaza <miguel@nuclecu.unam.mx>
* widget.c (update_input): Set the used flag early in update_input
to allow X widget to catch the right value
* screen.c (do_enter): Return the status for the operation.
* main.c (main): Sigh. This was hard. I added support for argp.
Right now we support both argp for the GNOME edition and popt for
the other editions. I will remove popt support in the future and
only keep argp.
* dlg.c (add_widgetl): Adding widgets to an already running dialog
had some flaws. Fix this.
Wed Apr 8 11:15:29 1998 Alex Tkachenko <alex@bcs.zp.ua>
* src/find.c: changes to find_parameters/find_file i18n.

View File

@ -878,7 +878,7 @@ void history_cmd (void)
return;
input_w (cmdline)->history = current;
assign_text (input_w (cmdline), input_w (cmdline)->history->text);
update_input (input_w (cmdline));
update_input (input_w (cmdline), 1);
}
#if !defined(HAVE_XVIEW) && !defined(HAVE_GNOME)

View File

@ -847,7 +847,7 @@ static int insert_text (WInput *in, char *text, int len)
}
strncpy (in->buffer + start, text, len - start + end);
in->point += len;
update_input (in);
update_input (in, 1);
end += len;
}
return len != 0;

View File

@ -275,6 +275,16 @@ int add_widgetl (Dlg_head *where, void *what, WLay layout)
widget->x += where->x;
widget->y += where->y;
if (where->running){
Widget_Item *point = where->current;
where->current = (Widget_Item *) malloc (sizeof (Widget_Item));
where->current->next = point->next;
where->current->prev = point;
point->next->prev = where->current;
point->next = where->current;
} else {
back = where->current;
where->current = (Widget_Item *) malloc (sizeof (Widget_Item));
if (back){
@ -285,11 +295,12 @@ int add_widgetl (Dlg_head *where, void *what, WLay layout)
where->first = where->current;
}
where->current->dlg_id = where->count;
where->current->prev = where->first;
where->last = where->current;
where->first->next = where->last;
}
where->current->dlg_id = where->count;
where->current->widget = what;
where->current->widget->parent = where;

View File

@ -339,6 +339,9 @@ int show_change_notice = 0;
char cmd_buf [512];
/* Used during argument processing */
int finish_program = 0;
/* Forward declarations */
char *get_mc_lib_dir ();
int panel_event (Gpm_Event *event, WPanel *panel);
@ -2453,52 +2456,7 @@ init_sigchld (void)
extern int SLtt_Try_Termcap;
#endif
static struct poptOption argumentTable[] = {
#ifdef WITH_BACKGROUND
{ "background", 'B', POPT_ARG_NONE, &background_wait, 0 },
#endif
#if defined(HAVE_SLANG) && defined(OS2_NT)
{ "createcmdfile", 'S', POPT_ARG_STRING, NULL, 'S' },
#endif
{ "color", 'c', POPT_ARG_NONE, NULL, 'c' },
{ "colors", 'C', POPT_ARG_STRING, &command_line_colors, 0 },
#ifdef HAVE_SUBSHELL_SUPPORT
{ "dbgsubshell", 'X', POPT_ARG_NONE, &debug_subshell, 0 },
#endif
{ "edit", 'e', POPT_ARG_STRING, &edit_one_file, 0 },
{ "help", 'h', POPT_ARG_NONE, NULL, 'h' },
{ "help-colors", 'H', POPT_ARG_NONE, NULL, 'H' },
#ifdef USE_NETCODE
{ "ftplog", 'l', POPT_ARG_STRING, NULL, 'l' },
#endif
{ "libdir", 'f', POPT_ARG_NONE, NULL, 'f' },
{ NULL, 'm', POPT_ARG_NONE, NULL, 'm' },
{ "nocolor", 'b', POPT_ARG_NONE, &disable_colors, 0 },
{ "nomouse", 'd', POPT_ARG_NONE, NULL, 'd' },
#ifdef HAVE_SUBSHELL_SUPPORT
{ "nosubshell", 'u', POPT_ARG_NONE, NULL, 'u' },
{ "forceexec", 'r', POPT_ARG_NONE, NULL, 'r' },
#endif
{ "printwd", 'P', POPT_ARG_NONE, &print_last_wd, 0 },
{ "resetsoft", 'k', POPT_ARG_NONE, &reset_hp_softkeys, 0 },
{ "slow", 's', POPT_ARG_NONE, &slow_terminal, 0 },
#if defined(HAVE_SLANG) && !defined(OS2_NT)
{ "stickchars", 'a', 0, &force_ugly_line_drawing, 0 },
#endif
#ifdef HAVE_SUBSHELL_SUPPORT
{ "subshell", 'U', POPT_ARG_NONE, NULL, 'U' },
#endif
#if defined(HAVE_SLANG) && !defined(OS2_NT)
{ "termcap", 't', 0, &SLtt_Try_Termcap, 0 },
#endif
{ "version", 'V', POPT_ARG_NONE, NULL, 'V'},
{ "view", 'v', POPT_ARG_STRING, &view_one_file, 0 },
{ "xterm", 'x', POPT_ARG_NONE, &force_xterm, 0},
{ NULL, 0, 0, NULL, 0 }
};
#ifndef PORT_WANTS_ARGP
static void
print_usage (void)
{
@ -2548,6 +2506,7 @@ print_usage (void)
#endif
);
}
#endif /* PORT_WANTS_ARGP */
static void
print_color_usage (void)
@ -2571,22 +2530,20 @@ print_color_usage (void)
}
static void handle_args (int argc, char *argv [])
static void
probably_finish_program (void)
{
char *tmp, *option_arg;
int c;
int finish_program = 0;
poptContext optCon;
optCon = poptGetContext ("mc", argc, argv, argumentTable, 0);
#ifdef USE_TERMCAP
SLtt_Try_Termcap = 1;
#endif
while ((c = poptGetNextOpt (optCon)) > 0) {
option_arg = poptGetOptArg(optCon);
if (finish_program){
if (print_last_wd)
printf (".");
exit (1);
}
}
static int
process_args (int c, char *option_arg)
{
switch (c) {
case 'V':
version (1);
@ -2627,7 +2584,6 @@ static void handle_args (int argc, char *argv [])
use_mouse_p = NO_MOUSE;
break;
case 'X':
#ifdef HAVE_SUBSHELL_SUPPORT
debug_subshell = 1;
@ -2658,10 +2614,194 @@ static void handle_args (int argc, char *argv [])
break;
case 'h':
default:
#ifndef PORT_WANTS_ARGP
print_usage ();
finish_program = 1;
#endif
return 1;
}
return 0;
}
#ifdef PORT_WANTS_ARGP
static struct argp_option argp_options [] = {
#ifdef WITH_BACKGROUND
{ "background", 'B', NULL, 0, N_("[DEVEL-ONLY: Debug the background code]"), 0 },
#endif
#if defined(HAVE_SLANG) && defined(OS2_NT)
{ "createcmdfile", 'S', NULL, 0, N_("Create command file to set default directory upon exit."), 1 },
#endif
{ "color", 'c', NULL, 0, N_("Force color mode."), 0 },
{ "colors", 'C', NULL, 0, N_("Specify colors (use --help-colors to get a list)."), 1 },
#ifdef HAVE_SUBSHELL_SUPPORT
{ "dbgsubshell", 'X', NULL, 0, N_("[DEVEL-ONLY: Debug the subshell."), 0 },
#endif
{ "edit", 'e', NULL, 0, N_("Startup the internal editor."), 1 },
{ "help", 'h', NULL, 0, N_("Shows this help message."), 0 },
{ "help-colors", 'H', NULL, 0, N_("Help on how to specify colors."), 0 },
#ifdef USE_NETCODE
{ "ftplog", 'l', NULL, 0, N_("Log ftpfs commands to the file."), 1 },
#endif
{ "libdir", 'f', NULL, 0, N_("Prints out the configured paths."), 0 },
{ NULL, 'm', NULL, OPTION_HIDDEN, NULL, 0 },
{ "nocolor", 'b', NULL, 0, N_("Force black and white display."), 0 },
{ "nomouse", 'd', NULL, 0, N_("Disable mouse support."), 0 },
#ifdef HAVE_SUBSHELL_SUPPORT
{ "subshell", 'U', NULL, 0, N_("Force the concurrent subshell mode"), 0 },
{ "nosubshell", 'u', NULL, 0, N_("Disable the concurrent subshell mode."), 0 },
{ "forceexec", 'r', NULL, 0, N_("Force subshell execution."), 0 },
#endif
{ "printwd", 'P', NULL, 0, N_("At exit, print the last working directory."), 0 },
{ "resetsoft", 'k', NULL, 0, N_("Reset softkeys (HP terminals only) to their terminfo/termcap default."), 0},
{ "slow", 's', NULL, 0, N_("Disables verbose operation (for slow terminals)."), 0 },
#if defined(HAVE_SLANG) && !defined(OS2_NT)
{ "stickchars", 'a', NULL, 0, N_("Use simple symbols for line drawing."), 0 },
#endif
#ifdef HAVE_SUBSHELL_SUPPORT
#endif
#if defined(HAVE_SLANG) && !defined(OS2_NT)
{ "termcap", 't', NULL, 0, N_("Activate support for the TERMCAP variable."), 0 },
#endif
{ "version", 'V', NULL, 0, N_("Report versionand configuration options."), 0 },
{ "view", 'v', NULL, 0, N_("Start up into the viewer mode."), 0 },
{ "xterm", 'x', NULL, 0, N_("Force xterm mouse support and screen save/restore"), 0 },
{ NULL, 0, NULL, 0, NULL },
};
static error_t
parse_an_arg (int key, char *arg, struct argp_state *state)
{
switch (key){
#ifdef WITH_BACKGROUND
case 'B':
background_wait = 1;
return 0;
#endif
case 'b':
disable_colors = 1;
return 0;
case 'P':
print_last_wd = 1;
return 0;
case 'k':
reset_hp_softkeys = 1;
return 0;
case 's':
slow_terminal = 1;
return 0;
case 'a':
force_ugly_line_drawing = 1;
return 0;
case 'x':
force_xterm = 1;
return 0;
#if defined(HAVE_SLANG) && !defined(OS2_NT)
case 't':
SLtt_Try_Termcap = 1;
return 0;
#endif
case ARGP_KEY_ARG:
break;
case ARGP_KEY_INIT:
case ARGP_KEY_FINI:
return 0;
default:
process_args (key, arg);
}
if (arg){
if (edit_one_file)
edit_one_file = strdup (arg);
else if (view_one_file)
view_one_file = strdup (arg);
else if (this_dir)
other_dir = strdup (arg);
else
this_dir = strdup (arg);
}
return 0;
}
static struct argp mc_argp_parser = {
argp_options, parse_an_arg, N_("[this dir] [other dir]"), NULL, NULL, NULL, NULL
};
#else
static struct poptOption argumentTable[] = {
#ifdef WITH_BACKGROUND
{ "background", 'B', POPT_ARG_NONE, &background_wait, 0 },
#endif
#if defined(HAVE_SLANG) && defined(OS2_NT)
{ "createcmdfile", 'S', POPT_ARG_STRING, NULL, 'S' },
#endif
{ "color", 'c', POPT_ARG_NONE, NULL, 'c' },
{ "colors", 'C', POPT_ARG_STRING, &command_line_colors, 0 },
#ifdef HAVE_SUBSHELL_SUPPORT
{ "dbgsubshell", 'X', POPT_ARG_NONE, &debug_subshell, 0 },
#endif
{ "edit", 'e', POPT_ARG_STRING, &edit_one_file, 0 },
{ "help", 'h', POPT_ARG_NONE, NULL, 'h' },
{ "help-colors", 'H', POPT_ARG_NONE, NULL, 'H' },
#ifdef USE_NETCODE
{ "ftplog", 'l', POPT_ARG_STRING, NULL, 'l' },
#endif
{ "libdir", 'f', POPT_ARG_NONE, NULL, 'f' },
{ NULL, 'm', POPT_ARG_NONE, NULL, 'm' },
{ "nocolor", 'b', POPT_ARG_NONE, &disable_colors, 0 },
{ "nomouse", 'd', POPT_ARG_NONE, NULL, 'd' },
#ifdef HAVE_SUBSHELL_SUPPORT
{ "nosubshell", 'u', POPT_ARG_NONE, NULL, 'u' },
{ "forceexec", 'r', POPT_ARG_NONE, NULL, 'r' },
#endif
{ "printwd", 'P', POPT_ARG_NONE, &print_last_wd, 0 },
{ "resetsoft", 'k', POPT_ARG_NONE, &reset_hp_softkeys, 0 },
{ "slow", 's', POPT_ARG_NONE, &slow_terminal, 0 },
#if defined(HAVE_SLANG) && !defined(OS2_NT)
{ "stickchars", 'a', 0, &force_ugly_line_drawing, 0 },
#endif
#ifdef HAVE_SUBSHELL_SUPPORT
{ "subshell", 'U', POPT_ARG_NONE, NULL, 'U' },
#endif
#if defined(HAVE_SLANG) && !defined(OS2_NT)
{ "termcap", 't', 0, &SLtt_Try_Termcap, 0 },
#endif
{ "version", 'V', POPT_ARG_NONE, NULL, 'V'},
{ "view", 'v', POPT_ARG_STRING, &view_one_file, 0 },
{ "xterm", 'x', POPT_ARG_NONE, &force_xterm, 0},
{ NULL, 0, 0, NULL, 0 }
};
static void
handle_args (int argc, char *argv [])
{
char *tmp, *option_arg;
int c;
poptContext optCon;
optCon = poptGetContext ("mc", argc, argv, argumentTable, 0);
#ifdef USE_TERMCAP
SLtt_Try_Termcap = 1;
#endif
while ((c = poptGetNextOpt (optCon)) > 0) {
option_arg = poptGetOptArg(optCon);
if (process_args (c, option_arg) == 1)
process_args ('h', 0);
}
if (c < -1){
@ -2672,11 +2812,7 @@ static void handle_args (int argc, char *argv [])
finish_program = 1;
}
if (finish_program){
if (print_last_wd)
printf (".");
exit (1);
}
probably_finish_program ();
/* Check for special invocation names mcedit and mcview,
* if none apply then set the current directory and the other
@ -2703,6 +2839,7 @@ static void handle_args (int argc, char *argv [])
}
poptFreeContext(optCon);
}
#endif
/*
* The compatibility_move_mc_files routine is intended to
@ -2789,9 +2926,28 @@ int main (int argc, char *argv [])
#ifdef HAVE_X
/* NOTE: This call has to be before any our argument handling :) */
#ifdef HAVE_GNOME
{
char *base = x_basename (argv [0]);
if (base){
if (strcmp (base, "mcedit") == 0)
edit_one_file = "";
if (strcmp (base, "mcview") == 0)
view_one_file = "";
}
}
gnome_init ("gmc", &mc_argp_parser, argc, argv, 0, NULL);
probably_finish_program ();
#endif
if (xtoolkit_init (&argc, argv) == -1)
exit (1);
#endif
#endif /* HAVE_X */
#ifdef HAVE_SLANG
SLtt_Ignore_Beep = 1;
#endif
@ -2800,7 +2956,9 @@ int main (int argc, char *argv [])
calls any define_sequence */
init_key ();
#ifndef PORT_WANTS_ARGP
handle_args (argc, argv);
#endif
/* Used to report the last working directory at program end */
if (print_last_wd){

View File

@ -121,6 +121,10 @@ typedef struct {
void *filter_w; /* A WInput* */
void *current_dir; /* A WInput* */
int estimated_total;
/* navigation buttons */
void *back_b;
void *fwd_b;
#endif
} WPanel;
@ -227,6 +231,7 @@ void do_file_mark (WPanel *panel, int index, int val);
int file_compute_color (int attr, file_entry *fe);
int file_entry_color (file_entry *fe);
void do_file_mark_range (WPanel *panel, int r1, int r2);
int do_enter (WPanel *panel);
/* NOTE: Have to be ifdefed for HAVE_X */
void x_panel_select_item (WPanel *panel, int index, int val);
@ -236,4 +241,8 @@ sortfn *get_sort_fn (char *name);
int panel_callback (Dlg_head *h, WPanel *panel, int msg, int par);
void update_one_panel_widget (WPanel *panel, int force_update, char *current_file);
void directory_history_next (WPanel * panel);
void directory_history_prev (WPanel * panel);
void directory_history_list (WPanel * panel);
#endif /* __PANEL_H */

View File

@ -121,7 +121,7 @@ static INLINE void update_command ()
assign_text (pname,
((struct panelize *) l_panelize->current->data)->command);
pname->point = 0;
update_input (pname);
update_input (pname, 1);
}
}

View File

@ -1955,12 +1955,13 @@ start_search (WPanel *panel)
}
}
void
int
do_enter (WPanel *panel)
{
if (S_ISDIR (selection (panel)->buf.st_mode)
|| link_isdir (selection (panel))){
do_cd (selection (panel)->fname, cd_exact);
return 1;
} else {
if (is_exe (selection (panel)->buf.st_mode) &&
if_link_is_exe (selection (panel))) {
@ -1987,9 +1988,16 @@ do_enter (WPanel *panel)
free (tmp2);
}
#endif /* USE_VFS */
return;
} else
regex_command (selection (panel)->fname, "Open", NULL, 0);
return 1;
} else {
char *p;
p = regex_command (selection (panel)->fname, "Open", NULL, 0);
if (p && (strcmp (p, "Success") == 0))
return 1;
else
return 0;
}
}
}
@ -2059,10 +2067,6 @@ chdir_to_readlink (WPanel *panel)
}
}
void directory_history_next (WPanel * panel);
void directory_history_prev (WPanel * panel);
void directory_history_list (WPanel * panel);
static key_map panel_keymap [] = {
{ KEY_DOWN, move_down },
{ KEY_UP, move_up },

View File

@ -1,4 +1,5 @@
/* Defines what features are to be includes in the text mode edition */
#define COMPUTE_FORMAT_ALLOCATIONS
#define PORT_WIDGET_WANTS_HISTORY 1
#define port_shutdown_extra_fds()

View File

@ -2,7 +2,7 @@
/* View file module for the Midnight Commander
Copyright (C) 1994, 1995, 1996 The Free Software Foundation
Written by: 1994, 1995 Miguel de Icaza
Written by: 1994, 1995, 1998 Miguel de Icaza
1994, 1995 Janne Kukonlehto
1995 Jakub Jelinek
1996 Joseph M. Hinkle

View File

@ -803,7 +803,7 @@ static void draw_history_button (WInput * in)
static char *kill_buffer = 0;
void
update_input (WInput *in)
update_input (WInput *in, int clear_first)
{
#ifndef HAVE_XVIEW
int has_history = 0;
@ -828,7 +828,10 @@ update_input (WInput *in)
/* Adjust the mark */
if (in->mark > buf_len)
in->mark = buf_len;
#ifdef HAVE_X
if (clear_first && in->first)
in->first = -1;
x_update_input (in);
#else
@ -850,9 +853,11 @@ update_input (WInput *in)
addch (c);
}
widget_move (&in->widget, 0, in->point - in->first_shown);
if (clear_first)
in->first = 0;
#endif
in->first = 0;
#endif
}
@ -861,7 +866,7 @@ winput_set_origin (WInput *in, int x, int field_len)
{
in->widget.x = x;
in->field_len = in->widget.cols = field_len;
update_input (in);
update_input (in, 0);
}
/* {{{ history saving and loading */
@ -1111,7 +1116,7 @@ void
input_enable_update (WInput *in)
{
in->disable_update--;
update_input (in);
update_input (in, 0);
}
int
@ -1151,7 +1156,7 @@ new_input (WInput *in)
in->point = 0;
in->mark = 0;
free_completions (in);
update_input (in);
update_input (in, 0);
}
static int
@ -1515,7 +1520,7 @@ handle_char (WInput *in, int c_code)
if (quote){
free_completions (in);
v = insert_char (in, c_code);
update_input (in);
update_input (in, 1);
quote = 0;
return v;
}
@ -1541,7 +1546,7 @@ handle_char (WInput *in, int c_code)
in->inserted_one = c_code;
}
if (!disable_update)
update_input (in);
update_input (in, 1);
return v;
}
@ -1555,7 +1560,7 @@ stuff (WInput *in, char *text, int insert_extra_space)
if (insert_extra_space)
handle_char (in, ' ');
input_enable_update (in);
update_input (in);
update_input (in, 1);
}
void
@ -1566,7 +1571,7 @@ input_set_point (WInput *in, int pos)
if (pos != in->point)
free_completions (in);
in->point = pos;
update_input (in);
update_input (in, 1);
}
int input_event (Gpm_Event *event, WInput *b);
@ -1574,8 +1579,6 @@ int input_event (Gpm_Event *event, WInput *b);
static int
input_callback (Dlg_head *h, WInput *in, int Msg, int Par)
{
int t;
switch (Msg){
case WIDGET_INIT:
return x_create_input (h, h->wdata, in);
@ -1604,10 +1607,7 @@ input_callback (Dlg_head *h, WInput *in, int Msg, int Par)
case WIDGET_FOCUS:
case WIDGET_UNFOCUS:
case WIDGET_DRAW:
/* Very ugly hack */
t = in->first;
update_input (in);
in->first = t;
update_input (in, 0);
break;
#endif /* !HAVE_XVIEW */
#ifndef HAVE_X
@ -1631,7 +1631,7 @@ input_event (Gpm_Event *event, WInput *in)
if (event->x >= in->field_len - HISTORY_BUTTON_WIDTH + 1 && should_show_history_button (in)) {
do_show_hist (in);
update_input (in);
update_input (in, 1);
} else {
in->point = strlen (in->buffer);
if (event->x - in->first_shown - 1 < in->point)
@ -1639,19 +1639,13 @@ input_event (Gpm_Event *event, WInput *in)
if (in->point < 0)
in->point = 0;
update_input (in);
update_input (in, 1);
}
}
#endif
return MOU_NORMAL;
}
#ifdef HAVE_GNOME
# define PORT_WIDGET_WANT_HISTORY 0
#else
# define PORT_WIDGET_WANT_HISTORY 1
#endif
WInput *
input_new (int y, int x, int color, int len, char *def_text, char *tkname)
{
@ -1665,7 +1659,7 @@ input_new (int y, int x, int color, int len, char *def_text, char *tkname)
/* history setup */
in->history = NULL;
in->history_name = 0;
if (tkname && PORT_WIDGET_WANT_HISTORY){
if (tkname && PORT_WIDGET_WANTS_HISTORY){
if (*tkname) {
in->history_name = strdup (tkname);
in->history = history_get (tkname);

View File

@ -158,7 +158,7 @@ WListbox *listbox_new (int x, int y, int width, int height, int action,
void winput_set_origin (WInput *i, int x, int field_len);
int handle_char (WInput *in, int c_code);
int is_in_input_map (WInput *in, int c_code);
void update_input (WInput *in);
void update_input (WInput *in, int clear_first);
void new_input (WInput *in);
int push_history (WInput *in, char *text);
void stuff (WInput *in, char *text, int insert_extra_space);

View File

@ -12,6 +12,7 @@
#define PORT_HAS_DESTROY_CMD 1
#define PORT_HAS_RADIO_FOCUS_ITEM 1
#define PORT_HAS_DISPLAY_MINI_INFO 1
#define PORT_WIDGET_WANTS_HISTORY 1
#define frontend_run_dlg(x) tkrundlg_event (x)
#define port_shutdown_extra_fds()

View File

@ -2,6 +2,7 @@
#define PORT_HAS_GETCH 1
#define PORT_HAS_FRONTEND_RUN_DLG 1
#define PORT_WIDGET_WANTS_HISTORY 1
#define mi_getch() fprintf (stderr, "mi_getch is not implemented\n")
#define frontend_run_dlg(x) xvrundlg_event (x)
#define port_shutdown_extra_fds()