MIDI2LR 6.1.0.0
MIDI2LR is an application that interfaces MIDI controllers with Lightroom 6+/CC Classic. It processes MIDI input into develop parameter updates and photo actions, and sends MIDI output when parameters are changed for motorized feedback (on controllers that have motorized faders). A listing of available LightRoom commands is in the Wiki. Assistance on the code and design is welcome.
Loading...
Searching...
No Matches
CCoptions Class Reference

#include <CCoptions.h>

+ Inheritance diagram for CCoptions:

Public Member Functions

 CCoptions ()
 
 CCoptions (CCoptions &&other) noexcept=delete
 
 ~CCoptions ()
 
void BindToControl (int channel, int control_number)
 
void buttonClicked (juce::Button *buttonThatWasClicked) override
 
CCoptionsoperator= (CCoptions &&other) noexcept=delete
 
void paint (juce::Graphics &g) override
 
void resized () override
 

Static Public Member Functions

static void LinkToControlsModel (_In_ ControlsModel *model) noexcept
 

Private Member Functions

void textEditorFocusLost (juce::TextEditor &t) override
 

Private Attributes

std::unique_ptr< juce::ToggleButton > absbutton
 
std::unique_ptr< juce::TextButton > applyAll
 
std::unique_ptr< juce::ToggleButton > binbutton
 
int bound_channel_ {0}
 
int bound_number_ {0}
 
std::unique_ptr< juce::Label > controlID
 
std::unique_ptr< juce::GroupComponent > groupComponent
 
std::unique_ptr< juce::Label > maxvallabel
 
std::unique_ptr< juce::TextEditor > maxvaltext
 
std::unique_ptr< juce::Label > minvallabel
 
std::unique_ptr< juce::TextEditor > minvaltext
 
juce::TextEditor::LengthAndCharacterRestriction numrestrict_ {5, "0123456789"}
 
std::unique_ptr< juce::ToggleButton > signbutton
 
std::unique_ptr< juce::ToggleButton > twosbutton
 

Static Private Attributes

static ControlsModelcontrols_model_ {nullptr}
 

Detailed Description

[Comments] An auto-generated component, created by the Projucer.

Describe your class and how it works here! [/Comments]

Constructor & Destructor Documentation

◆ CCoptions() [1/2]

