diff --git a/data/gui.xml b/data/gui.xml
index 1cce71b3c..c7874ed1a 100644
--- a/data/gui.xml
+++ b/data/gui.xml
@@ -90,7 +90,8 @@
-
+
+
@@ -572,7 +573,8 @@
-
-
+
+
diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt
index 6d84b3433..174cf7574 100644
--- a/src/app/CMakeLists.txt
+++ b/src/app/CMakeLists.txt
@@ -135,6 +135,7 @@ add_library(app-lib
commands/cmd_flatten_layers.cpp
commands/cmd_flip.cpp
commands/cmd_frame_properties.cpp
+ commands/cmd_fullscreen_preview.cpp
commands/cmd_goto_frame.cpp
commands/cmd_goto_layer.cpp
commands/cmd_goto_tab.cpp
@@ -166,7 +167,6 @@ add_library(app-lib
commands/cmd_palette_editor.cpp
commands/cmd_paste.cpp
commands/cmd_play_animation.cpp
- commands/cmd_preview.cpp
commands/cmd_refresh.cpp
commands/cmd_remove_frame.cpp
commands/cmd_remove_layer.cpp
@@ -185,6 +185,7 @@ add_library(app-lib
commands/cmd_sprite_size.cpp
commands/cmd_switch_colors.cpp
commands/cmd_timeline.cpp
+ commands/cmd_toggle_preview.cpp
commands/cmd_undo.cpp
commands/cmd_unlink_cel.cpp
commands/cmd_zoom.cpp
diff --git a/src/app/commands/cmd_preview.cpp b/src/app/commands/cmd_fullscreen_preview.cpp
similarity index 94%
rename from src/app/commands/cmd_preview.cpp
rename to src/app/commands/cmd_fullscreen_preview.cpp
index 0bfda7931..dcf0ff448 100644
--- a/src/app/commands/cmd_preview.cpp
+++ b/src/app/commands/cmd_fullscreen_preview.cpp
@@ -1,5 +1,5 @@
/* Aseprite
- * Copyright (C) 2001-2013 David Capello
+ * Copyright (C) 2001-2015 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
@@ -260,31 +260,31 @@ private:
filters::TiledMode m_tiled;
};
-class PreviewCommand : public Command {
+class FullscreenPreviewCommand : public Command {
public:
- PreviewCommand();
- Command* clone() const override { return new PreviewCommand(*this); }
+ FullscreenPreviewCommand();
+ Command* clone() const override { return new FullscreenPreviewCommand(*this); }
protected:
bool onEnabled(Context* context);
void onExecute(Context* context);
};
-PreviewCommand::PreviewCommand()
- : Command("Preview",
- "Preview",
+FullscreenPreviewCommand::FullscreenPreviewCommand()
+ : Command("FullscreenPreview",
+ "Fullscreen Preview",
CmdUIOnlyFlag)
{
}
-bool PreviewCommand::onEnabled(Context* context)
+bool FullscreenPreviewCommand::onEnabled(Context* context)
{
return context->checkFlags(ContextFlags::ActiveDocumentIsWritable |
ContextFlags::HasActiveSprite);
}
// Shows the sprite using the complete screen.
-void PreviewCommand::onExecute(Context* context)
+void FullscreenPreviewCommand::onExecute(Context* context)
{
Editor* editor = current_editor;
@@ -296,9 +296,9 @@ void PreviewCommand::onExecute(Context* context)
window.openWindowInForeground();
}
-Command* CommandFactory::createPreviewCommand()
+Command* CommandFactory::createFullscreenPreviewCommand()
{
- return new PreviewCommand;
+ return new FullscreenPreviewCommand;
}
} // namespace app
diff --git a/src/app/commands/cmd_toggle_preview.cpp b/src/app/commands/cmd_toggle_preview.cpp
new file mode 100644
index 000000000..2e9c1af10
--- /dev/null
+++ b/src/app/commands/cmd_toggle_preview.cpp
@@ -0,0 +1,79 @@
+/* Aseprite
+ * Copyright (C) 2001-2015 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
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "app/app.h"
+#include "app/commands/command.h"
+#include "app/context.h"
+#include "app/ui/main_window.h"
+#include "app/ui/mini_editor.h"
+
+namespace app {
+
+class TogglePreviewCommand : public Command {
+public:
+ TogglePreviewCommand();
+ Command* clone() const override { return new TogglePreviewCommand(*this); }
+
+protected:
+ bool onEnabled(Context* context) override;
+ bool onChecked(Context* context) override;
+ void onExecute(Context* context) override;
+};
+
+TogglePreviewCommand::TogglePreviewCommand()
+ : Command("TogglePreview",
+ "Toggle Preview",
+ CmdUIOnlyFlag)
+{
+}
+
+bool TogglePreviewCommand::onEnabled(Context* context)
+{
+ return context->checkFlags(ContextFlags::ActiveDocumentIsWritable |
+ ContextFlags::HasActiveSprite);
+}
+
+bool TogglePreviewCommand::onChecked(Context* context)
+{
+ MainWindow* mainWin = App::instance()->getMainWindow();
+ if (!mainWin)
+ return false;
+
+ MiniEditorWindow* previewWin = mainWin->getMiniEditor();
+ return (previewWin && previewWin->isVisible());
+}
+
+void TogglePreviewCommand::onExecute(Context* context)
+{
+ MiniEditorWindow* previewWin =
+ App::instance()->getMainWindow()->getMiniEditor();
+
+ bool state = previewWin->isMiniEditorEnabled();
+ previewWin->setMiniEditorEnabled(!state);
+}
+
+Command* CommandFactory::createTogglePreviewCommand()
+{
+ return new TogglePreviewCommand;
+}
+
+} // namespace app
diff --git a/src/app/commands/commands_list.h b/src/app/commands/commands_list.h
index 9a36f9cd8..89fb70bf1 100644
--- a/src/app/commands/commands_list.h
+++ b/src/app/commands/commands_list.h
@@ -48,6 +48,7 @@ FOR_EACH_COMMAND(Eyedropper)
FOR_EACH_COMMAND(FlattenLayers)
FOR_EACH_COMMAND(Flip)
FOR_EACH_COMMAND(FrameProperties)
+FOR_EACH_COMMAND(FullscreenPreview)
FOR_EACH_COMMAND(GotoFirstFrame)
FOR_EACH_COMMAND(GotoFrame)
FOR_EACH_COMMAND(GotoLastFrame)
@@ -86,7 +87,6 @@ FOR_EACH_COMMAND(Options)
FOR_EACH_COMMAND(PaletteEditor)
FOR_EACH_COMMAND(Paste)
FOR_EACH_COMMAND(PlayAnimation)
-FOR_EACH_COMMAND(Preview)
FOR_EACH_COMMAND(Redo)
FOR_EACH_COMMAND(Refresh)
FOR_EACH_COMMAND(RemoveFrame)
@@ -114,6 +114,7 @@ FOR_EACH_COMMAND(SpriteProperties)
FOR_EACH_COMMAND(SpriteSize)
FOR_EACH_COMMAND(SwitchColors)
FOR_EACH_COMMAND(Timeline)
+FOR_EACH_COMMAND(TogglePreview)
FOR_EACH_COMMAND(Undo)
FOR_EACH_COMMAND(UnlinkCel)
FOR_EACH_COMMAND(Zoom)
diff --git a/src/app/ui/mini_editor.cpp b/src/app/ui/mini_editor.cpp
index 86303df89..5d13f9d63 100644
--- a/src/app/ui/mini_editor.cpp
+++ b/src/app/ui/mini_editor.cpp
@@ -115,7 +115,7 @@ private:
};
MiniEditorWindow::MiniEditorWindow()
- : Window(WithTitleBar, "Mini-Editor")
+ : Window(WithTitleBar, "Preview")
, m_docView(NULL)
, m_playButton(new MiniPlayButton())
, m_playTimer(10)