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);
|
SetSizerAndFit(main_sizer);
|
||||||
|
|
||||||
/// @todo subscribe
|
/// @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_font.SetPointSize(OPT_GET("Audio/Karaoke/Font Size")->GetInt());
|
||||||
|
|
||||||
split_area->Bind(wxEVT_SIZE, &AudioKaraoke::OnSize, this);
|
split_area->Bind(wxEVT_SIZE, &AudioKaraoke::OnSize, this);
|
||||||
|
|
|
@ -498,7 +498,7 @@ namespace Automation4 {
|
||||||
catch (agi::Exception const& e) {
|
catch (agi::Exception const& e) {
|
||||||
Destroy();
|
Destroy();
|
||||||
name = GetPrettyFilename();
|
name = GetPrettyFilename();
|
||||||
description = e.GetChainedMessage();
|
description = to_wx(e.GetChainedMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ wxString GetEncoding(wxString const& filename) {
|
||||||
if (list.size() == 1) {
|
if (list.size() == 1) {
|
||||||
auto charset = list.begin();
|
auto charset = list.begin();
|
||||||
LOG_I("charset/file") << filename << " (" << charset->second << ")";
|
LOG_I("charset/file") << filename << " (" << charset->second << ")";
|
||||||
return charset->second;
|
return to_wx(charset->second);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxArrayString choices;
|
wxArrayString choices;
|
||||||
|
|
|
@ -34,22 +34,27 @@
|
||||||
|
|
||||||
#include "config.h"
|
#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 "dialog_export.h"
|
||||||
|
|
||||||
#include "ass_exporter.h"
|
#include "ass_exporter.h"
|
||||||
#include "ass_file.h"
|
#include "ass_file.h"
|
||||||
|
#include "compat.h"
|
||||||
#include "include/aegisub/context.h"
|
#include "include/aegisub/context.h"
|
||||||
#include "charset_conv.h"
|
#include "charset_conv.h"
|
||||||
#include "help_button.h"
|
#include "help_button.h"
|
||||||
#include "libresrc/libresrc.h"
|
#include "libresrc/libresrc.h"
|
||||||
#include "subtitle_format.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
|
// Swap the items at idx and idx + 1
|
||||||
static void swap(wxCheckListBox *list, int idx, int sel_dir) {
|
static void swap(wxCheckListBox *list, int idx, int sel_dir) {
|
||||||
if (idx < 0 || idx + 1 == (int)list->GetCount()) return;
|
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();
|
list->Thaw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DialogExport::DialogExport(agi::Context *c)
|
DialogExport::DialogExport(agi::Context *c)
|
||||||
: wxDialog(c->parent, -1, _("Export"), wxDefaultPosition, wxSize(200, 100), wxCAPTION | wxCLOSE_BOX)
|
: wxDialog(c->parent, -1, _("Export"), wxDefaultPosition, wxSize(200, 100), wxCAPTION | wxCLOSE_BOX)
|
||||||
, c(c)
|
, c(c)
|
||||||
|
@ -178,7 +182,7 @@ void DialogExport::OnProcess(wxCommandEvent &) {
|
||||||
wxMessageBox(error, "Error exporting subtitles", wxOK | wxICON_ERROR | wxCENTER, this);
|
wxMessageBox(error, "Error exporting subtitles", wxOK | wxICON_ERROR | wxCENTER, this);
|
||||||
}
|
}
|
||||||
catch (agi::Exception const& err) {
|
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 (...) {
|
catch (...) {
|
||||||
wxMessageBox("Unknown error", "Error exporting subtitles", wxOK | wxICON_ERROR | wxCENTER, this);
|
wxMessageBox("Unknown error", "Error exporting subtitles", wxOK | wxICON_ERROR | wxCENTER, this);
|
||||||
|
|
|
@ -32,20 +32,16 @@
|
||||||
/// @ingroup export
|
/// @ingroup export
|
||||||
///
|
///
|
||||||
|
|
||||||
#include <map>
|
|
||||||
|
|
||||||
#include <wx/checklst.h>
|
|
||||||
#include <wx/choice.h>
|
|
||||||
#include <wx/dialog.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>
|
#include <libaegisub/scoped_ptr.h>
|
||||||
|
|
||||||
class AssExporter;
|
class AssExporter;
|
||||||
namespace agi { struct Context; }
|
namespace agi { struct Context; }
|
||||||
|
class wxCheckListBox;
|
||||||
|
class wxChoice;
|
||||||
|
class wxSizer;
|
||||||
|
class wxTextCtrl;
|
||||||
|
|
||||||
class DialogExport : public wxDialog {
|
class DialogExport : public wxDialog {
|
||||||
agi::Context *c;
|
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);
|
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);
|
*commit_id = context->ass->Commit(_("spell check replace"), AssFile::COMMIT_DIAG_TEXT, *commit_id);
|
||||||
word_start += auto_rep->second.size();
|
word_start += auto_rep->second.size();
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ void FontCollector::ProcessDialogueLine(const AssDialogue *line, int index) {
|
||||||
for (auto& block : blocks) {
|
for (auto& block : blocks) {
|
||||||
if (AssDialogueBlockOverride *ovr = dynamic_cast<AssDialogueBlockOverride *>(&block)) {
|
if (AssDialogueBlockOverride *ovr = dynamic_cast<AssDialogueBlockOverride *>(&block)) {
|
||||||
for (auto const& tag : ovr->Tags) {
|
for (auto const& tag : ovr->Tags) {
|
||||||
wxString name = tag.Name;
|
std::string const& name = tag.Name;
|
||||||
|
|
||||||
if (name == "\\r") {
|
if (name == "\\r") {
|
||||||
style = styles[tag.Params[0].Get<wxString>(line->Style)];
|
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)) {
|
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("}")))
|
if (text.empty() || (text.size() >= 2 && text.StartsWith("{") && text.EndsWith("}")))
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -270,7 +270,7 @@ bool AegisubApp::OnInit() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
catch (agi::Exception const& e) {
|
catch (agi::Exception const& e) {
|
||||||
wxMessageBox(e.GetMessage(),"Fatal error while initializing");
|
wxMessageBox(to_wx(e.GetMessage()),"Fatal error while initializing");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -268,10 +268,8 @@ class CommandRenderer : public wxDataViewCustomRenderer {
|
||||||
public:
|
public:
|
||||||
CommandRenderer()
|
CommandRenderer()
|
||||||
: wxDataViewCustomRenderer("wxDataViewIconText", wxDATAVIEW_CELL_EDITABLE)
|
: 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) {
|
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)
|
if (opt->GetType() != agi::OptionValue::Type_String)
|
||||||
throw PreferenceIncorrectType("Option must be agi::OptionValue::Type_String for BrowseButton.");
|
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->SetMinSize(wxSize(160, -1));
|
||||||
text->Bind(wxEVT_COMMAND_TEXT_UPDATED, StringUpdater(opt_name, parent));
|
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(face_opt->GetName());
|
||||||
parent->AddChangeableOption(size_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->SetMinSize(wxSize(160, -1));
|
||||||
font_name->Bind(wxEVT_COMMAND_TEXT_UPDATED, StringUpdater(face_opt->GetName().c_str(), parent));
|
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;
|
std::string suggestion;
|
||||||
int sugIdx = event.GetId() - EDIT_MENU_THESAURUS_SUGS;
|
int sugIdx = event.GetId() - EDIT_MENU_THESAURUS_SUGS;
|
||||||
if (sugIdx >= 0)
|
if (sugIdx >= 0)
|
||||||
suggestion = from_wx(thesSugs[sugIdx]);
|
suggestion = thesSugs[sugIdx];
|
||||||
else
|
else
|
||||||
suggestion = sugs[event.GetId() - EDIT_MENU_SUGGESTIONS];
|
suggestion = sugs[event.GetId() - EDIT_MENU_SUGGESTIONS];
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "include/aegisub/toolbar.h"
|
#include "include/aegisub/toolbar.h"
|
||||||
|
|
||||||
#include "command/command.h"
|
#include "command/command.h"
|
||||||
|
#include "compat.h"
|
||||||
#include "include/aegisub/context.h"
|
#include "include/aegisub/context.h"
|
||||||
#include "include/aegisub/hotkey.h"
|
#include "include/aegisub/hotkey.h"
|
||||||
#include "libresrc/libresrc.h"
|
#include "libresrc/libresrc.h"
|
||||||
|
@ -156,7 +157,7 @@ namespace {
|
||||||
|
|
||||||
std::vector<std::string> hotkeys = hotkey::get_hotkey_strs(ht_context, command->name());
|
std::vector<std::string> hotkeys = hotkey::get_hotkey_strs(ht_context, command->name());
|
||||||
if (!hotkeys.empty())
|
if (!hotkeys.empty())
|
||||||
ret += " (" + boost::join(hotkeys, "/") + ")";
|
ret += to_wx(" (" + boost::join(hotkeys, "/") + ")");
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,13 +36,13 @@
|
||||||
|
|
||||||
#include "tooltip_manager.h"
|
#include "tooltip_manager.h"
|
||||||
|
|
||||||
|
#include "compat.h"
|
||||||
#include "include/aegisub/hotkey.h"
|
#include "include/aegisub/hotkey.h"
|
||||||
|
|
||||||
#include <libaegisub/hotkey.h>
|
#include <libaegisub/hotkey.h>
|
||||||
|
|
||||||
#include <wx/window.h>
|
|
||||||
|
|
||||||
#include <wx/weakref.h>
|
#include <wx/weakref.h>
|
||||||
|
#include <wx/window.h>
|
||||||
|
|
||||||
struct ToolTipBinding {
|
struct ToolTipBinding {
|
||||||
wxWeakRef<wxWindow> window;
|
wxWeakRef<wxWindow> window;
|
||||||
|
@ -96,6 +96,6 @@ void ToolTipBinding::Update() {
|
||||||
window->SetToolTip(toolTip);
|
window->SetToolTip(toolTip);
|
||||||
}
|
}
|
||||||
else {
|
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));
|
config::mru->Add("Keyframes", from_wx(filename));
|
||||||
}
|
}
|
||||||
catch (agi::keyframe::Error const& err) {
|
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));
|
config::mru->Remove("Keyframes", from_wx(filename));
|
||||||
}
|
}
|
||||||
catch (agi::FileSystemError const&) {
|
catch (agi::FileSystemError const&) {
|
||||||
|
|
Loading…
Reference in a new issue