Eliminate uses of c_str made unnecessary by changed to wxString::Format in wx 2.9

Originally committed to SVN as r5612.
This commit is contained in:
Thomas Goyne 2011-09-28 19:43:48 +00:00
parent d990bbbb99
commit cc147d1660
32 changed files with 81 additions and 81 deletions

View File

@ -185,7 +185,7 @@ wxArrayInt AegisubLocale::GetAvailableLanguages() {
// If the locale file doesn't exist then don't list it as an option. // If the locale file doesn't exist then don't list it as an option.
wxString locDir = wxStandardPaths::Get().GetLocalizedResourcesDir(langs[i], wxStandardPathsBase::ResourceCat_Messages); wxString locDir = wxStandardPaths::Get().GetLocalizedResourcesDir(langs[i], wxStandardPathsBase::ResourceCat_Messages);
wxFileName file(wxString::Format("%s/%s.mo", locDir.c_str(), GETTEXT_PACKAGE)); wxFileName file(wxString::Format("%s/%s.mo", locDir, GETTEXT_PACKAGE));
if (lang && file.FileExists()) final.Add(lang->Language); if (lang && file.FileExists()) final.Add(lang->Language);
} }
#endif #endif

View File

@ -220,13 +220,13 @@ wxString AssDialogue::GetData(bool ssa) const {
wxString str = wxString::Format( wxString str = wxString::Format(
"%s: %s,%s,%s,%s,%s,%d,%d,%d,%s,%s", "%s: %s,%s,%s,%s,%s,%d,%d,%d,%s,%s",
Comment ? "Comment" : "Dialogue", Comment ? "Comment" : "Dialogue",
ssa ? "Marked=0" : wxString::Format("%01d", Layer).c_str(), ssa ? "Marked=0" : wxString::Format("%01d", Layer),
Start.GetASSFormated().c_str(), Start.GetASSFormated(),
End.GetASSFormated().c_str(), End.GetASSFormated(),
s.c_str(), a.c_str(), s, a,
Margin[0], Margin[1], Margin[2], Margin[0], Margin[1], Margin[2],
e.c_str(), e,
Text.c_str()); Text);
// Make sure that final has no line breaks // Make sure that final has no line breaks
str.Replace("\n", ""); str.Replace("\n", "");

View File

@ -97,7 +97,7 @@ void AssExporter::AddFilter(wxString name) {
} }
// Check // Check
if (!filter) throw wxString::Format("Filter not found: %s", name.c_str()); if (!filter) throw wxString::Format("Filter not found: %s", name);
// Add to list // Add to list
Filters.push_back(filter); Filters.push_back(filter);
@ -177,5 +177,5 @@ wxString AssExporter::GetDescription(wxString name) {
return (*cur)->GetDescription(); return (*cur)->GetDescription();
} }
} }
throw wxString::Format("Filter not found: %s", name.c_str()); throw wxString::Format("Filter not found: %s", name);
} }

View File

@ -116,7 +116,7 @@ void AssFile::Load(const wxString &_filename,wxString charset,bool addToRecent)
// Real exception // Real exception
catch (agi::Exception &e) { catch (agi::Exception &e) {
wxMessageBox(wxString(e.GetChainedMessage().c_str(), wxConvUTF8), "Error loading file", wxICON_ERROR|wxOK); wxMessageBox(lagi_wxString(e.GetChainedMessage()), "Error loading file", wxICON_ERROR|wxOK);
return; return;
} }

View File

