Files
JaySynth/Source/MidiCC_PopUp.h
T
jens cfc9645b0b - port to minGw
git-svn-id: http://moon:8086/svn/software/trunk/projects/JaySynth@235 b431acfa-c32f-4a4a-93f1-934dc6c82436
2015-02-21 17:09:43 +00:00

204 lines
6.2 KiB
C++

/*
==============================================================================
This is an automatically generated file created by the Jucer!
Creation date: 19 Aug 2012 10:54:59am
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.
Jucer version: 1.12
------------------------------------------------------------------------------
The Jucer is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-6 by Raw Material Software ltd.
==============================================================================
*/
#ifndef __JUCER_HEADER_MIDICCPOPUP_MIDICCPOPUP_EA70576__
#define __JUCER_HEADER_MIDICCPOPUP_MIDICCPOPUP_EA70576__
//[Headers] -- You can add your own extra header files here --
#include "../JuceLibraryCode/JuceHeader.h"
#include "PluginProcessor.h"
//#include "juce.h"
class MidiCC_PopUp_Listener
{
public:
virtual void MidiCC_PopUp_event(int /*event*/) {};
};
//[/Headers]
//==============================================================================
/**
//[Comments]
An auto-generated component, created by the Jucer.
Describe your class and how it works here!
//[/Comments]
*/
class MidiCC_PopUp : public Component,
public ButtonListener,
public LabelListener,
public SliderListener
{
public:
//==============================================================================
MidiCC_PopUp (JaySynthMidiCC *pMidiCC, int paramID, synth_float_t currParamValue, JaySynth::midiCC_info_t *pCurrMidiCCinfo, String name, MidiCC_PopUp_Listener *listener);
~MidiCC_PopUp();
//==============================================================================
//[UserMethods] -- You can add your own custom methods in this section.
enum
{
POPUP_DELETED = 0,
POPUP_CREATED,
POPUP_SHOW,
POPUP_PARAM_CHANGED,
POPUP_OK
};
void addListener(MidiCC_PopUp_Listener *listener)
{
listeners.add (listener);
}
void show(void)
{
this->setVisible(true);
listeners.call (&MidiCC_PopUp_Listener::MidiCC_PopUp_event, POPUP_SHOW);
}
bool isEnabled(void)
{
return pMidiCC->isAssigned(pMidiCC_container);
}
bool doChangeParameter(void)
{
return pMidiCC->doChangeParameter(pMidiCC_container);
}
void setControllerID(int controllerID)
{
lastMidiCCvalue = pSavedMidiCCinfo[pMidiCC->getControllerID(pMidiCC_container)].value;
if (isEnabled())
{
currentParamValue = toParam(pMidiCC->getParam(pMidiCC_container), (synth_float_t)lastMidiCCvalue);
currentControlValue = toParam(pMidiCC->getControl(pMidiCC_container), (synth_float_t)lastMidiCCvalue);
}
restoreTestSlider();
TestValueUpdate();
if (!button_midi_learn->getToggleState())
return;
label_MidiCC_ID->setText(String(controllerID), juce::NotificationType::sendNotification);
}
synth_float_t getCurrentControlValue(void)
{
return currentControlValue;
}
synth_float_t getCurrentParamValue(void)
{
return currentParamValue;
}
int getParamID(void)
{
return pMidiCC->getParamID(pMidiCC_container);
}
void TestValueUpdate()
{
if (doChangeParameter())
{
currentControlValue = 0;
currentParamValue = toParam(pMidiCC->getParam(pMidiCC_container), (synth_float_t)slider_test->getValue());
}
else
{
currentParamValue = savedParamValue;
currentControlValue = toParam(pMidiCC->getControl(pMidiCC_container), (synth_float_t)slider_test->getValue());
}
listeners.call (&MidiCC_PopUp_Listener::MidiCC_PopUp_event, POPUP_PARAM_CHANGED);
}
void restoreTestSlider()
{
if (doChangeParameter())
{
slider_test->setValue(toSlider(pMidiCC->getParam(pMidiCC_container), (synth_float_t)currentParamValue), juce::NotificationType::sendNotification);
}
else
{
slider_test->setValue(toSlider(pMidiCC->getControl(pMidiCC_container), (synth_float_t)currentControlValue), juce::NotificationType::sendNotification);
}
}
void GetMin();
void GetMax();
void SetMin();
void SetMax();
ComponentDragger myDragger;
void mouseDown (const MouseEvent& e)
{
myDragger.startDraggingComponent (this, e);
}
void mouseDrag (const MouseEvent& e)
{
myDragger.dragComponent (this, e, nullptr);
}
void mouseWheelMove(const MouseEvent &event, const MouseWheelDetails &wheel);
//[/UserMethods]
void paint (Graphics& g);
void resized();
void buttonClicked (Button* buttonThatWasClicked);
void labelTextChanged (Label* labelThatHasChanged);
void sliderValueChanged (Slider* sliderThatWasMoved);
//==============================================================================
juce_UseDebuggingNewOperator
private:
//[UserVariables] -- You can add your own custom variables in this section.
JaySynthMidiCC *pMidiCC;
midiCC_container_t *pMidiCC_container;
ListenerList <MidiCC_PopUp_Listener> listeners;
JaySynth::midiCC_info_t *pSavedMidiCCinfo;
synth_float_t lastMidiCCvalue;
synth_float_t savedParamValue;
synth_float_t currentParamValue;
synth_float_t currentControlValue;
synth_float_t lastControlValue;
synth_float_t lastParamValue;
//[/UserVariables]
//==============================================================================
TextButton* textButton_OK;
Label* label_MidiCC_ID;
Label* label_control_min;
Label* label_control_max;
Slider* slider_test;
ToggleButton* button_move_sliders_enable;
ToggleButton* button_assign_enable;
ToggleButton* button_midi_learn;
Label* label_parameter_name;
ToggleButton* button_apply_on_patch_init;
//==============================================================================
// (prevent copy constructor and operator= being generated..)
MidiCC_PopUp (const MidiCC_PopUp&);
const MidiCC_PopUp& operator= (const MidiCC_PopUp&);
};
#endif // __JUCER_HEADER_MIDICCPOPUP_MIDICCPOPUP_EA70576__