From 9bbd190705d5a5f781693165cff257208268cffc Mon Sep 17 00:00:00 2001 From: Oezguer Emir Date: Fri, 26 Jul 2013 00:34:20 +0200 Subject: Support rectangular selected text in clipboard from and to Borland Delphi IDE --- win32/ScintillaWin.cxx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 8d7be0629..340dcd86d 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -197,6 +197,7 @@ class ScintillaWin : bool hasOKText; CLIPFORMAT cfColumnSelect; + CLIPFORMAT cfColumnSelectBorland; CLIPFORMAT cfLineSelect; HRESULT hrOle; @@ -315,7 +316,7 @@ public: friend class DataObject; friend class DropTarget; bool DragIsRectangularOK(CLIPFORMAT fmt) const { - return drag.rectangular && (fmt == cfColumnSelect); + return drag.rectangular && ((fmt == cfColumnSelect) || (fmt == cfColumnSelectBorland)); } private: @@ -347,9 +348,11 @@ ScintillaWin::ScintillaWin(HWND hwnd) { hasOKText = false; // There does not seem to be a real standard for indicating that the clipboard - // contains a rectangular selection, so copy Developer Studio. + // contains a rectangular selection, so copy Developer Studio and Borland Delphi. cfColumnSelect = static_cast( ::RegisterClipboardFormat(TEXT("MSDEVColumnSelect"))); + cfColumnSelectBorland = static_cast( + ::RegisterClipboardFormat(TEXT("Borland IDE Block Type"))); // Likewise for line-copy (copies a full line when no text is selected) cfLineSelect = static_cast( @@ -1697,7 +1700,7 @@ void ScintillaWin::Paste() { SelectionPosition selStart = sel.IsRectangular() ? sel.Rectangular().Start() : sel.Range(sel.Main()).Start(); - bool isRectangular = ::IsClipboardFormatAvailable(cfColumnSelect) != 0; + bool isRectangular = ((::IsClipboardFormatAvailable(cfColumnSelect) != 0) || (::IsClipboardFormatAvailable(cfColumnSelectBorland) != 0)); // Always use CF_UNICODETEXT if available GlobalMemory memUSelection(::GetClipboardData(CF_UNICODETEXT)); @@ -2244,6 +2247,12 @@ void ScintillaWin::CopyToClipboard(const SelectionText &selectedText) { if (selectedText.rectangular) { ::SetClipboardData(cfColumnSelect, 0); + GlobalMemory borlandColumn; + borlandColumn.Allocate(1); + if (borlandColumn) { + static_cast(borlandColumn.ptr)[0] = 0x02; + borlandColumn.SetClip(cfColumnSelectBorland); + } } if (selectedText.lineCopy) { -- cgit v1.2.3