@@ -608,7 +608,6 @@ CabbageXYController(XYPadAutomation* xyAuto, | |||
caption=""; | |||
groupbox = new GroupComponent(String("groupbox_")+name); | |||
groupbox->setWantsKeyboardFocus(false); | |||
Logger::writeToLog(text); | |||
xypad = new XYPad(xyAuto, text, minX, maxX, minY, maxY, dec, Colour::fromString(colour), Colour::fromString(fontcolour), xValue, yValue); | |||
xypad->setWantsKeyboardFocus(false); | |||
addAndMakeVisible(xypad); | |||
@@ -32,6 +32,96 @@ | |||
#include "CabbageUtils.h" | |||
namespace CabbageIDs | |||
{ | |||
static const Identifier top = "top"; | |||
static const Identifier left = "left"; | |||
static const Identifier width = "width"; | |||
static const Identifier height = "height"; | |||
static const Identifier min = "min"; | |||
static const Identifier max = "max"; | |||
static const Identifier value = "value"; | |||
static const Identifier channel = "channel"; | |||
static const Identifier colour = "colour"; | |||
static const Identifier tablecolour = "tablecolour"; | |||
static const Identifier fontcolour= "fontcolour"; | |||
static const Identifier items = "items"; | |||
static const Identifier text = "text"; | |||
static const Identifier range = "range"; | |||
static const Identifier sliderrange = "sliderrange"; | |||
static const Identifier amprange = "amprange"; | |||
static const Identifier caption = "caption"; | |||
static const Identifier basetype = "basetype"; | |||
static const Identifier textbox = "textbox"; | |||
static const Identifier name = "name"; | |||
static const Identifier type = "type"; | |||
static const Identifier trackercolour = "trackercolour"; | |||
static const Identifier sliderskew = "sliderskew"; | |||
static const Identifier sliderincr = "sliderince"; | |||
static const Identifier midichan = "midichan"; | |||
static const Identifier midictrl = "midictrl"; | |||
static const Identifier kind = "kind"; | |||
static const Identifier decimalplaces = "decimalplaces"; | |||
static const Identifier mode = "mode"; | |||
static const Identifier shape = "shape"; | |||
static const Identifier channeltype = "channeltype"; | |||
static const Identifier comborange = "comborange"; | |||
static const Identifier populate = "populate"; | |||
static const Identifier outline = "outline"; | |||
static const Identifier popup = "popup"; | |||
static const Identifier plant = "plant"; | |||
static const Identifier line = "line"; | |||
static const Identifier tablenumber = "tablenumber"; | |||
static const Identifier resizemode = "resizemode"; | |||
static const Identifier drawmode = "drawmode"; | |||
static const Identifier readonly = "readonly"; | |||
static const Identifier xyautoindex = "xyautoindex"; | |||
static const Identifier file = "file"; | |||
static const Identifier latched = "latched"; | |||
static const Identifier xchannel = "xchannel"; | |||
static const Identifier ychannel = "ychannel"; | |||
static const Identifier minx = "minx"; | |||
static const Identifier miny = "miny"; | |||
static const Identifier maxx = "maxx"; | |||
static const Identifier maxy = "maxy"; | |||
static const Identifier valuex = "valuex"; | |||
static const Identifier fill = "fill"; | |||
static const Identifier valuey = "valuey"; | |||
static const Identifier textcolour = "textcolour"; | |||
static const Identifier pluginid = "pluginid"; | |||
static const Identifier tabs = "tabs"; | |||
static const Identifier tabbed = "tabbed"; | |||
static const Identifier rangey = "rangey"; | |||
static const Identifier rangex = "rangex"; | |||
static const Identifier tabpage = "tabpage"; | |||
static const Identifier filetype = "filetype"; | |||
static const Identifier workingdir = "workingdir"; | |||
static const Identifier author = "author"; | |||
static const Identifier xychannel = "xychannel"; | |||
static const Identifier guirefresh = "guirefresh"; | |||
//type of widgets/controls/messages | |||
static const String combobox = "combobox"; | |||
static const String rslider = "rslider"; | |||
static const String hslider = "hslider"; | |||
static const String vslider = "vslider"; | |||
static const String checkbox = "checkbox"; | |||
static const String button = "button"; | |||
static const String filebutton = "filebutton"; | |||
static const String table = "table"; | |||
static const String groupbox = "groupbox"; | |||
static const String image = "image"; | |||
static const String form = "form"; | |||
static const String xypad = "xypad"; | |||
static const String stringchannel = "string"; | |||
static const String hostbpm = "HOST_BPM"; | |||
static const String timeinseconds = "TIME_IN_SECONDS"; | |||
static const String isplaying = "IS_PLAYING"; | |||
static const String isrecording = "IS_RECORDING"; | |||
static const String hostppqpos = "HOST_PPQ_POS"; | |||
static const String csoundoutput = "csoundoutput"; | |||
}; | |||
class CabbageGUIClass : public CabbageUtils | |||
{ | |||
@@ -58,20 +148,20 @@ public: | |||
CabbageGUIClass(){}; | |||
~CabbageGUIClass(); | |||
int parse(String str); | |||
float getNumProp(String prop); | |||
float getNumProp(String prop, int index); | |||
void setNumProp(String prop, float val); | |||
float getNumProp(Identifier prop); | |||
float getNumProp(Identifier prop, int index); | |||
void setNumProp(Identifier prop, float val); | |||
void setTableChannelValues(int index, float val); | |||
float getTableChannelValues(int index); | |||
void addTableChannelValues(); | |||
void setStringProp(String prop, String val); | |||
void setStringProp(String prop, int index, String value); | |||
String getStringProp(String prop); | |||
String getStringProp(String prop, int index); | |||
void setStringProp(Identifier prop, String val); | |||
void setStringProp(Identifier prop, int index, String value); | |||
String getStringProp(Identifier prop); | |||
String getStringProp(Identifier prop, int index); | |||
String getPropsString(); | |||
String getColourProp(String prop); | |||
float getNumPropVal(String prop); | |||
void setNumPropVal(String prop, float val); | |||
String getColourProp(Identifier prop); | |||
float getNumPropVal(Identifier prop); | |||
void setNumPropVal(Identifier prop, float val); | |||
static String getCabbageCodeFromIdentifiers(NamedValueSet props); | |||
static String getStringForIdentifier(var props, String identifier, String type); | |||
@@ -95,14 +185,14 @@ public: | |||
Rectangle<int> getComponentBounds(); | |||
StringArray getStringArrayProp(String prop); | |||
String getStringArrayPropValue(String prop, int index); | |||
StringArray getStringArrayProp(Identifier prop); | |||
String getStringArrayPropValue(Identifier prop, int index); | |||
int getIntArrayPropValue(String prop, int index); | |||
Array<int> getIntArrayProp(String prop); | |||
int getIntArrayPropValue(Identifier prop, int index); | |||
Array<int> getIntArrayProp(Identifier prop); | |||
float getFloatArrayPropValue(String prop, int index); | |||
Array<float> getFloatArrayProp(String prop); | |||
float getFloatArrayPropValue(Identifier prop, int index); | |||
Array<float> getFloatArrayProp(Identifier prop); | |||
@@ -211,3 +301,4 @@ public: | |||
}; | |||
#endif | |||
@@ -41,11 +41,22 @@ float value; | |||
#endif | |||
String type; | |||
String fStatement; | |||
String stringVal; | |||
CabbageChannelMessage(String chan, double val, String _type) | |||
{ | |||
channelName = chan; | |||
value = val; | |||
type = _type; | |||
} | |||
CabbageChannelMessage(String chan, String val, String _type) | |||
{ | |||
channelName = chan; | |||
stringVal = val; | |||
type = _type; | |||
} | |||
CabbageChannelMessage(String chan, double val, String _type):channelName(chan), | |||
value(val), | |||
type(_type) | |||
{} | |||
~CabbageChannelMessage() | |||
{} | |||
@@ -64,6 +75,10 @@ public: | |||
outgoingChannelMessages.add(CabbageChannelMessage(_chan, _val, _type)); | |||
} | |||
void addOutgoingChannelMessageToQueue(String _chan, String _val, String _type){ | |||
outgoingChannelMessages.add(CabbageChannelMessage(_chan, _val, _type)); | |||
} | |||
void addOutgoingTableUpdateMessageToQueue(String fStatement){ | |||
CabbageChannelMessage tableMessage("", 0.f, "updateTable"); | |||
tableMessage.fStatement = fStatement; | |||
@@ -39,7 +39,7 @@ value(_value) | |||
colourField->addActionListener(this); | |||
colourField->repaint(); | |||
} | |||
else if(name.contains("file")){ | |||
else if(name.contains("file") || name.contains("workingdir")){ | |||
addAndMakeVisible(fileBrowserField = new FileBrowserField(name, value.toString())); | |||
fileBrowserField->addActionListener(this); | |||
} | |||
@@ -102,16 +102,16 @@ public: | |||
comps[i]->setPreferredHeight(22); | |||
if(attributeNames[i].contains("type") || | |||
attributeNames[i].contains("name") || | |||
attributeNames[i].contains("caption") || | |||
attributeNames[i].contains("kind") || | |||
attributeNames[i].contains("scaley") || | |||
attributeNames[i].contains("scalex") || | |||
attributeNames[i].contains("range") || | |||
attributeNames[i].contains("comborange") || | |||
attributeNames[i].contains("basetype") || | |||
attributeNames[i].contains("decimalplaces")){ | |||
if(attributeNames[i].equalsIgnoreCase("type") || | |||
attributeNames[i].equalsIgnoreCase("name") || | |||
attributeNames[i].equalsIgnoreCase("caption") || | |||
attributeNames[i].equalsIgnoreCase("kind") || | |||
attributeNames[i].equalsIgnoreCase("scaley") || | |||
attributeNames[i].equalsIgnoreCase("scalex") || | |||
attributeNames[i].equalsIgnoreCase("range") || | |||
attributeNames[i].equalsIgnoreCase("comborange") || | |||
attributeNames[i].equalsIgnoreCase("basetype") || | |||
attributeNames[i].equalsIgnoreCase("decimalplaces")){ | |||
comps[i]->setPreferredHeight(0); | |||
hiddenComponents++; | |||
} | |||
@@ -453,7 +453,7 @@ public : | |||
} | |||
void mouseDown(const MouseEvent& e){ | |||
FileChooser openFC(String("Open a soundfile .csd file..."), File::nonexistent, String("*.wav;*.mp3;*.ogg")); | |||
FileChooser openFC(String("Open a file..."), File::nonexistent, String("*.*")); | |||
if(!e.mods.isCtrlDown()) | |||
if(openFC.browseForFileToOpen()){ | |||
value.resize(0); | |||
@@ -29,9 +29,9 @@ void CabbageEnvelopeHandleComponent::paint (Graphics& g) | |||
} | |||
Table* CabbageEnvelopeHandleComponent::getParentComponent() | |||
{ | |||
return (Table*)Component::getParentComponent(); | |||
Table* CabbageEnvelopeHandleComponent::getParentComponent() | |||
{ | |||
return (Table*)Component::getParentComponent(); | |||
} | |||
void CabbageEnvelopeHandleComponent::removeThisHandle() | |||
@@ -397,22 +397,22 @@ void Table::paint (Graphics& g) | |||
} | |||
} | |||
// g.setColour(Colours::lightblue); | |||
// envPath.letoleToFit (0, tableTop, getWidth(), tableHeight, false); | |||
// g.setColour(Colours::lightblue); | |||
// envPath.letoleToFit (0, tableTop, getWidth(), tableHeight, false); | |||
// g.strokePath (envPath, PathStrokeType(2.0f)); | |||
//----- For handles.... | |||
else if(!drawOriginalTableData){ | |||
envPath.clear(); | |||
for(int i = 0; i < handles.size(); i++) { | |||
for(int i = 0; i < handles.size(); i++) { | |||
CabbageEnvelopeHandleComponent* handle = handles.getUnchecked(i); | |||
int prevX, prevY; | |||
if((int)handle->getProperties().getWithDefault("curveType", 1)==0) | |||
{ | |||
//for linear envelopes | |||
if(i==0){ | |||
envPath.startNewSubPath((handle->getX() + handle->getRight()) / 2, | |||
int prevX, prevY; | |||
if((int)handle->getProperties().getWithDefault("curveType", 1)==0) | |||
{ | |||
//for linear envelopes | |||
if(i==0){ | |||
envPath.startNewSubPath((handle->getX() + handle->getRight()) / 2, | |||
(handle->getY() + handle->getBottom()) / 2); | |||
if(toggleMaxMin) | |||
g.setColour(currColour); | |||
@@ -428,7 +428,7 @@ void Table::paint (Graphics& g) | |||
g.setColour(currColour); | |||
} | |||
prevX = handle->getX(); | |||
prevY = handle->getY(); | |||
prevY = handle->getY(); | |||
} | |||
else | |||
{ | |||
@@ -464,60 +464,60 @@ void Table::paint (Graphics& g) | |||
(handle->getY() + handle->getBottom()) / 2); | |||
} | |||
prevY = handle->getY(); | |||
prevX = handle->getX(); | |||
} | |||
} | |||
else | |||
{ | |||
//for bezier envelopes | |||
if(i==0){ | |||
envPath.startNewSubPath((handle->getX() + handle->getRight()) / 2, | |||
(handle->getY() + handle->getBottom()) / 2); | |||
prevX = handle->getX(); | |||
} | |||
} | |||
else | |||
{ | |||
//for bezier envelopes | |||
if(i==0){ | |||
envPath.startNewSubPath((handle->getX() + handle->getRight()) / 2, | |||
(handle->getY() + handle->getBottom()) / 2); | |||
} | |||
else | |||
{ | |||
int curX = handle->getX(); | |||
int curY = handle->getY(); | |||
int prevX = envPath.getCurrentPosition().getX(); | |||
{ | |||
int curX = handle->getX(); | |||
int curY = handle->getY(); | |||
int prevX = envPath.getCurrentPosition().getX(); | |||
int prevY = envPath.getCurrentPosition().getY(); | |||
//int controlPoint1 | |||
//int controlPoint1 | |||
if(curY>prevY){ | |||
if((int)handle->getProperties().getWithDefault("curveType", 0)==CONVEX) | |||
envPath.quadraticTo(prevX+(curX/3), curY, | |||
(curX + handle->getRight()) / 2, | |||
if((int)handle->getProperties().getWithDefault("curveType", 0)==CONVEX) | |||
envPath.quadraticTo(prevX+(curX/3), curY, | |||
(curX + handle->getRight()) / 2, | |||
(curY + handle->getBottom()) / 2); | |||
else if((int)handle->getProperties().getWithDefault("curveType", 0)==CONCAVE) | |||
envPath.quadraticTo(curX-(curX/3), prevY, | |||
(curX + handle->getRight()) / 2, | |||
(curY + handle->getBottom()) / 2); | |||
} | |||
} | |||
else if(curY<prevY) | |||
if((int)handle->getProperties().getWithDefault("curveType", 0)==CONVEX) | |||
envPath.quadraticTo(curX-(curX/3.f), prevY, | |||
(curX + handle->getRight()) / 2, | |||
(curY + handle->getBottom()) / 2); | |||
if((int)handle->getProperties().getWithDefault("curveType", 0)==CONVEX) | |||
envPath.quadraticTo(curX-(curX/3.f), prevY, | |||
(curX + handle->getRight()) / 2, | |||
(curY + handle->getBottom()) / 2); | |||
else if((int)handle->getProperties().getWithDefault("curveType", 0)==CONCAVE) | |||
envPath.quadraticTo(prevX+(prevX/3.f), curY, | |||
(curX + handle->getRight()) / 2, | |||
(curY + handle->getBottom()) / 2); | |||
} | |||
(curY + handle->getBottom()) / 2); | |||
} | |||
} | |||
//String coordinate; | |||
//coordinate = String(handle->getX()) + String(", ") + String(handle->getY()); | |||
//g.setColour(Colours::lime); | |||
//String coordinate; | |||
//coordinate = String(handle->getX()) + String(", ") + String(handle->getY()); | |||
//g.setColour(Colours::lime); | |||
//g.drawFittedText(coordinate, handle->getX(), handle->getY(), 50, 20, Justification::centred, 1); | |||
//envPath.lineTo(getWidth(), getHeight()); | |||
//envPath.lineTo(0, getHeight()); | |||
//envPath.closeSubPath(); | |||
//envPath.closeSubPath(); | |||
//g.setColour(currColour.darker(.7f)); | |||
//if(toggleMaxMin) | |||
// int test; | |||
//else if((drawHorizontalSegments==true && fixedEnvelope == false)) | |||
//g.fillPath(envPath); | |||
//else | |||
if(!drawFill) | |||
if(!drawFill) | |||
g.strokePath (envPath, PathStrokeType(2.0f)); | |||
} | |||
} | |||
@@ -954,9 +954,8 @@ void CabbageTableManager::mouseDrag(const MouseEvent& e) | |||
void CabbageTableManager::mouseDown (const MouseEvent& e) | |||
{ | |||
if(e.mods.isRightButtonDown()) | |||
if(e.mods.isPopupMenu()) | |||
{ | |||
PopupMenu pop, subMenu1, subMenu2; | |||
pop.setLookAndFeel(&getTopLevelComponent()->getLookAndFeel()); | |||
subMenu1.setLookAndFeel(&getTopLevelComponent()->getLookAndFeel()); | |||
@@ -975,7 +974,7 @@ void CabbageTableManager::mouseDown (const MouseEvent& e) | |||
for(int i=0;i<tables.size();i++){ | |||
for(int i=0;i<tables.size();i++) | |||
subMenu2.addColouredItem(200+i, "fTable:"+String(tables[i]->tableNumber), tables[i]->currColour); | |||
if(!readOnly){ | |||
@@ -984,7 +983,7 @@ void CabbageTableManager::mouseDown (const MouseEvent& e) | |||
pop.addItem(300, "Replace existing table"); | |||
pop.addItem(301, "Add table to score"); | |||
} | |||
} | |||
int choice = pop.show(); | |||
if((choice>=100) && (choice<200)){ | |||
@@ -23,7 +23,7 @@ | |||
#include <string> | |||
#include <time.h> | |||
#include "JuceHeader.h" | |||
#include "JuceHeader.h" | |||
#ifndef Cabbage_Plugin_Host | |||
#include "BinaryData.h" | |||
@@ -663,7 +663,7 @@ for(int i=0;i<getNumChildComponents();i++){ | |||
//clear vector containing child positions before movement | |||
selectedCompsOrigCoordinates.clear(); | |||
if(e.mods.isRightButtonDown()){ | |||
if(e.mods.isPopupMenu()){ | |||
currentMouseCoors = e.getPosition(); | |||
//call change method in CabbagePluginEditor.. | |||
currentEvent = "triggerPopupMenu"; | |||
@@ -20,7 +20,7 @@ | |||
#ifndef SOUNDFILEWAVEFORM_H | |||
#define SOUNDFILEWAVEFORM_H | |||
#include "JuceHeader.h" | |||
#include "JuceHeader.h" | |||
#include "CabbageUtils.h" | |||
#include "CabbageLookAndFeel.h" | |||