Exemplo n.º 1
0
static BOOL task_enum_func(tasklist const * tl, LPARAM lParam)
{
    struct en* en = (struct en *)lParam;
    bool is_top = tl->hwnd == en->hwndTop;
    bool iconic = !is_top && IsIconic(tl->hwnd);
    en->i++;
    if ((en->desk == -1 && iconic) // iconic tasks
     || (en->desk == tl->wkspc // tasks for one workspace
        && ((en->flags & e_alltasks) || false == iconic)))
    {
        char buf[100];
        MenuItem *mi;

        sprintf(buf, "@BBCore.ActivateWindow %d", en->i);
        mi = MakeMenuItem(en->m, tl->caption, buf, is_top);
//#ifdef BBOPT_MENUICONS
        if (tl->icon && Settings_menu.iconSize) /* BlackboxZero 1.3.2012 */
            MenuItemOption(mi, BBMENUITEM_SETHICON, tl->icon);
//#endif
        if (en->desk != -1) {
            sprintf(buf, "@BBCore.MinimizeWindow %d", en->i);
            MenuItemOption(mi, BBMENUITEM_RCOMMAND, buf);
            if (iconic)
                MenuItemOption(mi, BBMENUITEM_DISABLED);
        }
        en->n ++;
    }
    return TRUE;
}
Exemplo n.º 2
0
//===========================================================================
static BOOL CALLBACK recoverwindow_enum_proc(HWND hwnd, LPARAM lParam)
{
    char windowtext[100];
    char classname[100];
    char appname[100];
    char broam[100];
    char text[400];
    RECT r;
    MenuItem *mi;

    if (IsWindowEnabled(hwnd) && (IsIconic(hwnd)
        || (GetClientRect(hwnd, &r) && r.right && r.bottom))
        && GetWindowText(hwnd, windowtext, sizeof(windowtext)))
    {
        classname[0] = 0;
        //GetClassName(hwnd, classname, sizeof classname);
        GetAppByWindow(hwnd, appname);

        sprintf (broam, "@BBCore.RecoverWindow %p", hwnd);
        sprintf (text, "%s : \"%s\"", appname, windowtext);
        mi = MakeMenuItem((Menu*)lParam, text, broam, FALSE != IsWindowVisible(hwnd));
        MenuItemOption(mi, BBMENUITEM_JUSTIFY, DT_LEFT);
    }
    return TRUE;
}
Exemplo n.º 3
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;
}
Exemplo n.º 4
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;
}
Exemplo n.º 5
0
static BOOL task_enum_func(struct tasklist *tl, LPARAM lParam)
{
	struct en * en = (struct en *)lParam;
	int k = IsIconic(tl->hwnd);
	if ((k && en->desk < 0) || (0 == k && en->desk == tl->wkspc))
	{
		char buf[80];
		sprintf(buf, "@BBCore.ActivateTask %d", en->i+1);
		MakeMenuItem(en->m, tl->caption, buf, en->desk >= 0 && tl->hwnd == en->hwndTop);
	}
	en->i++;
	return TRUE;
}
Exemplo n.º 6
0
/** @brief Add submenu for tasks configuration
  *
  * @param[in,out] pMenu Menu pointer to which items can be added
  *
  * This adds the submenu for general task properties (as read from the RC file by TaskArea)
  * as well as specific task properties (as read by Task). The messages generated will be
  * handled separately by these two classes
  */
