Skip to content

Commit

Permalink
Merge branch '0_4_master'
Browse files Browse the repository at this point in the history
Conflicts:
	Source/IncrMidiNotesMapping.cpp
	Source/IncrMidiNotesMapping.h
	Source/IsomorphicMassAssign.cpp
	Source/IsomorphicMassAssign.h
	Source/Main.cpp
	Source/MainComponent.h
	Source/NoteAssignTab.h
	Source/NoteEditArea.cpp
	Source/NoteEditArea.h
	Source/SingleNoteAssign.cpp
	Source/SingleNoteAssign.h
	Source/ViewConstants.h
	TerpstraSysEx.jucer
  • Loading branch information
hsstraub committed Feb 18, 2018
2 parents fa33a84 + fe5ecc2 commit 2e66221
Show file tree
Hide file tree
Showing 21 changed files with 902 additions and 317 deletions.
Binary file modified BinaryData/TopEdgeButton.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Source/IncrMidiNotesMapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ IncrMidiNotesMapping::IncrMidiNotesMapping ()
channelBox->addItem(String(i), i);

// Default: multi channel
// XXX (Or: latest choice by user, from settings)
// Todo latest choice by user, from settings
channelAutoIncrButton->setToggleState(true, juce::NotificationType::sendNotification);

//noteLabel->attachToComponent(noteBox, true);
Expand Down
2 changes: 1 addition & 1 deletion Source/IncrMidiNotesMapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#define __JUCE_HEADER_B85945BB76A8470__

//[Headers] -- You can add your own extra header files here --
#include "../../JuceLibraryCode/JuceHeader.h"
#include "../JuceLibraryCode/JuceHeader.h"
#include "MappingLogic.h"
//[/Headers]

Expand Down
161 changes: 99 additions & 62 deletions Source/IsomorphicMassAssign.cpp

Large diffs are not rendered by default.

25 changes: 15 additions & 10 deletions Source/IsomorphicMassAssign.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
and re-saved.
Created with Projucer version: 4.2.1
Created with Projucer version: 4.3.1
------------------------------------------------------------------------------
Expand All @@ -21,8 +21,9 @@
#define __JUCE_HEADER_730F20A4628CA114__

//[Headers] -- You can add your own extra header files here --
#include "../../JuceLibraryCode/JuceHeader.h"
#include "../JuceLibraryCode/JuceHeader.h"
#include "MappingLogic.h"
#include "IncrMidiNotesMapping.h"
#include "BoardGeometry.h"
//[/Headers]

