cleanup - reformat

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36869 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Surovell
2006-01-14 07:56:26 +00:00
parent a571434502
commit 876b960ac2

View File

@@ -59,7 +59,7 @@ wxDragResult wxDropTarget::OnDragOver( wxCoord WXUNUSED(x),
bool wxDropTarget::OnDrop( wxCoord WXUNUSED(x), wxCoord WXUNUSED(y) ) bool wxDropTarget::OnDrop( wxCoord WXUNUSED(x), wxCoord WXUNUSED(y) )
{ {
if (!m_dataObject) if (m_dataObject == NULL)
return false; return false;
return CurrentDragHasSupportedFormat() ; return CurrentDragHasSupportedFormat() ;
@@ -68,7 +68,7 @@ bool wxDropTarget::OnDrop( wxCoord WXUNUSED(x), wxCoord WXUNUSED(y) )
wxDragResult wxDropTarget::OnData( wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), wxDragResult wxDropTarget::OnData( wxCoord WXUNUSED(x), wxCoord WXUNUSED(y),
wxDragResult def ) wxDragResult def )
{ {
if (!m_dataObject) if (m_dataObject == NULL)
return wxDragNone; return wxDragNone;
if (!CurrentDragHasSupportedFormat()) if (!CurrentDragHasSupportedFormat())
@@ -80,6 +80,7 @@ wxDragResult wxDropTarget::OnData( wxCoord WXUNUSED(x), wxCoord WXUNUSED(y),
bool wxDropTarget::CurrentDragHasSupportedFormat() bool wxDropTarget::CurrentDragHasSupportedFormat()
{ {
bool supported = false ; bool supported = false ;
if ( gTrackingGlobals.m_currentSource != NULL ) if ( gTrackingGlobals.m_currentSource != NULL )
{ {
wxDataObject* data = gTrackingGlobals.m_currentSource->GetDataObject() ; wxDataObject* data = gTrackingGlobals.m_currentSource->GetDataObject() ;
@@ -87,7 +88,7 @@ bool wxDropTarget::CurrentDragHasSupportedFormat()
if ( data ) if ( data )
{ {
size_t formatcount = data->GetFormatCount() ; size_t formatcount = data->GetFormatCount() ;
wxDataFormat *array = new wxDataFormat[ formatcount ]; wxDataFormat *array = new wxDataFormat[formatcount];
data->GetAllFormats( array ); data->GetAllFormats( array );
for (size_t i = 0; !supported && i < formatcount ; i++) for (size_t i = 0; !supported && i < formatcount ; i++)
{ {
@@ -112,15 +113,15 @@ bool wxDropTarget::CurrentDragHasSupportedFormat()
UInt16 flavors = 0 ; UInt16 flavors = 0 ;
CountDragItems((DragReference)m_currentDrag, &items); CountDragItems((DragReference)m_currentDrag, &items);
for (UInt16 index = 1; index <= items && !supported ; ++index) for (UInt16 index = 1; index <= items && !supported; ++index)
{ {
flavors = 0 ; flavors = 0 ;
GetDragItemReferenceNumber((DragReference)m_currentDrag, index, &theItem); GetDragItemReferenceNumber( (DragReference)m_currentDrag, index, &theItem );
CountDragItemFlavors( (DragReference)m_currentDrag, theItem , &flavors ) ; CountDragItemFlavors( (DragReference)m_currentDrag, theItem, &flavors );
for ( UInt16 flavor = 1 ; flavor <= flavors ; ++flavor ) for ( UInt16 flavor = 1 ; flavor <= flavors ; ++flavor )
{ {
result = GetFlavorType((DragReference)m_currentDrag, theItem, flavor , &theType); result = GetFlavorType( (DragReference)m_currentDrag, theItem, flavor, &theType );
if ( m_dataObject->IsSupportedFormat( wxDataFormat( theType ) ) ) if ( m_dataObject->IsSupportedFormat( wxDataFormat( theType ) ) )
{ {
supported = true ; supported = true ;
@@ -161,7 +162,7 @@ bool wxDropTarget::GetData()
if (size == 0) if (size == 0)
{ {
m_dataObject->SetData(format , 0 , 0 ) ; m_dataObject->SetData( format , 0 , 0 );
} }
else else
{ {
@@ -187,19 +188,19 @@ bool wxDropTarget::GetData()
UInt16 flavors ; UInt16 flavors ;
bool firstFileAdded = false ; bool firstFileAdded = false ;
CountDragItems((DragReference)m_currentDrag, &items); CountDragItems( (DragReference)m_currentDrag, &items );
for (UInt16 index = 1; index <= items; ++index) for (UInt16 index = 1; index <= items; ++index)
{ {
flavors = 0 ; flavors = 0 ;
GetDragItemReferenceNumber((DragReference)m_currentDrag, index, &theItem); GetDragItemReferenceNumber( (DragReference)m_currentDrag, index, &theItem );
CountDragItemFlavors( (DragReference)m_currentDrag, theItem , &flavors ) ; CountDragItemFlavors( (DragReference)m_currentDrag, theItem , &flavors );
bool hasPreferredFormat = false ; bool hasPreferredFormat = false ;
wxDataFormat preferredFormat = m_dataObject->GetPreferredFormat( wxDataObject::Set ) ; wxDataFormat preferredFormat = m_dataObject->GetPreferredFormat( wxDataObject::Set ) ;
for ( UInt16 flavor = 1 ; flavor <= flavors ; ++flavor ) for ( UInt16 flavor = 1 ; flavor <= flavors ; ++flavor )
{ {
result = GetFlavorType((DragReference)m_currentDrag, theItem, flavor , &theType); result = GetFlavorType( (DragReference)m_currentDrag, theItem, flavor, &theType );
wxDataFormat format(theType) ; wxDataFormat format( theType );
if ( preferredFormat == format ) if ( preferredFormat == format )
{ {
hasPreferredFormat = true ; hasPreferredFormat = true ;
@@ -211,15 +212,16 @@ bool wxDropTarget::GetData()
{ {
result = GetFlavorType((DragReference)m_currentDrag, theItem, flavor , &theType); result = GetFlavorType((DragReference)m_currentDrag, theItem, flavor , &theType);
wxDataFormat format(theType) ; wxDataFormat format(theType) ;
if ( (hasPreferredFormat && format == preferredFormat) || (!hasPreferredFormat && m_dataObject->IsSupportedFormat( format ))) if ( (hasPreferredFormat && format == preferredFormat)
|| (!hasPreferredFormat && m_dataObject->IsSupportedFormat( format )))
{ {
result = GetFlavorFlags((DragReference)m_currentDrag, theItem, theType, &theFlags); result = GetFlavorFlags( (DragReference)m_currentDrag, theItem, theType, &theFlags );
if (result == noErr) if (result == noErr)
{ {
Size dataSize ; Size dataSize ;
Ptr theData ; Ptr theData ;
GetFlavorDataSize((DragReference)m_currentDrag, theItem, theType, &dataSize); GetFlavorDataSize( (DragReference)m_currentDrag, theItem, theType, &dataSize );
if ( theType == kScrapFlavorTypeText ) if ( theType == kScrapFlavorTypeText )
{ {
// this increment is only valid for allocating, on the next GetFlavorData // this increment is only valid for allocating, on the next GetFlavorData
@@ -235,7 +237,8 @@ bool wxDropTarget::GetData()
} }
theData = new char[dataSize]; theData = new char[dataSize];
GetFlavorData((DragReference)m_currentDrag, theItem, theType, (void*) theData, &dataSize, 0L);
GetFlavorData( (DragReference)m_currentDrag, theItem, theType, (void*) theData, &dataSize, 0L );
if ( theType == kScrapFlavorTypeText ) if ( theType == kScrapFlavorTypeText )
{ {
theData[dataSize] = 0 ; theData[dataSize] = 0 ;
@@ -244,7 +247,7 @@ bool wxDropTarget::GetData()
#if wxUSE_UNICODE #if wxUSE_UNICODE
else if ( theType == kScrapFlavorTypeUnicode ) else if ( theType == kScrapFlavorTypeUnicode )
{ {
theData[dataSize] = 0 ; theData[dataSize + 0] =
theData[dataSize + 1] = 0 ; theData[dataSize + 1] = 0 ;
m_dataObject->SetData( wxDataFormat(wxDF_UNICODETEXT), dataSize , theData ); m_dataObject->SetData( wxDataFormat(wxDF_UNICODETEXT), dataSize , theData );
} }
@@ -545,10 +548,10 @@ pascal OSErr wxMacWindowDragTrackingHandler(
if ( trackingGlobals->m_currentTarget ) if ( trackingGlobals->m_currentTarget )
{ {
HideDragHilite( theDrag ); HideDragHilite( theDrag );
trackingGlobals->m_currentTarget->SetCurrentDrag( theDrag ) ; trackingGlobals->m_currentTarget->SetCurrentDrag( theDrag );
trackingGlobals->m_currentTarget->OnLeave() ; trackingGlobals->m_currentTarget->OnLeave();
trackingGlobals->m_currentTarget = NULL; trackingGlobals->m_currentTarget = NULL;
trackingGlobals->m_currentTargetWindow = NULL ; trackingGlobals->m_currentTargetWindow = NULL;
} }
} }
@@ -573,7 +576,7 @@ pascal OSErr wxMacWindowDragTrackingHandler(
RgnHandle hiliteRgn = NewRgn() ; RgnHandle hiliteRgn = NewRgn() ;
Rect r = { y , x , y + win->GetSize().y , x + win->GetSize().x } ; Rect r = { y , x , y + win->GetSize().y , x + win->GetSize().x } ;
RectRgn( hiliteRgn , &r ) ; RectRgn( hiliteRgn , &r ) ;
ShowDragHilite(theDrag, hiliteRgn, true); ShowDragHilite( theDrag, hiliteRgn, true );
DisposeRgn( hiliteRgn ) ; DisposeRgn( hiliteRgn ) ;
} }
} }
@@ -631,12 +634,12 @@ pascal OSErr wxMacWindowDragTrackingHandler(
case kDragTrackingLeaveWindow: case kDragTrackingLeaveWindow:
if (trackingGlobals->m_currentTarget) if (trackingGlobals->m_currentTarget)
{ {
trackingGlobals->m_currentTarget->SetCurrentDrag( theDrag ) ; trackingGlobals->m_currentTarget->SetCurrentDrag( theDrag );
trackingGlobals->m_currentTarget->OnLeave() ; trackingGlobals->m_currentTarget->OnLeave();
HideDragHilite(theDrag); HideDragHilite( theDrag );
trackingGlobals->m_currentTarget = NULL ; trackingGlobals->m_currentTarget = NULL;
} }
trackingGlobals->m_currentTargetWindow = NULL ; trackingGlobals->m_currentTargetWindow = NULL;
break; break;
default: default: