mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-01 01:20:25 +00:00
Add TogglePreview command (rename "mini-editor" to "preview")
Renamed Preview to FullscreenPreview to avoid confusion. As an extra "to do", we need to add command aliases, so Preview matches FullscreenPreview (mainly to keep user defined keyboard shortcuts).
This commit is contained in:
parent
52003da721
commit
d1d49c5038
@ -90,7 +90,8 @@
|
|||||||
<key command="MakeUniqueEditor" shortcut="Ctrl+1" mac="Cmd+1" />
|
<key command="MakeUniqueEditor" shortcut="Ctrl+1" mac="Cmd+1" />
|
||||||
<key command="SplitEditorVertically" shortcut="Ctrl+2" mac="Cmd+2" />
|
<key command="SplitEditorVertically" shortcut="Ctrl+2" mac="Cmd+2" />
|
||||||
<key command="SplitEditorHorizontally" shortcut="Ctrl+3" mac="Cmd+3" />
|
<key command="SplitEditorHorizontally" shortcut="Ctrl+3" mac="Cmd+3" />
|
||||||
<key command="Preview" shortcut="F8" />
|
<key command="TogglePreview" shortcut="F7" />
|
||||||
|
<key command="FullscreenPreview" shortcut="F8" />
|
||||||
<key command="ShowGrid" shortcut="Shift+G" />
|
<key command="ShowGrid" shortcut="Shift+G" />
|
||||||
<key command="ShowPixelGrid" shortcut="Alt+Shift+G" />
|
<key command="ShowPixelGrid" shortcut="Alt+Shift+G" />
|
||||||
<key command="SnapToGrid" shortcut="Shift+S" />
|
<key command="SnapToGrid" shortcut="Shift+S" />
|
||||||
@ -572,7 +573,8 @@
|
|||||||
<item command="Timeline" text="&Timeline">
|
<item command="Timeline" text="&Timeline">
|
||||||
<param name="switch" value="true" />
|
<param name="switch" value="true" />
|
||||||
</item>
|
</item>
|
||||||
<item command="Preview" text="Previe&w" />
|
<item command="TogglePreview" text="Previe&w" />
|
||||||
|
<item command="FullscreenPreview" text="&Fullscreen Preview" />
|
||||||
<separator />
|
<separator />
|
||||||
<item command="Refresh" text="&Refresh && Reload Skin" />
|
<item command="Refresh" text="&Refresh && Reload Skin" />
|
||||||
</menu>
|
</menu>
|
||||||
|
@ -135,6 +135,7 @@ add_library(app-lib
|
|||||||
commands/cmd_flatten_layers.cpp
|
commands/cmd_flatten_layers.cpp
|
||||||
commands/cmd_flip.cpp
|
commands/cmd_flip.cpp
|
||||||
commands/cmd_frame_properties.cpp
|
commands/cmd_frame_properties.cpp
|
||||||
|
commands/cmd_fullscreen_preview.cpp
|
||||||
commands/cmd_goto_frame.cpp
|
commands/cmd_goto_frame.cpp
|
||||||
commands/cmd_goto_layer.cpp
|
commands/cmd_goto_layer.cpp
|
||||||
commands/cmd_goto_tab.cpp
|
commands/cmd_goto_tab.cpp
|
||||||
@ -166,7 +167,6 @@ add_library(app-lib
|
|||||||
commands/cmd_palette_editor.cpp
|
commands/cmd_palette_editor.cpp
|
||||||
commands/cmd_paste.cpp
|
commands/cmd_paste.cpp
|
||||||
commands/cmd_play_animation.cpp
|
commands/cmd_play_animation.cpp
|
||||||
commands/cmd_preview.cpp
|
|
||||||
commands/cmd_refresh.cpp
|
commands/cmd_refresh.cpp
|
||||||
commands/cmd_remove_frame.cpp
|
commands/cmd_remove_frame.cpp
|
||||||
commands/cmd_remove_layer.cpp
|
commands/cmd_remove_layer.cpp
|
||||||
@ -185,6 +185,7 @@ add_library(app-lib
|
|||||||
commands/cmd_sprite_size.cpp
|
commands/cmd_sprite_size.cpp
|
||||||
commands/cmd_switch_colors.cpp
|
commands/cmd_switch_colors.cpp
|
||||||
commands/cmd_timeline.cpp
|
commands/cmd_timeline.cpp
|
||||||
|
commands/cmd_toggle_preview.cpp
|
||||||
commands/cmd_undo.cpp
|
commands/cmd_undo.cpp
|
||||||
commands/cmd_unlink_cel.cpp
|
commands/cmd_unlink_cel.cpp
|
||||||
commands/cmd_zoom.cpp
|
commands/cmd_zoom.cpp
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Aseprite
|
/* 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -260,31 +260,31 @@ private:
|
|||||||
filters::TiledMode m_tiled;
|
filters::TiledMode m_tiled;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PreviewCommand : public Command {
|
class FullscreenPreviewCommand : public Command {
|
||||||
public:
|
public:
|
||||||
PreviewCommand();
|
FullscreenPreviewCommand();
|
||||||
Command* clone() const override { return new PreviewCommand(*this); }
|
Command* clone() const override { return new FullscreenPreviewCommand(*this); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool onEnabled(Context* context);
|
bool onEnabled(Context* context);
|
||||||
void onExecute(Context* context);
|
void onExecute(Context* context);
|
||||||
};
|
};
|
||||||
|
|
||||||
PreviewCommand::PreviewCommand()
|
FullscreenPreviewCommand::FullscreenPreviewCommand()
|
||||||
: Command("Preview",
|
: Command("FullscreenPreview",
|
||||||
"Preview",
|
"Fullscreen Preview",
|
||||||
CmdUIOnlyFlag)
|
CmdUIOnlyFlag)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PreviewCommand::onEnabled(Context* context)
|
bool FullscreenPreviewCommand::onEnabled(Context* context)
|
||||||
{
|
{
|
||||||
return context->checkFlags(ContextFlags::ActiveDocumentIsWritable |
|
return context->checkFlags(ContextFlags::ActiveDocumentIsWritable |
|
||||||
ContextFlags::HasActiveSprite);
|
ContextFlags::HasActiveSprite);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shows the sprite using the complete screen.
|
// Shows the sprite using the complete screen.
|
||||||
void PreviewCommand::onExecute(Context* context)
|
void FullscreenPreviewCommand::onExecute(Context* context)
|
||||||
{
|
{
|
||||||
Editor* editor = current_editor;
|
Editor* editor = current_editor;
|
||||||
|
|
||||||
@ -296,9 +296,9 @@ void PreviewCommand::onExecute(Context* context)
|
|||||||
window.openWindowInForeground();
|
window.openWindowInForeground();
|
||||||
}
|
}
|
||||||
|
|
||||||
Command* CommandFactory::createPreviewCommand()
|
Command* CommandFactory::createFullscreenPreviewCommand()
|
||||||
{
|
{
|
||||||
return new PreviewCommand;
|
return new FullscreenPreviewCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace app
|
} // namespace app
|
79
src/app/commands/cmd_toggle_preview.cpp
Normal file
79
src/app/commands/cmd_toggle_preview.cpp
Normal file
@ -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
|
@ -48,6 +48,7 @@ FOR_EACH_COMMAND(Eyedropper)
|
|||||||
FOR_EACH_COMMAND(FlattenLayers)
|
FOR_EACH_COMMAND(FlattenLayers)
|
||||||
FOR_EACH_COMMAND(Flip)
|
FOR_EACH_COMMAND(Flip)
|
||||||
FOR_EACH_COMMAND(FrameProperties)
|
FOR_EACH_COMMAND(FrameProperties)
|
||||||
|
FOR_EACH_COMMAND(FullscreenPreview)
|
||||||
FOR_EACH_COMMAND(GotoFirstFrame)
|
FOR_EACH_COMMAND(GotoFirstFrame)
|
||||||
FOR_EACH_COMMAND(GotoFrame)
|
FOR_EACH_COMMAND(GotoFrame)
|
||||||
FOR_EACH_COMMAND(GotoLastFrame)
|
FOR_EACH_COMMAND(GotoLastFrame)
|
||||||
@ -86,7 +87,6 @@ FOR_EACH_COMMAND(Options)
|
|||||||
FOR_EACH_COMMAND(PaletteEditor)
|
FOR_EACH_COMMAND(PaletteEditor)
|
||||||
FOR_EACH_COMMAND(Paste)
|
FOR_EACH_COMMAND(Paste)
|
||||||
FOR_EACH_COMMAND(PlayAnimation)
|
FOR_EACH_COMMAND(PlayAnimation)
|
||||||
FOR_EACH_COMMAND(Preview)
|
|
||||||
FOR_EACH_COMMAND(Redo)
|
FOR_EACH_COMMAND(Redo)
|
||||||
FOR_EACH_COMMAND(Refresh)
|
FOR_EACH_COMMAND(Refresh)
|
||||||
FOR_EACH_COMMAND(RemoveFrame)
|
FOR_EACH_COMMAND(RemoveFrame)
|
||||||
@ -114,6 +114,7 @@ FOR_EACH_COMMAND(SpriteProperties)
|
|||||||
FOR_EACH_COMMAND(SpriteSize)
|
FOR_EACH_COMMAND(SpriteSize)
|
||||||
FOR_EACH_COMMAND(SwitchColors)
|
FOR_EACH_COMMAND(SwitchColors)
|
||||||
FOR_EACH_COMMAND(Timeline)
|
FOR_EACH_COMMAND(Timeline)
|
||||||
|
FOR_EACH_COMMAND(TogglePreview)
|
||||||
FOR_EACH_COMMAND(Undo)
|
FOR_EACH_COMMAND(Undo)
|
||||||
FOR_EACH_COMMAND(UnlinkCel)
|
FOR_EACH_COMMAND(UnlinkCel)
|
||||||
FOR_EACH_COMMAND(Zoom)
|
FOR_EACH_COMMAND(Zoom)
|
||||||
|
@ -115,7 +115,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
MiniEditorWindow::MiniEditorWindow()
|
MiniEditorWindow::MiniEditorWindow()
|
||||||
: Window(WithTitleBar, "Mini-Editor")
|
: Window(WithTitleBar, "Preview")
|
||||||
, m_docView(NULL)
|
, m_docView(NULL)
|
||||||
, m_playButton(new MiniPlayButton())
|
, m_playButton(new MiniPlayButton())
|
||||||
, m_playTimer(10)
|
, m_playTimer(10)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user