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(); ~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;

View File

@ -64,6 +64,10 @@ bool NewBrushCommand::onEnabled(Context* context)
void NewBrushCommand::onExecute(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 // If there is no visible mask, the brush must be selected from the
// current editor. // current editor.
if (!context->activeDocument()->isMaskVisible()) { if (!context->activeDocument()->isMaskVisible()) {

View File

@ -138,6 +138,7 @@ public:
protected: protected:
void onLoadParams(const Params& params) override; void onLoadParams(const Params& params) override;
void onExecute(Context* context) override; void onExecute(Context* context) override;
bool onChecked(Context* context) override;
private: private:
bool m_open; 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 // PaletteEntryEditor implementation
// //

View File

@ -28,7 +28,8 @@ public:
protected: protected:
void onLoadParams(const Params& params) override; void onLoadParams(const Params& params) override;
void onExecute(Context* context) override; void onExecute(Context* context) override;
bool onChecked(Context* ctx) override;
bool m_open; bool m_open;
bool m_close; bool m_close;
bool m_switch; bool m_switch;
@ -75,6 +76,15 @@ void TimelineCommand::onExecute(Context* context)
App::instance()->getMainWindow()->setTimelineVisibility(newVisible); 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() Command* CommandFactory::createTimelineCommand()
{ {
return new TimelineCommand; return new TimelineCommand;

View File

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

View File

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