summaryrefslogtreecommitdiff
path: root/src/wx
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-07-11 17:26:16 +0100
committerCarl Hetherington <cth@carlh.net>2013-07-11 17:26:16 +0100
commit39c36075c62ce4c148ce14de0ae7b29d8427be2b (patch)
tree81e90e8065df9c1d68a6e6be646c5825400538dd /src/wx
parent6ff93316d9e89fd649b9fabac258318ed8470007 (diff)
parent8bdc282a88cbd0446b06866b9436c43200886314 (diff)
Merge branch '1.0' of /home/carl/git/dvdomatic into 1.0
Diffstat (limited to 'src/wx')
-rw-r--r--src/wx/audio_mapping_view.cc83
-rw-r--r--src/wx/audio_mapping_view.h3
-rw-r--r--src/wx/audio_plot.cc8
-rw-r--r--src/wx/film_editor.cc28
-rw-r--r--src/wx/film_editor.h2
-rw-r--r--src/wx/film_viewer.cc2
-rw-r--r--src/wx/timeline.cc13
7 files changed, 92 insertions, 47 deletions
diff --git a/src/wx/audio_mapping_view.cc b/src/wx/audio_mapping_view.cc
index 1e938b357..5f0f74d23 100644
--- a/src/wx/audio_mapping_view.cc
+++ b/src/wx/audio_mapping_view.cc
@@ -56,11 +56,7 @@ public:
void Draw (wxGrid& grid, wxGridCellAttr &, wxDC& dc, const wxRect& rect, int row, int col, bool)
{
-#if wxMAJOR_VERSION == 2 && wxMINOR_VERSION >= 9
dc.SetPen (*wxThePenList->FindOrCreatePen (wxColour (255, 255, 255), 0, wxPENSTYLE_SOLID));
-#else
- dc.SetPen (*wxThePenList->FindOrCreatePen (wxColour (255, 255, 255), 0, wxSOLID));
-#endif
dc.DrawRectangle (rect);
wxRendererNative::Get().DrawCheckBox (
@@ -88,26 +84,14 @@ AudioMappingView::AudioMappingView (wxWindow* parent)
_grid = new wxGrid (this, wxID_ANY);
_grid->CreateGrid (0, 7);
-#if wxMINOR_VERSION == 9
_grid->HideRowLabels ();
-#else
- _grid->SetRowLabelSize (0);
-#endif
_grid->DisableDragRowSize ();
_grid->DisableDragColSize ();
_grid->EnableEditing (false);
_grid->SetCellHighlightPenWidth (0);
_grid->SetDefaultRenderer (new NoSelectionStringRenderer);
- _grid->SetColLabelValue (0, _("Content channel"));
- _grid->SetColLabelValue (1, _("L"));
- _grid->SetColLabelValue (2, _("R"));
- _grid->SetColLabelValue (3, _("C"));
- _grid->SetColLabelValue (4, _("Lfe"));
- _grid->SetColLabelValue (5, _("Ls"));
- _grid->SetColLabelValue (6, _("Rs"));
-
- _grid->AutoSize ();
+ set_column_labels ();
_sizer = new wxBoxSizer (wxVERTICAL);
_sizer->Add (_grid, 1, wxEXPAND | wxALL);
@@ -129,26 +113,28 @@ AudioMappingView::left_click (wxGridEvent& ev)
_grid->SetCellValue (ev.GetRow(), ev.GetCol(), wxT("1"));
}
- AudioMapping mapping;
+ _map = AudioMapping ();
for (int i = 0; i < _grid->GetNumberRows(); ++i) {
for (int j = 1; j < _grid->GetNumberCols(); ++j) {
if (_grid->GetCellValue (i, j) == wxT ("1")) {
- mapping.add (i, static_cast<libdcp::Channel> (j - 1));
+ _map.add (i, static_cast<libdcp::Channel> (j - 1));
}
}
}
- Changed (mapping);
+ Changed (_map);
}
void
AudioMappingView::set (AudioMapping map)
{
+ _map = map;
+
if (_grid->GetNumberRows ()) {
_grid->DeleteRows (0, _grid->GetNumberRows ());
}
- list<int> content_channels = map.content_channels ();
+ list<int> content_channels = _map.content_channels ();
_grid->InsertRows (0, content_channels.size ());
for (size_t r = 0; r < content_channels.size(); ++r) {
@@ -161,11 +147,62 @@ AudioMappingView::set (AudioMapping map)
for (list<int>::iterator i = content_channels.begin(); i != content_channels.end(); ++i) {
_grid->SetCellValue (n, 0, wxString::Format (wxT("%d"), *i + 1));
- list<libdcp::Channel> const d = map.content_to_dcp (*i);
+ list<libdcp::Channel> const d = _map.content_to_dcp (*i);
for (list<libdcp::Channel>::const_iterator j = d.begin(); j != d.end(); ++j) {
- _grid->SetCellValue (n, static_cast<int> (*j) + 1, wxT("1"));
+ int const c = static_cast<int>(*j) + 1;
+ if (c < _grid->GetNumberCols ()) {
+ _grid->SetCellValue (n, c, wxT("1"));
+ }
}
++n;
}
}
+void
+AudioMappingView::set_channels (int c)
+{
+ c++;
+
+ if (c < _grid->GetNumberCols ()) {
+ _grid->DeleteCols (c, _grid->GetNumberCols() - c);
+ } else if (c > _grid->GetNumberCols ()) {
+ _grid->InsertCols (_grid->GetNumberCols(), c - _grid->GetNumberCols());
+ set_column_labels ();
+ }
+
+ set (_map);
+}
+
+void
+AudioMappingView::set_column_labels ()
+{
+ int const c = _grid->GetNumberCols ();
+
+ _grid->SetColLabelValue (0, _("Content channel"));
+
+ if (c > 0) {
+ _grid->SetColLabelValue (1, _("L"));
+ }
+
+ if (c > 1) {
+ _grid->SetColLabelValue (2, _("R"));
+ }
+
+ if (c > 2) {
+ _grid->SetColLabelValue (3, _("C"));
+ }
+
+ if (c > 3) {
+ _grid->SetColLabelValue (4, _("Lfe"));
+ }
+
+ if (c > 4) {
+ _grid->SetColLabelValue (5, _("Ls"));
+ }
+
+ if (c > 5) {
+ _grid->SetColLabelValue (6, _("Rs"));
+ }
+
+ _grid->AutoSize ();
+}
diff --git a/src/wx/audio_mapping_view.h b/src/wx/audio_mapping_view.h
index e0709c8b7..80534a613 100644
--- a/src/wx/audio_mapping_view.h
+++ b/src/wx/audio_mapping_view.h
@@ -28,12 +28,15 @@ public:
AudioMappingView (wxWindow *);
void set (AudioMapping);
+ void set_channels (int);
boost::signals2::signal<void (AudioMapping)> Changed;
private:
void left_click (wxGridEvent &);
+ void set_column_labels ();
wxGrid* _grid;
wxSizer* _sizer;
+ AudioMapping _map;
};
diff --git a/src/wx/audio_plot.cc b/src/wx/audio_plot.cc
index e2e2cdf76..b8b9ead25 100644
--- a/src/wx/audio_plot.cc
+++ b/src/wx/audio_plot.cc
@@ -147,11 +147,7 @@ AudioPlot::paint (wxPaintEvent &)
plot_peak (p, c);
}
wxColour const col = _colours[c];
-#if wxMAJOR_VERSION == 2 && wxMINOR_VERSION >= 9
gc->SetPen (*wxThePenList->FindOrCreatePen (wxColour (col.Red(), col.Green(), col.Blue(), col.Alpha() / 2), 1, wxPENSTYLE_SOLID));
-#else
- gc->SetPen (*wxThePenList->FindOrCreatePen (wxColour (col.Red(), col.Green(), col.Blue(), col.Alpha() / 2), 1, wxSOLID));
-#endif
gc->StrokePath (p);
}
}
@@ -163,11 +159,7 @@ AudioPlot::paint (wxPaintEvent &)
plot_rms (p, c);
}
wxColour const col = _colours[c];
-#if wxMAJOR_VERSION == 2 && wxMINOR_VERSION >= 9
gc->SetPen (*wxThePenList->FindOrCreatePen (col, 1, wxPENSTYLE_SOLID));
-#else
- gc->SetPen (*wxThePenList->FindOrCreatePen (col, 1, wxSOLID));
-#endif
gc->StrokePath (p);
}
}
diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc
index 92b4d0691..4794a9d33 100644
--- a/src/wx/film_editor.cc
+++ b/src/wx/film_editor.cc
@@ -149,6 +149,11 @@ FilmEditor::make_dcp_panel ()
}
++r;
+ add_label_to_grid_bag_sizer (grid, _dcp_panel, _("DCP audio channels"), true, wxGBPosition (r, 0));
+ _dcp_audio_channels = new wxSpinCtrl (_dcp_panel, wxID_ANY);
+ grid->Add (_dcp_audio_channels, wxGBPosition (r, 1));
+ ++r;
+
{
add_label_to_grid_bag_sizer (grid, _dcp_panel, _("JPEG2000 bandwidth"), true, wxGBPosition (r, 0));
wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
@@ -184,6 +189,7 @@ FilmEditor::make_dcp_panel ()
_dcp_frame_rate->Append (std_to_wx (boost::lexical_cast<string> (*i)));
}
+ _dcp_audio_channels->SetRange (0, MAX_AUDIO_CHANNELS);
_j2k_bandwidth->SetRange (50, 250);
}
@@ -211,6 +217,7 @@ FilmEditor::connect_to_widgets ()
_dcp_content_type->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (FilmEditor::dcp_content_type_changed), 0, this);
_dcp_frame_rate->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (FilmEditor::dcp_frame_rate_changed), 0, this);
_best_dcp_frame_rate->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::best_dcp_frame_rate_clicked), 0, this);
+ _dcp_audio_channels->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::dcp_audio_channels_changed), 0, this);
_with_subtitles->Connect (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler (FilmEditor::with_subtitles_toggled), 0, this);
_subtitle_offset->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::subtitle_offset_changed), 0, this);
_subtitle_scale->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::subtitle_scale_changed), 0, this);
@@ -445,6 +452,7 @@ FilmEditor::make_subtitle_panel ()
_subtitle_offset->SetRange (-100, 100);
_subtitle_scale->SetRange (1, 1000);
+ _subtitle_scale->SetValue (100);
}
void
@@ -580,6 +588,16 @@ FilmEditor::dcp_frame_rate_changed (wxCommandEvent &)
);
}
+void
+FilmEditor::dcp_audio_channels_changed (wxCommandEvent &)
+{
+ if (!_film) {
+ return;
+ }
+
+ _film->set_dcp_audio_channels (_dcp_audio_channels->GetValue ());
+}
+
/** Called when the metadata stored in the Film object has changed;
* so that we can update the GUI.
@@ -659,6 +677,10 @@ FilmEditor::film_changed (Film::Property p)
_best_dcp_frame_rate->Enable (_film->best_dcp_video_frame_rate () != _film->dcp_video_frame_rate ());
break;
}
+ case Film::DCP_AUDIO_CHANNELS:
+ _dcp_audio_channels->SetValue (_film->dcp_audio_channels ());
+ _audio_mapping->set_channels (_film->dcp_audio_channels ());
+ break;
}
}
@@ -867,6 +889,7 @@ FilmEditor::set_film (shared_ptr<Film> f)
film_changed (Film::J2K_BANDWIDTH);
film_changed (Film::DCI_METADATA);
film_changed (Film::DCP_VIDEO_FRAME_RATE);
+ film_changed (Film::DCP_AUDIO_CHANNELS);
wxListEvent ev;
content_selection_changed (ev);
@@ -1192,6 +1215,9 @@ FilmEditor::content_remove_clicked (wxCommandEvent &)
if (c) {
_film->remove_content (c);
}
+
+ wxListEvent ev;
+ content_selection_changed (ev);
}
void
@@ -1203,7 +1229,7 @@ FilmEditor::content_selection_changed (wxListEvent &)
if (_audio_dialog && s && dynamic_pointer_cast<AudioContent> (s)) {
_audio_dialog->set_content (dynamic_pointer_cast<AudioContent> (s));
}
-
+
film_content_changed (s, ContentProperty::START);
film_content_changed (s, ContentProperty::LENGTH);
film_content_changed (s, VideoContentProperty::VIDEO_CROP);
diff --git a/src/wx/film_editor.h b/src/wx/film_editor.h
index fdc6e077d..100e47b5b 100644
--- a/src/wx/film_editor.h
+++ b/src/wx/film_editor.h
@@ -97,6 +97,7 @@ private:
void start_changed ();
void length_changed ();
void ratio_changed (wxCommandEvent &);
+ void dcp_audio_channels_changed (wxCommandEvent &);
/* Handle changes to the model */
void film_changed (Film::Property);
@@ -167,6 +168,7 @@ private:
wxSpinCtrl* _j2k_bandwidth;
wxChoice* _dcp_content_type;
wxChoice* _dcp_frame_rate;
+ wxSpinCtrl* _dcp_audio_channels;
wxButton* _best_dcp_frame_rate;
wxChoice* _audio_stream;
wxStaticText* _audio_description;
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc
index d7ec26f7d..15c23e064 100644
--- a/src/wx/film_viewer.cc
+++ b/src/wx/film_viewer.cc
@@ -67,9 +67,7 @@ FilmViewer::FilmViewer (shared_ptr<Film> f, wxWindow* p)
_panel->SetDoubleBuffered (true);
#endif
-#if wxMAJOR_VERSION == 2 && wxMINOR_VERSION >= 9
_panel->SetBackgroundStyle (wxBG_STYLE_PAINT);
-#endif
_v_sizer = new wxBoxSizer (wxVERTICAL);
SetSizer (_v_sizer);
diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc
index f9223f19d..4e0737b41 100644
--- a/src/wx/timeline.cc
+++ b/src/wx/timeline.cc
@@ -140,21 +140,12 @@ private:
gc->SetPen (*wxBLACK_PEN);
-#if wxMAJOR_VERSION == 2 && wxMINOR_VERSION >= 9
gc->SetPen (*wxThePenList->FindOrCreatePen (wxColour (0, 0, 0), 4, wxPENSTYLE_SOLID));
if (_selected) {
gc->SetBrush (*wxTheBrushList->FindOrCreateBrush (selected, wxBRUSHSTYLE_SOLID));
} else {
gc->SetBrush (*wxTheBrushList->FindOrCreateBrush (colour(), wxBRUSHSTYLE_SOLID));
}
-#else
- gc->SetPen (*wxThePenList->FindOrCreatePen (wxColour (0, 0, 0), 4, wxSOLID));
- if (_selected) {
- gc->SetBrush (*wxTheBrushList->FindOrCreateBrush (selected, wxSOLID));
- } else {
- gc->SetBrush (*wxTheBrushList->FindOrCreateBrush (colour(), wxSOLID));
- }
-#endif
wxGraphicsPath path = gc->CreatePath ();
path.MoveToPoint (time_x (start), y_pos (_track) + 4);
@@ -258,11 +249,7 @@ private:
void do_paint (wxGraphicsContext* gc)
{
-#if wxMAJOR_VERSION == 2 && wxMINOR_VERSION >= 9
gc->SetPen (*wxThePenList->FindOrCreatePen (wxColour (0, 0, 0), 1, wxPENSTYLE_SOLID));
-#else
- gc->SetPen (*wxThePenList->FindOrCreatePen (wxColour (0, 0, 0), 1, wxSOLID));
-#endif
int mark_interval = rint (128 / (TIME_HZ * _timeline.pixels_per_time_unit ()));
if (mark_interval > 5) {