mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-21 21:41:02 +00:00
Merge branch 'master' of git@github.com:aseprite/aseprite.git
This commit is contained in:
commit
116f0a760e
@ -23,7 +23,8 @@ public:
|
||||
~HomeCommand();
|
||||
|
||||
protected:
|
||||
void onExecute(Context* context);
|
||||
void onExecute(Context* context) override;
|
||||
bool onEnabled(Context* context) override;
|
||||
};
|
||||
|
||||
HomeCommand::HomeCommand()
|
||||
@ -42,6 +43,11 @@ void HomeCommand::onExecute(Context* context)
|
||||
App::instance()->getMainWindow()->showHome();
|
||||
}
|
||||
|
||||
bool HomeCommand::onEnabled(Context* context)
|
||||
{
|
||||
return !App::instance()->getMainWindow()->isHomeSelected();
|
||||
}
|
||||
|
||||
Command* CommandFactory::createHomeCommand()
|
||||
{
|
||||
return new HomeCommand;
|
||||
|
@ -64,6 +64,10 @@ bool NewBrushCommand::onEnabled(Context* context)
|
||||
|
||||
void NewBrushCommand::onExecute(Context* context)
|
||||
{
|
||||
ASSERT(current_editor);
|
||||
if (!current_editor)
|
||||
return;
|
||||
|
||||
// If there is no visible mask, the brush must be selected from the
|
||||
// current editor.
|
||||
if (!context->activeDocument()->isMaskVisible()) {
|
||||
|
@ -138,6 +138,7 @@ public:
|
||||
protected:
|
||||
void onLoadParams(const Params& params) override;
|
||||
void onExecute(Context* context) override;
|
||||
bool onChecked(Context* context) override;
|
||||
|
||||
private:
|
||||
bool m_open;
|
||||
@ -225,6 +226,15 @@ void PaletteEditorCommand::onExecute(Context* context)
|
||||
}
|
||||
}
|
||||
|
||||
bool PaletteEditorCommand::onChecked(Context* context)
|
||||
{
|
||||
if(!g_window)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return g_window->isVisible();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// PaletteEntryEditor implementation
|
||||
//
|
||||
|
@ -28,6 +28,7 @@ public:
|
||||
protected:
|
||||
void onLoadParams(const Params& params) override;
|
||||
void onExecute(Context* context) override;
|
||||
bool onChecked(Context* ctx) override;
|
||||
|
||||
bool m_open;
|
||||
bool m_close;
|
||||
@ -75,6 +76,15 @@ void TimelineCommand::onExecute(Context* context)
|
||||
App::instance()->getMainWindow()->setTimelineVisibility(newVisible);
|
||||
}
|
||||
|
||||
bool TimelineCommand::onChecked(Context* ctx) {
|
||||
MainWindow* mainWin = App::instance()->getMainWindow();
|
||||
if (!mainWin)
|
||||
return false;
|
||||
|
||||
Timeline* timelineWin = mainWin->getTimeline();
|
||||
return (timelineWin && timelineWin->isVisible());
|
||||
}
|
||||
|
||||
Command* CommandFactory::createTimelineCommand()
|
||||
{
|
||||
return new TimelineCommand;
|
||||
|
@ -163,7 +163,7 @@ void MainWindow::showNotification(INotificationDelegate* del)
|
||||
m_notifications->getParent()->layout();
|
||||
}
|
||||
|
||||
void MainWindow::showHome()
|
||||
void MainWindow::showHomeOnOpen()
|
||||
{
|
||||
if (!getHomeView()->getParent()) {
|
||||
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()
|
||||
{
|
||||
if (!m_devConsoleView)
|
||||
@ -230,7 +243,7 @@ void MainWindow::showDataRecovery(crash::DataRecovery* dataRecovery)
|
||||
bool MainWindow::onProcessMessage(ui::Message* msg)
|
||||
{
|
||||
if (msg->type() == kOpenMessage)
|
||||
showHome();
|
||||
showHomeOnOpen();
|
||||
|
||||
return Window::onProcessMessage(msg);
|
||||
}
|
||||
|
@ -67,7 +67,9 @@ namespace app {
|
||||
void start();
|
||||
void reloadMenus();
|
||||
void showNotification(INotificationDelegate* del);
|
||||
void showHomeOnOpen();
|
||||
void showHome();
|
||||
bool isHomeSelected();
|
||||
void showDevConsole();
|
||||
|
||||
Mode getMode() const { return m_mode; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user