From d934dc4afe68e3e07e2d3dc97db5bf9bd26f2546 Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Wed, 11 Mar 1998 05:55:05 +0000 Subject: [PATCH] get_other_type works; sort order box works; rescan works; filter is enabled; virtual fs setup dialog box is up; save setup; mkdir link command is hossed. It is more than hossed for some stoopid reason, the thing is selecting the first file in the panel just after I talked to it. No matter how argumentative I get with the code. Have to fix next. Commit the bits I forgot to commit yesterday. -miguel. --- gnome/ChangeLog | 27 ++++++++----- gnome/glayout.c | 17 +++++--- gnome/gscreen.c | 3 +- gnome/layout | 104 ++++++++++++++++++++++++++++++++++++++++++++++++ src/ChangeLog | 11 +++++ src/cmd.c | 38 +++++++++++------- src/cmd.h | 1 + src/dlg.c | 7 +++- src/main.c | 2 +- src/myslang.h | 2 +- src/screen.c | 25 +++++++++++- src/widget.c | 25 +++++++----- tk/tkwidget.c | 6 +++ 13 files changed, 220 insertions(+), 48 deletions(-) diff --git a/gnome/ChangeLog b/gnome/ChangeLog index 1824e8ffa..79a6dd290 100644 --- a/gnome/ChangeLog +++ b/gnome/ChangeLog @@ -1,3 +1,19 @@ +Tue Mar 10 23:46:29 1998 Miguel de Icaza + + * glayout.c + + * gscreen.c (x_adjust_top_file): We no longer adjust the top + displayed filename. + + (panel_build_selected_file_list): Fix for the transfered data. + + (panel_drop_data_available): Now drop support uses the new + coords.x and coords.y fields from the DropDataAvailableEvent to + find out which directory receives the drop. + + * glayout.c: added: configure_box, configure_vfs + (get_other_type): Return the correct value. + 1998-03-10 Federico Mena Quintero * gscreen.c (panel_file_list_size_allocate_hook): Now we @@ -18,17 +34,6 @@ * gkey.c (find_select_closure_callback): Fix = -> == typo. -Tue Mar 10 14:01:47 1998 Miguel de Icaza - - * gscreen.c (x_adjust_top_file): We no longer adjust the top - displayed filename. - - (panel_build_selected_file_list): Fix for the transfered data. - - (panel_drop_data_available): Now drop support uses the new - coords.x and coords.y fields from the DropDataAvailableEvent to - find out which directory receives the drop. - Tue Mar 10 00:10:32 1998 Miguel de Icaza * gscreen.c (panel_drop_data_available): Now drop support uses the diff --git a/gnome/glayout.c b/gnome/glayout.c index 19a4fa94c..aaa677d8e 100644 --- a/gnome/glayout.c +++ b/gnome/glayout.c @@ -1,3 +1,4 @@ +#include #include "x.h" #include #include @@ -6,6 +7,7 @@ #include "gscreen.h" #include "main.h" #include "cmd.h" +#include "boxes.h" #define UNDEFINED_INDEX -1 @@ -123,8 +125,7 @@ get_current_type (void) int get_other_type (void) { - /* FIXME: This is returning CURRENT panel */ - return view_nothing; + return other_panel_ptr ? view_listing : view_nothing; } int @@ -165,7 +166,7 @@ gnome_listing_cmd (GtkWidget *widget, WPanel *panel) int view_type, use_msformat; char *user, *status; - view_type = display_box (panel, &user, &status, &use_msformat, index); + view_type = display_box (panel, &user, &status, &use_msformat, get_current_index ()); if (view_type == -1) return; @@ -179,15 +180,19 @@ GnomeUIInfo gnome_panel_filemenu [] = { { GNOME_APP_UI_ITEM, "Network link...", NULL, netlink_cmd }, { GNOME_APP_UI_ITEM, "FTP link...", NULL, ftplink_cmd }, { GNOME_APP_UI_ITEM, "Display mode...", NULL, gnome_listing_cmd }, - { GNOME_APP_UI_ITEM, "Sort order...", NULL, NULL }, - { GNOME_APP_UI_ITEM, "Filter...", NULL, NULL }, - { GNOME_APP_UI_ITEM, "Rescan", NULL, NULL }, + { GNOME_APP_UI_ITEM, "Sort order...", NULL, sort_cmd }, + { GNOME_APP_UI_ITEM, "Filter...", NULL, filter_cmd }, + { GNOME_APP_UI_ITEM, "Rescan", NULL, reread_cmd }, { GNOME_APP_UI_ITEM, "Find", NULL, find_cmd }, { GNOME_APP_UI_ITEM, "Hotlist", NULL, quick_chdir_cmd }, #ifdef USE_VFS { GNOME_APP_UI_ITEM, "Active VFS", NULL, reselect_vfs }, #endif + { GNOME_APP_UI_ITEM, "Confirmation", NULL, confirm_box }, { GNOME_APP_UI_ITEM, "Options", NULL, configure_box }, + { GNOME_APP_UI_ITEM, "Virtual FS", NULL, configure_vfs }, + { GNOME_APP_UI_ITEM, "Save setup", NULL, save_setup_cmd }, + { GNOME_APP_UI_ITEM, "Mkdir", NULL, mkdir_cmd }, { GNOME_APP_UI_ENDOFINFO, 0, 0 } }; diff --git a/gnome/gscreen.c b/gnome/gscreen.c index 49eeacfe9..de2d24fb1 100644 --- a/gnome/gscreen.c +++ b/gnome/gscreen.c @@ -331,6 +331,7 @@ static struct { { "Copy...", (context_menu_callback) copy_cmd }, { "Rename/move..", (context_menu_callback) ren_cmd }, { "Delete...", (context_menu_callback) delete_cmd }, + { "Link...", (context_menu_callback) link_cmd }, { NULL, NULL }, }; @@ -448,6 +449,7 @@ internal_select_item (GtkWidget *file_list, WPanel *panel, int row) { unselect_item (panel); panel->selected = row; + gtk_signal_handler_block_by_data (GTK_OBJECT (file_list), panel); printf ("Selecttionando\n"); select_item (panel); @@ -786,7 +788,6 @@ panel_create_file_list (WPanel *panel) gtk_signal_connect_after (GTK_OBJECT (file_list), "size_allocate", GTK_SIGNAL_FUNC (panel_file_list_size_allocate_hook), panel); - gtk_signal_connect (GTK_OBJECT (file_list), "realize", GTK_SIGNAL_FUNC (panel_realized), panel); diff --git a/gnome/layout b/gnome/layout index b5ddd0b19..6b214ccb6 100644 --- a/gnome/layout +++ b/gnome/layout @@ -487,3 +487,107 @@ flags= [mfind-Widget-button-chdir] geometry=0,4,1,1 flags= + +[quick_confirm-Widget-c] +geometry=3,2,1,1 +flags=ew + +[quick_confirm-Widget-o] +geometry=3,1,1,1 +flags=ew + +[quick_confirm-Widget-x] +geometry=1,3,1,1 +flags=w + +[quick_confirm-Widget-de] +geometry=1,1,1,1 +flags=w + +[quick_confirm-Widget-ov] +geometry=1,2,1,1 +flags=w + +[quick_confirm-Widget-e] +geometry=1,4,1,1 +flags=w + +[quick_vfs-Widget-label-vfs] +geometry=1,1,1,1 +flags=w + +[quick_vfs-Widget-input-timo-vfs] +geometry=2,1,1,1 +flags= + +[quick_vfs-Widget-label-pass] +geometry=1,4,1,1 +flags= + +[quick_vfs-Widget-button-ok] +geometry=5,1,1,1 +flags=ew + +[quick_vfs-Widget-input-limit] +geometry=2,3,1,1 +flags=s + +[quick_vfs-Widget-input-ftp-proxy] +geometry=2,6,1,1 +flags= + +[quick_vfs-Widget-label-tar] +geometry=1,2,1,1 +flags=w + +[quick_vfs-Widget-label-cache] +geometry=1,5,1,1 +flags=w + +[quick_vfs-Widget-input-timeout] +geometry=2,5,1,1 +flags= + +[quick_vfs-Widget-check-ftp-proxy] +geometry=1,6,1,1 +flags= + +[quick_vfs-Widget-input-passwd] +geometry=2,4,1,1 +flags= + +[quick_vfs-Widget-label-sec] +geometry=3,5,1,1 +flags= + +[quick_vfs-Widget-button-cancel] +geometry=5,2,1,1 +flags= + +[quick_vfs-Widget-label-sec2] +geometry=3,1,1,1 +flags= + +[quick_vfs-Widget-radio] +geometry=1,3,1,1 +flags=e + +[sort-Widget-case-check] +geometry=3,2,1,1 +flags=w + +[sort-Widget-ok-button] +geometry=4,1,1,1 +flags=ew + +[sort-Widget-reverse-check] +geometry=3,1,1,1 +flags=w + +[sort-Widget-cancel-button] +geometry=4,2,1,1 +flags= + +[sort-Widget-radio-1] +geometry=1,1,1,6 +flags=n diff --git a/src/ChangeLog b/src/ChangeLog index f4cc275eb..acbb00989 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +Tue Mar 10 20:41:45 1998 Miguel de Icaza + + * cmd.c (unselect_cmd_panel, select_cmd_panel): To avoid races on + the X11 version, these routines now take a panel argument at + invocation time. + + * widget.c (radio_callback): Call x_radio_focus for FOCUS/UNFOCUS + events. + (button_callback): Fallback to default_msg on WIDGET_FOCUS + messages. + 1998-03-10 Federico Mena Quintero * xslint.c (getch): Added missing "return". diff --git a/src/cmd.c b/src/cmd.c index 0b82b1f39..3816903ec 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -475,7 +475,7 @@ void reverse_selection_cmd (void) paint_panel (cpanel); } -void select_cmd (void) +void select_cmd_panel (WPanel *panel) { char *reg_exp, *reg_exp_t; int i; @@ -498,31 +498,36 @@ void select_cmd (void) reg_exp_t [strlen(reg_exp_t) - 1] = 0; } - for (i = 0; i < cpanel->count; i++){ - if (!strcmp( cpanel->dir.list [i].fname, "..")) + for (i = 0; i < panel->count; i++){ + if (!strcmp (panel->dir.list [i].fname, "..")) continue; - if (S_ISDIR (cpanel->dir.list [i].buf.st_mode)){ + if (S_ISDIR (panel->dir.list [i].buf.st_mode)){ if (!dirflag) continue; } else { if (dirflag) continue; } - c = regexp_match (reg_exp_t, cpanel->dir.list [i].fname, match_file); + c = regexp_match (reg_exp_t, panel->dir.list [i].fname, match_file); if (c == -1){ message (1, " Error ", " Malformed regular expression "); free (reg_exp); return; } if (c){ - do_file_mark (cpanel, i, 1); + do_file_mark (panel, i, 1); } } - paint_panel (cpanel); + paint_panel (panel); free (reg_exp); } -void unselect_cmd (void) +void select_cmd (void) +{ + select_cmd_panel (cpanel); +} + +void unselect_cmd_panel (WPanel *panel) { char *reg_exp, *reg_exp_t; int i; @@ -544,30 +549,35 @@ void unselect_cmd (void) dirflag = 1; reg_exp_t [strlen(reg_exp_t) - 1] = 0; } - for (i = 0; i < cpanel->count; i++){ - if (!strcmp( cpanel->dir.list [i].fname, "..")) + for (i = 0; i < panel->count; i++){ + if (!strcmp (panel->dir.list [i].fname, "..")) continue; - if (S_ISDIR (cpanel->dir.list [i].buf.st_mode)){ + if (S_ISDIR (panel->dir.list [i].buf.st_mode)){ if (!dirflag) continue; } else { if (dirflag) continue; } - c = regexp_match (reg_exp_t, cpanel->dir.list [i].fname, match_file); + c = regexp_match (reg_exp_t, panel->dir.list [i].fname, match_file); if (c == -1){ message (1, " Error ", " Malformed regular expression "); free (reg_exp); return; } if (c){ - do_file_mark (cpanel, i, 0); + do_file_mark (panel, i, 0); } } - paint_panel (cpanel); + paint_panel (panel); free (reg_exp); } +void unselect_cmd (void) +{ + unselect_cmd_panel (cpanel); +} + /* Check if the file exists */ /* If not copy the default */ static int check_for_default(char *default_file, char *file) diff --git a/src/cmd.h b/src/cmd.h index 58bdac821..6fa1f7ffd 100644 --- a/src/cmd.h +++ b/src/cmd.h @@ -57,6 +57,7 @@ void source_routing (void); void info_cmd (void); void tree_cmd (void); void listing_cmd (void); +void sort_cmd (void); void switch_to_listing (int panel_index); void quick_cmd_no_menu (void); void info_cmd_no_menu (void); diff --git a/src/dlg.c b/src/dlg.c index 73fc20b1c..9a83e0da9 100644 --- a/src/dlg.c +++ b/src/dlg.c @@ -631,8 +631,11 @@ void dlg_key_event (Dlg_head *h, int d_key) int handled; /* TAB used to cycle */ - if (!h->raw && d_key == '\t') - dlg_one_down (h); + if (!h->raw && (d_key == '\t' || d_key == KEY_BACKTAB)) + if (d_key == '\t') + dlg_one_down (h); + else + dlg_one_up (h); else { /* first can dlg_callback handle the key */ diff --git a/src/main.c b/src/main.c index 3bd0dd6f7..646fa9f39 100644 --- a/src/main.c +++ b/src/main.c @@ -1068,7 +1068,7 @@ set_sort_to (WPanel *p, sortfn *sort_order) do_re_sort (p); } -static void +void sort_cmd (void) { WPanel *p; diff --git a/src/myslang.h b/src/myslang.h index fb90304d9..5d61bdb75 100644 --- a/src/myslang.h +++ b/src/myslang.h @@ -11,7 +11,7 @@ enum { KEY_BACKSPACE = 400, KEY_END, KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT, KEY_HOME, KEY_A1, KEY_C1, KEY_NPAGE, KEY_PPAGE, KEY_IC, - KEY_ENTER, KEY_DC, KEY_SCANCEL + KEY_ENTER, KEY_DC, KEY_SCANCEL, KEY_BACKTAB }; #define KEY_F(x) 1000+x diff --git a/src/screen.c b/src/screen.c index c0836ceaa..55d9f87e0 100644 --- a/src/screen.c +++ b/src/screen.c @@ -112,6 +112,18 @@ int panel_event (Gpm_Event *event, WPanel *panel); #define llines(p) (p->widget.lines) #endif +#ifdef PORT_NOT_FOCUS_SELECT_ITEM +# define focus_select_item(x) +#else +# define focus_select_item(x) select_item(x) +#endif + +#ifdef PORT_NOT_UNFOCUS_UNSELECT_ITEM +# define unfocus_unselect_item(x) +#else +# define unfocus_unselect_item(x) unselect_item(x) +#endif + #ifdef HAVE_X # define set_colors(x) #else @@ -2042,6 +2054,15 @@ static key_map panel_keymap [] = { { XCTRL('t'), mark_file }, { ALT('o'), chdir_other_panel }, { ALT('l'), chdir_to_readlink }, + +#ifdef HAVE_GNOME + { '+', select_cmd }, + { '\\', unselect_cmd }, + { '-', unselect_cmd }, + { XCTRL('r'), reread_cmd }, + { ALT('o'), view_other_cmd }, +#endif + #ifndef HAVE_X { KEY_DC, delete_cmd}, #endif @@ -2135,7 +2156,7 @@ panel_callback (Dlg_head *h, WPanel *panel, int msg, int par) subshell_chdir (panel->cwd); show_dir (panel); - select_item (panel); + focus_select_item (panel); #ifndef HAVE_X define_label (h, (Widget *)panel, 1, "Help", help_cmd); define_label (h, (Widget *)panel, 2, "Menu", user_menu_cmd); @@ -2157,7 +2178,7 @@ panel_callback (Dlg_head *h, WPanel *panel, int msg, int par) } #ifdef HAVE_X show_dir (panel); - unselect_item (panel); + unfocus_unselect_item (panel); panel->active = 0; #else panel->active = 0; diff --git a/src/widget.c b/src/widget.c index f064ffe6e..9ab4a6a33 100644 --- a/src/widget.c +++ b/src/widget.c @@ -62,6 +62,10 @@ # define x_destroy_cmd(w) #endif +#ifndef HAVE_GNOME +# define x_radio_focus_item(r) +#endif + static int button_event (Gpm_Event *event, WButton *b); int quote = 0; @@ -152,7 +156,11 @@ button_callback (Dlg_head *h, WButton *b, int Msg, int Par) widget_move (&b->widget, 0, b->hotpos+off); addch (b->text [b->hotpos]); } - return 1; + if (Msg == WIDGET_FOCUS) + break; + else + return 1; + break; #endif #endif /* !HAVE_XVIEW */ } @@ -302,6 +310,7 @@ radio_callback (Dlg_head *h, WRadio *r, int Msg, int Par) case KEY_LEFT: if (r->pos > 0){ r->pos--; + x_radio_focus_item (r); return 1; } return 0; @@ -310,21 +319,17 @@ radio_callback (Dlg_head *h, WRadio *r, int Msg, int Par) case KEY_RIGHT: if (r->count - 1 > r->pos) { r->pos++; + x_radio_focus_item (r); return 1; } } return 0; - -#ifdef HAVE_TK - /* We manage a group of widgets, while Tk manages independent - * ones, so we have to do the focusing manually - */ + +#ifdef HAVE_X case WIDGET_FOCUS: case WIDGET_CURSOR: - tk_evalf ("focus %s.%d", (char *)(r->widget.wdata)+1, r->pos); - /* Do not call default_proc: we did the tk focus command */ - return 1; - + x_radio_focus_item (r); + return 1; #endif #endif diff --git a/tk/tkwidget.c b/tk/tkwidget.c index ed91168f1..dcb42c06e 100644 --- a/tk/tkwidget.c +++ b/tk/tkwidget.c @@ -155,6 +155,12 @@ tk_radio_callback (ClientData cd, Tcl_Interp *interp, int argc, char *argv []) return TCL_OK; } +void +x_radio_focus_item (WRadio *r) +{ + tk_evalf ("focus %s.%d", (char *)(r->widget.wdata)+1, r->pos); +} + int x_create_radio (Dlg_head *h, widget_data parent, WRadio *r) {