Skip to content
Snippets Groups Projects
Commit a5991de0 authored by Sept_en's avatar Sept_en
Browse files

PluginGenerator: GUI improvements and some cleanup.

parent ead0842f
Branches
Tags
No related merge requests found
......@@ -40,8 +40,6 @@ static String getProcessorTypeString (PluginProcessorType processorType)
return "PROCESSOR_TYPE_MERGER";
case PROCESSOR_TYPE_UTILITY:
return "PROCESSOR_TYPE_UTILITY";
case PROCESSOR_TYPE_DATA_FORMAT:
return "PROCESSOR_TYPE_DATA_FORMAT";
default:
return "InvalidProcessorType";
};
......@@ -98,8 +96,7 @@ static String getLibProcessorTypeString (PluginProcessorType processorType)
case PROCESSOR_TYPE_UTILITY:
case PROCESSOR_TYPE_MERGER:
case PROCESSOR_TYPE_SPLITTER:
// TODO <Kirill A>: Check where data format plugins should be placed.
case PROCESSOR_TYPE_DATA_FORMAT:
case PROCESSOR_TYPE_SOURCE:
return "Plugin::UtilityProcessor";
default:
......
......@@ -254,8 +254,8 @@ private:
a list box of platform targets to generate.
*/
class WizardComp : public Component,
public ComboBox::Listener,
private ButtonListener,
private ComboBoxListener,
private TextEditorListener,
private FileBrowserListener
{
......@@ -335,6 +335,11 @@ public:
g.fillRect (rect.reduced (10, 10));
}
void resized() override
{
updateOpenEphysWizardComboBoxBounds (*this);
}
void buttonClicked (Button* b) override
{
if (b == &createButton)
......@@ -403,9 +408,17 @@ public:
wizard->addSetupItems (*this, customItems);
}
void comboBoxChanged (ComboBox*) override
void comboBoxChanged (ComboBox* comboBoxThatHasChanged) override
{
updateCustomItems();
if (comboBoxThatHasChanged->getComponentID() == OpenEphysPluginAppWizard::COMBOBOX_ID_PLUGIN_TYPE)
{
const auto selectedIndex = comboBoxThatHasChanged->getSelectedItemIndex() + 1;
updateOpenEphysWizardComboBoxBounds (*this);
}
else
{
updateCustomItems();
}
}
void textEditorTextChanged (TextEditor&) override
......
......@@ -23,30 +23,6 @@
#include <iostream>
//#include "../../../Source/Processors/GenericProcessor/GenericProcessor.h"
//#include "../../../Source/Processors/PluginManager/PluginIDs.h"
//using namespace Plugin;
//enum PluginProcessorType
//{
// PROCESSOR_TYPE_FILTER = 1
// , PROCESSOR_TYPE_SOURCE
// , PROCESSOR_TYPE_SINK
// , PROCESSOR_TYPE_SPLITTER
// , PROCESSOR_TYPE_MERGER
// , PROCESSOR_TYPE_UTILITY
// , PROCESSOR_TYPE_DATA_FORMAT
// , PROCESSOR_TYPE_INVALID
//};
//
//enum PluginType
//{
// PLUGIN_TYPE_PROCESSOR = 1
// , PLUGIN_TYPE_RECORD_ENGINE
// , PLUGIN_TYPE_DATA_THREAD
// , PLUGIN_TYPE_FILE_SOURCE
// , NOT_A_PLUGIN_TYPE = -1
//};
// =================================================================================
......@@ -84,6 +60,7 @@ static ComboBox& createProcessorTypeOptionComboBox (Component& setupComp,
l->attachToComponent (processorTypeComboBox, true);
itemsCreated.add (l);
processorTypeComboBox->setVisible (false);
//c->setBounds ("parent.width / 2 + 160, 30, parent.width - 30, top + 22");
return *processorTypeComboBox;
......@@ -99,6 +76,47 @@ static int getComboResult (WizardComp& setupComp, const String& comboBoxID)
return 0;
}
static void updateOpenEphysWizardComboBoxBounds (const Component& parent)
{
auto pluginTypeComboBox = dynamic_cast<ComboBox*> (parent
.findChildWithID (OpenEphysPluginAppWizard::COMBOBOX_ID_PLUGIN_TYPE));
auto processorTypeComboBox = dynamic_cast<ComboBox*> (parent
.findChildWithID (OpenEphysPluginAppWizard::COMBOBOX_ID_PROCESSOR_TYPE));
if (pluginTypeComboBox == nullptr
|| processorTypeComboBox == nullptr)
{
return;
}
const auto parentBounds = parent.getLocalBounds();
//auto rightSideOfComponent = parent.getLocalBounds().removeFromRight (parent.getWidth() / 2).withHeight (22);
auto comboBoxBounds = juce::Rectangle<int> (parent.getWidth() / 2 + 95,
30,
parent.getWidth() / 2 - 127,
parent.getY() + 22);
const int marginBetweenComboBoxes = 140;
const int comboBoxMinWidth = (comboBoxBounds.getWidth() - marginBetweenComboBoxes) / 2;
if (pluginTypeComboBox->getSelectedItemIndex() + 1 == (int)PLUGIN_TYPE_PROCESSOR)
{
pluginTypeComboBox->setBounds (comboBoxBounds.removeFromLeft (comboBoxMinWidth));
comboBoxBounds.removeFromLeft (marginBetweenComboBoxes - 10);
processorTypeComboBox->setBounds (comboBoxBounds);
processorTypeComboBox->setVisible (true);
}
else
{
pluginTypeComboBox->setBounds (comboBoxBounds);
processorTypeComboBox->setVisible (false);
}
}
// ============================================================================
// ============================================================================
// ============================================================================
......@@ -126,15 +144,6 @@ struct OpenEphysPluginAppWizard : public NewProjectWizard
void addSetupItems (Component& setupComp, OwnedArray<Component>& itemsCreated) override
{
//juce::Rectangle<int> comboBoxDefaultBounds ("parent.width / 2 + 160, 30, parent.width - 30, top + 22");
juce::Rectangle<int> comboBoxDefaultBounds (setupComp.getWidth() / 2 + 95,
30,
setupComp.getWidth() / 2 - 30,
setupComp.getY() + 22);
const int marginBetweenComboBoxes = 150;
const int comboBoxMinWidth = (comboBoxDefaultBounds.getWidth() - marginBetweenComboBoxes) / 2;
const String pluginTypeOptions[] =
{
TRANS("Processor"),
......@@ -146,8 +155,10 @@ struct OpenEphysPluginAppWizard : public NewProjectWizard
auto& pluginTypeComboBox = createPluginTypeOptionComboBox (setupComp, itemsCreated,
StringArray (pluginTypeOptions,
numElementsInArray (pluginTypeOptions)));
pluginTypeComboBox.setBounds (comboBoxDefaultBounds);
//pluginTypeComboBox.addListener (this);
auto parentComboBoxListener = dynamic_cast<ComboBox::Listener*> (&setupComp);
jassert (parentComboBoxListener != nullptr);
pluginTypeComboBox.addListener (parentComboBoxListener);
const String processorTypeOptions[] =
{
......@@ -157,21 +168,13 @@ struct OpenEphysPluginAppWizard : public NewProjectWizard
TRANS("Splitter"),
TRANS("Merger"),
TRANS("Utility"),
TRANS("Data format")
};
auto& processorTypeComboBox = createProcessorTypeOptionComboBox (setupComp, itemsCreated,
StringArray (processorTypeOptions,
numElementsInArray (processorTypeOptions)));
pluginTypeComboBox.setBounds (comboBoxDefaultBounds.removeFromLeft (comboBoxMinWidth));
comboBoxDefaultBounds.removeFromLeft (marginBetweenComboBoxes - 10);
comboBoxDefaultBounds.translate (-30, 0);
processorTypeComboBox.setBounds (comboBoxDefaultBounds.removeFromLeft (70));
//processorTypeComboBox.setBounds (comboBoxDefaultBounds.removeFromRight (comboBoxMinWidth));
// Hide processor type now. Make it visible only after plugin type would be selected.
//processorTypeComboBox.setVisible (false);
updateOpenEphysWizardComboBoxBounds (setupComp);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment