void ComponentOverlay::updateBoundsDataForTarget() { for ( ComponentOverlay* child : layoutEditor->getLassoSelection() ) { ValueTree valueTree = CabbageWidgetData::getValueTreeForComponent (layoutEditor->widgetData, child->target.getComponent()->getName()); CabbageWidgetData::setNumProp (valueTree, CabbageIdentifierIds::left, child->target.getComponent()->getX()); CabbageWidgetData::setNumProp (valueTree, CabbageIdentifierIds::top, child->target.getComponent()->getY()); CabbageWidgetData::setNumProp (valueTree, CabbageIdentifierIds::width, child->target.getComponent()->getWidth()); CabbageWidgetData::setNumProp (valueTree, CabbageIdentifierIds::height, child->target.getComponent()->getHeight()); } Component* c = (Component*) target.getComponent (); for (int i = 0; i < c->getNumChildComponents(); i++) { const Component* child = target.getComponent()->getChildComponent (i); ValueTree valueTree = CabbageWidgetData::getValueTreeForComponent (layoutEditor->widgetData, child->getName()); if (CabbageWidgetData::getStringProp (valueTree, CabbageIdentifierIds::parentcomponent).isNotEmpty()) //now deal with plants, all child widgets must have theirs bounds updated.. { CabbageWidgetData::setNumProp (valueTree, CabbageIdentifierIds::left, child->getX()); CabbageWidgetData::setNumProp (valueTree, CabbageIdentifierIds::top, child->getY()); CabbageWidgetData::setNumProp (valueTree, CabbageIdentifierIds::width, child->getWidth()); CabbageWidgetData::setNumProp (valueTree, CabbageIdentifierIds::height, child->getHeight()); } } getPluginEditor()->sendChangeMessage(); }
//================================================================================================================== void ComponentLayoutEditor::updateCodeEditor() { StringArray compNames; if (getLassoSelection().getNumSelected() > 0) for ( ComponentOverlay* child : getLassoSelection() ) { compNames.add (child->getName()); for ( int i = 0 ; i < child->getTarget()->getNumChildComponents() ; i++) { if (child->getTarget()->getChildComponent (i)->getName().isNotEmpty()){ compNames.add (child->getTarget()->getChildComponent (i)->getName()); CabbageUtilities::debug(child->getTarget()->getChildComponent (i)->getName()); } } } else compNames.add (getName()); getPluginEditor()->setCurrentlySelectedComponents (compNames); getPluginEditor()->sendChangeMessage(); }
void PythonScriptViewWidget::scrollToEditorLine(const QUrl & link) { QStringList strList = link.toString().split(":"); QString file = strList.at(0); int line = strList.at(1).toInt()-1; if (file == "<unnamed script>") { tabWidget->setCurrentIndex(0); scrollToLine(getCurrentMainScriptEditor(), line); return; } for (int i = 0 ; i < mainScriptsTabWidget->count() ; ++i) { PythonCodeEditor *codeEditor = getMainScriptEditor(i); if (file == codeEditor->getFileName()) { tabWidget->setCurrentIndex(0); mainScriptsTabWidget->setCurrentIndex(i); scrollToLine(codeEditor, line); return; } } for (int i = 0 ; i < modulesTabWidget->count() ; ++i) { PythonCodeEditor *codeEditor = getModuleEditor(i); if (file == codeEditor->getFileName()) { tabWidget->setCurrentIndex(1); modulesTabWidget->setCurrentIndex(i); scrollToLine(codeEditor, line); return; } } for (int i = 0 ; i < pluginsTabWidget->count() ; ++i) { PythonCodeEditor *codeEditor = getPluginEditor(i); if (file == codeEditor->getFileName()) { tabWidget->setCurrentIndex(3); pluginsTabWidget->setCurrentIndex(i); scrollToLine(codeEditor, line); return; } } }
void ComponentLayoutEditor::mouseDown (const MouseEvent& e) { selectedComponents.deselectAll(); Array<File> customPlants; resetAllInterest(); if (e.mods.isPopupMenu()) { PopupMenu menu; menu.setLookAndFeel (&lookAndFeel); CabbagePopupWidgets widgets; PopupMenu subM; subM.addItem (1, "Button"); subM.addItem (2, "Button - File"); subM.addItem (3, "Button - Info"); menu.addSubMenu ("Buttons", subM); subM.clear(); menu.addItem (4, "Checkbox"); menu.addItem (5, "ComboBox"); menu.addItem (6, "Csound Output"); menu.addItem (7, "Endless Encoder"); menu.addItem (8, "Gentable"); menu.addItem (9, "Groupbox"); menu.addItem (11, "Image"); menu.addItem (12, "Keyboard"); menu.addItem (13, "Label"); menu.addItem (27, "Listbox"); subM.addItem (10, "Horizontal Meter"); subM.addItem (25, "Vertical Meter"); menu.addSubMenu( "Meters", subM); subM.clear(); menu.addItem (14, "Signal Display"); subM.addItem (15, "Slider - Horizontal"); subM.addItem (16, "Slider - Rotary"); subM.addItem (17, "Slider - Vertical"); subM.addItem (18, "Slider - Range - Vertical"); subM.addItem (19, "Slider - Range - Horizontal"); subM.addItem (20, "Slider - Number Box"); menu.addSubMenu("Sliders", subM); subM.clear(); menu.addItem (21, "Soundfiler"); menu.addItem (22, "Event Sequencer"); menu.addItem (23, "Text Box"); menu.addItem (24, "Text Editor"); menu.addItem (26, "XY Pad"); CabbageSettings settings; settings.setStorageParameters(CabbageUtilities::getStorageProps()); settings.setDefaultSettings(); const String plantDir = settings.getUserSettings()->getValue("CabbagePlantDir"); CabbageUtilities::debug(plantDir); PopupMenu subMenu; CabbageUtilities::addCustomPlantsToMenu(subMenu, customPlants, plantDir); menu.addSubMenu("Custom Plants", subMenu); const int result = menu.show(); if (result > 0 && result < 100) getPluginEditor()->addNewWidget (widgets.getAllValues()[result - 1], e.getPosition()); else getPluginEditor()->addNewWidget (customPlants[result-100].getFullPathName(), e.getPosition(), true); currentMouseCoors = e.getPosition(); } else { addChildComponent (&lassoComp); lassoComp.beginLasso (e, this); } }