void TaskArea::configMenu(Menu *pMenu, bool p_update)
{
	CHAR buffer[256];
	LPCSTR menuTitle = "Tasks Configuration";
	sprintf(buffer, "%s.%s", m_pluginPrefix, m_itemPrefix);
	Menu *subMenu = MakeNamedMenu(menuTitle, buffer, !p_update);
	if (!p_update)
	{
		MakeSubmenu(pMenu, subMenu, menuTitle);
	}
	sprintf(buffer, "@%s.%s.%s", m_pluginPrefix, m_basePrefix.c_str(), "ShowIcon");
	MakeMenuItem(subMenu, "Display Icon", buffer, s_settingsManager.AssociateBool(m_pluginPrefix, m_basePrefix.c_str(), "ShowIcon", true));
	sprintf(buffer, "@%s.%s.%s", m_pluginPrefix, m_basePrefix.c_str(), "ShowText");
	MakeMenuItem(subMenu, "Display Title", buffer, s_settingsManager.AssociateBool(m_pluginPrefix, m_basePrefix.c_str(), "ShowText", true));
	sprintf(buffer, "@%s.%s.%s", m_pluginPrefix, m_basePrefix.c_str(), "IconSize");
	MakeMenuItemInt(subMenu, "Icon size", buffer, s_settingsManager.AssociateUInt(m_pluginPrefix, "Tasks", "IconSize", 16), 0, 256);
	sprintf(buffer, "@%s.%s.%s", m_pluginPrefix, m_basePrefix.c_str(), "Maxsize.X");
	MakeMenuItemInt(subMenu, "Maximum TaskWidth", buffer, s_settingsManager.AssociateInt(m_pluginPrefix, m_basePrefix.c_str(), "MaxSize.x", 0), 0, 1000);
	if (p_update)
	{
		ShowMenu(subMenu);
	}
}
Exemplo n.º 7
0
void ShowMyMenu(bool popup)
{
    Menu *pMenu, *pSub;

    /* Create the main menu, with a title and an unique IDString */
    pMenu = MakeNamedMenu(szAppName, MENU_ID("Main"), popup);

    /* Create a submenu, also with title and unique IDString */
    pSub = MakeNamedMenu("Configuration", MENU_ID("Config"), popup);

    /* Insert first Item */
    MakeMenuItem(pSub, "Draw Border", BROAM("drawBorder"), my.drawBorder);

    if (g_hSlit)
        MakeMenuItem(pSub, "Use Slit", BROAM("useSlit"), my.useSlit);

    if (false == my.is_inslit)
    {
        /* these are only available if outside the slit */
        MakeMenuItem(pSub, "Always On Top", BROAM("alwaysOnTop"), my.alwaysOnTop);
        MakeMenuItem(pSub, "Snap To Edges", BROAM("snapWindow"), my.snapWindow);
        MakeMenuItem(pSub, "Toggle With Plugins", BROAM("pluginToggle"), my.pluginToggle);
        MakeMenuItem(pSub, "Transparency", BROAM("alphaEnabled"), my.alphaEnabled);
        MakeMenuItemInt(pSub, "Alpha Value", BROAM("alphaValue"), my.alphaValue, 0, 255);
    }

    /* Insert the submenu into the main menu */
    MakeSubmenu(pMenu, pSub, "Configuration");

    /* The configurable text string */
    MakeMenuItemString(pMenu, "Display Text", BROAM("windowText"), my.windowText);

    /* ---------------------------------- */
    /* add an empty line */
    MakeMenuNOP(pMenu, NULL);

    /* add an entry to let the user edit the setting file */
    MakeMenuItem(pMenu, "Edit Settings", BROAM("editRC"), false);

    /* and an about box */
    MakeMenuItem(pMenu, "About", BROAM("About"), false);

    /* ---------------------------------- */
    /* Finally, show the menu... */
    ShowMenu(pMenu);
}
Exemplo n.º 8
0
static int lua_AddMenuItem(lua_State *L)
{
	int hMenuObject = lua_tointeger(L, 1);

	if (lua_type(L, 2) != LUA_TTABLE)
	{
		lua_pushlightuserdata(L, 0);
		return 1;
	}

	CMenuItem mi;
	MakeMenuItem(L, mi);

	HGENMENU res = ::Menu_AddItem(hMenuObject, &mi, NULL);
	lua_pushlightuserdata(L, res);

	return 1;
}
Exemplo n.º 9
0
Menu* MakeProcessesMenu(bool popup)
{
	DWORD ph[1024];
	DWORD phs;
	if(!EnumProcesses(ph, 1024, &phs)) phs=0;
	phs/=sizeof(DWORD);
	char buff[128];
	sprintf(buff, "Process Killer Menu - %ld", phs);
	Menu *m = MakeNamedMenu(buff, "IDRoot_processes", popup);

	for (int i=phs-1; i>=0; i--){
		char name[128], buf[80];
		if (GetProcessName(ph[i], name)){
			sprintf(buf, "@KillProcess %ld", ph[i]);
			MakeMenuItem(m, name, buf, false);
		}
	}
	return m;
}
Exemplo n.º 10
0
void init_display(int argc, char **argv, MyProgram *me)
{
  Widget w[MAX_WIDGETS];


  if (OpenDisplay(argc, argv) == FALSE)
    return;

  /*  declare all the widgets
   */
  w[FILE_MENU_IDX] = MakeMenu("  File  ");
  w[OPTIONS_MENU_IDX] = MakeMenu(" Options ");
  w[DISPLAY_MENU_IDX] = MakeMenu(" Display ");
  w[CONTROL_MENU_IDX] = MakeMenu(" Control ");
  w[HELP_MENU_IDX] = MakeMenu("  Help  ");
  w[LABEL_IDX] = MakeLabel("         ");
  w[DRAW_AREA_IDX] = MakeDrawArea(SCREEN_X_SIZE, SCREEN_Y_SIZE, redisplay, me);
  w[STATUS_AREA_IDX] = MakeDrawArea(STATUS_X_SIZE, STATUS_Y_SIZE, redisplay_status, me);


  /*  add menu items to 'file' menu
   */
  w[FILE_LOAD_IDX] = MakeMenuItem(w[FILE_MENU_IDX], "Load Image ...", file_load, me);
  w[FILE_SAVE_IDX] = MakeMenuItem(w[FILE_MENU_IDX], "Save Image ...", file_save, me);
  w[FILE_QUIT_IDX] = MakeMenuItem(w[FILE_MENU_IDX], "Quit", file_quit, me);


  /*  add menu items to 'options' menu
   */
  w[OPT_ROM_IDX] = MakeMenuItem(w[OPTIONS_MENU_IDX], "ROM Setup ...", options_rom_setup, me);
  w[OPT_RAM_IDX] = MakeMenuItem(w[OPTIONS_MENU_IDX], "RAM Setup ...", options_ram_setup, me);
  w[OPT_CLOCK_IDX] = MakeMenuItem(w[OPTIONS_MENU_IDX], "Clock Setup ...", options_clock_setup, me);
  w[OPT_STAT_IDX] = MakeMenuItem(w[OPTIONS_MENU_IDX], "Status ...", options_status, me);


  /*  add menu items to 'display' menu
   */
  w[DIS_MPU_IDX] = MakeMenuItem(w[DISPLAY_MENU_IDX], "MPU", display_mpu, me);
  w[DIS_SYS_IDX] = MakeMenuItem(w[DISPLAY_MENU_IDX], "System", display_system, me);
  w[DIS_BOTH_IDX] = MakeMenuItem(w[DISPLAY_MENU_IDX], "MPU & System", display_both, me);
  w[DIS_IMAGE_IDX] = MakeMenuItem(w[DISPLAY_MENU_IDX], "Code Image", display_image, me);


  /*  add menu items to 'control' menu
   */
  w[CON_RESET_IDX] = MakeMenuItem(w[CONTROL_MENU_IDX], "Reset", control_reset, me);
  w[CON_STEP_IDX] = MakeMenuItem(w[CONTROL_MENU_IDX], "Step", control_step, me);
  w[CON_GO_IDX] = MakeMenuItem(w[CONTROL_MENU_IDX], "Go", control_go, me);
  w[CON_HALT_IDX] = MakeMenuItem(w[CONTROL_MENU_IDX], "Halt", control_halt, me);


  /*  add menu items to 'help' menu
   */
  w[HELP_ABOUT_IDX] = MakeMenuItem(w[HELP_MENU_IDX], "About ...", help_about, me);
  w[HELP_MENUS_IDX] = MakeMenuItem(w[HELP_MENU_IDX], "Menu Help ...", help_menu, me);
  w[HELP_KEYS_IDX] = MakeMenuItem(w[HELP_MENU_IDX], "Keys Help ...", help_keys, me);


  /*  callbacks for draw area 
   */
  SetButtonDownCB(w[DRAW_AREA_IDX], button_down);
  SetButtonUpCB(w[DRAW_AREA_IDX], button_up);
  SetMouseMotionCB(w[DRAW_AREA_IDX], motion);
  SetKeypressCB(w[DRAW_AREA_IDX], keypress);


  /*  set all the widgets' positions
   */
  SetWidgetPos(w[OPTIONS_MENU_IDX], PLACE_RIGHT, w[FILE_MENU_IDX], NO_CARE, NULL);
  SetWidgetPos(w[DISPLAY_MENU_IDX], PLACE_RIGHT, w[OPTIONS_MENU_IDX], NO_CARE, NULL);
  SetWidgetPos(w[CONTROL_MENU_IDX], PLACE_RIGHT, w[DISPLAY_MENU_IDX], NO_CARE, NULL);
  SetWidgetPos(w[HELP_MENU_IDX], PLACE_RIGHT, w[CONTROL_MENU_IDX], NO_CARE, NULL);
  SetWidgetPos(w[LABEL_IDX], PLACE_RIGHT, w[HELP_MENU_IDX], NO_CARE, NULL);
  SetWidgetPos(w[DRAW_AREA_IDX], PLACE_UNDER, w[FILE_MENU_IDX], NO_CARE, NULL);
  SetWidgetPos(w[STATUS_AREA_IDX], PLACE_UNDER, w[DRAW_AREA_IDX], NO_CARE, NULL);


  /* This call actually causes the whole thing to be displayed on the
   * screen.  You have to call this function before doing any drawing
   * into the window.
   */
  ShowDisplay();

  
  /* Get standard (red, blue, green, yellow, black, white) colors for
   * drawing stuff.  Check libsx.h for more info. 
   */
  GetStandardColors();
 
  SetFgColor(w[FILE_MENU_IDX], WHITE);
  SetBgColor(w[FILE_MENU_IDX], BLUE);

  SetFgColor(w[OPTIONS_MENU_IDX], WHITE);
  SetBgColor(w[OPTIONS_MENU_IDX], BLUE);

  SetFgColor(w[DISPLAY_MENU_IDX], WHITE);
  SetBgColor(w[DISPLAY_MENU_IDX], BLUE);

  SetFgColor(w[CONTROL_MENU_IDX], WHITE);
  SetBgColor(w[CONTROL_MENU_IDX], BLUE);

  SetFgColor(w[HELP_MENU_IDX], WHITE);
  SetBgColor(w[HELP_MENU_IDX], BLUE);

  SetFgColor(w[LABEL_IDX], BLACK);

  SetFgColor(w[DRAW_AREA_IDX], WHITE);
  SetBgColor(w[DRAW_AREA_IDX], BLACK);

  SetFgColor(w[STATUS_AREA_IDX], WHITE);
  SetBgColor(w[STATUS_AREA_IDX], BLACK);

  SetFgColor(w[FILE_LOAD_IDX], WHITE);
  SetFgColor(w[FILE_SAVE_IDX], WHITE);
  SetFgColor(w[FILE_QUIT_IDX], WHITE);
  SetBgColor(w[FILE_LOAD_IDX], BLUE);

  SetFgColor(w[OPT_ROM_IDX], WHITE);
  SetFgColor(w[OPT_RAM_IDX], WHITE);
  SetFgColor(w[OPT_CLOCK_IDX], WHITE);
  SetFgColor(w[OPT_STAT_IDX], WHITE);
  SetBgColor(w[OPT_RAM_IDX], BLUE);

  SetFgColor(w[DIS_MPU_IDX], WHITE);
  SetFgColor(w[DIS_SYS_IDX], WHITE);
  SetFgColor(w[DIS_BOTH_IDX], WHITE);
  SetFgColor(w[DIS_IMAGE_IDX], WHITE);
  SetBgColor(w[DIS_MPU_IDX], BLUE);

  SetFgColor(w[CON_RESET_IDX], WHITE);
  SetFgColor(w[CON_STEP_IDX], WHITE);
  SetFgColor(w[CON_GO_IDX], WHITE);
  SetFgColor(w[CON_HALT_IDX], WHITE);
  SetBgColor(w[CON_RESET_IDX], BLUE);

  SetFgColor(w[HELP_ABOUT_IDX], WHITE);
  SetFgColor(w[HELP_MENUS_IDX], WHITE);
  SetFgColor(w[HELP_KEYS_IDX], WHITE);
  SetBgColor(w[HELP_ABOUT_IDX], BLUE);

  /*  save drawing area widget 
   */
  me->draw_area_widget = w[DRAW_AREA_IDX];
  me->status_area_widget = w[STATUS_AREA_IDX];


  /* If you wanted to get all the colors in the colormap, you'd do the
   * following :
   *
   *    GetAllColors();
   *    SetColorMap(GREY_SCALE_1);
   *
   * You can wait to do it till later if you want.  There's no need 
   * to do it here if you don't need to (because it wacks out the
   * colormap).  
   */
}
Exemplo n.º 11
0
 MenuItem* _make_item(Menu *pMenu)
 {
     return MakeMenuItem(pMenu, text, menu->addid(cmd), checked);
 }