Expand All @@ -37,8 +38,8 @@
//[/Comments]
*/
class IsomorphicMassAssign : public Component,
public MappingLogicListener,
public ComboBoxListener
public ComboBoxListener,
public MappingLogicListener
{
public:
//==============================================================================
Expand All @@ -47,6 +48,7 @@ class IsomorphicMassAssign : public Component,

//==============================================================================
//[UserMethods] -- You can add your own custom methods in this section.
// Implementation of MappingLogicListener
// Set, save and maybe send data of one key
void setSaveSend(int setSelection, int keySelection, int noteIndex);

Expand All @@ -55,18 +57,17 @@ class IsomorphicMassAssign : public Component,

// Fill a horizontal line and its cutting upwards lines, recursively
void fill2DHorizLineRecursive(int setSelection, TerpstraBoardGeometry::StraightLine& horizLine, int startPos, int startNoteIndex,
int horizStepSize, int rUpwStepSize,
int horizStepSize, int rUpwStepSize,
TerpstraBoardGeometry::StraightLineSet& finishedLines);

// Fill a right upward line and its cutting horizontal lines, recursively
void fill2DRUpwLineRecursive(int setSelection, TerpstraBoardGeometry::StraightLine& rUpwLine, int startPos, int startNoteIndex,
int horizStepSize, int rUpwStepSize,
TerpstraBoardGeometry::StraightLineSet& finishedLines);


// Implementation of MappingLogicListener
void mappingLogicChanged(MappingLogicBase* mappingLogicThatChanged) override;
// Edit operation when a key field in MainComponent has been clicked

void PerformMouseClickEdit(int setSelection, int keySelection);
//[/UserMethods]

Expand All @@ -75,22 +76,26 @@ class IsomorphicMassAssign : public Component,
void comboBoxChanged (ComboBox* comboBoxThatHasChanged) override;



private:
//[UserVariables] -- You can add your own custom variables in this section.
ScopedPointer<IncrMidiNotesMapping> incrMidiNotesMapping;

MappingLogicBase* mappingLogic;
TerpstraBoardGeometry boardGeometry;
//[/UserVariables]

//==============================================================================
ScopedPointer<ComboBox> startingPointeBox;
ScopedPointer<ComboBox> startingPointBox;
ScopedPointer<Label> labelStartingPoint;
ScopedPointer<Label> labelHorizontalSteps;
ScopedPointer<TextEditor> editHorizontalSteps;
ScopedPointer<Label> labelRightUpwardSteps;
ScopedPointer<TextEditor> editRightUpwardSteps;
ScopedPointer<Label> editInstructionText;
Path internalPath1;
Path internalPath2;
ScopedPointer<GroupComponent> groupMapping;
ScopedPointer<ComboBox> cbMappingStyle;
ScopedPointer<Label> labelMappingStyle;


//==============================================================================
Expand Down
37 changes: 34 additions & 3 deletions Source/KeyboardDataStructure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ void TerpstraKeyMapping::fromStringArray(const StringArray& stringArray)
else
jassert(false);
}
else
jassert(false);
}
else if ((pos1 = currentLine.indexOf("Chan_")) >= 0)
{
Expand All @@ -79,7 +77,7 @@ void TerpstraKeyMapping::fromStringArray(const StringArray& stringArray)
{
int keyIndex = currentLine.substring(pos1 + 5, pos2).getIntValue();
int keyValue = currentLine.substring(pos2 + 1).getIntValue();
if (boardIndex >= 0 && boardIndex < NUMBEROFBOARDS && keyIndex >= 0 && keyIndex < TERPSTRABOARDSIZE )
if (boardIndex >= 0 && boardIndex < NUMBEROFBOARDS && keyIndex >= 0 && keyIndex < TERPSTRABOARDSIZE)
{
sets[boardIndex].theKeys[keyIndex].channelNumber = keyValue;
// XXX if keyValue is illegal: error status?
Expand All @@ -88,6 +86,23 @@ void TerpstraKeyMapping::fromStringArray(const StringArray& stringArray)
jassert(false);
}
}
else if ((pos1 = currentLine.indexOf("Col_")) >= 0)
{
pos2 = currentLine.indexOf("=");
if (pos2 >= 0 && pos2 > pos1)
{
int keyIndex = currentLine.substring(pos1 + 4, pos2).getIntValue();
int colValue = currentLine.substring(pos2 + 1).getHexValue32();
if (boardIndex >= 0 && boardIndex < NUMBEROFBOARDS && keyIndex >= 0 && keyIndex < TERPSTRABOARDSIZE)
{
sets[boardIndex].theKeys[keyIndex].colour = colValue;
}
else
jassert(false);
}
else
jassert(false);
}
}
}

Expand All @@ -107,8 +122,24 @@ StringArray TerpstraKeyMapping::toStringArray()
{
result.add("Key_" + String(keyIndex) + "=" + String(sets[boardIndex].theKeys[keyIndex].noteNumber));
result.add("Chan_" + String(keyIndex) + "=" + String(sets[boardIndex].theKeys[keyIndex].channelNumber));
result.add("Col_" + String(keyIndex) + "=" + String::toHexString( (sets[boardIndex].theKeys[keyIndex].colour)));
}
}

return result;
}

SortedSet<int> TerpstraKeyMapping::getUsedColours()
{
SortedSet<int> result;

for (int boardIndex = 0; boardIndex < NUMBEROFBOARDS; boardIndex++)
{
for (int keyIndex = 0; keyIndex < TERPSTRABOARDSIZE; keyIndex++)
{
result.add(sets[boardIndex].theKeys[keyIndex].colour);
}
}

return result;
}
2 changes: 2 additions & 0 deletions Source/KeyboardDataStructure.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ class TerpstraKeyMapping

void fromStringArray(const StringArray& stringArray);
StringArray toStringArray();
// The colours that are used
SortedSet<int> getUsedColours();

