summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-10-11 01:28:17 +0100
committerCarl Hetherington <cth@carlh.net>2012-10-11 01:28:17 +0100
commit8e8eb8a229a0ed385a53531fb1ad63aff1b0ee97 (patch)
tree0e9d3f50b864b7fe2eaae4ef338ee91ff3a02b82 /src
parentb96ad1327c25d5de8d61ed73a1c0e207e67f1226 (diff)
Tidy up; make viewer respond with with subtitles button.
Diffstat (limited to 'src')
-rw-r--r--src/wx/film_editor.cc1
-rw-r--r--src/wx/film_viewer.cc33
2 files changed, 19 insertions, 15 deletions
diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc
index bc7414c41..97a98e54d 100644
--- a/src/wx/film_editor.cc
+++ b/src/wx/film_editor.cc
@@ -219,6 +219,7 @@ FilmEditor::FilmEditor (Film* f, wxWindow* parent)
_audio_delay->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::audio_delay_changed), 0, this);
_still_duration->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::still_duration_changed), 0, this);
_change_dcp_range_button->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::change_dcp_range_clicked), 0, this);
+ _with_subtitles->Connect (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler (FilmEditor::with_subtitles_toggled), 0, this);
setup_visibility ();
setup_formats ();
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc
index e49532cdb..6a992f0db 100644
--- a/src/wx/film_viewer.cc
+++ b/src/wx/film_viewer.cc
@@ -54,7 +54,6 @@ public:
_subtitles.clear ();
- cout << "=== SUBS for " << _film->thumb_frame (_pending_index) << "\n";
list<pair<Position, string> > s = _film->thumb_subtitles (_pending_index);
for (list<pair<Position, string> >::iterator i = s.begin(); i != s.end(); ++i) {
_subtitles.push_back (SubtitleView (i->first, std_to_wx (i->second)));
@@ -70,13 +69,13 @@ public:
wxPaintDC dc (this);
if (_bitmap) {
- cout << "frame bm " << _bitmap->GetWidth() << " " << _bitmap->GetHeight() << "\n";
dc.DrawBitmap (*_bitmap, 0, 0, false);
}
- for (list<SubtitleView>::iterator i = _subtitles.begin(); i != _subtitles.end(); ++i) {
- dc.DrawBitmap (*i->bitmap, i->position.x, i->position.y, true);
- cout << "\tsub bm at " << i->position.x << " " << i->position.y << " size " << i->bitmap->GetWidth() << " by " << i->bitmap->GetHeight() << "\n";
+ if (_film->with_subtitles ()) {
+ for (list<SubtitleView>::iterator i = _subtitles.begin(); i != _subtitles.end(); ++i) {
+ dc.DrawBitmap (*i->bitmap, i->position.x, i->position.y, true);
+ }
}
}
@@ -178,9 +177,6 @@ private:
Rectangle sub_rect (i->position.x, i->position.y, i->image.GetWidth(), i->image.GetHeight());
Rectangle cropped_sub_rect = sub_rect.intersection (cropped);
- cout << "sub " << sub_rect.x << " " << sub_rect.y << " " << sub_rect.w << " " << sub_rect.h << "\n";
- cout << "cropped " << cropped_sub_rect.x << " " << cropped_sub_rect.y << " " << cropped_sub_rect.w << " " << cropped_sub_rect.h << "\n";
-
i->cropped_image = i->image.GetSubImage (
wxRect (
cropped_sub_rect.x - sub_rect.x,
@@ -197,9 +193,6 @@ private:
cropped_sub_rect.y * y_scale
);
- cout << "scales are " << x_scale << " " << y_scale << "\n";
- cout << "scaled to " << (cropped_sub_rect.w * x_scale) << " " << (cropped_sub_rect.h * y_scale) << "\n";
-
i->bitmap.reset (new wxBitmap (i->cropped_image));
}
}
@@ -274,9 +267,11 @@ FilmViewer::slider_changed (wxCommandEvent &)
void
FilmViewer::film_changed (Film::Property p)
{
- if (p == Film::CROP) {
+ switch (p) {
+ case Film::CROP:
_thumb_panel->set_crop (_film->crop ());
- } else if (p == Film::THUMBS) {
+ break;
+ case Film::THUMBS:
if (_film && _film->num_thumbs() > 1) {
_slider->SetRange (0, _film->num_thumbs () - 1);
} else {
@@ -286,12 +281,20 @@ FilmViewer::film_changed (Film::Property p)
_slider->SetValue (0);
set_thumbnail (0);
- } else if (p == Film::FORMAT) {
+ break;
+ case Film::FORMAT:
_thumb_panel->refresh ();
- } else if (p == Film::CONTENT) {
+ break;
+ case Film::CONTENT:
setup_visibility ();
_film->examine_content ();
update_thumbs ();
+ break;
+ case Film::WITH_SUBTITLES:
+ _thumb_panel->Refresh ();
+ break;
+ default:
+ break;
}
}