Replace all uses of lagi_wxString with to_wx
This commit is contained in:
parent
e270dc9aec
commit
d0f4d9df99
68 changed files with 215 additions and 223 deletions
|
@ -112,11 +112,11 @@ const wxString AssAttachment::GetEntryData() const {
|
|||
}
|
||||
|
||||
void AssAttachment::Extract(wxString const& filename) const {
|
||||
agi::io::Save(STD_STR(filename), true).Get().write(&(*data)[0], data->size());
|
||||
agi::io::Save(from_wx(filename), true).Get().write(&(*data)[0], data->size());
|
||||
}
|
||||
|
||||
void AssAttachment::Import(wxString const& filename) {
|
||||
agi::scoped_ptr<std::istream> file(agi::io::Open(STD_STR(filename), true));
|
||||
agi::scoped_ptr<std::istream> file(agi::io::Open(from_wx(filename), true));
|
||||
file->seekg(0, std::ios::end);
|
||||
data->resize(file->tellg());
|
||||
file->seekg(0, std::ios::beg);
|
||||
|
|
|
@ -84,7 +84,7 @@ AssDialogue::AssDialogue(wxString const& data)
|
|||
, Style("Default")
|
||||
{
|
||||
if (!Parse(data))
|
||||
throw SubtitleFormatParseError(STD_STR("Failed parsing line: " + data), 0);
|
||||
throw SubtitleFormatParseError(from_wx("Failed parsing line: " + data), 0);
|
||||
}
|
||||
|
||||
AssDialogue::~AssDialogue () {
|
||||
|
|
|
@ -148,7 +148,7 @@ wxString AssFile::AutoSave() {
|
|||
return "";
|
||||
|
||||
wxFileName origfile(filename);
|
||||
wxString path = lagi_wxString(OPT_GET("Path/Auto/Save")->GetString());
|
||||
wxString path = to_wx(OPT_GET("Path/Auto/Save")->GetString());
|
||||
if (!path)
|
||||
path = origfile.GetPath();
|
||||
path = StandardPaths::DecodePath(path + "/");
|
||||
|
@ -366,9 +366,9 @@ AssStyle *AssFile::GetStyle(wxString const& name) {
|
|||
}
|
||||
|
||||
void AssFile::AddToRecent(wxString const& file) const {
|
||||
config::mru->Add("Subtitle", STD_STR(file));
|
||||
config::mru->Add("Subtitle", from_wx(file));
|
||||
wxFileName filepath(file);
|
||||
OPT_SET("Path/Last/Subtitles")->SetString(STD_STR(filepath.GetPath()));
|
||||
OPT_SET("Path/Last/Subtitles")->SetString(from_wx(filepath.GetPath()));
|
||||
}
|
||||
|
||||
int AssFile::Commit(wxString const& desc, int type, int amendId, AssEntry *single_line) {
|
||||
|
|
|
@ -172,7 +172,7 @@ void AudioController::OpenAudio(const wxString &url)
|
|||
throw;
|
||||
}
|
||||
catch (...) {
|
||||
config::mru->Remove("Audio", STD_STR(url));
|
||||
config::mru->Remove("Audio", from_wx(url));
|
||||
throw;
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ void AudioController::OpenAudio(const wxString &url)
|
|||
|
||||
audio_url = url;
|
||||
|
||||
config::mru->Add("Audio", STD_STR(url));
|
||||
config::mru->Add("Audio", from_wx(url));
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -408,7 +408,7 @@ void AudioController::SaveClip(wxString const& filename, TimeRange const& range)
|
|||
int64_t end_sample = SamplesFromMilliseconds(range.end());
|
||||
if (filename.empty() || start_sample > provider->GetNumSamples() || range.length() == 0) return;
|
||||
|
||||
agi::io::Save outfile(STD_STR(filename), true);
|
||||
agi::io::Save outfile(from_wx(filename), true);
|
||||
std::ofstream& out(outfile.Get());
|
||||
|
||||
size_t bytes_per_sample = provider->GetBytesPerSample() * provider->GetChannels();
|
||||
|
|
|
@ -369,7 +369,7 @@ AlsaPlayer::AlsaPlayer(AudioProvider *provider)
|
|||
{
|
||||
ps->provider = provider;
|
||||
|
||||
wxString device_name = lagi_wxString(OPT_GET("Player/Audio/ALSA/Device")->GetString());
|
||||
wxString device_name = to_wx(OPT_GET("Player/Audio/ALSA/Device")->GetString());
|
||||
ps->device_name = std::string(device_name.utf8_str());
|
||||
|
||||
if (pthread_create(&thread, 0, &playback_thread, ps.get()) != 0)
|
||||
|
|
|
@ -74,7 +74,7 @@ void OSSPlayer::OpenStream()
|
|||
bpf = provider->GetChannels() * provider->GetBytesPerSample();
|
||||
|
||||
// Open device
|
||||
wxString device = lagi_wxString(OPT_GET("Player/Audio/OSS/Device")->GetString());
|
||||
wxString device = to_wx(OPT_GET("Player/Audio/OSS/Device")->GetString());
|
||||
dspdev = ::open(device.mb_str(wxConvUTF8), O_WRONLY, 0);
|
||||
if (dspdev < 0) {
|
||||
throw OSSError("OSS player: opening device failed", 0);
|
||||
|
|
|
@ -276,7 +276,7 @@ wxArrayString PortAudioPlayer::GetOutputDevices() {
|
|||
PortAudioPlayer player(0);
|
||||
|
||||
for (std::map<std::string, DeviceVec>::iterator it = player.devices.begin(); it != player.devices.end(); ++it)
|
||||
list.push_back(lagi_wxString(it->first));
|
||||
list.push_back(to_wx(it->first));
|
||||
}
|
||||
catch (PortAudioError const&) {
|
||||
// No output devices, just return the list with only Default
|
||||
|
|
|
@ -62,7 +62,7 @@ FFmpegSourceAudioProvider::FFmpegSourceAudioProvider(wxString filename) try
|
|||
LoadAudio(filename);
|
||||
}
|
||||
catch (wxString const& err) {
|
||||
throw agi::AudioProviderOpenError(STD_STR(err), 0);
|
||||
throw agi::AudioProviderOpenError(from_wx(err), 0);
|
||||
}
|
||||
catch (const char *err) {
|
||||
throw agi::AudioProviderOpenError(err, 0);
|
||||
|
|
|
@ -34,14 +34,14 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include "audio_provider_hd.h"
|
||||
|
||||
#include <wx/filefn.h>
|
||||
#include <wx/filename.h>
|
||||
|
||||
#include <libaegisub/background_runner.h>
|
||||
#include <libaegisub/io.h>
|
||||
|
||||
#include "audio_provider_hd.h"
|
||||
|
||||
#include "audio_controller.h"
|
||||
#include "audio_provider_pcm.h"
|
||||
#include "compat.h"
|
||||
|
@ -51,7 +51,7 @@
|
|||
|
||||
namespace {
|
||||
wxString cache_dir() {
|
||||
wxString path = lagi_wxString(OPT_GET("Audio/Cache/HD/Location")->GetString());
|
||||
wxString path = to_wx(OPT_GET("Audio/Cache/HD/Location")->GetString());
|
||||
if (path == "default")
|
||||
path = "?temp/";
|
||||
|
||||
|
@ -59,7 +59,7 @@ wxString cache_dir() {
|
|||
}
|
||||
|
||||
wxString cache_path() {
|
||||
wxString pattern = lagi_wxString(OPT_GET("Audio/Cache/HD/Name")->GetString());
|
||||
wxString pattern = to_wx(OPT_GET("Audio/Cache/HD/Name")->GetString());
|
||||
if (pattern.Find("%02i") == wxNOT_FOUND) pattern = "audio%02i.tmp";
|
||||
|
||||
// Try from 00 to 99
|
||||
|
@ -113,14 +113,14 @@ HDAudioProvider::HDAudioProvider(AudioProvider *src, agi::BackgroundRunner *br)
|
|||
wxDiskspaceSize_t freespace;
|
||||
if (wxGetDiskSpace(cache_dir(), 0, &freespace)) {
|
||||
if (num_samples * channels * bytes_per_sample > freespace)
|
||||
throw agi::AudioCacheOpenError("Not enough free disk space in " + STD_STR(cache_dir()) + " to cache the audio", 0);
|
||||
throw agi::AudioCacheOpenError("Not enough free disk space in " + from_wx(cache_dir()) + " to cache the audio", 0);
|
||||
}
|
||||
|
||||
diskCacheFilename = cache_path();
|
||||
|
||||
try {
|
||||
{
|
||||
agi::io::Save out(STD_STR(diskCacheFilename), true);
|
||||
agi::io::Save out(from_wx(diskCacheFilename), true);
|
||||
br->Run(bind(&HDAudioProvider::FillCache, this, src, &out.Get(), std::placeholders::_1));
|
||||
}
|
||||
cache_provider.reset(new RawAudioProvider(diskCacheFilename, src));
|
||||
|
@ -141,7 +141,7 @@ void HDAudioProvider::FillBuffer(void *buf, int64_t start, int64_t count) const
|
|||
}
|
||||
|
||||
void HDAudioProvider::FillCache(AudioProvider *src, std::ofstream *out, agi::ProgressSink *ps) {
|
||||
ps->SetMessage(STD_STR(_("Reading to Hard Disk cache")));
|
||||
ps->SetMessage(from_wx(_("Reading to Hard Disk cache")));
|
||||
|
||||
int64_t block = 65536;
|
||||
std::vector<char> read_buf;
|
||||
|
|
|
@ -73,7 +73,7 @@ PCMAudioProvider::PCMAudioProvider(const wxString &filename)
|
|||
0);
|
||||
|
||||
if (file_handle == INVALID_HANDLE_VALUE)
|
||||
throw agi::FileNotFoundError(STD_STR(filename));
|
||||
throw agi::FileNotFoundError(from_wx(filename));
|
||||
|
||||
LARGE_INTEGER li_file_size = {0};
|
||||
if (!GetFileSizeEx(file_handle, &li_file_size))
|
||||
|
@ -94,7 +94,7 @@ PCMAudioProvider::PCMAudioProvider(const wxString &filename)
|
|||
, file_handle(open(filename.mb_str(*wxConvFileName), O_RDONLY), close)
|
||||
{
|
||||
if (file_handle == -1)
|
||||
throw agi::FileNotFoundError(STD_STR(filename));
|
||||
throw agi::FileNotFoundError(from_wx(filename));
|
||||
|
||||
struct stat filestats;
|
||||
memset(&filestats, 0, sizeof(filestats));
|
||||
|
|
|
@ -71,7 +71,7 @@ RAMAudioProvider::RAMAudioProvider(AudioProvider *src, agi::BackgroundRunner *br
|
|||
}
|
||||
|
||||
void RAMAudioProvider::FillCache(AudioProvider *source, agi::ProgressSink *ps) {
|
||||
ps->SetMessage(STD_STR(_("Reading into RAM")));
|
||||
ps->SetMessage(from_wx(_("Reading into RAM")));
|
||||
|
||||
int64_t readsize = CacheBlockSize / source->GetBytesPerSample();
|
||||
for (size_t i = 0; i < blockcache.size(); i++) {
|
||||
|
|
|
@ -289,7 +289,7 @@ namespace Automation4 {
|
|||
// copied from auto3
|
||||
include_path.clear();
|
||||
include_path.EnsureFileAccessible(filename);
|
||||
wxStringTokenizer toker(lagi_wxString(OPT_GET("Path/Automation/Include")->GetString()), "|", wxTOKEN_STRTOK);
|
||||
wxStringTokenizer toker(to_wx(OPT_GET("Path/Automation/Include")->GetString()), "|", wxTOKEN_STRTOK);
|
||||
while (toker.HasMoreTokens()) {
|
||||
// todo? make some error reporting here
|
||||
wxFileName path(StandardPaths::DecodePath(toker.GetNextToken()));
|
||||
|
@ -421,7 +421,7 @@ namespace Automation4 {
|
|||
|
||||
wxStringTokenizer tok(local_scripts, "|", wxTOKEN_STRTOK);
|
||||
wxFileName assfn(context->ass->filename);
|
||||
wxString autobasefn(lagi_wxString(OPT_GET("Path/Automation/Base")->GetString()));
|
||||
wxString autobasefn(to_wx(OPT_GET("Path/Automation/Base")->GetString()));
|
||||
while (tok.HasMoreTokens()) {
|
||||
wxString trimmed = tok.GetNextToken().Trim(true).Trim(false);
|
||||
char first_char = trimmed[0];
|
||||
|
@ -461,7 +461,7 @@ namespace Automation4 {
|
|||
// 3. If step 2 failed, or absolute path is shorter than path relative to ass, use absolute path ("/")
|
||||
// 4. Otherwise, use path relative to ass ("~")
|
||||
wxString scripts_string;
|
||||
wxString autobasefn(lagi_wxString(OPT_GET("Path/Automation/Base")->GetString()));
|
||||
wxString autobasefn(to_wx(OPT_GET("Path/Automation/Base")->GetString()));
|
||||
|
||||
for (auto script : GetScripts()) {
|
||||
if (!scripts_string.empty())
|
||||
|
|
|
@ -461,7 +461,7 @@ namespace Automation4 {
|
|||
if (lua_load(L, script_reader.reader_func, &script_reader, GetPrettyFilename().utf8_str())) {
|
||||
wxString err = wxString::Format("Error loading Lua script \"%s\":\n\n%s", GetPrettyFilename(), get_wxstring(L, -1));
|
||||
lua_pop(L, 1);
|
||||
throw ScriptLoadError(STD_STR(err));
|
||||
throw ScriptLoadError(from_wx(err));
|
||||
}
|
||||
_stackcheck.check_stack(1);
|
||||
|
||||
|
@ -472,7 +472,7 @@ namespace Automation4 {
|
|||
// error occurred, assumed to be on top of Lua stack
|
||||
wxString err = wxString::Format("Error initialising Lua script \"%s\":\n\n%s", GetPrettyFilename(), get_wxstring(L, -1));
|
||||
lua_pop(L, 1);
|
||||
throw ScriptLoadError(STD_STR(err));
|
||||
throw ScriptLoadError(from_wx(err));
|
||||
}
|
||||
_stackcheck.check_stack(0);
|
||||
|
||||
|
@ -786,7 +786,7 @@ namespace Automation4 {
|
|||
, cmd_type(cmd::COMMAND_NORMAL)
|
||||
{
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, "filename");
|
||||
cmd_name = STD_STR(wxString::Format("automation/lua/%s/%s", get_wxstring(L, -1), check_wxstring(L, 1)));
|
||||
cmd_name = from_wx(wxString::Format("automation/lua/%s/%s", get_wxstring(L, -1), check_wxstring(L, 1)));
|
||||
|
||||
if (!lua_isfunction(L, 3))
|
||||
luaL_error(L, "The macro processing function must be a function");
|
||||
|
|
|
@ -135,7 +135,7 @@ namespace Automation4 {
|
|||
, width(get_field(L, "width", 1))
|
||||
, height(get_field(L, "height", 1))
|
||||
{
|
||||
LOG_D("automation/lua/dialog") << "created control: '" << STD_STR(name) << "', (" << x << "," << y << ")(" << width << "," << height << "), "<< STD_STR(hint);
|
||||
LOG_D("automation/lua/dialog") << "created control: '" << from_wx(name) << "', (" << x << "," << y << ")(" << width << "," << height << "), "<< from_wx(hint);
|
||||
}
|
||||
|
||||
namespace LuaControl {
|
||||
|
@ -566,7 +566,7 @@ namespace Automation4 {
|
|||
if (buttons.size() > 0) {
|
||||
LOG_D("automation/lua/dialog") << "creating user buttons";
|
||||
for (size_t i = 0; i < buttons.size(); ++i) {
|
||||
LOG_D("automation/lua/dialog") << "button '" << STD_STR(buttons[i]) << "' gets id " << 1001+(wxWindowID)i;
|
||||
LOG_D("automation/lua/dialog") << "button '" << from_wx(buttons[i]) << "' gets id " << 1001+(wxWindowID)i;
|
||||
|
||||
bs->Add(new wxButton(window, 1001+(wxWindowID)i, buttons[i]));
|
||||
}
|
||||
|
@ -604,7 +604,7 @@ namespace Automation4 {
|
|||
LOG_D("automation/lua/dialog") << "default buttons, button 1 bushed, Ok button";
|
||||
lua_pushboolean(L, 1);
|
||||
} else {
|
||||
LOG_D("automation/lua/dialog") << "user button: " << STD_STR(buttons.at(btn-1));
|
||||
LOG_D("automation/lua/dialog") << "user button: " << from_wx(buttons.at(btn-1));
|
||||
// button_pushed is index+1 to reserve 0 for Cancel
|
||||
lua_pushstring(L, buttons.at(btn-1).utf8_str());
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
namespace Automation4 {
|
||||
LuaScriptReader::LuaScriptReader(wxString const& filename)
|
||||
: conv(new agi::charset::IconvWrapper(CharSetDetect::GetEncoding(filename).c_str(), "utf-8", false))
|
||||
, file(agi::io::Open(STD_STR(filename)))
|
||||
, file(agi::io::Open(from_wx(filename)))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -216,7 +216,7 @@ void BaseGrid::OnHighlightVisibleChange(agi::OptionValue const& opt) {
|
|||
}
|
||||
|
||||
void BaseGrid::UpdateStyle() {
|
||||
wxString fontname = lagi_wxString(OPT_GET("Subtitle/Grid/Font Face")->GetString());
|
||||
wxString fontname = to_wx(OPT_GET("Subtitle/Grid/Font Face")->GetString());
|
||||
if (fontname.empty()) fontname = "Tahoma";
|
||||
font.SetFaceName(fontname);
|
||||
font.SetPointSize(OPT_GET("Subtitle/Grid/Font Size")->GetInt());
|
||||
|
@ -492,7 +492,7 @@ void BaseGrid::DrawImage(wxDC &dc, bool paint_columns[]) {
|
|||
int override_mode = OPT_GET("Subtitle/Grid/Hide Overrides")->GetInt();
|
||||
wxString replace_char;
|
||||
if (override_mode == 1)
|
||||
replace_char = lagi_wxString(OPT_GET("Subtitle/Grid/Hide Overrides Char")->GetString());
|
||||
replace_char = to_wx(OPT_GET("Subtitle/Grid/Hide Overrides Char")->GetString());
|
||||
|
||||
for (int i = 0; i < nDraw + 1; i++) {
|
||||
int curRow = i + yPos - 1;
|
||||
|
|
|
@ -185,7 +185,7 @@ struct app_language : public Command {
|
|||
wxString new_language = wxGetApp().locale.PickLanguage();
|
||||
if (!new_language) return;
|
||||
|
||||
OPT_SET("App/Language")->SetString(STD_STR(new_language));
|
||||
OPT_SET("App/Language")->SetString(from_wx(new_language));
|
||||
|
||||
// Ask to restart program
|
||||
int result = wxMessageBox("Aegisub needs to be restarted so that the new language can be applied. Restart now?", "Restart Aegisub?", wxYES_NO | wxICON_QUESTION | wxCENTER);
|
||||
|
|
|
@ -88,19 +88,19 @@ struct audio_open : public Command {
|
|||
|
||||
void operator()(agi::Context *c) {
|
||||
try {
|
||||
wxString path = lagi_wxString(OPT_GET("Path/Last/Audio")->GetString());
|
||||
wxString path = to_wx(OPT_GET("Path/Last/Audio")->GetString());
|
||||
wxString str = _("Audio Formats") + " (*.aac,*.ac3,*.ape,*.dts,*.flac,*.m4a,*.mka,*.mp3,*.mp4,*.ogg,*.w64,*.wav,*.wma)|*.aac;*.ac3;*.ape;*.dts;*.flac;*.m4a;*.mka;*.mp3;*.mp4;*.ogg;*.w64;*.wav;*.wma|"
|
||||
+ _("Video Formats") + " (*.asf,*.avi,*.avs,*.d2v,*.m2ts,*.m4v,*.mkv,*.mov,*.mp4,*.mpeg,*.mpg,*.ogm,*.webm,*.wmv,*.ts)|*.asf;*.avi;*.avs;*.d2v;*.m2ts;*.m4v;*.mkv;*.mov;*.mp4;*.mpeg;*.mpg;*.ogm;*.webm;*.wmv;*.ts|"
|
||||
+ _("All Files") + " (*.*)|*.*";
|
||||
wxString filename = wxFileSelector(_("Open Audio File"),path,"","",str,wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||
if (!filename.empty()) {
|
||||
c->audioController->OpenAudio(filename);
|
||||
OPT_SET("Path/Last/Audio")->SetString(STD_STR(wxFileName(filename).GetPath()));
|
||||
OPT_SET("Path/Last/Audio")->SetString(from_wx(wxFileName(filename).GetPath()));
|
||||
}
|
||||
}
|
||||
catch (agi::UserCancelException const&) { }
|
||||
catch (agi::Exception const& e) {
|
||||
wxMessageBox(lagi_wxString(e.GetChainedMessage()), "Error loading file", wxOK | wxICON_ERROR | wxCENTER, c->parent);
|
||||
wxMessageBox(to_wx(e.GetChainedMessage()), "Error loading file", wxOK | wxICON_ERROR | wxCENTER, c->parent);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -118,7 +118,7 @@ struct audio_open_blank : public Command {
|
|||
c->audioController->OpenAudio("dummy-audio:silence?sr=44100&bd=16&ch=1&ln=396900000");
|
||||
}
|
||||
catch (agi::Exception const& e) {
|
||||
wxMessageBox(lagi_wxString(e.GetChainedMessage()), "Error loading file", wxOK | wxICON_ERROR | wxCENTER, c->parent);
|
||||
wxMessageBox(to_wx(e.GetChainedMessage()), "Error loading file", wxOK | wxICON_ERROR | wxCENTER, c->parent);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -136,7 +136,7 @@ struct audio_open_noise : public Command {
|
|||
c->audioController->OpenAudio("dummy-audio:noise?sr=44100&bd=16&ch=1&ln=396900000");
|
||||
}
|
||||
catch (agi::Exception const& e) {
|
||||
wxMessageBox(lagi_wxString(e.GetChainedMessage()), "Error loading file", wxOK | wxICON_ERROR | wxCENTER, c->parent);
|
||||
wxMessageBox(to_wx(e.GetChainedMessage()), "Error loading file", wxOK | wxICON_ERROR | wxCENTER, c->parent);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -160,7 +160,7 @@ struct audio_open_video : public Command {
|
|||
}
|
||||
catch (agi::UserCancelException const&) { }
|
||||
catch (agi::Exception const& e) {
|
||||
wxMessageBox(lagi_wxString(e.GetChainedMessage()), "Error loading file", wxOK | wxICON_ERROR | wxCENTER, c->parent);
|
||||
wxMessageBox(to_wx(e.GetChainedMessage()), "Error loading file", wxOK | wxICON_ERROR | wxCENTER, c->parent);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace cmd {
|
|||
static iterator find_command(std::string const& name) {
|
||||
iterator it = cmd_map.find(name);
|
||||
if (it == cmd_map.end())
|
||||
throw CommandNotFound(STD_STR(wxString::Format(_("'%s' is not a valid command name"), lagi_wxString(name))));
|
||||
throw CommandNotFound(from_wx(wxString::Format(_("'%s' is not a valid command name"), to_wx(name))));
|
||||
return it;
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ struct keyframe_open : public Command {
|
|||
STR_HELP("Opens a keyframe list file")
|
||||
|
||||
void operator()(agi::Context *c) {
|
||||
wxString path = lagi_wxString(OPT_GET("Path/Last/Keyframes")->GetString());
|
||||
wxString path = to_wx(OPT_GET("Path/Last/Keyframes")->GetString());
|
||||
wxString filename = wxFileSelector(
|
||||
_("Open keyframes file"),
|
||||
path,
|
||||
|
@ -88,7 +88,7 @@ struct keyframe_open : public Command {
|
|||
wxFD_FILE_MUST_EXIST | wxFD_OPEN);
|
||||
|
||||
if (filename.empty()) return;
|
||||
OPT_SET("Path/Last/Keyframes")->SetString(STD_STR(wxFileName(filename).GetPath()));
|
||||
OPT_SET("Path/Last/Keyframes")->SetString(from_wx(wxFileName(filename).GetPath()));
|
||||
c->videoController->LoadKeyframes(filename);
|
||||
}
|
||||
};
|
||||
|
@ -107,10 +107,10 @@ struct keyframe_save : public Command {
|
|||
}
|
||||
|
||||
void operator()(agi::Context *c) {
|
||||
wxString path = lagi_wxString(OPT_GET("Path/Last/Keyframes")->GetString());
|
||||
wxString path = to_wx(OPT_GET("Path/Last/Keyframes")->GetString());
|
||||
wxString filename = wxFileSelector(_("Save keyframes file"),path,"","*.key.txt","Text files (*.txt)|*.txt",wxFD_OVERWRITE_PROMPT | wxFD_SAVE);
|
||||
if (filename.empty()) return;
|
||||
OPT_SET("Path/Last/Keyframes")->SetString(STD_STR(wxFileName(filename).GetPath()));
|
||||
OPT_SET("Path/Last/Keyframes")->SetString(from_wx(wxFileName(filename).GetPath()));
|
||||
c->videoController->SaveKeyframes(filename);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -67,11 +67,11 @@ struct recent_audio_entry : public Command {
|
|||
|
||||
void operator()(agi::Context *c, int id) {
|
||||
try {
|
||||
c->audioController->OpenAudio(lagi_wxString(config::mru->GetEntry("Audio", id)));
|
||||
c->audioController->OpenAudio(to_wx(config::mru->GetEntry("Audio", id)));
|
||||
}
|
||||
catch (agi::UserCancelException const&) { }
|
||||
catch (agi::Exception const& e) {
|
||||
wxMessageBox(lagi_wxString(e.GetChainedMessage()), "Error loading file", wxOK | wxICON_ERROR | wxCENTER, c->parent);
|
||||
wxMessageBox(to_wx(e.GetChainedMessage()), "Error loading file", wxOK | wxICON_ERROR | wxCENTER, c->parent);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -83,7 +83,7 @@ struct recent_keyframes_entry : public Command {
|
|||
STR_HELP("Open recent keyframes")
|
||||
|
||||
void operator()(agi::Context *c, int id) {
|
||||
c->videoController->LoadKeyframes(lagi_wxString(config::mru->GetEntry("Keyframes", id)));
|
||||
c->videoController->LoadKeyframes(to_wx(config::mru->GetEntry("Keyframes", id)));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -94,7 +94,7 @@ struct recent_subtitle_entry : public Command {
|
|||
STR_HELP("Open recent subtitles")
|
||||
|
||||
void operator()(agi::Context *c, int id) {
|
||||
wxGetApp().frame->LoadSubtitles(lagi_wxString(config::mru->GetEntry("Subtitle", id)));
|
||||
wxGetApp().frame->LoadSubtitles(to_wx(config::mru->GetEntry("Subtitle", id)));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -105,7 +105,7 @@ struct recent_timecodes_entry : public Command {
|
|||
STR_HELP("Open recent timecodes")
|
||||
|
||||
void operator()(agi::Context *c, int id) {
|
||||
c->videoController->LoadTimecodes(lagi_wxString(config::mru->GetEntry("Timecodes", id)));
|
||||
c->videoController->LoadTimecodes(to_wx(config::mru->GetEntry("Timecodes", id)));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -116,7 +116,7 @@ struct recent_video_entry : public Command {
|
|||
STR_HELP("Open recent videos")
|
||||
|
||||
void operator()(agi::Context *c, int id) {
|
||||
c->videoController->SetVideo(lagi_wxString(config::mru->GetEntry("Video", id)));
|
||||
c->videoController->SetVideo(to_wx(config::mru->GetEntry("Video", id)));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -260,7 +260,7 @@ struct subtitle_open : public Command {
|
|||
STR_HELP("Opens a subtitles file")
|
||||
|
||||
void operator()(agi::Context *c) {
|
||||
wxString path = lagi_wxString(OPT_GET("Path/Last/Subtitles")->GetString());
|
||||
wxString path = to_wx(OPT_GET("Path/Last/Subtitles")->GetString());
|
||||
wxString filename = wxFileSelector(_("Open subtitles file"),path,"","",SubtitleFormat::GetWildcards(0),wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||
if (!filename.empty()) {
|
||||
wxGetApp().frame->LoadSubtitles(filename);
|
||||
|
@ -291,7 +291,7 @@ struct subtitle_open_charset : public Command {
|
|||
|
||||
void operator()(agi::Context *c) {
|
||||
// Initialize charsets
|
||||
wxString path = lagi_wxString(OPT_GET("Path/Last/Subtitles")->GetString());
|
||||
wxString path = to_wx(OPT_GET("Path/Last/Subtitles")->GetString());
|
||||
|
||||
// Get options and load
|
||||
wxString filename = wxFileSelector(_("Open subtitles file"),path,"","",SubtitleFormat::GetWildcards(0),wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||
|
@ -339,7 +339,7 @@ struct subtitle_properties : public Command {
|
|||
static void save_subtitles(agi::Context *c, wxString filename) {
|
||||
if (filename.empty()) {
|
||||
c->videoController->Stop();
|
||||
wxString path = lagi_wxString(OPT_GET("Path/Last/Subtitles")->GetString());
|
||||
wxString path = to_wx(OPT_GET("Path/Last/Subtitles")->GetString());
|
||||
wxFileName origPath(c->ass->filename);
|
||||
filename = wxFileSelector(_("Save subtitles file"), path, origPath.GetName() + ".ass", "ass", "Advanced Substation Alpha (*.ass)|*.ass", wxFD_SAVE | wxFD_OVERWRITE_PROMPT, c->parent);
|
||||
if (filename.empty()) return;
|
||||
|
@ -349,7 +349,7 @@ static void save_subtitles(agi::Context *c, wxString filename) {
|
|||
c->ass->Save(filename, true, true);
|
||||
}
|
||||
catch (const agi::Exception& err) {
|
||||
wxMessageBox(lagi_wxString(err.GetMessage()), "Error", wxOK | wxICON_ERROR | wxCENTER, c->parent);
|
||||
wxMessageBox(to_wx(err.GetMessage()), "Error", wxOK | wxICON_ERROR | wxCENTER, c->parent);
|
||||
}
|
||||
catch (const char *err) {
|
||||
wxMessageBox(err, "Error", wxOK | wxICON_ERROR | wxCENTER, c->parent);
|
||||
|
|
|
@ -77,12 +77,12 @@ struct timecode_open : public Command {
|
|||
STR_HELP("Opens a VFR timecodes v1 or v2 file")
|
||||
|
||||
void operator()(agi::Context *c) {
|
||||
wxString path = lagi_wxString(OPT_GET("Path/Last/Timecodes")->GetString());
|
||||
wxString path = to_wx(OPT_GET("Path/Last/Timecodes")->GetString());
|
||||
wxString str = _("All Supported Formats") + " (*.txt)|*.txt|" + _("All Files") + " (*.*)|*.*";
|
||||
wxString filename = wxFileSelector(_("Open Timecodes File"),path,"","",str,wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||
if (!filename.empty()) {
|
||||
c->videoController->LoadTimecodes(filename);
|
||||
OPT_SET("Path/Last/Timecodes")->SetString(STD_STR(wxFileName(filename).GetPath()));
|
||||
OPT_SET("Path/Last/Timecodes")->SetString(from_wx(wxFileName(filename).GetPath()));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -101,12 +101,12 @@ struct timecode_save : public Command {
|
|||
}
|
||||
|
||||
void operator()(agi::Context *c) {
|
||||
wxString path = lagi_wxString(OPT_GET("Path/Last/Timecodes")->GetString());
|
||||
wxString path = to_wx(OPT_GET("Path/Last/Timecodes")->GetString());
|
||||
wxString str = _("All Supported Formats") + " (*.txt)|*.txt|" + _("All Files") + " (*.*)|*.*";
|
||||
wxString filename = wxFileSelector(_("Save Timecodes File"),path,"","",str,wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
|
||||
if (!filename.empty()) {
|
||||
c->videoController->SaveTimecodes(filename);
|
||||
OPT_SET("Path/Last/Timecodes")->SetString(STD_STR(wxFileName(filename).GetPath()));
|
||||
OPT_SET("Path/Last/Timecodes")->SetString(from_wx(wxFileName(filename).GetPath()));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -228,7 +228,7 @@ struct tool_translation_assistant : public Command {
|
|||
c->dialog->ShowModal<DialogTranslation>(c);
|
||||
}
|
||||
catch (agi::Exception const& e) {
|
||||
wxMessageBox(lagi_wxString(e.GetChainedMessage()));
|
||||
wxMessageBox(to_wx(e.GetChainedMessage()));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -473,7 +473,7 @@ struct video_frame_prev_large : public validator_video_loaded {
|
|||
|
||||
static void save_snapshot(agi::Context *c, bool raw) {
|
||||
static const agi::OptionValue* ssPath = OPT_GET("Path/Screenshot");
|
||||
wxString option = lagi_wxString(ssPath->GetString());
|
||||
wxString option = to_wx(ssPath->GetString());
|
||||
wxFileName videoFile(c->videoController->GetVideoName());
|
||||
wxString basepath;
|
||||
|
||||
|
@ -582,13 +582,13 @@ struct video_open : public Command {
|
|||
STR_HELP("Opens a video file")
|
||||
|
||||
void operator()(agi::Context *c) {
|
||||
wxString path = lagi_wxString(OPT_GET("Path/Last/Video")->GetString());
|
||||
wxString path = to_wx(OPT_GET("Path/Last/Video")->GetString());
|
||||
wxString str = _("Video Formats") + " (*.asf,*.avi,*.avs,*.d2v,*.m2ts,*.m4v,*.mkv,*.mov,*.mp4,*.mpeg,*.mpg,*.ogm,*.webm,*.wmv,*.ts,*.y4m,*.yuv)|*.asf;*.avi;*.avs;*.d2v;*.m2ts;*.m4v;*.mkv;*.mov;*.mp4;*.mpeg;*.mpg;*.ogm;*.webm;*.wmv;*.ts;*.y4m;*.yuv|"
|
||||
+ _("All Files") + " (*.*)|*.*";
|
||||
wxString filename = wxFileSelector(_("Open video file"),path,"","",str,wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||
if (!filename.empty()) {
|
||||
c->videoController->SetVideo(filename);
|
||||
OPT_SET("Path/Last/Video")->SetString(STD_STR(wxFileName(filename).GetPath()));
|
||||
OPT_SET("Path/Last/Video")->SetString(from_wx(wxFileName(filename).GetPath()));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -3,17 +3,18 @@
|
|||
|
||||
#include <algorithm>
|
||||
|
||||
template<typename T>
|
||||
wxArrayString to_wxAS(T const& src) {
|
||||
wxArrayString ret;
|
||||
ret.reserve(src.size());
|
||||
transform(src.begin(), src.end(), std::back_inserter(ret), (wxString (*)(std::string const&))to_wx);
|
||||
return ret;
|
||||
}
|
||||
|
||||
wxArrayString lagi_MRU_wxAS(const wxString &list) {
|
||||
const agi::MRUManager::MRUListMap *map = config::mru->Get(STD_STR(list));
|
||||
wxArrayString work;
|
||||
work.reserve(map->size());
|
||||
transform(map->begin(), map->end(), std::back_inserter(work), lagi_wxString);
|
||||
return work;
|
||||
return to_wxAS(*config::mru->Get(from_wx(list)));
|
||||
}
|
||||
|
||||
wxArrayString to_wx(std::vector<std::string> const& vec) {
|
||||
wxArrayString ret;
|
||||
ret.reserve(vec.size());
|
||||
transform(vec.begin(), vec.end(), std::back_inserter(ret), lagi_wxString);
|
||||
return ret;
|
||||
return to_wxAS(vec);
|
||||
}
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
|
||||
#include <libaegisub/color.h>
|
||||
|
||||
#define STD_STR(x) std::string((x).utf8_str())
|
||||
|
||||
inline wxColour to_wx(agi::Color color) { return wxColour(color.r, color.g, color.b, 255 - color.a); }
|
||||
inline wxString to_wx(std::string const& str) { return wxString(str.c_str(), wxConvUTF8); }
|
||||
wxArrayString to_wx(std::vector<std::string> const& vec);
|
||||
|
@ -16,5 +14,4 @@ wxArrayString to_wx(std::vector<std::string> const& vec);
|
|||
inline agi::Color from_wx(wxColour color) { return agi::Color(color.Red(), color.Green(), color.Blue(), 255 - color.Alpha()); }
|
||||
inline std::string from_wx(wxString const& str) { return std::string(str.utf8_str()); }
|
||||
|
||||
inline wxString lagi_wxString(const std::string &str) { return wxString(str.c_str(), wxConvUTF8); }
|
||||
wxArrayString lagi_MRU_wxAS(const wxString &list);
|
||||
|
|
|
@ -151,7 +151,7 @@ void DialogAttachments::AttachFile(wxFileDialog &diag, AssEntryGroup group, wxSt
|
|||
void DialogAttachments::OnAttachFont(wxCommandEvent &) {
|
||||
wxFileDialog diag(this,
|
||||
_("Choose file to be attached"),
|
||||
lagi_wxString(OPT_GET("Path/Fonts Collector Destination")->GetString()), "", "Font Files (*.ttf)|*.ttf",
|
||||
to_wx(OPT_GET("Path/Fonts Collector Destination")->GetString()), "", "Font Files (*.ttf)|*.ttf",
|
||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE);
|
||||
|
||||
AttachFile(diag, ENTRY_FONT, _("attach font file"));
|
||||
|
@ -176,13 +176,13 @@ void DialogAttachments::OnExtract(wxCommandEvent &) {
|
|||
|
||||
// Multiple or single?
|
||||
if (listView->GetNextSelected(i) != -1)
|
||||
path = wxDirSelector(_("Select the path to save the files to:"),lagi_wxString(OPT_GET("Path/Fonts Collector Destination")->GetString())) + "/";
|
||||
path = wxDirSelector(_("Select the path to save the files to:"),to_wx(OPT_GET("Path/Fonts Collector Destination")->GetString())) + "/";
|
||||
else {
|
||||
// Default path
|
||||
wxString defPath = ((AssAttachment*)wxUIntToPtr(listView->GetItemData(i)))->GetFileName();
|
||||
path = wxFileSelector(
|
||||
_("Select the path to save the file to:"),
|
||||
lagi_wxString(OPT_GET("Path/Fonts Collector Destination")->GetString()),
|
||||
to_wx(OPT_GET("Path/Fonts Collector Destination")->GetString()),
|
||||
defPath,
|
||||
".ttf",
|
||||
"Font Files (*.ttf)|*.ttf",
|
||||
|
|
|
@ -187,7 +187,7 @@ void DialogAutomation::OnAdd(wxCommandEvent &)
|
|||
{
|
||||
wxFileDialog diag(this,
|
||||
_("Add Automation script"),
|
||||
lagi_wxString(OPT_GET("Path/Last/Automation")->GetString()),
|
||||
to_wx(OPT_GET("Path/Last/Automation")->GetString()),
|
||||
"",
|
||||
Automation4::ScriptFactory::GetWildcardStr(),
|
||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE);
|
||||
|
@ -199,7 +199,7 @@ void DialogAutomation::OnAdd(wxCommandEvent &)
|
|||
|
||||
for (auto const& fname : fnames) {
|
||||
wxFileName fnpath(fname);
|
||||
OPT_SET("Path/Last/Automation")->SetString(STD_STR(fnpath.GetPath()));
|
||||
OPT_SET("Path/Last/Automation")->SetString(from_wx(fnpath.GetPath()));
|
||||
|
||||
if (has_file(local_manager->GetScripts(), fnpath) || has_file(global_manager->GetScripts(), fnpath)) {
|
||||
wxLogError("Script '%s' is already loaded", fname);
|
||||
|
|
|
@ -228,7 +228,7 @@ DialogFontsCollector::DialogFontsCollector(agi::Context *c)
|
|||
wxStaticBoxSizer *destination_box = new wxStaticBoxSizer(wxVERTICAL, this, _("Destination"));
|
||||
|
||||
dest_label = new wxStaticText(this, -1, " ");
|
||||
dest_ctrl = new wxTextCtrl(this, -1, StandardPaths::DecodePath(lagi_wxString(OPT_GET("Path/Fonts Collector Destination")->GetString())));
|
||||
dest_ctrl = new wxTextCtrl(this, -1, StandardPaths::DecodePath(to_wx(OPT_GET("Path/Fonts Collector Destination")->GetString())));
|
||||
dest_browse_button = new wxButton(this, -1, _("&Browse..."));
|
||||
|
||||
wxSizer *dest_browse_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
@ -313,7 +313,7 @@ void DialogFontsCollector::OnStart(wxCommandEvent &) {
|
|||
}
|
||||
|
||||
if (action != CheckFontsOnly)
|
||||
OPT_SET("Path/Fonts Collector Destination")->SetString(STD_STR(dest));
|
||||
OPT_SET("Path/Fonts Collector Destination")->SetString(from_wx(dest));
|
||||
|
||||
// Disable the UI while it runs as we don't support canceling
|
||||
EnableCloseButton(false);
|
||||
|
|
|
@ -184,7 +184,7 @@ void DialogSearchReplace::FindReplace(int mode) {
|
|||
if (hasReplace) {
|
||||
wxString ReplaceWith = ReplaceEdit->GetValue();
|
||||
Search.ReplaceWith = ReplaceWith;
|
||||
config::mru->Add("Replace", STD_STR(ReplaceWith));
|
||||
config::mru->Add("Replace", from_wx(ReplaceWith));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -194,11 +194,11 @@ void DialogSearchReplace::FindReplace(int mode) {
|
|||
Search.ReplaceWith = ReplaceWith;
|
||||
if (mode == 1) Search.ReplaceNext();
|
||||
else Search.ReplaceAll();
|
||||
config::mru->Add("Replace", STD_STR(ReplaceWith));
|
||||
config::mru->Add("Replace", from_wx(ReplaceWith));
|
||||
}
|
||||
|
||||
// Add to history
|
||||
config::mru->Add("Find", STD_STR(LookFor));
|
||||
config::mru->Add("Find", from_wx(LookFor));
|
||||
UpdateDropDowns();
|
||||
}
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ wxDialog (c->parent, -1, _("Select"), wxDefaultPosition, wxDefaultSize, wxCAPTIO
|
|||
match_radio_line->Add(case_sensitive = new wxCheckBox(this, -1, _("Match c&ase")), radio_flags);
|
||||
match_sizer->Add(match_radio_line);
|
||||
}
|
||||
match_sizer->Add(match_text = new wxTextCtrl(this, -1, lagi_wxString(OPT_GET("Tool/Select Lines/Text")->GetString())), main_flags);
|
||||
match_sizer->Add(match_text = new wxTextCtrl(this, -1, to_wx(OPT_GET("Tool/Select Lines/Text")->GetString())), main_flags);
|
||||
|
||||
main_sizer->Add(match_sizer, main_flags);
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ wxDialog (c->parent, -1, _("Select"), wxDefaultPosition, wxDefaultSize, wxCAPTIO
|
|||
}
|
||||
|
||||
DialogSelection::~DialogSelection() {
|
||||
OPT_SET("Tool/Select Lines/Text")->SetString(STD_STR(match_text->GetValue()));
|
||||
OPT_SET("Tool/Select Lines/Text")->SetString(from_wx(match_text->GetValue()));
|
||||
OPT_SET("Tool/Select Lines/Condition")->SetInt(select_unmatching_lines->GetValue());
|
||||
OPT_SET("Tool/Select Lines/Field")->SetInt(dialogue_field->GetSelection());
|
||||
OPT_SET("Tool/Select Lines/Action")->SetInt(selection_change_type->GetSelection());
|
||||
|
|
|
@ -55,11 +55,11 @@
|
|||
#include "video_context.h"
|
||||
|
||||
static wxString get_history_string(json::Object &obj) {
|
||||
wxString filename = lagi_wxString(obj["filename"]);
|
||||
wxString filename = to_wx(obj["filename"]);
|
||||
if (filename.empty())
|
||||
filename = _("unsaved");
|
||||
|
||||
wxString shift_amount(lagi_wxString(obj["amount"]));
|
||||
wxString shift_amount(to_wx(obj["amount"]));
|
||||
if (!obj["is by time"])
|
||||
shift_amount = wxString::Format(_("%s frames"), shift_amount);
|
||||
|
||||
|
@ -99,7 +99,7 @@ static wxString get_history_string(json::Object &obj) {
|
|||
DialogShiftTimes::DialogShiftTimes(agi::Context *context)
|
||||
: wxDialog(context->parent, -1, _("Shift Times"))
|
||||
, context(context)
|
||||
, history_filename(STD_STR(StandardPaths::DecodePath("?user/shift_history.json")))
|
||||
, history_filename(from_wx(StandardPaths::DecodePath("?user/shift_history.json")))
|
||||
, history(new json::Array)
|
||||
, timecodes_loaded_slot(context->videoController->AddTimecodesListener(&DialogShiftTimes::OnTimecodesLoaded, this))
|
||||
, selected_set_changed_slot(context->selectionController->AddSelectionListener(&DialogShiftTimes::OnSelectedSetChanged, this))
|
||||
|
@ -235,7 +235,7 @@ void DialogShiftTimes::OnSelectedSetChanged() {
|
|||
|
||||
|
||||
void DialogShiftTimes::OnClear(wxCommandEvent &) {
|
||||
wxRemoveFile(lagi_wxString(history_filename));
|
||||
wxRemoveFile(to_wx(history_filename));
|
||||
history_box->Clear();
|
||||
history->clear();
|
||||
}
|
||||
|
@ -256,12 +256,12 @@ void DialogShiftTimes::OnHistoryClick(wxCommandEvent &evt) {
|
|||
|
||||
json::Object& obj = (*history)[entry];
|
||||
if (obj["is by time"]) {
|
||||
shift_time->SetTime(AssTime(lagi_wxString(obj["amount"])));
|
||||
shift_time->SetTime(AssTime(to_wx(obj["amount"])));
|
||||
shift_by_time->SetValue(true);
|
||||
OnByTime(evt);
|
||||
}
|
||||
else {
|
||||
shift_frames->SetValue(lagi_wxString(obj["amount"]));
|
||||
shift_frames->SetValue(to_wx(obj["amount"]));
|
||||
if (shift_by_frames->IsEnabled()) {
|
||||
shift_by_frames->SetValue(true);
|
||||
OnByFrames(evt);
|
||||
|
@ -279,10 +279,10 @@ void DialogShiftTimes::OnHistoryClick(wxCommandEvent &evt) {
|
|||
|
||||
void DialogShiftTimes::SaveHistory(json::Array const& shifted_blocks) {
|
||||
json::Object new_entry;
|
||||
new_entry["filename"] = STD_STR(wxFileName(context->ass->filename).GetFullName());
|
||||
new_entry["filename"] = from_wx(wxFileName(context->ass->filename).GetFullName());
|
||||
new_entry["is by time"] = shift_by_time->GetValue();
|
||||
new_entry["is backward"] = shift_backward->GetValue();
|
||||
new_entry["amount"] = STD_STR(shift_by_time->GetValue() ? shift_time->GetValue() : shift_frames->GetValue());
|
||||
new_entry["amount"] = from_wx(shift_by_time->GetValue() ? shift_time->GetValue() : shift_frames->GetValue());
|
||||
new_entry["fields"] = time_fields->GetSelection();
|
||||
new_entry["mode"] = selection_mode->GetSelection();
|
||||
new_entry["selection"] = shifted_blocks;
|
||||
|
|
|
@ -110,7 +110,7 @@ DialogSpellChecker::DialogSpellChecker(agi::Context *context)
|
|||
}
|
||||
|
||||
language = new wxComboBox(this, -1, "", wxDefaultPosition, wxDefaultSize, language_names, wxCB_DROPDOWN | wxCB_READONLY);
|
||||
wxString cur_lang = lagi_wxString(OPT_GET("Tool/Spell Checker/Language")->GetString());
|
||||
wxString cur_lang = to_wx(OPT_GET("Tool/Spell Checker/Language")->GetString());
|
||||
int cur_lang_index = dictionary_lang_codes.Index(cur_lang);
|
||||
if (cur_lang_index == wxNOT_FOUND) cur_lang_index = dictionary_lang_codes.Index("en");
|
||||
if (cur_lang_index == wxNOT_FOUND) cur_lang_index = dictionary_lang_codes.Index("en_US");
|
||||
|
@ -185,7 +185,7 @@ void DialogSpellChecker::OnReplace(wxCommandEvent&) {
|
|||
|
||||
void DialogSpellChecker::OnChangeLanguage(wxCommandEvent&) {
|
||||
wxString code = dictionary_lang_codes[language->GetSelection()];
|
||||
OPT_SET("Tool/Spell Checker/Language")->SetString(STD_STR(code));
|
||||
OPT_SET("Tool/Spell Checker/Language")->SetString(from_wx(code));
|
||||
|
||||
FindNext();
|
||||
}
|
||||
|
|
|
@ -326,7 +326,7 @@ DialogStyleEditor::DialogStyleEditor(wxWindow *parent, AssStyle *style, agi::Con
|
|||
PreviewText = nullptr;
|
||||
ColourButton *previewButton = 0;
|
||||
if (!SubtitlesProviderFactory::GetClasses().empty()) {
|
||||
PreviewText = new wxTextCtrl(this, -1, lagi_wxString(OPT_GET("Tool/Style Editor/Preview Text")->GetString()));
|
||||
PreviewText = new wxTextCtrl(this, -1, to_wx(OPT_GET("Tool/Style Editor/Preview Text")->GetString()));
|
||||
previewButton = new ColourButton(this, -1, wxSize(45, 16), OPT_GET("Colour/Style Editor/Background/Preview")->GetColor());
|
||||
SubsPreview = new SubtitlesPreview(this, wxSize(100, 60), wxSUNKEN_BORDER, OPT_GET("Colour/Style Editor/Background/Preview")->GetColor());
|
||||
|
||||
|
@ -476,7 +476,7 @@ void DialogStyleEditor::Apply(bool apply, bool close) {
|
|||
if (close) {
|
||||
EndModal(apply);
|
||||
if (PreviewText)
|
||||
OPT_SET("Tool/Style Editor/Preview Text")->SetString(STD_STR(PreviewText->GetValue()));
|
||||
OPT_SET("Tool/Style Editor/Preview Text")->SetString(from_wx(PreviewText->GetValue()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -571,18 +571,18 @@ void DialogStyleManager::OnCurrentDelete() {
|
|||
|
||||
void DialogStyleManager::OnCurrentImport() {
|
||||
// Get file name
|
||||
wxString path = lagi_wxString(OPT_GET("Path/Last/Subtitles")->GetString());
|
||||
wxString path = to_wx(OPT_GET("Path/Last/Subtitles")->GetString());
|
||||
wxString filename = wxFileSelector(_("Open subtitles file"),path,"","",SubtitleFormat::GetWildcards(0),wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||
if (!filename) return;
|
||||
|
||||
OPT_SET("Path/Last/Subtitles")->SetString(STD_STR(wxFileName(filename).GetPath()));
|
||||
OPT_SET("Path/Last/Subtitles")->SetString(from_wx(wxFileName(filename).GetPath()));
|
||||
|
||||
AssFile temp;
|
||||
try {
|
||||
temp.Load(filename);
|
||||
}
|
||||
catch (agi::Exception const& err) {
|
||||
wxMessageBox(lagi_wxString(err.GetChainedMessage()), "Error", wxOK | wxICON_ERROR | wxCENTER, this);
|
||||
wxMessageBox(to_wx(err.GetChainedMessage()), "Error", wxOK | wxICON_ERROR | wxCENTER, this);
|
||||
}
|
||||
catch (...) {
|
||||
wxMessageBox("Unknown error", "Error", wxOK | wxICON_ERROR | wxCENTER, this);
|
||||
|
|
|
@ -49,8 +49,8 @@ DialogTextImport::DialogTextImport()
|
|||
// Main controls
|
||||
wxFlexGridSizer *fg = new wxFlexGridSizer(2, 5, 5);
|
||||
wxBoxSizer *main_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
edit_separator = new wxTextCtrl(this, -1, lagi_wxString(OPT_GET("Tool/Import/Text/Actor Separator")->GetString()));
|
||||
edit_comment = new wxTextCtrl(this, -1, lagi_wxString(OPT_GET("Tool/Import/Text/Comment Starter")->GetString()));
|
||||
edit_separator = new wxTextCtrl(this, -1, to_wx(OPT_GET("Tool/Import/Text/Actor Separator")->GetString()));
|
||||
edit_comment = new wxTextCtrl(this, -1, to_wx(OPT_GET("Tool/Import/Text/Comment Starter")->GetString()));
|
||||
|
||||
// Dialog layout
|
||||
fg->Add(new wxStaticText(this, -1, _("Actor separator:")), 0, wxALIGN_CENTRE_VERTICAL);
|
||||
|
@ -66,8 +66,8 @@ DialogTextImport::DialogTextImport()
|
|||
}
|
||||
|
||||
void DialogTextImport::OnOK(wxCommandEvent &) {
|
||||
OPT_SET("Tool/Import/Text/Actor Separator")->SetString(STD_STR(edit_separator->GetValue()));
|
||||
OPT_SET("Tool/Import/Text/Comment Starter")->SetString(STD_STR(edit_comment->GetValue()));
|
||||
OPT_SET("Tool/Import/Text/Actor Separator")->SetString(from_wx(edit_separator->GetValue()));
|
||||
OPT_SET("Tool/Import/Text/Comment Starter")->SetString(from_wx(edit_comment->GetValue()));
|
||||
|
||||
EndModal(wxID_OK);
|
||||
}
|
||||
|
|
|
@ -160,7 +160,7 @@ DialogTranslation::DialogTranslation(agi::Context *c)
|
|||
blocks = active_line->ParseTags();
|
||||
if (bad_block(blocks[0])) {
|
||||
if (!NextBlock())
|
||||
throw NothingToTranslate(STD_STR(_("There is nothing to translate in the file.")));
|
||||
throw NothingToTranslate(from_wx(_("There is nothing to translate in the file.")));
|
||||
}
|
||||
else
|
||||
UpdateDisplay();
|
||||
|
|
|
@ -325,7 +325,7 @@ static wxString GetSystemLanguage()
|
|||
|
||||
static wxString GetAegisubLanguage()
|
||||
{
|
||||
return lagi_wxString(OPT_GET("App/Language")->GetString());
|
||||
return to_wx(OPT_GET("App/Language")->GetString());
|
||||
}
|
||||
|
||||
template<class OutIter>
|
||||
|
@ -375,11 +375,11 @@ void AegisubVersionCheckerThread::DoCheck()
|
|||
break;
|
||||
case 6:
|
||||
case 7:
|
||||
throw VersionCheckError(STD_STR(_("Could not connect to updates server.")));
|
||||
throw VersionCheckError(from_wx(_("Could not connect to updates server.")));
|
||||
case 22:
|
||||
throw VersionCheckError(STD_STR(_("Could not download from updates server.")));
|
||||
throw VersionCheckError(from_wx(_("Could not download from updates server.")));
|
||||
default:
|
||||
throw VersionCheckError(STD_STR(wxString::Format("curl failed with error code %d", ret)));
|
||||
throw VersionCheckError(from_wx(wxString::Format("curl failed with error code %d", ret)));
|
||||
}
|
||||
|
||||
agi::scoped_ptr<wxStringInputStream> stream(new wxStringInputStream(update_str));
|
||||
|
@ -399,14 +399,14 @@ void AegisubVersionCheckerThread::DoCheck()
|
|||
http.SetFlags(wxSOCKET_WAITALL | wxSOCKET_BLOCK);
|
||||
|
||||
if (!http.Connect(UPDATE_CHECKER_SERVER))
|
||||
throw VersionCheckError(STD_STR(_("Could not connect to updates server.")));
|
||||
throw VersionCheckError(from_wx(_("Could not connect to updates server.")));
|
||||
|
||||
agi::scoped_ptr<wxInputStream> stream(http.GetInputStream(path));
|
||||
if (!stream) // check for null-pointer
|
||||
throw VersionCheckError(STD_STR(_("Could not download from updates server.")));
|
||||
throw VersionCheckError(from_wx(_("Could not download from updates server.")));
|
||||
|
||||
if (http.GetResponse() < 200 || http.GetResponse() >= 300) {
|
||||
throw VersionCheckError(STD_STR(wxString::Format(_("HTTP request failed, got HTTP response %d."), http.GetResponse())));
|
||||
throw VersionCheckError(from_wx(wxString::Format(_("HTTP request failed, got HTTP response %d."), http.GetResponse())));
|
||||
}
|
||||
#endif
|
||||
wxTextInputStream text(*stream);
|
||||
|
|