2013-08-09 08:01:20 +08:00
|
|
|
/* Aseprite
|
2013-01-27 23:13:13 +08:00
|
|
|
* Copyright (C) 2001-2013 David Capello
|
2012-01-06 06:45:03 +08:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
2013-08-06 08:20:19 +08:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2012-01-06 06:45:03 +08:00
|
|
|
#include "config.h"
|
2013-08-06 08:20:19 +08:00
|
|
|
#endif
|
2012-01-06 06:45:03 +08:00
|
|
|
|
2014-05-09 12:01:59 +08:00
|
|
|
#include "app/app.h"
|
2013-08-06 08:20:19 +08:00
|
|
|
#include "app/commands/command.h"
|
|
|
|
#include "app/context.h"
|
|
|
|
#include "app/document.h"
|
2014-05-09 12:01:59 +08:00
|
|
|
#include "app/ui/devconsole_view.h"
|
|
|
|
#include "app/ui/main_window.h"
|
|
|
|
#include "app/ui/workspace.h"
|
2012-06-18 09:49:58 +08:00
|
|
|
#include "ui/box.h"
|
|
|
|
#include "ui/button.h"
|
|
|
|
#include "ui/combobox.h"
|
2012-07-09 10:24:42 +08:00
|
|
|
#include "ui/window.h"
|
2012-01-06 06:45:03 +08:00
|
|
|
|
2013-08-06 08:20:19 +08:00
|
|
|
namespace app {
|
|
|
|
|
2012-06-18 09:02:54 +08:00
|
|
|
using namespace ui;
|
|
|
|
|
2013-08-06 08:20:19 +08:00
|
|
|
class DeveloperConsoleCommand : public Command {
|
2012-01-06 06:45:03 +08:00
|
|
|
public:
|
|
|
|
DeveloperConsoleCommand();
|
|
|
|
~DeveloperConsoleCommand();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void onExecute(Context* context);
|
|
|
|
|
2014-05-09 12:01:59 +08:00
|
|
|
DevConsoleView* m_devConsole;
|
2012-01-06 06:45:03 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
DeveloperConsoleCommand::DeveloperConsoleCommand()
|
|
|
|
: Command("DeveloperConsole",
|
|
|
|
"DeveloperConsole",
|
|
|
|
CmdUIOnlyFlag)
|
|
|
|
{
|
|
|
|
m_devConsole = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
DeveloperConsoleCommand::~DeveloperConsoleCommand()
|
|
|
|
{
|
2014-05-09 12:01:59 +08:00
|
|
|
delete m_devConsole;
|
2012-01-06 06:45:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void DeveloperConsoleCommand::onExecute(Context* context)
|
|
|
|
{
|
|
|
|
if (!m_devConsole) {
|
2014-05-09 12:01:59 +08:00
|
|
|
m_devConsole = new DevConsoleView();
|
|
|
|
|
|
|
|
App::instance()->getMainWindow()->getWorkspace()->addView(m_devConsole);
|
2012-01-06 06:45:03 +08:00
|
|
|
}
|
|
|
|
|
2014-05-09 12:01:59 +08:00
|
|
|
App::instance()->getMainWindow()->getTabsBar()->selectTab(m_devConsole);
|
|
|
|
App::instance()->getMainWindow()->getWorkspace()->setActiveView(m_devConsole);
|
2012-01-06 06:45:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
Command* CommandFactory::createDeveloperConsoleCommand()
|
|
|
|
{
|
|
|
|
return new DeveloperConsoleCommand;
|
|
|
|
}
|
2013-08-06 08:20:19 +08:00
|
|
|
|
|
|
|
} // namespace app
|