@@ -25,7 +25,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
2525
2626ScriptPathButton::ScriptPathButton (Parameter* param) : ParameterEditor(param)
2727{
28- utilButton = std::make_unique<UtilityButton>(" ..." , Font (12 ));
28+ utilButton = std::make_unique<UtilityButton>(" ..." );
29+ utilButton->setFont (FontOptions (12 .0f ));
2930 utilButton->addListener (this );
3031 addAndMakeVisible (utilButton.get ());
3132
@@ -35,7 +36,7 @@ ScriptPathButton::ScriptPathButton(Parameter* param) : ParameterEditor(param)
3536
3637void ScriptPathButton::buttonClicked (Button* label)
3738{
38- FileChooser chooseScriptDirectory (" Please select a python script..." , File (CoreServices::getDefaultUserSaveDirectory () ), " *.py" );
39+ FileChooser chooseScriptDirectory (" Please select a python script..." , File (), " *.py" );
3940
4041 if (chooseScriptDirectory.browseForFileToOpen ())
4142 {
@@ -59,69 +60,39 @@ PythonProcessorEditor::PythonProcessorEditor(PythonProcessor* parentNode)
5960
6061 desiredWidth = 190 ;
6162
62- streamSelection = std::make_unique<ComboBox>(" Stream Selector" );
63- streamSelection->setBounds (20 , 32 , 155 , 20 );
64- streamSelection->addListener (this );
65- addAndMakeVisible (streamSelection.get ());
63+ addSelectedStreamParameterEditor (Parameter::PROCESSOR_SCOPE, " current_stream" , 20 , 34 );
64+ getParameterEditor (" current_stream" )->setLayout (ParameterEditor::Layout::nameHidden);
65+ getParameterEditor (" current_stream" )->setSize (150 , 20 );
6666
67- scriptPathLabel = std::make_unique<Label>(" Script Path Label" , " No Module Loaded" );
67+
68+ scriptPathLabel = std::make_unique<TextEditor>(" Script Path Label" );
69+ scriptPathLabel->setText (" No Module Loaded" , false );
6870 scriptPathLabel->setTooltip (scriptPathLabel->getText ());
69- scriptPathLabel->setMinimumHorizontalScale ( 0 . 7f );
70- scriptPathLabel->setBounds ( 20 , 65 , 135 , 20 );
71- scriptPathLabel->setColour (Label::backgroundColourId, Colours::grey );
72- scriptPathLabel->setColour (Label::backgroundWhenEditingColourId, Colours::white );
73- scriptPathLabel->setJustificationType (Justification::centredLeft);
71+ scriptPathLabel->setMultiLine ( false );
72+ scriptPathLabel->setReadOnly ( true );
73+ scriptPathLabel->setCaretVisible ( false );
74+ scriptPathLabel->setBounds ( 20 , 65 , 125 , 20 );
75+ scriptPathLabel->setJustification (Justification::centredLeft);
7476 addAndMakeVisible (scriptPathLabel.get ());
7577
7678 Parameter* scriptPathPtr = getProcessor ()->getParameter (" script_path" );
77- addCustomParameterEditor (new ScriptPathButton (scriptPathPtr), 160 , 65 );
79+ addCustomParameterEditor (new ScriptPathButton (scriptPathPtr), 150 , 65 );
7880
79- reloadButton = std::make_unique<UtilityButton>(" Reload" , Font (12 ));
80- reloadButton->setBounds (60 , 95 , 80 , 25 );
81+ reloadButton = std::make_unique<UtilityButton>(" Reload" );
82+ reloadButton->setFont (FontOptions (13 .0f ));
83+ reloadButton->setBounds (60 , 95 , 70 , 25 );
8184 reloadButton->addListener (this );
8285 addAndMakeVisible (reloadButton.get ());
8386
8487}
8588
86- void PythonProcessorEditor::updateSettings ()
87- {
88-
89- currentStream = (uint16) (int )getProcessor ()->getParameter (" current_stream" )->getValue ();
90- streamSelection->clear ();
91-
92- for (auto stream : getProcessor ()->getDataStreams ())
93- {
94- if (currentStream == 0 )
95- currentStream = stream->getStreamId ();
96-
97- streamSelection->addItem (stream->getName (), stream->getStreamId ());
98- }
99-
100- if (streamSelection->indexOfItemId (currentStream) == -1 )
101- {
102- if (streamSelection->getNumItems () > 0 )
103- currentStream = streamSelection->getItemId (0 );
104- else
105- currentStream = 0 ;
106- }
107-
108- if (currentStream > 0 )
109- {
110- streamSelection->setSelectedId (currentStream, sendNotification);
111- }
112-
113-
114- }
115-
11689void PythonProcessorEditor::startAcquisition ()
11790{
118- streamSelection->setEnabled (false );
11991 reloadButton->setEnabled (false );
12092}
12193
12294void PythonProcessorEditor::stopAcquisition ()
12395{
124- streamSelection->setEnabled (true );
12596 reloadButton->setEnabled (true );
12697}
12798
@@ -135,23 +106,11 @@ void PythonProcessorEditor::buttonClicked(Button* button)
135106
136107}
137108
138- void PythonProcessorEditor::comboBoxChanged (ComboBox* cb)
139- {
140- if (cb == streamSelection.get ())
141- {
142- currentStream = cb->getSelectedId ();
143-
144- if (currentStream > 0 )
145- getProcessor ()->getParameter (" current_stream" )->setNextValue (currentStream);
146- }
147-
148- }
149-
150-
151109void PythonProcessorEditor::setPathLabelText (String text, String tooltip)
152110{
153- scriptPathLabel->setText (text, dontSendNotification );
111+ scriptPathLabel->setText (text, false );
154112 scriptPathLabel->setTooltip (tooltip);
113+ scriptPathLabel->setCaretPosition (0 );
155114}
156115
157116
0 commit comments