public:
TerpstraKeys sets[NUMBEROFBOARDS];
Expand Down
200 changes: 200 additions & 0 deletions Source/MacroButtonsWindow.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
/*
==============================================================================
This is an automatically generated GUI class created by the Projucer!
Be careful when adding custom code to these files, as only the code within
the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
and re-saved.
Created with Projucer version: 4.3.1
------------------------------------------------------------------------------
The Projucer is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright (c) 2015 - ROLI Ltd.
==============================================================================
*/

//[Headers] You can add your own extra header files here...
//[/Headers]

#include "MacroButtonsWindow.h"


//[MiscUserDefs] You can add your own user definitions and misc code here...
//[/MiscUserDefs]

//==============================================================================
MacroButtonsWindow::MacroButtonsWindow ()
{
//[Constructor_pre] You can add your own custom stuff here..
//[/Constructor_pre]

addAndMakeVisible (btnEnableMacroButtons = new ToggleButton ("btnEnableMacroButtons"));
btnEnableMacroButtons->setButtonText (TRANS("Enable Macro Buttons"));
btnEnableMacroButtons->addListener (this);

addAndMakeVisible (lblMacroButtonsInfo = new Label ("lblMacroButtonsInfo",
TRANS("When the corresponding macro button is pressed, the selected key mapping file will be sent to the keyboard.")));
lblMacroButtonsInfo->setFont (Font (15.00f, Font::plain));
lblMacroButtonsInfo->setJustificationType (Justification::centredLeft);
lblMacroButtonsInfo->setEditable (false, false, false);
lblMacroButtonsInfo->setColour (TextEditor::textColourId, Colours::black);
lblMacroButtonsInfo->setColour (TextEditor::backgroundColourId, Colour (0x00000000));

addAndMakeVisible (lblButton1 = new Label ("lblButton1",
TRANS("1")));
lblButton1->setFont (Font (15.00f, Font::plain));
lblButton1->setJustificationType (Justification::centredLeft);
lblButton1->setEditable (false, false, false);
lblButton1->setColour (TextEditor::textColourId, Colours::black);
lblButton1->setColour (TextEditor::backgroundColourId, Colour (0x00000000));

addAndMakeVisible (textMacroFile1 = new TextEditor ("textMacroFile1"));
textMacroFile1->setMultiLine (false);
textMacroFile1->setReturnKeyStartsNewLine (false);
textMacroFile1->setReadOnly (false);
textMacroFile1->setScrollbarsShown (true);
textMacroFile1->setCaretVisible (true);
textMacroFile1->setPopupMenuEnabled (true);
textMacroFile1->setText (String());

addAndMakeVisible (btnFileSelectMacro1 = new TextButton ("btnFileSelectMacro1"));
btnFileSelectMacro1->setButtonText (TRANS("..."));
btnFileSelectMacro1->addListener (this);

drawable1 = Drawable::createFromImageData (BinaryData::TopEdgeButton_png, BinaryData::TopEdgeButton_pngSize);

//[UserPreSize]
//[/UserPreSize]

setSize (428, 400);


//[Constructor] You can add your own custom stuff here..
//[/Constructor]
}

MacroButtonsWindow::~MacroButtonsWindow()
{
//[Destructor_pre]. You can add your own custom destruction code here..
//[/Destructor_pre]

btnEnableMacroButtons = nullptr;
lblMacroButtonsInfo = nullptr;
lblButton1 = nullptr;
textMacroFile1 = nullptr;
btnFileSelectMacro1 = nullptr;
drawable1 = nullptr;


//[Destructor]. You can add your own custom destruction code here..
//[/Destructor]
}

//==============================================================================
void MacroButtonsWindow::paint (Graphics& g)
{
//[UserPrePaint] Add your own custom painting code here..
//[/UserPrePaint]

g.fillAll (Colour (0xffbad0de));

g.setColour (Colours::black);
jassert (drawable1 != 0);
if (drawable1 != 0)
drawable1->drawWithin (g, Rectangle<float> (12, 20, 100, 46),
RectanglePlacement::stretchToFit, 1.000f);

//[UserPaint] Add your own custom painting code here..
//[/UserPaint]
}

