1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-03 03:30:06 +00:00

Added versions of Component::addAndMakeVisible and addChildComponent which take a reference instead of a pointer.

This commit is contained in:
jules 2013-12-23 15:16:38 +00:00
parent 9aeefa5ebe
commit 4d79bed3d1
82 changed files with 305 additions and 272 deletions

View file

@ -302,7 +302,7 @@ public:
addAndMakeVisible (liveAudioScroller = new LiveScrollingAudioDisplay());
addAndMakeVisible (&resultsBox);
addAndMakeVisible (resultsBox);
resultsBox.setMultiLine (true);
resultsBox.setReturnKeyStartsNewLine (true);
resultsBox.setReadOnly (true);
@ -318,7 +318,7 @@ public:
"back at the audio input. Obviously for this to work you need to have your "
"microphone somewhere near your speakers...");
addAndMakeVisible (&startTestButton);
addAndMakeVisible (startTestButton);
startTestButton.addListener (this);
startTestButton.setButtonText ("Test Latency");

View file

@ -46,13 +46,13 @@ public:
{
thumbnail.addChangeListener (this);
addAndMakeVisible (&scrollbar);
addAndMakeVisible (scrollbar);
scrollbar.setRangeLimits (visibleRange);
scrollbar.setAutoHide (false);
scrollbar.addListener (this);
currentPositionMarker.setFill (Colours::white.withAlpha (0.85f));
addAndMakeVisible (&currentPositionMarker);
addAndMakeVisible (currentPositionMarker);
}
~DemoThumbnailComp()
@ -240,7 +240,7 @@ public:
directoryList (nullptr, thread),
fileTreeComp (directoryList)
{
addAndMakeVisible (&zoomLabel);
addAndMakeVisible (zoomLabel);
zoomLabel.setText ("zoom:", dontSendNotification);
zoomLabel.setFont (Font (15.00f, Font::plain));
zoomLabel.setJustificationType (Justification::centredRight);
@ -248,11 +248,11 @@ public:
zoomLabel.setColour (TextEditor::textColourId, Colours::black);
zoomLabel.setColour (TextEditor::backgroundColourId, Colour (0x00000000));
addAndMakeVisible (&followTransportButton);
addAndMakeVisible (followTransportButton);
followTransportButton.setButtonText ("Follow Transport");
followTransportButton.addListener (this);
addAndMakeVisible (&explanation);
addAndMakeVisible (explanation);
explanation.setText ("Select an audio file in the treeview above, and this page will display its waveform, and let you play it..", dontSendNotification);
explanation.setFont (Font (14.00f, Font::plain));
explanation.setJustificationType (Justification::bottomRight);
@ -260,7 +260,7 @@ public:
explanation.setColour (TextEditor::textColourId, Colours::black);
explanation.setColour (TextEditor::backgroundColourId, Colour (0x00000000));
addAndMakeVisible (&zoomSlider);
addAndMakeVisible (zoomSlider);
zoomSlider.setRange (0, 1, 0);
zoomSlider.setSliderStyle (Slider::LinearHorizontal);
zoomSlider.setTextBoxStyle (Slider::NoTextBox, false, 80, 20);
@ -270,12 +270,12 @@ public:
addAndMakeVisible (thumbnail = new DemoThumbnailComp (formatManager, transportSource, zoomSlider));
thumbnail->addChangeListener (this);
addAndMakeVisible (&startStopButton);
addAndMakeVisible (startStopButton);
startStopButton.setButtonText ("Play/Stop");
startStopButton.addListener (this);
startStopButton.setColour (TextButton::buttonColourId, Colour (0xff79ed7f));
addAndMakeVisible (&fileTreeComp);
addAndMakeVisible (fileTreeComp);
// audio setup
formatManager.registerBasicFormats();

View file

@ -218,9 +218,9 @@ public:
recorder (recordingThumbnail.getAudioThumbnail())
{
setOpaque (true);
addAndMakeVisible (&liveAudioScroller);
addAndMakeVisible (liveAudioScroller);
addAndMakeVisible (&explanationLabel);
addAndMakeVisible (explanationLabel);
explanationLabel.setText ("This page demonstrates how to record a wave file from the live audio input..\n\nPressing record will start recording a file in your \"Documents\" folder.", dontSendNotification);
explanationLabel.setFont (Font (15.00f, Font::plain));
explanationLabel.setJustificationType (Justification::topLeft);
@ -228,13 +228,13 @@ public:
explanationLabel.setColour (TextEditor::textColourId, Colours::black);
explanationLabel.setColour (TextEditor::backgroundColourId, Colour (0x00000000));
addAndMakeVisible (&recordButton);
addAndMakeVisible (recordButton);
recordButton.setButtonText ("Record");
recordButton.addListener (this);
recordButton.setColour (TextButton::buttonColourId, Colour (0xffff5c5c));
recordButton.setColour (TextButton::textColourOnId, Colours::black);
addAndMakeVisible (&recordingThumbnail);
addAndMakeVisible (recordingThumbnail);
deviceManager.addAudioCallback (&liveAudioScroller);
deviceManager.addAudioCallback (&recorder);

View file

@ -38,7 +38,7 @@ public:
= new AudioDeviceSelectorComponent (MainAppWindow::getSharedAudioDeviceManager(),
0, 256, 0, 256, true, true, true, false));
addAndMakeVisible (&diagnosticsBox);
addAndMakeVisible (diagnosticsBox);
diagnosticsBox.setMultiLine (true);
diagnosticsBox.setReturnKeyStartsNewLine (true);
diagnosticsBox.setReadOnly (true);

View file

@ -241,20 +241,20 @@ public:
synthAudioSource (keyboardState),
keyboardComponent (keyboardState, MidiKeyboardComponent::horizontalKeyboard)
{
addAndMakeVisible (&keyboardComponent);
addAndMakeVisible (keyboardComponent);
addAndMakeVisible (&sineButton);
addAndMakeVisible (sineButton);
sineButton.setButtonText ("Use sine wave");
sineButton.setRadioGroupId (321);
sineButton.addListener (this);
sineButton.setToggleState (true, dontSendNotification);
addAndMakeVisible (&sampledButton);
addAndMakeVisible (sampledButton);
sampledButton.setButtonText ("Use sampled sound");
sampledButton.setRadioGroupId (321);
sampledButton.addListener (this);
addAndMakeVisible (&liveAudioDisplayComp);
addAndMakeVisible (liveAudioDisplayComp);
deviceManager.addAudioCallback (&liveAudioDisplayComp);

View file

@ -178,14 +178,14 @@ public:
testsListModel.addChangeListener (this);
addAndMakeVisible (&renderComponent);
addAndMakeVisible (renderComponent);
addAndMakeVisible (&testsListBox);
addAndMakeVisible (testsListBox);
testsListBox.setModel (&testsListModel);
testsListBox.selectRow (dominoes);
testsListBox.setColour (ListBox::backgroundColourId, Colours::lightgrey);
addAndMakeVisible (&instructions);
addAndMakeVisible (instructions);
instructions.setMultiLine (true);
instructions.setReadOnly (true);
instructions.setColour (TextEditor::backgroundColourId, Colours::lightgrey);

View file

@ -43,20 +43,20 @@ public:
{
setOpaque (true);
addAndMakeVisible (&cameraSelectorComboBox);
addAndMakeVisible (cameraSelectorComboBox);
updateCameraList();
cameraSelectorComboBox.setSelectedId (1);
cameraSelectorComboBox.addListener (this);
addAndMakeVisible (&snapshotButton);
addAndMakeVisible (snapshotButton);
snapshotButton.addListener (this);
snapshotButton.setEnabled (false);
addAndMakeVisible (&recordMovieButton);
addAndMakeVisible (recordMovieButton);
recordMovieButton.addListener (this);
recordMovieButton.setEnabled (false);
addAndMakeVisible (&lastSnapshot);
addAndMakeVisible (lastSnapshot);
cameraSelectorComboBox.setSelectedId (2);
}

View file

@ -51,7 +51,7 @@ public:
"\n");
// Create a file chooser control to load files into it..
addAndMakeVisible (&fileChooser);
addAndMakeVisible (fileChooser);
fileChooser.addListener (this);
}

View file

