From 28cc29b68b142c595f0361cf3d4cb32d87665327 Mon Sep 17 00:00:00 2001 From: cxl Date: Fri, 7 Jun 2019 11:39:12 +0000 Subject: [PATCH] CtrlLib: FileSelButton::WhenSelected, ide: small improvements git-svn-id: svn://ultimatepp.org/upp/trunk@13364 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Core/Map.hpp | 4 ---- uppsrc/CtrlLib/ArrayCtrl.h | 4 +++- uppsrc/CtrlLib/CtrlUtil.cpp | 1 + uppsrc/CtrlLib/CtrlUtil.h | 2 ++ uppsrc/TextDiffCtrl/DirDiff.cpp | 4 ++-- uppsrc/ide/Browser/Base.cpp | 10 ++++++---- uppsrc/ide/OutputMode.cpp | 3 +++ 7 files changed, 17 insertions(+), 11 deletions(-) diff --git a/uppsrc/Core/Map.hpp b/uppsrc/Core/Map.hpp index 885bd7d73..bb2b32696 100644 --- a/uppsrc/Core/Map.hpp +++ b/uppsrc/Core/Map.hpp @@ -66,10 +66,6 @@ int AMap::FindPut_(KK&& k) int i = key.FindPut(std::forward(k)); if(i >= value.GetCount()) value.Add(); - else { - Destroy(&value[i], &value[i] + 1); - Construct(&value[i], &value[i] + 1); - } return i; } diff --git a/uppsrc/CtrlLib/ArrayCtrl.h b/uppsrc/CtrlLib/ArrayCtrl.h index 0b75c69f6..847eebc5c 100644 --- a/uppsrc/CtrlLib/ArrayCtrl.h +++ b/uppsrc/CtrlLib/ArrayCtrl.h @@ -330,6 +330,8 @@ private: void SyncInfo(); void SortA(); void SortB(const Vector& o); + + void SelectOne(int i, bool sel = true, bool raise = true); int AsNdx(const String& id) { return id_ndx.FindAdd(id); } @@ -452,7 +454,7 @@ public: int GetSelectCount() const; bool IsSelection() const { return GetSelectCount(); } - void SelectOne(int i, bool sel = true, bool raise = true); + void Select(int i, bool sel = true) { SelectOne(i, sel); } void Select(int i, int count, bool sel = true); bool IsSelected(int i) const { return i < array.GetCount() && array[i].select; } void ClearSelection(bool raise = true); diff --git a/uppsrc/CtrlLib/CtrlUtil.cpp b/uppsrc/CtrlLib/CtrlUtil.cpp index ee2bb4e62..28d36134d 100644 --- a/uppsrc/CtrlLib/CtrlUtil.cpp +++ b/uppsrc/CtrlLib/CtrlUtil.cpp @@ -404,6 +404,7 @@ void FileSelButton::OnAction() { *owner <<= Get(); owner->Action(); + WhenSelected(); } } diff --git a/uppsrc/CtrlLib/CtrlUtil.h b/uppsrc/CtrlLib/CtrlUtil.h index db6192b65..fe5375b63 100644 --- a/uppsrc/CtrlLib/CtrlUtil.h +++ b/uppsrc/CtrlLib/CtrlUtil.h @@ -494,6 +494,8 @@ public: void Detach(); void Title(String t) { title = t; } String GetTitle() const { return title; } + + Event<> WhenSelected; private: void OnAction(); diff --git a/uppsrc/TextDiffCtrl/DirDiff.cpp b/uppsrc/TextDiffCtrl/DirDiff.cpp index f6d479b25..ea3b8494e 100644 --- a/uppsrc/TextDiffCtrl/DirDiff.cpp +++ b/uppsrc/TextDiffCtrl/DirDiff.cpp @@ -162,8 +162,8 @@ DirDiffDlg::DirDiffDlg() files_pane.Add(info.SetAlign(ALIGN_RIGHT).TopPos(3 * cy + 3 * div, bcy).RightPos(1, Zx(70))); files_pane.Add(compare.TopPos(2 * cy + 2 * div, bcy).RightPos(0, bcx)); - files_pane.Add(files.VSizePos(3 * cy + bcy + 4 * div, 22).HSizePos()); - files_pane.Add(find.HSizePosZ(4, 4).BottomPosZ(4, 19)); + files_pane.Add(files.VSizePosZ(3 * cy + bcy + 4 * div, 24).HSizePos()); + files_pane.Add(find.BottomPosZ(4, 19).HSizePosZ()); Add(files_diff.SizePos()); files_diff.Set(files_pane, diff); diff --git a/uppsrc/ide/Browser/Base.cpp b/uppsrc/ide/Browser/Base.cpp index 0f40e0c1d..efde8d3a3 100644 --- a/uppsrc/ide/Browser/Base.cpp +++ b/uppsrc/ide/Browser/Base.cpp @@ -8,10 +8,10 @@ #define LDUMP(x) // DDUMP(x) -// #define HAS_CLOG +#define HAS_CLOG #ifdef HAS_CLOG -#define CLOG(x) RLOG(x) +#define CLOG(x) // RLOG(x) #else #define CLOG(x) #endif @@ -321,9 +321,11 @@ void UpdateCodeBase2(Progress& pi) base.Sweep(keep_file); - for(int i = 0; i < source_file.GetCount(); i++) - if(keep_file.Find(i) < 0 && parse_file.Find(i) < 0 && !source_file.IsUnlinked(i)) + for(int i = 0; i < source_file.GetCount(); i++) { + if(keep_file.Find(i) < 0 && parse_file.Find(i) < 0 && !source_file.IsUnlinked(i)) { source_file.Unlink(i); + } + } #ifdef HAS_CLOG for(int i = 0; i < source_file.GetCount(); i++) diff --git a/uppsrc/ide/OutputMode.cpp b/uppsrc/ide/OutputMode.cpp index 8f96dd40f..e3d4a27db 100644 --- a/uppsrc/ide/OutputMode.cpp +++ b/uppsrc/ide/OutputMode.cpp @@ -118,6 +118,9 @@ ModePane::ModePane() .Add(1, "Minimal") .Add(2, "Full"); target_browse.Attach(target); + target_browse.WhenSelected << [=] { + target_override <<= true; + }; } struct OutMode : WithOutputModeLayout {