#include "film_editor.h"
using std::vector;
+using std::cout;
using std::string;
using boost::dynamic_pointer_cast;
using boost::lexical_cast;
_gain->SetRange (-60, 60);
_delay->SetRange (-1000, 1000);
- _delay->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (AudioPanel::delay_changed), 0, this);
- _stream->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (AudioPanel::stream_changed), 0, this);
- _show->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (AudioPanel::show_clicked), 0, this);
- _gain->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (AudioPanel::gain_changed), 0, this);
- _gain_calculate_button->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (AudioPanel::gain_calculate_button_clicked), 0, this);
+ _delay->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&AudioPanel::delay_changed, this));
+ _stream->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&AudioPanel::stream_changed, this));
+ _show->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&AudioPanel::show_clicked, this));
+ _gain->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&AudioPanel::gain_changed, this));
+ _gain_calculate_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&AudioPanel::gain_calculate_button_clicked, this));
+
_mapping->Changed.connect (boost::bind (&AudioPanel::mapping_changed, this, _1));
}
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 ());
+ case Film::AUDIO_CHANNELS:
+ _mapping->set_channels (_editor->film()->audio_channels ());
+ _sizer->Layout ();
break;
default:
break;
}
void
-AudioPanel::film_content_changed (
- shared_ptr<Content>,
- shared_ptr<AudioContent> audio_content,
- shared_ptr<SubtitleContent>,
- shared_ptr<FFmpegContent> ffmpeg_content,
- int property
- )
+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, audio_content ? audio_content->audio_gain() : 0);
+ checked_set (_gain, ac ? ac->audio_gain() : 0);
} else if (property == AudioContentProperty::AUDIO_DELAY) {
- checked_set (_delay, audio_content ? audio_content->audio_delay() : 0);
+ checked_set (_delay, ac ? ac->audio_delay() : 0);
} else if (property == AudioContentProperty::AUDIO_MAPPING) {
- _mapping->set (audio_content ? audio_content->audio_mapping () : AudioMapping ());
+ _mapping->set (ac ? ac->audio_mapping () : AudioMapping ());
+ _sizer->Layout ();
} else if (property == FFmpegContentProperty::AUDIO_STREAMS) {
_stream->Clear ();
- if (ffmpeg_content) {
- vector<shared_ptr<FFmpegAudioStream> > a = ffmpeg_content->audio_streams ();
+ if (fc) {
+ vector<shared_ptr<FFmpegAudioStream> > a = fc->audio_streams ();
for (vector<shared_ptr<FFmpegAudioStream> >::iterator i = a.begin(); i != a.end(); ++i) {
_stream->Append (std_to_wx ((*i)->name), new wxStringClientData (std_to_wx (lexical_cast<string> ((*i)->id))));
}
- if (ffmpeg_content->audio_stream()) {
- checked_set (_stream, lexical_cast<string> (ffmpeg_content->audio_stream()->id));
+ if (fc->audio_stream()) {
+ checked_set (_stream, lexical_cast<string> (fc->audio_stream()->id));
}
}
- setup_sensitivity ();
- } else if (property == FFmpegContentProperty::AUDIO_STREAM) {
- setup_sensitivity ();
}
}
void
-AudioPanel::gain_changed (wxCommandEvent &)
+AudioPanel::gain_changed ()
{
shared_ptr<AudioContent> ac = _editor->selected_audio_content ();
if (!ac) {
}
void
-AudioPanel::delay_changed (wxCommandEvent &)
+AudioPanel::delay_changed ()
{
shared_ptr<AudioContent> ac = _editor->selected_audio_content ();
if (!ac) {
}
void
-AudioPanel::gain_calculate_button_clicked (wxCommandEvent &)
+AudioPanel::gain_calculate_button_clicked ()
{
GainCalculatorDialog* d = new GainCalculatorDialog (this);
d->ShowModal ();
/* This appears to be necessary, as the change is not signalled,
I think.
*/
- wxCommandEvent dummy;
- gain_changed (dummy);
+ gain_changed ();
d->Destroy ();
}
void
-AudioPanel::show_clicked (wxCommandEvent &)
+AudioPanel::show_clicked ()
{
if (_audio_dialog) {
_audio_dialog->Destroy ();
_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 &)
+AudioPanel::stream_changed ()
{
shared_ptr<Content> c = _editor->selected_content ();
if (!c) {