Skip to content
Snippets Groups Projects
Commit cee19a56 authored by Septen's avatar Septen
Browse files

ParameterEditor class refactoring and stylystic fixes. Minor fixes.

parent c49c3a85
No related branches found
No related tags found
No related merge requests found
......@@ -1082,7 +1082,6 @@ SaveButton::~SaveButton()
void GenericEditor::updateParameterButtons(int parameterIndex)
{
if (parameterEditors.size() == 0)
{
//Checks if there is a parameter editor, and stops a bug if there isn't.
......@@ -1094,12 +1093,12 @@ void GenericEditor::updateParameterButtons(int parameterIndex)
{
for (int i = 0; i < parameterEditors.size(); ++i)
{
parameterEditors[i]->channelSelectionUI();
parameterEditors[i]->updateChannelSelectionUI();
}
}
else
{
parameterEditors[parameterIndex]->channelSelectionUI();
parameterEditors[parameterIndex]->updateChannelSelectionUI();
}
//std::cout << "updateParameterButtons" << std::endl;
}
......
......@@ -42,17 +42,15 @@ class Channel;
/**
Base class for creating processor editors.
Base class for creating processor editors.
If a processor doesn't havesign an editor defined, a GenericEditor will be used.
If a processor doesn't havesign an editor defined, a GenericEditor will be used.
Classes derived from this class must place their controls as child components.
They shouldn't try to re-draw any aspects of their background.
Classes derived from this class must place their controls as child components.
They shouldn't try to re-draw any aspects of their background.
@see GenericProcessor, EditorViewport
@see GenericProcessor, EditorViewport
*/
class PLUGIN_API GenericEditor : public AudioProcessorEditor
, public Timer
, public Button::Listener
......@@ -60,12 +58,9 @@ class PLUGIN_API GenericEditor : public AudioProcessorEditor
{
public:
/** Constructor. Loads fonts and creates default buttons.
useDefaultParameter Editors false means custom parameter editors will be used.*/
useDefaultParameter Editors false means custom parameter editors will be used.*/
GenericEditor (GenericProcessor* owner, bool useDefaultParameterEditors);
/** Constructor. Loads fonts and creates default buttons.*/
//GenericEditor (GenericProcessor* owner);
/** Destructor.*/
virtual ~GenericEditor();
......@@ -73,8 +68,8 @@ public:
========================================================================
============================= JUCE METHODS =============================
========================================================================
*/
*/
/** Draws the editor's background.*/
void paint (Graphics& g) override;
......
......@@ -39,7 +39,7 @@ GenericProcessor::GenericProcessor (const String& name)
, saveOrder (-1)
, loadOrder (-1)
, currentChannel (-1)
, editor (0)
, editor (nullptr)
, parametersAsXml (nullptr)
, sendSampleCount (true)
, m_name (name)
......@@ -129,7 +129,7 @@ const String GenericProcessor::getParameterText (int parameterIndex)
var GenericProcessor::getParameterVar (int parameterIndex, int parameterChannel)
{
Parameter& p=parameters.getReference (parameterIndex);
Parameter& p = parameters.getReference (parameterIndex);
return p.operator[] (parameterChannel);
}
......@@ -1016,7 +1016,6 @@ bool GenericProcessor::isEnabledState() const { return isEnabled; }
bool GenericProcessor::isGeneratesTimestamps() const { return false; }
bool GenericProcessor::isDataFormatter() const { return getProcessorType() == PROCESSOR_TYPE_DATA_FORMAT; }
bool GenericProcessor::isFilter() const { return getProcessorType() == PROCESSOR_TYPE_FILTER; }
bool GenericProcessor::isSource() const { return getProcessorType() == PROCESSOR_TYPE_SOURCE; }
bool GenericProcessor::isSink() const { return getProcessorType() == PROCESSOR_TYPE_SINK; }
......
......@@ -298,9 +298,6 @@ public:
/** Returns trus if a processor generates its own timestamps, false otherwise.*/
virtual bool isGeneratesTimestamps() const;
/** Returns true if a processor is a data format processor (e.g. KWIKFormat), false otherwise. */
virtual bool isDataFormatter() const;
/** Returns true if a processor is a filter processor, false otherwise. */
virtual bool isFilter() const;
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
------------------------------------------------------------------
This file is part of the Open Ephys GUI
Copyright (C) 2014 Open Ephys
Copyright (C) 2016 Open Ephys
------------------------------------------------------------------
......@@ -18,7 +18,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __PARAMETEREDITOR_H_44537DA9__
......@@ -35,52 +34,51 @@ class ParameterButton;
class ParameterSlider;
class ParameterCheckbox;
/**
Automatically creates an interactive editor for a particular
parameter.
@see GenericEditor, GenericProcessor, Parameter
/**
Automatically creates an interactive editor for a particular
parameter.
@see GenericEditor, GenericProcessor, Parameter
*/
class PLUGIN_API ParameterEditor : public Component,
public Button::Listener,
public Slider::Listener
class PLUGIN_API ParameterEditor : public Component
, public Button::Listener
, public Slider::Listener
{
public:
ParameterEditor(GenericProcessor* proc, Parameter& p, Font labelFont);
~ParameterEditor();
ParameterEditor (GenericProcessor* proccessor, Parameter& parameter, Font labelFont);
void parentHierarchyChanged() override;
int desiredWidth;
int desiredHeight;
void buttonClicked (Button* buttonThatWasClicked) override;
void sliderValueChanged (Slider* sliderWhichValueHasChanged) override;
void parentHierarchyChanged();
void setChannelSelector (ChannelSelector* channelSelector);
void buttonClicked(Button* button);
void sliderValueChanged(Slider* slider);
// for inactivation during acquisition:
void setEnabled (bool isEnabled);
void updateChannelSelectionUI();
void setChannelSelector(ChannelSelector* ch);
int desiredWidth;
int desiredHeight;
// for inactivation during acquisition:
void setEnabled(bool t);
bool shouldDeactivateDuringAcquisition;
bool activationState;
void channelSelectionUI();
private:
bool m_activationState;
Array<ParameterSlider*> sliderArray;
Array<ParameterButton*> buttonArray;
Array<ParameterCheckbox*> checkboxArray;
Array<int> buttonIdArray;
Array<int> sliderIdArray;
Array<int> checkboxIdArray;
GenericProcessor* m_processor;
Parameter* m_parameter;
ScopedPointer<ChannelSelector> m_channelSelector;
Parameter* parameter;
GenericProcessor* processor;
ScopedPointer<ChannelSelector> channelSelector;
OwnedArray<ParameterSlider> m_sliderArray;
OwnedArray<ParameterButton> m_buttonArray;
OwnedArray<ParameterCheckbox> m_checkboxArray;
Array<int> m_buttonIdArray;
Array<int> m_sliderIdArray;
Array<int> m_checkboxIdArray;
enum
{
......@@ -88,29 +86,24 @@ private:
MIDDLE,
RIGHT
};
};
/**
Used to edit discrete parameters.
*/
/** Used to edit discrete parameters. */
class PLUGIN_API ParameterButton : public Button
{
public:
ParameterButton(var value, int buttonType, Font labelFont);
~ParameterButton();
ParameterButton (var value, int buttonType, Font labelFont);
bool isEnabled;
//Used to mark if unused, usedByActive, or usedby inactive
int colorState;
private:
void paintButton(Graphics& g, bool isMouseOver, bool isButtonDown);
void paintButton (Graphics& g, bool isMouseOver, bool isButtonDown) override;
void resized();
void resized() override;
int type;
......@@ -134,26 +127,20 @@ private:
MIDDLE,
RIGHT
};
};
/**
Used to edit boolean parameters.
*/
/** Used to edit boolean parameters. */
class PLUGIN_API ParameterCheckbox : public Button
{
public:
ParameterCheckbox(bool defaultState);
~ParameterCheckbox();
ParameterCheckbox (bool defaultState);
bool isEnabled;
private:
void paintButton(Graphics& g, bool isMouseOver, bool isButtonDown);
void paintButton (Graphics& g, bool isMouseOver, bool isButtonDown);
ColourGradient selectedGrad;
ColourGradient selectedOverGrad;
......@@ -162,25 +149,20 @@ private:
ColourGradient deactivatedGrad;
};
/**
Used to edit continuous parameters.
*/
/** Used to edit continuous parameters. */
class PLUGIN_API ParameterSlider : public Slider
{
public:
ParameterSlider(float min, float max, float defaultValue, Font f);
~ParameterSlider();
ParameterSlider (float minValue, float maxValue, float defaultValue, Font f);
bool isEnabled;
private:
void paint(Graphics& g);//Button(Graphics& g, bool isMouseOver, bool isButtonDown);
void paint (Graphics& g);//Button(Graphics& g, bool isMouseOver, bool isButtonDown);
Path makeRotaryPath(double, double, double);
Path makeRotaryPath (double minValue, double maxValue, double value);
Font font;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment