From 352e572492352f514fbc5dec113f6217025a8884 Mon Sep 17 00:00:00 2001 From: ousnius Date: Mon, 16 Apr 2018 21:00:20 +0200 Subject: [PATCH] Unicode fixes for shapes, sliders and more Fixes #178 as well. --- src/program/BodySlideApp.cpp | 103 ++++++++++++++++++---------------- src/program/BodySlideApp.h | 2 +- src/program/OutfitProject.cpp | 8 +-- src/program/OutfitStudio.cpp | 67 ++++++++++++---------- 4 files changed, 97 insertions(+), 83 deletions(-) diff --git a/src/program/BodySlideApp.cpp b/src/program/BodySlideApp.cpp index 7a7c743f..fb2c125d 100644 --- a/src/program/BodySlideApp.cpp +++ b/src/program/BodySlideApp.cpp @@ -1833,7 +1833,7 @@ int BodySlideApp::BuildListBodies(std::vector& outfitList, std::map for (auto &file : filePath.second) { // Only if it's going to be batch built if (find(outfitList.begin(), outfitList.end(), file) != outfitList.end()) - selFilePaths.Add(file); + selFilePaths.Add(wxString::FromUTF8(file)); } // Same file would not be written more than once @@ -1877,7 +1877,7 @@ int BodySlideApp::BuildListBodies(std::vector& outfitList, std::map choicesList[i].Remove(choiceBoxes[i]->GetStringSelection()); for (auto &file : choicesList[i]) { - auto result = find(outfitList.begin(), outfitList.end(), file); + auto result = find(outfitList.begin(), outfitList.end(), file.ToUTF8()); if (result != outfitList.end()) outfitList.erase(result); } @@ -2222,8 +2222,9 @@ void BodySlideApp::GroupBuild(const std::string& group) { else if (ret == 3) { wxArrayString errlist; for (auto &e : failedOutfits) { - wxLogError("Failed to build '%s': %s", e.first, e.second); - errlist.Add(e.first + ":" + e.second); + wxString ename = wxString::FromUTF8(e.first); + wxLogError("Failed to build '%s': %s", ename, e.second); + errlist.Add(ename + ":" + e.second); } wxSingleChoiceDialog errdisplay(sliderView, _("The following sets failed"), _("Failed"), errlist, nullptr, wxDEFAULT_DIALOG_STYLE | wxOK | wxRESIZE_BORDER); @@ -2448,7 +2449,7 @@ void BodySlideFrame::AddCategorySliderUI(const wxString& name, bool show, bool o scrollWindow->FitInside(); } -void BodySlideFrame::AddSliderGUI(const wxString& name, const wxString& displayName, bool isZap, bool oneSize) { +void BodySlideFrame::AddSliderGUI(const std::string& name, const std::string& display, bool isZap, bool oneSize) { wxScrolledWindow* scrollWindow = (wxScrolledWindow*)FindWindowByName("SliderScrollWindow", this); if (!scrollWindow) return; @@ -2457,7 +2458,10 @@ void BodySlideFrame::AddSliderGUI(const wxString& name, const wxString& displayN if (!sliderLayout) return; - BodySlideFrame::SliderDisplay* sd = new BodySlideFrame::SliderDisplay; + wxString sliderName = wxString::FromUTF8(name); + wxString displayName = wxString::FromUTF8(display); + + auto sd = new SliderDisplay(); sd->isZap = isZap; sd->oneSize = oneSize; @@ -2470,7 +2474,7 @@ void BodySlideFrame::AddSliderGUI(const wxString& name, const wxString& displayN sliderLayout->Add(sd->lblSliderLo, 0, wxLEFT | wxALIGN_CENTER, 5); if (isZap) { - sd->zapCheckLo = new wxCheckBox(scrollWindow, wxID_ANY, " ", wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, name + "|ZLO"); + sd->zapCheckLo = new wxCheckBox(scrollWindow, wxID_ANY, " ", wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, sliderName + "|ZLO"); sd->zapCheckLo->Bind(wxEVT_CHECKBOX, &BodySlideFrame::OnZapCheckChanged, this); sliderLayout->AddStretchSpacer(); sliderLayout->Add(sd->zapCheckLo, 0, wxALIGN_LEFT, 0); @@ -2479,11 +2483,11 @@ void BodySlideFrame::AddSliderGUI(const wxString& name, const wxString& displayN sd->sliderLo = new wxSlider(scrollWindow, wxID_ANY, 0, minValue, maxValue, wxDefaultPosition, wxSize(-1, 24), wxSL_AUTOTICKS | wxSL_BOTTOM | wxSL_HORIZONTAL); sd->sliderLo->SetTickFreq(5); sd->sliderLo->Bind(wxEVT_ERASE_BACKGROUND, &BodySlideFrame::OnEraseBackground, this); - sd->sliderLo->SetName(name + "|LO"); + sd->sliderLo->SetName(sliderName + "|LO"); sliderLayout->Add(sd->sliderLo, 1, wxEXPAND, 0); sd->sliderReadoutLo = new wxTextCtrl(scrollWindow, wxID_ANY, "0%", wxDefaultPosition, wxSize(50, -1), wxTE_CENTRE | wxNO_BORDER | wxTE_PROCESS_ENTER); - sd->sliderReadoutLo->SetName(name + "|RLO"); + sd->sliderReadoutLo->SetName(sliderName + "|RLO"); sd->sliderReadoutLo->Connect(wxEVT_KILL_FOCUS, wxCommandEventHandler(BodySlideFrame::OnSliderReadoutChange), nullptr, this); sliderLayout->Add(sd->sliderReadoutLo, 0, wxALL | wxALIGN_CENTER, 0); } @@ -2494,7 +2498,7 @@ void BodySlideFrame::AddSliderGUI(const wxString& name, const wxString& displayN sliderLayout->Add(sd->lblSliderHi, 0, wxLEFT | wxALIGN_CENTER, 5); if (isZap) { - sd->zapCheckHi = new wxCheckBox(scrollWindow, wxID_ANY, " ", wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, name + "|ZHI"); + sd->zapCheckHi = new wxCheckBox(scrollWindow, wxID_ANY, " ", wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, sliderName + "|ZHI"); sd->zapCheckHi->Bind(wxEVT_CHECKBOX, &BodySlideFrame::OnZapCheckChanged, this); sliderLayout->AddStretchSpacer(); sliderLayout->Add(sd->zapCheckHi, 0, wxALIGN_LEFT, 0); @@ -2503,11 +2507,11 @@ void BodySlideFrame::AddSliderGUI(const wxString& name, const wxString& displayN sd->sliderHi = new wxSlider(scrollWindow, wxID_ANY, 0, minValue, maxValue, wxDefaultPosition, wxSize(-1, 24), wxSL_AUTOTICKS | wxSL_HORIZONTAL); sd->sliderHi->SetTickFreq(5); sd->sliderHi->Bind(wxEVT_ERASE_BACKGROUND, &BodySlideFrame::OnEraseBackground, this); - sd->sliderHi->SetName(name + "|HI"); + sd->sliderHi->SetName(sliderName + "|HI"); sliderLayout->Add(sd->sliderHi, 1, wxEXPAND, 0); sd->sliderReadoutHi = new wxTextCtrl(scrollWindow, wxID_ANY, "0%", wxDefaultPosition, wxSize(50, -1), wxTE_CENTRE | wxNO_BORDER | wxTE_PROCESS_ENTER); - sd->sliderReadoutHi->SetName(name + "|RHI"); + sd->sliderReadoutHi->SetName(sliderName + "|RHI"); sd->sliderReadoutHi->Connect(wxEVT_KILL_FOCUS, wxCommandEventHandler(BodySlideFrame::OnSliderReadoutChange), nullptr, this); sliderLayout->Add(sd->sliderReadoutHi, 0, wxRIGHT | wxALIGN_CENTER, 10); } @@ -2763,30 +2767,33 @@ void BodySlideFrame::OnZapCheckChanged(wxCommandEvent& event) { std::string sliderName = sn.ToUTF8(); wxLogMessage("Zap '%s' %s.", sn, event.IsChecked() ? "checked" : "unchecked"); - if (event.IsChecked()) { - if (sliderDisplays[sliderName]->oneSize) { - app->SetSliderValue(sn, false, 1.0f); - } - else { - app->SetSliderValue(sn, true, 1.0f); - app->SetSliderValue(sn, false, 1.0f); - if (isLo) - sliderDisplays[sliderName]->zapCheckHi->SetValue(true); - else - sliderDisplays[sliderName]->zapCheckLo->SetValue(true); - } - } - else { - if (sliderDisplays[sliderName]->oneSize) { - app->SetSliderValue(sn, false, 0.0f); + SliderDisplay* slider = GetSliderDisplay(sliderName); + if (slider) { + if (event.IsChecked()) { + if (slider->oneSize) { + app->SetSliderValue(sn, false, 1.0f); + } + else { + app->SetSliderValue(sn, true, 1.0f); + app->SetSliderValue(sn, false, 1.0f); + if (isLo) + slider->zapCheckHi->SetValue(true); + else + slider->zapCheckLo->SetValue(true); + } } else { - app->SetSliderValue(sn, true, 0.0f); - app->SetSliderValue(sn, false, 0.0f); - if (isLo) - sliderDisplays[sliderName]->zapCheckHi->SetValue(false); - else - sliderDisplays[sliderName]->zapCheckLo->SetValue(false); + if (slider->oneSize) { + app->SetSliderValue(sn, false, 0.0f); + } + else { + app->SetSliderValue(sn, true, 0.0f); + app->SetSliderValue(sn, false, 0.0f); + if (isLo) + slider->zapCheckHi->SetValue(false); + else + slider->zapCheckLo->SetValue(false); + } } } @@ -2801,7 +2808,7 @@ void BodySlideFrame::OnZapCheckChanged(wxCommandEvent& event) { app->SetSliderChanged(toggle, true); app->SetSliderChanged(toggle, false); - BodySlideFrame::SliderDisplay* slider = GetSliderDisplay(toggle); + slider = GetSliderDisplay(toggle); if (slider) { if (slider->zapCheckHi) slider->zapCheckHi->SetValue(!slider->zapCheckHi->GetValue()); @@ -2849,14 +2856,15 @@ void BodySlideFrame::OnChooseGroups(wxCommandEvent& WXUNUSED(event)) { wxArrayInt grpSelections; int idx = 0; for (auto &g : groupNames) { - grpChoices.Add(g); - if (curGroupNames.find(g) != curGroupNames.end()) { + grpChoices.Add(wxString::FromUTF8(g)); + if (curGroupNames.find(g) != curGroupNames.end()) grpSelections.Add(idx); - } - idx++; + idx++; } + grpChoices.Add("Unassigned"); + wxString filter; wxMultiChoiceDialog chooser(this, _("Choose groups to filter outfit list"), _("Choose Groups"), grpChoices); chooser.SetSelections(grpSelections); @@ -2879,16 +2887,16 @@ void BodySlideFrame::OnSaveGroups(wxCommandEvent& WXUNUSED(event)) { if (saveGroupDialog.ShowModal() == wxID_CANCEL) return; - std::string fName = saveGroupDialog.GetPath(); - std::string gName; - int ret; + wxString fName = saveGroupDialog.GetPath(); + wxString gName; + int ret = 0; do { gName = wxGetTextFromUser(_("What would you like the new group to be called?"), _("New Group Name")); - if (gName.empty()) + if (gName.IsEmpty()) return; - ret = app->SaveGroupList(fName, gName); + ret = app->SaveGroupList(fName.ToUTF8().data(), gName.ToUTF8().data()); } while (ret == 2); if (ret == 0) { @@ -3050,7 +3058,7 @@ void BodySlideFrame::OnBatchBuild(wxCommandEvent& WXUNUSED(event)) { int idx = 0; for (auto &o : outfitChoices) { - oChoices.Add(o); + oChoices.Add(wxString::FromUTF8(o)); oSelections.Add(idx); idx++; } @@ -3107,8 +3115,9 @@ void BodySlideFrame::OnBatchBuild(wxCommandEvent& WXUNUSED(event)) { else if (ret == 3) { wxArrayString errlist; for (auto &e : failedOutfits) { - wxLogError("Failed to build '%s': %s", e.first, e.second); - errlist.Add(e.first + ":" + e.second); + wxString ename = wxString::FromUTF8(e.first); + wxLogError("Failed to build '%s': %s", ename, e.second); + errlist.Add(ename + ":" + e.second); } wxSingleChoiceDialog errdisplay(this, _("The following sets failed"), _("Failed"), errlist, (void**)0, wxDEFAULT_DIALOG_STYLE | wxOK | wxRESIZE_BORDER); diff --git a/src/program/BodySlideApp.h b/src/program/BodySlideApp.h index af872028..5afd0fc7 100644 --- a/src/program/BodySlideApp.h +++ b/src/program/BodySlideApp.h @@ -260,7 +260,7 @@ class BodySlideFrame : public wxFrame { void ShowLowColumn(bool show); void AddCategorySliderUI(const wxString& name, bool show, bool oneSize); - void AddSliderGUI(const wxString& name, const wxString& displayName, bool isZap, bool oneSize = false); + void AddSliderGUI(const std::string& name, const std::string& display, bool isZap, bool oneSize = false); BodySlideFrame::SliderDisplay* GetSliderDisplay(const std::string& name) { if (sliderDisplays.find(name) != sliderDisplays.end()) diff --git a/src/program/OutfitProject.cpp b/src/program/OutfitProject.cpp index fa0dc4a0..91fb71a6 100644 --- a/src/program/OutfitProject.cpp +++ b/src/program/OutfitProject.cpp @@ -578,7 +578,7 @@ wxArrayString OutfitProject::SliderZapToggles(int index) { wxArrayString toggles; if (ValidSlider(index)) for (auto &toggle : activeSet[index].zapToggles) - toggles.Add(toggle); + toggles.Add(wxString::FromUTF8(toggle)); return toggles; } @@ -2141,7 +2141,7 @@ void OutfitProject::ChooseClothData(NifFile& nif) { if (!clothData.empty()) { wxArrayString clothFileNames; for (auto &cloth : clothData) - clothFileNames.Add(cloth.first); + clothFileNames.Add(wxString::FromUTF8(cloth.first)); wxMultiChoiceDialog clothDataChoice(owner, _("There was cloth physics data loaded at some point (BSClothExtraData). Please choose all the origins to use in the output."), _("Choose cloth data"), clothFileNames); if (clothDataChoice.ShowModal() == wxID_CANCEL) @@ -2237,7 +2237,7 @@ int OutfitProject::ImportOBJ(const std::string& fileName, const std::string& sha return 101; } } - useShapeName = wxGetTextFromUser(_("Please specify a name for the new shape"), _("New Shape Name"), useShapeName, owner); + useShapeName = wxGetTextFromUser(_("Please specify a name for the new shape"), _("New Shape Name"), useShapeName, owner).ToUTF8(); if (useShapeName.empty()) return 100; } @@ -2319,7 +2319,7 @@ int OutfitProject::ImportFBX(const std::string& fileName, const std::string& sha } } - useShapeName = wxGetTextFromUser(_("Please specify a name for the new shape"), _("New Shape Name"), useShapeName, owner); + useShapeName = wxGetTextFromUser(_("Please specify a name for the new shape"), _("New Shape Name"), useShapeName, owner).ToUTF8(); if (useShapeName.empty()) return 100; } diff --git a/src/program/OutfitStudio.cpp b/src/program/OutfitStudio.cpp index c750d162..44d827bf 100644 --- a/src/program/OutfitStudio.cpp +++ b/src/program/OutfitStudio.cpp @@ -1215,7 +1215,9 @@ bool OutfitStudioFrame::LoadNIF(const std::string& fileName) { } void OutfitStudioFrame::createSliderGUI(const std::string& name, int id, wxScrolledWindow* wnd, wxSizer* rootSz) { - SliderDisplay* d = new SliderDisplay(); + wxString sn = wxString::FromUTF8(name); + + auto d = new SliderDisplay(); d->sliderPane = new wxPanel(wnd, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER | wxTAB_TRAVERSAL); d->sliderPane->SetBackgroundColour(wxNullColour); d->sliderPane->SetMinSize(wxSize(-1, 25)); @@ -1223,40 +1225,40 @@ void OutfitStudioFrame::createSliderGUI(const std::string& name, int id, wxScrol d->paneSz = new wxBoxSizer(wxHORIZONTAL); - d->btnSliderEdit = new wxBitmapButton(d->sliderPane, wxID_ANY, wxBitmap("res\\images\\EditSmall.png", wxBITMAP_TYPE_ANY), wxDefaultPosition, wxSize(22, 22), wxBU_AUTODRAW, wxDefaultValidator, name + "|btn"); + d->btnSliderEdit = new wxBitmapButton(d->sliderPane, wxID_ANY, wxBitmap("res\\images\\EditSmall.png", wxBITMAP_TYPE_ANY), wxDefaultPosition, wxSize(22, 22), wxBU_AUTODRAW, wxDefaultValidator, sn + "|btn"); d->btnSliderEdit->SetBitmapDisabled(wxBitmap("res\\images\\EditSmall_d.png", wxBITMAP_TYPE_ANY)); d->btnSliderEdit->SetToolTip(_("Turn on edit mode for this slider.")); d->paneSz->Add(d->btnSliderEdit, 0, wxALIGN_CENTER_VERTICAL | wxALL); - d->btnMinus = new wxButton(d->sliderPane, wxID_ANY, "-", wxDefaultPosition, wxSize(18, 18), 0, wxDefaultValidator, name + "|btnMinus"); + d->btnMinus = new wxButton(d->sliderPane, wxID_ANY, "-", wxDefaultPosition, wxSize(18, 18), 0, wxDefaultValidator, sn + "|btnMinus"); d->btnMinus->SetToolTip(_("Weaken slider data by 1%.")); d->btnMinus->SetForegroundColour(wxTransparentColour); d->btnMinus->Hide(); d->paneSz->Add(d->btnMinus, 0, wxALIGN_CENTER_VERTICAL | wxALL); - d->btnPlus = new wxButton(d->sliderPane, wxID_ANY, "+", wxDefaultPosition, wxSize(18, 18), 0, wxDefaultValidator, name + "|btnPlus"); + d->btnPlus = new wxButton(d->sliderPane, wxID_ANY, "+", wxDefaultPosition, wxSize(18, 18), 0, wxDefaultValidator, sn + "|btnPlus"); d->btnPlus->SetToolTip(_("Strengthen slider data by 1%.")); d->btnPlus->SetForegroundColour(wxTransparentColour); d->btnPlus->Hide(); d->paneSz->Add(d->btnPlus, 0, wxALIGN_CENTER_VERTICAL | wxALL); d->sliderNameCheckID = 1000 + id; - d->sliderNameCheck = new wxCheckBox(d->sliderPane, d->sliderNameCheckID, "", wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, name + "|check"); + d->sliderNameCheck = new wxCheckBox(d->sliderPane, d->sliderNameCheckID, "", wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, sn + "|check"); d->sliderNameCheck->SetForegroundColour(wxColour(255, 255, 255)); d->paneSz->Add(d->sliderNameCheck, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); - d->sliderName = new wxStaticText(d->sliderPane, wxID_ANY, name.c_str(), wxDefaultPosition, wxDefaultSize, 0, name + "|lbl"); + d->sliderName = new wxStaticText(d->sliderPane, wxID_ANY, sn, wxDefaultPosition, wxDefaultSize, 0, sn + "|lbl"); d->sliderName->SetForegroundColour(wxColour(255, 255, 255)); d->paneSz->Add(d->sliderName, 0, wxALIGN_CENTER_VERTICAL | wxALL); d->sliderID = 2000 + id; - d->slider = new wxSlider(d->sliderPane, d->sliderID, 0, 0, 100, wxDefaultPosition, wxSize(-1, -1), wxSL_HORIZONTAL, wxDefaultValidator, name + "|slider"); + d->slider = new wxSlider(d->sliderPane, d->sliderID, 0, 0, 100, wxDefaultPosition, wxSize(-1, -1), wxSL_HORIZONTAL, wxDefaultValidator, sn + "|slider"); d->slider->SetMinSize(wxSize(-1, 20)); d->slider->SetMaxSize(wxSize(-1, 20)); d->paneSz->Add(d->slider, 1, wxLEFT | wxRIGHT | wxEXPAND, 5); - d->sliderReadout = new wxTextCtrl(d->sliderPane, wxID_ANY, "0%", wxDefaultPosition, wxSize(40, -1), wxTE_RIGHT | wxTE_PROCESS_ENTER | wxSIMPLE_BORDER, wxDefaultValidator, name + "|readout"); + d->sliderReadout = new wxTextCtrl(d->sliderPane, wxID_ANY, "0%", wxDefaultPosition, wxSize(40, -1), wxTE_RIGHT | wxTE_PROCESS_ENTER | wxSIMPLE_BORDER, wxDefaultValidator, sn + "|readout"); d->sliderReadout->SetMaxLength(0); d->sliderReadout->SetForegroundColour(wxColour(255, 255, 255)); d->sliderReadout->SetBackgroundColour(wxColour(48, 48, 48)); @@ -1289,9 +1291,10 @@ std::string OutfitStudioFrame::NewSlider(const std::string& suggestedName, bool while (sliderDisplays.find(thename) != sliderDisplays.end()) _snprintf_s(thename, 256, 256, "%s%d", namebase.c_str(), count++); + std::string finalName; if (!skipPrompt) { - finalName = wxGetTextFromUser(_("Enter a name for the new slider:"), _("Create New Slider"), thename, this); + finalName = wxGetTextFromUser(_("Enter a name for the new slider:"), _("Create New Slider"), thename, this).ToUTF8(); if (finalName.empty()) return finalName; } @@ -2002,7 +2005,7 @@ void OutfitStudioFrame::RefreshGUIFromProj() { wxTreeItemId subItem; for (auto &shape : shapes) { - subItem = outfitShapes->AppendItem(outfitRoot, shape); + subItem = outfitShapes->AppendItem(outfitRoot, wxString::FromUTF8(shape)); outfitShapes->SetItemState(subItem, 0); outfitShapes->SetItemData(subItem, new ShapeItemData(shape)); @@ -2654,7 +2657,7 @@ void OutfitStudioFrame::OnExportPhysicsData(wxCommandEvent& WXUNUSED(event)) { wxArrayString fileNames; for (auto &data : physicsData) - fileNames.Add(data.first); + fileNames.Add(wxString::FromUTF8(data.first)); wxSingleChoiceDialog physicsDataChoice(this, _("Please choose the physics data source you want to export."), _("Choose physics data"), fileNames); if (physicsDataChoice.ShowModal() == wxID_CANCEL) @@ -2688,7 +2691,7 @@ void OutfitStudioFrame::OnMakeConvRef(wxCommandEvent& WXUNUSED(event)) { while (sliderDisplays.find(thename) != sliderDisplays.end()) _snprintf_s(thename, 256, 256, "%s%d", namebase.c_str(), count++); - std::string finalName = wxGetTextFromUser(_("Create a conversion slider for the current slider settings with the following name: "), _("Create New Conversion Slider"), thename, this); + std::string finalName = wxGetTextFromUser(_("Create a conversion slider for the current slider settings with the following name: "), _("Create New Conversion Slider"), thename, this).ToUTF8(); if (finalName.empty()) return; @@ -4670,7 +4673,7 @@ void OutfitStudioFrame::OnSlider(wxScrollEvent& event) { if (!s) return; - std::string sliderName = s->GetName(); + wxString sliderName = s->GetName(); if (sliderName == "brushSize" || sliderName == "brushStrength" || sliderName == "brushFocus" || sliderName == "brushSpacing") return; @@ -4687,11 +4690,11 @@ void OutfitStudioFrame::OnSlider(wxScrollEvent& event) { return; } - sliderName = s->GetName().BeforeLast('|'); - if (sliderName.empty()) + std::string sn = sliderName.BeforeLast('|').ToUTF8(); + if (sn.empty()) return; - SetSliderValue(sliderName, event.GetPosition()); + SetSliderValue(sn, event.GetPosition()); if (!bEditSlider && event.GetEventType() == wxEVT_SCROLL_CHANGED) ApplySliders(true); @@ -5230,7 +5233,7 @@ void OutfitStudioFrame::OnNewZapSlider(wxCommandEvent& WXUNUSED(event)) { while (sliderDisplays.find(thename) != sliderDisplays.end()) _snprintf_s(thename, 256, 256, "%s%d", namebase.c_str(), count++); - std::string finalName = wxGetTextFromUser(_("Enter a name for the new zap:"), _("Create New Zap"), thename, this); + std::string finalName = wxGetTextFromUser(_("Enter a name for the new zap:"), _("Create New Zap"), thename, this).ToUTF8(); if (finalName.empty()) return; @@ -5257,7 +5260,7 @@ void OutfitStudioFrame::OnNewCombinedSlider(wxCommandEvent& WXUNUSED(event)) { while (sliderDisplays.find(thename) != sliderDisplays.end()) _snprintf_s(thename, 256, 256, "%s%d", namebase.c_str(), count++); - std::string finalName = wxGetTextFromUser(_("Enter a name for the new slider:"), _("Create New Slider"), thename, this); + std::string finalName = wxGetTextFromUser(_("Enter a name for the new slider:"), _("Create New Slider"), thename, this).ToUTF8(); if (finalName.empty()) return; @@ -5360,7 +5363,7 @@ void OutfitStudioFrame::OnSliderProperties(wxCommandEvent& WXUNUSED(event)) { int curSlider = project->SliderIndexFromName(activeSlider); long loVal = (int)(project->SliderDefault(curSlider, false)); long hiVal = (int)(project->SliderDefault(curSlider, true)); - XRCCTRL(dlg, "edSliderName", wxTextCtrl)->SetLabel(activeSlider); + XRCCTRL(dlg, "edSliderName", wxTextCtrl)->SetLabel(wxString::FromUTF8(activeSlider)); XRCCTRL(dlg, "edValLo", wxTextCtrl)->SetValue(wxString::Format("%d", loVal)); XRCCTRL(dlg, "edValHi", wxTextCtrl)->SetValue(wxString::Format("%d", hiVal)); @@ -5395,7 +5398,7 @@ void OutfitStudioFrame::OnSliderProperties(wxCommandEvent& WXUNUSED(event)) { for (int i = 0; i < project->SliderCount(); i++) if (i != curSlider && (project->SliderZap(i) || project->SliderHidden(i))) - zapToggleList->Append(project->GetSliderName(i)); + zapToggleList->Append(wxString::FromUTF8(project->GetSliderName(i))); for (auto &s : project->SliderZapToggles(curSlider)) { int stringId = zapToggleList->FindString(s, true); @@ -5433,12 +5436,14 @@ void OutfitStudioFrame::OnSliderProperties(wxCommandEvent& WXUNUSED(event)) { SliderDisplay* d = sliderDisplays[activeSlider]; sliderDisplays[sliderName] = d; sliderDisplays.erase(activeSlider); - d->slider->SetName(sliderName + "|slider"); - d->sliderName->SetName(sliderName + "|lbl"); - d->btnSliderEdit->SetName(sliderName + "|btn"); - d->sliderNameCheck->SetName(sliderName + "|check"); - d->sliderReadout->SetName(sliderName + "|readout"); - d->sliderName->SetLabel(sliderName); + + wxString sn = wxString::FromUTF8(sliderName); + d->slider->SetName(sn + "|slider"); + d->sliderName->SetName(sn + "|lbl"); + d->btnSliderEdit->SetName(sn + "|btn"); + d->sliderNameCheck->SetName(sn + "|check"); + d->sliderReadout->SetName(sn + "|readout"); + d->sliderName->SetLabel(sn); activeSlider = sliderName; } } @@ -5540,7 +5545,7 @@ void OutfitStudioFrame::OnRenameShape(wxCommandEvent& WXUNUSED(event)) { std::string newShapeName; do { - wxString result = wxGetTextFromUser(_("Please enter a new unique name for the shape."), _("Rename Shape")); + std::string result = wxGetTextFromUser(_("Please enter a new unique name for the shape."), _("Rename Shape")).ToUTF8(); if (result.empty()) return; @@ -5552,7 +5557,7 @@ void OutfitStudioFrame::OnRenameShape(wxCommandEvent& WXUNUSED(event)) { glView->RenameShape(activeItem->shapeName, newShapeName); activeItem->shapeName = newShapeName; - outfitShapes->SetItemText(activeItem->GetId(), newShapeName); + outfitShapes->SetItemText(activeItem->GetId(), wxString::FromUTF8(newShapeName)); } void OutfitStudioFrame::OnSetReference(wxCommandEvent& WXUNUSED(event)) { @@ -6136,7 +6141,7 @@ void OutfitStudioFrame::OnSeparateVerts(wxCommandEvent& WXUNUSED(event)) { std::string newShapeName; do { - wxString result = wxGetTextFromUser(_("Please enter a unique name for the new separated shape."), _("Separate Vertices...")); + std::string result = wxGetTextFromUser(_("Please enter a unique name for the new separated shape."), _("Separate Vertices...")).ToUTF8(); if (result.empty()) return; @@ -6175,7 +6180,7 @@ void OutfitStudioFrame::OnDupeShape(wxCommandEvent& WXUNUSED(event)) { } do { - wxString result = wxGetTextFromUser(_("Please enter a unique name for the duplicated shape."), _("Duplicate Shape")); + std::string result = wxGetTextFromUser(_("Please enter a unique name for the duplicated shape."), _("Duplicate Shape")).ToUTF8(); if (result.empty()) return; @@ -6196,7 +6201,7 @@ void OutfitStudioFrame::OnDupeShape(wxCommandEvent& WXUNUSED(event)) { bool hasMatFile = project->GetShapeMaterialFile(newName, matFile); glView->SetMeshTextures(newName, project->GetShapeTextures(newName), hasMatFile, matFile); - subitem = outfitShapes->AppendItem(outfitRoot, newName); + subitem = outfitShapes->AppendItem(outfitRoot, wxString::FromUTF8(newName)); outfitShapes->SetItemState(subitem, 0); outfitShapes->SetItemData(subitem, new ShapeItemData(newName));