# HG changeset patch
# User Pantxo Diribarne <pantxo.diribarne@gmail.com>
# Date 1701631792 -3600
#      Sun Dec 03 20:29:52 2023 +0100
# Branch stable
# Node ID 7805a3cd788219ec0f631f73623aebbde2897753
# Parent  4a65f4d6c80494b799ed49186dfd6019c515a875
__contour__.m: Accept "edgecolor" as an alias for "linecolor" (bug #64956)

* __contour__.m: Add "edgecolor" as possible input property. Add new property
                 and same listener as "linecolor". Add new listener to always
                 "linecolor" and "edgecolor" identical.
 (copy_color): New listener.
 (update_line): Prefer "edgecolor" over "linecolor".

diff -r 4a65f4d6c804 -r 7805a3cd7882 scripts/plot/draw/private/__contour__.m
--- a/scripts/plot/draw/private/__contour__.m	Fri Dec 01 11:30:43 2023 +0100
+++ b/scripts/plot/draw/private/__contour__.m	Sun Dec 03 20:29:52 2023 +0100
@@ -46,7 +46,7 @@
           filled = varargin{i+1};
           varargin(i:i+1) = [];
           continue;
-        elseif (strcmpi (arg, "linecolor"))
+        elseif (any (strcmpi (arg, {"linecolor", "edgecolor"})))
           linespec.color = varargin{i+1};
           varargin(i:i+1) = [];
           continue;
@@ -194,6 +194,7 @@
   addproperty ("showtext", hg, "radio", "on|{off}", "off");
 
   addproperty ("linecolor", hg, "color", linespec.color, "{auto}|none");
+  addproperty ("edgecolor", hg, "color", linespec.color, "{auto}|none");
   addproperty ("linestyle", hg, "linelinestyle", linespec.linestyle);
   addproperty ("linewidth", hg, "linelinewidth", 0.5);
 
@@ -220,7 +221,10 @@
   addlistener (hg, "textstepmode", @update_text);
   addlistener (hg, "showtext", @update_text);
 
+  addlistener (hg, "linecolor", {@copy_color, "linecolor"});
+  addlistener (hg, "edgecolor", {@copy_color, "edgecolor"});
   addlistener (hg, "linecolor", @update_line);
+  addlistener (hg, "edgecolor", @update_line);
   addlistener (hg, "linestyle", @update_line);
   addlistener (hg, "linewidth", @update_line);
 
@@ -245,7 +249,7 @@
   fill = get (hg, "fill");
   zlev = get (hg, "zlevel");
   zmode = get (hg, "zlevelmode");
-  lc = get (hg, "linecolor");
+  lc = get (hg, "edgecolor");
   lw = get (hg, "linewidth");
   ls = get (hg, "linestyle");
   filled = get (hg, "fill");
@@ -434,9 +438,29 @@
 
 endfunction
 
+function copy_color (h, ~, prop)
+
+  persistent updating = false;
+
+  if (updating)
+    return
+  endif
+
+  updating = true;
+
+  if (strcmp (prop, "linecolor"))
+    set (h, "edgecolor", get (h, "linecolor"));
+  else
+    set (h, "linecolor", get (h, "edgecolor"));
+  endif
+
+  updating = false;
+
+endfunction
+
 function update_line (h, ~)
 
-  lc = get (h, "linecolor");
+  lc = get (h, "edgecolor");
   if (strcmp (lc, "auto"))
     lc = "flat";
   endif
