diff options
author | Oezguer Emir <oezguer@3mir.de> | 2013-07-26 00:34:20 +0200 |
---|---|---|
committer | Oezguer Emir <oezguer@3mir.de> | 2013-07-26 00:34:20 +0200 |
commit | ad9dd61f17284bd1df8534b8a1d2c56f8c727580 (patch) | |
tree | b1d44b3d3ce10c98575dd4c1edb4cbcc9d5e8b1e | |
parent | c9605306ddf02bd4bc553421533fcab2fff9c4b6 (diff) | |
download | scintilla-mirror-ad9dd61f17284bd1df8534b8a1d2c56f8c727580.tar.gz |
Support rectangular selected text in clipboard from and to Borland Delphi IDE
-rw-r--r-- | win32/ScintillaWin.cxx | 15 |
1 files 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<CLIPFORMAT>( ::RegisterClipboardFormat(TEXT("MSDEVColumnSelect"))); + cfColumnSelectBorland = static_cast<CLIPFORMAT>( + ::RegisterClipboardFormat(TEXT("Borland IDE Block Type"))); // Likewise for line-copy (copies a full line when no text is selected) cfLineSelect = static_cast<CLIPFORMAT>( @@ -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<BYTE *>(borlandColumn.ptr)[0] = 0x02; + borlandColumn.SetClip(cfColumnSelectBorland); + } } if (selectedText.lineCopy) { |