X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0edfdd963bdc9cfeb54d403ed77b5f36e4de8c84..43c42c18d36c703a88b1b7b697bac27fe5608eca:/src/msw/clipbrd.cpp?ds=inline diff --git a/src/msw/clipbrd.cpp b/src/msw/clipbrd.cpp index ee67b677fd..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() { @@ -90,13 +91,15 @@ bool wxOpenClipboard() gs_wxClipboardIsOpen = ::OpenClipboard((HWND)win->GetHWND()) != 0; if ( !gs_wxClipboardIsOpen ) + { wxLogSysError(_("Failed to open the clipboard.")); + } return gs_wxClipboardIsOpen; } else { - wxLogDebug(wxT("Can not open clipboard without a main window.")); + wxLogDebug(wxT("Cannot open clipboard without a main window.")); return false; } @@ -137,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) ) { @@ -212,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() ) @@ -302,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" @@ -330,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, "