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
TextButtonAligned Class Reference

#include <TextButtonAligned.h>

+ Inheritance diagram for TextButtonAligned:

Public Member Functions

 TextButtonAligned (const juce::Justification::Flags alignment)
 
 TextButtonAligned (const juce::String &button_name, const juce::Justification::Flags alignment)
 
 TextButtonAligned (const juce::String &button_name, const juce::String &tool_tip, const juce::Justification::Flags alignment)
 
void paintButton (juce::Graphics &, bool, bool) override
 

Private Member Functions

void DrawButtonText (juce::Graphics &g, TextButton &button, bool should_draw_button_as_highlighted, bool should_draw_button_as_down) const
 

Private Attributes

juce::Justification::Flags alignment_ {juce::Justification::centredLeft}
 

Constructor & Destructor Documentation

◆ TextButtonAligned() [1/3]

TextButtonAligned::TextButtonAligned ( const juce::Justification::Flags  alignment)
inlineexplicit
28 : alignment_ {alignment}
29 {
30 }
juce::Justification::Flags alignment_
Definition TextButtonAligned.h:50

◆ TextButtonAligned() [2/3]

TextButtonAligned::TextButtonAligned ( const juce::String &  button_name,
const juce::Justification::Flags  alignment 
)
inline
33 : juce::TextButton(button_name), alignment_ {alignment}
34 {
35 }

◆ TextButtonAligned() [3/3]

TextButtonAligned::TextButtonAligned ( const juce::String &  button_name,
const juce::String &  tool_tip,
const juce::Justification::Flags  alignment 
)
inline
39 : juce::TextButton(button_name, tool_tip), alignment_ {alignment}
40 {
41 }

Member Function Documentation

◆ DrawButtonText()

void TextButtonAligned::DrawButtonText ( juce::Graphics &  g,
TextButton &  button,
bool  should_draw_button_as_highlighted,
bool  should_draw_button_as_down 
) const
private
40{
41 /* Based on drawButtonText in LookAndFeel_V2 (V3 doesn't override V2 for this call). Only change
42 * in my version is alignment on last line. */
43 const auto font {
44 juce::Component::getLookAndFeel().getTextButtonFont(button, button.getHeight())};
45 g.setFont(font);
46 g.setColour(button
47 .findColour(button.getToggleState() ? juce::TextButton::textColourOnId
48 : juce::TextButton::textColourOffId)
49 .withMultipliedAlpha(button.isEnabled() ? 1.0F : 0.5F));
50
51 const auto y_indent {std::min(4, button.proportionOfHeight(0.3F))}; //-V112
52 const auto corner_size {std::min(button.getHeight(), button.getWidth()) / 2};
53#ifdef _WIN32
54 const auto font_height {_cvt_ftoi_fast(font.getHeight() * 0.6F + 0.5F)};
55#else
56 const auto font_height {gsl::narrow_cast<int>(font.getHeight() * 0.6F + 0.5F)};
57#endif
58 const auto left_indent {
59 std::min(font_height, 2 + corner_size / (button.isConnectedOnLeft() ? 4 : 2))}; //-V112
60 const auto right_indent {
61 std::min(font_height, 2 + corner_size / (button.isConnectedOnRight() ? 4 : 2))}; //-V112
62
63 if (const auto text_width {button.getWidth() - left_indent - right_indent}; text_width > 0) {
64 g.drawFittedText(button.getButtonText(), left_indent, y_indent, text_width,
65 button.getHeight() - y_indent * 2, alignment_, 2);
66 }
67}
Definition MIDISender.h:24

◆ paintButton()

void TextButtonAligned::paintButton ( juce::Graphics &  g,
bool  should_draw_button_as_highlighted,
bool  should_draw_button_as_down 
)
override
25{
26 /* from TextButton.cpp: only change is second call from lf:: to TextButtonAligned:: */
27#pragma warning(suppress : 26812)
28 juce::Component::getLookAndFeel().drawButtonBackground(g, *this,
29 juce::Component::findColour(juce::Button::getToggleState()
30 ? juce::TextButton::ColourIds::buttonOnColourId
31 : juce::TextButton::ColourIds::buttonColourId),
32 should_draw_button_as_highlighted, should_draw_button_as_down);
33 /* the following normally calls lf.drawButtonText, hijacking the call for specific formatting */
34 DrawButtonText(g, *this, should_draw_button_as_highlighted, should_draw_button_as_down);
35}
void DrawButtonText(juce::Graphics &g, TextButton &button, bool should_draw_button_as_highlighted, bool should_draw_button_as_down) const
Definition TextButtonAligned.cpp:37

Member Data Documentation

◆ alignment_

juce::Justification::Flags TextButtonAligned::alignment_ {juce::Justification::centredLeft}
private
50{juce::Justification::centredLeft};

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