1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Minor tidying up

This commit is contained in:
jules 2017-11-29 17:33:00 +00:00
parent af254262f6
commit 6a49d6efdc
13 changed files with 59 additions and 57 deletions

View file

@ -29,17 +29,16 @@
#include "../JuceLibraryCode/JuceHeader.h"
//==============================================================================
class OSCLogListBox : public ListBox, private ListBoxModel, private AsyncUpdater
class OSCLogListBox : public ListBox,
private ListBoxModel,
private AsyncUpdater
{
public:
//==============================================================================
OSCLogListBox()
{
setModel (this);
}
//==============================================================================
~OSCLogListBox()
{
}
@ -161,14 +160,11 @@ public:
}
private:
//==============================================================================
String getIndentationString (int level)
static String getIndentationString (int level)
{
return String().paddedRight (' ', 2 * level);
}
//==============================================================================
StringArray oscLogList;

View file

@ -34,10 +34,10 @@
This component lives inside our window, and this is where you should put all
your controls and content.
*/
class MainContentComponent : public Component, private Slider::Listener
class MainContentComponent : public Component,
private Slider::Listener
{
public:
//==============================================================================
MainContentComponent()
{
setSize (200, 200);

View file

@ -78,8 +78,9 @@ private:
};
//==============================================================================
struct Header : public Component, private LicenseController::StateChangedCallback,
private Button::Listener
struct Header : public Component,
private LicenseController::StateChangedCallback,
private Button::Listener
{
Header() : avatarButton ("User Settings", &getIcons().user)
{

View file

@ -414,7 +414,8 @@ namespace AAXClasses
//==============================================================================
class JuceAAX_Processor;
class JuceAAX_GUI : public AAX_CEffectGUI, public ModifierKeyProvider
class JuceAAX_GUI : public AAX_CEffectGUI,
public ModifierKeyProvider
{
public:
JuceAAX_GUI() {}

View file

@ -693,15 +693,15 @@ public:
private:
//==============================================================================
class MainContentComponent : public Component, private Value::Listener,
Button::Listener,
ComponentListener
class MainContentComponent : public Component,
private Value::Listener,
private Button::Listener,
private ComponentListener
{
public:
MainContentComponent (StandaloneFilterWindow& filterWindow)
: owner (filterWindow), notification (this),
editor (owner.getAudioProcessor()->createEditorIfNeeded()),
shouldShowNotification (false)
editor (owner.getAudioProcessor()->createEditorIfNeeded())
{
Value& inputMutedValue = owner.pluginHolder->getMuteInputValue();
@ -829,7 +829,7 @@ private:
StandaloneFilterWindow& owner;
NotificationArea notification;
ScopedPointer<AudioProcessorEditor> editor;
bool shouldShowNotification;
bool shouldShowNotification = false;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainContentComponent)
};

View file

@ -49,7 +49,8 @@ private:
//==============================================================================
// An AudioSourcePlayer which will remove itself from the AudioDeviceManager's
// callback list once it finishes playing its source
struct AutoRemovingTransportSource : public AudioTransportSource, private Timer
struct AutoRemovingTransportSource : public AudioTransportSource,
private Timer
{
AutoRemovingTransportSource (MixerAudioSource& mixerToUse, AudioTransportSource* ts, bool ownSource,
int samplesPerBlock, double requiredSampleRate)

View file

@ -461,7 +461,8 @@ public:
static AtomicTests atomicUnitTests;
//==============================================================================
class ThreadLocalValueUnitTest : public UnitTest, private Thread
class ThreadLocalValueUnitTest : public UnitTest,
private Thread
{
public:
ThreadLocalValueUnitTest()

View file

@ -61,7 +61,7 @@ public:
{
const int buttonHeight = 26;
Rectangle<int> area (getLocalBounds());
auto area = getLocalBounds();
text.createLayout (getLookAndFeel().createFileChooserHeaderText (getName(), instructions),
getWidth() - 12.0f);
@ -69,7 +69,7 @@ public:
area.removeFromTop (roundToInt (text.getHeight()) + 10);
chooserComponent.setBounds (area.removeFromTop (area.getHeight() - buttonHeight - 20));
Rectangle<int> buttonArea (area.reduced (16, 10));
auto buttonArea = area.reduced (16, 10);
okButton.changeWidthToFitText (buttonHeight);
okButton.setBounds (buttonArea.removeFromRight (okButton.getWidth() + 16));
@ -85,8 +85,6 @@ public:
FileBrowserComponent& chooserComponent;
TextButton okButton, cancelButton, newFolderButton;
private:
String instructions;
TextLayout text;
};
@ -95,10 +93,10 @@ private:
FileChooserDialogBox::FileChooserDialogBox (const String& name,
const String& instructions,
FileBrowserComponent& chooserComponent,
const bool warnAboutOverwritingExistingFiles_,
bool shouldWarn,
Colour backgroundColour)
: ResizableWindow (name, backgroundColour, true),
warnAboutOverwritingExistingFiles (warnAboutOverwritingExistingFiles_)
warnAboutOverwritingExistingFiles (shouldWarn)
{
content = new ContentComponent (name, instructions, chooserComponent);
setContentOwned (content, false);
@ -149,7 +147,7 @@ void FileChooserDialogBox::centreWithDefaultSize (Component* componentToCentreAr
int FileChooserDialogBox::getDefaultWidth() const
{
if (Component* const previewComp = content->chooserComponent.getPreviewComponent())
if (auto* previewComp = content->chooserComponent.getPreviewComponent())
return 400 + previewComp->getWidth();
return 600;
@ -158,18 +156,9 @@ int FileChooserDialogBox::getDefaultWidth() const
//==============================================================================
void FileChooserDialogBox::buttonClicked (Button* button)
{
if (button == &(content->okButton))
{
okButtonPressed();
}
else if (button == &(content->cancelButton))
{
closeButtonPressed();
}
else if (button == &(content->newFolderButton))
{
createNewFolder();
}
if (button == &(content->okButton)) okButtonPressed();
if (button == &(content->cancelButton)) closeButtonPressed();
if (button == &(content->newFolderButton)) createNewFolder();
}
void FileChooserDialogBox::closeButtonPressed()
@ -235,13 +224,13 @@ void FileChooserDialogBox::createNewFolderCallback (int result, FileChooserDialo
void FileChooserDialogBox::createNewFolder()
{
File parent (content->chooserComponent.getRoot());
auto parent = content->chooserComponent.getRoot();
if (parent.isDirectory())
{
AlertWindow* aw = new AlertWindow (TRANS("New Folder"),
TRANS("Please enter the name for the folder"),
AlertWindow::NoIcon, this);
auto* aw = new AlertWindow (TRANS("New Folder"),
TRANS("Please enter the name for the folder"),
AlertWindow::NoIcon, this);
aw->addTextEditor ("Folder Name", String(), String(), false);
aw->addButton (TRANS("Create Folder"), 1, KeyPress (KeyPress::returnKey));
@ -256,18 +245,16 @@ void FileChooserDialogBox::createNewFolder()
void FileChooserDialogBox::createNewFolderConfirmed (const String& nameFromDialog)
{
const String name (File::createLegalFileName (nameFromDialog));
auto name = File::createLegalFileName (nameFromDialog);
if (! name.isEmpty())
{
const File parent (content->chooserComponent.getRoot());
auto parent = content->chooserComponent.getRoot();
if (! parent.getChildFile (name).createDirectory())
{
AlertWindow::showMessageBoxAsync (AlertWindow::WarningIcon,
TRANS ("New Folder"),
TRANS ("Couldn't create the folder!"));
}
content->chooserComponent.refresh();
}

View file

@ -31,7 +31,8 @@ namespace juce
template <> struct ContainerDeletePolicy<UIDocumentPickerViewController> { static void destroy (NSObject* o) { [o release]; } };
template <> struct ContainerDeletePolicy<NSObject<UIDocumentPickerDelegate>> { static void destroy (NSObject* o) { [o release]; } };
class FileChooser::Native : private Component, public FileChooser::Pimpl
class FileChooser::Native : private Component,
public FileChooser::Pimpl
{
public:
Native (FileChooser& fileChooser, int flags)
@ -50,8 +51,8 @@ public:
auto currentFileOrDirectory = owner.startingFile;
UIDocumentPickerMode pickerMode = currentFileOrDirectory.existsAsFile()
? UIDocumentPickerModeExportToService
: UIDocumentPickerModeMoveToService;
? UIDocumentPickerModeExportToService
: UIDocumentPickerModeMoveToService;
if (! currentFileOrDirectory.existsAsFile())
{

View file

@ -51,7 +51,8 @@ static NSMutableArray* createAllowedTypesArray (const StringArray& filters)
//==============================================================================
template <> struct ContainerDeletePolicy<NSSavePanel> { static void destroy (NSObject* o) { [o release]; } };
class FileChooser::Native : public Component, public FileChooser::Pimpl
class FileChooser::Native : public Component,
public FileChooser::Pimpl
{
public:
Native (FileChooser& fileChooser, int flags, FilePreviewComponent* previewComponent)

View file

@ -35,7 +35,8 @@ namespace juce
// not have been created yet when the user deletes JUCE's FileChooser class. If this
// occurs the Win32NativeFileChooser will still have a reference count of 1 and will
// simply delete itself immedietely once the HWND will have been created a while later.
class Win32NativeFileChooser : public ReferenceCountedObject, private Thread
class Win32NativeFileChooser : public ReferenceCountedObject,
private Thread
{
public:
typedef ReferenceCountedObjectPtr<Win32NativeFileChooser> Ptr;
@ -500,7 +501,8 @@ private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Win32NativeFileChooser)
};
class FileChooser::Native : public Component, public FileChooser::Pimpl
class FileChooser::Native : public Component,
public FileChooser::Pimpl
{
public:
@ -509,7 +511,7 @@ public:
nativeFileChooser (new Win32NativeFileChooser (this, flags, previewComp, fileChooser.startingFile,
fileChooser.title, fileChooser.filters))
{
const Rectangle<int> mainMon (Desktop::getInstance().getDisplays().getMainDisplay().userArea);
auto mainMon = Desktop::getInstance().getDisplays().getMainDisplay().userArea;
setBounds (mainMon.getX() + mainMon.getWidth() / 4,
mainMon.getY() + mainMon.getHeight() / 4,
@ -531,12 +533,21 @@ public:
{
SafePointer<Native> safeThis (this);
<<<<<<< Updated upstream
enterModalState (true, ModalCallbackFunction::create(
[safeThis] (int)
{
if (safeThis != nullptr)
safeThis->owner.finished (safeThis->nativeFileChooser->results);
}));
=======
enterModalState (true, ModalCallbackFunction::create (
[safeThis] (int)
{
if (safeThis != nullptr)
safeThis->owner.finished (safeThis->nativeFileChooser->results, true);
}));
>>>>>>> Stashed changes
nativeFileChooser->open (true);
}

View file

@ -419,7 +419,8 @@ private:
};
//==============================================================================
class WebBrowserComponent::Pimpl : private Thread, private CommandReceiver::Responder
class WebBrowserComponent::Pimpl : private Thread,
private CommandReceiver::Responder
{
public:
Pimpl (WebBrowserComponent& parent)

View file

@ -27,7 +27,8 @@
namespace juce
{
struct Spinner : public Component, private Timer
struct Spinner : public Component,
private Timer
{
Spinner() { startTimer (1000 / 50); }
void timerCallback() override { repaint(); }