Skip to content

Commit

Permalink
Merge branch 'GUIBigRedesignNoMenu_55keys' into GUIBigRedesignNoMenu
Browse files Browse the repository at this point in the history
  • Loading branch information
hsstraub committed Dec 13, 2020
2 parents d89a060 + bc4423f commit 804ccf4
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 46 deletions.
77 changes: 47 additions & 30 deletions Source/AllKeysOverview.cpp
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: 6.0.4
Created with Projucer version: 6.0.5
------------------------------------------------------------------------------
Expand Down Expand Up @@ -51,14 +51,17 @@ KeyMiniDisplayInsideAllKeysOverview::~KeyMiniDisplayInsideAllKeysOverview()
void KeyMiniDisplayInsideAllKeysOverview::paint(Graphics& g)
{
jassert(getParentComponent() != nullptr);
bool isSelected = boardIndex == dynamic_cast<AllKeysOverview*>(getParentComponent())->getCurrentSetSelection();
bool boardIsSelected = boardIndex == dynamic_cast<AllKeysOverview*>(getParentComponent())->getCurrentSetSelection();

Colour hexagonColour = findColour(TerpstraKeyEdit::backgroundColourId).overlaidWith(getKeyColour()
.withAlpha(isSelected ? TERPSTRASINGLEKEYCOLOURALPHA : TERPSTRASINGLEKEYCOLOURUNSELECTEDMINIALPHA));
.withAlpha(boardIsSelected ? TERPSTRASINGLEKEYCOLOURALPHA : TERPSTRASINGLEKEYCOLOURUNSELECTEDMINIALPHA));
// ToDo if highlighted: even different alpha?
g.setColour(hexagonColour);
g.fillPath(hexPath);

Colour lineColour = findColour(TerpstraKeyEdit::outlineColourId);
// Key highlighted or not: color and thickness of the line
float lineWidth = isHighlighted ? 1.5 : 1;
Colour lineColour = findColour(isHighlighted ? TerpstraKeyEdit::selectedKeyOutlineId : TerpstraKeyEdit::outlineColourId);
g.setColour(lineColour);
g.strokePath(hexPath, PathStrokeType(1));
}
Expand Down Expand Up @@ -99,29 +102,61 @@ void KeyMiniDisplayInsideAllKeysOverview::mouseDown(const MouseEvent& e)
dynamic_cast<MainContentComponent*>(getParentComponent()->getParentComponent())->
getOctaveBoardSelectorTab()->setCurrentTabIndex(boardIndex);

// ToDo NoteOn MIDI message (here or in parent component)
isHighlighted = true;
repaint();

// NoteOn MIDI message
auto keyData = getKeyData();
if (keyData != nullptr && keyData->channelNumber > 0)
{
if (keyData->keyType == TerpstraKey::noteOnNoteOff)
{
// Send "note on" event
TerpstraSysExApplication::getApp().getMidiDriver().sendNoteOnMessage(keyData->noteNumber, keyData->channelNumber, 60);
}
// ToDo if keyType is "continuous controller": send controller event?
}
}

void KeyMiniDisplayInsideAllKeysOverview::mouseUp(const MouseEvent& e)
{
Component::mouseDown(e);

// ToDo NoteOff MIDI message (here or in parent component)
}
isHighlighted = false;
repaint();

// NoteOff MIDI message
auto keyData = getKeyData();
if (keyData != nullptr && keyData->channelNumber > 0)
{
if (keyData->keyType == TerpstraKey::noteOnNoteOff)
{
// Send "note off" event
TerpstraSysExApplication::getApp().getMidiDriver().sendNoteOffMessage(keyData->noteNumber, keyData->channelNumber, 60);
}
}
}

