Add crop left/right top/bottom link control.
authorCarl Hetherington <cth@carlh.net>
Mon, 11 May 2020 22:11:01 +0000 (00:11 +0200)
committerCarl Hetherington <cth@carlh.net>
Tue, 12 May 2020 11:13:36 +0000 (13:13 +0200)
graphics/link.png [new file with mode: 0644]
graphics/src/link.svg [new file with mode: 0644]
graphics/update
graphics/web/favicon-128x128.png
graphics/web/favicon-16x16.png
graphics/web/favicon-32x32.png
graphics/web/favicon-64x64.png
src/wx/video_panel.cc
src/wx/video_panel.h

diff --git a/graphics/link.png b/graphics/link.png
new file mode 100644 (file)
index 0000000..69af402
Binary files /dev/null and b/graphics/link.png differ
diff --git a/graphics/src/link.svg b/graphics/src/link.svg
new file mode 100644 (file)
index 0000000..bf58ad7
--- /dev/null
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="40.736046mm"
+   height="72.459007mm"
+   viewBox="0 0 40.736045 72.459008"
+   version="1.1"
+   id="svg8"
+   inkscape:version="0.92.3 (2405546, 2018-03-11)"
+   sodipodi:docname="link.svg">
+  <defs
+     id="defs2" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="1.979899"
+     inkscape:cx="30.0516"
+     inkscape:cy="107.36255"
+     inkscape:document-units="mm"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1680"
+     inkscape:window-height="995"
+     inkscape:window-x="0"
+     inkscape:window-y="27"
+     inkscape:window-maximized="1"
+     fit-margin-top="1"
+     fit-margin-left="1"
+     fit-margin-right="1"
+     fit-margin-bottom="1" />
+  <metadata
+     id="metadata5">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(-43.172802,-2.2134689)">
+    <g
+       id="g11"
+       transform="matrix(-3.0676153e-5,-1.0020549,1.0020464,-0.00413633,25.020746,102.13853)"
+       style="stroke-width:0.99795336">
+      <path
+         sodipodi:nodetypes="ccsccccccscscccccsssccc"
+         inkscape:connector-curvature="0"
+         id="rect819"
+         d="m 65.199219,27.601562 0.3125,0.01172 c 0,0 -1.921609,-0.08686 -3.953125,0.625 -2.031517,0.711861 -4.556382,2.227912 -6.824219,5.013672 l 6.205078,5.050781 c 1.370276,-1.683216 2.525799,-2.25443 3.265625,-2.513672 0.739826,-0.259241 0.679688,-0.199218 0.679688,-0.199218 l 0.15625,0.01172 h 19.550781 c 2.172037,0.06924 3.36417,0.821834 4.335937,2.03125 0.973224,1.211229 1.583731,3.040311 1.589844,4.931641 0.0061,1.89133 -0.59167,3.751118 -1.582031,5.015625 -0.986061,1.259016 -2.231578,2.067616 -4.441406,2.205078 h -15.51516 l -3.779762,8 h 19.626953 l 0.11914,-0.0078 c 4.347056,-0.25782 8.013718,-2.360449 10.289063,-5.26564 2.275345,-2.905192 3.294538,-6.465865 3.283203,-9.972657 C 98.506244,39.032271 97.46527,35.48507 95.164062,32.621094 92.862855,29.757118 89.15903,27.737178 84.832031,27.603516 l -0.0625,-0.002 z"
+         style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:7.98362684;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
+      <path
+         sodipodi:nodetypes="ccscscccccccccccscscccc"
+         inkscape:connector-curvature="0"
+         id="rect819-7"
+         d="m 41.986328,19.101562 -0.117187,0.0059 c -4.347056,0.257804 -8.013718,2.360434 -10.289063,5.265625 -2.275345,2.905191 -3.296491,6.467818 -3.285156,9.974609 0.01133,3.506791 1.054262,7.05204 3.355469,9.916016 2.301207,2.863976 6.005032,4.885869 10.332031,5.019531 l 0.0625,0.002 h 19.570312 l -0.3125,-0.01172 c 0,0 1.921609,0.08491 3.953125,-0.626954 2.031517,-0.711861 4.556382,-2.227911 6.824219,-5.013672 L 65.875,38.582031 c -1.370276,1.683217 -2.525798,2.256384 -3.265625,2.515625 -0.739827,0.259242 -0.681641,0.199219 -0.681641,0.199219 l -0.15625,-0.01172 H 42.220703 c -2.172033,-0.06924 -3.362218,-0.821835 -4.333984,-2.03125 -0.973223,-1.211229 -1.585684,-3.04031 -1.591797,-4.93164 -0.0061,-1.891331 0.59167,-3.751118 1.582031,-5.015625 0.984624,-1.257182 2.229804,-2.06585 4.433594,-2.205079 h 14.957961 l 4.346726,-8 z"
+         style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:7.98362684;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
+    </g>
+  </g>
+</svg>
index 9b75493dbd94a0e5480d92540241f06a2d2ad6f9..f0a7fd597b418123b4eea8a7b061807484c4fa9c 100755 (executable)
@@ -84,6 +84,9 @@ else
     $INKSCAPE tick.png src/tick.svg -w 16 -h 16
     $INKSCAPE no_tick.png src/no_tick.svg -w 16 -h 16
 
