diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-07-09 19:36:33 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-07-09 19:37:16 +0200 |
| commit | f89f471e821b33839d3a24c2ed39a5595b83b6ee (patch) | |
| tree | 451a0c0e1bcf087d5c4070199cb92dd0e7d18fab | |
| parent | ac2304c3cb37dcde2c5a91ddd1e19f788ce3896f (diff) | |
Add menu option to remove a reel boundary (#2824).
| -rw-r--r-- | src/wx/dcp_timeline.cc | 18 | ||||
| -rw-r--r-- | src/wx/dcp_timeline.h | 2 |
2 files changed, 19 insertions, 1 deletions
diff --git a/src/wx/dcp_timeline.cc b/src/wx/dcp_timeline.cc index e25f93484..f3ccea037 100644 --- a/src/wx/dcp_timeline.cc +++ b/src/wx/dcp_timeline.cc @@ -56,7 +56,8 @@ auto constexpr content_y_pos = 112; auto constexpr content_type_height = 12; enum { - ID_add_reel_boundary = DCPOMATIC_DCP_TIMELINE_MENU + ID_add_reel_boundary = DCPOMATIC_DCP_TIMELINE_MENU, + ID_remove_reel_boundary }; @@ -169,6 +170,8 @@ DCPTimeline::DCPTimeline(wxWindow* parent, shared_ptr<Film> film) _menu = new wxMenu; _add_reel_boundary = _menu->Append(ID_add_reel_boundary, _("Add reel boundary")); _canvas->Bind(wxEVT_MENU, boost::bind(&DCPTimeline::add_reel_boundary, this), ID_add_reel_boundary); + _remove_reel_boundary = _menu->Append(ID_remove_reel_boundary, _("Remove reel boundary")); + _canvas->Bind(wxEVT_MENU, boost::bind(&DCPTimeline::remove_reel_boundary, this), ID_remove_reel_boundary); setup_reel_settings(); setup_reel_boundaries(); @@ -189,6 +192,18 @@ DCPTimeline::add_reel_boundary() void +DCPTimeline::remove_reel_boundary() +{ + auto boundaries = film()->custom_reel_boundaries(); + auto boundary = position_to_reel_boundary({_right_down_position.x, _right_down_position.y}); + if (boundary) { + boundaries.erase(std::remove(boundaries.begin(), boundaries.end(), boundary->time()), boundaries.end()); + film()->set_custom_reel_boundaries(boundaries); + } +} + + +void DCPTimeline::film_changed(ChangeType type, FilmProperty property) { if (type != ChangeType::DONE) { @@ -508,6 +523,7 @@ void DCPTimeline::right_down(wxMouseEvent& ev) { _right_down_position = ev.GetPosition(); + _remove_reel_boundary->Enable(film()->reel_type() == ReelType::CUSTOM && static_cast<bool>(event_to_reel_boundary(ev))); _canvas->PopupMenu(_menu, _right_down_position); } diff --git a/src/wx/dcp_timeline.h b/src/wx/dcp_timeline.h index 6abb72d63..e3ab386a8 100644 --- a/src/wx/dcp_timeline.h +++ b/src/wx/dcp_timeline.h @@ -66,6 +66,7 @@ private: void setup_sensitivity(); void add_reel_boundary(); + void remove_reel_boundary(); void setup_reel_settings(); void setup_reel_boundaries(); std::shared_ptr<ReelBoundary> event_to_reel_boundary(wxMouseEvent& ev) const; @@ -115,6 +116,7 @@ private: wxMenu* _menu; wxMenuItem* _add_reel_boundary; + wxMenuItem* _remove_reel_boundary; boost::signals2::scoped_connection _film_connection; |
