Open Ephys GUI
 All Classes Functions Variables Pages
SpikeDetectorEditor.h
1 /*
2  ------------------------------------------------------------------
3 
4  This file is part of the Open Ephys GUI
5  Copyright (C) 2012 Open Ephys
6 
7  ------------------------------------------------------------------
8 
9  This program is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program. If not, see <http://www.gnu.org/licenses/>.
21 
22 */
23 
24 #ifndef __SPIKEDETECTOREDITOR_H_F0BD2DD9__
25 #define __SPIKEDETECTOREDITOR_H_F0BD2DD9__
26 
27 
28 #include "../../../JuceLibraryCode/JuceHeader.h"
29 #include "GenericEditor.h"
30 
31 class TriangleButton;
32 class UtilityButton;
33 
34 class ElectrodeButton : public Button
35 {
36 public:
37  ElectrodeButton(int chan_) : Button("Electrode"), chan(chan_)
38  {
39  setClickingTogglesState(true);
40  //setRadioGroupId(299);
41  setToggleState(true, false);
42  }
43  ~ElectrodeButton() {}
44 
45  int getChannelNum() {return chan;}
46  void setChannelNum(int i) {chan = i;}
47 private:
48  void paintButton(Graphics& g, bool isMouseOver, bool isButtonDown);
49 
50  int chan;
51 };
52 
53 class ElectrodeEditorButton : public Button
54 {
55 public:
56  ElectrodeEditorButton(const String& name_, Font font_) : Button("Electrode Editor"),
57  name(name_), font(font_)
58  {
59  if (name.equalsIgnoreCase("edit") || name.equalsIgnoreCase("monitor"))
60  setClickingTogglesState(true);
61  }
63 private:
64  void paintButton(Graphics& g, bool isMouseOver, bool isButtonDown);
65 
66  const String name;
67 
68  Font font;
69 
70 };
71 
72 class ThresholdSlider : public Slider
73 {
74 public:
75  ThresholdSlider(Font f);
76  ~ThresholdSlider() {}
77 
78  void setActive(bool);
79 
80  void setValues(Array<double>);
81 
82 private:
83  void paint(Graphics& g);
84 
85  Path makeRotaryPath(double, double, double);
86 
87  Font font;
88 
89  bool isActive;
90 
91  Array<double> valueArray;
92 
93 };
94 
96  public Label::Listener,
97  public ComboBox::Listener
98 
99 {
100 public:
102  virtual ~SpikeDetectorEditor();
103  void buttonEvent(Button* button);
104  void labelTextChanged(Label* label);
105  void comboBoxChanged(ComboBox* comboBox);
106  void sliderEvent(Slider* slider);
107 
108  void channelChanged(int chan);
109 
110 private:
111 
112  void drawElectrodeButtons(int);
113 
114  void refreshElectrodeList();
115 
116  ComboBox* electrodeTypes;
117  ComboBox* electrodeList;
118  Label* numElectrodes;
119  Label* thresholdLabel;
120  TriangleButton* upButton;
121  TriangleButton* downButton;
122  UtilityButton* plusButton;
123 
124  ThresholdSlider* thresholdSlider;
125 
126  OwnedArray<ElectrodeButton> electrodeButtons;
127  Array<ElectrodeEditorButton*> electrodeEditorButtons;
128 
129  bool addElectrode(int nChans);
130  void removeElectrode(int index);
131  void editElectrode(int index, int chan, int newChan);
132 
133  int lastId;
134  bool isPlural;
135 
136  Font font;
137 
138  JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (SpikeDetectorEditor);
139 
140 };
141 
142 
143 
144 
145 #endif // __SPIKEDETECTOREDITOR_H_F0BD2DD9__