mirror of
https://github.com/aseprite/aseprite.git
synced 2024-09-02 13:09:27 +00:00
Add a simple DeveloperConsole for debugging purposes (F11 key).
This commit is contained in:
parent
7dd873b1a7
commit
d95919beb5
@ -14,6 +14,7 @@
|
||||
<key command="SaveFileCopyAs" shortcut="Ctrl+Shift+C" />
|
||||
<key command="CloseFile" shortcut="Ctrl+W" />
|
||||
<key command="CloseAllFiles" shortcut="Ctrl+Shift+W" />
|
||||
<key command="DeveloperConsole" shortcut="F11" />
|
||||
<key command="ScreenShot" shortcut="F12" />
|
||||
<key command="Exit" shortcut="Ctrl+Q" />
|
||||
<key command="Exit" shortcut="Esc" />
|
||||
|
@ -108,6 +108,7 @@ add_library(aseprite-library
|
||||
commands/cmd_crop.cpp
|
||||
commands/cmd_cut.cpp
|
||||
commands/cmd_deselect_mask.cpp
|
||||
commands/cmd_developer_console.cpp
|
||||
commands/cmd_donate.cpp
|
||||
commands/cmd_duplicate_layer.cpp
|
||||
commands/cmd_duplicate_sprite.cpp
|
||||
|
106
src/commands/cmd_developer_console.cpp
Normal file
106
src/commands/cmd_developer_console.cpp
Normal file
@ -0,0 +1,106 @@
|
||||
/* ASE - Allegro Sprite Editor
|
||||
* Copyright (C) 2001-2011 David Capello
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "commands/command.h"
|
||||
#include "context.h"
|
||||
#include "document.h"
|
||||
#include "documents.h"
|
||||
#include "gui/box.h"
|
||||
#include "gui/button.h"
|
||||
#include "gui/combobox.h"
|
||||
#include "gui/frame.h"
|
||||
|
||||
class DeveloperConsole : public Frame
|
||||
{
|
||||
public:
|
||||
DeveloperConsole()
|
||||
: Frame(false, "Developer Console")
|
||||
, m_vbox(JI_VERTICAL)
|
||||
{
|
||||
jwidget_add_child(&m_vbox, &m_docs);
|
||||
jwidget_add_child(this, &m_vbox);
|
||||
|
||||
remap_window();
|
||||
center_window();
|
||||
}
|
||||
|
||||
void updateDocuments(Context* context)
|
||||
{
|
||||
m_docs.removeAllItems();
|
||||
m_docs.addItem("Documents");
|
||||
for (Documents::const_iterator
|
||||
it = context->getDocuments().begin(),
|
||||
end = context->getDocuments().end(); it != end; ++it) {
|
||||
m_docs.addItem((*it)->getFilename());
|
||||
}
|
||||
m_docs.addItem("---------");
|
||||
}
|
||||
|
||||
private:
|
||||
Box m_vbox;
|
||||
ComboBox m_docs;
|
||||
};
|
||||
|
||||
class DeveloperConsoleCommand : public Command
|
||||
{
|
||||
public:
|
||||
DeveloperConsoleCommand();
|
||||
~DeveloperConsoleCommand();
|
||||
|
||||
protected:
|
||||
void onExecute(Context* context);
|
||||
|
||||
DeveloperConsole* m_devConsole;
|
||||
};
|
||||
|
||||
DeveloperConsoleCommand::DeveloperConsoleCommand()
|
||||
: Command("DeveloperConsole",
|
||||
"DeveloperConsole",
|
||||
CmdUIOnlyFlag)
|
||||
{
|
||||
m_devConsole = NULL;
|
||||
}
|
||||
|
||||
DeveloperConsoleCommand::~DeveloperConsoleCommand()
|
||||
{
|
||||
// delete m_devConsole;
|
||||
}
|
||||
|
||||
void DeveloperConsoleCommand::onExecute(Context* context)
|
||||
{
|
||||
if (!m_devConsole) {
|
||||
m_devConsole = new DeveloperConsole();
|
||||
}
|
||||
else if (m_devConsole->isVisible()) {
|
||||
m_devConsole->closeWindow(NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
m_devConsole->updateDocuments(context);
|
||||
m_devConsole->open_window_bg();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// CommandFactory
|
||||
|
||||
Command* CommandFactory::createDeveloperConsoleCommand()
|
||||
{
|
||||
return new DeveloperConsoleCommand;
|
||||
}
|
@ -39,6 +39,7 @@ FOR_EACH_COMMAND(CropSprite)
|
||||
FOR_EACH_COMMAND(Cut)
|
||||
FOR_EACH_COMMAND(DeselectMask)
|
||||
FOR_EACH_COMMAND(Despeckle)
|
||||
FOR_EACH_COMMAND(DeveloperConsole)
|
||||
FOR_EACH_COMMAND(Donate)
|
||||
FOR_EACH_COMMAND(DuplicateLayer)
|
||||
FOR_EACH_COMMAND(DuplicateSprite)
|
||||
|
Loading…
Reference in New Issue
Block a user