@ -340,7 +340,7 @@ std::vector<wxString> tokenize(const wxString &text) {
else if (c == ')') { else if (c == ')') {
parDepth--; parDepth--;
if (parDepth < 0) { if (parDepth < 0) {
wxLogWarning("Unmatched parenthesis near '%s'!\nTag-parsing incomplete.", text.SubString(i, 10).c_str()); wxLogWarning("Unmatched parenthesis near '%s'!\nTag-parsing incomplete.", text.SubString(i, 10));
return paramList; return paramList;
} }
else if (parDepth == 0) { else if (parDepth == 0) {

View File

@ -429,11 +429,11 @@ void AssStyle::UpdateData() {
final = wxString::Format("Style: %s,%s,%g,%s,%s,%s,%s,%d,%d,%d,%d,%g,%g,%g,%g,%d,%g,%g,%i,%i,%i,%i,%i", final = wxString::Format("Style: %s,%s,%g,%s,%s,%s,%s,%d,%d,%d,%d,%g,%g,%g,%g,%d,%g,%g,%i,%i,%i,%i,%i",
name.c_str(), font.c_str(), fontsize, name, font, fontsize,
primary.GetASSFormatted(true,false,true).c_str(), primary.GetASSFormatted(true,false,true),
secondary.GetASSFormatted(true,false,true).c_str(), secondary.GetASSFormatted(true,false,true),
outline.GetASSFormatted(true,false,true).c_str(), outline.GetASSFormatted(true,false,true),
shadow.GetASSFormatted(true,false,true).c_str(), shadow.GetASSFormatted(true,false,true),
(bold? -1 : 0), (italic ? -1 : 0), (bold? -1 : 0), (italic ? -1 : 0),
(underline?-1:0),(strikeout?-1:0), (underline?-1:0),(strikeout?-1:0),
scalex,scaley,spacing,angle, scalex,scaley,spacing,angle,
@ -491,10 +491,10 @@ wxString AssStyle::GetSSAText() const {
f.Replace(",", ";"); f.Replace(",", ";");
output = wxString::Format("Style: %s,%s,%g,%s,%s,0,%s,%d,%d,%d,%g,%g,%d,%d,%d,%d,0,%i", output = wxString::Format("Style: %s,%s,%g,%s,%s,0,%s,%d,%d,%d,%g,%g,%d,%d,%d,%d,0,%i",
n.c_str(), f.c_str(), fontsize, n, f, fontsize,
primary.GetSSAFormatted().c_str(), primary.GetSSAFormatted(),
secondary.GetSSAFormatted().c_str(), secondary.GetSSAFormatted(),
shadow.GetSSAFormatted().c_str(), shadow.GetSSAFormatted(),
(bold? -1 : 0), (italic ? -1 : 0), (bold? -1 : 0), (italic ? -1 : 0),
borderstyle,outline_w,shadow_w,align, borderstyle,outline_w,shadow_w,align,
Margin[0],Margin[1],Margin[2],encoding); Margin[0],Margin[1],Margin[2],encoding);

View File

@ -165,7 +165,7 @@ wxString HDAudioProvider::DiskCacheName() {
// Try from 00 to 99 // Try from 00 to 99
for (int i=0;i<100;i++) { for (int i=0;i<100;i++) {
// File exists? // File exists?
wxString curStringTry = DiskCachePath() + wxString::Format(pattern.c_str(),i); wxString curStringTry = DiskCachePath() + wxString::Format(pattern,i);
if (!wxFile::Exists(curStringTry)) return curStringTry; if (!wxFile::Exists(curStringTry)) return curStringTry;
} }
return ""; return "";

View File

@ -104,7 +104,7 @@ namespace Automation4 {
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf.lfQuality = ANTIALIASED_QUALITY; lf.lfQuality = ANTIALIASED_QUALITY;
lf.lfPitchAndFamily = DEFAULT_PITCH|FF_DONTCARE; lf.lfPitchAndFamily = DEFAULT_PITCH|FF_DONTCARE;
_tcsncpy(lf.lfFaceName, style->font.c_str(), 32); wcsncpy(lf.lfFaceName, style->font.wc_str(), 32);
HFONT thefont = CreateFontIndirect(&lf); HFONT thefont = CreateFontIndirect(&lf);
if (!thefont) return false; if (!thefont) return false;
@ -311,7 +311,7 @@ namespace Automation4 {
/// ///
wxString FeatureFilter::GetScriptSettingsIdentifier() wxString FeatureFilter::GetScriptSettingsIdentifier()
{ {
return inline_string_encode(wxString::Format("Automation Settings %s", GetName().c_str())); return inline_string_encode(wxString::Format("Automation Settings %s", GetName()));
} }
@ -899,11 +899,11 @@ namespace Automation4 {
} }
catch (const char *e) { catch (const char *e) {
error_count++; error_count++;
wxLogError("Error loading Automation script: %s\n%s", fn.c_str(), e); wxLogError("Error loading Automation script: %s\n%s", fn, e);
} }
catch (...) { catch (...) {
error_count++; error_count++;
wxLogError("Error loading Automation script: %s\nUnknown error.", fn.c_str()); wxLogError("Error loading Automation script: %s\nUnknown error.", fn);
} }
more = dir.GetNext(&fn); more = dir.GetNext(&fn);
} }
@ -991,7 +991,7 @@ namespace Automation4 {
Script *s = (*i)->Produce(filename); Script *s = (*i)->Produce(filename);
if (s) { if (s) {
if (!s->GetLoadedState() && log_errors) { if (!s->GetLoadedState() && log_errors) {
wxLogError(_("An Automation script failed to load. File name: '%s', error reported:"), filename.c_str()); wxLogError(_("An Automation script failed to load. File name: '%s', error reported:"), filename);
wxLogError(s->GetDescription()); wxLogError(s->GetDescription());
} }
return s; return s;
@ -1004,7 +1004,7 @@ namespace Automation4 {
} }
} }
if (log_errors) { if (log_errors) {
wxLogWarning(_("The file was not recognised as an Automation script: %s"), filename.c_str()); wxLogWarning(_("The file was not recognised as an Automation script: %s"), filename);
} }
return new UnknownScript(filename); return new UnknownScript(filename);
} }

View File

@ -756,7 +756,7 @@ namespace Automation4 {
bool result; bool result;
if (err) { if (err) {
wxString errmsg(lua_tostring(L, -1), wxConvUTF8); wxString errmsg(lua_tostring(L, -1), wxConvUTF8);
wxLogWarning("Runtime error in Lua macro validation function:\n%s", errmsg.c_str()); wxLogWarning("Runtime error in Lua macro validation function:\n%s", errmsg);
result = false; result = false;
} else { } else {
result = !!lua_toboolean(L, -1); result = !!lua_toboolean(L, -1);
@ -948,7 +948,7 @@ namespace Automation4 {
int err = lua_pcall(L, 2, 1, 0); int err = lua_pcall(L, 2, 1, 0);
if (err) { if (err) {
wxString errmsg(lua_tostring(L, -1), wxConvUTF8); wxString errmsg(lua_tostring(L, -1), wxConvUTF8);
wxLogWarning("Runtime error in Lua macro validation function:\n%s", errmsg.c_str()); wxLogWarning("Runtime error in Lua macro validation function:\n%s", errmsg);
lua_pop(L, 1); // remove error message lua_pop(L, 1); // remove error message
return config_dialog = 0; return config_dialog = 0;
} else { } else {

View File

@ -342,7 +342,7 @@ namespace Automation4 {
} else if (lclass == "info") { } else if (lclass == "info") {
GETSTRING(key, "key", "info") GETSTRING(key, "key", "info")
GETSTRING(value, "value", "info") GETSTRING(value, "value", "info")
result = new AssEntry(wxString::Format("%s: %s", key.c_str(), value.c_str())); result = new AssEntry(wxString::Format("%s: %s", key, value));
result->group = "[Script Info]"; // just so it can be read correctly back result->group = "[Script Info]"; // just so it can be read correctly back
} else if (lclass == "format") { } else if (lclass == "format") {

View File

@ -138,7 +138,7 @@ namespace Automation4 {
} }
lua_pop(L, 1); lua_pop(L, 1);
LOG_D("automation/lua/dialog") << "created control: '" << name.c_str() << "', (" << x << "," << y << ")(" << width << "," << height << ", "<< hint.c_str(); LOG_D("automation/lua/dialog") << "created control: '" << STD_STR(name) << "', (" << x << "," << y << ")(" << width << "," << height << ", "<< STD_STR(hint);
} }
@ -1007,7 +1007,7 @@ badcontrol:
if (buttons.size() > 0) { if (buttons.size() > 0) {
LOG_D("automation/lua/dialog") << "creating user buttons"; LOG_D("automation/lua/dialog") << "creating user buttons";
for (size_t i = 0; i < buttons.size(); ++i) { for (size_t i = 0; i < buttons.size(); ++i) {
LOG_D("automation/lua/dialog") << "button '" << buttons[i].c_str() << "' gets id " << 1001+(wxWindowID)i; LOG_D("automation/lua/dialog") << "button '" << STD_STR(buttons[i]) << "' gets id " << 1001+(wxWindowID)i;
bs->Add(new wxButton(w, 1001+(wxWindowID)i, buttons[i])); bs->Add(new wxButton(w, 1001+(wxWindowID)i, buttons[i]));
} }
@ -1054,7 +1054,7 @@ badcontrol:
LOG_D("automation/lua/dialog") << "default buttons, button 1 bushed, Ok button"; LOG_D("automation/lua/dialog") << "default buttons, button 1 bushed, Ok button";
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
} else { } else {
LOG_D("automation/lua/dialog") << "user button: " << buttons.at(btn-1).c_str(); LOG_D("automation/lua/dialog") << "user button: " << STD_STR(buttons.at(btn-1));
// button_pushed is index+1 to reserve 0 for Cancel // button_pushed is index+1 to reserve 0 for Cancel
lua_pushstring(L, buttons.at(btn-1).mb_str(wxConvUTF8)); lua_pushstring(L, buttons.at(btn-1).mb_str(wxConvUTF8));
} }
@ -1090,7 +1090,7 @@ badcontrol:
if (controls[i]->CanSerialiseValue()) { if (controls[i]->CanSerialiseValue()) {
wxString sn = inline_string_encode(controls[i]->name); wxString sn = inline_string_encode(controls[i]->name);
wxString sv = controls[i]->SerialiseValue(); wxString sv = controls[i]->SerialiseValue();
res += wxString::Format("%s:%s|", sn.c_str(), sv.c_str()); res += wxString::Format("%s:%s|", sn, sv);
} }
} }

View File

@ -80,7 +80,7 @@ struct am_manager : public Command {
} catch (const char *e) { } catch (const char *e) {
wxLogError(e); wxLogError(e);
} catch (...) { } catch (...) {
wxLogError("An unknown error occurred reloading Automation script '%s'.", scripts[i]->GetName().c_str()); wxLogError("An unknown error occurred reloading Automation script '%s'.", scripts[i]->GetName());
} }
} }

View File

@ -100,7 +100,7 @@ struct help_files : public Command {
void operator()(agi::Context *c) { void operator()(agi::Context *c) {
#ifdef __WXMAC__ #ifdef __WXMAC__
char *shared_path = agi::util::OSX_GetBundleSharedSupportDirectory(); char *shared_path = agi::util::OSX_GetBundleSharedSupportDirectory();
wxString help_path = wxString::Format("%s/doc", wxString(shared_path, wxConvUTF8).c_str()); wxString help_path = wxString::Format("%s/doc", wxString(shared_path, wxConvUTF8));
agi::util::OSX_OpenLocation(help_path.c_str()); agi::util::OSX_OpenLocation(help_path.c_str());
free(shared_path); free(shared_path);
#endif #endif

View File

@ -215,7 +215,7 @@ void DialogAutomation::OnAdd(wxCommandEvent &evt)
const Automation4::ScriptFactory *fact = factories[i]; const Automation4::ScriptFactory *fact = factories[i];
if (fact->GetEngineName().IsEmpty() || fact->GetFilenamePattern().IsEmpty()) if (fact->GetEngineName().IsEmpty() || fact->GetFilenamePattern().IsEmpty())
continue; continue;
fnfilter = wxString::Format("%s%s scripts (%s)|%s|", fnfilter.c_str(), fact->GetEngineName().c_str(), fact->GetFilenamePattern().c_str(), fact->GetFilenamePattern().c_str()); fnfilter = wxString::Format("%s%s scripts (%s)|%s|", fnfilter, fact->GetEngineName(), fact->GetFilenamePattern(), fact->GetFilenamePattern());
catchall << fact->GetFilenamePattern() << ";"; catchall << fact->GetFilenamePattern() << ";";
} }
#ifdef __WINDOWS__ #ifdef __WINDOWS__
@ -323,16 +323,16 @@ void DialogAutomation::OnInfo(wxCommandEvent &evt)
info += _("Scripting engines installed:\n"); info += _("Scripting engines installed:\n");
const std::vector<Automation4::ScriptFactory*> &factories = Automation4::ScriptFactory::GetFactories(); const std::vector<Automation4::ScriptFactory*> &factories = Automation4::ScriptFactory::GetFactories();
for (std::vector<Automation4::ScriptFactory*>::const_iterator c = factories.begin(); c != factories.end(); ++c) { for (std::vector<Automation4::ScriptFactory*>::const_iterator c = factories.begin(); c != factories.end(); ++c) {
info += wxString::Format("- %s (%s)\n", (*c)->GetEngineName().c_str(), (*c)->GetFilenamePattern().c_str()); info += wxString::Format("- %s (%s)\n", (*c)->GetEngineName(), (*c)->GetFilenamePattern());
} }
if (ei) { if (ei) {
info += wxString::Format(_("\nScript info:\nName: %s\nDescription: %s\nAuthor: %s\nVersion: %s\nFull path: %s\nState: %s\n\nFeatures provided by script:\n"), info += wxString::Format(_("\nScript info:\nName: %s\nDescription: %s\nAuthor: %s\nVersion: %s\nFull path: %s\nState: %s\n\nFeatures provided by script:\n"),
ei->script->GetName().c_str(), ei->script->GetName(),
ei->script->GetDescription().c_str(), ei->script->GetDescription(),
ei->script->GetAuthor().c_str(), ei->script->GetAuthor(),
ei->script->GetVersion().c_str(), ei->script->GetVersion(),
ei->script->GetFilename().c_str(), ei->script->GetFilename(),
ei->script->GetLoadedState() ? _("Correctly loaded") : _("Failed to load")); ei->script->GetLoadedState() ? _("Correctly loaded") : _("Failed to load"));
for (std::vector<Automation4::Feature*>::iterator f = ei->script->GetFeatures().begin(); f != ei->script->GetFeatures().end(); ++f) { for (std::vector<Automation4::Feature*>::iterator f = ei->script->GetFeatures().begin(); f != ei->script->GetFeatures().end(); ++f) {
switch ((*f)->GetClass()) { switch ((*f)->GetClass()) {

View File

@ -536,7 +536,7 @@ bool FontsCollectorThread::ProcessFont(wxString name) {
int action = collector->CollectAction->GetSelection(); int action = collector->CollectAction->GetSelection();
// Font name // Font name
AppendText(wxString::Format(_T("\"%s\"... "),name.c_str())); AppendText(wxString::Format("\"%s\"... ", name));
// Get font list // Get font list
wxArrayString files = FontFileLister::GetFilesWithFace(name); wxArrayString files = FontFileLister::GetFilesWithFace(name);
@ -565,14 +565,14 @@ bool FontsCollectorThread::ProcessFont(wxString name) {
} }
if (tempResult == 1) { if (tempResult == 1) {
AppendText(wxString::Format(_("* Copied %s.\n"),files[i].c_str()),1); AppendText(wxString::Format(_("* Copied %s.\n"),files[i]),1);
} }
else if (tempResult == 2) { else if (tempResult == 2) {
wxFileName fn(files[i]); wxFileName fn(files[i]);
AppendText(wxString::Format(_("* %s already exists on destination.\n"),fn.GetFullName().c_str()),3); AppendText(wxString::Format(_("* %s already exists on destination.\n"),fn.GetFullName()),3);
} }
else { else {
AppendText(wxString::Format(_("* Failed to copy %s.\n"),files[i].c_str()),2); AppendText(wxString::Format(_("* Failed to copy %s.\n"),files[i]),2);
result = false; result = false;
} }
} }
@ -662,9 +662,9 @@ void FontsCollectorThread::AddFont(wxString fontname,int mode) {
if (fonts.Index(fontname) == wxNOT_FOUND) { if (fonts.Index(fontname) == wxNOT_FOUND) {
fonts.Add(fontname); fonts.Add(fontname);
if (mode == 0) AppendText(wxString::Format(_("\"%s\" found on style \"%s\".\n"), fontname.c_str(), curStyle->name.c_str())); if (mode == 0) AppendText(wxString::Format(_("\"%s\" found on style \"%s\".\n"), fontname, curStyle->name));
else if (mode == 1) AppendText(wxString::Format(_("\"%s\" found on dialogue line \"%d\".\n"), fontname.c_str(), curLine)); else if (mode == 1) AppendText(wxString::Format(_("\"%s\" found on dialogue line \"%d\".\n"), fontname, curLine));
else AppendText(wxString::Format(_("\"%s\" found.\n"), fontname.c_str())); else AppendText(wxString::Format(_("\"%s\" found.\n"), fontname));
} }
} }

View File

@ -510,7 +510,7 @@ wxString KaraokeLineMatchDisplay::GetOutputLine()
for (size_t i = 0; i < matched_groups.size(); ++i) for (size_t i = 0; i < matched_groups.size(); ++i)
{ {
MatchGroup &match = matched_groups[i]; MatchGroup &match = matched_groups[i];
res = wxString::Format("%s{\\k%d}%s", res.c_str(), match.duration, match.dst.c_str()); res = wxString::Format("%s{\\k%d}%s", res, match.duration, match.dst);
} }
return res; return res;

View File

@ -435,7 +435,7 @@ void DialogStyleManager::OnCatalogNew (wxCommandEvent &) {
// Warn about bad characters // Warn about bad characters
if (badchars_removed > 0) { if (badchars_removed > 0) {
wxMessageBox(wxString::Format(_("The specified catalog name contains one or more illegal characters. They have been replaced with underscores instead.\nThe catalog has been renamed to \"%s\"."), name.c_str()),_("Invalid characters")); wxMessageBox(wxString::Format(_("The specified catalog name contains one or more illegal characters. They have been replaced with underscores instead.\nThe catalog has been renamed to \"%s\"."), name),_("Invalid characters"));
} }
// Add to list of storages // Add to list of storages
@ -462,7 +462,7 @@ void DialogStyleManager::OnCatalogDelete (wxCommandEvent &) {
int sel = CatalogList->GetSelection(); int sel = CatalogList->GetSelection();
if (sel != wxNOT_FOUND) { if (sel != wxNOT_FOUND) {
wxString name = CatalogList->GetString(sel); wxString name = CatalogList->GetString(sel);
wxString message = wxString::Format(_("Are you sure you want to delete the storage \"%s\" from the catalog?"), name.c_str()); wxString message = wxString::Format(_("Are you sure you want to delete the storage \"%s\" from the catalog?"), name);
int option = wxMessageBox(message, _("Confirm delete"), wxYES_NO | wxICON_EXCLAMATION , this); int option = wxMessageBox(message, _("Confirm delete"), wxYES_NO | wxICON_EXCLAMATION , this);
if (option == wxYES) { if (option == wxYES) {
wxRemoveFile(StandardPaths::DecodePath("?user/catalog/" + name + ".sty")); wxRemoveFile(StandardPaths::DecodePath("?user/catalog/" + name + ".sty"));
@ -543,7 +543,7 @@ void DialogStyleManager::OnCopyToStorage (wxCommandEvent &) {
for (list<AssStyle *>::iterator style = Store.style.begin(); style != Store.style.end(); ++style) { for (list<AssStyle *>::iterator style = Store.style.begin(); style != Store.style.end(); ++style) {
if ((*style)->name.CmpNoCase(styleName) == 0) { if ((*style)->name.CmpNoCase(styleName) == 0) {
addStyle = false; addStyle = false;
if (wxYES == wxMessageBox(wxString::Format("There is already a style with the name \"%s\" on the current storage. Proceed and overwrite anyway?",styleName.c_str()), "Style name collision.", wxYES_NO)) { if (wxYES == wxMessageBox(wxString::Format("There is already a style with the name \"%s\" on the current storage. Proceed and overwrite anyway?",styleName), "Style name collision.", wxYES_NO)) {
**style = *styleMap.at(selections[i]); **style = *styleMap.at(selections[i]);
copied.push_back(styleName); copied.push_back(styleName);
} }
@ -578,7 +578,7 @@ void DialogStyleManager::OnCopyToCurrent (wxCommandEvent &) {
for (std::vector<AssStyle *>::iterator style = styleMap.begin(); style != styleMap.end(); ++style) { for (std::vector<AssStyle *>::iterator style = styleMap.begin(); style != styleMap.end(); ++style) {
if ((*style)->name.CmpNoCase(styleName) == 0) { if ((*style)->name.CmpNoCase(styleName) == 0) {
addStyle = false; addStyle = false;
if (wxYES == wxMessageBox(wxString::Format("There is already a style with the name \"%s\" on the current script. Proceed and overwrite anyway?",styleName.c_str()), "Style name collision.", wxYES_NO)) { if (wxYES == wxMessageBox(wxString::Format("There is already a style with the name \"%s\" on the current script. Proceed and overwrite anyway?",styleName), "Style name collision.", wxYES_NO)) {
**style = *styleStorageMap.at(selections[i]); **style = *styleStorageMap.at(selections[i]);
copied.push_back(styleName); copied.push_back(styleName);
} }
@ -879,7 +879,7 @@ void DialogStyleManager::OnCurrentImport(wxCommandEvent &) {
// Check if there is already a style with that name // Check if there is already a style with that name
int test = CurrentList->FindString(styles[selections[i]], false); int test = CurrentList->FindString(styles[selections[i]], false);
if (test != wxNOT_FOUND) { if (test != wxNOT_FOUND) {
int answer = wxMessageBox(wxString::Format("There is already a style with the name \"%s\" on the current script. Overwrite?",styles[selections[i]].c_str()),"Style name collision.",wxYES_NO); int answer = wxMessageBox(wxString::Format("There is already a style with the name \"%s\" on the current script. Overwrite?",styles[selections[i]]),"Style name collision.",wxYES_NO);
if (answer == wxYES) { if (answer == wxYES) {
// Overwrite // Overwrite
modified = true; modified = true;

View File

@ -342,7 +342,7 @@ void AegisubVersionCheckerThread::DoCheck()
GetSVNRevision(), GetSVNRevision(),
GetIsOfficialRelease()?1:0, GetIsOfficialRelease()?1:0,
GetOSShortName(), GetOSShortName(),
GetSystemLanguage().c_str()); GetSystemLanguage());
wxString path = base_updates_path + querystring; wxString path = base_updates_path + querystring;

View File

@ -159,12 +159,12 @@ int FFmpegSourceProvider::AskForTrackSelection(const std::map<int,wxString> &Tra
TypeName = _("audio"); TypeName = _("audio");
for (std::map<int,wxString>::const_iterator i = TrackList.begin(); i != TrackList.end(); i++) { for (std::map<int,wxString>::const_iterator i = TrackList.begin(); i != TrackList.end(); i++) {
Choices.Add(wxString::Format(_("Track %02d: %s"), i->first, i->second.c_str())); Choices.Add(wxString::Format(_("Track %02d: %s"), i->first, i->second));
TrackNumbers.push_back(i->first); TrackNumbers.push_back(i->first);
} }
int Choice = wxGetSingleChoiceIndex(wxString::Format(_("Multiple %s tracks detected, please choose the one you wish to load:"), TypeName.c_str()), int Choice = wxGetSingleChoiceIndex(wxString::Format(_("Multiple %s tracks detected, please choose the one you wish to load:"), TypeName),
wxString::Format(_("Choose %s track"), TypeName.c_str()), Choices); wxString::Format(_("Choose %s track"), TypeName), Choices);
if (Choice < 0) if (Choice < 0)
return Choice; return Choice;
@ -301,7 +301,7 @@ wxThread::ExitCode FFmpegSourceCacheCleaner::Entry() {
wxString cachedirname = StandardPaths::DecodePath("?user/ffms2cache/"); wxString cachedirname = StandardPaths::DecodePath("?user/ffms2cache/");
wxDir cachedir; wxDir cachedir;
if (!cachedir.Open(cachedirname)) { if (!cachedir.Open(cachedirname)) {
LOG_D("provider/ffmpegsource/cache") << "couldn't open cache directory " << cachedirname.c_str(); LOG_D("provider/ffmpegsource/cache") << "couldn't open cache directory " << STD_STR(cachedirname);
return (wxThread::ExitCode)1; return (wxThread::ExitCode)1;
} }
@ -360,7 +360,7 @@ wxThread::ExitCode FFmpegSourceCacheCleaner::Entry() {
int64_t fsize = i->second.GetSize().GetValue(); int64_t fsize = i->second.GetSize().GetValue();
if (!wxRemoveFile(i->second.GetFullPath())) { if (!wxRemoveFile(i->second.GetFullPath())) {
LOG_D("provider/ffmpegsource/cache") << "failed to remove file " << i->second.GetFullPath().c_str(); LOG_D("provider/ffmpegsource/cache") << "failed to remove file " << STD_STR(i->second.GetFullPath());
continue; continue;
} }
cursize -= fsize; cursize -= fsize;

View File

@ -752,7 +752,7 @@ void FrameMain::OnSubtitlesOpen() {
basepath = ""; basepath = "";
} else { } else {
wxLogWarning("Automation Script referenced with unknown location specifier character.\nLocation specifier found: %s\nFilename specified: %s", wxLogWarning("Automation Script referenced with unknown location specifier character.\nLocation specifier found: %s\nFilename specified: %s",
sfnamel.c_str(), sfnames.c_str()); sfnamel, sfnames);
continue; continue;
} }
wxFileName sfname(sfnames); wxFileName sfname(sfnames);
@ -762,7 +762,7 @@ void FrameMain::OnSubtitlesOpen() {
context->local_scripts->Add(Automation4::ScriptFactory::CreateFromFile(sfnames, true)); context->local_scripts->Add(Automation4::ScriptFactory::CreateFromFile(sfnames, true));
} else { } else {
wxLogWarning("Automation Script referenced could not be found.\nFilename specified: %s%s\nSearched relative to: %s\nResolved filename: %s", wxLogWarning("Automation Script referenced could not be found.\nFilename specified: %s%s\nSearched relative to: %s\nResolved filename: %s",
sfnamel.c_str(), sfnames.c_str(), basepath.c_str(), sfname.GetFullPath().c_str()); sfnamel, sfnames, basepath, sfname.GetFullPath());
} }
} }
#endif #endif

View File

@ -99,7 +99,7 @@ void HelpButton::OpenPage(const wxString pageID) {
docsPath.Replace("\\","/"); docsPath.Replace("\\","/");
docsPath = "/" + docsPath; docsPath = "/" + docsPath;
#endif #endif
wxString path = wxString::Format("file://%s/%s.html",docsPath.c_str(),page.c_str()); wxString path = wxString::Format("file://%s/%s.html",docsPath,page);
wxLaunchDefaultBrowser(path); wxLaunchDefaultBrowser(path);
} }
} }

View File

@ -378,7 +378,7 @@ static void UnhandledExeception(bool stackWalk) {
#endif #endif
// Inform user of crash. // Inform user of crash.
wxMessageBox(wxString::Format(exception_message, filename.c_str()), _("Program error"), wxOK | wxICON_ERROR, NULL); wxMessageBox(wxString::Format(exception_message, filename), _("Program error"), wxOK | wxICON_ERROR, NULL);
} }
else if (LastStartupState) { else if (LastStartupState) {
#if wxUSE_STACKWALKER == 1 #if wxUSE_STACKWALKER == 1

View File

@ -88,7 +88,7 @@ void MatroskaWrapper::Open(wxString filename,bool parse) {
// Failed parsing // Failed parsing
if (!file) { if (!file) {
delete input; delete input;
throw wxString("MatroskaParser error: " + wxString(err,wxConvUTF8)).c_str(); throw wxString("MatroskaParser error: " + wxString(err,wxConvUTF8));
} }
// Parse // Parse

View File

@ -820,7 +820,7 @@ void SubsTextEditCtrl::OnContextMenu(wxContextMenuEvent &event) {
// Build list // Build list
wxMenu *subMenu = new wxMenu(); wxMenu *subMenu = new wxMenu();
for (int i=0;i<nSugs;i++) subMenu->Append(EDIT_MENU_SUGGESTIONS+i,sugs[i]); for (int i=0;i<nSugs;i++) subMenu->Append(EDIT_MENU_SUGGESTIONS+i,sugs[i]);
menu.Append(-1,wxString::Format(_("Spell checker suggestions for \"%s\""),currentWord.c_str()), subMenu); menu.Append(-1,wxString::Format(_("Spell checker suggestions for \"%s\""),currentWord), subMenu);
} }
} }

View File

@ -291,7 +291,7 @@ SubtitleFormat::FPSRational SubtitleFormat::AskForFPS(bool showSMPTE) {
wxString vidFPS; wxString vidFPS;
if (context->FPS().IsVFR()) vidFPS = "VFR"; if (context->FPS().IsVFR()) vidFPS = "VFR";
else vidFPS = wxString::Format("%.3f",context->FPS().FPS()); else vidFPS = wxString::Format("%.3f",context->FPS().FPS());
choices.Add(wxString::Format("From video (%s)",vidFPS.c_str())); choices.Add(wxString::Format("From video (%s)",vidFPS));
} }
// Standard FPS values // Standard FPS values

View File

@ -105,7 +105,7 @@ void EncoreSubtitleFormat::WriteFile(wxString _filename,wxString encoding) {
AssDialogue *current = dynamic_cast<AssDialogue*>(*cur); AssDialogue *current = dynamic_cast<AssDialogue*>(*cur);
if (current && !current->Comment) { if (current && !current->Comment) {
++i; ++i;
file.WriteLineToFile(wxString::Format("%i %s %s %s", i, ft.FromAssTime(current->Start).c_str(), ft.FromAssTime(current->End).c_str(), current->Text.c_str())); file.WriteLineToFile(wxString::Format("%i %s %s %s", i, ft.FromAssTime(current->Start), ft.FromAssTime(current->End), current->Text));
} }
} }

View File

@ -174,7 +174,7 @@ void MicroDVDSubtitleFormat::WriteFile(wxString filename,wxString encoding) {
int start = rate->FrameAtTime(current->Start.GetMS(),agi::vfr::START); int start = rate->FrameAtTime(current->Start.GetMS(),agi::vfr::START);
int end = rate->FrameAtTime(current->End.GetMS(),agi::vfr::END); int end = rate->FrameAtTime(current->End.GetMS(),agi::vfr::END);
file.WriteLineToFile(wxString::Format("{%i}{%i}%s",start,end,current->Text.c_str())); file.WriteLineToFile(wxString::Format("{%i}{%i}%s",start,end,current->Text));
} }
} }

View File

@ -57,7 +57,7 @@ TextFileWriter::TextFileWriter(wxString const& filename, wxString encoding)
, conv() { , conv() {
if (encoding.empty()) encoding = lagi_wxString(OPT_GET("App/Save Charset")->GetString()); if (encoding.empty()) encoding = lagi_wxString(OPT_GET("App/Save Charset")->GetString());
if (encoding.Lower() != wxSTRING_ENCODING) if (encoding.Lower() != wxSTRING_ENCODING)
conv.reset(new agi::charset::IconvWrapper(wxSTRING_ENCODING, encoding.c_str(), true)); conv.reset(new agi::charset::IconvWrapper(wxSTRING_ENCODING, encoding.utf8_str(), true));
// Write the BOM // Write the BOM
try { try {

View File

@ -437,7 +437,7 @@ void RestartAegisub() {
char *bundle_path = agi::util::OSX_GetBundlePath(); char *bundle_path = agi::util::OSX_GetBundlePath();
char *support_path = agi::util::OSX_GetBundleSupportFilesDirectory(); char *support_path = agi::util::OSX_GetBundleSupportFilesDirectory();
if (!bundle_path || !support_path) return; // oops if (!bundle_path || !support_path) return; // oops
wxString exec = wxString::Format("\"%s/MacOS/restart-helper\" /usr/bin/open -n \"%s\"'", wxString(support_path, wxConvUTF8).c_str(), wxString(bundle_path, wxConvUTF8).c_str()); wxString exec = wxString::Format("\"%s/MacOS/restart-helper\" /usr/bin/open -n \"%s\"'", wxString(support_path, wxConvUTF8), wxString(bundle_path, wxConvUTF8));
LOG_I("util/restart/exec") << exec; LOG_I("util/restart/exec") << exec;
wxExecute(exec); wxExecute(exec);
free(bundle_path); free(bundle_path);

View File

@ -535,7 +535,7 @@ void VideoContext::LoadTimecodes(wxString filename) {
config::mru->Remove("Timecodes", STD_STR(filename)); config::mru->Remove("Timecodes", STD_STR(filename));
} }
catch (const agi::vfr::Error& e) { catch (const agi::vfr::Error& e) {
wxLogError("Timecode file parse error: %s", e.GetMessage().c_str()); wxLogError("Timecode file parse error: %s", e.GetMessage());
} }
} }
void VideoContext::SaveTimecodes(wxString filename) { void VideoContext::SaveTimecodes(wxString filename) {
@ -571,12 +571,12 @@ void VideoContext::OnVideoError(VideoProviderErrorEvent const& err) {
wxLogError( wxLogError(
"Failed seeking video. The video file may be corrupt or incomplete.\n" "Failed seeking video. The video file may be corrupt or incomplete.\n"
"Error message reported: %s", "Error message reported: %s",
lagi_wxString(err.GetMessage()).c_str()); lagi_wxString(err.GetMessage()));
} }
void VideoContext::OnSubtitlesError(SubtitlesProviderErrorEvent const& err) { void VideoContext::OnSubtitlesError(SubtitlesProviderErrorEvent const& err) {
wxLogError( wxLogError(
"Failed rendering subtitles. Error message reported: %s", "Failed rendering subtitles. Error message reported: %s",
lagi_wxString(err.GetMessage()).c_str()); lagi_wxString(err.GetMessage()));
} }
void VideoContext::OnExit() { void VideoContext::OnExit() {

View File

@ -191,14 +191,14 @@ void VideoDisplay::UploadFrameData(FrameReadyEvent &evt) {
"Failed to initialize video display. Closing other running " "Failed to initialize video display. Closing other running "
"programs and updating your video card drivers may fix this.\n" "programs and updating your video card drivers may fix this.\n"
"Error message reported: %s", "Error message reported: %s",
err.GetMessage().c_str()); err.GetMessage());
con->videoController->Reset(); con->videoController->Reset();
} }
catch (const VideoOutRenderException& err) { catch (const VideoOutRenderException& err) {
wxLogError( wxLogError(
"Could not upload video frame to graphics card.\n" "Could not upload video frame to graphics card.\n"
"Error message reported: %s", "Error message reported: %s",
err.GetMessage().c_str()); err.GetMessage());
} }
Render(); Render();
} }
@ -258,14 +258,14 @@ catch (const VideoOutException &err) {
wxLogError( wxLogError(
"An error occurred trying to render the video frame on the screen.\n" "An error occurred trying to render the video frame on the screen.\n"
"Error message reported: %s", "Error message reported: %s",
err.GetMessage().c_str()); err.GetMessage());
con->videoController->Reset(); con->videoController->Reset();
} }
catch (const OpenGlException &err) { catch (const OpenGlException &err) {
wxLogError( wxLogError(
"An error occurred trying to render visual overlays on the screen.\n" "An error occurred trying to render visual overlays on the screen.\n"
"Error message reported: %s", "Error message reported: %s",
err.GetMessage().c_str()); err.GetMessage());
con->videoController->Reset(); con->videoController->Reset();
} }
catch (const char *err) { catch (const char *err) {

View File

@ -255,7 +255,7 @@ void YUV4MPEGVideoProvider::ParseFileHeader(const std::vector<wxString>& tags) {
throw VideoOpenError("ParseFileHeader: invalid or unknown interlacing mode"); throw VideoOpenError("ParseFileHeader: invalid or unknown interlacing mode");
} }
else else
LOG_D("provider/video/yuv4mpeg") << "Unparsed tag: " << tags[i].c_str(); LOG_D("provider/video/yuv4mpeg") << "Unparsed tag: " << STD_STR(tags[i]);
} }
// The point of all this is to allow multiple YUV4MPEG2 headers in a single file // The point of all this is to allow multiple YUV4MPEG2 headers in a single file