-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathPythonEditor.h
More file actions
152 lines (106 loc) · 3.93 KB
/
Copy pathPythonEditor.h
File metadata and controls
152 lines (106 loc) · 3.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/*
------------------------------------------------------------------
Python Plugin
Copyright (C) 2016 FP Battaglia
based on
Open Ephys GUI
Copyright (C) 2013, 2015 Open Ephys
------------------------------------------------------------------
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
==============================================================================
PythonEditor.h
Created: 13 Jun 2014 4:21:01pm
Author: fpbatta
==============================================================================
*/
#ifndef __PYTHONEDITOR_H
#define __PYTHONEDITOR_H
#include <EditorHeaders.h>
class PythonPlugin;
class PythonParameterButtonInterface;
class PythonEditor : public GenericEditor
{
public:
PythonEditor(GenericProcessor* parentNode, bool useDefaultParameterEditors);
virtual ~PythonEditor();
void buttonEvent(Button* button);
void channelChanged(int chan, bool newState) override;
void setFile(String file);
void saveCustomParameters(XmlElement*);
void loadCustomParameters(XmlElement*);
Component *addToggleButton(String, bool);
Component *addComboBox(String, int, int*);
Component *addSlider(String, float, float, float);
private:
ScopedPointer<UtilityButton> fileButton;
ScopedPointer<Label> fileNameLabel;
OwnedArray<Component> parameterInterfaces;
PythonPlugin* pythonPlugin;
File lastFilePath;
Font font;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PythonEditor);
};
class PythonParameterButtonInterface : public Component, public Button::Listener
{
public:
PythonParameterButtonInterface(String paramName_, int defaultVal, PythonPlugin *plugin_);
~PythonParameterButtonInterface();
void paint(Graphics& g);
void buttonClicked(Button* button);
void setToggleStateFromValue(int value);
private:
String paramName;
bool isEnabled;
PythonPlugin *plugin;
ScopedPointer<ToggleButton> theButton;
Font font;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PythonParameterButtonInterface);
};
class PythonParameterComboBoxInterface : public Component, public ComboBox::Listener
{
public:
PythonParameterComboBoxInterface(String paramName_, int nEntries_, int *entries_, PythonPlugin *plugin_);
~PythonParameterComboBoxInterface();
void paint(Graphics& g);
void comboBoxChanged(ComboBox* comboBox);
void setEntryFromValue(int value);
private:
String paramName;
int nEntries;
int *entries;
bool lastState;
bool isEnabled;
PythonPlugin *plugin;
ScopedPointer<ComboBox> theComboBox;
Font font;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PythonParameterComboBoxInterface);
};
class PythonParameterSliderInterface : public Component, public Slider::Listener
{
public:
PythonParameterSliderInterface(String paramName_, double rangeMin, double rangeMax, double startValue, PythonPlugin *plugin_);
~PythonParameterSliderInterface();
void paint(Graphics& g);
void sliderValueChanged(Slider* slider);
void setSliderFromValue(float value);
private:
String paramName;
bool isEnabled;
PythonPlugin *plugin;
ScopedPointer<Slider> theSlider;
ScopedPointer<Label> titleLabel;
Font font;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PythonParameterSliderInterface);
};
#endif // __PYTHONEDITOR_H