MCPcopy Create free account
hub / github.com/HertzDevil/0CC-FamiTracker / DropData

Method DropData

Source/FrameEditor.cpp:1177–1219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1175}
1176
1177BOOL CFrameEditor::DropData(COleDataObject* pDataObject, DROPEFFECT dropEffect)
1178{
1179 // Drag'n'drop operation completed
1180
1181 const int Frames = GetSongFrameCount(); // // //
1182
1183 ASSERT(m_iDragRow >= 0 && m_iDragRow <= Frames);
1184
1185 // Get frame data
1186 CFrameClipData ClipData; // // //
1187 if (!CClipboard::ReadGlobalMemory(ClipData, pDataObject->GetGlobalData(m_iClipboard))) // // //
1188 return FALSE;
1189
1190 const int SelectStart = ClipData.ClipInfo.OleInfo.SourceRowStart;
1191 const int SelectEnd = ClipData.ClipInfo.OleInfo.SourceRowEnd;
1192
1193 // Add action
1194 switch (dropEffect) {
1195 case DROPEFFECT_MOVE:
1196 // Move
1197 if (m_bStartDrag) { // // // same window
1198 // Disallow dragging to the same area
1199 if (m_iDragRow >= SelectStart && m_iDragRow <= (SelectEnd + 1)) // // //
1200 return FALSE;
1201 int target = m_iDragRow - (m_iDragRow > SelectStart ? ClipData.ClipInfo.Frames : 0);
1202 m_pMainFrame->AddAction(std::make_unique<CFActionDropMove>(std::move(ClipData), target));
1203 break;
1204 }
1205 [[fallthrough]];
1206 case DROPEFFECT_COPY:
1207 // Copy
1208 if (!m_pMainFrame->AddAction(std::make_unique<CFActionPaste>(
1209 std::move(ClipData), m_iDragRow, m_DropTarget.CopyToNewPatterns()))) // // //
1210 return FALSE;
1211 break;
1212 }
1213
1214 m_bDropped = true;
1215
1216 InvalidateFrameData();
1217
1218 return TRUE;
1219}
1220
1221void CFrameEditor::MoveSelection(const CFrameSelection &Sel, const CFrameCursorPos &Target) // // //
1222{

Callers 1

OnDropMethod · 0.80

Calls 2

CopyToNewPatternsMethod · 0.80
AddActionMethod · 0.45

Tested by

no test coverage detected