From a09409adc9fb44aa5205652ded8ccad4e2d0ef8b Mon Sep 17 00:00:00 2001
From: Jonathan Wilkes <jon.w.wilkes@gmail.com>
Date: Thu, 10 Dec 2015 23:31:16 -0500
Subject: [PATCH] set the gop rectangle color in css presets

---
 pd/nw/css/c64.css              | 7 +++++++
 pd/nw/css/default.css          | 7 +++++++
 pd/nw/css/extended.css         | 7 +++++++
 pd/nw/css/inverted.css         | 9 +++++++++
 pd/nw/css/strongbad.css        | 8 ++++++++
 pd/nw/css/subdued.css          | 8 ++++++++
 pd/nw/css/vanilla.css          | 7 +++++++
 pd/nw/css/vanilla_inverted.css | 8 ++++++++
 pd/nw/pdgui.js                 | 9 ++++-----
 9 files changed, 65 insertions(+), 5 deletions(-)

diff --git a/pd/nw/css/c64.css b/pd/nw/css/c64.css
index 1045bf06f..c50d43984 100644
--- a/pd/nw/css/c64.css
+++ b/pd/nw/css/c64.css
@@ -60,6 +60,13 @@
     stroke: #7c71da;
 }
 
+/* The outline to show the visible area for a Graph-On-Parent canvas,
+   i.e., the "red rectangle" */
+#gop_rect {
+    fill: none;
+    stroke: #ff9933;
+}
+
 .cord.signal {
     stroke-width: 2;
     stroke: #7569d7;
diff --git a/pd/nw/css/default.css b/pd/nw/css/default.css
index c256cd42c..263fbc127 100644
--- a/pd/nw/css/default.css
+++ b/pd/nw/css/default.css
@@ -84,6 +84,13 @@ mark.console_find_highlighted {
     stroke: #e87216;
 }
 
+/* The outline to show the visible area for a Graph-On-Parent canvas,
+   i.e., the "red rectangle" */
+#gop_rect {
+    fill: none;
+    stroke: red; 
+}
+
 .cord.signal {
     stroke-width: 2;
     stroke: #808095;
diff --git a/pd/nw/css/extended.css b/pd/nw/css/extended.css
index 1523d29d7..df5e84a07 100644
--- a/pd/nw/css/extended.css
+++ b/pd/nw/css/extended.css
@@ -59,6 +59,13 @@
     stroke: black;
 }
 
+/* The outline to show the visible area for a Graph-On-Parent canvas,
+   i.e., the "red rectangle" */
+#gop_rect {
+    fill: none;
+    stroke: red;
+}
+
 .cord.signal {
     stroke-width: 2;
     stroke: #828297;
diff --git a/pd/nw/css/inverted.css b/pd/nw/css/inverted.css
index 8605587f8..9c93459e2 100644
--- a/pd/nw/css/inverted.css
+++ b/pd/nw/css/inverted.css
@@ -61,6 +61,15 @@
     stroke: white;
 }
 
+/* The outline to show the visible area for a Graph-On-Parent canvas,
+   i.e., the "red rectangle" */
+#gop_rect {
+    fill: none;
+    stroke: blue;
+    stroke-opacity: 0.8;
+    stroke-dasharray: 5 2;
+}
+
 .cord.signal {
     stroke-width: 2;
     stroke: #7d7d68;
diff --git a/pd/nw/css/strongbad.css b/pd/nw/css/strongbad.css
index b603c8aa0..1737eeb92 100644
--- a/pd/nw/css/strongbad.css
+++ b/pd/nw/css/strongbad.css
@@ -60,6 +60,14 @@
     stroke: #53b83b;
 }
 
+/* The outline to show the visible area for a Graph-On-Parent canvas,
+   i.e., the "red rectangle" */
+#gop_rect {
+    fill: none;
+    stroke: red;
+    stroke-opacity: 0.6;
+}
+
 .cord.signal {
     stroke-width: 2;
     stroke: #53b83b;
diff --git a/pd/nw/css/subdued.css b/pd/nw/css/subdued.css
index 073b1d6c3..ca36e375b 100644
--- a/pd/nw/css/subdued.css
+++ b/pd/nw/css/subdued.css
@@ -60,6 +60,14 @@
     stroke: #333333;
 }
 
+/* The outline to show the visible area for a Graph-On-Parent canvas,
+   i.e., the "red rectangle" */
+#gop_rect {
+    fill: none;
+    stroke: blue;
+    stroke-opacity: 0.4;
+}
+
 .cord.signal {
     stroke-width: 2;
     stroke: #666666;
diff --git a/pd/nw/css/vanilla.css b/pd/nw/css/vanilla.css
index 6aa0a5f0b..07c22908e 100644
--- a/pd/nw/css/vanilla.css
+++ b/pd/nw/css/vanilla.css
@@ -60,6 +60,13 @@
     stroke: black;
 }
 
+/* The outline to show the visible area for a Graph-On-Parent canvas,
+   i.e., the "red rectangle" */
+#gop_rect {
+    fill: none;
+    stroke: red;
+}
+
 .cord.signal {
     stroke-width: 2;
     stroke: black;
diff --git a/pd/nw/css/vanilla_inverted.css b/pd/nw/css/vanilla_inverted.css
index 48920bbab..11840c591 100644
--- a/pd/nw/css/vanilla_inverted.css
+++ b/pd/nw/css/vanilla_inverted.css
@@ -60,6 +60,14 @@
     stroke: white;
 }
 
+/* The outline to show the visible area for a Graph-On-Parent canvas,
+   i.e., the "red rectangle" */
+#gop_rect {
+    fill: none;
+    stroke: blue;
+    stroke-opacity: 0.8;
+}
+
 .cord.signal {
     stroke-width: 2;
     stroke: white;
diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js
index b3a9c610a..f1813f417 100644
--- a/pd/nw/pdgui.js
+++ b/pd/nw/pdgui.js
@@ -2846,18 +2846,17 @@ function gui_canvas_drawredrect(cid, x1, y1, x2, y2) {
     var svgelem = get_item(cid, "patchsvg"),
         b;
     b = create_item(cid, "rect", {
-        x: x1,
-        y: y1,
+        x: x1 + 0.5, // align to pixel grid
+        y: y1 + 0.5, // align to pixel grid
         width: x2 - x1,
         height: y2 - y1,
-        stroke: "red",
-        id: "GOP"
+        id: "gop_rect" // Note: the old tk tag was "GOP"
     });
     svgelem.appendChild(b);
 }
 
 function gui_canvas_deleteredrect(cid) {
-    var r = get_item(cid, "GOP");
+    var r = get_item(cid, "gop_rect");
     // We need to check for existence here, because the first
     // time setting GOP in properties, there is no red rect yet.
     // But setting properties when the subpatch's window is
-- 
GitLab