mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
* menu.h: Remove "*" from the definition of the type "Menu"
for consistency with other types. Change all dependencies. (menubar_event): Make static.
This commit is contained in:
parent
e085356351
commit
b0481b41bf
@ -166,8 +166,8 @@ struct context_rule {
|
||||
struct key_word **keyword;
|
||||
};
|
||||
|
||||
int edit_drop_hotkey_menu (WEdit * e, int key);
|
||||
void edit_menu_cmd (WEdit * e);
|
||||
int edit_drop_hotkey_menu (WEdit *e, int key);
|
||||
void edit_menu_cmd (WEdit *e);
|
||||
void edit_init_menu_emacs (void);
|
||||
void edit_init_menu_normal (void);
|
||||
void edit_done_menu (void);
|
||||
@ -347,7 +347,7 @@ extern char *home_dir;
|
||||
*/
|
||||
extern int edit_key_emulation;
|
||||
extern WEdit *wedit;
|
||||
extern Menu EditMenuBar[];
|
||||
extern Menu *EditMenuBar[];
|
||||
extern WMenu *edit_menubar;
|
||||
|
||||
extern int option_word_wrap_line_length;
|
||||
|
@ -260,7 +260,7 @@ static menu_entry OptMenuEmacs[] =
|
||||
|
||||
#define menu_entries(x) sizeof(x)/sizeof(menu_entry)
|
||||
|
||||
Menu EditMenuBar[N_menus];
|
||||
Menu *EditMenuBar[N_menus];
|
||||
|
||||
void edit_init_menu_normal (void)
|
||||
{
|
||||
|
@ -105,15 +105,14 @@ edit_event (WEdit * edit, Gpm_Event * event, int *result)
|
||||
}
|
||||
|
||||
|
||||
int menubar_event (Gpm_Event * event, WMenu * menubar); /* menu.c */
|
||||
|
||||
int edit_mouse_event (Gpm_Event * event, void *x)
|
||||
int
|
||||
edit_mouse_event (Gpm_Event *event, void *x)
|
||||
{
|
||||
int result;
|
||||
if (edit_event ((WEdit *) x, event, &result))
|
||||
return result;
|
||||
else
|
||||
return menubar_event (event, edit_menubar);
|
||||
return (*edit_menubar->widget.mouse) (event, edit_menubar);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1,3 +1,9 @@
|
||||
2002-11-12 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* menu.h: Remove "*" from the definition of the type "Menu"
|
||||
for consistency with other types. Change all dependencies.
|
||||
(menubar_event): Make static.
|
||||
|
||||
2002-11-12 Andrew V. Samoilov <kai@cmail.ru>
|
||||
|
||||
* view.c (get_line_at): Use g_strreverse() instead of
|
||||
|
@ -1086,7 +1086,7 @@ static menu_entry OptMenu[] = {
|
||||
|
||||
#define menu_entries(x) sizeof(x)/sizeof(menu_entry)
|
||||
|
||||
static Menu MenuBar[5];
|
||||
static Menu *MenuBar[5];
|
||||
|
||||
void
|
||||
init_menu (void)
|
||||
|
26
src/menu.c
26
src/menu.c
@ -34,7 +34,8 @@
|
||||
extern int is_right;
|
||||
int menubar_visible = 1; /* This is the new default */
|
||||
|
||||
static void menu_scan_hotkey(Menu menu)
|
||||
static void
|
||||
menu_scan_hotkey(Menu *menu)
|
||||
{
|
||||
char* cp = strchr (menu->name, '&');
|
||||
|
||||
@ -46,12 +47,13 @@ static void menu_scan_hotkey(Menu menu)
|
||||
menu->hotkey = 0;
|
||||
}
|
||||
|
||||
Menu create_menu (char *name, menu_entry *entries, int count, char *help_node)
|
||||
Menu *
|
||||
create_menu (char *name, menu_entry *entries, int count, char *help_node)
|
||||
{
|
||||
Menu menu;
|
||||
Menu *menu;
|
||||
char *cp;
|
||||
|
||||
menu = (Menu) g_malloc (sizeof (*menu));
|
||||
menu = (Menu *) g_malloc (sizeof (*menu));
|
||||
menu->count = count;
|
||||
menu->max_entry_len = 20;
|
||||
menu->entries = entries;
|
||||
@ -91,7 +93,7 @@ static void menubar_drop_compute (WMenu *menubar)
|
||||
|
||||
static void menubar_paint_idx (WMenu *menubar, int idx, int color)
|
||||
{
|
||||
const Menu menu = menubar->menu [menubar->selected];
|
||||
const Menu *menu = menubar->menu [menubar->selected];
|
||||
const int y = 2 + idx;
|
||||
int x = menubar-> menu[menubar->selected]->start_x;
|
||||
|
||||
@ -227,7 +229,7 @@ static void menubar_drop (WMenu *menubar, int selected)
|
||||
|
||||
static void menubar_execute (WMenu *menubar, int entry)
|
||||
{
|
||||
const Menu menu = menubar->menu [menubar->selected];
|
||||
const Menu *menu = menubar->menu [menubar->selected];
|
||||
const callfn call_back = menu->entries [entry].call_back;
|
||||
|
||||
is_right = menubar->selected != 0;
|
||||
@ -243,7 +245,7 @@ static void menubar_execute (WMenu *menubar, int entry)
|
||||
|
||||
static void menubar_move (WMenu *menubar, int step)
|
||||
{
|
||||
const Menu menu = menubar->menu [menubar->selected];
|
||||
const Menu *menu = menubar->menu [menubar->selected];
|
||||
|
||||
menubar_paint_idx (menubar, menubar->subsel, MENU_ENTRY_COLOR);
|
||||
do {
|
||||
@ -297,7 +299,7 @@ static int menubar_handle_key (WMenu *menubar, int key)
|
||||
if (!menubar->dropped){
|
||||
const int items = menubar->items;
|
||||
for (i = 0; i < items; i++){
|
||||
const Menu menu = menubar->menu [i];
|
||||
const Menu *menu = menubar->menu [i];
|
||||
|
||||
if (menu->hotkey == key){
|
||||
menubar_drop (menubar, i);
|
||||
@ -312,7 +314,7 @@ static int menubar_handle_key (WMenu *menubar, int key)
|
||||
return 1;
|
||||
} else {
|
||||
const int selected = menubar->selected;
|
||||
const Menu menu = menubar->menu [selected];
|
||||
const Menu *menu = menubar->menu [selected];
|
||||
const int items = menu->count;
|
||||
|
||||
for (i = 0; i < items; i++){
|
||||
@ -389,7 +391,7 @@ static int menubar_callback (Dlg_head *h, WMenu *menubar, int msg, int par)
|
||||
return default_proc (h, msg, par);
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
menubar_event (Gpm_Event *event, WMenu *menubar)
|
||||
{
|
||||
int was_active;
|
||||
@ -529,14 +531,14 @@ menubar_arrange(WMenu* menubar)
|
||||
}
|
||||
|
||||
void
|
||||
destroy_menu (Menu menu)
|
||||
destroy_menu (Menu *menu)
|
||||
{
|
||||
g_free (menu->name);
|
||||
g_free (menu->help_node);
|
||||
g_free (menu);
|
||||
}
|
||||
|
||||
WMenu *menubar_new (int y, int x, int cols, Menu menu [], int items)
|
||||
WMenu *menubar_new (int y, int x, int cols, Menu *menu [], int items)
|
||||
{
|
||||
WMenu *menubar = g_new0 (WMenu, 1); /* FIXME: subsel used w/o being set */
|
||||
|
||||
|
16
src/menu.h
16
src/menu.h
@ -16,7 +16,7 @@ typedef struct {
|
||||
callfn call_back;
|
||||
} menu_entry;
|
||||
|
||||
typedef struct {
|
||||
typedef struct Menu {
|
||||
char *name;
|
||||
int count;
|
||||
int max_entry_len;
|
||||
@ -25,8 +25,7 @@ typedef struct {
|
||||
menu_entry *entries;
|
||||
int start_x; /* position relative to menubar start */
|
||||
char *help_node;
|
||||
} sMenu;
|
||||
typedef sMenu *Menu;
|
||||
} Menu;
|
||||
|
||||
extern int menubar_visible;
|
||||
|
||||
@ -36,7 +35,7 @@ typedef struct WMenu {
|
||||
|
||||
int active; /* If the menubar is in use */
|
||||
int dropped; /* If the menubar has dropped */
|
||||
Menu *menu; /* The actual menus */
|
||||
Menu **menu; /* The actual menus */
|
||||
int items;
|
||||
int selected; /* Selected menu on the top bar */
|
||||
int subsel; /* Selected entry on the submenu */
|
||||
@ -44,12 +43,11 @@ typedef struct WMenu {
|
||||
int previous_selection; /* Selected widget before activating menu */
|
||||
} WMenu;
|
||||
|
||||
Menu create_menu (char *name, menu_entry *entries, int count,
|
||||
Menu *create_menu (char *name, menu_entry *entries, int count,
|
||||
char *help_node);
|
||||
void destroy_menu (Menu menu);
|
||||
WMenu *menubar_new (int y, int x, int cols, Menu menu [], int items);
|
||||
void menubar_arrange (WMenu* menubar);
|
||||
int menubar_event (Gpm_Event *event, WMenu *menubar);
|
||||
void destroy_menu (Menu *menu);
|
||||
WMenu *menubar_new (int y, int x, int cols, Menu *menu[], int items);
|
||||
void menubar_arrange (WMenu *menubar);
|
||||
|
||||
#endif /* __MENU_H */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user