void EventSheetEditor::DeselectActions() { SelectedActionVector SelectedActions; CreateActionSelectionVector(SelectedActions,(*m_pEventList)); for(int a = 0; a < SelectedActions.size(); a++) { SelectedActions[a]->m_select(this) = false; InvalidateRect(SelectedActions[a]->m_rect(this)); } }
void EventSheetEditor::CreateActionSelectionVector(SelectedActionVector& pSelectedActionList, EventVector& EventList) { for(int a = 0 ; a < EventList.size() ; a ++) { for(int c = 0; c < EventList[a]->m_Actions.size(); c ++ ) if( EventList[a]->m_Actions[c]->m_select(this)) pSelectedActionList.push_back(EventList[a]->m_Actions[c]); CreateActionSelectionVector(pSelectedActionList,EventList[a]->m_EventList); } }
void EventSheetEditor::OnMouseMove(UINT nFlags, CPoint point) { if(!m_pHeader) return; m_ObjectHeaderTooltip.ShowAt(point, *this); m_Mouse = point; m_pHeader->OnMouseMove(point); if(m_pHeader->m_isDrag) Invalidate(); else { // Is is possible we might be dragging. if(!m_Drag.IsDragging && m_leftDown) { if( ( (point.x - m_Drag.StoredPos.x)*(point.x - m_Drag.StoredPos.x) +(point.y - m_Drag.StoredPos.y)*(point.y - m_Drag.StoredPos.y)) > 8) { switch (m_Drag.dragtype) { case EVENT: { SelectedEventVector m_SelectedEvents; CreateEventSelectionVectorLimited(m_SelectedEvents,(*m_pEventList)); CEditorDragEvents* Events = new CEditorDragEvents; Events->pEd = this; Events->m_pSelectedEvents = &m_SelectedEvents; DROPEFFECT de = DROPEFFECT_COPY; m_pDDMgr->PrepareDrop(DO_DRAGDROP,"Construct Events",Events,&de); // wait till the drop is done...then.... m_Drag.dragtype = -1; m_Drag.IsDragging = false; Invalidate(); } break; case CONDITION: { SelectedConditionVector m_SelectedConditions; CreateConditionSelectionVector(m_SelectedConditions,(*m_pEventList)); CEditorDragConditions* Conditions = new CEditorDragConditions; Conditions->pEd = this; Conditions->m_pSelectedConditions = &m_SelectedConditions; DROPEFFECT de = DROPEFFECT_COPY; m_pDDMgr->PrepareDrop(DO_DRAGDROP,"Construct Conditions",Conditions,&de); // wait till the drop is done..then... m_Drag.dragtype = -1; m_Drag.IsDragging = false; Invalidate(); m_SelectedConditions.clear(); } break; case ACTION: { SelectedActionVector m_SelectedActions; CreateActionSelectionVector(m_SelectedActions,(*m_pEventList)); CEditorDragActions* Actions = new CEditorDragActions; Actions->pEd = this; Actions->m_pSelectedActions = &m_SelectedActions; DROPEFFECT de = DROPEFFECT_COPY; m_pDDMgr->PrepareDrop(DO_DRAGDROP,"Construct Actions",Actions,&de); // wait till the drop is done..then... m_Drag.dragtype = -1; m_Drag.IsDragging = false; Invalidate(); m_SelectedActions.clear(); } break; case OBJECT: { CEditorDragObject* Objects = new CEditorDragObject; Objects->pEd = (EventSheetEditor*)this; Objects->ObjectIdentifier = m_pHeader->GetObjectAtX(m_Drag.StoredPos.x)->oid; DROPEFFECT de = DROPEFFECT_COPY; m_pDDMgr->PrepareDrop(DO_DRAGDROP,"Construct Object",Objects,&de); // wait till the drop is done..then... m_Drag.dragtype = -1; m_Drag.IsDragging = false; Invalidate(); } break; default: break; } } } else { //Tooltips CEditorEvent* pMyEvent = EventAt(point); if(pMyEvent) { SelectedActionVector actions; CEditorAction* pAction = pMyEvent->actionAt(point, actions, this); CEditorCondition* pCondition = pMyEvent->conditionAt(point, this); if(pMyEvent->m_displayActionType(this) < 2) //only grid and chrono should show the tooltip { if(pAction) { CPoint pt = (actions[0])->m_rect(this).TopLeft(); pt.x += 16; pt.y = (actions[0])->m_rect(this).bottom-4; if(!m_InsertBefore.IsWindowVisible()) m_ActionTooltip.ShowAt(pt,actions,*this); } else { m_ActionTooltip.Hide(); } } else { } } else m_ActionTooltip.Hide(); } } SelectedConditionVector SelectedConditions; CreateConditionSelectionVector(SelectedConditions,(*m_pEventList)); for(int c = 0; c < SelectedConditions.size(); c++) InvalidateRect(SelectedConditions[c]->m_rect(this)); SelectedActionVector SelectedActions; CreateActionSelectionVector(SelectedActions,(*m_pEventList)); for(int a = 0; a < SelectedActions.size(); a++) InvalidateRect(SelectedActions[a]->m_rect(this)); SelectedEventVector SelectedEvents; CreateEventSelectionVector(SelectedEvents,(*m_pEventList)); for(int e = 0; e < SelectedEvents.size(); e++) InvalidateRect(SelectedEvents[e]->m_rect(this)); //////////////////////// // Change to a hand cursor if overlapping "new action" bool useHandCursor = false; static CEditorEvent* pLastEvent = NULL; if (pLastEvent) { pLastEvent->mouseOverNewAction = false; pLastEvent->mouseOverFooter = false; } if (!(point.x >= m_pHeader->m_Split - 2 && point.x <= m_pHeader->m_Split + 5)) { CEditorEvent* pEvent = this->EventAt(point); if(pEvent) { pEvent->mouseOverNewAction = false; pEvent->mouseOverFooter = false; if(pEvent->canAddActions()) { if(pEvent->m_gridRec(this).PtInRect(point)) { useHandCursor = true; pEvent->mouseOverNewAction = true; } } if(pEvent->m_type == 2 && pEvent->m_open(this)) // Group { CRect Footer = pEvent->m_rect(this); Footer.top = Footer.bottom - 17; Footer.left += EVENT_INDENT * 2; if(Footer.PtInRect(point)) { useHandCursor = true; pEvent->mouseOverFooter = true; } } pLastEvent = pEvent; this->Invalidate(); } } //////////////////////// // Change to a hand cursor if overlapping "new event to group" static HCURSOR handCursor = LoadCursor(NULL, IDC_HAND); static HCURSOR arrowCursor = LoadCursor(NULL, IDC_ARROW); if (useHandCursor) SetCursor(handCursor); //else // SetCursor(arrowCursor); //////////////////////// int objid = 0; CPoint pt = point; // copy! CRect myrect; GetWindowRect(&myrect); CRect rect; rect.top = pt.y; rect.left = pt.x; rect.right = pt.x + 20; rect.bottom = pt.y + 20; CScrollView::OnMouseMove(nFlags, point); }