Esempio n. 1
0
//================================================
void SpecialFolder::UpdateFolder(void)
{
	// ---------------------------------------
	// remember the active item as text

	MenuItem *ActiveItem = m_pActiveItem;
	TCHAR *active_item_text = NULL;

	m_pLastChild = m_pChild;
	if (m_pLastChild) ActiveItem = m_pLastChild->m_pParentItem;
	if (ActiveItem) active_item_text = new_str(ActiveItem->m_pszTitle);

	// delete_old items
	DeleteMenuItems();

	// load the folder contents
	MenuItem *Items = NULL; int r = 0;

	struct pidl_node *p;
	dolist (p, m_pidl_list)
		r |= MenuMaker_LoadFolder(&Items, p->v, m_pszExtra);

	if (Items) add_folder_contents(Items, NULL != m_pidl_list->next);
	else if (r) MakeMenuNOP(this, NLS0(_T("No Files")));
	else MakeMenuNOP(this, NLS0(_T("Invalid Path")));

	// ---------------------------------------
	// search by text the previously active item

	if (active_item_text)
	{
		dolist (ActiveItem, m_pMenuItems)
			if (0 == _tcscmp(active_item_text, ActiveItem->m_pszTitle))
				break;

		free_str(&active_item_text);
	}

	// ---------------------------------------
	// possibly reconnect to an open child-folder

	if (m_pLastChild)
	{
		if (ActiveItem)
		{
			m_pLastChild->incref();
			ActiveItem->LinkSubmenu(m_pLastChild);
			m_pLastChild->LinkToParentItem(ActiveItem);
		}
		else
		{
			m_pLastChild->Hide(); // lost child
		}
		m_pLastChild = NULL;
	}

	if (ActiveItem) ActiveItem->Active(2);
}
Esempio n. 2
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;
}
Esempio n. 3
0
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;
}
Esempio n. 4
0
//===========================================================================
Menu* MakeDesktopMenu(int mode, bool popup)
{
    DesktopInfo DI;
    struct string_node *sl;
    int n, d;
    Menu *m, *s, *i = NULL;

    if (mode == 2) {
        m = MakeNamedMenu(NLS0("Tasks"), "Core_tasks_menu", popup);
    } else {
        i = build_task_folder(-1, NLS0("Icons"), popup);
        if (mode == 1)
            return i;
        m = MakeNamedMenu(NLS0("Workspaces"), "Core_tasks_workspaces", popup);
    }
    getWorkspaces().GetDesktopInfo(DI);
    for (n = 0, d = DI.nScreens, sl = DI.deskNames; n < d; ++n, sl = sl->next) {
        if (mode == 0) {
            char buf[100];
            MenuItem *fi;

            fi = MakeSubmenu(m, build_task_folder(n, sl->str, popup), NULL);
            sprintf(buf, "@BBCore.SwitchToWorkspace %d", n+1);
            MenuItemOption(fi, BBMENUITEM_LCOMMAND, buf);
            if (n == DI.number)
                MenuItemOption(fi, BBMENUITEM_CHECKED);
        } else {
            fill_task_folder(m, n, e_alltasks);
            if (n == d-1) return m;
            MakeMenuNOP(m, NULL);
        }
    }
    MakeMenuNOP(m, NULL);
    MakeSubmenu(m, i, NULL);
    s = MakeNamedMenu(NLS0("New/Remove"), "Core_workspaces_setup", popup);
    MakeMenuItem(s, NLS0("New Workspace"), "@BBCore.AddWorkspace", false);
    if (d > 1) MakeMenuItem(s, NLS0("Remove Last"), "@BBCore.DelWorkspace", false);
    MakeMenuItemString(s, NLS0("Workspace Names"), "@BBCore.SetWorkspaceNames", Settings_workspaceNames);
    MakeSubmenu(m, s, NULL);
    MakeMenuGrip(s, "New/Remove");
    MakeMenuGrip(m, "Workspaces");
    return m;
}
Esempio n. 5
0
Menu* MakeDesktopMenu(bool popup)
{
	Menu *m = MakeNamedMenu(NLS0("Workspaces"), "IDRoot_workspaces", popup);

	struct dn dn; dn.m = m; dn.popup = popup;
	EnumDesks(desk_enum_func, (LPARAM)&dn);

	MakeMenuNOP(m);
	MakeSubmenu(m, MakeIconsMenu(popup), NLS0("Icons"));

	const char *CFG = NLS0("New/Remove");
	Menu *s = MakeNamedMenu(CFG, "IDRoot_workspaces_setup", popup);
	MakeSubmenu(m, s, CFG);

	MakeMenuItem(s, NLS0("New Workspace"), "@BBCore.AddWorkspace", false);
	if (Settings_workspaces>1) MakeMenuItem(s, NLS0("Remove Last"), "@BBCore.DelWorkspace", false);
	MakeMenuItem(s, NLS0("Edit Workspace Names"), "@BBCore.EditWorkspaceNames", false);

	return m;
}
Esempio n. 6
0
Menu* MakeIconsMenu(bool popup)
{
	Menu *m = build_task_folder(-1, NLS0("Icons"), popup);
	return m;
}
Esempio n. 7
0
Menu *CfgMenuMaker(const char *title, const char *defbroam, const struct cfgmenu *pm, bool pop, char *menu_id)
{
    char buf[100];
    char *broam_dot;
    char *end_id;
    Menu *pMenu, *pSub;

    end_id = strchr(menu_id, 0);
    pMenu = MakeNamedMenu(title, menu_id, pop);
    broam_dot = strchr(strcpy_max(buf, defbroam, sizeof buf), 0);

    for (;pm->text; ++pm)
    {
        const char *item_text = pm->text;
        const void *v = pm->pvalue;
        const char *cmd = pm->command;
        const struct int_item *iip;
        bool disabled, checked;
        MenuItem *pItem;

        disabled = checked = false;
        if (cmd)
        {
            if ('@' != *cmd)
                strcpy(broam_dot, cmd), cmd = buf;

            if (NULL != (iip = get_int_item(v))) {
                pItem = MakeMenuItemInt(
                    pMenu, item_text, cmd, *iip->v, iip->minval, iip->maxval);
                if (-2 != iip->offval)
                    MenuItemOption(pItem, BBMENUITEM_OFFVAL,
                        iip->offval, 10000 == iip->maxval ? NLS0("auto") : NULL);
                continue;
            } else if (is_string_item(v)) {
                MakeMenuItemString(pMenu, item_text, cmd, (const char*)v);
                continue;
            } else if (is_fixed_string(v)) {
                checked = 0 == stricmp((const char *)v, strchr(cmd, ' ')+1);
            } else if (v) {
                checked = *(bool*)v;
            }

            disabled = (v == &Settings_styleXPFix && Settings_altMethod)
                    || (v == &Settings_menu.dropShadows && false == usingXP)
                    ;
            pItem = MakeMenuItem(pMenu, item_text, cmd, checked && false == disabled);
        }
        else if (v)
        {
            sprintf(end_id, "_%s", item_text);
            if ((DWORD_PTR)v <= SUB_PLUGIN_SLIT)
                pSub = PluginManager_GetMenu(item_text, menu_id, pop, (int)(DWORD_PTR)v);
            else
                pSub = CfgMenuMaker(item_text, defbroam, (struct cfgmenu*)v, pop, menu_id);
            if (NULL == pSub)
                continue;
            pItem = MakeSubmenu(pMenu, pSub, NULL);
        }
        else
        {
            pItem = MakeMenuNOP(pMenu, item_text);
        }

        if (disabled)
            MenuItemOption(pItem, BBMENUITEM_DISABLED);
    }
    return pMenu;
}
Esempio n. 8
0
        || v == Settings_workspaceNames
        ;
}

static bool is_fixed_string(const void *v)
{
    return v == Settings_focusModel
        || v == Settings_menu.openDirection
        || v == Settings_toolbar.placement
        ;
}

//===========================================================================

static const struct cfgmenu cfg_sub_plugins[] = {
    { NLS0("Load/Unload"),          NULL, (const void*)SUB_PLUGIN_LOAD },
    { NLS0("In Slit"),              NULL, (const void*)SUB_PLUGIN_SLIT },
    { "", NULL, NULL },
#ifndef BBTINY
    { NLS0("Add Plugin ..."),       "plugin.add", NULL },
#endif
    { NLS0("Edit plugins.rc"),      "@BBCore.editPlugins", NULL },
    { NLS0("About Plugins"),        "@BBCore.aboutPlugins", NULL },
    { NULL,NULL,NULL },
};

static const struct cfgmenu cfg_sub_opendirection[] = {
    { NLS0("Bullet"),               "menu.openDirection bullet",    Settings_menu.openDirection },
    { NLS0("Left"),                 "menu.openDirection left",      Settings_menu.openDirection },
    { NLS0("Right"),                "menu.openDirection right",     Settings_menu.openDirection },
    { NULL,NULL,NULL }
Esempio n. 9
0
void Toolbar_ShowMenu(bool popup)
{
	TCHAR menu_id[200]; _tcsncpy_s(menu_id, 200, _T("IDRoot_configuration_TB"), _TRUNCATE);
	ShowMenu(CfgMenuMaker(NLS0(_T("Toolbar")), tb_main, popup, menu_id, 200));
}
Esempio n. 10
0
// -------------------------
#include "MessageManager.h"
#include "Workspaces.h"
#include "Menu/MenuMaker.h"

#include <time.h>
#include <locale.h>
#include <shellapi.h>
#ifdef __GNUC__
#include <shlwapi.h>
#endif

#define ST static

const struct cfgmenu tb_sub_placement[] = {
	{ NLS0(_T("Top Left"))      , _T("@Toolbar TopLeft")       , &Settings_toolbarPlacement },
	{ NLS0(_T("Top Center"))    , _T("@Toolbar TopCenter")     , &Settings_toolbarPlacement },
	{ NLS0(_T("Top Right"))     , _T("@Toolbar TopRight")      , &Settings_toolbarPlacement },
	{ NLS0(_T("Bottom Left"))   , _T("@Toolbar BottomLeft")    , &Settings_toolbarPlacement },
	{ NLS0(_T("Bottom Center")) , _T("@Toolbar BottomCenter")  , &Settings_toolbarPlacement },
	{ NLS0(_T("Bottom Right"))  , _T("@Toolbar BottomRight")   , &Settings_toolbarPlacement },
	{ NULL }
};

const struct cfgmenu tb_sub_settings[] = {
	{ NLS0(_T("Width Percent")),      _T("@ToolbarWidthPercent"), &Settings_toolbarWidthPercent },
	{ NLS0(_T("Clock Format")),       _T("@ToolbarClockFormat"), Settings_toolbarStrftimeFormat },
	{ NLS0(_T("Toggle With Plugins")), _T("@ToolbarTogglePlugins"), &Settings_toolbarPluginToggle },
	{ NLS0(_T("Transparency")),       _T("@ToolbarAlphaEnabled"), &Settings_toolbarAlphaEnabled },
	{ NLS0(_T("Alpha Value")),        _T("@ToolbarAlphaValue"), &Settings_toolbarAlphaValue },
	{ NULL }
Esempio n. 11
0
void Toolbar_ShowMenu(bool popup)
{
    char menu_id[200]; strcpy(menu_id, "IDRoot_configuration_TB");
    ShowMenu(CfgMenuMaker(NLS0("Toolbar"), tb_main, popup, menu_id));
}
Esempio n. 12
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
    }
}
Esempio n. 13
0
ToolbarInfo TBInfo;

