X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c2517b523979d4beaabbbe3538df1b49d682748d..84bdb0d8d7d7fe3d7cd6a2e5f50ee247ce2af5df:/src/msw/clipbrd.cpp diff --git a/src/msw/clipbrd.cpp b/src/msw/clipbrd.cpp index 49cc833ca9..8955fe8840 100644 --- a/src/msw/clipbrd.cpp +++ b/src/msw/clipbrd.cpp @@ -28,10 +28,6 @@ #pragma hdrstop #endif -#ifndef WX_PRECOMP - #include "wx/setup.h" -#endif - #if wxUSE_CLIPBOARD #ifndef WX_PRECOMP @@ -54,9 +50,10 @@ #include #include "wx/msw/private.h" +#include "wx/msw/ole/oleutils.h" #if wxUSE_WXDIB -#include "wx/msw/dib.h" + #include "wx/msw/dib.h" #endif // wxDataObject is tied to OLE/drag and drop implementation, therefore so are @@ -87,11 +84,11 @@ // old-style clipboard functions using Windows API // --------------------------------------------------------------------------- -static bool gs_wxClipboardIsOpen = FALSE; +static bool gs_wxClipboardIsOpen = false; bool wxOpenClipboard() { - wxCHECK_MSG( !gs_wxClipboardIsOpen, TRUE, wxT("clipboard already opened.") ); + wxCHECK_MSG( !gs_wxClipboardIsOpen, true, wxT("clipboard already opened.") ); wxWindow *win = wxTheApp->GetTopWindow(); if ( win ) @@ -107,24 +104,24 @@ bool wxOpenClipboard() { wxLogDebug(wxT("Can not open clipboard without a main window.")); - return FALSE; + return false; } } bool wxCloseClipboard() { - wxCHECK_MSG( gs_wxClipboardIsOpen, FALSE, wxT("clipboard is not opened") ); + wxCHECK_MSG( gs_wxClipboardIsOpen, false, wxT("clipboard is not opened") ); - gs_wxClipboardIsOpen = FALSE; + gs_wxClipboardIsOpen = false; if ( ::CloseClipboard() == 0 ) { wxLogSysError(_("Failed to close the clipboard.")); - return FALSE; + return false; } - return TRUE; + return true; } bool wxEmptyClipboard() @@ -133,10 +130,10 @@ bool wxEmptyClipboard() { wxLogSysError(_("Failed to empty the clipboard.")); - return FALSE; + return false; } - return TRUE; + return true; } bool wxIsClipboardOpened() @@ -151,7 +148,7 @@ bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat) if ( ::IsClipboardFormatAvailable(cf) ) { // ok from the first try - return TRUE; + return true; } // for several standard formats, we can convert from some other ones too @@ -167,7 +164,7 @@ bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat) #endif // wxUSE_ENH_METAFILE default: - return FALSE; + return false; } } @@ -196,7 +193,7 @@ bool wxSetClipboardData(wxDataFormat dataFormat, SelectObject(hdcSrc, old); DeleteDC(hdcMem); DeleteDC(hdcSrc); - return FALSE; + return false; } HBITMAP old1 = (HBITMAP) SelectObject(hdcMem, hBitmap); @@ -274,7 +271,7 @@ bool wxSetClipboardData(wxDataFormat dataFormat, default: { wxLogError(_("Unsupported clipboard format.")); - return FALSE; + return false; } case wxDF_OEMTEXT: @@ -306,15 +303,15 @@ bool wxSetClipboardData(wxDataFormat dataFormat, case wxDF_HTML: { char* html = (char *)data; - + // Create temporary buffer for HTML header... char *buf = new char [400 + strlen(html)]; - if(!buf) return FALSE; - + if(!buf) return false; + // Get clipboard id for HTML format... static int cfid = 0; if(!cfid) cfid = RegisterClipboardFormat(wxT("HTML Format")); - + // Create a template string for the HTML header... strcpy(buf, "Version:0.9\r\n" @@ -324,7 +321,7 @@ bool wxSetClipboardData(wxDataFormat dataFormat, "EndFragment:00000000\r\n" "\r\n" "\r\n"); - + // Append the HTML... strcat(buf, html); strcat(buf, "\r\n"); @@ -333,7 +330,7 @@ bool wxSetClipboardData(wxDataFormat dataFormat, "\r\n" "\r\n" ""); - + // Now go back, calculate all the lengths, and write out the // necessary header information. Note, wsprintf() truncates the // string when you overwrite it so you follow up with code to replace @@ -341,35 +338,35 @@ bool wxSetClipboardData(wxDataFormat dataFormat, char *ptr = strstr(buf, "StartHTML"); wsprintf(ptr+10, "%08u", strstr(buf, "") - buf); *(ptr+10+8) = '\r'; - + ptr = strstr(buf, "EndHTML"); wsprintf(ptr+8, "%08u", strlen(buf)); *(ptr+8+8) = '\r'; - + ptr = strstr(buf, "StartFragment"); wsprintf(ptr+14, "%08u", strstr(buf, "