@ -32,7 +32,7 @@ class RSAComponent : public Component,
public:
RSAComponent()
{
addAndMakeVisible (&rsaGroup);
addAndMakeVisible (rsaGroup);
rsaGroup.setText ("RSA Encryption");
rsaGroup.setColour (GroupComponent::outlineColourId, Colours::darkgrey);
rsaGroup.setColour (GroupComponent::textColourId, Colours::black);
@ -40,14 +40,14 @@ public:
bitSizeLabel.setText ("Num Bits to Use:", dontSendNotification);
bitSizeLabel.attachToComponent (&bitSize, true);
addAndMakeVisible (&bitSize);
addAndMakeVisible (bitSize);
bitSize.setText (String (256));
addAndMakeVisible (&generateRSAButton);
addAndMakeVisible (generateRSAButton);
generateRSAButton.setButtonText ("Generate RSA");
generateRSAButton.addListener (this);
addAndMakeVisible (&rsaResultBox);
addAndMakeVisible (rsaResultBox);
rsaResultBox.setColour (TextEditor::backgroundColourId, Colours::white.withAlpha (0.5f));
rsaResultBox.setReadOnly (true);
rsaResultBox.setMultiLine (true);
@ -122,12 +122,12 @@ class HashesComponent : public Component,
public:
HashesComponent()
{
addAndMakeVisible (&hashGroup);
addAndMakeVisible (hashGroup);
hashGroup.setText ("Hashes");
hashGroup.setColour (GroupComponent::outlineColourId, Colours::darkgrey);
hashGroup.setColour (GroupComponent::textColourId, Colours::black);
addAndMakeVisible (&hashEntryBox);
addAndMakeVisible (hashEntryBox);
hashEntryBox.setMultiLine (true);
hashEntryBox.setColour (TextEditor::backgroundColourId, Colours::white.withAlpha (0.5f));
@ -143,8 +143,8 @@ public:
hashLabel2.attachToComponent (&md5Result, true);
hashLabel3.attachToComponent (&shaResult, true);
addAndMakeVisible (&md5Result);
addAndMakeVisible (&shaResult);
addAndMakeVisible (md5Result);
addAndMakeVisible (shaResult);
updateHashes();
}
@ -220,8 +220,8 @@ class CryptographyDemo : public Component
public:
CryptographyDemo()
{
addAndMakeVisible (&rsaDemo);
addAndMakeVisible (&hashDemo);
addAndMakeVisible (rsaDemo);
addAndMakeVisible (hashDemo);
}
void paint (Graphics& g) override

View file

@ -91,7 +91,7 @@ public:
{
setOpaque (true);
addAndMakeVisible (&nativeButton);
addAndMakeVisible (nativeButton);
nativeButton.setButtonText ("Use Native Windows");
nativeButton.addListener (this);
@ -112,7 +112,7 @@ public:
};
// warn in case we add any windows
jassert (numElementsInArray(windowNames) == numDialogs);
jassert (numElementsInArray (windowNames) == numDialogs);
for (int i = 0; i < numDialogs; ++i)
{

View file

@ -44,17 +44,17 @@ public:
{
setOpaque (true);
addAndMakeVisible (&listBox);
addAndMakeVisible (&demoTextBox);
addAndMakeVisible (&heightSlider);
addAndMakeVisible (&heightLabel);
addAndMakeVisible (&kerningLabel);
addAndMakeVisible (&kerningSlider);
addAndMakeVisible (&scaleLabel);
addAndMakeVisible (&scaleSlider);
addAndMakeVisible (&boldToggle);
addAndMakeVisible (&italicToggle);
addAndMakeVisible (&styleBox);
addAndMakeVisible (listBox);
addAndMakeVisible (demoTextBox);
addAndMakeVisible (heightSlider);
addAndMakeVisible (heightLabel);
addAndMakeVisible (kerningLabel);
addAndMakeVisible (kerningSlider);
addAndMakeVisible (scaleLabel);
addAndMakeVisible (scaleSlider);
addAndMakeVisible (boldToggle);
addAndMakeVisible (italicToggle);
addAndMakeVisible (styleBox);
kerningLabel.attachToComponent (&kerningSlider, true);
heightLabel.attachToComponent (&heightSlider, true);

View file

@ -77,7 +77,7 @@ public:
void initialiseToggle (ToggleButton& b, const char* name, bool on)
{
addAndMakeVisible (&b);
addAndMakeVisible (b);
b.setButtonText (name);
b.setToggleState (on, dontSendNotification);
}
@ -627,7 +627,7 @@ public:
demos.add (new SVGDemo (controls));
demos.add (new LinesDemo (controls));
addAndMakeVisible (&listBox);
addAndMakeVisible (listBox);
listBox.setModel (this);
listBox.selectRow (0);
listBox.setColour (ListBox::backgroundColourId, Colour::greyLevel (0.9f));
@ -680,10 +680,10 @@ public:
{
setOpaque (true);
addAndMakeVisible (&demoHolder);
addAndMakeVisible (&controllersComponent);
addAndMakeVisible (&performanceDisplay);
addAndMakeVisible (&testList);
addAndMakeVisible (demoHolder);
addAndMakeVisible (controllersComponent);
addAndMakeVisible (performanceDisplay);
addAndMakeVisible (testList);
}
void paint (Graphics& g)

View file

@ -43,11 +43,11 @@ public:
fileTree.addListener (this);
fileTree.setColour (TreeView::backgroundColourId, Colours::lightgrey.withAlpha (0.6f));
addAndMakeVisible (&fileTree);
addAndMakeVisible (fileTree);
addAndMakeVisible (&resizerBar);
addAndMakeVisible (resizerBar);
addAndMakeVisible (&imagePreview);
addAndMakeVisible (imagePreview);
// we have to set up our StretchableLayoutManager so it know the limits and preferred sizes of it's contents
stretchableManager.setItemLayout (0, // for the fileTree

View file

@ -44,7 +44,7 @@ public:
outputDisplay.setReadOnly (true);
outputDisplay.setCaretVisible (false);
outputDisplay.setFont (Font (Font::getDefaultMonospacedFontName(), 14.0f, Font::plain));
addAndMakeVisible (&outputDisplay);
addAndMakeVisible (outputDisplay);
codeDocument.addListener (this);

View file

@ -34,7 +34,7 @@ public:
: keyMappingEditor (*MainAppWindow::getApplicationCommandManager().getKeyMappings(), true)
{
setOpaque (true);
addAndMakeVisible (&keyMappingEditor);
addAndMakeVisible (keyMappingEditor);
}
void paint (Graphics& g) override

View file

@ -71,9 +71,9 @@ public:
"the code that's invoking the demo below...",
dontSendNotification);
addAndMakeVisible (&descriptionLabel);
addAndMakeVisible (&startButton);
addChildComponent (&demoComp);
addAndMakeVisible (descriptionLabel);
addAndMakeVisible (startButton);
addChildComponent (demoComp);
startButton.addListener (this);
}

View file

@ -48,7 +48,7 @@ public:
editor.setMultiLine (true);
editor.setReturnKeyStartsNewLine (true);
editor.getTextValue().referTo (textValueObject);
addAndMakeVisible (&editor);
addAndMakeVisible (editor);
editor.addListener (this);
}
@ -164,13 +164,13 @@ public:
showInTabsButton.setButtonText ("Show with tabs");
showInTabsButton.setToggleState (false, dontSendNotification);
showInTabsButton.addListener (this);
addAndMakeVisible (&showInTabsButton);
addAndMakeVisible (showInTabsButton);
addNoteButton.setButtonText ("Create a new note");
addNoteButton.addListener (this);
addAndMakeVisible (&addNoteButton);
addAndMakeVisible (addNoteButton);
addAndMakeVisible (&multiDocumentPanel);
addAndMakeVisible (multiDocumentPanel);
multiDocumentPanel.setBackgroundColour (Colours::transparentBlack);
updateLayoutMode();

View file

@ -106,11 +106,11 @@ public:
{
setOpaque (true);
addAndMakeVisible (&midiInputListLabel);
addAndMakeVisible (midiInputListLabel);
midiInputListLabel.setText ("MIDI Input:", dontSendNotification);
midiInputListLabel.attachToComponent (&midiInputList, true);
addAndMakeVisible (&midiInputList);
addAndMakeVisible (midiInputList);
midiInputList.setTextWhenNoChoicesAvailable ("No MIDI Inputs Enabled");
const StringArray midiInputs (MidiInput::getDevices());
midiInputList.addItemList (midiInputs, 1);
@ -130,10 +130,10 @@ public:
if (midiInputList.getSelectedId() == 0)
setMidiInput (0);
addAndMakeVisible (&keyboardComponent);
addAndMakeVisible (keyboardComponent);
keyboardState.addListener (this);
addAndMakeVisible (&messageListBox);
addAndMakeVisible (messageListBox);
messageListBox.setModel (&midiLogListBoxModel);
messageListBox.setColour (ListBox::backgroundColourId, Colour (0x32ffffff));
messageListBox.setColour (ListBox::outlineColourId, Colours::black);

View file

@ -214,7 +214,7 @@ public:
{
setOpaque (true);
addAndMakeVisible (&controlButton);
addAndMakeVisible (controlButton);
controlButton.changeWidthToFitText (24);
controlButton.setTopLeftPosition (20, 20);
controlButton.setTriggeredOnMouseDown (true);

View file

@ -36,14 +36,14 @@ public:
{
setOpaque (true);
addAndMakeVisible (&urlBox);
addAndMakeVisible (urlBox);
urlBox.setText ("http://www.google.com");
addAndMakeVisible (&fetchButton);
addAndMakeVisible (fetchButton);
fetchButton.setButtonText ("Download URL Contents");
fetchButton.addListener (this);
addAndMakeVisible (&resultsBox);
addAndMakeVisible (resultsBox);
}
~NetworkingDemo()

View file

@ -340,34 +340,34 @@ struct OpenGLDemoClasses
tabbedComp (TabbedButtonBar::TabsAtLeft),
showBackgroundToggle ("Draw 2D graphics in background")
{
addAndMakeVisible (&statusLabel);
addAndMakeVisible (statusLabel);
statusLabel.setJustificationType (Justification::topLeft);
statusLabel.setColour (Label::textColourId, Colours::black);
statusLabel.setFont (Font (14.0f));
addAndMakeVisible (&sizeSlider);
addAndMakeVisible (sizeSlider);
sizeSlider.setRange (0.0, 1.0, 0.001);
sizeSlider.addListener (this);
addAndMakeVisible (&zoomLabel);
addAndMakeVisible (zoomLabel);
zoomLabel.setText ("Zoom:", dontSendNotification);
zoomLabel.attachToComponent (&sizeSlider, true);
addAndMakeVisible (&speedSlider);
addAndMakeVisible (speedSlider);
speedSlider.setRange (0.0, 0.5, 0.001);
speedSlider.addListener (this);
speedSlider.setSkewFactor (0.5f);
addAndMakeVisible (&speedLabel);
addAndMakeVisible (speedLabel);
speedLabel.setText ("Speed:", dontSendNotification);
speedLabel.attachToComponent (&speedSlider, true);
addAndMakeVisible (&showBackgroundToggle);
addAndMakeVisible (showBackgroundToggle);
showBackgroundToggle.addListener (this);
Colour editorBackground (Colours::white.withAlpha (0.6f));
addAndMakeVisible (&tabbedComp);
addAndMakeVisible (tabbedComp);
tabbedComp.setTabBarDepth (25);
tabbedComp.setColour (TabbedButtonBar::tabTextColourId, Colours::grey);
tabbedComp.addTab ("Vertex", editorBackground, &vertexEditorComp, false);
@ -384,11 +384,11 @@ struct OpenGLDemoClasses
textures.add (new BuiltInTexture ("JUCE logo", BinaryData::juce_icon_png, BinaryData::juce_icon_pngSize));
textures.add (new DynamicTexture());
addAndMakeVisible (&textureBox);
addAndMakeVisible (textureBox);
textureBox.addListener (this);
updateTexturesList();
addAndMakeVisible (&presetBox);
addAndMakeVisible (presetBox);
presetBox.addListener (this);
Array<ShaderPreset> presets (getPresets());
@ -397,11 +397,11 @@ struct OpenGLDemoClasses
for (int i = 0; i < presets.size(); ++i)
presetBox.addItem (presets[i].name, i + 1);
addAndMakeVisible (&presetLabel);
addAndMakeVisible (presetLabel);
presetLabel.setText ("Shader Preset:", dontSendNotification);
presetLabel.attachToComponent (&presetBox, true);
addAndMakeVisible (&textureLabel);
addAndMakeVisible (textureLabel);
textureLabel.setText ("Texture:", dontSendNotification);
textureLabel.attachToComponent (&textureBox, true);
}

View file

@ -149,7 +149,7 @@ public:
PropertiesDemo()
{
setOpaque (true);
addAndMakeVisible (&propertyPanel);
addAndMakeVisible (propertyPanel);
propertyPanel.addSection ("Text Editors", createTextEditors());
propertyPanel.addSection ("Sliders", createSliders (3));
@ -181,7 +181,7 @@ public:
ConcertinaDemo()
{
setOpaque (true);
addAndMakeVisible (&concertinaPanel);
addAndMakeVisible (concertinaPanel);
{
PropertyPanel* panel = new PropertyPanel ("Text Editors");

View file

@ -148,7 +148,7 @@ class SystemInfoDemo : public Component
public:
SystemInfoDemo()
{
addAndMakeVisible (&resultsBox);
addAndMakeVisible (resultsBox);
resultsBox.setReadOnly (true);
resultsBox.setMultiLine (true);
resultsBox.setColour (TextEditor::backgroundColourId, Colours::transparentBlack);

View file

@ -152,11 +152,11 @@ public:
addAndMakeVisible (newFlasher);
}
addAndMakeVisible (&stopButton);
addAndMakeVisible (stopButton);
stopButton.addListener (this);
stopButton.setButtonText ("Stop");
addAndMakeVisible (&randomColourButton);
addAndMakeVisible (randomColourButton);
randomColourButton.addListener (this);
randomColourButton.setButtonText ("Set Random Colour");

View file

@ -108,8 +108,8 @@ struct UnitTestClasses
{
setOpaque (true);
addAndMakeVisible (&startTestButton);
addAndMakeVisible (&testResultsBox);
addAndMakeVisible (startTestButton);
addAndMakeVisible (testResultsBox);
testResultsBox.setMultiLine (true);
testResultsBox.setFont (Font (Font::getDefaultMonospacedFontName(), 12.0f, Font::plain));

View file

@ -164,15 +164,15 @@ public:
: undoButton ("Undo"),
redoButton ("Redo")
{
addAndMakeVisible (&tree);
addAndMakeVisible (tree);
tree.setDefaultOpenness (true);
tree.setMultiSelectEnabled (true);
tree.setRootItem (rootItem = new ValueTreeItem (createRootValueTree(), undoManager));
tree.setColour (TreeView::backgroundColourId, Colours::white);
addAndMakeVisible (&undoButton);
addAndMakeVisible (&redoButton);
addAndMakeVisible (undoButton);
addAndMakeVisible (redoButton);
undoButton.addListener (this);
redoButton.addListener (this);

View file

@ -39,9 +39,9 @@ public:
fileChooser ("movie", File::nonexistent, true, false, false,
"*", String::empty, "(choose a video file to play)")
{
addAndMakeVisible (&videoComp);
addAndMakeVisible (videoComp);
addAndMakeVisible (&fileChooser);
addAndMakeVisible (fileChooser);
fileChooser.addListener (this);
fileChooser.setBrowseButtonText ("browse");
}
@ -148,9 +148,9 @@ public:
fileTree.addListener (this);
fileTree.setColour (TreeView::backgroundColourId, Colours::lightgrey);
addAndMakeVisible (&fileTree);
addAndMakeVisible (fileTree);
addAndMakeVisible (&resizerBar);
addAndMakeVisible (resizerBar);
loadLeftButton.setButtonText ("Load Left");
loadRightButton.setButtonText ("Load Right");
@ -158,11 +158,11 @@ public:
loadLeftButton.addListener (this);
loadRightButton.addListener (this);
addAndMakeVisible (&loadLeftButton);
addAndMakeVisible (&loadRightButton);
addAndMakeVisible (loadLeftButton);
addAndMakeVisible (loadRightButton);
addAndMakeVisible (&movieCompLeft);
addAndMakeVisible (&movieCompRight);
addAndMakeVisible (movieCompLeft);
addAndMakeVisible (movieCompRight);
// we have to set up our StretchableLayoutManager so it know the limits and preferred sizes of it's contents
stretchableManager.setItemLayout (0, // for the fileTree

View file

@ -74,7 +74,7 @@ public:
setOpaque (true);
// Create an address box..
addAndMakeVisible (&addressTextBox);
addAndMakeVisible (addressTextBox);
addressTextBox.setTextToShowWhenEmpty ("Enter a web address, e.g. http://www.juce.com", Colours::grey);
addressTextBox.addListener (this);
@ -82,11 +82,11 @@ public:
addAndMakeVisible (webView = new DemoBrowserComponent (addressTextBox));
// add some buttons..
addAndMakeVisible (&goButton);
addAndMakeVisible (goButton);
goButton.addListener (this);
addAndMakeVisible (&backButton);
addAndMakeVisible (backButton);
backButton.addListener (this);
addAndMakeVisible (&forwardButton);
addAndMakeVisible (forwardButton);
forwardButton.addListener (this);
// send the browser to a start page..

View file

@ -200,7 +200,7 @@ struct SlidersPage : public Component
}
hintLabel.setBounds (20, 245, 350, 150);
addAndMakeVisible (&hintLabel);
addAndMakeVisible (hintLabel);
}
private:
@ -421,15 +421,15 @@ struct MiscPage : public Component
: textEditor2 ("Password", (juce_wchar) 0x2022),
comboBox ("Combo")
{
addAndMakeVisible (&textEditor1);
addAndMakeVisible (textEditor1);
textEditor1.setBounds (10, 25, 200, 24);
textEditor1.setText ("Single-line text box");
addAndMakeVisible (&textEditor2);
addAndMakeVisible (textEditor2);
textEditor2.setBounds (10, 55, 200, 24);
textEditor2.setText ("Password");
addAndMakeVisible (&comboBox);
addAndMakeVisible (comboBox);
comboBox.setBounds (10, 85, 200, 24);
comboBox.setEditableText (true);
comboBox.setJustificationType (Justification::centred);
@ -460,19 +460,19 @@ public:
customiseButton ("Customise...")
{
// Create and add the toolbar...
addAndMakeVisible (&toolbar);
addAndMakeVisible (toolbar);
// And use our item factory to add a set of default icons to it...
toolbar.addDefaultItems (factory);
// Now we'll just create the other sliders and buttons on the demo page, which adjust
// the toolbar's properties...
addAndMakeVisible (&infoLabel);
addAndMakeVisible (infoLabel);
infoLabel.setJustificationType (Justification::topLeft);
infoLabel.setBounds (80, 80, 450, 100);
infoLabel.setInterceptsMouseClicks (false, false);
addAndMakeVisible (&depthSlider);
addAndMakeVisible (depthSlider);
depthSlider.setRange (10.0, 200.0, 1.0);
depthSlider.setValue (50, dontSendNotification);
depthSlider.setSliderStyle (Slider::LinearHorizontal);
@ -481,12 +481,12 @@ public:
depthSlider.setBounds (80, 210, 300, 22);
depthLabel.attachToComponent (&depthSlider, false);
addAndMakeVisible (&orientationButton);
addAndMakeVisible (orientationButton);
orientationButton.addListener (this);
orientationButton.changeWidthToFitText (22);
orientationButton.setTopLeftPosition (depthSlider.getX(), depthSlider.getBottom() + 20);
addAndMakeVisible (&customiseButton);
addAndMakeVisible (customiseButton);
customiseButton.addListener (this);
customiseButton.changeWidthToFitText (22);
customiseButton.setTopLeftPosition (orientationButton.getRight() + 20, orientationButton.getY());
@ -651,7 +651,7 @@ private:
: ToolbarItemComponent (toolbarItemId, "Custom Toolbar Item", false),
comboBox ("demo toolbar combo box")
{
addAndMakeVisible (&comboBox);
addAndMakeVisible (comboBox);
for (int i = 1; i < 20; ++i)
comboBox.addItem ("Toolbar ComboBox item " + String (i), i);
@ -707,7 +707,7 @@ public:
loadData();
// Create our table component and add it to this component..
addAndMakeVisible (&table);
addAndMakeVisible (table);
table.setModel (this);
// give it a border
@ -872,7 +872,7 @@ private:
: owner (owner_)
{
// just put a combo box inside this component
addAndMakeVisible (&comboBox);
addAndMakeVisible (comboBox);
comboBox.addItem ("fab", 1);
comboBox.addItem ("groovy", 2);
comboBox.addItem ("hep", 3);
@ -979,8 +979,8 @@ public:
sourceListBox.setModel (&sourceModel);
sourceListBox.setMultipleSelectionEnabled (true);
addAndMakeVisible (&sourceListBox);
addAndMakeVisible (&target);
addAndMakeVisible (sourceListBox);
addAndMakeVisible (target);
}
void resized() override
@ -1190,7 +1190,7 @@ public:
popupButton.setButtonText ("Show Popup Menu");
popupButton.setTriggeredOnMouseDown (true);
popupButton.addListener (this);
addAndMakeVisible (&popupButton);
addAndMakeVisible (popupButton);
}
~MenusDemo()
@ -1468,7 +1468,7 @@ public:
WidgetsDemo()
{
setOpaque (true);
addAndMakeVisible (&tabs);
addAndMakeVisible (tabs);
}
void paint (Graphics& g) override

View file

@ -201,11 +201,11 @@ public:
setOpaque (true);
showWindowsButton.setButtonText ("Show Windows");
addAndMakeVisible (&showWindowsButton);
addAndMakeVisible (showWindowsButton);
showWindowsButton.addListener (this);
closeWindowsButton.setButtonText ("Close Windows");
addAndMakeVisible (&closeWindowsButton);
addAndMakeVisible (closeWindowsButton);
closeWindowsButton.addListener (this);
}

View file

@ -223,7 +223,7 @@ public:
{
setOpaque (true);
addAndMakeVisible (&typeBox);
addAndMakeVisible (typeBox);
typeBox.addListener (this);
typeBox.addItem ("XML", 1);
typeBox.addItem ("JSON", 2);
@ -231,14 +231,14 @@ public:
comboBoxLabel.setText ("Database Type:", dontSendNotification);
comboBoxLabel.attachToComponent (&typeBox, true);
addAndMakeVisible (&codeDocumentComponent);
addAndMakeVisible (codeDocumentComponent);
codeDocument.addListener (this);
addAndMakeVisible (&resultsTree);
addAndMakeVisible (resultsTree);
resultsTree.setColour (TreeView::backgroundColourId, Colours::white);
resultsTree.setDefaultOpenness (true);
addAndMakeVisible (&errorMessage);
addAndMakeVisible (errorMessage);
errorMessage.setReadOnly (true);
errorMessage.setMultiLine (true);
errorMessage.setCaretVisible (false);

View file

@ -37,9 +37,9 @@ public:
{
setOpaque (true);
addAndMakeVisible (&versionLabel);
addAndMakeVisible (&linkButton);
addAndMakeVisible (&logo);
addAndMakeVisible (versionLabel);
addAndMakeVisible (linkButton);
addAndMakeVisible (logo);
versionLabel.setColour (Label::textColourId, Colours::white);
versionLabel.setText (String ("{version} built on {date}")

View file

@ -110,7 +110,7 @@ public:
ContentComponent()
{
LookAndFeel::setDefaultLookAndFeel (&lookAndFeelV3);
addAndMakeVisible (&demoList);
addAndMakeVisible (demoList);
demoList.setModel (this);
demoList.setColour (ListBox::backgroundColourId, Colour::greyLevel (0.7f));

View file

@ -354,15 +354,15 @@ struct AppearanceEditor
saveButton ("Save Scheme...")
{
rebuildProperties();
addAndMakeVisible (&panel);
addAndMakeVisible (panel);
loadButton.setColour (TextButton::buttonColourId, Colours::lightgrey.withAlpha (0.5f));
saveButton.setColour (TextButton::buttonColourId, Colours::lightgrey.withAlpha (0.5f));
loadButton.setColour (TextButton::textColourOffId, Colours::white);
saveButton.setColour (TextButton::textColourOffId, Colours::white);
addAndMakeVisible (&loadButton);
addAndMakeVisible (&saveButton);
addAndMakeVisible (loadButton);
addAndMakeVisible (saveButton);
loadButton.addListener (this);
saveButton.addListener (this);

View file

@ -335,20 +335,20 @@ public:
{
editor.setColour (CaretComponent::caretColourId, Colours::black);
addAndMakeVisible (&editor);
addAndMakeVisible (editor);
label.setText ("Find:", dontSendNotification);
label.setColour (Label::textColourId, Colours::white);
label.attachToComponent (&editor, false);
addAndMakeVisible (&caseButton);
addAndMakeVisible (caseButton);
caseButton.setColour (ToggleButton::textColourId, Colours::white);
caseButton.setToggleState (isCaseSensitiveSearch(), dontSendNotification);
caseButton.addListener (this);
findPrev.setConnectedEdges (Button::ConnectedOnRight);
findNext.setConnectedEdges (Button::ConnectedOnLeft);
addAndMakeVisible (&findPrev);
addAndMakeVisible (&findNext);
addAndMakeVisible (findPrev);
addAndMakeVisible (findNext);
setWantsKeyboardFocus (false);
setFocusContainer (true);

View file

@ -114,14 +114,14 @@ public:
: owner (owner_),
defaultButton ("Reset to Default")
{
addAndMakeVisible (&selector);
addAndMakeVisible (selector);
selector.setName ("Colour");
selector.setCurrentColour (owner->getColour());
selector.addChangeListener (owner);
if (canReset)
{
addAndMakeVisible (&defaultButton);
addAndMakeVisible (defaultButton);
defaultButton.addListener (this);
}
}

View file

@ -39,7 +39,7 @@ public:
isDirectory, false, fileBrowserWildcard,
String::empty, String::empty)
{
addAndMakeVisible (&filenameComp);
addAndMakeVisible (filenameComp);
filenameComp.addListener (this);
}

View file

@ -59,7 +59,7 @@ public:
includeAnchorOptions (includeAnchorOptions_),
allowRelativeOptions (allowRelativeOptions_)
{
addAndMakeVisible (&button);
addAndMakeVisible (button);
button.addListener (this);
button.setTriggeredOnMouseDown (true);
button.setConnectedEdges (TextButton::ConnectedOnLeft | TextButton::ConnectedOnRight);

View file

@ -282,7 +282,7 @@ void ComponentLayoutEditor::mouseDown (const MouseEvent& e)
}
else
{
addChildComponent (&lassoComp);
addChildComponent (lassoComp);
lassoComp.beginLasso (e, this);
}
}

View file

@ -73,8 +73,7 @@ private:
: document (doc), layout (l)
{
layout.getSelectedSet().addChangeListener (this);
addAndMakeVisible (&propsPanel);
addAndMakeVisible (propsPanel);
}
~LayoutPropsPanel()

View file

@ -133,8 +133,8 @@ public:
ClassPropertiesPanel (JucerDocument& doc)
: document (doc)
{
addAndMakeVisible (&panel1);
addAndMakeVisible (&panel2);
addAndMakeVisible (panel1);
addAndMakeVisible (panel2);
Array <PropertyComponent*> props;
props.add (new ComponentClassNameProperty (doc));
@ -318,7 +318,7 @@ JucerDocumentEditor::JucerDocumentEditor (JucerDocument* const doc)
setSize (document->getInitialWidth(),
document->getInitialHeight());
addAndMakeVisible (&tabbedComponent);
addAndMakeVisible (tabbedComponent);
tabbedComponent.setOutline (0);
tabbedComponent.addTab ("Class", tabColour, new ClassPropertiesPanel (*document), true);

View file

@ -216,7 +216,7 @@ void PaintRoutineEditor::mouseDown (const MouseEvent& e)
}
else
{
addChildComponent (&lassoComp);
addChildComponent (lassoComp);
lassoComp.beginLasso (e, this);
}
}

View file

@ -35,7 +35,7 @@ public:
: document (doc), reloadButton ("Reload"), row (0)
{
setInterceptsMouseClicks (false, true);
addAndMakeVisible (&reloadButton);
addAndMakeVisible (reloadButton);
reloadButton.addListener (this);
}
@ -74,13 +74,13 @@ ResourceEditorPanel::ResourceEditorPanel (JucerDocument& doc)
reloadAllButton ("Reload all resources"),
delButton ("Delete selected resources")
{
addAndMakeVisible (&addButton);
addAndMakeVisible (addButton);
addButton.addListener (this);
addAndMakeVisible (&reloadAllButton);
addAndMakeVisible (reloadAllButton);
reloadAllButton.addListener (this);
addAndMakeVisible (&delButton);
addAndMakeVisible (delButton);
delButton.addListener (this);
delButton.setEnabled (false);

View file

@ -139,8 +139,8 @@ private:
public:
PropertyPanelViewport (Component* content)
{
addAndMakeVisible (&viewport);
addAndMakeVisible (&rolloverHelp);
addAndMakeVisible (viewport);
addAndMakeVisible (rolloverHelp);
viewport.setViewedComponent (content, true);
}
@ -251,7 +251,7 @@ private:
public:
SettingsComp (Project& p) : project (p)
{
addAndMakeVisible (&group);
addAndMakeVisible (group);
updatePropertyList();
project.addChangeListener (this);

View file

@ -129,7 +129,7 @@ private:
public:
SettingsComp (ProjectExporter* exp)
{
addAndMakeVisible (&group);
addAndMakeVisible (group);
PropertyListBuilder props;
exp->createPropertyEditors (props);
@ -230,7 +230,7 @@ private:
public:
SettingsComp (ProjectExporter::BuildConfiguration* conf, const String& expName)
{
addAndMakeVisible (&group);
addAndMakeVisible (group);
PropertyListBuilder props;
conf->createPropertyEditors (props);

View file

@ -71,7 +71,7 @@ private:
ModuleSettingsPanel (Project& p, const String& modID)
: project (p), moduleID (modID)
{
addAndMakeVisible (&group);
addAndMakeVisible (group);
group.setName ("Module: " + moduleID);
refresh();
}
@ -202,7 +202,7 @@ private:
missingDependencies (project.getModules().getExtraDependenciesNeeded (modID)),
fixButton ("Add Required Modules")
{
addAndMakeVisible (&fixButton);
addAndMakeVisible (fixButton);
fixButton.setColour (TextButton::buttonColourId, Colours::red);
fixButton.setColour (TextButton::textColourOffId, Colours::white);
fixButton.addListener (this);

View file

@ -40,7 +40,7 @@ public:
{
list.setModel (this);
list.setColour (ListBox::backgroundColourId, Colours::transparentBlack);
addAndMakeVisible (&list);
addAndMakeVisible (list);
list.updateContent();
list.setRowHeight (20);
item.state.addListener (this);
@ -121,10 +121,10 @@ private:
{
if (item.isFile())
{
addAndMakeVisible (&compileButton);
addAndMakeVisible (compileButton);
compileButton.getToggleStateValue().referTo (item.getShouldCompileValue());
addAndMakeVisible (&resourceButton);
addAndMakeVisible (resourceButton);
resourceButton.getToggleStateValue().referTo (item.getShouldAddToResourceValue());
}
}

View file

@ -45,14 +45,14 @@ public:
table.setModel (this);
table.setColour (TableListBox::backgroundColourId, Colours::transparentBlack);
addAndMakeVisible (&table);
addAndMakeVisible (table);
table.updateContent();
table.setRowHeight (20);
addAndMakeVisible (&addWebModuleButton);
addAndMakeVisible (&updateModuleButton);
addAndMakeVisible (&setCopyModeButton);
addAndMakeVisible (&copyPathButton);
addAndMakeVisible (addWebModuleButton);
addAndMakeVisible (updateModuleButton);
addAndMakeVisible (setCopyModeButton);
addAndMakeVisible (copyPathButton);
addWebModuleButton.addListener (this);
updateModuleButton.addListener (this);
updateModuleButton.setEnabled (false);

View file

@ -71,12 +71,12 @@ public:
#if JUCE_MAC || JUCE_WINDOWS
ApplicationCommandManager& commandManager = IntrojucerApp::getCommandManager();
addAndMakeVisible (&openProjectButton);
addAndMakeVisible (openProjectButton);
openProjectButton.setCommandToTrigger (&commandManager, CommandIDs::openInIDE, true);
openProjectButton.setButtonText (commandManager.getNameOfCommand (CommandIDs::openInIDE));
openProjectButton.setColour (TextButton::buttonColourId, Colours::white.withAlpha (0.5f));
addAndMakeVisible (&saveAndOpenButton);
addAndMakeVisible (saveAndOpenButton);
saveAndOpenButton.setCommandToTrigger (&commandManager, CommandIDs::saveAndOpenInIDE, true);
saveAndOpenButton.setButtonText (commandManager.getNameOfCommand (CommandIDs::saveAndOpenInIDE));
saveAndOpenButton.setColour (TextButton::buttonColourId, Colours::white.withAlpha (0.5f));
@ -263,7 +263,7 @@ void ProjectContentComponent::rebuildProjectTabs()
if (project != nullptr)
{
addAndMakeVisible (&treeViewTabs);
addAndMakeVisible (treeViewTabs);
createProjectTabs();
@ -651,7 +651,7 @@ void ProjectContentComponent::updateMainWindowTitle()
void ProjectContentComponent::showBubbleMessage (const Rectangle<int>& pos, const String& text)
{
addChildComponent (&bubbleMessage);
addChildComponent (bubbleMessage);
bubbleMessage.setColour (BubbleComponent::backgroundColourId, Colours::white.withAlpha (0.7f));
bubbleMessage.setColour (BubbleComponent::outlineColourId, Colours::black.withAlpha (0.8f));
bubbleMessage.setAlwaysOnTop (true);

View file

@ -144,7 +144,7 @@ public:
ed.setText (item.getRenamingName());
ed.setBounds (bounds);
parent.addAndMakeVisible (&ed);
parent.addAndMakeVisible (ed);
ed.enterModalState (true, this);
}

View file

@ -118,7 +118,7 @@ public:
TreePanelBase (const Project* p, const String& treeviewID)
: project (p), opennessStateKey (treeviewID)
{
addAndMakeVisible (&tree);
addAndMakeVisible (tree);
tree.setRootItemVisible (true);
tree.setDefaultOpenness (true);
tree.setColour (TreeView::backgroundColourId, Colours::transparentBlack);

View file

@ -306,14 +306,14 @@ public:
{
desc.setJustificationType (Justification::centred);
desc.setColour (Label::textColourId, Colours::white);
addAndMakeVisible (&desc);
addAndMakeVisible (desc);
const Colour bkgd (Colours::white.withAlpha (0.6f));
userText.setMultiLine (true, true);
userText.setReturnKeyStartsNewLine (true);
userText.setColour (TextEditor::backgroundColourId, bkgd);
addAndMakeVisible (&userText);
addAndMakeVisible (userText);
userText.addListener (this);
resultText.setFont (getAppSettings().appearance.getCodeFont().withHeight (13.0f));
@ -321,7 +321,7 @@ public:
resultText.setColour (TextEditor::backgroundColourId, bkgd);
resultText.setReadOnly (true);
resultText.setSelectAllWhenFocused (true);
addAndMakeVisible (&resultText);
addAndMakeVisible (resultText);
userText.setText (getLastText());
}
@ -391,7 +391,7 @@ public:
{
desc.setJustificationType (Justification::centred);
desc.setColour (Label::textColourId, Colours::white);
addAndMakeVisible (&desc);
addAndMakeVisible (desc);
const Colour bkgd (Colours::white.withAlpha (0.6f));
@ -399,7 +399,7 @@ public:
userText.setMultiLine (true, true);
userText.setReturnKeyStartsNewLine (true);
userText.setColour (TextEditor::backgroundColourId, bkgd);
addAndMakeVisible (&userText);
addAndMakeVisible (userText);
userText.addListener (this);
resultText.setFont (getAppSettings().appearance.getCodeFont().withHeight (13.0f));
@ -407,7 +407,7 @@ public:
resultText.setColour (TextEditor::backgroundColourId, bkgd);
resultText.setReadOnly (true);
resultText.setSelectAllWhenFocused (true);
addAndMakeVisible (&resultText);
addAndMakeVisible (resultText);
userText.setText (getLastText());
}

View file

@ -189,14 +189,14 @@ public:
colourValue (colour),
defaultColour (defaultCol)
{
addAndMakeVisible (&selector);
addAndMakeVisible (selector);
selector.setName ("Colour");
selector.setCurrentColour (getColour());
selector.addChangeListener (this);
if (canResetToDefault)
{
addAndMakeVisible (&defaultButton);
addAndMakeVisible (defaultButton);
defaultButton.addListener (this);
}
@ -364,7 +364,7 @@ public:
: PropertyComponent (name),
colourEditor (undoManager, colour, defaultColour, canResetToDefault)
{
addAndMakeVisible (&colourEditor);
addAndMakeVisible (colourEditor);
}
void resized() override

View file

@ -289,28 +289,28 @@ public:
"\n\n"
"First, choose whether to scan the current project for all TRANS() macros, or "
"pick an existing translation file to load:", dontSendNotification);
addAndMakeVisible (&instructionsLabel);
addAndMakeVisible (instructionsLabel);
label1.setText ("..then copy-and-paste this annotated text into Google Translate or some other translator:", dontSendNotification);
addAndMakeVisible (&label1);
addAndMakeVisible (label1);
label2.setText ("...then, take the translated result and paste it into the box below:", dontSendNotification);
addAndMakeVisible (&label2);
addAndMakeVisible (label2);
label3.setText ("Finally, click the 'Generate' button, and a translation file will be created below. "
"Remember to update its language code at the top!", dontSendNotification);
addAndMakeVisible (&label3);
addAndMakeVisible (label3);
addAndMakeVisible (&editorPre);
addAndMakeVisible (&editorPost);
addAndMakeVisible (&editorResult);
addAndMakeVisible (editorPre);
addAndMakeVisible (editorPost);
addAndMakeVisible (editorResult);
generateButton.setButtonText (TRANS("Generate"));
addAndMakeVisible (&generateButton);
addAndMakeVisible (generateButton);
scanButton.setButtonText ("Scan Project for TRANS macros");
addAndMakeVisible (&scanButton);
addAndMakeVisible (scanButton);
loadButton.setButtonText ("Load existing translation File...");
addAndMakeVisible (&loadButton);
addAndMakeVisible (loadButton);
generateButton.addListener (this);
scanButton.addListener (this);

View file

@ -22,12 +22,12 @@ JuceDemoPluginAudioProcessorEditor::JuceDemoPluginAudioProcessorEditor (JuceDemo
delaySlider ("delay")
{
// add some sliders..
addAndMakeVisible (&gainSlider);
addAndMakeVisible (gainSlider);
gainSlider.setSliderStyle (Slider::Rotary);
gainSlider.addListener (this);
gainSlider.setRange (0.0, 1.0, 0.01);
addAndMakeVisible (&delaySlider);
addAndMakeVisible (delaySlider);
delaySlider.setSliderStyle (Slider::Rotary);
delaySlider.addListener (this);
delaySlider.setRange (0.0, 1.0, 0.01);
@ -40,10 +40,10 @@ JuceDemoPluginAudioProcessorEditor::JuceDemoPluginAudioProcessorEditor (JuceDemo
delayLabel.setFont (Font (11.0f));
// add the midi keyboard component..
addAndMakeVisible (&midiKeyboard);
addAndMakeVisible (midiKeyboard);
// add a label that will display the current timecode and status..
addAndMakeVisible (&infoLabel);
addAndMakeVisible (infoLabel);
infoLabel.setColour (Label::textColourId, Colours::blue);
// add the triangular resizer component for the bottom-right of the UI

View file

@ -109,7 +109,7 @@ public:
jassert (p != nullptr);
setOpaque (true);
addAndMakeVisible (&panel);
addAndMakeVisible (panel);
Array<PropertyComponent*> programs;

View file

@ -37,11 +37,11 @@ public:
: textBox (String::empty),
button ("Send a message to the webpage")
{
addAndMakeVisible (&textBox);
addAndMakeVisible (textBox);
textBox.setMultiLine (true);
textBox.setBounds (8, 8, 300, 300);
addAndMakeVisible (&button);
addAndMakeVisible (button);
button.setBounds (320, 8, 180, 22);
button.addListener (this);
button.setEnabled (false);

View file

@ -1372,7 +1372,7 @@ private:
JUCE_AUTORELEASEPOOL
{
jassert (ed != nullptr);
addAndMakeVisible (&editor);
addAndMakeVisible (editor);
setOpaque (true);
setVisible (true);
setBroughtToFrontOnMouseClick (true);

View file

@ -54,7 +54,7 @@ public:
{
setTitleBarButtonsRequired (DocumentWindow::minimiseButton | DocumentWindow::closeButton, false);
Component::addAndMakeVisible (&optionsButton);
Component::addAndMakeVisible (optionsButton);
optionsButton.addListener (this);
optionsButton.setTriggeredOnMouseDown (true);

View file

@ -1303,7 +1303,7 @@ public:
: AudioProcessorEditor (&p),
plugin (p)
{
addAndMakeVisible (&wrapper);
addAndMakeVisible (wrapper);
setOpaque (true);
setVisible (true);

View file

@ -1682,7 +1682,7 @@ private:
pluginHandle = (HandleFormat) peer->getNativeHandle();
#elif JUCE_MAC
dummyComponent.setBounds (getBounds().withZeroOrigin());
addAndMakeVisible (&dummyComponent);
addAndMakeVisible (dummyComponent);
pluginHandle = [[NSView alloc] init];
dummyComponent.setView (pluginHandle);
#endif

View file

@ -35,7 +35,7 @@ public:
slider (p, index_)
{
startTimer (100);
addAndMakeVisible (&slider);
addAndMakeVisible (slider);
owner.addListener (this);
}
@ -123,7 +123,7 @@ GenericAudioProcessorEditor::GenericAudioProcessorEditor (AudioProcessor* const
jassert (p != nullptr);
setOpaque (true);
addAndMakeVisible (&panel);
addAndMakeVisible (panel);
Array <PropertyComponent*> params;

View file

@ -152,9 +152,9 @@ PluginListComponent::PluginListComponent (AudioPluginFormatManager& manager, Kno
table.setHeaderHeight (22);
table.setRowHeight (20);
table.setModel (tableModel);
addAndMakeVisible (&table);
addAndMakeVisible (table);
addAndMakeVisible (&optionsButton);
addAndMakeVisible (optionsButton);
optionsButton.addListener (this);
optionsButton.setTriggeredOnMouseDown (true);

View file

@ -1443,25 +1443,25 @@ Component* Component::getComponentAt (const int x, const int y)
}
//==============================================================================
void Component::addChildComponent (Component* const child, int zOrder)
void Component::addChildComponent (Component& child, int zOrder)
{
// if component methods are being called from threads other than the message
// thread, you'll need to use a MessageManagerLock object to make sure it's thread-safe.
CHECK_MESSAGE_MANAGER_IS_LOCKED_OR_OFFSCREEN
if (child != nullptr && child->parentComponent != this)
if (child.parentComponent != this)
{
if (child->parentComponent != nullptr)
child->parentComponent->removeChildComponent (child);
if (child.parentComponent != nullptr)
child.parentComponent->removeChildComponent (&child);
else
child->removeFromDesktop();
child.removeFromDesktop();
child->parentComponent = this;
child.parentComponent = this;
if (child->isVisible())
child->repaintParent();
if (child.isVisible())
child.repaintParent();
if (! child->isAlwaysOnTop())
if (! child.isAlwaysOnTop())
{
if (zOrder < 0 || zOrder > childComponentList.size())
zOrder = childComponentList.size();
@ -1475,20 +1475,29 @@ void Component::addChildComponent (Component* const child, int zOrder)
}
}
childComponentList.insert (zOrder, child);
childComponentList.insert (zOrder, &child);
child->internalHierarchyChanged();
child.internalHierarchyChanged();
internalChildrenChanged();
}
}
void Component::addAndMakeVisible (Component& child, int zOrder)
{
child.setVisible (true);
addChildComponent (child, zOrder);
}
void Component::addChildComponent (Component* const child, int zOrder)
{
if (child != nullptr)
addChildComponent (*child, zOrder);
}
void Component::addAndMakeVisible (Component* const child, int zOrder)
{
if (child != nullptr)
{
child->setVisible (true);
addChildComponent (child, zOrder);
}
addAndMakeVisible (*child, zOrder);
}
void Component::addChildAndSetID (Component* const child, const String& childID)

View file

@ -703,13 +703,38 @@ public:
*/
void addChildComponent (Component* child, int zOrder = -1);
/** Adds a child component to this one, and also makes the child visible if it isn't.
/** Adds a child component to this one.
Quite a useful function, this is just the same as calling setVisible (true) on the child
and then addChildComponent(). See addChildComponent() for more details.
Adding a child component does not mean that the component will own or delete the child - it's
your responsibility to delete the component. Note that it's safe to delete a component
without first removing it from its parent - doing so will automatically remove it and
send out the appropriate notifications before the deletion completes.
If the child is already a child of this component, then no action will be taken, and its
z-order will be left unchanged.
@param child the new component to add. If the component passed-in is already
the child of another component, it'll first be removed from it current parent.
@param zOrder The index in the child-list at which this component should be inserted.
A value of -1 will insert it in front of the others, 0 is the back.
@see removeChildComponent, addAndMakeVisible, addChildAndSetID, getChild, ComponentListener::componentChildrenChanged
*/
void addChildComponent (Component& child, int zOrder = -1);
/** Adds a child component to this one, and also makes the child visible if it isn't already.
This is the same as calling setVisible (true) on the child and then addChildComponent().
See addChildComponent() for more details.
*/
void addAndMakeVisible (Component* child, int zOrder = -1);
/** Adds a child component to this one, and also makes the child visible if it isn't already.
This is the same as calling setVisible (true) on the child and then addChildComponent().
See addChildComponent() for more details.
*/
void addAndMakeVisible (Component& child, int zOrder = -1);
/** Adds a child component to this one, makes it visible, and sets its component ID.
@see addAndMakeVisible, addChildComponent
*/

View file

@ -84,19 +84,19 @@ FileBrowserComponent::FileBrowserComponent (int flags_,
fileListComponent->addListener (this);
addAndMakeVisible (&currentPathBox);
addAndMakeVisible (currentPathBox);
currentPathBox.setEditableText (true);
resetRecentPaths();
currentPathBox.addListener (this);
addAndMakeVisible (&filenameBox);
addAndMakeVisible (filenameBox);
filenameBox.setMultiLine (false);
filenameBox.setSelectAllWhenFocused (true);
filenameBox.setText (filename, false);
filenameBox.addListener (this);
filenameBox.setReadOnly ((flags & (filenameBoxIsReadOnly | canSelectMultipleItems)) != 0);
addAndMakeVisible (&fileLabel);
addAndMakeVisible (fileLabel);
fileLabel.attachToComponent (&filenameBox, true);
addAndMakeVisible (goUpButton = getLookAndFeel().createFileBrowserGoUpButton());

View file

@ -33,15 +33,15 @@ public:
newFolderButton (TRANS ("New Folder")),
instructions (desc)
{
addAndMakeVisible (&chooserComponent);
addAndMakeVisible (chooserComponent);
addAndMakeVisible (&okButton);
addAndMakeVisible (okButton);
okButton.addShortcut (KeyPress (KeyPress::returnKey));
addAndMakeVisible (&cancelButton);
addAndMakeVisible (cancelButton);
cancelButton.addShortcut (KeyPress (KeyPress::escapeKey));
addChildComponent (&newFolderButton);
addChildComponent (newFolderButton);
setInterceptsMouseClicks (false, true);
}

View file

@ -30,23 +30,23 @@ FileSearchPathListComponent::FileSearchPathListComponent()
downButton (String::empty, DrawableButton::ImageOnButtonBackground)
{
listBox.setModel (this);
addAndMakeVisible (&listBox);
addAndMakeVisible (listBox);
listBox.setColour (ListBox::backgroundColourId, Colours::black.withAlpha (0.02f));
listBox.setColour (ListBox::outlineColourId, Colours::black.withAlpha (0.1f));
listBox.setOutlineThickness (1);
addAndMakeVisible (&addButton);
addAndMakeVisible (addButton);
addButton.addListener (this);
addButton.setConnectedEdges (Button::ConnectedOnLeft | Button::ConnectedOnRight | Button::ConnectedOnBottom | Button::ConnectedOnTop);
addAndMakeVisible (&removeButton);
addAndMakeVisible (removeButton);
removeButton.addListener (this);
removeButton.setConnectedEdges (Button::ConnectedOnLeft | Button::ConnectedOnRight | Button::ConnectedOnBottom | Button::ConnectedOnTop);
addAndMakeVisible (&changeButton);
addAndMakeVisible (changeButton);
changeButton.addListener (this);
addAndMakeVisible (&upButton);
addAndMakeVisible (upButton);
upButton.addListener (this);
{
@ -59,7 +59,7 @@ FileSearchPathListComponent::FileSearchPathListComponent()
upButton.setImages (&arrowImage);
}
addAndMakeVisible (&downButton);
addAndMakeVisible (downButton);
downButton.addListener (this);
{

View file

@ -38,7 +38,7 @@ FilenameComponent::FilenameComponent (const String& name,
wildcard (fileBrowserWildcard),
enforcedSuffix (suffix)
{
addAndMakeVisible (&filenameBox);
addAndMakeVisible (filenameBox);
filenameBox.setEditableText (canEditFilename);
filenameBox.addListener (this);
filenameBox.setTextWhenNothingSelected (textWhenNothingSelected);

View file

@ -34,11 +34,11 @@ Viewport::Viewport (const String& name)
horizontalScrollBar (false)
{
// content holder is used to clip the contents so they don't overlap the scrollbars
addAndMakeVisible (&contentHolder);
addAndMakeVisible (contentHolder);
contentHolder.setInterceptsMouseClicks (false, true);
addChildComponent (&verticalScrollBar);
addChildComponent (&horizontalScrollBar);
addChildComponent (verticalScrollBar);
addChildComponent (horizontalScrollBar);
verticalScrollBar.addListener (this);
horizontalScrollBar.addListener (this);

View file

@ -29,7 +29,7 @@ BooleanPropertyComponent::BooleanPropertyComponent (const String& name,
onText (buttonTextWhenTrue),
offText (buttonTextWhenFalse)
{
addAndMakeVisible (&button);
addAndMakeVisible (button);
button.setClickingTogglesState (false);
button.addListener (this);
}
@ -41,7 +41,7 @@ BooleanPropertyComponent::BooleanPropertyComponent (const Value& valueToControl,
onText (buttonText),
offText (buttonText)
{
addAndMakeVisible (&button);
addAndMakeVisible (button);
button.setClickingTogglesState (false);
button.setButtonText (buttonText);
button.getToggleStateValue().referTo (valueToControl);

View file

@ -26,7 +26,7 @@ ButtonPropertyComponent::ButtonPropertyComponent (const String& name,
const bool triggerOnMouseDown)
: PropertyComponent (name)
{
addAndMakeVisible (&button);
addAndMakeVisible (button);
button.setTriggeredOnMouseDown (triggerOnMouseDown);
button.addListener (this);
}

View file

@ -96,7 +96,7 @@ ChoicePropertyComponent::~ChoicePropertyComponent()
//==============================================================================
void ChoicePropertyComponent::createComboBox()
{
addAndMakeVisible (&comboBox);
addAndMakeVisible (comboBox);
for (int i = 0; i < choices.size(); ++i)
{

View file

@ -193,7 +193,7 @@ void PropertyPanel::init()
{
messageWhenEmpty = TRANS("(nothing selected)");
addAndMakeVisible (&viewport);
addAndMakeVisible (viewport);
viewport.setViewedComponent (propertyHolderComponent = new PropertyHolderComponent());
viewport.setFocusContainer (true);
}

View file

@ -29,7 +29,7 @@ SliderPropertyComponent::SliderPropertyComponent (const String& name,
const double skewFactor)
: PropertyComponent (name)
{
addAndMakeVisible (&slider);
addAndMakeVisible (slider);
slider.setRange (rangeMin, rangeMax, interval);
slider.setSkewFactor (skewFactor);
@ -46,7 +46,7 @@ SliderPropertyComponent::SliderPropertyComponent (const Value& valueToControl,
const double skewFactor)
: PropertyComponent (name)
{
addAndMakeVisible (&slider);
addAndMakeVisible (slider);
slider.setRange (rangeMin, rangeMax, interval);
slider.setSkewFactor (skewFactor);

View file

@ -713,13 +713,13 @@ private:
+ TRANS ("Items on the toolbar can also be dragged around to change their order, or dragged off the edge to delete them.")),
defaultButton (TRANS ("Restore to default set of items"))
{
addAndMakeVisible (&palette);
addAndMakeVisible (palette);
if ((optionFlags & (Toolbar::allowIconsOnlyChoice
| Toolbar::allowIconsWithTextChoice
| Toolbar::allowTextOnlyChoice)) != 0)
{
addAndMakeVisible (&styleBox);
addAndMakeVisible (styleBox);
styleBox.setEditableText (false);
if ((optionFlags & Toolbar::allowIconsOnlyChoice) != 0) styleBox.addItem (TRANS("Show icons only"), 1);
@ -741,11 +741,11 @@ private:
if ((optionFlags & Toolbar::showResetToDefaultsButton) != 0)
{
addAndMakeVisible (&defaultButton);
addAndMakeVisible (defaultButton);
defaultButton.addListener (this);
}
addAndMakeVisible (&instructions);
addAndMakeVisible (instructions);
instructions.setFont (Font (13.0f));
setSize (500, 300);

View file

@ -28,13 +28,13 @@ ToolbarItemPalette::ToolbarItemPalette (ToolbarItemFactory& tbf, Toolbar& bar)
Component* const itemHolder = new Component();
viewport.setViewedComponent (itemHolder);
Array <int> allIds;
Array<int> allIds;
factory.getAllToolbarItemIds (allIds);
for (int i = 0; i < allIds.size(); ++i)
addComponent (allIds.getUnchecked (i), -1);
addAndMakeVisible (&viewport);
addAndMakeVisible (viewport);
}
ToolbarItemPalette::~ToolbarItemPalette()

View file

@ -25,7 +25,7 @@
CallOutBox::CallOutBox (Component& c, const Rectangle<int>& area, Component* const parent)
: borderSpace (20), arrowSize (16.0f), content (c)
{
addAndMakeVisible (&content);
addAndMakeVisible (content);
if (parent != nullptr)
{

View file

@ -365,10 +365,10 @@ CodeEditorComponent::CodeEditorComponent (CodeDocument& doc, CodeTokeniser* cons
addAndMakeVisible (caret = getLookAndFeel().createCaretComponent (this));
addAndMakeVisible (&verticalScrollBar);
addAndMakeVisible (verticalScrollBar);
verticalScrollBar.setSingleStepSize (1.0);
addAndMakeVisible (&horizontalScrollBar);
addAndMakeVisible (horizontalScrollBar);
horizontalScrollBar.setSingleStepSize (1.0);
Font f (12.0f);

View file

@ -73,7 +73,7 @@ public:
ColourSpaceView (ColourSelector& cs, float& hue, float& sat, float& val, const int edgeSize)
: owner (cs), h (hue), s (sat), v (val), lastHue (0.0f), edge (edgeSize)
{
addAndMakeVisible (&marker);
addAndMakeVisible (marker);
setMouseCursor (MouseCursor::CrosshairCursor);
}
@ -199,7 +199,7 @@ public:
HueSelectorComp (ColourSelector& cs, float& hue, const int edgeSize)
: owner (cs), h (hue), edge (edgeSize)
{
addAndMakeVisible (&marker);
addAndMakeVisible (marker);
}
void paint (Graphics& g) override

View file

@ -403,11 +403,11 @@ KeyMappingEditorComponent::KeyMappingEditorComponent (KeyPressMappingSet& mappin
if (showResetToDefaultButton)
{
addAndMakeVisible (&resetButton);
addAndMakeVisible (resetButton);
resetButton.addListener (treeItem);
}
addAndMakeVisible (&tree);
addAndMakeVisible (tree);
tree.setColour (TreeView::backgroundColourId, findColour (backgroundColourId));
tree.setRootItemVisible (false);
tree.setDefaultOpenness (true);

View file

@ -107,10 +107,10 @@ LivePropertyEditorBase::LivePropertyEditorBase (LiveValueBase& v, CodeDocument&
{
setSize (600, 100);
addAndMakeVisible (&name);
addAndMakeVisible (&resetButton);
addAndMakeVisible (&valueEditor);
addAndMakeVisible (&sourceEditor);
addAndMakeVisible (name);
addAndMakeVisible (resetButton);
addAndMakeVisible (valueEditor);
addAndMakeVisible (sourceEditor);
findOriginalValueInCode();
selectOriginalValue();
@ -420,7 +420,7 @@ public:
: editor (e), isFloat (useFloat)
{
slider.setTextBoxStyle (Slider::NoTextBox, true, 0, 0);
addAndMakeVisible (&slider);
addAndMakeVisible (slider);
updateRange();
slider.addListener (this);
}