| 13 | : TextButton(name), m_id(id), m_withExtraButtons(extraButtons) {} |
| 14 | |
| 15 | void PluginButton::paintButton(Graphics& g, bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) { |
| 16 | auto bgcol = findColour(getToggleState() ? buttonOnColourId : buttonColourId); |
| 17 | auto baseColour = bgcol.withMultipliedSaturation(hasKeyboardFocus(true) ? 1.3f : 0.9f) |
| 18 | .withMultipliedAlpha(isEnabled() ? 0.5f : 0.7f); |
| 19 | if (shouldDrawButtonAsDown || shouldDrawButtonAsHighlighted) { |
| 20 | baseColour = baseColour.contrasting(shouldDrawButtonAsDown ? 0.2f : 0.05f); |
| 21 | } |
| 22 | auto fgColor = findColour(getToggleState() ? TextButton::textColourOnId : TextButton::textColourOffId) |
| 23 | .withMultipliedAlpha(isEnabled() ? 0.7f : 0.4f); |
| 24 | |
| 25 | Colour txtColor, bgColor; |
| 26 | float symLineThikness = 0.7f; |
| 27 | |
| 28 | if (!m_active || shouldDrawButtonAsDown || shouldDrawButtonAsHighlighted) { |
| 29 | g.setColour(baseColour); |
| 30 | g.fillRect(getLocalBounds()); |
| 31 | txtColor = fgColor; |
| 32 | bgColor = baseColour; |
| 33 | } |
| 34 | |
| 35 | if (m_active) { |
| 36 | txtColor = Colours::black; |
| 37 | bgColor = fgColor; |
| 38 | symLineThikness = 1.3f; |
| 39 | g.setColour(bgColor); |
| 40 | g.fillRect(getLocalBounds()); |
| 41 | g.setColour(baseColour); |
| 42 | float dashs[] = {4.0, 2.0}; |
| 43 | g.drawDashedLine(Line<float>(0.0f, 0.0f, (float)getWidth(), 0.0f), dashs, 2); |
| 44 | g.drawDashedLine(Line<float>(0.0f, (float)getHeight(), (float)getWidth(), (float)getHeight()), dashs, 2); |
| 45 | g.drawDashedLine(Line<float>(0.0f, 0.0f, 0.0f, (float)getHeight()), dashs, 2); |
| 46 | g.drawDashedLine(Line<float>((float)getWidth(), 0.0f, (float)getWidth(), (float)getHeight()), dashs, 2); |
| 47 | } |
| 48 | |
| 49 | int textIndentLeft = 0; |
| 50 | int textIndentRight = 0; |
| 51 | |
| 52 | if (m_withExtraButtons) { |
| 53 | // bypass button |
| 54 | int indent = 5; |
| 55 | int width = getHeight() - indent * 2; |
| 56 | textIndentLeft = indent * 2 + width; |
| 57 | |
| 58 | m_bypassArea = Rectangle<int>(indent, indent, width, width); |
| 59 | |
| 60 | int space = 4; |
| 61 | int indent_right = 6; |
| 62 | width = getHeight() - indent_right * 2; |
| 63 | int rightButtonCount = 3; |
| 64 | #if JucePlugin_IsSynth |
| 65 | rightButtonCount = 1; |
| 66 | #endif |
| 67 | textIndentRight = indent + (space + width) * rightButtonCount; |
| 68 | m_moveDownArea = Rectangle<int>(getWidth() - (width + space) * 3, indent_right, width, width); |
| 69 | m_moveUpArea = Rectangle<int>(getWidth() - (width + space) * 2, indent_right, width, width); |
| 70 | m_deleteArea = Rectangle<int>(getWidth() - width - space, indent_right, width, width); |
| 71 | |
| 72 | // bypass |
nothing calls this directly
no test coverage detected