Colour KeyMiniDisplayInsideAllKeysOverview::getKeyColour()
const TerpstraKey* KeyMiniDisplayInsideAllKeysOverview::getKeyData() const
{
if (boardIndex >= 0 && boardIndex < NUMBEROFBOARDS && keyIndex >= 0 && keyIndex < TERPSTRABOARDSIZE)
{
jassert(getParentComponent() != nullptr);
jassert(getParentComponent()->getParentComponent() != nullptr);
return Colour(
dynamic_cast<MainContentComponent*>(getParentComponent()->getParentComponent())
->getMappingInEdit().sets[boardIndex].theKeys[keyIndex].colour);
return &dynamic_cast<MainContentComponent*>(getParentComponent()->getParentComponent())
->getMappingInEdit().sets[boardIndex].theKeys[keyIndex];
}

return findColour(TerpstraKeyEdit::backgroundColourId);
return nullptr;
}

Colour KeyMiniDisplayInsideAllKeysOverview::getKeyColour() const
{
auto keyData = getKeyData();
if ( keyData != nullptr)
return Colour(keyData->colour);
else
return findColour(TerpstraKeyEdit::backgroundColourId);
}

//[/MiscUserDefs]
Expand Down Expand Up @@ -311,20 +346,6 @@ void AllKeysOverview::buttonClicked (juce::Button* buttonThatWasClicked)
//[/UserbuttonClicked_Post]
}

void AllKeysOverview::mouseDown (const juce::MouseEvent& e)
{
//[UserCode_mouseDown] -- Add your code here...
// MIDI NoteOn message - here or in key component
//[/UserCode_mouseDown]
}

void AllKeysOverview::mouseUp (const juce::MouseEvent& e)
{
//[UserCode_mouseUp] -- Add your code here...
// MIDI NoteOff message - here or in key component
//[/UserCode_mouseUp]
}



//[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
Expand All @@ -344,10 +365,6 @@ BEGIN_JUCER_METADATA
parentClasses="public juce::Component" constructorParams="" variableInitialisers=""
snapPixels="8" snapActive="1" snapShown="1" overlayOpacity="0.330"
fixedSize="0" initialWidth="928" initialHeight="214">
<METHODS>
<METHOD name="mouseDown (const juce::MouseEvent&amp; e)"/>
<METHOD name="mouseUp (const juce::MouseEvent&amp; e)"/>
</METHODS>
<BACKGROUND backgroundColour="ff323e44"/>
<TEXTBUTTON name="btnLoadFile" id="6c0c074c9f137f23" memberName="btnLoadFile"
virtualName="" explicitFocusOrder="0" pos="368 8 96 24" buttonText="Load File"
Expand Down
10 changes: 5 additions & 5 deletions Source/AllKeysOverview.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: 6.0.4
Created with Projucer version: 6.0.5
------------------------------------------------------------------------------
Expand Down Expand Up @@ -40,11 +40,13 @@ class KeyMiniDisplayInsideAllKeysOverview : public Component
private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(KeyMiniDisplayInsideAllKeysOverview)

Colour getKeyColour();
const TerpstraKey* getKeyData() const;
Colour getKeyColour() const;

int boardIndex = -1;
int keyIndex = -1;
Path hexPath;
bool isHighlighted = false;
};

//[/Headers]
Expand All @@ -69,7 +71,7 @@ class AllKeysOverview : public juce::Component,

//==============================================================================
//[UserMethods] -- You can add your own custom methods in this section.

int getCurrentSetSelection() const { return currentSetSelection ;}
void setCurrentSetSelection(int newSetSelection) { currentSetSelection = newSetSelection; repaint(); }

Expand All @@ -78,8 +80,6 @@ class AllKeysOverview : public juce::Component,
void paint (juce::Graphics& g) override;
void resized() override;
void buttonClicked (juce::Button* buttonThatWasClicked) override;
void mouseDown (const juce::MouseEvent& e) override;
void mouseUp (const juce::MouseEvent& e) override;