void MacroButtonsWindow::resized()
{
//[UserPreResize] Add your own custom resize code here..
//[/UserPreResize]

btnEnableMacroButtons->setBounds (136, 24, 150, 24);
lblMacroButtonsInfo->setBounds (8, 80, 440, 48);
lblButton1->setBounds (8, 136, 31, 24);
textMacroFile1->setBounds (48, 136, 150, 24);
btnFileSelectMacro1->setBounds (208, 136, 32, 24);
//[UserResized] Add your own custom resize handling here..
//[/UserResized]
}

void MacroButtonsWindow::buttonClicked (Button* buttonThatWasClicked)
{
//[UserbuttonClicked_Pre]
//[/UserbuttonClicked_Pre]

if (buttonThatWasClicked == btnEnableMacroButtons)
{
//[UserButtonCode_btnEnableMacroButtons] -- add your button handler code here..
//[/UserButtonCode_btnEnableMacroButtons]
}
else if (buttonThatWasClicked == btnFileSelectMacro1)
{
//[UserButtonCode_btnFileSelectMacro1] -- add your button handler code here..
//[/UserButtonCode_btnFileSelectMacro1]
}

//[UserbuttonClicked_Post]
//[/UserbuttonClicked_Post]
}



//[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
//[/MiscUserCode]


//==============================================================================
#if 0
/* -- Projucer information section --

This is where the Projucer stores the metadata that describe this GUI layout, so
make changes in here at your peril!

BEGIN_JUCER_METADATA

<JUCER_COMPONENT documentType="Component" className="MacroButtonsWindow" componentName=""
parentClasses="public Component" constructorParams="" variableInitialisers=""
snapPixels="8" snapActive="1" snapShown="1" overlayOpacity="0.330"
fixedSize="0" initialWidth="428" initialHeight="400">
<BACKGROUND backgroundColour="ffbad0de">
<IMAGE pos="12 20 100 46" resource="BinaryData::TopEdgeButton_png" opacity="1"
mode="0"/>
</BACKGROUND>
<TOGGLEBUTTON name="btnEnableMacroButtons" id="9e31c84073a54686" memberName="btnEnableMacroButtons"
virtualName="" explicitFocusOrder="0" pos="136 24 150 24" buttonText="Enable Macro Buttons"
connectedEdges="0" needsCallback="1" radioGroupId="0" state="0"/>
<LABEL name="lblMacroButtonsInfo" id="199c7576a5017f09" memberName="lblMacroButtonsInfo"
virtualName="" explicitFocusOrder="0" pos="8 80 440 48" edTextCol="ff000000"
edBkgCol="0" labelText="When the corresponding macro button is pressed, the selected key mapping file will be sent to the keyboard."
editableSingleClick="0" editableDoubleClick="0" focusDiscardsChanges="0"
fontname="Default font" fontsize="15" bold="0" italic="0" justification="33"/>
<LABEL name="lblButton1" id="20c692b045b913d5" memberName="lblButton1"
virtualName="" explicitFocusOrder="0" pos="8 136 31 24" edTextCol="ff000000"
edBkgCol="0" labelText="1" editableSingleClick="0" editableDoubleClick="0"
focusDiscardsChanges="0" fontname="Default font" fontsize="15"
bold="0" italic="0" justification="33"/>
<TEXTEDITOR name="textMacroFile1" id="b9bc5baf677ed902" memberName="textMacroFile1"
virtualName="" explicitFocusOrder="0" pos="48 136 150 24" initialText=""
multiline="0" retKeyStartsLine="0" readonly="0" scrollbars="1"
caret="1" popupmenu="1"/>
<TEXTBUTTON name="btnFileSelectMacro1" id="23cc77cbad6653d7" memberName="btnFileSelectMacro1"
virtualName="" explicitFocusOrder="0" pos="208 136 32 24" buttonText="..."
connectedEdges="0" needsCallback="1" radioGroupId="0"/>
</JUCER_COMPONENT>

END_JUCER_METADATA
*/
#endif


//[EndFile] You can add extra defines here...
//[/EndFile]
Loading

0 comments on commit 2e66221

Please sign in to comment.