Пример #1
0
Menu *MakeRecoverMenu(bool popup)
{
    Menu *m = MakeNamedMenu(NLS0("Toggle Window Visibilty"), "Core_tasks_recoverwindows", popup);
    EnumWindows(recoverwindow_enum_proc, (LPARAM)m);
    MenuOption(m, BBMENU_MAXWIDTH|BBMENU_SORT|BBMENU_CENTER|BBMENU_PINNED|BBMENU_ONTOP, 400);
    return m;
}
Пример #2
0
void BBP_showmenu(plugin_info *PI, Menu *pMenu, int flags)
{
    if (flags & (int)true) {
        HWND hwnd = PI->inSlit?PI->hSlit:PI->hwnd;
        MenuOption(pMenu, (flags & ~(int)true) | BBMENU_HWND, PI->hwnd);
        PostMessage(hwnd, BB_AUTOHIDE, 1, 1);
    }
    ShowMenu(pMenu);
}
Пример #3
0
SubMenu::SubMenu(SDL_Setup* passed_SDL_Setup, int *passed_MouseX, int *passed_MouseY, int kind) //Constructor
{

    sdl_setup = passed_SDL_Setup;
    MouseX = passed_MouseX;
    MouseY = passed_MouseY;

    selectedI = 0;
    opSelected = false;
    buttonPressed = false;

    //Buttons
    newHouse = MenuOption(1,100, "images/house.png", false);
    newBarracks = MenuOption(2,250, "images/barracks.png", false);
    newVillager = MenuOption(3, 50, "images/villagerButton.png", true);
    newMilitia = MenuOption(5, 50, "images/militiaButton.png", true);
    newChampion = MenuOption(7, 150, "images/championButton.png", true);

    //Menu Options
    villagerOptions.push_back(newHouse);
    villagerOptions.push_back(newBarracks);
    TownCenterOptions.push_back(newVillager);
    barracksOptions.push_back(newMilitia);
    barracksOptions.push_back(newChampion);

    bar = new Sprite(sdl_setup->GetRenderer(), "images/optionsmenu.png", 0, 675, 1024, 100, CollisionRectangle(0,0,1024,100));

    //Sprite menus
    main = newMenu(mainOptions);
    house = newMenu(houseOptions);
    barracks = newMenu(barracksOptions);
    villager = newMenu(villagerOptions);
    townCenter = newMenu(TownCenterOptions);
    displayed = main;

    type = kind;
}
Пример #4
0
void n_showmenu(plugin_info *PI, n_menu *m, bool popup, int flags, ...)
{
    Menu *pMenu;
    pMenu = n_convertmenu(m, PI->broam_key, popup);
    if (flags) {
        va_list vl;
        va_start(vl, flags);
        void *o1, *o2, *o3;
        o1 = va_arg(vl, void*);
        o2 = va_arg(vl, void*);
        o3 = va_arg(vl, void*);
        MenuOption(pMenu, flags, o1, o2, o3);
    }
    BBP_showmenu(PI, pMenu, popup);
}
Пример #5
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;
}
Пример #6
0
// recursive parsing of menu file
static Menu* ParseMenu(struct menu_src *src, const char *title, const char *IDString)
{
    char line[4000];
    char data[4000];
    char buffer[4000];
    char command[40];
    char label[MAX_PATH];

    Menu *pMenu, *pSub;
    MenuItem *pItem;
    int f, e_cmd;
    const char *p_label, *p_data, *cp, *p_cmd;

    pMenu = NULL;
    for(;;)
    {
        p_label = NULL;
        p_data = data;

        if (0 == src->level) {
            // read default menu from string
            NextToken(line, &src->default_menu, "\n");
        } else {
            f = ReadNextCommand(src->fp[src->level-1], line, sizeof(line));
            if (!f) {
                if (src->level > 1) {
                    dec_inc_level(src);
                    continue; // continue from included file
                }
                e_cmd = e_no_end;
                goto skip;
            }
        }

        cp = replace_environment_strings(line, sizeof line);

        //dbg_printf("Menu %08x line:%s", pMenu, line);

        // get the command
        if (false == get_string_within(command, sizeof command, &cp, "[]"))
            continue;
        // search the command
        e_cmd = get_string_index(command, menu_cmds);

        if (get_string_within(label, sizeof label, &cp, "()"))
            p_label = label;

        if (false == get_string_within(data, sizeof data, &cp, "{}"))
            p_data = label;

skip:
        if (NULL == pMenu)
        {
            if (e_begin == e_cmd) {
                // If the line contains [begin] we create the menu
                // If no menu title has been defined, display Blackbox version...
#ifdef BBXMENU
                if (src->default_menu)
                    strcpy(label, "bbXMenu");
                else
#endif
                if (0 == label[0] && src->default_menu)
                    p_label = GetBBVersion();
                pMenu = MakeNamedMenu(p_label, IDString, src->popup);
                continue;
            }

            if (NULL == title)
                title = NLS0("missing [begin]");

            pMenu = MakeNamedMenu(title, IDString, src->popup);
        }

        pItem = NULL;

        switch (e_cmd) {

        //====================
        // [begin] is like [submenu] when within the menu
        case e_begin:
        case e_submenu:
            sprintf(buffer, "%s_%s", IDString, label);
            strlwr(buffer + strlen(IDString));
            pSub = ParseMenu(src, p_data, buffer);
            if (pSub)
                pItem = MakeSubmenu(pMenu, pSub, label);
            else
                pItem = MakeMenuNOP(pMenu, label);
            break;

        //====================
        case e_no_end:
            MakeMenuNOP(pMenu, NLS0("missing [end]"));
        case e_end:
            MenuOption(pMenu, BBMENU_ISDROPTARGET);
            return pMenu;

        //====================
        case e_include:
        {
            char dir[MAX_PATH];
            file_directory(dir, src->path[src->level-1]);
            replace_shellfolders_from_base(buffer, p_data, false, dir);
            if (false == add_inc_level(src, buffer)) {
                replace_shellfolders(buffer, p_data, false);
                if (false == add_inc_level(src, buffer))
                    MakeMenuNOP(pMenu, NLS0("[include] failed"));
            }
            continue;
        }

        //====================
        // a [nop] item will insert an inactive item with optional text
        case e_nop:
            pItem = MakeMenuNOP(pMenu, label);
            break;

        // a insert separator, we treat [sep] like [nop] with no label
        case e_sep1:
        case e_sep2:
            pItem = MakeMenuNOP(pMenu, NULL);
            break;

        //====================
        // a [path] item is pointing to a dynamic folder...
        case e_path:
            p_cmd = get_special_command(&p_data, buffer, sizeof buffer);
            pItem = MakeMenuItemPath(pMenu, label, p_data, p_cmd);
            break;

        // a [insertpath] item will insert items from a folder...
        case e_insertpath:
            p_cmd = get_special_command(&p_data, buffer, sizeof buffer);
            pItem = MakeMenuItemPath(pMenu, NULL, p_data, p_cmd);
            break;

        // a [stylemenu] item is pointing to a dynamic style folder...
        case e_stylesmenu:
            pItem = MakeMenuItemPath(pMenu, label, p_data, MM_STYLE_BROAM);
            break;

        // a [styledir] item will insert styles from a folder...
        case e_stylesdir:
            pItem = MakeMenuItemPath(pMenu, NULL, p_data, MM_STYLE_BROAM);
            break;

        // a [rcmenu] item is pointing to a dynamic rc files folder...
        case e_rcmenu:
            pItem = MakeMenuItemPath(pMenu, label, p_data, MM_EDIT_BROAM);
            break;

        case e_themesmenu:
            pItem = MakeMenuItemPath(pMenu, label, p_data, MM_THEME_BROAM);
            break;

        //====================
        // special items...
        case e_workspaces:
            pItem = MakeSubmenu(pMenu, MakeDesktopMenu(0, src->popup), p_label);
            break;
        case e_icons:
            pItem = MakeSubmenu(pMenu, MakeDesktopMenu(1, src->popup), p_label);
            break;
        case e_tasks:
            pItem = MakeSubmenu(pMenu, MakeDesktopMenu(2, src->popup), p_label);
            break;
        case e_config:
            pItem = MakeSubmenu(pMenu, MakeConfigMenu(src->popup), p_label);
            break;

        //====================
        case e_exec:
            if ('@' == data[0]) {
                pItem = MakeMenuItem(pMenu, label, data, false);
                MenuItemOption(pItem, BBMENUITEM_UPDCHECK);
            } else {
                goto core_broam;
            }
            break;

        //====================
        case e_other:
            f = get_workspace_number(command); // check for 'workspace1..'
            if (-1 != f) {
                pItem = MakeSubmenu(pMenu, MakeTaskFolder(f, src->popup), p_label);
            } else {
                p_data = data;
                goto core_broam;
            }
            break;

        //====================
        // everything else is converted to a '@BBCore.xxx' broam
        core_broam:
            f = sprintf(buffer, "@bbCore.%s", command);
            strlwr(buffer+8);
            if (p_data[0])
                sprintf(buffer + f, " %s", p_data);
            pItem = MakeMenuItem(pMenu, label[0]?label:command, buffer, false);
            break;
        }

//#ifdef BBOPT_MENUICONS
		if ( Settings_menu.iconSize ) {
			if (pItem && get_string_within(label,  sizeof label, &cp, "<>"))
				MenuItemOption(pItem, BBMENUITEM_SETICON, label);
		}
//#endif
    }
}