summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-07-20 00:09:58 +0100
committerCarl Hetherington <cth@carlh.net>2013-07-20 00:09:58 +0100
commit71cb2c8b03be7a246567631c637347d871c9c82d (patch)
treee0aa51ebfd1027e20ee08aa40aec0d18536fdd4d /src
parent11c54ca7ffb9f4b70dff6414b8da2099597b0d4d (diff)
Hopefully sensitivity is a bit tidier.
Diffstat (limited to 'src')
-rw-r--r--src/wx/audio_panel.cc28
-rw-r--r--src/wx/audio_panel.h3
-rw-r--r--src/wx/film_editor.cc72
-rw-r--r--src/wx/film_editor.h20
-rw-r--r--src/wx/film_editor_panel.h1
-rw-r--r--src/wx/subtitle_panel.cc16
-rw-r--r--src/wx/subtitle_panel.h3
-rw-r--r--src/wx/video_panel.cc12
-rw-r--r--src/wx/video_panel.h6
9 files changed, 72 insertions, 89 deletions
diff --git a/src/wx/audio_panel.cc b/src/wx/audio_panel.cc
index b4845233f..cfe34bba5 100644
--- a/src/wx/audio_panel.cc
+++ b/src/wx/audio_panel.cc
@@ -99,9 +99,6 @@ void
AudioPanel::film_changed (Film::Property property)
{
switch (property) {
- case Film::CONTENT:
- setup_sensitivity ();
- break;
case Film::DCP_AUDIO_CHANNELS:
_mapping->set_channels (_editor->film()->dcp_audio_channels ());
break;
@@ -115,6 +112,10 @@ AudioPanel::film_content_changed (shared_ptr<Content> c, int property)
{
shared_ptr<AudioContent> ac = dynamic_pointer_cast<AudioContent> (c);
shared_ptr<FFmpegContent> fc = dynamic_pointer_cast<FFmpegContent> (c);
+
+ if (_audio_dialog && _editor->selected_audio_content()) {
+ _audio_dialog->set_content (_editor->selected_audio_content ());
+ }
if (property == AudioContentProperty::AUDIO_GAIN) {
checked_set (_gain, ac ? ac->audio_gain() : 0);
@@ -134,9 +135,6 @@ AudioPanel::film_content_changed (shared_ptr<Content> c, int property)
checked_set (_stream, lexical_cast<string> (fc->audio_stream()->id));
}
}
- setup_sensitivity ();
- } else if (property == FFmpegContentProperty::AUDIO_STREAM) {
- setup_sensitivity ();
}
}
@@ -212,24 +210,6 @@ AudioPanel::show_clicked (wxCommandEvent &)
_audio_dialog->set_content (ac);
}
-
-void
-AudioPanel::setup_sensitivity ()
-{
- _show->Enable (_editor->film ());
- _gain->Enable (_editor->generally_sensitive ());
- _gain_calculate_button->Enable (_editor->generally_sensitive ());
- _delay->Enable (_editor->generally_sensitive ());
-}
-
-void
-AudioPanel::content_selection_changed ()
-{
- if (_audio_dialog && _editor->selected_audio_content()) {
- _audio_dialog->set_content (_editor->selected_audio_content ());
- }
-}
-
void
AudioPanel::stream_changed (wxCommandEvent &)
{
diff --git a/src/wx/audio_panel.h b/src/wx/audio_panel.h
index f4a595f32..8a6402c9e 100644
--- a/src/wx/audio_panel.h
+++ b/src/wx/audio_panel.h
@@ -33,9 +33,6 @@ public:
void film_changed (Film::Property);
void film_content_changed (boost::shared_ptr<Content>, int);
- void content_selection_changed ();
-
- void setup_sensitivity ();
private:
void gain_changed (wxCommandEvent &);
diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc
index ea1afd220..3800774e2 100644
--- a/src/wx/film_editor.cc
+++ b/src/wx/film_editor.cc
@@ -257,10 +257,15 @@ FilmEditor::make_content_panel ()
_content_sizer->Add (_content_notebook, 1, wxEXPAND | wxTOP, 6);
_video_panel = new VideoPanel (this);
+ _panels.push_back (_video_panel);
_audio_panel = new AudioPanel (this);
+ _panels.push_back (_audio_panel);
_subtitle_panel = new SubtitlePanel (this);
+ _panels.push_back (_subtitle_panel);
_timing_panel = new TimingPanel (this);
+ _panels.push_back (_timing_panel);
}
+
/** Called when the name widget has been changed */
void
FilmEditor::name_changed (wxCommandEvent &)
@@ -332,10 +337,9 @@ FilmEditor::film_changed (Film::Property p)
stringstream s;
- _video_panel->film_changed (p);
- _audio_panel->film_changed (p);
- _subtitle_panel->film_changed (p);
- _timing_panel->film_changed (p);
+ for (list<FilmEditorPanel*>::iterator i = _panels.begin(); i != _panels.end(); ++i) {
+ (*i)->film_changed (p);
+ }
switch (p) {
case Film::NONE:
@@ -415,25 +419,13 @@ FilmEditor::film_content_changed (weak_ptr<Content> weak_content, int property)
}
shared_ptr<Content> content = weak_content.lock ();
- if (content != selected_content ()) {
+ if (!content || content != selected_content ()) {
return;
}
-
- shared_ptr<VideoContent> video_content;
- shared_ptr<AudioContent> audio_content;
- shared_ptr<SubtitleContent> subtitle_content;
- shared_ptr<FFmpegContent> ffmpeg_content;
- if (content) {
- video_content = dynamic_pointer_cast<VideoContent> (content);
- audio_content = dynamic_pointer_cast<AudioContent> (content);
- subtitle_content = dynamic_pointer_cast<SubtitleContent> (content);
- ffmpeg_content = dynamic_pointer_cast<FFmpegContent> (content);
- }
-
- _video_panel->film_content_changed (content, property);
- _audio_panel->film_content_changed (content, property);
- _subtitle_panel->film_content_changed (content, property);
- _timing_panel->film_content_changed (content, property);
+
+ for (list<FilmEditorPanel*>::iterator i = _panels.begin(); i != _panels.end(); ++i) {
+ (*i)->film_content_changed (content, property);
+ }
if (property == FFmpegContentProperty::AUDIO_STREAM) {
setup_dcp_name ();
@@ -458,7 +450,6 @@ FilmEditor::setup_container ()
}
setup_dcp_name ();
- _video_panel->setup_scaling_description ();
}
/** Called when the container widget has been changed */
@@ -495,7 +486,7 @@ FilmEditor::dcp_content_type_changed (wxCommandEvent &)
void
FilmEditor::set_film (shared_ptr<Film> f)
{
- set_things_sensitive (f != 0);
+ set_general_sensitivity (f != 0);
if (_film == f) {
return;
@@ -536,28 +527,33 @@ FilmEditor::set_film (shared_ptr<Film> f)
content_selection_changed (ev);
}
-/** Updates the sensitivity of lots of widgets to a given value.
- * @param s true to make sensitive, false to make insensitive.
- */
void
-FilmEditor::set_things_sensitive (bool s)
+FilmEditor::set_general_sensitivity (bool s)
{
_generally_sensitive = s;
-
+
+ /* Stuff in the Content / DCP tabs */
_name->Enable (s);
_use_dci_name->Enable (s);
_edit_dci_button->Enable (s);
_content->Enable (s);
+ _content_add->Enable (s);
+ _content_remove->Enable (s);
+ _content_timeline->Enable (s);
_dcp_content_type->Enable (s);
_dcp_frame_rate->Enable (s);
_dcp_audio_channels->Enable (s);
_j2k_bandwidth->Enable (s);
_container->Enable (s);
-
- _subtitle_panel->setup_control_sensitivity ();
- _audio_panel->setup_sensitivity ();
- setup_content_sensitivity ();
_best_dcp_frame_rate->Enable (s && _film && _film->best_dcp_video_frame_rate () != _film->dcp_video_frame_rate ());
+ _sequence_video->Enable (s);
+ _dcp_resolution->Enable (s);
+ _scaler->Enable (s);
+
+ /* Set the panels in the content notebook */
+ for (list<FilmEditorPanel*>::iterator i = _panels.begin(); i != _panels.end(); ++i) {
+ (*i)->Enable (s);
+ }
}
/** Called when the scaler widget has been changed */
@@ -600,7 +596,7 @@ FilmEditor::edit_dci_button_clicked (wxCommandEvent &)
void
FilmEditor::active_jobs_changed (bool a)
{
- set_things_sensitive (!a);
+ set_general_sensitivity (!a);
}
void
@@ -700,8 +696,9 @@ FilmEditor::content_selection_changed (wxListEvent &)
setup_content_sensitivity ();
shared_ptr<Content> s = selected_content ();
- _audio_panel->content_selection_changed ();
-
+ /* All other sensitivity in content panels should be triggered by
+ one of these.
+ */
film_content_changed (s, ContentProperty::START);
film_content_changed (s, ContentProperty::LENGTH);
film_content_changed (s, VideoContentProperty::VIDEO_CROP);
@@ -718,6 +715,7 @@ FilmEditor::content_selection_changed (wxListEvent &)
film_content_changed (s, SubtitleContentProperty::SUBTITLE_SCALE);
}
+/** Set up broad sensitivity based on the type of content that is selected */
void
FilmEditor::setup_content_sensitivity ()
{
@@ -811,6 +809,10 @@ FilmEditor::set_selection (weak_ptr<Content> wc)
void
FilmEditor::sequence_video_changed (wxCommandEvent &)
{
+ if (!_film) {
+ return;
+ }
+
_film->set_sequence_video (_sequence_video->GetValue ());
}
diff --git a/src/wx/film_editor.h b/src/wx/film_editor.h
index 751ed0890..66913643e 100644
--- a/src/wx/film_editor.h
+++ b/src/wx/film_editor.h
@@ -36,10 +36,7 @@ class Film;
class TimelineDialog;
class Ratio;
class Timecode;
-class TimingPanel;
-class SubtitlePanel;
-class AudioPanel;
-class VideoPanel;
+class FilmEditorPanel;
/** @class FilmEditor
* @brief A wx widget to edit a film's metadata, and perform various functions.
@@ -69,10 +66,6 @@ public:
boost::shared_ptr<AudioContent> selected_audio_content ();
boost::shared_ptr<SubtitleContent> selected_subtitle_content ();
- bool generally_sensitive () const {
- return _generally_sensitive;
- }
-
private:
void make_dcp_panel ();
void make_content_panel ();
@@ -101,7 +94,7 @@ private:
void film_changed (Film::Property);
void film_content_changed (boost::weak_ptr<Content>, int);
- void set_things_sensitive (bool);
+ void set_general_sensitivity (bool);
void setup_dcp_name ();
void setup_content ();
void setup_container ();
@@ -109,10 +102,11 @@ private:
void active_jobs_changed (bool);
- VideoPanel* _video_panel;
- AudioPanel* _audio_panel;
- SubtitlePanel* _subtitle_panel;
- TimingPanel* _timing_panel;
+ FilmEditorPanel* _video_panel;
+ FilmEditorPanel* _audio_panel;
+ FilmEditorPanel* _subtitle_panel;
+ FilmEditorPanel* _timing_panel;
+ std::list<FilmEditorPanel *> _panels;
wxNotebook* _main_notebook;
wxNotebook* _content_notebook;
diff --git a/src/wx/film_editor_panel.h b/src/wx/film_editor_panel.h
index 8bfe94f8d..8acb3efb6 100644
--- a/src/wx/film_editor_panel.h
+++ b/src/wx/film_editor_panel.h
@@ -34,7 +34,6 @@ public:
virtual void film_changed (Film::Property) {}
virtual void film_content_changed (boost::shared_ptr<Content>, int) = 0;
- virtual void content_selection_changed () {}
protected:
FilmEditor* _editor;
diff --git a/src/wx/subtitle_panel.cc b/src/wx/subtitle_panel.cc
index e41012022..2cc5197ce 100644
--- a/src/wx/subtitle_panel.cc
+++ b/src/wx/subtitle_panel.cc
@@ -76,11 +76,11 @@ SubtitlePanel::film_changed (Film::Property property)
{
switch (property) {
case Film::CONTENT:
- setup_control_sensitivity ();
+ setup_sensitivity ();
break;
case Film::WITH_SUBTITLES:
checked_set (_with_subtitles, _editor->film()->with_subtitles ());
- setup_control_sensitivity ();
+ setup_sensitivity ();
break;
default:
break;
@@ -107,7 +107,7 @@ SubtitlePanel::film_content_changed (shared_ptr<Content> c, int property)
_stream->SetSelection (wxNOT_FOUND);
}
}
- setup_control_sensitivity ();
+ setup_sensitivity ();
} else if (property == SubtitleContentProperty::SUBTITLE_OFFSET) {
checked_set (_offset, sc ? (sc->subtitle_offset() * 100) : 0);
} else if (property == SubtitleContentProperty::SUBTITLE_SCALE) {
@@ -127,20 +127,16 @@ SubtitlePanel::with_subtitles_toggled (wxCommandEvent &)
}
void
-SubtitlePanel::setup_control_sensitivity ()
+SubtitlePanel::setup_sensitivity ()
{
bool h = false;
- if (_editor->generally_sensitive() && _editor->film()) {
- h = _editor->film()->has_subtitles ();
- }
-
- _with_subtitles->Enable (h);
-
bool j = false;
if (_editor->film()) {
+ h = _editor->film()->has_subtitles ();
j = _editor->film()->with_subtitles ();
}
+ _with_subtitles->Enable (h);
_offset->Enable (j);
_scale->Enable (j);
_stream->Enable (j);
diff --git a/src/wx/subtitle_panel.h b/src/wx/subtitle_panel.h
index ec684d7ad..c2891f86d 100644
--- a/src/wx/subtitle_panel.h
+++ b/src/wx/subtitle_panel.h
@@ -30,13 +30,14 @@ public:
void film_changed (Film::Property);
void film_content_changed (boost::shared_ptr<Content>, int);
- void setup_control_sensitivity ();
private:
void with_subtitles_toggled (wxCommandEvent &);
void offset_changed (wxCommandEvent &);
void scale_changed (wxCommandEvent &);
void stream_changed (wxCommandEvent &);
+
+ void setup_sensitivity ();
wxCheckBox* _with_subtitles;
wxSpinCtrl* _offset;
diff --git a/src/wx/video_panel.cc b/src/wx/video_panel.cc
index 09fa8dbe6..47e32c5e8 100644
--- a/src/wx/video_panel.cc
+++ b/src/wx/video_panel.cc
@@ -151,6 +151,18 @@ VideoPanel::bottom_crop_changed (wxCommandEvent &)
}
void
+VideoPanel::film_changed (Film::Property property)
+{
+ switch (property) {
+ case Film::CONTAINER:
+ setup_scaling_description ();
+ break;
+ default:
+ break;
+ }
+}
+
+void
VideoPanel::film_content_changed (shared_ptr<Content> c, int property)
{
shared_ptr<VideoContent> vc = dynamic_pointer_cast<VideoContent> (c);
diff --git a/src/wx/video_panel.h b/src/wx/video_panel.h
index a373f091e..4cc9cd79c 100644
--- a/src/wx/video_panel.h
+++ b/src/wx/video_panel.h
@@ -17,6 +17,7 @@
*/
+#include "lib/film.h"
#include "film_editor_panel.h"
class wxChoice;
@@ -29,10 +30,9 @@ class VideoPanel : public FilmEditorPanel
public:
VideoPanel (FilmEditor *);
+ void film_changed (Film::Property);
void film_content_changed (boost::shared_ptr<Content>, int);
- void setup_scaling_description ();
-
private:
void left_crop_changed (wxCommandEvent &);
void right_crop_changed (wxCommandEvent &);
@@ -41,6 +41,8 @@ private:
void edit_filters_clicked (wxCommandEvent &);
void ratio_changed (wxCommandEvent &);
+ void setup_scaling_description ();
+
wxChoice* _ratio;
wxStaticText* _ratio_description;
wxStaticText* _scaling_description;