forked from mia/Aegisub
Fix a bunch of incorrect implicit wxString <-> std::string conversions
The implicit conversion assumes that std::string is encoded in the local charset, while it's always actually UTF-8.
This commit is contained in:
parent
e04c46fd45
commit
426e4593c7
14 changed files with 33 additions and 34 deletions
|
@ -90,7 +90,7 @@ AudioKaraoke::AudioKaraoke(wxWindow *parent, agi::Context *c)
|
|||
SetSizerAndFit(main_sizer);
|
||||
|
||||
/// @todo subscribe
|
||||
split_font.SetFaceName(OPT_GET("Audio/Karaoke/Font Face")->GetString());
|
||||
split_font.SetFaceName(to_wx(OPT_GET("Audio/Karaoke/Font Face")->GetString()));
|
||||
split_font.SetPointSize(OPT_GET("Audio/Karaoke/Font Size")->GetInt());
|
||||
|
||||
split_area->Bind(wxEVT_SIZE, &AudioKaraoke::OnSize, this);
|
||||
|
|
|
@ -498,7 +498,7 @@ namespace Automation4 {
|
|||
catch (agi::Exception const& e) {
|
||||
Destroy();
|
||||
name = GetPrettyFilename();
|
||||
description = e.GetChainedMessage();
|
||||
description = to_wx(e.GetChainedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ wxString GetEncoding(wxString const& filename) {
|
|||
if (list.size() == 1) {
|
||||
auto charset = list.begin();
|
||||
LOG_I("charset/file") << filename << " (" << charset->second << ")";
|
||||
return charset->second;
|
||||
return to_wx(charset->second);
|
||||
}
|
||||
|
||||
wxArrayString choices;
|
||||
|
|
|
@ -34,22 +34,27 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <wx/button.h>
|
||||
#include <wx/filedlg.h>
|
||||
#include <wx/msgdlg.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/tokenzr.h>
|
||||
|
||||
#include "dialog_export.h"
|
||||
|
||||
#include "ass_exporter.h"
|
||||
#include "ass_file.h"
|
||||
#include "compat.h"
|
||||
#include "include/aegisub/context.h"
|
||||
#include "charset_conv.h"
|
||||
#include "help_button.h"
|
||||
#include "libresrc/libresrc.h"
|
||||
#include "subtitle_format.h"
|
||||
|
||||
#include <wx/button.h>
|
||||
#include <wx/checklst.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/filedlg.h>
|
||||
#include <wx/msgdlg.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/tokenzr.h>
|
||||
|
||||
// Swap the items at idx and idx + 1
|
||||
static void swap(wxCheckListBox *list, int idx, int sel_dir) {
|
||||
if (idx < 0 || idx + 1 == (int)list->GetCount()) return;
|
||||
|
@ -65,7 +70,6 @@ static void swap(wxCheckListBox *list, int idx, int sel_dir) {
|
|||
list->Thaw();
|
||||
}
|
||||
|
||||
|
||||
DialogExport::DialogExport(agi::Context *c)
|
||||
: wxDialog(c->parent, -1, _("Export"), wxDefaultPosition, wxSize(200, 100), wxCAPTION | wxCLOSE_BOX)
|
||||
, c(c)
|
||||
|
@ -178,7 +182,7 @@ void DialogExport::OnProcess(wxCommandEvent &) {
|
|||
wxMessageBox(error, "Error exporting subtitles", wxOK | wxICON_ERROR | wxCENTER, this);
|
||||
}
|
||||
catch (agi::Exception const& err) {
|
||||
wxMessageBox(err.GetMessage(), "Error exporting subtitles", wxOK | wxICON_ERROR | wxCENTER, this);
|
||||
wxMessageBox(to_wx(err.GetMessage()), "Error exporting subtitles", wxOK | wxICON_ERROR | wxCENTER, this);
|
||||
}
|
||||
catch (...) {
|
||||
wxMessageBox("Unknown error", "Error exporting subtitles", wxOK | wxICON_ERROR | wxCENTER, this);
|
||||
|
|
|
@ -32,20 +32,16 @@
|
|||
/// @ingroup export
|
||||
///
|
||||
|
||||
#include <map>
|
||||
|
||||
#include <wx/checklst.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/dialog.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/textctrl.h>
|
||||
|
||||
#include <libaegisub/scoped_ptr.h>
|
||||
|
||||
class AssExporter;
|
||||
namespace agi { struct Context; }
|
||||
class wxCheckListBox;
|
||||
class wxChoice;
|
||||
class wxSizer;
|
||||
class wxTextCtrl;
|
||||
|
||||
class DialogExport : public wxDialog {
|
||||
agi::Context *c;
|
||||
|
|
|
@ -277,7 +277,7 @@ bool DialogSpellChecker::CheckLine(AssDialogue *active_line, int start_pos, int
|
|||
}
|
||||
|
||||
text.replace(word_start, word_len, auto_rep->second);
|
||||
active_line->Text = from_wx(text);
|
||||
active_line->Text = to_wx(text);
|
||||
*commit_id = context->ass->Commit(_("spell check replace"), AssFile::COMMIT_DIAG_TEXT, *commit_id);
|
||||
word_start += auto_rep->second.size();
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ void FontCollector::ProcessDialogueLine(const AssDialogue *line, int index) {
|
|||
for (auto& block : blocks) {
|
||||
if (AssDialogueBlockOverride *ovr = dynamic_cast<AssDialogueBlockOverride *>(&block)) {
|
||||
for (auto const& tag : ovr->Tags) {
|
||||
wxString name = tag.Name;
|
||||
std::string const& name = tag.Name;
|
||||
|
||||
if (name == "\\r") {
|
||||
style = styles[tag.Params[0].Get<wxString>(line->Style)];
|
||||
|
@ -77,7 +77,7 @@ void FontCollector::ProcessDialogueLine(const AssDialogue *line, int index) {
|
|||
}
|
||||
}
|
||||
else if (AssDialogueBlockPlain *txt = dynamic_cast<AssDialogueBlockPlain *>(&block)) {
|
||||
wxString text = txt->GetText();
|
||||
wxString text(to_wx(txt->GetText()));
|
||||
|
||||
if (text.empty() || (text.size() >= 2 && text.StartsWith("{") && text.EndsWith("}")))
|
||||
continue;
|
||||
|
|
|
@ -270,7 +270,7 @@ bool AegisubApp::OnInit() {
|
|||
return false;
|
||||
}
|
||||
catch (agi::Exception const& e) {
|
||||
wxMessageBox(e.GetMessage(),"Fatal error while initializing");
|
||||
wxMessageBox(to_wx(e.GetMessage()),"Fatal error while initializing");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -268,10 +268,8 @@ class CommandRenderer : public wxDataViewCustomRenderer {
|
|||
public:
|
||||
CommandRenderer()
|
||||
: wxDataViewCustomRenderer("wxDataViewIconText", wxDATAVIEW_CELL_EDITABLE)
|
||||
, autocomplete(to_wx(cmd::get_registered_commands()))
|
||||
{
|
||||
std::vector<std::string> cmd_names = cmd::get_registered_commands();
|
||||
autocomplete.reserve(cmd_names.size());
|
||||
copy(cmd_names.begin(), cmd_names.end(), std::back_inserter(autocomplete));
|
||||
}
|
||||
|
||||
wxWindow *CreateEditorCtrl(wxWindow *parent, wxRect label_rect, wxVariant const& value) {
|
||||
|
|
|
@ -218,7 +218,7 @@ void OptionPage::OptionBrowse(wxFlexGridSizer *flex, const wxString &name, const
|
|||
if (opt->GetType() != agi::OptionValue::Type_String)
|
||||
throw PreferenceIncorrectType("Option must be agi::OptionValue::Type_String for BrowseButton.");
|
||||
|
||||
wxTextCtrl *text = new wxTextCtrl(this, -1 , opt->GetString());
|
||||
wxTextCtrl *text = new wxTextCtrl(this, -1 , to_wx(opt->GetString()));
|
||||
text->SetMinSize(wxSize(160, -1));
|
||||
text->Bind(wxEVT_COMMAND_TEXT_UPDATED, StringUpdater(opt_name, parent));
|
||||
|
||||
|
@ -250,7 +250,7 @@ void OptionPage::OptionFont(wxSizer *sizer, std::string opt_prefix) {
|
|||
parent->AddChangeableOption(face_opt->GetName());
|
||||
parent->AddChangeableOption(size_opt->GetName());
|
||||
|
||||
wxTextCtrl *font_name = new wxTextCtrl(this, -1, face_opt->GetString());
|
||||
wxTextCtrl *font_name = new wxTextCtrl(this, -1, to_wx(face_opt->GetString()));
|
||||
font_name->SetMinSize(wxSize(160, -1));
|
||||
font_name->Bind(wxEVT_COMMAND_TEXT_UPDATED, StringUpdater(face_opt->GetName().c_str(), parent));
|
||||
|
||||
|
|
|
@ -443,7 +443,7 @@ void SubsTextEditCtrl::OnUseSuggestion(wxCommandEvent &event) {
|
|||
std::string suggestion;
|
||||
int sugIdx = event.GetId() - EDIT_MENU_THESAURUS_SUGS;
|
||||
if (sugIdx >= 0)
|
||||
suggestion = from_wx(thesSugs[sugIdx]);
|
||||
suggestion = thesSugs[sugIdx];
|
||||
else
|
||||
suggestion = sugs[event.GetId() - EDIT_MENU_SUGGESTIONS];
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "include/aegisub/toolbar.h"
|
||||
|
||||
#include "command/command.h"
|
||||
#include "compat.h"
|
||||
#include "include/aegisub/context.h"
|
||||
#include "include/aegisub/hotkey.h"
|
||||
#include "libresrc/libresrc.h"
|
||||
|
@ -156,7 +157,7 @@ namespace {
|
|||
|
||||
std::vector<std::string> hotkeys = hotkey::get_hotkey_strs(ht_context, command->name());
|
||||
if (!hotkeys.empty())
|
||||
ret += " (" + boost::join(hotkeys, "/") + ")";
|
||||
ret += to_wx(" (" + boost::join(hotkeys, "/") + ")");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -36,13 +36,13 @@
|
|||
|
||||
#include "tooltip_manager.h"
|
||||
|
||||
#include "compat.h"
|
||||
#include "include/aegisub/hotkey.h"
|
||||
|
||||
#include <libaegisub/hotkey.h>
|
||||
|
||||
#include <wx/window.h>
|
||||
|
||||
#include <wx/weakref.h>
|
||||
#include <wx/window.h>
|
||||
|
||||
struct ToolTipBinding {
|
||||
wxWeakRef<wxWindow> window;
|
||||
|
@ -96,6 +96,6 @@ void ToolTipBinding::Update() {
|
|||
window->SetToolTip(toolTip);
|
||||
}
|
||||
else {
|
||||
window->SetToolTip(toolTip + " (" + str + ")");
|
||||
window->SetToolTip(toolTip + to_wx(" (" + str + ")"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -420,7 +420,7 @@ void VideoContext::LoadKeyframes(wxString filename) {
|
|||
config::mru->Add("Keyframes", from_wx(filename));
|
||||
}
|
||||
catch (agi::keyframe::Error const& err) {
|
||||
wxMessageBox(err.GetMessage(), "Error opening keyframes file", wxOK | wxICON_ERROR | wxCENTER, context->parent);
|
||||
wxMessageBox(to_wx(err.GetMessage()), "Error opening keyframes file", wxOK | wxICON_ERROR | wxCENTER, context->parent);
|
||||
config::mru->Remove("Keyframes", from_wx(filename));
|
||||
}
|
||||
catch (agi::FileSystemError const&) {
|
||||
|
|
Loading…
Reference in a new issue