#ifndef BBTINY

#include "Settings.h"
#include "MessageManager.h"
#include "Workspaces.h"
#include "Menu/MenuMaker.h"
#include <time.h>
#include <locale.h>
#include <shellapi.h>



static const struct cfgmenu tb_sub_placement[] = {
    { NLS0("Top Left")      , "placement topLeft"       , &Settings_toolbar.placement },
    { NLS0("Top Center")    , "placement topCenter"     , &Settings_toolbar.placement },
    { NLS0("Top Right")     , "placement topRight"      , &Settings_toolbar.placement },
    { NLS0("Bottom Left")   , "placement bottomLeft"    , &Settings_toolbar.placement },
    { NLS0("Bottom Center") , "placement bottomCenter"  , &Settings_toolbar.placement },
    { NLS0("Bottom Right")  , "placement bottomRight"   , &Settings_toolbar.placement },
    { NULL }
};

static const struct cfgmenu tb_sub_settings[] = {
    { NLS0("Width Percent") ,   "widthPercent", &Settings_toolbar.widthPercent },
    { NLS0("Clock Format")  ,   "clockFormat", Settings_toolbar.strftimeFormat },
    { NLS0("Toggle With Plugins"),  "togglePlugins", &Settings_toolbar.pluginToggle },
    { NLS0("Transparency")  ,   "alphaEnabled", &Settings_toolbar.alphaEnabled },
    { NLS0("Alpha Value")   ,   "alphaValue", &Settings_toolbar.alphaValue },
    { NULL }