{"action":"created","comment":{"url":"https://api.github.com/repos/bjorn/tiled/pulls/comments/33304325","id":33304325,"diff_hunk":"@@ -0,0 +1,100 @@\n+/*\n+ * selectsametiletool.cpp\n+ * Copyright 2009-2010, Jeff Bland <jksb@member.fsf.org>\n+ * Copyright 2010, Thorbjørn Lindeijer <thorbjorn@lindeijer.nl>\n+ * Copyright 2010, Jared Adams <jaxad0127@gmail.com>\n+ * Copyright 2011, Stefan Beller <stefanbeller@googlemail.com>\n+ *\n+ * This file is part of Tiled.\n+ *\n+ * This program is free software; you can redistribute it and/or modify it\n+ * under the terms of the GNU General Public License as published by the Free\n+ * Software Foundation; either version 2 of the License, or (at your option)\n+ * any later version.\n+ *\n+ * This program is distributed in the hope that it will be useful, but WITHOUT\n+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for\n+ * more details.\n+ *\n+ * You should have received a copy of the GNU General Public License along with\n+ * this program. If not, see <http://www.gnu.org/licenses/>.\n+ */\n+\n+#include \"selectsametiletool.h\"\n+\n+#include \"brushitem.h\"\n+#include \"mapdocument.h\"\n+#include \"changeselectedarea.h\"\n+\n+#include <QApplication>\n+\n+using namespace Tiled;\n+using namespace Tiled::Internal;\n+\n+SelectSameTileTool::SelectSameTileTool(QObject *parent)\n+    : AbstractTileTool(tr(\"Select Same Tile\"),\n+                       QIcon(QLatin1String(\n+                               \":images/22x22/stock-tool-select-same-tiles.png\")),\n+                       QKeySequence(tr(\"S\")),\n+                       parent)\n+{\n+}\n+\n+void SelectSameTileTool::tilePositionChanged(const QPoint &tilePos)\n+{\n+    // Make sure that a tile layer is selected and contains current tile pos.\n+    TileLayer *tileLayer = currentTileLayer();\n+    if (!tileLayer)\n+        return;\n+\n+    QRegion resultRegion;\n+    if (tileLayer->contains(tilePos)) {\n+        const Cell matchCell = tileLayer->cellAt(tilePos);\n+\n+        for (int i = 0; i < tileLayer->height(); ++i) {\n+            for (int j = 0; j < tileLayer->width(); ++j) {\n+                if (tileLayer->cellAt(i, j) == matchCell)\n+                    resultRegion += QRegion(i, j, 1, 1);\n+            }\n+        }","path":"src/tiled/selectsametiletool.cpp","position":60,"original_position":60,"commit_id":"66d39408d0011d08840b0c5594e4887b11af3ce9","original_commit_id":"66d39408d0011d08840b0c5594e4887b11af3ce9","user":{"login":"bjorn","id":531764,"avatar_url":"https://avatars.githubusercontent.com/u/531764?v=3","gravatar_id":"","url":"https://api.github.com/users/bjorn","html_url":"https://github.com/bjorn","followers_url":"https://api.github.com/users/bjorn/followers","following_url":"https://api.github.com/users/bjorn/following{/other_user}","gists_url":"https://api.github.com/users/bjorn/gists{/gist_id}","starred_url":"https://api.github.com/users/bjorn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bjorn/subscriptions","organizations_url":"https://api.github.com/users/bjorn/orgs","repos_url":"https://api.github.com/users/bjorn/repos","events_url":"https://api.github.com/users/bjorn/events{/privacy}","received_events_url":"https://api.github.com/users/bjorn/received_events","type":"User","site_admin":false},"body":"Building up a `QRegion` as a series of small 1x1 rectangles gets potentially quite slow. For this reason, a much more efficient version exists as `TileLayer::region(Condition condition)`. Please change your code to use that one. You can use the condition `MatchesAnyTile` in `tilesetdock.cpp` as an example.","created_at":"2015-06-25T20:59:48Z","updated_at":"2015-06-25T20:59:48Z","html_url":"https://github.com/bjorn/tiled/pull/1002#discussion_r33304325","pull_request_url":"https://api.github.com/repos/bjorn/tiled/pulls/1002","_links":{"self":{"href":"https://api.github.com/repos/bjorn/tiled/pulls/comments/33304325"},"html":{"href":"https://github.com/bjorn/tiled/pull/1002#discussion_r33304325"},"pull_request":{"href":"https://api.github.com/repos/bjorn/tiled/pulls/1002"}}},"pull_request":{"url":"https://api.github.com/repos/bjorn/tiled/pulls/1002","id":38581891,"html_url":"https://github.com/bjorn/tiled/pull/1002","diff_url":"https://github.com/bjorn/tiled/pull/1002.diff","patch_url":"https://github.com/bjorn/tiled/pull/1002.patch","issue_url":"https://api.github.com/repos/bjorn/tiled/issues/1002","number":1002,"state":"open","locked":false,"title":"Added select same tile tool.","user":{"login":"IMMZ","id":1856709,"avatar_url":"https://avatars.githubusercontent.com/u/1856709?v=3","gravatar_id":"","url":"https://api.github.com/users/IMMZ","html_url":"https://github.com/IMMZ","followers_url":"https://api.github.com/users/IMMZ/followers","following_url":"https://api.github.com/users/IMMZ/following{/other_user}","gists_url":"https://api.github.com/users/IMMZ/gists{/gist_id}","starred_url":"https://api.github.com/users/IMMZ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IMMZ/subscriptions","organizations_url":"https://api.github.com/users/IMMZ/orgs","repos_url":"https://api.github.com/users/IMMZ/repos","events_url":"https://api.github.com/users/IMMZ/events{/privacy}","received_events_url":"https://api.github.com/users/IMMZ/received_events","type":"User","site_admin":false},"body":"Added select same tile tool which selects all tiles which are similar to the current one.","created_at":"2015-06-25T19:08:01Z","updated_at":"2015-06-25T20:59:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"817250258e902500c8b30314a446f31ba5d294b7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bjorn/tiled/pulls/1002/commits","review_comments_url":"https://api.github.com/repos/bjorn/tiled/pulls/1002/comments","review_comment_url":"https://api.github.com/repos/bjorn/tiled/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bjorn/tiled/issues/1002/comments","statuses_url":"https://api.github.com/repos/bjorn/tiled/statuses/66d39408d0011d08840b0c5594e4887b11af3ce9","head":{"label":"IMMZ:new_tool","ref":"new_tool","sha":"66d39408d0011d08840b0c5594e4887b11af3ce9","user":{"login":"IMMZ","id":1856709,"avatar_url":"https://avatars.githubusercontent.com/u/1856709?v=3","gravatar_id":"","url":"https://api.github.com/users/IMMZ","html_url":"https://github.com/IMMZ","followers_url":"https://api.github.com/users/IMMZ/followers","following_url":"https://api.github.com/users/IMMZ/following{/other_user}","gists_url":"https://api.github.com/users/IMMZ/gists{/gist_id}","starred_url":"https://api.github.com/users/IMMZ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IMMZ/subscriptions","organizations_url":"https://api.github.com/users/IMMZ/orgs","repos_url":"https://api.github.com/users/IMMZ/repos","events_url":"https://api.github.com/users/IMMZ/events{/privacy}","received_events_url":"https://api.github.com/users/IMMZ/received_events","type":"User","site_admin":false},"repo":{"id":37856287,"name":"tiled","full_name":"IMMZ/tiled","owner":{"login":"IMMZ","id":1856709,"avatar_url":"https://avatars.githubusercontent.com/u/1856709?v=3","gravatar_id":"","url":"https://api.github.com/users/IMMZ","html_url":"https://github.com/IMMZ","followers_url":"https://api.github.com/users/IMMZ/followers","following_url":"https://api.github.com/users/IMMZ/following{/other_user}","gists_url":"https://api.github.com/users/IMMZ/gists{/gist_id}","starred_url":"https://api.github.com/users/IMMZ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IMMZ/subscriptions","organizations_url":"https://api.github.com/users/IMMZ/orgs","repos_url":"https://api.github.com/users/IMMZ/repos","events_url":"https://api.github.com/users/IMMZ/events{/privacy}","received_events_url":"https://api.github.com/users/IMMZ/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/IMMZ/tiled","description":"A generic tile map editor","fork":true,"url":"https://api.github.com/repos/IMMZ/tiled","forks_url":"https://api.github.com/repos/IMMZ/tiled/forks","keys_url":"https://api.github.com/repos/IMMZ/tiled/keys{/key_id}","collaborators_url":"https://api.github.com/repos/IMMZ/tiled/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/IMMZ/tiled/teams","hooks_url":"https://api.github.com/repos/IMMZ/tiled/hooks","issue_events_url":"https://api.github.com/repos/IMMZ/tiled/issues/events{/number}","events_url":"https://api.github.com/repos/IMMZ/tiled/events","assignees_url":"https://api.github.com/repos/IMMZ/tiled/assignees{/user}","branches_url":"https://api.github.com/repos/IMMZ/tiled/branches{/branch}","tags_url":"https://api.github.com/repos/IMMZ/tiled/tags","blobs_url":"https://api.github.com/repos/IMMZ/tiled/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/IMMZ/tiled/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/IMMZ/tiled/git/refs{/sha}","trees_url":"https://api.github.com/repos/IMMZ/tiled/git/trees{/sha}","statuses_url":"https://api.github.com/repos/IMMZ/tiled/statuses/{sha}","languages_url":"https://api.github.com/repos/IMMZ/tiled/languages","stargazers_url":"https://api.github.com/repos/IMMZ/tiled/stargazers","contributors_url":"https://api.github.com/repos/IMMZ/tiled/contributors","subscribers_url":"https://api.github.com/repos/IMMZ/tiled/subscribers","subscription_url":"https://api.github.com/repos/IMMZ/tiled/subscription","commits_url":"https://api.github.com/repos/IMMZ/tiled/commits{/sha}","git_commits_url":"https://api.github.com/repos/IMMZ/tiled/git/commits{/sha}","comments_url":"https://api.github.com/repos/IMMZ/tiled/comments{/number}","issue_comment_url":"https://api.github.com/repos/IMMZ/tiled/issues/comments{/number}","contents_url":"https://api.github.com/repos/IMMZ/tiled/contents/{+path}","compare_url":"https://api.github.com/repos/IMMZ/tiled/compare/{base}...{head}","merges_url":"https://api.github.com/repos/IMMZ/tiled/merges","archive_url":"https://api.github.com/repos/IMMZ/tiled/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/IMMZ/tiled/downloads","issues_url":"https://api.github.com/repos/IMMZ/tiled/issues{/number}","pulls_url":"https://api.github.com/repos/IMMZ/tiled/pulls{/number}","milestones_url":"https://api.github.com/repos/IMMZ/tiled/milestones{/number}","notifications_url":"https://api.github.com/repos/IMMZ/tiled/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/IMMZ/tiled/labels{/name}","releases_url":"https://api.github.com/repos/IMMZ/tiled/releases{/id}","created_at":"2015-06-22T13:20:40Z","updated_at":"2015-06-22T13:20:42Z","pushed_at":"2015-06-25T19:06:28Z","git_url":"git://github.com/IMMZ/tiled.git","ssh_url":"git@github.com:IMMZ/tiled.git","clone_url":"https://github.com/IMMZ/tiled.git","svn_url":"https://github.com/IMMZ/tiled","homepage":"http://www.mapeditor.org/","size":8876,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"bjorn:master","ref":"master","sha":"51b06cc88f4c32c72619e074ade18947757af39e","user":{"login":"bjorn","id":531764,"avatar_url":"https://avatars.githubusercontent.com/u/531764?v=3","gravatar_id":"","url":"https://api.github.com/users/bjorn","html_url":"https://github.com/bjorn","followers_url":"https://api.github.com/users/bjorn/followers","following_url":"https://api.github.com/users/bjorn/following{/other_user}","gists_url":"https://api.github.com/users/bjorn/gists{/gist_id}","starred_url":"https://api.github.com/users/bjorn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bjorn/subscriptions","organizations_url":"https://api.github.com/users/bjorn/orgs","repos_url":"https://api.github.com/users/bjorn/repos","events_url":"https://api.github.com/users/bjorn/events{/privacy}","received_events_url":"https://api.github.com/users/bjorn/received_events","type":"User","site_admin":false},"repo":{"id":1418150,"name":"tiled","full_name":"bjorn/tiled","owner":{"login":"bjorn","id":531764,"avatar_url":"https://avatars.githubusercontent.com/u/531764?v=3","gravatar_id":"","url":"https://api.github.com/users/bjorn","html_url":"https://github.com/bjorn","followers_url":"https://api.github.com/users/bjorn/followers","following_url":"https://api.github.com/users/bjorn/following{/other_user}","gists_url":"https://api.github.com/users/bjorn/gists{/gist_id}","starred_url":"https://api.github.com/users/bjorn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bjorn/subscriptions","organizations_url":"https://api.github.com/users/bjorn/orgs","repos_url":"https://api.github.com/users/bjorn/repos","events_url":"https://api.github.com/users/bjorn/events{/privacy}","received_events_url":"https://api.github.com/users/bjorn/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bjorn/tiled","description":"A generic tile map editor","fork":false,"url":"https://api.github.com/repos/bjorn/tiled","forks_url":"https://api.github.com/repos/bjorn/tiled/forks","keys_url":"https://api.github.com/repos/bjorn/tiled/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bjorn/tiled/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bjorn/tiled/teams","hooks_url":"https://api.github.com/repos/bjorn/tiled/hooks","issue_events_url":"https://api.github.com/repos/bjorn/tiled/issues/events{/number}","events_url":"https://api.github.com/repos/bjorn/tiled/events","assignees_url":"https://api.github.com/repos/bjorn/tiled/assignees{/user}","branches_url":"https://api.github.com/repos/bjorn/tiled/branches{/branch}","tags_url":"https://api.github.com/repos/bjorn/tiled/tags","blobs_url":"https://api.github.com/repos/bjorn/tiled/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bjorn/tiled/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bjorn/tiled/git/refs{/sha}","trees_url":"https://api.github.com/repos/bjorn/tiled/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bjorn/tiled/statuses/{sha}","languages_url":"https://api.github.com/repos/bjorn/tiled/languages","stargazers_url":"https://api.github.com/repos/bjorn/tiled/stargazers","contributors_url":"https://api.github.com/repos/bjorn/tiled/contributors","subscribers_url":"https://api.github.com/repos/bjorn/tiled/subscribers","subscription_url":"https://api.github.com/repos/bjorn/tiled/subscription","commits_url":"https://api.github.com/repos/bjorn/tiled/commits{/sha}","git_commits_url":"https://api.github.com/repos/bjorn/tiled/git/commits{/sha}","comments_url":"https://api.github.com/repos/bjorn/tiled/comments{/number}","issue_comment_url":"https://api.github.com/repos/bjorn/tiled/issues/comments{/number}","contents_url":"https://api.github.com/repos/bjorn/tiled/contents/{+path}","compare_url":"https://api.github.com/repos/bjorn/tiled/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bjorn/tiled/merges","archive_url":"https://api.github.com/repos/bjorn/tiled/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bjorn/tiled/downloads","issues_url":"https://api.github.com/repos/bjorn/tiled/issues{/number}","pulls_url":"https://api.github.com/repos/bjorn/tiled/pulls{/number}","milestones_url":"https://api.github.com/repos/bjorn/tiled/milestones{/number}","notifications_url":"https://api.github.com/repos/bjorn/tiled/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bjorn/tiled/labels{/name}","releases_url":"https://api.github.com/repos/bjorn/tiled/releases{/id}","created_at":"2011-02-27T15:18:22Z","updated_at":"2015-06-25T15:02:11Z","pushed_at":"2015-06-25T20:51:15Z","git_url":"git://github.com/bjorn/tiled.git","ssh_url":"git@github.com:bjorn/tiled.git","clone_url":"https://github.com/bjorn/tiled.git","svn_url":"https://github.com/bjorn/tiled","homepage":"http://www.mapeditor.org/","size":23282,"stargazers_count":3170,"watchers_count":3170,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":684,"mirror_url":null,"open_issues_count":287,"forks":684,"open_issues":287,"watchers":3170,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bjorn/tiled/pulls/1002"},"html":{"href":"https://github.com/bjorn/tiled/pull/1002"},"issue":{"href":"https://api.github.com/repos/bjorn/tiled/issues/1002"},"comments":{"href":"https://api.github.com/repos/bjorn/tiled/issues/1002/comments"},"review_comments":{"href":"https://api.github.com/repos/bjorn/tiled/pulls/1002/comments"},"review_comment":{"href":"https://api.github.com/repos/bjorn/tiled/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bjorn/tiled/pulls/1002/commits"},"statuses":{"href":"https://api.github.com/repos/bjorn/tiled/statuses/66d39408d0011d08840b0c5594e4887b11af3ce9"}}}}