patch 1352744
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36201 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
90e572f1e5
commit
21ec3bf99c
@ -60,10 +60,8 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
|
||||
case wxDF_METAFILE :
|
||||
break ;
|
||||
default:
|
||||
{
|
||||
wxLogError(_("Unsupported clipboard format."));
|
||||
return NULL;
|
||||
}
|
||||
// custom datatype
|
||||
break ;
|
||||
}
|
||||
|
||||
#if TARGET_CARBON
|
||||
@ -226,12 +224,12 @@ bool wxClipboard::AddData( wxDataObject *data )
|
||||
|
||||
wxCHECK_MSG( data, false, wxT("data is invalid") );
|
||||
|
||||
/* we can only store one wxDataObject */
|
||||
// we can only store one wxDataObject
|
||||
Clear();
|
||||
|
||||
m_data = data;
|
||||
|
||||
/* get formats from wxDataObjects */
|
||||
// get formats from wxDataObjects
|
||||
wxDataFormat *array = new wxDataFormat[ m_data->GetFormatCount() ];
|
||||
m_data->GetAllFormats( array );
|
||||
|
||||
@ -272,6 +270,7 @@ bool wxClipboard::AddData( wxDataObject *data )
|
||||
mactype = kScrapFlavorTypePicture ;
|
||||
break ;
|
||||
default:
|
||||
mactype = (OSType)(array[i].GetFormatId());
|
||||
break ;
|
||||
}
|
||||
UMAPutScrap( sz , mactype , buf ) ;
|
||||
@ -297,7 +296,6 @@ void wxClipboard::Close()
|
||||
delete m_data;
|
||||
m_data = (wxDataObject*) NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool wxClipboard::IsSupported( const wxDataFormat &dataFormat )
|
||||
@ -351,59 +349,59 @@ bool wxClipboard::GetData( wxDataObject& data )
|
||||
|
||||
if ( m_data )
|
||||
{
|
||||
for (size_t i = 0; !transferred && i < formatcount ; i++)
|
||||
{
|
||||
wxDataFormat format = array[i] ;
|
||||
if ( m_data->IsSupported( format ) )
|
||||
{
|
||||
int size = m_data->GetDataSize( format );
|
||||
transferred = true ;
|
||||
for (size_t i = 0; !transferred && i < formatcount ; i++)
|
||||
{
|
||||
wxDataFormat format = array[i] ;
|
||||
if ( m_data->IsSupported( format ) )
|
||||
{
|
||||
int size = m_data->GetDataSize( format );
|
||||
transferred = true ;
|
||||
|
||||
if (size == 0)
|
||||
{
|
||||
data.SetData(format , 0 , 0 ) ;
|
||||
if (size == 0)
|
||||
{
|
||||
data.SetData(format , 0 , 0 ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *d = new char[size];
|
||||
m_data->GetDataHere( format , (void*) d );
|
||||
data.SetData( format , size , d ) ;
|
||||
delete[] d ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
char *d = new char[size];
|
||||
m_data->GetDataHere( format , (void*) d );
|
||||
data.SetData( format , size , d ) ;
|
||||
delete[] d ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* get formats from wxDataObjects */
|
||||
|
||||
// get formats from wxDataObjects
|
||||
if ( !transferred )
|
||||
{
|
||||
for (size_t i = 0; !transferred && i < formatcount ; i++)
|
||||
{
|
||||
wxDataFormat format = array[i] ;
|
||||
for (size_t i = 0; !transferred && i < formatcount ; i++)
|
||||
{
|
||||
wxDataFormat format = array[i] ;
|
||||
|
||||
switch ( format.GetType() )
|
||||
{
|
||||
case wxDF_TEXT :
|
||||
case wxDF_UNICODETEXT:
|
||||
case wxDF_OEMTEXT :
|
||||
case wxDF_BITMAP :
|
||||
case wxDF_METAFILE :
|
||||
{
|
||||
long len ;
|
||||
char* s = (char*)wxGetClipboardData(format, &len );
|
||||
if ( s )
|
||||
{
|
||||
data.SetData( format , len , s ) ;
|
||||
delete [] s;
|
||||
switch ( format.GetType() )
|
||||
{
|
||||
// NOTE: this is usable for all data types
|
||||
case wxDF_TEXT :
|
||||
case wxDF_UNICODETEXT:
|
||||
case wxDF_OEMTEXT :
|
||||
case wxDF_BITMAP :
|
||||
case wxDF_METAFILE :
|
||||
default :
|
||||
{
|
||||
long len ;
|
||||
char* s = (char*)wxGetClipboardData(format, &len );
|
||||
if ( s )
|
||||
{
|
||||
data.SetData( format , len , s ) ;
|
||||
delete [] s;
|
||||
|
||||
transferred = true ;
|
||||
}
|
||||
}
|
||||
break ;
|
||||
|
||||
default :
|
||||
transferred = true ;
|
||||
}
|
||||
}
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delete[] array ;
|
||||
|
Loading…
Reference in New Issue
Block a user