From b33e4374afccce93b2c81f02ecab173bb9d311f9 Mon Sep 17 00:00:00 2001 From: jsiegle <jsiegle@mit.edu> Date: Fri, 5 Apr 2013 14:15:45 -0400 Subject: [PATCH] Add files for RHD2000Editor class --- Builds/Linux/Makefile | 6 + .../open-ephys.xcodeproj/project.pbxproj | 6 + Builds/VisualStudio2010/open-ephys.vcxproj | 2 + .../open-ephys.vcxproj.filters | 6 + Builds/VisualStudio2012/open-ephys.vcxproj | 2 + .../open-ephys.vcxproj.filters | 6 + Source/Processors/Editors/RHD2000Editor.cpp | 35 ++ Source/Processors/Editors/RHD2000Editor.h | 55 ++ Source/Processors/Editors/SourceNodeEditor.h | 1 - .../Processors/Editors/VisualizerEditor.cpp | 311 +++++----- Source/Processors/SourceNode.cpp | 11 +- .../Visualization/SpikeDisplayCanvas.h | 145 +++-- Source/UI/CustomLookAndFeel.cpp | 559 +++++++++--------- open-ephys.jucer | 3 + 14 files changed, 621 insertions(+), 527 deletions(-) create mode 100644 Source/Processors/Editors/RHD2000Editor.cpp create mode 100644 Source/Processors/Editors/RHD2000Editor.h diff --git a/Builds/Linux/Makefile b/Builds/Linux/Makefile index 5455eaddd..3998a067c 100644 --- a/Builds/Linux/Makefile +++ b/Builds/Linux/Makefile @@ -87,6 +87,7 @@ OBJECTS := \ $(OBJDIR)/SpikeDetector_300d85e7.o \ $(OBJDIR)/AudioNode_94606ff3.o \ $(OBJDIR)/EventNode_95c842b7.o \ + $(OBJDIR)/RHD2000Editor_d7ddd6b.o \ $(OBJDIR)/RecordControlEditor_244084cb.o \ $(OBJDIR)/ReferenceNodeEditor_19ee0fac.o \ $(OBJDIR)/ResamplingNodeEditor_f2d6f061.o \ @@ -392,6 +393,11 @@ $(OBJDIR)/EventNode_95c842b7.o: ../../Source/Processors/EventNode.cpp @echo "Compiling EventNode.cpp" @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" +$(OBJDIR)/RHD2000Editor_d7ddd6b.o: ../../Source/Processors/Editors/RHD2000Editor.cpp + -@mkdir -p $(OBJDIR) + @echo "Compiling RHD2000Editor.cpp" + @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" + $(OBJDIR)/RecordControlEditor_244084cb.o: ../../Source/Processors/Editors/RecordControlEditor.cpp -@mkdir -p $(OBJDIR) @echo "Compiling RecordControlEditor.cpp" diff --git a/Builds/MacOSX/open-ephys.xcodeproj/project.pbxproj b/Builds/MacOSX/open-ephys.xcodeproj/project.pbxproj index fb7be91eb..093db028d 100644 --- a/Builds/MacOSX/open-ephys.xcodeproj/project.pbxproj +++ b/Builds/MacOSX/open-ephys.xcodeproj/project.pbxproj @@ -65,6 +65,7 @@ ED8CB527B27C67E9E4DA027C = { isa = PBXBuildFile; fileRef = BC3B7E4E25505D9044BFACC7; }; DE758AF46844DF951655966C = { isa = PBXBuildFile; fileRef = B27F558F42AC78F0E564B5AF; }; 80E5365461A5A7A32C48C563 = { isa = PBXBuildFile; fileRef = F94DD42C7BBF81C101D3F605; }; + AF26E388BF6536803E762CB1 = { isa = PBXBuildFile; fileRef = 45D78C8EF660EECE64BAA33F; }; 0CEFF81CD8861F959DB13362 = { isa = PBXBuildFile; fileRef = 1552007C6C6AF750278C5BE5; }; 352F3875222B1D233013AAF9 = { isa = PBXBuildFile; fileRef = 9C39C584DA6F507E773687EE; }; F0EC60AEFAFF3D289F8110BE = { isa = PBXBuildFile; fileRef = C5ABE6BDCA91410BA92A7BD9; }; @@ -415,6 +416,7 @@ 458A112D564ED066211FD482 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_ToneGeneratorAudioSource.cpp"; path = "../../JuceLibraryCode/modules/juce_audio_basics/sources/juce_ToneGeneratorAudioSource.cpp"; sourceTree = "SOURCE_ROOT"; }; 45A66E543B62A2C32AB3BA23 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_AudioDeviceSelectorComponent.h"; path = "../../JuceLibraryCode/modules/juce_audio_utils/gui/juce_AudioDeviceSelectorComponent.h"; sourceTree = "SOURCE_ROOT"; }; 45D440B69BDB210B17CD424B = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_ImageComponent.h"; path = "../../JuceLibraryCode/modules/juce_gui_basics/widgets/juce_ImageComponent.h"; sourceTree = "SOURCE_ROOT"; }; + 45D78C8EF660EECE64BAA33F = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = RHD2000Editor.cpp; path = ../../Source/Processors/Editors/RHD2000Editor.cpp; sourceTree = "SOURCE_ROOT"; }; 4608E765A643BC0CB2C1BB02 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_CriticalSection.h"; path = "../../JuceLibraryCode/modules/juce_core/threads/juce_CriticalSection.h"; sourceTree = "SOURCE_ROOT"; }; 463A302B39C7815EB981CEBD = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_Point.h"; path = "../../JuceLibraryCode/modules/juce_graphics/geometry/juce_Point.h"; sourceTree = "SOURCE_ROOT"; }; 4650B5724FE3C0608FB07A04 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_TextLayout.cpp"; path = "../../JuceLibraryCode/modules/juce_graphics/fonts/juce_TextLayout.cpp"; sourceTree = "SOURCE_ROOT"; }; @@ -945,6 +947,7 @@ BB0BB31575E1377F0C560D53 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_RelativeCoordinate.cpp"; path = "../../JuceLibraryCode/modules/juce_gui_basics/positioning/juce_RelativeCoordinate.cpp"; sourceTree = "SOURCE_ROOT"; }; BB26BA9CFAE8C836251E8EAF = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = MainWindow.h; path = ../../Source/MainWindow.h; sourceTree = "SOURCE_ROOT"; }; BBC386B5A369262583AD4DDA = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_QuickTimeAudioFormat.h"; path = "../../JuceLibraryCode/modules/juce_audio_formats/codecs/juce_QuickTimeAudioFormat.h"; sourceTree = "SOURCE_ROOT"; }; + BBCDE855BD0A58D3779D96A8 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = RHD2000Editor.h; path = ../../Source/Processors/Editors/RHD2000Editor.h; sourceTree = "SOURCE_ROOT"; }; BBD9C2AED6F500D090069007 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = ReferenceNode.cpp; path = ../../Source/Processors/ReferenceNode.cpp; sourceTree = "SOURCE_ROOT"; }; BBDFB328C3D5FC72A0446E6A = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = "juce_graphics.mm"; path = "../../JuceLibraryCode/modules/juce_graphics/juce_graphics.mm"; sourceTree = "SOURCE_ROOT"; }; BBE1DB78E35135B41537DCB5 = { isa = PBXFileReference; lastKnownFileType = file.nib; name = RecentFilesMenuTemplate.nib; path = RecentFilesMenuTemplate.nib; sourceTree = "SOURCE_ROOT"; }; @@ -1384,6 +1387,8 @@ F2FDC07162CAEDE524F09CFC, DA4A6BD7079F2BC73B5035F3 ); name = Visualization; sourceTree = "<group>"; }; 9F16043BF599BCE0C02A00A5 = { isa = PBXGroup; children = ( + 45D78C8EF660EECE64BAA33F, + BBCDE855BD0A58D3779D96A8, 1552007C6C6AF750278C5BE5, 0B2B7732073D56E484950C8D, 9C39C584DA6F507E773687EE, @@ -2715,6 +2720,7 @@ ED8CB527B27C67E9E4DA027C, DE758AF46844DF951655966C, 80E5365461A5A7A32C48C563, + AF26E388BF6536803E762CB1, 0CEFF81CD8861F959DB13362, 352F3875222B1D233013AAF9, F0EC60AEFAFF3D289F8110BE, diff --git a/Builds/VisualStudio2010/open-ephys.vcxproj b/Builds/VisualStudio2010/open-ephys.vcxproj index 4cb4bc311..f1f9cddd8 100644 --- a/Builds/VisualStudio2010/open-ephys.vcxproj +++ b/Builds/VisualStudio2010/open-ephys.vcxproj @@ -173,6 +173,7 @@ <ClCompile Include="..\..\Source\Processors\SpikeDetector.cpp"/> <ClCompile Include="..\..\Source\Processors\AudioNode.cpp"/> <ClCompile Include="..\..\Source\Processors\EventNode.cpp"/> + <ClCompile Include="..\..\Source\Processors\Editors\RHD2000Editor.cpp"/> <ClCompile Include="..\..\Source\Processors\Editors\RecordControlEditor.cpp"/> <ClCompile Include="..\..\Source\Processors\Editors\ReferenceNodeEditor.cpp"/> <ClCompile Include="..\..\Source\Processors\Editors\ResamplingNodeEditor.cpp"/> @@ -1348,6 +1349,7 @@ <ClInclude Include="..\..\Source\Processors\SpikeDetector.h"/> <ClInclude Include="..\..\Source\Processors\AudioNode.h"/> <ClInclude Include="..\..\Source\Processors\EventNode.h"/> + <ClInclude Include="..\..\Source\Processors\Editors\RHD2000Editor.h"/> <ClInclude Include="..\..\Source\Processors\Editors\RecordControlEditor.h"/> <ClInclude Include="..\..\Source\Processors\Editors\ReferenceNodeEditor.h"/> <ClInclude Include="..\..\Source\Processors\Editors\ResamplingNodeEditor.h"/> diff --git a/Builds/VisualStudio2010/open-ephys.vcxproj.filters b/Builds/VisualStudio2010/open-ephys.vcxproj.filters index c661a376e..9993432fe 100644 --- a/Builds/VisualStudio2010/open-ephys.vcxproj.filters +++ b/Builds/VisualStudio2010/open-ephys.vcxproj.filters @@ -490,6 +490,9 @@ <ClCompile Include="..\..\Source\Processors\EventNode.cpp"> <Filter>open-ephys\Source\Processors</Filter> </ClCompile> + <ClCompile Include="..\..\Source\Processors\Editors\RHD2000Editor.cpp"> + <Filter>open-ephys\Source\Processors\Editors</Filter> + </ClCompile> <ClCompile Include="..\..\Source\Processors\Editors\RecordControlEditor.cpp"> <Filter>open-ephys\Source\Processors\Editors</Filter> </ClCompile> @@ -1974,6 +1977,9 @@ <ClInclude Include="..\..\Source\Processors\EventNode.h"> <Filter>open-ephys\Source\Processors</Filter> </ClInclude> + <ClInclude Include="..\..\Source\Processors\Editors\RHD2000Editor.h"> + <Filter>open-ephys\Source\Processors\Editors</Filter> + </ClInclude> <ClInclude Include="..\..\Source\Processors\Editors\RecordControlEditor.h"> <Filter>open-ephys\Source\Processors\Editors</Filter> </ClInclude> diff --git a/Builds/VisualStudio2012/open-ephys.vcxproj b/Builds/VisualStudio2012/open-ephys.vcxproj index 16e151d2d..8ba9ba395 100644 --- a/Builds/VisualStudio2012/open-ephys.vcxproj +++ b/Builds/VisualStudio2012/open-ephys.vcxproj @@ -177,6 +177,7 @@ <ClCompile Include="..\..\Source\Processors\SpikeDetector.cpp"/> <ClCompile Include="..\..\Source\Processors\AudioNode.cpp"/> <ClCompile Include="..\..\Source\Processors\EventNode.cpp"/> + <ClCompile Include="..\..\Source\Processors\Editors\RHD2000Editor.cpp"/> <ClCompile Include="..\..\Source\Processors\Editors\RecordControlEditor.cpp"/> <ClCompile Include="..\..\Source\Processors\Editors\ReferenceNodeEditor.cpp"/> <ClCompile Include="..\..\Source\Processors\Editors\ResamplingNodeEditor.cpp"/> @@ -1352,6 +1353,7 @@ <ClInclude Include="..\..\Source\Processors\SpikeDetector.h"/> <ClInclude Include="..\..\Source\Processors\AudioNode.h"/> <ClInclude Include="..\..\Source\Processors\EventNode.h"/> + <ClInclude Include="..\..\Source\Processors\Editors\RHD2000Editor.h"/> <ClInclude Include="..\..\Source\Processors\Editors\RecordControlEditor.h"/> <ClInclude Include="..\..\Source\Processors\Editors\ReferenceNodeEditor.h"/> <ClInclude Include="..\..\Source\Processors\Editors\ResamplingNodeEditor.h"/> diff --git a/Builds/VisualStudio2012/open-ephys.vcxproj.filters b/Builds/VisualStudio2012/open-ephys.vcxproj.filters index c661a376e..9993432fe 100644 --- a/Builds/VisualStudio2012/open-ephys.vcxproj.filters +++ b/Builds/VisualStudio2012/open-ephys.vcxproj.filters @@ -490,6 +490,9 @@ <ClCompile Include="..\..\Source\Processors\EventNode.cpp"> <Filter>open-ephys\Source\Processors</Filter> </ClCompile> + <ClCompile Include="..\..\Source\Processors\Editors\RHD2000Editor.cpp"> + <Filter>open-ephys\Source\Processors\Editors</Filter> + </ClCompile> <ClCompile Include="..\..\Source\Processors\Editors\RecordControlEditor.cpp"> <Filter>open-ephys\Source\Processors\Editors</Filter> </ClCompile> @@ -1974,6 +1977,9 @@ <ClInclude Include="..\..\Source\Processors\EventNode.h"> <Filter>open-ephys\Source\Processors</Filter> </ClInclude> + <ClInclude Include="..\..\Source\Processors\Editors\RHD2000Editor.h"> + <Filter>open-ephys\Source\Processors\Editors</Filter> + </ClInclude> <ClInclude Include="..\..\Source\Processors\Editors\RecordControlEditor.h"> <Filter>open-ephys\Source\Processors\Editors</Filter> </ClInclude> diff --git a/Source/Processors/Editors/RHD2000Editor.cpp b/Source/Processors/Editors/RHD2000Editor.cpp new file mode 100644 index 000000000..79e36583b --- /dev/null +++ b/Source/Processors/Editors/RHD2000Editor.cpp @@ -0,0 +1,35 @@ +/* + ------------------------------------------------------------------ + + This file is part of the Open Ephys GUI + Copyright (C) 2013 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 "RHD2000Editor.h" + +RHD2000Editor::RHD2000Editor(GenericProcessor* parentNode, bool useDefaultParameterEditors=true) + : GenericEditor(parentNode, useDefaultParameterEditors) +{ + desiredWidth = 600; +} + +RHD2000Editor::~RHD2000Editor() +{ + +} diff --git a/Source/Processors/Editors/RHD2000Editor.h b/Source/Processors/Editors/RHD2000Editor.h new file mode 100644 index 000000000..93c35c385 --- /dev/null +++ b/Source/Processors/Editors/RHD2000Editor.h @@ -0,0 +1,55 @@ +/* + ------------------------------------------------------------------ + + This file is part of the Open Ephys GUI + Copyright (C) 2013 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/>. + +*/ + +#ifndef __RHD2000EDITOR_H_2AD3C591__ +#define __RHD2000EDITOR_H_2AD3C591__ + +#include "../../../JuceLibraryCode/JuceHeader.h" +#include "GenericEditor.h" + +/** + + User interface for the RHD2000 source module. + + @see SourceNode + +*/ + + +class RHD2000Editor : public GenericEditor + +{ +public: + RHD2000Editor(GenericProcessor* parentNode, bool useDefaultParameterEditors); + virtual ~RHD2000Editor(); + +private: + + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(RHD2000Editor); + +}; + + + + +#endif // __RHD2000EDITOR_H_2AD3C591__ diff --git a/Source/Processors/Editors/SourceNodeEditor.h b/Source/Processors/Editors/SourceNodeEditor.h index 57900fa85..5bf07e2bb 100755 --- a/Source/Processors/Editors/SourceNodeEditor.h +++ b/Source/Processors/Editors/SourceNodeEditor.h @@ -28,7 +28,6 @@ #include "GenericEditor.h" #include "ImageIcon.h" -class FilterViewport; class ImageIcon; /** diff --git a/Source/Processors/Editors/VisualizerEditor.cpp b/Source/Processors/Editors/VisualizerEditor.cpp index 38b1dade0..e62ae7026 100755 --- a/Source/Processors/Editors/VisualizerEditor.cpp +++ b/Source/Processors/Editors/VisualizerEditor.cpp @@ -24,10 +24,10 @@ #include "VisualizerEditor.h" SelectorButton::SelectorButton(const String& name_) - : Button(name_) + : Button(name_) { - setClickingTogglesState(true); - setTooltip("Toggle a state."); + setClickingTogglesState (true); + setTooltip ("Toggle a state."); } @@ -35,229 +35,206 @@ SelectorButton::~SelectorButton() { } -void SelectorButton::paintButton(Graphics& g, bool isMouseOver, bool isButtonDown) +void SelectorButton::paintButton(Graphics &g, bool isMouseOver, bool isButtonDown) { if (getToggleState() == true) g.setColour(Colours::white); - else + else g.setColour(Colours::darkgrey); if (isMouseOver) g.setColour(Colours::yellow); - if (getName().equalsIgnoreCase("window")) - { - // window icon - g.drawRect(0,0,getWidth(),getHeight(),1.0); - g.fillRect(0,0,getWidth(),3.0); - } - else - { - // tab icon - g.drawVerticalLine(5,0,getHeight()); - g.fillRoundedRectangle(5,2,4,getHeight()-4,4.0f); - g.fillRect(5,2,4,getHeight()-4); - } - + if (getName().equalsIgnoreCase("window")) + { + // window icon + g.drawRect(0,0,getWidth(),getHeight(),1.0); + g.fillRect(0,0,getWidth(),3.0); + } else { + // tab icon + g.drawVerticalLine(5,0,getHeight()); + g.fillRoundedRectangle(5,2,4,getHeight()-4,4.0f); + g.fillRect(5,2,4,getHeight()-4); + } + } -VisualizerEditor::VisualizerEditor(GenericProcessor* parentNode, int width, bool useDefaultParameterEditors=true) - : GenericEditor(parentNode, useDefaultParameterEditors=true), - dataWindow(0), canvas(0), tabText("Tab"), isPlaying(false), tabIndex(-1) +VisualizerEditor::VisualizerEditor (GenericProcessor* parentNode, int width, bool useDefaultParameterEditors=true) + : GenericEditor(parentNode, useDefaultParameterEditors=true), + dataWindow(0), canvas(0), tabText("Tab"), isPlaying(false), tabIndex(-1) { - desiredWidth = width; + desiredWidth = width; - initializeSelectors(); + initializeSelectors(); } -VisualizerEditor::VisualizerEditor(GenericProcessor* parentNode, bool useDefaultParameterEditors=true) - : GenericEditor(parentNode, useDefaultParameterEditors), - dataWindow(0), canvas(0), isPlaying(false), tabIndex(-1) +VisualizerEditor::VisualizerEditor (GenericProcessor* parentNode, bool useDefaultParameterEditors=true) + : GenericEditor(parentNode, useDefaultParameterEditors), + dataWindow(0), canvas(0), isPlaying(false), tabIndex(-1) { - desiredWidth = 180; - initializeSelectors(); + desiredWidth = 180; + initializeSelectors(); } -void VisualizerEditor::initializeSelectors() -{ - - windowSelector = new SelectorButton("window"); - windowSelector->addListener(this); - windowSelector->setBounds(desiredWidth - 40,7,14,10); +void VisualizerEditor::initializeSelectors(){ - windowSelector->setToggleState(false,false); - addAndMakeVisible(windowSelector); + windowSelector = new SelectorButton("window"); + windowSelector->addListener(this); + windowSelector->setBounds(desiredWidth - 40,7,14,10); - tabSelector = new SelectorButton("tab"); - tabSelector->addListener(this); - tabSelector->setBounds(desiredWidth - 20,7,15,10); + windowSelector->setToggleState(false,false); + addAndMakeVisible(windowSelector); - addAndMakeVisible(tabSelector); - tabSelector->setToggleState(false,false); + tabSelector = new SelectorButton("tab"); + tabSelector->addListener(this); + tabSelector->setBounds(desiredWidth - 20,7,15,10); + + addAndMakeVisible(tabSelector); + tabSelector->setToggleState(false,false); } VisualizerEditor::~VisualizerEditor() { - if (tabIndex > -1) - { - getDataViewport()->destroyTab(tabIndex); - } + if (tabIndex > -1) + { + getDataViewport()->destroyTab(tabIndex); + } - deleteAllChildren(); + deleteAllChildren(); } void VisualizerEditor::enable() { - std::cout << " Enabling VisualizerEditor" << std::endl; - if (canvas != 0) - canvas->beginAnimation(); - - isPlaying = true; + std::cout << " Enabling VisualizerEditor" << std::endl; + if (canvas != 0) + canvas->beginAnimation(); + + isPlaying = true; } void VisualizerEditor::disable() { - if (canvas != 0) - canvas->endAnimation(); + if (canvas != 0) + canvas->endAnimation(); - isPlaying = false; + isPlaying = false; } void VisualizerEditor::updateVisualizer() { - if (canvas != 0) - canvas->update(); + if (canvas != 0) + canvas->update(); } void VisualizerEditor::editorWasClicked() { - if (tabIndex > -1) - { - std::cout << "Setting tab index to " << tabIndex << std::endl; - getDataViewport()->selectTab(tabIndex); - } + if (tabIndex > -1) + { + std::cout << "Setting tab index to " << tabIndex << std::endl; + getDataViewport()->selectTab(tabIndex); + } } void VisualizerEditor::buttonEvent(Button* button) { - int gId = button->getRadioGroupId(); - - if (gId > 0) - { - if (canvas != 0) - { - canvas->setParameter(gId-1, button->getName().getFloatValue()); - } - - } - else - { - - if (canvas == 0) - { - - canvas = createNewCanvas(); - - if (isPlaying) - canvas->beginAnimation(); - } - - if (button == windowSelector) - { - - if (tabSelector->getToggleState() && windowSelector->getToggleState()) - { - tabSelector->setToggleState(false, false); - getDataViewport()->destroyTab(tabIndex); - tabIndex = -1; - } - - // Component* parent = canvas->getParentComponent(); - - // if (parent != nullptr) - // { - // std::cout << "Removing child." << std::endl; - // parent->removeChildComponent(canvas); - // } else { - // std::cout << "Parent doesn't exist." << std::endl; - // } - - if (dataWindow == 0) - { - - dataWindow = new DataWindow(windowSelector, tabText); - dataWindow->setContentNonOwned(canvas, false); - dataWindow->setVisible(true); - canvas->refreshState(); - - } - else - { - - dataWindow->setVisible(windowSelector->getToggleState()); - - if (windowSelector->getToggleState()) - { - dataWindow->setContentNonOwned(canvas, false); - canvas->setBounds(0,0,canvas->getParentWidth(), canvas->getParentHeight()); - canvas->refreshState(); - } - else - { - dataWindow->setContentNonOwned(0, false); - } - - } - - } - else if (button == tabSelector) - { - if (tabSelector->getToggleState() && tabIndex < 0) - { - - if (windowSelector->getToggleState()) - { - dataWindow->setContentNonOwned(0, false); - windowSelector->setToggleState(false, false); - dataWindow->setVisible(false); - } - - tabIndex = getDataViewport()->addTabToDataViewport(tabText, canvas, this); - - - } - else if (!tabSelector->getToggleState() && tabIndex > -1) - { - getDataViewport()->destroyTab(tabIndex); - tabIndex = -1; - - } - } - - } - - buttonCallback(button); - - if (button == drawerButton) - { - std::cout<<"Drawer button clicked"<<std::endl; - windowSelector->setBounds(desiredWidth - 40,7,14,10); - tabSelector->setBounds(desiredWidth - 20,7,15,10); - - } + int gId = button->getRadioGroupId(); + + if (gId > 0) { + if (canvas != 0) + { + canvas->setParameter(gId-1, button->getName().getFloatValue()); + } + + } else { + + if (canvas == 0) { + + canvas = createNewCanvas(); + + if (isPlaying) + canvas->beginAnimation(); + } + + if (button == windowSelector) + { + + if (tabSelector->getToggleState() && windowSelector->getToggleState()) + { + tabSelector->setToggleState(false, false); + getDataViewport()->destroyTab(tabIndex); + tabIndex = -1; + } + + if (dataWindow == 0) { + + dataWindow = new DataWindow(windowSelector, tabText); + dataWindow->setContentNonOwned(canvas, false); + dataWindow->setVisible(true); + canvas->refreshState(); + + } else { + + dataWindow->setVisible(windowSelector->getToggleState()); + + if (windowSelector->getToggleState()) + { + dataWindow->setContentNonOwned(canvas, false); + canvas->setBounds(0,0,canvas->getParentWidth(), canvas->getParentHeight()); + canvas->refreshState(); + } else { + dataWindow->setContentNonOwned(0, false); + } + + } + + } + else if (button == tabSelector) + { + if (tabSelector->getToggleState() && tabIndex < 0) + { + + if (windowSelector->getToggleState()) + { + dataWindow->setContentNonOwned(0, false); + windowSelector->setToggleState(false, false); + dataWindow->setVisible(false); + } + + tabIndex = getDataViewport()->addTabToDataViewport(tabText, canvas, this); + + + } else if (!tabSelector->getToggleState() && tabIndex > -1) + { + getDataViewport()->destroyTab(tabIndex); + tabIndex = -1; + + } + } + + } + + buttonCallback(button); + + if (button == drawerButton) + { + std::cout<<"Drawer button clicked"<<std::endl; + windowSelector->setBounds(desiredWidth - 40,7,14,10); + tabSelector->setBounds(desiredWidth - 20,7,15,10); + + } } diff --git a/Source/Processors/SourceNode.cpp b/Source/Processors/SourceNode.cpp index 86d6c85eb..5cc8d17e4 100755 --- a/Source/Processors/SourceNode.cpp +++ b/Source/Processors/SourceNode.cpp @@ -28,6 +28,7 @@ #include "DataThreads/FileReaderThread.h" #include "DataThreads/RHD2000Thread.h" #include "Editors/SourceNodeEditor.h" +#include "Editors/RHD2000Editor.h" #include "Channel.h" #include <stdio.h> @@ -194,7 +195,15 @@ void SourceNode::setParameter(int parameterIndex, float newValue) AudioProcessorEditor* SourceNode::createEditor() { - editor = new SourceNodeEditor(this, true); + + if (getName().equalsIgnoreCase("RHD2000 USB Board")) + { + editor = new RHD2000Editor(this, false); + } + else + { + editor = new SourceNodeEditor(this, true); + } return editor; } diff --git a/Source/Processors/Visualization/SpikeDisplayCanvas.h b/Source/Processors/Visualization/SpikeDisplayCanvas.h index f1d1ee199..896231d84 100755 --- a/Source/Processors/Visualization/SpikeDisplayCanvas.h +++ b/Source/Processors/Visualization/SpikeDisplayCanvas.h @@ -46,7 +46,7 @@ class WaveformPlot; class ProjectionPlot; /** - + Displays spike waveforms and projections. @see SpikeDisplayNode, SpikeDisplayEditor, Visualizer @@ -56,86 +56,83 @@ class ProjectionPlot; class SpikeDisplayCanvas : public Visualizer { -public: - SpikeDisplayCanvas(SpikeDisplayNode* n); - ~SpikeDisplayCanvas(); +public: + SpikeDisplayCanvas(SpikeDisplayNode* n); + ~SpikeDisplayCanvas(); - void paint(Graphics& g); + void paint(Graphics& g); - void refresh(); + void refresh(); - void processSpikeEvents(); + void processSpikeEvents(); - void beginAnimation(); - void endAnimation(); + void beginAnimation(); + void endAnimation(); - void refreshState(); + void refreshState(); - void setParameter(int, float) {} - void setParameter(int, int, int, float) {} + void setParameter(int, float) {} + void setParameter(int, int, int, float){} - void update(); + void update(); - void resized(); + void resized(); private: - SpikeDisplayNode* processor; - MidiBuffer* spikeBuffer; - - ScopedPointer<SpikeDisplay> spikeDisplay; - ScopedPointer<Viewport> viewport; + SpikeDisplayNode* processor; + MidiBuffer* spikeBuffer; - bool newSpike; - SpikeObject spike; + ScopedPointer<SpikeDisplay> spikeDisplay; + ScopedPointer<Viewport> viewport; - int scrollBarThickness; + bool newSpike; + SpikeObject spike; - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(SpikeDisplayCanvas); + int scrollBarThickness; + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (SpikeDisplayCanvas); + }; class SpikeDisplay : public Component { public: - SpikeDisplay(SpikeDisplayCanvas*, Viewport*); - ~SpikeDisplay(); + SpikeDisplay(SpikeDisplayCanvas*, Viewport*); + ~SpikeDisplay(); - void addSpikePlot(int numChannels); + void addSpikePlot(int numChannels); - void paint(Graphics& g); + void paint(Graphics& g); - void resized(); + void resized(); - void mouseDown(const MouseEvent& event); + void mouseDown(const MouseEvent& event); - void plotSpike(const SpikeObject& spike); + void plotSpike(const SpikeObject& spike); - int getTotalHeight() - { - return totalHeight; - } + int getTotalHeight() {return totalHeight;} private: - //void computeColumnLayout(); - //void initializeSpikePlots(); - //void repositionSpikePlots(); + //void computeColumnLayout(); +//void initializeSpikePlots(); + //void repositionSpikePlots(); - int numColumns; + int numColumns; - int totalHeight; + int totalHeight; - SpikeDisplayCanvas* canvas; - Viewport* viewport; + SpikeDisplayCanvas* canvas; + Viewport* viewport; - OwnedArray<TetrodePlot> tetrodePlots; - OwnedArray<StereotrodePlot> stereotrodePlots; - OwnedArray<SingleElectrodePlot> singleElectrodePlots; + OwnedArray<TetrodePlot> tetrodePlots; + OwnedArray<StereotrodePlot> stereotrodePlots; + OwnedArray<SingleElectrodePlot> singleElectrodePlots; - float tetrodePlotMinWidth, stereotrodePlotMinWidth, singleElectrodePlotMinWidth; - float tetrodePlotRatio, stereotrodePlotRatio, singleElectrodePlotRatio; + float tetrodePlotMinWidth, stereotrodePlotMinWidth, singleElectrodePlotMinWidth; + float tetrodePlotRatio, stereotrodePlotRatio, singleElectrodePlotRatio; }; @@ -143,24 +140,24 @@ private: class SpikePlot : public Component { public: - SpikePlot(SpikeDisplayCanvas*, int elecNum, int numChans); - ~SpikePlot(); + SpikePlot(SpikeDisplayCanvas*, int elecNum, int numChans); + ~SpikePlot(); - void paint(Graphics& g); + void paint(Graphics& g); - void select(); - void deselect(); + void select(); + void deselect(); - SpikeDisplayCanvas* canvas; + SpikeDisplayCanvas* canvas; - bool isSelected; + bool isSelected; - int electrodeNumber; + int electrodeNumber; - int numChannels; + int numChannels; - OwnedArray<ProjectionPlot> projectionPlots; - OwnedArray<WaveformPlot> waveformPlots; + OwnedArray<ProjectionPlot> projectionPlots; + OwnedArray<WaveformPlot> waveformPlots; private: @@ -171,10 +168,10 @@ private: class TetrodePlot : public SpikePlot { public: - TetrodePlot(SpikeDisplayCanvas*, int elecNum); - ~TetrodePlot() {} + TetrodePlot(SpikeDisplayCanvas*, int elecNum); + ~TetrodePlot() {} - void resized(); + void resized(); private: @@ -183,34 +180,34 @@ private: class StereotrodePlot : public SpikePlot { public: - StereotrodePlot(SpikeDisplayCanvas*, int elecNum); - ~StereotrodePlot() {} + StereotrodePlot(SpikeDisplayCanvas*, int elecNum); + ~StereotrodePlot() {} - void resized(); + void resized(); private: - + }; class SingleElectrodePlot : public SpikePlot { public: - SingleElectrodePlot(SpikeDisplayCanvas*, int elecNum); - ~SingleElectrodePlot() {} + SingleElectrodePlot(SpikeDisplayCanvas*, int elecNum); + ~SingleElectrodePlot() {} - void resized(); + void resized(); private: - + }; class WaveformPlot : public Component { public: - WaveformPlot(); - ~WaveformPlot() {} + WaveformPlot(); + ~WaveformPlot() {} - void paint(Graphics& g); + void paint(Graphics& g); private: @@ -219,10 +216,10 @@ private: class ProjectionPlot : public Component { public: - ProjectionPlot(); - ~ProjectionPlot() {} + ProjectionPlot(); + ~ProjectionPlot() {} - void paint(Graphics& g); + void paint(Graphics& g); private: diff --git a/Source/UI/CustomLookAndFeel.cpp b/Source/UI/CustomLookAndFeel.cpp index b4c110b00..0990c9375 100755 --- a/Source/UI/CustomLookAndFeel.cpp +++ b/Source/UI/CustomLookAndFeel.cpp @@ -24,69 +24,68 @@ #include "CustomLookAndFeel.h" CustomLookAndFeel::CustomLookAndFeel() : - // third argument to MIS means don't copy the binary data to make a new stream - cpmonoExtraLightStream(BinaryData::cpmonoextralightserialized, - BinaryData::cpmonoextralightserializedSize, - false), - cpmonoLightStream(BinaryData::cpmonolightserialized, - BinaryData::cpmonolightserializedSize, - false), - cpmonoPlainStream(BinaryData::cpmonoplainserialized, - BinaryData::cpmonoplainserializedSize, - false), - cpmonoBoldStream(BinaryData::cpmonoboldserialized, - BinaryData::cpmonoboldserializedSize, - false), - cpmonoBlackStream(BinaryData::cpmonoblackserialized, - BinaryData::cpmonoblackserializedSize, - false), - misoRegularStream(BinaryData::misoserialized, - BinaryData::misoserializedSize, - false), - silkscreenStream(BinaryData::silkscreenserialized, - BinaryData::silkscreenserializedSize, - false), - // heap allocation is necessary here, because otherwise the typefaces are - // deleted too soon (there's a singleton typefacecache that holds references - // to them whenever they're used). - cpmonoExtraLight(new CustomTypeface(cpmonoExtraLightStream)), - cpmonoLight(new CustomTypeface(cpmonoLightStream)), - cpmonoPlain(new CustomTypeface(cpmonoPlainStream)), - cpmonoBold(new CustomTypeface(cpmonoBoldStream)), - cpmonoBlack(new CustomTypeface(cpmonoBlackStream)), - misoRegular(new CustomTypeface(misoRegularStream)), - silkscreen(new CustomTypeface(silkscreenStream)) + // third argument to MIS means don't copy the binary data to make a new stream + cpmonoExtraLightStream(BinaryData::cpmonoextralightserialized, + BinaryData::cpmonoextralightserializedSize, + false), + cpmonoLightStream(BinaryData::cpmonolightserialized, + BinaryData::cpmonolightserializedSize, + false), + cpmonoPlainStream(BinaryData::cpmonoplainserialized, + BinaryData::cpmonoplainserializedSize, + false), + cpmonoBoldStream(BinaryData::cpmonoboldserialized, + BinaryData::cpmonoboldserializedSize, + false), + cpmonoBlackStream(BinaryData::cpmonoblackserialized, + BinaryData::cpmonoblackserializedSize, + false), + misoRegularStream(BinaryData::misoserialized, + BinaryData::misoserializedSize, + false), + silkscreenStream(BinaryData::silkscreenserialized, + BinaryData::silkscreenserializedSize, + false), + // heap allocation is necessary here, because otherwise the typefaces are + // deleted too soon (there's a singleton typefacecache that holds references + // to them whenever they're used). + cpmonoExtraLight(new CustomTypeface(cpmonoExtraLightStream)), + cpmonoLight(new CustomTypeface(cpmonoLightStream)), + cpmonoPlain(new CustomTypeface(cpmonoPlainStream)), + cpmonoBold(new CustomTypeface(cpmonoBoldStream)), + cpmonoBlack(new CustomTypeface(cpmonoBlackStream)), + misoRegular(new CustomTypeface(misoRegularStream)), + silkscreen(new CustomTypeface(silkscreenStream)) { - // UNCOMMENT AFTER UPDATE - typefaceMap.set(String("Default Extra Light"), cpmonoExtraLight); - typefaceMap.set(String("Default Light"), cpmonoLight); - typefaceMap.set(String("Default"), cpmonoPlain); - typefaceMap.set(String("Default Bold"), cpmonoBold); - typefaceMap.set(String("Default Black"), cpmonoBlack); - typefaceMap.set(String("Miso Serialized"), misoRegular); - typefaceMap.set(String("Silkscreen"), silkscreen); - - enum - { - PROCESSOR_COLOR = 0x801, - FILTER_COLOR = 0x802, - SINK_COLOR = 0x803, - SOURCE_COLOR = 0x804, - UTILITY_COLOR = 0x805, - }; - - setColour(PROCESSOR_COLOR, Colour(59, 59, 59)); - setColour(FILTER_COLOR, Colour(99, 89, 0)); - setColour(SINK_COLOR, Colour(255, 149, 0)); - setColour(SOURCE_COLOR, Colour(255, 0, 0)); - setColour(UTILITY_COLOR, Colour(90, 80, 80)); - - setColour(PopupMenu::backgroundColourId, Colours::darkgrey); - setColour(PopupMenu::textColourId, Colours::white); - setColour(PopupMenu::highlightedBackgroundColourId, Colours::grey); - setColour(PopupMenu::highlightedTextColourId, Colours::yellow); + // UNCOMMENT AFTER UPDATE + // typefaceMap.set(String("Default Extra Light"), cpmonoExtraLight); + // typefaceMap.set(String("Default Light"), cpmonoLight); + // typefaceMap.set(String("Default"), cpmonoPlain); + // typefaceMap.set(String("Default Bold"), cpmonoBold); + // typefaceMap.set(String("Default Black"), cpmonoBlack); + // typefaceMap.set(String("Paragraph"), misoRegular); + // typefaceMap.set(String("Silkscreen"), silkscreen); + + enum { + PROCESSOR_COLOR = 0x801, + FILTER_COLOR = 0x802, + SINK_COLOR = 0x803, + SOURCE_COLOR = 0x804, + UTILITY_COLOR = 0x805, + }; + + setColour(PROCESSOR_COLOR, Colour(59, 59, 59)); + setColour(FILTER_COLOR, Colour(255, 89, 0)); + setColour(SINK_COLOR, Colour(255, 149, 0)); + setColour(SOURCE_COLOR, Colour(255, 0, 0)); + setColour(UTILITY_COLOR, Colour(90, 80, 80)); + + setColour(PopupMenu::backgroundColourId, Colours::darkgrey); + setColour(PopupMenu::textColourId, Colours::white); + setColour(PopupMenu::highlightedBackgroundColourId, Colours::grey); + setColour(PopupMenu::highlightedTextColourId, Colours::yellow); } @@ -96,116 +95,108 @@ CustomLookAndFeel::~CustomLookAndFeel() {} // FONT/TYPEFACE METHODS : //============================================================================== -const Typeface::Ptr CustomLookAndFeel::getTypefaceForFont(const Font& font) +const Typeface::Ptr CustomLookAndFeel::getTypefaceForFont (const Font& font) { String typefaceName = font.getTypefaceName(); // some of these names might be unnecessary, and there may be good ones - // missing. adjust as needed - // if (typefaceName.equalsIgnoreCase("Default Extra Light")) - // { - // return cpmonoExtraLight; - // } else if (typefaceName.equalsIgnoreCase("Default Light")) - // { - // return cpmonoLight; - // } else if (typefaceName.equalsIgnoreCase("Default")) - // { - // return cpmonoPlain; - // } else if (typefaceName.equalsIgnoreCase("Default Bold")) - // { - // return cpmonoBold; - // } else if (typefaceName.equalsIgnoreCase("Default Black")) - // { - // return cpmonoBlack; - // } else if (typefaceName.equalsIgnoreCase("Paragraph")) - // { - // return misoRegular; - // } else if (typefaceName.equalsIgnoreCase("Small Text")) - // { - // return silkscreen; - // } else // default - // { - // return LookAndFeel::getTypefaceForFont(font); - // } - - std::cout << "Looking for typeface named " << typefaceName << std::endl; - - // UNCOMMENT AFTER UPDATE - if (typefaceMap.contains(typefaceName)) + // missing. adjust as needed + if (typefaceName.equalsIgnoreCase("Default Extra Light")) { - std::cout << "Returning custom font." << std::endl; - return typefaceMap[typefaceName]; - } - else + return cpmonoExtraLight; + } else if (typefaceName.equalsIgnoreCase("Default Light")) + { + return cpmonoLight; + } else if (typefaceName.equalsIgnoreCase("Default")) + { + return cpmonoPlain; + } else if (typefaceName.equalsIgnoreCase("Default Bold")) + { + return cpmonoBold; + } else if (typefaceName.equalsIgnoreCase("Default Black")) + { + return cpmonoBlack; + } else if (typefaceName.equalsIgnoreCase("Paragraph")) + { + return misoRegular; + } else if (typefaceName.equalsIgnoreCase("Small Text")) + { + return silkscreen; + } else // default { - std::cout << "Returning standard font." << std::endl; return LookAndFeel::getTypefaceForFont(font); } + + // UNCOMMENT AFTER UPDATE + // if (typefaceMap.contains(typefaceName)) + // return typefaceMap[typefaceName]; + // else + // return LookAndFeel::getTypefaceForFont(font); } //================================================================== -// SCROLL BAR METHODS : +// SCROLL BAR METHODS : //================================================================== -void CustomLookAndFeel::drawScrollbarButton(Graphics& g, - ScrollBar& scrollbar, - int width, int height, - int buttonDirection, - bool isScrollBarVertical, - bool isMouseOverButton, - bool isButtonDown) +void CustomLookAndFeel::drawScrollbarButton (Graphics& g, + ScrollBar& scrollbar, + int width, int height, + int buttonDirection, + bool isScrollBarVertical, + bool isMouseOverButton, + bool isButtonDown) { - Path p; + Path p; - float w1 = 0.25f; - float w2 = 0.75f; + float w1 = 0.25f; + float w2 = 0.75f; if (buttonDirection == 0) - p.addTriangle(width * 0.5f, height * 0.2f, - width * w1, height * 0.7f, - width * w2, height * 0.7f); + p.addTriangle (width * 0.5f, height * 0.2f, + width * w1, height * 0.7f, + width * w2, height * 0.7f); else if (buttonDirection == 1) - p.addTriangle(width * 0.8f, height * 0.5f, - width * 0.3f, height * w1, - width * 0.3f, height * w2); + p.addTriangle (width * 0.8f, height * 0.5f, + width * 0.3f, height * w1, + width * 0.3f, height * w2); else if (buttonDirection == 2) - p.addTriangle(width * 0.5f, height * 0.8f, - width * w1, height * 0.3f, - width * w2, height * 0.3f); + p.addTriangle (width * 0.5f, height * 0.8f, + width * w1, height * 0.3f, + width * w2, height * 0.3f); else if (buttonDirection == 3) - p.addTriangle(width * 0.2f, height * 0.5f, - width * 0.7f, height * w1, - width * 0.7f, height * w2); + p.addTriangle (width * 0.2f, height * 0.5f, + width * 0.7f, height * w1, + width * 0.7f, height * w2); if (isButtonDown) - g.setColour(Colours::white); + g.setColour (Colours::white); else - g.setColour(Colours::darkgrey); + g.setColour (Colours::darkgrey); - g.fillPath(p); + g.fillPath (p); if (isMouseOverButton) - g.strokePath(p, PathStrokeType(1.0f)); - + g.strokePath (p, PathStrokeType (1.0f)); + } -void CustomLookAndFeel::drawScrollbar(Graphics& g, - ScrollBar& scrollbar, - int x, int y, - int width, int height, - bool isScrollbarVertical, - int thumbStartPosition, - int thumbSize, - bool isMouseOver, - bool isMouseDown) - -{ +void CustomLookAndFeel::drawScrollbar (Graphics& g, + ScrollBar& scrollbar, + int x, int y, + int width, int height, + bool isScrollbarVertical, + int thumbStartPosition, + int thumbSize, + bool isMouseOver, + bool isMouseDown) + + { Path thumbPath; - const float slotIndent = jmin(width, height) > 15 ? 1.0f : 0.0f; + const float slotIndent = jmin (width, height) > 15 ? 1.0f : 0.0f; const float thumbIndent = slotIndent + 4.0f; const float thumbIndentx2 = thumbIndent * 2.0f; @@ -213,49 +204,49 @@ void CustomLookAndFeel::drawScrollbar(Graphics& g, { if (thumbSize > 0) - thumbPath.addRoundedRectangle(x + thumbIndent, - thumbStartPosition + thumbIndent, - width - thumbIndentx2, - thumbSize - thumbIndentx2, - (width - thumbIndentx2) * 0.3f); + thumbPath.addRoundedRectangle (x + thumbIndent, + thumbStartPosition + thumbIndent, + width - thumbIndentx2, + thumbSize - thumbIndentx2, + (width - thumbIndentx2) * 0.3f); } else { - + if (thumbSize > 0) - thumbPath.addRoundedRectangle(thumbStartPosition + thumbIndent, - y + thumbIndent, - thumbSize - thumbIndentx2, - height - thumbIndentx2, - (height - thumbIndentx2) * 0.3f); + thumbPath.addRoundedRectangle (thumbStartPosition + thumbIndent, + y + thumbIndent, + thumbSize - thumbIndentx2, + height - thumbIndentx2, + (height - thumbIndentx2) * 0.3f); } + + g.setColour (Colours::darkgrey); + g.fillPath (thumbPath); - g.setColour(Colours::darkgrey); - g.fillPath(thumbPath); - -} + } //================================================================== -// SLIDER METHODS : +// SLIDER METHODS : //================================================================== -void CustomLookAndFeel::drawLinearSliderThumb(Graphics& g, - int x, int y, - int width, int height, - float sliderPos, - float minSliderPos, - float maxSliderPos, - const Slider::SliderStyle style, - Slider& slider) +void CustomLookAndFeel::drawLinearSliderThumb (Graphics& g, + int x, int y, + int width, int height, + float sliderPos, + float minSliderPos, + float maxSliderPos, + const Slider::SliderStyle style, + Slider& slider) { - const float sliderRadius = (float)(getSliderThumbRadius(slider) - 2); + const float sliderRadius = (float) (getSliderThumbRadius (slider) - 2); - Colour knobColour(Colours::darkgrey); //LookAndFeelHelpers::createBaseColour (slider.findColour (Slider::thumbColourId), - // slider.hasKeyboardFocus (false) && slider.isEnabled(), - // slider.isMouseOverOrDragging() && slider.isEnabled(), - // slider.isMouseButtonDown() && slider.isEnabled())); + Colour knobColour (Colours::darkgrey);//LookAndFeelHelpers::createBaseColour (slider.findColour (Slider::thumbColourId), + // slider.hasKeyboardFocus (false) && slider.isEnabled(), + // slider.isMouseOverOrDragging() && slider.isEnabled(), + // slider.isMouseButtonDown() && slider.isEnabled())); const float outlineThickness = slider.isEnabled() ? 2.0f : 0.5f; @@ -274,209 +265,209 @@ void CustomLookAndFeel::drawLinearSliderThumb(Graphics& g, ky = y + height * 0.5f; } - drawSliderKnob(g, - kx - sliderRadius, - ky - sliderRadius, - sliderRadius * 2.0f, - knobColour, outlineThickness); + drawSliderKnob (g, + kx - sliderRadius, + ky - sliderRadius, + sliderRadius * 2.0f, + knobColour, outlineThickness); } else { if (style == Slider::ThreeValueVertical) { - drawSliderKnob(g, x + width * 0.5f - sliderRadius, - sliderPos - sliderRadius, - sliderRadius * 2.0f, - knobColour, outlineThickness); + drawSliderKnob (g, x + width * 0.5f - sliderRadius, + sliderPos - sliderRadius, + sliderRadius * 2.0f, + knobColour, outlineThickness); } else if (style == Slider::ThreeValueHorizontal) { - drawSliderKnob(g,sliderPos - sliderRadius, - y + height * 0.5f - sliderRadius, - sliderRadius * 2.0f, - knobColour, outlineThickness); + drawSliderKnob (g,sliderPos - sliderRadius, + y + height * 0.5f - sliderRadius, + sliderRadius * 2.0f, + knobColour, outlineThickness); } if (style == Slider::TwoValueVertical || style == Slider::ThreeValueVertical) { - const float sr = jmin(sliderRadius, width * 0.4f); + const float sr = jmin (sliderRadius, width * 0.4f); - drawGlassPointer(g, jmax(0.0f, x + width * 0.5f - sliderRadius * 2.0f), - minSliderPos - sliderRadius, - sliderRadius * 2.0f, knobColour, outlineThickness, 1); + drawGlassPointer (g, jmax (0.0f, x + width * 0.5f - sliderRadius * 2.0f), + minSliderPos - sliderRadius, + sliderRadius * 2.0f, knobColour, outlineThickness, 1); - drawGlassPointer(g, jmin(x + width - sliderRadius * 2.0f, x + width * 0.5f), maxSliderPos - sr, - sliderRadius * 2.0f, knobColour, outlineThickness, 3); + drawGlassPointer (g, jmin (x + width - sliderRadius * 2.0f, x + width * 0.5f), maxSliderPos - sr, + sliderRadius * 2.0f, knobColour, outlineThickness, 3); } else if (style == Slider::TwoValueHorizontal || style == Slider::ThreeValueHorizontal) { - const float sr = jmin(sliderRadius, height * 0.4f); + const float sr = jmin (sliderRadius, height * 0.4f); - drawGlassPointer(g, minSliderPos - sr, - jmax(0.0f, y + height * 0.5f - sliderRadius * 2.0f), - sliderRadius * 2.0f, knobColour, outlineThickness, 2); + drawGlassPointer (g, minSliderPos - sr, + jmax (0.0f, y + height * 0.5f - sliderRadius * 2.0f), + sliderRadius * 2.0f, knobColour, outlineThickness, 2); - drawGlassPointer(g, maxSliderPos - sliderRadius, - jmin(y + height - sliderRadius * 2.0f, y + height * 0.5f), - sliderRadius * 2.0f, knobColour, outlineThickness, 4); + drawGlassPointer (g, maxSliderPos - sliderRadius, + jmin (y + height - sliderRadius * 2.0f, y + height * 0.5f), + sliderRadius * 2.0f, knobColour, outlineThickness, 4); } } } -void CustomLookAndFeel::drawLinearSliderBackground(Graphics& g, - int x, int y, - int width, int height, - float sliderPos, - float minSliderPos, - float maxSliderPos, - const Slider::SliderStyle /*style*/, - Slider& slider) +void CustomLookAndFeel::drawLinearSliderBackground (Graphics& g, + int x, int y, + int width, int height, + float sliderPos, + float minSliderPos, + float maxSliderPos, + const Slider::SliderStyle /*style*/, + Slider& slider) { - const float sliderRadius = (float)(getSliderThumbRadius(slider) - 2); + const float sliderRadius = (float) (getSliderThumbRadius (slider) - 2); Path indent; - // Path backgroundPath; + // Path backgroundPath; if (slider.isHorizontal()) { const float iy = y + height * 0.5f - sliderRadius * 0.5f; const float ih = sliderRadius; - indent.addRoundedRectangle(x - sliderRadius * 0.5f, iy, - width + sliderRadius, ih, - 5.0f); + indent.addRoundedRectangle (x - sliderRadius * 0.5f, iy, + width + sliderRadius, ih, + 5.0f); - // backgroundPath.addRoundedRectangle (x - sliderRadius * 0.5f, iy, - // (width + sliderRadius)*minSliderPos, ih, - // 5.0f); + // backgroundPath.addRoundedRectangle (x - sliderRadius * 0.5f, iy, + // (width + sliderRadius)*minSliderPos, ih, + // 5.0f); - // g.setColour(Colours::orange); - // g.fillPath (backgroundPath); + // g.setColour(Colours::orange); + // g.fillPath (backgroundPath); } else { const float ix = x + width * 0.5f - sliderRadius * 0.5f; const float iw = sliderRadius; - indent.addRoundedRectangle(ix, y - sliderRadius * 0.5f, - iw, height + sliderRadius, - 5.0f); + indent.addRoundedRectangle (ix, y - sliderRadius * 0.5f, + iw, height + sliderRadius, + 5.0f); - // backgroundPath.addRoundedRectangle (ix, y - sliderRadius * 0.5f, - // iw, (height + sliderRadius)*sliderPos, - // 5.0f); + // backgroundPath.addRoundedRectangle (ix, y - sliderRadius * 0.5f, + // iw, (height + sliderRadius)*sliderPos, + // 5.0f); - // g.setColour(Colours::orange); - // g.fillPath (backgroundPath); + // g.setColour(Colours::orange); + // g.fillPath (backgroundPath); //g.fillPath (indent); } - g.setColour(Colours::darkgrey); - g.strokePath(indent, PathStrokeType(0.5f)); + g.setColour (Colours::darkgrey); + g.strokePath (indent, PathStrokeType (0.5f)); } -int CustomLookAndFeel::getSliderThumbRadius(Slider& slider) +int CustomLookAndFeel::getSliderThumbRadius (Slider& slider) { - return jmin(7, - slider.getHeight() / 2, - slider.getWidth() / 2) + 2; + return jmin (7, + slider.getHeight() / 2, + slider.getWidth() / 2) + 2; } -void CustomLookAndFeel::drawSliderKnob(Graphics& g, - const float x, const float y, - const float diameter, - const Colour& colour, - const float outlineThickness) throw() +void CustomLookAndFeel::drawSliderKnob (Graphics& g, + const float x, const float y, + const float diameter, + const Colour& colour, + const float outlineThickness) throw() { if (diameter <= outlineThickness) return; g.setColour(Colours::darkgrey); + + g.fillEllipse (x, y, diameter, diameter); - g.fillEllipse(x, y, diameter, diameter); - - g.setColour(Colours::black); - g.drawEllipse(x, y, diameter, diameter, outlineThickness); + g.setColour(Colours::black); + g.drawEllipse (x, y, diameter, diameter, outlineThickness); } -void CustomLookAndFeel::drawGlassPointer(Graphics& g, - const float x, const float y, - const float diameter, - const Colour& colour, const float outlineThickness, - const int direction) throw() +void CustomLookAndFeel::drawGlassPointer (Graphics& g, + const float x, const float y, + const float diameter, + const Colour& colour, const float outlineThickness, + const int direction) throw() { if (diameter <= outlineThickness) return; Path p; - p.startNewSubPath(x + diameter * 0.5f, y); - p.lineTo(x + diameter, y + diameter * 0.6f); - p.lineTo(x + diameter, y + diameter); - p.lineTo(x, y + diameter); - p.lineTo(x, y + diameter * 0.6f); + p.startNewSubPath (x + diameter * 0.5f, y); + p.lineTo (x + diameter, y + diameter * 0.6f); + p.lineTo (x + diameter, y + diameter); + p.lineTo (x, y + diameter); + p.lineTo (x, y + diameter * 0.6f); p.closeSubPath(); - p.applyTransform(AffineTransform::rotation(direction * (float_Pi * 0.5f), x + diameter * 0.5f, y + diameter * 0.5f)); + p.applyTransform (AffineTransform::rotation (direction * (float_Pi * 0.5f), x + diameter * 0.5f, y + diameter * 0.5f)); { - ColourGradient cg(Colours::white.overlaidWith(colour.withMultipliedAlpha(0.3f)), 0, y, - Colours::white.overlaidWith(colour.withMultipliedAlpha(0.3f)), 0, y + diameter, false); + ColourGradient cg (Colours::white.overlaidWith (colour.withMultipliedAlpha (0.3f)), 0, y, + Colours::white.overlaidWith (colour.withMultipliedAlpha (0.3f)), 0, y + diameter, false); - cg.addColour(0.4, Colours::white.overlaidWith(colour)); + cg.addColour (0.4, Colours::white.overlaidWith (colour)); - g.setGradientFill(cg); - g.fillPath(p); + g.setGradientFill (cg); + g.fillPath (p); } - ColourGradient cg(Colours::transparentBlack, - x + diameter * 0.5f, y + diameter * 0.5f, - Colours::black.withAlpha(0.5f * outlineThickness * colour.getFloatAlpha()), - x - diameter * 0.2f, y + diameter * 0.5f, true); + ColourGradient cg (Colours::transparentBlack, + x + diameter * 0.5f, y + diameter * 0.5f, + Colours::black.withAlpha (0.5f * outlineThickness * colour.getFloatAlpha()), + x - diameter * 0.2f, y + diameter * 0.5f, true); - cg.addColour(0.5, Colours::transparentBlack); - cg.addColour(0.7, Colours::black.withAlpha(0.07f * outlineThickness)); + cg.addColour (0.5, Colours::transparentBlack); + cg.addColour (0.7, Colours::black.withAlpha (0.07f * outlineThickness)); - g.setGradientFill(cg); - g.fillPath(p); + g.setGradientFill (cg); + g.fillPath (p); - g.setColour(Colours::black.withAlpha(0.5f * colour.getFloatAlpha())); - g.strokePath(p, PathStrokeType(outlineThickness)); + g.setColour (Colours::black.withAlpha (0.5f * colour.getFloatAlpha())); + g.strokePath (p, PathStrokeType (outlineThickness)); } /// ------ combo box ---------------/// -void CustomLookAndFeel::drawComboBox(Graphics& g, int width, int height, - const bool isButtonDown, - int buttonX, int buttonY, - int buttonW, int buttonH, - ComboBox& box) +void CustomLookAndFeel::drawComboBox (Graphics& g, int width, int height, + const bool isButtonDown, + int buttonX, int buttonY, + int buttonW, int buttonH, + ComboBox& box) { - g.fillAll(Colours::lightgrey); //box.findColour (ComboBox::backgroundColourId)); + g.fillAll (Colours::lightgrey);//box.findColour (ComboBox::backgroundColourId)); - if (box.isEnabled() && box.hasKeyboardFocus(false)) + if (box.isEnabled() && box.hasKeyboardFocus (false)) { - g.setColour(Colours::lightgrey); //box.findColour (TextButton::buttonColourId)); - g.drawRect(0, 0, width, height, 2); + g.setColour (Colours::lightgrey);//box.findColour (TextButton::buttonColourId)); + g.drawRect (0, 0, width, height, 2); } else { - g.setColour(box.findColour(ComboBox::outlineColourId)); - g.drawRect(0, 0, width, height); + g.setColour (box.findColour (ComboBox::outlineColourId)); + g.drawRect (0, 0, width, height); } const float outlineThickness = box.isEnabled() ? (isButtonDown ? 1.2f : 0.5f) : 0.3f; - const Colour baseColour(Colours::orange);/*LookAndFeelHelpers::createBaseColour (box.findColour (ComboBox::buttonColourId), + const Colour baseColour (Colours::orange);/*LookAndFeelHelpers::createBaseColour (box.findColour (ComboBox::buttonColourId), box.hasKeyboardFocus (true), false, isButtonDown) .withMultipliedAlpha (box.isEnabled() ? 1.0f : 0.5f));*/ - drawGlassLozenge(g, - buttonX + outlineThickness, buttonY + outlineThickness, - buttonW - outlineThickness * 2.0f, buttonH - outlineThickness * 2.0f, - baseColour, outlineThickness, -1.0f, - true, true, true, true); + drawGlassLozenge (g, + buttonX + outlineThickness, buttonY + outlineThickness, + buttonW - outlineThickness * 2.0f, buttonH - outlineThickness * 2.0f, + baseColour, outlineThickness, -1.0f, + true, true, true, true); if (box.isEnabled()) { @@ -484,16 +475,16 @@ void CustomLookAndFeel::drawComboBox(Graphics& g, int width, int height, const float arrowH = 0.2f; Path p; - p.addTriangle(buttonX + buttonW * 0.5f, buttonY + buttonH * (0.45f - arrowH), - buttonX + buttonW * (1.0f - arrowX), buttonY + buttonH * 0.45f, - buttonX + buttonW * arrowX, buttonY + buttonH * 0.45f); + p.addTriangle (buttonX + buttonW * 0.5f, buttonY + buttonH * (0.45f - arrowH), + buttonX + buttonW * (1.0f - arrowX), buttonY + buttonH * 0.45f, + buttonX + buttonW * arrowX, buttonY + buttonH * 0.45f); - p.addTriangle(buttonX + buttonW * 0.5f, buttonY + buttonH * (0.55f + arrowH), - buttonX + buttonW * (1.0f - arrowX), buttonY + buttonH * 0.55f, - buttonX + buttonW * arrowX, buttonY + buttonH * 0.55f); + p.addTriangle (buttonX + buttonW * 0.5f, buttonY + buttonH * (0.55f + arrowH), + buttonX + buttonW * (1.0f - arrowX), buttonY + buttonH * 0.55f, + buttonX + buttonW * arrowX, buttonY + buttonH * 0.55f); - g.setColour(box.findColour(ComboBox::arrowColourId)); - g.fillPath(p); + g.setColour (box.findColour (ComboBox::arrowColourId)); + g.fillPath (p); } diff --git a/open-ephys.jucer b/open-ephys.jucer index 53c14b60e..0acde5af3 100644 --- a/open-ephys.jucer +++ b/open-ephys.jucer @@ -307,6 +307,9 @@ <FILE id="hGnGAjh" name="EventNode.cpp" compile="1" resource="0" file="Source/Processors/EventNode.cpp"/> <FILE id="dUtRN6" name="EventNode.h" compile="0" resource="0" file="Source/Processors/EventNode.h"/> <GROUP id="AqvwO6w" name="Editors"> + <FILE id="Xy7AJu" name="RHD2000Editor.cpp" compile="1" resource="0" + file="Source/Processors/Editors/RHD2000Editor.cpp"/> + <FILE id="TKVa9h" name="RHD2000Editor.h" compile="0" resource="0" file="Source/Processors/Editors/RHD2000Editor.h"/> <FILE id="3P8oDf3" name="RecordControlEditor.cpp" compile="1" resource="0" file="Source/Processors/Editors/RecordControlEditor.cpp"/> <FILE id="hFb27ev" name="RecordControlEditor.h" compile="0" resource="0" -- GitLab