CCoptions::CCoptions ( )
50{
51 //[Constructor_pre] You can add your own custom stuff here..
52 //[/Constructor_pre]
53
54 groupComponent.reset(new GroupComponent("CCmethod", TRANS("CC Message Type")));
55 addAndMakeVisible(groupComponent.get());
56
57 groupComponent->setBounds(16, 60, 240, 157);
58
59 twosbutton.reset(new ToggleButton("twoscomp"));
60 addAndMakeVisible(twosbutton.get());
61 twosbutton->setTooltip(TRANS("Control value is 1 or greater when turned one way, and 127 or "
62 "smaller when turned the other."));
63 twosbutton->setExplicitFocusOrder(2);
64 twosbutton->setButtonText(TRANS("Two\'s complement"));
65 twosbutton->setConnectedEdges(Button::ConnectedOnTop | Button::ConnectedOnBottom);
66 twosbutton->setRadioGroupId(1);
67 twosbutton->addListener(this);
68
69 twosbutton->setBounds(40, 117, 150, 24);
70
71 absbutton.reset(new ToggleButton("Absolute"));
72 addAndMakeVisible(absbutton.get());
73 absbutton->setTooltip(
74 TRANS("Control value increases when turned one way, decreases when turned the other."));
75 absbutton->setExplicitFocusOrder(1);
76 absbutton->setConnectedEdges(Button::ConnectedOnBottom);
77 absbutton->setRadioGroupId(1);
78 absbutton->addListener(this);
79 absbutton->setToggleState(true, dontSendNotification);
80
81 absbutton->setBounds(40, 85, 150, 24);
82
83 binbutton.reset(new ToggleButton("Binaryoffset"));
84 addAndMakeVisible(binbutton.get());
85 binbutton->setTooltip(
86 TRANS("Control value is near 63 when turned one way, and near 65 when turned the other."));
87 binbutton->setExplicitFocusOrder(3);
88 binbutton->setButtonText(TRANS("Binary offset"));
89 binbutton->setConnectedEdges(Button::ConnectedOnTop | Button::ConnectedOnBottom);
90 binbutton->setRadioGroupId(1);
91 binbutton->addListener(this);
92
93 binbutton->setBounds(40, 149, 150, 24);
94
95 signbutton.reset(new ToggleButton("Signmagnitude"));
96 addAndMakeVisible(signbutton.get());
97 signbutton->setTooltip(
98 TRANS("Control value is near 1 when turned one way, and near 65 when turned the other."));
99 signbutton->setExplicitFocusOrder(4);
100 signbutton->setButtonText(TRANS("Sign and magnitude"));
101 signbutton->setConnectedEdges(Button::ConnectedOnTop);
102 signbutton->setRadioGroupId(1);
103 signbutton->addListener(this);
104
105 signbutton->setBounds(40, 181, 150, 24);
106
107 maxvaltext.reset(new TextEditor("maxvaltext"));
108 addAndMakeVisible(maxvaltext.get());
109 maxvaltext->setExplicitFocusOrder(6);
110 maxvaltext->setMultiLine(false);
111 maxvaltext->setReturnKeyStartsNewLine(false);
112 maxvaltext->setReadOnly(false);
113 maxvaltext->setScrollbarsShown(true);
114 maxvaltext->setCaretVisible(true);
115 maxvaltext->setPopupMenuEnabled(true);
116 maxvaltext->setText(TRANS("127"));
117
118 maxvaltext->setBounds(200, 268, 56, 24);
119
120 minvaltext.reset(new TextEditor("minvaltext"));
121 addAndMakeVisible(minvaltext.get());
122 minvaltext->setExplicitFocusOrder(5);
123 minvaltext->setMultiLine(false);
124 minvaltext->setReturnKeyStartsNewLine(false);
125 minvaltext->setReadOnly(false);
126 minvaltext->setScrollbarsShown(true);
127 minvaltext->setCaretVisible(true);
128 minvaltext->setPopupMenuEnabled(true);
129 minvaltext->setText(TRANS("0"));
130
131 minvaltext->setBounds(200, 228, 56, 24);
132
133 minvallabel.reset(new Label("new label", TRANS("Minimum value")));
134 addAndMakeVisible(minvallabel.get());
135 minvallabel->setFont(Font(15.00f, Font::plain).withTypefaceStyle("Regular"));
136 minvallabel->setJustificationType(Justification::centredLeft);
137 minvallabel->setEditable(false, false, false);
138 minvallabel->setColour(TextEditor::textColourId, Colours::black);
139 minvallabel->setColour(TextEditor::backgroundColourId, Colour(0x00000000));
140
141 minvallabel->setBounds(16, 228, 150, 24);
142
143 maxvallabel.reset(new Label("maxlabel", TRANS("Maximum value")));
144 addAndMakeVisible(maxvallabel.get());
145 maxvallabel->setFont(Font(15.00f, Font::plain).withTypefaceStyle("Regular"));
146 maxvallabel->setJustificationType(Justification::centredLeft);
147 maxvallabel->setEditable(false, false, false);
148 maxvallabel->setColour(TextEditor::textColourId, Colours::black);
149 maxvallabel->setColour(TextEditor::backgroundColourId, Colour(0x00000000));
150
151 maxvallabel->setBounds(16, 268, 150, 24);
152
153 applyAll.reset(new TextButton("new button"));
154 addAndMakeVisible(applyAll.get());
155 applyAll->setTooltip(TRANS("Apply these settings to all similar controls."));
156 applyAll->setExplicitFocusOrder(7);
157 applyAll->setButtonText(TRANS("Apply to all"));
158 applyAll->addListener(this);
159
160 controlID.reset(new Label("channel 0 number 0", TRANS("Channel 0 Number 0")));
161 addAndMakeVisible(controlID.get());
162 controlID->setFont(Font(15.00f, Font::plain).withTypefaceStyle("Regular"));
163 controlID->setJustificationType(Justification::centred);
164 controlID->setEditable(false, false, false);
165 controlID->setColour(TextEditor::textColourId, Colours::black);
166 controlID->setColour(TextEditor::backgroundColourId, Colour(0x00000000));
167
168 //[UserPreSize]
169 //[/UserPreSize]
170
171 setSize(280, 350);
172
173 //[Constructor] You can add your own custom stuff here..
174 maxvaltext->setInputFilter(&numrestrict_, false);
175 minvaltext->setInputFilter(&numrestrict_, false);
176 maxvaltext->addListener(this);
177 minvaltext->addListener(this);
178 //[/Constructor]
179}
std::unique_ptr< juce::TextEditor > maxvaltext
Definition CCoptions.h:96
std::unique_ptr< juce::Label > maxvallabel
Definition CCoptions.h:99
std::unique_ptr< juce::TextButton > applyAll
Definition CCoptions.h:100
std::unique_ptr< juce::ToggleButton > signbutton
Definition CCoptions.h:95
std::unique_ptr< juce::ToggleButton > twosbutton
Definition CCoptions.h:92
std::unique_ptr< juce::Label > controlID
Definition CCoptions.h:101
juce::TextEditor::LengthAndCharacterRestriction numrestrict_
Definition CCoptions.h:83
std::unique_ptr< juce::TextEditor > minvaltext
Definition CCoptions.h:97
std::unique_ptr< juce::ToggleButton > absbutton
Definition CCoptions.h:93
std::unique_ptr< juce::ToggleButton > binbutton
Definition CCoptions.h:94
std::unique_ptr< juce::GroupComponent > groupComponent
Definition CCoptions.h:91
std::unique_ptr< juce::Label > minvallabel
Definition CCoptions.h:98

