Make OptionsView somewhat more manageable
This commit is contained in:
parent
958ab1df96
commit
5b610f0b0e
@ -23,20 +23,20 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
|
||||||
OptionsView::OptionsView():
|
OptionsView::OptionsView() : ui::Window(ui::Point(-1, -1), ui::Point(320, 340))
|
||||||
ui::Window(ui::Point(-1, -1), ui::Point(320, 340))
|
{
|
||||||
{
|
auto autoWidth = [this](ui::Component *c, int extra) {
|
||||||
|
c->Size.X = Size.X - c->Position.X - 12 - extra;
|
||||||
auto autowidth = [this](ui::Component *c) {
|
|
||||||
c->Size.X = Size.X - c->Position.X - 12;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ui::Label * tempLabel = new ui::Label(ui::Point(4, 1), ui::Point(Size.X-8, 22), "Simulation Options");
|
{
|
||||||
tempLabel->SetTextColour(style::Colour::InformationTitle);
|
auto *label = new ui::Label(ui::Point(4, 1), ui::Point(Size.X-8, 22), "Simulation Options");
|
||||||
tempLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
label->SetTextColour(style::Colour::InformationTitle);
|
||||||
tempLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
label->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||||
autowidth(tempLabel);
|
label->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
||||||
AddComponent(tempLabel);
|
autoWidth(label, 0);
|
||||||
|
AddComponent(label);
|
||||||
|
}
|
||||||
|
|
||||||
class Separator : public ui::Component
|
class Separator : public ui::Component
|
||||||
{
|
{
|
||||||
@ -53,99 +53,90 @@ OptionsView::OptionsView():
|
|||||||
Separator *tmpSeparator = new Separator(ui::Point(0, 22), ui::Point(Size.X, 1));
|
Separator *tmpSeparator = new Separator(ui::Point(0, 22), ui::Point(Size.X, 1));
|
||||||
AddComponent(tmpSeparator);
|
AddComponent(tmpSeparator);
|
||||||
|
|
||||||
int currentY = 6;
|
|
||||||
scrollPanel = new ui::ScrollPanel(ui::Point(1, 23), ui::Point(Size.X-2, Size.Y-39));
|
scrollPanel = new ui::ScrollPanel(ui::Point(1, 23), ui::Point(Size.X-2, Size.Y-39));
|
||||||
|
|
||||||
AddComponent(scrollPanel);
|
AddComponent(scrollPanel);
|
||||||
|
|
||||||
heatSimulation = new ui::Checkbox(ui::Point(8, currentY), ui::Point(1, 16), "Heat simulation \bgIntroduced in version 34", "");
|
int currentY = 8;
|
||||||
autowidth(heatSimulation);
|
auto addCheckbox = [this, ¤tY, &autoWidth](int indent, String text, String info, std::function<void ()> action) {
|
||||||
heatSimulation->SetActionCallback({ [this] { c->SetHeatSimulation(heatSimulation->GetChecked()); } });
|
auto *checkbox = new ui::Checkbox(ui::Point(8 + indent * 15, currentY), ui::Point(1, 16), text, "");
|
||||||
scrollPanel->AddChild(heatSimulation);
|
autoWidth(checkbox, 0);
|
||||||
currentY+=14;
|
checkbox->SetActionCallback({ action });
|
||||||
tempLabel = new ui::Label(ui::Point(24, currentY), ui::Point(1, 16), "\bgCan cause odd behaviour when disabled");
|
scrollPanel->AddChild(checkbox);
|
||||||
autowidth(tempLabel);
|
currentY += 14;
|
||||||
tempLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
if (info.size())
|
||||||
tempLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
{
|
||||||
scrollPanel->AddChild(tempLabel);
|
auto *label = new ui::Label(ui::Point(22 + indent * 15, currentY), ui::Point(1, 16), "\bg" + info);
|
||||||
|
autoWidth(label, 0);
|
||||||
currentY+=16;
|
label->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||||
ambientHeatSimulation = new ui::Checkbox(ui::Point(8, currentY), ui::Point(1, 16), "Ambient heat simulation \bgIntroduced in version 50", "");
|
label->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
||||||
autowidth(ambientHeatSimulation);
|
scrollPanel->AddChild(label);
|
||||||
ambientHeatSimulation->SetActionCallback({ [this] { c->SetAmbientHeatSimulation(ambientHeatSimulation->GetChecked()); } });
|
currentY += 14;
|
||||||
scrollPanel->AddChild(ambientHeatSimulation);
|
}
|
||||||
currentY+=14;
|
currentY += 4;
|
||||||
tempLabel = new ui::Label(ui::Point(24, currentY), ui::Point(1, 16), "\bgCan cause odd / broken behaviour with many saves");
|
return checkbox;
|
||||||
autowidth(tempLabel);
|
};
|
||||||
tempLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
auto addDropDown = [this, ¤tY, &autoWidth](String info, std::vector<std::pair<String, int>> options, std::function<void ()> action) {
|
||||||
tempLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
auto *dropDown = new ui::DropDown(ui::Point(Size.X - 95, currentY), ui::Point(80, 16));
|
||||||
scrollPanel->AddChild(tempLabel);
|
scrollPanel->AddChild(dropDown);
|
||||||
|
for (auto &option : options)
|
||||||
currentY+=16;
|
{
|
||||||
newtonianGravity = new ui::Checkbox(ui::Point(8, currentY), ui::Point(1, 16), "Newtonian gravity \bgIntroduced in version 48", "");
|
dropDown->AddOption(option);
|
||||||
autowidth(newtonianGravity);
|
}
|
||||||
newtonianGravity->SetActionCallback({ [this] { c->SetNewtonianGravity(newtonianGravity->GetChecked()); } });
|
dropDown->SetActionCallback({ action });
|
||||||
scrollPanel->AddChild(newtonianGravity);
|
auto *label = new ui::Label(ui::Point(8, currentY), ui::Point(Size.X - 96, 16), info);
|
||||||
currentY+=14;
|
label->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||||
tempLabel = new ui::Label(ui::Point(24, currentY), ui::Point(1, 16), "\bgMay cause poor performance on older computers");
|
label->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
||||||
autowidth(tempLabel);
|
scrollPanel->AddChild(label);
|
||||||
tempLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
autoWidth(label, 85);
|
||||||
tempLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
currentY += 20;
|
||||||
scrollPanel->AddChild(tempLabel);
|
return dropDown;
|
||||||
|
};
|
||||||
currentY+=16;
|
auto addSeparator = [this, ¤tY]() {
|
||||||
waterEqualisation = new ui::Checkbox(ui::Point(8, currentY), ui::Point(1, 16), "Water equalisation \bgIntroduced in version 61", "");
|
currentY += 6;
|
||||||
autowidth(waterEqualisation);
|
auto *separator = new Separator(ui::Point(0, currentY), ui::Point(Size.X, 1));
|
||||||
waterEqualisation->SetActionCallback({ [this] { c->SetWaterEqualisation(waterEqualisation->GetChecked()); } });
|
scrollPanel->AddChild(separator);
|
||||||
scrollPanel->AddChild(waterEqualisation);
|
currentY += 11;
|
||||||
currentY+=14;
|
};
|
||||||
tempLabel = new ui::Label(ui::Point(24, currentY), ui::Point(1, 16), "\bgMay cause poor performance with a lot of water");
|
|
||||||
autowidth(tempLabel);
|
|
||||||
tempLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
|
||||||
tempLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
|
||||||
scrollPanel->AddChild(tempLabel);
|
|
||||||
|
|
||||||
currentY+=19;
|
|
||||||
airMode = new ui::DropDown(ui::Point(Size.X-95, currentY), ui::Point(80, 16));
|
|
||||||
scrollPanel->AddChild(airMode);
|
|
||||||
airMode->AddOption(std::pair<String, int>("On", 0));
|
|
||||||
airMode->AddOption(std::pair<String, int>("Pressure off", 1));
|
|
||||||
airMode->AddOption(std::pair<String, int>("Velocity off", 2));
|
|
||||||
airMode->AddOption(std::pair<String, int>("Off", 3));
|
|
||||||
airMode->AddOption(std::pair<String, int>("No Update", 4));
|
|
||||||
airMode->SetActionCallback({ [this] { c->SetAirMode(airMode->GetOption().second); } });
|
|
||||||
|
|
||||||
tempLabel = new ui::Label(ui::Point(8, currentY), ui::Point(Size.X-96, 16), "Air Simulation Mode");
|
|
||||||
tempLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
|
||||||
tempLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
|
||||||
scrollPanel->AddChild(tempLabel);
|
|
||||||
|
|
||||||
currentY+=20;
|
|
||||||
ambientAirTemp = new ui::Textbox(ui::Point(Size.X-95, currentY), ui::Point(60, 16));
|
|
||||||
ambientAirTemp->SetActionCallback({ [this] {
|
|
||||||
UpdateAirTemp(ambientAirTemp->GetText(), false);
|
|
||||||
} });
|
|
||||||
ambientAirTemp->SetDefocusCallback({ [this] {
|
|
||||||
UpdateAirTemp(ambientAirTemp->GetText(), true);
|
|
||||||
}});
|
|
||||||
scrollPanel->AddChild(ambientAirTemp);
|
|
||||||
|
|
||||||
ambientAirTempPreview = new ui::Button(ui::Point(Size.X-31, currentY), ui::Point(16, 16), "", "Preview");
|
|
||||||
scrollPanel->AddChild(ambientAirTempPreview);
|
|
||||||
|
|
||||||
tempLabel = new ui::Label(ui::Point(8, currentY), ui::Point(Size.X-96, 16), "Ambient Air Temperature");
|
|
||||||
tempLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
|
||||||
tempLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
|
||||||
scrollPanel->AddChild(tempLabel);
|
|
||||||
|
|
||||||
currentY+=20;
|
|
||||||
gravityMode = new ui::DropDown(ui::Point(Size.X-95, currentY), ui::Point(80, 16));
|
|
||||||
scrollPanel->AddChild(gravityMode);
|
|
||||||
gravityMode->AddOption(std::pair<String, int>("Vertical", 0));
|
|
||||||
gravityMode->AddOption(std::pair<String, int>("Off", 1));
|
|
||||||
gravityMode->AddOption(std::pair<String, int>("Radial", 2));
|
|
||||||
gravityMode->AddOption(std::pair<String, int>("Custom", 3));
|
|
||||||
|
|
||||||
|
heatSimulation = addCheckbox(0, "Heat simulation \bgIntroduced in version 34", "Can cause odd behaviour when disabled", [this] {
|
||||||
|
c->SetHeatSimulation(heatSimulation->GetChecked());
|
||||||
|
});
|
||||||
|
newtonianGravity = addCheckbox(0, "Newtonian gravity \bgIntroduced in version 48", "May cause poor performance on older computers", [this] {
|
||||||
|
c->SetNewtonianGravity(newtonianGravity->GetChecked());
|
||||||
|
});
|
||||||
|
ambientHeatSimulation = addCheckbox(0, "Ambient heat simulation \bgIntroduced in version 50", "Can cause odd / broken behaviour with many saves", [this] {
|
||||||
|
c->SetAmbientHeatSimulation(ambientHeatSimulation->GetChecked());
|
||||||
|
});
|
||||||
|
waterEqualisation = addCheckbox(0, "Water equalisation \bgIntroduced in version 61", "May cause poor performance with a lot of water", [this] {
|
||||||
|
c->SetWaterEqualisation(waterEqualisation->GetChecked());
|
||||||
|
});
|
||||||
|
airMode = addDropDown("Air simulation mode", {
|
||||||
|
{ "On", 0 },
|
||||||
|
{ "Pressure off", 1 },
|
||||||
|
{ "Velocity off", 2 },
|
||||||
|
{ "Off", 3 },
|
||||||
|
{ "No update", 4 },
|
||||||
|
}, [this] {
|
||||||
|
c->SetAirMode(airMode->GetOption().second);
|
||||||
|
});
|
||||||
|
{
|
||||||
|
ambientAirTemp = new ui::Textbox(ui::Point(Size.X-95, currentY), ui::Point(60, 16));
|
||||||
|
ambientAirTemp->SetActionCallback({ [this] {
|
||||||
|
UpdateAirTemp(ambientAirTemp->GetText(), false);
|
||||||
|
} });
|
||||||
|
ambientAirTemp->SetDefocusCallback({ [this] {
|
||||||
|
UpdateAirTemp(ambientAirTemp->GetText(), true);
|
||||||
|
}});
|
||||||
|
scrollPanel->AddChild(ambientAirTemp);
|
||||||
|
ambientAirTempPreview = new ui::Button(ui::Point(Size.X-31, currentY), ui::Point(16, 16), "", "Preview");
|
||||||
|
scrollPanel->AddChild(ambientAirTempPreview);
|
||||||
|
auto *label = new ui::Label(ui::Point(8, currentY), ui::Point(Size.X-96, 16), "Ambient air temperature");
|
||||||
|
label->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||||
|
label->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
||||||
|
scrollPanel->AddChild(label);
|
||||||
|
currentY += 20;
|
||||||
|
}
|
||||||
class GravityWindow : public ui::Window
|
class GravityWindow : public ui::Window
|
||||||
{
|
{
|
||||||
void OnTryExit(ExitMethod method) override
|
void OnTryExit(ExitMethod method) override
|
||||||
@ -210,237 +201,135 @@ OptionsView::OptionsView():
|
|||||||
MakeActiveWindow();
|
MakeActiveWindow();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
gravityMode = addDropDown("Gravity simulation mode", {
|
||||||
gravityMode->SetActionCallback({ [this] {
|
{ "Vertical", 0 },
|
||||||
|
{ "Off", 1 },
|
||||||
|
{ "Radial", 2 },
|
||||||
|
{ "Custom", 3 },
|
||||||
|
}, [this] {
|
||||||
c->SetGravityMode(gravityMode->GetOption().second);
|
c->SetGravityMode(gravityMode->GetOption().second);
|
||||||
if (gravityMode->GetOption().second == 3)
|
if (gravityMode->GetOption().second == 3)
|
||||||
|
{
|
||||||
new GravityWindow(ui::Point(-1, -1), 0.05f, 40, customGravityX, customGravityY, c);
|
new GravityWindow(ui::Point(-1, -1), 0.05f, 40, customGravityX, customGravityY, c);
|
||||||
} });
|
}
|
||||||
|
});
|
||||||
tempLabel = new ui::Label(ui::Point(8, currentY), ui::Point(Size.X-96, 16), "Gravity Simulation Mode");
|
edgeMode = addDropDown("Edge mode", {
|
||||||
tempLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
{ "Void", 0 },
|
||||||
tempLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
{ "Solid", 1 },
|
||||||
scrollPanel->AddChild(tempLabel);
|
{ "Loop", 2 },
|
||||||
|
}, [this] {
|
||||||
currentY+=20;
|
c->SetEdgeMode(edgeMode->GetOption().second);
|
||||||
edgeMode = new ui::DropDown(ui::Point(Size.X-95, currentY), ui::Point(80, 16));
|
});
|
||||||
scrollPanel->AddChild(edgeMode);
|
temperatureScale = addDropDown("Temperature scale", {
|
||||||
edgeMode->AddOption(std::pair<String, int>("Void", 0));
|
{ "Kelvin", 0 },
|
||||||
edgeMode->AddOption(std::pair<String, int>("Solid", 1));
|
{ "Celsius", 1 },
|
||||||
edgeMode->AddOption(std::pair<String, int>("Loop", 2));
|
{ "Fahrenheit", 2 },
|
||||||
edgeMode->SetActionCallback({ [this] { c->SetEdgeMode(edgeMode->GetOption().second); } });
|
}, [this] {
|
||||||
|
c->SetTemperatureScale(temperatureScale->GetOption().second);
|
||||||
tempLabel = new ui::Label(ui::Point(8, currentY), ui::Point(Size.X-96, 16), "Edge Mode");
|
});
|
||||||
tempLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
addSeparator();
|
||||||
tempLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
|
||||||
scrollPanel->AddChild(tempLabel);
|
|
||||||
|
|
||||||
currentY+=20;
|
|
||||||
temperatureScale = new ui::DropDown(ui::Point(Size.X-95, currentY), ui::Point(80, 16));
|
|
||||||
scrollPanel->AddChild(temperatureScale);
|
|
||||||
temperatureScale->AddOption(std::pair<String, int>("Kelvin", 0));
|
|
||||||
temperatureScale->AddOption(std::pair<String, int>("Celsius", 1));
|
|
||||||
temperatureScale->AddOption(std::pair<String, int>("Fahrenheit", 2));
|
|
||||||
temperatureScale->SetActionCallback({ [this] { c->SetTemperatureScale(temperatureScale->GetOption().second); } });
|
|
||||||
|
|
||||||
tempLabel = new ui::Label(ui::Point(8, currentY), ui::Point(Size.X-96, 16), "Temperature Scale");
|
|
||||||
tempLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
|
||||||
tempLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
|
||||||
scrollPanel->AddChild(tempLabel);
|
|
||||||
|
|
||||||
currentY+=20;
|
|
||||||
tmpSeparator = new Separator(ui::Point(0, currentY), ui::Point(Size.X, 1));
|
|
||||||
scrollPanel->AddChild(tmpSeparator);
|
|
||||||
|
|
||||||
currentY+=4;
|
|
||||||
scale = new ui::DropDown(ui::Point(8, currentY), ui::Point(40, 16));
|
|
||||||
{
|
{
|
||||||
int current_scale = ui::Engine::Ref().GetScale();
|
std::vector<std::pair<String, int>> options;
|
||||||
int ix_scale = 1;
|
int currentScale = ui::Engine::Ref().GetScale();
|
||||||
bool current_scale_valid = false;
|
int scaleIndex = 1;
|
||||||
|
bool currentScaleValid = false;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (current_scale == ix_scale)
|
if (currentScale == scaleIndex)
|
||||||
current_scale_valid = true;
|
{
|
||||||
scale->AddOption(std::pair<String, int>(String::Build(ix_scale), ix_scale));
|
currentScaleValid = true;
|
||||||
ix_scale += 1;
|
}
|
||||||
|
options.push_back({ String::Build(scaleIndex), scaleIndex });
|
||||||
|
scaleIndex += 1;
|
||||||
}
|
}
|
||||||
while (desktopWidth >= GetGraphics()->Size().X * ix_scale && desktopHeight >= GetGraphics()->Size().Y * ix_scale);
|
while (desktopWidth >= GetGraphics()->Size().X * scaleIndex && desktopHeight >= GetGraphics()->Size().Y * scaleIndex);
|
||||||
if (!current_scale_valid)
|
if (!currentScaleValid)
|
||||||
scale->AddOption(std::pair<String, int>("current", current_scale));
|
{
|
||||||
|
options.push_back({ "current", currentScale });
|
||||||
|
}
|
||||||
|
scale = addDropDown("Window scale factor for larger screens", options, [this] {
|
||||||
|
c->SetScale(scale->GetOption().second);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
scale->SetActionCallback({ [this] { c->SetScale(scale->GetOption().second); } });
|
resizable = addCheckbox(0, "Resizable \bg- allow resizing and maximizing window", "", [this] {
|
||||||
scrollPanel->AddChild(scale);
|
c->SetResizable(resizable->GetChecked());
|
||||||
|
});
|
||||||
|
fullscreen = addCheckbox(0, "Fullscreen \bg- fill the entire screen", "", [this] {
|
||||||
|
c->SetFullscreen(fullscreen->GetChecked());
|
||||||
|
});
|
||||||
|
altFullscreen = addCheckbox(1, "Set optimal screen resolution", "", [this] {
|
||||||
|
c->SetAltFullscreen(altFullscreen->GetChecked());
|
||||||
|
});
|
||||||
|
forceIntegerScaling = addCheckbox(1, "Force integer scaling \bg- less blurry", "", [this] {
|
||||||
|
c->SetForceIntegerScaling(forceIntegerScaling->GetChecked());
|
||||||
|
});
|
||||||
|
addSeparator();
|
||||||
|
fastquit = addCheckbox(0, "Fast quit", "Always exit completely when hitting close", [this] {
|
||||||
|
c->SetFastQuit(fastquit->GetChecked());
|
||||||
|
});
|
||||||
|
showAvatars = addCheckbox(0, "Show avatars", "Disable if you have a slow connection", [this] {
|
||||||
|
c->SetShowAvatars(showAvatars->GetChecked());
|
||||||
|
});
|
||||||
|
momentumScroll = addCheckbox(0, "Momentum (old) scrolling", "Accelerating instead of step scroll", [this] {
|
||||||
|
c->SetMomentumScroll(momentumScroll->GetChecked());
|
||||||
|
});
|
||||||
|
mouseClickRequired = addCheckbox(0, "Sticky categories", "Switch between categories by clicking", [this] {
|
||||||
|
c->SetMouseClickrequired(mouseClickRequired->GetChecked());
|
||||||
|
});
|
||||||
|
includePressure = addCheckbox(0, "Include pressure", "When saving, copying, stamping, etc.", [this] {
|
||||||
|
c->SetIncludePressure(includePressure->GetChecked());
|
||||||
|
});
|
||||||
|
perfectCircle = addCheckbox(0, "Perfect circle brush", "Better circle brush, without incorrect points on edges", [this] {
|
||||||
|
c->SetPerfectCircle(perfectCircle->GetChecked());
|
||||||
|
});
|
||||||
|
graveExitsConsole = addCheckbox(0, "Key under Esc exits console", "Disable if that key is 0 on your keyboard", [this] {
|
||||||
|
c->SetGraveExitsConsole(graveExitsConsole->GetChecked());
|
||||||
|
});
|
||||||
|
decoSpace = addDropDown("Colour space used by decoration tools", {
|
||||||
|
{ "sRGB", 0 },
|
||||||
|
{ "Linear", 1 },
|
||||||
|
{ "Gamma 2.2", 2 },
|
||||||
|
{ "Gamma 1.8", 3 },
|
||||||
|
}, [this] {
|
||||||
|
c->SetDecoSpace(decoSpace->GetOption().second);
|
||||||
|
});
|
||||||
|
|
||||||
tempLabel = new ui::Label(ui::Point(scale->Position.X+scale->Size.X+3, currentY), ui::Point(Size.X-40, 16), "\bg- Window scale factor for larger screens");
|
{
|
||||||
tempLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
currentY += 4;
|
||||||
tempLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
auto *dataFolderButton = new ui::Button(ui::Point(10, currentY), ui::Point(90, 16), "Open data folder");
|
||||||
scrollPanel->AddChild(tempLabel);
|
dataFolderButton->SetActionCallback({ [] {
|
||||||
|
ByteString cwd = Platform::GetCwd();
|
||||||
currentY+=20;
|
if (!cwd.empty())
|
||||||
resizable = new ui::Checkbox(ui::Point(8, currentY), ui::Point(1, 16), "Resizable", "");
|
{
|
||||||
autowidth(resizable);
|
Platform::OpenURI(cwd);
|
||||||
resizable->SetActionCallback({ [this] { c->SetResizable(resizable->GetChecked()); } });
|
}
|
||||||
tempLabel = new ui::Label(ui::Point(resizable->Position.X+Graphics::TextSize(resizable->GetText()).X+19, currentY), ui::Point(1, 16), "\bg- Allow resizing and maximizing window");
|
else
|
||||||
autowidth(tempLabel);
|
{
|
||||||
tempLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
std::cerr << "Cannot open data folder: Platform::GetCwd(...) failed" << std::endl;
|
||||||
tempLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
}
|
||||||
scrollPanel->AddChild(tempLabel);
|
} });
|
||||||
scrollPanel->AddChild(resizable);
|
scrollPanel->AddChild(dataFolderButton);
|
||||||
|
auto *migrationButton = new ui::Button(ui::Point(Size.X - 178, currentY), ui::Point(163, 16), "Migrate to shared data directory");
|
||||||
currentY+=20;
|
migrationButton->SetActionCallback({ [] {
|
||||||
fullscreen = new ui::Checkbox(ui::Point(8, currentY), ui::Point(1, 16), "Fullscreen", "");
|
ByteString from = Platform::originalCwd;
|
||||||
autowidth(fullscreen);
|
ByteString to = Platform::sharedCwd;
|
||||||
fullscreen->SetActionCallback({ [this] { c->SetFullscreen(fullscreen->GetChecked()); } });
|
new ConfirmPrompt("Do Migration?", "This will migrate all stamps, saves, and scripts from\n\bt" + from.FromUtf8() + "\bw\nto the shared data directory at\n\bt" + to.FromUtf8() + "\bw\n\n" + "Files that already exist will not be overwritten.", { [from, to]() {
|
||||||
tempLabel = new ui::Label(ui::Point(fullscreen->Position.X+Graphics::TextSize(fullscreen->GetText()).X+19, currentY), ui::Point(1, 16), "\bg- Fill the entire screen");
|
String ret = Client::Ref().DoMigration(from, to);
|
||||||
autowidth(tempLabel);
|
|
||||||
tempLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
|
||||||
tempLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
|
||||||
scrollPanel->AddChild(tempLabel);
|
|
||||||
scrollPanel->AddChild(fullscreen);
|
|
||||||
|
|
||||||
currentY+=20;
|
|
||||||
altFullscreen = new ui::Checkbox(ui::Point(23, currentY), ui::Point(1, 16), "Change Resolution", "");
|
|
||||||
autowidth(altFullscreen);
|
|
||||||
altFullscreen->SetActionCallback({ [this] { c->SetAltFullscreen(altFullscreen->GetChecked()); } });
|
|
||||||
tempLabel = new ui::Label(ui::Point(altFullscreen->Position.X+Graphics::TextSize(altFullscreen->GetText()).X+19, currentY), ui::Point(1, 16), "\bg- Set optimal screen resolution");
|
|
||||||
autowidth(tempLabel);
|
|
||||||
tempLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
|
||||||
tempLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
|
||||||
scrollPanel->AddChild(tempLabel);
|
|
||||||
scrollPanel->AddChild(altFullscreen);
|
|
||||||
|
|
||||||
currentY+=20;
|
|
||||||
forceIntegerScaling = new ui::Checkbox(ui::Point(23, currentY), ui::Point(1, 16), "Force Integer Scaling", "");
|
|
||||||
autowidth(forceIntegerScaling);
|
|
||||||
forceIntegerScaling->SetActionCallback({ [this] { c->SetForceIntegerScaling(forceIntegerScaling->GetChecked()); } });
|
|
||||||
tempLabel = new ui::Label(ui::Point(altFullscreen->Position.X+Graphics::TextSize(forceIntegerScaling->GetText()).X+19, currentY), ui::Point(1, 16), "\bg- Less blurry");
|
|
||||||
autowidth(tempLabel);
|
|
||||||
tempLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
|
||||||
tempLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
|
||||||
scrollPanel->AddChild(tempLabel);
|
|
||||||
scrollPanel->AddChild(forceIntegerScaling);
|
|
||||||
|
|
||||||
currentY+=20;
|
|
||||||
fastquit = new ui::Checkbox(ui::Point(8, currentY), ui::Point(1, 16), "Fast Quit", "");
|
|
||||||
autowidth(fastquit);
|
|
||||||
fastquit->SetActionCallback({ [this] { c->SetFastQuit(fastquit->GetChecked()); } });
|
|
||||||
tempLabel = new ui::Label(ui::Point(fastquit->Position.X+Graphics::TextSize(fastquit->GetText()).X+19, currentY), ui::Point(1, 16), "\bg- Always exit completely when hitting close");
|
|
||||||
autowidth(tempLabel);
|
|
||||||
tempLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
|
||||||
tempLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
|
||||||
scrollPanel->AddChild(tempLabel);
|
|
||||||
scrollPanel->AddChild(fastquit);
|
|
||||||
|
|
||||||
currentY+=20;
|
|
||||||
showAvatars = new ui::Checkbox(ui::Point(8, currentY), ui::Point(1, 16), "Show Avatars", "");
|
|
||||||
autowidth(showAvatars);
|
|
||||||
showAvatars->SetActionCallback({ [this] { c->SetShowAvatars(showAvatars->GetChecked()); } });
|
|
||||||
tempLabel = new ui::Label(ui::Point(showAvatars->Position.X+Graphics::TextSize(showAvatars->GetText()).X+19, currentY), ui::Point(1, 16), "\bg- Disable if you have a slow connection");
|
|
||||||
autowidth(tempLabel);
|
|
||||||
tempLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
|
||||||
tempLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
|
||||||
scrollPanel->AddChild(tempLabel);
|
|
||||||
scrollPanel->AddChild(showAvatars);
|
|
||||||
|
|
||||||
currentY += 20;
|
|
||||||
momentumScroll = new ui::Checkbox(ui::Point(8, currentY), ui::Point(1, 16), "Momentum/Old Scrolling", "");
|
|
||||||
autowidth(momentumScroll);
|
|
||||||
momentumScroll->SetActionCallback({ [this] { c->SetMomentumScroll(momentumScroll->GetChecked()); } });
|
|
||||||
tempLabel = new ui::Label(ui::Point(momentumScroll->Position.X + Graphics::TextSize(momentumScroll->GetText()).X+19, currentY), ui::Point(1, 16), "\bg- Accelerating instead of step scroll");
|
|
||||||
autowidth(tempLabel);
|
|
||||||
tempLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
|
||||||
tempLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
|
||||||
scrollPanel->AddChild(tempLabel);
|
|
||||||
scrollPanel->AddChild(momentumScroll);
|
|
||||||
|
|
||||||
currentY+=20;
|
|
||||||
mouseClickRequired = new ui::Checkbox(ui::Point(8, currentY), ui::Point(1, 16), "Sticky Categories", "");
|
|
||||||
autowidth(mouseClickRequired);
|
|
||||||
mouseClickRequired->SetActionCallback({ [this] { c->SetMouseClickrequired(mouseClickRequired->GetChecked()); } });
|
|
||||||
tempLabel = new ui::Label(ui::Point(mouseClickRequired->Position.X+Graphics::TextSize(mouseClickRequired->GetText()).X+19, currentY), ui::Point(1, 16), "\bg- Switch between categories by clicking");
|
|
||||||
autowidth(tempLabel);
|
|
||||||
tempLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
|
||||||
tempLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
|
||||||
scrollPanel->AddChild(tempLabel);
|
|
||||||
scrollPanel->AddChild(mouseClickRequired);
|
|
||||||
|
|
||||||
currentY+=20;
|
|
||||||
includePressure = new ui::Checkbox(ui::Point(8, currentY), ui::Point(1, 16), "Include Pressure", "");
|
|
||||||
autowidth(includePressure);
|
|
||||||
includePressure->SetActionCallback({ [this] { c->SetIncludePressure(includePressure->GetChecked()); } });
|
|
||||||
tempLabel = new ui::Label(ui::Point(includePressure->Position.X+Graphics::TextSize(includePressure->GetText()).X+19, currentY), ui::Point(1, 16), "\bg- When saving, copying, stamping, etc.");
|
|
||||||
autowidth(tempLabel);
|
|
||||||
tempLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
|
||||||
tempLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
|
||||||
scrollPanel->AddChild(tempLabel);
|
|
||||||
scrollPanel->AddChild(includePressure);
|
|
||||||
|
|
||||||
currentY+=20;
|
|
||||||
perfectCircle = new ui::Checkbox(ui::Point(8, currentY), ui::Point(1, 16), "Perfect Circle", "");
|
|
||||||
autowidth(perfectCircle);
|
|
||||||
perfectCircle->SetActionCallback({ [this] { c->SetPerfectCircle(perfectCircle->GetChecked()); } });
|
|
||||||
tempLabel = new ui::Label(ui::Point(perfectCircle->Position.X+Graphics::TextSize(perfectCircle->GetText()).X+19, currentY), ui::Point(1, 16), "\bg- Better circle brush, without incorrect points on edges");
|
|
||||||
autowidth(tempLabel);
|
|
||||||
tempLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
|
||||||
tempLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
|
||||||
scrollPanel->AddChild(tempLabel);
|
|
||||||
scrollPanel->AddChild(perfectCircle);
|
|
||||||
|
|
||||||
currentY+=20;
|
|
||||||
graveExitsConsole = new ui::Checkbox(ui::Point(8, currentY), ui::Point(1, 16), "Key Under Esc Exits Console", "");
|
|
||||||
autowidth(graveExitsConsole);
|
|
||||||
graveExitsConsole->SetActionCallback({ [this] { c->SetGraveExitsConsole(graveExitsConsole->GetChecked()); } });
|
|
||||||
tempLabel = new ui::Label(ui::Point(graveExitsConsole->Position.X+Graphics::TextSize(graveExitsConsole->GetText()).X+19, currentY), ui::Point(1, 16), "\bg- Uncheck this if that key is 0 on your keyboard");
|
|
||||||
autowidth(tempLabel);
|
|
||||||
tempLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
|
||||||
tempLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
|
||||||
scrollPanel->AddChild(tempLabel);
|
|
||||||
scrollPanel->AddChild(graveExitsConsole);
|
|
||||||
|
|
||||||
currentY+=20;
|
|
||||||
decoSpace = new ui::DropDown(ui::Point(8, currentY), ui::Point(60, 16));
|
|
||||||
decoSpace->SetActionCallback({ [this] { c->SetDecoSpace(decoSpace->GetOption().second); } });
|
|
||||||
scrollPanel->AddChild(decoSpace);
|
|
||||||
decoSpace->AddOption(std::pair<String, int>("sRGB", 0));
|
|
||||||
decoSpace->AddOption(std::pair<String, int>("Linear", 1));
|
|
||||||
decoSpace->AddOption(std::pair<String, int>("Gamma 2.2", 2));
|
|
||||||
decoSpace->AddOption(std::pair<String, int>("Gamma 1.8", 3));
|
|
||||||
|
|
||||||
tempLabel = new ui::Label(ui::Point(decoSpace->Position.X+decoSpace->Size.X+3, currentY), ui::Point(Size.X-40, 16), "\bg- Colour space used by decoration tools");
|
|
||||||
tempLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
|
||||||
tempLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
|
||||||
scrollPanel->AddChild(tempLabel);
|
|
||||||
|
|
||||||
currentY+=20;
|
|
||||||
ui::Button * dataFolderButton = new ui::Button(ui::Point(8, currentY), ui::Point(90, 16), "Open Data Folder");
|
|
||||||
dataFolderButton->SetActionCallback({ [] {
|
|
||||||
ByteString cwd = Platform::GetCwd();
|
|
||||||
if (!cwd.empty())
|
|
||||||
Platform::OpenURI(cwd);
|
|
||||||
else
|
|
||||||
fprintf(stderr, "cannot open data folder: Platform::GetCwd(...) failed\n");
|
|
||||||
} });
|
|
||||||
scrollPanel->AddChild(dataFolderButton);
|
|
||||||
|
|
||||||
ui::Button * migrationButton = new ui::Button(ui::Point(Size.X - 178, currentY), ui::Point(163, 16), "Migrate to shared data directory");
|
|
||||||
migrationButton->SetActionCallback({ [] {
|
|
||||||
ByteString from = Platform::originalCwd;
|
|
||||||
ByteString to = Platform::sharedCwd;
|
|
||||||
new ConfirmPrompt("Do Migration?", "This will migrate all stamps, saves, and scripts from\n\bt" + from.FromUtf8() + "\bw\nto the shared data directory at\n\bt" + to.FromUtf8() + "\bw\n\n" +
|
|
||||||
"Files that already exist will not be overwritten.", { [=] () {
|
|
||||||
String ret = Client::Ref().DoMigration(from, to);
|
|
||||||
new InformationMessage("Migration Complete", ret, false);
|
new InformationMessage("Migration Complete", ret, false);
|
||||||
} });
|
} });
|
||||||
} });
|
} });
|
||||||
scrollPanel->AddChild(migrationButton);
|
scrollPanel->AddChild(migrationButton);
|
||||||
|
currentY += 26;
|
||||||
ui::Button * tempButton = new ui::Button(ui::Point(0, Size.Y-16), ui::Point(Size.X, 16), "OK");
|
}
|
||||||
tempButton->SetActionCallback({ [this] { c->Exit(); } });
|
{
|
||||||
AddComponent(tempButton);
|
ui::Button *ok = new ui::Button(ui::Point(0, Size.Y-16), ui::Point(Size.X, 16), "OK");
|
||||||
SetCancelButton(tempButton);
|
ok->SetActionCallback({ [this] {
|
||||||
SetOkayButton(tempButton);
|
c->Exit();
|
||||||
currentY+=20;
|
} });
|
||||||
|
AddComponent(ok);
|
||||||
|
SetCancelButton(ok);
|
||||||
|
SetOkayButton(ok);
|
||||||
|
}
|
||||||
scrollPanel->InnerSize = ui::Point(Size.X, currentY);
|
scrollPanel->InnerSize = ui::Point(Size.X, currentY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -560,7 +449,3 @@ void OptionsView::OnTryExit(ExitMethod method)
|
|||||||
{
|
{
|
||||||
c->Exit();
|
c->Exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
OptionsView::~OptionsView() {
|
|
||||||
}
|
|
||||||
|
@ -50,5 +50,4 @@ public:
|
|||||||
void AttachController(OptionsController * c_);
|
void AttachController(OptionsController * c_);
|
||||||
void OnDraw() override;
|
void OnDraw() override;
|
||||||
void OnTryExit(ExitMethod method) override;
|
void OnTryExit(ExitMethod method) override;
|
||||||
virtual ~OptionsView();
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user