remove unnessary internal variables, parameters; use wxVector replace c++ array; enable implemented function parameter
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77858 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -258,7 +258,6 @@ void GetClipboardData(Display* disp, Window win, wxDataObject &data, wxDataForma
|
|||||||
unsigned char *clipbrdData = NULL;
|
unsigned char *clipbrdData = NULL;
|
||||||
|
|
||||||
// some variables that used to get the data in window property
|
// some variables that used to get the data in window property
|
||||||
char *text = NULL;
|
|
||||||
unsigned long len;
|
unsigned long len;
|
||||||
|
|
||||||
switch ( dfFormat )
|
switch ( dfFormat )
|
||||||
@@ -269,22 +268,27 @@ void GetClipboardData(Display* disp, Window win, wxDataObject &data, wxDataForma
|
|||||||
}
|
}
|
||||||
case wxDF_BITMAP:
|
case wxDF_BITMAP:
|
||||||
{
|
{
|
||||||
Atom atomArray[] = {XA_IMAGE_BMP, XA_IMAGE_JPG, XA_IMAGE_TIFF, XA_IMAGE_PNG};
|
wxVector<Atom> atomVector;
|
||||||
|
atomVector.push_back(XA_IMAGE_BMP);
|
||||||
|
atomVector.push_back(XA_IMAGE_JPG);
|
||||||
|
atomVector.push_back(XA_IMAGE_TIFF);
|
||||||
|
atomVector.push_back(XA_IMAGE_PNG);
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
// check the four atoms in clipboard, try to find whether there has data
|
// check the four atoms in clipboard, try to find whether there has data
|
||||||
// stored in one of these atom.
|
// stored in one of these atom.
|
||||||
for ( i = 0; i <= 4; i++ )
|
for ( i = 0; i < atomVector.size(); i++ )
|
||||||
{
|
{
|
||||||
|
|
||||||
clipbrdData = GetClipboardDataByFormat(disp, win, XA_CLIPBOARD, atomArray[i], &len);
|
clipbrdData = GetClipboardDataByFormat(disp, win, XA_CLIPBOARD,
|
||||||
|
atomVector.at(i), &len);
|
||||||
if ( clipbrdData != NULL )
|
if ( clipbrdData != NULL )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// if we got any data, copy it.
|
// if we got any data, copy it.
|
||||||
if ( clipbrdData )
|
if ( clipbrdData )
|
||||||
{
|
{
|
||||||
text = strdup((char*) clipbrdData);
|
data.SetData(dfFormat, len, (char*)clipbrdData);
|
||||||
data.SetData(dfFormat, len, text);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -294,8 +298,7 @@ void GetClipboardData(Display* disp, Window win, wxDataObject &data, wxDataForma
|
|||||||
// if we got any data, copy it.
|
// if we got any data, copy it.
|
||||||
if ( clipbrdData )
|
if ( clipbrdData )
|
||||||
{
|
{
|
||||||
text = strdup((char*) clipbrdData );
|
data.SetData(dfFormat, len, (char*)clipbrdData);
|
||||||
data.SetData(dfFormat, len, text);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -343,13 +346,17 @@ extern "C" void wxClipboardHandleSelectionRequest(XEvent event)
|
|||||||
// get formats count in the wxDataObject
|
// get formats count in the wxDataObject
|
||||||
// for each data format, search it in x11 selection
|
// for each data format, search it in x11 selection
|
||||||
// and store it to wxDataObject
|
// and store it to wxDataObject
|
||||||
wxDataObject* m_data = wxTheClipboard->m_data;
|
wxDataObject* data = wxTheClipboard->m_data;
|
||||||
size_t count = m_data->GetFormatCount(wxDataObject::Get);
|
size_t count = data->GetFormatCount();
|
||||||
wxDataFormatScopedArray dfarr(count);
|
wxDataFormatScopedArray dfarr(count);
|
||||||
m_data->GetAllFormats(dfarr.get(), wxDataObject::Get);
|
data->GetAllFormats(dfarr.get());
|
||||||
|
|
||||||
// retrieve the data with specific image Atom.
|
// retrieve the data with specific image Atom.
|
||||||
Atom atomArray[] = {XA_IMAGE_BMP, XA_IMAGE_JPG, XA_IMAGE_TIFF, XA_IMAGE_PNG};
|
wxVector<Atom> atomVector;
|
||||||
|
atomVector.push_back(XA_IMAGE_BMP);
|
||||||
|
atomVector.push_back(XA_IMAGE_JPG);
|
||||||
|
atomVector.push_back(XA_IMAGE_TIFF);
|
||||||
|
atomVector.push_back(XA_IMAGE_PNG);
|
||||||
|
|
||||||
#if wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
wxDataFormat dfFormat = wxDF_UNICODETEXT;
|
wxDataFormat dfFormat = wxDF_UNICODETEXT;
|
||||||
@@ -358,9 +365,9 @@ extern "C" void wxClipboardHandleSelectionRequest(XEvent event)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for ( i = 0; i <= 4; i++ )
|
for ( i = 0; i <= atomVector.size(); i++ )
|
||||||
{
|
{
|
||||||
if ( target == atomArray[i] )
|
if ( target == atomVector.at(i) )
|
||||||
{
|
{
|
||||||
dfFormat = wxDF_BITMAP;
|
dfFormat = wxDF_BITMAP;
|
||||||
break;
|
break;
|
||||||
@@ -391,13 +398,11 @@ extern "C" void wxClipboardHandleSelectionRequest(XEvent event)
|
|||||||
// TODO, when finish the event process issue, improve the check.
|
// TODO, when finish the event process issue, improve the check.
|
||||||
else if ( target == XA_UTF8_STRING )
|
else if ( target == XA_UTF8_STRING )
|
||||||
{
|
{
|
||||||
unsigned char* buf = NULL;
|
size_t size = data->GetDataSize(dfFormat);
|
||||||
size_t size = 0;
|
wxCharTypeBuffer<unsigned char> buf(size);
|
||||||
size = m_data->GetDataSize(dfFormat);
|
data->GetDataHere(dfFormat, buf.data());
|
||||||
buf = (unsigned char*)malloc(size);
|
XChangeProperty(disp, requestor, XA_CLIPBOARD, target, 8, PropModeReplace,
|
||||||
m_data->GetDataHere(dfFormat, buf);
|
buf.data(), size);
|
||||||
XChangeProperty(disp, requestor, XA_CLIPBOARD, target, 8, PropModeReplace,
|
|
||||||
buf, size);
|
|
||||||
delete buf;
|
delete buf;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -519,7 +524,9 @@ bool wxClipboard::AddData( wxDataObject *data )
|
|||||||
m_data->GetDataHere(wxDF_UNICODETEXT, buf);
|
m_data->GetDataHere(wxDF_UNICODETEXT, buf);
|
||||||
|
|
||||||
XChangeProperty(xdisplay, window, XA_CLIPBOARD, XA_STRING, 8, PropModeReplace,
|
XChangeProperty(xdisplay, window, XA_CLIPBOARD, XA_STRING, 8, PropModeReplace,
|
||||||
buf, size);
|
buf, size);
|
||||||
|
|
||||||
|
delete buf;
|
||||||
|
|
||||||
XSetSelectionOwner(xdisplay, XA_CLIPBOARD, window, CurrentTime);
|
XSetSelectionOwner(xdisplay, XA_CLIPBOARD, window, CurrentTime);
|
||||||
XFlush(xdisplay);
|
XFlush(xdisplay);
|
||||||
@@ -552,9 +559,9 @@ bool wxClipboard::GetData( wxDataObject& data )
|
|||||||
// get formats count in the wxDataObject
|
// get formats count in the wxDataObject
|
||||||
// for each data format, search it in x11 selection
|
// for each data format, search it in x11 selection
|
||||||
// and store it to wxDataObject
|
// and store it to wxDataObject
|
||||||
size_t count = data.GetFormatCount(wxDataObject::Get);
|
size_t count = data.GetFormatCount();
|
||||||
wxDataFormatScopedArray dfarr(count);
|
wxDataFormatScopedArray dfarr(count);
|
||||||
data.GetAllFormats(dfarr.get(), wxDataObject::Get);
|
data.GetAllFormats(dfarr.get());
|
||||||
|
|
||||||
// prepare and find the root window,
|
// prepare and find the root window,
|
||||||
// the copied data stored in the root window as window property
|
// the copied data stored in the root window as window property
|
||||||
|
@@ -1660,8 +1660,8 @@ void wxWindowDCImpl::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDCImpl::DoDrawRotatedText(const wxString& WXUNUSED(text),
|
void wxWindowDCImpl::DoDrawRotatedText(const wxString& text,
|
||||||
wxCoord WXUNUSED(x), wxCoord WXUNUSED(y),
|
wxCoord x, wxCoord y,
|
||||||
double angle)
|
double angle)
|
||||||
{
|
{
|
||||||
// use cairo to draw rotated text
|
// use cairo to draw rotated text
|
||||||
|
Reference in New Issue
Block a user