mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Changed Label::setText to use a NotificationType parameter rather than a bool.
This commit is contained in:
parent
26c0733f8f
commit
af18430f08
16 changed files with 43 additions and 44 deletions
|
|
@ -55,7 +55,7 @@ JuceUpdater::JuceUpdater (ModuleList& moduleList_, const String& message)
|
|||
|
||||
currentVersionLabel.setFont (Font (14.0f, Font::italic));
|
||||
label.setFont (Font (12.0f));
|
||||
label.setText ("Local modules folder:", false);
|
||||
label.setText ("Local modules folder:", dontSendNotification);
|
||||
|
||||
addAndMakeVisible (&availableVersionsList);
|
||||
availableVersionsList.setModel (this);
|
||||
|
|
@ -219,9 +219,9 @@ void JuceUpdater::filenameComponentChanged (FilenameComponent*)
|
|||
filenameComp.setCurrentFile (moduleList.getModulesFolder(), true, dontSendNotification);
|
||||
|
||||
if (! ModuleList::isModulesFolder (moduleList.getModulesFolder()))
|
||||
currentVersionLabel.setText ("(Not a Juce folder)", false);
|
||||
currentVersionLabel.setText ("(Not a Juce folder)", dontSendNotification);
|
||||
else
|
||||
currentVersionLabel.setText (String::empty, false);
|
||||
currentVersionLabel.setText (String::empty, dontSendNotification);
|
||||
|
||||
refresh();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@ public:
|
|||
editor.setColour (CaretComponent::caretColourId, Colours::black);
|
||||
|
||||
addAndMakeVisible (&editor);
|
||||
label.setText ("Find:", false);
|
||||
label.setText ("Find:", dontSendNotification);
|
||||
label.setColour (Label::textColourId, Colours::white);
|
||||
label.attachToComponent (&editor, false);
|
||||
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ public:
|
|||
|
||||
l->setJustificationType (Justification (xml.getIntAttribute ("justification", Justification::centred)));
|
||||
|
||||
l->setText (xml.getStringAttribute ("labelText", "Label Text"), false);
|
||||
l->setText (xml.getStringAttribute ("labelText", "Label Text"), dontSendNotification);
|
||||
|
||||
l->setEditable (xml.getBoolAttribute ("editableSingleClick", defaultLabel.isEditableOnSingleClick()),
|
||||
xml.getBoolAttribute ("editableDoubleClick", defaultLabel.isEditableOnDoubleClick()),
|
||||
|
|
@ -220,7 +220,7 @@ private:
|
|||
bool perform()
|
||||
{
|
||||
showCorrectTab();
|
||||
getComponent()->setText (newState, false);
|
||||
getComponent()->setText (newState, dontSendNotification);
|
||||
changed();
|
||||
return true;
|
||||
}
|
||||
|
|
@ -228,7 +228,7 @@ private:
|
|||
bool undo()
|
||||
{
|
||||
showCorrectTab();
|
||||
getComponent()->setText (oldState, false);
|
||||
getComponent()->setText (oldState, dontSendNotification);
|
||||
changed();
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -387,7 +387,7 @@ public:
|
|||
|
||||
void refresh()
|
||||
{
|
||||
textEditor->setText (getText(), false);
|
||||
textEditor->setText (getText(), dontSendNotification);
|
||||
}
|
||||
|
||||
void buttonClicked (Button*)
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public:
|
|||
textScrollPos (200)
|
||||
{
|
||||
infoLabel.setText ("These sliders demonstrate how components and 2D graphics can be rendered "
|
||||
"using OpenGL by using the OpenGLContext class.", false);
|
||||
"using OpenGL by using the OpenGLContext class.", dontSendNotification);
|
||||
infoLabel.setInterceptsMouseClicks (false, false);
|
||||
addAndMakeVisible (&infoLabel);
|
||||
infoLabel.setBounds ("parent.width * 0.05, bottom - 150, parent.width * 0.4, parent.height - 60");
|
||||
|
|
|
|||
|
|
@ -118,7 +118,8 @@ public:
|
|||
bounce (bouncingNumber[i], bouncingNumberDelta[i], 1.0f);
|
||||
|
||||
owner.speedLabel->setText (String (getWidth()) + "x" + String (getHeight())
|
||||
+ " - Render time: " + String (averageTime, 2) + "ms", false);
|
||||
+ " - Render time: " + String (averageTime, 2) + "ms",
|
||||
dontSendNotification);
|
||||
|
||||
if (owner.animatePositionToggle->getToggleState())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -172,5 +172,5 @@ void JuceDemoPluginAudioProcessorEditor::displayPositionInfo (const AudioPlayHea
|
|||
else if (pos.isPlaying)
|
||||
displayText << " (playing)";
|
||||
|
||||
infoLabel.setText (displayText, false);
|
||||
infoLabel.setText (displayText, dontSendNotification);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ public:
|
|||
|
||||
l->setJustificationType (Justification (xml.getIntAttribute ("justification", Justification::centred)));
|
||||
|
||||
l->setText (xml.getStringAttribute ("labelText", "Label Text"), false);
|
||||
l->setText (xml.getStringAttribute ("labelText", "Label Text"), dontSendNotification);
|
||||
|
||||
l->setEditable (xml.getBoolAttribute ("editableSingleClick", defaultLabel.isEditableOnSingleClick()),
|
||||
xml.getBoolAttribute ("editableDoubleClick", defaultLabel.isEditableOnDoubleClick()),
|
||||
|
|
@ -232,7 +232,7 @@ private:
|
|||
bool perform()
|
||||
{
|
||||
showCorrectTab();
|
||||
getComponent()->setText (newState, false);
|
||||
getComponent()->setText (newState, dontSendNotification);
|
||||
changed();
|
||||
return true;
|
||||
}
|
||||
|
|
@ -240,7 +240,7 @@ private:
|
|||
bool undo()
|
||||
{
|
||||
showCorrectTab();
|
||||
getComponent()->setText (oldState, false);
|
||||
getComponent()->setText (oldState, dontSendNotification);
|
||||
changed();
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -394,7 +394,7 @@ public:
|
|||
|
||||
void refresh()
|
||||
{
|
||||
textEditor->setText (getText(), false);
|
||||
textEditor->setText (getText(), dontSendNotification);
|
||||
}
|
||||
|
||||
void buttonClicked (Button*)
|
||||
|
|
|
|||
|
|
@ -310,7 +310,7 @@ String FileBrowserComponent::getActionVerb() const
|
|||
|
||||
void FileBrowserComponent::setFilenameBoxLabel (const String& name)
|
||||
{
|
||||
fileLabel.setText (name, false);
|
||||
fileLabel.setText (name, dontSendNotification);
|
||||
}
|
||||
|
||||
FilePreviewComponent* FileBrowserComponent::getPreviewComponent() const noexcept
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public:
|
|||
|
||||
void filesDropped (const StringArray& files, int, int)
|
||||
{
|
||||
setText (getText() + files.joinIntoString (isMultiline ? "\n" : ", "), true);
|
||||
setText (getText() + files.joinIntoString (isMultiline ? "\n" : ", "), sendNotificationSync);
|
||||
showEditor();
|
||||
}
|
||||
|
||||
|
|
@ -102,7 +102,7 @@ TextPropertyComponent::~TextPropertyComponent()
|
|||
|
||||
void TextPropertyComponent::setText (const String& newText)
|
||||
{
|
||||
textEditor->setText (newText, true);
|
||||
textEditor->setText (newText, sendNotificationSync);
|
||||
}
|
||||
|
||||
String TextPropertyComponent::getText() const
|
||||
|
|
@ -123,7 +123,7 @@ void TextPropertyComponent::createEditor (const int maxNumChars, const bool isMu
|
|||
|
||||
void TextPropertyComponent::refresh()
|
||||
{
|
||||
textEditor->setText (getText(), false);
|
||||
textEditor->setText (getText(), dontSendNotification);
|
||||
}
|
||||
|
||||
void TextPropertyComponent::textWasEdited()
|
||||
|
|
|
|||
|
|
@ -280,7 +280,7 @@ void ComboBox::setSelectedId (const int newItemId, const bool dontSendChangeMess
|
|||
if (! dontSendChangeMessage)
|
||||
triggerAsyncUpdate();
|
||||
|
||||
label->setText (newItemText, false);
|
||||
label->setText (newItemText, dontSendNotification);
|
||||
lastCurrentId = newItemId;
|
||||
currentId = newItemId;
|
||||
|
||||
|
|
@ -333,7 +333,7 @@ void ComboBox::setText (const String& newText, const bool dontSendChangeMessage)
|
|||
|
||||
if (label->getText() != newText)
|
||||
{
|
||||
label->setText (newText, false);
|
||||
label->setText (newText, dontSendNotification);
|
||||
|
||||
if (! dontSendChangeMessage)
|
||||
triggerAsyncUpdate();
|
||||
|
|
@ -417,7 +417,7 @@ void ComboBox::lookAndFeelChanged()
|
|||
newLabel->setEditable (label->isEditable());
|
||||
newLabel->setJustificationType (label->getJustificationType());
|
||||
newLabel->setTooltip (label->getTooltip());
|
||||
newLabel->setText (label->getText(), false);
|
||||
newLabel->setText (label->getText(), dontSendNotification);
|
||||
}
|
||||
|
||||
label = newLabel;
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ Label::~Label()
|
|||
|
||||
//==============================================================================
|
||||
void Label::setText (const String& newText,
|
||||
const bool broadcastChangeMessage)
|
||||
const NotificationType notification)
|
||||
{
|
||||
hideEditor (true);
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ void Label::setText (const String& newText,
|
|||
if (ownerComponent != nullptr)
|
||||
componentMovedOrResized (*ownerComponent, true, true);
|
||||
|
||||
if (broadcastChangeMessage)
|
||||
if (notification != dontSendNotification)
|
||||
callChangeListeners();
|
||||
}
|
||||
}
|
||||
|
|
@ -86,7 +86,7 @@ String Label::getText (const bool returnActiveEditorContents) const
|
|||
void Label::valueChanged (Value&)
|
||||
{
|
||||
if (lastTextValue != textValue.toString())
|
||||
setText (textValue.toString(), true);
|
||||
setText (textValue.toString(), sendNotification);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -359,16 +359,13 @@ class LabelKeyboardFocusTraverser : public KeyboardFocusTraverser
|
|||
public:
|
||||
LabelKeyboardFocusTraverser() {}
|
||||
|
||||
Component* getNextComponent (Component* current)
|
||||
{
|
||||
return KeyboardFocusTraverser::getNextComponent (dynamic_cast <TextEditor*> (current) != nullptr
|
||||
? current->getParentComponent() : current);
|
||||
}
|
||||
Component* getNextComponent (Component* c) { return KeyboardFocusTraverser::getNextComponent (getComp (c)); }
|
||||
Component* getPreviousComponent (Component* c) { return KeyboardFocusTraverser::getPreviousComponent (getComp (c)); }
|
||||
|
||||
Component* getPreviousComponent (Component* current)
|
||||
static Component* getComp (Component* current)
|
||||
{
|
||||
return KeyboardFocusTraverser::getPreviousComponent (dynamic_cast <TextEditor*> (current) != nullptr
|
||||
? current->getParentComponent() : current);
|
||||
return dynamic_cast <TextEditor*> (current) != nullptr
|
||||
? current->getParentComponent() : current;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -56,11 +56,11 @@ public:
|
|||
//==============================================================================
|
||||
/** Changes the label text.
|
||||
|
||||
If broadcastChangeMessage is true and the new text is different to the current
|
||||
text, then the class will broadcast a change message to any Label::Listener objects
|
||||
that are registered.
|
||||
The NotificationType parameter indicates whether to send a change message to
|
||||
any Label::Listener objects if the new text is different.
|
||||
*/
|
||||
void setText (const String& newText, bool broadcastChangeMessage);
|
||||
void setText (const String& newText,
|
||||
NotificationType notification);
|
||||
|
||||
/** Returns the label's current text.
|
||||
|
||||
|
|
@ -185,8 +185,7 @@ public:
|
|||
/** Destructor. */
|
||||
virtual ~Listener() {}
|
||||
|
||||
/** Called when a Label's text has changed.
|
||||
*/
|
||||
/** Called when a Label's text has changed. */
|
||||
virtual void labelTextChanged (Label* labelThatHasChanged) = 0;
|
||||
};
|
||||
|
||||
|
|
@ -269,10 +268,10 @@ protected:
|
|||
virtual void textWasChanged();
|
||||
|
||||
/** Called when the text editor has just appeared, due to a user click or other focus change. */
|
||||
virtual void editorShown (TextEditor* editorComponent);
|
||||
virtual void editorShown (TextEditor*);
|
||||
|
||||
/** Called when the text editor is going to be deleted, after editing has finished. */
|
||||
virtual void editorAboutToBeHidden (TextEditor* editorComponent);
|
||||
virtual void editorAboutToBeHidden (TextEditor*);
|
||||
|
||||
//==============================================================================
|
||||
/** @internal */
|
||||
|
|
@ -309,6 +308,8 @@ protected:
|
|||
void colourChanged();
|
||||
/** @internal */
|
||||
void valueChanged (Value&);
|
||||
/** @internal */
|
||||
void callChangeListeners();
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
|
|
@ -327,7 +328,6 @@ private:
|
|||
bool leftOfOwnerComp : 1;
|
||||
|
||||
bool updateFromTextEditorContents (TextEditor&);
|
||||
void callChangeListeners();
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Label)
|
||||
};
|
||||
|
|
|
|||
|
|
@ -401,7 +401,7 @@ public:
|
|||
void updateText()
|
||||
{
|
||||
if (valueBox != nullptr)
|
||||
valueBox->setText (owner.getTextFromValue (currentValue.getValue()), false);
|
||||
valueBox->setText (owner.getTextFromValue (currentValue.getValue()), dontSendNotification);
|
||||
}
|
||||
|
||||
double constrainedValue (double value) const
|
||||
|
|
@ -564,7 +564,7 @@ public:
|
|||
owner.addAndMakeVisible (valueBox = lf.createSliderTextBox (owner));
|
||||
|
||||
valueBox->setWantsKeyboardFocus (false);
|
||||
valueBox->setText (previousTextBoxContent, false);
|
||||
valueBox->setText (previousTextBoxContent, dontSendNotification);
|
||||
|
||||
if (valueBox->isEditable() != editableText) // (avoid overriding the single/double click flags unless we have to)
|
||||
valueBox->setEditable (editableText && owner.isEnabled());
|
||||
|
|
|
|||
|
|
@ -1113,6 +1113,7 @@ void TextEditor::lookAndFeelChanged()
|
|||
{
|
||||
setCaretVisible (false);
|
||||
setCaretVisible (true);
|
||||
updateCaretPosition();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue