From 306c28facff88f38dd03831062dedd5a865578fe Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 15 Dec 2023 00:40:41 +0100 Subject: Rename TimelineAudioContentView -> ContentTimelineAudioView. --- src/wx/content_menu.cc | 6 +-- src/wx/content_timeline.cc | 10 ++--- src/wx/content_timeline_audio_view.cc | 85 +++++++++++++++++++++++++++++++++++ src/wx/content_timeline_audio_view.h | 40 +++++++++++++++++ src/wx/timeline_audio_content_view.cc | 85 ----------------------------------- src/wx/timeline_audio_content_view.h | 40 ----------------- src/wx/wscript | 2 +- 7 files changed, 134 insertions(+), 134 deletions(-) create mode 100644 src/wx/content_timeline_audio_view.cc create mode 100644 src/wx/content_timeline_audio_view.h delete mode 100644 src/wx/timeline_audio_content_view.cc delete mode 100644 src/wx/timeline_audio_content_view.h (limited to 'src') diff --git a/src/wx/content_menu.cc b/src/wx/content_menu.cc index 4af5a71b7..9f89835ff 100644 --- a/src/wx/content_menu.cc +++ b/src/wx/content_menu.cc @@ -23,13 +23,13 @@ #include "content_advanced_dialog.h" #include "content_menu.h" #include "content_properties_dialog.h" +#include "content_timeline_audio_view.h" #include "dir_dialog.h" #include "file_dialog.h" #include "film_viewer.h" #include "id.h" #include "repeat_dialog.h" #include "timeline_video_content_view.h" -#include "timeline_audio_content_view.h" #include "wx_util.h" #include "lib/audio_content.h" #include "lib/config.h" @@ -315,11 +315,11 @@ ContentMenu::remove () } shared_ptr video; - shared_ptr audio; + shared_ptr audio; for (auto j: _views) { auto v = dynamic_pointer_cast(j); - auto a = dynamic_pointer_cast(j); + auto a = dynamic_pointer_cast(j); if (v && v->content() == fc) { video = v; } else if (a && a->content() == fc) { diff --git a/src/wx/content_timeline.cc b/src/wx/content_timeline.cc index 0f993108d..3efb15d3f 100644 --- a/src/wx/content_timeline.cc +++ b/src/wx/content_timeline.cc @@ -23,7 +23,7 @@ #include "film_editor.h" #include "film_viewer.h" #include "content_timeline_atmos_view.h" -#include "timeline_audio_content_view.h" +#include "content_timeline_audio_view.h" #include "timeline_labels_view.h" #include "timeline_reels_view.h" #include "timeline_text_content_view.h" @@ -307,7 +307,7 @@ ContentTimeline::recreate_views() } if (i->audio && !i->audio->mapping().mapped_output_channels().empty ()) { - _views.push_back (make_shared(*this, i)); + _views.push_back(make_shared(*this, i)); } for (auto j: i->text) { @@ -406,13 +406,13 @@ place(shared_ptr film, ContentTimelineViewList& views, int& tracks) struct AudioMappingComparator { bool operator()(shared_ptr a, shared_ptr b) { int la = -1; - auto cva = dynamic_pointer_cast(a); + auto cva = dynamic_pointer_cast(a); if (cva) { auto oc = cva->content()->audio->mapping().mapped_output_channels(); la = *min_element(boost::begin(oc), boost::end(oc)); } int lb = -1; - auto cvb = dynamic_pointer_cast(b); + auto cvb = dynamic_pointer_cast(b); if (cvb) { auto oc = cvb->content()->audio->mapping().mapped_output_channels(); lb = *min_element(boost::begin(oc), boost::end(oc)); @@ -474,7 +474,7 @@ ContentTimeline::assign_tracks() auto views = _views; sort(views.begin(), views.end(), AudioMappingComparator()); - int const audio_tracks = place (film, views, _tracks); + int const audio_tracks = place(film, views, _tracks); _labels_view->set_video_tracks (video_tracks); _labels_view->set_audio_tracks (audio_tracks); diff --git a/src/wx/content_timeline_audio_view.cc b/src/wx/content_timeline_audio_view.cc new file mode 100644 index 000000000..9604ee7cc --- /dev/null +++ b/src/wx/content_timeline_audio_view.cc @@ -0,0 +1,85 @@ +/* + Copyright (C) 2013-2018 Carl Hetherington + + This file is part of DCP-o-matic. + + DCP-o-matic is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + DCP-o-matic is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with DCP-o-matic. If not, see . + +*/ + + +#include "content_timeline_audio_view.h" +#include "wx_util.h" +#include "lib/audio_content.h" +#include "lib/util.h" + + +using std::dynamic_pointer_cast; +using std::list; +using std::shared_ptr; + + +/** @class ContentTimelineAudioView + * @brief Content timeline view for AudioContent. + */ + + +ContentTimelineAudioView::ContentTimelineAudioView(ContentTimeline& tl, shared_ptr c) + : TimelineContentView (tl, c) +{ + +} + +wxColour +ContentTimelineAudioView::background_colour () const +{ + return wxColour (149, 121, 232, 255); +} + +wxColour +ContentTimelineAudioView::foreground_colour () const +{ + return wxColour (0, 0, 0, 255); +} + +wxString +ContentTimelineAudioView::label () const +{ + wxString s = TimelineContentView::label (); + shared_ptr ac = content()->audio; + DCPOMATIC_ASSERT (ac); + + if (ac->gain() > 0.01) { + s += wxString::Format (" +%.1fdB", ac->gain()); + } else if (ac->gain() < -0.01) { + s += wxString::Format (" %.1fdB", ac->gain()); + } + + if (ac->delay() > 0) { + s += wxString::Format (_(" delayed by %dms"), ac->delay()); + } else if (ac->delay() < 0) { + s += wxString::Format (_(" advanced by %dms"), -ac->delay()); + } + + list mapped = ac->mapping().mapped_output_channels(); + if (!mapped.empty ()) { + s += wxString::FromUTF8(" → "); + for (auto i: mapped) { + s += std_to_wx(short_audio_channel_name(i)) + ", "; + } + s = s.Left(s.Length() - 2); + } + + return s; +} diff --git a/src/wx/content_timeline_audio_view.h b/src/wx/content_timeline_audio_view.h new file mode 100644 index 000000000..719c2536d --- /dev/null +++ b/src/wx/content_timeline_audio_view.h @@ -0,0 +1,40 @@ +/* + Copyright (C) 2013-2015 Carl Hetherington + + This file is part of DCP-o-matic. + + DCP-o-matic is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + DCP-o-matic is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with DCP-o-matic. If not, see . + +*/ + + +#include "timeline_content_view.h" + + +/** @class ContentTimelineAudioView + * @brief Content timeline view for AudioContent. + */ +class ContentTimelineAudioView : public TimelineContentView +{ +public: + ContentTimelineAudioView(ContentTimeline& tl, std::shared_ptr c); + +private: + bool active () const override { + return true; + } + wxColour background_colour () const override; + wxColour foreground_colour () const override; + wxString label () const override; +}; diff --git a/src/wx/timeline_audio_content_view.cc b/src/wx/timeline_audio_content_view.cc deleted file mode 100644 index 2920bf4fd..000000000 --- a/src/wx/timeline_audio_content_view.cc +++ /dev/null @@ -1,85 +0,0 @@ -/* - Copyright (C) 2013-2018 Carl Hetherington - - This file is part of DCP-o-matic. - - DCP-o-matic is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - DCP-o-matic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DCP-o-matic. If not, see . - -*/ - - -#include "timeline_audio_content_view.h" -#include "wx_util.h" -#include "lib/audio_content.h" -#include "lib/util.h" - - -using std::dynamic_pointer_cast; -using std::list; -using std::shared_ptr; - - -/** @class TimelineAudioContentView - * @brief Timeline view for AudioContent. - */ - - -TimelineAudioContentView::TimelineAudioContentView(ContentTimeline& tl, shared_ptr c) - : TimelineContentView (tl, c) -{ - -} - -wxColour -TimelineAudioContentView::background_colour () const -{ - return wxColour (149, 121, 232, 255); -} - -wxColour -TimelineAudioContentView::foreground_colour () const -{ - return wxColour (0, 0, 0, 255); -} - -wxString -TimelineAudioContentView::label () const -{ - wxString s = TimelineContentView::label (); - shared_ptr ac = content()->audio; - DCPOMATIC_ASSERT (ac); - - if (ac->gain() > 0.01) { - s += wxString::Format (" +%.1fdB", ac->gain()); - } else if (ac->gain() < -0.01) { - s += wxString::Format (" %.1fdB", ac->gain()); - } - - if (ac->delay() > 0) { - s += wxString::Format (_(" delayed by %dms"), ac->delay()); - } else if (ac->delay() < 0) { - s += wxString::Format (_(" advanced by %dms"), -ac->delay()); - } - - list mapped = ac->mapping().mapped_output_channels(); - if (!mapped.empty ()) { - s += wxString::FromUTF8(" → "); - for (auto i: mapped) { - s += std_to_wx(short_audio_channel_name(i)) + ", "; - } - s = s.Left(s.Length() - 2); - } - - return s; -} diff --git a/src/wx/timeline_audio_content_view.h b/src/wx/timeline_audio_content_view.h deleted file mode 100644 index 29849adb2..000000000 --- a/src/wx/timeline_audio_content_view.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright (C) 2013-2015 Carl Hetherington - - This file is part of DCP-o-matic. - - DCP-o-matic is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - DCP-o-matic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DCP-o-matic. If not, see . - -*/ - - -#include "timeline_content_view.h" - - -/** @class TimelineAudioContentView - * @brief Timeline view for AudioContent. - */ -class TimelineAudioContentView : public TimelineContentView -{ -public: - TimelineAudioContentView(ContentTimeline& tl, std::shared_ptr c); - -private: - bool active () const override { - return true; - } - wxColour background_colour () const override; - wxColour foreground_colour () const override; - wxString label () const override; -}; diff --git a/src/wx/wscript b/src/wx/wscript index f9573bd6d..c2bcd72c5 100644 --- a/src/wx/wscript +++ b/src/wx/wscript @@ -50,6 +50,7 @@ sources = """ content_sub_panel.cc content_timeline.cc content_timeline_atmos_view.cc + content_timeline_audio_view.cc content_timeline_dialog.cc content_timeline_view.cc content_version_dialog.cc @@ -166,7 +167,6 @@ sources = """ timecode.cc timeline.cc timeline_content_view.cc - timeline_audio_content_view.cc timeline_labels_view.cc timeline_text_content_view.cc timeline_reels_view.cc -- cgit v1.2.3