diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-01-09 01:29:24 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-01-09 01:29:24 +0100 |
| commit | d31674ec14bb533fe2b195601e9ee2fe03848487 (patch) | |
| tree | 7647a1de68dae090f68776baa271ac104b624c57 /src/wx | |
| parent | 444809fb888ed99803f2d19c94d3faef067cf348 (diff) | |
More c++ tidying.
Diffstat (limited to 'src/wx')
| -rw-r--r-- | src/wx/about_dialog.cc | 14 | ||||
| -rw-r--r-- | src/wx/content_panel.cc | 52 | ||||
| -rw-r--r-- | src/wx/dcp_panel.cc | 28 | ||||
| -rw-r--r-- | src/wx/wx_util.cc | 30 |
4 files changed, 62 insertions, 62 deletions
diff --git a/src/wx/about_dialog.cc b/src/wx/about_dialog.cc index ae2bf0d0a..5c13be551 100644 --- a/src/wx/about_dialog.cc +++ b/src/wx/about_dialog.cc @@ -38,8 +38,8 @@ using std::vector; AboutDialog::AboutDialog (wxWindow* parent) : wxDialog (parent, wxID_ANY, _("About DCP-o-matic")) { - wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL); - wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL); + auto overall_sizer = new wxBoxSizer (wxVERTICAL); + auto sizer = new wxBoxSizer (wxVERTICAL); wxFont title_font (*wxNORMAL_FONT); title_font.SetPointSize (title_font.GetPointSize() + 12); @@ -51,7 +51,7 @@ AboutDialog::AboutDialog (wxWindow* parent) wxFont version_font (*wxNORMAL_FONT); version_font.SetWeight (wxFONTWEIGHT_BOLD); - wxStaticText* t = new StaticText (this, _("DCP-o-matic")); + auto t = new StaticText (this, _("DCP-o-matic")); t->SetFont (title_font); sizer->Add (t, wxSizerFlags().Centre().Border(wxALL, 16)); @@ -74,7 +74,7 @@ AboutDialog::AboutDialog (wxWindow* parent) sizer->Add (t, wxSizerFlags().Centre().Border(wxALL, 8)); - wxHyperlinkCtrl* h = new wxHyperlinkCtrl ( + auto h = new wxHyperlinkCtrl ( this, wxID_ANY, wxT ("dcpomatic.com"), wxT ("https://dcpomatic.com") @@ -238,14 +238,14 @@ AboutDialog::AboutDialog (wxWindow* parent) void AboutDialog::add_section (wxString name, wxArrayString credits) { - static bool first = true; + static auto first = true; int const N = 4; - wxScrolledWindow* panel = new wxScrolledWindow (_notebook); + auto panel = new wxScrolledWindow (_notebook); panel->SetMaxSize (wxSize (-1, 380)); panel->EnableScrolling (false, true); panel->SetScrollRate (0, 32); - wxSizer* overall_sizer = new wxBoxSizer (wxHORIZONTAL); + auto overall_sizer = new wxBoxSizer (wxHORIZONTAL); vector<wxSizer*> sizers; diff --git a/src/wx/content_panel.cc b/src/wx/content_panel.cc index 83539403d..0530c9128 100644 --- a/src/wx/content_panel.cc +++ b/src/wx/content_panel.cc @@ -88,7 +88,7 @@ ContentPanel::ContentPanel (wxNotebook* n, shared_ptr<Film> film, weak_ptr<FilmV _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); @@ -97,7 +97,7 @@ ContentPanel::ContentPanel (wxNotebook* n, shared_ptr<Film> film, weak_ptr<FilmV _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.")); @@ -168,7 +168,7 @@ ContentPanel::selected () break; } - ContentList cl = _film->content(); + auto cl = _film->content(); if (s < int (cl.size())) { sel.push_back (cl[s]); } @@ -225,7 +225,7 @@ ContentPanel::selected_ffmpeg () 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); } @@ -308,7 +308,7 @@ ContentPanel::check_selection () } 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)); } @@ -385,7 +385,7 @@ ContentPanel::check_selection () /* 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); @@ -414,7 +414,7 @@ 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 ( + auto d = new wxFileDialog ( _splitter, _("Choose a file or files"), wxT (""), @@ -444,7 +444,7 @@ ContentPanel::add_file_clicked () 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 (); @@ -468,11 +468,11 @@ ContentPanel::add_folder_clicked () } 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) { @@ -489,7 +489,7 @@ ContentPanel::add_folder_clicked () 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 (); @@ -533,7 +533,7 @@ ContentPanel::timeline_clicked () if (_timeline_dialog) { _timeline_dialog->Destroy (); - _timeline_dialog = 0; + _timeline_dialog = nullptr; } _timeline_dialog = new TimelineDialog (this, _film, _film_viewer); @@ -555,9 +555,9 @@ ContentPanel::setup_sensitivity () _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); @@ -607,7 +607,7 @@ ContentPanel::set_general_sensitivity (bool s) void ContentPanel::earlier_clicked () { - ContentList sel = selected (); + auto sel = selected (); if (sel.size() == 1) { _film->move_content_earlier (sel.front ()); check_selection (); @@ -617,7 +617,7 @@ ContentPanel::earlier_clicked () void ContentPanel::later_clicked () { - ContentList sel = selected (); + auto sel = selected (); if (sel.size() == 1) { _film->move_content_later (sel.front ()); check_selection (); @@ -627,7 +627,7 @@ ContentPanel::later_clicked () 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); @@ -642,7 +642,7 @@ ContentPanel::set_selection (ContentList cl) { _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); @@ -682,10 +682,10 @@ ContentPanel::setup () 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); @@ -700,11 +700,11 @@ ContentPanel::setup () 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; @@ -748,7 +748,7 @@ ContentPanel::files_dropped (wxDropFilesEvent& event) 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])); diff --git a/src/wx/dcp_panel.cc b/src/wx/dcp_panel.cc index 5d941301b..8b87595b4 100644 --- a/src/wx/dcp_panel.cc +++ b/src/wx/dcp_panel.cc @@ -1,5 +1,5 @@ /* - 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. @@ -102,7 +102,7 @@ DCPPanel::DCPPanel (wxNotebook* n, shared_ptr<Film> film, weak_ptr<FilmViewer> v _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); @@ -205,7 +205,7 @@ DCPPanel::add_to_grid () _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)); @@ -523,19 +523,19 @@ DCPPanel::set_film (shared_ptr<Film> film) /* 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; @@ -634,7 +634,7 @@ DCPPanel::edit_isdcf_button_clicked () 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 (); @@ -707,8 +707,8 @@ DCPPanel::setup_frame_rate_widget () 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); @@ -796,7 +796,7 @@ DCPPanel::add_video_panel_to_grid () ++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); @@ -822,7 +822,7 @@ DCPPanel::minimum_allowed_audio_channels () const 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); @@ -878,7 +878,7 @@ DCPPanel::audio_processor_changed () 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)); } @@ -894,7 +894,7 @@ DCPPanel::show_audio_clicked () _audio_dialog = 0; } - AudioDialog* d = new AudioDialog (_panel, _film, _viewer); + auto d = new AudioDialog (_panel, _film, _viewer); d->Show (); } diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc index 3386b2700..8b6d0961b 100644 --- a/src/wx/wx_util.cc +++ b/src/wx/wx_util.cc @@ -80,7 +80,7 @@ add_label_to_sizer (wxSizer* s, wxWindow* p, wxString t, bool left, int prop, in 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; } @@ -110,7 +110,7 @@ add_label_to_sizer (wxGridBagSizer* s, wxWindow* p, wxString t, bool left, wxGBP 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; } @@ -140,7 +140,7 @@ add_label_to_sizer (wxGridBagSizer* s, wxStaticText* t, bool, wxGBPosition pos, 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]); @@ -157,7 +157,7 @@ error_dialog (wxWindow* parent, wxString m, optional<wxString> e) 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 (); } @@ -253,7 +253,7 @@ checked_set (wxChoice* widget, int value) void checked_set (wxChoice* widget, string value) { - wxClientData* o = 0; + wxClientData* o = nullptr; if (widget->GetSelection() != -1) { o = widget->GetClientObject (widget->GetSelection ()); } @@ -285,8 +285,8 @@ checked_set (wxChoice* widget, vector<pair<string, string> > items) } 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))); } } @@ -351,15 +351,15 @@ dcpomatic_setup_i18n () { 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); @@ -418,7 +418,7 @@ wx_get (wxSpinCtrlDouble* w) 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 ("|")); @@ -433,7 +433,7 @@ context_translation (wxString s) 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); @@ -470,7 +470,7 @@ setup_audio_channels_choice (wxChoice* choice, int minimum) wxSplashScreen * maybe_show_splash () { - wxSplashScreen* splash = 0; + wxSplashScreen* splash = nullptr; try { wxBitmap bitmap; if (bitmap.LoadFile(bitmap_path("splash"), wxBITMAP_TYPE_PNG)) { @@ -512,7 +512,7 @@ calculate_mark_interval (double mark_interval) bool display_progress (wxString title, wxString task) { - JobManager* jm = JobManager::instance (); + auto jm = JobManager::instance (); wxProgressDialog progress (title, task, 100, 0, wxPD_CAN_ABORT); @@ -597,7 +597,7 @@ wxSize 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; |
