CtrlLib: Fixed slider appearance in QHD

This commit is contained in:
Mirek Fidler 2025-10-10 09:58:19 +02:00
parent 2d59b2f79b
commit c54d747e2a
5 changed files with 50 additions and 26 deletions

View file

@ -36,6 +36,10 @@ https://github.com/llvm/llvm-project/releases
(check with theide about)
2025-10-09: 21.1.1 (CLANG and LLVM)
------------------------------------------------------------------
OpenSSL
@ -152,6 +156,7 @@ libcrypto_static.lib, libssl_static.lib -> bin/openssl/lib64/crypto.lib, ssl.lib
2022-03-05: 1.1.1n
2023-09-28: 1.1.1w
2024-05-12: 3.2.1
2025-10-09: 3.6.0
------------------------------------------------------------------
plugin/jpg

View file

@ -239,7 +239,7 @@ bool Aes256Gcm::Decrypt(Stream& in, const String& password, Stream& out)
throw Exc("Initialization failed");
#endif
Buffer<byte> buffer(min((int64) chunksize, ciphertextlen));
Buffer<byte> buffer(min((size_t) chunksize, (size_t)ciphertextlen));
int buflen = 0;
int64 remaining = ciphertextlen, processed = AES_GCM_ENVELOPE_SIZE;

View file

@ -509,6 +509,41 @@ Image WithBottomLine(const Image& m, Color c, int w)
return WithRect(m, 0, m.GetHeight() - w, m.GetWidth(), w, c);
}
void ChSetSliderThumb()
{
for(int i = 0; i < 4; i++) {
Image thumb_face = CreateImage(Size(Zx(20), Zy(20)), IsDarkTheme() ? GrayColor(50 + 20 * i) : GrayColor(224 - 20 * i));
CtrlImg::Set(CtrlImg::I_hthumb + i, MakeElement(Size(Zx(10), Zy(20)), 0,
thumb_face, 1, Gray(), [&](Painter& w, const Rectf& r) {
double cx = r.GetWidth();
double cy = r.GetHeight();
double uy = 0.4 * cy;
double by = int(0.85 * cy);
double uq = 0.5 * uy;
w.Move(r.left, r.top + by)
.Line(r.left, r.top + uy)
.Quadratic(r.left, r.top + uq, r.left + cx / 2, r.top)
.Quadratic(r.left + cx, r.top + uq, r.left + cx, r.top + uy)
.Line(r.left + cx, r.top + by)
.Close();
}));
CtrlImg::Set(CtrlImg::I_vthumb + i, MakeElement(Size(Zx(20), Zx(10)), 0,
thumb_face, 1, Gray(), [&](Painter& w, const Rectf& r) {
double cx = r.GetWidth();
double cy = r.GetHeight();
double rx = 0.5 * cx;
double bx = int(0.15 * cx);
double uq = 0.8 * cx;
w.Move(r.left + bx, r.top)
.Line(r.left + rx, r.top)
.Quadratic(r.left + uq, r.top, r.right - 1, r.top + cy / 2)
.Quadratic(r.left + uq, r.top + cy, r.left + rx, r.top + cy)
.Line(r.left + bx, r.top + cy)
.Close();
}));
}
}
int ChSynthetic(Image *button100x100, Color *text, bool macos, int dpi)
{
auto DPI = [&](int i) { return dpi * i; };
@ -643,28 +678,11 @@ int ChSynthetic(Image *button100x100, Color *text, bool macos, int dpi)
s.bound = true;
s.nomargins = true;
}
Image sm = MakeElement(Size(DPI(10), DPI(20)), roundness,
CreateImage(Size(10, 10), GrayColor(224 - 20 * i)),
lw, ink, [&](Painter& w, const Rectf& r) {
double cx = r.GetWidth();
double cy = r.GetHeight();
double uy = 0.4 * cy;
double by = 0.85 * cy;
double uq = 0.5 * uy;
w.Move(r.left, r.top + by)
.Line(r.left, r.top + uy)
.Quadratic(r.left, r.top + uq, r.left + cx / 2, r.top)
.Quadratic(r.left + cx, r.top + uq, r.left + cx, r.top + uy)
.Line(r.left + cx, r.top + by)
.Close();
});
CtrlImg::Set(CtrlImg::I_hthumb + i, sm);
CtrlImg::Set(CtrlImg::I_vthumb + i, RotateClockwise(sm));
{
SyntheticTab(i, roundness, ink);
}
SyntheticTab(i, roundness, ink);
}
ChSetSliderThumb();
return roundness;
}
@ -673,6 +691,7 @@ void ChBaseSkin()
GUI_GlobalStyle_Write(GUISTYLE_XP);
GUI_PopUpEffect_Write(Ctrl::IsCompositedGui() ? GUIEFFECT_NONE : GUIEFFECT_SLIDE);
ColoredOverride(CtrlsImg::Iml(), CtrlsImg::Iml());
ChSetSliderThumb();
}
void ChMakeSkin(int roundness, Color button_face, Color thumb, int *adj)

