From 21606f2f5781f648c5dd26020983e4fdaec4fd19 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 12 May 2020 00:11:01 +0200 Subject: [PATCH] Add crop left/right top/bottom link control. --- graphics/link.png | Bin 0 -> 334 bytes graphics/src/link.svg | 78 +++++++++++++++++++++++ graphics/update | 3 + graphics/web/favicon-128x128.png | Bin 25054 -> 25054 bytes graphics/web/favicon-16x16.png | Bin 1977 -> 1977 bytes graphics/web/favicon-32x32.png | Bin 3755 -> 3755 bytes graphics/web/favicon-64x64.png | Bin 9595 -> 9595 bytes src/wx/video_panel.cc | 102 +++++++++++++++++++++++++++---- src/wx/video_panel.h | 9 +++ 9 files changed, 180 insertions(+), 12 deletions(-) create mode 100644 graphics/link.png create mode 100644 graphics/src/link.svg diff --git a/graphics/link.png b/graphics/link.png new file mode 100644 index 0000000000000000000000000000000000000000..69af402f6e9e7298e220a61a290988536bcd0950 GIT binary patch literal 334 zcmeAS@N?(olHy`uVBq!ia0vp^oIotV!3HFcc!W9wDVAa<&kznEsNqQI04XT&h%5%u zcR`r3Ab1fwkRe&(8c`CQpH@mmtT}V`<;yxP|;~m7sn8d ziM1L~p_b zk^d}e-Yqp7-n=_wz1i4$%`1*tn?>Ethu*UYpSdixc6e0z_#0m5G`C$mCR()x + + + + + + + + + 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 6214556419d2b3b204e3cb6afd2b6d10c5387eb2..9330c0cdc6476efca5d0e176f0d03b1a1407a739 100644 GIT binary patch delta 80 zcmcb2nDO3W#tp9-Iazra*wow;9=31(!uTjo+*H@lD8#_P%D~LZ*h1UD$jZP#BmIlQ T}HEj2@=ChDIR<237`UR>l_E21Zr}1{&#K6c`v7 mR7+eVN>UO_Qmu0HQ!>*k8H@~!40H{!Xo$4(nKSt(+W`P3yc-z+ delta 99 zcmdnVzmtDMIx8m&tFWH1P}>LD%>}HEj2OX+3J&jvK;^bWh5N4 diff --git a/graphics/web/favicon-32x32.png b/graphics/web/favicon-32x32.png index 847bc813a7a7e6c3206fd2bdc6e50cbcbdee54fe..e9772da248ae57c4f609973824954f2f36474a5d 100644 GIT binary patch delta 78 zcmZ22yIOX`Yer619tJiw_k@S-o4+uw=N32BH8ct_Ft9Q(vof~OHZZa>FwjWFgShs^6bgG Rc%`t(?V6UYKKV880RXOP7*hZM diff --git a/graphics/web/favicon-64x64.png b/graphics/web/favicon-64x64.png index e836814d1bb9b2fda9c4684643886de028795d96..0ff824f40465981e9159fa7a0a447ecf772dbedc 100644 GIT binary patch delta 78 zcmezE_1kO1Yer619tJiw_k@S-o4+vDD~X%x8XAQd7+4vYSs7bs8yHy`7-*z_QJCDN QB85#Z(#mJf +#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; -- 2.30.2