diff --git a/uppsrc/CtrlCore/srcdoc.tpp/Resolution$en-us.tpp b/uppsrc/CtrlCore/srcdoc.tpp/Resolution$en-us.tpp index 5060b95fc..789613911 100644 --- a/uppsrc/CtrlCore/srcdoc.tpp/Resolution$en-us.tpp +++ b/uppsrc/CtrlCore/srcdoc.tpp/Resolution$en-us.tpp @@ -75,5 +75,5 @@ better approach for scaling things that are related to icons.&] specifically informed that the application is able to handle UHD, otherwise they enter into mode when application is rendered in standard resolution and upscaled by windows (which looks quite -terrible). Normally, U`+`+ is in this mode by default. You can -revert to ugly upscaling mode by calling Ctrl`::SetUHDEnabled(false).]] \ No newline at end of file +terrible). Normally, U`+`+ is in this `"HiDPI`" mode by default. +You can revert to ugly upscaling mode by calling Ctrl`::SetUHDEnabled(false).]] \ No newline at end of file diff --git a/uppsrc/CtrlLib/ArrayCtrl.cpp b/uppsrc/CtrlLib/ArrayCtrl.cpp index ea29aa907..38e9d3191 100644 --- a/uppsrc/CtrlLib/ArrayCtrl.cpp +++ b/uppsrc/CtrlLib/ArrayCtrl.cpp @@ -574,19 +574,29 @@ void ArrayCtrl::Layout() { void ArrayCtrl::Reline(int i, int y) { - while(i < ln.GetCount()) { - Ln& p = ln[i]; - p.y = y; - y += Nvl(p.cy, linecy) + horzgrid; - i++; - } + if(WhenLineVisible) + while(i < ln.GetCount()) { + Ln& p = ln[i]; + p.y = y; + if(IsLineVisible(i)) + y += Nvl(p.cy, linecy) + horzgrid; + i++; + } + else + while(i < ln.GetCount()) { + Ln& p = ln[i]; + p.y = y; + if(IsLineVisible0(i)) + y += Nvl(p.cy, linecy) + horzgrid; + i++; + } SetSb(); } int ArrayCtrl::GetLineY(int i) const { return i < ln.GetCount() ? ln[i].y - : (ln.GetCount() ? ln.Top().y + Nvl(ln.Top().cy, linecy) + horzgrid : 0) + : (ln.GetCount() ? ln.Top().y + IsLineVisible(ln.GetCount() - 1) * (Nvl(ln.Top().cy, linecy) + horzgrid) : 0) + (linecy + horzgrid) * (i - ln.GetCount()); } @@ -828,7 +838,7 @@ Size ArrayCtrl::DoPaint(Draw& w, bool sample) { int sy = 0; if(!IsNull(i)) while(i < GetCount()) { - if(!sample || i == cursor || i < array.GetCount() && array[i].select) { + if((!sample || i == cursor || i < array.GetCount() && array[i].select) && IsLineVisible(i)) { r.top = sample ? sy : GetLineY(i) - sb; if(r.top > size.cy) break; @@ -1444,6 +1454,24 @@ bool ArrayCtrl::IsLineEnabled(int i) const return b; } +void ArrayCtrl::ShowLine(int i, bool e) +{ + int q = ln.GetCount(); + array.At(i).visible = e; + ln.At(i); + if(q > 0) + Reline(q - 1, ln[q - 1].y); + else + Reline(0, 0); +} + +bool ArrayCtrl::IsLineVisible(int i) const +{ + bool b = IsLineVisible0(i); + WhenLineVisible(i, b); + return b; +} + void ArrayCtrl::Select(int i, int count, bool sel) { while(count--) { @@ -2707,7 +2735,8 @@ void ArrayCtrl::RefreshSel() while(y < sz.cy && i < array.GetCount()) { if(IsSelected(i)) RefreshRow(i); - y += GetLineCy(i++); + if(IsLineVisible(i)) + y += GetLineCy(i++); } } } diff --git a/uppsrc/CtrlLib/ArrayCtrl.h b/uppsrc/CtrlLib/ArrayCtrl.h index 49855b3de..d4d10b1eb 100644 --- a/uppsrc/CtrlLib/ArrayCtrl.h +++ b/uppsrc/CtrlLib/ArrayCtrl.h @@ -174,9 +174,10 @@ private: struct Line : Moveable { bool select:1; bool enabled:1; + bool visible:1; Vector line; - Line() { select = false; enabled = true; } + Line() { select = false; enabled = true; visible = true; } }; Vector array; @@ -327,6 +328,8 @@ private: // These are listed here as private because name has changed to SetMap/AddMap void Set(int i, const ValueMap& m); void Add(const ValueMap& m); + + bool IsLineVisible0(int i) const { return i < 0 ? false : i < array.GetCount() ? array[i].visible : true; } public: // temporary (TRC 06/07/28) // will be removed! Ctrl& SetCtrl(int i, int j, Ctrl *newctrl) { return SetCtrl(i, j, newctrl, true, true); } @@ -354,6 +357,7 @@ public: Callback WhenHeaderLayout; Callback2 WhenLineEnabled; + Callback2 WhenLineVisible; Callback WhenDrag; Callback3 WhenDropCell; @@ -447,6 +451,10 @@ public: bool IsLineEnabled(int i) const; bool IsLineDisabled(int i) const { return !IsLineEnabled(i); } + void ShowLine(int i, bool e); + void HideLine(int i) { ShowLine(i, false); } + bool IsLineVisible(int i) const; + Vector ReadRow(int i) const; // deprecated name Vector GetLine(int i) const { return ReadRow(i); } diff --git a/uppsrc/CtrlLib/src.tpp/ArrayCtrl$en-us.tpp b/uppsrc/CtrlLib/src.tpp/ArrayCtrl$en-us.tpp index 920c3c9bc..cb5381800 100644 --- a/uppsrc/CtrlLib/src.tpp/ArrayCtrl$en-us.tpp +++ b/uppsrc/CtrlLib/src.tpp/ArrayCtrl$en-us.tpp @@ -2117,12 +2117,30 @@ nt]_[*@3 i])&] [s4;%- &] [s5;:Upp`:`:ArrayCtrl`:`:IsLineEnabled`(int`)const:%- [@(0.0.255) bool]_[* IsLineEnabled]( [@(0.0.255) int]_[*@3 i])_[@(0.0.255) const]&] -[s2; Returns true if line is enabled.&] +[s2; Returns true if line is enabled. Not that in addition to EnableLine +method, callback WhenLineEnabled affects the status too.&] [s3; &] [s4;%- &] [s5;:Upp`:`:ArrayCtrl`:`:IsLineDisabled`(int`)const:%- [@(0.0.255) bool]_[* IsLineDisable d]([@(0.0.255) int]_[*@3 i])_[@(0.0.255) const]&] -[s2; Returns true if line is not enabled.&] +[s2; Same as !IsLineEnabled([%-*@3 i]).&] +[s3; &] +[s4;%- &] +[s5;:Upp`:`:ArrayCtrl`:`:ShowLine`(int`,bool`):%- [@(0.0.255) void]_[* ShowLine]([@(0.0.255) i +nt]_[*@3 i], [@(0.0.255) bool]_[*@3 visible])&] +[s2; Sets the visibility of line. Hidden lines are omitted from the +list.&] +[s3; &] +[s4;%- &] +[s5;:Upp`:`:ArrayCtrl`:`:HideLine`(int`):%- [@(0.0.255) void]_[* HideLine]([@(0.0.255) int]_ +[*@3 i])&] +[s2; Same as ShowLine([%-*@3 i], false).&] +[s3; &] +[s4;%- &] +[s5;:Upp`:`:ArrayCtrl`:`:IsLineVisible`(int`)const:%- [@(0.0.255) bool]_[* IsLineVisible]( +[@(0.0.255) int]_[*@3 i])_[@(0.0.255) const]&] +[s2; Returns true if line is visible. Not that in addition to EnableLine +method, callback WhenLineVisible affects the visibility too.&] [s3; &] [s4;%- &] [s5;:ArrayCtrl`:`:ClearSelection`(`):%- [@(0.0.255) void]_[* ClearSelection]()&] @@ -2548,6 +2566,14 @@ in the cell editors and react to specific situations accordingly.&] to `"EnableLine`" interface. This is especially useful when using SetVirtualCount. First parameter is the line number, second is reference to enable status.&] +[s3;%- &] +[s4;%- &] +[s5;:Upp`:`:ArrayCtrl`:`:WhenLineVisible:%- [_^Upp`:`:Callback2^ Callback2]<[@(0.0.255) i +nt], [@(0.0.255) bool`&]>_[* WhenLineVisible]&] +[s2; Provides additional means to show/hide lines in addition to +`"ShowLine`" interface. This is especially useful when using +SetVirtualCount. First parameter is the line number, second is +reference to visibility status.&] [s3; &] [s0;%- &] [ {{10000t/25b/25@3 [s0;%- [*@(229)4 ArrayCtrl`::IdInfo]]}}&]