Skip to content
Snippets Groups Projects
Commit 090660a7 authored by jsiegle's avatar jsiegle
Browse files

Reorganized layout of SpikeDisplayCanvas

parent 70b9a635
No related branches found
No related tags found
No related merge requests found
Showing
with 195 additions and 170 deletions
...@@ -360,6 +360,8 @@ void GenericEditor::update() ...@@ -360,6 +360,8 @@ void GenericEditor::update()
drawerButton->setVisible(true); drawerButton->setVisible(true);
} }
updateSettings();
updateVisualizer(); // does nothing unless this method updateVisualizer(); // does nothing unless this method
// has been implemented // has been implemented
......
...@@ -108,6 +108,7 @@ public: ...@@ -108,6 +108,7 @@ public:
void refreshColors(); void refreshColors();
virtual void update(); virtual void update();
virtual void updateSettings() {}
virtual void updateVisualizer() {} virtual void updateVisualizer() {}
Array<int> getActiveChannels(); Array<int> getActiveChannels();
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "SpikeDetectorEditor.h" #include "SpikeDetectorEditor.h"
#include "../SpikeDetector.h" #include "../SpikeDetector.h"
#include "../../UI/EditorViewport.h"
#include <stdio.h> #include <stdio.h>
...@@ -51,7 +52,7 @@ SpikeDetectorEditor::SpikeDetectorEditor (GenericProcessor* parentNode) ...@@ -51,7 +52,7 @@ SpikeDetectorEditor::SpikeDetectorEditor (GenericProcessor* parentNode)
electrodeTypes->setJustificationType (Justification::centredLeft); electrodeTypes->setJustificationType (Justification::centredLeft);
electrodeTypes->addListener(this); electrodeTypes->addListener(this);
electrodeTypes->setBounds(65,40,130,16); electrodeTypes->setBounds(65,40,130,16);
electrodeTypes->setSelectedId(4); electrodeTypes->setSelectedId(2);
addAndMakeVisible(electrodeTypes); addAndMakeVisible(electrodeTypes);
electrodeList = new ComboBox("Electrode List"); electrodeList = new ComboBox("Electrode List");
...@@ -61,7 +62,7 @@ SpikeDetectorEditor::SpikeDetectorEditor (GenericProcessor* parentNode) ...@@ -61,7 +62,7 @@ SpikeDetectorEditor::SpikeDetectorEditor (GenericProcessor* parentNode)
electrodeList->setBounds(20,80,115,20); electrodeList->setBounds(20,80,115,20);
addAndMakeVisible(electrodeList); addAndMakeVisible(electrodeList);
numElectrodes = new Label("Number of Electrodes","4"); numElectrodes = new Label("Number of Electrodes","2");
numElectrodes->setEditable(true); numElectrodes->setEditable(true);
numElectrodes->addListener(this); numElectrodes->addListener(this);
numElectrodes->setBounds(30,40,25,20); numElectrodes->setBounds(30,40,25,20);
...@@ -149,6 +150,8 @@ void SpikeDetectorEditor::buttonEvent(Button* button) ...@@ -149,6 +150,8 @@ void SpikeDetectorEditor::buttonEvent(Button* button)
drawElectrodeButtons(electrodeList->getNumItems()-1); drawElectrodeButtons(electrodeList->getNumItems()-1);
getEditorViewport()->makeEditorVisible(this);
} else if (button == electrodeEditorButtons[0]) // EDIT } else if (button == electrodeEditorButtons[0]) // EDIT
{ {
...@@ -220,7 +223,7 @@ void SpikeDetectorEditor::labelTextChanged(Label* label) ...@@ -220,7 +223,7 @@ void SpikeDetectorEditor::labelTextChanged(Label* label)
{ {
if (label->getText().equalsIgnoreCase("1") && isPlural) if (label->getText().equalsIgnoreCase("1") && isPlural)
{ {
for (int n = 1; n < 21; n++) for (int n = 1; n < electrodeTypes->getNumItems()+1; n++)
{ {
electrodeTypes->changeItemText(n, electrodeTypes->changeItemText(n,
electrodeTypes->getItemText(n-1).trimCharactersAtEnd("s")); electrodeTypes->getItemText(n-1).trimCharactersAtEnd("s"));
...@@ -236,7 +239,7 @@ void SpikeDetectorEditor::labelTextChanged(Label* label) ...@@ -236,7 +239,7 @@ void SpikeDetectorEditor::labelTextChanged(Label* label)
const String s = "s"; const String s = "s";
size_t one = 1; size_t one = 1;
for (int n = 1; n < 21; n++) for (int n = 1; n < electrodeTypes->getNumItems()+1; n++)
{ {
String currentString = electrodeTypes->getItemText(n-1); String currentString = electrodeTypes->getItemText(n-1);
currentString += "s"; currentString += "s";
......
#include "SpikeDisplayEditor.h" /*
#include <string> ------------------------------------------------------------------
This file is part of the Open Ephys GUI
Copyright (C) 2012 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/>.
*/
#include "SpikeDisplayEditor.h"
#include <string>
SpikeDisplayEditor::SpikeDisplayEditor (GenericProcessor* parentNode) SpikeDisplayEditor::SpikeDisplayEditor (GenericProcessor* parentNode)
: VisualizerEditor(parentNode,200) : VisualizerEditor(parentNode,200)
...@@ -153,6 +174,17 @@ Visualizer* SpikeDisplayEditor::createNewCanvas() ...@@ -153,6 +174,17 @@ Visualizer* SpikeDisplayEditor::createNewCanvas()
} }
// void SpikeDisplayEditor::updateSettings()
// {
// // called by base class
// }
// void SpikeDisplayEditor::updateVisualizer()
// {
// }
void SpikeDisplayEditor::buttonCallback(Button* button) void SpikeDisplayEditor::buttonCallback(Button* button)
{ {
//std::cout<<"Got event from component:"<<button<<std::endl; //std::cout<<"Got event from component:"<<button<<std::endl;
......
...@@ -44,6 +44,9 @@ public: ...@@ -44,6 +44,9 @@ public:
void buttonCallback (Button* button); void buttonCallback (Button* button);
// void updateSettings();
// void updateVisualizer();
Visualizer* createNewCanvas(); Visualizer* createNewCanvas();
private: private:
......
...@@ -283,6 +283,7 @@ void GenericProcessor::clearSettings() ...@@ -283,6 +283,7 @@ void GenericProcessor::clearSettings()
settings.bitVolts.clear(); settings.bitVolts.clear();
settings.eventChannelIds.clear(); settings.eventChannelIds.clear();
settings.eventChannelNames.clear(); settings.eventChannelNames.clear();
settings.eventChannelTypes.clear();
} }
void GenericProcessor::update() void GenericProcessor::update()
......
...@@ -193,6 +193,14 @@ public: ...@@ -193,6 +193,14 @@ public:
CONTINUOUS = 6 CONTINUOUS = 6
}; };
enum eventChannelTypes
{
GENERIC_EVENT = 999,
SINGLE_ELECTRODE = 1,
STEREOTRODE = 2,
TETRODE = 4
};
int saveOrder; int saveOrder;
int loadOrder; int loadOrder;
...@@ -215,6 +223,7 @@ public: ...@@ -215,6 +223,7 @@ public:
Array<int> eventChannelIds; Array<int> eventChannelIds;
StringArray eventChannelNames; StringArray eventChannelNames;
Array<int> eventChannelTypes;
}; };
......
...@@ -29,29 +29,34 @@ SpikeDetector::SpikeDetector() ...@@ -29,29 +29,34 @@ SpikeDetector::SpikeDetector()
overflowBuffer(2,100), dataBuffer(overflowBuffer) overflowBuffer(2,100), dataBuffer(overflowBuffer)
{ {
//// the standard form:
electrodeTypes.add("hentrode"); electrodeTypes.add("single electrode");
electrodeTypes.add("duotrode"); electrodeTypes.add("stereotrode");
electrodeTypes.add("triode");
electrodeTypes.add("tetrode"); electrodeTypes.add("tetrode");
electrodeTypes.add("pentrode");
electrodeTypes.add("hextrode"); //// the technically correct form (Greek cardinal prefixes):
electrodeTypes.add("heptrode"); // electrodeTypes.add("hentrode");
electrodeTypes.add("octrode"); // electrodeTypes.add("duotrode");
electrodeTypes.add("enneatrode"); // electrodeTypes.add("triode");
electrodeTypes.add("decatrode"); // electrodeTypes.add("tetrode");
electrodeTypes.add("hendecatrode"); // electrodeTypes.add("pentrode");
electrodeTypes.add("dodecatrode"); // electrodeTypes.add("hextrode");
electrodeTypes.add("triskaidecatrode"); // electrodeTypes.add("heptrode");
electrodeTypes.add("tetrakaidecatrode"); // electrodeTypes.add("octrode");
electrodeTypes.add("pentakaidecatrode"); // electrodeTypes.add("enneatrode");
electrodeTypes.add("hexadecatrode"); // electrodeTypes.add("decatrode");
electrodeTypes.add("heptakaidecatrode"); // electrodeTypes.add("hendecatrode");
electrodeTypes.add("octakaidecatrode"); // electrodeTypes.add("dodecatrode");
electrodeTypes.add("enneakaidecatrode"); // electrodeTypes.add("triskaidecatrode");
electrodeTypes.add("icosatrode"); // electrodeTypes.add("tetrakaidecatrode");
// electrodeTypes.add("pentakaidecatrode");
for (int i = 0; i < 21; i++) // electrodeTypes.add("hexadecatrode");
// electrodeTypes.add("heptakaidecatrode");
// electrodeTypes.add("octakaidecatrode");
// electrodeTypes.add("enneakaidecatrode");
// electrodeTypes.add("icosatrode");
for (int i = 0; i < electrodeTypes.size()+1; i++)
{ {
electrodeCounter.add(0); electrodeCounter.add(0);
} }
...@@ -75,6 +80,13 @@ void SpikeDetector::updateSettings() ...@@ -75,6 +80,13 @@ void SpikeDetector::updateSettings()
overflowBuffer.setSize(getNumInputs(),overflowBufferSize); overflowBuffer.setSize(getNumInputs(),overflowBufferSize);
for (int i = 0; i < electrodes.size(); i++)
{
settings.eventChannelIds.add(i);
settings.eventChannelNames.add(electrodes[i]->name);
settings.eventChannelTypes.add(electrodes[i]->numChannels);
}
} }
bool SpikeDetector::addElectrode(int nChans) bool SpikeDetector::addElectrode(int nChans)
......
...@@ -50,11 +50,16 @@ AudioProcessorEditor* SpikeDisplayNode::createEditor() ...@@ -50,11 +50,16 @@ AudioProcessorEditor* SpikeDisplayNode::createEditor()
} }
void SpikeDisplayNode::updateSettings() // void SpikeDisplayNode::updateSettings()
{ // {
std::cout << "Setting num inputs on SpikeDisplayNode to " << getNumInputs() << std::endl; // //std::cout << "Setting num inputs on SpikeDisplayNode to " << getNumInputs() << std::endl;
}
// }
// void SpikeDisplayNode::updateVisualizer()
// {
// }
bool SpikeDisplayNode::enable() bool SpikeDisplayNode::enable()
{ {
...@@ -73,9 +78,42 @@ bool SpikeDisplayNode::disable() ...@@ -73,9 +78,42 @@ bool SpikeDisplayNode::disable()
return true; return true;
} }
int SpikeDisplayNode::getNumberOfChannelsForInput(int i){ int SpikeDisplayNode::getNumberOfChannelsForElectrode(int i)
std::cout<<"SpikeDisplayNode::getNumberOfChannelsForInput()"<<std::endl; {
return 1; //std::cout<<"SpikeDisplayNode::getNumberOfChannelsForInput()"<<std::endl;
int electrodeIndex = -1;
for (int i = 0; i < settings.eventChannelTypes.size(); i++)
{
if (settings.eventChannelTypes[i] < 999)
{
electrodeIndex++;
if (electrodeIndex == i)
{
return settings.eventChannelTypes[i];
}
}
}
return 0;
}
int SpikeDisplayNode::getNumElectrodes()
{
int nElectrodes = 0;
for (int i = 0; i < settings.eventChannelTypes.size(); i++)
{
if (settings.eventChannelTypes[i] < 999)
{
nElectrodes++;
}
}
return nElectrodes;
} }
......
...@@ -64,12 +64,13 @@ public: ...@@ -64,12 +64,13 @@ public:
void setParameter(int, float); void setParameter(int, float);
void updateSettings(); //void updateSettings();
bool enable(); bool enable();
bool disable(); bool disable();
int getNumberOfChannelsForInput(int i); int getNumberOfChannelsForElectrode(int i);
int getNumElectrodes();
bool getNextSpike(SpikeObject *spike); bool getNextSpike(SpikeObject *spike);
......
...@@ -234,9 +234,9 @@ void LfpDisplayCanvas::renderOpenGL() ...@@ -234,9 +234,9 @@ void LfpDisplayCanvas::renderOpenGL()
drawWaveform(i,isSelected); drawWaveform(i,isSelected);
} }
} }
drawScrollBars();
//std::cout << "Render." << std::endl; drawScrollBars();
} }
void LfpDisplayCanvas::drawWaveform(int chan, bool isSelected) void LfpDisplayCanvas::drawWaveform(int chan, bool isSelected)
...@@ -367,25 +367,3 @@ void LfpDisplayCanvas::mouseDownInCanvas(const MouseEvent& e) ...@@ -367,25 +367,3 @@ void LfpDisplayCanvas::mouseDownInCanvas(const MouseEvent& e)
} }
} }
// void LfpDisplayCanvas::mouseDrag(const MouseEvent& e) {mouseDragInCanvas(e);}
// void LfpDisplayCanvas::mouseMove(const MouseEvent& e) {mouseMoveInCanvas(e);}
// void LfpDisplayCanvas::mouseUp(const MouseEvent& e) {mouseUpInCanvas(e);}
// void LfpDisplayCanvas::mouseWheelMove(const MouseEvent& e, float a, float b) {mouseWheelMoveInCanvas(e,a,b);}
// void LfpDisplayCanvas::resized()
// {
// //screenBuffer = new AudioSampleBuffer(nChans, getWidth());
// // glClear(GL_COLOR_BUFFER_BIT);
// // //int h = getParentComponent()->getHeight();
// // if (scrollPix + getHeight() > getTotalHeight() && getTotalHeight() > getHeight())
// // scrollPix = getTotalHeight() - getHeight();
// // else
// // scrollPix = 0;
// // showScrollBars();
// canvasWasResized();
// }
\ No newline at end of file
...@@ -210,6 +210,8 @@ void OpenGLCanvas::stopCallbacks() ...@@ -210,6 +210,8 @@ void OpenGLCanvas::stopCallbacks()
void OpenGLCanvas::drawScrollBars() void OpenGLCanvas::drawScrollBars()
{ {
//std::cout << "Drawing scroll bars" << std::endl;
float scrollBarY = float(getHeight())/float(getTotalHeight()); float scrollBarY = float(getHeight())/float(getTotalHeight());
float timeSinceScroll = timer->getMillisecondCounter()-scrollTime; float timeSinceScroll = timer->getMillisecondCounter()-scrollTime;
...@@ -245,6 +247,8 @@ void OpenGLCanvas::drawScrollBars() ...@@ -245,6 +247,8 @@ void OpenGLCanvas::drawScrollBars()
void OpenGLCanvas::drawScrollBar(float y1, float y2, float alpha) void OpenGLCanvas::drawScrollBar(float y1, float y2, float alpha)
{ {
glViewport(0,0,getWidth(),getHeight()); glViewport(0,0,getWidth(),getHeight());
glOrtho (0, 1, 1, 0, 0, 1);
//setViewportRange(0, 0, getWidth(), getHeight());
float x1 = (getWidth()-8.0f)/getWidth(); float x1 = (getWidth()-8.0f)/getWidth();
float x2 = (getWidth()-2.0f)/getWidth(); float x2 = (getWidth()-2.0f)/getWidth();
......
...@@ -28,16 +28,17 @@ SpikeDisplayCanvas::SpikeDisplayCanvas(SpikeDisplayNode* n) : processor(n), ...@@ -28,16 +28,17 @@ SpikeDisplayCanvas::SpikeDisplayCanvas(SpikeDisplayNode* n) : processor(n),
totalScrollPix(0) totalScrollPix(0)
{ {
nCols = 3;
nPlots = 1; //8; update();
nCols = 3; //processor->getNumInputs();
std::cout<<"SpikeDisplayNode has :"<<nPlots<<" outputs!"<<std::endl;
// std::cout<<"SpikeDisplayNode has :"<<nPlots<<" outputs!"<<std::endl;
for (int i=0; i<nPlots; i++) // // for (int i=0; i<nPlots; i++)
nChannels[i] = processor->getNumberOfChannelsForInput(i); // // nChannels[i] = processor->getNumberOfChannelsForElectrode(i);
std::cout << "Setting num inputs on SpikeDisplayCanvas to " << nPlots << std::endl; // std::cout << "Setting num inputs on SpikeDisplayCanvas to " << nPlots << std::endl;
...@@ -49,15 +50,21 @@ SpikeDisplayCanvas::~SpikeDisplayCanvas() ...@@ -49,15 +50,21 @@ SpikeDisplayCanvas::~SpikeDisplayCanvas()
} }
void SpikeDisplayCanvas::initializeSpikePlots(){ void SpikeDisplayCanvas::initializeSpikePlots(){
std::cout<<"Initializing Plots"<<std::endl; std::cout<<"Initializing Plots"<<std::endl;
if (plots.size() != nPlots)
{
int totalWidth = getWidth(); int totalWidth = getWidth();
int plotWidth = (totalWidth - yBuffer * ( nCols+1)) / nCols + .99; int plotWidth = (totalWidth - yBuffer * ( nCols+1)) / nCols + .99;
int plotHeight = plotWidth / 2 + .5; int plotHeight = plotWidth / 2 + .5;
int rowCount = 0; int rowCount = 0;
for (int i=0; i<nPlots; i++) plots.clear();
for (int i=0; i < nPlots; i++)
{ {
StereotrodePlot p = StereotrodePlot( StereotrodePlot p = StereotrodePlot(
...@@ -76,11 +83,13 @@ void SpikeDisplayCanvas::initializeSpikePlots(){ ...@@ -76,11 +83,13 @@ void SpikeDisplayCanvas::initializeSpikePlots(){
} }
totalHeight = rowCount * (plotHeight + yBuffer) + yBuffer * 2; //totalHeight = rowCount * (plotHeight + yBuffer) + yBuffer * 2;
// Set the total height of the Canvas to the top of the top most plot // Set the total height of the Canvas to the top of the top most plot
plotsInitialized = true; plotsInitialized = true;
repositionSpikePlots(); repositionSpikePlots();
}
} }
void SpikeDisplayCanvas::repositionSpikePlots(){ void SpikeDisplayCanvas::repositionSpikePlots(){
...@@ -91,11 +100,11 @@ void SpikeDisplayCanvas::repositionSpikePlots(){ ...@@ -91,11 +100,11 @@ void SpikeDisplayCanvas::repositionSpikePlots(){
int plotHeight = plotWidth / 2 + .5; int plotHeight = plotWidth / 2 + .5;
int rowCount = 0; int rowCount = 0;
for (int i=0; i<plots.size(); i++) for (int i=0; i < plots.size(); i++)
{ {
plots[i].setPosition( xBuffer + i%nCols * (plotWidth + xBuffer) , plots[i].setPosition( xBuffer + i%nCols * (plotWidth + xBuffer) ,
yBuffer + rowCount * (plotHeight + yBuffer), getHeight() - ( yBuffer + plotHeight + rowCount * (plotHeight + yBuffer)) + getScrollAmount(),
plotWidth, plotWidth,
plotHeight); // deprecated conversion from string constant to char plotHeight); // deprecated conversion from string constant to char
...@@ -104,7 +113,7 @@ void SpikeDisplayCanvas::repositionSpikePlots(){ ...@@ -104,7 +113,7 @@ void SpikeDisplayCanvas::repositionSpikePlots(){
} }
// Set the total height of the Canvas to the top of the top most plot // Set the total height of the Canvas to the top of the top most plot
totalHeight = rowCount * (plotHeight + yBuffer) + yBuffer * 2; totalHeight = (rowCount + 1) * (plotHeight + yBuffer) + yBuffer;
} }
void SpikeDisplayCanvas::newOpenGLContextCreated() void SpikeDisplayCanvas::newOpenGLContextCreated()
...@@ -116,19 +125,12 @@ void SpikeDisplayCanvas::newOpenGLContextCreated() ...@@ -116,19 +125,12 @@ void SpikeDisplayCanvas::newOpenGLContextCreated()
glClearColor (0.667, 0.698, 0.918, 1.0); glClearColor (0.667, 0.698, 0.918, 1.0);
resized(); resized();
endAnimation(); //endAnimation();
} }
void SpikeDisplayCanvas::beginAnimation() void SpikeDisplayCanvas::beginAnimation()
{ {
std::cout << "Beginning animation." << std::endl; std::cout << "Beginning animation." << std::endl;
// displayBufferSize = displayBuffer->getNumSamples();
// screenBuffer->clear();
//displayBufferIndex = 0;
// screenBufferIndex = 0;
startCallbacks(); startCallbacks();
} }
...@@ -141,19 +143,14 @@ void SpikeDisplayCanvas::endAnimation() ...@@ -141,19 +143,14 @@ void SpikeDisplayCanvas::endAnimation()
void SpikeDisplayCanvas::update() void SpikeDisplayCanvas::update()
{ {
// nChans = processor->getNumInputs();
// sampleRate = processor->getSampleRate();
// std::cout << "Setting num inputs on SpikeDisplayCanvas to " << nChans << std::endl; std::cout << "UPDATING SpikeDisplayCanvas" << std::endl;
// if (nChans < 200 && nChans > 0)
// screenBuffer->setSize(nChans, 10000);
// //sampleRate = processor->getSampleRate();
// screenBuffer->clear(); nPlots = processor->getNumElectrodes();
repaint(); initializeSpikePlots();
// totalHeight = (plotHeight+yBuffer)*nChans + yBuffer; repaint();
} }
...@@ -198,7 +195,7 @@ void SpikeDisplayCanvas::refreshState() ...@@ -198,7 +195,7 @@ void SpikeDisplayCanvas::refreshState()
// screenBufferIndex = 0; // screenBufferIndex = 0;
//resized(); //resized();
totalScrollPix = 0; //totalScrollPix = 0;
} }
void SpikeDisplayCanvas::canvasWasResized() void SpikeDisplayCanvas::canvasWasResized()
...@@ -208,12 +205,13 @@ void SpikeDisplayCanvas::canvasWasResized() ...@@ -208,12 +205,13 @@ void SpikeDisplayCanvas::canvasWasResized()
void SpikeDisplayCanvas::renderOpenGL() void SpikeDisplayCanvas::renderOpenGL()
{ {
if(!plotsInitialized) //if(!plotsInitialized)
initializeSpikePlots(); // initializeSpikePlots();
glClearColor (0.667, 0.698, 0.718, 1.0); glClearColor (0.667, 0.698, 0.918, 1.0);
glClear(GL_COLOR_BUFFER_BIT); // clear buffers to preset values glClear(GL_COLOR_BUFFER_BIT); // clear buffers to preset values
// std::cout<<"SpikeDisplayCanvas::renderOpenGL"<<std::endl;
//std::cout<<"SpikeDisplayCanvas::renderOpenGL"<<std::endl;
// Get Spikes from the processor // Get Spikes from the processor
// Iterate through each spike, passing them individually to the appropriate plots and calling redraw before moving on to the next spike // Iterate through each spike, passing them individually to the appropriate plots and calling redraw before moving on to the next spike
...@@ -224,8 +222,9 @@ void SpikeDisplayCanvas::renderOpenGL() ...@@ -224,8 +222,9 @@ void SpikeDisplayCanvas::renderOpenGL()
// Distribute thoses spike to the appropriate plot object // Distribute thoses spike to the appropriate plot object
// Generate fake spikes
SpikeObject tmpSpike; SpikeObject tmpSpike;
for (int i=0; i<plots.size(); i++){ for (int i=0; i<plots.size(); i++){
generateSimulatedSpike(&tmpSpike, 0, 150); generateSimulatedSpike(&tmpSpike, 0, 150);
plots[i].processSpikeObject(tmpSpike); plots[i].processSpikeObject(tmpSpike);
...@@ -255,12 +254,13 @@ void SpikeDisplayCanvas::drawPlotTitle(int chan){ ...@@ -255,12 +254,13 @@ void SpikeDisplayCanvas::drawPlotTitle(int chan){
String s = "Source:";//String("Channel "); String s = "Source:";//String("Channel ");
s += (chan+1); s += (chan+1);
getFont(String("cpmono-bold"))->FaceSize(25); getFont(String("cpmono-bold"))->FaceSize(15);
getFont(String("cpmono-bold"))->Render(s); getFont(String("cpmono-bold"))->Render(s);
} }
int SpikeDisplayCanvas::getTotalHeight() int SpikeDisplayCanvas::getTotalHeight()
{ {
//std::cout << "TOTAL HEIGHT = " << totalHeight << std::endl;
return totalHeight; return totalHeight;
} }
...@@ -285,7 +285,7 @@ void SpikeDisplayCanvas::mouseDownInCanvas(const MouseEvent& e) ...@@ -285,7 +285,7 @@ void SpikeDisplayCanvas::mouseDownInCanvas(const MouseEvent& e)
// void SpikeDisplayCanvas::mouseDrag(const MouseEvent& e) {mouseDragInCanvas(e);} // void SpikeDisplayCanvas::mouseDrag(const MouseEvent& e) {mouseDragInCanvas(e);}
// void SpikeDisplayCanvas::mouseMove(const MouseEvent& e) {mouseMoveInCanvas(e);} // void SpikeDisplayCanvas::mouseMove(const MouseEvent& e) {mouseMoveInCanvas(e);}
void SpikeDisplayCanvas::mouseUp(const MouseEvent& e) { void SpikeDisplayCanvas::mouseUpInCanvas(const MouseEvent& e) {
// std::cout<<"Mouse Event!"<<std::endl; // std::cout<<"Mouse Event!"<<std::endl;
// bool inout = false; // bool inout = false;
...@@ -300,54 +300,15 @@ void SpikeDisplayCanvas::mouseUp(const MouseEvent& e) { ...@@ -300,54 +300,15 @@ void SpikeDisplayCanvas::mouseUp(const MouseEvent& e) {
// else // else
// panPlot(0,0,inout); // panPlot(0,0,inout);
} }
void SpikeDisplayCanvas::mouseWheelMove(const MouseEvent& e, float wheelIncrementX, float wheelIncrementY) { void SpikeDisplayCanvas::mouseWheelMoveInCanvas(const MouseEvent& e, float wheelIncrementX, float wheelIncrementY)
{
// std::cout<<"Mouse Wheel Move:"<< wheelIncrementX<<","<<wheelIncrementY;
// std::cout<<" Scroll Pix:"<<scrollPix<<std::endl;
int scrollAmount = 0;
// std::cout<<getTotalHeight()<<" "<<getHeight()<<std::endl;
if (getTotalHeight() > getHeight()) {
//if (wheelIncrementY > 0 )
scrollAmount += int(100.0f*wheelIncrementY);
//else if (wheelIncrementY < 0)
totalScrollPix += scrollAmount;
// don't let the user scroll too far down
int minScrollDown = (-1 * totalHeight) + getHeight();
int maxScrollUp = 0; // never scroll plots up, there is nothing below the bottom plot
// std::cout<<"TotalScrollPix:"<<totalScrollPix<<" min:"<<minScrollDown<<" max:"<<maxScrollUp<<std::endl;
if (totalScrollPix < minScrollDown){
totalScrollPix= minScrollDown;
scrollAmount = 0;
}
else if (totalScrollPix > maxScrollUp)
{
totalScrollPix = maxScrollUp;
scrollAmount = 0;
}
for (int i=0; i<plots.size(); i++){
int x,y;
double w,h;
plots[i].getPosition(&x, &y, &w, &h);
plots[i].setPosition(x,y+scrollAmount, w, h);
}
scrollPix = 0;//totalScrollPix;
repaint();
showScrollBars(); repositionSpikePlots();
} repaint();
//repaint();
mouseWheelMoveInCanvas(e, wheelIncrementX, wheelIncrementY); // mouseWheelMoveInCanvas(e, wheelIncrementX, wheelIncrementY);
} }
void SpikeDisplayCanvas::panPlot(int p, int c, bool up){ void SpikeDisplayCanvas::panPlot(int p, int c, bool up){
...@@ -364,27 +325,7 @@ void SpikeDisplayCanvas::zoomPlot(int p, int c, bool in){ ...@@ -364,27 +325,7 @@ void SpikeDisplayCanvas::zoomPlot(int p, int c, bool in){
plots[p].zoom(c, in); plots[p].zoom(c, in);
} }
void SpikeDisplayCanvas::disablePointSmoothing(){ void SpikeDisplayCanvas::disablePointSmoothing()
{
// glDisable(GL_LINE_SMOOTH); glDisable(GL_POINT_SMOOTH); // needed to make projections visible
glDisable(GL_POINT_SMOOTH);
// glDisable(GL_POLYGON_SMOOTH);
} }
// void SpikeDisplayCanvas::resized()
// {
// //screenBuffer = new AudioSampleBuffer(nChans, getWidth());
// // glClear(GL_COLOR_BUFFER_BIT);
// // //int h = getParentComponent()->getHeight();
// // if (scrollPix + getHeight() > getTotalHeight() && getTotalHeight() > getHeight())
// // scrollPix = getTotalHeight() - getHeight();
// // else
// // scrollPix = 0;
// // showScrollBars();
// canvasWasResized();
// }
\ No newline at end of file
...@@ -115,10 +115,10 @@ private: ...@@ -115,10 +115,10 @@ private:
void disablePointSmoothing(); void disablePointSmoothing();
void canvasWasResized(); void canvasWasResized();
void mouseDownInCanvas(const MouseEvent& e); void mouseDownInCanvas(const MouseEvent& e);
// void mouseDrag(const MouseEvent& e); //void mouseDragInCanvas(const MouseEvent& e);
// void mouseMove(const MouseEvent& e); //void mouseMoveInCanvas(const MouseEvent& e);
void mouseUp(const MouseEvent& e); void mouseUpInCanvas(const MouseEvent& e);
void mouseWheelMove(const MouseEvent&, float, float); void mouseWheelMoveInCanvas(const MouseEvent&, float, float);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (SpikeDisplayCanvas); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (SpikeDisplayCanvas);
......
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