diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-07-10 20:29:00 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-07-10 20:29:00 +0100 |
| commit | 320a74efb8d9c8aacded2799459a92d5b7235d90 (patch) | |
| tree | 1f547cb3cde20bd025dabddc6209390e22826b6a /src/wx | |
| parent | 623f3c66821d6a99bf0e683a8072b99a168f3a1c (diff) | |
Make subtitles work at least a bit.
Diffstat (limited to 'src/wx')
| -rw-r--r-- | src/wx/film_editor.cc | 8 | ||||
| -rw-r--r-- | src/wx/timeline.cc | 18 | ||||
| -rw-r--r-- | src/wx/timeline.h | 7 |
3 files changed, 17 insertions, 16 deletions
diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc index f63121201..e3c4af12c 100644 --- a/src/wx/film_editor.cc +++ b/src/wx/film_editor.cc @@ -426,7 +426,7 @@ FilmEditor::make_subtitle_panel () wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); _subtitle_offset = new wxSpinCtrl (_subtitle_panel); s->Add (_subtitle_offset); - add_label_to_sizer (s, _subtitle_panel, _("pixels"), false); + add_label_to_sizer (s, _subtitle_panel, _("%"), false); grid->Add (s); } @@ -443,7 +443,7 @@ FilmEditor::make_subtitle_panel () _subtitle_stream = new wxChoice (_subtitle_panel, wxID_ANY); grid->Add (_subtitle_stream, 1, wxEXPAND); - _subtitle_offset->SetRange (-1024, 1024); + _subtitle_offset->SetRange (-100, 100); _subtitle_scale->SetRange (1, 1000); } @@ -532,7 +532,7 @@ FilmEditor::subtitle_offset_changed (wxCommandEvent &) return; } - c->set_subtitle_offset (_subtitle_offset->GetValue ()); + c->set_subtitle_offset (_subtitle_offset->GetValue() / 100.0); } void @@ -775,7 +775,7 @@ FilmEditor::film_content_changed (weak_ptr<Content> weak_content, int property) _dcp_sizer->Layout (); } } else if (property == SubtitleContentProperty::SUBTITLE_OFFSET) { - checked_set (_subtitle_offset, subtitle_content ? subtitle_content->subtitle_offset() : 0); + checked_set (_subtitle_offset, subtitle_content ? (subtitle_content->subtitle_offset() * 100) : 0); } else if (property == SubtitleContentProperty::SUBTITLE_SCALE) { checked_set (_subtitle_scale, subtitle_content ? (subtitle_content->subtitle_scale() * 100) : 100); } diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc index bd2d314a4..f9223f19d 100644 --- a/src/wx/timeline.cc +++ b/src/wx/timeline.cc @@ -55,7 +55,7 @@ public: _timeline.force_redraw (bbox ()); } - virtual dcpomatic::Rect bbox () const = 0; + virtual dcpomatic::Rect<int> bbox () const = 0; protected: virtual void do_paint (wxGraphicsContext *) = 0; @@ -68,7 +68,7 @@ protected: Timeline& _timeline; private: - dcpomatic::Rect _last_paint_bbox; + dcpomatic::Rect<int> _last_paint_bbox; }; class ContentView : public View @@ -83,15 +83,15 @@ public: _content_connection = c->Changed.connect (bind (&ContentView::content_changed, this, _2)); } - dcpomatic::Rect bbox () const + dcpomatic::Rect<int> bbox () const { shared_ptr<const Film> film = _timeline.film (); shared_ptr<const Content> content = _content.lock (); if (!film || !content) { - return dcpomatic::Rect (); + return dcpomatic::Rect<int> (); } - return dcpomatic::Rect ( + return dcpomatic::Rect<int> ( time_x (content->start ()) - 8, y_pos (_track) - 8, content->length () * _timeline.pixels_per_time_unit() + 16, @@ -243,9 +243,9 @@ public: , _y (y) {} - dcpomatic::Rect bbox () const + dcpomatic::Rect<int> bbox () const { - return dcpomatic::Rect (0, _y - 4, _timeline.width(), 24); + return dcpomatic::Rect<int> (0, _y - 4, _timeline.width(), 24); } void set_y (int y) @@ -476,7 +476,7 @@ void Timeline::left_down (wxMouseEvent& ev) { list<shared_ptr<View> >::iterator i = _views.begin(); - Position const p (ev.GetX(), ev.GetY()); + Position<int> const p (ev.GetX(), ev.GetY()); while (i != _views.end() && !(*i)->bbox().contains (p)) { ++i; } @@ -545,7 +545,7 @@ Timeline::mouse_moved (wxMouseEvent& ev) } void -Timeline::force_redraw (dcpomatic::Rect const & r) +Timeline::force_redraw (dcpomatic::Rect<int> const & r) { RefreshRect (wxRect (r.x, r.y, r.width, r.height), false); } diff --git a/src/wx/timeline.h b/src/wx/timeline.h index 5c25a6426..3e984bfe1 100644 --- a/src/wx/timeline.h +++ b/src/wx/timeline.h @@ -22,6 +22,7 @@ #include <boost/signals2.hpp> #include <wx/wx.h> #include "util.h" +#include "rect.h" class Film; class View; @@ -36,7 +37,7 @@ public: boost::shared_ptr<const Film> film () const; - void force_redraw (dcpomatic::Rect const &); + void force_redraw (dcpomatic::Rect<int> const &); int x_offset () const { return 8; @@ -54,8 +55,8 @@ public: return _pixels_per_time_unit; } - Position tracks_position () const { - return Position (8, 8); + Position<int> tracks_position () const { + return Position<int> (8, 8); } int tracks () const; |
