Menu *MakeConfigMenu(bool popup)
{
    char menu_id[200];
    Menu *m;

    Core_IDString(menu_id, "Configuration");
    m = CfgMenuMaker(NLS0("Configuration"), "@BBCfg.", cfg_main, popup, menu_id);

#if 0
    char buff[MAX_PATH];
    FindRCFile(buff, "plugins\\bbleanskin\\bblsmenu.rc", NULL);
    Menu *s = MakeRootMenu("Configuration_BBLS", buff, NULL, popup);
    if (s) MakeSubmenu(m, s, NULL);
#endif

    return m;
}
Exemple #2
0
// update one of the core menus
void Menu_Update(int id)
{
    switch (id)
    {
        case MENU_UPD_ROOT:
            // right click menu or any of its submenus
            if (MenuExists("Core_root")) {
                ShowMenu(MakeRootMenu("root", menuPath(NULL),
                    default_root_menu, false));
                break;
            }
            // fall though
        case MENU_UPD_CONFIG:
            // the core config menu
            if (MenuExists("Core_configuration"))
                ShowMenu(MakeConfigMenu(false));
            break;

        case MENU_UPD_TASKS:
            // desktop workspaces menu etc.
            if (MenuExists("Core_tasks"))
            {
                if (MenuExists("Core_tasks_workspace"))
                    ShowMenu(MakeDesktopMenu(0, false));
                else
                if (MenuExists("Core_tasks_icons"))
                    ShowMenu(MakeDesktopMenu(1, false));

                if (MenuExists("Core_tasks_menu"))
                    ShowMenu(MakeDesktopMenu(2, false));

                if (MenuExists("Core_tasks_recoverwindows"))
                    ShowMenu(MakeRecoverMenu(false));
            }
            break;
    }
}
Exemple #3
0
// show one of the root menus
bool MenuMaker_ShowMenu(int id, const char* param)
{
    char buffer[MAX_PATH];
    Menu *m;
    int x, y, n, flags, toggle;

    static const char * const menu_string_ids[] = {
        "",
        "root",
        "workspaces",
        "icons",
        "tasks",
        "configuration",
        NULL
    };

    enum {
        e_lastmenu,
        e_root,
        e_workspaces,
        e_icons,
        e_tasks,
        e_configuration,
    };

    x = y = flags = n = toggle = 0;


    switch (id)
    {
        case BB_MENU_BROAM: // @ShowMenu ...
            while (param[0] == '-') {
                const char *p = NextToken(buffer, &param, NULL);
                if (0 == strcmp(p, "-at")) {
                    for (;;++param) {
                        if (*param == 'r')
                            flags |= BBMENU_XRIGHT;
                        else if (*param == 'b')
                            flags |= BBMENU_YBOTTOM;
                        else
                            break;
                    }
                    x = atoi(NextToken(buffer, &param, " ,"));
                    param += ',' == *param;
                    y = atoi(NextToken(buffer, &param, NULL));
                    flags |= BBMENU_XY;
                } else if (0 == strcmp(p, "-key")) {
                    flags |= BBMENU_KBD;
                } else if (0 == strcmp(p, "-toggle")) {
                    toggle = 1;
                } else if (0 == strcmp(p, "-pinned")) {
                    flags |= BBMENU_PINNED;
                } else if (0 == strcmp(p, "-ontop")) {
                    flags |= BBMENU_ONTOP;
                } else if (0 == strcmp(p, "-notitle")) {
                    flags |= BBMENU_NOTITLE;
                }
            }
            break;
        case BB_MENU_ROOT: // Main menu
            param = "root";
            break;
        case BB_MENU_TASKS: // Workspaces menu
            param = "workspaces";
            break;
        case BB_MENU_ICONS: // Iconized tasks menu
            param = "icons";
            break;
        case BB_MENU_UPDATE:
            Menu_Update(MENU_UPD_ROOT);
            Menu_All_Redraw(0);
            return false;
        case BB_MENU_SIGNAL: // just to signal e.g. BBSoundFX
            return true;
        default:
            return false;
    }

    // If invoked by kbd and the menu currently has focus,
    // hide it and return
    if (((flags & BBMENU_KBD) || toggle) && Menu_ToggleCheck(param))
        return false;

    //DWORD t1 = GetTickCount();

    switch (get_string_index(param, menu_string_ids))
    {
        case e_root:
        case e_lastmenu:
            m = MakeRootMenu("root", menuPath(NULL), default_root_menu, true);
            break;

        case e_workspaces:
            m = MakeDesktopMenu(0, true);
            break;

        case e_icons:
            m = MakeDesktopMenu(1, true);
            break;

        case e_tasks:
            m = MakeDesktopMenu(2, true);
            break;

        case e_configuration:
            m = MakeConfigMenu(true);
            break;

        default:
            n = get_workspace_number(param); // e.g. 'workspace1'
            if (-1 != n) {
                m = MakeTaskFolder(n, true);
            } else if (FindRCFile(buffer, param, NULL)) {
                m = MakeRootMenu(param, buffer, NULL, true);
            } else {
                const char *cmd = get_special_command(&param, buffer, sizeof buffer);
                m = MakeFolderMenu(NULL, param, cmd);
            }
            break;
    }

    if (NULL == m)
        return false;

    MenuOption(m, flags, x, y);
    ShowMenu(m);

    //dbg_printf("showmenu time %d", GetTickCount() - t1);
    return true;
}