void
SubtitleContent::take_settings_from (shared_ptr<const SubtitleContent> c)
{
- _use = c->_use;
- _burn = c->_burn;
- _x_offset = c->_x_offset;
- _y_offset = c->_y_offset;
- _x_scale = c->_x_scale;
- _y_scale = c->_y_scale;
- _fonts = c->_fonts;
- _colour = c->_colour;
- _outline = c->_outline;
- _shadow = c->_shadow;
- _effect_colour = c->_effect_colour;
- _line_spacing = c->_line_spacing;
- _fade_in = c->_fade_in;
- _fade_out = c->_fade_out;
- _outline_width = c->_outline_width;
+ set_use (c->_use);
+ set_burn (c->_burn);
+ set_x_offset (c->_x_offset);
+ set_y_offset (c->_y_offset);
+ set_x_scale (c->_x_scale);
+ set_y_scale (c->_y_scale);
+ maybe_set (_fonts, c->_fonts, SubtitleContentProperty::FONTS);
+ set_colour (c->_colour);
+ set_outline (c->_outline);
+ set_shadow (c->_shadow);
+ set_effect_colour (c->_effect_colour);
+ set_line_spacing (c->_line_spacing);
+ set_fade_in (c->_fade_in);
+ set_fade_out (c->_fade_out);
+ set_outline_width (c->_outline_width);
}
/*
- Copyright (C) 2012-2017 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
#include "wx/templates_dialog.h"
#include "wx/nag_dialog.h"
#include "wx/export_dialog.h"
+#include "wx/paste_dialog.h"
#include "lib/film.h"
#include "lib/config.h"
#include "lib/util.h"
#include "lib/ffmpeg_encoder.h"
#include "lib/transcode_job.h"
#include "lib/dkdm_wrapper.h"
+#include "lib/audio_content.h"
+#include "lib/subtitle_content.h"
#include <dcp/exceptions.h>
#include <dcp/raw_convert.h>
#include <wx/generic/aboutdlgg.h>
wxMessageDialog* _dialog;
};
-#define ALWAYS 0x0
-#define NEEDS_FILM 0x1
-#define NOT_DURING_DCP_CREATION 0x2
-#define NEEDS_CPL 0x4
-#define NEEDS_SELECTED_VIDEO_CONTENT 0x8
+#define ALWAYS 0x0
+#define NEEDS_FILM 0x1
+#define NOT_DURING_DCP_CREATION 0x2
+#define NEEDS_CPL 0x4
+#define NEEDS_SINGLE_SELECTED_CONTENT 0x8
+#define NEEDS_SELECTED_CONTENT 0x10
+#define NEEDS_SELECTED_VIDEO_CONTENT 0x20
+#define NEEDS_CLIPBOARD 0x40
map<wxMenuItem*, int> menu_items;
ID_file_duplicate_and_open,
ID_file_history,
/* Allow spare IDs after _history for the recent files list */
- ID_content_scale_to_fit_width = 100,
+ ID_edit_copy = 100,
+ ID_edit_paste,
+ ID_content_scale_to_fit_width,
ID_content_scale_to_fit_height,
ID_jobs_make_dcp,
ID_jobs_make_dcp_batch,
Bind (wxEVT_MENU, boost::bind (&DOMFrame::file_duplicate_and_open, this), ID_file_duplicate_and_open);
Bind (wxEVT_MENU, boost::bind (&DOMFrame::file_history, this, _1), ID_file_history, ID_file_history + HISTORY_SIZE);
Bind (wxEVT_MENU, boost::bind (&DOMFrame::file_exit, this), wxID_EXIT);
+ Bind (wxEVT_MENU, boost::bind (&DOMFrame::edit_copy, this), ID_edit_copy);
+ Bind (wxEVT_MENU, boost::bind (&DOMFrame::edit_paste, this), ID_edit_paste);
Bind (wxEVT_MENU, boost::bind (&DOMFrame::edit_preferences, this), wxID_PREFERENCES);
Bind (wxEVT_MENU, boost::bind (&DOMFrame::content_scale_to_fit_width, this), ID_content_scale_to_fit_width);
Bind (wxEVT_MENU, boost::bind (&DOMFrame::content_scale_to_fit_height, this), ID_content_scale_to_fit_height);
set_menu_sensitivity ();
_film_editor->FileChanged.connect (bind (&DOMFrame::file_changed, this, _1));
+ _film_editor->content_panel()->SelectionChanged.connect (boost::bind (&DOMFrame::set_menu_sensitivity, this));
file_changed ("");
JobManager::instance()->ActiveJobsChanged.connect (boost::bind (&DOMFrame::set_menu_sensitivity, this));
Close (false);
}
+ void edit_copy ()
+ {
+ ContentList const sel = _film_editor->content_panel()->selected();
+ DCPOMATIC_ASSERT (sel.size() == 1);
+ _clipboard = sel.front()->clone();
+ }
+
+ void edit_paste ()
+ {
+ DCPOMATIC_ASSERT (_clipboard);
+
+ PasteDialog* d = new PasteDialog (this, static_cast<bool>(_clipboard->video), static_cast<bool>(_clipboard->audio), static_cast<bool>(_clipboard->subtitle));
+ if (d->ShowModal() == wxID_OK) {
+ BOOST_FOREACH (shared_ptr<Content> i, _film_editor->content_panel()->selected()) {
+ if (d->video() && i->video) {
+ DCPOMATIC_ASSERT (_clipboard->video);
+ i->video->take_settings_from (_clipboard->video);
+ }
+ if (d->audio() && i->audio) {
+ DCPOMATIC_ASSERT (_clipboard->audio);
+ i->audio->take_settings_from (_clipboard->audio);
+ }
+ if (d->subtitle() && i->subtitle) {
+ DCPOMATIC_ASSERT (_clipboard->subtitle);
+ i->subtitle->take_settings_from (_clipboard->subtitle);
+ }
+ }
+ }
+ d->Destroy ();
+ }
+
void edit_preferences ()
{
if (!_config_dialog) {
}
bool const dcp_creation = (i != jobs.end ()) && !(*i)->finished ();
bool const have_cpl = _film && !_film->cpls().empty ();
+ bool const have_single_selected_content = _film_editor->content_panel()->selected().size() == 1;
+ bool const have_selected_content = !_film_editor->content_panel()->selected().empty();
bool const have_selected_video_content = !_film_editor->content_panel()->selected_video().empty();
for (map<wxMenuItem*, int>::iterator j = menu_items.begin(); j != menu_items.end(); ++j) {
enabled = false;
}
+ if ((j->second & NEEDS_SELECTED_CONTENT) && !have_selected_content) {
+ enabled = false;
+ }
+
+ if ((j->second & NEEDS_SINGLE_SELECTED_CONTENT) && !have_single_selected_content) {
+ enabled = false;
+ }
+
if ((j->second & NEEDS_SELECTED_VIDEO_CONTENT) && !have_selected_video_content) {
enabled = false;
}
+ if ((j->second & NEEDS_CLIPBOARD) && !_clipboard) {
+ enabled = false;
+ }
+
j->first->Enable (enabled);
}
}
add_item (_file_menu, _("&Quit"), wxID_EXIT, ALWAYS);
#endif
+ wxMenu* edit = new wxMenu;
+ add_item (edit, _("Copy settings\tCtrl-C"), ID_edit_copy, NEEDS_FILM | NOT_DURING_DCP_CREATION | NEEDS_SINGLE_SELECTED_CONTENT);
+ add_item (edit, _("Paste settings...\tCtrl-V"), ID_edit_paste, NEEDS_FILM | NOT_DURING_DCP_CREATION | NEEDS_SELECTED_CONTENT | NEEDS_CLIPBOARD);
+
#ifdef __WXOSX__
add_item (_file_menu, _("&Preferences...\tCtrl-P"), wxID_PREFERENCES, ALWAYS);
#else
- wxMenu* edit = new wxMenu;
add_item (edit, _("&Preferences...\tCtrl-P"), wxID_PREFERENCES, ALWAYS);
#endif
add_item (help, _("Report a problem..."), ID_help_report_a_problem, NEEDS_FILM);
m->Append (_file_menu, _("&File"));
-#ifndef __WXOSX__
m->Append (edit, _("&Edit"));
-#endif
m->Append (content, _("&Content"));
m->Append (jobs_menu, _("&Jobs"));
m->Append (tools, _("&Tools"));
wxMenuItem* _history_separator;
boost::signals2::scoped_connection _config_changed_connection;
bool _update_news_requested;
+ shared_ptr<Content> _clipboard;
};
static const wxCmdLineEntryDesc command_line_description[] = {
--- /dev/null
+/*
+ Copyright (C) 2018 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 "paste_dialog.h"
+
+PasteDialog::PasteDialog (wxWindow* parent, bool video, bool audio, bool subtitle)
+ : TableDialog (parent, _("Paste"), 1, 0, true)
+{
+ _video = new wxCheckBox (this, wxID_ANY, _("Paste video settings"));
+ _video->Enable (video);
+ add (_video);
+ _audio = new wxCheckBox (this, wxID_ANY, _("Paste audio settings"));
+ _audio->Enable (audio);
+ add (_audio);
+ _subtitle = new wxCheckBox (this, wxID_ANY, _("Paste subtitle settings"));
+ _subtitle->Enable (subtitle);
+ add (_subtitle);
+
+ layout ();
+}
+
+bool
+PasteDialog::video () const
+{
+ return _video->GetValue ();
+}
+
+bool
+PasteDialog::audio () const
+{
+ return _audio->GetValue ();
+}
+
+bool
+PasteDialog::subtitle () const
+{
+ return _subtitle->GetValue ();
+}