[aseprite] 16/134: Add Alt+Shift+G shortcut to toogle the pixel grid visibility (fix #504)

Tobias Hansen thansen at moszumanska.debian.org
Sat Mar 14 17:09:56 UTC 2015


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

thansen pushed a commit to branch master
in repository aseprite.

commit c6aedc117a2a5f7f3a3f8e5b8a8539c5130d9f0a
Author: David Capello <davidcapello at gmail.com>
Date:   Sun Oct 26 00:48:15 2014 -0300

    Add Alt+Shift+G shortcut to toogle the pixel grid visibility (fix #504)
---
 data/gui.xml                     |  1 +
 src/app/commands/cmd_grid.cpp    | 32 ++++++++++++++++++++++++++++++++
 src/app/commands/commands_list.h |  1 +
 3 files changed, 34 insertions(+)

diff --git a/data/gui.xml b/data/gui.xml
index 934758d..95c0fd4 100644
--- a/data/gui.xml
+++ b/data/gui.xml
@@ -88,6 +88,7 @@
       <key command="SplitEditorHorizontally" shortcut="Ctrl+3" mac="Cmd+3" />
       <key command="Preview" shortcut="F8" />
       <key command="ShowGrid" shortcut="Shift+G" />
+      <key command="ShowPixelGrid" shortcut="Alt+Shift+G" />
       <key command="SnapToGrid" shortcut="Shift+S" />
       <key command="ShowOnionSkin" shortcut="F3" />
       <key command="Timeline" shortcut="Tab">
diff --git a/src/app/commands/cmd_grid.cpp b/src/app/commands/cmd_grid.cpp
index 3b77638..2e895a6 100644
--- a/src/app/commands/cmd_grid.cpp
+++ b/src/app/commands/cmd_grid.cpp
@@ -67,6 +67,33 @@ protected:
   }
 };
 
+class ShowPixelGridCommand : public Command {
+public:
+  ShowPixelGridCommand()
+    : Command("ShowPixelGrid",
+              "Show Pixel Grid",
+              CmdUIOnlyFlag)
+  {
+  }
+
+  Command* clone() const override { return new ShowPixelGridCommand(*this); }
+
+protected:
+  bool onChecked(Context* context)
+  {
+    IDocumentSettings* docSettings = context->settings()->getDocumentSettings(context->activeDocument());
+
+    return docSettings->getPixelGridVisible();
+  }
+
+  void onExecute(Context* context)
+  {
+    IDocumentSettings* docSettings = context->settings()->getDocumentSettings(context->activeDocument());
+
+    docSettings->setPixelGridVisible(docSettings->getPixelGridVisible() ? false: true);
+  }
+};
+
 class SnapToGridCommand : public Command {
 public:
   SnapToGridCommand()
@@ -158,6 +185,11 @@ Command* CommandFactory::createShowGridCommand()
   return new ShowGridCommand;
 }
 
+Command* CommandFactory::createShowPixelGridCommand()
+{
+  return new ShowPixelGridCommand;
+}
+
 Command* CommandFactory::createSnapToGridCommand()
 {
   return new SnapToGridCommand;
diff --git a/src/app/commands/commands_list.h b/src/app/commands/commands_list.h
index 67346ef..bfb66b9 100644
--- a/src/app/commands/commands_list.h
+++ b/src/app/commands/commands_list.h
@@ -102,6 +102,7 @@ FOR_EACH_COMMAND(Scroll)
 FOR_EACH_COMMAND(SetPalette)
 FOR_EACH_COMMAND(ShowGrid)
 FOR_EACH_COMMAND(ShowOnionSkin)
+FOR_EACH_COMMAND(ShowPixelGrid)
 FOR_EACH_COMMAND(SnapToGrid)
 FOR_EACH_COMMAND(SplitEditorHorizontally)
 FOR_EACH_COMMAND(SplitEditorVertically)

-- 
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