mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-26 18:41:20 +00:00
Add option to enable/disable automatic menu bar items popup (related to issue #501)
This commit is contained in:
parent
4188fa1408
commit
bb24d8b995
@ -22,6 +22,7 @@
|
|||||||
<combobox id="screen_scale" />
|
<combobox id="screen_scale" />
|
||||||
</hbox>
|
</hbox>
|
||||||
<check text="Show timeline automatically" id="autotimeline" tooltip="Show the timeline automatically when a new frame or layer is added." />
|
<check text="Show timeline automatically" id="autotimeline" tooltip="Show the timeline automatically when a new frame or layer is added." />
|
||||||
|
<check text="Expand menu bar items on mouseover" id="expand_menubar_on_mouseover" tooltip="Check this option to get this old menus behavior." />
|
||||||
<separator horizontal="true" />
|
<separator horizontal="true" />
|
||||||
<link id="locate_file" text="Locate Configuration File" />
|
<link id="locate_file" text="Locate Configuration File" />
|
||||||
<link id="locate_crash_folder" text="Locate Crash Folder" />
|
<link id="locate_crash_folder" text="Locate Crash Folder" />
|
||||||
|
@ -74,6 +74,10 @@ public:
|
|||||||
if (get_config_bool("Options", "AutoShowTimeline", true))
|
if (get_config_bool("Options", "AutoShowTimeline", true))
|
||||||
autotimeline()->setSelected(true);
|
autotimeline()->setSelected(true);
|
||||||
|
|
||||||
|
if (get_config_bool("Options", "ExpandMenuBarOnMouseover",
|
||||||
|
ui::MenuBar::expandOnMouseover()))
|
||||||
|
expandMenubarOnMouseover()->setSelected(true);
|
||||||
|
|
||||||
if (m_settings->experimental()->useNativeCursor())
|
if (m_settings->experimental()->useNativeCursor())
|
||||||
nativeCursor()->setSelected(true);
|
nativeCursor()->setSelected(true);
|
||||||
|
|
||||||
@ -143,6 +147,10 @@ public:
|
|||||||
|
|
||||||
set_config_bool("Options", "AutoShowTimeline", autotimeline()->isSelected());
|
set_config_bool("Options", "AutoShowTimeline", autotimeline()->isSelected());
|
||||||
|
|
||||||
|
bool expandOnMouseover = expandMenubarOnMouseover()->isSelected();
|
||||||
|
set_config_bool("Options", "ExpandMenuBarOnMouseover", expandOnMouseover);
|
||||||
|
ui::MenuBar::setExpandOnMouseover(expandOnMouseover);
|
||||||
|
|
||||||
m_settings->setShowSpriteEditorScrollbars(showScrollbars()->isSelected());
|
m_settings->setShowSpriteEditorScrollbars(showScrollbars()->isSelected());
|
||||||
m_settings->setZoomWithScrollWheel(wheelZoom()->isSelected());
|
m_settings->setZoomWithScrollWheel(wheelZoom()->isSelected());
|
||||||
m_settings->setRightClickMode(static_cast<RightClickMode>(rightClickBehavior()->getSelectedItemIndex()));
|
m_settings->setRightClickMode(static_cast<RightClickMode>(rightClickBehavior()->getSelectedItemIndex()));
|
||||||
@ -223,6 +231,9 @@ OptionsCommand::OptionsCommand()
|
|||||||
"Options",
|
"Options",
|
||||||
CmdUIOnlyFlag)
|
CmdUIOnlyFlag)
|
||||||
{
|
{
|
||||||
|
ui::MenuBar::setExpandOnMouseover(
|
||||||
|
get_config_bool("Options", "ExpandMenuBarOnMouseover",
|
||||||
|
ui::MenuBar::expandOnMouseover()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionsCommand::onExecute(Context* context)
|
void OptionsCommand::onExecute(Context* context)
|
||||||
|
@ -123,6 +123,9 @@ static MenuItem* check_for_letter(Menu* menu, int ascii);
|
|||||||
static MenuItem* find_nextitem(Menu* menu, MenuItem* menuitem);
|
static MenuItem* find_nextitem(Menu* menu, MenuItem* menuitem);
|
||||||
static MenuItem* find_previtem(Menu* menu, MenuItem* menuitem);
|
static MenuItem* find_previtem(Menu* menu, MenuItem* menuitem);
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// Menu
|
||||||
|
|
||||||
Menu::Menu()
|
Menu::Menu()
|
||||||
: Widget(kMenuWidget)
|
: Widget(kMenuWidget)
|
||||||
, m_menuitem(NULL)
|
, m_menuitem(NULL)
|
||||||
@ -142,6 +145,9 @@ Menu::~Menu()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// MenuBox
|
||||||
|
|
||||||
MenuBox::MenuBox(WidgetType type)
|
MenuBox::MenuBox(WidgetType type)
|
||||||
: Widget(type)
|
: Widget(type)
|
||||||
, m_base(NULL)
|
, m_base(NULL)
|
||||||
@ -160,12 +166,32 @@ MenuBox::~MenuBox()
|
|||||||
delete m_base;
|
delete m_base;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// MenuBar
|
||||||
|
|
||||||
|
bool MenuBar::m_expandOnMouseover = false;
|
||||||
|
|
||||||
MenuBar::MenuBar()
|
MenuBar::MenuBar()
|
||||||
: MenuBox(kMenuBarWidget)
|
: MenuBox(kMenuBarWidget)
|
||||||
{
|
{
|
||||||
createBase();
|
createBase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
bool MenuBar::expandOnMouseover()
|
||||||
|
{
|
||||||
|
return m_expandOnMouseover;
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
void MenuBar::setExpandOnMouseover(bool state)
|
||||||
|
{
|
||||||
|
m_expandOnMouseover = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// MenuItem
|
||||||
|
|
||||||
MenuItem::MenuItem(const std::string& text)
|
MenuItem::MenuItem(const std::string& text)
|
||||||
: Widget(kMenuItemWidget)
|
: Widget(kMenuItemWidget)
|
||||||
{
|
{
|
||||||
@ -687,7 +713,7 @@ bool MenuItem::onProcessMessage(Message* msg)
|
|||||||
// When a menu item receives the mouse, start a timer to open the submenu...
|
// When a menu item receives the mouse, start a timer to open the submenu...
|
||||||
if (isEnabled() && hasSubmenu()) {
|
if (isEnabled() && hasSubmenu()) {
|
||||||
// Start the timer to open the submenu...
|
// Start the timer to open the submenu...
|
||||||
if (!inBar())
|
if (!inBar() || MenuBar::expandOnMouseover())
|
||||||
startTimer();
|
startTimer();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -88,6 +88,12 @@ namespace ui {
|
|||||||
class MenuBar : public MenuBox {
|
class MenuBar : public MenuBox {
|
||||||
public:
|
public:
|
||||||
MenuBar();
|
MenuBar();
|
||||||
|
|
||||||
|
static bool expandOnMouseover();
|
||||||
|
static void setExpandOnMouseover(bool state);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static bool m_expandOnMouseover;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MenuItem : public Widget {
|
class MenuItem : public Widget {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user