Browse Source

Minor code clean-ups.

tags/2021-05-28
Julian Storer 15 years ago
parent
commit
6bcc8febca
25 changed files with 246 additions and 380 deletions
  1. +97
    -165
      juce_amalgamated.cpp
  2. +26
    -25
      juce_amalgamated.h
  3. +1
    -1
      src/core/juce_StandardHeader.h
  4. +2
    -6
      src/gui/components/controls/juce_TreeView.cpp
  5. +8
    -5
      src/gui/components/controls/juce_TreeView.h
  6. +15
    -17
      src/gui/components/filebrowser/juce_FilenameComponent.cpp
  7. +2
    -2
      src/gui/components/filebrowser/juce_FilenameComponent.h
  8. +3
    -6
      src/gui/components/layout/juce_ScrollBar.cpp
  9. +2
    -2
      src/gui/components/layout/juce_ScrollBar.h
  10. +6
    -6
      src/gui/components/layout/juce_TabbedButtonBar.cpp
  11. +1
    -1
      src/gui/components/layout/juce_TabbedButtonBar.h
  12. +14
    -19
      src/gui/components/properties/juce_BooleanPropertyComponent.cpp
  13. +1
    -3
      src/gui/components/properties/juce_BooleanPropertyComponent.h
  14. +4
    -5
      src/gui/components/properties/juce_ButtonPropertyComponent.cpp
  15. +1
    -1
      src/gui/components/properties/juce_ButtonPropertyComponent.h
  16. +9
    -12
      src/gui/components/properties/juce_ChoicePropertyComponent.cpp
  17. +1
    -1
      src/gui/components/properties/juce_ChoicePropertyComponent.h
  18. +9
    -10
      src/gui/components/properties/juce_PropertyPanel.cpp
  19. +1
    -1
      src/gui/components/properties/juce_PropertyPanel.h
  20. +14
    -15
      src/gui/components/properties/juce_SliderPropertyComponent.cpp
  21. +1
    -1
      src/gui/components/properties/juce_SliderPropertyComponent.h
  22. +17
    -60
      src/gui/components/special/juce_AudioDeviceSelectorComponent.cpp
  23. +7
    -7
      src/gui/components/special/juce_AudioDeviceSelectorComponent.h
  24. +2
    -7
      src/native/mac/juce_mac_CoreAudio.cpp
  25. +2
    -2
      src/native/windows/juce_win32_DirectSound.cpp

+ 97
- 165
juce_amalgamated.cpp View File

@@ -55211,8 +55211,6 @@ private:
TreeView::TreeView (const String& componentName) TreeView::TreeView (const String& componentName)
: Component (componentName), : Component (componentName),
rootItem (0), rootItem (0),
dragInsertPointHighlight (0),
dragTargetGroupHighlight (0),
indentSize (24), indentSize (24),
defaultOpenness (false), defaultOpenness (false),
needsRecalculating (true), needsRecalculating (true),
@@ -55230,8 +55228,6 @@ TreeView::~TreeView()
{ {
if (rootItem != 0) if (rootItem != 0)
rootItem->setOwnerView (0); rootItem->setOwnerView (0);

deleteAllChildren();
} }


