--- /dev/null
+/*
+ Copyright (C) 2021 Carl Hetherington <cth@carlh.net>
+
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ DCP-o-matic is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
+#include "dcpomatic_spin_ctrl.h"
+#include <boost/bind.hpp>
+#include <wx/wx.h>
+#if BOOST_VERSION >= 106100
+using namespace boost::placeholders;
+#endif
+
+
+SpinCtrl::SpinCtrl (wxWindow* parent, int width)
+ : wxSpinCtrl (parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(width, -1), wxSP_ARROW_KEYS | wxTE_PROCESS_ENTER)
+{
+ auto enter = [](wxCommandEvent& ev) {
+ dynamic_cast<wxWindow*>(ev.GetEventObject())->Navigate();
+ };
+ Bind (wxEVT_TEXT_ENTER, boost::bind<void>(enter, _1));
+}
+
/*
- Copyright (C) 2012-2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
-#include "text_panel.h"
-#include "film_editor.h"
-#include "wx_util.h"
-#include "text_view.h"
+
+#include "check_box.h"
#include "content_panel.h"
-#include "fonts_dialog.h"
#include "dcp_text_track_dialog.h"
-#include "subtitle_appearance_dialog.h"
-#include "static_text.h"
-#include "check_box.h"
#include "dcpomatic_button.h"
+#include "dcpomatic_spin_ctrl.h"
+#include "film_editor.h"
#include "film_viewer.h"
-#include "lib/job_manager.h"
-#include "lib/ffmpeg_content.h"
-#include "lib/string_text_file_content.h"
-#include "lib/ffmpeg_subtitle_stream.h"
+#include "fonts_dialog.h"
+#include "static_text.h"
+#include "subtitle_appearance_dialog.h"
+#include "text_panel.h"
+#include "text_view.h"
+#include "wx_util.h"
+#include "lib/analyse_subtitles_job.h"
+#include "lib/dcp_content.h"
#include "lib/dcp_subtitle_content.h"
-#include "lib/string_text_file_decoder.h"
#include "lib/dcp_subtitle_decoder.h"
-#include "lib/dcp_content.h"
-#include "lib/text_content.h"
#include "lib/decoder_factory.h"
-#include "lib/analyse_subtitles_job.h"
+#include "lib/ffmpeg_content.h"
+#include "lib/ffmpeg_subtitle_stream.h"
+#include "lib/job_manager.h"
+#include "lib/string_text_file_content.h"
+#include "lib/string_text_file_decoder.h"
#include "lib/subtitle_analysis.h"
+#include "lib/text_content.h"
#include <wx/spinctrl.h>
+
using std::vector;
using std::string;
using std::list;
using std::dynamic_pointer_cast;
using boost::bind;
+
/** @param t Original text type of the content, if known */
TextPanel::TextPanel (ContentPanel* p, TextType t)
: ContentSubPanel (p, std_to_wx(text_type_to_name(t)))
_offset_label = create_label (this, _("Offset"), true);
_x_offset_label = create_label (this, _("X"), true);
- _x_offset = new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(spin_width, -1));
+ _x_offset = new SpinCtrl (this, spin_width);
_x_offset_pc_label = new StaticText (this, _("%"));
_y_offset_label = create_label (this, _("Y"), true);
- _y_offset = new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(spin_width, -1));
+ _y_offset = new SpinCtrl (this, spin_width);
_y_offset_pc_label = new StaticText (this, _("%"));
_scale_label = create_label (this, _("Scale"), true);
_x_scale_label = create_label (this, _("X"), true);
- _x_scale = new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(spin_width, -1));
+ _x_scale = new SpinCtrl (this, spin_width);
_x_scale_pc_label = new StaticText (this, _("%"));
_y_scale_label = create_label (this, S_("Coord|Y"), true);
- _y_scale = new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(spin_width, -1));
+ _y_scale = new SpinCtrl (this, spin_width);
_y_scale_pc_label = new StaticText (this, _("%"));
_line_spacing_label = create_label (this, _("Line spacing"), true);
- _line_spacing = new wxSpinCtrl (this);
+ _line_spacing = new SpinCtrl (this, spin_width);
_line_spacing_pc_label = new StaticText (this, _("%"));
_stream_label = create_label (this, _("Stream"), true);
_x_offset->SetRange (-100, 100);
_y_offset->SetRange (-100, 100);
- _x_scale->SetRange (10, 1000);
- _y_scale->SetRange (10, 1000);
- _line_spacing->SetRange (10, 1000);
+ _x_scale->SetRange (0, 1000);
+ _y_scale->SetRange (0, 1000);
+ _line_spacing->SetRange (0, 1000);
_reference->Bind (wxEVT_CHECKBOX, boost::bind (&TextPanel::reference_clicked, this));
_use->Bind (wxEVT_CHECKBOX, boost::bind (&TextPanel::use_toggled, this));
content_selection_changed ();
}
+
void
TextPanel::setup_visibility ()
{
}
if (_dcp_track) {
_dcp_track->Destroy ();
- _dcp_track = 0;
+ _dcp_track = nullptr;
}
if (!_outline_subtitles) {
_outline_subtitles = new CheckBox (this, _("Show subtitle area"));
_grid->Layout ();
}
+
void
TextPanel::add_to_grid ()
{
setup_visibility ();
}
+
void
TextPanel::update_dcp_track_selection ()
{
}
}
+
void
TextPanel::update_dcp_tracks ()
{
update_dcp_track_selection ();
}
+
void
TextPanel::dcp_track_changed ()
{
update_dcp_tracks ();
}
+
void
TextPanel::film_changed (Film::Property property)
{
}
}
+
void
TextPanel::film_content_changed (int property)
{
}
}
+
void
TextPanel::use_toggled ()
{
}
}
+
/** @return the text type that is currently selected in the drop-down */
TextType
TextPanel::current_type () const
return TextType::UNKNOWN;
}
+
void
TextPanel::type_changed ()
{
setup_visibility ();
}
+
void
TextPanel::burn_toggled ()
{
}
}
+
void
TextPanel::setup_sensitivity ()
{
_appearance_dialog_button->Enable (!reference && any_subs > 0 && use && type == TextType::OPEN_SUBTITLE);
}
+
void
TextPanel::stream_changed ()
{
}
}
+
void
TextPanel::x_offset_changed ()
{
}
}
+
void
TextPanel::y_offset_changed ()
{
}
}
+
void
TextPanel::x_scale_changed ()
{
}
}
+
void
TextPanel::y_scale_changed ()
{
}
}
+
void
TextPanel::line_spacing_changed ()
{
}
}
+
void
TextPanel::content_selection_changed ()
{
film_content_changed (DCPContentProperty::REFERENCE_TEXT);
}
+
void
TextPanel::text_view_clicked ()
{
}
}
+
void
TextPanel::fonts_dialog_clicked ()
{
_fonts_dialog->Show ();
}
+
void
TextPanel::reference_clicked ()
{
d->set_reference_text (_original_type, _reference->GetValue ());
}
+
void
TextPanel::appearance_dialog_clicked ()
{