ControlParameter * ControlRulerWidget::getControlParameter(void) { ControllerEventsRuler *ruler = getActiveRuler(); if (!ruler) { return 0; } return ruler->getControlParameter(); }
// @return the active ruler's parameter situation, or NULL if none. // Return is owned by caller. // @author Tom Breton (Tehom) SelectionSituation * ControlRulerWidget::getSituation(void) { ControllerEventsRuler *ruler = getActiveRuler(); if (!ruler) { return 0; } EventSelection * selection = ruler->getEventSelection(); if (!selection) { return 0; } ControlParameter * cp = ruler->getControlParameter(); if (!cp) { return 0; } return new SelectionSituation(cp->getType(), selection); }
void ControlRulerWidget::slotToggleControlRuler(std::string controlName) { if (!m_controlList) return; ControlList::const_iterator it; // Check that the device supports a control parameter of this name for (it = m_controlList->begin(); it != m_controlList->end(); ++it) { if ((*it).getName() == controlName) { break; } } // If we found this control name in the list for this device if (it != m_controlList->end()) { // Check whether we already have a control ruler for a control parameter of this name ControllerEventsRuler *eventruler; std::list<ControlRuler*>::iterator jt; for (jt = m_controlRulerList.begin(); jt != m_controlRulerList.end(); ++jt) { eventruler = dynamic_cast <ControllerEventsRuler*> (*jt); if (eventruler) { if (eventruler->getControlParameter()->getName() == controlName) { // We already have a ruler for this control // Delete it removeRuler(jt); break; } } } // If we don't have a control ruler, make one now if (jt == m_controlRulerList.end()) { slotAddControlRuler(*it); } } }