◆ ~CCoptions()

CCoptions::~CCoptions ( )
182{
183 //[Destructor_pre]. You can add your own custom destruction code here..
184 //[/Destructor_pre]
185
186 groupComponent = nullptr;
187 twosbutton = nullptr;
188 absbutton = nullptr;
189 binbutton = nullptr;
190 signbutton = nullptr;
191 maxvaltext = nullptr;
192 minvaltext = nullptr;
193 minvallabel = nullptr;
194 maxvallabel = nullptr;
195 applyAll = nullptr;
196 controlID = nullptr;
197
198 //[Destructor]. You can add your own custom destruction code here..
199 //[/Destructor]
200}

◆ CCoptions() [2/2]

CCoptions::CCoptions ( CCoptions &&  other)
deletenoexcept

Member Function Documentation

◆ BindToControl()

void CCoptions::BindToControl ( int  channel,
int  control_number 
)
307{
308 bound_channel_ = channel; // 0-based but displays as 1-based
309 bound_number_ = control_number;
310 controlID->setText(
311 "channel " + juce::String(channel + 1) + " number " + juce::String(control_number),
312 juce::dontSendNotification);
314 juce::dontSendNotification);
316 juce::dontSendNotification);
319 absbutton->setToggleState(true, juce::sendNotification);
320 break;
322 binbutton->setToggleState(true, juce::sendNotification);
323 break;
325 signbutton->setToggleState(true, juce::sendNotification);
326 break;
328 twosbutton->setToggleState(true, juce::sendNotification);
329 break;
330 }
331}
static ControlsModel * controls_model_
Definition CCoptions.h:85
int bound_channel_
Definition CCoptions.h:86
int bound_number_
Definition CCoptions.h:87
rsj::CCmethod GetCcMethod(int channel, int controlnumber) const
Definition ControlsModel.h:244
int GetCcMax(int channel, int controlnumber) const
Definition ControlsModel.h:256
int GetCcMin(int channel, int controlnumber) const
Definition ControlsModel.h:261

◆ buttonClicked()

void CCoptions::buttonClicked ( juce::Button *  buttonThatWasClicked)
override
226{
227 //[UserbuttonClicked_Pre]
228 //[/UserbuttonClicked_Pre]
229
230 if (buttonThatWasClicked == twosbutton.get()) {
231 //[UserButtonCode_twosbutton] -- add your button handler code here..
232 minvaltext->setVisible(false);
233 minvallabel->setVisible(false);
234 maxvallabel->setText(TRANS("Resolution"), juce::dontSendNotification);
235 minvaltext->setText("0", juce::dontSendNotification);
237 //[/UserButtonCode_twosbutton]
238 }
239 else if (buttonThatWasClicked == absbutton.get()) {
240 //[UserButtonCode_absbutton] -- add your button handler code here..
241 minvaltext->setVisible(true);
242 minvallabel->setVisible(true);
243 maxvallabel->setText(TRANS("Maximum value"), juce::dontSendNotification);
245 //[/UserButtonCode_absbutton]
246 }
247 else if (buttonThatWasClicked == binbutton.get()) {
248 //[UserButtonCode_binbutton] -- add your button handler code here..
249 minvaltext->setVisible(false);
250 minvallabel->setVisible(false);
251 maxvallabel->setText(TRANS("Resolution"), juce::dontSendNotification);
252 minvaltext->setText("0", juce::dontSendNotification);
254
255 //[/UserButtonCode_binbutton]
256 }
257 else if (buttonThatWasClicked == signbutton.get()) {
258 //[UserButtonCode_signbutton] -- add your button handler code here..
259 minvaltext->setVisible(false);
260 minvallabel->setVisible(false);
261 maxvallabel->setText(TRANS("Resolution"), juce::dontSendNotification);
262 minvaltext->setText("0", juce::dontSendNotification);
264 //[/UserButtonCode_signbutton]
265 }
266 else if (buttonThatWasClicked == applyAll.get()) {
267 //[UserButtonCode_applyAll] -- add your button handler code here..
268 rsj::CCmethod ccm {};
269 if (twosbutton->getToggleState()) { ccm = rsj::CCmethod::kTwosComplement; }
270 else if (absbutton->getToggleState()) {
272 }
273 else if (binbutton->getToggleState()) {
275 }
276 else if (signbutton->getToggleState()) {
278 }
279 else {
280 throw std::logic_error("CCoptions::buttonClicked reached unreachable code");
281 }
283 maxvaltext->getText().getIntValue(), ccm);
284 //[/UserButtonCode_applyAll]
285 }
286 else { /* no action needed */
287 }
288
289 //[UserbuttonClicked_Post]
290 //[/UserbuttonClicked_Post]
291}
void SetCcMethod(int channel, int controlnumber, rsj::CCmethod value)
Definition ControlsModel.h:297
void SetCcAll(int channel, int controlnumber, int min, int max, rsj::CCmethod controltype)
Definition ControlsModel.h:287
CCmethod
Definition ControlsModel.h:33

◆ LinkToControlsModel()

static void CCoptions::LinkToControlsModel ( _In_ ControlsModel model)
inlinestaticnoexcept
67 {
68 controls_model_ = model;
69 }

◆ operator=()

CCoptions & CCoptions::operator= ( CCoptions &&  other)
deletenoexcept

◆ paint()

void CCoptions::paint ( juce::Graphics &  g)
override
204{
205 //[UserPrePaint] Add your own custom painting code here..
206 //[/UserPrePaint]
207
208 g.fillAll(Colours::white);
209
210 //[UserPaint] Add your own custom painting code here..
211 //[/UserPaint]
212}

◆ resized()

void CCoptions::resized ( )
override
215{
216 //[UserPreResize] Add your own custom resize code here..
217 //[/UserPreResize]
218
219 applyAll->setBounds((getWidth() / 2) - (150 / 2), (getHeight() / 2) + 141, 150, 24);
220 controlID->setBounds((getWidth() / 2) - (248 / 2), 16, 248, 24);
221 //[UserResized] Add your own custom resize handling here..
222 //[/UserResized]
223}

◆ textEditorFocusLost()

void CCoptions::textEditorFocusLost ( juce::TextEditor &  t)
overrideprivate
295{
296 const auto val = t.getText().getIntValue();
297 const auto& nam = t.getName();
298 if (nam == "minvaltext") { controls_model_->SetCcMin(bound_channel_, bound_number_, val); }
299 else if (nam == "maxvaltext") {
301 }
302 else { /* no action needed */
303 }
304}
void SetCcMax(int channel, int controlnumber, int value)
Definition ControlsModel.h:292
void SetCcMin(int channel, int controlnumber, int value)
Definition ControlsModel.h:302

Member Data Documentation

◆ absbutton

std::unique_ptr<juce::ToggleButton> CCoptions::absbutton
private

◆ applyAll

std::unique_ptr<juce::TextButton> CCoptions::applyAll
private

◆ binbutton

std::unique_ptr<juce::ToggleButton> CCoptions::binbutton
private

◆ bound_channel_

int CCoptions::bound_channel_ {0}
private
86{0}; // note: 0-based in program, add one to compensate for display

◆ bound_number_

int CCoptions::bound_number_ {0}
private
87{0};

◆ controlID

std::unique_ptr<juce::Label> CCoptions::controlID
private

◆ controls_model_

ControlsModel* CCoptions::controls_model_ {nullptr}
inlinestaticprivate
85{nullptr};

◆ groupComponent

std::unique_ptr<juce::GroupComponent> CCoptions::groupComponent
private

◆ maxvallabel

std::unique_ptr<juce::Label> CCoptions::maxvallabel
private

◆ maxvaltext

std::unique_ptr<juce::TextEditor> CCoptions::maxvaltext
private

◆ minvallabel

std::unique_ptr<juce::Label> CCoptions::minvallabel
private

◆ minvaltext

std::unique_ptr<juce::TextEditor> CCoptions::minvaltext
private

◆ numrestrict_

juce::TextEditor::LengthAndCharacterRestriction CCoptions::numrestrict_ {5, "0123456789"}
private
83{5, "0123456789"};

◆ signbutton

std::unique_ptr<juce::ToggleButton> CCoptions::signbutton
private

◆ twosbutton

std::unique_ptr<juce::ToggleButton> CCoptions::twosbutton
private

The documentation for this class was generated from the following files: