From: Carl Hetherington Date: Mon, 11 May 2020 22:11:01 +0000 (+0200) Subject: Add crop left/right top/bottom link control. X-Git-Tag: v2.15.72~3^2~1 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=21606f2f5781f648c5dd26020983e4fdaec4fd19 Add crop left/right top/bottom link control. --- diff --git a/graphics/link.png b/graphics/link.png new file mode 100644 index 000000000..69af402f6 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 index 000000000..bf58ad7de --- /dev/null +++ b/graphics/src/link.svg @@ -0,0 +1,78 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/graphics/update b/graphics/update index 9b75493db..f0a7fd597 100755 --- a/graphics/update +++ b/graphics/update @@ -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 diff --git a/graphics/web/favicon-128x128.png b/graphics/web/favicon-128x128.png index 621455641..9330c0cdc 100644 Binary files a/graphics/web/favicon-128x128.png and b/graphics/web/favicon-128x128.png differ diff --git a/graphics/web/favicon-16x16.png b/graphics/web/favicon-16x16.png index 4c31c0258..82639fddf 100644 Binary files a/graphics/web/favicon-16x16.png and b/graphics/web/favicon-16x16.png differ diff --git a/graphics/web/favicon-32x32.png b/graphics/web/favicon-32x32.png index 847bc813a..e9772da24 100644 Binary files a/graphics/web/favicon-32x32.png and b/graphics/web/favicon-32x32.png differ diff --git a/graphics/web/favicon-64x64.png b/graphics/web/favicon-64x64.png index e836814d1..0ff824f40 100644 Binary files a/graphics/web/favicon-64x64.png and b/graphics/web/favicon-64x64.png differ diff --git a/src/wx/video_panel.cc b/src/wx/video_panel.cc index 8a9136008..24099e1cc 100644 --- a/src/wx/video_panel.cc +++ b/src/wx/video_panel.cc @@ -38,6 +38,7 @@ #include "lib/dcp_content.h" #include "lib/video_content.h" #include +#include #include #include #include @@ -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 ( 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 ( 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 ( 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 ( 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 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 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 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 i, _parent->selected_video()) { + i->video->set_top_crop (i->video->bottom_crop()); + } + } +} + + + diff --git a/src/wx/video_panel.h b/src/wx/video_panel.h index 22c564482..31aeed2e1 100644 --- a/src/wx/video_panel.h +++ b/src/wx/video_panel.h @@ -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* _left_crop; + wxToggleButton* _left_right_link; wxStaticText* _right_crop_label; ContentSpinCtrl* _right_crop; wxStaticText* _top_crop_label; ContentSpinCtrl* _top_crop; + wxToggleButton* _top_bottom_link; wxStaticText* _bottom_crop_label; ContentSpinCtrl* _bottom_crop; wxStaticText* _fade_in_label;