Exemplo n.º 12
0
void ShowMyMenu(bool popup)
{
	if (myMenu){ DelMenu(myMenu); myMenu = NULL;}

	configSubmenu = MakeNamedMenu("Configuration", "BBSB_Config", popup);
	MakeMenuItemInt(configSubmenu, "Width Size", "@BBSeekbarWidthSize", width, 16, ScreenWidth);
	MakeMenuItemInt(configSubmenu, "Height Size", "@BBSeekbarHeightSize", height, 12, ScreenHeight);
	MakeMenuNOP(configSubmenu, NULL);
	if(hSlit) MakeMenuItem(configSubmenu, "In Slit", "@BBSeekbarInSlit", inSlit);
	MakeMenuItem(configSubmenu, "Plugin Toggle", "@BBSeekbarPluginToggle", pluginToggle);
	MakeMenuItem(configSubmenu, "Always on Top", "@BBSeekbarOnTop", alwaysOnTop);
	MakeMenuItem(configSubmenu, "Transparency", "@BBSeekbarTransparent", transparency);
	MakeMenuItemInt(configSubmenu, "Alpha Value", "@BBSeekbarAlphaValue", alpha, 0, 255);
	MakeMenuItem(configSubmenu, "Snap To Edge", "@BBSeekbarSnapToEdge", snapWindow);
	MakeMenuItem(configSubmenu, "Show Border", "@BBSeekbarShowBorder", showBorder);
	MakeMenuItem(configSubmenu, "Allow Tooltip", "@BBSeekbarAllowTip", allowtip);

	playerSubmenu = MakeNamedMenu("Player", "BBSB_Player", popup);
	MakeMenuItem(playerSubmenu, "Winamp",     "@BBSeekbarPlayerType 0", (playerType == 0));
	MakeMenuItem(playerSubmenu, "foobar2000", "@BBSeekbarPlayerType 1", (playerType == 1));

	optionsSubmenu = MakeNamedMenu("Options", "BBSB_Options", popup);
	appearanceSubmenu = MakeNamedMenu("Appearance", "BBSB_Appearance", popup);
	MakeMenuItem(appearanceSubmenu, "Fill Bar",       "@BBSeekbarAppearance 0", (appearance == 0));
	MakeMenuItem(appearanceSubmenu, "Scroll Bar",     "@BBSeekbarAppearance 1", (appearance == 1));
	MakeMenuItem(appearanceSubmenu, "Track and Knob", "@BBSeekbarAppearance 2", (appearance == 2));
	MakeSubmenu(optionsSubmenu, appearanceSubmenu, "Appearance");

	MakeMenuItem(optionsSubmenu, "Vertical", "@BBSeekbarVertical", vertical);
	MakeMenuItem(optionsSubmenu, "Values Reversed", "@BBSeekbarReversed", reversed);

	styleSubmenu = MakeNamedMenu("Style Type", "BBSB_StyleType", popup);
	bgStyleSubmenu = MakeNamedMenu("Background", "BBSB_BGStyle", popup);
	MakeMenuItem(bgStyleSubmenu, "Toolbar",  "@BBSeekbarStyleType 1", (styleType == 1));
	MakeMenuItem(bgStyleSubmenu, "Button",   "@BBSeekbarStyleType 2", (styleType == 2));
	MakeMenuItem(bgStyleSubmenu, "ButtonP",  "@BBSeekbarStyleType 3", (styleType == 3));
	MakeMenuItem(bgStyleSubmenu, "Label",    "@BBSeekbarStyleType 4", (styleType == 4));
	MakeMenuItem(bgStyleSubmenu, "WinLabel", "@BBSeekbarStyleType 5", (styleType == 5));
	MakeMenuItem(bgStyleSubmenu, "Clock",    "@BBSeekbarStyleType 6", (styleType == 6));
	MakeSubmenu(styleSubmenu, bgStyleSubmenu, "Background");

	trackStyleSubmenu = MakeNamedMenu("Track", "BBSB_TrackStyle", popup);
	MakeMenuItem(trackStyleSubmenu, "Toolbar",  "@BBSeekbarTrackStyle 1", (trackStyleType == 1));
	MakeMenuItem(trackStyleSubmenu, "Button",   "@BBSeekbarTrackStyle 2", (trackStyleType == 2));
	MakeMenuItem(trackStyleSubmenu, "ButtonP",  "@BBSeekbarTrackStyle 3", (trackStyleType == 3));
	MakeMenuItem(trackStyleSubmenu, "Label",    "@BBSeekbarTrackStyle 4", (trackStyleType == 4));
	MakeMenuItem(trackStyleSubmenu, "WinLabel", "@BBSeekbarTrackStyle 5", (trackStyleType == 5));
	MakeMenuItem(trackStyleSubmenu, "Clock",    "@BBSeekbarTrackStyle 6", (trackStyleType == 6));
	MakeSubmenu(styleSubmenu, trackStyleSubmenu, "Track");

	knobStyleSubmenu = MakeNamedMenu("Knob", "BBSB_KnobStyle", popup);
	MakeMenuItem(knobStyleSubmenu, "Toolbar",  "@BBSeekbarKnobStyle 1", (knobStyleType == 1));
	MakeMenuItem(knobStyleSubmenu, "Button",   "@BBSeekbarKnobStyle 2", (knobStyleType == 2));
	MakeMenuItem(knobStyleSubmenu, "ButtonP",  "@BBSeekbarKnobStyle 3", (knobStyleType == 3));
	MakeMenuItem(knobStyleSubmenu, "Label",    "@BBSeekbarKnobStyle 4", (knobStyleType == 4));
	MakeMenuItem(knobStyleSubmenu, "WinLabel", "@BBSeekbarKnobStyle 5", (knobStyleType == 5));
	MakeMenuItem(knobStyleSubmenu, "Clock",    "@BBSeekbarKnobStyle 6", (knobStyleType == 6));
	MakeSubmenu(styleSubmenu, knobStyleSubmenu, "Knob");


	settingsSubmenu = MakeNamedMenu("Settings", "BBSB_Settings", popup);
	MakeMenuItem(settingsSubmenu, "Edit Settings",   "@BBSeekbarEditRC", false);
	MakeMenuItem(settingsSubmenu, "Reload Settings", "@BBSeekbarReloadSettings", false);
	MakeMenuItem(settingsSubmenu, "Save Settings",   "@BBSeekbarSaveSettings", false);

	myMenu = MakeNamedMenu("BBSeekbar", "BBSB_Main", popup);
	MakeSubmenu(myMenu, configSubmenu, "Configuration");
	MakeSubmenu(myMenu, playerSubmenu, "Player");
	MakeSubmenu(myMenu, optionsSubmenu, "Options");
	MakeSubmenu(myMenu, styleSubmenu, "Style Type");
	MakeSubmenu(myMenu, settingsSubmenu, "Settings");
  	MakeMenuItem(myMenu, "About", "@BBSeekbarAbout", false);
	ShowMenu(myMenu);
}
Exemplo n.º 13
0
 MenuItem* _make_item(Menu *pMenu)
 {
     return MakeMenuItem(pMenu, text, menu->addid(cmd), false);
 }
