X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e542ecc6f610409e6b17b48716daf613edbaf2e6..52af3158e974b042008474268570f3bdb7ce95ee:/src/mac/carbon/clipbrd.cpp?ds=sidebyside diff --git a/src/mac/carbon/clipbrd.cpp b/src/mac/carbon/clipbrd.cpp index 14fdda89c2..413b80df02 100644 --- a/src/mac/carbon/clipbrd.cpp +++ b/src/mac/carbon/clipbrd.cpp @@ -2,7 +2,7 @@ // Name: src/mac/carbon/clipbrd.cpp // Purpose: Clipboard functionality // Author: Stefan Csomor; -// Generalized clipboard implementation by Matthew Flatt +// Generalized clipboard implementation by Matthew Flatt // Modified by: // Created: 1998-01-01 // RCS-ID: $Id$ @@ -14,14 +14,18 @@ #if wxUSE_CLIPBOARD -#include "wx/app.h" -#include "wx/frame.h" -#include "wx/bitmap.h" -#include "wx/utils.h" -#include "wx/metafile.h" #include "wx/clipbrd.h" -#include "wx/intl.h" -#include "wx/log.h" + +#ifndef WX_PRECOMP + #include "wx/intl.h" + #include "wx/log.h" + #include "wx/app.h" + #include "wx/utils.h" + #include "wx/frame.h" + #include "wx/bitmap.h" +#endif + +#include "wx/metafile.h" #ifndef __DARWIN__ #include @@ -169,6 +173,9 @@ wxClipboard::~wxClipboard() void wxClipboard::Clear() { + if ( IsUsingPrimarySelection() ) + return; + if (m_data != NULL) { delete m_data; @@ -210,6 +217,9 @@ bool wxClipboard::IsOpened() const bool wxClipboard::SetData( wxDataObject *data ) { + if ( IsUsingPrimarySelection() ) + return false; + wxCHECK_MSG( m_open, false, wxT("clipboard not open") ); wxCHECK_MSG( data, false, wxT("data is invalid") ); @@ -222,6 +232,9 @@ bool wxClipboard::SetData( wxDataObject *data ) bool wxClipboard::AddData( wxDataObject *data ) { + if ( IsUsingPrimarySelection() ) + return false; + wxCHECK_MSG( m_open, false, wxT("clipboard not open") ); wxCHECK_MSG( data, false, wxT("data is invalid") ); @@ -236,9 +249,18 @@ bool wxClipboard::AddData( wxDataObject *data ) for (size_t i = 0; i < m_data->GetFormatCount(); i++) { - wxLogTrace( TRACE_CLIPBOARD, - wxT("wxClipboard now supports atom %s"), - array[i].GetId().c_str() ); + if (array[i].IsStandard()) + { + wxLogTrace( TRACE_CLIPBOARD, + wxT("wxClipboard now supports standard atom type %d"), + array[i].GetType() ); + } + else + { + wxLogTrace( TRACE_CLIPBOARD, + wxT("wxClipboard now supports atom %s"), + array[i].GetId().c_str() ); + } size_t sz = data->GetDataSize( array[ i ] ); void* buf = malloc( sz + 1 ); @@ -307,6 +329,9 @@ void wxClipboard::Close() bool wxClipboard::IsSupported( const wxDataFormat &dataFormat ) { + if ( IsUsingPrimarySelection() ) + return false; + if ( m_data ) return m_data->IsSupported( dataFormat ); @@ -329,6 +354,16 @@ bool wxClipboard::IsSupported( const wxDataFormat &dataFormat ) if (err == noErr) hasData = true; } + else if ( dataFormat.GetType() == wxDF_UNICODETEXT ) + { + err = GetScrapFlavorFlags( scrapRef, 'TEXT', &flavorFlags ); + if (err == noErr) + { + err = GetScrapFlavorSize( scrapRef, 'TEXT', &byteCount ); + if (err == noErr) + hasData = true; + } + } } #else @@ -347,6 +382,9 @@ bool wxClipboard::IsSupported( const wxDataFormat &dataFormat ) bool wxClipboard::GetData( wxDataObject& data ) { + if ( IsUsingPrimarySelection() ) + return false; + wxCHECK_MSG( m_open, false, wxT("clipboard not open") ); size_t formatcount = data.GetFormatCount() + 1;