mirror of https://github.com/odrling/Aegisub
Use std::to_wstring rather than wxString::Format("%d", ...)
std::to_wstring is significantly faster and is a bit shorter.
This commit is contained in:
parent
64ecd29169
commit
c62ebf7e8b
|
@ -577,11 +577,11 @@ void BaseGrid::DrawImage(wxDC &dc, bool paint_columns[]) {
|
|||
}
|
||||
|
||||
void BaseGrid::GetRowStrings(int row, AssDialogue *line, bool *paint_columns, wxString *strings, bool replace, wxString const& rep_char) const {
|
||||
if (paint_columns[0]) strings[0] = wxString::Format("%d", row + 1);
|
||||
if (paint_columns[1]) strings[1] = wxString::Format("%d", line->Layer);
|
||||
if (paint_columns[0]) strings[0] = std::to_wstring(row + 1);
|
||||
if (paint_columns[1]) strings[1] = std::to_wstring(line->Layer);
|
||||
if (byFrame) {
|
||||
if (paint_columns[2]) strings[2] = wxString::Format("%d", context->videoController->FrameAtTime(line->Start, agi::vfr::START));
|
||||
if (paint_columns[3]) strings[3] = wxString::Format("%d", context->videoController->FrameAtTime(line->End, agi::vfr::END));
|
||||
if (paint_columns[2]) strings[2] = std::to_wstring(context->videoController->FrameAtTime(line->Start, agi::vfr::START));
|
||||
if (paint_columns[3]) strings[3] = std::to_wstring(context->videoController->FrameAtTime(line->End, agi::vfr::END));
|
||||
}
|
||||
else {
|
||||
if (paint_columns[2]) strings[2] = to_wx(line->Start.GetAssFormated());
|
||||
|
@ -820,7 +820,7 @@ void BaseGrid::SetColumnWidths() {
|
|||
// O(1) widths
|
||||
int marginLen = dc.GetTextExtent("0000").GetWidth();
|
||||
|
||||
int labelLen = dc.GetTextExtent(wxString::Format("%d", GetRows())).GetWidth();
|
||||
int labelLen = dc.GetTextExtent(std::to_wstring(GetRows())).GetWidth();
|
||||
int startLen = 0;
|
||||
int endLen = 0;
|
||||
if (!byFrame)
|
||||
|
@ -865,12 +865,12 @@ void BaseGrid::SetColumnWidths() {
|
|||
}
|
||||
|
||||
// Finish layer
|
||||
int layerLen = maxLayer ? dc.GetTextExtent(wxString::Format("%d", maxLayer)).GetWidth() : 0;
|
||||
int layerLen = maxLayer ? dc.GetTextExtent(std::to_wstring(maxLayer)).GetWidth() : 0;
|
||||
|
||||
// Finish times
|
||||
if (byFrame) {
|
||||
startLen = dc.GetTextExtent(wxString::Format("%d", maxStart)).GetWidth();
|
||||
endLen = dc.GetTextExtent(wxString::Format("%d", maxEnd)).GetWidth();
|
||||
startLen = dc.GetTextExtent(std::to_wstring(maxStart)).GetWidth();
|
||||
endLen = dc.GetTextExtent(std::to_wstring(maxEnd)).GetWidth();
|
||||
}
|
||||
|
||||
// Set column widths
|
||||
|
|
|
@ -162,6 +162,6 @@ int DialogProperties::SetInfoIfDifferent(std::string const& key, std::string con
|
|||
}
|
||||
|
||||
void DialogProperties::OnSetFromVideo(wxCommandEvent &) {
|
||||
ResX->SetValue(wxString::Format("%d", c->videoController->GetWidth()));
|
||||
ResY->SetValue(wxString::Format("%d", c->videoController->GetHeight()));
|
||||
ResX->SetValue(std::to_wstring(c->videoController->GetWidth()));
|
||||
ResY->SetValue(std::to_wstring(c->videoController->GetHeight()));
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ static wxString get_history_string(json::Object &obj) {
|
|||
int beg = (int64_t)(*it)["start"];
|
||||
int end = (int64_t)(*it)["end"];
|
||||
if (beg == end)
|
||||
lines += wxString::Format("%d", beg);
|
||||
lines += std::to_wstring(beg);
|
||||
else
|
||||
lines += wxString::Format("%d-%d", beg, end);
|
||||
if (it + 1 != sel.end())
|
||||
|
|
|
@ -126,7 +126,7 @@ wxControl *OptionPage::OptionAdd(wxFlexGridSizer *flex, const wxString &name, co
|
|||
}
|
||||
|
||||
case agi::OptionValue::Type_Int: {
|
||||
wxSpinCtrl *sc = new wxSpinCtrl(this, -1, wxString::Format("%d", (int)opt->GetInt()), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, min, max, opt->GetInt());
|
||||
wxSpinCtrl *sc = new wxSpinCtrl(this, -1, std::to_wstring((int)opt->GetInt()), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, min, max, opt->GetInt());
|
||||
sc->Bind(wxEVT_COMMAND_SPINCTRL_UPDATED, IntUpdater(opt_name, parent));
|
||||
Add(flex, name, sc);
|
||||
return sc;
|
||||
|
@ -240,7 +240,7 @@ void OptionPage::OptionFont(wxSizer *sizer, std::string opt_prefix) {
|
|||
font_name->SetMinSize(wxSize(160, -1));
|
||||
font_name->Bind(wxEVT_COMMAND_TEXT_UPDATED, StringUpdater(face_opt->GetName().c_str(), parent));
|
||||
|
||||
wxSpinCtrl *font_size = new wxSpinCtrl(this, -1, wxString::Format("%d", (int)size_opt->GetInt()), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 3, 42, size_opt->GetInt());
|
||||
wxSpinCtrl *font_size = new wxSpinCtrl(this, -1, std::to_wstring((int)size_opt->GetInt()), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 3, 42, size_opt->GetInt());
|
||||
font_size->Bind(wxEVT_COMMAND_SPINCTRL_UPDATED, IntUpdater(size_opt->GetName().c_str(), parent));
|
||||
|
||||
wxButton *pick_btn = new wxButton(this, -1, _("Choose..."));
|
||||
|
|
|
@ -129,7 +129,7 @@ void TimeEdit::OnModified(wxCommandEvent &event) {
|
|||
|
||||
void TimeEdit::UpdateText() {
|
||||
if (byFrame)
|
||||
ChangeValue(wxString::Format("%d", c->videoController->FrameAtTime(time, isEnd ? agi::vfr::END : agi::vfr::START)));
|
||||
ChangeValue(std::to_wstring(c->videoController->FrameAtTime(time, isEnd ? agi::vfr::END : agi::vfr::START)));
|
||||
else
|
||||
ChangeValue(to_wx(time.GetAssFormated()));
|
||||
}
|
||||
|
|
|
@ -184,7 +184,7 @@ bool NumValidator::TransferToWindow() {
|
|||
if (isFloat)
|
||||
ctrl->SetValue(wxString::Format("%g",fValue));
|
||||
else
|
||||
ctrl->SetValue(wxString::Format("%d",iValue));
|
||||
ctrl->SetValue(std::to_wstring(iValue));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue