static void ShowUsedCCLanes(int flag, void *data) { RprMidiCCLanePtr laneView = RprMidiCCLane::createFromMidiEditor(); set<int> usedCC = GetUsedCCLanes(MIDIEditor_GetActive(), 0, false); // faster than RprMidiTake::createFromMidiEditor(true); /* remove ununsed lanes */ for (int i = 0; i < laneView->countShown(); ++i) if (usedCC.find(laneView->getIdAt(i)) == usedCC.end()) laneView->remove(i--); /* Special case: Bank select (CC0) and lane 131 (Program change) */ if (usedCC.find(0) != usedCC.end() && usedCC.find(CC_BANK_SELECT) != usedCC.end() && !laneView->isShown(131)) laneView->append(131, defaultHeight); /* add new lanes at bottom for used ccs if not already shown */ for (set<int>::iterator it = usedCC.begin(); it != usedCC.end(); ++it) { if (!laneView->isShown(*it)) laneView->append(*it, defaultHeight); else { for (int i = 0; i < laneView->countShown(); ++i) { if (laneView->getIdAt(i) == *it && laneView->getHeight(i) == 0) laneView->setHeightAt(i, defaultHeight); } } } /* BR: If all lanes are removed it won't really work - we need to leave one lane with height 0 */ if (laneView->countShown() == 0) laneView->append(-1, 0); }
static void HideUnusedCCLanes(int flag, void *data) { RprMidiCCLanePtr laneView = RprMidiCCLane::createFromMidiEditor(); set<int> usedCC = GetUsedCCLanes(MIDIEditor_GetActive(), 1, false); for(int i = 0; i < laneView->countShown(); ++i) { if (usedCC.find(laneView->getIdAt(i)) == usedCC.end()) laneView->remove(i--); } /* BR: If all lanes are removed it won't really work - we need to leave one lane with height 0 */ if (laneView->countShown() == 0) laneView->append(-1, 0); }
void ME_ShowUsedCCLanesDetect14Bit (COMMAND_T* ct, int val, int valhw, int relmode, HWND hwnd) { if (MediaItem_Take* take = MIDIEditor_GetTake(MIDIEditor_GetActive())) { RprTake rprTake(take); if (RprMidiCCLane* laneView = new (nothrow) RprMidiCCLane(rprTake)) { int defaultHeight = 67; // same height FNG versions use (to keep behavior identical) set<int> usedCC = GetUsedCCLanes(MIDIEditor_GetTake(MIDIEditor_GetActive()), 2); for (int i = 0; i < laneView->countShown(); ++i) if (usedCC.find(laneView->getIdAt(i)) == usedCC.end()) laneView->remove(i--); // Special case: Bank select and CC0 (from FNG version to keep behavior identical) if (usedCC.find(0) != usedCC.end() && usedCC.find(CC_BANK_SELECT) != usedCC.end() && !laneView->isShown(131)) laneView->append(131, defaultHeight); for (set<int>::iterator it = usedCC.begin(); it != usedCC.end(); ++it) { if (!laneView->isShown(*it)) laneView->append(*it, defaultHeight); else { for (int i = 0; i < laneView->countShown(); ++i) { if (laneView->getIdAt(i) == *it && laneView->getHeight(i) == 0) laneView->setHeightAt(i, defaultHeight); } } } if (laneView->countShown() == 0) laneView->append(-1, 0); delete laneView; Undo_OnStateChangeEx2(NULL, SWS_CMD_SHORTNAME(ct), UNDO_STATE_ITEMS, -1); } } }