[aseprite] 65/308: Allow scrolling to center of canvas

Tobias Hansen thansen at moszumanska.debian.org
Tue Mar 8 02:44:53 UTC 2016


This is an automated email from the git hooks/post-receive script.

thansen pushed a commit to branch master
in repository aseprite.

commit 877d29cd76ca92f04a5e0ec95b43a4102cf157bb
Author: Tony Narlock <tony at git-pull.com>
Date:   Mon Dec 7 05:06:12 2015 -0600

    Allow scrolling to center of canvas
---
 data/gui.xml                           |  4 +++
 src/app/CMakeLists.txt                 |  1 +
 src/app/commands/cmd_scroll_center.cpp | 46 ++++++++++++++++++++++++++++++++++
 src/app/commands/commands_list.h       |  1 +
 4 files changed, 52 insertions(+)

diff --git a/data/gui.xml b/data/gui.xml
index 945dc62..c73cd00 100644
--- a/data/gui.xml
+++ b/data/gui.xml
@@ -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" />
diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt
index a1e7c71..f1392ba 100644
--- a/src/app/CMakeLists.txt
+++ b/src/app/CMakeLists.txt
@@ -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
diff --git a/src/app/commands/cmd_scroll_center.cpp b/src/app/commands/cmd_scroll_center.cpp
new file mode 100644
index 0000000..0066719
--- /dev/null
+++ b/src/app/commands/cmd_scroll_center.cpp
@@ -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
diff --git a/src/app/commands/commands_list.h b/src/app/commands/commands_list.h
index 0cfef55..7a685b1 100644
--- a/src/app/commands/commands_list.h
+++ b/src/app/commands/commands_list.h
@@ -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)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git



More information about the Pkg-games-commits mailing list