Merge branch 'master' of git@github.com:aseprite/aseprite.git

This commit is contained in:
David Capello 2015-05-04 14:58:38 -03:00
commit 116f0a760e
6 changed files with 49 additions and 4 deletions

View File

@ -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;

View File

@ -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()) {

View File

@ -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
//

View File

@ -28,7 +28,8 @@ public:
protected:
void onLoadParams(const Params& params) override;
void onExecute(Context* context) override;
bool onChecked(Context* ctx) override;
bool m_open;
bool m_close;
bool m_switch;
@ -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;

View File

@ -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);
}

View File

@ -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; }