readded clipboard support to richedit sample and fixed a fatal bug in
wxCustomDataObject (uninitialized m_data) which this allowed to discover git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4330 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2844,9 +2844,8 @@ wxLayoutList::GetSelection(wxLayoutDataObject *wxlo, bool invalidate)
|
|||||||
exp->content.object->Write(string);
|
exp->content.object->Write(string);
|
||||||
delete exp;
|
delete exp;
|
||||||
}
|
}
|
||||||
#if 0 // FIXME: DnD/Clipboard API has changed, what should this be?
|
|
||||||
wxlo->SetData(string.c_str(), string.Length()+1);
|
wxlo->SetLayoutData(string);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return llist;
|
return llist;
|
||||||
}
|
}
|
||||||
|
@@ -1218,13 +1218,15 @@ private:
|
|||||||
class wxLayoutDataObject : public wxCustomDataObject
|
class wxLayoutDataObject : public wxCustomDataObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxLayoutDataObject(void)
|
wxLayoutDataObject()
|
||||||
{
|
{
|
||||||
#if 0 // TODO: No longer exists, what should we do instead?
|
SetFormat("application/wxlayoutlist");
|
||||||
SetId("application/wxlayoutlist");
|
|
||||||
#endif
|
|
||||||
//m_format.SetAtom((GdkAtom) 222222);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// type safe wrappers
|
||||||
|
void SetLayoutData(const wxString& text)
|
||||||
|
{ SetData(text.length() + 1, text.c_str()); }
|
||||||
|
const char *GetLayoutData() const { return (const char *)GetData(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
@@ -1080,21 +1080,19 @@ wxLayoutWindow::Paste(bool primary)
|
|||||||
// Read some text
|
// Read some text
|
||||||
if (wxTheClipboard->Open())
|
if (wxTheClipboard->Open())
|
||||||
{
|
{
|
||||||
#if __WXGTK__
|
|
||||||
if(primary)
|
if(primary)
|
||||||
wxTheClipboard->UsePrimarySelection();
|
wxTheClipboard->UsePrimarySelection();
|
||||||
#endif
|
|
||||||
#if wxUSE_PRIVATE_CLIPBOARD_FORMAT
|
|
||||||
wxLayoutDataObject wxldo;
|
wxLayoutDataObject wxldo;
|
||||||
if (wxTheClipboard->IsSupported( wxldo.GetFormat() ))
|
if (wxTheClipboard->IsSupported( wxldo.GetFormat() ))
|
||||||
{
|
{
|
||||||
wxTheClipboard->GetData(&wxldo);
|
wxTheClipboard->GetData(wxldo);
|
||||||
{
|
|
||||||
}
|
// now we can access the data we had put into wxLayoutDataObject in
|
||||||
//FIXME: missing functionality m_llist->Insert(wxldo.GetList());
|
// wxLayoutList::GetSelection by calling its GetLayoutData() - the
|
||||||
|
// trouble is that I don't know what to do with it! (VZ)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
wxTextDataObject data;
|
wxTextDataObject data;
|
||||||
if (wxTheClipboard->IsSupported( data.GetFormat() ))
|
if (wxTheClipboard->IsSupported( data.GetFormat() ))
|
||||||
@@ -1120,8 +1118,8 @@ wxLayoutWindow::Copy(bool invalidate)
|
|||||||
m_llist->EndSelection();
|
m_llist->EndSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxLayoutDataObject wldo;
|
wxLayoutDataObject *wldo = new wxLayoutDataObject;
|
||||||
wxLayoutList *llist = m_llist->GetSelection(&wldo, invalidate);
|
wxLayoutList *llist = m_llist->GetSelection(wldo, invalidate);
|
||||||
if(! llist)
|
if(! llist)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
// Export selection as text:
|
// Export selection as text:
|
||||||
@@ -1149,11 +1147,12 @@ wxLayoutWindow::Copy(bool invalidate)
|
|||||||
|
|
||||||
if (wxTheClipboard->Open())
|
if (wxTheClipboard->Open())
|
||||||
{
|
{
|
||||||
wxTextDataObject *data = new wxTextDataObject( text );
|
wxDataObjectComposite *dobj = new wxDataObjectComposite;
|
||||||
bool rc = wxTheClipboard->SetData( data );
|
dobj->Add(new wxTextDataObject(text));
|
||||||
#if wxUSE_PRIVATE_CLIPBOARD_FORMAT
|
dobj->Add(wldo);
|
||||||
rc |= wxTheClipboard->AddData( &wldo );
|
|
||||||
#endif
|
bool rc = wxTheClipboard->SetData(dobj);
|
||||||
|
|
||||||
wxTheClipboard->Close();
|
wxTheClipboard->Close();
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@@ -232,9 +232,9 @@ void wxFileDataObjectBase::SetFilenames(const wxChar* filenames)
|
|||||||
wxCustomDataObject::wxCustomDataObject(const wxDataFormat& format)
|
wxCustomDataObject::wxCustomDataObject(const wxDataFormat& format)
|
||||||
: wxDataObjectSimple(format)
|
: wxDataObjectSimple(format)
|
||||||
{
|
{
|
||||||
|
m_data = (void *)NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxCustomDataObject::~wxCustomDataObject()
|
wxCustomDataObject::~wxCustomDataObject()
|
||||||
{
|
{
|
||||||
Free();
|
Free();
|
||||||
|
Reference in New Issue
Block a user