void __fastcall TClipMaker::BPDragDrop(TObject *Sender, TObject *Source, int X, int Y) { TMxPanel* P = dynamic_cast<TMxPanel*>(Source); VERIFY(P); CUIClip* tgt = FindClip(X); VERIFY(tgt); CUIClip* src = sel_clip; if (P->Tag==-2){ if (drag_state.Contains(ssAlt)){ std::swap (tgt->fx,src->fx); }else if (drag_state.Contains(ssCtrl)){ tgt->fx = src->fx; }else{ tgt->fx = src->fx; src->fx.clear (); } }else{ if (drag_state.Contains(ssAlt)){ std::swap (tgt->cycles[P->Tag],src->cycles[P->Tag]); }else if (drag_state.Contains(ssCtrl)){ tgt->cycles[P->Tag] = src->cycles[P->Tag]; }else{ tgt->cycles[P->Tag] = src->cycles[P->Tag]; src->cycles[P->Tag].clear(); } } RepaintClips(); }
void __fastcall TClipMaker::ClipMouseMove(TObject *Sender, TShiftState Shift, int X, int Y) { VERIFY (sel_clip); TMxPanel* P = dynamic_cast<TMxPanel*>(Sender); CUIClip* C = FindClip(X); VERIFY(C); int cX = X-C->PLeft(); float w0 = float(cX)/C->PWidth(); int w1 = C->PWidth()-cX; if ((w0>0.75f)&&(w0<1.f)&&(w1<7)){ P->Cursor = crHSplit; }else{ if (!g_resizing) P->Cursor = crDefault; } if (g_resizing){ float dx = float(X-(g_X_prev+g_X_dx))/m_Zoom; if (!fis_zero(dx)){ sel_clip->length += dx; if (sel_clip->length<0.01f) sel_clip->length=0.01f; g_X_prev = sel_clip->PRight(); UI->ShowHint (AnsiString().sprintf("Length: %s",FloatTimeToStrTime(sel_clip->Length(),false,true,true,true).c_str())); } UpdateClips (); } }
void __fastcall TClipMaker::BPDragOver(TObject *Sender, TObject *Source, int X, int Y, TDragState State, bool &Accept) { Accept = false; if (Sender==Source){ CUIClip* clip = FindClip(X); Accept = (clip&&(clip!=sel_clip)); } }
bool CDmeTrack::RemoveClip( CDmeClip *clip ) { Assert( clip->GetClipType() == GetClipType() ); int i = FindClip( clip ); if ( i != -1 ) { RemoveClip( i ); return true; } return false; }
void CDmeTrack::AddClip( CDmeClip *clip ) { if ( clip->GetClipType() == GetClipType() ) { // FIXME: In the case of a non-overlapped track, // we could optimize this to insert the clip in sorted order, // then fix overlaps (fixing overlaps requires a sorted list) Assert( FindClip( clip ) < 0 ); m_Clips.AddToTail( clip ); } }
void __fastcall TClipMaker::ClipMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { if (Button==mbLeft){ SelectClip (FindClip(X)); if (paClips->Cursor==crHSplit){ g_resizing = TRUE; Stop (); g_X_prev = X; g_X_dx = X-sel_clip->PRight(); RepaintClips(); }else{ paClips->BeginDrag(false, 2); } } }
void __fastcall TClipMaker::BPMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { TMxPanel* P = dynamic_cast<TMxPanel*>(Sender); if (P){ if (Button==mbRight){ // TPoint pt; pt.x = X; pt.y = Y; // pt=P->ClientToScreen(pt); // pmClip->Popup(pt.x,pt.y-10); }else if (Button==mbLeft){ SelectClip (FindClip(X)); P->BeginDrag(false, 2); drag_state = Shift; } } }
void __fastcall TClipMaker::ClipDragDrop(TObject *Sender, TObject *Source, int X, int Y) { VERIFY (Sender==paClips); CUIClip* tgt = FindClip(X); VERIFY(tgt); TElTreeDragObject* obj = dynamic_cast<TElTreeDragObject*>(Source); if (obj){ TElTree* tv = dynamic_cast<TElTree*>(obj->Control); if (tv->SelectedCount){ for (TElTreeItem* item = tv->GetNextSelected(0); item; item = tv->GetNextSelected(item)){ ListItem* prop = (ListItem*)item->Tag; VERIFY(prop); u16 bp; BOOL fx; LPCSTR m_name = ATools->ExtractMotionName(prop->Key()); u16 m_slot = ATools->ExtractMotionSlot(prop->Key()); if (m_CurrentObject->m_SMotionRefs.size()){ CMotionDef* SM = ATools->m_RenderObject.FindMotionDef(m_name,m_slot); VERIFY(SM); bp = SM->bone_or_part; fx = SM->flags&esmFX; }else{ CSMotion* SM = ATools->FindMotion(m_name); VERIFY(SM); bp = SM->m_BoneOrPart; fx = SM->m_Flags.is(esmFX); } if (fx){ tgt->SetFX (m_name,m_slot); }else{ tgt->SetCycle (m_name,bp,m_slot); } } } }else{ float rt = float(X)/m_Zoom-tgt->RunTime(); if (rt<tgt->Length()/2.f) sel_clip->run_time = tgt->run_time-EPS_L; else sel_clip->run_time = tgt->run_time+EPS_L; } UpdateClips (); }
TClipMaker::CUIClip* TClipMaker::FindClip(int x) { return FindClip(float(x)/m_Zoom); }