mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-29 19:20:09 +00:00
Fix showing keyboard shortcuts on AniControls tooltips
This commit is contained in:
parent
61d1e7c46c
commit
7f21deb4d5
@ -95,6 +95,16 @@ MainWindow::MainWindow()
|
||||
{
|
||||
m_tooltipManager = new TooltipManager();
|
||||
m_menuBar = new MainMenuBar();
|
||||
|
||||
// Register commands to load menus+shortcuts for these commands
|
||||
Editor::registerCommands();
|
||||
|
||||
// Load all menus+keys for the first time
|
||||
AppMenus::instance()->reload();
|
||||
|
||||
// Setup the main menubar
|
||||
m_menuBar->setMenu(AppMenus::instance()->getRootMenu());
|
||||
|
||||
m_notifications = new Notifications();
|
||||
m_contextBar = new ContextBar(m_tooltipManager);
|
||||
m_statusBar = new StatusBar(m_tooltipManager);
|
||||
@ -104,9 +114,10 @@ MainWindow::MainWindow()
|
||||
m_tabsBar = new WorkspaceTabs(this);
|
||||
m_workspace = new Workspace();
|
||||
m_previewEditor = new PreviewEditorWindow();
|
||||
m_timeline = new Timeline(m_tooltipManager);
|
||||
|
||||
Editor::registerCommands();
|
||||
// The timeline (AniControls) tooltips will use the keyboard
|
||||
// shortcuts loaded above.
|
||||
m_timeline = new Timeline(m_tooltipManager);
|
||||
|
||||
m_workspace->setTabsBar(m_tabsBar);
|
||||
m_workspace->ActiveViewChanged.connect(&MainWindow::onActiveViewChange, this);
|
||||
@ -123,12 +134,6 @@ MainWindow::MainWindow()
|
||||
m_workspace->setExpansive(true);
|
||||
m_notifications->setVisible(false);
|
||||
|
||||
// Load all menus by first time.
|
||||
AppMenus::instance()->reload();
|
||||
|
||||
// Setup the menus
|
||||
m_menuBar->setMenu(AppMenus::instance()->getRootMenu());
|
||||
|
||||
// Add the widgets in the boxes
|
||||
addChild(m_tooltipManager);
|
||||
menuBarPlaceholder()->addChild(m_menuBar);
|
||||
|
@ -120,10 +120,18 @@ std::string AniControls::getTooltipFor(int index) const
|
||||
tooltip = cmd->friendlyName();
|
||||
|
||||
KeyPtr key = KeyboardShortcuts::instance()->command(cmd->id().c_str());
|
||||
if (!key || key->accels().empty())
|
||||
key = KeyboardShortcuts::instance()->command(cmd->id().c_str(),
|
||||
Params(),
|
||||
KeyContext::Normal);
|
||||
if (key && !key->accels().empty()) {
|
||||
tooltip += "\n\nShortcut: ";
|
||||
tooltip += key->accels().front().toString();
|
||||
}
|
||||
|
||||
if (index == ACTION_PLAY) {
|
||||
tooltip += "\n\nRight-click: Show playback options";
|
||||
}
|
||||
}
|
||||
|
||||
return tooltip;
|
||||
|
Loading…
x
Reference in New Issue
Block a user