2015-02-12 23:16:25 +08:00
|
|
|
// Aseprite
|
2016-04-23 00:19:06 +08:00
|
|
|
// Copyright (C) 2001-2016 David Capello
|
2015-02-12 23:16:25 +08:00
|
|
|
//
|
2016-08-27 04:02:58 +08:00
|
|
|
// This program is distributed under the terms of
|
|
|
|
// the End-User License Agreement for Aseprite.
|
2012-02-12 22:33:06 +08:00
|
|
|
|
2013-08-06 08:20:19 +08:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2012-02-12 22:33:06 +08:00
|
|
|
#include "config.h"
|
2013-08-06 08:20:19 +08:00
|
|
|
#endif
|
2012-02-12 22:33:06 +08:00
|
|
|
|
2013-08-06 08:20:19 +08:00
|
|
|
#include "app/commands/command.h"
|
2012-02-12 22:33:06 +08:00
|
|
|
|
2013-08-06 08:20:19 +08:00
|
|
|
#include "app/app.h"
|
2015-04-05 01:40:07 +08:00
|
|
|
#include "app/ui/workspace.h"
|
2012-02-12 22:33:06 +08:00
|
|
|
|
2013-08-06 08:20:19 +08:00
|
|
|
namespace app {
|
|
|
|
|
|
|
|
class GotoNextTabCommand : public Command {
|
2012-02-12 22:33:06 +08:00
|
|
|
public:
|
|
|
|
GotoNextTabCommand();
|
2014-08-15 10:07:47 +08:00
|
|
|
Command* clone() const override { return new GotoNextTabCommand(*this); }
|
2012-02-12 22:33:06 +08:00
|
|
|
|
|
|
|
protected:
|
2015-04-17 20:49:49 +08:00
|
|
|
bool onEnabled(Context* context) override;
|
|
|
|
void onExecute(Context* context) override;
|
2012-02-12 22:33:06 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
GotoNextTabCommand::GotoNextTabCommand()
|
|
|
|
: Command("GotoNextTab",
|
2014-10-29 22:58:03 +08:00
|
|
|
"Go to Next Tab",
|
2012-02-12 22:33:06 +08:00
|
|
|
CmdUIOnlyFlag)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-04-17 20:49:49 +08:00
|
|
|
bool GotoNextTabCommand::onEnabled(Context* context)
|
|
|
|
{
|
2016-04-23 00:19:06 +08:00
|
|
|
return App::instance()->workspace()->canSelectOtherTab();
|
2015-04-17 20:49:49 +08:00
|
|
|
}
|
|
|
|
|
2012-02-12 22:33:06 +08:00
|
|
|
void GotoNextTabCommand::onExecute(Context* context)
|
|
|
|
{
|
2016-04-23 00:19:06 +08:00
|
|
|
App::instance()->workspace()->selectNextTab();
|
2012-02-12 22:33:06 +08:00
|
|
|
}
|
|
|
|
|
2013-08-06 08:20:19 +08:00
|
|
|
class GotoPreviousTabCommand : public Command {
|
2012-02-12 22:33:06 +08:00
|
|
|
public:
|
|
|
|
GotoPreviousTabCommand();
|
2014-08-15 10:07:47 +08:00
|
|
|
Command* clone() const override { return new GotoPreviousTabCommand(*this); }
|
2012-02-12 22:33:06 +08:00
|
|
|
|
|
|
|
protected:
|
2015-04-17 20:49:49 +08:00
|
|
|
bool onEnabled(Context* context) override;
|
|
|
|
void onExecute(Context* context) override;
|
2012-02-12 22:33:06 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
GotoPreviousTabCommand::GotoPreviousTabCommand()
|
|
|
|
: Command("GotoPreviousTab",
|
2014-10-29 22:58:03 +08:00
|
|
|
"Go to Previous tab",
|
2012-02-12 22:33:06 +08:00
|
|
|
CmdRecordableFlag)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-04-17 20:49:49 +08:00
|
|
|
bool GotoPreviousTabCommand::onEnabled(Context* context)
|
|
|
|
{
|
2016-04-23 00:19:06 +08:00
|
|
|
return App::instance()->workspace()->canSelectOtherTab();
|
2015-04-17 20:49:49 +08:00
|
|
|
}
|
|
|
|
|
2012-02-12 22:33:06 +08:00
|
|
|
void GotoPreviousTabCommand::onExecute(Context* context)
|
|
|
|
{
|
2016-04-23 00:19:06 +08:00
|
|
|
App::instance()->workspace()->selectPreviousTab();
|
2012-02-12 22:33:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
Command* CommandFactory::createGotoNextTabCommand()
|
|
|
|
{
|
|
|
|
return new GotoNextTabCommand;
|
|
|
|
}
|
|
|
|
|
|
|
|
Command* CommandFactory::createGotoPreviousTabCommand()
|
|
|
|
{
|
|
|
|
return new GotoPreviousTabCommand;
|
|
|
|
}
|
2013-08-06 08:20:19 +08:00
|
|
|
|
|
|
|
} // namespace app
|