View file

@ -148,8 +148,8 @@ void SliderCtrl::LeftUp(Point pos, dword keyflags)
{
if(HasCapture())
WhenSlideFinish();
Refresh();
ReleaseCapture();
Refresh();
}
void SliderCtrl::MouseMove(Point pos, dword keyflags)

View file

@ -1,4 +1,4 @@
LAYOUT(TestChStyleLayout, 972, 532)
LAYOUT(TestChStyleLayout, 972, 620)
ITEM(Upp::OptionBox, dv___0, SetLabel(t_("OptionBox")).LeftPosZ(16, 140).TopPosZ(304, 32))
ITEM(Upp::EditString, readonly, SetEditable(false).LeftPosZ(20, 80).TopPosZ(52, 19))
ITEM(Upp::DropList, dl_readonly, SetEditable(false).LeftPosZ(108, 96).TopPosZ(52, 19))
@ -35,7 +35,7 @@ LAYOUT(TestChStyleLayout, 972, 532)
ITEM(Upp::ProgressIndicator, pi5, LeftPosZ(180, 192).TopPosZ(328, 24))
ITEM(Upp::ProgressIndicator, pi3, LeftPosZ(380, 24).TopPosZ(296, 148))
ITEM(Upp::ProgressIndicator, pi4, LeftPosZ(412, 24).TopPosZ(296, 148))
ITEM(Upp::SliderCtrl, vslider, SetFrame(Upp::BlackFrame()).LeftPosZ(16, 20).VCenterPosZ(80, 186))
ITEM(Upp::SliderCtrl, vslider, SetFrame(Upp::BlackFrame()).LeftPosZ(16, 20).VCenterPosZ(80, 142))
UNTYPED(sample, LeftPosZ(216, 156).TopPosZ(364, 80))
ITEM(Upp::DropList, dl_empty, LeftPosZ(480, 96).TopPosZ(4, 19))
ITEM(Upp::WithDropChoice<Upp::EditString>, dc_empty, LeftPosZ(480, 96).TopPosZ(28, 19))
@ -57,9 +57,9 @@ LAYOUT(TestChStyleLayout, 972, 532)
ITEM(Upp::TreeCtrl, dv___55, LeftPosZ(696, 152).TopPosZ(12, 196))
ITEM(Upp::RichTextView, dv___56, Background(Upp::SLtBlue).LeftPosZ(696, 152).TopPosZ(348, 136))
ITEM(Upp::ColumnList, dv___57, LeftPosZ(696, 152).TopPosZ(212, 132))
ITEM(Upp::DropList, skin, LeftPosZ(8, 140).TopPosZ(504, 19))
ITEM(Upp::DropList, skin, LeftPosZ(20, 140).TopPosZ(4, 19))
ITEM(Upp::Label, vslider_val, LeftPosZ(40, 40).TopPosZ(472, 19))
ITEM(Upp::SliderCtrl, vslider2, SetFrame(Upp::BlackFrame()).LeftPosZ(92, 20).VCenterPosZ(80, 186))
ITEM(Upp::SliderCtrl, vslider2, SetFrame(Upp::BlackFrame()).LeftPosZ(92, 20).VCenterPosZ(80, 142))
ITEM(Upp::Label, vslider_val2, LeftPosZ(116, 40).TopPosZ(472, 19))
ITEM(Upp::Label, hslider_val, LeftPosZ(92, 40).TopPosZ(344, 19))
ITEM(Upp::SliderCtrl, hslider2, SetFrame(Upp::BlackFrame()).LeftPosZ(16, 72).TopPosZ(372, 24))