Skip to content
Snippets Groups Projects
Commit f340a6bb authored by Yogi's avatar Yogi
Browse files

adding function to load items into processor list based off of name

parent 41ccd058
No related branches found
No related tags found
No related merge requests found
......@@ -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)));
}
......@@ -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();
......
......@@ -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;
......
......@@ -210,7 +210,8 @@ private:
showHelp = 0x2011,
resizeWindow = 0x2012,
reloadOnStartup = 0x2013,
saveConfigurationAs = 0x2014
saveConfigurationAs = 0x2014,
loadProcessor = 0x2015
};
File currentConfigFile;
......
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