mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-26 09:41:05 +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" />
|
||||
</hbox>
|
||||
<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" />
|
||||
<link id="locate_file" text="Locate Configuration File" />
|
||||
<link id="locate_crash_folder" text="Locate Crash Folder" />
|
||||
|
@ -74,6 +74,10 @@ public:
|
||||
if (get_config_bool("Options", "AutoShowTimeline", true))
|
||||
autotimeline()->setSelected(true);
|
||||
|
||||
if (get_config_bool("Options", "ExpandMenuBarOnMouseover",
|
||||
ui::MenuBar::expandOnMouseover()))
|
||||
expandMenubarOnMouseover()->setSelected(true);
|
||||
|
||||
if (m_settings->experimental()->useNativeCursor())
|
||||
nativeCursor()->setSelected(true);
|
||||
|
||||
@ -143,6 +147,10 @@ public:
|
||||
|
||||
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->setZoomWithScrollWheel(wheelZoom()->isSelected());
|
||||
m_settings->setRightClickMode(static_cast<RightClickMode>(rightClickBehavior()->getSelectedItemIndex()));
|
||||
@ -223,6 +231,9 @@ OptionsCommand::OptionsCommand()
|
||||
"Options",
|
||||
CmdUIOnlyFlag)
|
||||
{
|
||||
ui::MenuBar::setExpandOnMouseover(
|
||||
get_config_bool("Options", "ExpandMenuBarOnMouseover",
|
||||
ui::MenuBar::expandOnMouseover()));
|
||||
}
|
||||
|
||||
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_previtem(Menu* menu, MenuItem* menuitem);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Menu
|
||||
|
||||
Menu::Menu()
|
||||
: Widget(kMenuWidget)
|
||||
, m_menuitem(NULL)
|
||||
@ -142,6 +145,9 @@ Menu::~Menu()
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// MenuBox
|
||||
|
||||
MenuBox::MenuBox(WidgetType type)
|
||||
: Widget(type)
|
||||
, m_base(NULL)
|
||||
@ -160,12 +166,32 @@ MenuBox::~MenuBox()
|
||||
delete m_base;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// MenuBar
|
||||
|
||||
bool MenuBar::m_expandOnMouseover = false;
|
||||
|
||||
MenuBar::MenuBar()
|
||||
: MenuBox(kMenuBarWidget)
|
||||
{
|
||||
createBase();
|
||||
}
|
||||
|
||||
// static
|
||||
bool MenuBar::expandOnMouseover()
|
||||
{
|
||||
return m_expandOnMouseover;
|
||||
}
|
||||
|
||||
// static
|
||||
void MenuBar::setExpandOnMouseover(bool state)
|
||||
{
|
||||
m_expandOnMouseover = state;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// MenuItem
|
||||
|
||||
MenuItem::MenuItem(const std::string& text)
|
||||
: 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...
|
||||
if (isEnabled() && hasSubmenu()) {
|
||||
// Start the timer to open the submenu...
|
||||
if (!inBar())
|
||||
if (!inBar() || MenuBar::expandOnMouseover())
|
||||
startTimer();
|
||||
}
|
||||
break;
|
||||
|
@ -88,6 +88,12 @@ namespace ui {
|
||||
class MenuBar : public MenuBox {
|
||||
public:
|
||||
MenuBar();
|
||||
|
||||
static bool expandOnMouseover();
|
||||
static void setExpandOnMouseover(bool state);
|
||||
|
||||
private:
|
||||
static bool m_expandOnMouseover;
|
||||
};
|
||||
|
||||
class MenuItem : public Widget {
|
||||
|
Loading…
x
Reference in New Issue
Block a user