MCPcopy Create free account
hub / github.com/audacity/audacity / GetData

Method GetData

src/DropTarget.cpp:65–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63#if defined(__WXMAC__)
64#if !wxCHECK_VERSION(3, 0, 0)
65 bool GetData() override
66 {
67 bool foundSupported = false;
68 bool firstFileAdded = false;
69 OSErr result;
70
71 UInt16 items = 0;
72 CountDragItems((DragReference)m_currentDrag, &items);
73
74 for (UInt16 index = 1; index <= items; index++) {
75
76 DragItemRef theItem = 0;
77 GetDragItemReferenceNumber((DragReference)m_currentDrag, index, &theItem);
78
79 UInt16 flavors = 0;
80 CountDragItemFlavors((DragReference)m_currentDrag, theItem , &flavors ) ;
81
82 for (UInt16 flavor = 1 ;flavor <= flavors; flavor++) {
83
84 FlavorType theType = 0;
85 result = GetFlavorType((DragReference)m_currentDrag, theItem, flavor, &theType);
86 if (theType != kDragPromisedFlavorFindFile && theType != kDragFlavorTypeHFS) {
87 continue;
88 }
89 foundSupported = true;
90
91 Size dataSize = 0;
92 GetFlavorDataSize((DragReference)m_currentDrag, theItem, theType, &dataSize);
93
94 ArrayOf<char> theData{ dataSize };
95 GetFlavorData((DragReference)m_currentDrag, theItem, theType, (void*) theData.get(), &dataSize, 0L);
96
97 wxString name;
98 if (theType == kDragPromisedFlavorFindFile) {
99 name = wxMacFSSpec2MacFilename((FSSpec *)theData.get());
100 }
101 else if (theType == kDragFlavorTypeHFS) {
102 name = wxMacFSSpec2MacFilename(&((HFSFlavor *)theData.get())->fileSpec);
103 }
104
105 if (!firstFileAdded) {
106 // reset file list
107 ((wxFileDataObject*)GetDataObject())->SetData(0, "");
108 firstFileAdded = true;
109 }
110
111 ((wxFileDataObject*)GetDataObject())->AddFile(name);
112
113 // We only want to process one flavor
114 break;
115 }
116 }
117 return foundSupported;
118 }
119#endif
120
121 bool OnDrop(wxCoord x, wxCoord y) override

Callers 15

EncodeAudioMethod · 0.45
DecodeAudioPacketMethod · 0.45
ConsumeFrameMethod · 0.45
GetParentMethod · 0.45
DependencyDialogClass · 0.45
ExploreMenuMethod · 0.45
PasteSelectedTextMethod · 0.45
DrawClipSpectrumFunction · 0.45
AllocateMethod · 0.45
PasteSelectedTextMethod · 0.45
OnPasteMethod · 0.45

Calls 3

getMethod · 0.45
SetDataMethod · 0.45
AddFileMethod · 0.45

Tested by 1

DrawClipSpectrumFunction · 0.36