mirror of https://github.com/buggins/dlangui.git
win32 clipboard support working in editors
This commit is contained in:
parent
4348b859c7
commit
4ffb33f0ae
|
@ -537,12 +537,12 @@ class Win32Platform : Platform {
|
||||||
dstring res = null;
|
dstring res = null;
|
||||||
if (mouseBuffer)
|
if (mouseBuffer)
|
||||||
return res; // not supporetd under win32
|
return res; // not supporetd under win32
|
||||||
if (!IsClipboardFormatAvailable(CF_TEXT))
|
if (!IsClipboardFormatAvailable(CF_UNICODETEXT))
|
||||||
return res;
|
return res;
|
||||||
if (!OpenClipboard(NULL))
|
if (!OpenClipboard(NULL))
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
HGLOBAL hglb = GetClipboardData(CF_TEXT);
|
HGLOBAL hglb = GetClipboardData(CF_UNICODETEXT);
|
||||||
if (hglb != NULL)
|
if (hglb != NULL)
|
||||||
{
|
{
|
||||||
LPTSTR lptstr = cast(LPTSTR)GlobalLock(hglb);
|
LPTSTR lptstr = cast(LPTSTR)GlobalLock(hglb);
|
||||||
|
@ -556,11 +556,13 @@ class Win32Platform : Platform {
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseClipboard();
|
CloseClipboard();
|
||||||
|
//Log.d("getClipboardText(", res, ")");
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// sets text to clipboard (when mouseBuffer == true, use mouse selection clipboard - under linux)
|
/// sets text to clipboard (when mouseBuffer == true, use mouse selection clipboard - under linux)
|
||||||
override void setClipboardText(dstring text, bool mouseBuffer = false) {
|
override void setClipboardText(dstring text, bool mouseBuffer = false) {
|
||||||
|
//Log.d("setClipboardText(", text, ")");
|
||||||
if (text.length < 1 || mouseBuffer)
|
if (text.length < 1 || mouseBuffer)
|
||||||
return;
|
return;
|
||||||
if (!OpenClipboard(NULL))
|
if (!OpenClipboard(NULL))
|
||||||
|
@ -577,9 +579,9 @@ class Win32Platform : Platform {
|
||||||
for (int i = 0; i < w.length; i++) {
|
for (int i = 0; i < w.length; i++) {
|
||||||
lptstrCopy[i] = w[i];
|
lptstrCopy[i] = w[i];
|
||||||
}
|
}
|
||||||
lptstrCopy[w.length - 1] = 0;
|
lptstrCopy[w.length] = 0;
|
||||||
GlobalUnlock(hglbCopy);
|
GlobalUnlock(hglbCopy);
|
||||||
SetClipboardData(CF_TEXT, hglbCopy);
|
SetClipboardData(CF_UNICODETEXT, hglbCopy);
|
||||||
CloseClipboard();
|
CloseClipboard();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue