void gdPluginList::refreshList() { /* delete the previous list */ list->clear(); list->scroll_to(0, 0); /* add new buttons, as many as the plugin in pluginHost::stack + 1, * the 'add new' button. Warning: if ch == NULL we are working with * master in/master out stacks. */ int numPlugins = G_PluginHost.countPlugins(stackType, ch); int i = 0; while (i<numPlugins) { Plugin *pPlugin = G_PluginHost.getPluginByIndex(i, stackType, ch); gdPlugin *gdp = new gdPlugin(this, pPlugin, list->x(), list->y()-list->yposition()+(i*24), 800); list->add(gdp); i++; } int addPlugY = numPlugins == 0 ? 90 : list->y()-list->yposition()+(i*24); addPlugin = new gClick(8, addPlugY, 452, 20, "-- add new plugin --"); addPlugin->callback(cb_addPlugin, (void*)this); list->add(addPlugin); /* if num(plugins) > 7 make room for the side scrollbar. * Scrollbar.width = 20 + 4(margin) */ if (i>7) size(492, h()); else size(468, h()); redraw(); /* set 'full' flag to FX button */ /* TODO - awful stuff... we should subclass into gdPluginListChannel and gdPluginListMaster */ if (stackType == PluginHost::MASTER_OUT) { mainWin->inOut->setMasterFxOutFull(G_PluginHost.countPlugins(stackType, ch) > 0); } else if (stackType == PluginHost::MASTER_IN) { mainWin->inOut->setMasterFxInFull(G_PluginHost.countPlugins(stackType, ch) > 0); } else { ch->guiChannel->fx->full = G_PluginHost.countPlugins(stackType, ch) > 0; ch->guiChannel->fx->redraw(); } }
void gdPlugin::__cb_shiftUp() { /*nothing to do if there's only one plugin */ if (G_PluginHost.countPlugins(pParent->stackType, pParent->ch) == 1) return; int pluginIndex = G_PluginHost.getPluginIndex(pPlugin->getId(), pParent->stackType, pParent->ch); if (pluginIndex == 0) // first of the stack, do nothing return; G_PluginHost.swapPlugin(pluginIndex, pluginIndex-1, pParent->stackType, pParent->ch); pParent->refreshList(); }
void gdPlugin::__cb_shiftDown() { /*nothing to do if there's only one plugin */ if (G_PluginHost.countPlugins(pParent->stackType, pParent->ch) == 1) return; unsigned pluginIndex = G_PluginHost.getPluginIndex(pPlugin->getId(), pParent->stackType, pParent->ch); unsigned stackSize = (G_PluginHost.getStack(pParent->stackType, pParent->ch))->size(); if (pluginIndex == stackSize-1) // last one in the stack, do nothing return; G_PluginHost.swapPlugin(pluginIndex, pluginIndex+1, pParent->stackType, pParent->ch); pParent->refreshList(); }
void gdPluginList::refreshList() { /* delete the previous list */ list->clear(); list->scroll_to(0, 0); /* add new buttons, as many as the plugin in pluginHost::stack + 1, * the 'add new' button. Warning: if ch == NULL we are working with * master in/master out stacks. */ int numPlugins = G_PluginHost.countPlugins(stackType, ch); int i = 0; while (i<numPlugins) { Plugin *pPlugin = G_PluginHost.getPluginByIndex(i, stackType, ch); gdPlugin *gdp = new gdPlugin(this, pPlugin, list->x(), list->y()-list->yposition()+(i*24), 800); list->add(gdp); i++; } int addPlugY = numPlugins == 0 ? 90 : list->y()-list->yposition()+(i*24); addPlugin = new gClick(8, addPlugY, 452, 20, "-- add new plugin --"); addPlugin->callback(cb_addPlugin, (void*)this); list->add(addPlugin); /* if num(plugins) > 7 make room for the side scrollbar. * Scrollbar.width = 20 + 4(margin) */ if (i>7) size(492, h()); else size(468, h()); redraw(); }