From 449be30bcb75e136d0985f68f3d942d2059e1802 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 27 Mar 2021 00:04:53 +0100 Subject: [PATCH] C++11 tidying. --- src/wx/text_panel.cc | 45 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/src/wx/text_panel.cc b/src/wx/text_panel.cc index 8d295180a..ec4904afd 100644 --- a/src/wx/text_panel.cc +++ b/src/wx/text_panel.cc @@ -72,7 +72,7 @@ TextPanel::TextPanel (ContentPanel* p, TextType t) _reference = new CheckBox (this, refer); _reference_note = new StaticText (this, wxT("")); _reference_note->Wrap (200); - wxFont font = _reference_note->GetFont(); + auto font = _reference_note->GetFont(); font.SetStyle(wxFONTSTYLE_ITALIC); font.SetPointSize(font.GetPointSize() - 1); _reference_note->SetFont(font); @@ -191,13 +191,13 @@ TextPanel::add_to_grid () { int r = 0; - wxBoxSizer* reference_sizer = new wxBoxSizer (wxVERTICAL); + auto reference_sizer = new wxBoxSizer (wxVERTICAL); reference_sizer->Add (_reference, 0); reference_sizer->Add (_reference_note, 0); _grid->Add (reference_sizer, wxGBPosition(r, 0), wxGBSpan(1, 4)); ++r; - wxBoxSizer* use = new wxBoxSizer (wxHORIZONTAL); + auto use = new wxBoxSizer (wxHORIZONTAL); use->Add (_use, 0, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_GAP); use->Add (_type, 1, wxEXPAND, 0); _grid->Add (use, wxGBPosition (r, 0), wxGBSpan (1, 2)); @@ -210,7 +210,7 @@ TextPanel::add_to_grid () ++r; add_label_to_sizer (_grid, _offset_label, true, wxGBPosition (r, 0)); - wxBoxSizer* offset = new wxBoxSizer (wxHORIZONTAL); + auto offset = new wxBoxSizer (wxHORIZONTAL); add_label_to_sizer (offset, _x_offset_label, true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL); offset->Add (_x_offset, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_X_GAP); offset->Add (_x_offset_pc_label, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_X_GAP * 2); @@ -226,7 +226,7 @@ TextPanel::add_to_grid () ++r; add_label_to_sizer (_grid, _scale_label, true, wxGBPosition (r, 0)); - wxBoxSizer* scale = new wxBoxSizer (wxHORIZONTAL); + auto scale = new wxBoxSizer (wxHORIZONTAL); add_label_to_sizer (scale, _x_scale_label, true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL); scale->Add (_x_scale, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_X_GAP); scale->Add (_x_scale_pc_label, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_X_GAP * 2); @@ -258,7 +258,7 @@ TextPanel::add_to_grid () ++r; { - wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); + auto s = new wxBoxSizer (wxHORIZONTAL); s->Add (_text_view_button, 1, wxALL, DCPOMATIC_SIZER_GAP); s->Add (_fonts_dialog_button, 1, wxALL, DCPOMATIC_SIZER_GAP); @@ -279,9 +279,9 @@ TextPanel::update_dcp_track_selection () optional selected; bool many = false; for (auto i: _parent->selected_text()) { - shared_ptr t = i->text_of_original_type(_original_type); + auto t = i->text_of_original_type(_original_type); if (t) { - optional dt = t->dcp_track(); + auto dt = t->dcp_track(); if (dt && selected && *dt != *selected) { many = true; } else if (!selected) { @@ -331,7 +331,7 @@ TextPanel::dcp_track_changed () optional track; if (_dcp_track->GetSelection() == int(_dcp_track->GetCount()) - 1) { - DCPTextTrackDialog* d = new DCPTextTrackDialog (this); + auto d = new DCPTextTrackDialog (this); if (d->ShowModal() == wxID_OK) { track = d->get(); } @@ -347,7 +347,7 @@ TextPanel::dcp_track_changed () if (track) { for (auto i: _parent->selected_text()) { - shared_ptr t = i->text_of_original_type(_original_type); + auto t = i->text_of_original_type(_original_type); if (t && t->type() == TextType::CLOSED_CAPTION) { t->set_dcp_track(*track); } @@ -368,8 +368,8 @@ TextPanel::film_changed (Film::Property property) void TextPanel::film_content_changed (int property) { - FFmpegContentList fc = _parent->selected_ffmpeg (); - ContentList sc = _parent->selected_text (); + auto fc = _parent->selected_ffmpeg (); + auto sc = _parent->selected_text (); shared_ptr fcs; if (fc.size() == 1) { @@ -389,9 +389,8 @@ TextPanel::film_content_changed (int property) if (property == FFmpegContentProperty::SUBTITLE_STREAMS) { _stream->Clear (); if (fcs) { - vector > s = fcs->subtitle_streams (); - for (vector >::iterator i = s.begin(); i != s.end(); ++i) { - _stream->Append (std_to_wx ((*i)->name), new wxStringClientData (std_to_wx ((*i)->identifier ()))); + for (auto i: fcs->subtitle_streams()) { + _stream->Append (std_to_wx(i->name), new wxStringClientData(std_to_wx(i->identifier()))); } if (fcs->subtitle_stream()) { @@ -446,7 +445,7 @@ TextPanel::film_content_changed (int property) } } else if (property == DCPContentProperty::REFERENCE_TEXT) { if (scs) { - shared_ptr dcp = dynamic_pointer_cast (scs); + auto dcp = dynamic_pointer_cast (scs); checked_set (_reference, dcp ? dcp->reference_text(_original_type) : false); } else { checked_set (_reference, false); @@ -508,13 +507,13 @@ TextPanel::setup_sensitivity () int ffmpeg_subs = 0; /* DCP subs can't have their line spacing changed */ int dcp_subs = 0; - ContentList sel = _parent->selected_text (); + auto sel = _parent->selected_text (); for (auto i: sel) { /* These are the content types that could include subtitles */ - shared_ptr fc = std::dynamic_pointer_cast (i); - shared_ptr sc = std::dynamic_pointer_cast (i); - shared_ptr dc = std::dynamic_pointer_cast (i); - shared_ptr dsc = std::dynamic_pointer_cast (i); + auto fc = std::dynamic_pointer_cast (i); + auto sc = std::dynamic_pointer_cast (i); + auto dc = std::dynamic_pointer_cast (i); + auto dsc = std::dynamic_pointer_cast (i); if (fc) { if (!fc->text.empty()) { ++ffmpeg_subs; @@ -677,10 +676,10 @@ TextPanel::text_view_clicked () _text_view = 0; } - ContentList c = _parent->selected_text (); + auto c = _parent->selected_text (); DCPOMATIC_ASSERT (c.size() == 1); - shared_ptr decoder = decoder_factory (_parent->film(), c.front(), false, false, shared_ptr()); + auto decoder = decoder_factory (_parent->film(), c.front(), false, false, shared_ptr()); if (decoder) { _text_view = new TextView (this, _parent->film(), c.front(), c.front()->text_of_original_type(_original_type), decoder, _parent->film_viewer()); -- 2.30.2