1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Someone, sometime ago wanted always visible menu bar. This is attempt to

handle it. I have no idea where to make initialisation call to
activate_bfu_technology.
This commit is contained in:
witekfl 2006-03-03 19:01:15 +01:00 committed by
parent 30a60caa12
commit a802f0fb3e
5 changed files with 41 additions and 8 deletions

View File

@ -868,10 +868,16 @@ void
do_mainmenu(struct terminal *term, struct menu_item *items,
void *data, int sel)
{
struct menu *menu = mem_calloc(1, sizeof(*menu));
int init = 0;
struct menu *menu;
if (!menu) return;
if (!term->main_menu) {
term->main_menu = mem_calloc(1, sizeof(*menu));
if (!term->main_menu) return;
init = 1;
}
menu = term->main_menu;
menu->selected = (sel == -1 ? 0 : sel);
menu->items = items;
menu->data = data;
@ -882,7 +888,20 @@ do_mainmenu(struct terminal *term, struct menu_item *items,
clear_hotkeys_cache(menu);
#endif
init_hotkeys(term, menu);
if (init) {
menu->selected = -1;
add_window(term, mainmenu_handler, menu);
} else {
struct window *win;
foreach (win, term->windows) {
if (win->data == menu) {
del_from_list(win);
add_at_pos((struct window *) &term->windows, win);
break;
}
}
}
if (sel != -1) {
select_menu(term, menu);
@ -1107,8 +1126,10 @@ mainmenu_kbd_handler(struct menu *menu, struct term_event *ev)
}
case ACT_MENU_CANCEL:
delete_window_ev(win, action_id != ACT_MENU_CANCEL ? ev : NULL);
return;
menu->selected = -1;
del_from_list(win);
add_to_list_end(win->term->windows, win);
break;
}
/* Redraw the menu */

View File

@ -1177,6 +1177,10 @@ static struct option_info config_options_info[] = {
N_("Language of user interface. 'System' means that the language will\n"
"be extracted from the environment dynamically.")),
INIT_OPT_BOOL("ui", N_("Display menu bar always"),
"show_menu_bar_always", 0, 0,
N_("Always show menu bar on the screen.")),
INIT_OPT_BOOL("ui", N_("Display status bar"),
"show_status_bar", 0, 1,
N_("Show status bar on the screen.")),

View File

@ -379,11 +379,14 @@ display_title_bar(struct session *ses, struct terminal *term)
unsigned char buf[40];
int buflen = 0;
int height;
struct box box;
/* Clear the old title */
if (!get_opt_bool("ui.show_menu_bar_always")) {
struct box box;
set_box(&box, 0, 0, term->width, 1);
draw_box(term, &box, ' ', 0, get_bfu_color(term, "title.title-bar"));
}
doc_view = current_frame(ses);
if (!doc_view || !doc_view->document) return;

View File

@ -88,6 +88,8 @@ struct terminal {
/* This is the screen. See terminal/screen.h */
struct terminal_screen *screen;
/* This is for displaying main menu */
struct menu *main_menu;
/* These are pipes for communication with the ELinks instance owning
* this terminal. */
int fdin, fdout;

View File

@ -70,6 +70,9 @@ do_action(struct session *ses, enum main_action action_id, int verbose)
struct document_view *doc_view = current_frame(ses);
struct link *link = NULL;
/* FIXME: Move it to appropriate place */
if (!term->main_menu) activate_bfu_technology(ses, -1);
if (action_id == -1) goto unknown_action;
if (doc_view && doc_view->vs) {