Expand Down
8 changes: 4 additions & 4 deletions Source/GeneralOptionsDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,11 @@ void GeneralOptionsDlg::loadFromMapping()
{
auto mappingInEdit = ((MainContentComponent*)getParentComponent())->getMappingInEdit();

buttonAfterTouchActive->setToggleState(mappingInEdit.afterTouchActive, juce::NotificationType::sendNotification);
buttonLightOnKeyStrokes->setToggleState(mappingInEdit.lightOnKeyStrokes, juce::NotificationType::sendNotification);
buttonAfterTouchActive->setToggleState(mappingInEdit.afterTouchActive, juce::NotificationType::dontSendNotification);
buttonLightOnKeyStrokes->setToggleState(mappingInEdit.lightOnKeyStrokes, juce::NotificationType::dontSendNotification);

btnInvertFootCtrl->setToggleState(mappingInEdit.invertFootController, juce::NotificationType::sendNotification);
txtExprCtrlSensivity->setText(String(mappingInEdit.expressionControllerSensivity));
btnInvertFootCtrl->setToggleState(mappingInEdit.invertFootController, juce::NotificationType::dontSendNotification);
txtExprCtrlSensivity->setText(String(mappingInEdit.expressionControllerSensivity), false);
}

//[/MiscUserCode]
Expand Down
12 changes: 6 additions & 6 deletions Source/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ void TerpstraSysExApplication::anotherInstanceStarted(const String& commandLine)

bool TerpstraSysExApplication::openSysExMapping()
{
FileChooser chooser("Open a Lumatone key mapping", recentFiles.getFile(0).getParentDirectory(), "*.lmt");
FileChooser chooser("Open a Lumatone key mapping", recentFiles.getFile(0).getParentDirectory(), "*.ltn");
if (chooser.browseForFileToOpen())
{
currentFile = chooser.getResult();
Expand All @@ -160,7 +160,7 @@ bool TerpstraSysExApplication::saveSysExMapping()

bool TerpstraSysExApplication::saveSysExMappingAs()
{
FileChooser chooser("Lumatone Key Mapping Files", recentFiles.getFile(0).getParentDirectory(), "*.lmt");
FileChooser chooser("Lumatone Key Mapping Files", recentFiles.getFile(0).getParentDirectory(), "*.ltn");
if (chooser.browseForFileToSave(true))
{
currentFile = chooser.getResult();
Expand Down Expand Up @@ -320,15 +320,15 @@ bool TerpstraSysExApplication::openFromCurrentFile()

((MainContentComponent*)(mainWindow->getContentComponent()))->setData(keyMapping);

// Mark file as unchanged
setHasChangesToSave(false);

// Window title
updateMainTitle();

// Send configuraiton to controller, if connected
// Send configuration to controller, if connected
sendCurrentMappingToDevice();

// Mark file as unchanged
setHasChangesToSave(false);

// Add file to recent files list
recentFiles.addFile(currentFile);

Expand Down
1 change: 1 addition & 0 deletions Source/TerpstraMidiDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ bool TerpstraMidiDriver::messageIsVelocityIntervalConfigReceptionMessage(const M
void TerpstraMidiDriver::sendMessageWithAcknowledge(const MidiMessage& message)
{
// If there is no MIDI input port active: just send, without expecting acknowledge
// ToDo Or do nothing?
if ( lastInputCallback == nullptr)
{
sendMessageNow(message);
Expand Down
2 changes: 1 addition & 1 deletion TerpstraSysEx.jucer
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>

<JUCERPROJECT id="oPBJmN" name="LumatoneSetup" projectType="guiapp" version="0.9.6"
<JUCERPROJECT id="oPBJmN" name="LumatoneSetup" projectType="guiapp" version="0.9.7"
bundleIdentifier="HansStraub.Lumatone.LumatoneSetup" includeBinaryInAppConfig="1"
companyName="Hans Straub" headerPath="../../../JUCE/modules"
jucerFormatVersion="1">
Expand Down

0 comments on commit 804ccf4

Please sign in to comment.