X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/43b2d5e7c3b3e3d6b245e279dde73d96e0075911..1b48beaaf07513d9924b3b84e148957d4e69cfa2:/src/msw/clipbrd.cpp diff --git a/src/msw/clipbrd.cpp b/src/msw/clipbrd.cpp index fa65cd2a21..bd929dcac3 100644 --- a/src/msw/clipbrd.cpp +++ b/src/msw/clipbrd.cpp @@ -79,6 +79,7 @@ // --------------------------------------------------------------------------- static bool gs_wxClipboardIsOpen = false; +static int gs_htmlcfid = 0; bool wxOpenClipboard() { @@ -98,7 +99,7 @@ bool wxOpenClipboard() } else { - wxLogDebug(wxT("Can not open clipboard without a main window.")); + wxLogDebug(wxT("Cannot open clipboard without a main window.")); return false; } @@ -139,7 +140,9 @@ bool wxIsClipboardOpened() bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat) { - wxDataFormat::NativeFormat cf = dataFormat.GetFormatId(); + wxDataFormat::NativeFormat cf = dataFormat.GetFormatId(); + if (cf == wxDF_HTML) + cf = gs_htmlcfid; if ( ::IsClipboardFormatAvailable(cf) ) { @@ -214,7 +217,7 @@ bool wxSetClipboardData(wxDataFormat dataFormat, { wxBitmap *bitmap = (wxBitmap *)data; - if ( bitmap && bitmap->Ok() ) + if ( bitmap && bitmap->IsOk() ) { wxDIB dib(*bitmap); if ( dib.IsOk() ) @@ -304,10 +307,6 @@ bool wxSetClipboardData(wxDataFormat dataFormat, char *buf = new char [400 + strlen(html)]; 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" @@ -332,19 +331,19 @@ bool wxSetClipboardData(wxDataFormat dataFormat, // string when you overwrite it so you follow up with code to replace // the 0 appended at the end with a '\r'... char *ptr = strstr(buf, "StartHTML"); - sprintf(ptr+10, "%08u", strstr(buf, "") - buf); + sprintf(ptr+10, "%08u", (unsigned)(strstr(buf, "") - buf)); *(ptr+10+8) = '\r'; ptr = strstr(buf, "EndHTML"); - sprintf(ptr+8, "%08u", strlen(buf)); + sprintf(ptr+8, "%08u", (unsigned)strlen(buf)); *(ptr+8+8) = '\r'; ptr = strstr(buf, "StartFragment"); - sprintf(ptr+14, "%08u", strstr(buf, "