+    # Link icon
+    $INKSCAPE link.png src/link.svg -w 9 -h 16
+
     # favicon
     mkdir -p web
     convert src/web.png -resize 256x256 -transparent white web/favicon-256x256.png
index 6214556419d2b3b204e3cb6afd2b6d10c5387eb2..9330c0cdc6476efca5d0e176f0d03b1a1407a739 100644 (file)
Binary files a/graphics/web/favicon-128x128.png and b/graphics/web/favicon-128x128.png differ
index 4c31c0258b920b7011bf47ae6e91059812748ffc..82639fddf987b9e87d7507ac5edb649c71ead67a 100644 (file)
Binary files a/graphics/web/favicon-16x16.png and b/graphics/web/favicon-16x16.png differ
index 847bc813a7a7e6c3206fd2bdc6e50cbcbdee54fe..e9772da248ae57c4f609973824954f2f36474a5d 100644 (file)
Binary files a/graphics/web/favicon-32x32.png and b/graphics/web/favicon-32x32.png differ
index e836814d1bb9b2fda9c4684643886de028795d96..0ff824f40465981e9159fa7a0a447ecf772dbedc 100644 (file)
Binary files a/graphics/web/favicon-64x64.png and b/graphics/web/favicon-64x64.png differ
index 8a9136008b42eab613e1e3f255bf0a197c00fc7d..24099e1ccd97ed2b524ce31a9bc20490542e4e25 100644 (file)
@@ -38,6 +38,7 @@
 #include "lib/dcp_content.h"
 #include "lib/video_content.h"
 #include <wx/spinctrl.h>
+#include <wx/tglbtn.h>
 #include <boost/foreach.hpp>
 #include <boost/unordered_set.hpp>
 #include <boost/functional/hash.hpp>
@@ -84,44 +85,57 @@ VideoPanel::VideoPanel (ContentPanel* p)
 
        _crop_label = create_label (this, _("Crop"), true);
 
+       int const crop_width = 56;
+       int const link_height = 28;
+
        _left_crop_label = create_label (this, _("Left"), true);
        _left_crop = new ContentSpinCtrl<VideoContent> (
                this,
-               new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1)),
+               new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(crop_width, -1)),
                VideoContentProperty::CROP,
                &Content::video,
                boost::mem_fn (&VideoContent::left_crop),
-               boost::mem_fn (&VideoContent::set_left_crop)
+               boost::mem_fn (&VideoContent::set_left_crop),
+               boost::bind (&VideoPanel::left_crop_changed, this)
                );
 
+       _left_right_link = new wxToggleButton (this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(22, link_height));
+       _left_right_link->SetBitmap (wxBitmap(bitmap_path("link"), wxBITMAP_TYPE_PNG));
+
        _right_crop_label = create_label (this, _("Right"), true);
        _right_crop = new ContentSpinCtrl<VideoContent> (
                this,
-               new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1)),
+               new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(crop_width, -1)),
                VideoContentProperty::CROP,
                &Content::video,
                boost::mem_fn (&VideoContent::right_crop),
-               boost::mem_fn (&VideoContent::set_right_crop)
+               boost::mem_fn (&VideoContent::set_right_crop),
+               boost::bind (&VideoPanel::right_crop_changed, this)
                );
 
        _top_crop_label = create_label (this, _("Top"), true);
        _top_crop = new ContentSpinCtrl<VideoContent> (
                this,
-               new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1)),
+               new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(crop_width, -1)),
                VideoContentProperty::CROP,
                &Content::video,
                boost::mem_fn (&VideoContent::top_crop),
-               boost::mem_fn (&VideoContent::set_top_crop)
+               boost::mem_fn (&VideoContent::set_top_crop),
+               boost::bind (&VideoPanel::top_crop_changed, this)
                );
 
+       _top_bottom_link = new wxToggleButton (this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(22, link_height));
+       _top_bottom_link->SetBitmap (wxBitmap(bitmap_path("link"), wxBITMAP_TYPE_PNG));
+
        _bottom_crop_label = create_label (this, _("Bottom"), true);
        _bottom_crop = new ContentSpinCtrl<VideoContent> (
                this,
-               new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1)),
+               new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(crop_width, -1)),
                VideoContentProperty::CROP,
                &Content::video,
                boost::mem_fn (&VideoContent::bottom_crop),
-               boost::mem_fn (&VideoContent::set_bottom_crop)
+               boost::mem_fn (&VideoContent::set_bottom_crop),
+               boost::bind (&VideoPanel::bottom_crop_changed, this)
                );
 
        _fade_in_label = create_label (this, _("Fade in"), true);
@@ -189,6 +203,8 @@ VideoPanel::VideoPanel (ContentPanel* p)
        _colour_conversion->Bind             (wxEVT_CHOICE,   boost::bind (&VideoPanel::colour_conversion_changed, this));
        _range->Bind                         (wxEVT_CHOICE,   boost::bind (&VideoPanel::range_changed, this));
        _edit_colour_conversion_button->Bind (wxEVT_BUTTON,   boost::bind (&VideoPanel::edit_colour_conversion_clicked, this));
