1
1

* menu.h: Return to keeping dialog id instead of a widget

pointer for previous widget.  The widget can be replaced in the
meantime.
* dlg.c (dlg_select_by_id): New function, essentially a cleaner
implementation of dlg_select_nth_widget().
Этот коммит содержится в:
Pavel Roskin 2003-09-13 07:43:20 +00:00
родитель 9941a0bb6a
Коммит 6eda31f362
7 изменённых файлов: 37 добавлений и 5 удалений

Просмотреть файл

@ -450,7 +450,7 @@ edit_drop_menu_cmd (WEdit *e, int which)
edit_menubar->selected = which;
}
edit_menubar->previous_widget = e->widget.parent->current;
edit_menubar->previous_widget = e->widget.parent->current->dlg_id;
dlg_select_widget (e->widget.parent, edit_menubar);
}

Просмотреть файл

@ -1,5 +1,11 @@
2003-09-13 Pavel Roskin <proski@gnu.org>
* menu.h: Return to keeping dialog id instead of a widget
pointer for previous widget. The widget can be replaced in the
meantime.
* dlg.c (dlg_select_by_id): New function, essentially a cleaner
implementation of dlg_select_nth_widget().
* dlg.h: Remove "first" field for dialogs and DLG_HAS_MENUBAR.
* dlg.c (dlg_mouse_event): Remove menubar hack.
* screen.c (do_panel_event): Redirect mouse events on the upper

Просмотреть файл

@ -369,6 +369,30 @@ find_widget_type (Dlg_head *h, void *callback)
return w;
}
/* Find the widget with the given dialog id in the dialog h and select it */
void
dlg_select_by_id (Dlg_head *h, int id)
{
Widget *w, *w_found;
if (!h->current)
return;
w = h->current;
w_found = NULL;
do {
if (w->dlg_id == id) {
w_found = w;
break;
}
w = w->next;
} while (w != h->current);
if (w_found)
dlg_select_widget(h, w_found);
}
void dlg_one_up (Dlg_head *h)
{
Widget *old;

Просмотреть файл

@ -194,6 +194,7 @@ void dlg_one_up (Dlg_head *h);
void dlg_one_down (Dlg_head *h);
int dlg_focus (Dlg_head *h);
Widget *find_widget_type (Dlg_head *h, void *callback);
void dlg_select_by_id (Dlg_head *h, int id);
/* Sets/clear the specified flag in the options field */
#define widget_option(w,f,i) \

Просмотреть файл

@ -980,7 +980,7 @@ menu_last_selected_cmd (void)
{
the_menubar->active = 1;
the_menubar->dropped = drop_menus;
the_menubar->previous_widget = midnight_dlg->current;
the_menubar->previous_widget = midnight_dlg->current->dlg_id;
dlg_select_widget (midnight_dlg, the_menubar);
}

Просмотреть файл

@ -213,7 +213,8 @@ menubar_finish (WMenu *menubar)
menubar->active = 0;
menubar->widget.lines = 1;
widget_want_hotkey (menubar->widget, 0);
dlg_select_widget (menubar->widget.parent, menubar->previous_widget);
dlg_select_by_id (menubar->widget.parent, menubar->previous_widget);
do_refresh ();
}
@ -399,7 +400,7 @@ menubar_event (Gpm_Event *event, WMenu *menubar)
return MOU_NORMAL;
if (!menubar->dropped){
menubar->previous_widget = menubar->widget.parent->current;
menubar->previous_widget = menubar->widget.parent->current->dlg_id;
menubar->active = 1;
menubar->dropped = 1;
was_active = 0;

Просмотреть файл

@ -37,7 +37,7 @@ typedef struct WMenu {
int selected; /* Selected menu on the top bar */
int subsel; /* Selected entry on the submenu */
int max_entry_len; /* Cache value for the columns in a box */
Widget *previous_widget; /* Selected widget before activating menu */
int previous_widget; /* Selected widget ID before activating menu */
} WMenu;
Menu *create_menu (char *name, menu_entry *entries, int count,