diff --git a/uppsrc/Core/src.tpp/AsyncWork_en-us.tpp b/uppsrc/Core/src.tpp/AsyncWork_en-us.tpp index bb283ddc2..0d3c2d9fa 100644 --- a/uppsrc/Core/src.tpp/AsyncWork_en-us.tpp +++ b/uppsrc/Core/src.tpp/AsyncWork_en-us.tpp @@ -66,4 +66,5 @@ constructor to pass the return value.&] [s5;:Upp`:`:Async`(Upp`:`:Function`&`&`,Args`&`&`.`.`.args`): [@(0.0.255) auto]_[* Async]( [_^Upp`:`:Function^ Function][@(0.0.255) `&`&]_[*@3 f], Args[@(0.0.255) `&`&...]_args)&] [s2;%% Returns AsyncWork for given job [%-*@3 f] with [%- args].&] +[s3;%% &] [s0;@(0.0.255)3 ]] \ No newline at end of file diff --git a/uppsrc/Core/src.tpp/CoWork_en-us.tpp b/uppsrc/Core/src.tpp/CoWork_en-us.tpp index ce9b7a9bd..0f9731693 100644 --- a/uppsrc/Core/src.tpp/CoWork_en-us.tpp +++ b/uppsrc/Core/src.tpp/CoWork_en-us.tpp @@ -195,6 +195,19 @@ exception handling is required, you need to use Finish (not depend on destructor to call it).&] [s0; &] [s0; &] +[ {{10000@(113.42.0) [s0;%% [*@7;4 Loop parallelisation functions]]}}&] +[s3; &] +[s5;:Upp`:`:CoDo`(Upp`:`:Function``&`&`): [@(0.0.255) void]_[* CoDo]([_^Upp`:`:Function^ F +unction]<[@(0.0.255) void]_()>`&`&_[*@3 fn])&] +[s2;%% Creates CoWork and calls Loop([%-*@3 fn]). This is the most +effective way to parallelise iteration.&] +[s3;%% &] +[s4; &] +[s5;:Upp`:`:CoFor`(int`,Fn`): [@(0.0.255) template]_<[@(0.0.255) typename]_[*@4 Fn]>_[@(0.0.255) v +oid]_[* CoFor]([@(0.0.255) int]_[*@3 n], [*@4 Fn]_[*@3 iterator])&] +[s2;%% Based on CoDo, runs in parallel [%-*@3 iterator] for values +0..[%-*@3 n] passing the value as argument.&] +[s0; &] [ {{10000@(113.42.0) [s0;%% [*@7;4 CoWorkerResources]]}}&] [s3; &] [s1;:noref: [@(0.0.255)3 template][3 _<][@(0.0.255)3 class][3 _][*@4;3 T][3 >]&] @@ -206,6 +219,10 @@ In single`-threaded code, a single instance of such model would be used over the whole loop, however in multi`-threaded code, each worker thread, plus thread that created CoWork need its own instance. CoWorkerResources helps to manage such situation.&] +[s0;%% &] +[s2;%% NOTE: The problem that this helper class solves is in majority +better solved by using CoDo function.&] +[s0;%% &] [s3;%% &] [ {{10000F(128)G(128)@1 [s0;%% [* Public Method List]]}}&] [s3; &] diff --git a/uppsrc/CtrlCore/ToDo.txt b/uppsrc/CtrlCore/ToDo.txt index a5f123b9d..2ba575685 100644 --- a/uppsrc/CtrlCore/ToDo.txt +++ b/uppsrc/CtrlCore/ToDo.txt @@ -4,21 +4,21 @@ - FileChooser - InsetFrame vs DefaultFrame - MacOS crash when addint Label to TestChStyles -- Ide: When dark editor in light theme, svn history is invisible (as text is white) -- LayDes .usc: Small defect in slider thumb in SD mode -- Laydes Rect is still to aggresive NTH: DONE: +- LayDes .usc: Small defect in slider thumb in SD mode +- Laydes Rect is still to aggresive - Vertical centering of DropList text is a bit off - Win32 - always use dark mode, always use UHD - Some problem when switching skin should be solved - Win32 menu checkbox - Classic is broken - ClassicCtrlsImg +- Ide: When dark editor in light theme, svn history is invisible (as text is white) macos done: diff --git a/uppsrc/CtrlLib/CtrlLib.usc b/uppsrc/CtrlLib/CtrlLib.usc index 8405d3978..a3b187f2f 100644 --- a/uppsrc/CtrlLib/CtrlLib.usc +++ b/uppsrc/CtrlLib/CtrlLib.usc @@ -43,14 +43,12 @@ fn DrawBorder(w, &r, ...) fn DrawButtonFrame(w, &r) { -// DrawBorder(w, r, :SWhite, :Black, :WhiteGray, :Gray); DrawBorder(w, r, :Gray, :Gray, :Gray, :Gray); } fn DrawEdgeButtonFrame(w, &r) { DrawBorder(w, r, :SWhite, :SWhite, :Gray, :Gray); -// DrawBorder(w, r, :SWhiteGray, :Black, :White, :Gray); } fn DrawButton(w, r) @@ -311,22 +309,15 @@ ctrl LabelBox { w.DrawSmartText(d, (sz.cy - ts.cy) / 2, .SetLabel, .SetFont, .SetInk, sz.cx); w.DrawRect(1, d, d - 1, 1, :Gray); w.DrawRect(1, d + 1, d - 1, 1, :Gray); + w.DrawRect(d + ts.cx, d, sz.cx - ts.cx - d - 2, 1, :Gray); + w.DrawRect(d + ts.cx, d + 1, sz.cx - ts.cx - d - 2, 1, :Gray); } else { - w.DrawSmartText(d, 0, .SetLabel, .SetFont, .SetInk, sz.cx); - w.DrawRect(0, d + 2, 1, sz.cy - d - 4, :Gray); - w.DrawRect(1, d + 2, 1, sz.cy - d - 4, :Gray); - w.DrawRect(sz.cx - 2, d, 1, sz.cy - d - 2, :Gray); - w.DrawRect(sz.cx - 1, d, 1, sz.cy - d - 2, :Gray); - w.DrawRect(0, sz.cy - 2, sz.cx - 1, 1, :Gray); - w.DrawRect(0, sz.cy - 1, sz.cx - 1, 1, :Gray); - w.DrawRect(sz.cx - 1, sz.cy - 2, 1, 2, :Gray); - w.DrawRect(1, d, d - 1, 1, :Gray); - w.DrawRect(1, d + 1, d - 1, 1, :Gray); - w.DrawRect(0, d, 1, 2, :Gray); + d = ts.cy / 2; + DrawButtonFrame(w, RectC(0, d, sz.cx, sz.cy - d)); + w.DrawRect(8, 0, ts.cx + 4, ts.cy, :SLtGray); + w.DrawSmartText(10, 0, .SetLabel, .SetFont); } - w.DrawRect(d + ts.cx, d, sz.cx - ts.cx - d - 2, 1, :Gray); - w.DrawRect(d + ts.cx, d + 1, sz.cx - ts.cx - d - 2, 1, :Gray); } } @@ -459,26 +450,12 @@ ctrl Option { textsize = GetSmartTextSize(.SetLabel, .SetFont); if(.Box || .AutoBox) { - DrawOption(w, 10, (textsize.cy - osz) / 2, kind); - w.DrawSmartText(osz + 14, 0, .SetLabel, .SetFont); - d = textsize.cy / 2; - w.DrawRect(0, d + 2, 1, sz.cy - d - 4, :Gray); - w.DrawRect(1, d + 2, 1, sz.cy - d - 4, :Gray); - w.DrawRect(sz.cx - 2, d, 1, sz.cy - d - 2, :Gray); - w.DrawRect(sz.cx - 1, d, 1, sz.cy - d - 2, :Gray); - w.DrawRect(0, sz.cy - 2, sz.cx - 1, 1, :Gray); - w.DrawRect(0, sz.cy - 1, sz.cx - 1, 1, :Gray); - w.DrawRect(sz.cx - 1, sz.cy - 2, 1, 2, :Gray); - q = d - 1; - if(q > 5) - q = 5; - w.DrawRect(1, d, 8, 1, :Gray); - w.DrawRect(1, d + 1, 8, 1, :Gray); - w.DrawRect(0, d, 1, 2, :Gray); - x = textsize.cx + osz + 8; - w.DrawRect(d + x, d, sz.cx - d - x, 1, :Gray); - w.DrawRect(d + x, d + 1, sz.cx - d - x, 1, :Gray); + DrawButtonFrame(w, RectC(0, d, sz.cx, sz.cy - d)); + d = (textsize.cy - osz) / 2; + w.DrawRect(8, 0, osz + textsize.cx + 8, textsize.cy, :SLtGray); + DrawOption(w, 10, d, kind); + w.DrawSmartText(osz + 14, 0, .SetLabel, .SetFont); } else { DrawOption(w, 0, (sz.cy - osz) / 2, kind); @@ -1345,8 +1322,8 @@ ctrl SliderCtrl { halfY = int(r.top + r.bottom) >> 1; osz = 3 * OptionSize() / 2; - osz2 = osz / 2; - osz4 = osz / 4; + osz2 = int(osz / 2); + osz4 = int(osz / 4); if (sz.cx < sz.cy) { DrawInsetFrame(w, Rect(halfX - 2, r.top + 2, halfX + 2, r.bottom - 2)); diff --git a/uppsrc/Draw/DrawTextUtil.cpp b/uppsrc/Draw/DrawTextUtil.cpp index c7ba73990..14de7eedf 100644 --- a/uppsrc/Draw/DrawTextUtil.cpp +++ b/uppsrc/Draw/DrawTextUtil.cpp @@ -75,7 +75,7 @@ int GetTLTextHeight(const wchar *s, Font font) void DrawTLText(Draw& draw, int x, int y, int cx, const wchar *text, Font font, Color ink, int accesskey) { - int cy = font.GetCy(); // Bold to have the same height as with GetStdFontCy() + int cy = font.GetCy(); const wchar *s = text; const wchar *t = s; int apos = HIWORD(accesskey); diff --git a/uppsrc/TextDiffCtrl/TextCtrl.cpp b/uppsrc/TextDiffCtrl/TextCtrl.cpp index 5a4100540..bd6666e3e 100644 --- a/uppsrc/TextDiffCtrl/TextCtrl.cpp +++ b/uppsrc/TextDiffCtrl/TextCtrl.cpp @@ -283,11 +283,21 @@ void TextCompareCtrl::Paint(Draw& draw) int sell, selh; GetSelection(sell, selh); + + WString test = "č"; // read text/paper colors from highlighting scheme using likely non-highlighted text + Vector th; + th.SetCount(2); + th[0].ink = SColorText(); + th[0].paper = SColorPaper(); + WhenHighlight(th, test); + Color text_color = th[0].ink; + Color paper_color = th[0].paper; + for(int i = first_line; i <= last_line; i++) { const Line& l = lines[i]; int y = i * letter.cy - offset.cy; - Color ink = SColorText(); - Color paper = IsNull(l.number) ? LtGray() : l.diff ? diffpaper : SColorPaper(); + Color ink = text_color; + Color paper = IsNull(l.number) ? LtGray() : l.diff ? diffpaper : paper_color; bool sel = l.number >= sell && l.number <= selh; if(sel) { ink = SColorHighlightText; diff --git a/uppsrc/ide/LayDes/item.cpp b/uppsrc/ide/LayDes/item.cpp index 2ee04c070..de166fc78 100644 --- a/uppsrc/ide/LayDes/item.cpp +++ b/uppsrc/ide/LayDes/item.cpp @@ -218,13 +218,13 @@ String LayoutItem::Save(int i, int y, const String& eol) const void LayoutItem::UnknownPaint(Draw& w) { - DrawFrame(w, 0, 0, csize.cx, csize.cy, SColorShadow); + DrawFatFrame(w, 0, 0, csize.cx, csize.cy, SGray(), 2); int q = FindProperty("SetLabel"); if(q >= 0 && IsString(~property[q])) DrawSmartText(w, 0, 0, csize.cx, ToUtf8((WString)~property[q])); Size tsz = GetTextSize(type, LayFont()); - w.DrawRect(csize.cx - tsz.cx, csize.cy - tsz.cy, tsz.cx, tsz.cy, SColorShadow); - w.DrawText(csize.cx - tsz.cx, csize.cy - tsz.cy, type, LayFont(), SColorLight); + w.DrawRect(csize.cx - tsz.cx - tsz.cy, csize.cy - tsz.cy, tsz.cx + tsz.cy, tsz.cy, SGray()); + w.DrawText(csize.cx - tsz.cx - tsz.cy / 2, csize.cy - tsz.cy, type, LayFont(), White()); } void LayoutItem::CreateMethods(EscValue& ctrl, const String& type, bool copy) const @@ -341,9 +341,9 @@ void LayoutItem::Paint(Draw& w, Size sz, bool sample) } catch(CParser::Error e) { PutConsole(e); - DrawingDraw edw; - edw.DrawRect(0, 0, csize.cx, csize.cy, Red); - edw.DrawText(2, 2, e, LayFont().Bold(), Yellow); + DrawingDraw edw(csize); + edw.DrawRect(0, 0, csize.cx, csize.cy, Red()); + DrawSmartText(edw, 2, 2, csize.cx - 4, "\1[g@Y \1" + e, LayFont(), Yellow()); cache = edw; } } diff --git a/uppsrc/ide/LayDes/laydes.cpp b/uppsrc/ide/LayDes/laydes.cpp index 346b2c108..dd96a6d41 100644 --- a/uppsrc/ide/LayDes/laydes.cpp +++ b/uppsrc/ide/LayDes/laydes.cpp @@ -177,7 +177,7 @@ void LayDes::PaintLayoutItems(Draw& w, int layid, Size size, Index& passed, Rect r = CtrlRectZ(m.pos, size); String dummy; int lr = ParseLayoutRef(m.type, dummy); - DrawFrame(w, r, IsDarkTheme() ? Blend(Gray(), Blue()) : Blend(WhiteGray(), LtBlue())); + DrawFrame(w, r, Blend(SLtGray(), SCyan(), 35)); w.Clipoff(r); if(lr < 0) m.Paint(w, r.Size());