From 6a673b95a6ea8eb922a28192419f67e48146cd42 Mon Sep 17 00:00:00 2001 From: Mirek Fidler Date: Sun, 29 Sep 2024 21:00:18 +0200 Subject: [PATCH] CodeEditor: Conversion warnings resolved --- uppsrc/CodeEditor/CSyntax.cpp | 4 ++-- uppsrc/CtrlLib/Ch.cpp | 14 ++++++++++---- uppsrc/CtrlLib/Ch.h | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/uppsrc/CodeEditor/CSyntax.cpp b/uppsrc/CodeEditor/CSyntax.cpp index 3723bc929..47b90e21c 100644 --- a/uppsrc/CodeEditor/CSyntax.cpp +++ b/uppsrc/CodeEditor/CSyntax.cpp @@ -195,7 +195,7 @@ void CSyntax::ScanSyntax(const wchar *ln, const wchar *e, int line, int tab_size } if(cl == 0) { blk_end.y = line; - blk_end.x = e - ln; + blk_end.x = int(e - ln); } p = e; } @@ -255,7 +255,7 @@ void CSyntax::ScanSyntax(const wchar *ln, const wchar *e, int line, int tab_size auto Cl0Pos = [&](Point& t) { if(cl == 0) { t.y = line; - t.x = p - 1 - ln; + t.x = int(p - 1 - ln); } }; if(c == '/') break; diff --git a/uppsrc/CtrlLib/Ch.cpp b/uppsrc/CtrlLib/Ch.cpp index 383d501b5..9b2db0940 100644 --- a/uppsrc/CtrlLib/Ch.cpp +++ b/uppsrc/CtrlLib/Ch.cpp @@ -21,7 +21,7 @@ Color FaceColor(int adj) return AdjustColor(SColorFace(), adj); }; -void SyntheticTab(int i, int roundness, Color ink) +void SyntheticTab(int i, int roundness, Color ink, int pen) { TabCtrl::Style& s = TabCtrl::StyleDefault().Write(); s.body = MakeButton(0, FaceColor(8), DPI(1), ink); @@ -32,11 +32,16 @@ void SyntheticTab(int i, int roundness, Color ink) CORNER_TOP_LEFT|CORNER_TOP_RIGHT); s.first[i] = s.last[i] = s.both[i] = s.normal[i] = ChHot(Crop(t, 0, 0, t.GetWidth(), t.GetHeight() - DPI(3)), DPI(3)); s.margin = 0; - s.sel = Rect(0, DPI(1), 0, DPI(1)); - s.extendleft = DPI(2); + s.sel = Rect(0, pen, 0, pen); + s.extendleft = 2 * pen; s.text_color[i] = SColorText(); } +void SyntheticTab(int i, int roundness, Color ink) +{ + SyntheticTab(i, roundness, ink, DPI(1)); +} + void MakeDialogIcons() { auto MakeCircularIcon = [](Color c, const byte *signc, int csz, double ssz = 0.6, Color sc = White()) -> Image @@ -448,8 +453,9 @@ Image WithBottomLine(const Image& m, Color c, int w) return WithRect(m, 0, m.GetHeight() - w, m.GetWidth(), w, c); } -void ChSynthetic(Image *button100x100, Color *text, bool macos) +void ChSynthetic(Image *button100x100, Color *text, bool macos, int dpi) { + auto DPI = [&](int i) { return dpi * i; }; int roundness = DPI(3); int roundness2 = roundness; Color ink = SColorText(); diff --git a/uppsrc/CtrlLib/Ch.h b/uppsrc/CtrlLib/Ch.h index 5dd924bc6..1d672d966 100644 --- a/uppsrc/CtrlLib/Ch.h +++ b/uppsrc/CtrlLib/Ch.h @@ -43,7 +43,7 @@ Image WithBottomLine(const Image& m, Color c, int w = DPI(1)); Color FaceColor(int adj); // Creates synthetic style based on SColors and basic button face -void ChSynthetic(Image *button100x100, Color *text, bool macos = false); +void ChSynthetic(Image *button100x100, Color *text, bool macos = false, int dpi = DPI(1)); // for diagnostics purposes #ifdef _DEBUG