Load Scripts menu before loading keyboard shortcuts

In this way we can see the keyboard shortcuts to run scripts when the
menus are loaded for the first time.
This commit is contained in:
David Capello 2018-09-13 11:56:39 -03:00
parent 6108d2d5ad
commit 2b3e386d15

View File

@ -347,27 +347,6 @@ void AppMenus::reload()
m_palettePopupMenu.reset(loadMenuById(handle, "palette_popup_menu"));
m_inkPopupMenu.reset(loadMenuById(handle, "ink_popup_menu"));
////////////////////////////////////////
// Load keyboard shortcuts for commands
LOG("MENU: Loading commands keyboard shortcuts from %s\n", path);
TiXmlElement* xmlKey = handle
.FirstChild("gui")
.FirstChild("keyboard").ToElement();
KeyboardShortcuts::instance()->clear();
KeyboardShortcuts::instance()->importFile(xmlKey, KeySource::Original);
// Load user settings
{
ResourceFinder rf;
rf.includeUserDir("user.aseprite-keys");
std::string fn = rf.getFirstOrCreateDefault();
if (base::is_file(fn))
KeyboardShortcuts::instance()->importFile(fn, KeySource::UserDefined);
}
// Add one menu item to run each script from the user scripts/ folder
{
MenuItem* scriptsMenu = dynamic_cast<MenuItem*>(
@ -390,6 +369,27 @@ void AppMenus::reload()
#endif
}
////////////////////////////////////////
// Load keyboard shortcuts for commands
LOG("MENU: Loading commands keyboard shortcuts from %s\n", path);
TiXmlElement* xmlKey = handle
.FirstChild("gui")
.FirstChild("keyboard").ToElement();
KeyboardShortcuts::instance()->clear();
KeyboardShortcuts::instance()->importFile(xmlKey, KeySource::Original);
// Load user settings
{
ResourceFinder rf;
rf.includeUserDir("user.aseprite-keys");
std::string fn = rf.getFirstOrCreateDefault();
if (base::is_file(fn))
KeyboardShortcuts::instance()->importFile(fn, KeySource::UserDefined);
}
// Create native menus after the default + user defined keyboard
// shortcuts are loaded correctly.
createNativeMenus();