2 Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 /** @file src/film_editor.cc
21 * @brief A wx widget to edit a film's metadata, and perform various functions.
25 #include "lib/job_manager.h"
26 #include "lib/content.h"
27 #include "lib/dcp_content.h"
29 #include "film_editor.h"
30 #include "dcp_panel.h"
31 #include "content_panel.h"
33 #include <wx/notebook.h>
37 using boost::shared_ptr;
39 /** @param f Film to edit */
40 FilmEditor::FilmEditor (wxWindow* parent)
43 wxBoxSizer* s = new wxBoxSizer (wxVERTICAL);
45 _main_notebook = new wxNotebook (this, wxID_ANY);
46 s->Add (_main_notebook, 1);
48 _content_panel = new ContentPanel (_main_notebook, _film);
49 _main_notebook->AddPage (_content_panel->panel (), _("Content"), true);
50 _dcp_panel = new DCPPanel (_main_notebook, _film);
51 _main_notebook->AddPage (_dcp_panel->panel (), _("DCP"), false);
53 JobManager::instance()->ActiveJobsChanged.connect (
54 bind (&FilmEditor::active_jobs_changed, this, _1)
57 set_film (shared_ptr<Film> ());
62 /** Called when the metadata stored in the Film object has changed;
63 * so that we can update the GUI.
64 * @param p Property of the Film that has changed.
67 FilmEditor::film_changed (Film::Property p)
75 _content_panel->film_changed (p);
76 _dcp_panel->film_changed (p);
80 FilmEditor::film_content_changed (int property)
85 /* We call this method ourselves (as well as using it as a signal handler)
91 _content_panel->film_content_changed (property);
92 _dcp_panel->film_content_changed (property);
95 /** Sets the Film that we are editing */
97 FilmEditor::set_film (shared_ptr<Film> f)
99 set_general_sensitivity (f != 0);
107 _content_panel->set_film (_film);
108 _dcp_panel->set_film (_film);
111 _film->Changed.connect (bind (&FilmEditor::film_changed, this, _1));
112 _film->ContentChanged.connect (bind (&FilmEditor::film_content_changed, this, _2));
116 FileChanged (_film->directory ());
121 if (!_film->content().empty ()) {
122 _content_panel->set_selection (_film->content().front ());
127 FilmEditor::set_general_sensitivity (bool s)
129 _content_panel->set_general_sensitivity (s);
130 _dcp_panel->set_general_sensitivity (s);
134 FilmEditor::active_jobs_changed (bool a)
136 set_general_sensitivity (!a);