1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-11 23:54:18 +00:00

Minor code clean-ups.

This commit is contained in:
Julian Storer 2010-06-10 10:09:24 +01:00
parent cc45ec88f5
commit 6bcc8febca
25 changed files with 246 additions and 380 deletions

View file

@ -55211,8 +55211,6 @@ private:
TreeView::TreeView (const String& componentName)
: Component (componentName),
rootItem (0),
dragInsertPointHighlight (0),
dragTargetGroupHighlight (0),
indentSize (24),
defaultOpenness (false),
needsRecalculating (true),
@ -55230,8 +55228,6 @@ TreeView::~TreeView()
{
if (rootItem != 0)
rootItem->setOwnerView (0);
deleteAllChildren();
}
void TreeView::setRootItem (TreeViewItem* const newRootItem)
@ -55691,8 +55687,8 @@ void TreeView::showDragHighlight (TreeViewItem* item, int insertIndex, int x, in
void TreeView::hideDragHighlight() throw()
{
deleteAndZero (dragInsertPointHighlight);
deleteAndZero (dragTargetGroupHighlight);
dragInsertPointHighlight = 0;
dragTargetGroupHighlight = 0;
}
TreeViewItem* TreeView::getInsertPosition (int& x, int& y, int& insertIndex,
@ -57935,13 +57931,12 @@ FilenameComponent::FilenameComponent (const String& name,
wildcard (fileBrowserWildcard),
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 ("...");
setCurrentFile (currentFile, true);
@ -57949,7 +57944,6 @@ FilenameComponent::FilenameComponent (const String& name,
FilenameComponent::~FilenameComponent()
{
deleteAllChildren();
}
void FilenameComponent::paintOverChildren (Graphics& g)
@ -57963,7 +57957,7 @@ void FilenameComponent::paintOverChildren (Graphics& g)
void FilenameComponent::resized()
{
getLookAndFeel().layoutFilenameComponent (*this, filenameBox, browseButton);
getLookAndFeel().layoutFilenameComponent (*this, &filenameBox, browseButton);
}
void FilenameComponent::setBrowseButtonText (const String& newBrowseButtonText)
@ -57974,7 +57968,7 @@ void FilenameComponent::setBrowseButtonText (const String& newBrowseButtonText)
void FilenameComponent::lookAndFeelChanged()
{
deleteAndZero (browseButton);
browseButton = 0;
addAndMakeVisible (browseButton = getLookAndFeel().createFilenameComponentBrowseButton (browseButtonText));
browseButton->setConnectedEdges (Button::ConnectedOnLeft);
@ -57986,7 +57980,7 @@ void FilenameComponent::lookAndFeelChanged()
void FilenameComponent::setTooltip (const String& newTooltip)
{
SettableTooltipClient::setTooltip (newTooltip);
filenameBox->setTooltip (newTooltip);
filenameBox.setTooltip (newTooltip);
}
void FilenameComponent::setDefaultBrowseTarget (const File& newDefaultDirectory)
@ -58044,7 +58038,7 @@ void FilenameComponent::fileDragExit (const StringArray&)
const File FilenameComponent::getCurrentFile() const
{
File f (filenameBox->getText());
File f (filenameBox.getText());
if (enforcedSuffix.isNotEmpty())
f = f.withFileExtension (enforcedSuffix);
@ -58066,7 +58060,7 @@ void FilenameComponent::setCurrentFile (File newFile,
if (addToRecentlyUsedList)
addRecentlyUsedFile (newFile);
filenameBox->setText (lastFilename, true);
filenameBox.setText (lastFilename, true);
if (sendChangeNotification)
triggerAsyncUpdate();
@ -58075,15 +58069,15 @@ void FilenameComponent::setCurrentFile (File newFile,
void FilenameComponent::setFilenameIsEditable (const bool shouldBeEditable)
{
filenameBox->setEditableText (shouldBeEditable);
filenameBox.setEditableText (shouldBeEditable);
}
const StringArray FilenameComponent::getRecentlyUsedFilenames() const
{
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;
}
@ -58092,10 +58086,10 @@ void FilenameComponent::setRecentlyUsedFilenames (const StringArray& filenames)
{
if (filenames != getRecentlyUsedFilenames())
{
filenameBox->clear();
filenameBox.clear();
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),
vertical (vertical_),
isDraggingThumb (false),
autohides (true),
upButton (0),
downButton (0)
autohides (true)
{
setButtonVisibility (buttonsAreVisible);
@ -61618,7 +61610,8 @@ ScrollBar::ScrollBar (const bool vertical_,
ScrollBar::~ScrollBar()
{
deleteAllChildren();
upButton = 0;
downButton = 0;
}
void ScrollBar::setRangeLimits (const Range<double>& newRangeLimit)
@ -61768,9 +61761,7 @@ void ScrollBar::setOrientation (const bool shouldBeVertical)
void ScrollBar::setButtonVisibility (const bool buttonsAreVisible)
{
delete upButton;
upButton = 0;
delete downButton;
downButton = 0;
if (buttonsAreVisible)
@ -62605,8 +62596,7 @@ private:
TabbedButtonBar::TabbedButtonBar (const Orientation orientation_)
: orientation (orientation_),
currentTabIndex (-1),
extraTabsButton (0)
currentTabIndex (-1)
{
setInterceptsMouseClicks (false, true);
addAndMakeVisible (behindFrontTab = new TabAreaBehindFrontButtonComponent (this));
@ -62615,6 +62605,7 @@ TabbedButtonBar::TabbedButtonBar (const Orientation orientation_)
TabbedButtonBar::~TabbedButtonBar()
{
extraTabsButton = 0;
deleteAllChildren();
}
@ -62639,7 +62630,7 @@ void TabbedButtonBar::clearTabs()
tabColours.clear();
currentTabIndex = -1;
deleteAndZero (extraTabsButton);
extraTabsButton = 0;
removeChildComponent (behindFrontTab);
deleteAllChildren();
addChildComponent (behindFrontTab);
@ -62784,7 +62775,7 @@ TabBarButton* TabbedButtonBar::getTabButton (const int index) const
void TabbedButtonBar::lookAndFeelChanged()
{
deleteAndZero (extraTabsButton);
extraTabsButton = 0;
resized();
}
@ -62872,7 +62863,7 @@ void TabbedButtonBar::resized()
}
else
{
deleteAndZero (extraTabsButton);
extraTabsButton = 0;
}
int pos = 0;
@ -62936,7 +62927,7 @@ void TabbedButtonBar::setTabBackgroundColour (const int tabIndex, const Colour&
void TabbedButtonBar::buttonClicked (Button* button)
{
if (extraTabsButton == button)
if (button == extraTabsButton)
{
PopupMenu m;
@ -70807,8 +70798,9 @@ BooleanPropertyComponent::BooleanPropertyComponent (const String& name,
onText (buttonTextWhenTrue),
offText (buttonTextWhenFalse)
{
createButton();
button->addButtonListener (this);
addAndMakeVisible (&button);
button.setClickingTogglesState (false);
button.addButtonListener (this);
}
BooleanPropertyComponent::BooleanPropertyComponent (const Value& valueToControl,
@ -70818,31 +70810,25 @@ BooleanPropertyComponent::BooleanPropertyComponent (const Value& valueToControl,
onText (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()
{
deleteAllChildren();
}
void BooleanPropertyComponent::createButton()
{
addAndMakeVisible (button = new ToggleButton (String::empty));
button->setClickingTogglesState (false);
}
void BooleanPropertyComponent::setState (const bool newState)
{
button->setToggleState (newState, true);
button.setToggleState (newState, true);
}
bool BooleanPropertyComponent::getState() const
{
return button->getToggleState();
return button.getToggleState();
}
void BooleanPropertyComponent::paint (Graphics& g)
@ -70850,16 +70836,16 @@ void BooleanPropertyComponent::paint (Graphics& g)
PropertyComponent::paint (g);
g.setColour (Colours::white);
g.fillRect (button->getBounds());
g.fillRect (button.getBounds());
g.setColour (findColour (ComboBox::outlineColourId));
g.drawRect (button->getBounds());
g.drawRect (button.getBounds());
}
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*)
@ -70878,19 +70864,18 @@ ButtonPropertyComponent::ButtonPropertyComponent (const String& name,
const bool triggerOnMouseDown)
: PropertyComponent (name)
{
addAndMakeVisible (button = new TextButton (String::empty));
button->setTriggeredOnMouseDown (triggerOnMouseDown);
button->addButtonListener (this);
addAndMakeVisible (&button);
button.setTriggeredOnMouseDown (triggerOnMouseDown);
button.addButtonListener (this);
}
ButtonPropertyComponent::~ButtonPropertyComponent()
{
deleteAllChildren();
}
void ButtonPropertyComponent::refresh()
{
button->setButtonText (getButtonText());
button.setButtonText (getButtonText());
}
void ButtonPropertyComponent::buttonClicked (Button*)
@ -70948,7 +70933,6 @@ protected:
ChoicePropertyComponent::ChoicePropertyComponent (const String& name)
: PropertyComponent (name),
comboBox (0),
isCustomClass (true)
{
}
@ -70959,7 +70943,6 @@ ChoicePropertyComponent::ChoicePropertyComponent (const Value& valueToControl,
const Array <var>& correspondingValues)
: PropertyComponent (name),
choices (choices_),
comboBox (0),
isCustomClass (false)
{
// 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();
comboBox->getSelectedIdAsValue().referTo (Value (new RemapperValueSource (valueToControl, correspondingValues)));
comboBox.getSelectedIdAsValue().referTo (Value (new RemapperValueSource (valueToControl, correspondingValues)));
}
ChoicePropertyComponent::~ChoicePropertyComponent()
{
deleteAllChildren();
}
void ChoicePropertyComponent::createComboBox()
{
addAndMakeVisible (comboBox = new ComboBox());
addAndMakeVisible (&comboBox);
for (int i = 0; i < choices.size(); ++i)
{
if (choices[i].isNotEmpty())
comboBox->addItem (choices[i], i + 1);
comboBox.addItem (choices[i], i + 1);
else
comboBox->addSeparator();
comboBox.addSeparator();
}
comboBox->setEditableText (false);
comboBox.setEditableText (false);
}
void ChoicePropertyComponent::setIndex (const int /*newIndex*/)
@ -71011,13 +70993,13 @@ void ChoicePropertyComponent::refresh()
{
if (isCustomClass)
{
if (comboBox == 0)
if (! comboBox.isVisible())
{
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)
{
const int newIndex = comboBox->getSelectedId() - 1;
const int newIndex = comboBox.getSelectedId() - 1;
if (newIndex != getIndex())
setIndex (newIndex);
@ -71266,15 +71248,14 @@ PropertyPanel::PropertyPanel()
{
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()
{
clear();
deleteAllChildren();
}
void PropertyPanel::paint (Graphics& g)
@ -71290,7 +71271,7 @@ void PropertyPanel::paint (Graphics& g)
void PropertyPanel::resized()
{
viewport->setBounds (0, 0, getWidth(), getHeight());
viewport.setBounds (0, 0, getWidth(), getHeight());
updatePropHolderLayout();
}
@ -71332,10 +71313,10 @@ void PropertyPanel::addSection (const String& sectionTitle,
void PropertyPanel::updatePropHolderLayout() const
{
const int maxWidth = viewport->getMaximumVisibleWidth();
const int maxWidth = viewport.getMaximumVisibleWidth();
propertyHolderComponent->updateLayout (maxWidth);
const int newMaxWidth = viewport->getMaximumVisibleWidth();
const int newMaxWidth = viewport.getMaximumVisibleWidth();
if (maxWidth != newMaxWidth)
{
// 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");
xml->setAttribute ("scrollPos", viewport->getViewPositionY());
xml->setAttribute ("scrollPos", viewport.getViewPositionY());
const StringArray sections (getSectionNames());
@ -71458,8 +71439,8 @@ void PropertyPanel::restoreOpennessState (const XmlElement& xml)
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)
: 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,
@ -71508,18 +71489,17 @@ SliderPropertyComponent::SliderPropertyComponent (const Value& valueToControl,
const double skewFactor)
: 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()
{
deleteAllChildren();
}
void SliderPropertyComponent::setValue (const double /*newValue*/)
@ -71528,18 +71508,18 @@ void SliderPropertyComponent::setValue (const double /*newValue*/)
double SliderPropertyComponent::getValue() const
{
return slider->getValue();
return slider.getValue();
}
void SliderPropertyComponent::refresh()
{
slider->setValue (getValue(), false);
slider.setValue (getValue(), false);
}
void SliderPropertyComponent::sliderValueChanged (Slider*)
{
if (getValue() != slider->getValue())
setValue (slider->getValue());
if (getValue() != slider.getValue())
setValue (slider.getValue());
}
END_JUCE_NAMESPACE
@ -71836,23 +71816,6 @@ public:
: type (type_),
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)
{
addAndMakeVisible (showAdvancedSettingsButton = new TextButton (TRANS("Show advanced settings...")));
@ -71868,17 +71831,6 @@ public:
~AudioDeviceSettingsPanel()
{
setup.manager->removeChangeListener (this);
deleteAndZero (outputDeviceLabel);
deleteAndZero (inputDeviceLabel);
deleteAndZero (sampleRateLabel);
deleteAndZero (bufferSizeLabel);
deleteAndZero (showUIButton);
deleteAndZero (inputChanLabel);
deleteAndZero (outputChanLabel);
deleteAndZero (showAdvancedSettingsButton);
deleteAllChildren();
}
void resized()
@ -72052,7 +72004,7 @@ public:
{
AudioIODevice* const currentDevice = setup.manager->getCurrentAudioDevice();
deleteAndZero (showUIButton);
showUIButton = 0;
if (currentDevice != 0 && currentDevice->hasControlPanel())
{
@ -72131,8 +72083,8 @@ public:
}
else
{
deleteAndZero (outputChanLabel);
deleteAndZero (outputChanList);
outputChanLabel = 0;
outputChanList = 0;
}
if (setup.maxNumInputChannels > 0
@ -72151,8 +72103,8 @@ public:
}
else
{
deleteAndZero (inputChanLabel);
deleteAndZero (inputChanList);
inputChanLabel = 0;
inputChanList = 0;
}
// sample rate..
@ -72162,7 +72114,6 @@ public:
addAndMakeVisible (sampleRateDropDown = new ComboBox (String::empty));
sampleRateDropDown->addListener (this);
delete sampleRateLabel;
sampleRateLabel = new Label (String::empty, TRANS ("sample rate:"));
sampleRateLabel->attachToComponent (sampleRateDropDown, true);
}
@ -72191,7 +72142,6 @@ public:
addAndMakeVisible (bufferSizeDropDown = new ComboBox (String::empty));
bufferSizeDropDown->addListener (this);
delete bufferSizeLabel;
bufferSizeLabel = new Label (String::empty, TRANS ("audio buffer size:"));
bufferSizeLabel->attachToComponent (bufferSizeDropDown, true);
}
@ -72222,10 +72172,10 @@ public:
{
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)
outputDeviceDropDown->setSelectedId (-1, true);
@ -72242,20 +72192,11 @@ private:
AudioIODeviceType* const type;
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)
{
@ -72553,8 +72494,7 @@ public:
};
private:
ChannelSelectorListBox* inputChanList;
ChannelSelectorListBox* outputChanList;
ScopedPointer<ChannelSelectorListBox> inputChanList, outputChanList;
AudioDeviceSettingsPanel (const AudioDeviceSettingsPanel&);
AudioDeviceSettingsPanel& operator= (const AudioDeviceSettingsPanel&);
@ -72572,7 +72512,6 @@ AudioDeviceSelectorComponent::AudioDeviceSelectorComponent (AudioDeviceManager&
: deviceManager (deviceManager_),
deviceTypeDropDown (0),
deviceTypeDropDownLabel (0),
audioDeviceSettingsComp (0),
minOutputChannels (minOutputChannels_),
maxOutputChannels (maxOutputChannels_),
minInputChannels (minInputChannels_),
@ -72640,7 +72579,6 @@ AudioDeviceSelectorComponent::AudioDeviceSelectorComponent (AudioDeviceManager&
AudioDeviceSelectorComponent::~AudioDeviceSelectorComponent()
{
deviceManager.removeChangeListener (this);
deleteAllChildren();
}
void AudioDeviceSelectorComponent::resized()
@ -72702,7 +72640,7 @@ void AudioDeviceSelectorComponent::comboBoxChanged (ComboBox* comboBoxThatHasCha
if (type != 0)
{
deleteAndZero (audioDeviceSettingsComp);
audioDeviceSettingsComp = 0;
deviceManager.setCurrentAudioDeviceType (type->getTypeName(), true);
@ -72726,8 +72664,7 @@ void AudioDeviceSelectorComponent::changeListenerCallback (void*)
|| audioDeviceSettingsCompType != deviceManager.getCurrentAudioDeviceType())
{
audioDeviceSettingsCompType = deviceManager.getCurrentAudioDeviceType();
deleteAndZero (audioDeviceSettingsComp);
audioDeviceSettingsComp = 0;
AudioIODeviceType* const type
= deviceManager.getAvailableDeviceTypes() [deviceTypeDropDown == 0
@ -250281,7 +250218,7 @@ const String DSoundAudioIODevice::openDevice (const BigInteger& inputChannels,
enabledInputs.getHighestBit() + 1 - inChannels.size(),
false);
inputBuffers.setSize (enabledInputs.countNumberOfSetBits(), bufferSizeSamples);
inputBuffers.setSize (jmax (1, enabledInputs.countNumberOfSetBits()), bufferSizeSamples);
int i, numIns = 0;
for (i = 0; i <= enabledInputs.getHighestBit(); i += 2)
@ -250306,7 +250243,7 @@ const String DSoundAudioIODevice::openDevice (const BigInteger& inputChannels,
enabledOutputs.getHighestBit() + 1 - outChannels.size(),
false);
outputBuffers.setSize (enabledOutputs.countNumberOfSetBits(), bufferSizeSamples);
outputBuffers.setSize (jmax (1, enabledOutputs.countNumberOfSetBits()), bufferSizeSamples);
int numOuts = 0;
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
audioProcID (0),
#endif
inputDevice (0),
isSlaveDevice (false),
deviceID (id),
started (false),
@ -274927,7 +274863,6 @@ public:
AudioObjectRemovePropertyListener (deviceID, &pa, deviceListenerProc, this);
stop (false);
delete inputDevice;
}
void allocateTempBuffers()
@ -275589,7 +275524,7 @@ public:
AudioDeviceIOProcID audioProcID;
#endif
CoreAudioInternal* inputDevice;
ScopedPointer<CoreAudioInternal> inputDevice;
bool isSlaveDevice;
private:
@ -275689,7 +275624,6 @@ public:
isOpen_ (false),
isStarted (false)
{
internal = 0;
CoreAudioInternal* device = 0;
if (outputDeviceId == 0 || outputDeviceId == inputDeviceId)
@ -275729,8 +275663,6 @@ public:
pa.mElement = kAudioObjectPropertyElementWildcard;
AudioObjectRemovePropertyListener (kAudioObjectSystemObject, &pa, hardwareListenerProc, internal);
delete internal;
}
const StringArray getOutputChannelNames()
@ -275899,7 +275831,7 @@ public:
juce_UseDebuggingNewOperator
private:
CoreAudioInternal* internal;
ScopedPointer<CoreAudioInternal> internal;
bool isOpen_, isStarted;
String lastError;

View file

@ -64,7 +64,7 @@
*/
#define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 52
#define JUCE_BUILDNUMBER 15
#define JUCE_BUILDNUMBER 16
/** Current Juce version number.
@ -34478,8 +34478,8 @@ private:
int initialDelayInMillisecs, repeatDelayInMillisecs, minimumDelayInMillisecs;
bool vertical, isDraggingThumb, autohides;
class ScrollbarButton;
ScrollbarButton* upButton;
ScrollbarButton* downButton;
friend class ScopedPointer<ScrollbarButton>;
ScopedPointer<ScrollbarButton> upButton, downButton;
ListenerList <ScrollBarListener> listeners;
void updateThumbPosition();
@ -40731,7 +40731,7 @@ public:
juce_UseDebuggingNewOperator
private:
Viewport* viewport;
Viewport viewport;
class PropertyHolderComponent;
PropertyHolderComponent* propertyHolderComponent;
String messageWhenEmpty;
@ -47821,13 +47821,16 @@ private:
friend class TreeViewItem;
friend class TreeViewContentComponent;
class TreeViewport;
TreeViewport* viewport;
CriticalSection nodeAlterationLock;
TreeViewItem* rootItem;
class InsertPointHighlight;
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;
bool defaultOpenness : 1;
bool needsRecalculating : 1;
@ -50282,9 +50285,9 @@ public:
private:
ComboBox* filenameBox;
ComboBox filenameBox;
String lastFilename;
Button* browseButton;
ScopedPointer<Button> browseButton;
int maxRecentFiles;
bool isDir, isSaving, isFileDragOver;
String wildcard, enforcedSuffix, browseButtonText;
@ -51366,7 +51369,7 @@ private:
Array <Colour> tabColours;
int currentTabIndex;
Component* behindFrontTab;
Button* extraTabsButton;
ScopedPointer<Button> extraTabsButton;
TabbedButtonBar (const TabbedButtonBar&);
TabbedButtonBar& operator= (const TabbedButtonBar&);
@ -54836,11 +54839,9 @@ public:
juce_UseDebuggingNewOperator
private:
ToggleButton* button;
ToggleButton button;
String onText, offText;
void createButton();
BooleanPropertyComponent (const BooleanPropertyComponent&);
BooleanPropertyComponent& operator= (const BooleanPropertyComponent&);
};
@ -54898,7 +54899,7 @@ public:
juce_UseDebuggingNewOperator
private:
TextButton* button;
TextButton button;
ButtonPropertyComponent (const ButtonPropertyComponent&);
ButtonPropertyComponent& operator= (const ButtonPropertyComponent&);
@ -54998,7 +54999,7 @@ protected:
StringArray choices;
private:
ComboBox* comboBox;
ComboBox comboBox;
bool isCustomClass;
class RemapperValueSource;
@ -55092,7 +55093,7 @@ protected:
Your subclass has access to this in case it needs to customise it in some way.
*/
Slider* slider;
Slider slider;
SliderPropertyComponent (const SliderPropertyComponent&);
SliderPropertyComponent& operator= (const SliderPropertyComponent&);
@ -55356,19 +55357,19 @@ public:
private:
AudioDeviceManager& deviceManager;
ComboBox* deviceTypeDropDown;
Label* deviceTypeDropDownLabel;
Component* audioDeviceSettingsComp;
ScopedPointer<ComboBox> deviceTypeDropDown;
ScopedPointer<Label> deviceTypeDropDownLabel;
ScopedPointer<Component> audioDeviceSettingsComp;
String audioDeviceSettingsCompType;
const int minOutputChannels, maxOutputChannels, minInputChannels, maxInputChannels;
const bool showChannelsAsStereoPairs;
const bool hideAdvancedOptionsWithButton;
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& operator= (const AudioDeviceSelectorComponent&);

View file

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

View file

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

View file

@ -752,13 +752,16 @@ private:
friend class TreeViewItem;
friend class TreeViewContentComponent;
class TreeViewport;
TreeViewport* viewport;
CriticalSection nodeAlterationLock;
TreeViewItem* rootItem;
class InsertPointHighlight;
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;
bool defaultOpenness : 1;
bool needsRecalculating : 1;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -77,7 +77,6 @@ protected:
//==============================================================================
ChoicePropertyComponent::ChoicePropertyComponent (const String& name)
: PropertyComponent (name),
comboBox (0),
isCustomClass (true)
{
}
@ -88,7 +87,6 @@ ChoicePropertyComponent::ChoicePropertyComponent (const Value& valueToControl,
const Array <var>& correspondingValues)
: PropertyComponent (name),
choices (choices_),
comboBox (0),
isCustomClass (false)
{
// 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();
comboBox->getSelectedIdAsValue().referTo (Value (new RemapperValueSource (valueToControl, correspondingValues)));
comboBox.getSelectedIdAsValue().referTo (Value (new RemapperValueSource (valueToControl, correspondingValues)));
}
ChoicePropertyComponent::~ChoicePropertyComponent()
{
deleteAllChildren();
}
//==============================================================================
void ChoicePropertyComponent::createComboBox()
{
addAndMakeVisible (comboBox = new ComboBox());
addAndMakeVisible (&comboBox);
for (int i = 0; i < choices.size(); ++i)
{
if (choices[i].isNotEmpty())
comboBox->addItem (choices[i], i + 1);
comboBox.addItem (choices[i], i + 1);
else
comboBox->addSeparator();
comboBox.addSeparator();
}
comboBox->setEditableText (false);
comboBox.setEditableText (false);
}
void ChoicePropertyComponent::setIndex (const int /*newIndex*/)
@ -142,13 +139,13 @@ void ChoicePropertyComponent::refresh()
{
if (isCustomClass)
{
if (comboBox == 0)
if (! comboBox.isVisible())
{
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)
{
const int newIndex = comboBox->getSelectedId() - 1;
const int newIndex = comboBox.getSelectedId() - 1;
if (newIndex != getIndex())
setIndex (newIndex);

View file

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

View file

@ -226,15 +226,14 @@ PropertyPanel::PropertyPanel()
{
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()
{
clear();
deleteAllChildren();
}
//==============================================================================
@ -251,7 +250,7 @@ void PropertyPanel::paint (Graphics& g)
void PropertyPanel::resized()
{
viewport->setBounds (0, 0, getWidth(), getHeight());
viewport.setBounds (0, 0, getWidth(), getHeight());
updatePropHolderLayout();
}
@ -294,10 +293,10 @@ void PropertyPanel::addSection (const String& sectionTitle,
void PropertyPanel::updatePropHolderLayout() const
{
const int maxWidth = viewport->getMaximumVisibleWidth();
const int maxWidth = viewport.getMaximumVisibleWidth();
propertyHolderComponent->updateLayout (maxWidth);
const int newMaxWidth = viewport->getMaximumVisibleWidth();
const int newMaxWidth = viewport.getMaximumVisibleWidth();
if (maxWidth != newMaxWidth)
{
// 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");
xml->setAttribute ("scrollPos", viewport->getViewPositionY());
xml->setAttribute ("scrollPos", viewport.getViewPositionY());
const StringArray sections (getSectionNames());
@ -422,8 +421,8 @@ void PropertyPanel::restoreOpennessState (const XmlElement& xml)
e->getBoolAttribute ("open"));
}
viewport->setViewPosition (viewport->getViewPositionX(),
xml.getIntAttribute ("scrollPos", viewport->getViewPositionY()));
viewport.setViewPosition (viewport.getViewPositionX(),
xml.getIntAttribute ("scrollPos", viewport.getViewPositionY()));
}
}

View file

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

View file

@ -38,13 +38,13 @@ SliderPropertyComponent::SliderPropertyComponent (const String& name,
const double skewFactor)
: 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,
@ -55,18 +55,17 @@ SliderPropertyComponent::SliderPropertyComponent (const Value& valueToControl,
const double skewFactor)
: 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()
{
deleteAllChildren();
}
void SliderPropertyComponent::setValue (const double /*newValue*/)
@ -75,18 +74,18 @@ void SliderPropertyComponent::setValue (const double /*newValue*/)
double SliderPropertyComponent::getValue() const
{
return slider->getValue();
return slider.getValue();
}
void SliderPropertyComponent::refresh()
{
slider->setValue (getValue(), false);
slider.setValue (getValue(), false);
}
void SliderPropertyComponent::sliderValueChanged (Slider*)
{
if (getValue() != slider->getValue())
setValue (slider->getValue());
if (getValue() != slider.getValue())
setValue (slider.getValue());
}

View file

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

View file

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

View file

@ -95,19 +95,19 @@ public:
private:
AudioDeviceManager& deviceManager;
ComboBox* deviceTypeDropDown;
Label* deviceTypeDropDownLabel;
Component* audioDeviceSettingsComp;
ScopedPointer<ComboBox> deviceTypeDropDown;
ScopedPointer<Label> deviceTypeDropDownLabel;
ScopedPointer<Component> audioDeviceSettingsComp;
String audioDeviceSettingsCompType;
const int minOutputChannels, maxOutputChannels, minInputChannels, maxInputChannels;
const bool showChannelsAsStereoPairs;
const bool hideAdvancedOptionsWithButton;
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& operator= (const AudioDeviceSelectorComponent&);

View file

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

View file

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