Exemplo n.º 14
0
void make_menuitem_bol(Menu *m, const char *title, const char* cmd, bool checked)
{
	MakeMenuItem(m, title, cmd, checked);
}
Exemplo n.º 15
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;
}
Exemplo n.º 16
0
void make_menuitem_cmd(Menu *m, const char *title, const char* cmd)
{
	MakeMenuItem(m, title, cmd, false);
}
Exemplo n.º 17
0
int init_display(int argc, char **argv, MyProgram *me)
{
  Widget w[25];

  argc = OpenDisplay(argc, argv);
  if (argc == FALSE)
    return argc;


  w[0]  = MakeMenu("File");
  w[1]  = MakeMenuItem(w[0], "Load...",  load, me);
  w[2]  = MakeMenuItem(w[0], "Save...",  save, me);
  w[3]  = MakeMenuItem(w[0], "Quit",     quit, me);
 
  w[4]  = MakeMenu("Edit");
  w[5]  = MakeMenuItem(w[4], "Check me", check_me, me);
  w[6]  = MakeMenuItem(w[4], "Copy",  NULL, NULL);
  w[7]  = MakeMenuItem(w[4], "Paste", NULL, NULL);
  
  w[8]  = MakeButton("Color Stuff", do_stuff,   me); 
  w[9]  = MakeButton("More Stuff",  more_stuff, me);
  w[10] = MakeButton("Quit!",       quit,       me);

  w[11] = MakeDrawArea(X_SIZE, Y_SIZE, redisplay, me);
  w[12] = MakeScrollList(string_table, 125, 275, list_callback, NULL);
  
  w[13] = MakeHorizScrollbar(X_SIZE, scroll_func, me);
  w[14] = MakeHorizScrollbar(X_SIZE, scroll_func, me);
  w[15] = MakeVertScrollbar(Y_SIZE, scroll_func, me);

  w[16] = MakeToggle("Slow",    TRUE,  NULL,  toggle1, me);
  w[17] = MakeToggle("Fast",    FALSE, w[16], toggle2, me);
  w[18] = MakeToggle("Faster",  FALSE, w[16], toggle3, me);
  w[19] = MakeToggle("Fastest", FALSE, w[16], toggle4, me);

  w[20] = MakeToggle("Toggle me", FALSE, NULL, other_toggle, me);

  w[21] = MakeStringEntry("button.c", 435, string_func, me);
  w[22] = MakeTextWidget("button.c", TRUE, TRUE, 435, 200);
  w[23] = MakeLabel("   A Sample Libsx Demo Program (cool huh?)");


  SetWidgetPos(w[4],  PLACE_RIGHT, w[0], NO_CARE, NULL);

  SetWidgetPos(w[8],  PLACE_UNDER, w[0], NO_CARE,     NULL);
  SetWidgetPos(w[9],  PLACE_UNDER, w[0], PLACE_RIGHT, w[8]);
  SetWidgetPos(w[10], PLACE_UNDER, w[0], PLACE_RIGHT, w[9]);

  SetWidgetPos(w[11], PLACE_UNDER, w[8], NO_CARE, NULL); 

  SetWidgetPos(w[13], PLACE_UNDER, w[11], NO_CARE, NULL);
  SetWidgetPos(w[14], PLACE_UNDER, w[13], NO_CARE, NULL);
  SetWidgetPos(w[15], PLACE_RIGHT, w[11], PLACE_UNDER, w[8]);

  SetWidgetPos(w[12], PLACE_RIGHT, w[15], PLACE_UNDER, w[8]);

  SetWidgetPos(w[16], PLACE_RIGHT, w[13], PLACE_UNDER, w[15]);
  SetWidgetPos(w[17], PLACE_RIGHT, w[16], PLACE_UNDER, w[15]);
  SetWidgetPos(w[18], PLACE_RIGHT, w[13], PLACE_UNDER, w[16]);
  SetWidgetPos(w[19], PLACE_RIGHT, w[18], PLACE_UNDER, w[16]);

  SetWidgetPos(w[20], PLACE_RIGHT, w[10], PLACE_UNDER, w[0]);
  SetWidgetPos(w[21], PLACE_UNDER, w[18], NO_CARE, NULL);
  SetWidgetPos(w[22], PLACE_UNDER, w[21], NO_CARE, NULL);
  SetWidgetPos(w[23], PLACE_RIGHT, w[4],  NO_CARE, NULL);


  /*
   * initialize the state of the toggle variables.
   */
  me->toggle1 = TRUE;
  me->toggle2 = me->toggle3 = me->toggle4 = me->other_toggle = FALSE;

  me->list         = w[12];   /* save these widget values for later */
  me->str_entry    = w[21];
  me->text_widget  = w[22];
  me->draw_widget  = w[11];
  me->quit         = w[10];
  me->color_widget = w[8];

  me->draw_font = GetFont("10x20");
  if (me->draw_font == NULL)
    me->draw_font = GetFont("fixed");

  SetWidgetFont(me->draw_widget, me->draw_font);

  SetButtonDownCB(w[11], button_down);
  SetButtonUpCB(w[11],   button_up);
  SetKeypressCB(w[11],   keypress);

  SetScrollbar(w[13],   3.0,  14.0, 14.0);
  SetScrollbar(w[14], 250.0, 255.0,  1.0);
  SetScrollbar(w[15],  30.0, 100.0, 25.0);

  /*
   * Now actually put the display on the screen.
   */
  ShowDisplay();


  /*
   * Get some colors for drawing with.
   */
  GetStandardColors();

  me->col1 = GetNamedColor("peachpuff2");
  if (me->col1 == -1)
    fprintf(stderr, "Error getting color peachpuff\n");

  me->col2 = GetRGBColor(255, 0, 255);
  if (me->col2 == -1)
    fprintf(stderr, "Error getting RGB color 0 255 255\n");

  return argc;
}
Exemplo n.º 18
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
    }
}
Exemplo n.º 19
0
void createMenu()
{
	bool tempBool = false;

	if(myMenu){ DelMenu(myMenu); myMenu = NULL;}
		
			//Now we define all menus and submenus
			
			otherSubmenu = MakeMenu("Other");

			MakeMenuItem(otherSubmenu, "Draw Border", "@BBNoterDrawBorder", drawBorder);
			MakeMenuItemInt(otherSubmenu, "Width", "@BBNoterWidth", width, 20, 400);
			MakeMenuItemInt(otherSubmenu, "Height", "@BBNoterHeight", height, 20, 400);
		//	MakeMenuItemInt(otherSubmenu, "Font Size", "@BBNoterFontSize", fontSize, 6, width/3);
	
			windowStyleSubmenu = MakeMenu("Style");
			//MakeMenuNOP(windowStyleSubmenu, "___________________");
			if(StrStrI(windowStyle, "toolbar") != NULL) tempBool = true;
			MakeMenuItem(windowStyleSubmenu, "toolbar:", "@BBNoterStyleToolbar", tempBool);
			tempBool = false;
			if(StrStrI(windowStyle, "buttonnp") != NULL) tempBool = true;
			MakeMenuItem(windowStyleSubmenu, "toolbar.button:", "@BBNoterStyleButton", tempBool);
			tempBool = false;
			if(StrStrI(windowStyle, "buttonpr") != NULL) tempBool = true;
			MakeMenuItem(windowStyleSubmenu, "toolbar.button.pressed:", "@BBNoterStyleButtonPr", tempBool);
			tempBool = false;
			if(StrStrI(windowStyle, "label") != NULL && strlen(windowStyle) < 6) tempBool = true;
			MakeMenuItem(windowStyleSubmenu, "toolbar.label:", "@BBNoterStyleLabel", tempBool);
			tempBool = false;
			if(StrStrI(windowStyle, "windowlabel") != NULL) tempBool = true;
			MakeMenuItem(windowStyleSubmenu, "toolbar.windowLabel:", "@BBNoterStyleWindowLabel", tempBool);
			tempBool = false;
			if(StrStrI(windowStyle, "clock") != NULL) tempBool = true;
			MakeMenuItem(windowStyleSubmenu, "toolbar.clock:", "@BBNoterStyleClock", tempBool);
					
			configSubmenu = MakeMenu("Configuration");

			generalConfigSubmenu = MakeMenu("General");
			if(hSlit) MakeMenuItem(generalConfigSubmenu, "In Slit", "@BBNoterSlit", wantInSlit);
			MakeMenuItem(generalConfigSubmenu, "Toggle with Plugins", "@BBNoterPluginToggle", pluginToggle);
			MakeMenuItem(generalConfigSubmenu, "Always on top", "@BBNoterOnTop", alwaysOnTop);
			if ((dwId == VER_PLATFORM_WIN32_NT)&&(dwMajorVer > 4))
				MakeMenuItem(generalConfigSubmenu, "Transparency", "@BBNoterTransparent", transparency);
			if ((dwId == VER_PLATFORM_WIN32_NT)&&(dwMajorVer > 4))
				MakeMenuItemInt(generalConfigSubmenu, "Set Transparency", "@BBNoterSetTransparent",alpha,0,255);
			if ((dwId == VER_PLATFORM_WIN32_NT)&&(dwMajorVer > 4))
				MakeMenuItem(generalConfigSubmenu, "Transparent Background", "@BBNoterFullTrans", fullTrans);
			MakeMenuItem(generalConfigSubmenu, "Snap Window To Edge", "@BBNoterSnapToEdge", snapWindow);

			browseSubmenu = MakeMenu("Browse");
			MakeMenuItem(browseSubmenu, "Browse...", "@BBNoterLoadBitmap", false);

			bitmapSubmenu = MakeMenu("Bitmap");
			MakeSubmenu(bitmapSubmenu, browseSubmenu, "Bitmap");
			MakeMenuItem(bitmapSubmenu, "Nothing", "@BBNoterNoBitmap", noBitmap);

			settingsSubmenu = MakeMenu("Settings");
			MakeMenuItem(settingsSubmenu, "Edit Settings", "@BBNoterEditRC", false);
			MakeMenuItem(settingsSubmenu, "Reload Settings", "@BBNoterReloadSettings", false);
			MakeMenuItem(settingsSubmenu, "Save Settings", "@BBNoterSaveSettings", false);
			
		/*	ratioSubmenu = MakeMenu("Ratio");
			tempBool = false;
			if (ratio == 1) tempBool = true;
			MakeMenuItem(ratioSubmenu, "1x", "@BBNoterRatio 1", tempBool);
			tempBool = false;
			if (ratio == 2) tempBool = true;
			MakeMenuItem(ratioSubmenu, "2x", "@BBNoterRatio 2", tempBool);
			tempBool = false;
			if (ratio == 4) tempBool = true;
			MakeMenuItem(ratioSubmenu, "4x", "@BBNoterRatio 4", tempBool);
			tempBool = false;
			if (ratio == 8) tempBool = true;
			MakeMenuItem(ratioSubmenu, "8x", "@BBNoterRatio 8", tempBool);
			tempBool = false;
			if (ratio == 16) tempBool = true;
			MakeMenuItem(ratioSubmenu, "16x", "@BBNoterRatio 16", tempBool);
			tempBool = false;
			if (ratio == 32) tempBool = true;
			MakeMenuItem(ratioSubmenu, "32x", "@BBNoterRatio 32", tempBool);
		*/	//attach defined menus together
			myMenu = MakeMenu("BBNoter 1.0");
			
		//	MakeSubmenu(configSubmenu, ratioSubmenu, "Ratio");
			MakeSubmenu(configSubmenu, windowStyleSubmenu, "Style");
			MakeSubmenu(configSubmenu, generalConfigSubmenu, "General");
			MakeSubmenu(configSubmenu, otherSubmenu, "Other");
			MakeSubmenu(configSubmenu, bitmapSubmenu, "Image");
			
			MakeSubmenu(myMenu, configSubmenu, "Configuration");
			MakeSubmenu(myMenu, settingsSubmenu, "Settings");
			MakeMenuItem(myMenu, "About", "@BBNoterAbout", false);
			ShowMenu(myMenu);
}