i18n for everything else
This commit is contained in:
parent
7f4aae7e99
commit
8e67a6ff89
@ -15,7 +15,7 @@ SaveFile::SaveFile(ByteString filename):
|
||||
gameSave(NULL),
|
||||
filename(filename),
|
||||
displayName(filename.FromUtf8()),
|
||||
loadingError("")
|
||||
loadingError(""_ascii)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ SaveInfo::SaveInfo(int _id, int _createdDate, int _updatedDate, int _votesUp, in
|
||||
Version(0),
|
||||
userName(_userName),
|
||||
name(_name),
|
||||
Description(""),
|
||||
Description(""_ascii),
|
||||
Published(false),
|
||||
tags(),
|
||||
gameSave(NULL)
|
||||
|
@ -293,7 +293,7 @@ inline wchar_t narrow_wchar(String::value_type ch)
|
||||
|
||||
char const numberChars[] = "-.+0123456789ABCDEFXabcdefx";
|
||||
ByteString numberByteString(numberChars);
|
||||
String numberString(numberChars);
|
||||
String numberString(numberByteString.FromAscii());
|
||||
|
||||
struct LocaleImpl
|
||||
{
|
||||
|
@ -32,10 +32,10 @@ void DebugLines::Draw()
|
||||
g->draw_line(drawPoint2.X, 0, drawPoint2.X, YRES, 255, 255, 255, 120);
|
||||
|
||||
String info;
|
||||
info = String::Build(drawPoint2.X, " x ", drawPoint2.Y);
|
||||
info = String::Build(drawPoint2.X, " x "_ascii, drawPoint2.Y);
|
||||
g->drawtext_outline(drawPoint2.X+(drawPoint2.X>drawPoint1.X?3:-g->textwidth(info)-3), drawPoint2.Y+(drawPoint2.Y<drawPoint1.Y?-10:3), info, 255, 255, 255, 200);
|
||||
|
||||
info = String::Build(drawPoint1.X, " x ", drawPoint1.Y);
|
||||
info = String::Build(drawPoint1.X, " x "_ascii, drawPoint1.Y);
|
||||
g->drawtext_outline(drawPoint1.X+(drawPoint2.X<drawPoint1.X?3:-g->textwidth(info)-2), drawPoint1.Y+(drawPoint2.Y>drawPoint1.Y?-10:3), info, 255, 255, 255, 200);
|
||||
|
||||
info = String::Build(std::abs(drawPoint2.X-drawPoint1.X));
|
||||
|
@ -18,7 +18,7 @@ void DebugParts::Draw()
|
||||
Graphics * g = ui::Engine::Ref().g;
|
||||
|
||||
int x = 0, y = 0, lpx = 0, lpy = 0;
|
||||
String info = String::Build(sim->parts_lastActiveIndex, "/", NPART, " (", Format::Precision((float)sim->parts_lastActiveIndex/(NPART)*100.0f, 2), "%)");
|
||||
String info = String::Build(sim->parts_lastActiveIndex, '/', NPART, " ("_ascii, Format::Precision((float)sim->parts_lastActiveIndex/(NPART)*100.0f, 2), "%)"_ascii);
|
||||
for (int i = 0; i < NPART; i++)
|
||||
{
|
||||
if (sim->parts[i].type)
|
||||
|
@ -74,7 +74,7 @@ void ElementPopulationDebug::Draw()
|
||||
}
|
||||
}
|
||||
|
||||
g->drawtext(xStart + bars + 5, yBottom-5, "0", 255, 255, 255, 255);
|
||||
g->drawtext(xStart + bars + 5, yBottom-5, "0"_ascii, 255, 255, 255, 255);
|
||||
g->drawtext(xStart + bars + 5, yBottom-132, halfValString, 255, 255, 255, 255);
|
||||
g->drawtext(xStart + bars + 5, yBottom-260, maxValString, 255, 255, 255, 255);
|
||||
}
|
||||
|
@ -26,19 +26,23 @@ void ParticleDebug::Debug(int mode, int x, int y)
|
||||
while (i < NPART && !sim->parts[i].type)
|
||||
i++;
|
||||
if (i == NPART)
|
||||
logmessage = "End of particles reached, updated sim";
|
||||
logmessage = "End of particles reached, updated sim"_i18n;
|
||||
else
|
||||
logmessage = String::Build("Updated particle #", i);
|
||||
logmessage = String::Build("Updated particle #"_i18n, i);
|
||||
}
|
||||
else if (mode == 1)
|
||||
{
|
||||
if (x < 0 || x >= XRES || y < 0 || y >= YRES || !sim->pmap[y][x] || (i = ID(sim->pmap[y][x])) < debug_currentParticle)
|
||||
{
|
||||
i = NPART;
|
||||
logmessage = String::Build("Updated particles from #", debug_currentParticle, " to end, updated sim");
|
||||
auto updated = i18nMulti("Updated particles from #", " to end, updated sim");
|
||||
logmessage = String::Build(updated[0], debug_currentParticle, updated[1]);
|
||||
}
|
||||
else
|
||||
logmessage = String::Build("Updated particles #", debug_currentParticle, " through #", i);
|
||||
{
|
||||
auto updated = i18nMulti("Updated particles #", "through #");
|
||||
logmessage = String::Build(updated[0], debug_currentParticle, updated[1], i);
|
||||
}
|
||||
}
|
||||
model->Log(logmessage, false);
|
||||
|
||||
@ -90,7 +94,8 @@ bool ParticleDebug::KeyPress(int key, int scan, bool shift, bool ctrl, bool alt,
|
||||
{
|
||||
sim->UpdateParticles(sim->debug_currentParticle, NPART);
|
||||
sim->AfterSim();
|
||||
String logmessage = String::Build("Updated particles from #", sim->debug_currentParticle, " to end, updated sim");
|
||||
auto updated = i18nMulti("Updated particles from #", " to end, updated sim");
|
||||
String logmessage = String::Build(updated[0], sim->debug_currentParticle, updated[1]);
|
||||
model->Log(logmessage, false);
|
||||
sim->debug_currentParticle = 0;
|
||||
}
|
||||
|
@ -592,7 +592,7 @@ void Graphics::textnpos(String str, int n, int w, int *cx, int *cy)
|
||||
while (*s&&n)
|
||||
{
|
||||
wordlen = 0;
|
||||
while(*s && String(" .,!?\n").Contains(*s))
|
||||
while(*s && String(" .,!?\n"_ascii).Contains(*s))
|
||||
s++;
|
||||
charspace = textwidthx(s, w-x);
|
||||
if (charspace<wordlen && wordlen && w-x<w/3)
|
||||
@ -653,7 +653,7 @@ int Graphics::textwrapheight(String str, int width)
|
||||
while (*s)
|
||||
{
|
||||
wordlen = 0;
|
||||
while(*s && String(" .,!?\n").Contains(*s))
|
||||
while(*s && String(" .,!?\n"_ascii).Contains(*s))
|
||||
s++;
|
||||
charspace = textwidthx(s, width-x);
|
||||
if (charspace<wordlen && wordlen && width-x<width/3)
|
||||
@ -734,6 +734,7 @@ void Graphics::textsize(String str, int & width, int & height)
|
||||
|
||||
void Graphics::draw_icon(int x, int y, Icon icon, unsigned char alpha, bool invert)
|
||||
{
|
||||
static String voteText = "Vote"_i18n;
|
||||
y--;
|
||||
switch(icon)
|
||||
{
|
||||
@ -759,12 +760,12 @@ void Graphics::draw_icon(int x, int y, Icon icon, unsigned char alpha, bool inve
|
||||
if(invert)
|
||||
{
|
||||
drawchar(x-11, y+1, 0xE04B, 0, 100, 0, alpha);
|
||||
drawtext(x+2, y+1, "Vote", 0, 100, 0, alpha);
|
||||
drawtext(x+2, y+1, voteText, 0, 100, 0, alpha);
|
||||
}
|
||||
else
|
||||
{
|
||||
drawchar(x-11, y+1, 0xE04B, 0, 187, 18, alpha);
|
||||
drawtext(x+2, y+1, "Vote", 0, 187, 18, alpha);
|
||||
drawtext(x+2, y+1, voteText, 0, 187, 18, alpha);
|
||||
}
|
||||
break;
|
||||
case IconVoteDown:
|
||||
|
@ -39,34 +39,34 @@ ColourPickerActivity::ColourPickerActivity(ui::Colour initialColour, OnPicked on
|
||||
UpdateTextboxes(r, g, b, alpha);
|
||||
};
|
||||
|
||||
rValue = new ui::Textbox(ui::Point(5, Size.Y-23), ui::Point(30, 17), "255");
|
||||
rValue = new ui::Textbox(ui::Point(5, Size.Y-23), ui::Point(30, 17), "255"_ascii);
|
||||
rValue->SetActionCallback({ colourChange });
|
||||
rValue->SetLimit(3);
|
||||
rValue->SetInputType(ui::Textbox::Number);
|
||||
AddComponent(rValue);
|
||||
|
||||
gValue = new ui::Textbox(ui::Point(40, Size.Y-23), ui::Point(30, 17), "255");
|
||||
gValue = new ui::Textbox(ui::Point(40, Size.Y-23), ui::Point(30, 17), "255"_ascii);
|
||||
gValue->SetActionCallback({ colourChange });
|
||||
gValue->SetLimit(3);
|
||||
gValue->SetInputType(ui::Textbox::Number);
|
||||
AddComponent(gValue);
|
||||
|
||||
bValue = new ui::Textbox(ui::Point(75, Size.Y-23), ui::Point(30, 17), "255");
|
||||
bValue = new ui::Textbox(ui::Point(75, Size.Y-23), ui::Point(30, 17), "255"_ascii);
|
||||
bValue->SetActionCallback({ colourChange });
|
||||
bValue->SetLimit(3);
|
||||
bValue->SetInputType(ui::Textbox::Number);
|
||||
AddComponent(bValue);
|
||||
|
||||
aValue = new ui::Textbox(ui::Point(110, Size.Y-23), ui::Point(30, 17), "255");
|
||||
aValue = new ui::Textbox(ui::Point(110, Size.Y-23), ui::Point(30, 17), "255"_ascii);
|
||||
aValue->SetActionCallback({ colourChange });
|
||||
aValue->SetLimit(3);
|
||||
aValue->SetInputType(ui::Textbox::Number);
|
||||
AddComponent(aValue);
|
||||
|
||||
hexValue = new::ui::Label(ui::Point(150, Size.Y-23), ui::Point(53, 17), "0xFFFFFFFF");
|
||||
hexValue = new::ui::Label(ui::Point(150, Size.Y-23), ui::Point(53, 17), "0xFFFFFFFF"_ascii);
|
||||
AddComponent(hexValue);
|
||||
|
||||
ui::Button * doneButton = new ui::Button(ui::Point(Size.X-45, Size.Y-23), ui::Point(40, 17), "Done");
|
||||
ui::Button * doneButton = new ui::Button(ui::Point(Size.X-45, Size.Y-23), ui::Point(40, 17), "Done"_i18n);
|
||||
doneButton->SetActionCallback({ [this] {
|
||||
int Red, Green, Blue;
|
||||
Red = rValue->GetText().ToNumber<int>(true);
|
||||
|
@ -23,7 +23,7 @@ void ConsoleController::EvaluateCommand(String command)
|
||||
{
|
||||
if(command.length())
|
||||
{
|
||||
if (command.BeginsWith("!load "))
|
||||
if (command.BeginsWith("!load "_ascii))
|
||||
CloseConsole();
|
||||
int returnCode = commandInterface->Command(command);
|
||||
consoleModel->AddLastCommand(ConsoleCommand(command, returnCode, commandInterface->GetLastError()));
|
||||
|
@ -10,7 +10,7 @@ ConsoleModel::ConsoleModel() {
|
||||
{
|
||||
if(previousCommands.size()<25)
|
||||
{
|
||||
previousCommands.push_front(ConsoleCommand(*iter, 0, ""));
|
||||
previousCommands.push_front(ConsoleCommand(*iter, 0, ""_ascii));
|
||||
currentCommandIndex = previousCommands.size();
|
||||
}
|
||||
}
|
||||
@ -37,7 +37,7 @@ ConsoleCommand ConsoleModel::GetCurrentCommand()
|
||||
{
|
||||
if (currentCommandIndex >= previousCommands.size())
|
||||
{
|
||||
return ConsoleCommand("", 0, "");
|
||||
return ConsoleCommand(""_ascii, 0, ""_ascii);
|
||||
}
|
||||
return previousCommands[currentCommandIndex];
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ ConsoleView::ConsoleView():
|
||||
ui::Window(ui::Point(0, 0), ui::Point(WINDOWW, 150)),
|
||||
commandField(NULL)
|
||||
{
|
||||
commandField = new ui::Textbox(ui::Point(0, Size.Y-16), ui::Point(Size.X, 16), "");
|
||||
commandField = new ui::Textbox(ui::Point(0, Size.Y-16), ui::Point(Size.X, 16), ""_ascii);
|
||||
commandField->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||
commandField->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
||||
commandField->SetActionCallback({ [this] { commandField->SetDisplayText(c->FormatCommand(commandField->GetText())); } });
|
||||
@ -41,8 +41,8 @@ void ConsoleView::DoKeyPress(int key, int scan, bool repeat, bool shift, bool ct
|
||||
case SDLK_RETURN:
|
||||
case SDLK_KP_ENTER:
|
||||
c->EvaluateCommand(commandField->GetText());
|
||||
commandField->SetText("");
|
||||
commandField->SetDisplayText("");
|
||||
commandField->SetText(""_ascii);
|
||||
commandField->SetDisplayText(""_ascii);
|
||||
break;
|
||||
case SDLK_DOWN:
|
||||
c->NextCommand();
|
||||
@ -62,7 +62,7 @@ void ConsoleView::DoKeyPress(int key, int scan, bool repeat, bool shift, bool ct
|
||||
|
||||
void ConsoleView::DoTextInput(String text)
|
||||
{
|
||||
if (text == "~")
|
||||
if (text == "~"_ascii)
|
||||
doClose = false;
|
||||
if (!doClose)
|
||||
Window::DoTextInput(text);
|
||||
|
@ -38,7 +38,7 @@ ConfirmPrompt::ConfirmPrompt(String title, String message, ResultCallback callba
|
||||
Size.Y += messagePanel->Size.Y+12;
|
||||
Position.Y = (ui::Engine::Ref().GetHeight()-Size.Y)/2;
|
||||
|
||||
ui::Button * cancelButton = new ui::Button(ui::Point(0, Size.Y-16), ui::Point(Size.X-75, 16), "Cancel");
|
||||
ui::Button * cancelButton = new ui::Button(ui::Point(0, Size.Y-16), ui::Point(Size.X-75, 16), "Cancel"_i18n);
|
||||
cancelButton->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||
cancelButton->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
||||
cancelButton->Appearance.BorderInactive = ui::Colour(200, 200, 200);
|
||||
|
@ -29,7 +29,7 @@ ErrorMessage::ErrorMessage(String title, String message, DismissCallback callbac
|
||||
Size.Y += messageLabel->Size.Y+12;
|
||||
Position.Y = (ui::Engine::Ref().GetHeight()-Size.Y)/2;
|
||||
|
||||
ui::Button * okayButton = new ui::Button(ui::Point(0, Size.Y-16), ui::Point(Size.X, 16), "Dismiss");
|
||||
ui::Button * okayButton = new ui::Button(ui::Point(0, Size.Y-16), ui::Point(Size.X, 16), "Dismiss"_i18n);
|
||||
okayButton->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||
okayButton->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
||||
okayButton->Appearance.BorderInactive = ui::Colour(200, 200, 200);
|
||||
|
@ -55,7 +55,7 @@ InformationMessage::InformationMessage(String title, String message, bool large)
|
||||
titleLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
||||
AddComponent(titleLabel);
|
||||
|
||||
ui::Button * okayButton = new ui::Button(ui::Point(0, Size.Y-16), ui::Point(Size.X, 16), "Dismiss");
|
||||
ui::Button * okayButton = new ui::Button(ui::Point(0, Size.Y-16), ui::Point(Size.X, 16), "Dismiss"_i18n);
|
||||
okayButton->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||
okayButton->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
||||
okayButton->Appearance.BorderInactive = ui::Colour(200, 200, 200);
|
||||
|
@ -13,21 +13,21 @@
|
||||
SaveIDMessage::SaveIDMessage(int id):
|
||||
ui::Window(ui::Point((XRES-244)/2, (YRES-90)/2), ui::Point(244, 90))
|
||||
{
|
||||
int textWidth = Graphics::textwidth("Save ID");
|
||||
ui::Label * titleLabel = new ui::Label(ui::Point(4, 5), ui::Point(textWidth+20, 16), "Save ID");
|
||||
int textWidth = Graphics::textwidth("Save ID"_i18n);
|
||||
ui::Label * titleLabel = new ui::Label(ui::Point(4, 5), ui::Point(textWidth+20, 16), "Save ID"_i18n);
|
||||
titleLabel->SetTextColour(style::Colour::InformationTitle);
|
||||
titleLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||
titleLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
||||
AddComponent(titleLabel);
|
||||
|
||||
textWidth = Graphics::textwidth("Saved Successfully!");
|
||||
ui::Label * messageLabel = new ui::Label(ui::Point(4, 24), ui::Point(textWidth+20, 16), "Saved Successfully!");
|
||||
textWidth = Graphics::textwidth("Saved Successfully!"_i18n);
|
||||
ui::Label * messageLabel = new ui::Label(ui::Point(4, 24), ui::Point(textWidth+20, 16), "Saved Successfully!"_i18n);
|
||||
messageLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||
messageLabel->Appearance.VerticalAlign = ui::Appearance::AlignTop;
|
||||
AddComponent(messageLabel);
|
||||
|
||||
textWidth = Graphics::textwidth("Click the box below to copy the save ID");
|
||||
ui::Label * copyTextLabel = new ui::Label(ui::Point((Size.X-textWidth-20)/2, 35), ui::Point(textWidth+20, 16), "Click the box below to copy the save id");
|
||||
textWidth = Graphics::textwidth("Click the box below to copy the save ID"_i18n);
|
||||
ui::Label * copyTextLabel = new ui::Label(ui::Point((Size.X-textWidth-20)/2, 35), ui::Point(textWidth+20, 16), "Click the box below to copy the save id"_i18n);
|
||||
copyTextLabel->SetTextColour(ui::Colour(150, 150, 150));
|
||||
copyTextLabel->Appearance.HorizontalAlign = ui::Appearance::AlignCentre;
|
||||
AddComponent(copyTextLabel);
|
||||
@ -36,7 +36,7 @@ SaveIDMessage::SaveIDMessage(int id):
|
||||
ui::CopyTextButton * copyTextButton = new ui::CopyTextButton(ui::Point((Size.X-textWidth-10)/2, 50), ui::Point(textWidth+10, 18), String::Build(id), copyTextLabel);
|
||||
AddComponent(copyTextButton);
|
||||
|
||||
ui::Button * okayButton = new ui::Button(ui::Point(0, Size.Y-16), ui::Point(Size.X, 16), "OK");
|
||||
ui::Button * okayButton = new ui::Button(ui::Point(0, Size.Y-16), ui::Point(Size.X, 16), "OK"_i18n);
|
||||
okayButton->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||
okayButton->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
||||
okayButton->SetActionCallback({ [this] {
|
||||
|
@ -47,7 +47,7 @@ TextPrompt::TextPrompt(String title, String message, String text, String placeho
|
||||
AddComponent(textField);
|
||||
FocusComponent(textField);
|
||||
|
||||
ui::Button * cancelButton = new ui::Button(ui::Point(0, Size.Y-16), ui::Point((Size.X/2)+1, 16), "Cancel");
|
||||
ui::Button * cancelButton = new ui::Button(ui::Point(0, Size.Y-16), ui::Point((Size.X/2)+1, 16), "Cancel"_i18n);
|
||||
cancelButton->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||
cancelButton->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
||||
cancelButton->Appearance.BorderInactive = ui::Colour(200, 200, 200);
|
||||
@ -60,7 +60,7 @@ TextPrompt::TextPrompt(String title, String message, String text, String placeho
|
||||
AddComponent(cancelButton);
|
||||
SetCancelButton(cancelButton);
|
||||
|
||||
ui::Button * okayButton = new ui::Button(ui::Point(Size.X/2, Size.Y-16), ui::Point(Size.X/2, 16), "Okay");
|
||||
ui::Button * okayButton = new ui::Button(ui::Point(Size.X/2, Size.Y-16), ui::Point(Size.X/2, 16), "OK"_i18n);
|
||||
okayButton->Appearance.HorizontalAlign = ui::Appearance::AlignRight;
|
||||
okayButton->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
||||
okayButton->Appearance.TextInactive = style::Colour::WarningTitle;
|
||||
|
@ -20,7 +20,7 @@ ElementSearchActivity::ElementSearchActivity(GameController * gameController, st
|
||||
firstResult(NULL),
|
||||
gameController(gameController),
|
||||
tools(tools),
|
||||
toolTip(""),
|
||||
toolTip(""_ascii),
|
||||
toolTipPresence(0),
|
||||
shiftPressed(false),
|
||||
ctrlPressed(false),
|
||||
@ -28,20 +28,20 @@ ElementSearchActivity::ElementSearchActivity(GameController * gameController, st
|
||||
isToolTipFadingIn(false),
|
||||
exit(false)
|
||||
{
|
||||
ui::Label * title = new ui::Label(ui::Point(4, 5), ui::Point(Size.X-8, 15), "Element Search");
|
||||
ui::Label * title = new ui::Label(ui::Point(4, 5), ui::Point(Size.X-8, 15), "Element Search"_i18n);
|
||||
title->SetTextColour(style::Colour::InformationTitle);
|
||||
title->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||
AddComponent(title);
|
||||
|
||||
searchField = new ui::Textbox(ui::Point(8, 23), ui::Point(Size.X-16, 17), "");
|
||||
searchField = new ui::Textbox(ui::Point(8, 23), ui::Point(Size.X-16, 17), ""_ascii);
|
||||
searchField->SetActionCallback({ [this] { searchTools(searchField->GetText()); } });
|
||||
searchField->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||
AddComponent(searchField);
|
||||
FocusComponent(searchField);
|
||||
|
||||
ui::Button * closeButton = new ui::Button(ui::Point(0, Size.Y-15), ui::Point((Size.X/2)+1, 15), "Close");
|
||||
ui::Button * closeButton = new ui::Button(ui::Point(0, Size.Y-15), ui::Point((Size.X/2)+1, 15), "Close"_i18n);
|
||||
closeButton->SetActionCallback({ [this] { exit = true; } });
|
||||
ui::Button * okButton = new ui::Button(ui::Point(Size.X/2, Size.Y-15), ui::Point(Size.X/2, 15), "OK");
|
||||
ui::Button * okButton = new ui::Button(ui::Point(Size.X/2, Size.Y-15), ui::Point(Size.X/2, 15), "OK"_i18n);
|
||||
okButton->SetActionCallback({ [this] {
|
||||
if (GetFirstResult())
|
||||
SetActiveTool(0, GetFirstResult());
|
||||
@ -50,7 +50,7 @@ ElementSearchActivity::ElementSearchActivity(GameController * gameController, st
|
||||
AddComponent(okButton);
|
||||
AddComponent(closeButton);
|
||||
|
||||
searchTools("");
|
||||
searchTools(""_ascii);
|
||||
}
|
||||
|
||||
void ElementSearchActivity::searchTools(String query)
|
||||
@ -143,7 +143,7 @@ void ElementSearchActivity::searchTools(String query)
|
||||
ToolButton * tempButton;
|
||||
|
||||
if(tempTexture)
|
||||
tempButton = new ToolButton(current+viewPosition, ui::Point(30, 18), "", tool->GetIdentifier(), tool->GetDescription());
|
||||
tempButton = new ToolButton(current+viewPosition, ui::Point(30, 18), ""_ascii, tool->GetIdentifier(), tool->GetDescription());
|
||||
else
|
||||
tempButton = new ToolButton(current+viewPosition, ui::Point(30, 18), tool->GetName(), tool->GetIdentifier(), tool->GetDescription());
|
||||
|
||||
|
@ -313,17 +313,17 @@ FontEditor::FontEditor(ByteString _dataFile):
|
||||
next->SetActionCallback({ [this] { NextChar(); } });
|
||||
AddComponent(next);
|
||||
|
||||
ui::Button *shrink = new ui::Button(ui::Point(currentX, baseline), ui::Point(17, 17), "><");
|
||||
ui::Button *shrink = new ui::Button(ui::Point(currentX, baseline), ui::Point(17, 17), "><"_ascii);
|
||||
currentX += 18;
|
||||
shrink->SetActionCallback({ [this] { ShrinkChar(); } });
|
||||
AddComponent(shrink);
|
||||
|
||||
ui::Button *grow = new ui::Button(ui::Point(currentX, baseline), ui::Point(17, 17), "<>");
|
||||
ui::Button *grow = new ui::Button(ui::Point(currentX, baseline), ui::Point(17, 17), "<>"_ascii);
|
||||
currentX += 18;
|
||||
grow->SetActionCallback({ [this] { GrowChar(); } });
|
||||
AddComponent(grow);
|
||||
|
||||
ui::Button *add = new ui::Button(ui::Point(currentX, baseline), ui::Point(36, 17), "Add");
|
||||
ui::Button *add = new ui::Button(ui::Point(currentX, baseline), ui::Point(36, 17), "Add"_ascii);
|
||||
currentX += 37;
|
||||
add->SetActionCallback({ [this] {
|
||||
if (fontWidths.find(currentChar) == fontWidths.end())
|
||||
@ -335,7 +335,7 @@ FontEditor::FontEditor(ByteString _dataFile):
|
||||
} });
|
||||
AddComponent(add);
|
||||
|
||||
ui::Button *remove = new ui::Button(ui::Point(currentX, baseline), ui::Point(36, 17), "Remove");
|
||||
ui::Button *remove = new ui::Button(ui::Point(currentX, baseline), ui::Point(36, 17), "Remove"_ascii);
|
||||
currentX += 37;
|
||||
remove->SetActionCallback({ [this] {
|
||||
if (fontWidths.find(currentChar) != fontWidths.end())
|
||||
@ -347,7 +347,7 @@ FontEditor::FontEditor(ByteString _dataFile):
|
||||
} });
|
||||
AddComponent(remove);
|
||||
|
||||
ui::Button *showGrid = new ui::Button(ui::Point(currentX, baseline), ui::Point(32, 17), "Grid");
|
||||
ui::Button *showGrid = new ui::Button(ui::Point(currentX, baseline), ui::Point(32, 17), "Grid"_ascii);
|
||||
currentX += 33;
|
||||
showGrid->SetTogglable(true);
|
||||
showGrid->SetToggleState(grid);
|
||||
@ -356,7 +356,7 @@ FontEditor::FontEditor(ByteString _dataFile):
|
||||
} });
|
||||
AddComponent(showGrid);
|
||||
|
||||
ui::Button *showRulers = new ui::Button(ui::Point(currentX, baseline), ui::Point(32, 17), "Rulers");
|
||||
ui::Button *showRulers = new ui::Button(ui::Point(currentX, baseline), ui::Point(32, 17), "Rulers"_ascii);
|
||||
currentX += 33;
|
||||
showRulers->SetTogglable(true);
|
||||
showRulers->SetToggleState(rulers);
|
||||
@ -382,12 +382,12 @@ FontEditor::FontEditor(ByteString _dataFile):
|
||||
baseline += 18;
|
||||
currentX = 1;
|
||||
|
||||
ui::Button *render = new ui::Button(ui::Point(currentX, baseline), ui::Point(50, 17), "Render");
|
||||
ui::Button *render = new ui::Button(ui::Point(currentX, baseline), ui::Point(50, 17), "Render"_ascii);
|
||||
currentX += 51;
|
||||
render->SetActionCallback({ [this] { Render(); } });
|
||||
AddComponent(render);
|
||||
|
||||
savedButton = new ui::Button(ui::Point(currentX, baseline), ui::Point(50, 17), "Save");
|
||||
savedButton = new ui::Button(ui::Point(currentX, baseline), ui::Point(50, 17), "Save"_ascii);
|
||||
currentX += 51;
|
||||
savedButton->SetTogglable(true);
|
||||
savedButton->SetToggleState(true);
|
||||
@ -398,7 +398,7 @@ FontEditor::FontEditor(ByteString _dataFile):
|
||||
|
||||
ui::ScrollPanel *outputPanel = new ui::ScrollPanel(ui::Point(Size.X / 2, baseline), ui::Point(Size.X / 2, Size.Y - baseline));
|
||||
AddComponent(outputPanel);
|
||||
StretchLabel *outputPreview = new StretchLabel(ui::Point(0, 0), ui::Point(Size.X / 2, 0), "");
|
||||
StretchLabel *outputPreview = new StretchLabel(ui::Point(0, 0), ui::Point(Size.X / 2, 0), ""_ascii);
|
||||
outputPreview->SetMultiline(true);
|
||||
outputPreview->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||
outputPreview->Appearance.VerticalAlign = ui::Appearance::AlignTop;
|
||||
@ -454,9 +454,9 @@ FontEditor::FontEditor(ByteString _dataFile):
|
||||
if(p[0] < 0x20)
|
||||
p[0] = 0x20;
|
||||
if(p[0] == p[1])
|
||||
input << p[0] << "\n";
|
||||
input << p[0] << "\n"_ascii;
|
||||
else
|
||||
input << p[0] << ":" << p[1] << "\n";
|
||||
input << p[0] << ":"_ascii << p[1] << "\n"_ascii;
|
||||
}
|
||||
inputPreview->SetText(input.Build());
|
||||
textChangedCallback();
|
||||
@ -530,7 +530,7 @@ void FontEditor::OnDraw()
|
||||
}
|
||||
else
|
||||
{
|
||||
g->drawtext(8, 8, "No character", 255, 0, 0, 255);
|
||||
g->drawtext(8, 8, "No character"_ascii, 255, 0, 0, 255);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ void Button::TextPosition(String ButtonText)
|
||||
{
|
||||
int position = Graphics::textwidthx(buttonDisplayText, Size.X - (Appearance.icon? 38 : 22));
|
||||
buttonDisplayText = buttonDisplayText.erase(position, buttonDisplayText.length()-position);
|
||||
buttonDisplayText += "...";
|
||||
buttonDisplayText += "..."_ascii;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace ui
|
||||
ui::Button::OnMouseClick(x, y, button);
|
||||
ClipboardPush(ButtonText.ToUtf8());
|
||||
|
||||
copyTextLabel->SetText("Copied!");
|
||||
copyTextLabel->SetText("Copied!"_i18n);
|
||||
|
||||
Appearance.TextInactive = ui::Colour(180, 230, 180);
|
||||
Appearance.TextHover = ui::Colour(180, 230, 180);
|
||||
|
@ -77,7 +77,7 @@ void Engine::Exit()
|
||||
|
||||
void Engine::ConfirmExit()
|
||||
{
|
||||
new ConfirmPrompt("You are about to quit", "Are you sure you want to exit the game?", { [] {
|
||||
new ConfirmPrompt("You are about to quit"_i18n, "Are you sure you want to exit the game?"_i18n, { [] {
|
||||
ui::Engine::Ref().Exit();
|
||||
} });
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ Label::Label(Point position, Point size, String labelText):
|
||||
SetText(labelText);
|
||||
|
||||
menu = new ContextMenu(this);
|
||||
menu->AddItem(ContextMenuItem("Copy", 0, true));
|
||||
menu->AddItem(ContextMenuItem("Copy"_i18n, 0, true));
|
||||
}
|
||||
|
||||
Label::~Label()
|
||||
@ -206,8 +206,8 @@ void Label::updateSelection()
|
||||
{
|
||||
auto indexL = displayTextWrapper.Clear2Index(selectionIndexL.clear_index);
|
||||
auto indexH = displayTextWrapper.Clear2Index(selectionIndexH.clear_index);
|
||||
displayTextWithSelection.Insert(indexL.wrapped_index , "\x01");
|
||||
displayTextWithSelection.Insert(indexH.wrapped_index + 1, "\x01");
|
||||
displayTextWithSelection.Insert(indexL.wrapped_index , "\x01"_ascii);
|
||||
displayTextWithSelection.Insert(indexH.wrapped_index + 1, "\x01"_ascii);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ ProgressBar::ProgressBar(Point position, Point size, int startProgress, String s
|
||||
Component(position, size),
|
||||
progress(0),
|
||||
intermediatePos(0.0f),
|
||||
progressStatus("")
|
||||
progressStatus(""_ascii)
|
||||
{
|
||||
SetStatus(startStatus);
|
||||
SetProgress(startProgress);
|
||||
|
@ -236,8 +236,8 @@ void Window::DoDraw()
|
||||
Graphics * g = ui::Engine::Ref().g;
|
||||
String tempString, tempString2;
|
||||
|
||||
tempString = String::Build("Position: L ", focusedComponent_->Position.X, ", R ", Size.X-(focusedComponent_->Position.X+focusedComponent_->Size.X), ", T: ", focusedComponent_->Position.Y, ", B: ", Size.Y-(focusedComponent_->Position.Y+focusedComponent_->Size.Y));
|
||||
tempString2 = String::Build("Size: ", focusedComponent_->Size.X, ", ", focusedComponent_->Size.Y);
|
||||
tempString = String::Build("Position: L "_ascii, focusedComponent_->Position.X, ", R "_ascii, Size.X-(focusedComponent_->Position.X+focusedComponent_->Size.X), ", T: "_ascii, focusedComponent_->Position.Y, ", B: "_ascii, Size.Y-(focusedComponent_->Position.Y+focusedComponent_->Size.Y));
|
||||
tempString2 = String::Build("Size: "_ascii, focusedComponent_->Size.X, ", "_ascii, focusedComponent_->Size.Y);
|
||||
|
||||
if (Graphics::textwidth(tempString)+xPos > WINDOWW)
|
||||
xPos = WINDOWW-(Graphics::textwidth(tempString)+5);
|
||||
|
@ -22,19 +22,20 @@ LocalBrowserView::LocalBrowserView():
|
||||
lastChanged(0),
|
||||
pageCount(0)
|
||||
{
|
||||
nextButton = new ui::Button(ui::Point(WINDOWW-52, WINDOWH-18), ui::Point(50, 16), String("Next ") + 0xE015);
|
||||
previousButton = new ui::Button(ui::Point(2, WINDOWH-18), ui::Point(50, 16), 0xE016 + String(" Prev"));
|
||||
undeleteButton = new ui::Button(ui::Point(WINDOWW-122, WINDOWH-18), ui::Point(60, 16), "Rescan");
|
||||
nextButton = new ui::Button(ui::Point(WINDOWW-52, WINDOWH-18), ui::Point(50, 16), "Next "_i18n + 0xE015);
|
||||
previousButton = new ui::Button(ui::Point(2, WINDOWH-18), ui::Point(50, 16), 0xE016 + " Prev"_i18n);
|
||||
undeleteButton = new ui::Button(ui::Point(WINDOWW-122, WINDOWH-18), ui::Point(60, 16), "Rescan"_i18n);
|
||||
AddComponent(nextButton);
|
||||
AddComponent(previousButton);
|
||||
AddComponent(undeleteButton);
|
||||
|
||||
pageTextbox = new ui::Textbox(ui::Point(283, WINDOWH-18), ui::Point(41, 16), "");
|
||||
pageTextbox = new ui::Textbox(ui::Point(283, WINDOWH-18), ui::Point(41, 16), ""_ascii);
|
||||
pageTextbox->SetActionCallback({ [this] { textChanged(); } });
|
||||
pageTextbox->SetInputType(ui::Textbox::Number);
|
||||
pageLabel = new ui::Label(ui::Point(0, WINDOWH-18), ui::Point(30, 16), "Page"); //page [TEXTBOX] of y
|
||||
auto pageOf = i18nMulti("Page", "of "); //page [TEXTBOX] of y
|
||||
pageLabel = new ui::Label(ui::Point(0, WINDOWH-18), ui::Point(30, 16), pageOf[0]);
|
||||
pageLabel->Appearance.HorizontalAlign = ui::Appearance::AlignRight;
|
||||
pageCountLabel = new ui::Label(ui::Point(WINDOWW/2+6, WINDOWH-18), ui::Point(50, 16), "");
|
||||
pageCountLabel = new ui::Label(ui::Point(WINDOWW/2+6, WINDOWH-18), ui::Point(50, 16), ""_ascii);
|
||||
pageCountLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||
AddComponent(pageLabel);
|
||||
AddComponent(pageCountLabel);
|
||||
@ -50,7 +51,7 @@ LocalBrowserView::LocalBrowserView():
|
||||
|
||||
undeleteButton->SetActionCallback({ [this] { c->RescanStamps(); } });
|
||||
|
||||
removeSelected = new ui::Button(ui::Point(((WINDOWW-100)/2), WINDOWH-18), ui::Point(100, 16), "Delete");
|
||||
removeSelected = new ui::Button(ui::Point(((WINDOWW-100)/2), WINDOWH-18), ui::Point(100, 16), "Delete"_i18n);
|
||||
removeSelected->Visible = false;
|
||||
removeSelected->SetActionCallback({ [this] { c->RemoveSelected(); } });
|
||||
AddComponent(removeSelected);
|
||||
@ -59,10 +60,8 @@ LocalBrowserView::LocalBrowserView():
|
||||
void LocalBrowserView::textChanged()
|
||||
{
|
||||
int num = pageTextbox->GetText().ToNumber<int>(true);
|
||||
if (num < 0) //0 is allowed so that you can backspace the 1
|
||||
pageTextbox->SetText("1");
|
||||
else if (num > pageCount)
|
||||
pageTextbox->SetText(String::Build(pageCount));
|
||||
if(num < 0 || num > pageCount) //0 is allowed so that you can backspace the 1
|
||||
pageTextbox->SetText(String::Build(num < 0 ? 1 : pageCount));
|
||||
changed = true;
|
||||
lastChanged = GetTicks()+600;
|
||||
}
|
||||
@ -86,7 +85,8 @@ void LocalBrowserView::NotifyPageChanged(LocalBrowserModel * sender)
|
||||
}
|
||||
else
|
||||
{
|
||||
String pageInfo = String::Build("of ", pageCount);
|
||||
auto pageOf = i18nMulti("Page", "of ");
|
||||
String pageInfo = String::Build(pageOf[1], pageCount);
|
||||
pageCountLabel->SetText(pageInfo);
|
||||
int width = Graphics::textwidth(pageInfo);
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "LoginView.h"
|
||||
|
||||
#include "client/Client.h"
|
||||
#include "Config.h"
|
||||
|
||||
LoginModel::LoginModel():
|
||||
currentUser(0, "")
|
||||
@ -14,19 +15,19 @@ void LoginModel::Login(ByteString username, ByteString password)
|
||||
{
|
||||
if (username.Contains("@"))
|
||||
{
|
||||
statusText = "Use your Powder Toy account to log in, not your email. If you don't have a Powder Toy account, you can create one at https://powdertoy.co.uk/Register.html";
|
||||
statusText = "Use your Powder Toy account to log in, not your email. If you don't have a Powder Toy account, you can create one at "_i18n + ByteString(SCHEME SERVER "/Register.html").FromAscii();
|
||||
loginStatus = false;
|
||||
notifyStatusChanged();
|
||||
return;
|
||||
}
|
||||
statusText = "Logging in...";
|
||||
statusText = "Logging in..."_i18n;
|
||||
loginStatus = false;
|
||||
notifyStatusChanged();
|
||||
LoginStatus status = Client::Ref().Login(username, password, currentUser);
|
||||
switch(status)
|
||||
{
|
||||
case LoginOkay:
|
||||
statusText = "Logged in";
|
||||
statusText = "Logged in"_i18n;
|
||||
loginStatus = true;
|
||||
break;
|
||||
case LoginError:
|
||||
|
@ -16,12 +16,12 @@
|
||||
|
||||
LoginView::LoginView():
|
||||
ui::Window(ui::Point(-1, -1), ui::Point(200, 87)),
|
||||
loginButton(new ui::Button(ui::Point(200-100, 87-17), ui::Point(100, 17), "Sign in")),
|
||||
cancelButton(new ui::Button(ui::Point(0, 87-17), ui::Point(101, 17), "Sign Out")),
|
||||
titleLabel(new ui::Label(ui::Point(4, 5), ui::Point(200-16, 16), "Server login")),
|
||||
infoLabel(new ui::Label(ui::Point(8, 67), ui::Point(200-16, 16), "")),
|
||||
usernameField(new ui::Textbox(ui::Point(8, 25), ui::Point(200-16, 17), Client::Ref().GetAuthUser().Username.FromUtf8(), "[username]")),
|
||||
passwordField(new ui::Textbox(ui::Point(8, 46), ui::Point(200-16, 17), "", "[password]")),
|
||||
loginButton(new ui::Button(ui::Point(200-100, 87-17), ui::Point(100, 17), "Sign in"_i18n)),
|
||||
cancelButton(new ui::Button(ui::Point(0, 87-17), ui::Point(101, 17), "Sign Out"_i18n)),
|
||||
titleLabel(new ui::Label(ui::Point(4, 5), ui::Point(200-16, 16), "Server login"_i18n)),
|
||||
infoLabel(new ui::Label(ui::Point(8, 67), ui::Point(200-16, 16), ""_ascii)),
|
||||
usernameField(new ui::Textbox(ui::Point(8, 25), ui::Point(200-16, 17), Client::Ref().GetAuthUser().Username.FromUtf8(), "[username]"_i18n)),
|
||||
passwordField(new ui::Textbox(ui::Point(8, 46), ui::Point(200-16, 17), ""_ascii, "[password]"_i18n)),
|
||||
targetSize(0, 0)
|
||||
{
|
||||
targetSize = Size;
|
||||
|
@ -58,7 +58,7 @@ bool PreviewController::SubmitComment(String comment)
|
||||
{
|
||||
if(comment.length() < 4)
|
||||
{
|
||||
new ErrorMessage("Error", "Comment is too short");
|
||||
new ErrorMessage("Error"_i18n, "Comment is too short"_i18n);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@ -66,7 +66,7 @@ bool PreviewController::SubmitComment(String comment)
|
||||
RequestStatus status = Client::Ref().AddComment(saveId, comment);
|
||||
if(status != RequestOkay)
|
||||
{
|
||||
new ErrorMessage("Error submitting comment", Client::Ref().GetLastError());
|
||||
new ErrorMessage("Error submitting comment"_i18n, Client::Ref().GetLastError());
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@ -109,10 +109,10 @@ void PreviewController::Report(String message)
|
||||
if(Client::Ref().ReportSave(saveId, message) == RequestOkay)
|
||||
{
|
||||
Exit();
|
||||
new InformationMessage("Information", "Report submitted", false);
|
||||
new InformationMessage("Information"_i18n, "Report submitted"_i18n, false);
|
||||
}
|
||||
else
|
||||
new ErrorMessage("Error", "Unable to file report: " + Client::Ref().GetLastError());
|
||||
new ErrorMessage("Error"_i18n, "Unable to file report: "_i18n + Client::Ref().GetLastError());
|
||||
}
|
||||
|
||||
void PreviewController::FavouriteSave()
|
||||
@ -128,7 +128,7 @@ void PreviewController::FavouriteSave()
|
||||
}
|
||||
catch (PreviewModelException & e)
|
||||
{
|
||||
new ErrorMessage("Error", ByteString(e.what()).FromUtf8());
|
||||
new ErrorMessage("Error"_i18n, ByteString(e.what()).FromUtf8());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -39,9 +39,9 @@ void PreviewModel::SetFavourite(bool favourite)
|
||||
if (Client::Ref().FavouriteSave(saveInfo->id, favourite) == RequestOkay)
|
||||
saveInfo->Favourite = favourite;
|
||||
else if (favourite)
|
||||
throw PreviewModelException("Error, could not fav. the save: " + Client::Ref().GetLastError());
|
||||
throw PreviewModelException("Error, could not fav. the save: "_i18n + Client::Ref().GetLastError());
|
||||
else
|
||||
throw PreviewModelException("Error, could not unfav. the save: " + Client::Ref().GetLastError());
|
||||
throw PreviewModelException("Error, could not unfav. the save: "_i18n + Client::Ref().GetLastError());
|
||||
notifySaveChanged();
|
||||
}
|
||||
}
|
||||
@ -175,12 +175,12 @@ void PreviewModel::OnSaveReady()
|
||||
{
|
||||
GameSave *gameSave = new GameSave(*saveData);
|
||||
if (gameSave->fromNewerVersion)
|
||||
new ErrorMessage("This save is from a newer version", "Please update TPT in game or at https://powdertoy.co.uk");
|
||||
new ErrorMessage("This save is from a newer version"_i18n, "Please update TPT in game or at "_i18n + ByteString(SCHEME SERVER).FromAscii());
|
||||
saveInfo->SetGameSave(gameSave);
|
||||
}
|
||||
catch(ParseException &e)
|
||||
{
|
||||
new ErrorMessage("Error", ByteString(e.what()).FromUtf8());
|
||||
new ErrorMessage("Error"_i18n, ByteString(e.what()).FromUtf8());
|
||||
canOpen = false;
|
||||
}
|
||||
notifySaveChanged();
|
||||
@ -331,7 +331,7 @@ void PreviewModel::Update()
|
||||
else
|
||||
{
|
||||
for (size_t i = 0; i < observers.size(); i++)
|
||||
observers[i]->SaveLoadingError("Could not parse save info");
|
||||
observers[i]->SaveLoadingError("Could not parse save info"_i18n);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -22,7 +22,7 @@ CommandInterface::CommandInterface(GameController * c, GameModel * m) {
|
||||
|
||||
int CommandInterface::Command(String command)
|
||||
{
|
||||
lastError = "No interpreter";
|
||||
lastError = "No interpreter"_i18n;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -280,7 +280,7 @@ void luacon_hook(lua_State * l, lua_Debug * ar)
|
||||
{
|
||||
if(ar->event == LUA_HOOKCOUNT && Platform::GetTime()-ui::Engine::Ref().LastTick() > 3000)
|
||||
{
|
||||
if(ConfirmPrompt::Blocking("Script not responding", "The Lua script may have stopped responding. There might be an infinite loop. Press \"Stop\" to stop it", "Stop"))
|
||||
if(ConfirmPrompt::Blocking("Script not responding"_i18n, "The Lua script may have stopped responding. There might be an infinite loop. Press \"Stop\" to stop it"_i18n, "Stop"_i18n))
|
||||
luaL_error(l, "Error: Script not responding");
|
||||
ui::Engine::Ref().LastTick(Platform::GetTime());
|
||||
}
|
||||
@ -459,7 +459,7 @@ int luatpt_graphics_func(lua_State *l)
|
||||
int luatpt_error(lua_State* l)
|
||||
{
|
||||
String errorMessage = ByteString(luaL_optstring(l, 1, "Error text")).FromUtf8();
|
||||
ErrorMessage::Blocking("Error", errorMessage);
|
||||
ErrorMessage::Blocking("Error"_i18n, errorMessage);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -560,12 +560,12 @@ int luatpt_setconsole(lua_State* l)
|
||||
int luatpt_log(lua_State* l)
|
||||
{
|
||||
int args = lua_gettop(l);
|
||||
String text = "";
|
||||
String text = ""_ascii;
|
||||
for(int i = 1; i <= args; i++)
|
||||
{
|
||||
luaL_tostring(l, -1);
|
||||
if(text.length())
|
||||
text=ByteString(luaL_optstring(l, -1, "")).FromUtf8() + ", " + text;
|
||||
text=ByteString(luaL_optstring(l, -1, "")).FromUtf8() + ", "_ascii + text;
|
||||
else
|
||||
text=ByteString(luaL_optstring(l, -1, "")).FromUtf8();
|
||||
lua_pop(l, 2);
|
||||
@ -573,7 +573,7 @@ int luatpt_log(lua_State* l)
|
||||
if((*luacon_currentCommand))
|
||||
{
|
||||
if(luacon_lastError->length())
|
||||
*luacon_lastError += "; ";
|
||||
*luacon_lastError += "; "_ascii;
|
||||
*luacon_lastError += text;
|
||||
}
|
||||
else
|
||||
@ -1386,7 +1386,7 @@ int luatpt_getscript(lua_State* l)
|
||||
int confirmPrompt = luaL_optint(l, 4, 1);
|
||||
|
||||
ByteString url = ByteString::Build(SCHEME "starcatcher.us/scripts/main.lua?get=", scriptID);
|
||||
if (confirmPrompt && !ConfirmPrompt::Blocking("Do you want to install script?", url.FromUtf8(), "Install"))
|
||||
if (confirmPrompt && !ConfirmPrompt::Blocking("Do you want to install script?"_i18n, url.FromUtf8(), "Install"_i18n))
|
||||
return 0;
|
||||
|
||||
int ret;
|
||||
@ -1410,7 +1410,7 @@ int luatpt_getscript(lua_State* l)
|
||||
{
|
||||
fclose(outputfile);
|
||||
outputfile = NULL;
|
||||
if (!confirmPrompt || ConfirmPrompt::Blocking("File already exists, overwrite?", ByteString(filename).FromUtf8(), "Overwrite"))
|
||||
if (!confirmPrompt || ConfirmPrompt::Blocking("File already exists, overwrite?"_i18n, ByteString(filename).FromUtf8(), "Overwrite"_i18n))
|
||||
{
|
||||
outputfile = fopen(filename, "wb");
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ LuaCheckbox::LuaCheckbox(lua_State * l) :
|
||||
int sizeY = luaL_optinteger(l, 4, 10);
|
||||
String text = ByteString(luaL_optstring(l, 5, "")).FromUtf8();
|
||||
|
||||
checkbox = new ui::Checkbox(ui::Point(posX, posY), ui::Point(sizeX, sizeY), text, "");
|
||||
checkbox = new ui::Checkbox(ui::Point(posX, posY), ui::Point(sizeX, sizeY), text, ""_ascii);
|
||||
component = checkbox;
|
||||
checkbox->SetActionCallback({ [this] { triggerAction(); } });
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ bool LuaEvents::HandleEvent(LuaScriptInterface *luacon_ci, Event *event, ByteStr
|
||||
int callret = lua_pcall(l, numArgs, 1, 0);
|
||||
if (callret)
|
||||
{
|
||||
if (luacon_geterror(luacon_ci) == "Error: Script not responding")
|
||||
if (luacon_geterror(luacon_ci) == "Error: Script not responding"_i18n) // probably not a good idea
|
||||
{
|
||||
ui::Engine::Ref().LastTick(Platform::GetTime());
|
||||
for (int j = i; j <= len - 1; j++)
|
||||
|
@ -54,7 +54,7 @@ AnyType::operator StringType()
|
||||
else if (type == TypePoint && value.pt)
|
||||
{
|
||||
ui::Point thisPoint = *(value.pt);
|
||||
return StringType(String::Build(thisPoint.X, ",", thisPoint.Y));
|
||||
return StringType(String::Build(thisPoint.X, ',', thisPoint.Y));
|
||||
}
|
||||
else
|
||||
throw InvalidConversionException(type, TypeString);
|
||||
@ -71,7 +71,7 @@ AnyType::operator PointType()
|
||||
{
|
||||
int x, y;
|
||||
if(String::Split comma = (*value.str).SplitNumber(x))
|
||||
if(comma.After().BeginsWith(","))
|
||||
if(comma.After().BeginsWith(","_ascii))
|
||||
if(String::Split end = comma.After().Substr(1).SplitNumber(y))
|
||||
if(!end.After().size())
|
||||
return PointType(x, y);
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
Element::Element():
|
||||
Identifier("DEFAULT_INVALID"),
|
||||
Name(""),
|
||||
Name(""_ascii),
|
||||
Colour(PIXPACK(0xFF00FF)),
|
||||
MenuVisible(0),
|
||||
MenuSection(0),
|
||||
@ -29,7 +29,7 @@ Element::Element():
|
||||
Weight(50),
|
||||
|
||||
HeatConduct(128),
|
||||
Description("No description"),
|
||||
Description("No description"_i18n),
|
||||
|
||||
Properties(TYPE_SOLID),
|
||||
|
||||
|
@ -11,8 +11,8 @@
|
||||
|
||||
SimTool::SimTool():
|
||||
Identifier("DEFAULT_TOOL_INVALID"),
|
||||
Name(""),
|
||||
Name(""_ascii),
|
||||
Colour(PIXPACK(0xFFFFFF)),
|
||||
Description("NULL Tool, does NOTHING")
|
||||
Description("NULL Tool, does NOTHING"_i18n)
|
||||
{
|
||||
}
|
||||
|
@ -5219,7 +5219,7 @@ String Simulation::ElementResolve(int type, int ctype)
|
||||
{
|
||||
return elements[type].Name;
|
||||
}
|
||||
return "Empty";
|
||||
return "Empty"_i18n;
|
||||
}
|
||||
|
||||
String Simulation::BasicParticleInfo(Particle const &sample_part)
|
||||
@ -5230,17 +5230,17 @@ String Simulation::BasicParticleInfo(Particle const &sample_part)
|
||||
int pavg1int = (int)sample_part.pavg[1];
|
||||
if (type == PT_LAVA && ctype && IsValidElement(ctype))
|
||||
{
|
||||
sampleInfo << "Molten " << ElementResolve(ctype, -1);
|
||||
sampleInfo << "Molten "_i18n << ElementResolve(ctype, -1);
|
||||
}
|
||||
else if ((type == PT_PIPE || type == PT_PPIP) && ctype && IsValidElement(ctype))
|
||||
{
|
||||
if (ctype == PT_LAVA && pavg1int && IsValidElement(pavg1int))
|
||||
{
|
||||
sampleInfo << ElementResolve(type, -1) << " with molten " << ElementResolve(pavg1int, -1);
|
||||
sampleInfo << ElementResolve(type, -1) << " with molten "_i18n << ElementResolve(pavg1int, -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
sampleInfo << ElementResolve(type, -1) << " with " << ElementResolve(ctype, pavg1int);
|
||||
sampleInfo << ElementResolve(type, -1) << " with "_i18n << ElementResolve(ctype, pavg1int);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -104,7 +104,7 @@ void Task::before()
|
||||
|
||||
bool Task::doWork()
|
||||
{
|
||||
notifyStatus("Fake progress");
|
||||
notifyStatus("Fake progress"_ascii);
|
||||
for(int i = 0; i < 100; i++)
|
||||
{
|
||||
notifyProgress(i);
|
||||
|
@ -18,7 +18,7 @@ TaskWindow::TaskWindow(String title_, Task * task_, bool closeOnDone):
|
||||
progress(0),
|
||||
done(false),
|
||||
closeOnDone(closeOnDone),
|
||||
progressStatus("0%")
|
||||
progressStatus("0%"_ascii)
|
||||
{
|
||||
|
||||
ui::Label * tempLabel = new ui::Label(ui::Point(4, 5), ui::Point(Size.X-8, 15), title);
|
||||
@ -27,7 +27,7 @@ TaskWindow::TaskWindow(String title_, Task * task_, bool closeOnDone):
|
||||
tempLabel->SetTextColour(style::Colour::WarningTitle);
|
||||
AddComponent(tempLabel);
|
||||
|
||||
statusLabel = new ui::Label(ui::Point(4, 23), ui::Point(Size.X-8, 15), "");
|
||||
statusLabel = new ui::Label(ui::Point(4, 23), ui::Point(Size.X-8, 15), ""_ascii);
|
||||
statusLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||
statusLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
||||
AddComponent(statusLabel);
|
||||
@ -45,7 +45,7 @@ void TaskWindow::NotifyStatus(Task * task)
|
||||
|
||||
void TaskWindow::NotifyError(Task * task)
|
||||
{
|
||||
new ErrorMessage("Error", task->GetError());
|
||||
new ErrorMessage("Error"_i18n, task->GetError());
|
||||
done = true;
|
||||
}
|
||||
|
||||
@ -68,9 +68,9 @@ void TaskWindow::NotifyProgress(Task * task)
|
||||
{
|
||||
progress = task->GetProgress();
|
||||
if(progress>-1)
|
||||
progressStatus = String::Build(progress, "%");
|
||||
progressStatus = String::Build(progress, '%');
|
||||
else
|
||||
progressStatus = "Please wait...";
|
||||
progressStatus = "Please wait..."_i18n;
|
||||
}
|
||||
|
||||
void TaskWindow::OnTick(float dt)
|
||||
|
Reference in New Issue
Block a user