ID_file_duplicate_and_open,
ID_file_history,
/* Allow spare IDs after _history for the recent files list */
- ID_edit_copy = 100,
+ ID_file_close = 100,
+ ID_edit_copy,
ID_edit_paste,
ID_content_scale_to_fit_width,
ID_content_scale_to_fit_height,
Bind (wxEVT_MENU, boost::bind (&DOMFrame::file_save_as_template, this), ID_file_save_as_template);
Bind (wxEVT_MENU, boost::bind (&DOMFrame::file_duplicate, this), ID_file_duplicate);
Bind (wxEVT_MENU, boost::bind (&DOMFrame::file_duplicate_and_open, this), ID_file_duplicate_and_open);
+ Bind (wxEVT_MENU, boost::bind (&DOMFrame::file_close, this), ID_file_close);
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);
accel[4].Set (wxACCEL_NORMAL, WXK_LEFT, ID_back_frame);
accel[5].Set (wxACCEL_NORMAL, WXK_RIGHT, ID_forward_frame);
#ifdef __WXOSX__
- accel[6].Set (wxACCEL_CTRL, static_cast<int>('W'), wxID_EXIT);
+ accel[6].Set (wxACCEL_CTRL, static_cast<int>('W'), ID_file_close);
#endif
Bind (wxEVT_MENU, boost::bind (&ContentPanel::add_file_clicked, _film_editor->content_panel()), ID_add_file);
Bind (wxEVT_MENU, boost::bind (&DOMFrame::remove_clicked, this, _1), ID_remove);
_video_waveform_dialog = 0;
}
set_menu_sensitivity ();
- if (_film->directory()) {
+ if (_film && _film->directory()) {
Config::instance()->add_to_history (_film->directory().get());
}
- _film->Change.connect (boost::bind (&DOMFrame::film_change, this, _1));
+ if (_film) {
+ _film->Change.connect (boost::bind (&DOMFrame::film_change, this, _1));
+ }
}
shared_ptr<Film> film () const {
d->Destroy ();
}
+ void file_close ()
+ {
+ set_film (shared_ptr<Film>());
+ }
+
void file_history (wxCommandEvent& event)
{
vector<boost::filesystem::path> history = Config::instance()->history ();
_history_position = _file_menu->GetMenuItems().GetCount();
+ _file_menu->AppendSeparator ();
+ add_item (_file_menu, _("&Close"), ID_file_close, NEEDS_FILM);
+
#ifndef __WXOSX__
_file_menu->AppendSeparator ();
#endif
_film = film;
+ if (!_film) {
+ /* Really should all the film_changed below but this might be enough */
+ checked_set (_dcp_name, wxT(""));
+ set_general_sensitivity (false);
+ return;
+ }
+
film_changed (Film::NAME);
film_changed (Film::USE_ISDCF_NAME);
film_changed (Film::CONTENT);
_resolution->Enable (_generally_sensitive && _film && !_film->references_dcp_video());
_three_d->Enable (_generally_sensitive && _film && !_film->references_dcp_video());
_standard->Enable (_generally_sensitive && _film && !_film->references_dcp_video() && !_film->references_dcp_audio());
+ _reencode_j2k->Enable (_generally_sensitive && _film);
+ _show_audio->Enable (_generally_sensitive && _film);
}
void
_content_panel->set_film (_film);
_dcp_panel->set_film (_film);
- if (_film) {
- _film->Change.connect (bind (&FilmEditor::film_change, this, _1, _2));
- _film->ContentChange.connect (bind (&FilmEditor::film_content_change, this, _1, _3));
+ if (!_film) {
+ FileChanged ("");
+ return;
}
- if (_film && _film->directory()) {
+ _film->Change.connect (bind (&FilmEditor::film_change, this, _1, _2));
+ _film->ContentChange.connect (bind (&FilmEditor::film_content_change, this, _1, _3));
+
+ if (_film->directory()) {
FileChanged (_film->directory().get());
} else {
FileChanged ("");
}
- if (!_film->content().empty ()) {
+ if (!_film->content().empty()) {
_content_panel->set_selection (_film->content().front ());
}
}