/*
- Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
using std::make_pair;
using std::list;
using std::exception;
+using std::make_shared;
using std::shared_ptr;
using std::dynamic_pointer_cast;
using boost::optional;
}
#endif
- wxMenuBar* bar = new wxMenuBar;
+ auto bar = new wxMenuBar;
setup_menu (bar);
SetMenuBar (bar);
_film_viewer.reset (new FilmViewer (overall_panel));
_controls = new StandardControls (overall_panel, _film_viewer, true);
_film_editor = new FilmEditor (overall_panel, _film_viewer);
- JobManagerView* job_manager_view = new JobManagerView (overall_panel, false);
+ auto job_manager_view = new JobManagerView (overall_panel, false);
- wxBoxSizer* right_sizer = new wxBoxSizer (wxVERTICAL);
+ auto right_sizer = new wxBoxSizer (wxVERTICAL);
right_sizer->Add (_film_viewer->panel(), 2, wxEXPAND | wxALL, 6);
right_sizer->Add (_controls, 0, wxEXPAND | wxALL, 6);
right_sizer->Add (job_manager_view, 1, wxEXPAND | wxALL, 6);
void new_film (boost::filesystem::path path, optional<string> template_name)
{
- shared_ptr<Film> film (new Film (path));
+ auto film = make_shared<Film>(path);
if (template_name) {
film->use_template (template_name.get());
}
void load_film (boost::filesystem::path file)
try
{
- shared_ptr<Film> film (new Film (file));
- list<string> const notes = film->read_metadata ();
+ auto film = make_shared<Film>(file);
+ auto const notes = film->read_metadata ();
if (film->state_version() == 4) {
error_dialog (
JobManager::instance()->add(shared_ptr<Job>(new CheckContentChangeJob(film)));
}
catch (FileNotFoundError& e) {
- boost::filesystem::path const dir = e.file().parent_path();
+ auto const dir = e.file().parent_path();
if (boost::filesystem::exists(dir / "ASSETMAP") || boost::filesystem::exists(dir / "ASSETMAP.xml")) {
error_dialog (
this, _("Could not open this folder as a DCP-o-matic project."),
_("It looks like you are trying to open a DCP. File -> Open is for loading DCP-o-matic projects, not DCPs. To import a DCP, create a new project with File -> New and then click the \"Add DCP...\" button.")
);
} else {
- wxString const p = std_to_wx(file.string ());
+ auto const p = std_to_wx(file.string ());
error_dialog (this, wxString::Format(_("Could not open film at %s"), p.data()), std_to_wx(e.what()));
}
} catch (std::exception& e) {
- wxString const p = std_to_wx (file.string());
+ auto const p = std_to_wx (file.string());
error_dialog (this, wxString::Format(_("Could not open film at %s"), p.data()), std_to_wx(e.what()));
}
void file_changed (boost::filesystem::path f)
{
- string s = wx_to_std (_("DCP-o-matic"));
+ auto s = wx_to_std(_("DCP-o-matic"));
if (!f.empty ()) {
s += " - " + f.string ();
}
void file_new ()
{
- FilmNameLocationDialog* d = new FilmNameLocationDialog (this, _("New Film"), true);
+ auto d = new FilmNameLocationDialog (this, _("New Film"), true);
int const r = d->ShowModal ();
if (r == wxID_OK && d->check_path() && maybe_save_then_delete_film<FilmChangedClosingDialog>()) {
void file_open ()
{
- wxDirDialog* c = new wxDirDialog (
+ auto c = new wxDirDialog (
this,
_("Select film to open"),
std_to_wx (Config::instance()->default_directory_or (wx_to_std (wxStandardPaths::Get().GetDocumentsDir())).string ()),
void file_save_as_template ()
{
- SaveTemplateDialog* d = new SaveTemplateDialog (this);
+ auto d = new SaveTemplateDialog (this);
int const r = d->ShowModal ();
if (r == wxID_OK) {
Config::instance()->save_template (_film, d->name ());
void file_duplicate ()
{
- FilmNameLocationDialog* d = new FilmNameLocationDialog (this, _("Duplicate Film"), false);
+ auto d = new FilmNameLocationDialog (this, _("Duplicate Film"), false);
int const r = d->ShowModal ();
if (r == wxID_OK && d->check_path() && maybe_save_film<FilmChangedDuplicatingDialog>()) {
void file_duplicate_and_open ()
{
- FilmNameLocationDialog* d = new FilmNameLocationDialog (this, _("Duplicate Film"), false);
+ auto d = new FilmNameLocationDialog (this, _("Duplicate Film"), false);
int const r = d->ShowModal ();
if (r == wxID_OK && d->check_path() && maybe_save_film<FilmChangedDuplicatingDialog>()) {
{
if (_film && _film->dirty ()) {
- FilmChangedClosingDialog* dialog = new FilmChangedClosingDialog (_film->name ());
+ auto dialog = new FilmChangedClosingDialog (_film->name ());
int const r = dialog->run ();
delete dialog;
void file_history (wxCommandEvent& event)
{
- vector<boost::filesystem::path> history = Config::instance()->history ();
+ auto history = Config::instance()->history ();
int n = event.GetId() - ID_file_history;
if (n >= 0 && n < static_cast<int> (history.size ()) && maybe_save_then_delete_film<FilmChangedClosingDialog>()) {
load_film (history[n]);
void edit_copy ()
{
- ContentList const sel = _film_editor->content_panel()->selected();
+ auto const sel = _film_editor->content_panel()->selected();
DCPOMATIC_ASSERT (sel.size() == 1);
_clipboard = sel.front()->clone();
}
{
DCPOMATIC_ASSERT (_clipboard);
- PasteDialog* d = new PasteDialog (this, static_cast<bool>(_clipboard->video), static_cast<bool>(_clipboard->audio), !_clipboard->text.empty());
+ auto d = new PasteDialog (this, static_cast<bool>(_clipboard->video), static_cast<bool>(_clipboard->audio), !_clipboard->text.empty());
if (d->ShowModal() == wxID_OK) {
for (auto i: _film_editor->content_panel()->selected()) {
if (d->video() && i->video) {
}
if (d->text()) {
- list<shared_ptr<TextContent> >::iterator j = i->text.begin ();
- list<shared_ptr<TextContent> >::const_iterator k = _clipboard->text.begin ();
+ auto j = i->text.begin ();
+ auto k = _clipboard->text.begin ();
while (j != i->text.end() && k != _clipboard->text.end()) {
(*j)->take_settings_from (*k);
++j;
void tools_restore_default_preferences ()
{
- wxMessageDialog* d = new wxMessageDialog (
+ auto d = new wxMessageDialog (
0,
_("Are you sure you want to restore preferences to their defaults? This cannot be undone."),
_("Restore default preferences"),
}
if (Config::instance()->show_hints_before_make_dcp()) {
- HintsDialog* hints = new HintsDialog (this, _film, false);
+ auto hints = new HintsDialog (this, _film, false);
int const r = hints->ShowModal();
hints->Destroy ();
if (r == wxID_CANCEL) {
}
if (Config::instance()->show_hints_before_make_dcp()) {
- HintsDialog* hints = new HintsDialog (this, _film, false);
+ auto hints = new HintsDialog (this, _film, false);
int const r = hints->ShowModal();
hints->Destroy ();
if (r == wxID_CANCEL) {
return;
}
- SelfDKDMDialog* d = new SelfDKDMDialog (this, _film);
+ auto d = new SelfDKDMDialog (this, _film);
if (d->ShowModal () != wxID_OK) {
d->Destroy ();
return;
if (kdm) {
if (d->internal ()) {
- shared_ptr<DKDMGroup> dkdms = Config::instance()->dkdms ();
+ auto dkdms = Config::instance()->dkdms();
dkdms->add (shared_ptr<DKDM> (new DKDM (kdm.get())));
Config::instance()->changed ();
} else {
- boost::filesystem::path path = d->directory() / (_film->dcp_name(false) + "_DKDM.xml");
+ auto path = d->directory() / (_film->dcp_name(false) + "_DKDM.xml");
kdm->as_xml (path);
}
}
void jobs_export_video_file ()
{
- ExportVideoFileDialog* d = new ExportVideoFileDialog (this, _film->isdcf_name(true));
+ auto d = new ExportVideoFileDialog (this, _film->isdcf_name(true));
if (d->ShowModal() == wxID_OK) {
if (boost::filesystem::exists(d->path())) {
bool ok = confirm_dialog(
}
}
- shared_ptr<TranscodeJob> job (new TranscodeJob (_film));
+ auto job = make_shared<TranscodeJob>(_film);
job->set_encoder (
- shared_ptr<FFmpegEncoder> (
- new FFmpegEncoder (_film, job, d->path(), d->format(), d->mixdown_to_stereo(), d->split_reels(), d->split_streams(), d->x264_crf())
- )
+ make_shared<FFmpegEncoder> (
+ _film, job, d->path(), d->format(), d->mixdown_to_stereo(), d->split_reels(), d->split_streams(), d->x264_crf())
);
JobManager::instance()->add (job);
}
void jobs_export_subtitles ()
{
- ExportSubtitlesDialog* d = new ExportSubtitlesDialog (this, _film->reels().size(), _film->interop());
+ auto d = new ExportSubtitlesDialog (this, _film->reels().size(), _film->interop());
if (d->ShowModal() == wxID_OK) {
- shared_ptr<TranscodeJob> job (new TranscodeJob (_film));
+ auto job = make_shared<TranscodeJob>(_film);
job->set_encoder (
- shared_ptr<SubtitleEncoder>(new SubtitleEncoder(_film, job, d->path(), _film->isdcf_name(true), d->split_reels(), d->include_font()))
+ make_shared<SubtitleEncoder>(_film, job, d->path(), _film->isdcf_name(true), d->split_reels(), d->include_font())
);
JobManager::instance()->add (job);
}
void tools_send_translations ()
{
- SendI18NDialog* d = new SendI18NDialog (this);
+ auto d = new SendI18NDialog (this);
if (d->ShowModal() == wxID_OK) {
string body;
body += d->name() + "\n";
body += d->language() + "\n";
body += string(dcpomatic_version) + " " + string(dcpomatic_git_commit) + "\n";
body += "--\n";
- map<string, string> translations = I18NHook::translations ();
- for (map<string, string>::const_iterator i = translations.begin(); i != translations.end(); ++i) {
- body += i->first + "\n" + i->second + "\n\n";
+ auto translations = I18NHook::translations ();
+ for (auto i: translations) {
+ body += i.first + "\n" + i.second + "\n\n";
}
- list<string> to;
- to.push_back ("carl@dcpomatic.com");
+ list<string> to = { "carl@dcpomatic.com" };
Emailer emailer (d->email(), to, "DCP-o-matic translations", body);
emailer.send ("main.carlh.net", 2525, EMAIL_PROTOCOL_STARTTLS);
}
void help_about ()
{
- AboutDialog* d = new AboutDialog (this);
+ auto d = new AboutDialog (this);
d->ShowModal ();
d->Destroy ();
}
void help_report_a_problem ()
{
- ReportProblemDialog* d = new ReportProblemDialog (this, _film);
+ auto d = new ReportProblemDialog (this, _film);
if (d->ShowModal () == wxID_OK) {
d->report ();
}
return true;
}
- wxMessageDialog* d = new wxMessageDialog (
+ auto d = new wxMessageDialog (
0,
_("There are unfinished jobs; are you sure you want to quit?"),
_("Unfinished jobs"),
if (_film && _film->dirty ()) {
- FilmChangedClosingDialog* dialog = new FilmChangedClosingDialog (_film->name ());
+ auto dialog = new FilmChangedClosingDialog (_film->name ());
int const r = dialog->run ();
delete dialog;
void set_menu_sensitivity ()
{
- list<shared_ptr<Job> > jobs = JobManager::instance()->get ();
- list<shared_ptr<Job> >::iterator i = jobs.begin();
+ auto jobs = JobManager::instance()->get ();
+ auto i = jobs.begin();
while (i != jobs.end() && (*i)->json_name() != "transcode") {
++i;
}
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) {
+ for (auto j: menu_items) {
bool enabled = true;
- if ((j->second & NEEDS_FILM) && !_film) {
+ if ((j.second & NEEDS_FILM) && !_film) {
enabled = false;
}
- if ((j->second & NOT_DURING_DCP_CREATION) && dcp_creation) {
+ if ((j.second & NOT_DURING_DCP_CREATION) && dcp_creation) {
enabled = false;
}
- if ((j->second & NEEDS_CPL) && !have_cpl) {
+ if ((j.second & NEEDS_CPL) && !have_cpl) {
enabled = false;
}
- if ((j->second & NEEDS_SELECTED_CONTENT) && !have_selected_content) {
+ if ((j.second & NEEDS_SELECTED_CONTENT) && !have_selected_content) {
enabled = false;
}
- if ((j->second & NEEDS_SINGLE_SELECTED_CONTENT) && !have_single_selected_content) {
+ if ((j.second & NEEDS_SINGLE_SELECTED_CONTENT) && !have_single_selected_content) {
enabled = false;
}
- if ((j->second & NEEDS_SELECTED_VIDEO_CONTENT) && !have_selected_video_content) {
+ if ((j.second & NEEDS_SELECTED_VIDEO_CONTENT) && !have_selected_video_content) {
enabled = false;
}
- if ((j->second & NEEDS_CLIPBOARD) && !_clipboard) {
+ if ((j.second & NEEDS_CLIPBOARD) && !_clipboard) {
enabled = false;
}
- if ((j->second & NEEDS_ENCRYPTION) && (!_film || !_film->encrypted())) {
+ if ((j.second & NEEDS_ENCRYPTION) && (!_film || !_film->encrypted())) {
enabled = false;
}
- j->first->Enable (enabled);
+ j.first->Enable (enabled);
}
}
void add_item (wxMenu* menu, wxString text, int id, int sens)
{
- wxMenuItem* item = menu->Append (id, text);
+ auto item = menu->Append (id, text);
menu_items.insert (make_pair (item, sens));
}
/* Clear out non-existant history items before we re-build the menu */
Config::instance()->clean_history ();
- vector<boost::filesystem::path> history = Config::instance()->history ();
+ auto history = Config::instance()->history();
if (!history.empty ()) {
_history_separator = _file_menu->InsertSeparator (pos++);
void update_checker_state_changed ()
{
- UpdateChecker* uc = UpdateChecker::instance ();
+ auto uc = UpdateChecker::instance ();
bool const announce =
_update_news_requested ||
}
if (uc->state() == UpdateChecker::YES) {
- UpdateDialog* dialog = new UpdateDialog (this, uc->stable (), uc->test ());
+ auto dialog = new UpdateDialog (this, uc->stable(), uc->test());
dialog->ShowModal ();
dialog->Destroy ();
} else if (uc->state() == UpdateChecker::FAILED) {
void analytics_message (string title, string html)
{
- HTMLDialog* d = new HTMLDialog(this, std_to_wx(title), std_to_wx(html));
+ auto d = new HTMLDialog(this, std_to_wx(title), std_to_wx(html));
d->ShowModal();
d->Destroy();
}
{
if (_splash) {
_splash->Destroy ();
- _splash = 0;
+ _splash = nullptr;
}
- error_dialog (0, wxString::Format ("DCP-o-matic could not start."), std_to_wx(e.what()));
+ error_dialog (nullptr, wxString::Format ("DCP-o-matic could not start."), std_to_wx(e.what()));
}
return true;
);
} catch (exception& e) {
error_dialog (
- 0,
+ nullptr,
wxString::Format (
_("An exception occurred: %s.\n\n") + REPORT_PROBLEM,
std_to_wx (e.what ())
when we open our recreate dialog, close it, *then* try to Destroy the splash (the Destroy fails).
*/
_splash->Destroy ();
- _splash = 0;
+ _splash = nullptr;
- Config* config = Config::instance();
+ auto config = Config::instance();
switch (reason) {
case Config::BAD_SIGNER_UTF8_STRINGS:
{
if (config->nagged(Config::NAG_BAD_SIGNER_CHAIN)) {
return false;
}
- RecreateChainDialog* d = new RecreateChainDialog (
+ auto d = new RecreateChainDialog (
_frame, _("Recreate signing certificates"),
_("The certificate chain that DCP-o-matic uses for signing DCPs and KDMs contains a small error\n"
"which will prevent DCPs from being validated correctly on some systems. Do you want to re-create\n"
}
case Config::BAD_SIGNER_INCONSISTENT:
{
- RecreateChainDialog* d = new RecreateChainDialog (
+ auto d = new RecreateChainDialog (
_frame, _("Recreate signing certificates"),
_("The certificate chain that DCP-o-matic uses for signing DCPs and KDMs is inconsistent and\n"
"cannot be used. DCP-o-matic cannot start unless you re-create it. Do you want to re-create\n"
}
case Config::BAD_DECRYPTION_INCONSISTENT:
{
- RecreateChainDialog* d = new RecreateChainDialog (
+ auto d = new RecreateChainDialog (
_frame, _("Recreate KDM decryption chain"),
_("The certificate chain that DCP-o-matic uses for decrypting KDMs is inconsistent and\n"
"cannot be used. DCP-o-matic cannot start unless you re-create it. Do you want to re-create\n"
_menu = new ContentMenu (_splitter);
{
- wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+ auto s = new wxBoxSizer (wxHORIZONTAL);
_content = new wxListCtrl (_top_panel, wxID_ANY, wxDefaultPosition, wxSize (320, 160), wxLC_REPORT | wxLC_NO_HEADER);
_content->DragAcceptFiles (true);
_content->InsertColumn (0, wxT(""));
_content->SetColumnWidth (0, 512);
- wxBoxSizer* b = new wxBoxSizer (wxVERTICAL);
+ auto b = new wxBoxSizer (wxVERTICAL);
_add_file = new Button (_top_panel, _("Add file(s)..."));
_add_file->SetToolTip (_("Add video, image, sound or subtitle files to the film."));
break;
}
- ContentList cl = _film->content();
+ auto cl = _film->content();
if (s < int (cl.size())) {
sel.push_back (cl[s]);
}
FFmpegContentList sc;
for (auto i: selected()) {
- shared_ptr<FFmpegContent> t = dynamic_pointer_cast<FFmpegContent> (i);
+ auto t = dynamic_pointer_cast<FFmpegContent> (i);
if (t) {
sc.push_back (t);
}
}
if (go_to && Config::instance()->jump_to_selected() && signal_manager) {
- shared_ptr<FilmViewer> fv = _film_viewer.lock ();
+ auto fv = _film_viewer.lock ();
DCPOMATIC_ASSERT (fv);
signal_manager->when_idle(boost::bind(&FilmViewer::seek, fv.get(), go_to.get().ceil(_film->video_frame_rate()), true));
}
/* Set up the tab selection */
- bool done = false;
+ auto done = false;
for (size_t i = 0; i < _notebook->GetPageCount(); ++i) {
if (_notebook->GetPage(i) == _last_selected_tab) {
_notebook->SetSelection (i);
/* 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 (
+ auto d = new wxFileDialog (
_splitter,
_("Choose a file or files"),
wxT (""),
void
ContentPanel::add_folder_clicked ()
{
- wxDirDialog* d = new wxDirDialog (_splitter, _("Choose a folder"), wxT(""), wxDD_DIR_MUST_EXIST);
+ auto d = new wxDirDialog (_splitter, _("Choose a folder"), wxT(""), wxDD_DIR_MUST_EXIST);
int r = d->ShowModal ();
boost::filesystem::path const path (wx_to_std (d->GetPath ()));
d->Destroy ();
}
for (auto i: content) {
- shared_ptr<ImageContent> ic = dynamic_pointer_cast<ImageContent> (i);
+ auto ic = dynamic_pointer_cast<ImageContent> (i);
if (ic) {
- ImageSequenceDialog* e = new ImageSequenceDialog (_splitter);
+ auto e = new ImageSequenceDialog (_splitter);
r = e->ShowModal ();
- float const frame_rate = e->frame_rate ();
+ auto const frame_rate = e->frame_rate ();
e->Destroy ();
if (r != wxID_OK) {
void
ContentPanel::add_dcp_clicked ()
{
- wxDirDialog* d = new wxDirDialog (_splitter, _("Choose a DCP folder"), wxT(""), wxDD_DIR_MUST_EXIST);
+ auto d = new wxDirDialog (_splitter, _("Choose a DCP folder"), wxT(""), wxDD_DIR_MUST_EXIST);
int r = d->ShowModal ();
boost::filesystem::path const path (wx_to_std (d->GetPath ()));
d->Destroy ();
if (_timeline_dialog) {
_timeline_dialog->Destroy ();
- _timeline_dialog = 0;
+ _timeline_dialog = nullptr;
}
_timeline_dialog = new TimelineDialog (this, _film, _film_viewer);
_add_folder->Enable (_generally_sensitive);
_add_dcp->Enable (_generally_sensitive);
- ContentList selection = selected ();
- ContentList video_selection = selected_video ();
- ContentList audio_selection = selected_audio ();
+ auto selection = selected ();
+ auto video_selection = selected_video ();
+ auto audio_selection = selected_audio ();
_remove->Enable (_generally_sensitive && !selection.empty());
_earlier->Enable (_generally_sensitive && selection.size() == 1);
void
ContentPanel::earlier_clicked ()
{
- ContentList sel = selected ();
+ auto sel = selected ();
if (sel.size() == 1) {
_film->move_content_earlier (sel.front ());
check_selection ();
void
ContentPanel::later_clicked ()
{
- ContentList sel = selected ();
+ auto sel = selected ();
if (sel.size() == 1) {
_film->move_content_later (sel.front ());
check_selection ();
void
ContentPanel::set_selection (weak_ptr<Content> wc)
{
- ContentList content = _film->content ();
+ auto 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);
{
_no_check_selection = true;
- ContentList content = _film->content ();
+ auto content = _film->content ();
for (size_t i = 0; i < content.size(); ++i) {
if (find(cl.begin(), cl.end(), content[i]) != cl.end()) {
_content->SetItemState (i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
return;
}
- ContentList content = _film->content ();
+ auto content = _film->content ();
- Content* selected_content = 0;
- int const s = _content->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
+ Content* selected_content = nullptr;
+ auto const s = _content->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
if (s != -1) {
wxListItem item;
item.SetId (s);
int const t = _content->GetItemCount ();
bool const valid = i->paths_valid ();
- shared_ptr<DCPContent> dcp = dynamic_pointer_cast<DCPContent> (i);
+ auto dcp = dynamic_pointer_cast<DCPContent> (i);
bool const needs_kdm = dcp && dcp->needs_kdm ();
bool const needs_assets = dcp && dcp->needs_assets ();
- wxString s = std_to_wx (i->summary ());
+ auto s = std_to_wx (i->summary ());
if (!valid) {
s = _("MISSING: ") + s;
return;
}
- wxString* paths = event.GetFiles ();
+ auto paths = event.GetFiles ();
list<boost::filesystem::path> path_list;
for (int i = 0; i < event.GetNumberOfFiles(); i++) {
path_list.push_back (wx_to_std (paths[i]));
/*
- 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.
_encrypted = new CheckBox (_panel, _("Encrypted"));
wxClientDC dc (_panel);
- wxSize size = dc.GetTextExtent (wxT ("GGGGGGGG..."));
+ auto size = dc.GetTextExtent (wxT ("GGGGGGGG..."));
size.SetHeight (-1);
_reels_label = create_label (_panel, _("Reels"), true);
_grid->Add (_standard, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
++r;
- wxBoxSizer* extra = new wxBoxSizer (wxHORIZONTAL);
+ auto extra = new wxBoxSizer (wxHORIZONTAL);
extra->Add (_markers, 1, wxRIGHT, DCPOMATIC_SIZER_X_GAP);
extra->Add (_metadata, 1, wxRIGHT, DCPOMATIC_SIZER_X_GAP);
_grid->Add (extra, wxGBPosition(r, 0), wxGBSpan(1, 2));
/* We are changing film, so destroy any dialogs for the old one */
if (_audio_dialog) {
_audio_dialog->Destroy ();
- _audio_dialog = 0;
+ _audio_dialog = nullptr;
}
if (_markers_dialog) {
_markers_dialog->Destroy ();
- _markers_dialog = 0;
+ _markers_dialog = nullptr;
}
if (_interop_metadata_dialog) {
_interop_metadata_dialog->Destroy ();
- _interop_metadata_dialog = 0;
+ _interop_metadata_dialog = nullptr;
}
if (_smpte_metadata_dialog) {
_smpte_metadata_dialog->Destroy ();
- _smpte_metadata_dialog = 0;
+ _smpte_metadata_dialog = nullptr;
}
_film = film;
return;
}
- ISDCFMetadataDialog* d = new ISDCFMetadataDialog (_panel, _film->isdcf_metadata (), _film->three_d ());
+ auto d = new ISDCFMetadataDialog (_panel, _film->isdcf_metadata (), _film->three_d ());
d->ShowModal ();
_film->set_isdcf_metadata (d->isdcf_metadata ());
d->Destroy ();
wxPanel *
DCPPanel::make_video_panel ()
{
- wxPanel* panel = new wxPanel (_notebook);
- wxSizer* sizer = new wxBoxSizer (wxVERTICAL);
+ auto panel = new wxPanel (_notebook);
+ auto sizer = new wxBoxSizer (wxVERTICAL);
_video_grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
sizer->Add (_video_grid, 0, wxALL, 8);
panel->SetSizer (sizer);
++r;
add_label_to_sizer (_video_grid, _j2k_bandwidth_label, true, wxGBPosition (r, 0));
- wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+ auto s = new wxBoxSizer (wxHORIZONTAL);
s->Add (_j2k_bandwidth, 0, wxALIGN_CENTER_VERTICAL);
add_label_to_sizer (s, _mbits_label, false, 0, wxALIGN_CENTER_VERTICAL);
_video_grid->Add (s, wxGBPosition(r, 1), wxDefaultSpan, wxEXPAND);
wxPanel *
DCPPanel::make_audio_panel ()
{
- wxPanel* panel = new wxPanel (_notebook);
+ auto panel = new wxPanel (_notebook);
_audio_panel_sizer = new wxBoxSizer (wxVERTICAL);
_audio_grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
_audio_panel_sizer->Add (_audio_grid, 0, wxALL, 8);
return;
}
- string const s = string_client_data (_audio_processor->GetClientObject (_audio_processor->GetSelection ()));
+ auto const s = string_client_data (_audio_processor->GetClientObject (_audio_processor->GetSelection ()));
_film->set_audio_processor (AudioProcessor::from_id (s));
}
_audio_dialog = 0;
}
- AudioDialog* d = new AudioDialog (_panel, _film, _viewer);
+ auto d = new AudioDialog (_panel, _film, _viewer);
d->Show ();
}
flags |= wxALIGN_RIGHT;
}
#endif
- wxStaticText* m = create_label (p, t, left);
+ auto m = create_label (p, t, left);
s->Add (m, prop, flags, 6);
return m;
}
flags |= wxALIGN_RIGHT;
}
#endif
- wxStaticText* m = create_label (p, t, left);
+ auto m = create_label (p, t, left);
s->Add (m, pos, span, flags);
return m;
}
void
error_dialog (wxWindow* parent, wxString m, optional<wxString> e)
{
- wxMessageDialog* d = new wxMessageDialog (parent, m, _("DCP-o-matic"), wxOK | wxICON_ERROR);
+ auto d = new wxMessageDialog (parent, m, _("DCP-o-matic"), wxOK | wxICON_ERROR);
if (e) {
wxString em = *e;
em[0] = wxToupper (em[0]);
void
message_dialog (wxWindow* parent, wxString m)
{
- wxMessageDialog* d = new wxMessageDialog (parent, m, _("DCP-o-matic"), wxOK | wxICON_INFORMATION);
+ auto d = new wxMessageDialog (parent, m, _("DCP-o-matic"), wxOK | wxICON_INFORMATION);
d->ShowModal ();
d->Destroy ();
}
void
checked_set (wxChoice* widget, string value)
{
- wxClientData* o = 0;
+ wxClientData* o = nullptr;
if (widget->GetSelection() != -1) {
o = widget->GetClientObject (widget->GetSelection ());
}
}
widget->Clear ();
- for (vector<pair<string, string> >::const_iterator i = items.begin(); i != items.end(); ++i) {
- widget->Append (std_to_wx (i->first), new wxStringClientData (std_to_wx (i->second)));
+ for (auto i: items) {
+ widget->Append (std_to_wx(i.first), new wxStringClientData(std_to_wx(i.second)));
}
}
{
int language = wxLANGUAGE_DEFAULT;
- boost::optional<string> config_lang = Config::instance()->language ();
+ auto config_lang = Config::instance()->language ();
if (config_lang && !config_lang->empty ()) {
- wxLanguageInfo const * li = wxLocale::FindLanguageInfo (std_to_wx (config_lang.get ()));
+ auto const li = wxLocale::FindLanguageInfo (std_to_wx (config_lang.get ()));
if (li) {
language = li->Language;
}
}
- wxLocale* locale = 0;
+ wxLocale* locale = nullptr;
if (wxLocale::IsAvailable (language)) {
locale = new wxLocale (language, wxLOCALE_LOAD_DEFAULT);
wxString
context_translation (wxString s)
{
- wxString t = wxGetTranslation (s);
+ auto t = wxGetTranslation (s);
if (t == s) {
/* No translation; strip the context */
int c = t.Find (wxT ("|"));
wxString
time_to_timecode (DCPTime t, double fps)
{
- double w = t.seconds ();
+ auto w = t.seconds ();
int const h = (w / 3600);
w -= h * 3600;
int const m = (w / 60);
wxSplashScreen *
maybe_show_splash ()
{
- wxSplashScreen* splash = 0;
+ wxSplashScreen* splash = nullptr;
try {
wxBitmap bitmap;
if (bitmap.LoadFile(bitmap_path("splash"), wxBITMAP_TYPE_PNG)) {
bool
display_progress (wxString title, wxString task)
{
- JobManager* jm = JobManager::instance ();
+ auto jm = JobManager::instance ();
wxProgressDialog progress (title, task, 100, 0, wxPD_CAN_ABORT);
small_button_size (wxWindow* parent, wxString text)
{
wxClientDC dc (parent);
- wxSize size = dc.GetTextExtent (text);
+ auto size = dc.GetTextExtent (text);
size.SetHeight (-1);
size.IncBy (24, 0);
return size;