void content_scale_to_fit_width ()
{
- VideoContentList vc = _film_editor->selected_video_content ();
+ VideoContentList vc = _film_editor->content_panel()->selected_video ();
for (VideoContentList::iterator i = vc.begin(); i != vc.end(); ++i) {
(*i)->scale_and_crop_to_fit_width ();
}
void content_scale_to_fit_height ()
{
- VideoContentList vc = _film_editor->selected_video_content ();
+ VideoContentList vc = _film_editor->content_panel()->selected_video ();
for (VideoContentList::iterator i = vc.begin(); i != vc.end(); ++i) {
(*i)->scale_and_crop_to_fit_height ();
}
}
bool const dcp_creation = (i != jobs.end ()) && !(*i)->finished ();
bool const have_cpl = film && !film->cpls().empty ();
- bool const have_selected_video_content = !_film_editor->selected_video_content().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) {
/*
- Copyright (C) 2012-2013 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
using boost::lexical_cast;
using boost::shared_ptr;
-AudioPanel::AudioPanel (FilmEditor* e)
- : FilmEditorPanel (e, _("Audio"))
+AudioPanel::AudioPanel (ContentPanel* p)
+ : ContentSubPanel (p, _("Audio"))
, _audio_dialog (0)
{
wxGridBagSizer* grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
{
switch (property) {
case Film::AUDIO_CHANNELS:
- _mapping->set_channels (_editor->film()->audio_channels ());
+ _mapping->set_channels (_parent->film()->audio_channels ());
_sizer->Layout ();
break;
default:
void
AudioPanel::film_content_changed (int property)
{
- AudioContentList ac = _editor->selected_audio_content ();
+ AudioContentList ac = _parent->selected_audio ();
shared_ptr<AudioContent> acs;
shared_ptr<FFmpegContent> fcs;
if (ac.size() == 1) {
_audio_dialog = 0;
}
- AudioContentList ac = _editor->selected_audio_content ();
+ AudioContentList ac = _parent->selected_audio ();
if (ac.size() != 1) {
return;
}
void
AudioPanel::stream_changed ()
{
- FFmpegContentList fc = _editor->selected_ffmpeg_content ();
+ FFmpegContentList fc = _parent->selected_ffmpeg ();
if (fc.size() != 1) {
return;
}
void
AudioPanel::setup_stream_description ()
{
- FFmpegContentList fc = _editor->selected_ffmpeg_content ();
+ FFmpegContentList fc = _parent->selected_ffmpeg ();
if (fc.size() != 1) {
_description->SetLabel ("");
return;
void
AudioPanel::mapping_changed (AudioMapping m)
{
- AudioContentList c = _editor->selected_audio_content ();
+ AudioContentList c = _parent->selected_audio ();
if (c.size() == 1) {
c.front()->set_audio_mapping (m);
}
void
AudioPanel::content_selection_changed ()
{
- AudioContentList sel = _editor->selected_audio_content ();
+ AudioContentList sel = _parent->selected_audio ();
if (_audio_dialog && sel.size() == 1) {
_audio_dialog->set_content (sel.front ());
*/
#include "lib/audio_mapping.h"
-#include "film_editor_panel.h"
+#include "content_sub_panel.h"
#include "content_widget.h"
class wxSpinCtrlDouble;
class AudioMappingView;
class AudioDialog;
-class AudioPanel : public FilmEditorPanel
+class AudioPanel : public ContentSubPanel
{
public:
- AudioPanel (FilmEditor *);
+ AudioPanel (ContentPanel *);
void film_changed (Film::Property);
void film_content_changed (int);
class ContentMenu
{
public:
- ContentMenu (wxWindow *);
+ ContentMenu (wxWindow* p);
~ContentMenu ();
-
+
void popup (boost::weak_ptr<Film>, ContentList, wxPoint);
private:
--- /dev/null
+/*
+ Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+
+ This program 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.
+
+ This program 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 this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <wx/wx.h>
+#include <wx/notebook.h>
+#include <wx/listctrl.h>
+#include "lib/audio_content.h"
+#include "lib/subtitle_content.h"
+#include "lib/video_content.h"
+#include "lib/ffmpeg_content.h"
+#include "lib/content_factory.h"
+#include "lib/image_content.h"
+#include "lib/dcp_content.h"
+#include "lib/playlist.h"
+#include "content_panel.h"
+#include "wx_util.h"
+#include "video_panel.h"
+#include "audio_panel.h"
+#include "subtitle_panel.h"
+#include "timing_panel.h"
+#include "timeline_dialog.h"
+
+using std::list;
+using std::string;
+using boost::shared_ptr;
+using boost::weak_ptr;
+using boost::dynamic_pointer_cast;
+
+ContentPanel::ContentPanel (wxNotebook* n, boost::shared_ptr<Film> f)
+ : _timeline_dialog (0)
+ , _film (f)
+ , _generally_sensitive (true)
+{
+ _panel = new wxPanel (n);
+ _sizer = new wxBoxSizer (wxVERTICAL);
+ _panel->SetSizer (_sizer);
+
+ _menu = new ContentMenu (_panel);
+
+ {
+ wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+
+ _content = new wxListCtrl (_panel, wxID_ANY, wxDefaultPosition, wxSize (320, 160), wxLC_REPORT | wxLC_NO_HEADER);
+ s->Add (_content, 1, wxEXPAND | wxTOP | wxBOTTOM, 6);
+
+ _content->InsertColumn (0, wxT(""));
+ _content->SetColumnWidth (0, 512);
+
+ wxBoxSizer* b = new wxBoxSizer (wxVERTICAL);
+ _add_file = new wxButton (_panel, wxID_ANY, _("Add file(s)..."));
+ b->Add (_add_file, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
+ _add_folder = new wxButton (_panel, wxID_ANY, _("Add folder..."));
+ b->Add (_add_folder, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
+ _remove = new wxButton (_panel, wxID_ANY, _("Remove"));
+ b->Add (_remove, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
+ _earlier = new wxButton (_panel, wxID_ANY, _("Up"));
+ b->Add (_earlier, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
+ _later = new wxButton (_panel, wxID_ANY, _("Down"));
+ b->Add (_later, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
+ _timeline = new wxButton (_panel, wxID_ANY, _("Timeline..."));
+ b->Add (_timeline, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
+
+ s->Add (b, 0, wxALL, 4);
+
+ _sizer->Add (s, 0, wxEXPAND | wxALL, 6);
+ }
+
+ _sequence_video = new wxCheckBox (_panel, wxID_ANY, _("Keep video in sequence"));
+ _sizer->Add (_sequence_video);
+
+ _notebook = new wxNotebook (_panel, wxID_ANY);
+ _sizer->Add (_notebook, 1, wxEXPAND | wxTOP, 6);
+
+ _video_panel = new VideoPanel (this);
+ _panels.push_back (_video_panel);
+ _audio_panel = new AudioPanel (this);
+ _panels.push_back (_audio_panel);
+ _subtitle_panel = new SubtitlePanel (this);
+ _panels.push_back (_subtitle_panel);
+ _timing_panel = new TimingPanel (this);
+ _panels.push_back (_timing_panel);
+
+ _content->Bind (wxEVT_COMMAND_LIST_ITEM_SELECTED, boost::bind (&ContentPanel::selection_changed, this));
+ _content->Bind (wxEVT_COMMAND_LIST_ITEM_DESELECTED, boost::bind (&ContentPanel::selection_changed, this));
+ _content->Bind (wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, boost::bind (&ContentPanel::right_click, this, _1));
+ _add_file->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&ContentPanel::add_file_clicked, this));
+ _add_folder->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&ContentPanel::add_folder_clicked, this));
+ _remove->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&ContentPanel::remove_clicked, this));
+ _earlier->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&ContentPanel::earlier_clicked, this));
+ _later->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&ContentPanel::later_clicked, this));
+ _timeline->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&ContentPanel::timeline_clicked, this));
+ _sequence_video->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&ContentPanel::sequence_video_changed, this));
+}
+
+ContentList
+ContentPanel::selected ()
+{
+ ContentList sel;
+ long int s = -1;
+ while (true) {
+ s = _content->GetNextItem (s, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
+ if (s == -1) {
+ break;
+ }
+
+ if (s < int (_film->content().size ())) {
+ sel.push_back (_film->content()[s]);
+ }
+ }
+
+ return sel;
+}
+
+VideoContentList
+ContentPanel::selected_video ()
+{
+ ContentList c = selected ();
+ VideoContentList vc;
+
+ for (ContentList::iterator i = c.begin(); i != c.end(); ++i) {
+ shared_ptr<VideoContent> t = dynamic_pointer_cast<VideoContent> (*i);
+ if (t) {
+ vc.push_back (t);
+ }
+ }
+
+ return vc;
+}
+
+AudioContentList
+ContentPanel::selected_audio ()
+{
+ ContentList c = selected ();
+ AudioContentList ac;
+
+ for (ContentList::iterator i = c.begin(); i != c.end(); ++i) {
+ shared_ptr<AudioContent> t = dynamic_pointer_cast<AudioContent> (*i);
+ if (t) {
+ ac.push_back (t);
+ }
+ }
+
+ return ac;
+}
+
+SubtitleContentList
+ContentPanel::selected_subtitle ()
+{
+ ContentList c = selected ();
+ SubtitleContentList sc;
+
+ for (ContentList::iterator i = c.begin(); i != c.end(); ++i) {
+ shared_ptr<SubtitleContent> t = dynamic_pointer_cast<SubtitleContent> (*i);
+ if (t) {
+ sc.push_back (t);
+ }
+ }
+
+ return sc;
+}
+
+FFmpegContentList
+ContentPanel::selected_ffmpeg ()
+{
+ ContentList c = selected ();
+ FFmpegContentList sc;
+
+ for (ContentList::iterator i = c.begin(); i != c.end(); ++i) {
+ shared_ptr<FFmpegContent> t = dynamic_pointer_cast<FFmpegContent> (*i);
+ if (t) {
+ sc.push_back (t);
+ }
+ }
+
+ return sc;
+}
+
+void
+ContentPanel::sequence_video_changed ()
+{
+ if (!_film) {
+ return;
+ }
+
+ _film->set_sequence_video (_sequence_video->GetValue ());
+}
+
+void
+ContentPanel::film_changed (Film::Property p)
+{
+ switch (p) {
+ case Film::CONTENT:
+ setup ();
+ break;
+ case Film::SEQUENCE_VIDEO:
+ checked_set (_sequence_video, _film->sequence_video ());
+ break;
+ default:
+ break;
+ }
+
+ for (list<ContentSubPanel*>::iterator i = _panels.begin(); i != _panels.end(); ++i) {
+ (*i)->film_changed (p);
+ }
+}
+
+void
+ContentPanel::selection_changed ()
+{
+ setup_sensitivity ();
+
+ for (list<ContentSubPanel*>::iterator i = _panels.begin(); i != _panels.end(); ++i) {
+ (*i)->content_selection_changed ();
+ }
+}
+
+void
+ContentPanel::add_file_clicked ()
+{
+ /* The wxFD_CHANGE_DIR here prevents a `could not set working directory' error 123 on Windows when using
+ non-Latin filenames or paths.
+ */
+ wxFileDialog* d = new wxFileDialog (_panel, _("Choose a file or files"), wxT (""), wxT (""), wxT ("*.*"), wxFD_MULTIPLE | wxFD_CHANGE_DIR);
+ int const r = d->ShowModal ();
+
+ if (r != wxID_OK) {
+ d->Destroy ();
+ return;
+ }
+
+ wxArrayString paths;
+ d->GetPaths (paths);
+
+ /* XXX: check for lots of files here and do something */
+
+ for (unsigned int i = 0; i < paths.GetCount(); ++i) {
+ _film->examine_and_add_content (content_factory (_film, wx_to_std (paths[i])));
+ }
+
+ d->Destroy ();
+}
+
+void
+ContentPanel::add_folder_clicked ()
+{
+ wxDirDialog* d = new wxDirDialog (_panel, _("Choose a folder"), wxT (""), wxDD_DIR_MUST_EXIST);
+ int const r = d->ShowModal ();
+ d->Destroy ();
+
+ if (r != wxID_OK) {
+ return;
+ }
+
+ shared_ptr<Content> content;
+
+ try {
+ content.reset (new ImageContent (_film, boost::filesystem::path (wx_to_std (d->GetPath ()))));
+ } catch (...) {
+ try {
+ content.reset (new DCPContent (_film, boost::filesystem::path (wx_to_std (d->GetPath ()))));
+ } catch (...) {
+ error_dialog (_panel, _("Could not find any images nor a DCP in that folder"));
+ return;
+ }
+ }
+
+ if (content) {
+ _film->examine_and_add_content (content);
+ }
+}
+
+void
+ContentPanel::remove_clicked ()
+{
+ ContentList c = selected ();
+ if (c.size() == 1) {
+ _film->remove_content (c.front ());
+ }
+
+ selection_changed ();
+}
+
+void
+ContentPanel::timeline_clicked ()
+{
+ if (_timeline_dialog) {
+ _timeline_dialog->Destroy ();
+ _timeline_dialog = 0;
+ }
+
+ _timeline_dialog = new TimelineDialog (this, _film);
+ _timeline_dialog->Show ();
+}
+
+void
+ContentPanel::right_click (wxListEvent& ev)
+{
+ _menu->popup (_film, selected (), ev.GetPoint ());
+}
+
+/** Set up broad sensitivity based on the type of content that is selected */
+void
+ContentPanel::setup_sensitivity ()
+{
+ _add_file->Enable (_generally_sensitive);
+ _add_folder->Enable (_generally_sensitive);
+
+ ContentList selection = selected ();
+ VideoContentList video_selection = selected_video ();
+ AudioContentList audio_selection = selected_audio ();
+
+ _remove->Enable (selection.size() == 1 && _generally_sensitive);
+ _earlier->Enable (selection.size() == 1 && _generally_sensitive);
+ _later->Enable (selection.size() == 1 && _generally_sensitive);
+ _timeline->Enable (!_film->content().empty() && _generally_sensitive);
+
+ _video_panel->Enable (video_selection.size() > 0 && _generally_sensitive);
+ _audio_panel->Enable (audio_selection.size() > 0 && _generally_sensitive);
+ _subtitle_panel->Enable (selection.size() == 1 && dynamic_pointer_cast<SubtitleContent> (selection.front()) && _generally_sensitive);
+ _timing_panel->Enable (selection.size() == 1 && _generally_sensitive);
+}
+
+void
+ContentPanel::set_film (shared_ptr<Film> f)
+{
+ _film = f;
+ selection_changed ();
+}
+
+void
+ContentPanel::set_general_sensitivity (bool s)
+{
+ _generally_sensitive = s;
+
+ _content->Enable (s);
+ _add_file->Enable (s);
+ _add_folder->Enable (s);
+ _remove->Enable (s);
+ _earlier->Enable (s);
+ _later->Enable (s);
+ _timeline->Enable (s);
+ _sequence_video->Enable (s);
+
+ /* Set the panels in the content notebook */
+ for (list<ContentSubPanel*>::iterator i = _panels.begin(); i != _panels.end(); ++i) {
+ (*i)->Enable (s);
+ }
+}
+
+void
+ContentPanel::earlier_clicked ()
+{
+ ContentList sel = selected ();
+ if (sel.size() == 1) {
+ _film->move_content_earlier (sel.front ());
+ selection_changed ();
+ }
+}
+
+void
+ContentPanel::later_clicked ()
+{
+ ContentList sel = selected ();
+ if (sel.size() == 1) {
+ _film->move_content_later (sel.front ());
+ selection_changed ();
+ }
+}
+
+void
+ContentPanel::set_selection (weak_ptr<Content> wc)
+{
+ ContentList content = _film->content ();
+ for (size_t i = 0; i < content.size(); ++i) {
+ if (content[i] == wc.lock ()) {
+ _content->SetItemState (i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
+ } else {
+ _content->SetItemState (i, 0, wxLIST_STATE_SELECTED | wxLIST_STATE_FOCUSED);
+ }
+ }
+}
+
+void
+ContentPanel::film_content_changed (int property)
+{
+ if (property == ContentProperty::PATH || property == ContentProperty::POSITION) {
+ setup ();
+ }
+
+ for (list<ContentSubPanel*>::iterator i = _panels.begin(); i != _panels.end(); ++i) {
+ (*i)->film_content_changed (property);
+ }
+}
+
+void
+ContentPanel::setup ()
+{
+ string selected_summary;
+ int const s = _content->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
+ if (s != -1) {
+ selected_summary = wx_to_std (_content->GetItemText (s));
+ }
+
+ _content->DeleteAllItems ();
+
+ ContentList content = _film->content ();
+ sort (content.begin(), content.end(), ContentSorter ());
+
+ for (ContentList::iterator i = content.begin(); i != content.end(); ++i) {
+ int const t = _content->GetItemCount ();
+ bool const valid = (*i)->paths_valid ();
+
+ string s = (*i)->summary ();
+ if (!valid) {
+ s = _("MISSING: ") + s;
+ }
+
+ _content->InsertItem (t, std_to_wx (s));
+
+ if ((*i)->summary() == selected_summary) {
+ _content->SetItemState (t, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
+ }
+
+ if (!valid) {
+ _content->SetItemTextColour (t, *wxRED);
+ }
+ }
+
+ if (selected_summary.empty () && !content.empty ()) {
+ /* Select the item of content if none was selected before */
+ _content->SetItemState (0, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
+ }
+}
+
--- /dev/null
+/*
+ Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+
+ This program 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.
+
+ This program 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 this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <list>
+#include <boost/shared_ptr.hpp>
+#include "lib/types.h"
+#include "lib/film.h"
+#include "content_menu.h"
+
+class wxNotebook;
+class wxPanel;
+class wxSizer;
+class wxListCtrl;
+class wxListEvent;
+class TimelineDialog;
+class FilmEditor;
+class ContentSubPanel;
+class Film;
+
+class ContentPanel
+{
+public:
+ ContentPanel (wxNotebook *, boost::shared_ptr<Film>);
+
+ boost::shared_ptr<Film> film () const {
+ return _film;
+ }
+
+ void set_film (boost::shared_ptr<Film> f);
+ void set_general_sensitivity (bool s);
+ void set_selection (boost::weak_ptr<Content>);
+
+ void film_changed (Film::Property p);
+ void film_content_changed (int p);
+
+ wxPanel* panel () const {
+ return _panel;
+ }
+
+ wxNotebook* notebook () const {
+ return _notebook;
+ }
+
+ ContentList selected ();
+ VideoContentList selected_video ();
+ AudioContentList selected_audio ();
+ SubtitleContentList selected_subtitle ();
+ FFmpegContentList selected_ffmpeg ();
+
+private:
+ void sequence_video_changed ();
+ void selection_changed ();
+ void add_file_clicked ();
+ void add_folder_clicked ();
+ void remove_clicked ();
+ void earlier_clicked ();
+ void later_clicked ();
+ void right_click (wxListEvent &);
+ void timeline_clicked ();
+
+ void setup ();
+ void setup_sensitivity ();
+
+ wxPanel* _panel;
+ wxSizer* _sizer;
+ wxNotebook* _notebook;
+ wxListCtrl* _content;
+ wxButton* _add_file;
+ wxButton* _add_folder;
+ wxButton* _remove;
+ wxButton* _earlier;
+ wxButton* _later;
+ wxButton* _timeline;
+ wxCheckBox* _sequence_video;
+ ContentSubPanel* _video_panel;
+ ContentSubPanel* _audio_panel;
+ ContentSubPanel* _subtitle_panel;
+ ContentSubPanel* _timing_panel;
+ std::list<ContentSubPanel *> _panels;
+ ContentMenu* _menu;
+ TimelineDialog* _timeline_dialog;
+
+ boost::shared_ptr<Film> _film;
+ bool _generally_sensitive;
+};
--- /dev/null
+/*
+ Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+
+ This program 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.
+
+ This program 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 this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <wx/notebook.h>
+#include "content_sub_panel.h"
+#include "film_editor.h"
+
+using boost::shared_ptr;
+
+ContentSubPanel::ContentSubPanel (ContentPanel* p, wxString name)
+ : wxPanel (p->notebook(), wxID_ANY)
+ , _parent (p)
+ , _sizer (new wxBoxSizer (wxVERTICAL))
+{
+ p->notebook()->AddPage (this, name, false);
+ SetSizer (_sizer);
+}
+
--- /dev/null
+/*
+ Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+
+ This program 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.
+
+ This program 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 this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef DCPOMATIC_CONTENT_SUB_PANEL_H
+#define DCPOMATIC_CONTENT_SUB_PANEL_H
+
+#include <boost/shared_ptr.hpp>
+#include <wx/wx.h>
+#include "lib/film.h"
+
+class ContentPanel;
+class Content;
+
+class ContentSubPanel : public wxPanel
+{
+public:
+ ContentSubPanel (ContentPanel *, wxString);
+
+ virtual void film_changed (Film::Property) {}
+ /** Called when a given property of one of the selected Contents changes */
+ virtual void film_content_changed (int) = 0;
+ /** Called when the list of selected Contents changes */
+ virtual void content_selection_changed () = 0;
+
+protected:
+ ContentPanel* _parent;
+ wxSizer* _sizer;
+};
+
+#endif
#include <vector>
#include <wx/wx.h>
#include <wx/gbsizer.h>
+#include <wx/spinctrl.h>
#include <boost/function.hpp>
#include "wx_util.h"
/** @param f Film to edit */
FilmEditor::FilmEditor (shared_ptr<Film> f, wxWindow* parent)
: wxPanel (parent)
- , _menu (this)
, _generally_sensitive (true)
- , _timeline_dialog (0)
{
wxBoxSizer* s = new wxBoxSizer (wxVERTICAL);
_main_notebook = new wxNotebook (this, wxID_ANY);
s->Add (_main_notebook, 1);
- make_content_panel ();
- _main_notebook->AddPage (_content_panel, _("Content"), true);
+ _content_panel = new ContentPanel (_main_notebook, _film);
+ _main_notebook->AddPage (_content_panel->panel (), _("Content"), true);
make_dcp_panel ();
_main_notebook->AddPage (_dcp_panel, _("DCP"), false);
_use_isdcf_name->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&FilmEditor::use_isdcf_name_toggled, this));
_edit_isdcf_button->Bind(wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&FilmEditor::edit_isdcf_button_clicked, this));
_container->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&FilmEditor::container_changed, this));
- _content->Bind (wxEVT_COMMAND_LIST_ITEM_SELECTED, boost::bind (&FilmEditor::content_selection_changed, this));
- _content->Bind (wxEVT_COMMAND_LIST_ITEM_DESELECTED, boost::bind (&FilmEditor::content_selection_changed, this));
- _content->Bind (wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, boost::bind (&FilmEditor::content_right_click, this, _1));
- _content_add_file->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&FilmEditor::content_add_file_clicked, this));
- _content_add_folder->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&FilmEditor::content_add_folder_clicked, this));
- _content_remove->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&FilmEditor::content_remove_clicked, this));
- _content_earlier->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&FilmEditor::content_earlier_clicked, this));
- _content_later->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&FilmEditor::content_later_clicked, this));
- _content_timeline->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&FilmEditor::content_timeline_clicked, this));
_scaler->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&FilmEditor::scaler_changed, this));
_dcp_content_type->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&FilmEditor::dcp_content_type_changed, this));
_frame_rate_choice->Bind(wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&FilmEditor::frame_rate_choice_changed, this));
_audio_channels->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&FilmEditor::audio_channels_changed, this));
_j2k_bandwidth->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&FilmEditor::j2k_bandwidth_changed, this));
_resolution->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&FilmEditor::resolution_changed, this));
- _sequence_video->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&FilmEditor::sequence_video_changed, this));
_three_d->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&FilmEditor::three_d_changed, this));
_standard->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&FilmEditor::standard_changed, this));
}
-void
-FilmEditor::make_content_panel ()
-{
- _content_panel = new wxPanel (_main_notebook);
- _content_sizer = new wxBoxSizer (wxVERTICAL);
- _content_panel->SetSizer (_content_sizer);
-
- {
- wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
-
- _content = new wxListCtrl (_content_panel, wxID_ANY, wxDefaultPosition, wxSize (320, 160), wxLC_REPORT | wxLC_NO_HEADER);
- s->Add (_content, 1, wxEXPAND | wxTOP | wxBOTTOM, 6);
-
- _content->InsertColumn (0, wxT(""));
- _content->SetColumnWidth (0, 512);
-
- wxBoxSizer* b = new wxBoxSizer (wxVERTICAL);
- _content_add_file = new wxButton (_content_panel, wxID_ANY, _("Add file(s)..."));
- b->Add (_content_add_file, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
- _content_add_folder = new wxButton (_content_panel, wxID_ANY, _("Add folder..."));
- b->Add (_content_add_folder, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
- _content_remove = new wxButton (_content_panel, wxID_ANY, _("Remove"));
- b->Add (_content_remove, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
- _content_earlier = new wxButton (_content_panel, wxID_ANY, _("Up"));
- b->Add (_content_earlier, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
- _content_later = new wxButton (_content_panel, wxID_ANY, _("Down"));
- b->Add (_content_later, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
- _content_timeline = new wxButton (_content_panel, wxID_ANY, _("Timeline..."));
- b->Add (_content_timeline, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
-
- s->Add (b, 0, wxALL, 4);
-
- _content_sizer->Add (s, 0, wxEXPAND | wxALL, 6);
- }
-
- _sequence_video = new wxCheckBox (_content_panel, wxID_ANY, _("Keep video in sequence"));
- _content_sizer->Add (_sequence_video);
-
- _content_notebook = new wxNotebook (_content_panel, wxID_ANY);
- _content_sizer->Add (_content_notebook, 1, wxEXPAND | wxTOP, 6);
-
- _video_panel = new VideoPanel (this);
- _panels.push_back (_video_panel);
- _audio_panel = new AudioPanel (this);
- _panels.push_back (_audio_panel);
- _subtitle_panel = new SubtitlePanel (this);
- _panels.push_back (_subtitle_panel);
- _timing_panel = new TimingPanel (this);
- _panels.push_back (_timing_panel);
-}
-
/** Called when the name widget has been changed */
void
FilmEditor::name_changed ()
stringstream s;
- for (list<FilmEditorPanel*>::iterator i = _panels.begin(); i != _panels.end(); ++i) {
- (*i)->film_changed (p);
- }
-
+ _content_panel->film_changed (p);
+
switch (p) {
case Film::NONE:
break;
- case Film::CONTENT:
- setup_content ();
- break;
case Film::CONTAINER:
setup_container ();
break;
checked_set (_audio_channels, _film->audio_channels ());
setup_dcp_name ();
break;
- case Film::SEQUENCE_VIDEO:
- checked_set (_sequence_video, _film->sequence_video ());
- break;
case Film::THREE_D:
checked_set (_three_d, _film->three_d ());
setup_dcp_name ();
case Film::INTEROP:
checked_set (_standard, _film->interop() ? 1 : 0);
break;
+ default:
+ break;
}
}
return;
}
- for (list<FilmEditorPanel*>::iterator i = _panels.begin(); i != _panels.end(); ++i) {
- (*i)->film_content_changed (property);
- }
+ _content_panel->film_content_changed (property);
if (property == FFmpegContentProperty::AUDIO_STREAM || property == SubtitleContentProperty::USE_SUBTITLES) {
setup_dcp_name ();
- } else if (property == ContentProperty::PATH) {
- setup_content ();
- } else if (property == ContentProperty::POSITION) {
- setup_content ();
}
}
_film = f;
+ _content_panel->set_film (_film);
+
if (_film) {
_film->Changed.connect (bind (&FilmEditor::film_changed, this, _1));
_film->ContentChanged.connect (bind (&FilmEditor::film_content_changed, this, _2));
film_changed (Film::INTEROP);
if (!_film->content().empty ()) {
- set_selection (_film->content().front ());
+ _content_panel->set_selection (_film->content().front ());
}
-
- content_selection_changed ();
}
void
{
_generally_sensitive = s;
+ _content_panel->set_general_sensitivity (s);
+
/* Stuff in the Content / DCP tabs */
_name->Enable (s);
_use_isdcf_name->Enable (s);
_edit_isdcf_button->Enable (s);
- _content->Enable (s);
- _content_add_file->Enable (s);
- _content_add_folder->Enable (s);
- _content_remove->Enable (s);
- _content_earlier->Enable (s);
- _content_later->Enable (s);
- _content_timeline->Enable (s);
_dcp_content_type->Enable (s);
bool si = s;
_j2k_bandwidth->Enable (s);
_container->Enable (s);
_best_frame_rate->Enable (s && _film && _film->best_video_frame_rate () != _film->video_frame_rate ());
- _sequence_video->Enable (s);
_resolution->Enable (s);
_scaler->Enable (s);
_three_d->Enable (s);
_standard->Enable (s);
-
- /* Set the panels in the content notebook */
- for (list<FilmEditorPanel*>::iterator i = _panels.begin(); i != _panels.end(); ++i) {
- (*i)->Enable (s);
- }
}
/** Called when the scaler widget has been changed */
_film->set_video_frame_rate (_film->best_video_frame_rate ());
}
-void
-FilmEditor::setup_content ()
-{
- string selected_summary;
- int const s = _content->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
- if (s != -1) {
- selected_summary = wx_to_std (_content->GetItemText (s));
- }
-
- _content->DeleteAllItems ();
-
- ContentList content = _film->content ();
- sort (content.begin(), content.end(), ContentSorter ());
-
- for (ContentList::iterator i = content.begin(); i != content.end(); ++i) {
- int const t = _content->GetItemCount ();
- bool const valid = (*i)->paths_valid ();
-
- string s = (*i)->summary ();
- if (!valid) {
- s = _("MISSING: ") + s;
- }
-
- _content->InsertItem (t, std_to_wx (s));
-
- if ((*i)->summary() == selected_summary) {
- _content->SetItemState (t, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
- }
-
- if (!valid) {
- _content->SetItemTextColour (t, *wxRED);
- }
- }
-
- if (selected_summary.empty () && !content.empty ()) {
- /* Select the item of content if none was selected before */
- _content->SetItemState (0, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
- }
-}
-
-void
-FilmEditor::content_add_file_clicked ()
-{
- /* The wxFD_CHANGE_DIR here prevents a `could not set working directory' error 123 on Windows when using
- non-Latin filenames or paths.
- */
- wxFileDialog* d = new wxFileDialog (this, _("Choose a file or files"), wxT (""), wxT (""), wxT ("*.*"), wxFD_MULTIPLE | wxFD_CHANGE_DIR);
- int const r = d->ShowModal ();
-
- if (r != wxID_OK) {
- d->Destroy ();
- return;
- }
-
- wxArrayString paths;
- d->GetPaths (paths);
-
- /* XXX: check for lots of files here and do something */
-
- for (unsigned int i = 0; i < paths.GetCount(); ++i) {
- _film->examine_and_add_content (content_factory (_film, wx_to_std (paths[i])));
- }
-
- d->Destroy ();
-}
-
-void
-FilmEditor::content_add_folder_clicked ()
-{
- wxDirDialog* d = new wxDirDialog (this, _("Choose a folder"), wxT (""), wxDD_DIR_MUST_EXIST);
- int const r = d->ShowModal ();
- d->Destroy ();
-
- if (r != wxID_OK) {
- return;
- }
-
- shared_ptr<Content> content;
-
- try {
- content.reset (new ImageContent (_film, boost::filesystem::path (wx_to_std (d->GetPath ()))));
- } catch (...) {
- try {
- content.reset (new DCPContent (_film, boost::filesystem::path (wx_to_std (d->GetPath ()))));
- } catch (...) {
- error_dialog (this, _("Could not find any images nor a DCP in that folder"));
- return;
- }
- }
-
- if (content) {
- _film->examine_and_add_content (content);
- }
-}
-
-void
-FilmEditor::content_remove_clicked ()
-{
- ContentList c = selected_content ();
- if (c.size() == 1) {
- _film->remove_content (c.front ());
- }
-
- content_selection_changed ();
-}
-
-void
-FilmEditor::content_selection_changed ()
-{
- setup_content_sensitivity ();
-
- for (list<FilmEditorPanel*>::iterator i = _panels.begin(); i != _panels.end(); ++i) {
- (*i)->content_selection_changed ();
- }
-}
-
-/** Set up broad sensitivity based on the type of content that is selected */
-void
-FilmEditor::setup_content_sensitivity ()
-{
- _content_add_file->Enable (_generally_sensitive);
- _content_add_folder->Enable (_generally_sensitive);
-
- ContentList selection = selected_content ();
- VideoContentList video_selection = selected_video_content ();
- AudioContentList audio_selection = selected_audio_content ();
-
- _content_remove->Enable (selection.size() == 1 && _generally_sensitive);
- _content_earlier->Enable (selection.size() == 1 && _generally_sensitive);
- _content_later->Enable (selection.size() == 1 && _generally_sensitive);
- _content_timeline->Enable (!_film->content().empty() && _generally_sensitive);
-
- _video_panel->Enable (video_selection.size() > 0 && _generally_sensitive);
- _audio_panel->Enable (audio_selection.size() > 0 && _generally_sensitive);
- _subtitle_panel->Enable (selection.size() == 1 && dynamic_pointer_cast<SubtitleContent> (selection.front()) && _generally_sensitive);
- _timing_panel->Enable (selection.size() == 1 && _generally_sensitive);
-}
-
-ContentList
-FilmEditor::selected_content ()
-{
- ContentList sel;
- long int s = -1;
- while (true) {
- s = _content->GetNextItem (s, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
- if (s == -1) {
- break;
- }
-
- if (s < int (_film->content().size ())) {
- sel.push_back (_film->content()[s]);
- }
- }
-
- return sel;
-}
-
-VideoContentList
-FilmEditor::selected_video_content ()
-{
- ContentList c = selected_content ();
- VideoContentList vc;
-
- for (ContentList::iterator i = c.begin(); i != c.end(); ++i) {
- shared_ptr<VideoContent> t = dynamic_pointer_cast<VideoContent> (*i);
- if (t) {
- vc.push_back (t);
- }
- }
-
- return vc;
-}
-
-AudioContentList
-FilmEditor::selected_audio_content ()
-{
- ContentList c = selected_content ();
- AudioContentList ac;
-
- for (ContentList::iterator i = c.begin(); i != c.end(); ++i) {
- shared_ptr<AudioContent> t = dynamic_pointer_cast<AudioContent> (*i);
- if (t) {
- ac.push_back (t);
- }
- }
-
- return ac;
-}
-
-SubtitleContentList
-FilmEditor::selected_subtitle_content ()
-{
- ContentList c = selected_content ();
- SubtitleContentList sc;
-
- for (ContentList::iterator i = c.begin(); i != c.end(); ++i) {
- shared_ptr<SubtitleContent> t = dynamic_pointer_cast<SubtitleContent> (*i);
- if (t) {
- sc.push_back (t);
- }
- }
-
- return sc;
-}
-
-FFmpegContentList
-FilmEditor::selected_ffmpeg_content ()
-{
- ContentList c = selected_content ();
- FFmpegContentList sc;
-
- for (ContentList::iterator i = c.begin(); i != c.end(); ++i) {
- shared_ptr<FFmpegContent> t = dynamic_pointer_cast<FFmpegContent> (*i);
- if (t) {
- sc.push_back (t);
- }
- }
-
- return sc;
-}
-
-void
-FilmEditor::content_timeline_clicked ()
-{
- if (_timeline_dialog) {
- _timeline_dialog->Destroy ();
- _timeline_dialog = 0;
- }
-
- _timeline_dialog = new TimelineDialog (this, _film);
- _timeline_dialog->Show ();
-}
-
-void
-FilmEditor::set_selection (weak_ptr<Content> wc)
-{
- ContentList content = _film->content ();
- for (size_t i = 0; i < content.size(); ++i) {
- if (content[i] == wc.lock ()) {
- _content->SetItemState (i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
- } else {
- _content->SetItemState (i, 0, wxLIST_STATE_SELECTED | wxLIST_STATE_FOCUSED);
- }
- }
-}
-
-void
-FilmEditor::sequence_video_changed ()
-{
- if (!_film) {
- return;
- }
-
- _film->set_sequence_video (_sequence_video->GetValue ());
-}
-
-void
-FilmEditor::content_right_click (wxListEvent& ev)
-{
- _menu.popup (_film, selected_content (), ev.GetPoint ());
-}
-
void
FilmEditor::three_d_changed ()
{
_film->set_three_d (_three_d->GetValue ());
}
-void
-FilmEditor::content_earlier_clicked ()
-{
- ContentList sel = selected_content ();
- if (sel.size() == 1) {
- _film->move_content_earlier (sel.front ());
- content_selection_changed ();
- }
-}
-
-void
-FilmEditor::content_later_clicked ()
-{
- ContentList sel = selected_content ();
- if (sel.size() == 1) {
- _film->move_content_later (sel.front ());
- content_selection_changed ();
- }
-}
-
void
FilmEditor::config_changed ()
{
#include <boost/signals2.hpp>
#include "lib/film.h"
#include "content_menu.h"
+#include "content_panel.h"
class wxNotebook;
class wxListCtrl;
FilmEditor (boost::shared_ptr<Film>, wxWindow *);
void set_film (boost::shared_ptr<Film>);
- void set_selection (boost::weak_ptr<Content>);
boost::signals2::signal<void (boost::filesystem::path)> FileChanged;
/* Stuff for panels */
-
- wxNotebook* content_notebook () const {
- return _content_notebook;
- }
+ ContentPanel* content_panel () const {
+ return _content_panel;
+ }
+
boost::shared_ptr<Film> film () const {
return _film;
}
- ContentList selected_content ();
- VideoContentList selected_video_content ();
- AudioContentList selected_audio_content ();
- SubtitleContentList selected_subtitle_content ();
- FFmpegContentList selected_ffmpeg_content ();
-
private:
void make_dcp_panel ();
- void make_content_panel ();
void connect_to_widgets ();
/* Handle changes to the view */
void name_changed ();
void use_isdcf_name_toggled ();
void edit_isdcf_button_clicked ();
- void content_selection_changed ();
- void content_add_file_clicked ();
- void content_add_folder_clicked ();
- void content_remove_clicked ();
- void content_earlier_clicked ();
- void content_later_clicked ();
void container_changed ();
void dcp_content_type_changed ();
void scaler_changed ();
void content_timeline_clicked ();
void audio_channels_changed ();
void resolution_changed ();
- void sequence_video_changed ();
- void content_right_click (wxListEvent &);
void three_d_changed ();
void standard_changed ();
void signed_toggled ();
void set_general_sensitivity (bool);
void setup_dcp_name ();
- void setup_content ();
void setup_container ();
- void setup_content_sensitivity ();
void setup_frame_rate_widget ();
void active_jobs_changed (bool);
void config_changed ();
- FilmEditorPanel* _video_panel;
- FilmEditorPanel* _audio_panel;
- FilmEditorPanel* _subtitle_panel;
- FilmEditorPanel* _timing_panel;
- std::list<FilmEditorPanel *> _panels;
-
wxNotebook* _main_notebook;
- wxNotebook* _content_notebook;
wxPanel* _dcp_panel;
wxSizer* _dcp_sizer;
- wxPanel* _content_panel;
- wxSizer* _content_sizer;
+ ContentPanel* _content_panel;
/** The film we are editing */
boost::shared_ptr<Film> _film;
wxStaticText* _dcp_name;
wxCheckBox* _use_isdcf_name;
wxChoice* _container;
- wxListCtrl* _content;
- wxButton* _content_add_file;
- wxButton* _content_add_folder;
- wxButton* _content_remove;
- wxButton* _content_earlier;
- wxButton* _content_later;
- wxButton* _content_timeline;
- wxCheckBox* _sequence_video;
wxButton* _edit_isdcf_button;
wxChoice* _scaler;
wxSpinCtrl* _j2k_bandwidth;
wxCheckBox* _burn_subtitles;
wxCheckBox* _encrypted;
- ContentMenu _menu;
-
std::vector<Ratio const *> _ratios;
bool _generally_sensitive;
- TimelineDialog* _timeline_dialog;
};
+++ /dev/null
-/*
- Copyright (C) 2012-2013 Carl Hetherington <cth@carlh.net>
-
- This program 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.
-
- This program 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 this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <wx/notebook.h>
-#include "film_editor_panel.h"
-#include "film_editor.h"
-
-using boost::shared_ptr;
-
-FilmEditorPanel::FilmEditorPanel (FilmEditor* e, wxString name)
- : wxPanel (e->content_notebook (), wxID_ANY)
- , _editor (e)
- , _sizer (new wxBoxSizer (wxVERTICAL))
-{
- e->content_notebook()->AddPage (this, name, false);
- SetSizer (_sizer);
-}
-
+++ /dev/null
-/*
- Copyright (C) 2012-2013 Carl Hetherington <cth@carlh.net>
-
- This program 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.
-
- This program 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 this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#ifndef DCPOMATIC_FILM_EDITOR_PANEL_H
-#define DCPOMATIC_FILM_EDITOR_PANEL_H
-
-#include <boost/shared_ptr.hpp>
-#include <wx/wx.h>
-#include "lib/film.h"
-
-class FilmEditor;
-class Content;
-
-class FilmEditorPanel : public wxPanel
-{
-public:
- FilmEditorPanel (FilmEditor *, wxString);
-
- virtual void film_changed (Film::Property) {}
- /** Called when a given property of one of the selected Contents changes */
- virtual void film_content_changed (int) = 0;
- /** Called when the list of selected Contents changes */
- virtual void content_selection_changed () = 0;
-
-protected:
- FilmEditor* _editor;
- wxSizer* _sizer;
-};
-
-#endif
using boost::lexical_cast;
using boost::dynamic_pointer_cast;
-SubtitlePanel::SubtitlePanel (FilmEditor* e)
- : FilmEditorPanel (e, _("Subtitles"))
+SubtitlePanel::SubtitlePanel (ContentPanel* p)
+ : ContentSubPanel (p, _("Subtitles"))
, _view (0)
{
wxFlexGridSizer* grid = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
void
SubtitlePanel::film_content_changed (int property)
{
- FFmpegContentList fc = _editor->selected_ffmpeg_content ();
- SubtitleContentList sc = _editor->selected_subtitle_content ();
+ FFmpegContentList fc = _parent->selected_ffmpeg ();
+ SubtitleContentList sc = _parent->selected_subtitle ();
shared_ptr<FFmpegContent> fcs;
if (fc.size() == 1) {
void
SubtitlePanel::use_toggled ()
{
- SubtitleContentList c = _editor->selected_subtitle_content ();
+ SubtitleContentList c = _parent->selected_subtitle ();
for (SubtitleContentList::iterator i = c.begin(); i != c.end(); ++i) {
(*i)->set_use_subtitles (_use->GetValue());
}
int any_subs = 0;
int ffmpeg_subs = 0;
int subrip_or_dcp_subs = 0;
- SubtitleContentList c = _editor->selected_subtitle_content ();
+ SubtitleContentList c = _parent->selected_subtitle ();
for (SubtitleContentList::const_iterator i = c.begin(); i != c.end(); ++i) {
shared_ptr<const FFmpegContent> fc = boost::dynamic_pointer_cast<const FFmpegContent> (*i);
shared_ptr<const SubRipContent> sc = boost::dynamic_pointer_cast<const SubRipContent> (*i);
void
SubtitlePanel::stream_changed ()
{
- FFmpegContentList fc = _editor->selected_ffmpeg_content ();
+ FFmpegContentList fc = _parent->selected_ffmpeg ();
if (fc.size() != 1) {
return;
}
void
SubtitlePanel::x_offset_changed ()
{
- SubtitleContentList c = _editor->selected_subtitle_content ();
+ SubtitleContentList c = _parent->selected_subtitle ();
for (SubtitleContentList::iterator i = c.begin(); i != c.end(); ++i) {
(*i)->set_subtitle_x_offset (_x_offset->GetValue() / 100.0);
}
void
SubtitlePanel::y_offset_changed ()
{
- SubtitleContentList c = _editor->selected_subtitle_content ();
+ SubtitleContentList c = _parent->selected_subtitle ();
for (SubtitleContentList::iterator i = c.begin(); i != c.end(); ++i) {
(*i)->set_subtitle_y_offset (_y_offset->GetValue() / 100.0);
}
void
SubtitlePanel::scale_changed ()
{
- SubtitleContentList c = _editor->selected_subtitle_content ();
+ SubtitleContentList c = _parent->selected_subtitle ();
for (SubtitleContentList::iterator i = c.begin(); i != c.end(); ++i) {
(*i)->set_subtitle_scale (_scale->GetValue() / 100.0);
}
_view = 0;
}
- SubtitleContentList c = _editor->selected_subtitle_content ();
+ SubtitleContentList c = _parent->selected_subtitle ();
assert (c.size() == 1);
shared_ptr<SubtitleDecoder> decoder;
}
if (decoder) {
- _view = new SubtitleView (this, _editor->film(), decoder, c.front()->position ());
+ _view = new SubtitleView (this, _parent->film(), decoder, c.front()->position ());
_view->Show ();
}
}
*/
-#include "film_editor_panel.h"
+#include "content_sub_panel.h"
class wxCheckBox;
class wxSpinCtrl;
class SubtitleView;
-class SubtitlePanel : public FilmEditorPanel
+class SubtitlePanel : public ContentSubPanel
{
public:
- SubtitlePanel (FilmEditor *);
+ SubtitlePanel (ContentPanel *);
void film_changed (Film::Property);
void film_content_changed (int);
};
-Timeline::Timeline (wxWindow* parent, FilmEditor* ed, shared_ptr<Film> film)
+Timeline::Timeline (wxWindow* parent, ContentPanel* cp, shared_ptr<Film> film)
: wxPanel (parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE)
- , _film_editor (ed)
+ , _content_panel (cp)
, _film (film)
, _time_axis_view (new TimeAxisView (*this, 32))
, _tracks (0)
}
if (view == *i) {
- _film_editor->set_selection (cv->content ());
+ _content_panel->set_selection (cv->content ());
}
}
class Film;
class View;
class ContentView;
-class FilmEditor;
+class ContentPanel;
class TimeAxisView;
class Timeline : public wxPanel
{
public:
- Timeline (wxWindow *, FilmEditor *, boost::shared_ptr<Film>);
+ Timeline (wxWindow *, ContentPanel *, boost::shared_ptr<Film>);
boost::shared_ptr<const Film> film () const;
ContentViewList selected_views () const;
ContentList selected_content () const;
- FilmEditor* _film_editor;
+ ContentPanel* _content_panel;
boost::weak_ptr<Film> _film;
ViewList _views;
boost::shared_ptr<TimeAxisView> _time_axis_view;
using std::cout;
using boost::shared_ptr;
-TimelineDialog::TimelineDialog (FilmEditor* ed, shared_ptr<Film> film)
- : wxDialog (ed, wxID_ANY, _("Timeline"), wxDefaultPosition, wxSize (640, 512), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxFULL_REPAINT_ON_RESIZE)
- , _timeline (this, ed, film)
+TimelineDialog::TimelineDialog (ContentPanel* cp, shared_ptr<Film> film)
+ : wxDialog (cp->panel(), wxID_ANY, _("Timeline"), wxDefaultPosition, wxSize (640, 512), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxFULL_REPAINT_ON_RESIZE)
+ , _timeline (this, cp, film)
{
wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL);
class TimelineDialog : public wxDialog
{
public:
- TimelineDialog (FilmEditor *, boost::shared_ptr<Film>);
+ TimelineDialog (ContentPanel *, boost::shared_ptr<Film>);
private:
void snap_toggled ();
using boost::dynamic_pointer_cast;
using dcp::raw_convert;
-TimingPanel::TimingPanel (FilmEditor* e)
+TimingPanel::TimingPanel (ContentPanel* p)
/* horrid hack for apparent lack of context support with wxWidgets i18n code */
- : FilmEditorPanel (e, S_("Timing|Timing"))
+ : ContentSubPanel (p, S_("Timing|Timing"))
{
wxFlexGridSizer* grid = new wxFlexGridSizer (2, 4, 4);
_sizer->Add (grid, 0, wxALL, 8);
void
TimingPanel::film_content_changed (int property)
{
- ContentList cl = _editor->selected_content ();
+ ContentList cl = _parent->selected ();
shared_ptr<Content> content;
if (cl.size() == 1) {
content = cl.front ();
}
- int const film_video_frame_rate = _editor->film()->video_frame_rate ();
+ int const film_video_frame_rate = _parent->film()->video_frame_rate ();
if (property == ContentProperty::POSITION) {
if (content) {
void
TimingPanel::position_changed ()
{
- ContentList c = _editor->selected_content ();
+ ContentList c = _parent->selected ();
if (c.size() == 1) {
- c.front()->set_position (_position->get (_editor->film()->video_frame_rate ()));
+ c.front()->set_position (_position->get (_parent->film()->video_frame_rate ()));
}
}
void
TimingPanel::full_length_changed ()
{
- ContentList c = _editor->selected_content ();
+ ContentList c = _parent->selected ();
if (c.size() == 1) {
shared_ptr<ImageContent> ic = dynamic_pointer_cast<ImageContent> (c.front ());
if (ic && ic->still ()) {
/* XXX: No effective FRC here... is this right? */
- ic->set_video_length (ContentTime (_full_length->get (_editor->film()->video_frame_rate()), FrameRateChange (1, 1)));
+ ic->set_video_length (ContentTime (_full_length->get (_parent->film()->video_frame_rate()), FrameRateChange (1, 1)));
}
}
}
void
TimingPanel::trim_start_changed ()
{
- ContentList c = _editor->selected_content ();
+ ContentList c = _parent->selected ();
if (c.size() == 1) {
- c.front()->set_trim_start (_trim_start->get (_editor->film()->video_frame_rate ()));
+ c.front()->set_trim_start (_trim_start->get (_parent->film()->video_frame_rate ()));
}
}
void
TimingPanel::trim_end_changed ()
{
- ContentList c = _editor->selected_content ();
+ ContentList c = _parent->selected ();
if (c.size() == 1) {
- c.front()->set_trim_end (_trim_end->get (_editor->film()->video_frame_rate ()));
+ c.front()->set_trim_end (_trim_end->get (_parent->film()->video_frame_rate ()));
}
}
void
TimingPanel::play_length_changed ()
{
- ContentList c = _editor->selected_content ();
+ ContentList c = _parent->selected ();
if (c.size() == 1) {
- c.front()->set_trim_end (c.front()->full_length() - _play_length->get (_editor->film()->video_frame_rate()) - c.front()->trim_start());
+ c.front()->set_trim_end (c.front()->full_length() - _play_length->get (_parent->film()->video_frame_rate()) - c.front()->trim_start());
}
}
void
TimingPanel::set_video_frame_rate ()
{
- ContentList c = _editor->selected_content ();
+ ContentList c = _parent->selected ();
if (c.size() == 1) {
shared_ptr<VideoContent> vc = dynamic_pointer_cast<VideoContent> (c.front ());
if (vc) {
void
TimingPanel::content_selection_changed ()
{
- ContentList sel = _editor->selected_content ();
+ ContentList sel = _parent->selected ();
bool const single = sel.size() == 1;
/* Things that are only allowed with single selections */
*/
-#include "film_editor_panel.h"
+#include "content_sub_panel.h"
class Timecode;
-class TimingPanel : public FilmEditorPanel
+class TimingPanel : public ContentSubPanel
{
public:
- TimingPanel (FilmEditor *);
+ TimingPanel (ContentPanel *);
void film_content_changed (int);
void content_selection_changed ();
assert (false);
}
-VideoPanel::VideoPanel (FilmEditor* e)
- : FilmEditorPanel (e, _("Video"))
+VideoPanel::VideoPanel (ContentPanel* p)
+ : ContentSubPanel (p, _("Video"))
{
wxGridBagSizer* grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
_sizer->Add (grid, 0, wxALL, 8);
void
VideoPanel::film_content_changed (int property)
{
- VideoContentList vc = _editor->selected_video_content ();
+ VideoContentList vc = _parent->selected_video ();
shared_ptr<VideoContent> vcs;
shared_ptr<FFmpegContent> fcs;
if (!vc.empty ()) {
void
VideoPanel::edit_filters_clicked ()
{
- FFmpegContentList c = _editor->selected_ffmpeg_content ();
+ FFmpegContentList c = _parent->selected_ffmpeg ();
if (c.size() != 1) {
return;
}
void
VideoPanel::setup_description ()
{
- VideoContentList vc = _editor->selected_video_content ();
+ VideoContentList vc = _parent->selected_video ();
if (vc.empty ()) {
_description->SetLabel ("");
return;
++lines;
}
- dcp::Size const container_size = _editor->film()->frame_size ();
+ dcp::Size const container_size = _parent->film()->frame_size ();
dcp::Size const scaled = vcs->scale().size (vcs, container_size, container_size);
if (scaled != vcs->video_size_after_crop ()) {
d << wxString::Format (_("Content frame rate %.4f\n"), vcs->video_frame_rate ());
++lines;
- FrameRateChange frc (vcs->video_frame_rate(), _editor->film()->video_frame_rate ());
+ FrameRateChange frc (vcs->video_frame_rate(), _parent->film()->video_frame_rate ());
d << std_to_wx (frc.description) << "\n";
++lines;
void
VideoPanel::edit_colour_conversion_clicked ()
{
- VideoContentList vc = _editor->selected_video_content ();
+ VideoContentList vc = _parent->selected_video ();
if (vc.size() != 1) {
return;
}
void
VideoPanel::content_selection_changed ()
{
- VideoContentList sel = _editor->selected_video_content ();
+ VideoContentList sel = _parent->selected_video ();
bool const single = sel.size() == 1;
_left_crop->set_content (sel);
*/
#include "lib/film.h"
-#include "film_editor_panel.h"
+#include "content_sub_panel.h"
#include "content_widget.h"
class wxChoice;
/** @class VideoPanel
* @brief The video tab of the film editor.
*/
-class VideoPanel : public FilmEditorPanel
+class VideoPanel : public ContentSubPanel
{
public:
- VideoPanel (FilmEditor *);
+ VideoPanel (ContentPanel *);
void film_changed (Film::Property);
void film_content_changed (int);
config_dialog.cc
content_colour_conversion_dialog.cc
content_menu.cc
+ content_panel.cc
+ content_sub_panel.cc
isdcf_metadata_dialog.cc
dir_picker_ctrl.cc
dolby_certificate_dialog.cc
doremi_certificate_dialog.cc
download_certificate_dialog.cc
film_editor.cc
- film_editor_panel.cc
film_viewer.cc
filter_dialog.cc
filter_editor.cc