From affa760a9d61c1cbb2959a20db1b54011dee7850 Mon Sep 17 00:00:00 2001 From: Mirek Fidler Date: Wed, 21 Dec 2022 09:49:46 +0100 Subject: [PATCH] CtrlLib: ArrayCtrl::AcceptEdits, RichTextView::GetCursor; ide: Fixed issue with pure virtual signature id --- uppsrc/CtrlLib/ArrayCtrl.cpp | 4 +++- uppsrc/CtrlLib/ArrayCtrl.h | 3 +++ uppsrc/CtrlLib/RichText.h | 2 ++ uppsrc/CtrlLib/src.tpp/ArrayCtrl_en-us.tpp | 6 ++++++ uppsrc/ide/clang/Signature.cpp | 4 +++- 5 files changed, 17 insertions(+), 2 deletions(-) diff --git a/uppsrc/CtrlLib/ArrayCtrl.cpp b/uppsrc/CtrlLib/ArrayCtrl.cpp index 4f5f222be..9483ba976 100644 --- a/uppsrc/CtrlLib/ArrayCtrl.cpp +++ b/uppsrc/CtrlLib/ArrayCtrl.cpp @@ -1403,7 +1403,8 @@ bool ArrayCtrl::AcceptRow(bool endedit) { } bool ArrayCtrl::Accept() { - return IsCursor() ? AcceptRow() : true; + return IsCursor() ? AcceptRow() : + accept_edits ? Ctrl::Accept() : true; } bool ArrayCtrl::KillCursor0() { @@ -2798,6 +2799,7 @@ void ArrayCtrl::Reset() { min_visible_line = 0; max_visible_line = INT_MAX; ctrl_low = ctrl_high = 0; + accept_edits = false; } void ArrayCtrl::CancelMode() diff --git a/uppsrc/CtrlLib/ArrayCtrl.h b/uppsrc/CtrlLib/ArrayCtrl.h index a36f115d0..b0cddf457 100644 --- a/uppsrc/CtrlLib/ArrayCtrl.h +++ b/uppsrc/CtrlLib/ArrayCtrl.h @@ -252,6 +252,7 @@ private: bool focussetcursor:1; bool allsorting:1; bool spanwidecells:1; + bool accept_edits:1; mutable bool selectiondirty:1; @@ -719,6 +720,8 @@ public: ArrayCtrl& NoCursorOverride() { return CursorOverride(Null); } ArrayCtrl& SpanWideCells(bool b = true) { spanwidecells = b; Refresh(); return *this; } + + ArrayCtrl& AcceptEdits(bool b = true) { accept_edits = b; return *this; } void Reset(); diff --git a/uppsrc/CtrlLib/RichText.h b/uppsrc/CtrlLib/RichText.h index 09557af9c..04c93dcb7 100644 --- a/uppsrc/CtrlLib/RichText.h +++ b/uppsrc/CtrlLib/RichText.h @@ -63,6 +63,8 @@ public: void SetQTF(const char *qtf, Zoom z = Zoom(1, 1)); const RichText& Get() const { return text; } String GetQTF(byte cs = CHARSET_UTF8) const { return AsQTF(text, cs); } + + int GetCursor() const { return cursor; } int GetWidth() const { return text.GetWidth(); } int GetHeight(int cx) const { return text.GetHeight(Zoom(1, 1), cx); } diff --git a/uppsrc/CtrlLib/src.tpp/ArrayCtrl_en-us.tpp b/uppsrc/CtrlLib/src.tpp/ArrayCtrl_en-us.tpp index bb51aab13..c13ecbe79 100644 --- a/uppsrc/CtrlLib/src.tpp/ArrayCtrl_en-us.tpp +++ b/uppsrc/CtrlLib/src.tpp/ArrayCtrl_en-us.tpp @@ -1073,6 +1073,12 @@ width is extended to span over the next cell (just like in common spreadsheet applications). ArrayCtrl header must no be in Moving mode for correct operation. Returns `*this.&] [s3; &] +[s4;%- &] +[s5;:Upp`:`:ArrayCtrl`:`:AcceptEdits`(bool`):%- ArrayCtrl[@(0.0.255) `&] +[* AcceptEdits]([@(0.0.255) bool] [*@3 b] [@(0.0.255) `=] [@(0.0.255) true])&] +[s2; ArrayCtrl normally does not Accept (check) controlled widgets +(e.g. editors). This mode activates such behaviour.&] +[s3;%- &] [s4; &] [s5;:ArrayCtrl`:`:RowFormat`(const char`*`): [_^String^ String]_[* RowFormat]([@(0.0.255) c onst]_[@(0.0.255) char]_`*[*@3 s])&] diff --git a/uppsrc/ide/clang/Signature.cpp b/uppsrc/ide/clang/Signature.cpp index 6d989b731..38349f901 100644 --- a/uppsrc/ide/clang/Signature.cpp +++ b/uppsrc/ide/clang/Signature.cpp @@ -158,7 +158,9 @@ String CleanupId(const char *s) mm.Cat(*s++); } } - return mm; + String m = mm; + m.TrimEnd("=0"); + return m; } String CleanupPretty(const String& signature)