upgrade to JUCE 5.4.3. Remove (probably) unused JUCE modules. Remove VST2 target (it's been end-of-life'd by Steinberg and by JUCE)
This commit is contained in:
@ -369,16 +369,8 @@ void ComboBox::paint (Graphics& g)
|
||||
label->getRight(), 0, getWidth() - label->getRight(), getHeight(),
|
||||
*this);
|
||||
|
||||
if (textWhenNothingSelected.isNotEmpty()
|
||||
&& label->getText().isEmpty()
|
||||
&& ! label->isBeingEdited())
|
||||
{
|
||||
g.setColour (findColour (textColourId).withMultipliedAlpha (0.5f));
|
||||
g.setFont (label->getLookAndFeel().getLabelFont (*label));
|
||||
g.drawFittedText (textWhenNothingSelected, label->getBounds().reduced (2, 1),
|
||||
label->getJustificationType(),
|
||||
jmax (1, (int) (label->getHeight() / label->getFont().getHeight())));
|
||||
}
|
||||
if (textWhenNothingSelected.isNotEmpty() && label->getText().isEmpty() && ! label->isBeingEdited())
|
||||
getLookAndFeel().drawComboBoxTextWhenNothingSelected (g, *this, *label);
|
||||
}
|
||||
|
||||
void ComboBox::resized()
|
||||
@ -523,6 +515,9 @@ static void comboBoxPopupMenuFinishedCallback (int result, ComboBox* combo)
|
||||
|
||||
void ComboBox::showPopup()
|
||||
{
|
||||
if (! menuActive)
|
||||
menuActive = true;
|
||||
|
||||
auto menu = currentMenu;
|
||||
|
||||
if (menu.getNumItems() > 0)
|
||||
@ -542,12 +537,10 @@ void ComboBox::showPopup()
|
||||
menu.addItem (1, noChoicesMessage, false, false);
|
||||
}
|
||||
|
||||
menu.setLookAndFeel (&getLookAndFeel());
|
||||
menu.showMenuAsync (PopupMenu::Options().withTargetComponent (this)
|
||||
.withItemThatMustBeVisible (getSelectedId())
|
||||
.withMinimumWidth (getWidth())
|
||||
.withMaximumNumColumns (1)
|
||||
.withStandardItemHeight (label->getHeight()),
|
||||
auto& lf = getLookAndFeel();
|
||||
|
||||
menu.setLookAndFeel (&lf);
|
||||
menu.showMenuAsync (lf.getOptionsForComboBoxPopupMenu (*this, *label),
|
||||
ModalCallbackFunction::forComponent (comboBoxPopupMenuFinishedCallback, this));
|
||||
}
|
||||
|
||||
|
@ -58,10 +58,10 @@ public:
|
||||
|
||||
@param componentName the name to set for the component (see Component::setName())
|
||||
*/
|
||||
explicit ComboBox (const String& componentName = String());
|
||||
explicit ComboBox (const String& componentName = {});
|
||||
|
||||
/** Destructor. */
|
||||
virtual ~ComboBox();
|
||||
~ComboBox() override;
|
||||
|
||||
//==============================================================================
|
||||
/** Sets whether the text in the combo-box is editable.
|
||||
@ -240,7 +240,7 @@ public:
|
||||
|
||||
The text passed-in will be set as the current text regardless of whether
|
||||
it is one of the items in the list. If the current text isn't one of the
|
||||
items, then getSelectedId() will return -1, otherwise it wil return
|
||||
items, then getSelectedId() will return 0, otherwise it wil return
|
||||
the approriate ID.
|
||||
|
||||
@param newText the text to select
|
||||
@ -288,7 +288,7 @@ public:
|
||||
{
|
||||
public:
|
||||
/** Destructor. */
|
||||
virtual ~Listener() {}
|
||||
virtual ~Listener() = default;
|
||||
|
||||
/** Called when a ComboBox has its selected item changed. */
|
||||
virtual void comboBoxChanged (ComboBox* comboBoxThatHasChanged) = 0;
|
||||
@ -365,7 +365,7 @@ public:
|
||||
*/
|
||||
struct JUCE_API LookAndFeelMethods
|
||||
{
|
||||
virtual ~LookAndFeelMethods() {}
|
||||
virtual ~LookAndFeelMethods() = default;
|
||||
|
||||
virtual void drawComboBox (Graphics&, int width, int height, bool isButtonDown,
|
||||
int buttonX, int buttonY, int buttonW, int buttonH,
|
||||
@ -376,6 +376,10 @@ public:
|
||||
virtual Label* createComboBoxTextBox (ComboBox&) = 0;
|
||||
|
||||
virtual void positionComboBoxText (ComboBox&, Label& labelToPosition) = 0;
|
||||
|
||||
virtual PopupMenu::Options getOptionsForComboBoxPopupMenu (ComboBox&, Label&) = 0;
|
||||
|
||||
virtual void drawComboBoxTextWhenNothingSelected (Graphics&, ComboBox&, Label&) = 0;
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
ImageComponent (const String& componentName = String());
|
||||
|
||||
/** Destructor. */
|
||||
~ImageComponent();
|
||||
~ImageComponent() override;
|
||||
|
||||
//==============================================================================
|
||||
/** Sets the image that should be displayed. */
|
||||
|
@ -131,16 +131,17 @@ void Label::setBorderSize (BorderSize<int> newBorder)
|
||||
//==============================================================================
|
||||
Component* Label::getAttachedComponent() const
|
||||
{
|
||||
return static_cast<Component*> (ownerComponent);
|
||||
return ownerComponent.get();
|
||||
}
|
||||
|
||||
void Label::attachToComponent (Component* owner, bool onLeft)
|
||||
{
|
||||
jassert (owner != this); // Not a great idea to try to attach it to itself!
|
||||
|
||||
if (ownerComponent != nullptr)
|
||||
ownerComponent->removeComponentListener (this);
|
||||
|
||||
ownerComponent = owner;
|
||||
|
||||
leftOfOwnerComp = onLeft;
|
||||
|
||||
if (ownerComponent != nullptr)
|
||||
@ -154,19 +155,21 @@ void Label::attachToComponent (Component* owner, bool onLeft)
|
||||
|
||||
void Label::componentMovedOrResized (Component& component, bool /*wasMoved*/, bool /*wasResized*/)
|
||||
{
|
||||
auto f = getLookAndFeel().getLabelFont (*this);
|
||||
auto& lf = getLookAndFeel();
|
||||
auto f = lf.getLabelFont (*this);
|
||||
auto borderSize = lf.getLabelBorderSize (*this);
|
||||
|
||||
if (leftOfOwnerComp)
|
||||
{
|
||||
auto width = jmin (roundToInt (f.getStringWidthFloat (textValue.toString()) + 0.5f)
|
||||
+ getBorderSize().getLeftAndRight(),
|
||||
+ borderSize.getLeftAndRight(),
|
||||
component.getX());
|
||||
|
||||
setBounds (component.getX() - width, component.getY(), width, component.getHeight());
|
||||
}
|
||||
else
|
||||
{
|
||||
auto height = getBorderSize().getTopAndBottom() + 6 + roundToInt (f.getHeight() + 0.5f);
|
||||
auto height = borderSize.getTopAndBottom() + 6 + roundToInt (f.getHeight() + 0.5f);
|
||||
|
||||
setBounds (component.getX(), component.getY() - height, component.getWidth(), height);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
const String& labelText = String());
|
||||
|
||||
/** Destructor. */
|
||||
~Label();
|
||||
~Label() override;
|
||||
|
||||
//==============================================================================
|
||||
/** Changes the label text.
|
||||
@ -184,7 +184,7 @@ public:
|
||||
{
|
||||
public:
|
||||
/** Destructor. */
|
||||
virtual ~Listener() {}
|
||||
virtual ~Listener() = default;
|
||||
|
||||
/** Called when a Label's text has changed. */
|
||||
virtual void labelTextChanged (Label* labelThatHasChanged) = 0;
|
||||
@ -276,10 +276,11 @@ public:
|
||||
*/
|
||||
struct JUCE_API LookAndFeelMethods
|
||||
{
|
||||
virtual ~LookAndFeelMethods() {}
|
||||
virtual ~LookAndFeelMethods() = default;
|
||||
|
||||
virtual void drawLabel (Graphics&, Label&) = 0;
|
||||
virtual Font getLabelFont (Label&) = 0;
|
||||
virtual BorderSize<int> getLabelBorderSize (Label&) = 0;
|
||||
};
|
||||
|
||||
protected:
|
||||
|
@ -352,7 +352,7 @@ struct ListBoxMouseMoveSelector : public MouseListener
|
||||
owner.addMouseListener (this, true);
|
||||
}
|
||||
|
||||
~ListBoxMouseMoveSelector()
|
||||
~ListBoxMouseMoveSelector() override
|
||||
{
|
||||
owner.removeMouseListener (this);
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ class JUCE_API ListBoxModel
|
||||
public:
|
||||
//==============================================================================
|
||||
/** Destructor. */
|
||||
virtual ~ListBoxModel() {}
|
||||
virtual ~ListBoxModel() = default;
|
||||
|
||||
//==============================================================================
|
||||
/** This has to return the number of items in the list.
|
||||
@ -193,7 +193,7 @@ public:
|
||||
ListBoxModel* model = nullptr);
|
||||
|
||||
/** Destructor. */
|
||||
~ListBox();
|
||||
~ListBox() override;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
|
@ -65,7 +65,7 @@ public:
|
||||
explicit ProgressBar (double& progress);
|
||||
|
||||
/** Destructor. */
|
||||
~ProgressBar();
|
||||
~ProgressBar() override;
|
||||
|
||||
//==============================================================================
|
||||
/** Turns the percentage display on or off.
|
||||
@ -102,7 +102,7 @@ public:
|
||||
/** This abstract base class is implemented by LookAndFeel classes. */
|
||||
struct JUCE_API LookAndFeelMethods
|
||||
{
|
||||
virtual ~LookAndFeelMethods() {}
|
||||
virtual ~LookAndFeelMethods() = default;
|
||||
|
||||
/** Draws a progress bar.
|
||||
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
rotaryParams.stopAtEnd = true;
|
||||
}
|
||||
|
||||
~Pimpl()
|
||||
~Pimpl() override
|
||||
{
|
||||
currentValue.removeListener (this);
|
||||
valueMin.removeListener (this);
|
||||
@ -88,6 +88,18 @@ public:
|
||||
|| style == LinearBarVertical;
|
||||
}
|
||||
|
||||
bool isTwoValue() const noexcept
|
||||
{
|
||||
return style == TwoValueHorizontal
|
||||
|| style == TwoValueVertical;
|
||||
}
|
||||
|
||||
bool isThreeValue() const noexcept
|
||||
{
|
||||
return style == ThreeValueHorizontal
|
||||
|| style == ThreeValueVertical;
|
||||
}
|
||||
|
||||
bool incDecDragDirectionIsHorizontal() const noexcept
|
||||
{
|
||||
return incDecButtonMode == incDecButtonsDraggable_Horizontal
|
||||
@ -650,10 +662,7 @@ public:
|
||||
|
||||
int getThumbIndexAt (const MouseEvent& e)
|
||||
{
|
||||
bool isTwoValue = (style == TwoValueHorizontal || style == TwoValueVertical);
|
||||
bool isThreeValue = (style == ThreeValueHorizontal || style == ThreeValueVertical);
|
||||
|
||||
if (isTwoValue || isThreeValue)
|
||||
if (isTwoValue() || isThreeValue())
|
||||
{
|
||||
auto mousePos = isVertical() ? e.position.y : e.position.x;
|
||||
|
||||
@ -661,7 +670,7 @@ public:
|
||||
auto minPosDistance = std::abs (getLinearSliderPos (valueMin.getValue()) + (isVertical() ? 0.1f : -0.1f) - mousePos);
|
||||
auto maxPosDistance = std::abs (getLinearSliderPos (valueMax.getValue()) + (isVertical() ? -0.1f : 0.1f) - mousePos);
|
||||
|
||||
if (isTwoValue)
|
||||
if (isTwoValue())
|
||||
return maxPosDistance <= minPosDistance ? 2 : 1;
|
||||
|
||||
if (normalPosDistance >= minPosDistance && maxPosDistance >= minPosDistance)
|
||||
@ -819,7 +828,7 @@ public:
|
||||
showPopupMenu();
|
||||
}
|
||||
else if (canDoubleClickToValue()
|
||||
&& e.mods.withoutMouseButtons() == ModifierKeys (ModifierKeys::altModifier))
|
||||
&& (singleClickModifiers != ModifierKeys() && e.mods.withoutMouseButtons() == singleClickModifiers))
|
||||
{
|
||||
mouseDoubleClick();
|
||||
}
|
||||
@ -834,9 +843,10 @@ public:
|
||||
|
||||
minMaxDiff = static_cast<double> (valueMax.getValue()) - static_cast<double> (valueMin.getValue());
|
||||
|
||||
lastAngle = rotaryParams.startAngleRadians
|
||||
+ (rotaryParams.endAngleRadians - rotaryParams.startAngleRadians)
|
||||
* owner.valueToProportionOfLength (currentValue.getValue());
|
||||
if (! isTwoValue())
|
||||
lastAngle = rotaryParams.startAngleRadians
|
||||
+ (rotaryParams.endAngleRadians - rotaryParams.startAngleRadians)
|
||||
* owner.valueToProportionOfLength (currentValue.getValue());
|
||||
|
||||
valueWhenLastDragged = (sliderBeingDragged == 2 ? valueMax
|
||||
: (sliderBeingDragged == 1 ? valueMin
|
||||
@ -955,17 +965,14 @@ public:
|
||||
|
||||
void mouseMove()
|
||||
{
|
||||
auto isTwoValue = (style == TwoValueHorizontal || style == TwoValueVertical);
|
||||
auto isThreeValue = (style == ThreeValueHorizontal || style == ThreeValueVertical);
|
||||
|
||||
// this is a workaround for a bug where the popup display being dismissed triggers
|
||||
// a mouse move causing it to never be hidden
|
||||
auto shouldShowPopup = showPopupOnHover
|
||||
&& (Time::getMillisecondCounterHiRes() - lastPopupDismissal) > 250;
|
||||
|
||||
if (shouldShowPopup
|
||||
&& ! isTwoValue
|
||||
&& ! isThreeValue)
|
||||
&& ! isTwoValue()
|
||||
&& ! isThreeValue())
|
||||
{
|
||||
if (owner.isMouseOver (true))
|
||||
{
|
||||
@ -990,12 +997,14 @@ public:
|
||||
|
||||
if (popupDisplay == nullptr)
|
||||
{
|
||||
popupDisplay.reset (new PopupDisplayComponent (owner));
|
||||
popupDisplay.reset (new PopupDisplayComponent (owner, parentForPopupDisplay == nullptr));
|
||||
|
||||
if (parentForPopupDisplay != nullptr)
|
||||
parentForPopupDisplay->addChildComponent (popupDisplay.get());
|
||||
else
|
||||
popupDisplay->addToDesktop (ComponentPeer::windowIsTemporary);
|
||||
popupDisplay->addToDesktop (ComponentPeer::windowIsTemporary
|
||||
| ComponentPeer::windowIgnoresKeyPresses
|
||||
| ComponentPeer::windowIgnoresMouseClicks);
|
||||
|
||||
if (style == SliderStyle::TwoValueHorizontal
|
||||
|| style == SliderStyle::TwoValueVertical)
|
||||
@ -1268,6 +1277,8 @@ public:
|
||||
int popupHoverTimeout = 2000;
|
||||
double lastPopupDismissal = 0.0;
|
||||
|
||||
ModifierKeys singleClickModifiers;
|
||||
|
||||
std::unique_ptr<Label> valueBox;
|
||||
std::unique_ptr<Button> incButton, decButton;
|
||||
|
||||
@ -1275,18 +1286,22 @@ public:
|
||||
struct PopupDisplayComponent : public BubbleComponent,
|
||||
public Timer
|
||||
{
|
||||
PopupDisplayComponent (Slider& s)
|
||||
PopupDisplayComponent (Slider& s, bool isOnDesktop)
|
||||
: owner (s),
|
||||
font (s.getLookAndFeel().getSliderPopupFont (s))
|
||||
{
|
||||
if (isOnDesktop)
|
||||
setTransform (AffineTransform::scale (getApproximateScaleFactor (&s)));
|
||||
|
||||
setAlwaysOnTop (true);
|
||||
setAllowedPlacement (owner.getLookAndFeel().getSliderPopupPlacement (s));
|
||||
setLookAndFeel (&s.getLookAndFeel());
|
||||
}
|
||||
|
||||
~PopupDisplayComponent()
|
||||
~PopupDisplayComponent() override
|
||||
{
|
||||
owner.pimpl->lastPopupDismissal = Time::getMillisecondCounterHiRes();
|
||||
if (owner.pimpl != nullptr)
|
||||
owner.pimpl->lastPopupDismissal = Time::getMillisecondCounterHiRes();
|
||||
}
|
||||
|
||||
void paintContent (Graphics& g, int w, int h) override
|
||||
@ -1316,6 +1331,22 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
static float getApproximateScaleFactor (Component* targetComponent)
|
||||
{
|
||||
AffineTransform transform;
|
||||
|
||||
for (Component* target = targetComponent; target != nullptr; target = target->getParentComponent())
|
||||
{
|
||||
transform = transform.followedBy (target->getTransform());
|
||||
|
||||
if (target->isOnDesktop())
|
||||
transform = transform.scaled (target->getDesktopScaleFactor());
|
||||
}
|
||||
|
||||
return (transform.getScaleFactor() / Desktop::getInstance().getGlobalScaleFactor());
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
Slider& owner;
|
||||
Font font;
|
||||
String text;
|
||||
@ -1514,10 +1545,11 @@ void Slider::setMinAndMaxValues (double newMinValue, double newMaxValue, Notific
|
||||
pimpl->setMinAndMaxValues (newMinValue, newMaxValue, notification);
|
||||
}
|
||||
|
||||
void Slider::setDoubleClickReturnValue (bool isDoubleClickEnabled, double valueToSetOnDoubleClick)
|
||||
void Slider::setDoubleClickReturnValue (bool isDoubleClickEnabled, double valueToSetOnDoubleClick, ModifierKeys mods)
|
||||
{
|
||||
pimpl->doubleClickToValue = isDoubleClickEnabled;
|
||||
pimpl->doubleClickReturnValue = valueToSetOnDoubleClick;
|
||||
pimpl->singleClickModifiers = mods;
|
||||
}
|
||||
|
||||
double Slider::getDoubleClickReturnValue() const noexcept { return pimpl->doubleClickReturnValue; }
|
||||
@ -1540,25 +1572,30 @@ String Slider::getTextValueSuffix() const
|
||||
|
||||
String Slider::getTextFromValue (double v)
|
||||
{
|
||||
if (textFromValueFunction != nullptr)
|
||||
return textFromValueFunction (v);
|
||||
auto getText = [this] (double val)
|
||||
{
|
||||
if (textFromValueFunction != nullptr)
|
||||
return textFromValueFunction (val);
|
||||
|
||||
if (getNumDecimalPlacesToDisplay() > 0)
|
||||
return String (v, getNumDecimalPlacesToDisplay()) + getTextValueSuffix();
|
||||
if (getNumDecimalPlacesToDisplay() > 0)
|
||||
return String (val, getNumDecimalPlacesToDisplay());
|
||||
|
||||
return String (roundToInt (v)) + getTextValueSuffix();
|
||||
return String (roundToInt (val));
|
||||
};
|
||||
|
||||
return getText (v) + getTextValueSuffix();
|
||||
}
|
||||
|
||||
double Slider::getValueFromText (const String& text)
|
||||
{
|
||||
if (valueFromTextFunction != nullptr)
|
||||
return valueFromTextFunction (text);
|
||||
|
||||
auto t = text.trimStart();
|
||||
|
||||
if (t.endsWith (getTextValueSuffix()))
|
||||
t = t.substring (0, t.length() - getTextValueSuffix().length());
|
||||
|
||||
if (valueFromTextFunction != nullptr)
|
||||
return valueFromTextFunction (t);
|
||||
|
||||
while (t.startsWithChar ('+'))
|
||||
t = t.substring (1).trimStart();
|
||||
|
||||
@ -1603,6 +1640,8 @@ bool Slider::isHorizontal() const noexcept { return pimpl->isHo
|
||||
bool Slider::isVertical() const noexcept { return pimpl->isVertical(); }
|
||||
bool Slider::isRotary() const noexcept { return pimpl->isRotary(); }
|
||||
bool Slider::isBar() const noexcept { return pimpl->isBar(); }
|
||||
bool Slider::isTwoValue() const noexcept { return pimpl->isTwoValue(); }
|
||||
bool Slider::isThreeValue() const noexcept { return pimpl->isThreeValue(); }
|
||||
|
||||
float Slider::getPositionOfValue (double value) const { return pimpl->getPositionOfValue (value); }
|
||||
|
||||
|
@ -125,7 +125,7 @@ public:
|
||||
Slider (SliderStyle style, TextEntryBoxPosition textBoxPosition);
|
||||
|
||||
/** Destructor. */
|
||||
~Slider();
|
||||
~Slider() override;
|
||||
|
||||
//==============================================================================
|
||||
/** Changes the type of slider interface being used.
|
||||
@ -558,7 +558,7 @@ public:
|
||||
public:
|
||||
//==============================================================================
|
||||
/** Destructor. */
|
||||
virtual ~Listener() {}
|
||||
virtual ~Listener() = default;
|
||||
|
||||
//==============================================================================
|
||||
/** Called when the slider's value is changed.
|
||||
@ -612,16 +612,19 @@ public:
|
||||
std::function<String (double)> textFromValueFunction;
|
||||
|
||||
//==============================================================================
|
||||
/** This lets you choose whether double-clicking moves the slider to a given position.
|
||||
/** This lets you choose whether double-clicking or single-clicking with a specified
|
||||
key modifier moves the slider to a given position.
|
||||
|
||||
By default this is turned off, but it's handy if you want a double-click to act
|
||||
as a quick way of resetting a slider. Just pass in the value you want it to
|
||||
go to when double-clicked.
|
||||
By default this is turned off, but it's handy if you want either of these actions
|
||||
to act as a quick way of resetting a slider. Just pass in the value you want it to
|
||||
go to when double-clicked. By default the key modifier is the alt key but you can
|
||||
pass in another key modifier, or none to disable this behaviour.
|
||||
|
||||
@see getDoubleClickReturnValue
|
||||
*/
|
||||
void setDoubleClickReturnValue (bool shouldDoubleClickBeEnabled,
|
||||
double valueToSetOnDoubleClick);
|
||||
double valueToSetOnDoubleClick,
|
||||
ModifierKeys singleClickModifiers = ModifierKeys::altModifier);
|
||||
|
||||
/** Returns the values last set by setDoubleClickReturnValue() method.
|
||||
@see setDoubleClickReturnValue
|
||||
@ -843,6 +846,10 @@ public:
|
||||
bool isRotary() const noexcept;
|
||||
/** True if the slider is in a linear bar mode. */
|
||||
bool isBar() const noexcept;
|
||||
/** True if the slider has two thumbs. */
|
||||
bool isTwoValue() const noexcept;
|
||||
/** True if the slider has three thumbs. */
|
||||
bool isThreeValue() const noexcept;
|
||||
|
||||
//==============================================================================
|
||||
/** A set of colour IDs to use to change the colour of various aspects of the slider.
|
||||
@ -883,7 +890,7 @@ public:
|
||||
*/
|
||||
struct JUCE_API LookAndFeelMethods
|
||||
{
|
||||
virtual ~LookAndFeelMethods() {}
|
||||
virtual ~LookAndFeelMethods() = default;
|
||||
|
||||
//==============================================================================
|
||||
virtual void drawLinearSlider (Graphics&,
|
||||
@ -973,8 +980,6 @@ public:
|
||||
private:
|
||||
//==============================================================================
|
||||
JUCE_PUBLIC_IN_DLL_BUILD (class Pimpl)
|
||||
friend class Pimpl;
|
||||
friend struct ContainerDeletePolicy<Pimpl>;
|
||||
std::unique_ptr<Pimpl> pimpl;
|
||||
|
||||
void init (SliderStyle, TextEntryBoxPosition);
|
||||
|
@ -156,7 +156,7 @@ void TableHeaderComponent::moveColumn (const int columnId, int newIndex)
|
||||
auto currentIndex = getIndexOfColumnId (columnId, false);
|
||||
newIndex = visibleIndexToTotalIndex (newIndex);
|
||||
|
||||
if (columns [currentIndex] != 0 && currentIndex != newIndex)
|
||||
if (columns[currentIndex] != nullptr && currentIndex != newIndex)
|
||||
{
|
||||
columns.move (currentIndex, newIndex);
|
||||
sendColumnsChanged();
|
||||
@ -436,40 +436,42 @@ String TableHeaderComponent::toString() const
|
||||
|
||||
void TableHeaderComponent::restoreFromString (const String& storedVersion)
|
||||
{
|
||||
std::unique_ptr<XmlElement> storedXml (XmlDocument::parse (storedVersion));
|
||||
int index = 0;
|
||||
|
||||
if (storedXml != nullptr && storedXml->hasTagName ("TABLELAYOUT"))
|
||||
if (auto storedXML = parseXML (storedVersion))
|
||||
{
|
||||
forEachXmlChildElement (*storedXml, col)
|
||||
if (storedXML->hasTagName ("TABLELAYOUT"))
|
||||
{
|
||||
auto tabId = col->getIntAttribute ("id");
|
||||
int index = 0;
|
||||
|
||||
if (auto* ci = getInfoForId (tabId))
|
||||
forEachXmlChildElement (*storedXML, col)
|
||||
{
|
||||
columns.move (columns.indexOf (ci), index);
|
||||
ci->width = col->getIntAttribute ("width");
|
||||
setColumnVisible (tabId, col->getBoolAttribute ("visible"));
|
||||
auto tabId = col->getIntAttribute ("id");
|
||||
|
||||
if (auto* ci = getInfoForId (tabId))
|
||||
{
|
||||
columns.move (columns.indexOf (ci), index);
|
||||
ci->width = col->getIntAttribute ("width");
|
||||
setColumnVisible (tabId, col->getBoolAttribute ("visible"));
|
||||
}
|
||||
|
||||
++index;
|
||||
}
|
||||
|
||||
++index;
|
||||
columnsResized = true;
|
||||
sendColumnsChanged();
|
||||
|
||||
setSortColumnId (storedXML->getIntAttribute ("sortedCol"),
|
||||
storedXML->getBoolAttribute ("sortForwards", true));
|
||||
}
|
||||
|
||||
columnsResized = true;
|
||||
sendColumnsChanged();
|
||||
|
||||
setSortColumnId (storedXml->getIntAttribute ("sortedCol"),
|
||||
storedXml->getBoolAttribute ("sortForwards", true));
|
||||
}
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
void TableHeaderComponent::addListener (Listener* const newListener)
|
||||
void TableHeaderComponent::addListener (Listener* newListener)
|
||||
{
|
||||
listeners.addIfNotAlreadyThere (newListener);
|
||||
}
|
||||
|
||||
void TableHeaderComponent::removeListener (Listener* const listenerToRemove)
|
||||
void TableHeaderComponent::removeListener (Listener* listenerToRemove)
|
||||
{
|
||||
listeners.removeFirstMatchingValue (listenerToRemove);
|
||||
}
|
||||
@ -499,11 +501,11 @@ void TableHeaderComponent::reactToMenuItem (const int menuReturnId, const int /*
|
||||
|
||||
void TableHeaderComponent::paint (Graphics& g)
|
||||
{
|
||||
LookAndFeel& lf = getLookAndFeel();
|
||||
auto& lf = getLookAndFeel();
|
||||
|
||||
lf.drawTableHeaderBackground (g, *this);
|
||||
|
||||
const Rectangle<int> clip (g.getClipBounds());
|
||||
auto clip = g.getClipBounds();
|
||||
|
||||
int x = 0;
|
||||
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
TableHeaderComponent();
|
||||
|
||||
/** Destructor. */
|
||||
~TableHeaderComponent();
|
||||
~TableHeaderComponent() override;
|
||||
|
||||
//==============================================================================
|
||||
/** A combination of these flags are passed into the addColumn() method to specify
|
||||
@ -306,10 +306,10 @@ public:
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
Listener() {}
|
||||
Listener() = default;
|
||||
|
||||
/** Destructor. */
|
||||
virtual ~Listener() {}
|
||||
virtual ~Listener() = default;
|
||||
|
||||
//==============================================================================
|
||||
/** This is called when some of the table's columns are added, removed, hidden,
|
||||
@ -390,7 +390,7 @@ public:
|
||||
/** This abstract base class is implemented by LookAndFeel classes. */
|
||||
struct JUCE_API LookAndFeelMethods
|
||||
{
|
||||
virtual ~LookAndFeelMethods() {}
|
||||
virtual ~LookAndFeelMethods() = default;
|
||||
|
||||
virtual void drawTableHeaderBackground (Graphics&, TableHeaderComponent&) = 0;
|
||||
|
||||
|
@ -42,10 +42,10 @@ class JUCE_API TableListBoxModel
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
TableListBoxModel() {}
|
||||
TableListBoxModel() = default;
|
||||
|
||||
/** Destructor. */
|
||||
virtual ~TableListBoxModel() {}
|
||||
virtual ~TableListBoxModel() = default;
|
||||
|
||||
//==============================================================================
|
||||
/** This must return the number of rows currently in the table.
|
||||
@ -225,7 +225,7 @@ public:
|
||||
TableListBoxModel* model = nullptr);
|
||||
|
||||
/** Destructor. */
|
||||
~TableListBox();
|
||||
~TableListBox() override;
|
||||
|
||||
//==============================================================================
|
||||
/** Changes the TableListBoxModel that is being used for this table.
|
||||
|
@ -77,9 +77,9 @@ public:
|
||||
|
||||
// VS2013 can't default move constructors
|
||||
UniformTextSection (UniformTextSection&& other)
|
||||
: font (static_cast<Font&&> (other.font)),
|
||||
: font (std::move (other.font)),
|
||||
colour (other.colour),
|
||||
atoms (static_cast<Array<TextAtom>&&> (other.atoms))
|
||||
atoms (std::move (other.atoms))
|
||||
{
|
||||
}
|
||||
|
||||
@ -711,13 +711,13 @@ struct TextEditor::InsertAction : public UndoableAction
|
||||
|
||||
bool perform() override
|
||||
{
|
||||
owner.insert (text, insertIndex, font, colour, 0, newCaretPos);
|
||||
owner.insert (text, insertIndex, font, colour, nullptr, newCaretPos);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool undo() override
|
||||
{
|
||||
owner.remove ({ insertIndex, insertIndex + text.length() }, 0, oldCaretPos);
|
||||
owner.remove ({ insertIndex, insertIndex + text.length() }, nullptr, oldCaretPos);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -751,7 +751,7 @@ struct TextEditor::RemoveAction : public UndoableAction
|
||||
|
||||
bool perform() override
|
||||
{
|
||||
owner.remove (range, 0, newCaretPos);
|
||||
owner.remove (range, nullptr, newCaretPos);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -795,7 +795,7 @@ struct TextEditor::TextHolderComponent : public Component,
|
||||
owner.getTextValue().addListener (this);
|
||||
}
|
||||
|
||||
~TextHolderComponent()
|
||||
~TextHolderComponent() override
|
||||
{
|
||||
owner.getTextValue().removeListener (this);
|
||||
}
|
||||
@ -1171,7 +1171,7 @@ void TextEditor::setText (const String& newText, bool sendTextChangeMessage)
|
||||
bool cursorWasAtEnd = oldCursorPos >= getTotalNumChars();
|
||||
|
||||
clearInternal (nullptr);
|
||||
insert (newText, 0, currentFont, findColour (textColourId), 0, caretPosition);
|
||||
insert (newText, 0, currentFont, findColour (textColourId), nullptr, caretPosition);
|
||||
|
||||
// if you're adding text with line-feeds to a single-line text editor, it
|
||||
// ain't gonna look right!
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
juce_wchar passwordCharacter = 0);
|
||||
|
||||
/** Destructor. */
|
||||
~TextEditor();
|
||||
~TextEditor() override;
|
||||
|
||||
//==============================================================================
|
||||
/** Puts the editor into either multi- or single-line mode.
|
||||
@ -295,7 +295,7 @@ public:
|
||||
{
|
||||
public:
|
||||
/** Destructor. */
|
||||
virtual ~Listener() {}
|
||||
virtual ~Listener() = default;
|
||||
|
||||
/** Called when the user changes the text in some way. */
|
||||
virtual void textEditorTextChanged (TextEditor&) {}
|
||||
@ -569,8 +569,8 @@ public:
|
||||
class JUCE_API InputFilter
|
||||
{
|
||||
public:
|
||||
InputFilter() {}
|
||||
virtual ~InputFilter() {}
|
||||
InputFilter() = default;
|
||||
virtual ~InputFilter() = default;
|
||||
|
||||
/** This method is called whenever text is entered into the editor.
|
||||
An implementation of this class should should check the input string,
|
||||
@ -632,7 +632,7 @@ public:
|
||||
*/
|
||||
struct JUCE_API LookAndFeelMethods
|
||||
{
|
||||
virtual ~LookAndFeelMethods() {}
|
||||
virtual ~LookAndFeelMethods() = default;
|
||||
|
||||
virtual void fillTextEditorBackground (Graphics&, int width, int height, TextEditor&) = 0;
|
||||
virtual void drawTextEditorOutline (Graphics&, int width, int height, TextEditor&) = 0;
|
||||
|
@ -174,7 +174,7 @@ public:
|
||||
layout (400);
|
||||
}
|
||||
|
||||
~MissingItemsComponent()
|
||||
~MissingItemsComponent() override
|
||||
{
|
||||
if (owner != nullptr)
|
||||
{
|
||||
@ -543,7 +543,7 @@ void Toolbar::showMissingItems()
|
||||
{
|
||||
PopupMenu m;
|
||||
m.addCustomItem (1, new MissingItemsComponent (*this, getThickness()));
|
||||
m.showMenuAsync (PopupMenu::Options().withTargetComponent (missingItemsButton.get()), nullptr);
|
||||
m.showMenuAsync (PopupMenu::Options().withTargetComponent (missingItemsButton.get()), [] (int) {});
|
||||
}
|
||||
}
|
||||
|
||||
@ -656,7 +656,7 @@ public:
|
||||
positionNearBar();
|
||||
}
|
||||
|
||||
~CustomisationDialog()
|
||||
~CustomisationDialog() override
|
||||
{
|
||||
toolbar.setEditingActive (false);
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
|
||||
Any items on the bar will be deleted when the toolbar is deleted.
|
||||
*/
|
||||
~Toolbar();
|
||||
~Toolbar() override;
|
||||
|
||||
//==============================================================================
|
||||
/** Changes the bar's orientation.
|
||||
@ -274,7 +274,7 @@ public:
|
||||
/** This abstract base class is implemented by LookAndFeel classes. */
|
||||
struct JUCE_API LookAndFeelMethods
|
||||
{
|
||||
virtual ~LookAndFeelMethods() {}
|
||||
virtual ~LookAndFeelMethods() = default;
|
||||
|
||||
virtual void paintToolbarBackground (Graphics&, int width, int height, Toolbar&) = 0;
|
||||
|
||||
|
@ -65,7 +65,7 @@ public:
|
||||
bool isBeingUsedAsAButton);
|
||||
|
||||
/** Destructor. */
|
||||
~ToolbarItemComponent();
|
||||
~ToolbarItemComponent() override;
|
||||
|
||||
//==============================================================================
|
||||
/** Returns the item type ID that this component represents.
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
Toolbar& toolbar);
|
||||
|
||||
/** Destructor. */
|
||||
~ToolbarItemPalette();
|
||||
~ToolbarItemPalette() override;
|
||||
|
||||
//==============================================================================
|
||||
/** @internal */
|
||||
|
@ -651,7 +651,7 @@ public:
|
||||
TreeView (const String& componentName = String());
|
||||
|
||||
/** Destructor. */
|
||||
~TreeView();
|
||||
~TreeView() override;
|
||||
|
||||
//==============================================================================
|
||||
/** Sets the item that is displayed in the treeview.
|
||||
@ -858,7 +858,7 @@ public:
|
||||
*/
|
||||
struct JUCE_API LookAndFeelMethods
|
||||
{
|
||||
virtual ~LookAndFeelMethods() {}
|
||||
virtual ~LookAndFeelMethods() = default;
|
||||
|
||||
virtual void drawTreeviewPlusMinusBox (Graphics&, const Rectangle<float>& area,
|
||||
Colour backgroundColour, bool isItemOpen, bool isMouseOver) = 0;
|
||||
@ -900,15 +900,12 @@ public:
|
||||
void itemDropped (const SourceDetails&) override;
|
||||
|
||||
private:
|
||||
friend class TreeViewItem;
|
||||
|
||||
class ContentComponent;
|
||||
class TreeViewport;
|
||||
class InsertPointHighlight;
|
||||
class TargetGroupHighlight;
|
||||
friend class TreeViewItem;
|
||||
friend class ContentComponent;
|
||||
friend struct ContainerDeletePolicy<TreeViewport>;
|
||||
friend struct ContainerDeletePolicy<InsertPointHighlight>;
|
||||
friend struct ContainerDeletePolicy<TargetGroupHighlight>;
|
||||
|
||||
std::unique_ptr<TreeViewport> viewport;
|
||||
CriticalSection nodeAlterationLock;
|
||||
|
Reference in New Issue
Block a user