diff options
author | nyamatongwe <unknown> | 2001-09-01 03:01:09 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2001-09-01 03:01:09 +0000 |
commit | 2551486092fa6cd68a1881b84c502f0bb7e74892 (patch) | |
tree | a90dfa88218a698f1a689abd2caa2e0b54772405 /win32/ScintillaWin.cxx | |
parent | 111ae4b1a706e2daf7c6e561a5389b57d4b7ea2b (diff) | |
download | scintilla-mirror-2551486092fa6cd68a1881b84c502f0bb7e74892.tar.gz |
Using new SelectionText type to handle text that is the subject of copy,
cut, paste and drag operations.
Mouse wheel scrolling moved into platform subclasses.
Macro support always included so MACRO_SUPPORT definition and use removed.
Allowing menu popup moved from Editor to ScintillaBase.
Diffstat (limited to 'win32/ScintillaWin.cxx')
-rw-r--r-- | win32/ScintillaWin.cxx | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index de1e8fc34..a26dcb9fd 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -231,7 +231,7 @@ public: friend class DataObject; friend class DropTarget; bool DragIsRectangularOK(CLIPFORMAT fmt) { - return dragIsRectangle && (fmt == cfColumnSelect); + return drag.rectangular && (fmt == cfColumnSelect); } }; @@ -1320,34 +1320,33 @@ void ScintillaWin::GetIntelliMouseParameters() { } void ScintillaWin::CopySelTextToClipboard() { - int bytes = SelectionRangeLength(); - char *selChars = CopySelectionRange(); - if (!selChars) + SelectionText selectedText; + CopySelectionRange(&selectedText); + if (selectedText.len == 0) return; HGLOBAL hand = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, - bytes + 1); + selectedText.len + 1); if (hand) { char *ptr = static_cast<char *>(::GlobalLock(hand)); - memcpy(ptr, selChars, bytes); - ptr[bytes] = '\0'; + memcpy(ptr, selectedText.s, selectedText.len); + ptr[selectedText.len] = '\0'; ::GlobalUnlock(hand); } ::SetClipboardData(CF_TEXT, hand); if (IsUnicodeMode()) { - int uchars = UCS2Length(selChars, bytes); + int uchars = UCS2Length(selectedText.s, selectedText.len); HGLOBAL uhand = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, 2 * (uchars + 1)); if (uhand) { wchar_t *uptr = static_cast<wchar_t *>(::GlobalLock(uhand)); - UCS2FromUTF8(selChars, bytes, uptr, uchars); + UCS2FromUTF8(selectedText.s, selectedText.len, uptr, uchars); uptr[uchars] = 0; ::GlobalUnlock(uhand); } ::SetClipboardData(CF_UNICODETEXT, uhand); } - delete []selChars; } void ScintillaWin::ScrollMessage(WPARAM wParam) { @@ -1627,21 +1626,21 @@ STDMETHODIMP ScintillaWin::GetData(FORMATETC *pFEIn, STGMEDIUM *pSTM) { HGLOBAL hand; if (pFEIn->cfFormat == CF_UNICODETEXT) { - int uchars = UCS2Length(dragChars, lenDrag); + int uchars = UCS2Length(drag.s, drag.len); hand = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, 2 * (uchars + 1)); if (hand) { wchar_t *uptr = static_cast<wchar_t *>(::GlobalLock(hand)); - UCS2FromUTF8(dragChars, lenDrag, uptr, uchars); + UCS2FromUTF8(drag.s, drag.len, uptr, uchars); uptr[uchars] = 0; } } else { - hand = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, lenDrag + 1); + hand = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, drag.len + 1); if (hand) { char *ptr = static_cast<char *>(::GlobalLock(hand)); - for (int i = 0; i < lenDrag; i++) { - ptr[i] = dragChars[i]; + for (int i = 0; i < drag.len; i++) { + ptr[i] = drag.s[i]; } - ptr[lenDrag] = '\0'; + ptr[drag.len] = '\0'; } } ::GlobalUnlock(hand); |