mirror of
https://github.com/aseprite/aseprite.git
synced 2024-12-27 21:19:18 +00:00
Merge branch 'center-canvas-newcmd' of https://github.com/tony/aseprite into tony-center-canvas-newcmd
This commit is contained in:
commit
20b59bf0c4
@ -218,6 +218,10 @@
|
||||
<param name="action" value="in" />
|
||||
</key>
|
||||
|
||||
<!-- Scroll to center -->
|
||||
<key command="ScrollCenter" shortcut="C">
|
||||
</key>
|
||||
|
||||
<!-- Scroll with arrows -->
|
||||
<key command="Scroll" shortcut="Space+Left">
|
||||
<param name="direction" value="left" />
|
||||
|
@ -243,6 +243,7 @@ add_library(app-lib
|
||||
commands/cmd_save_mask.cpp
|
||||
commands/cmd_save_palette.cpp
|
||||
commands/cmd_scroll.cpp
|
||||
commands/cmd_scroll_center.cpp
|
||||
commands/cmd_set_color_selector.cpp
|
||||
commands/cmd_set_ink_type.cpp
|
||||
commands/cmd_set_loop_section.cpp
|
||||
|
46
src/app/commands/cmd_scroll_center.cpp
Normal file
46
src/app/commands/cmd_scroll_center.cpp
Normal file
@ -0,0 +1,46 @@
|
||||
// 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 version 2 as
|
||||
// published by the Free Software Foundation.
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "app/app.h"
|
||||
#include "app/commands/command.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/modules/editors.h"
|
||||
#include "app/ui/editor/editor.h"
|
||||
|
||||
namespace app {
|
||||
|
||||
class ScrollCenterCommand : public Command {
|
||||
public:
|
||||
ScrollCenterCommand();
|
||||
Command* clone() const override { return new ScrollCenterCommand(*this); }
|
||||
|
||||
protected:
|
||||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
ScrollCenterCommand::ScrollCenterCommand()
|
||||
: Command("ScrollCenter",
|
||||
"Scroll to center of canvas",
|
||||
CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
void ScrollCenterCommand::onExecute(Context* context)
|
||||
{
|
||||
current_editor->setDefaultScroll();
|
||||
}
|
||||
|
||||
Command* CommandFactory::createScrollCenterCommand()
|
||||
{
|
||||
return new ScrollCenterCommand;
|
||||
}
|
||||
|
||||
} //namespace app
|
@ -106,6 +106,7 @@ FOR_EACH_COMMAND(SaveFileCopyAs)
|
||||
FOR_EACH_COMMAND(SaveMask)
|
||||
FOR_EACH_COMMAND(SavePalette)
|
||||
FOR_EACH_COMMAND(Scroll)
|
||||
FOR_EACH_COMMAND(ScrollCenter)
|
||||
FOR_EACH_COMMAND(SelectionAsGrid)
|
||||
FOR_EACH_COMMAND(SetColorSelector)
|
||||
FOR_EACH_COMMAND(SetInkType)
|
||||
|
Loading…
Reference in New Issue
Block a user