Browse Source

Removed incorrect constness from ColourSelector::setSwatchColour

tags/2021-05-28
jules 8 years ago
parent
commit
57a3cb58ec
5 changed files with 11 additions and 14 deletions
  1. +1
    -1
      extras/Projucer/Source/ComponentEditor/properties/jucer_ColourPropertyComponent.h
  2. +1
    -1
      extras/Projucer/Source/Utility/jucer_StoredSettings.cpp
  3. +1
    -1
      extras/Projucer/Source/Utility/jucer_StoredSettings.h
  4. +7
    -10
      modules/juce_gui_extra/misc/juce_ColourSelector.cpp
  5. +1
    -1
      modules/juce_gui_extra/misc/juce_ColourSelector.h

+ 1
- 1
extras/Projucer/Source/ComponentEditor/properties/jucer_ColourPropertyComponent.h View File

@@ -163,7 +163,7 @@ public:
return getAppSettings().swatchColours [index];
}
void setSwatchColour (int index, const Colour& newColour) const override
void setSwatchColour (int index, const Colour& newColour) override
{
getAppSettings().swatchColours.set (index, newColour);
}


+ 1
- 1
extras/Projucer/Source/Utility/jucer_StoredSettings.cpp View File

@@ -208,7 +208,7 @@ Colour StoredSettings::ColourSelectorWithSwatches::getSwatchColour (int index) c
return getAppSettings().swatchColours [index];
}
void StoredSettings::ColourSelectorWithSwatches::setSwatchColour (int index, const Colour& newColour) const
void StoredSettings::ColourSelectorWithSwatches::setSwatchColour (int index, const Colour& newColour)
{
getAppSettings().swatchColours.set (index, newColour);
}


+ 1
- 1
extras/Projucer/Source/Utility/jucer_StoredSettings.h View File

@@ -57,7 +57,7 @@ public:
int getNumSwatches() const override;
Colour getSwatchColour (int index) const override;
void setSwatchColour (int index, const Colour& newColour) const override;
void setSwatchColour (int index, const Colour& newColour) override;
};
//==============================================================================


+ 7
- 10
modules/juce_gui_extra/misc/juce_ColourSelector.cpp View File

@@ -429,7 +429,7 @@ void ColourSelector::paint (Graphics& g)
if ((flags & showColourAtTop) != 0)
{
const Colour currentColour (getCurrentColour());
auto currentColour = getCurrentColour();
g.fillCheckerBoard (previewArea, 10, 10,
Colour (0xffdddddd).overlaidWith (currentColour),
@@ -446,14 +446,11 @@ void ColourSelector::paint (Graphics& g)
g.setColour (findColour (labelTextColourId));
g.setFont (11.0f);
for (int i = 4; --i >= 0;)
{
if (sliders[i]->isVisible())
g.drawText (sliders[i]->getName() + ":",
0, sliders[i]->getY(),
sliders[i]->getX() - 8, sliders[i]->getHeight(),
for (auto* s : sliders)
if (s->isVisible())
g.drawText (s->getName() + ":",
0, s->getY(), s->getX() - 8, s->getHeight(),
Justification::centredRight, false);
}
}
}
@@ -515,7 +512,7 @@ void ColourSelector::resized()
for (int i = 0; i < numSwatches; ++i)
{
SwatchComponent* const sc = new SwatchComponent (*this, i);
auto* sc = new SwatchComponent (*this, i);
swatchComponents.add (sc);
addAndMakeVisible (sc);
}
@@ -566,7 +563,7 @@ Colour ColourSelector::getSwatchColour (const int) const
return Colours::black;
}
void ColourSelector::setSwatchColour (const int, const Colour&) const
void ColourSelector::setSwatchColour (int, const Colour&)
{
jassertfalse; // if you've overridden getNumSwatches(), you also need to implement this method
}

+ 1
- 1
modules/juce_gui_extra/misc/juce_ColourSelector.h View File

@@ -110,7 +110,7 @@ public:
setSwatchColour(), to return the number of colours you want, and to set and retrieve
their values.
*/
virtual void setSwatchColour (int index, const Colour& newColour) const;
virtual void setSwatchColour (int index, const Colour& newColour);
//==============================================================================


Loading…
Cancel
Save