Open Ephys GUI
 All Classes Functions Variables Pages
SpikeDisplayCanvas.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 SPIKEDISPLAYCANVAS_H_
25 #define SPIKEDISPLAYCANVAS_H_
26 
27 #include "../../../JuceLibraryCode/JuceHeader.h"
28 
29 #include "../SpikeDisplayNode.h"
30 #include "SpikePlotting/ElectrodePlot.h"
31 #include "SpikePlotting/StereotrodePlot.h"
32 #include "SpikePlotting/TetrodePlot.h"
33 #include "SpikeObject.h"
34 
35 #include "Visualizer.h"
36 #include <vector>
37 
38  /**
39 
40  Displays spike waveforms and projections.
41 
42  @see SpikeDisplayNode, SpikeDisplayEditor, Visualizer
43 
44 */
45 
46 #define MAX_NUMBER_OF_SPIKE_SOURCES = 128;
47 
48 class SpikeDisplayNode;
49 
51 
52 {
53 public:
56  void newOpenGLContextCreated();
57  void renderOpenGL();
58 
59  void processSpikeEvents();
60 
61  void beginAnimation();
62  void endAnimation();
63 
64  void refreshState();
65 
66  void update();
67 
68  void setParameter(int, float);
69  void setParameter(int, int, int, float);
70 
71  void panPlot(int, int, bool);
72  void zoomPlot(int, int, bool);
73 
74 private:
75 
76 
77  MidiBuffer* spikeBuffer;
78 
79  int xBuffer, yBuffer;
80 
81  bool plotsInitialized;
82 
83  bool newSpike;
84  SpikeObject spike;
85  SpikeDisplayNode* processor;
86 
87  Array<BaseUIElement*> plots;
88 
89  // std::vector<StereotrodePlot> STplots;
90  // std::vector<TetrodePlot> TTplots;
91  // std::vector<ElectrodePlot> SEplots;
92 
93  Array<int> numChannelsPerPlot;
94 
95  int totalScrollPix;
96  // AudioSampleBuffer* displayBuffer;
97  // ScopedPointer<AudioSampleBuffer> screenBuffer;
98  // MidiBuffer* eventBuffer;
99 
100  // void setViewport(int chan);
101  // void drawBorder(bool isSelected);
102  // void drawChannelInfo(int chan, bool isSelected);
103  // void drawWaveform(int chan, bool isSelected);
104 
105  void drawPlotTitle(int chan);
106  //void drawTicks();
107 
108  // bool checkBounds(int chan);
109 
110  // void updateScreenBuffer();
111  // int screenBufferIndex;
112  // int displayBufferIndex;
113  // int displayBufferSize;
114 
115  int totalHeight;
116  // int selectedChan;
117 
118  int getTotalHeight();
119 
120  int nPlots;
121  int nCols;
122  int nChannels[MAX_NUMBER_OF_SPIKE_CHANNELS];
123 
124  void initializeSpikePlots();
125  void repositionSpikePlots();
126 
127  void disablePointSmoothing();
128  void canvasWasResized();
129  void mouseDownInCanvas(const MouseEvent& e);
130  //void mouseDragInCanvas(const MouseEvent& e);
131  //void mouseMoveInCanvas(const MouseEvent& e);
132  void mouseUpInCanvas(const MouseEvent& e);
133  void mouseWheelMoveInCanvas(const MouseEvent&, float, float);
134 
135  JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (SpikeDisplayCanvas);
136 
137 };
138 
139 
140 
141 #endif // SPIKEDISPLAYCANVAS_H_