projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge master.
[dcpomatic.git]
/
src
/
wx
/
subtitle_panel.cc
diff --git
a/src/wx/subtitle_panel.cc
b/src/wx/subtitle_panel.cc
index 9025e5ddc4cb530a39cca106f6ca98ebdf9dff42..21d6f8e5ba6c46a48a57004fa625e3a584af4641 100644
(file)
--- a/
src/wx/subtitle_panel.cc
+++ b/
src/wx/subtitle_panel.cc
@@
-29,6
+29,7
@@
#include "film_editor.h"
#include "wx_util.h"
#include "subtitle_view.h"
#include "film_editor.h"
#include "wx_util.h"
#include "subtitle_view.h"
+#include "content_panel.h"
using std::vector;
using std::string;
using std::vector;
using std::string;
@@
-66,14
+67,23
@@
SubtitlePanel::SubtitlePanel (ContentPanel* p)
}
{
}
{
- add_label_to_sizer (grid, this, _("Scale"), true);
+ add_label_to_sizer (grid, this, _("
X
Scale"), true);
wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
- _scale = new wxSpinCtrl (this);
- s->Add (_scale);
+ _
x_
scale = new wxSpinCtrl (this);
+ s->Add (_
x_
scale);
add_label_to_sizer (s, this, _("%"), false);
grid->Add (s);
}
add_label_to_sizer (s, this, _("%"), false);
grid->Add (s);
}
+ {
+ add_label_to_sizer (grid, this, _("Y Scale"), true);
+ wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+ _y_scale = new wxSpinCtrl (this);
+ s->Add (_y_scale);
+ add_label_to_sizer (s, this, _("%"), false);
+ grid->Add (s);
+ }
+
add_label_to_sizer (grid, this, _("Stream"), true);
_stream = new wxChoice (this, wxID_ANY);
grid->Add (_stream, 1, wxEXPAND);
add_label_to_sizer (grid, this, _("Stream"), true);
_stream = new wxChoice (this, wxID_ANY);
grid->Add (_stream, 1, wxEXPAND);
@@
-83,13
+93,14
@@
SubtitlePanel::SubtitlePanel (ContentPanel* p)
_x_offset->SetRange (-100, 100);
_y_offset->SetRange (-100, 100);
_x_offset->SetRange (-100, 100);
_y_offset->SetRange (-100, 100);
- _
scale->SetRange (1
, 1000);
- _
scale->SetValue (1
00);
+ _
x_scale->SetRange (10
, 1000);
+ _
y_scale->SetRange (10, 10
00);
_use->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&SubtitlePanel::use_toggled, this));
_x_offset->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&SubtitlePanel::x_offset_changed, this));
_y_offset->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&SubtitlePanel::y_offset_changed, this));
_use->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&SubtitlePanel::use_toggled, this));
_x_offset->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&SubtitlePanel::x_offset_changed, this));
_y_offset->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&SubtitlePanel::y_offset_changed, this));
- _scale->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&SubtitlePanel::scale_changed, this));
+ _x_scale->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&SubtitlePanel::x_scale_changed, this));
+ _y_scale->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&SubtitlePanel::y_scale_changed, this));
_stream->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&SubtitlePanel::stream_changed, this));
_view_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&SubtitlePanel::view_clicked, this));
}
_stream->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&SubtitlePanel::stream_changed, this));
_view_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&SubtitlePanel::view_clicked, this));
}
@@
-140,8
+151,10
@@
SubtitlePanel::film_content_changed (int property)
checked_set (_x_offset, scs ? (scs->subtitle_x_offset() * 100) : 0);
} else if (property == SubtitleContentProperty::SUBTITLE_Y_OFFSET) {
checked_set (_y_offset, scs ? (scs->subtitle_y_offset() * 100) : 0);
checked_set (_x_offset, scs ? (scs->subtitle_x_offset() * 100) : 0);
} else if (property == SubtitleContentProperty::SUBTITLE_Y_OFFSET) {
checked_set (_y_offset, scs ? (scs->subtitle_y_offset() * 100) : 0);
- } else if (property == SubtitleContentProperty::SUBTITLE_SCALE) {
- checked_set (_scale, scs ? (scs->subtitle_scale() * 100) : 100);
+ } else if (property == SubtitleContentProperty::SUBTITLE_X_SCALE) {
+ checked_set (_x_scale, scs ? int (rint (scs->subtitle_x_scale() * 100)) : 100);
+ } else if (property == SubtitleContentProperty::SUBTITLE_Y_SCALE) {
+ checked_set (_y_scale, scs ? int (rint (scs->subtitle_y_scale() * 100)) : 100);
}
}
}
}
@@
-183,7
+196,8
@@
SubtitlePanel::setup_sensitivity ()
_x_offset->Enable (any_subs > 0 && use);
_y_offset->Enable (any_subs > 0 && use);
_x_offset->Enable (any_subs > 0 && use);
_y_offset->Enable (any_subs > 0 && use);
- _scale->Enable (any_subs > 0 && use);
+ _x_scale->Enable (any_subs > 0 && use);
+ _y_scale->Enable (any_subs > 0 && use);
_stream->Enable (ffmpeg_subs == 1);
_view_button->Enable (subrip_or_dcp_subs == 1);
}
_stream->Enable (ffmpeg_subs == 1);
_view_button->Enable (subrip_or_dcp_subs == 1);
}
@@
-229,11
+243,20
@@
SubtitlePanel::y_offset_changed ()
}
void
}
void
-SubtitlePanel::scale_changed ()
+SubtitlePanel::x_scale_changed ()
+{
+ SubtitleContentList c = _parent->selected_subtitle ();
+ if (c.size() == 1) {
+ c.front()->set_subtitle_x_scale (_x_scale->GetValue() / 100.0);
+ }
+}
+
+void
+SubtitlePanel::y_scale_changed ()
{
SubtitleContentList c = _parent->selected_subtitle ();
for (SubtitleContentList::iterator i = c.begin(); i != c.end(); ++i) {
{
SubtitleContentList c = _parent->selected_subtitle ();
for (SubtitleContentList::iterator i = c.begin(); i != c.end(); ++i) {
- (*i)->set_subtitle_
scale (
_scale->GetValue() / 100.0);
+ (*i)->set_subtitle_
y_scale (_y
_scale->GetValue() / 100.0);
}
}
}
}
@@
-244,7
+267,8
@@
SubtitlePanel::content_selection_changed ()
film_content_changed (SubtitleContentProperty::USE_SUBTITLES);
film_content_changed (SubtitleContentProperty::SUBTITLE_X_OFFSET);
film_content_changed (SubtitleContentProperty::SUBTITLE_Y_OFFSET);
film_content_changed (SubtitleContentProperty::USE_SUBTITLES);
film_content_changed (SubtitleContentProperty::SUBTITLE_X_OFFSET);
film_content_changed (SubtitleContentProperty::SUBTITLE_Y_OFFSET);
- film_content_changed (SubtitleContentProperty::SUBTITLE_SCALE);
+ film_content_changed (SubtitleContentProperty::SUBTITLE_X_SCALE);
+ film_content_changed (SubtitleContentProperty::SUBTITLE_Y_SCALE);
}
void
}
void