// Plugin accessors. void qtractorPluginForm::setPlugin ( qtractorPlugin *pPlugin ) { clear(); // Set the new reference... m_pPlugin = pPlugin; if (m_pPlugin == NULL) return; // Dispatch any pending updates. qtractorSubject::flushQueue(true); // Set activate button MIDI controller observer... addMidiControlAction( m_ui.ActivateToolButton, m_pPlugin->activateObserver()); qtractorPluginType *pType = m_pPlugin->type(); const bool bVstPlugin = (pType->typeHint() == qtractorPluginType::Vst); const int MaxRowsPerPage = (bVstPlugin ? 12 : 8); const int MaxColumnsPerPage = (bVstPlugin ? 2 : 3); const int MaxItemsPerPage = MaxRowsPerPage * MaxColumnsPerPage; const qtractorPlugin::Params& params = m_pPlugin->params(); const int iParams = params.count(); int iItems = iParams; #ifdef CONFIG_LV2_PATCH qtractorLv2Plugin *pLv2Plugin = NULL; if (pType->typeHint() == qtractorPluginType::Lv2) pLv2Plugin = static_cast<qtractorLv2Plugin *> (m_pPlugin); if (pLv2Plugin) iItems += pLv2Plugin->lv2_properties().count(); #endif int iItemsPerPage = iItems; int iItemsOnLastPage = 0; if (iItemsPerPage > MaxItemsPerPage) { iItemsPerPage = MaxItemsPerPage; iItemsOnLastPage = (iItems % iItemsPerPage); while (iItemsOnLastPage > 0 && iItemsOnLastPage < ((3 * iItemsPerPage) >> 2)) iItemsOnLastPage = (iItems % --iItemsPerPage); }
// Plugin accessors. void qtractorPluginForm::setPlugin ( qtractorPlugin *pPlugin ) { clear(); // Set the new reference... m_pPlugin = pPlugin; if (m_pPlugin == NULL) return; // Dispatch any pending updates. qtractorSubject::flushQueue(true); // Set activate button MIDI controller observer... addMidiControlAction( m_ui.ActivateToolButton, m_pPlugin->activateObserver()); qtractorPluginType *pType = m_pPlugin->type(); const bool bVstPlugin = (pType->typeHint() == qtractorPluginType::Vst); const int MaxRowsPerPage = (bVstPlugin ? 12 : 8); const int MaxColumnsPerPage = (bVstPlugin ? 2 : 3); const int MaxParamsPerPage = MaxRowsPerPage * MaxColumnsPerPage; const qtractorPlugin::Params& params = m_pPlugin->params(); const int iParams = params.count(); int iParamsPerPage = iParams; int iParamsOnLastPage = 0; if (iParamsPerPage > MaxParamsPerPage) { iParamsPerPage = MaxParamsPerPage; iParamsOnLastPage = (iParams % iParamsPerPage); while (iParamsOnLastPage > 0 && iParamsOnLastPage < ((3 * iParamsPerPage) >> 2)) iParamsOnLastPage = (iParams % --iParamsPerPage); }