void TreeView::setRootItem (TreeViewItem* const newRootItem) void TreeView::setRootItem (TreeViewItem* const newRootItem)
@@ -55691,8 +55687,8 @@ void TreeView::showDragHighlight (TreeViewItem* item, int insertIndex, int x, in


void TreeView::hideDragHighlight() throw() void TreeView::hideDragHighlight() throw()
{ {
deleteAndZero (dragInsertPointHighlight);
deleteAndZero (dragTargetGroupHighlight);
dragInsertPointHighlight = 0;
dragTargetGroupHighlight = 0;
} }


TreeViewItem* TreeView::getInsertPosition (int& x, int& y, int& insertIndex, TreeViewItem* TreeView::getInsertPosition (int& x, int& y, int& insertIndex,
@@ -57935,13 +57931,12 @@ FilenameComponent::FilenameComponent (const String& name,
wildcard (fileBrowserWildcard), wildcard (fileBrowserWildcard),
enforcedSuffix (enforcedSuffix_) enforcedSuffix (enforcedSuffix_)
{ {
addAndMakeVisible (filenameBox = new ComboBox ("fn"));
filenameBox->setEditableText (canEditFilename);
filenameBox->addListener (this);
filenameBox->setTextWhenNothingSelected (textWhenNothingSelected);
filenameBox->setTextWhenNoChoicesAvailable (TRANS("(no recently seleced files)"));
addAndMakeVisible (&filenameBox);
filenameBox.setEditableText (canEditFilename);
filenameBox.addListener (this);
filenameBox.setTextWhenNothingSelected (textWhenNothingSelected);
filenameBox.setTextWhenNoChoicesAvailable (TRANS("(no recently seleced files)"));


browseButton = 0;
setBrowseButtonText ("..."); setBrowseButtonText ("...");


setCurrentFile (currentFile, true); setCurrentFile (currentFile, true);
@@ -57949,7 +57944,6 @@ FilenameComponent::FilenameComponent (const String& name,


FilenameComponent::~FilenameComponent() FilenameComponent::~FilenameComponent()
{ {
deleteAllChildren();
} }


void FilenameComponent::paintOverChildren (Graphics& g) void FilenameComponent::paintOverChildren (Graphics& g)
@@ -57963,7 +57957,7 @@ void FilenameComponent::paintOverChildren (Graphics& g)


void FilenameComponent::resized() void FilenameComponent::resized()
{ {
getLookAndFeel().layoutFilenameComponent (*this, filenameBox, browseButton);
getLookAndFeel().layoutFilenameComponent (*this, &filenameBox, browseButton);
} }


void FilenameComponent::setBrowseButtonText (const String& newBrowseButtonText) void FilenameComponent::setBrowseButtonText (const String& newBrowseButtonText)
@@ -57974,7 +57968,7 @@ void FilenameComponent::setBrowseButtonText (const String& newBrowseButtonText)


void FilenameComponent::lookAndFeelChanged() void FilenameComponent::lookAndFeelChanged()
{ {
deleteAndZero (browseButton);
browseButton = 0;


addAndMakeVisible (browseButton = getLookAndFeel().createFilenameComponentBrowseButton (browseButtonText)); addAndMakeVisible (browseButton = getLookAndFeel().createFilenameComponentBrowseButton (browseButtonText));
browseButton->setConnectedEdges (Button::ConnectedOnLeft); browseButton->setConnectedEdges (Button::ConnectedOnLeft);
@@ -57986,7 +57980,7 @@ void FilenameComponent::lookAndFeelChanged()
void FilenameComponent::setTooltip (const String& newTooltip) void FilenameComponent::setTooltip (const String& newTooltip)
{ {
SettableTooltipClient::setTooltip (newTooltip); SettableTooltipClient::setTooltip (newTooltip);
filenameBox->setTooltip (newTooltip);
filenameBox.setTooltip (newTooltip);
} }


void FilenameComponent::setDefaultBrowseTarget (const File& newDefaultDirectory) void FilenameComponent::setDefaultBrowseTarget (const File& newDefaultDirectory)
@@ -58044,7 +58038,7 @@ void FilenameComponent::fileDragExit (const StringArray&)


const File FilenameComponent::getCurrentFile() const const File FilenameComponent::getCurrentFile() const
{ {
File f (filenameBox->getText());
File f (filenameBox.getText());


if (enforcedSuffix.isNotEmpty()) if (enforcedSuffix.isNotEmpty())
f = f.withFileExtension (enforcedSuffix); f = f.withFileExtension (enforcedSuffix);
@@ -58066,7 +58060,7 @@ void FilenameComponent::setCurrentFile (File newFile,
if (addToRecentlyUsedList) if (addToRecentlyUsedList)
addRecentlyUsedFile (newFile); addRecentlyUsedFile (newFile);


filenameBox->setText (lastFilename, true);
filenameBox.setText (lastFilename, true);


if (sendChangeNotification) if (sendChangeNotification)
triggerAsyncUpdate(); triggerAsyncUpdate();
@@ -58075,15 +58069,15 @@ void FilenameComponent::setCurrentFile (File newFile,


void FilenameComponent::setFilenameIsEditable (const bool shouldBeEditable) void FilenameComponent::setFilenameIsEditable (const bool shouldBeEditable)
{ {
filenameBox->setEditableText (shouldBeEditable);
filenameBox.setEditableText (shouldBeEditable);
} }


const StringArray FilenameComponent::getRecentlyUsedFilenames() const const StringArray FilenameComponent::getRecentlyUsedFilenames() const
{ {
StringArray names; StringArray names;


for (int i = 0; i < filenameBox->getNumItems(); ++i)
names.add (filenameBox->getItemText (i));
for (int i = 0; i < filenameBox.getNumItems(); ++i)
names.add (filenameBox.getItemText (i));


return names; return names;
} }
@@ -58092,10 +58086,10 @@ void FilenameComponent::setRecentlyUsedFilenames (const StringArray& filenames)
{ {
if (filenames != getRecentlyUsedFilenames()) if (filenames != getRecentlyUsedFilenames())
{ {
filenameBox->clear();
filenameBox.clear();


for (int i = 0; i < jmin (filenames.size(), maxRecentFiles); ++i) for (int i = 0; i < jmin (filenames.size(), maxRecentFiles); ++i)
filenameBox->addItem (filenames[i], i + 1);
filenameBox.addItem (filenames[i], i + 1);
} }
} }


@@ -61606,9 +61600,7 @@ ScrollBar::ScrollBar (const bool vertical_,
minimumDelayInMillisecs (10), minimumDelayInMillisecs (10),
vertical (vertical_), vertical (vertical_),
isDraggingThumb (false), isDraggingThumb (false),
autohides (true),
upButton (0),
downButton (0)
autohides (true)
{ {
setButtonVisibility (buttonsAreVisible); setButtonVisibility (buttonsAreVisible);


@@ -61618,7 +61610,8 @@ ScrollBar::ScrollBar (const bool vertical_,


ScrollBar::~ScrollBar() ScrollBar::~ScrollBar()
{ {
deleteAllChildren();
upButton = 0;
downButton = 0;
} }


void ScrollBar::setRangeLimits (const Range<double>& newRangeLimit) void ScrollBar::setRangeLimits (const Range<double>& newRangeLimit)
@@ -61768,9 +61761,7 @@ void ScrollBar::setOrientation (const bool shouldBeVertical)


void ScrollBar::setButtonVisibility (const bool buttonsAreVisible) void ScrollBar::setButtonVisibility (const bool buttonsAreVisible)
{ {
delete upButton;
upButton = 0; upButton = 0;
delete downButton;
downButton = 0; downButton = 0;


if (buttonsAreVisible) if (buttonsAreVisible)
@@ -62605,8 +62596,7 @@ private:


TabbedButtonBar::TabbedButtonBar (const Orientation orientation_) TabbedButtonBar::TabbedButtonBar (const Orientation orientation_)
: orientation (orientation_), : orientation (orientation_),
currentTabIndex (-1),
extraTabsButton (0)
currentTabIndex (-1)
{ {
setInterceptsMouseClicks (false, true); setInterceptsMouseClicks (false, true);
addAndMakeVisible (behindFrontTab = new TabAreaBehindFrontButtonComponent (this)); addAndMakeVisible (behindFrontTab = new TabAreaBehindFrontButtonComponent (this));
@@ -62615,6 +62605,7 @@ TabbedButtonBar::TabbedButtonBar (const Orientation orientation_)


TabbedButtonBar::~TabbedButtonBar() TabbedButtonBar::~TabbedButtonBar()
{ {
extraTabsButton = 0;
deleteAllChildren(); deleteAllChildren();
} }


@@ -62639,7 +62630,7 @@ void TabbedButtonBar::clearTabs()
tabColours.clear(); tabColours.clear();
currentTabIndex = -1; currentTabIndex = -1;


deleteAndZero (extraTabsButton);
extraTabsButton = 0;
removeChildComponent (behindFrontTab); removeChildComponent (behindFrontTab);
deleteAllChildren(); deleteAllChildren();
addChildComponent (behindFrontTab); addChildComponent (behindFrontTab);
@@ -62784,7 +62775,7 @@ TabBarButton* TabbedButtonBar::getTabButton (const int index) const


void TabbedButtonBar::lookAndFeelChanged() void TabbedButtonBar::lookAndFeelChanged()
{ {
deleteAndZero (extraTabsButton);
extraTabsButton = 0;
resized(); resized();
} }


@@ -62872,7 +62863,7 @@ void TabbedButtonBar::resized()
} }
else else
{ {
deleteAndZero (extraTabsButton);
extraTabsButton = 0;
} }


int pos = 0; int pos = 0;
@@ -62936,7 +62927,7 @@ void TabbedButtonBar::setTabBackgroundColour (const int tabIndex, const Colour&


void TabbedButtonBar::buttonClicked (Button* button) void TabbedButtonBar::buttonClicked (Button* button)
{ {
if (extraTabsButton == button)
if (button == extraTabsButton)
{ {
PopupMenu m; PopupMenu m;


@@ -70807,8 +70798,9 @@ BooleanPropertyComponent::BooleanPropertyComponent (const String& name,
onText (buttonTextWhenTrue), onText (buttonTextWhenTrue),
offText (buttonTextWhenFalse) offText (buttonTextWhenFalse)
{ {
createButton();
button->addButtonListener (this);
addAndMakeVisible (&button);
button.setClickingTogglesState (false);
button.addButtonListener (this);
} }


BooleanPropertyComponent::BooleanPropertyComponent (const Value& valueToControl, BooleanPropertyComponent::BooleanPropertyComponent (const Value& valueToControl,
@@ -70818,31 +70810,25 @@ BooleanPropertyComponent::BooleanPropertyComponent (const Value& valueToControl,
onText (buttonText), onText (buttonText),
offText (buttonText) offText (buttonText)
{ {
createButton();
button->setButtonText (buttonText);
button->getToggleStateValue().referTo (valueToControl);
button->setClickingTogglesState (true);
addAndMakeVisible (&button);
button.setClickingTogglesState (false);
button.setButtonText (buttonText);
button.getToggleStateValue().referTo (valueToControl);
button.setClickingTogglesState (true);
} }


BooleanPropertyComponent::~BooleanPropertyComponent() BooleanPropertyComponent::~BooleanPropertyComponent()
{ {
deleteAllChildren();
}

void BooleanPropertyComponent::createButton()
{
addAndMakeVisible (button = new ToggleButton (String::empty));
button->setClickingTogglesState (false);
} }


void BooleanPropertyComponent::setState (const bool newState) void BooleanPropertyComponent::setState (const bool newState)
{ {
button->setToggleState (newState, true);
button.setToggleState (newState, true);
} }


bool BooleanPropertyComponent::getState() const bool BooleanPropertyComponent::getState() const
{ {
return button->getToggleState();
return button.getToggleState();
} }


void BooleanPropertyComponent::paint (Graphics& g) void BooleanPropertyComponent::paint (Graphics& g)
@@ -70850,16 +70836,16 @@ void BooleanPropertyComponent::paint (Graphics& g)
PropertyComponent::paint (g); PropertyComponent::paint (g);


g.setColour (Colours::white); g.setColour (Colours::white);
g.fillRect (button->getBounds());
g.fillRect (button.getBounds());


g.setColour (findColour (ComboBox::outlineColourId)); g.setColour (findColour (ComboBox::outlineColourId));
g.drawRect (button->getBounds());
g.drawRect (button.getBounds());
} }


void BooleanPropertyComponent::refresh() void BooleanPropertyComponent::refresh()
{ {
button->setToggleState (getState(), false);
button->setButtonText (button->getToggleState() ? onText : offText);
button.setToggleState (getState(), false);
button.setButtonText (button.getToggleState() ? onText : offText);
} }


void BooleanPropertyComponent::buttonClicked (Button*) void BooleanPropertyComponent::buttonClicked (Button*)
@@ -70878,19 +70864,18 @@ ButtonPropertyComponent::ButtonPropertyComponent (const String& name,
const bool triggerOnMouseDown) const bool triggerOnMouseDown)
: PropertyComponent (name) : PropertyComponent (name)
{ {
addAndMakeVisible (button = new TextButton (String::empty));
button->setTriggeredOnMouseDown (triggerOnMouseDown);
button->addButtonListener (this);
addAndMakeVisible (&button);
button.setTriggeredOnMouseDown (triggerOnMouseDown);
button.addButtonListener (this);
} }


ButtonPropertyComponent::~ButtonPropertyComponent() ButtonPropertyComponent::~ButtonPropertyComponent()
{ {
deleteAllChildren();
} }


void ButtonPropertyComponent::refresh() void ButtonPropertyComponent::refresh()
{ {
button->setButtonText (getButtonText());
button.setButtonText (getButtonText());
} }


void ButtonPropertyComponent::buttonClicked (Button*) void ButtonPropertyComponent::buttonClicked (Button*)
@@ -70948,7 +70933,6 @@ protected:


ChoicePropertyComponent::ChoicePropertyComponent (const String& name) ChoicePropertyComponent::ChoicePropertyComponent (const String& name)
: PropertyComponent (name), : PropertyComponent (name),
comboBox (0),
isCustomClass (true) isCustomClass (true)
{ {
} }
@@ -70959,7 +70943,6 @@ ChoicePropertyComponent::ChoicePropertyComponent (const Value& valueToControl,
const Array <var>& correspondingValues) const Array <var>& correspondingValues)
: PropertyComponent (name), : PropertyComponent (name),
choices (choices_), choices (choices_),
comboBox (0),
isCustomClass (false) isCustomClass (false)
{ {
// The array of corresponding values must contain one value for each of the items in // The array of corresponding values must contain one value for each of the items in
@@ -70968,27 +70951,26 @@ ChoicePropertyComponent::ChoicePropertyComponent (const Value& valueToControl,


createComboBox(); createComboBox();


comboBox->getSelectedIdAsValue().referTo (Value (new RemapperValueSource (valueToControl, correspondingValues)));
comboBox.getSelectedIdAsValue().referTo (Value (new RemapperValueSource (valueToControl, correspondingValues)));
} }


ChoicePropertyComponent::~ChoicePropertyComponent() ChoicePropertyComponent::~ChoicePropertyComponent()
{ {
deleteAllChildren();
} }


void ChoicePropertyComponent::createComboBox() void ChoicePropertyComponent::createComboBox()
{ {
addAndMakeVisible (comboBox = new ComboBox());
addAndMakeVisible (&comboBox);


for (int i = 0; i < choices.size(); ++i) for (int i = 0; i < choices.size(); ++i)
{ {
if (choices[i].isNotEmpty()) if (choices[i].isNotEmpty())
comboBox->addItem (choices[i], i + 1);
comboBox.addItem (choices[i], i + 1);
else else
comboBox->addSeparator();
comboBox.addSeparator();
} }


comboBox->setEditableText (false);
comboBox.setEditableText (false);
} }


void ChoicePropertyComponent::setIndex (const int /*newIndex*/) void ChoicePropertyComponent::setIndex (const int /*newIndex*/)
@@ -71011,13 +70993,13 @@ void ChoicePropertyComponent::refresh()
{ {
if (isCustomClass) if (isCustomClass)
{ {
if (comboBox == 0)
if (! comboBox.isVisible())
{ {
createComboBox(); createComboBox();
comboBox->addListener (this);
comboBox.addListener (this);
} }


comboBox->setSelectedId (getIndex() + 1, true);
comboBox.setSelectedId (getIndex() + 1, true);
} }
} }


@@ -71025,7 +71007,7 @@ void ChoicePropertyComponent::comboBoxChanged (ComboBox*)
{ {
if (isCustomClass) if (isCustomClass)
{ {
const int newIndex = comboBox->getSelectedId() - 1;
const int newIndex = comboBox.getSelectedId() - 1;


if (newIndex != getIndex()) if (newIndex != getIndex())
setIndex (newIndex); setIndex (newIndex);
@@ -71266,15 +71248,14 @@ PropertyPanel::PropertyPanel()
{ {
messageWhenEmpty = TRANS("(nothing selected)"); messageWhenEmpty = TRANS("(nothing selected)");


addAndMakeVisible (viewport = new Viewport());
viewport->setViewedComponent (propertyHolderComponent = new PropertyHolderComponent());
viewport->setFocusContainer (true);
addAndMakeVisible (&viewport);
viewport.setViewedComponent (propertyHolderComponent = new PropertyHolderComponent());
viewport.setFocusContainer (true);
} }


PropertyPanel::~PropertyPanel() PropertyPanel::~PropertyPanel()
{ {
clear(); clear();
deleteAllChildren();
} }


void PropertyPanel::paint (Graphics& g) void PropertyPanel::paint (Graphics& g)
@@ -71290,7 +71271,7 @@ void PropertyPanel::paint (Graphics& g)


void PropertyPanel::resized() void PropertyPanel::resized()
{ {
viewport->setBounds (0, 0, getWidth(), getHeight());
viewport.setBounds (0, 0, getWidth(), getHeight());
updatePropHolderLayout(); updatePropHolderLayout();
} }


@@ -71332,10 +71313,10 @@ void PropertyPanel::addSection (const String& sectionTitle,


void PropertyPanel::updatePropHolderLayout() const void PropertyPanel::updatePropHolderLayout() const
{ {
const int maxWidth = viewport->getMaximumVisibleWidth();
const int maxWidth = viewport.getMaximumVisibleWidth();
propertyHolderComponent->updateLayout (maxWidth); propertyHolderComponent->updateLayout (maxWidth);


const int newMaxWidth = viewport->getMaximumVisibleWidth();
const int newMaxWidth = viewport.getMaximumVisibleWidth();
if (maxWidth != newMaxWidth) if (maxWidth != newMaxWidth)
{ {
// need to do this twice because of scrollbars changing the size, etc. // need to do this twice because of scrollbars changing the size, etc.
@@ -71429,7 +71410,7 @@ XmlElement* PropertyPanel::getOpennessState() const
{ {
XmlElement* const xml = new XmlElement ("PROPERTYPANELSTATE"); XmlElement* const xml = new XmlElement ("PROPERTYPANELSTATE");


xml->setAttribute ("scrollPos", viewport->getViewPositionY());
xml->setAttribute ("scrollPos", viewport.getViewPositionY());


const StringArray sections (getSectionNames()); const StringArray sections (getSectionNames());


@@ -71458,8 +71439,8 @@ void PropertyPanel::restoreOpennessState (const XmlElement& xml)
e->getBoolAttribute ("open")); e->getBoolAttribute ("open"));
} }


viewport->setViewPosition (viewport->getViewPositionX(),
xml.getIntAttribute ("scrollPos", viewport->getViewPositionY()));
viewport.setViewPosition (viewport.getViewPositionX(),
xml.getIntAttribute ("scrollPos", viewport.getViewPositionY()));
} }
} }


@@ -71491,13 +71472,13 @@ SliderPropertyComponent::SliderPropertyComponent (const String& name,
const double skewFactor) const double skewFactor)
: PropertyComponent (name) : PropertyComponent (name)
{ {
addAndMakeVisible (slider = new Slider (name));
addAndMakeVisible (&slider);


slider->setRange (rangeMin, rangeMax, interval);
slider->setSkewFactor (skewFactor);
slider->setSliderStyle (Slider::LinearBar);
slider.setRange (rangeMin, rangeMax, interval);
slider.setSkewFactor (skewFactor);
slider.setSliderStyle (Slider::LinearBar);


slider->addListener (this);
slider.addListener (this);
} }


SliderPropertyComponent::SliderPropertyComponent (const Value& valueToControl, SliderPropertyComponent::SliderPropertyComponent (const Value& valueToControl,
@@ -71508,18 +71489,17 @@ SliderPropertyComponent::SliderPropertyComponent (const Value& valueToControl,
const double skewFactor) const double skewFactor)
: PropertyComponent (name) : PropertyComponent (name)
{ {
addAndMakeVisible (slider = new Slider (name));
addAndMakeVisible (&slider);


slider->setRange (rangeMin, rangeMax, interval);
slider->setSkewFactor (skewFactor);
slider->setSliderStyle (Slider::LinearBar);
slider.setRange (rangeMin, rangeMax, interval);
slider.setSkewFactor (skewFactor);
slider.setSliderStyle (Slider::LinearBar);


slider->getValueObject().referTo (valueToControl);
slider.getValueObject().referTo (valueToControl);
} }


SliderPropertyComponent::~SliderPropertyComponent() SliderPropertyComponent::~SliderPropertyComponent()
{ {
deleteAllChildren();
} }


void SliderPropertyComponent::setValue (const double /*newValue*/) void SliderPropertyComponent::setValue (const double /*newValue*/)
@@ -71528,18 +71508,18 @@ void SliderPropertyComponent::setValue (const double /*newValue*/)


double SliderPropertyComponent::getValue() const double SliderPropertyComponent::getValue() const
{ {
return slider->getValue();
return slider.getValue();
} }


void SliderPropertyComponent::refresh() void SliderPropertyComponent::refresh()
{ {
slider->setValue (getValue(), false);
slider.setValue (getValue(), false);
} }


void SliderPropertyComponent::sliderValueChanged (Slider*) void SliderPropertyComponent::sliderValueChanged (Slider*)
{ {
if (getValue() != slider->getValue())
setValue (slider->getValue());
if (getValue() != slider.getValue())
setValue (slider.getValue());
} }


END_JUCE_NAMESPACE END_JUCE_NAMESPACE
@@ -71836,23 +71816,6 @@ public:
: type (type_), : type (type_),
setup (setup_) setup (setup_)
{ {
sampleRateDropDown = 0;
sampleRateLabel = 0;
bufferSizeDropDown = 0;
bufferSizeLabel = 0;
outputDeviceDropDown = 0;
outputDeviceLabel = 0;
inputDeviceDropDown = 0;
inputDeviceLabel = 0;
testButton = 0;
inputLevelMeter = 0;
showUIButton = 0;
inputChanList = 0;
outputChanList = 0;
inputChanLabel = 0;
outputChanLabel = 0;
showAdvancedSettingsButton = 0;

if (hideAdvancedOptionsWithButton) if (hideAdvancedOptionsWithButton)
{ {
addAndMakeVisible (showAdvancedSettingsButton = new TextButton (TRANS("Show advanced settings..."))); addAndMakeVisible (showAdvancedSettingsButton = new TextButton (TRANS("Show advanced settings...")));
@@ -71868,17 +71831,6 @@ public:
~AudioDeviceSettingsPanel() ~AudioDeviceSettingsPanel()
{ {
setup.manager->removeChangeListener (this); setup.manager->removeChangeListener (this);

deleteAndZero (outputDeviceLabel);
deleteAndZero (inputDeviceLabel);
deleteAndZero (sampleRateLabel);
deleteAndZero (bufferSizeLabel);
deleteAndZero (showUIButton);
deleteAndZero (inputChanLabel);
deleteAndZero (outputChanLabel);
deleteAndZero (showAdvancedSettingsButton);

deleteAllChildren();
} }


void resized() void resized()
@@ -72052,7 +72004,7 @@ public:
{ {
AudioIODevice* const currentDevice = setup.manager->getCurrentAudioDevice(); AudioIODevice* const currentDevice = setup.manager->getCurrentAudioDevice();


deleteAndZero (showUIButton);
showUIButton = 0;


if (currentDevice != 0 && currentDevice->hasControlPanel()) if (currentDevice != 0 && currentDevice->hasControlPanel())
{ {
@@ -72131,8 +72083,8 @@ public:
} }
else else
{ {
deleteAndZero (outputChanLabel);
deleteAndZero (outputChanList);
outputChanLabel = 0;
outputChanList = 0;
} }


if (setup.maxNumInputChannels > 0 if (setup.maxNumInputChannels > 0
@@ -72151,8 +72103,8 @@ public:
} }
else else
{ {
deleteAndZero (inputChanLabel);
deleteAndZero (inputChanList);
inputChanLabel = 0;
inputChanList = 0;
} }


// sample rate.. // sample rate..
@@ -72162,7 +72114,6 @@ public:
addAndMakeVisible (sampleRateDropDown = new ComboBox (String::empty)); addAndMakeVisible (sampleRateDropDown = new ComboBox (String::empty));
sampleRateDropDown->addListener (this); sampleRateDropDown->addListener (this);


delete sampleRateLabel;
sampleRateLabel = new Label (String::empty, TRANS ("sample rate:")); sampleRateLabel = new Label (String::empty, TRANS ("sample rate:"));
sampleRateLabel->attachToComponent (sampleRateDropDown, true); sampleRateLabel->attachToComponent (sampleRateDropDown, true);
} }
@@ -72191,7 +72142,6 @@ public:
addAndMakeVisible (bufferSizeDropDown = new ComboBox (String::empty)); addAndMakeVisible (bufferSizeDropDown = new ComboBox (String::empty));
bufferSizeDropDown->addListener (this); bufferSizeDropDown->addListener (this);


delete bufferSizeLabel;
bufferSizeLabel = new Label (String::empty, TRANS ("audio buffer size:")); bufferSizeLabel = new Label (String::empty, TRANS ("audio buffer size:"));
bufferSizeLabel->attachToComponent (bufferSizeDropDown, true); bufferSizeLabel->attachToComponent (bufferSizeDropDown, true);
} }
@@ -72222,10 +72172,10 @@ public:
{ {
jassert (setup.manager->getCurrentAudioDevice() == 0); // not the correct device type! jassert (setup.manager->getCurrentAudioDevice() == 0); // not the correct device type!


deleteAndZero (sampleRateLabel);
deleteAndZero (bufferSizeLabel);
deleteAndZero (sampleRateDropDown);
deleteAndZero (bufferSizeDropDown);
sampleRateLabel = 0;
bufferSizeLabel = 0;
sampleRateDropDown = 0;
bufferSizeDropDown = 0;


if (outputDeviceDropDown != 0) if (outputDeviceDropDown != 0)
outputDeviceDropDown->setSelectedId (-1, true); outputDeviceDropDown->setSelectedId (-1, true);
@@ -72242,20 +72192,11 @@ private:
AudioIODeviceType* const type; AudioIODeviceType* const type;
const AudioIODeviceType::DeviceSetupDetails setup; const AudioIODeviceType::DeviceSetupDetails setup;


ComboBox* outputDeviceDropDown;
ComboBox* inputDeviceDropDown;
ComboBox* sampleRateDropDown;
ComboBox* bufferSizeDropDown;
Label* outputDeviceLabel;
Label* inputDeviceLabel;
Label* sampleRateLabel;
Label* bufferSizeLabel;
Label* inputChanLabel;
Label* outputChanLabel;
TextButton* testButton;
Component* inputLevelMeter;
TextButton* showUIButton;
TextButton* showAdvancedSettingsButton;
ScopedPointer<ComboBox> outputDeviceDropDown, inputDeviceDropDown, sampleRateDropDown, bufferSizeDropDown;
ScopedPointer<Label> outputDeviceLabel, inputDeviceLabel, sampleRateLabel, bufferSizeLabel, inputChanLabel, outputChanLabel;
ScopedPointer<TextButton> testButton;
ScopedPointer<Component> inputLevelMeter;
ScopedPointer<TextButton> showUIButton, showAdvancedSettingsButton;


void showCorrectDeviceName (ComboBox* const box, const bool isInput) void showCorrectDeviceName (ComboBox* const box, const bool isInput)
{ {
@@ -72553,8 +72494,7 @@ public:
}; };


private: private:
ChannelSelectorListBox* inputChanList;
ChannelSelectorListBox* outputChanList;
ScopedPointer<ChannelSelectorListBox> inputChanList, outputChanList;


AudioDeviceSettingsPanel (const AudioDeviceSettingsPanel&); AudioDeviceSettingsPanel (const AudioDeviceSettingsPanel&);
AudioDeviceSettingsPanel& operator= (const AudioDeviceSettingsPanel&); AudioDeviceSettingsPanel& operator= (const AudioDeviceSettingsPanel&);
@@ -72572,7 +72512,6 @@ AudioDeviceSelectorComponent::AudioDeviceSelectorComponent (AudioDeviceManager&
: deviceManager (deviceManager_), : deviceManager (deviceManager_),
deviceTypeDropDown (0), deviceTypeDropDown (0),
deviceTypeDropDownLabel (0), deviceTypeDropDownLabel (0),
audioDeviceSettingsComp (0),
minOutputChannels (minOutputChannels_), minOutputChannels (minOutputChannels_),
maxOutputChannels (maxOutputChannels_), maxOutputChannels (maxOutputChannels_),
minInputChannels (minInputChannels_), minInputChannels (minInputChannels_),
@@ -72640,7 +72579,6 @@ AudioDeviceSelectorComponent::AudioDeviceSelectorComponent (AudioDeviceManager&
AudioDeviceSelectorComponent::~AudioDeviceSelectorComponent() AudioDeviceSelectorComponent::~AudioDeviceSelectorComponent()
{ {
deviceManager.removeChangeListener (this); deviceManager.removeChangeListener (this);
deleteAllChildren();
} }


void AudioDeviceSelectorComponent::resized() void AudioDeviceSelectorComponent::resized()
@@ -72702,7 +72640,7 @@ void AudioDeviceSelectorComponent::comboBoxChanged (ComboBox* comboBoxThatHasCha


if (type != 0) if (type != 0)
{ {
deleteAndZero (audioDeviceSettingsComp);
audioDeviceSettingsComp = 0;


deviceManager.setCurrentAudioDeviceType (type->getTypeName(), true); deviceManager.setCurrentAudioDeviceType (type->getTypeName(), true);


@@ -72726,8 +72664,7 @@ void AudioDeviceSelectorComponent::changeListenerCallback (void*)
|| audioDeviceSettingsCompType != deviceManager.getCurrentAudioDeviceType()) || audioDeviceSettingsCompType != deviceManager.getCurrentAudioDeviceType())
{ {
audioDeviceSettingsCompType = deviceManager.getCurrentAudioDeviceType(); audioDeviceSettingsCompType = deviceManager.getCurrentAudioDeviceType();

deleteAndZero (audioDeviceSettingsComp);
audioDeviceSettingsComp = 0;


AudioIODeviceType* const type AudioIODeviceType* const type
= deviceManager.getAvailableDeviceTypes() [deviceTypeDropDown == 0 = deviceManager.getAvailableDeviceTypes() [deviceTypeDropDown == 0
@@ -250281,7 +250218,7 @@ const String DSoundAudioIODevice::openDevice (const BigInteger& inputChannels,
enabledInputs.getHighestBit() + 1 - inChannels.size(), enabledInputs.getHighestBit() + 1 - inChannels.size(),
false); false);


inputBuffers.setSize (enabledInputs.countNumberOfSetBits(), bufferSizeSamples);
inputBuffers.setSize (jmax (1, enabledInputs.countNumberOfSetBits()), bufferSizeSamples);
int i, numIns = 0; int i, numIns = 0;


for (i = 0; i <= enabledInputs.getHighestBit(); i += 2) for (i = 0; i <= enabledInputs.getHighestBit(); i += 2)
@@ -250306,7 +250243,7 @@ const String DSoundAudioIODevice::openDevice (const BigInteger& inputChannels,
enabledOutputs.getHighestBit() + 1 - outChannels.size(), enabledOutputs.getHighestBit() + 1 - outChannels.size(),
false); false);


outputBuffers.setSize (enabledOutputs.countNumberOfSetBits(), bufferSizeSamples);
outputBuffers.setSize (jmax (1, enabledOutputs.countNumberOfSetBits()), bufferSizeSamples);
int numOuts = 0; int numOuts = 0;


for (i = 0; i <= enabledOutputs.getHighestBit(); i += 2) for (i = 0; i <= enabledOutputs.getHighestBit(); i += 2)
@@ -274893,7 +274830,6 @@ public:
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 #if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
audioProcID (0), audioProcID (0),
#endif #endif
inputDevice (0),
isSlaveDevice (false), isSlaveDevice (false),
deviceID (id), deviceID (id),
started (false), started (false),
@@ -274927,7 +274863,6 @@ public:
AudioObjectRemovePropertyListener (deviceID, &pa, deviceListenerProc, this); AudioObjectRemovePropertyListener (deviceID, &pa, deviceListenerProc, this);


stop (false); stop (false);
delete inputDevice;
} }


void allocateTempBuffers() void allocateTempBuffers()
@@ -275589,7 +275524,7 @@ public:
AudioDeviceIOProcID audioProcID; AudioDeviceIOProcID audioProcID;
#endif #endif


CoreAudioInternal* inputDevice;
ScopedPointer<CoreAudioInternal> inputDevice;
bool isSlaveDevice; bool isSlaveDevice;


private: private:
@@ -275689,7 +275624,6 @@ public:
isOpen_ (false), isOpen_ (false),
isStarted (false) isStarted (false)
{ {
internal = 0;
CoreAudioInternal* device = 0; CoreAudioInternal* device = 0;


if (outputDeviceId == 0 || outputDeviceId == inputDeviceId) if (outputDeviceId == 0 || outputDeviceId == inputDeviceId)
@@ -275729,8 +275663,6 @@ public:
pa.mElement = kAudioObjectPropertyElementWildcard; pa.mElement = kAudioObjectPropertyElementWildcard;


AudioObjectRemovePropertyListener (kAudioObjectSystemObject, &pa, hardwareListenerProc, internal); AudioObjectRemovePropertyListener (kAudioObjectSystemObject, &pa, hardwareListenerProc, internal);

delete internal;
} }


const StringArray getOutputChannelNames() const StringArray getOutputChannelNames()
@@ -275899,7 +275831,7 @@ public:
juce_UseDebuggingNewOperator juce_UseDebuggingNewOperator


private: private:
CoreAudioInternal* internal;
ScopedPointer<CoreAudioInternal> internal;
bool isOpen_, isStarted; bool isOpen_, isStarted;
String lastError; String lastError;




+ 26
- 25
juce_amalgamated.h View File

@@ -64,7 +64,7 @@
*/ */
#define JUCE_MAJOR_VERSION 1 #define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 52 #define JUCE_MINOR_VERSION 52
#define JUCE_BUILDNUMBER 15
#define JUCE_BUILDNUMBER 16


/** Current Juce version number. /** Current Juce version number.


@@ -34478,8 +34478,8 @@ private:
int initialDelayInMillisecs, repeatDelayInMillisecs, minimumDelayInMillisecs; int initialDelayInMillisecs, repeatDelayInMillisecs, minimumDelayInMillisecs;
bool vertical, isDraggingThumb, autohides; bool vertical, isDraggingThumb, autohides;
class ScrollbarButton; class ScrollbarButton;
ScrollbarButton* upButton;
ScrollbarButton* downButton;
friend class ScopedPointer<ScrollbarButton>;
ScopedPointer<ScrollbarButton> upButton, downButton;
ListenerList <ScrollBarListener> listeners; ListenerList <ScrollBarListener> listeners;


void updateThumbPosition(); void updateThumbPosition();
@@ -40731,7 +40731,7 @@ public:
juce_UseDebuggingNewOperator juce_UseDebuggingNewOperator


private: private:
Viewport* viewport;
Viewport viewport;
class PropertyHolderComponent; class PropertyHolderComponent;
PropertyHolderComponent* propertyHolderComponent; PropertyHolderComponent* propertyHolderComponent;
String messageWhenEmpty; String messageWhenEmpty;
@@ -47821,13 +47821,16 @@ private:
friend class TreeViewItem; friend class TreeViewItem;
friend class TreeViewContentComponent; friend class TreeViewContentComponent;
class TreeViewport; class TreeViewport;
TreeViewport* viewport;
CriticalSection nodeAlterationLock;
TreeViewItem* rootItem;
class InsertPointHighlight; class InsertPointHighlight;
class TargetGroupHighlight; class TargetGroupHighlight;
InsertPointHighlight* dragInsertPointHighlight;
TargetGroupHighlight* dragTargetGroupHighlight;
friend class ScopedPointer<TreeViewport>;
friend class ScopedPointer<InsertPointHighlight>;
friend class ScopedPointer<TargetGroupHighlight>;
ScopedPointer<TreeViewport> viewport;
CriticalSection nodeAlterationLock;
TreeViewItem* rootItem;
ScopedPointer<InsertPointHighlight> dragInsertPointHighlight;
ScopedPointer<TargetGroupHighlight> dragTargetGroupHighlight;
int indentSize; int indentSize;
bool defaultOpenness : 1; bool defaultOpenness : 1;
bool needsRecalculating : 1; bool needsRecalculating : 1;
@@ -50282,9 +50285,9 @@ public:


private: private:


ComboBox* filenameBox;
ComboBox filenameBox;
String lastFilename; String lastFilename;
Button* browseButton;
ScopedPointer<Button> browseButton;
int maxRecentFiles; int maxRecentFiles;
bool isDir, isSaving, isFileDragOver; bool isDir, isSaving, isFileDragOver;
String wildcard, enforcedSuffix, browseButtonText; String wildcard, enforcedSuffix, browseButtonText;
@@ -51366,7 +51369,7 @@ private:
Array <Colour> tabColours; Array <Colour> tabColours;
int currentTabIndex; int currentTabIndex;
Component* behindFrontTab; Component* behindFrontTab;
Button* extraTabsButton;
ScopedPointer<Button> extraTabsButton;


TabbedButtonBar (const TabbedButtonBar&); TabbedButtonBar (const TabbedButtonBar&);
TabbedButtonBar& operator= (const TabbedButtonBar&); TabbedButtonBar& operator= (const TabbedButtonBar&);
@@ -54836,11 +54839,9 @@ public:
juce_UseDebuggingNewOperator juce_UseDebuggingNewOperator


private: private:
ToggleButton* button;
ToggleButton button;
String onText, offText; String onText, offText;


void createButton();

BooleanPropertyComponent (const BooleanPropertyComponent&); BooleanPropertyComponent (const BooleanPropertyComponent&);
BooleanPropertyComponent& operator= (const BooleanPropertyComponent&); BooleanPropertyComponent& operator= (const BooleanPropertyComponent&);
}; };
@@ -54898,7 +54899,7 @@ public:
juce_UseDebuggingNewOperator juce_UseDebuggingNewOperator


private: private:
TextButton* button;
TextButton button;


ButtonPropertyComponent (const ButtonPropertyComponent&); ButtonPropertyComponent (const ButtonPropertyComponent&);
ButtonPropertyComponent& operator= (const ButtonPropertyComponent&); ButtonPropertyComponent& operator= (const ButtonPropertyComponent&);
@@ -54998,7 +54999,7 @@ protected:
StringArray choices; StringArray choices;


private: private:
ComboBox* comboBox;
ComboBox comboBox;
bool isCustomClass; bool isCustomClass;


class RemapperValueSource; class RemapperValueSource;
@@ -55092,7 +55093,7 @@ protected:


Your subclass has access to this in case it needs to customise it in some way. Your subclass has access to this in case it needs to customise it in some way.
*/ */
Slider* slider;
Slider slider;


SliderPropertyComponent (const SliderPropertyComponent&); SliderPropertyComponent (const SliderPropertyComponent&);
SliderPropertyComponent& operator= (const SliderPropertyComponent&); SliderPropertyComponent& operator= (const SliderPropertyComponent&);
@@ -55356,19 +55357,19 @@ public:


private: private:
AudioDeviceManager& deviceManager; AudioDeviceManager& deviceManager;
ComboBox* deviceTypeDropDown;
Label* deviceTypeDropDownLabel;
Component* audioDeviceSettingsComp;
ScopedPointer<ComboBox> deviceTypeDropDown;
ScopedPointer<Label> deviceTypeDropDownLabel;
ScopedPointer<Component> audioDeviceSettingsComp;
String audioDeviceSettingsCompType; String audioDeviceSettingsCompType;
const int minOutputChannels, maxOutputChannels, minInputChannels, maxInputChannels; const int minOutputChannels, maxOutputChannels, minInputChannels, maxInputChannels;
const bool showChannelsAsStereoPairs; const bool showChannelsAsStereoPairs;
const bool hideAdvancedOptionsWithButton; const bool hideAdvancedOptionsWithButton;


class MidiInputSelectorComponentListBox; class MidiInputSelectorComponentListBox;
MidiInputSelectorComponentListBox* midiInputsList;
Label* midiInputsLabel;
ComboBox* midiOutputSelector;
Label* midiOutputLabel;
friend class ScopedPointer<MidiInputSelectorComponentListBox>;
ScopedPointer<MidiInputSelectorComponentListBox> midiInputsList;
ScopedPointer<ComboBox> midiOutputSelector;
ScopedPointer<Label> midiInputsLabel, midiOutputLabel;


AudioDeviceSelectorComponent (const AudioDeviceSelectorComponent&); AudioDeviceSelectorComponent (const AudioDeviceSelectorComponent&);
AudioDeviceSelectorComponent& operator= (const AudioDeviceSelectorComponent&); AudioDeviceSelectorComponent& operator= (const AudioDeviceSelectorComponent&);


+ 1
- 1
src/core/juce_StandardHeader.h View File

@@ -33,7 +33,7 @@
*/ */
#define JUCE_MAJOR_VERSION 1 #define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 52 #define JUCE_MINOR_VERSION 52
#define JUCE_BUILDNUMBER 15
#define JUCE_BUILDNUMBER 16
/** Current Juce version number. /** Current Juce version number.


+ 2
- 6
src/gui/components/controls/juce_TreeView.cpp View File

@@ -451,8 +451,6 @@ private:
TreeView::TreeView (const String& componentName) TreeView::TreeView (const String& componentName)
: Component (componentName), : Component (componentName),
rootItem (0), rootItem (0),
dragInsertPointHighlight (0),
dragTargetGroupHighlight (0),
indentSize (24), indentSize (24),
defaultOpenness (false), defaultOpenness (false),
needsRecalculating (true), needsRecalculating (true),
@@ -470,8 +468,6 @@ TreeView::~TreeView()
{ {
if (rootItem != 0) if (rootItem != 0)
rootItem->setOwnerView (0); rootItem->setOwnerView (0);
deleteAllChildren();
} }
void TreeView::setRootItem (TreeViewItem* const newRootItem) void TreeView::setRootItem (TreeViewItem* const newRootItem)
@@ -937,8 +933,8 @@ void TreeView::showDragHighlight (TreeViewItem* item, int insertIndex, int x, in
void TreeView::hideDragHighlight() throw() void TreeView::hideDragHighlight() throw()
{ {
deleteAndZero (dragInsertPointHighlight);
deleteAndZero (dragTargetGroupHighlight);
dragInsertPointHighlight = 0;
dragTargetGroupHighlight = 0;
} }
TreeViewItem* TreeView::getInsertPosition (int& x, int& y, int& insertIndex, TreeViewItem* TreeView::getInsertPosition (int& x, int& y, int& insertIndex,


+ 8
- 5
src/gui/components/controls/juce_TreeView.h View File

@@ -752,13 +752,16 @@ private:
friend class TreeViewItem; friend class TreeViewItem;
friend class TreeViewContentComponent; friend class TreeViewContentComponent;
class TreeViewport; class TreeViewport;
TreeViewport* viewport;
CriticalSection nodeAlterationLock;
TreeViewItem* rootItem;
class InsertPointHighlight; class InsertPointHighlight;
class TargetGroupHighlight; class TargetGroupHighlight;
InsertPointHighlight* dragInsertPointHighlight;
TargetGroupHighlight* dragTargetGroupHighlight;
friend class ScopedPointer<TreeViewport>;
friend class ScopedPointer<InsertPointHighlight>;
friend class ScopedPointer<TargetGroupHighlight>;
ScopedPointer<TreeViewport> viewport;
CriticalSection nodeAlterationLock;
TreeViewItem* rootItem;
ScopedPointer<InsertPointHighlight> dragInsertPointHighlight;
ScopedPointer<TargetGroupHighlight> dragTargetGroupHighlight;
int indentSize; int indentSize;
bool defaultOpenness : 1; bool defaultOpenness : 1;
bool needsRecalculating : 1; bool needsRecalculating : 1;


+ 15
- 17
src/gui/components/filebrowser/juce_FilenameComponent.cpp View File

@@ -50,13 +50,12 @@ FilenameComponent::FilenameComponent (const String& name,
wildcard (fileBrowserWildcard), wildcard (fileBrowserWildcard),
enforcedSuffix (enforcedSuffix_) enforcedSuffix (enforcedSuffix_)
{ {
addAndMakeVisible (filenameBox = new ComboBox ("fn"));
filenameBox->setEditableText (canEditFilename);
filenameBox->addListener (this);
filenameBox->setTextWhenNothingSelected (textWhenNothingSelected);
filenameBox->setTextWhenNoChoicesAvailable (TRANS("(no recently seleced files)"));
addAndMakeVisible (&filenameBox);
filenameBox.setEditableText (canEditFilename);
filenameBox.addListener (this);
filenameBox.setTextWhenNothingSelected (textWhenNothingSelected);
filenameBox.setTextWhenNoChoicesAvailable (TRANS("(no recently seleced files)"));
browseButton = 0;
setBrowseButtonText ("..."); setBrowseButtonText ("...");
setCurrentFile (currentFile, true); setCurrentFile (currentFile, true);
@@ -64,7 +63,6 @@ FilenameComponent::FilenameComponent (const String& name,
FilenameComponent::~FilenameComponent() FilenameComponent::~FilenameComponent()
{ {
deleteAllChildren();
} }
//============================================================================== //==============================================================================
@@ -79,7 +77,7 @@ void FilenameComponent::paintOverChildren (Graphics& g)
void FilenameComponent::resized() void FilenameComponent::resized()
{ {
getLookAndFeel().layoutFilenameComponent (*this, filenameBox, browseButton);
getLookAndFeel().layoutFilenameComponent (*this, &filenameBox, browseButton);
} }
void FilenameComponent::setBrowseButtonText (const String& newBrowseButtonText) void FilenameComponent::setBrowseButtonText (const String& newBrowseButtonText)
@@ -90,7 +88,7 @@ void FilenameComponent::setBrowseButtonText (const String& newBrowseButtonText)
void FilenameComponent::lookAndFeelChanged() void FilenameComponent::lookAndFeelChanged()
{ {
deleteAndZero (browseButton);
browseButton = 0;
addAndMakeVisible (browseButton = getLookAndFeel().createFilenameComponentBrowseButton (browseButtonText)); addAndMakeVisible (browseButton = getLookAndFeel().createFilenameComponentBrowseButton (browseButtonText));
browseButton->setConnectedEdges (Button::ConnectedOnLeft); browseButton->setConnectedEdges (Button::ConnectedOnLeft);
@@ -102,7 +100,7 @@ void FilenameComponent::lookAndFeelChanged()
void FilenameComponent::setTooltip (const String& newTooltip) void FilenameComponent::setTooltip (const String& newTooltip)
{ {
SettableTooltipClient::setTooltip (newTooltip); SettableTooltipClient::setTooltip (newTooltip);
filenameBox->setTooltip (newTooltip);
filenameBox.setTooltip (newTooltip);
} }
void FilenameComponent::setDefaultBrowseTarget (const File& newDefaultDirectory) void FilenameComponent::setDefaultBrowseTarget (const File& newDefaultDirectory)
@@ -161,7 +159,7 @@ void FilenameComponent::fileDragExit (const StringArray&)
//============================================================================== //==============================================================================
const File FilenameComponent::getCurrentFile() const const File FilenameComponent::getCurrentFile() const
{ {
File f (filenameBox->getText());
File f (filenameBox.getText());
if (enforcedSuffix.isNotEmpty()) if (enforcedSuffix.isNotEmpty())
f = f.withFileExtension (enforcedSuffix); f = f.withFileExtension (enforcedSuffix);
@@ -183,7 +181,7 @@ void FilenameComponent::setCurrentFile (File newFile,
if (addToRecentlyUsedList) if (addToRecentlyUsedList)
addRecentlyUsedFile (newFile); addRecentlyUsedFile (newFile);
filenameBox->setText (lastFilename, true);
filenameBox.setText (lastFilename, true);
if (sendChangeNotification) if (sendChangeNotification)
triggerAsyncUpdate(); triggerAsyncUpdate();
@@ -192,15 +190,15 @@ void FilenameComponent::setCurrentFile (File newFile,
void FilenameComponent::setFilenameIsEditable (const bool shouldBeEditable) void FilenameComponent::setFilenameIsEditable (const bool shouldBeEditable)
{ {
filenameBox->setEditableText (shouldBeEditable);
filenameBox.setEditableText (shouldBeEditable);
} }
const StringArray FilenameComponent::getRecentlyUsedFilenames() const const StringArray FilenameComponent::getRecentlyUsedFilenames() const
{ {
StringArray names; StringArray names;
for (int i = 0; i < filenameBox->getNumItems(); ++i)
names.add (filenameBox->getItemText (i));
for (int i = 0; i < filenameBox.getNumItems(); ++i)
names.add (filenameBox.getItemText (i));
return names; return names;
} }
@@ -209,10 +207,10 @@ void FilenameComponent::setRecentlyUsedFilenames (const StringArray& filenames)
{ {
if (filenames != getRecentlyUsedFilenames()) if (filenames != getRecentlyUsedFilenames())
{ {
filenameBox->clear();
filenameBox.clear();
for (int i = 0; i < jmin (filenames.size(), maxRecentFiles); ++i) for (int i = 0; i < jmin (filenames.size(), maxRecentFiles); ++i)
filenameBox->addItem (filenames[i], i + 1);
filenameBox.addItem (filenames[i], i + 1);
} }
} }


+ 2
- 2
src/gui/components/filebrowser/juce_FilenameComponent.h View File

@@ -203,9 +203,9 @@ public:
private: private:
//============================================================================== //==============================================================================
ComboBox* filenameBox;
ComboBox filenameBox;
String lastFilename; String lastFilename;
Button* browseButton;
ScopedPointer<Button> browseButton;
int maxRecentFiles; int maxRecentFiles;
bool isDir, isSaving, isFileDragOver; bool isDir, isSaving, isFileDragOver;
String wildcard, enforcedSuffix, browseButtonText; String wildcard, enforcedSuffix, browseButtonText;


+ 3
- 6
src/gui/components/layout/juce_ScrollBar.cpp View File

@@ -91,9 +91,7 @@ ScrollBar::ScrollBar (const bool vertical_,
minimumDelayInMillisecs (10), minimumDelayInMillisecs (10),
vertical (vertical_), vertical (vertical_),
isDraggingThumb (false), isDraggingThumb (false),
autohides (true),
upButton (0),
downButton (0)
autohides (true)
{ {
setButtonVisibility (buttonsAreVisible); setButtonVisibility (buttonsAreVisible);
@@ -103,7 +101,8 @@ ScrollBar::ScrollBar (const bool vertical_,
ScrollBar::~ScrollBar() ScrollBar::~ScrollBar()
{ {
deleteAllChildren();
upButton = 0;
downButton = 0;
} }
//============================================================================== //==============================================================================
@@ -256,9 +255,7 @@ void ScrollBar::setOrientation (const bool shouldBeVertical)
void ScrollBar::setButtonVisibility (const bool buttonsAreVisible) void ScrollBar::setButtonVisibility (const bool buttonsAreVisible)
{ {
delete upButton;
upButton = 0; upButton = 0;
delete downButton;
downButton = 0; downButton = 0;
if (buttonsAreVisible) if (buttonsAreVisible)


+ 2
- 2
src/gui/components/layout/juce_ScrollBar.h View File

@@ -324,8 +324,8 @@ private:
int initialDelayInMillisecs, repeatDelayInMillisecs, minimumDelayInMillisecs; int initialDelayInMillisecs, repeatDelayInMillisecs, minimumDelayInMillisecs;
bool vertical, isDraggingThumb, autohides; bool vertical, isDraggingThumb, autohides;
class ScrollbarButton; class ScrollbarButton;
ScrollbarButton* upButton;
ScrollbarButton* downButton;
friend class ScopedPointer<ScrollbarButton>;
ScopedPointer<ScrollbarButton> upButton, downButton;
ListenerList <ScrollBarListener> listeners; ListenerList <ScrollBarListener> listeners;
void updateThumbPosition(); void updateThumbPosition();


+ 6
- 6
src/gui/components/layout/juce_TabbedButtonBar.cpp View File

@@ -176,8 +176,7 @@ private:
//============================================================================== //==============================================================================
TabbedButtonBar::TabbedButtonBar (const Orientation orientation_) TabbedButtonBar::TabbedButtonBar (const Orientation orientation_)
: orientation (orientation_), : orientation (orientation_),
currentTabIndex (-1),
extraTabsButton (0)
currentTabIndex (-1)
{ {
setInterceptsMouseClicks (false, true); setInterceptsMouseClicks (false, true);
addAndMakeVisible (behindFrontTab = new TabAreaBehindFrontButtonComponent (this)); addAndMakeVisible (behindFrontTab = new TabAreaBehindFrontButtonComponent (this));
@@ -186,6 +185,7 @@ TabbedButtonBar::TabbedButtonBar (const Orientation orientation_)
TabbedButtonBar::~TabbedButtonBar() TabbedButtonBar::~TabbedButtonBar()
{ {
extraTabsButton = 0;
deleteAllChildren(); deleteAllChildren();
} }
@@ -212,7 +212,7 @@ void TabbedButtonBar::clearTabs()
tabColours.clear(); tabColours.clear();
currentTabIndex = -1; currentTabIndex = -1;
deleteAndZero (extraTabsButton);
extraTabsButton = 0;
removeChildComponent (behindFrontTab); removeChildComponent (behindFrontTab);
deleteAllChildren(); deleteAllChildren();
addChildComponent (behindFrontTab); addChildComponent (behindFrontTab);
@@ -357,7 +357,7 @@ TabBarButton* TabbedButtonBar::getTabButton (const int index) const
void TabbedButtonBar::lookAndFeelChanged() void TabbedButtonBar::lookAndFeelChanged()
{ {
deleteAndZero (extraTabsButton);
extraTabsButton = 0;
resized(); resized();
} }
@@ -445,7 +445,7 @@ void TabbedButtonBar::resized()
} }
else else
{ {
deleteAndZero (extraTabsButton);
extraTabsButton = 0;
} }
int pos = 0; int pos = 0;
@@ -510,7 +510,7 @@ void TabbedButtonBar::setTabBackgroundColour (const int tabIndex, const Colour&
void TabbedButtonBar::buttonClicked (Button* button) void TabbedButtonBar::buttonClicked (Button* button)
{ {
if (extraTabsButton == button)
if (button == extraTabsButton)
{ {
PopupMenu m; PopupMenu m;


+ 1
- 1
src/gui/components/layout/juce_TabbedButtonBar.h View File

@@ -283,7 +283,7 @@ private:
Array <Colour> tabColours; Array <Colour> tabColours;
int currentTabIndex; int currentTabIndex;
Component* behindFrontTab; Component* behindFrontTab;
Button* extraTabsButton;
ScopedPointer<Button> extraTabsButton;
TabbedButtonBar (const TabbedButtonBar&); TabbedButtonBar (const TabbedButtonBar&);
TabbedButtonBar& operator= (const TabbedButtonBar&); TabbedButtonBar& operator= (const TabbedButtonBar&);


+ 14
- 19
src/gui/components/properties/juce_BooleanPropertyComponent.cpp View File

@@ -39,8 +39,9 @@ BooleanPropertyComponent::BooleanPropertyComponent (const String& name,
onText (buttonTextWhenTrue), onText (buttonTextWhenTrue),
offText (buttonTextWhenFalse) offText (buttonTextWhenFalse)
{ {
createButton();
button->addButtonListener (this);
addAndMakeVisible (&button);
button.setClickingTogglesState (false);
button.addButtonListener (this);
} }
BooleanPropertyComponent::BooleanPropertyComponent (const Value& valueToControl, BooleanPropertyComponent::BooleanPropertyComponent (const Value& valueToControl,
@@ -50,31 +51,25 @@ BooleanPropertyComponent::BooleanPropertyComponent (const Value& valueToControl,
onText (buttonText), onText (buttonText),
offText (buttonText) offText (buttonText)
{ {
createButton();
button->setButtonText (buttonText);
button->getToggleStateValue().referTo (valueToControl);
button->setClickingTogglesState (true);
addAndMakeVisible (&button);
button.setClickingTogglesState (false);
button.setButtonText (buttonText);
button.getToggleStateValue().referTo (valueToControl);
button.setClickingTogglesState (true);
} }
BooleanPropertyComponent::~BooleanPropertyComponent() BooleanPropertyComponent::~BooleanPropertyComponent()
{ {
deleteAllChildren();
}
void BooleanPropertyComponent::createButton()
{
addAndMakeVisible (button = new ToggleButton (String::empty));
button->setClickingTogglesState (false);
} }
void BooleanPropertyComponent::setState (const bool newState) void BooleanPropertyComponent::setState (const bool newState)
{ {
button->setToggleState (newState, true);
button.setToggleState (newState, true);
} }
bool BooleanPropertyComponent::getState() const bool BooleanPropertyComponent::getState() const
{ {
return button->getToggleState();
return button.getToggleState();
} }
void BooleanPropertyComponent::paint (Graphics& g) void BooleanPropertyComponent::paint (Graphics& g)
@@ -82,16 +77,16 @@ void BooleanPropertyComponent::paint (Graphics& g)
PropertyComponent::paint (g); PropertyComponent::paint (g);
g.setColour (Colours::white); g.setColour (Colours::white);
g.fillRect (button->getBounds());
g.fillRect (button.getBounds());
g.setColour (findColour (ComboBox::outlineColourId)); g.setColour (findColour (ComboBox::outlineColourId));
g.drawRect (button->getBounds());
g.drawRect (button.getBounds());
} }
void BooleanPropertyComponent::refresh() void BooleanPropertyComponent::refresh()
{ {
button->setToggleState (getState(), false);
button->setButtonText (button->getToggleState() ? onText : offText);
button.setToggleState (getState(), false);
button.setButtonText (button.getToggleState() ? onText : offText);
} }
void BooleanPropertyComponent::buttonClicked (Button*) void BooleanPropertyComponent::buttonClicked (Button*)


+ 1
- 3
src/gui/components/properties/juce_BooleanPropertyComponent.h View File

@@ -89,11 +89,9 @@ public:
juce_UseDebuggingNewOperator juce_UseDebuggingNewOperator
private: private:
ToggleButton* button;
ToggleButton button;
String onText, offText; String onText, offText;
void createButton();
BooleanPropertyComponent (const BooleanPropertyComponent&); BooleanPropertyComponent (const BooleanPropertyComponent&);
BooleanPropertyComponent& operator= (const BooleanPropertyComponent&); BooleanPropertyComponent& operator= (const BooleanPropertyComponent&);
}; };


+ 4
- 5
src/gui/components/properties/juce_ButtonPropertyComponent.cpp View File

@@ -35,19 +35,18 @@ ButtonPropertyComponent::ButtonPropertyComponent (const String& name,
const bool triggerOnMouseDown) const bool triggerOnMouseDown)
: PropertyComponent (name) : PropertyComponent (name)
{ {
addAndMakeVisible (button = new TextButton (String::empty));
button->setTriggeredOnMouseDown (triggerOnMouseDown);
button->addButtonListener (this);
addAndMakeVisible (&button);
button.setTriggeredOnMouseDown (triggerOnMouseDown);
button.addButtonListener (this);
} }
ButtonPropertyComponent::~ButtonPropertyComponent() ButtonPropertyComponent::~ButtonPropertyComponent()
{ {
deleteAllChildren();
} }
void ButtonPropertyComponent::refresh() void ButtonPropertyComponent::refresh()
{ {
button->setButtonText (getButtonText());
button.setButtonText (getButtonText());
} }
void ButtonPropertyComponent::buttonClicked (Button*) void ButtonPropertyComponent::buttonClicked (Button*)


+ 1
- 1
src/gui/components/properties/juce_ButtonPropertyComponent.h View File

@@ -75,7 +75,7 @@ public:
juce_UseDebuggingNewOperator juce_UseDebuggingNewOperator
private: private:
TextButton* button;
TextButton button;
ButtonPropertyComponent (const ButtonPropertyComponent&); ButtonPropertyComponent (const ButtonPropertyComponent&);
ButtonPropertyComponent& operator= (const ButtonPropertyComponent&); ButtonPropertyComponent& operator= (const ButtonPropertyComponent&);


+ 9
- 12
src/gui/components/properties/juce_ChoicePropertyComponent.cpp View File

@@ -77,7 +77,6 @@ protected:
//============================================================================== //==============================================================================
ChoicePropertyComponent::ChoicePropertyComponent (const String& name) ChoicePropertyComponent::ChoicePropertyComponent (const String& name)
: PropertyComponent (name), : PropertyComponent (name),
comboBox (0),
isCustomClass (true) isCustomClass (true)
{ {
} }
@@ -88,7 +87,6 @@ ChoicePropertyComponent::ChoicePropertyComponent (const Value& valueToControl,
const Array <var>& correspondingValues) const Array <var>& correspondingValues)
: PropertyComponent (name), : PropertyComponent (name),
choices (choices_), choices (choices_),
comboBox (0),
isCustomClass (false) isCustomClass (false)
{ {
// The array of corresponding values must contain one value for each of the items in // The array of corresponding values must contain one value for each of the items in
@@ -97,28 +95,27 @@ ChoicePropertyComponent::ChoicePropertyComponent (const Value& valueToControl,
createComboBox(); createComboBox();
comboBox->getSelectedIdAsValue().referTo (Value (new RemapperValueSource (valueToControl, correspondingValues)));
comboBox.getSelectedIdAsValue().referTo (Value (new RemapperValueSource (valueToControl, correspondingValues)));
} }
ChoicePropertyComponent::~ChoicePropertyComponent() ChoicePropertyComponent::~ChoicePropertyComponent()
{ {
deleteAllChildren();
} }
//============================================================================== //==============================================================================
void ChoicePropertyComponent::createComboBox() void ChoicePropertyComponent::createComboBox()
{ {
addAndMakeVisible (comboBox = new ComboBox());
addAndMakeVisible (&comboBox);
for (int i = 0; i < choices.size(); ++i) for (int i = 0; i < choices.size(); ++i)
{ {
if (choices[i].isNotEmpty()) if (choices[i].isNotEmpty())
comboBox->addItem (choices[i], i + 1);
comboBox.addItem (choices[i], i + 1);
else else
comboBox->addSeparator();
comboBox.addSeparator();
} }
comboBox->setEditableText (false);
comboBox.setEditableText (false);
} }
void ChoicePropertyComponent::setIndex (const int /*newIndex*/) void ChoicePropertyComponent::setIndex (const int /*newIndex*/)
@@ -142,13 +139,13 @@ void ChoicePropertyComponent::refresh()
{ {
if (isCustomClass) if (isCustomClass)
{ {
if (comboBox == 0)
if (! comboBox.isVisible())
{ {
createComboBox(); createComboBox();
comboBox->addListener (this);
comboBox.addListener (this);
} }
comboBox->setSelectedId (getIndex() + 1, true);
comboBox.setSelectedId (getIndex() + 1, true);
} }
} }
@@ -156,7 +153,7 @@ void ChoicePropertyComponent::comboBoxChanged (ComboBox*)
{ {
if (isCustomClass) if (isCustomClass)
{ {
const int newIndex = comboBox->getSelectedId() - 1;
const int newIndex = comboBox.getSelectedId() - 1;
if (newIndex != getIndex()) if (newIndex != getIndex())
setIndex (newIndex); setIndex (newIndex);


+ 1
- 1
src/gui/components/properties/juce_ChoicePropertyComponent.h View File

@@ -117,7 +117,7 @@ protected:
StringArray choices; StringArray choices;
private: private:
ComboBox* comboBox;
ComboBox comboBox;
bool isCustomClass; bool isCustomClass;
class RemapperValueSource; class RemapperValueSource;


+ 9
- 10
src/gui/components/properties/juce_PropertyPanel.cpp View File

@@ -226,15 +226,14 @@ PropertyPanel::PropertyPanel()
{ {
messageWhenEmpty = TRANS("(nothing selected)"); messageWhenEmpty = TRANS("(nothing selected)");
addAndMakeVisible (viewport = new Viewport());
viewport->setViewedComponent (propertyHolderComponent = new PropertyHolderComponent());
viewport->setFocusContainer (true);
addAndMakeVisible (&viewport);
viewport.setViewedComponent (propertyHolderComponent = new PropertyHolderComponent());
viewport.setFocusContainer (true);
} }
PropertyPanel::~PropertyPanel() PropertyPanel::~PropertyPanel()
{ {
clear(); clear();
deleteAllChildren();
} }
//============================================================================== //==============================================================================
@@ -251,7 +250,7 @@ void PropertyPanel::paint (Graphics& g)
void PropertyPanel::resized() void PropertyPanel::resized()
{ {
viewport->setBounds (0, 0, getWidth(), getHeight());
viewport.setBounds (0, 0, getWidth(), getHeight());
updatePropHolderLayout(); updatePropHolderLayout();
} }
@@ -294,10 +293,10 @@ void PropertyPanel::addSection (const String& sectionTitle,
void PropertyPanel::updatePropHolderLayout() const void PropertyPanel::updatePropHolderLayout() const
{ {
const int maxWidth = viewport->getMaximumVisibleWidth();
const int maxWidth = viewport.getMaximumVisibleWidth();
propertyHolderComponent->updateLayout (maxWidth); propertyHolderComponent->updateLayout (maxWidth);
const int newMaxWidth = viewport->getMaximumVisibleWidth();
const int newMaxWidth = viewport.getMaximumVisibleWidth();
if (maxWidth != newMaxWidth) if (maxWidth != newMaxWidth)
{ {
// need to do this twice because of scrollbars changing the size, etc. // need to do this twice because of scrollbars changing the size, etc.
@@ -393,7 +392,7 @@ XmlElement* PropertyPanel::getOpennessState() const
{ {
XmlElement* const xml = new XmlElement ("PROPERTYPANELSTATE"); XmlElement* const xml = new XmlElement ("PROPERTYPANELSTATE");
xml->setAttribute ("scrollPos", viewport->getViewPositionY());
xml->setAttribute ("scrollPos", viewport.getViewPositionY());
const StringArray sections (getSectionNames()); const StringArray sections (getSectionNames());
@@ -422,8 +421,8 @@ void PropertyPanel::restoreOpennessState (const XmlElement& xml)
e->getBoolAttribute ("open")); e->getBoolAttribute ("open"));
} }
viewport->setViewPosition (viewport->getViewPositionX(),
xml.getIntAttribute ("scrollPos", viewport->getViewPositionY()));
viewport.setViewPosition (viewport.getViewPositionX(),
xml.getIntAttribute ("scrollPos", viewport.getViewPositionY()));
} }
} }


+ 1
- 1
src/gui/components/properties/juce_PropertyPanel.h View File

@@ -152,7 +152,7 @@ public:
juce_UseDebuggingNewOperator juce_UseDebuggingNewOperator
private: private:
Viewport* viewport;
Viewport viewport;
class PropertyHolderComponent; class PropertyHolderComponent;
PropertyHolderComponent* propertyHolderComponent; PropertyHolderComponent* propertyHolderComponent;
String messageWhenEmpty; String messageWhenEmpty;


+ 14
- 15
src/gui/components/properties/juce_SliderPropertyComponent.cpp View File

@@ -38,13 +38,13 @@ SliderPropertyComponent::SliderPropertyComponent (const String& name,
const double skewFactor) const double skewFactor)
: PropertyComponent (name) : PropertyComponent (name)
{ {
addAndMakeVisible (slider = new Slider (name));
addAndMakeVisible (&slider);
slider->setRange (rangeMin, rangeMax, interval);
slider->setSkewFactor (skewFactor);
slider->setSliderStyle (Slider::LinearBar);
slider.setRange (rangeMin, rangeMax, interval);
slider.setSkewFactor (skewFactor);
slider.setSliderStyle (Slider::LinearBar);
slider->addListener (this);
slider.addListener (this);
} }
SliderPropertyComponent::SliderPropertyComponent (const Value& valueToControl, SliderPropertyComponent::SliderPropertyComponent (const Value& valueToControl,
@@ -55,18 +55,17 @@ SliderPropertyComponent::SliderPropertyComponent (const Value& valueToControl,
const double skewFactor) const double skewFactor)
: PropertyComponent (name) : PropertyComponent (name)
{ {
addAndMakeVisible (slider = new Slider (name));
addAndMakeVisible (&slider);
slider->setRange (rangeMin, rangeMax, interval);
slider->setSkewFactor (skewFactor);
slider->setSliderStyle (Slider::LinearBar);
slider.setRange (rangeMin, rangeMax, interval);
slider.setSkewFactor (skewFactor);
slider.setSliderStyle (Slider::LinearBar);
slider->getValueObject().referTo (valueToControl);
slider.getValueObject().referTo (valueToControl);
} }
SliderPropertyComponent::~SliderPropertyComponent() SliderPropertyComponent::~SliderPropertyComponent()
{ {
deleteAllChildren();
} }
void SliderPropertyComponent::setValue (const double /*newValue*/) void SliderPropertyComponent::setValue (const double /*newValue*/)
@@ -75,18 +74,18 @@ void SliderPropertyComponent::setValue (const double /*newValue*/)
double SliderPropertyComponent::getValue() const double SliderPropertyComponent::getValue() const
{ {
return slider->getValue();
return slider.getValue();
} }
void SliderPropertyComponent::refresh() void SliderPropertyComponent::refresh()
{ {
slider->setValue (getValue(), false);
slider.setValue (getValue(), false);
} }
void SliderPropertyComponent::sliderValueChanged (Slider*) void SliderPropertyComponent::sliderValueChanged (Slider*)
{ {
if (getValue() != slider->getValue())
setValue (slider->getValue());
if (getValue() != slider.getValue())
setValue (slider.getValue());
} }


+ 1
- 1
src/gui/components/properties/juce_SliderPropertyComponent.h View File

@@ -102,7 +102,7 @@ protected:
Your subclass has access to this in case it needs to customise it in some way. Your subclass has access to this in case it needs to customise it in some way.
*/ */
Slider* slider;
Slider slider;
SliderPropertyComponent (const SliderPropertyComponent&); SliderPropertyComponent (const SliderPropertyComponent&);
SliderPropertyComponent& operator= (const SliderPropertyComponent&); SliderPropertyComponent& operator= (const SliderPropertyComponent&);


+ 17
- 60
src/gui/components/special/juce_AudioDeviceSelectorComponent.cpp View File

@@ -218,23 +218,6 @@ public:
: type (type_), : type (type_),
setup (setup_) setup (setup_)
{ {
sampleRateDropDown = 0;
sampleRateLabel = 0;
bufferSizeDropDown = 0;
bufferSizeLabel = 0;
outputDeviceDropDown = 0;
outputDeviceLabel = 0;
inputDeviceDropDown = 0;
inputDeviceLabel = 0;
testButton = 0;
inputLevelMeter = 0;
showUIButton = 0;
inputChanList = 0;
outputChanList = 0;
inputChanLabel = 0;
outputChanLabel = 0;
showAdvancedSettingsButton = 0;
if (hideAdvancedOptionsWithButton) if (hideAdvancedOptionsWithButton)
{ {
addAndMakeVisible (showAdvancedSettingsButton = new TextButton (TRANS("Show advanced settings..."))); addAndMakeVisible (showAdvancedSettingsButton = new TextButton (TRANS("Show advanced settings...")));
@@ -250,17 +233,6 @@ public:
~AudioDeviceSettingsPanel() ~AudioDeviceSettingsPanel()
{ {
setup.manager->removeChangeListener (this); setup.manager->removeChangeListener (this);
deleteAndZero (outputDeviceLabel);
deleteAndZero (inputDeviceLabel);
deleteAndZero (sampleRateLabel);
deleteAndZero (bufferSizeLabel);
deleteAndZero (showUIButton);
deleteAndZero (inputChanLabel);
deleteAndZero (outputChanLabel);
deleteAndZero (showAdvancedSettingsButton);
deleteAllChildren();
} }
void resized() void resized()
@@ -434,7 +406,7 @@ public:
{ {
AudioIODevice* const currentDevice = setup.manager->getCurrentAudioDevice(); AudioIODevice* const currentDevice = setup.manager->getCurrentAudioDevice();
deleteAndZero (showUIButton);
showUIButton = 0;
if (currentDevice != 0 && currentDevice->hasControlPanel()) if (currentDevice != 0 && currentDevice->hasControlPanel())
{ {
@@ -513,8 +485,8 @@ public:
} }
else else
{ {
deleteAndZero (outputChanLabel);
deleteAndZero (outputChanList);
outputChanLabel = 0;
outputChanList = 0;
} }
if (setup.maxNumInputChannels > 0 if (setup.maxNumInputChannels > 0
@@ -533,8 +505,8 @@ public:
} }
else else
{ {
deleteAndZero (inputChanLabel);
deleteAndZero (inputChanList);
inputChanLabel = 0;
inputChanList = 0;
} }
// sample rate.. // sample rate..
@@ -544,7 +516,6 @@ public:
addAndMakeVisible (sampleRateDropDown = new ComboBox (String::empty)); addAndMakeVisible (sampleRateDropDown = new ComboBox (String::empty));
sampleRateDropDown->addListener (this); sampleRateDropDown->addListener (this);
delete sampleRateLabel;
sampleRateLabel = new Label (String::empty, TRANS ("sample rate:")); sampleRateLabel = new Label (String::empty, TRANS ("sample rate:"));
sampleRateLabel->attachToComponent (sampleRateDropDown, true); sampleRateLabel->attachToComponent (sampleRateDropDown, true);
} }
@@ -573,7 +544,6 @@ public:
addAndMakeVisible (bufferSizeDropDown = new ComboBox (String::empty)); addAndMakeVisible (bufferSizeDropDown = new ComboBox (String::empty));
bufferSizeDropDown->addListener (this); bufferSizeDropDown->addListener (this);
delete bufferSizeLabel;
bufferSizeLabel = new Label (String::empty, TRANS ("audio buffer size:")); bufferSizeLabel = new Label (String::empty, TRANS ("audio buffer size:"));
bufferSizeLabel->attachToComponent (bufferSizeDropDown, true); bufferSizeLabel->attachToComponent (bufferSizeDropDown, true);
} }
@@ -604,10 +574,10 @@ public:
{ {
jassert (setup.manager->getCurrentAudioDevice() == 0); // not the correct device type! jassert (setup.manager->getCurrentAudioDevice() == 0); // not the correct device type!
deleteAndZero (sampleRateLabel);
deleteAndZero (bufferSizeLabel);
deleteAndZero (sampleRateDropDown);
deleteAndZero (bufferSizeDropDown);
sampleRateLabel = 0;
bufferSizeLabel = 0;
sampleRateDropDown = 0;
bufferSizeDropDown = 0;
if (outputDeviceDropDown != 0) if (outputDeviceDropDown != 0)
outputDeviceDropDown->setSelectedId (-1, true); outputDeviceDropDown->setSelectedId (-1, true);
@@ -624,20 +594,11 @@ private:
AudioIODeviceType* const type; AudioIODeviceType* const type;
const AudioIODeviceType::DeviceSetupDetails setup; const AudioIODeviceType::DeviceSetupDetails setup;
ComboBox* outputDeviceDropDown;
ComboBox* inputDeviceDropDown;
ComboBox* sampleRateDropDown;
ComboBox* bufferSizeDropDown;
Label* outputDeviceLabel;
Label* inputDeviceLabel;
Label* sampleRateLabel;
Label* bufferSizeLabel;
Label* inputChanLabel;
Label* outputChanLabel;
TextButton* testButton;
Component* inputLevelMeter;
TextButton* showUIButton;
TextButton* showAdvancedSettingsButton;
ScopedPointer<ComboBox> outputDeviceDropDown, inputDeviceDropDown, sampleRateDropDown, bufferSizeDropDown;
ScopedPointer<Label> outputDeviceLabel, inputDeviceLabel, sampleRateLabel, bufferSizeLabel, inputChanLabel, outputChanLabel;
ScopedPointer<TextButton> testButton;
ScopedPointer<Component> inputLevelMeter;
ScopedPointer<TextButton> showUIButton, showAdvancedSettingsButton;
void showCorrectDeviceName (ComboBox* const box, const bool isInput) void showCorrectDeviceName (ComboBox* const box, const bool isInput)
{ {
@@ -937,8 +898,7 @@ public:
}; };
private: private:
ChannelSelectorListBox* inputChanList;
ChannelSelectorListBox* outputChanList;
ScopedPointer<ChannelSelectorListBox> inputChanList, outputChanList;
AudioDeviceSettingsPanel (const AudioDeviceSettingsPanel&); AudioDeviceSettingsPanel (const AudioDeviceSettingsPanel&);
AudioDeviceSettingsPanel& operator= (const AudioDeviceSettingsPanel&); AudioDeviceSettingsPanel& operator= (const AudioDeviceSettingsPanel&);
@@ -958,7 +918,6 @@ AudioDeviceSelectorComponent::AudioDeviceSelectorComponent (AudioDeviceManager&
: deviceManager (deviceManager_), : deviceManager (deviceManager_),
deviceTypeDropDown (0), deviceTypeDropDown (0),
deviceTypeDropDownLabel (0), deviceTypeDropDownLabel (0),
audioDeviceSettingsComp (0),
minOutputChannels (minOutputChannels_), minOutputChannels (minOutputChannels_),
maxOutputChannels (maxOutputChannels_), maxOutputChannels (maxOutputChannels_),
minInputChannels (minInputChannels_), minInputChannels (minInputChannels_),
@@ -1026,7 +985,6 @@ AudioDeviceSelectorComponent::AudioDeviceSelectorComponent (AudioDeviceManager&
AudioDeviceSelectorComponent::~AudioDeviceSelectorComponent() AudioDeviceSelectorComponent::~AudioDeviceSelectorComponent()
{ {
deviceManager.removeChangeListener (this); deviceManager.removeChangeListener (this);
deleteAllChildren();
} }
void AudioDeviceSelectorComponent::resized() void AudioDeviceSelectorComponent::resized()
@@ -1088,7 +1046,7 @@ void AudioDeviceSelectorComponent::comboBoxChanged (ComboBox* comboBoxThatHasCha
if (type != 0) if (type != 0)
{ {
deleteAndZero (audioDeviceSettingsComp);
audioDeviceSettingsComp = 0;
deviceManager.setCurrentAudioDeviceType (type->getTypeName(), true); deviceManager.setCurrentAudioDeviceType (type->getTypeName(), true);
@@ -1112,8 +1070,7 @@ void AudioDeviceSelectorComponent::changeListenerCallback (void*)
|| audioDeviceSettingsCompType != deviceManager.getCurrentAudioDeviceType()) || audioDeviceSettingsCompType != deviceManager.getCurrentAudioDeviceType())
{ {
audioDeviceSettingsCompType = deviceManager.getCurrentAudioDeviceType(); audioDeviceSettingsCompType = deviceManager.getCurrentAudioDeviceType();
deleteAndZero (audioDeviceSettingsComp);
audioDeviceSettingsComp = 0;
AudioIODeviceType* const type AudioIODeviceType* const type
= deviceManager.getAvailableDeviceTypes() [deviceTypeDropDown == 0 = deviceManager.getAvailableDeviceTypes() [deviceTypeDropDown == 0


+ 7
- 7
src/gui/components/special/juce_AudioDeviceSelectorComponent.h View File

@@ -95,19 +95,19 @@ public:
private: private:
AudioDeviceManager& deviceManager; AudioDeviceManager& deviceManager;
ComboBox* deviceTypeDropDown;
Label* deviceTypeDropDownLabel;
Component* audioDeviceSettingsComp;
ScopedPointer<ComboBox> deviceTypeDropDown;
ScopedPointer<Label> deviceTypeDropDownLabel;
ScopedPointer<Component> audioDeviceSettingsComp;
String audioDeviceSettingsCompType; String audioDeviceSettingsCompType;
const int minOutputChannels, maxOutputChannels, minInputChannels, maxInputChannels; const int minOutputChannels, maxOutputChannels, minInputChannels, maxInputChannels;
const bool showChannelsAsStereoPairs; const bool showChannelsAsStereoPairs;
const bool hideAdvancedOptionsWithButton; const bool hideAdvancedOptionsWithButton;
class MidiInputSelectorComponentListBox; class MidiInputSelectorComponentListBox;
MidiInputSelectorComponentListBox* midiInputsList;
Label* midiInputsLabel;
ComboBox* midiOutputSelector;
Label* midiOutputLabel;
friend class ScopedPointer<MidiInputSelectorComponentListBox>;
ScopedPointer<MidiInputSelectorComponentListBox> midiInputsList;
ScopedPointer<ComboBox> midiOutputSelector;
ScopedPointer<Label> midiInputsLabel, midiOutputLabel;
AudioDeviceSelectorComponent (const AudioDeviceSelectorComponent&); AudioDeviceSelectorComponent (const AudioDeviceSelectorComponent&);
AudioDeviceSelectorComponent& operator= (const AudioDeviceSelectorComponent&); AudioDeviceSelectorComponent& operator= (const AudioDeviceSelectorComponent&);


+ 2
- 7
src/native/mac/juce_mac_CoreAudio.cpp View File

@@ -71,7 +71,6 @@ public:
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 #if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
audioProcID (0), audioProcID (0),
#endif #endif
inputDevice (0),
isSlaveDevice (false), isSlaveDevice (false),
deviceID (id), deviceID (id),
started (false), started (false),
@@ -105,7 +104,6 @@ public:
AudioObjectRemovePropertyListener (deviceID, &pa, deviceListenerProc, this); AudioObjectRemovePropertyListener (deviceID, &pa, deviceListenerProc, this);
stop (false); stop (false);
delete inputDevice;
} }
void allocateTempBuffers() void allocateTempBuffers()
@@ -770,7 +768,7 @@ public:
AudioDeviceIOProcID audioProcID; AudioDeviceIOProcID audioProcID;
#endif #endif
CoreAudioInternal* inputDevice;
ScopedPointer<CoreAudioInternal> inputDevice;
bool isSlaveDevice; bool isSlaveDevice;
private: private:
@@ -874,7 +872,6 @@ public:
isOpen_ (false), isOpen_ (false),
isStarted (false) isStarted (false)
{ {
internal = 0;
CoreAudioInternal* device = 0; CoreAudioInternal* device = 0;
if (outputDeviceId == 0 || outputDeviceId == inputDeviceId) if (outputDeviceId == 0 || outputDeviceId == inputDeviceId)
@@ -914,8 +911,6 @@ public:
pa.mElement = kAudioObjectPropertyElementWildcard; pa.mElement = kAudioObjectPropertyElementWildcard;
AudioObjectRemovePropertyListener (kAudioObjectSystemObject, &pa, hardwareListenerProc, internal); AudioObjectRemovePropertyListener (kAudioObjectSystemObject, &pa, hardwareListenerProc, internal);
delete internal;
} }
const StringArray getOutputChannelNames() const StringArray getOutputChannelNames()
@@ -1084,7 +1079,7 @@ public:
juce_UseDebuggingNewOperator juce_UseDebuggingNewOperator
private: private:
CoreAudioInternal* internal;
ScopedPointer<CoreAudioInternal> internal;
bool isOpen_, isStarted; bool isOpen_, isStarted;
String lastError; String lastError;


+ 2
- 2
src/native/windows/juce_win32_DirectSound.cpp View File

@@ -1503,7 +1503,7 @@ const String DSoundAudioIODevice::openDevice (const BigInteger& inputChannels,
enabledInputs.getHighestBit() + 1 - inChannels.size(), enabledInputs.getHighestBit() + 1 - inChannels.size(),
false); false);
inputBuffers.setSize (enabledInputs.countNumberOfSetBits(), bufferSizeSamples);
inputBuffers.setSize (jmax (1, enabledInputs.countNumberOfSetBits()), bufferSizeSamples);
int i, numIns = 0; int i, numIns = 0;
for (i = 0; i <= enabledInputs.getHighestBit(); i += 2) for (i = 0; i <= enabledInputs.getHighestBit(); i += 2)
@@ -1528,7 +1528,7 @@ const String DSoundAudioIODevice::openDevice (const BigInteger& inputChannels,
enabledOutputs.getHighestBit() + 1 - outChannels.size(), enabledOutputs.getHighestBit() + 1 - outChannels.size(),
false); false);
outputBuffers.setSize (enabledOutputs.countNumberOfSetBits(), bufferSizeSamples);
outputBuffers.setSize (jmax (1, enabledOutputs.countNumberOfSetBits()), bufferSizeSamples);
int numOuts = 0; int numOuts = 0;
for (i = 0; i <= enabledOutputs.getHighestBit(); i += 2) for (i = 0; i <= enabledOutputs.getHighestBit(); i += 2)


Loading…
Cancel
Save