+       _left_right_link->Bind               (wxEVT_TOGGLEBUTTON, boost::bind(&VideoPanel::left_right_link_clicked, this));
+       _top_bottom_link->Bind               (wxEVT_TOGGLEBUTTON, boost::bind(&VideoPanel::top_bottom_link_clicked, this));
 
        add_to_grid ();
 }
@@ -223,13 +239,15 @@ VideoPanel::add_to_grid ()
        wxGridBagSizer* crop = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
        add_label_to_sizer (crop, _left_crop_label, true, wxGBPosition (cr, 0));
        _left_crop->add (crop, wxGBPosition (cr, 1));
-       add_label_to_sizer (crop, _right_crop_label, true, wxGBPosition (cr, 2));
-       _right_crop->add (crop, wxGBPosition (cr, 3));
+       crop->Add (_left_right_link, wxGBPosition(cr, 2));
+       add_label_to_sizer (crop, _right_crop_label, true, wxGBPosition (cr, 3));
+       _right_crop->add (crop, wxGBPosition (cr, 4));
        ++cr;
        add_label_to_sizer (crop, _top_crop_label, true, wxGBPosition (cr, 0));
        _top_crop->add (crop, wxGBPosition (cr, 1));
-       add_label_to_sizer (crop, _bottom_crop_label, true, wxGBPosition (cr, 2));
-       _bottom_crop->add (crop, wxGBPosition (cr, 3));
+       crop->Add (_top_bottom_link, wxGBPosition(cr, 2));
+       add_label_to_sizer (crop, _bottom_crop_label, true, wxGBPosition (cr, 3));
+       _bottom_crop->add (crop, wxGBPosition (cr, 4));
        add_label_to_sizer (_grid, _crop_label, true, wxGBPosition(r, 0));
        _grid->Add (crop, wxGBPosition(r, 1));
        ++r;
@@ -739,3 +757,63 @@ VideoPanel::scale_custom_edit_clicked ()
        return r == wxID_OK;
 }
 
+
+void
+VideoPanel::left_right_link_clicked ()
+{
+       right_crop_changed ();
+}
+
+
+void
+VideoPanel::top_bottom_link_clicked ()
+{
+       bottom_crop_changed ();
+}
+
+
+void
+VideoPanel::left_crop_changed ()
+{
+       if (_left_right_link->GetValue()) {
+               BOOST_FOREACH (shared_ptr<Content> i, _parent->selected_video()) {
+                       i->video->set_right_crop (i->video->left_crop());
+               }
+       }
+}
+
+
+void
+VideoPanel::right_crop_changed ()
+{
+       if (_left_right_link->GetValue()) {
+               BOOST_FOREACH (shared_ptr<Content> i, _parent->selected_video()) {
+                       i->video->set_left_crop (i->video->right_crop());
+               }
+       }
+}
+
+
+void
+VideoPanel::top_crop_changed ()
+{
+       if (_top_bottom_link->GetValue()) {
+               BOOST_FOREACH (shared_ptr<Content> i, _parent->selected_video()) {
+                       i->video->set_bottom_crop (i->video->top_crop());
+               }
+       }
+}
+
+
+void
+VideoPanel::bottom_crop_changed ()
+{
+       if (_top_bottom_link->GetValue()) {
+               BOOST_FOREACH (shared_ptr<Content> i, _parent->selected_video()) {
+                       i->video->set_top_crop (i->video->bottom_crop());
+               }
+       }
+}
+
+
+
index 22c5644828ab9de26594398cbd80f6e8745ab645..31aeed2e1d36ea166d1df8e635391ca8b692bf09 100644 (file)
@@ -31,6 +31,7 @@ class wxChoice;
 class wxStaticText;
 class wxSpinCtrl;
 class wxButton;
+class wxToggleButton;
 
 /** @class VideoPanel
  *  @brief The video tab of the film editor.
@@ -57,6 +58,12 @@ private:
        void scale_fit_clicked ();
        void scale_custom_clicked ();
        bool scale_custom_edit_clicked ();
+       void left_right_link_clicked ();
+       void top_bottom_link_clicked ();
+       void left_crop_changed ();
+       void right_crop_changed ();
+       void top_crop_changed ();
+       void bottom_crop_changed ();
 
        void setup_description ();
        void setup_sensitivity ();
@@ -69,10 +76,12 @@ private:
        wxStaticText* _crop_label;
        wxStaticText* _left_crop_label;
        ContentSpinCtrl<VideoContent>* _left_crop;
+       wxToggleButton* _left_right_link;
        wxStaticText* _right_crop_label;
        ContentSpinCtrl<VideoContent>* _right_crop;
        wxStaticText* _top_crop_label;
        ContentSpinCtrl<VideoContent>* _top_crop;
+       wxToggleButton* _top_bottom_link;
        wxStaticText* _bottom_crop_label;
        ContentSpinCtrl<VideoContent>* _bottom_crop;
        wxStaticText* _fade_in_label;