From 87b78019a277c64d6e52182d43e501db1693e4cc Mon Sep 17 00:00:00 2001 From: cxl Date: Mon, 24 May 2021 15:00:35 +0000 Subject: [PATCH] GridCtrl: WhenPasting (called before paste) git-svn-id: svn://ultimatepp.org/upp/trunk@15959 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/CtrlCore/TopWindow.cpp | 1 - uppsrc/GridCtrl/GridCtrl.cpp | 8 ++++++-- uppsrc/GridCtrl/GridCtrl.h | 4 +++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/uppsrc/CtrlCore/TopWindow.cpp b/uppsrc/CtrlCore/TopWindow.cpp index 0692818c4..33e1cc618 100644 --- a/uppsrc/CtrlCore/TopWindow.cpp +++ b/uppsrc/CtrlCore/TopWindow.cpp @@ -93,7 +93,6 @@ void TopWindow::Close() DefaultBreak(); return; } - backup.Clear(); if(IsOpen()) IgnoreMouseUp(); Ctrl::Close(); } diff --git a/uppsrc/GridCtrl/GridCtrl.cpp b/uppsrc/GridCtrl/GridCtrl.cpp index 53c6d8474..19ca6e868 100644 --- a/uppsrc/GridCtrl/GridCtrl.cpp +++ b/uppsrc/GridCtrl/GridCtrl.cpp @@ -781,7 +781,7 @@ void GridCtrl::Paste(int mode) { if(!clipboard) return; - + GridClipboard gc = GetClipboard(); bool is_gc = !gc.data.IsEmpty(); @@ -802,8 +802,12 @@ void GridCtrl::Paste(int mode) Vector lines; + String s = FromUnicode(ReadClipboardUnicodeText()); + + WhenPasting(s); + if(is_tc && !is_gc) - lines = Upp::Split(FromUnicode(ReadClipboardUnicodeText()), '\n'); + lines = Upp::Split(s, '\n'); if(mode == 1) { diff --git a/uppsrc/GridCtrl/GridCtrl.h b/uppsrc/GridCtrl/GridCtrl.h index 17961a264..ed2ecbb89 100644 --- a/uppsrc/GridCtrl/GridCtrl.h +++ b/uppsrc/GridCtrl/GridCtrl.h @@ -1853,7 +1853,9 @@ class GridCtrl : public Ctrl Event ProcessSummaryValue; Event WhenPasteCell; - Event<> WhenPaste; + + Event WhenPasting; + Event<> WhenPaste; }; class GridText : Ctrl