ide: Support for scale testing

This commit is contained in:
Mirek Fidler 2026-04-18 11:15:52 +02:00
parent 0c4992feea
commit 9a1322ecb1
7 changed files with 38 additions and 25 deletions

View file

@ -94,7 +94,7 @@ String NoCr(const char *s)
return out;
}
void MakeBuild::CreateHost(Host& host, const String& method, bool darkmode, bool disable_uhd)
void MakeBuild::CreateHost(Host& host, const String& method, bool darkmode, bool disable_uhd, int scale)
{
VectorMap<String, String> bm = GetMethodVars(method);
{
@ -114,6 +114,8 @@ void MakeBuild::CreateHost(Host& host, const String& method, bool darkmode, bool
env.GetAdd("UPP_DISABLE_UHD__") = "1";
if(darkmode)
env.GetAdd("UPP_DARKMODE__") = "1";
if(scale)
env.GetAdd("UPP_SCALE__") = AsString(scale);
// setup LD_LIBRARY_PATH on target dir, needed for all shared builds on posix
#ifdef PLATFORM_POSIX
if(target != "")
@ -145,10 +147,10 @@ void MakeBuild::CreateHost(Host& host, const String& method, bool darkmode, bool
}
}
void MakeBuild::CreateHost(Host& host, bool darkmode, bool disable_uhd)
void MakeBuild::CreateHost(Host& host, bool darkmode, bool disable_uhd, int scale)
{
SetupDefaultMethod();
CreateHost(host, method, darkmode, disable_uhd);
CreateHost(host, method, darkmode, disable_uhd, scale);
}
One<Builder> MakeBuild::CreateBuilder(Host *host)
@ -341,7 +343,7 @@ bool MakeBuild::BuildPackage(const Workspace& wspc, int pkindex, int pknumber, i
return false;
}
Host host;
CreateHost(host, false, false);
CreateHost(host, false, false, 0);
One<Builder> b = CreateBuilder(&host);
b->onefile = onefile;
if(!b)
@ -579,7 +581,7 @@ bool MakeBuild::Build()
return false;
}
Host host;
CreateHost(host, false, false);
CreateHost(host, false, false, 0);
One<Builder> builder = CreateBuilder(&host);
if(!builder)
return false;
@ -599,7 +601,7 @@ void MakeBuild::CleanPackage(const Workspace& wspc, int package)
{
PutConsole(Format("Cleaning %s", wspc[package]));
Host host;
CreateHost(host, false, false);
CreateHost(host, false, false, 0);
One<Builder> builder = CreateBuilder(&host);
if(!builder)
return;
@ -616,7 +618,7 @@ void MakeBuild::Clean()
ConsoleClear();
Host host;
CreateHost(host, false, false);
CreateHost(host, false, false, 0);
One<Builder> builder = CreateBuilder(&host);
if(!builder)
return;
@ -664,7 +666,7 @@ int HostSys(const char *cmd, String& out)
if(!mb)
return Null;
Host host;
mb->CreateHost(host, false, false);
mb->CreateHost(host, false, false, 0);
LocalProcess p;
host.canlog = false;
if(host.StartProcess(p, cmd))

View file

@ -68,8 +68,8 @@ public:
bool makefile_svn_revision = true;
void CreateHost(Host& host, const String& method, bool darkmode, bool disable_uhd);
void CreateHost(Host& host, bool darkmode = false, bool disable_uhd = false);
void CreateHost(Host& host, const String& method, bool darkmode, bool disable_uhd, int scale);
void CreateHost(Host& host, bool darkmode = false, bool disable_uhd = false, int scale = 0);
const TargetMode& GetTargetMode();
Index<String> PackageConfig(const Workspace& wspc, int package, const VectorMap<String, String>& bm,

View file

@ -4,7 +4,7 @@
void Ide::SerializeWorkspace(Stream& s) {
int i;
int version = 22;
int version = 23;
s / version;
s.Magic(0x12354);
if(s.IsStoring()) {
@ -63,6 +63,8 @@ void Ide::SerializeWorkspace(Stream& s) {
s % darkmode;
if(version >= 21)
s % minimize;
if(version >= 23)
s % scale;
s % editfile;
for(i = 0; i < 10; i++) {
s % bookmark[i];

View file

@ -51,6 +51,13 @@ void Ide::RunArgs() {
dlg.disable_uhd <<= disable_uhd;
dlg.darkmode <<= darkmode;
dlg.minimize <<= minimize;
dlg.scale <<= scale;
dlg.scale.Add(0, AttrText("Host").Ink(Gray()).Italic());
dlg.scale.Add(2, "100% (HD)");
dlg.scale.Add(3, "150% (QHD)");
dlg.scale.Add(4, "200% (UHD)");
dlg.scale.Add(6, "300% (XHD)");
auto Ins = [&](bool file) {
int l, h;
@ -88,6 +95,7 @@ void Ide::RunArgs() {
disable_uhd = ~dlg.disable_uhd;
darkmode = ~dlg.darkmode;
minimize = ~dlg.minimize;
scale = ~dlg.scale;
dlg.arg.AddHistory();
{
StringStream ss;
@ -109,7 +117,7 @@ void Ide::RunArgs() {
void Ide::CreateHostRunDir(Host& h)
{
CreateHost(h, darkmode, disable_uhd);
CreateHost(h, darkmode, disable_uhd, scale);
if(IsNull(rundir))
h.ChDir(GetFileFolder(target));
else
@ -281,7 +289,7 @@ void Ide::ExecuteApk()
return;
Host host;
CreateHost(host, darkmode, disable_uhd);
CreateHost(host, darkmode, disable_uhd, scale);
Apk apk(target, sdk);
String packageName = apk.FindPackageName();
String activityName = apk.FindLaunchableActivity();
@ -512,7 +520,7 @@ void Ide::ConditionalBreak()
brk = "1";
Host h;
CreateHost(h, darkmode, disable_uhd);
CreateHost(h, darkmode, disable_uhd, scale);
Index<String> cfg = PackageConfig(IdeWorkspace(), 0, GetMethodVars(method), mainconfigparam, h,
*CreateBuilder(&h));
#ifdef PLATFORM_WIN32

View file

@ -217,8 +217,6 @@ void Ide::FindPrevError() {
return;
int ln = console.GetLine(console.GetCursor());
int l = ln;
Host h;
CreateHost(h, false, disable_uhd);
for(l = ln - 2; l >= 0; l--)
if(FindLineError(l)) return;
for(l = console.GetLineCount() - 1; l > ln; l--)

View file

@ -608,6 +608,7 @@ public:
bool disable_uhd = false;
bool darkmode = false;
bool minimize = false;
int scale = 0;
String stdout_file;
String recent_stdout_file;

View file

@ -50,29 +50,31 @@ LAYOUT(CustomLayout, 608, 410)
ITEM(Upp::Button, exit, SetLabel(t_("Close")).RightPosZ(4, 80).BottomPosZ(4, 22))
END_LAYOUT
LAYOUT(RunLayout, 560, 200)
ITEM(Upp::Label, dv___0, SetLabel(t_("&Program arguments:")).LeftPosZ(4, 112).TopPosZ(4, 19))
LAYOUT(RunLayout, 560, 212)
ITEM(Upp::Label, dv___0, SetLabel(t_("Program arguments")).LeftPosZ(4, 112).TopPosZ(4, 19))
ITEM(Upp::WithDropChoice<Upp::EditString>, arg, HSizePosZ(120, 56).TopPosZ(4, 19))
ITEM(Upp::Button, ifile, Tip(t_("Select file and insert its path as an arguments...")).RightPosZ(32, 20).TopPosZ(4, 19))
ITEM(Upp::Button, idir, Tip(t_("Select directory and insert its path as an arguments...")).RightPosZ(8, 20).TopPosZ(4, 19))
ITEM(Upp::Label, dv___4, SetLabel(t_("&Working directory:")).LeftPosZ(4, 112).TopPosZ(28, 19))
ITEM(Upp::Label, dv___4, SetLabel(t_("Working directory")).LeftPosZ(4, 112).TopPosZ(28, 19))
ITEM(Upp::EditString, dir, HSizePosZ(120, 32).TopPosZ(28, 19))
ITEM(Upp::Button, dirb, Tip(t_("Select directory and insert its path as an arguments...")).RightPosZ(8, 20).TopPosZ(28, 19))
ITEM(Upp::Label, stdout_file_lbl, SetLabel(t_("STDOUT file:")).LeftPosZ(4, 112).TopPosZ(52, 19))
ITEM(Upp::Label, stdout_file_lbl, SetLabel(t_("STDOUT file")).LeftPosZ(4, 112).TopPosZ(52, 19))
ITEM(Upp::WithDropChoice<Upp::EditString>, stdout_file, HSizePosZ(120, 32).TopPosZ(52, 19))
ITEM(Upp::Button, stdout_fileb, Tip(t_("Select directory and insert its path as an arguments...")).RightPosZ(8, 20).TopPosZ(52, 19))
ITEM(Upp::Label, dv___10, SetLabel(t_("Standard output:")).LeftPosZ(4, 112).TopPosZ(76, 19))
ITEM(Upp::Label, dv___10, SetLabel(t_("Standard output")).LeftPosZ(4, 112).TopPosZ(76, 19))
ITEM(Upp::Switch, runmode, SetLabel(t_("&Standalone\n&Console\n&File")).LeftPosZ(120, 200).TopPosZ(76, 19))
ITEM(Upp::Option, utf8, SetLabel(t_("Output is UTF-8")).LeftPosZ(320, 104).TopPosZ(76, 20))
ITEM(Upp::Option, external, SetLabel(t_("&External application")).LeftPosZ(120, 200).TopPosZ(100, 20))
ITEM(Upp::Label, console_label, SetLabel(t_("Open console:")).LeftPosZ(4, 112).TopPosZ(124, 20))
ITEM(Upp::Label, console_label, SetLabel(t_("Open console")).LeftPosZ(4, 112).TopPosZ(124, 20))
ITEM(Upp::Switch, consolemode, SetLabel(t_("Auto\nAlways\nNever")).LeftPosZ(120, 200).TopPosZ(124, 20))
ITEM(Upp::Option, minimize, SetLabel(t_("Minimize TheIDE on launching")).LeftPosZ(328, 224).TopPosZ(124, 20))
ITEM(Upp::Label, advanced_label, SetLabel(t_("Advanced:")).LeftPosZ(4, 112).TopPosZ(148, 20))
ITEM(Upp::Option, disable_uhd, SetLabel(t_("Disable UHD mode")).LeftPosZ(120, 120).TopPosZ(148, 20))
ITEM(Upp::Option, darkmode, SetLabel(t_("Run in dark mode")).LeftPosZ(244, 120).TopPosZ(148, 20))
ITEM(Upp::Label, advanced_label, SetLabel(t_("Advanced")).LeftPosZ(4, 112).TopPosZ(152, 19))
ITEM(Upp::Option, disable_uhd, SetLabel(t_("Disable UHD mode")).LeftPosZ(120, 120).TopPosZ(152, 19))
ITEM(Upp::Option, darkmode, SetLabel(t_("Run in dark mode")).LeftPosZ(244, 120).TopPosZ(152, 19))
ITEM(Upp::Button, ok, SetLabel(t_("OK")).RightPosZ(76, 64).BottomPosZ(8, 24))
ITEM(Upp::Button, cancel, SetLabel(t_("Cancel")).RightPosZ(8, 64).BottomPosZ(8, 24))
ITEM(Upp::Label, dv___22, SetLabel(t_("Scale")).LeftPosZ(404, 32).TopPosZ(152, 19))
ITEM(Upp::DropList, scale, LeftPosZ(440, 112).TopPosZ(152, 19))
END_LAYOUT
LAYOUT(FindInFilesLayout, 572, 176)