aboutsummaryrefslogtreecommitdiffhomepage
path: root/win32/ScintillaWin.cxx
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2001-09-01 03:01:09 +0000
committernyamatongwe <devnull@localhost>2001-09-01 03:01:09 +0000
commit310e00f780d3fbf65a69405404849e140ff20739 (patch)
treea90dfa88218a698f1a689abd2caa2e0b54772405 /win32/ScintillaWin.cxx
parent669deeb6407f674b4017f2f7393e3ccce1b3a58a (diff)
downloadscintilla-mirror-310e00f780d3fbf65a69405404849e140ff20739.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.cxx31
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);