mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-10 19:13:29 +00:00
Merge pull request #653 from blackmiaool/master
Select Home tab when it's not selected in HomeCommand
This commit is contained in:
commit
8a2b1d46a1
@ -23,7 +23,8 @@ public:
|
|||||||
~HomeCommand();
|
~HomeCommand();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onExecute(Context* context);
|
void onExecute(Context* context) override;
|
||||||
|
bool onEnabled(Context* context) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
HomeCommand::HomeCommand()
|
HomeCommand::HomeCommand()
|
||||||
@ -42,6 +43,11 @@ void HomeCommand::onExecute(Context* context)
|
|||||||
App::instance()->getMainWindow()->showHome();
|
App::instance()->getMainWindow()->showHome();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool HomeCommand::onEnabled(Context* context)
|
||||||
|
{
|
||||||
|
return !App::instance()->getMainWindow()->isHomeSelected();
|
||||||
|
}
|
||||||
|
|
||||||
Command* CommandFactory::createHomeCommand()
|
Command* CommandFactory::createHomeCommand()
|
||||||
{
|
{
|
||||||
return new HomeCommand;
|
return new HomeCommand;
|
||||||
|
@ -163,7 +163,7 @@ void MainWindow::showNotification(INotificationDelegate* del)
|
|||||||
m_notifications->getParent()->layout();
|
m_notifications->getParent()->layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::showHome()
|
void MainWindow::showHomeOnOpen()
|
||||||
{
|
{
|
||||||
if (!getHomeView()->getParent()) {
|
if (!getHomeView()->getParent()) {
|
||||||
TabView* selectedTab = m_tabsBar->getSelectedTab();
|
TabView* selectedTab = m_tabsBar->getSelectedTab();
|
||||||
@ -178,6 +178,19 @@ void MainWindow::showHome()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::showHome()
|
||||||
|
{
|
||||||
|
if (!getHomeView()->getParent()) {
|
||||||
|
m_workspace->addView(m_homeView, 0);
|
||||||
|
}
|
||||||
|
m_tabsBar->selectTab(m_homeView);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MainWindow::isHomeSelected()
|
||||||
|
{
|
||||||
|
return (m_tabsBar->getSelectedTab() == m_homeView && m_homeView);
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::showDevConsole()
|
void MainWindow::showDevConsole()
|
||||||
{
|
{
|
||||||
if (!m_devConsoleView)
|
if (!m_devConsoleView)
|
||||||
@ -230,7 +243,7 @@ void MainWindow::showDataRecovery(crash::DataRecovery* dataRecovery)
|
|||||||
bool MainWindow::onProcessMessage(ui::Message* msg)
|
bool MainWindow::onProcessMessage(ui::Message* msg)
|
||||||
{
|
{
|
||||||
if (msg->type() == kOpenMessage)
|
if (msg->type() == kOpenMessage)
|
||||||
showHome();
|
showHomeOnOpen();
|
||||||
|
|
||||||
return Window::onProcessMessage(msg);
|
return Window::onProcessMessage(msg);
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,9 @@ namespace app {
|
|||||||
void start();
|
void start();
|
||||||
void reloadMenus();
|
void reloadMenus();
|
||||||
void showNotification(INotificationDelegate* del);
|
void showNotification(INotificationDelegate* del);
|
||||||
|
void showHomeOnOpen();
|
||||||
void showHome();
|
void showHome();
|
||||||
|
bool isHomeSelected();
|
||||||
void showDevConsole();
|
void showDevConsole();
|
||||||
|
|
||||||
Mode getMode() const { return m_mode; }
|
Mode getMode() const { return m_mode; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user