diff --git a/Source/UI/ProcessorList.cpp b/Source/UI/ProcessorList.cpp index a1bd6436994c006f0e5e49181ec3316cc3048d56..adedd49d01a43b9b4cb142632033740f1fdcc707 100755 --- a/Source/UI/ProcessorList.cpp +++ b/Source/UI/ProcessorList.cpp @@ -28,6 +28,11 @@ #include "UIComponent.h" #include "../AccessClass.h" +ProcessorListItem* sources = new ProcessorListItem("Sources"); +ProcessorListItem* filters = new ProcessorListItem("Filters"); +ProcessorListItem* sinks = new ProcessorListItem("Sinks"); +ProcessorListItem* utilities = new ProcessorListItem("Utilities"); + enum colorIds { PROCESSOR_COLOR = 801, @@ -51,51 +56,47 @@ ProcessorList::ProcessorList() setColour(SOURCE_COLOR, Colour(241, 90, 41)); setColour(UTILITY_COLOR, Colour(147, 149, 152)); - ProcessorListItem* sources = new ProcessorListItem("Sources"); //sources->addSubItem(new ProcessorListItem("RHA2000-EVAL")); //sources->addSubItem(new ProcessorListItem("Signal Generator")); //sources->addSubItem(new ProcessorListItem("Custom FPGA")); - sources->addSubItem(new ProcessorListItem("Rhythm FPGA")); +// sources->addSubItem(new ProcessorListItem("Rhythm FPGA")); #if JUCE_WINDOWS // eCube module currently only available for Windows #ifdef ECUBE_COMPILE - sources->addSubItem(new ProcessorListItem("eCube")); // Added by Michael Borisov +// sources->addSubItem(new ProcessorListItem("eCube")); // Added by Michael Borisov #endif #endif - sources->addSubItem(new ProcessorListItem("File Reader")); +// sources->addSubItem(new ProcessorListItem("File Reader")); #ifdef ZEROMQ - sources->addSubItem(new ProcessorListItem("Network Events")); +// sources->addSubItem(new ProcessorListItem("Network Events")); #endif - sources->addSubItem(new ProcessorListItem("Serial Port")); +// sources->addSubItem(new ProcessorListItem("Serial Port")); //sources->addSubItem(new ProcessorListItem("Event Generator")); - ProcessorListItem* filters = new ProcessorListItem("Filters"); - filters->addSubItem(new ProcessorListItem("Bandpass Filter")); - filters->addSubItem(new ProcessorListItem("Spike Detector")); - filters->addSubItem(new ProcessorListItem("Spike Sorter")); +// filters->addSubItem(new ProcessorListItem("Bandpass Filter")); +// filters->addSubItem(new ProcessorListItem("Spike Detector")); +// filters->addSubItem(new ProcessorListItem("Spike Sorter")); //filters->addSubItem(new ProcessorListItem("Resampler")); - filters->addSubItem(new ProcessorListItem("Phase Detector")); +// filters->addSubItem(new ProcessorListItem("Phase Detector")); //filters->addSubItem(new ProcessorListItem("Digital Ref")); - filters->addSubItem(new ProcessorListItem("Channel Map")); - filters->addSubItem(new ProcessorListItem("Common Avg Ref")); - filters->addSubItem(new ProcessorListItem("Rectifier")); +// filters->addSubItem(new ProcessorListItem("Channel Map")); +// filters->addSubItem(new ProcessorListItem("Common Avg Ref")); +// filters->addSubItem(new ProcessorListItem("Rectifier")); //filters->addSubItem(new ProcessorListItem("Eye Tracking")); - ProcessorListItem* sinks = new ProcessorListItem("Sinks"); - sinks->addSubItem(new ProcessorListItem("LFP Viewer")); +// sinks->addSubItem(new ProcessorListItem("LFP Viewer")); //sinks->addSubItem(new ProcessorListItem("LFP Trig. Avg.")); - sinks->addSubItem(new ProcessorListItem("Spike Viewer")); - sinks->addSubItem(new ProcessorListItem("PSTH")); +// sinks->addSubItem(new ProcessorListItem("Spike Viewer")); +// sinks->addSubItem(new ProcessorListItem("PSTH")); //sinks->addSubItem(new ProcessorListItem("Network Sink")); //sinks->addSubItem(new ProcessorListItem("WiFi Output")); - sinks->addSubItem(new ProcessorListItem("Arduino Output")); +// sinks->addSubItem(new ProcessorListItem("Arduino Output")); // sinks->addSubItem(new ProcessorListItem("FPGA Output")); - sinks->addSubItem(new ProcessorListItem("Pulse Pal")); +// sinks->addSubItem(new ProcessorListItem("Pulse Pal")); - ProcessorListItem* utilities = new ProcessorListItem("Utilities"); - utilities->addSubItem(new ProcessorListItem("Splitter")); - utilities->addSubItem(new ProcessorListItem("Merger")); - utilities->addSubItem(new ProcessorListItem("Record Control")); +// utilities->addSubItem(new ProcessorListItem("Splitter")); +// utilities->addSubItem(new ProcessorListItem("Merger")); +// utilities->addSubItem(new ProcessorListItem("Record Control")); //utilities->addSubItem(new ProcessorListItem("Advancers")); baseItem = new ProcessorListItem("Processors"); @@ -762,3 +763,21 @@ void ProcessorListItem::setParentName(const String& name) // } else { // color = Colour(20, 37, 92); // } + +/* + Insert selected plugin into the processor list + */ +void ProcessorList::sortAndInsertProcessor(const String& processorPath, const String& processorName) +{ + + int cnt = 3; + + if(processorPath.containsIgnoreCase("sources")) + sources->addSubItem(new ProcessorListItem(processorName.dropLastCharacters(cnt))); + else if(processorPath.containsIgnoreCase("filters")) + sources->addSubItem(new ProcessorListItem(processorName.dropLastCharacters(cnt))); + else if(processorPath.containsIgnoreCase("sinks")) + sources->addSubItem(new ProcessorListItem(processorName.dropLastCharacters(cnt))); + else if(processorPath.containsIgnoreCase("utilities")) + sources->addSubItem(new ProcessorListItem(processorName.dropLastCharacters(cnt))); +} diff --git a/Source/UI/ProcessorList.h b/Source/UI/ProcessorList.h index c140a73d962e2696b1e275943f1953fbdc5c2e5e..f9176e0a61b4f8d2f8cf4864531e1f9131e407b0 100755 --- a/Source/UI/ProcessorList.h +++ b/Source/UI/ProcessorList.h @@ -81,6 +81,9 @@ public: void resized(); + /** Sort and add processor to list */ + void sortAndInsertProcessor(const String& processorPath, const String& processorName); + /** Returns the height requested by the ProcessorList. Determines whether or not to draw scroll bars.*/ int getTotalHeight(); diff --git a/Source/UI/UIComponent.cpp b/Source/UI/UIComponent.cpp index 3334531fea34f84909f3c082467715d73a81a62a..66b080ad7c10c27a5489cae6aea774ed537e0f6b 100755 --- a/Source/UI/UIComponent.cpp +++ b/Source/UI/UIComponent.cpp @@ -289,6 +289,8 @@ PopupMenu UIComponent::getMenuForIndex(int menuIndex, const String& menuName) menu.addCommandItem(commandManager, saveConfiguration); menu.addCommandItem(commandManager, saveConfigurationAs); menu.addSeparator(); + menu.addCommandItem(commandManager, loadProcessor); + menu.addSeparator(); menu.addCommandItem(commandManager, reloadOnStartup); #if !JUCE_MAC @@ -347,6 +349,7 @@ void UIComponent::getAllCommands(Array <CommandID>& commands) const CommandID ids[] = {openConfiguration, saveConfiguration, saveConfigurationAs, + loadProcessor, reloadOnStartup, undo, redo, @@ -387,6 +390,11 @@ void UIComponent::getCommandInfo(CommandID commandID, ApplicationCommandInfo& re result.addDefaultKeypress('S', ModifierKeys::commandModifier | ModifierKeys::shiftModifier); break; + case loadProcessor: + result.setInfo("Load processor...", "Load a custom compiled processor.", "General", 0); + result.addDefaultKeypress('L', ModifierKeys::commandModifier); + break; + case reloadOnStartup: result.setInfo("Reload on startup", "Load the last used configuration on startup.", "General", 0); result.setActive(!acquisitionStarted); @@ -531,6 +539,34 @@ bool UIComponent::perform(const InvocationInfo& info) break; } + case loadProcessor: + { + + // Load UI for choosing plugin + File pluginFile; + FileChooser fc("Choose the file name...", + File::getCurrentWorkingDirectory(), + "*", + true); + + // Store user input + if(fc.browseForFileToOpen()) + pluginFile = fc.getResult(); + else + { + return "No processor selected."; + break; + } + + // UI Status string + String error = "Loaded "; + error += pluginFile.getFileName(); + + // Add to processor list + getProcessorList()->sortAndInsertProcessor(pluginFile.getFullPathName(), pluginFile.getFileName()); + break; + } + case reloadOnStartup: { mainWindow->shouldReloadOnStartup = !mainWindow->shouldReloadOnStartup; diff --git a/Source/UI/UIComponent.h b/Source/UI/UIComponent.h index 9e6f8576d03d53257863416f1a59e5380b01e2d8..3950241f390cd22735ba3d490b8a0b1eb93d267e 100755 --- a/Source/UI/UIComponent.h +++ b/Source/UI/UIComponent.h @@ -210,7 +210,8 @@ private: showHelp = 0x2011, resizeWindow = 0x2012, reloadOnStartup = 0x2013, - saveConfigurationAs = 0x2014 + saveConfigurationAs = 0x2014, + loadProcessor = 0x2015 }; File currentConfigFile;