| @@ -100,7 +100,7 @@ static String getCurrentDefaultAudioDeviceName (AudioDeviceManager& deviceManage | |||||
| AudioDeviceManager& getSharedAudioDeviceManager (int numInputChannels, int numOutputChannels) | AudioDeviceManager& getSharedAudioDeviceManager (int numInputChannels, int numOutputChannels) | ||||
| { | { | ||||
| if (sharedAudioDeviceManager == nullptr) | if (sharedAudioDeviceManager == nullptr) | ||||
| sharedAudioDeviceManager = new AudioDeviceManager(); | |||||
| sharedAudioDeviceManager.reset (new AudioDeviceManager()); | |||||
| auto* currentDevice = sharedAudioDeviceManager->getCurrentAudioDevice(); | auto* currentDevice = sharedAudioDeviceManager->getCurrentAudioDevice(); | ||||
| @@ -95,7 +95,7 @@ public: | |||||
| return; | return; | ||||
| #endif | #endif | ||||
| mainWindow = new MainAppWindow (getApplicationName()); | |||||
| mainWindow.reset (new MainAppWindow (getApplicationName())); | |||||
| } | } | ||||
| void backButtonPressed() override { mainWindow->getMainComponent().getSidePanel().showOrHide (false); } | void backButtonPressed() override { mainWindow->getMainComponent().getSidePanel().showOrHide (false); } | ||||
| @@ -131,7 +131,7 @@ private: | |||||
| setVisible (true); | setVisible (true); | ||||
| #if JUCE_WINDOWS || JUCE_LINUX || JUCE_MAC | #if JUCE_WINDOWS || JUCE_LINUX || JUCE_MAC | ||||
| taskbarIcon = new DemoTaskbarComponent(); | |||||
| taskbarIcon.reset (new DemoTaskbarComponent()); | |||||
| #endif | #endif | ||||
| } | } | ||||
| @@ -45,7 +45,7 @@ struct DemoContent : public Component | |||||
| if (comp != nullptr) | if (comp != nullptr) | ||||
| { | { | ||||
| addAndMakeVisible (comp); | |||||
| addAndMakeVisible (comp.get()); | |||||
| resized(); | resized(); | ||||
| } | } | ||||
| } | } | ||||
| @@ -105,10 +105,12 @@ DemoContentComponent::DemoContentComponent (Component& mainComponent, std::funct | |||||
| : TabbedComponent (TabbedButtonBar::Orientation::TabsAtTop), | : TabbedComponent (TabbedButtonBar::Orientation::TabsAtTop), | ||||
| demoChangedCallback (callback) | demoChangedCallback (callback) | ||||
| { | { | ||||
| addTab ("Demo", Colours::transparentBlack, demoContent = new DemoContent(), false); | |||||
| demoContent.reset (new DemoContent()); | |||||
| addTab ("Demo", Colours::transparentBlack, demoContent.get(), false); | |||||
| #if ! (JUCE_ANDROID || JUCE_IOS) | #if ! (JUCE_ANDROID || JUCE_IOS) | ||||
| addTab ("Code", Colours::transparentBlack, codeContent = new CodeContent(), false); | |||||
| codeContent.reset (new CodeContent()); | |||||
| addTab ("Code", Colours::transparentBlack, codeContent.get(), false); | |||||
| #endif | #endif | ||||
| addTab ("Settings", Colours::transparentBlack, new SettingsContent (dynamic_cast<MainComponent&> (mainComponent)), true); | addTab ("Settings", Colours::transparentBlack, new SettingsContent (dynamic_cast<MainComponent&> (mainComponent)), true); | ||||
| @@ -243,7 +243,7 @@ private: | |||||
| //============================================================================== | //============================================================================== | ||||
| MainComponent::MainComponent() | MainComponent::MainComponent() | ||||
| { | { | ||||
| contentComponent = new DemoContentComponent (*this, [this] (bool isHeavyweight) | |||||
| contentComponent.reset (new DemoContentComponent (*this, [this] (bool isHeavyweight) | |||||
| { | { | ||||
| #if (JUCE_ANDROID || JUCE_IOS) | #if (JUCE_ANDROID || JUCE_IOS) | ||||
| demosPanel.showOrHide (false); | demosPanel.showOrHide (false); | ||||
| @@ -260,12 +260,12 @@ MainComponent::MainComponent() | |||||
| isShowingHeavyweightDemo = isHeavyweight; | isShowingHeavyweightDemo = isHeavyweight; | ||||
| resized(); | resized(); | ||||
| }); | |||||
| })); | |||||
| demosPanel.setContent (new DemoList (*contentComponent)); | demosPanel.setContent (new DemoList (*contentComponent)); | ||||
| demosPanel.setTitleBarComponent (new SidePanelHeader (*this), true); | demosPanel.setTitleBarComponent (new SidePanelHeader (*this), true); | ||||
| addAndMakeVisible (contentComponent); | |||||
| addAndMakeVisible (contentComponent.get()); | |||||
| addAndMakeVisible (showDemosButton); | addAndMakeVisible (showDemosButton); | ||||
| addAndMakeVisible (demosPanel); | addAndMakeVisible (demosPanel); | ||||
| @@ -98,8 +98,9 @@ private: | |||||
| rendererLabel.setJustificationType (Justification::centredRight); | rendererLabel.setJustificationType (Justification::centredRight); | ||||
| rendererLabel.attachToComponent (&rendererSelector, true); | rendererLabel.attachToComponent (&rendererSelector, true); | ||||
| addAndMakeVisible (audioSettings = new AudioDeviceSelectorComponent (getSharedAudioDeviceManager(), | |||||
| 0, 256, 0, 256, true, true, true, false)); | |||||
| audioSettings.reset (new AudioDeviceSelectorComponent (getSharedAudioDeviceManager(), | |||||
| 0, 256, 0, 256, true, true, true, false)); | |||||
| addAndMakeVisible (audioSettings.get()); | |||||
| audioSettings->setItemHeight (itemHeight); | audioSettings->setItemHeight (itemHeight); | ||||
| setOpaque (true); | setOpaque (true); | ||||
| @@ -49,25 +49,25 @@ | |||||
| <MODULEPATH id="juce_audio_utils" path="../../modules"/> | <MODULEPATH id="juce_audio_utils" path="../../modules"/> | ||||
| </MODULEPATHS> | </MODULEPATHS> | ||||
| </XCODE_IPHONE> | </XCODE_IPHONE> | ||||
| <VS2015 targetFolder="Builds/VisualStudio2015" extraCompilerFlags=""> | |||||
| <VS2017 targetFolder="Builds/VisualStudio2017"> | |||||
| <CONFIGURATIONS> | <CONFIGURATIONS> | ||||
| <CONFIGURATION name="Debug" isDebug="1" targetName="AudioPerformanceTest"/> | |||||
| <CONFIGURATION name="Release" isDebug="0" targetName="AudioPerformanceTest"/> | |||||
| <CONFIGURATION isDebug="1" name="Debug"/> | |||||
| <CONFIGURATION isDebug="0" name="Release"/> | |||||
| </CONFIGURATIONS> | </CONFIGURATIONS> | ||||
| <MODULEPATHS> | <MODULEPATHS> | ||||
| <MODULEPATH id="juce_core" path="../../modules"/> | |||||
| <MODULEPATH id="juce_events" path="../../modules"/> | |||||
| <MODULEPATH id="juce_gui_extra" path="../../modules"/> | |||||
| <MODULEPATH id="juce_gui_basics" path="../../modules"/> | |||||
| <MODULEPATH id="juce_graphics" path="../../modules"/> | <MODULEPATH id="juce_graphics" path="../../modules"/> | ||||
| <MODULEPATH id="juce_events" path="../../modules"/> | |||||
| <MODULEPATH id="juce_data_structures" path="../../modules"/> | <MODULEPATH id="juce_data_structures" path="../../modules"/> | ||||
| <MODULEPATH id="juce_gui_basics" path="../../modules"/> | |||||
| <MODULEPATH id="juce_gui_extra" path="../../modules"/> | |||||
| <MODULEPATH id="juce_audio_basics" path="../../modules"/> | |||||
| <MODULEPATH id="juce_audio_devices" path="../../modules"/> | |||||
| <MODULEPATH id="juce_audio_formats" path="../../modules"/> | |||||
| <MODULEPATH id="juce_audio_processors" path="../../modules"/> | |||||
| <MODULEPATH id="juce_core" path="../../modules"/> | |||||
| <MODULEPATH id="juce_audio_utils" path="../../modules"/> | <MODULEPATH id="juce_audio_utils" path="../../modules"/> | ||||
| <MODULEPATH id="juce_audio_processors" path="../../modules"/> | |||||
| <MODULEPATH id="juce_audio_formats" path="../../modules"/> | |||||
| <MODULEPATH id="juce_audio_devices" path="../../modules"/> | |||||
| <MODULEPATH id="juce_audio_basics" path="../../modules"/> | |||||
| </MODULEPATHS> | </MODULEPATHS> | ||||
| </VS2015> | |||||
| </VS2017> | |||||
| <LINUX_MAKE targetFolder="Builds/LinuxMakefile" extraCompilerFlags=""> | <LINUX_MAKE targetFolder="Builds/LinuxMakefile" extraCompilerFlags=""> | ||||
| <CONFIGURATIONS> | <CONFIGURATIONS> | ||||
| <CONFIGURATION name="Debug" libraryPath="/usr/X11R6/lib/" isDebug="1" targetName="AudioPerformanceTest"/> | <CONFIGURATION name="Debug" libraryPath="/usr/X11R6/lib/" isDebug="1" targetName="AudioPerformanceTest"/> | ||||
| @@ -0,0 +1,20 @@ | |||||
| Microsoft Visual Studio Solution File, Format Version 11.00 | |||||
| # Visual Studio 2017 | |||||
| Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AudioPerformanceTest - App", "AudioPerformanceTest_App.vcxproj", "{78607AE9-F43B-3DDB-0FE1-D745771AF527}" | |||||
| EndProject | |||||
| Global | |||||
| GlobalSection(SolutionConfigurationPlatforms) = preSolution | |||||
| Debug|x64 = Debug|x64 | |||||
| Release|x64 = Release|x64 | |||||
| EndGlobalSection | |||||
| GlobalSection(ProjectConfigurationPlatforms) = postSolution | |||||
| {78607AE9-F43B-3DDB-0FE1-D745771AF527}.Debug|x64.ActiveCfg = Debug|x64 | |||||
| {78607AE9-F43B-3DDB-0FE1-D745771AF527}.Debug|x64.Build.0 = Debug|x64 | |||||
| {78607AE9-F43B-3DDB-0FE1-D745771AF527}.Release|x64.ActiveCfg = Release|x64 | |||||
| {78607AE9-F43B-3DDB-0FE1-D745771AF527}.Release|x64.Build.0 = Release|x64 | |||||
| EndGlobalSection | |||||
| GlobalSection(SolutionProperties) = preSolution | |||||
| HideSolutionNode = FALSE | |||||
| EndGlobalSection | |||||
| EndGlobal | |||||
| @@ -0,0 +1,31 @@ | |||||
| #ifdef JUCE_USER_DEFINED_RC_FILE | |||||
| #include JUCE_USER_DEFINED_RC_FILE | |||||
| #else | |||||
| #undef WIN32_LEAN_AND_MEAN | |||||
| #define WIN32_LEAN_AND_MEAN | |||||
| #include <windows.h> | |||||
| VS_VERSION_INFO VERSIONINFO | |||||
| FILEVERSION 1,0,0,0 | |||||
| BEGIN | |||||
| BLOCK "StringFileInfo" | |||||
| BEGIN | |||||
| BLOCK "040904E4" | |||||
| BEGIN | |||||
| VALUE "CompanyName", "ROLI Ltd.\0" | |||||
| VALUE "LegalCopyright", "ROLI Ltd.\0" | |||||
| VALUE "FileDescription", "AudioPerformanceTest\0" | |||||
| VALUE "FileVersion", "1.0.0\0" | |||||
| VALUE "ProductName", "AudioPerformanceTest\0" | |||||
| VALUE "ProductVersion", "1.0.0\0" | |||||
| END | |||||
| END | |||||
| BLOCK "VarFileInfo" | |||||
| BEGIN | |||||
| VALUE "Translation", 0x409, 1252 | |||||
| END | |||||
| END | |||||
| #endif | |||||
| @@ -43,7 +43,7 @@ public: | |||||
| //============================================================================== | //============================================================================== | ||||
| void initialise (const String&) override | void initialise (const String&) override | ||||
| { | { | ||||
| mainWindow = new MainWindow (getApplicationName()); | |||||
| mainWindow.reset (new MainWindow (getApplicationName())); | |||||
| } | } | ||||
| void shutdown() override | void shutdown() override | ||||
| @@ -448,10 +448,16 @@ FilterIOConfigurationWindow::FilterIOConfigurationWindow (AudioProcessor& p) | |||||
| } | } | ||||
| if (p.getBusCount (true) > 0 || p.canAddBus (true)) | if (p.getBusCount (true) > 0 || p.canAddBus (true)) | ||||
| addAndMakeVisible (inConfig = new InputOutputConfig (*this, true)); | |||||
| { | |||||
| inConfig.reset (new InputOutputConfig (*this, true)); | |||||
| addAndMakeVisible (inConfig.get()); | |||||
| } | |||||
| if (p.getBusCount (false) > 0 || p.canAddBus (false)) | if (p.getBusCount (false) > 0 || p.canAddBus (false)) | ||||
| addAndMakeVisible (outConfig = new InputOutputConfig (*this, false)); | |||||
| { | |||||
| outConfig.reset (new InputOutputConfig (*this, false)); | |||||
| addAndMakeVisible (outConfig.get()); | |||||
| } | |||||
| currentLayout = p.getBusesLayout(); | currentLayout = p.getBusesLayout(); | ||||
| setSize (400, (inConfig != nullptr && outConfig != nullptr ? 160 : 0) + 200); | setSize (400, (inConfig != nullptr && outConfig != nullptr ? 160 : 0) + 200); | ||||
| @@ -48,7 +48,7 @@ private: | |||||
| Label title; | Label title; | ||||
| ScopedPointer<InputOutputConfig> inConfig, outConfig; | ScopedPointer<InputOutputConfig> inConfig, outConfig; | ||||
| InputOutputConfig* getConfig (bool isInput) noexcept { return isInput ? inConfig : outConfig; } | |||||
| InputOutputConfig* getConfig (bool isInput) noexcept { return isInput ? inConfig.get() : outConfig.get(); } | |||||
| void update(); | void update(); | ||||
| MainHostWindow* getMainWindow() const; | MainHostWindow* getMainWindow() const; | ||||
| @@ -49,14 +49,14 @@ public: | |||||
| options.filenameSuffix = "settings"; | options.filenameSuffix = "settings"; | ||||
| options.osxLibrarySubFolder = "Preferences"; | options.osxLibrarySubFolder = "Preferences"; | ||||
| appProperties = new ApplicationProperties(); | |||||
| appProperties.reset (new ApplicationProperties()); | |||||
| appProperties->setStorageParameters (options); | appProperties->setStorageParameters (options); | ||||
| mainWindow = new MainHostWindow(); | |||||
| mainWindow.reset (new MainHostWindow()); | |||||
| mainWindow->setUsingNativeTitleBar (true); | mainWindow->setUsingNativeTitleBar (true); | ||||
| commandManager.registerAllCommandsForTarget (this); | commandManager.registerAllCommandsForTarget (this); | ||||
| commandManager.registerAllCommandsForTarget (mainWindow); | |||||
| commandManager.registerAllCommandsForTarget (mainWindow.get()); | |||||
| mainWindow->menuItemsChanged(); | mainWindow->menuItemsChanged(); | ||||
| @@ -57,8 +57,8 @@ | |||||
| auto deadMansPedalFile = getAppProperties().getUserSettings() | auto deadMansPedalFile = getAppProperties().getUserSettings() | ||||
| ->getFile().getSiblingFile ("RecentlyCrashedPluginsList"); | ->getFile().getSiblingFile ("RecentlyCrashedPluginsList"); | ||||
| scanner = new PluginDirectoryScanner (knownPluginList, formatToScan, paths, | |||||
| true, deadMansPedalFile, true); | |||||
| scanner.reset (new PluginDirectoryScanner (knownPluginList, formatToScan, paths, | |||||
| true, deadMansPedalFile, true)); | |||||
| for (int i = 5; --i >= 0;) | for (int i = 5; --i >= 0;) | ||||
| pool.addJob (new ScanJob (*this), true); | pool.addJob (new ScanJob (*this), true); | ||||
| @@ -399,7 +399,7 @@ struct GraphEditorPanel::FilterComponent : public Component, | |||||
| void showPopupMenu() | void showPopupMenu() | ||||
| { | { | ||||
| menu = new PopupMenu; | |||||
| menu.reset (new PopupMenu); | |||||
| menu->addItem (1, "Delete this filter"); | menu->addItem (1, "Delete this filter"); | ||||
| menu->addItem (2, "Disconnect all pins"); | menu->addItem (2, "Disconnect all pins"); | ||||
| menu->addItem (3, "Toggle Bypass"); | menu->addItem (3, "Toggle Bypass"); | ||||
| @@ -820,7 +820,7 @@ void GraphEditorPanel::updateComponents() | |||||
| void GraphEditorPanel::showPopupMenu (Point<int> mousePos) | void GraphEditorPanel::showPopupMenu (Point<int> mousePos) | ||||
| { | { | ||||
| menu = new PopupMenu; | |||||
| menu.reset (new PopupMenu); | |||||
| if (auto* mainWindow = findParentComponentOfClass<MainHostWindow>()) | if (auto* mainWindow = findParentComponentOfClass<MainHostWindow>()) | ||||
| { | { | ||||
| @@ -842,15 +842,15 @@ void GraphEditorPanel::beginConnectorDrag (AudioProcessorGraph::NodeAndChannel s | |||||
| { | { | ||||
| auto* c = dynamic_cast<ConnectorComponent*> (e.originalComponent); | auto* c = dynamic_cast<ConnectorComponent*> (e.originalComponent); | ||||
| connectors.removeObject (c, false); | connectors.removeObject (c, false); | ||||
| draggingConnector = c; | |||||
| draggingConnector.reset (c); | |||||
| if (draggingConnector == nullptr) | if (draggingConnector == nullptr) | ||||
| draggingConnector = new ConnectorComponent (*this); | |||||
| draggingConnector.reset (new ConnectorComponent (*this)); | |||||
| draggingConnector->setInput (source); | draggingConnector->setInput (source); | ||||
| draggingConnector->setOutput (dest); | draggingConnector->setOutput (dest); | ||||
| addAndMakeVisible (draggingConnector); | |||||
| addAndMakeVisible (draggingConnector.get()); | |||||
| draggingConnector->toFront (false); | draggingConnector->toFront (false); | ||||
| dragConnector (e); | dragConnector (e); | ||||
| @@ -1148,31 +1148,37 @@ GraphDocumentComponent::GraphDocumentComponent (AudioPluginFormatManager& fm, | |||||
| { | { | ||||
| init(); | init(); | ||||
| deviceManager.addChangeListener (graphPanel); | |||||
| deviceManager.addChangeListener (graphPanel.get()); | |||||
| deviceManager.addAudioCallback (&graphPlayer); | deviceManager.addAudioCallback (&graphPlayer); | ||||
| deviceManager.addMidiInputCallback (String(), &graphPlayer.getMidiMessageCollector()); | deviceManager.addMidiInputCallback (String(), &graphPlayer.getMidiMessageCollector()); | ||||
| } | } | ||||
| void GraphDocumentComponent::init() | void GraphDocumentComponent::init() | ||||
| { | { | ||||
| addAndMakeVisible (graphPanel = new GraphEditorPanel (*graph)); | |||||
| graphPanel.reset (new GraphEditorPanel (*graph)); | |||||
| addAndMakeVisible (graphPanel.get()); | |||||
| graphPlayer.setProcessor (&graph->graph); | graphPlayer.setProcessor (&graph->graph); | ||||
| keyState.addListener (&graphPlayer.getMidiMessageCollector()); | keyState.addListener (&graphPlayer.getMidiMessageCollector()); | ||||
| addAndMakeVisible (keyboardComp = new MidiKeyboardComponent (keyState, MidiKeyboardComponent::horizontalKeyboard)); | |||||
| addAndMakeVisible (statusBar = new TooltipBar()); | |||||
| keyboardComp.reset (new MidiKeyboardComponent (keyState, MidiKeyboardComponent::horizontalKeyboard)); | |||||
| addAndMakeVisible (keyboardComp.get()); | |||||
| statusBar.reset (new TooltipBar()); | |||||
| addAndMakeVisible (statusBar.get()); | |||||
| graphPanel->updateComponents(); | graphPanel->updateComponents(); | ||||
| if (isOnTouchDevice()) | if (isOnTouchDevice()) | ||||
| { | { | ||||
| if (isOnTouchDevice()) | if (isOnTouchDevice()) | ||||
| addAndMakeVisible (titleBarComponent = new TitleBarComponent (*this)); | |||||
| { | |||||
| titleBarComponent.reset (new TitleBarComponent (*this)); | |||||
| addAndMakeVisible (titleBarComponent.get()); | |||||
| } | |||||
| pluginListBoxModel = new PluginListBoxModel (pluginListBox, pluginList); | |||||
| pluginListBoxModel.reset (new PluginListBoxModel (pluginListBox, pluginList)); | |||||
| pluginListBox.setModel (pluginListBoxModel); | |||||
| pluginListBox.setModel (pluginListBoxModel.get()); | |||||
| pluginListBox.setRowHeight (40); | pluginListBox.setRowHeight (40); | ||||
| pluginListSidePanel.setContent (&pluginListBox, false); | pluginListSidePanel.setContent (&pluginListBox, false); | ||||
| @@ -1230,7 +1236,7 @@ void GraphDocumentComponent::releaseGraph() | |||||
| if (graphPanel != nullptr) | if (graphPanel != nullptr) | ||||
| { | { | ||||
| deviceManager.removeChangeListener (graphPanel); | |||||
| deviceManager.removeChangeListener (graphPanel.get()); | |||||
| graphPanel = nullptr; | graphPanel = nullptr; | ||||
| } | } | ||||
| @@ -87,7 +87,7 @@ MainHostWindow::MainHostWindow() | |||||
| ScopedPointer<XmlElement> savedAudioState (getAppProperties().getUserSettings() | ScopedPointer<XmlElement> savedAudioState (getAppProperties().getUserSettings() | ||||
| ->getXmlValue ("audioDeviceState")); | ->getXmlValue ("audioDeviceState")); | ||||
| safeThis->deviceManager.initialise (granted ? 256 : 0, 256, savedAudioState, true); | |||||
| safeThis->deviceManager.initialise (granted ? 256 : 0, 256, savedAudioState.get(), true); | |||||
| }); | }); | ||||
| #if JUCE_IOS || JUCE_ANDROID | #if JUCE_IOS || JUCE_ANDROID | ||||
| @@ -98,9 +98,9 @@ MainHostWindow::MainHostWindow() | |||||
| centreWithSize (800, 600); | centreWithSize (800, 600); | ||||
| #endif | #endif | ||||
| graphHolder = new GraphDocumentComponent (formatManager, deviceManager, knownPluginList); | |||||
| graphHolder.reset (new GraphDocumentComponent (formatManager, deviceManager, knownPluginList)); | |||||
| setContentNonOwned (graphHolder, false); | |||||
| setContentNonOwned (graphHolder.get(), false); | |||||
| restoreWindowStateFromString (getAppProperties().getUserSettings()->getValue ("mainWindowPos")); | restoreWindowStateFromString (getAppProperties().getUserSettings()->getValue ("mainWindowPos")); | ||||
| @@ -224,11 +224,11 @@ void MainHostWindow::changeListenerCallback (ChangeBroadcaster* changed) | |||||
| if (savedPluginList != nullptr) | if (savedPluginList != nullptr) | ||||
| { | { | ||||
| getAppProperties().getUserSettings()->setValue ("pluginList", savedPluginList); | |||||
| getAppProperties().getUserSettings()->setValue ("pluginList", savedPluginList.get()); | |||||
| getAppProperties().saveIfNeeded(); | getAppProperties().saveIfNeeded(); | ||||
| } | } | ||||
| } | } | ||||
| else if (graphHolder != nullptr && changed == graphHolder->graph) | |||||
| else if (graphHolder != nullptr && changed == graphHolder->graph.get()) | |||||
| { | { | ||||
| auto title = JUCEApplication::getInstance()->getApplicationName(); | auto title = JUCEApplication::getInstance()->getApplicationName(); | ||||
| auto f = graphHolder->graph->getFile(); | auto f = graphHolder->graph->getFile(); | ||||
| @@ -506,7 +506,7 @@ bool MainHostWindow::perform (const InvocationInfo& info) | |||||
| case CommandIDs::showPluginListEditor: | case CommandIDs::showPluginListEditor: | ||||
| if (pluginListWindow == nullptr) | if (pluginListWindow == nullptr) | ||||
| pluginListWindow = new PluginListWindow (*this, formatManager); | |||||
| pluginListWindow.reset (new PluginListWindow (*this, formatManager)); | |||||
| pluginListWindow->toFront (true); | pluginListWindow->toFront (true); | ||||
| break; | break; | ||||
| @@ -579,7 +579,7 @@ void MainHostWindow::showAudioSettings() | |||||
| { | { | ||||
| ScopedPointer<XmlElement> audioState (safeThis->deviceManager.createStateXml()); | ScopedPointer<XmlElement> audioState (safeThis->deviceManager.createStateXml()); | ||||
| getAppProperties().getUserSettings()->setValue ("audioDeviceState", audioState); | |||||
| getAppProperties().getUserSettings()->setValue ("audioDeviceState", audioState.get()); | |||||
| getAppProperties().getUserSettings()->saveIfNeeded(); | getAppProperties().getUserSettings()->saveIfNeeded(); | ||||
| if (safeThis->graphHolder != nullptr) | if (safeThis->graphHolder != nullptr) | ||||
| @@ -81,7 +81,7 @@ static int addFile (const File& file, | |||||
| cppStream << "const char* " << classname << "::" << name | cppStream << "const char* " << classname << "::" << name | ||||
| << " = (const char*) temp" << tempNum << ";\r\n\r\n"; | << " = (const char*) temp" << tempNum << ";\r\n\r\n"; | ||||
| return mb.getSize(); | |||||
| return (int) mb.getSize(); | |||||
| } | } | ||||
| static bool isHiddenFile (const File& f, const File& root) | static bool isHiddenFile (const File& f, const File& root) | ||||
| @@ -85,7 +85,7 @@ struct BackgroundLogo : public AnimatedContent | |||||
| )blahblah"; | )blahblah"; | ||||
| ScopedPointer<XmlElement> svg (XmlDocument::parse (logoData)); | ScopedPointer<XmlElement> svg (XmlDocument::parse (logoData)); | ||||
| logo = Drawable::createFromSVG (*svg); | |||||
| logo.reset (Drawable::createFromSVG (*svg)); | |||||
| } | } | ||||
| String getName() const override { return "Background Image"; } | String getName() const override { return "Background Image"; } | ||||
| @@ -205,18 +205,18 @@ struct FlockDemo : public BackgroundLogo | |||||
| { | { | ||||
| Bird() | Bird() | ||||
| { | { | ||||
| Random rng; | |||||
| pos.x = rng.nextFloat() * 10.0f - 5.0f; | |||||
| pos.y = rng.nextFloat() * 10.0f - 5.0f; | |||||
| velocity.x = rng.nextFloat() * 0.001f; | |||||
| velocity.y = rng.nextFloat() * 0.001f; | |||||
| Random randGen; | |||||
| pos.x = randGen.nextFloat() * 10.0f - 5.0f; | |||||
| pos.y = randGen.nextFloat() * 10.0f - 5.0f; | |||||
| velocity.x = randGen.nextFloat() * 0.001f; | |||||
| velocity.y = randGen.nextFloat() * 0.001f; | |||||
| colour = Colour::fromHSV (rng.nextFloat(), 0.2f, 0.9f, rng.nextFloat() * 0.4f + 0.2f); | |||||
| colour = Colour::fromHSV (randGen.nextFloat(), 0.2f, 0.9f, randGen.nextFloat() * 0.4f + 0.2f); | |||||
| shape.addTriangle (0.0f, 0.0f, -0.3f, 1.0f, 0.3f, 1.0f); | shape.addTriangle (0.0f, 0.0f, -0.3f, 1.0f, 0.3f, 1.0f); | ||||
| shape = shape.createPathWithRoundedCorners (0.2f); | shape = shape.createPathWithRoundedCorners (0.2f); | ||||
| shape.applyTransform (AffineTransform::scale (rng.nextFloat() + 1.0f)); | |||||
| shape.applyTransform (AffineTransform::scale (randGen.nextFloat() + 1.0f)); | |||||
| } | } | ||||
| Point<float> pos, velocity, acc; | Point<float> pos, velocity, acc; | ||||
| @@ -410,8 +410,8 @@ struct FlockWithText : public FlockDemo | |||||
| as.append (text, Font (textSize * scale), Colour (0x80ffffff).withMultipliedAlpha (alpha)); | as.append (text, Font (textSize * scale), Colour (0x80ffffff).withMultipliedAlpha (alpha)); | ||||
| as.setJustification (Justification::centred); | as.setJustification (Justification::centred); | ||||
| auto centre = canvas.clients[clientIndex % canvas.clients.size()].centre * scale; | |||||
| as.draw (g, Rectangle<float> (textBlockWidth * scale, textBlockWidth * scale).withCentre (centre)); | |||||
| auto middle = canvas.clients[clientIndex % canvas.clients.size()].centre * scale; | |||||
| as.draw (g, Rectangle<float> (textBlockWidth * scale, textBlockWidth * scale).withCentre (middle)); | |||||
| } | } | ||||
| void tick() | void tick() | ||||
| @@ -42,8 +42,8 @@ struct MasterContentComponent : public Component, | |||||
| createAllDemos (demos); | createAllDemos (demos); | ||||
| setContent (0); | setContent (0); | ||||
| setSize (15.0f * currentCanvas.getLimits().getWidth(), | |||||
| 15.0f * currentCanvas.getLimits().getHeight()); | |||||
| setSize ((int) (15.0f * currentCanvas.getLimits().getWidth()), | |||||
| (int) (15.0f * currentCanvas.getLimits().getHeight())); | |||||
| if (! OSCSender::connect (getBroadcastIPAddress(), masterPortNumber)) | if (! OSCSender::connect (getBroadcastIPAddress(), masterPortNumber)) | ||||
| error = "Master app OSC sender: network connection error."; | error = "Master app OSC sender: network connection error."; | ||||
| @@ -64,7 +64,8 @@ public: | |||||
| if (showCheckbox) | if (showCheckbox) | ||||
| { | { | ||||
| addAndMakeVisible (shareApplicationUsageDataToggle = new ToggleButton()); | |||||
| shareApplicationUsageDataToggle.reset (new ToggleButton()); | |||||
| addAndMakeVisible (shareApplicationUsageDataToggle.get()); | |||||
| auto* controller = ProjucerApplication::getApp().licenseController.get(); | auto* controller = ProjucerApplication::getApp().licenseController.get(); | ||||
| @@ -63,7 +63,8 @@ class PIPCreatorWindowComponent : public Component, | |||||
| public: | public: | ||||
| PIPCreatorWindowComponent() | PIPCreatorWindowComponent() | ||||
| { | { | ||||
| setLookAndFeel (lf = new PIPCreatorLookAndFeel()); | |||||
| lf.reset (new PIPCreatorLookAndFeel()); | |||||
| setLookAndFeel (lf.get()); | |||||
| addAndMakeVisible (propertyViewport); | addAndMakeVisible (propertyViewport); | ||||
| propertyViewport.setViewedComponent (&propertyGroup, false); | propertyViewport.setViewedComponent (&propertyGroup, false); | ||||
| @@ -163,11 +163,13 @@ public: | |||||
| dragOver = false; | dragOver = false; | ||||
| repaint(); | repaint(); | ||||
| if (ScopedPointer<XmlElement> e = XmlDocument::parse (File (files[0]))) | |||||
| ScopedPointer<XmlElement> element (XmlDocument::parse (File (files[0]))); | |||||
| if (element != nullptr) | |||||
| { | { | ||||
| if (auto* ePath = e->getChildByName ("path")) | |||||
| if (auto* ePath = element->getChildByName ("path")) | |||||
| userText.setText (ePath->getStringAttribute ("d"), true); | userText.setText (ePath->getStringAttribute ("d"), true); | ||||
| else if (auto* ePolygon = e->getChildByName ("polygon")) | |||||
| else if (auto* ePolygon = element->getChildByName ("polygon")) | |||||
| userText.setText (ePolygon->getStringAttribute ("points"), true); | userText.setText (ePolygon->getStringAttribute ("points"), true); | ||||
| } | } | ||||
| } | } | ||||
| @@ -85,7 +85,7 @@ void ProjucerApplication::initialise (const String& commandLine) | |||||
| isRunningCommandLine = commandLine.isNotEmpty(); | isRunningCommandLine = commandLine.isNotEmpty(); | ||||
| licenseController = new LicenseController; | |||||
| licenseController.reset (new LicenseController); | |||||
| licenseController->addLicenseStatusChangedCallback (this); | licenseController->addLicenseStatusChangedCallback (this); | ||||
| if (isRunningCommandLine) | if (isRunningCommandLine) | ||||
| @@ -111,10 +111,10 @@ void ProjucerApplication::initialise (const String& commandLine) | |||||
| openDocumentManager.registerType (new ProjucerAppClasses::LiveBuildCodeEditorDocument::Type(), 2); | openDocumentManager.registerType (new ProjucerAppClasses::LiveBuildCodeEditorDocument::Type(), 2); | ||||
| childProcessCache = new ChildProcessCache(); | |||||
| childProcessCache.reset (new ChildProcessCache()); | |||||
| initCommandManager(); | initCommandManager(); | ||||
| menuModel = new MainMenuModel(); | |||||
| menuModel.reset (new MainMenuModel()); | |||||
| settings->appearance.refreshPresetSchemeList(); | settings->appearance.refreshPresetSchemeList(); | ||||
| @@ -131,9 +131,9 @@ void ProjucerApplication::initialiseBasics() | |||||
| { | { | ||||
| LookAndFeel::setDefaultLookAndFeel (&lookAndFeel); | LookAndFeel::setDefaultLookAndFeel (&lookAndFeel); | ||||
| settings = new StoredSettings(); | |||||
| settings.reset (new StoredSettings()); | |||||
| ImageCache::setCacheTimeout (30 * 1000); | ImageCache::setCacheTimeout (30 * 1000); | ||||
| icons = new Icons(); | |||||
| icons.reset (new Icons()); | |||||
| tooltipWindow.setMillisecondsBeforeTipAppears (1200); | tooltipWindow.setMillisecondsBeforeTipAppears (1200); | ||||
| } | } | ||||
| @@ -147,10 +147,10 @@ bool ProjucerApplication::initialiseLogger (const char* filePrefix) | |||||
| String folder = "com.juce.projucer"; | String folder = "com.juce.projucer"; | ||||
| #endif | #endif | ||||
| logger = FileLogger::createDateStampedLogger (folder, filePrefix, ".txt", | |||||
| getApplicationName() + " " + getApplicationVersion() | |||||
| + " --- Build date: " __DATE__); | |||||
| Logger::setCurrentLogger (logger); | |||||
| logger.reset (FileLogger::createDateStampedLogger (folder, filePrefix, ".txt", | |||||
| getApplicationName() + " " + getApplicationVersion() | |||||
| + " --- Build date: " __DATE__)); | |||||
| Logger::setCurrentLogger (logger.get()); | |||||
| } | } | ||||
| return logger != nullptr; | return logger != nullptr; | ||||
| @@ -167,10 +167,10 @@ void ProjucerApplication::handleAsyncUpdate() | |||||
| // workaround broken "Open Recent" submenu: not passing the | // workaround broken "Open Recent" submenu: not passing the | ||||
| // submenu's title here avoids the defect in JuceMainMenuHandler::addMenuItem | // submenu's title here avoids the defect in JuceMainMenuHandler::addMenuItem | ||||
| MenuBarModel::setMacMainMenu (menuModel, &extraAppleMenuItems); //, "Open Recent"); | |||||
| MenuBarModel::setMacMainMenu (menuModel.get(), &extraAppleMenuItems); //, "Open Recent"); | |||||
| #endif | #endif | ||||
| versionChecker = new LatestVersionChecker(); | |||||
| versionChecker.reset (new LatestVersionChecker()); | |||||
| if (licenseController != nullptr) | if (licenseController != nullptr) | ||||
| { | { | ||||
| @@ -334,7 +334,7 @@ ProjucerApplication& ProjucerApplication::getApp() | |||||
| ApplicationCommandManager& ProjucerApplication::getCommandManager() | ApplicationCommandManager& ProjucerApplication::getCommandManager() | ||||
| { | { | ||||
| ApplicationCommandManager* cm = ProjucerApplication::getApp().commandManager; | |||||
| auto* cm = ProjucerApplication::getApp().commandManager.get(); | |||||
| jassert (cm != nullptr); | jassert (cm != nullptr); | ||||
| return *cm; | return *cm; | ||||
| } | } | ||||
| @@ -378,11 +378,11 @@ void ProjucerApplication::createMenu (PopupMenu& menu, const String& menuName) | |||||
| void ProjucerApplication::createFileMenu (PopupMenu& menu) | void ProjucerApplication::createFileMenu (PopupMenu& menu) | ||||
| { | { | ||||
| menu.addCommandItem (commandManager, CommandIDs::newProject); | |||||
| menu.addCommandItem (commandManager, CommandIDs::newProjectFromClipboard); | |||||
| menu.addCommandItem (commandManager, CommandIDs::newPIP); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::newProject); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::newProjectFromClipboard); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::newPIP); | |||||
| menu.addSeparator(); | menu.addSeparator(); | ||||
| menu.addCommandItem (commandManager, CommandIDs::open); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::open); | |||||
| { | { | ||||
| PopupMenu recentFiles; | PopupMenu recentFiles; | ||||
| @@ -392,7 +392,7 @@ void ProjucerApplication::createFileMenu (PopupMenu& menu) | |||||
| if (recentFiles.getNumItems() > 0) | if (recentFiles.getNumItems() > 0) | ||||
| { | { | ||||
| recentFiles.addSeparator(); | recentFiles.addSeparator(); | ||||
| recentFiles.addCommandItem (commandManager, CommandIDs::clearRecentFiles); | |||||
| recentFiles.addCommandItem (commandManager.get(), CommandIDs::clearRecentFiles); | |||||
| } | } | ||||
| menu.addSubMenu ("Open Recent", recentFiles); | menu.addSubMenu ("Open Recent", recentFiles); | ||||
| @@ -406,58 +406,58 @@ void ProjucerApplication::createFileMenu (PopupMenu& menu) | |||||
| } | } | ||||
| menu.addSeparator(); | menu.addSeparator(); | ||||
| menu.addCommandItem (commandManager, CommandIDs::closeDocument); | |||||
| menu.addCommandItem (commandManager, CommandIDs::saveDocument); | |||||
| menu.addCommandItem (commandManager, CommandIDs::saveDocumentAs); | |||||
| menu.addCommandItem (commandManager, CommandIDs::saveAll); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::closeDocument); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::saveDocument); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::saveDocumentAs); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::saveAll); | |||||
| menu.addSeparator(); | menu.addSeparator(); | ||||
| menu.addCommandItem (commandManager, CommandIDs::closeProject); | |||||
| menu.addCommandItem (commandManager, CommandIDs::saveProject); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::closeProject); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::saveProject); | |||||
| menu.addSeparator(); | menu.addSeparator(); | ||||
| menu.addCommandItem (commandManager, CommandIDs::openInIDE); | |||||
| menu.addCommandItem (commandManager, CommandIDs::saveAndOpenInIDE); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::openInIDE); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::saveAndOpenInIDE); | |||||
| menu.addSeparator(); | menu.addSeparator(); | ||||
| #if ! JUCER_ENABLE_GPL_MODE | #if ! JUCER_ENABLE_GPL_MODE | ||||
| menu.addCommandItem (commandManager, CommandIDs::loginLogout); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::loginLogout); | |||||
| #endif | #endif | ||||
| #if ! JUCE_MAC | #if ! JUCE_MAC | ||||
| menu.addCommandItem (commandManager, CommandIDs::showAboutWindow); | |||||
| menu.addCommandItem (commandManager, CommandIDs::showAppUsageWindow); | |||||
| menu.addCommandItem (commandManager, CommandIDs::showGlobalPathsWindow); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::showAboutWindow); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::showAppUsageWindow); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::showGlobalPathsWindow); | |||||
| menu.addSeparator(); | menu.addSeparator(); | ||||
| menu.addCommandItem (commandManager, StandardApplicationCommandIDs::quit); | |||||
| menu.addCommandItem (commandManager.get(), StandardApplicationCommandIDs::quit); | |||||
| #endif | #endif | ||||
| } | } | ||||
| void ProjucerApplication::createEditMenu (PopupMenu& menu) | void ProjucerApplication::createEditMenu (PopupMenu& menu) | ||||
| { | { | ||||
| menu.addCommandItem (commandManager, StandardApplicationCommandIDs::undo); | |||||
| menu.addCommandItem (commandManager, StandardApplicationCommandIDs::redo); | |||||
| menu.addCommandItem (commandManager.get(), StandardApplicationCommandIDs::undo); | |||||
| menu.addCommandItem (commandManager.get(), StandardApplicationCommandIDs::redo); | |||||
| menu.addSeparator(); | menu.addSeparator(); | ||||
| menu.addCommandItem (commandManager, StandardApplicationCommandIDs::cut); | |||||
| menu.addCommandItem (commandManager, StandardApplicationCommandIDs::copy); | |||||
| menu.addCommandItem (commandManager, StandardApplicationCommandIDs::paste); | |||||
| menu.addCommandItem (commandManager, StandardApplicationCommandIDs::del); | |||||
| menu.addCommandItem (commandManager, StandardApplicationCommandIDs::selectAll); | |||||
| menu.addCommandItem (commandManager, StandardApplicationCommandIDs::deselectAll); | |||||
| menu.addCommandItem (commandManager.get(), StandardApplicationCommandIDs::cut); | |||||
| menu.addCommandItem (commandManager.get(), StandardApplicationCommandIDs::copy); | |||||
| menu.addCommandItem (commandManager.get(), StandardApplicationCommandIDs::paste); | |||||
| menu.addCommandItem (commandManager.get(), StandardApplicationCommandIDs::del); | |||||
| menu.addCommandItem (commandManager.get(), StandardApplicationCommandIDs::selectAll); | |||||
| menu.addCommandItem (commandManager.get(), StandardApplicationCommandIDs::deselectAll); | |||||
| menu.addSeparator(); | menu.addSeparator(); | ||||
| menu.addCommandItem (commandManager, CommandIDs::showFindPanel); | |||||
| menu.addCommandItem (commandManager, CommandIDs::findSelection); | |||||
| menu.addCommandItem (commandManager, CommandIDs::findNext); | |||||
| menu.addCommandItem (commandManager, CommandIDs::findPrevious); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::showFindPanel); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::findSelection); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::findNext); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::findPrevious); | |||||
| } | } | ||||
| void ProjucerApplication::createViewMenu (PopupMenu& menu) | void ProjucerApplication::createViewMenu (PopupMenu& menu) | ||||
| { | { | ||||
| menu.addCommandItem (commandManager, CommandIDs::showProjectSettings); | |||||
| menu.addCommandItem (commandManager, CommandIDs::showProjectTab); | |||||
| menu.addCommandItem (commandManager, CommandIDs::showBuildTab); | |||||
| menu.addCommandItem (commandManager, CommandIDs::showFileExplorerPanel); | |||||
| menu.addCommandItem (commandManager, CommandIDs::showModulesPanel); | |||||
| menu.addCommandItem (commandManager, CommandIDs::showExportersPanel); | |||||
| menu.addCommandItem (commandManager, CommandIDs::showExporterSettings); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::showProjectSettings); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::showProjectTab); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::showBuildTab); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::showFileExplorerPanel); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::showModulesPanel); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::showExportersPanel); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::showExporterSettings); | |||||
| menu.addSeparator(); | menu.addSeparator(); | ||||
| createColourSchemeItems (menu); | createColourSchemeItems (menu); | ||||
| @@ -465,19 +465,19 @@ void ProjucerApplication::createViewMenu (PopupMenu& menu) | |||||
| void ProjucerApplication::createBuildMenu (PopupMenu& menu) | void ProjucerApplication::createBuildMenu (PopupMenu& menu) | ||||
| { | { | ||||
| menu.addCommandItem (commandManager, CommandIDs::toggleBuildEnabled); | |||||
| menu.addCommandItem (commandManager, CommandIDs::buildNow); | |||||
| menu.addCommandItem (commandManager, CommandIDs::toggleContinuousBuild); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::toggleBuildEnabled); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::buildNow); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::toggleContinuousBuild); | |||||
| menu.addSeparator(); | menu.addSeparator(); | ||||
| menu.addCommandItem (commandManager, CommandIDs::launchApp); | |||||
| menu.addCommandItem (commandManager, CommandIDs::killApp); | |||||
| menu.addCommandItem (commandManager, CommandIDs::cleanAll); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::launchApp); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::killApp); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::cleanAll); | |||||
| menu.addSeparator(); | menu.addSeparator(); | ||||
| menu.addCommandItem (commandManager, CommandIDs::reinstantiateComp); | |||||
| menu.addCommandItem (commandManager, CommandIDs::showWarnings); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::reinstantiateComp); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::showWarnings); | |||||
| menu.addSeparator(); | menu.addSeparator(); | ||||
| menu.addCommandItem (commandManager, CommandIDs::nextError); | |||||
| menu.addCommandItem (commandManager, CommandIDs::prevError); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::nextError); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::prevError); | |||||
| } | } | ||||
| void ProjucerApplication::createColourSchemeItems (PopupMenu& menu) | void ProjucerApplication::createColourSchemeItems (PopupMenu& menu) | ||||
| @@ -518,9 +518,9 @@ void ProjucerApplication::createColourSchemeItems (PopupMenu& menu) | |||||
| void ProjucerApplication::createWindowMenu (PopupMenu& menu) | void ProjucerApplication::createWindowMenu (PopupMenu& menu) | ||||
| { | { | ||||
| menu.addCommandItem (commandManager, CommandIDs::goToPreviousWindow); | |||||
| menu.addCommandItem (commandManager, CommandIDs::goToNextWindow); | |||||
| menu.addCommandItem (commandManager, CommandIDs::closeWindow); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::goToPreviousWindow); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::goToNextWindow); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::closeWindow); | |||||
| menu.addSeparator(); | menu.addSeparator(); | ||||
| int counter = 0; | int counter = 0; | ||||
| @@ -534,14 +534,14 @@ void ProjucerApplication::createWindowMenu (PopupMenu& menu) | |||||
| } | } | ||||
| menu.addSeparator(); | menu.addSeparator(); | ||||
| menu.addCommandItem (commandManager, CommandIDs::closeAllWindows); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::closeAllWindows); | |||||
| } | } | ||||
| void ProjucerApplication::createDocumentMenu (PopupMenu& menu) | void ProjucerApplication::createDocumentMenu (PopupMenu& menu) | ||||
| { | { | ||||
| menu.addCommandItem (commandManager, CommandIDs::goToPreviousDoc); | |||||
| menu.addCommandItem (commandManager, CommandIDs::goToNextDoc); | |||||
| menu.addCommandItem (commandManager, CommandIDs::goToCounterpart); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::goToPreviousDoc); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::goToNextDoc); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::goToCounterpart); | |||||
| menu.addSeparator(); | menu.addSeparator(); | ||||
| auto numDocs = jmin (50, openDocumentManager.getNumOpenDocuments()); | auto numDocs = jmin (50, openDocumentManager.getNumOpenDocuments()); | ||||
| @@ -553,31 +553,31 @@ void ProjucerApplication::createDocumentMenu (PopupMenu& menu) | |||||
| } | } | ||||
| menu.addSeparator(); | menu.addSeparator(); | ||||
| menu.addCommandItem (commandManager, CommandIDs::closeAllDocuments); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::closeAllDocuments); | |||||
| } | } | ||||
| void ProjucerApplication::createToolsMenu (PopupMenu& menu) | void ProjucerApplication::createToolsMenu (PopupMenu& menu) | ||||
| { | { | ||||
| menu.addCommandItem (commandManager, CommandIDs::showUTF8Tool); | |||||
| menu.addCommandItem (commandManager, CommandIDs::showSVGPathTool); | |||||
| menu.addCommandItem (commandManager, CommandIDs::showTranslationTool); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::showUTF8Tool); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::showSVGPathTool); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::showTranslationTool); | |||||
| } | } | ||||
| void ProjucerApplication::createHelpMenu (PopupMenu& menu) | void ProjucerApplication::createHelpMenu (PopupMenu& menu) | ||||
| { | { | ||||
| menu.addCommandItem (commandManager, CommandIDs::showForum); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::showForum); | |||||
| menu.addSeparator(); | menu.addSeparator(); | ||||
| menu.addCommandItem (commandManager, CommandIDs::showAPIModules); | |||||
| menu.addCommandItem (commandManager, CommandIDs::showAPIClasses); | |||||
| menu.addCommandItem (commandManager, CommandIDs::showTutorials); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::showAPIModules); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::showAPIClasses); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::showTutorials); | |||||
| } | } | ||||
| void ProjucerApplication::createExtraAppleMenuItems (PopupMenu& menu) | void ProjucerApplication::createExtraAppleMenuItems (PopupMenu& menu) | ||||
| { | { | ||||
| menu.addCommandItem (commandManager, CommandIDs::showAboutWindow); | |||||
| menu.addCommandItem (commandManager, CommandIDs::showAppUsageWindow); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::showAboutWindow); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::showAppUsageWindow); | |||||
| menu.addSeparator(); | menu.addSeparator(); | ||||
| menu.addCommandItem (commandManager, CommandIDs::showGlobalPathsWindow); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::showGlobalPathsWindow); | |||||
| } | } | ||||
| void ProjucerApplication::createExamplesPopupMenu (PopupMenu& menu) noexcept | void ProjucerApplication::createExamplesPopupMenu (PopupMenu& menu) noexcept | ||||
| @@ -602,7 +602,7 @@ void ProjucerApplication::createExamplesPopupMenu (PopupMenu& menu) noexcept | |||||
| else | else | ||||
| { | { | ||||
| menu.addSeparator(); | menu.addSeparator(); | ||||
| menu.addCommandItem (commandManager, CommandIDs::launchDemoRunner); | |||||
| menu.addCommandItem (commandManager.get(), CommandIDs::launchDemoRunner); | |||||
| } | } | ||||
| } | } | ||||
| @@ -809,16 +809,16 @@ void ProjucerApplication::launchDemoRunner() | |||||
| else if (findDemoRunnerProject() != File()) | else if (findDemoRunnerProject() != File()) | ||||
| { | { | ||||
| auto& lf = Desktop::getInstance().getDefaultLookAndFeel(); | auto& lf = Desktop::getInstance().getDefaultLookAndFeel(); | ||||
| demoRunnerAlert = lf.createAlertWindow ("Open Project", | |||||
| "Couldn't find a compiled version of the Demo Runner." | |||||
| #if JUCE_LINUX | |||||
| " Do you want to build it now?", "Build project", "Cancel", | |||||
| #else | |||||
| " Do you want to open the project?", "Open project", "Cancel", | |||||
| #endif | |||||
| {}, | |||||
| AlertWindow::QuestionIcon, 2, | |||||
| mainWindowList.getFrontmostWindow (false)); | |||||
| demoRunnerAlert.reset (lf.createAlertWindow ("Open Project", | |||||
| "Couldn't find a compiled version of the Demo Runner." | |||||
| #if JUCE_LINUX | |||||
| " Do you want to build it now?", "Build project", "Cancel", | |||||
| #else | |||||
| " Do you want to open the project?", "Open project", "Cancel", | |||||
| #endif | |||||
| {}, | |||||
| AlertWindow::QuestionIcon, 2, | |||||
| mainWindowList.getFrontmostWindow (false))); | |||||
| demoRunnerAlert->enterModalState (true, ModalCallbackFunction::create ([this] (int retVal) | demoRunnerAlert->enterModalState (true, ModalCallbackFunction::create ([this] (int retVal) | ||||
| { | { | ||||
| @@ -1327,7 +1327,7 @@ void ProjucerApplication::updateAllBuildTabs() | |||||
| void ProjucerApplication::initCommandManager() | void ProjucerApplication::initCommandManager() | ||||
| { | { | ||||
| commandManager = new ApplicationCommandManager(); | |||||
| commandManager.reset (new ApplicationCommandManager()); | |||||
| commandManager->registerAllCommandsForTarget (this); | commandManager->registerAllCommandsForTarget (this); | ||||
| { | { | ||||
| @@ -1386,11 +1386,11 @@ void ProjucerApplication::setupAnalytics() | |||||
| void ProjucerApplication::showSetJUCEPathAlert() | void ProjucerApplication::showSetJUCEPathAlert() | ||||
| { | { | ||||
| auto& lf = Desktop::getInstance().getDefaultLookAndFeel(); | auto& lf = Desktop::getInstance().getDefaultLookAndFeel(); | ||||
| pathAlert = lf.createAlertWindow ("Set JUCE Path", "Your global JUCE path is invalid. This path is used to access the JUCE examples and demo project - " | |||||
| "would you like to set it now?", | |||||
| "Set path", "Cancel", "Don't ask again", | |||||
| AlertWindow::WarningIcon, 3, | |||||
| mainWindowList.getFrontmostWindow (false)); | |||||
| pathAlert.reset (lf.createAlertWindow ("Set JUCE Path", "Your global JUCE path is invalid. This path is used to access the JUCE examples and demo project - " | |||||
| "would you like to set it now?", | |||||
| "Set path", "Cancel", "Don't ask again", | |||||
| AlertWindow::WarningIcon, 3, | |||||
| mainWindowList.getFrontmostWindow (false))); | |||||
| pathAlert->enterModalState (true, ModalCallbackFunction::create ([this] (int retVal) | pathAlert->enterModalState (true, ModalCallbackFunction::create ([this] (int retVal) | ||||
| { | { | ||||
| @@ -214,7 +214,7 @@ public: | |||||
| total += written; | total += written; | ||||
| setStatusMessage (String (TRANS ("Downloading... (123)")) | |||||
| setStatusMessage (String (TRANS("Downloading... (123)")) | |||||
| .replace ("123", File::descriptionOfSizeInBytes (total))); | .replace ("123", File::descriptionOfSizeInBytes (total))); | ||||
| } | } | ||||
| @@ -243,36 +243,42 @@ public: | |||||
| const char* overwriteFolderPath) | const char* overwriteFolderPath) | ||||
| : hasOverwriteButton (overwriteFolderPath != nullptr) | : hasOverwriteButton (overwriteFolderPath != nullptr) | ||||
| { | { | ||||
| addAndMakeVisible (titleLabel = new Label ("Title Label", | |||||
| TRANS ("Download \"123\" version 456?").replace ("123", productName) | |||||
| .replace ("456", version.toString()))); | |||||
| titleLabel.reset (new Label ("Title Label", | |||||
| TRANS("Download \"123\" version 456?") | |||||
| .replace ("123", productName) | |||||
| .replace ("456", version.toString()))); | |||||
| addAndMakeVisible (titleLabel.get()); | |||||
| titleLabel->setFont (Font (15.00f, Font::bold)); | titleLabel->setFont (Font (15.00f, Font::bold)); | ||||
| titleLabel->setJustificationType (Justification::centredLeft); | titleLabel->setJustificationType (Justification::centredLeft); | ||||
| titleLabel->setEditable (false, false, false); | titleLabel->setEditable (false, false, false); | ||||
| addAndMakeVisible (contentLabel = new Label ("Content Label", | |||||
| TRANS ("A new version of \"123\" is available - would you like to download it?") | |||||
| .replace ("123", productName))); | |||||
| contentLabel.reset(new Label ("Content Label", | |||||
| TRANS("A new version of \"123\" is available - would you like to download it?") | |||||
| .replace ("123", productName))); | |||||
| addAndMakeVisible (contentLabel.get()); | |||||
| contentLabel->setFont (Font (15.00f, Font::plain)); | contentLabel->setFont (Font (15.00f, Font::plain)); | ||||
| contentLabel->setJustificationType (Justification::topLeft); | contentLabel->setJustificationType (Justification::topLeft); | ||||
| contentLabel->setEditable (false, false, false); | contentLabel->setEditable (false, false, false); | ||||
| addAndMakeVisible (okButton = new TextButton ("OK Button")); | |||||
| okButton.reset (new TextButton ("OK Button")); | |||||
| addAndMakeVisible (okButton.get()); | |||||
| okButton->setButtonText (TRANS(hasOverwriteButton ? "Choose Another Folder..." : "OK")); | okButton->setButtonText (TRANS(hasOverwriteButton ? "Choose Another Folder..." : "OK")); | ||||
| okButton->onClick = [this] { exitParentDialog (2); }; | okButton->onClick = [this] { exitParentDialog (2); }; | ||||
| addAndMakeVisible (cancelButton = new TextButton ("Cancel Button")); | |||||
| cancelButton.reset (new TextButton ("Cancel Button")); | |||||
| addAndMakeVisible (cancelButton.get()); | |||||
| cancelButton->setButtonText (TRANS("Cancel")); | cancelButton->setButtonText (TRANS("Cancel")); | ||||
| cancelButton->onClick = [this] { exitParentDialog (-1); }; | cancelButton->onClick = [this] { exitParentDialog (-1); }; | ||||
| addAndMakeVisible (changeLogLabel = new Label ("Change Log Label", | |||||
| TRANS("Release Notes:"))); | |||||
| changeLogLabel.reset (new Label ("Change Log Label", TRANS("Release Notes:"))); | |||||
| addAndMakeVisible (changeLogLabel.get()); | |||||
| changeLogLabel->setFont (Font (15.00f, Font::plain)); | changeLogLabel->setFont (Font (15.00f, Font::plain)); | ||||
| changeLogLabel->setJustificationType (Justification::topLeft); | changeLogLabel->setJustificationType (Justification::topLeft); | ||||
| changeLogLabel->setEditable (false, false, false); | changeLogLabel->setEditable (false, false, false); | ||||
| addAndMakeVisible (changeLog = new TextEditor ("Change Log")); | |||||
| changeLog.reset (new TextEditor ("Change Log")); | |||||
| addAndMakeVisible (changeLog.get()); | |||||
| changeLog->setMultiLine (true); | changeLog->setMultiLine (true); | ||||
| changeLog->setReturnKeyStartsNewLine (true); | changeLog->setReturnKeyStartsNewLine (true); | ||||
| changeLog->setReadOnly (true); | changeLog->setReadOnly (true); | ||||
| @@ -283,24 +289,27 @@ public: | |||||
| if (hasOverwriteButton) | if (hasOverwriteButton) | ||||
| { | { | ||||
| addAndMakeVisible (overwriteLabel = new Label ("Overwrite Label", | |||||
| TRANS("Updating will overwrite everything in the following folder:"))); | |||||
| overwriteLabel.reset (new Label ("Overwrite Label", | |||||
| TRANS("Updating will overwrite everything in the following folder:"))); | |||||
| addAndMakeVisible (overwriteLabel.get()); | |||||
| overwriteLabel->setFont (Font (15.00f, Font::plain)); | overwriteLabel->setFont (Font (15.00f, Font::plain)); | ||||
| overwriteLabel->setJustificationType (Justification::topLeft); | overwriteLabel->setJustificationType (Justification::topLeft); | ||||
| overwriteLabel->setEditable (false, false, false); | overwriteLabel->setEditable (false, false, false); | ||||
| addAndMakeVisible (overwritePath = new Label ("Overwrite Path", overwriteFolderPath)); | |||||
| overwritePath.reset (new Label ("Overwrite Path", overwriteFolderPath)); | |||||
| addAndMakeVisible (overwritePath.get()); | |||||
| overwritePath->setFont (Font (15.00f, Font::bold)); | overwritePath->setFont (Font (15.00f, Font::bold)); | ||||
| overwritePath->setJustificationType (Justification::topLeft); | overwritePath->setJustificationType (Justification::topLeft); | ||||
| overwritePath->setEditable (false, false, false); | overwritePath->setEditable (false, false, false); | ||||
| addAndMakeVisible (overwriteButton = new TextButton ("Overwrite Button")); | |||||
| overwriteButton.reset (new TextButton ("Overwrite Button")); | |||||
| addAndMakeVisible (overwriteButton.get()); | |||||
| overwriteButton->setButtonText (TRANS("Overwrite")); | overwriteButton->setButtonText (TRANS("Overwrite")); | ||||
| overwriteButton->onClick = [this] { exitParentDialog (1); }; | overwriteButton->onClick = [this] { exitParentDialog (1); }; | ||||
| } | } | ||||
| juceIcon = Drawable::createFromImageData (BinaryData::juce_icon_png, | |||||
| BinaryData::juce_icon_pngSize); | |||||
| juceIcon.reset (Drawable::createFromImageData (BinaryData::juce_icon_png, | |||||
| BinaryData::juce_icon_pngSize)); | |||||
| setSize (518, overwritePath != nullptr ? 345 : 269); | setSize (518, overwritePath != nullptr ? 345 : 269); | ||||
| @@ -371,7 +380,7 @@ public: | |||||
| releaseNotes, overwritePath), true); | releaseNotes, overwritePath), true); | ||||
| DialogWindow::LaunchOptions lo; | DialogWindow::LaunchOptions lo; | ||||
| lo.dialogTitle = TRANS ("Download \"123\" version 456?").replace ("456", version.toString()) | |||||
| lo.dialogTitle = TRANS("Download \"123\" version 456?").replace ("456", version.toString()) | |||||
| .replace ("123", productName); | .replace ("123", productName); | ||||
| lo.dialogBackgroundColour = userDialog->findColour (backgroundColourId); | lo.dialogBackgroundColour = userDialog->findColour (backgroundColourId); | ||||
| lo.content = userDialog; | lo.content = userDialog; | ||||
| @@ -763,8 +772,8 @@ void LatestVersionChecker::askUserForLocationToDownload (URL& newVersionToDownlo | |||||
| if (targetFolder.getChildFile (".git").isDirectory()) | if (targetFolder.getChildFile (".git").isDirectory()) | ||||
| { | { | ||||
| AlertWindow::showMessageBox (AlertWindow::WarningIcon, | AlertWindow::showMessageBox (AlertWindow::WarningIcon, | ||||
| TRANS ("Downloading new JUCE version"), | |||||
| TRANS ("This folder is a GIT repository!\n\n" | |||||
| TRANS("Downloading new JUCE version"), | |||||
| TRANS("This folder is a GIT repository!\n\n" | |||||
| "You should use a \"git pull\" to update it to the latest version. " | "You should use a \"git pull\" to update it to the latest version. " | ||||
| "Or to use the Projucer to get an update, you should select an empty " | "Or to use the Projucer to get an update, you should select an empty " | ||||
| "folder into which you'd like to download the new code.")); | "folder into which you'd like to download the new code.")); | ||||
| @@ -142,7 +142,7 @@ void MainWindow::closeButtonPressed() | |||||
| bool MainWindow::closeProject (Project* project, bool askUserToSave) | bool MainWindow::closeProject (Project* project, bool askUserToSave) | ||||
| { | { | ||||
| jassert (project == currentProject && project != nullptr); | |||||
| jassert (project == currentProject.get() && project != nullptr); | |||||
| if (project == nullptr) | if (project == nullptr) | ||||
| return true; | return true; | ||||
| @@ -177,7 +177,7 @@ void MainWindow::moveProject (File newProjectFileToOpen) | |||||
| { | { | ||||
| auto openInIDE = currentProject->shouldOpenInIDEAfterSaving(); | auto openInIDE = currentProject->shouldOpenInIDEAfterSaving(); | ||||
| closeProject (currentProject, false); | |||||
| closeProject (currentProject.get(), false); | |||||
| openFile (newProjectFileToOpen); | openFile (newProjectFileToOpen); | ||||
| if (currentProject != nullptr) | if (currentProject != nullptr) | ||||
| @@ -362,7 +362,7 @@ private: | |||||
| String text = getTextInRange (selection).toLowerCase(); | String text = getTextInRange (selection).toLowerCase(); | ||||
| if (isIntegerLiteral (text) || isFloatLiteral (text)) | if (isIntegerLiteral (text) || isFloatLiteral (text)) | ||||
| overlay = new LiteralHighlightOverlay (*this, selection, mightBeColourValue (text)); | |||||
| overlay.reset (new LiteralHighlightOverlay (*this, selection, mightBeColourValue (text))); | |||||
| } | } | ||||
| } | } | ||||
| @@ -384,7 +384,7 @@ private: | |||||
| jucerComp->setFilename (jucerComponentFile); | jucerComp->setFilename (jucerComponentFile); | ||||
| jucerComp->setToInitialSize(); | jucerComp->setToInitialSize(); | ||||
| addAndMakeVisible (jucerComp); | |||||
| addAndMakeVisible (jucerComp.get()); | |||||
| } | } | ||||
| } | } | ||||
| else | else | ||||
| @@ -698,7 +698,7 @@ private: | |||||
| : ComponentUndoableAction<TabbedComponent> (comp, l), | : ComponentUndoableAction<TabbedComponent> (comp, l), | ||||
| indexToRemove (indexToRemove_) | indexToRemove (indexToRemove_) | ||||
| { | { | ||||
| previousState = getTabState (comp, indexToRemove); | |||||
| previousState.reset (getTabState (comp, indexToRemove)); | |||||
| } | } | ||||
| bool perform() | bool perform() | ||||
| @@ -53,7 +53,8 @@ PaintElement::PaintElement (PaintRoutine* owner_, | |||||
| setMinimumOnscreenAmounts (0, 0, 0, 0); | setMinimumOnscreenAmounts (0, 0, 0, 0); | ||||
| setSizeLimits (borderThickness * 2 + 1, borderThickness * 2 + 1, 8192, 8192); | setSizeLimits (borderThickness * 2 + 1, borderThickness * 2 + 1, 8192, 8192); | ||||
| addChildComponent (border = new ResizableBorderComponent (this, this)); | |||||
| border.reset (new ResizableBorderComponent (this, this)); | |||||
| addChildComponent (border.get()); | |||||
| border->setBorderThickness (BorderSize<int> (borderThickness)); | border->setBorderThickness (BorderSize<int> (borderThickness)); | ||||
| @@ -65,7 +65,7 @@ void PaintElementGroup::groupSelected (PaintRoutine* routine) | |||||
| { | { | ||||
| ScopedPointer<XmlElement> xml (routine->getElement(i)->createXml()); | ScopedPointer<XmlElement> xml (routine->getElement(i)->createXml()); | ||||
| if (auto* newOne = ObjectTypes::createElementForXml (xml, routine)) | |||||
| if (auto* newOne = ObjectTypes::createElementForXml (xml.get(), routine)) | |||||
| newGroup->subElements.add (newOne); | newGroup->subElements.add (newOne); | ||||
| if (i > frontIndex) | if (i > frontIndex) | ||||
| @@ -36,7 +36,7 @@ public: | |||||
| : PropertyComponent (name) | : PropertyComponent (name) | ||||
| { | { | ||||
| colourPropEditor.reset (new ColourPropEditorComponent (this, canReset)); | colourPropEditor.reset (new ColourPropEditorComponent (this, canReset)); | ||||
| addAndMakeVisible (colourPropEditor); | |||||
| addAndMakeVisible (colourPropEditor.get()); | |||||
| } | } | ||||
| virtual void setColour (Colour newColour) = 0; | virtual void setColour (Colour newColour) = 0; | ||||
| @@ -68,7 +68,8 @@ public: | |||||
| refresh(); // (to clear the text editor if it's got focus) | refresh(); // (to clear the text editor if it's got focus) | ||||
| }; | }; | ||||
| addAndMakeVisible (textEditor = new PositionPropLabel (*this)); | |||||
| textEditor.reset (new PositionPropLabel (*this)); | |||||
| addAndMakeVisible (textEditor.get()); | |||||
| } | } | ||||
| String getText() const | String getText() const | ||||
| @@ -41,7 +41,8 @@ ComponentOverlayComponent::ComponentOverlayComponent (Component* const target_, | |||||
| setMinimumOnscreenAmounts (0, 0, 0, 0); | setMinimumOnscreenAmounts (0, 0, 0, 0); | ||||
| setSizeLimits (borderThickness * 2 + 2, borderThickness * 2 + 2, 8192, 8192); | setSizeLimits (borderThickness * 2 + 2, borderThickness * 2 + 2, 8192, 8192); | ||||
| addChildComponent (border = new ResizableBorderComponent (this, this)); | |||||
| border.reset (new ResizableBorderComponent (this, this)); | |||||
| addChildComponent (border.get()); | |||||
| border->setBorderThickness (BorderSize<int> (borderThickness)); | border->setBorderThickness (BorderSize<int> (borderThickness)); | ||||
| @@ -47,7 +47,8 @@ public: | |||||
| : PropertyComponent ("extra callbacks", 250), | : PropertyComponent ("extra callbacks", 250), | ||||
| document (doc) | document (doc) | ||||
| { | { | ||||
| addAndMakeVisible (listBox = new ListBox (String(), this)); | |||||
| listBox.reset (new ListBox (String(), this)); | |||||
| addAndMakeVisible (listBox.get()); | |||||
| listBox->setRowHeight (22); | listBox->setRowHeight (22); | ||||
| document.addChangeListener (this); | document.addChangeListener (this); | ||||
| @@ -611,7 +612,7 @@ void JucerDocumentEditor::saveLastSelectedTab() const | |||||
| ScopedPointer<XmlElement> root (projectProps.getXmlValue ("GUIComponentsLastTab")); | ScopedPointer<XmlElement> root (projectProps.getXmlValue ("GUIComponentsLastTab")); | ||||
| if (root == nullptr) | if (root == nullptr) | ||||
| root = new XmlElement ("FILES"); | |||||
| root.reset (new XmlElement ("FILES")); | |||||
| auto fileName = document->getCppFile().getFileName(); | auto fileName = document->getCppFile().getFileName(); | ||||
| @@ -1155,7 +1156,9 @@ bool JucerDocumentEditor::perform (const InvocationInfo& info) | |||||
| case StandardApplicationCommandIDs::paste: | case StandardApplicationCommandIDs::paste: | ||||
| { | { | ||||
| if (ScopedPointer<XmlElement> doc = XmlDocument::parse (SystemClipboard::getTextFromClipboard())) | |||||
| ScopedPointer<XmlElement> doc (XmlDocument::parse (SystemClipboard::getTextFromClipboard())); | |||||
| if (doc != nullptr) | |||||
| { | { | ||||
| if (doc->hasTagName (ComponentLayout::clipboardXmlTag)) | if (doc->hasTagName (ComponentLayout::clipboardXmlTag)) | ||||
| { | { | ||||
| @@ -79,7 +79,8 @@ ResourceEditorPanel::ResourceEditorPanel (JucerDocument& doc) | |||||
| delButton.setEnabled (false); | delButton.setEnabled (false); | ||||
| delButton.onClick = [this] { document.getResources().remove (listBox->getSelectedRow (0)); }; | delButton.onClick = [this] { document.getResources().remove (listBox->getSelectedRow (0)); }; | ||||
| addAndMakeVisible (listBox = new TableListBox (String(), this)); | |||||
| listBox.reset (new TableListBox (String(), this)); | |||||
| addAndMakeVisible (listBox.get()); | |||||
| listBox->getHeader().addColumn ("name", 1, 150, 80, 400); | listBox->getHeader().addColumn ("name", 1, 150, 80, 400); | ||||
| listBox->getHeader().addColumn ("original file", 2, 350, 80, 800); | listBox->getHeader().addColumn ("original file", 2, 350, 80, 800); | ||||
| listBox->getHeader().addColumn ("size", 3, 100, 40, 150); | listBox->getHeader().addColumn ("size", 3, 100, 40, 150); | ||||
| @@ -99,7 +99,7 @@ void TestComponent::setFilename (const String& newName) | |||||
| filename = newName; | filename = newName; | ||||
| lastModificationTime = findFile().getLastModificationTime(); | lastModificationTime = findFile().getLastModificationTime(); | ||||
| loadedDocument = JucerDocument::createForCppFile (nullptr, findFile()); | |||||
| loadedDocument.reset (JucerDocument::createForCppFile (nullptr, findFile())); | |||||
| updateContents(); | updateContents(); | ||||
| repaint(); | repaint(); | ||||
| @@ -129,7 +129,7 @@ public: | |||||
| oldIndex (-1) | oldIndex (-1) | ||||
| { | { | ||||
| if (ComponentTypeHandler* const h = ComponentTypeHandler::getHandlerFor (*comp)) | if (ComponentTypeHandler* const h = ComponentTypeHandler::getHandlerFor (*comp)) | ||||
| xml = h->createXmlFor (comp, &layout); | |||||
| xml.reset (h->createXmlFor (comp, &layout)); | |||||
| else | else | ||||
| jassertfalse; | jassertfalse; | ||||
| @@ -415,18 +415,17 @@ Component* ComponentLayout::addNewComponent (ComponentTypeHandler* const type, i | |||||
| { | { | ||||
| c->setSize (type->getDefaultWidth(), type->getDefaultHeight()); | c->setSize (type->getDefaultWidth(), type->getDefaultHeight()); | ||||
| c->setCentrePosition (x, y); | c->setCentrePosition (x, y); | ||||
| updateStoredComponentPosition (c, false); | |||||
| updateStoredComponentPosition (c.get(), false); | |||||
| c->getProperties().set ("id", nextCompUID++); | c->getProperties().set ("id", nextCompUID++); | ||||
| ScopedPointer<XmlElement> xml (type->createXmlFor (c, this)); | |||||
| c.reset(); | |||||
| c = addComponentFromXml (*xml, true); | |||||
| ScopedPointer<XmlElement> xml (type->createXmlFor (c.get(), this)); | |||||
| c.reset (addComponentFromXml (*xml, true)); | |||||
| String memberName (CodeHelpers::makeValidIdentifier (type->getClassName (c), true, true, false)); | |||||
| setComponentMemberVariableName (c, memberName); | |||||
| String memberName (CodeHelpers::makeValidIdentifier (type->getClassName (c.get()), true, true, false)); | |||||
| setComponentMemberVariableName (c.get(), memberName); | |||||
| selected.selectOnly (c); | |||||
| selected.selectOnly (c.get()); | |||||
| } | } | ||||
| return c.release(); | return c.release(); | ||||
| @@ -447,16 +446,16 @@ Component* ComponentLayout::addComponentFromXml (const XmlElement& xml, const bo | |||||
| { | { | ||||
| ScopedPointer<Component> newComp (type->createNewComponent (getDocument())); | ScopedPointer<Component> newComp (type->createNewComponent (getDocument())); | ||||
| if (type->restoreFromXml (xml, newComp, this)) | |||||
| if (type->restoreFromXml (xml, newComp.get(), this)) | |||||
| { | { | ||||
| // ensure that the new comp's name is unique | // ensure that the new comp's name is unique | ||||
| setComponentMemberVariableName (newComp, getComponentMemberVariableName (newComp)); | |||||
| setComponentMemberVariableName (newComp.get(), getComponentMemberVariableName (newComp.get())); | |||||
| // check for duped IDs.. | // check for duped IDs.. | ||||
| while (findComponentWithId (ComponentTypeHandler::getComponentId (newComp)) != nullptr) | |||||
| ComponentTypeHandler::setComponentId (newComp, Random::getSystemRandom().nextInt64()); | |||||
| while (findComponentWithId (ComponentTypeHandler::getComponentId (newComp.get())) != nullptr) | |||||
| ComponentTypeHandler::setComponentId (newComp.get(), Random::getSystemRandom().nextInt64()); | |||||
| components.add (newComp); | |||||
| components.add (newComp.get()); | |||||
| changed(); | changed(); | ||||
| return newComp.release(); | return newComp.release(); | ||||
| } | } | ||||
| @@ -76,7 +76,7 @@ struct UserDocChangeTimer : public Timer | |||||
| void JucerDocument::userEditedCpp() | void JucerDocument::userEditedCpp() | ||||
| { | { | ||||
| if (userDocChangeTimer == nullptr) | if (userDocChangeTimer == nullptr) | ||||
| userDocChangeTimer = new UserDocChangeTimer (*this); | |||||
| userDocChangeTimer.reset (new UserDocChangeTimer (*this)); | |||||
| userDocChangeTimer->startTimer (500); | userDocChangeTimer->startTimer (500); | ||||
| } | } | ||||
| @@ -577,10 +577,10 @@ bool JucerDocument::reloadFromDocument() | |||||
| if (newXML == nullptr || ! newXML->hasTagName (jucerCompXmlTag)) | if (newXML == nullptr || ! newXML->hasTagName (jucerCompXmlTag)) | ||||
| return false; | return false; | ||||
| if (currentXML != nullptr && currentXML->isEquivalentTo (newXML, true)) | |||||
| if (currentXML != nullptr && currentXML->isEquivalentTo (newXML.get(), true)) | |||||
| return true; | return true; | ||||
| currentXML = newXML; | |||||
| currentXML.reset (newXML.release()); | |||||
| stopTimer(); | stopTimer(); | ||||
| resources.loadFromCpp (getCppFile(), cppContent); | resources.loadFromCpp (getCppFile(), cppContent); | ||||
| @@ -646,8 +646,12 @@ XmlElement* JucerDocument::pullMetaDataFromCppFile (const String& cpp) | |||||
| bool JucerDocument::isValidJucerCppFile (const File& f) | bool JucerDocument::isValidJucerCppFile (const File& f) | ||||
| { | { | ||||
| if (f.hasFileExtension (".cpp")) | if (f.hasFileExtension (".cpp")) | ||||
| if (ScopedPointer<XmlElement> xml = pullMetaDataFromCppFile (f.loadFileAsString())) | |||||
| { | |||||
| ScopedPointer<XmlElement> xml (pullMetaDataFromCppFile (f.loadFileAsString())); | |||||
| if (xml != nullptr) | |||||
| return xml->hasTagName (jucerCompXmlTag); | return xml->hasTagName (jucerCompXmlTag); | ||||
| } | |||||
| return false; | return false; | ||||
| } | } | ||||
| @@ -666,10 +670,10 @@ static JucerDocument* createDocument (SourceCodeDocument* cpp) | |||||
| ScopedPointer<JucerDocument> newDoc; | ScopedPointer<JucerDocument> newDoc; | ||||
| if (docType.equalsIgnoreCase ("Button")) | if (docType.equalsIgnoreCase ("Button")) | ||||
| newDoc = new ButtonDocument (cpp); | |||||
| newDoc.reset (new ButtonDocument (cpp)); | |||||
| if (docType.equalsIgnoreCase ("Component") || docType.isEmpty()) | if (docType.equalsIgnoreCase ("Component") || docType.isEmpty()) | ||||
| newDoc = new ComponentDocument (cpp); | |||||
| newDoc.reset (new ComponentDocument (cpp)); | |||||
| if (newDoc != nullptr && newDoc->reloadFromDocument()) | if (newDoc != nullptr && newDoc->reloadFromDocument()) | ||||
| return newDoc.release(); | return newDoc.release(); | ||||
| @@ -720,7 +724,9 @@ public: | |||||
| Component* createEditor() override | Component* createEditor() override | ||||
| { | { | ||||
| if (ScopedPointer<JucerDocument> jucerDoc = JucerDocument::createForCppFile (getProject(), getFile())) | |||||
| ScopedPointer<JucerDocument> jucerDoc (JucerDocument::createForCppFile (getProject(), getFile())); | |||||
| if (jucerDoc != nullptr) | |||||
| return new JucerDocumentEditor (jucerDoc.release()); | return new JucerDocumentEditor (jucerDoc.release()); | ||||
| return SourceCodeDocument::createEditor(); | return SourceCodeDocument::createEditor(); | ||||
| @@ -766,7 +772,9 @@ struct NewGUIComponentWizard : public NewFileWizard::Type | |||||
| { | { | ||||
| if (auto* header = dynamic_cast<SourceCodeDocument*> (odm.openFile (nullptr, headerFile))) | if (auto* header = dynamic_cast<SourceCodeDocument*> (odm.openFile (nullptr, headerFile))) | ||||
| { | { | ||||
| if (ScopedPointer<JucerDocument> jucerDoc = new ComponentDocument (cpp)) | |||||
| ScopedPointer<JucerDocument> jucerDoc (new ComponentDocument (cpp)); | |||||
| if (jucerDoc != nullptr) | |||||
| { | { | ||||
| jucerDoc->setClassName (newFile.getFileNameWithoutExtension()); | jucerDoc->setClassName (newFile.getFileNameWithoutExtension()); | ||||
| @@ -108,13 +108,13 @@ PaintElement* createElementForXml (const XmlElement* const e, PaintRoutine* cons | |||||
| ScopedPointer<PaintElement> pe; | ScopedPointer<PaintElement> pe; | ||||
| if (e->hasTagName (PaintElementRectangle::getTagName())) pe = new PaintElementRectangle (owner); | |||||
| else if (e->hasTagName (PaintElementRoundedRectangle::getTagName())) pe = new PaintElementRoundedRectangle (owner); | |||||
| else if (e->hasTagName (PaintElementEllipse::getTagName())) pe = new PaintElementEllipse (owner); | |||||
| else if (e->hasTagName (PaintElementImage::getTagName())) pe = new PaintElementImage (owner); | |||||
| else if (e->hasTagName (PaintElementPath::getTagName())) pe = new PaintElementPath (owner); | |||||
| else if (e->hasTagName (PaintElementText::getTagName())) pe = new PaintElementText (owner); | |||||
| else if (e->hasTagName (PaintElementGroup::getTagName())) pe = new PaintElementGroup (owner); | |||||
| if (e->hasTagName (PaintElementRectangle::getTagName())) pe.reset (new PaintElementRectangle (owner)); | |||||
| else if (e->hasTagName (PaintElementRoundedRectangle::getTagName())) pe.reset (new PaintElementRoundedRectangle (owner)); | |||||
| else if (e->hasTagName (PaintElementEllipse::getTagName())) pe.reset (new PaintElementEllipse (owner)); | |||||
| else if (e->hasTagName (PaintElementImage::getTagName())) pe.reset (new PaintElementImage (owner)); | |||||
| else if (e->hasTagName (PaintElementPath::getTagName())) pe.reset (new PaintElementPath (owner)); | |||||
| else if (e->hasTagName (PaintElementText::getTagName())) pe.reset (new PaintElementText (owner)); | |||||
| else if (e->hasTagName (PaintElementGroup::getTagName())) pe.reset (new PaintElementGroup (owner)); | |||||
| if (pe != nullptr && pe->loadFromXml (*e)) | if (pe != nullptr && pe->loadFromXml (*e)) | ||||
| return pe.release(); | return pe.release(); | ||||
| @@ -169,7 +169,7 @@ public: | |||||
| : PaintElementUndoableAction <PaintElement> (element), | : PaintElementUndoableAction <PaintElement> (element), | ||||
| oldIndex (-1) | oldIndex (-1) | ||||
| { | { | ||||
| xml = element->createXml(); | |||||
| xml.reset (element->createXml()); | |||||
| oldIndex = routine.indexOfElement (element); | oldIndex = routine.indexOfElement (element); | ||||
| } | } | ||||
| @@ -147,7 +147,7 @@ void LicenseController::startWebviewIfNeeded() | |||||
| #if ! JUCER_ENABLE_GPL_MODE | #if ! JUCER_ENABLE_GPL_MODE | ||||
| if (thread == nullptr) | if (thread == nullptr) | ||||
| thread = new LicenseThread (*this, false); | |||||
| thread.reset (new LicenseThread (*this, false)); | |||||
| #endif | #endif | ||||
| } | } | ||||
| @@ -163,7 +163,7 @@ void LicenseController::logout() | |||||
| WebBrowserComponent::clearCookies(); | WebBrowserComponent::clearCookies(); | ||||
| #endif | #endif | ||||
| thread = new LicenseThread (*this, false); | |||||
| thread.reset (new LicenseThread (*this, false)); | |||||
| #endif | #endif | ||||
| } | } | ||||
| @@ -173,7 +173,7 @@ void LicenseController::chooseNewLicense() | |||||
| #if ! JUCER_ENABLE_GPL_MODE | #if ! JUCER_ENABLE_GPL_MODE | ||||
| thread.reset(); | thread.reset(); | ||||
| thread = new LicenseThread (*this, true); | |||||
| thread.reset (new LicenseThread (*this, true)); | |||||
| #endif | #endif | ||||
| } | } | ||||
| @@ -293,14 +293,14 @@ LicenseState LicenseController::licenseStateFromOldSettings (XmlElement* license | |||||
| LicenseState LicenseController::licenseStateFromSettings (PropertiesFile& props) | LicenseState LicenseController::licenseStateFromSettings (PropertiesFile& props) | ||||
| { | { | ||||
| ScopedPointer<XmlElement> licenseXml = props.getXmlValue ("license"); | |||||
| ScopedPointer<XmlElement> licenseXml (props.getXmlValue ("license")); | |||||
| if (licenseXml != nullptr) | if (licenseXml != nullptr) | ||||
| { | { | ||||
| // this is here for backwards compatibility with old-style settings files using XML text elements | // this is here for backwards compatibility with old-style settings files using XML text elements | ||||
| if (licenseXml->getChildElementAllSubText ("type", {}) != String()) | if (licenseXml->getChildElementAllSubText ("type", {}) != String()) | ||||
| { | { | ||||
| auto stateFromOldSettings = licenseStateFromOldSettings (licenseXml); | |||||
| auto stateFromOldSettings = licenseStateFromOldSettings (licenseXml.get()); | |||||
| licenseStateToSettings (stateFromOldSettings, props); | licenseStateToSettings (stateFromOldSettings, props); | ||||
| @@ -165,9 +165,9 @@ struct LicenseThread : NetWorkerThread | |||||
| jassert (stateToUpdate.authToken.isNotEmpty()); | jassert (stateToUpdate.authToken.isNotEmpty()); | ||||
| auto accessTokenHeader = "x-access-token: " + stateToUpdate.authToken; | auto accessTokenHeader = "x-access-token: " + stateToUpdate.authToken; | ||||
| ScopedPointer<WebInputStream> shared (getSharedWebInputStream (URL ("https://api.roli.com/api/v1/user"), false)); | |||||
| if (ScopedPointer<WebInputStream> shared | |||||
| = getSharedWebInputStream (URL ("https://api.roli.com/api/v1/user"), false)) | |||||
| if (shared != nullptr) | |||||
| { | { | ||||
| const int statusCode = shared->withExtraHeaders (accessTokenHeader).getStatusCode(); | const int statusCode = shared->withExtraHeaders (accessTokenHeader).getStatusCode(); | ||||
| @@ -215,8 +215,8 @@ struct LicenseThread : NetWorkerThread | |||||
| if (! selectNewLicense) | if (! selectNewLicense) | ||||
| { | { | ||||
| ScopedPointer<WebInputStream> shared = getSharedWebInputStream (URL ("https://api.roli.com/api/v1/user/licences?search_internal_id=com.roli.projucer&version=5"), | |||||
| false); | |||||
| ScopedPointer<WebInputStream> shared (getSharedWebInputStream (URL ("https://api.roli.com/api/v1/user/licences?search_internal_id=com.roli.projucer&version=5"), | |||||
| false)); | |||||
| if (shared == nullptr) | if (shared == nullptr) | ||||
| break; | break; | ||||
| @@ -274,8 +274,8 @@ struct LicenseThread : NetWorkerThread | |||||
| String postData (JSON::toString (var (redeamObject.get()))); | String postData (JSON::toString (var (redeamObject.get()))); | ||||
| ScopedPointer<WebInputStream> shared = getSharedWebInputStream (URL ("https://api.roli.com/api/v1/user/products").withPOSTData (postData), | |||||
| true); | |||||
| ScopedPointer<WebInputStream> shared (getSharedWebInputStream (URL ("https://api.roli.com/api/v1/user/products").withPOSTData (postData), | |||||
| true)); | |||||
| if (shared == nullptr) | if (shared == nullptr) | ||||
| break; | break; | ||||
| @@ -306,8 +306,9 @@ struct LicenseThread : NetWorkerThread | |||||
| jsonLicenseRequest->setProperty (licenseTypeIdentifier, "software"); | jsonLicenseRequest->setProperty (licenseTypeIdentifier, "software"); | ||||
| String postData (JSON::toString (var (jsonLicenseRequest.get()))); | String postData (JSON::toString (var (jsonLicenseRequest.get()))); | ||||
| ScopedPointer<WebInputStream> shared | |||||
| = getSharedWebInputStream (URL ("https://api.roli.com/api/v1/user/products/redeem").withPOSTData (postData), true); | |||||
| ScopedPointer<WebInputStream> shared (getSharedWebInputStream (URL ("https://api.roli.com/api/v1/user/products/redeem") | |||||
| .withPOSTData (postData), | |||||
| true)); | |||||
| if (shared != nullptr) | if (shared != nullptr) | ||||
| { | { | ||||
| @@ -390,7 +391,9 @@ struct LicenseThread : NetWorkerThread | |||||
| if (avatarURL.isNotEmpty()) | if (avatarURL.isNotEmpty()) | ||||
| { | { | ||||
| if (ScopedPointer<WebInputStream> shared = getSharedWebInputStream (URL (avatarURL), false)) | |||||
| ScopedPointer<WebInputStream> shared (getSharedWebInputStream (URL (avatarURL), false)); | |||||
| if (shared != nullptr) | |||||
| { | { | ||||
| MemoryBlock mb; | MemoryBlock mb; | ||||
| shared->readIntoMemoryBlock (mb); | shared->readIntoMemoryBlock (mb); | ||||
| @@ -137,9 +137,8 @@ private: | |||||
| } | } | ||||
| const uint32 backgroundColour = 0xff414141; | const uint32 backgroundColour = 0xff414141; | ||||
| ScopedPointer<Drawable> juceLogo | |||||
| = Drawable::createFromImageData (BinaryData::jucelogowithtext_svg, | |||||
| BinaryData::jucelogowithtext_svgSize); | |||||
| ScopedPointer<Drawable> juceLogo { Drawable::createFromImageData (BinaryData::jucelogowithtext_svg, | |||||
| BinaryData::jucelogowithtext_svgSize) }; | |||||
| IconButton avatarButton; | IconButton avatarButton; | ||||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Header) | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Header) | ||||
| @@ -213,8 +213,7 @@ public: | |||||
| void restartServer() | void restartServer() | ||||
| { | { | ||||
| server.reset(); | |||||
| server = new ClientIPC (owner); | |||||
| server.reset (new ClientIPC (owner)); | |||||
| sendRebuild(); | sendRebuild(); | ||||
| } | } | ||||
| @@ -516,7 +515,7 @@ CompileEngineChildProcess::~CompileEngineChildProcess() | |||||
| void CompileEngineChildProcess::createProcess() | void CompileEngineChildProcess::createProcess() | ||||
| { | { | ||||
| jassert (process == nullptr); | jassert (process == nullptr); | ||||
| process = new ChildProcess (*this, project); | |||||
| process.reset (new ChildProcess (*this, project)); | |||||
| if (! process->openedOk) | if (! process->openedOk) | ||||
| process.reset(); | process.reset(); | ||||
| @@ -598,7 +597,7 @@ void CompileEngineChildProcess::killApp() | |||||
| void CompileEngineChildProcess::handleAppLaunched() | void CompileEngineChildProcess::handleAppLaunched() | ||||
| { | { | ||||
| runningAppProcess = process; | |||||
| runningAppProcess.reset (process.release()); | |||||
| runningAppProcess->isRunningApp = true; | runningAppProcess->isRunningApp = true; | ||||
| createProcess(); | createProcess(); | ||||
| } | } | ||||
| @@ -158,7 +158,7 @@ public: | |||||
| setParentProcessID (info[3].getHexValue32()); | setParentProcessID (info[3].getHexValue32()); | ||||
| #endif | #endif | ||||
| zombieKiller = new ZombiePatrol (*this); | |||||
| zombieKiller.reset (new ZombiePatrol (*this)); | |||||
| } | } | ||||
| ~ServerIPC() | ~ServerIPC() | ||||
| @@ -259,7 +259,7 @@ void* createClangServer (const String& commandLine) | |||||
| StringArray info; | StringArray info; | ||||
| info.addTokens (commandLine.fromFirstOccurrenceOf (commandPrefix, false, false), commandTokenSeparator, ""); | info.addTokens (commandLine.fromFirstOccurrenceOf (commandPrefix, false, false), commandTokenSeparator, ""); | ||||
| ScopedPointer<ServerIPC> ipc = new ServerIPC (info); | |||||
| ScopedPointer<ServerIPC> ipc (new ServerIPC (info)); | |||||
| if (ipc->dll.isLoaded()) | if (ipc->dll.isLoaded()) | ||||
| { | { | ||||
| @@ -98,12 +98,11 @@ private: | |||||
| return "WINDOWS"; | return "WINDOWS"; | ||||
| #elif JUCE_LINUX | #elif JUCE_LINUX | ||||
| return "LINUX"; | return "LINUX"; | ||||
| #endif | |||||
| #else | |||||
| // unknown platform?! | // unknown platform?! | ||||
| jassertfalse; | jassertfalse; | ||||
| return {}; | return {}; | ||||
| #endif | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -88,9 +88,9 @@ Result DownloadCompileEngineThread::download (MemoryBlock& dest) | |||||
| StringPairArray responseHeaders; | StringPairArray responseHeaders; | ||||
| URL url = getDownloadUrl(); | URL url = getDownloadUrl(); | ||||
| ScopedPointer<InputStream> in = url.createInputStream (false, nullptr, nullptr, | |||||
| String(), timeoutMs, &responseHeaders, | |||||
| &statusCode, 0); | |||||
| ScopedPointer<InputStream> in (url.createInputStream (false, nullptr, nullptr, | |||||
| String(), timeoutMs, &responseHeaders, | |||||
| &statusCode, 0)); | |||||
| if (in == nullptr || statusCode != 200) | if (in == nullptr || statusCode != 200) | ||||
| return Result::fail ("Download error: cannot establish connection"); | return Result::fail ("Download error: cannot establish connection"); | ||||
| @@ -69,7 +69,8 @@ class LiveBuildTab : public Component, | |||||
| public: | public: | ||||
| LiveBuildTab (CompileEngineChildProcess* child, String lastErrorMessage) | LiveBuildTab (CompileEngineChildProcess* child, String lastErrorMessage) | ||||
| { | { | ||||
| addAndMakeVisible (settingsButton = new IconButton ("Settings", &getIcons().settings)); | |||||
| settingsButton.reset (new IconButton ("Settings", &getIcons().settings)); | |||||
| addAndMakeVisible (settingsButton.get()); | |||||
| settingsButton->onClick = [this] | settingsButton->onClick = [this] | ||||
| { | { | ||||
| if (auto* pcc = findParentComponentOfClass<ProjectContentComponent>()) | if (auto* pcc = findParentComponentOfClass<ProjectContentComponent>()) | ||||
| @@ -87,16 +88,17 @@ public: | |||||
| isEnabled = false; | isEnabled = false; | ||||
| errorMessage = getErrorMessage(); | errorMessage = getErrorMessage(); | ||||
| errorMessageLabel = new Label ("Error", errorMessage); | |||||
| errorMessageLabel.reset (new Label ("Error", errorMessage)); | |||||
| errorMessageLabel->setJustificationType (Justification::centred); | errorMessageLabel->setJustificationType (Justification::centred); | ||||
| errorMessageLabel->setFont (Font (12.0f)); | errorMessageLabel->setFont (Font (12.0f)); | ||||
| errorMessageLabel->setMinimumHorizontalScale (1.0f); | errorMessageLabel->setMinimumHorizontalScale (1.0f); | ||||
| addAndMakeVisible (errorMessageLabel); | |||||
| addAndMakeVisible (errorMessageLabel.get()); | |||||
| if (showDownloadButton) | if (showDownloadButton) | ||||
| { | { | ||||
| addAndMakeVisible (downloadButton = new TextButton ("Download")); | |||||
| downloadButton.reset (new TextButton ("Download")); | |||||
| addAndMakeVisible (downloadButton.get()); | |||||
| downloadButton->onClick = [this] { downloadDLL(); }; | downloadButton->onClick = [this] { downloadDLL(); }; | ||||
| } | } | ||||
| @@ -110,7 +112,8 @@ public: | |||||
| buttonText = "Re-enable"; | buttonText = "Re-enable"; | ||||
| } | } | ||||
| addAndMakeVisible (enableButton = new TextButton (buttonText)); | |||||
| enableButton.reset (new TextButton (buttonText)); | |||||
| addAndMakeVisible (enableButton.get()); | |||||
| enableButton->onClick = [this] | enableButton->onClick = [this] | ||||
| { | { | ||||
| if (auto* pcc = findParentComponentOfClass<ProjectContentComponent>()) | if (auto* pcc = findParentComponentOfClass<ProjectContentComponent>()) | ||||
| @@ -173,22 +173,25 @@ public: | |||||
| { | { | ||||
| if (hasAddButton) | if (hasAddButton) | ||||
| { | { | ||||
| addAndMakeVisible (addButton = new IconButton ("Add", &getIcons().plus)); | |||||
| addButton.reset (new IconButton ("Add", &getIcons().plus)); | |||||
| addAndMakeVisible (addButton.get()); | |||||
| addButton->onClick = [this] { showAddMenu(); }; | addButton->onClick = [this] { showAddMenu(); }; | ||||
| } | } | ||||
| if (hasSettingsButton) | if (hasSettingsButton) | ||||
| { | { | ||||
| addAndMakeVisible (settingsButton = new IconButton ("Settings", &getIcons().settings)); | |||||
| settingsButton.reset (new IconButton ("Settings", &getIcons().settings)); | |||||
| addAndMakeVisible (settingsButton.get()); | |||||
| settingsButton->onClick = [this] { showSettings(); }; | settingsButton->onClick = [this] { showSettings(); }; | ||||
| } | } | ||||
| if (hasFindPanel) | if (hasFindPanel) | ||||
| { | { | ||||
| addAndMakeVisible (findPanel = new FindPanel ([this] (const String& filter) { treeToDisplay->rootItem->setSearchFilter (filter); })); | |||||
| findPanel.reset (new FindPanel ([this] (const String& filter) { treeToDisplay->rootItem->setSearchFilter (filter); })); | |||||
| addAndMakeVisible (findPanel.get()); | |||||
| } | } | ||||
| addAndMakeVisible (treeToDisplay); | |||||
| addAndMakeVisible (treeToDisplay.get()); | |||||
| } | } | ||||
| ~ConcertinaTreeComponent() | ~ConcertinaTreeComponent() | ||||
| @@ -43,7 +43,8 @@ HeaderComponent::HeaderComponent() | |||||
| exporterBox.onChange = [this] { updateExporterButton(); }; | exporterBox.onChange = [this] { updateExporterButton(); }; | ||||
| addAndMakeVisible (juceIcon = new ImageComponent ("icon")); | |||||
| juceIcon.reset (new ImageComponent ("icon")); | |||||
| addAndMakeVisible (juceIcon.get()); | |||||
| juceIcon->setImage (ImageCache::getFromMemory (BinaryData::juce_icon_png, BinaryData::juce_icon_pngSize), | juceIcon->setImage (ImageCache::getFromMemory (BinaryData::juce_icon_png, BinaryData::juce_icon_pngSize), | ||||
| RectanglePlacement::centred); | RectanglePlacement::centred); | ||||
| @@ -260,7 +261,8 @@ void HeaderComponent::initialiseButtons() noexcept | |||||
| { | { | ||||
| auto& icons = getIcons(); | auto& icons = getIcons(); | ||||
| addAndMakeVisible (projectSettingsButton = new IconButton ("Project Settings", &icons.settings)); | |||||
| projectSettingsButton.reset (new IconButton ("Project Settings", &icons.settings)); | |||||
| addAndMakeVisible (projectSettingsButton.get()); | |||||
| projectSettingsButton->onClick = [this] | projectSettingsButton->onClick = [this] | ||||
| { | { | ||||
| sendProjectButtonAnalyticsEvent ("Project Settings"); | sendProjectButtonAnalyticsEvent ("Project Settings"); | ||||
| @@ -269,7 +271,8 @@ void HeaderComponent::initialiseButtons() noexcept | |||||
| pcc->showProjectSettings(); | pcc->showProjectSettings(); | ||||
| }; | }; | ||||
| addAndMakeVisible (saveAndOpenInIDEButton = new IconButton ("Save and Open in IDE", nullptr)); | |||||
| saveAndOpenInIDEButton.reset (new IconButton ("Save and Open in IDE", nullptr)); | |||||
| addAndMakeVisible (saveAndOpenInIDEButton.get()); | |||||
| saveAndOpenInIDEButton->isIDEButton = true; | saveAndOpenInIDEButton->isIDEButton = true; | ||||
| saveAndOpenInIDEButton->onClick = [this] | saveAndOpenInIDEButton->onClick = [this] | ||||
| { | { | ||||
| @@ -279,7 +282,8 @@ void HeaderComponent::initialiseButtons() noexcept | |||||
| pcc->openInSelectedIDE (true); | pcc->openInSelectedIDE (true); | ||||
| }; | }; | ||||
| addAndMakeVisible (userSettingsButton = new IconButton ("User Settings", &icons.user)); | |||||
| userSettingsButton.reset (new IconButton ("User Settings", &icons.user)); | |||||
| addAndMakeVisible (userSettingsButton.get()); | |||||
| userSettingsButton->isUserButton = true; | userSettingsButton->isUserButton = true; | ||||
| userSettingsButton->onClick = [this] | userSettingsButton->onClick = [this] | ||||
| { | { | ||||
| @@ -289,7 +293,8 @@ void HeaderComponent::initialiseButtons() noexcept | |||||
| showUserSettings(); | showUserSettings(); | ||||
| }; | }; | ||||
| addAndMakeVisible (runAppButton = new IconButton ("Run Application", &icons.play)); | |||||
| runAppButton.reset (new IconButton ("Run Application", &icons.play)); | |||||
| addAndMakeVisible (runAppButton.get()); | |||||
| runAppButton->onClick = [this] | runAppButton->onClick = [this] | ||||
| { | { | ||||
| sendProjectButtonAnalyticsEvent ("Run Application"); | sendProjectButtonAnalyticsEvent ("Run Application"); | ||||
| @@ -39,7 +39,7 @@ struct LogoComponent : public Component | |||||
| LogoComponent() | LogoComponent() | ||||
| { | { | ||||
| ScopedPointer<XmlElement> svg (XmlDocument::parse (BinaryData::background_logo_svg)); | ScopedPointer<XmlElement> svg (XmlDocument::parse (BinaryData::background_logo_svg)); | ||||
| logo = Drawable::createFromSVG (*svg); | |||||
| logo.reset (Drawable::createFromSVG (*svg)); | |||||
| } | } | ||||
| void paint (Graphics& g) override | void paint (Graphics& g) override | ||||
| @@ -71,10 +71,14 @@ ProjectContentComponent::ProjectContentComponent() | |||||
| setOpaque (true); | setOpaque (true); | ||||
| setWantsKeyboardFocus (true); | setWantsKeyboardFocus (true); | ||||
| addAndMakeVisible (logo = new LogoComponent()); | |||||
| addAndMakeVisible (header = new HeaderComponent()); | |||||
| logo.reset (new LogoComponent()); | |||||
| addAndMakeVisible (logo.get()); | |||||
| addAndMakeVisible (fileNameLabel = new Label()); | |||||
| header.reset (new HeaderComponent()); | |||||
| addAndMakeVisible (header.get()); | |||||
| fileNameLabel.reset (new Label()); | |||||
| addAndMakeVisible (fileNameLabel.get()); | |||||
| fileNameLabel->setJustificationType (Justification::centred); | fileNameLabel->setJustificationType (Justification::centred); | ||||
| sidebarSizeConstrainer.setMinimumWidth (200); | sidebarSizeConstrainer.setMinimumWidth (200); | ||||
| @@ -265,8 +269,9 @@ void ProjectContentComponent::rebuildProjectTabs() | |||||
| .getFloatValue()); | .getFloatValue()); | ||||
| //====================================================================== | //====================================================================== | ||||
| addAndMakeVisible (resizerBar = new ResizableEdgeComponent (&sidebarTabs, &sidebarSizeConstrainer, | |||||
| ResizableEdgeComponent::rightEdge)); | |||||
| resizerBar.reset (new ResizableEdgeComponent (&sidebarTabs, &sidebarSizeConstrainer, | |||||
| ResizableEdgeComponent::rightEdge)); | |||||
| addAndMakeVisible (resizerBar.get()); | |||||
| resizerBar->setAlwaysOnTop (true); | resizerBar->setAlwaysOnTop (true); | ||||
| project->addChangeListener (this); | project->addChangeListener (this); | ||||
| @@ -299,7 +304,7 @@ void ProjectContentComponent::saveOpenDocumentList() | |||||
| ScopedPointer<XmlElement> xml (recentDocumentList.createXML()); | ScopedPointer<XmlElement> xml (recentDocumentList.createXML()); | ||||
| if (xml != nullptr) | if (xml != nullptr) | ||||
| project->getStoredProperties().setValue ("lastDocs", xml); | |||||
| project->getStoredProperties().setValue ("lastDocs", xml.get()); | |||||
| } | } | ||||
| } | } | ||||
| @@ -419,7 +424,7 @@ bool ProjectContentComponent::setEditorComponent (Component* editor, | |||||
| { | { | ||||
| auto* viewport = new ContentViewport (editor); | auto* viewport = new ContentViewport (editor); | ||||
| contentView = viewport; | |||||
| contentView.reset (viewport); | |||||
| currentDocument = nullptr; | currentDocument = nullptr; | ||||
| fileNameLabel->setVisible (false); | fileNameLabel->setVisible (false); | ||||
| @@ -427,7 +432,7 @@ bool ProjectContentComponent::setEditorComponent (Component* editor, | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| contentView = editor; | |||||
| contentView.reset (editor); | |||||
| currentDocument = doc; | currentDocument = doc; | ||||
| fileNameLabel->setText (doc->getFile().getFileName(), dontSendNotification); | fileNameLabel->setText (doc->getFile().getFileName(), dontSendNotification); | ||||
| fileNameLabel->setVisible (true); | fileNameLabel->setVisible (true); | ||||
| @@ -1819,7 +1819,7 @@ Array<var> Project::getDefaultRTASCategories() const noexcept | |||||
| EnabledModuleList& Project::getModules() | EnabledModuleList& Project::getModules() | ||||
| { | { | ||||
| if (enabledModulesList == nullptr) | if (enabledModulesList == nullptr) | ||||
| enabledModulesList = new EnabledModuleList (*this, projectRoot.getOrCreateChildWithName (Ids::MODULES, nullptr)); | |||||
| enabledModulesList.reset (new EnabledModuleList (*this, projectRoot.getOrCreateChildWithName (Ids::MODULES, nullptr))); | |||||
| return *enabledModulesList; | return *enabledModulesList; | ||||
| } | } | ||||
| @@ -1923,7 +1923,7 @@ bool Project::ExporterIterator::next() | |||||
| if (++index >= project.getNumExporters()) | if (++index >= project.getNumExporters()) | ||||
| return false; | return false; | ||||
| exporter = project.createExporter (index); | |||||
| exporter.reset (project.createExporter (index)); | |||||
| if (exporter == nullptr) | if (exporter == nullptr) | ||||
| { | { | ||||
| @@ -1332,7 +1332,7 @@ private: | |||||
| customStringsXmlContent << cfg.getCustomStringsXml(); | customStringsXmlContent << cfg.getCustomStringsXml(); | ||||
| customStringsXmlContent << "\n</resources>"; | customStringsXmlContent << "\n</resources>"; | ||||
| ScopedPointer<XmlElement> strings = XmlDocument::parse (customStringsXmlContent); | |||||
| ScopedPointer<XmlElement> strings (XmlDocument::parse (customStringsXmlContent)); | |||||
| String dir = cfg.isDebug() ? "debug" : "release"; | String dir = cfg.isDebug() ? "debug" : "release"; | ||||
| String subPath = "app/src/" + dir + "/res/values/string.xml"; | String subPath = "app/src/" + dir + "/res/values/string.xml"; | ||||
| @@ -137,7 +137,7 @@ public: | |||||
| for (auto& exporterName : getExporterNames()) | for (auto& exporterName : getExporterNames()) | ||||
| { | { | ||||
| ScopedPointer<ProjectExporter> exporter = createNewExporter (getProject(), exporterName); | |||||
| ScopedPointer<ProjectExporter> exporter (createNewExporter (getProject(), exporterName)); | |||||
| if (isExporterSupported (*exporter)) | if (isExporterSupported (*exporter)) | ||||
| description << exporter->getName() << newLine; | description << exporter->getName() << newLine; | ||||
| @@ -938,7 +938,7 @@ private: | |||||
| { | { | ||||
| auto plistFile = exporter.getTargetFolder().getChildFile (targetAttributes["INFOPLIST_FILE"]); | auto plistFile = exporter.getTargetFolder().getChildFile (targetAttributes["INFOPLIST_FILE"]); | ||||
| XmlDocument infoPlistData (plistFile); | XmlDocument infoPlistData (plistFile); | ||||
| ScopedPointer<XmlElement> plist = infoPlistData.getDocumentElement(); | |||||
| ScopedPointer<XmlElement> plist (infoPlistData.getDocumentElement()); | |||||
| if (plist != nullptr) | if (plist != nullptr) | ||||
| { | { | ||||
| @@ -1280,7 +1280,7 @@ public: | |||||
| ScopedPointer<XmlElement> plist (XmlDocument::parse (owner.getPListToMergeString())); | ScopedPointer<XmlElement> plist (XmlDocument::parse (owner.getPListToMergeString())); | ||||
| if (plist == nullptr || ! plist->hasTagName ("plist")) | if (plist == nullptr || ! plist->hasTagName ("plist")) | ||||
| plist = new XmlElement ("plist"); | |||||
| plist.reset (new XmlElement ("plist")); | |||||
| auto* dict = plist->getChildByName ("dict"); | auto* dict = plist->getChildByName ("dict"); | ||||
| @@ -2493,7 +2493,7 @@ private: | |||||
| v->setProperty ("path", pathString, nullptr); | v->setProperty ("path", pathString, nullptr); | ||||
| v->setProperty ("sourceTree", sourceTree, nullptr); | v->setProperty ("sourceTree", sourceTree, nullptr); | ||||
| auto existing = pbxFileReferences.indexOfSorted (*this, v); | |||||
| auto existing = pbxFileReferences.indexOfSorted (*this, v.get()); | |||||
| if (existing >= 0) | if (existing >= 0) | ||||
| { | { | ||||
| @@ -792,15 +792,15 @@ Image ProjectExporter::getBestIconForSize (int size, bool returnNullIfNothingBig | |||||
| if (im1 != nullptr && im2 != nullptr) | if (im1 != nullptr && im2 != nullptr) | ||||
| { | { | ||||
| if (im1->getWidth() >= size && im2->getWidth() >= size) | if (im1->getWidth() >= size && im2->getWidth() >= size) | ||||
| im = im1->getWidth() < im2->getWidth() ? im1 : im2; | |||||
| im = im1->getWidth() < im2->getWidth() ? im1.get() : im2.get(); | |||||
| else if (im1->getWidth() >= size) | else if (im1->getWidth() >= size) | ||||
| im = im1; | |||||
| im = im1.get(); | |||||
| else if (im2->getWidth() >= size) | else if (im2->getWidth() >= size) | ||||
| im = im2; | |||||
| im = im2.get(); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| im = im1 != nullptr ? im1 : im2; | |||||
| im = im1 != nullptr ? im1.get() : im2.get(); | |||||
| } | } | ||||
| if (im == nullptr) | if (im == nullptr) | ||||
| @@ -699,7 +699,7 @@ private: | |||||
| JobStatus runJob() override | JobStatus runJob() override | ||||
| { | { | ||||
| owner.saveExporter (exporter, modules); | |||||
| owner.saveExporter (exporter.get(), modules); | |||||
| return jobHasFinished; | return jobHasFinished; | ||||
| } | } | ||||
| @@ -114,7 +114,7 @@ void StoredSettings::updateKeyMappings() | |||||
| const ScopedPointer<XmlElement> keys (commandManager->getKeyMappings()->createXml (true)); | const ScopedPointer<XmlElement> keys (commandManager->getKeyMappings()->createXml (true)); | ||||
| if (keys != nullptr) | if (keys != nullptr) | ||||
| getGlobalProperties().setValue ("keyMappings", keys); | |||||
| getGlobalProperties().setValue ("keyMappings", keys.get()); | |||||
| } | } | ||||
| } | } | ||||
| @@ -135,7 +135,7 @@ Result PIPGenerator::createJucerFile() | |||||
| auto outputFile = outputDirectory.getChildFile (metadata[Ids::name].toString() + ".jucer"); | auto outputFile = outputDirectory.getChildFile (metadata[Ids::name].toString() + ".jucer"); | ||||
| ScopedPointer<XmlElement> xml = root.createXml(); | |||||
| ScopedPointer<XmlElement> xml (root.createXml()); | |||||
| if (xml->writeToFile (outputFile, {})) | if (xml->writeToFile (outputFile, {})) | ||||
| return Result::ok(); | return Result::ok(); | ||||
| @@ -31,7 +31,7 @@ | |||||
| //============================================================================== | //============================================================================== | ||||
| void TreePanelBase::setRoot (JucerTreeViewBase* root) | void TreePanelBase::setRoot (JucerTreeViewBase* root) | ||||
| { | { | ||||
| rootItem = root; | |||||
| rootItem.reset (root); | |||||
| tree.setRootItem (root); | tree.setRootItem (root); | ||||
| tree.getRootItem()->setOpen (true); | tree.getRootItem()->setOpen (true); | ||||
| @@ -243,7 +243,7 @@ void JucerTreeViewBase::itemSelectionChanged (bool isNowSelected) | |||||
| { | { | ||||
| if (isNowSelected) | if (isNowSelected) | ||||
| { | { | ||||
| delayedSelectionTimer = new ItemSelectionTimer (*this); | |||||
| delayedSelectionTimer.reset (new ItemSelectionTimer (*this)); | |||||
| delayedSelectionTimer->startTimer (getMillisecsAllowedForDragGesture()); | delayedSelectionTimer->startTimer (getMillisecsAllowedForDragGesture()); | ||||
| } | } | ||||
| else | else | ||||
| @@ -78,7 +78,8 @@ void SlidingPanelComponent::addTab (const String& tabName, | |||||
| PageInfo* page = new PageInfo(); | PageInfo* page = new PageInfo(); | ||||
| pages.insert (insertIndex, page); | pages.insert (insertIndex, page); | ||||
| page->content = contentComponent; | page->content = contentComponent; | ||||
| addAndMakeVisible (page->dotButton = new DotButton (*this, pages.indexOf (page))); | |||||
| page->dotButton.reset (new DotButton (*this, pages.indexOf (page))); | |||||
| addAndMakeVisible (page->dotButton.get()); | |||||
| page->name = tabName; | page->name = tabName; | ||||
| page->shouldDelete = deleteComponentWhenNotNeeded; | page->shouldDelete = deleteComponentWhenNotNeeded; | ||||
| @@ -47,7 +47,8 @@ public: | |||||
| auto standardFont = Font (16.0f); | auto standardFont = Font (16.0f); | ||||
| addAndMakeVisible (loggedInUsernameLabel = new Label ("Username Label")); | |||||
| loggedInUsernameLabel.reset (new Label ("Username Label")); | |||||
| addAndMakeVisible (loggedInUsernameLabel.get()); | |||||
| loggedInUsernameLabel->setFont (standardFont); | loggedInUsernameLabel->setFont (standardFont); | ||||
| loggedInUsernameLabel->setJustificationType (Justification::centred); | loggedInUsernameLabel->setJustificationType (Justification::centred); | ||||
| @@ -57,13 +58,15 @@ public: | |||||
| loggedInUsernameLabel->setText ("GPL Mode: Re-compile with JUCER_ENABLE_GPL_MODE=0 to enable login!", | loggedInUsernameLabel->setText ("GPL Mode: Re-compile with JUCER_ENABLE_GPL_MODE=0 to enable login!", | ||||
| NotificationType::dontSendNotification); | NotificationType::dontSendNotification); | ||||
| #else | #else | ||||
| addAndMakeVisible (licenseTypeLabel = new Label ("License Type Label")); | |||||
| licenseTypeLabel.reset (new Label ("License Type Label")); | |||||
| addAndMakeVisible (licenseTypeLabel.get()); | |||||
| licenseTypeLabel->setFont (standardFont); | licenseTypeLabel->setFont (standardFont); | ||||
| licenseTypeLabel->setJustificationType (Justification::centred); | licenseTypeLabel->setJustificationType (Justification::centred); | ||||
| licenseTypeLabel->setMinimumHorizontalScale (1.0f); | licenseTypeLabel->setMinimumHorizontalScale (1.0f); | ||||
| addAndMakeVisible (logoutButton = new TextButton (isInsideWebview ? "Select different account..." : "Logout")); | |||||
| logoutButton.reset (new TextButton (isInsideWebview ? "Select different account..." : "Logout")); | |||||
| addAndMakeVisible (logoutButton.get()); | |||||
| logoutButton->setColour (TextButton::buttonColourId, findColour (secondaryButtonBackgroundColourId)); | logoutButton->setColour (TextButton::buttonColourId, findColour (secondaryButtonBackgroundColourId)); | ||||
| logoutButton->onClick = [this] | logoutButton->onClick = [this] | ||||
| @@ -74,7 +77,8 @@ public: | |||||
| if (! isInsideWebview) | if (! isInsideWebview) | ||||
| { | { | ||||
| addAndMakeVisible (switchLicenseButton = new TextButton ("Switch License")); | |||||
| switchLicenseButton.reset (new TextButton ("Switch License")); | |||||
| addAndMakeVisible (switchLicenseButton.get()); | |||||
| switchLicenseButton->onClick = [this] | switchLicenseButton->onClick = [this] | ||||
| { | { | ||||
| dismissCalloutBox(); | dismissCalloutBox(); | ||||
| @@ -421,10 +421,11 @@ public: | |||||
| } | } | ||||
| auto projectDir = fileBrowser.getSelectedFile (0); | auto projectDir = fileBrowser.getSelectedFile (0); | ||||
| ScopedPointer<Project> project (wizard->runWizard (*this, projectName.getText(), | |||||
| projectDir, | |||||
| modulesPathBox.isUsingGlobalPaths)); | |||||
| if (ScopedPointer<Project> project = wizard->runWizard (*this, projectName.getText(), | |||||
| projectDir, | |||||
| modulesPathBox.isUsingGlobalPaths)) | |||||
| if (project != nullptr) | |||||
| { | { | ||||
| mw->setProject (project.release()); | mw->setProject (project.release()); | ||||
| getAppSettings().lastWizardFolder = projectDir.getParentDirectory(); | getAppSettings().lastWizardFolder = projectDir.getParentDirectory(); | ||||
| @@ -42,13 +42,13 @@ public: | |||||
| ScopedPointer<XmlElement> svg (XmlDocument::parse (thumbSvg)); | ScopedPointer<XmlElement> svg (XmlDocument::parse (thumbSvg)); | ||||
| jassert (svg != nullptr); | jassert (svg != nullptr); | ||||
| thumb = Drawable::createFromSVG (*svg); | |||||
| thumb.reset (Drawable::createFromSVG (*svg)); | |||||
| // svg for thumbnail background highlight | // svg for thumbnail background highlight | ||||
| ScopedPointer<XmlElement> backSvg (XmlDocument::parse (BinaryData::wizard_Highlight_svg)); | ScopedPointer<XmlElement> backSvg (XmlDocument::parse (BinaryData::wizard_Highlight_svg)); | ||||
| jassert (backSvg != nullptr); | jassert (backSvg != nullptr); | ||||
| hoverBackground = Drawable::createFromSVG (*backSvg); | |||||
| hoverBackground.reset (Drawable::createFromSVG (*backSvg)); | |||||
| name = buttonName; | name = buttonName; | ||||
| @@ -240,12 +240,12 @@ public: | |||||
| const int type = formatsToTry [i + 1]; | const int type = formatsToTry [i + 1]; | ||||
| bitDepth = type & 255; | bitDepth = type & 255; | ||||
| converter = createConverter (isInput, bitDepth, | |||||
| (type & isFloatBit) != 0, | |||||
| (type & isLittleEndianBit) != 0, | |||||
| (type & onlyUseLower24Bits) != 0, | |||||
| numChannels, | |||||
| isInterleaved); | |||||
| converter.reset (createConverter (isInput, bitDepth, | |||||
| (type & isFloatBit) != 0, | |||||
| (type & isLittleEndianBit) != 0, | |||||
| (type & onlyUseLower24Bits) != 0, | |||||
| numChannels, | |||||
| isInterleaved)); | |||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| @@ -563,7 +563,7 @@ public: | |||||
| if (outputChannelDataForCallback.size() > 0 && outputId.isNotEmpty()) | if (outputChannelDataForCallback.size() > 0 && outputId.isNotEmpty()) | ||||
| { | { | ||||
| outputDevice = new ALSADevice (outputId, false); | |||||
| outputDevice.reset (new ALSADevice (outputId, false)); | |||||
| if (outputDevice->error.isNotEmpty()) | if (outputDevice->error.isNotEmpty()) | ||||
| { | { | ||||
| @@ -587,7 +587,7 @@ public: | |||||
| if (inputChannelDataForCallback.size() > 0 && inputId.isNotEmpty()) | if (inputChannelDataForCallback.size() > 0 && inputId.isNotEmpty()) | ||||
| { | { | ||||
| inputDevice = new ALSADevice (inputId, true); | |||||
| inputDevice.reset (new ALSADevice (inputId, true)); | |||||
| if (inputDevice->error.isNotEmpty()) | if (inputDevice->error.isNotEmpty()) | ||||
| { | { | ||||
| @@ -210,7 +210,7 @@ public: | |||||
| void registerCallback() | void registerCallback() | ||||
| { | { | ||||
| if (inputThread == nullptr) | if (inputThread == nullptr) | ||||
| inputThread = new MidiInputThread (*this); | |||||
| inputThread.reset (new MidiInputThread (*this)); | |||||
| if (++activeCallbacks - 1 == 0) | if (++activeCallbacks - 1 == 0) | ||||
| inputThread->startThread(); | inputThread->startThread(); | ||||
| @@ -266,7 +266,7 @@ private: | |||||
| deviceId = index; | deviceId = index; | ||||
| } | } | ||||
| collector = new MidiInCollector (parentService, input, *callback); | |||||
| collector.reset (new MidiInCollector (parentService, input, *callback)); | |||||
| HMIDIIN h; | HMIDIIN h; | ||||
| MMRESULT err = midiInOpen (&h, deviceId, | MMRESULT err = midiInOpen (&h, deviceId, | ||||
| @@ -1134,7 +1134,7 @@ MidiService::MidiService() | |||||
| #if JUCE_USE_WINRT_MIDI | #if JUCE_USE_WINRT_MIDI | ||||
| try | try | ||||
| { | { | ||||
| internal = new WinRTMidiService(); | |||||
| internal.reset (new WinRTMidiService()); | |||||
| return; | return; | ||||
| } | } | ||||
| catch (std::runtime_error&) | catch (std::runtime_error&) | ||||
| @@ -1142,7 +1142,7 @@ MidiService::MidiService() | |||||
| } | } | ||||
| #endif | #endif | ||||
| internal = new WindowsMidiService(); | |||||
| internal.reset (new WindowsMidiService()); | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -1171,7 +1171,7 @@ MidiInput* MidiInput::openDevice (const int index, MidiInputCallback* const call | |||||
| try | try | ||||
| { | { | ||||
| wrapper = MidiService::getInstance()->getService()->createInputWrapper (in, index, callback); | |||||
| wrapper.reset (MidiService::getInstance()->getService()->createInputWrapper (in.get(), index, callback)); | |||||
| } | } | ||||
| catch (std::runtime_error&) | catch (std::runtime_error&) | ||||
| { | { | ||||
| @@ -1208,7 +1208,7 @@ MidiOutput* MidiOutput::openDevice (const int index) | |||||
| try | try | ||||
| { | { | ||||
| wrapper = MidiService::getInstance()->getService()->createOutputWrapper (index); | |||||
| wrapper.reset (MidiService::getInstance()->getService()->createOutputWrapper (index)); | |||||
| } | } | ||||
| catch (std::runtime_error&) | catch (std::runtime_error&) | ||||
| { | { | ||||
| @@ -731,7 +731,7 @@ public: | |||||
| void updateFormatWithType (SourceType*) noexcept | void updateFormatWithType (SourceType*) noexcept | ||||
| { | { | ||||
| typedef AudioData::Pointer<AudioData::Float32, AudioData::NativeEndian, AudioData::NonInterleaved, AudioData::NonConst> NativeType; | typedef AudioData::Pointer<AudioData::Float32, AudioData::NativeEndian, AudioData::NonInterleaved, AudioData::NonConst> NativeType; | ||||
| converter = new AudioData::ConverterInstance<AudioData::Pointer<SourceType, AudioData::LittleEndian, AudioData::Interleaved, AudioData::Const>, NativeType> (actualNumChannels, 1); | |||||
| converter.reset (new AudioData::ConverterInstance<AudioData::Pointer<SourceType, AudioData::LittleEndian, AudioData::Interleaved, AudioData::Const>, NativeType> (actualNumChannels, 1)); | |||||
| } | } | ||||
| void updateFormat (bool isFloat) override | void updateFormat (bool isFloat) override | ||||
| @@ -888,7 +888,7 @@ public: | |||||
| void updateFormatWithType (DestType*) | void updateFormatWithType (DestType*) | ||||
| { | { | ||||
| typedef AudioData::Pointer<AudioData::Float32, AudioData::NativeEndian, AudioData::NonInterleaved, AudioData::Const> NativeType; | typedef AudioData::Pointer<AudioData::Float32, AudioData::NativeEndian, AudioData::NonInterleaved, AudioData::Const> NativeType; | ||||
| converter = new AudioData::ConverterInstance<NativeType, AudioData::Pointer<DestType, AudioData::LittleEndian, AudioData::Interleaved, AudioData::NonConst>> (1, actualNumChannels); | |||||
| converter.reset (new AudioData::ConverterInstance<NativeType, AudioData::Pointer<DestType, AudioData::LittleEndian, AudioData::Interleaved, AudioData::NonConst>> (1, actualNumChannels)); | |||||
| } | } | ||||
| void updateFormat (bool isFloat) override | void updateFormat (bool isFloat) override | ||||
| @@ -1024,8 +1024,8 @@ public: | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| WASAPIDeviceBase* d = inputDevice != nullptr ? static_cast<WASAPIDeviceBase*> (inputDevice) | |||||
| : static_cast<WASAPIDeviceBase*> (outputDevice); | |||||
| WASAPIDeviceBase* d = inputDevice != nullptr ? static_cast<WASAPIDeviceBase*> (inputDevice.get()) | |||||
| : static_cast<WASAPIDeviceBase*> (outputDevice.get()); | |||||
| defaultSampleRate = d->defaultSampleRate; | defaultSampleRate = d->defaultSampleRate; | ||||
| minBufferSize = d->minBufferSize; | minBufferSize = d->minBufferSize; | ||||
| defaultBufferSize = d->defaultBufferSize; | defaultBufferSize = d->defaultBufferSize; | ||||
| @@ -1303,7 +1303,7 @@ public: | |||||
| { | { | ||||
| // Note that this function is handed the input device so it can check for the event and make sure | // Note that this function is handed the input device so it can check for the event and make sure | ||||
| // the input reservoir is filled up correctly even when bufferSize > device actualBufferSize | // the input reservoir is filled up correctly even when bufferSize > device actualBufferSize | ||||
| outputDevice->copyBuffers (const_cast<const float**> (outputBuffers), numOutputBuffers, bufferSize, inputDevice, *this); | |||||
| outputDevice->copyBuffers (const_cast<const float**> (outputBuffers), numOutputBuffers, bufferSize, inputDevice.get(), *this); | |||||
| if (outputDevice->sampleRateHasChanged) | if (outputDevice->sampleRateHasChanged) | ||||
| { | { | ||||
| @@ -1375,9 +1375,9 @@ private: | |||||
| const EDataFlow flow = getDataFlow (device); | const EDataFlow flow = getDataFlow (device); | ||||
| if (deviceId == inputDeviceId && flow == eCapture) | if (deviceId == inputDeviceId && flow == eCapture) | ||||
| inputDevice = new WASAPIInputDevice (device, useExclusiveMode); | |||||
| inputDevice.reset (new WASAPIInputDevice (device, useExclusiveMode)); | |||||
| else if (deviceId == outputDeviceId && flow == eRender) | else if (deviceId == outputDeviceId && flow == eRender) | ||||
| outputDevice = new WASAPIOutputDevice (device, useExclusiveMode); | |||||
| outputDevice.reset (new WASAPIOutputDevice (device, useExclusiveMode)); | |||||
| } | } | ||||
| return (outputDeviceId.isEmpty() || (outputDevice != nullptr && outputDevice->isOk())) | return (outputDeviceId.isEmpty() || (outputDevice != nullptr && outputDevice->isOk())) | ||||
| @@ -1492,12 +1492,12 @@ public: | |||||
| if (outputIndex >= 0 || inputIndex >= 0) | if (outputIndex >= 0 || inputIndex >= 0) | ||||
| { | { | ||||
| device = new WASAPIAudioIODevice (outputDeviceName.isNotEmpty() ? outputDeviceName | |||||
| : inputDeviceName, | |||||
| getTypeName(), | |||||
| outputDeviceIds [outputIndex], | |||||
| inputDeviceIds [inputIndex], | |||||
| exclusiveMode); | |||||
| device.reset (new WASAPIAudioIODevice (outputDeviceName.isNotEmpty() ? outputDeviceName | |||||
| : inputDeviceName, | |||||
| getTypeName(), | |||||
| outputDeviceIds [outputIndex], | |||||
| inputDeviceIds [inputIndex], | |||||
| exclusiveMode)); | |||||
| if (! device->initialise()) | if (! device->initialise()) | ||||
| device = nullptr; | device = nullptr; | ||||
| @@ -533,7 +533,8 @@ namespace AAXClasses | |||||
| setOpaque (true); | setOpaque (true); | ||||
| setBroughtToFrontOnMouseClick (true); | setBroughtToFrontOnMouseClick (true); | ||||
| addAndMakeVisible (pluginEditor = plugin.createEditorIfNeeded()); | |||||
| pluginEditor.reset (plugin.createEditorIfNeeded()); | |||||
| addAndMakeVisible (pluginEditor.get()); | |||||
| if (pluginEditor != nullptr) | if (pluginEditor != nullptr) | ||||
| { | { | ||||
| @@ -551,7 +552,7 @@ namespace AAXClasses | |||||
| { | { | ||||
| PopupMenu::dismissAllActiveMenus(); | PopupMenu::dismissAllActiveMenus(); | ||||
| pluginEditor->removeMouseListener (this); | pluginEditor->removeMouseListener (this); | ||||
| pluginEditor->processor.editorBeingDeleted (pluginEditor); | |||||
| pluginEditor->processor.editorBeingDeleted (pluginEditor.get()); | |||||
| } | } | ||||
| } | } | ||||
| @@ -1425,9 +1426,8 @@ namespace AAXClasses | |||||
| { | { | ||||
| aaxWrapperProvidedBypassParam = true; | aaxWrapperProvidedBypassParam = true; | ||||
| ownedBypassParameter = new AudioParameterBool (cDefaultMasterBypassID, "Master Bypass", false, {}, {}, {}); | |||||
| bypassParameter = ownedBypassParameter; | |||||
| ownedBypassParameter.reset (new AudioParameterBool (cDefaultMasterBypassID, "Master Bypass", false, {}, {}, {})); | |||||
| bypassParameter = ownedBypassParameter.get(); | |||||
| } | } | ||||
| if (! bypassPartOfRegularParams) | if (! bypassPartOfRegularParams) | ||||
| @@ -1808,7 +1808,7 @@ namespace AAXClasses | |||||
| if (component == nullptr) | if (component == nullptr) | ||||
| { | { | ||||
| if (auto* params = dynamic_cast<JuceAAX_Processor*> (GetEffectParameters())) | if (auto* params = dynamic_cast<JuceAAX_Processor*> (GetEffectParameters())) | ||||
| component = new ContentWrapperComponent (*this, params->getPluginInstance()); | |||||
| component.reset (new ContentWrapperComponent (*this, params->getPluginInstance())); | |||||
| else | else | ||||
| jassertfalse; | jassertfalse; | ||||
| } | } | ||||
| @@ -2051,7 +2051,7 @@ namespace AAXClasses | |||||
| static void getPlugInDescription (AAX_IEffectDescriptor& descriptor, const AAX_IFeatureInfo* featureInfo) | static void getPlugInDescription (AAX_IEffectDescriptor& descriptor, const AAX_IFeatureInfo* featureInfo) | ||||
| { | { | ||||
| PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_AAX; | PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_AAX; | ||||
| ScopedPointer<AudioProcessor> plugin = createPluginFilterOfType (AudioProcessor::wrapperType_AAX); | |||||
| ScopedPointer<AudioProcessor> plugin (createPluginFilterOfType (AudioProcessor::wrapperType_AAX)); | |||||
| auto numInputBuses = plugin->getBusCount (true); | auto numInputBuses = plugin->getBusCount (true); | ||||
| auto numOutputBuses = plugin->getBusCount (false); | auto numOutputBuses = plugin->getBusCount (false); | ||||
| @@ -2141,11 +2141,11 @@ AAX_Result JUCE_CDECL GetEffectDescriptions (AAX_ICollection* collection) | |||||
| ScopedPointer<const AAX_IFeatureInfo> stemFormatFeatureInfo; | ScopedPointer<const AAX_IFeatureInfo> stemFormatFeatureInfo; | ||||
| if (const auto* hostDescription = collection->DescriptionHost()) | if (const auto* hostDescription = collection->DescriptionHost()) | ||||
| stemFormatFeatureInfo = hostDescription->AcquireFeatureProperties (AAXATTR_ClientFeature_StemFormat); | |||||
| stemFormatFeatureInfo.reset (hostDescription->AcquireFeatureProperties (AAXATTR_ClientFeature_StemFormat)); | |||||
| if (auto* descriptor = collection->NewDescriptor()) | if (auto* descriptor = collection->NewDescriptor()) | ||||
| { | { | ||||
| AAXClasses::getPlugInDescription (*descriptor, stemFormatFeatureInfo); | |||||
| AAXClasses::getPlugInDescription (*descriptor, stemFormatFeatureInfo.get()); | |||||
| collection->AddEffect (JUCE_STRINGIFY (JucePlugin_AAXIdentifier), descriptor); | collection->AddEffect (JUCE_STRINGIFY (JucePlugin_AAXIdentifier), descriptor); | ||||
| collection->SetManufacturerName (JucePlugin_Manufacturer); | collection->SetManufacturerName (JucePlugin_Manufacturer); | ||||
| @@ -107,7 +107,7 @@ struct AudioProcessorHolder | |||||
| initialiseJuce_GUI(); | initialiseJuce_GUI(); | ||||
| } | } | ||||
| juceFilter = createPluginFilterOfType (AudioProcessor::wrapperType_AudioUnit); | |||||
| juceFilter.reset (createPluginFilterOfType (AudioProcessor::wrapperType_AudioUnit)); | |||||
| // audio units do not have a notion of enabled or un-enabled buses | // audio units do not have a notion of enabled or un-enabled buses | ||||
| juceFilter->enableAllBuses(); | juceFilter->enableAllBuses(); | ||||
| @@ -128,8 +128,8 @@ public: | |||||
| JuceAU (AudioUnit component) | JuceAU (AudioUnit component) | ||||
| : AudioProcessorHolder(activePlugins.size() + activeUIs.size() == 0), | : AudioProcessorHolder(activePlugins.size() + activeUIs.size() == 0), | ||||
| MusicDeviceBase (component, | MusicDeviceBase (component, | ||||
| (UInt32) AudioUnitHelpers::getBusCount (juceFilter, true), | |||||
| (UInt32) AudioUnitHelpers::getBusCount (juceFilter, false)), | |||||
| (UInt32) AudioUnitHelpers::getBusCount (juceFilter.get(), true), | |||||
| (UInt32) AudioUnitHelpers::getBusCount (juceFilter.get(), false)), | |||||
| isBypassed (false), | isBypassed (false), | ||||
| mapper (*juceFilter) | mapper (*juceFilter) | ||||
| { | { | ||||
| @@ -208,7 +208,7 @@ public: | |||||
| return err; | return err; | ||||
| mapper.alloc(); | mapper.alloc(); | ||||
| pulledSucceeded.calloc (static_cast<size_t> (AudioUnitHelpers::getBusCount (juceFilter, true))); | |||||
| pulledSucceeded.calloc (static_cast<size_t> (AudioUnitHelpers::getBusCount (juceFilter.get(), true))); | |||||
| prepareToPlay(); | prepareToPlay(); | ||||
| @@ -298,7 +298,7 @@ public: | |||||
| if (isInput) return false; | if (isInput) return false; | ||||
| #endif | #endif | ||||
| const int busCount = AudioUnitHelpers::getBusCount (juceFilter, isInput); | |||||
| const int busCount = AudioUnitHelpers::getBusCount (juceFilter.get(), isInput); | |||||
| return (juceFilter->canAddBus (isInput) || (busCount > 0 && juceFilter->canRemoveBus (isInput))); | return (juceFilter->canAddBus (isInput) || (busCount > 0 && juceFilter->canRemoveBus (isInput))); | ||||
| #endif | #endif | ||||
| } | } | ||||
| @@ -311,12 +311,12 @@ public: | |||||
| if ((err = scopeToDirection (scope, isInput)) != noErr) | if ((err = scopeToDirection (scope, isInput)) != noErr) | ||||
| return err; | return err; | ||||
| if (count != (UInt32) AudioUnitHelpers::getBusCount (juceFilter, isInput)) | |||||
| if (count != (UInt32) AudioUnitHelpers::getBusCount (juceFilter.get(), isInput)) | |||||
| { | { | ||||
| #ifdef JucePlugin_PreferredChannelConfigurations | #ifdef JucePlugin_PreferredChannelConfigurations | ||||
| return kAudioUnitErr_PropertyNotWritable; | return kAudioUnitErr_PropertyNotWritable; | ||||
| #else | #else | ||||
| const int busCount = AudioUnitHelpers::getBusCount (juceFilter, isInput); | |||||
| const int busCount = AudioUnitHelpers::getBusCount (juceFilter.get(), isInput); | |||||
| if ((! juceFilter->canAddBus (isInput)) && ((busCount == 0) || (! juceFilter->canRemoveBus (isInput)))) | if ((! juceFilter->canAddBus (isInput)) && ((busCount == 0) || (! juceFilter->canRemoveBus (isInput)))) | ||||
| return kAudioUnitErr_PropertyNotWritable; | return kAudioUnitErr_PropertyNotWritable; | ||||
| @@ -360,7 +360,7 @@ public: | |||||
| if (err != noErr) | if (err != noErr) | ||||
| { | { | ||||
| // restore bus state | // restore bus state | ||||
| const int newBusCount = AudioUnitHelpers::getBusCount (juceFilter, isInput); | |||||
| const int newBusCount = AudioUnitHelpers::getBusCount (juceFilter.get(), isInput); | |||||
| for (int i = newBusCount; i != busCount; i += (busCount > newBusCount ? 1 : -1)) | for (int i = newBusCount; i != busCount; i += (busCount > newBusCount ? 1 : -1)) | ||||
| { | { | ||||
| if (busCount > newBusCount) | if (busCount > newBusCount) | ||||
| @@ -475,7 +475,7 @@ public: | |||||
| switch (inID) | switch (inID) | ||||
| { | { | ||||
| case juceFilterObjectPropertyID: | case juceFilterObjectPropertyID: | ||||
| ((void**) outData)[0] = (void*) static_cast<AudioProcessor*> (juceFilter); | |||||
| ((void**) outData)[0] = (void*) static_cast<AudioProcessor*> (juceFilter.get()); | |||||
| ((void**) outData)[1] = (void*) this; | ((void**) outData)[1] = (void*) this; | ||||
| return noErr; | return noErr; | ||||
| @@ -996,7 +996,7 @@ public: | |||||
| ComponentResult Version() override { return JucePlugin_VersionCode; } | ComponentResult Version() override { return JucePlugin_VersionCode; } | ||||
| bool SupportsTail() override { return true; } | bool SupportsTail() override { return true; } | ||||
| Float64 GetTailTime() override { return juceFilter->getTailLengthSeconds(); } | Float64 GetTailTime() override { return juceFilter->getTailLengthSeconds(); } | ||||
| double getSampleRate() { return AudioUnitHelpers::getBusCount (juceFilter, false) > 0 ? GetOutput(0)->GetStreamFormat().mSampleRate : 44100.0; } | |||||
| double getSampleRate() { return AudioUnitHelpers::getBusCount (juceFilter.get(), false) > 0 ? GetOutput (0)->GetStreamFormat().mSampleRate : 44100.0; } | |||||
| Float64 GetLatency() override | Float64 GetLatency() override | ||||
| { | { | ||||
| @@ -1831,7 +1831,7 @@ private: | |||||
| busIdx = static_cast<int> (element); | busIdx = static_cast<int> (element); | ||||
| if ((err = scopeToDirection (scope, isInput)) != noErr) return err; | if ((err = scopeToDirection (scope, isInput)) != noErr) return err; | ||||
| if (isPositiveAndBelow (busIdx, AudioUnitHelpers::getBusCount (juceFilter, isInput))) return noErr; | |||||
| if (isPositiveAndBelow (busIdx, AudioUnitHelpers::getBusCount (juceFilter.get(), isInput))) return noErr; | |||||
| return kAudioUnitErr_InvalidElement; | return kAudioUnitErr_InvalidElement; | ||||
| } | } | ||||
| @@ -1936,8 +1936,8 @@ private: | |||||
| OSStatus syncAudioUnitWithProcessor() | OSStatus syncAudioUnitWithProcessor() | ||||
| { | { | ||||
| OSStatus err = noErr; | OSStatus err = noErr; | ||||
| const int enabledInputs = AudioUnitHelpers::getBusCount (juceFilter, true); | |||||
| const int enabledOutputs = AudioUnitHelpers::getBusCount (juceFilter, false); | |||||
| const int enabledInputs = AudioUnitHelpers::getBusCount (juceFilter.get(), true); | |||||
| const int enabledOutputs = AudioUnitHelpers::getBusCount (juceFilter.get(), false); | |||||
| if ((err = MusicDeviceBase::SetBusCount (kAudioUnitScope_Input, static_cast<UInt32> (enabledInputs))) != noErr) | if ((err = MusicDeviceBase::SetBusCount (kAudioUnitScope_Input, static_cast<UInt32> (enabledInputs))) != noErr) | ||||
| return err; | return err; | ||||
| @@ -1958,8 +1958,8 @@ private: | |||||
| OSStatus syncProcessorWithAudioUnit() | OSStatus syncProcessorWithAudioUnit() | ||||
| { | { | ||||
| const int numInputBuses = AudioUnitHelpers::getBusCount (juceFilter, true); | |||||
| const int numOutputBuses = AudioUnitHelpers::getBusCount (juceFilter, false); | |||||
| const int numInputBuses = AudioUnitHelpers::getBusCount (juceFilter.get(), true); | |||||
| const int numOutputBuses = AudioUnitHelpers::getBusCount (juceFilter.get(), false); | |||||
| const int numInputElements = static_cast<int> (GetScope(kAudioUnitScope_Input). GetNumberOfElements()); | const int numInputElements = static_cast<int> (GetScope(kAudioUnitScope_Input). GetNumberOfElements()); | ||||
| const int numOutputElements = static_cast<int> (GetScope(kAudioUnitScope_Output).GetNumberOfElements()); | const int numOutputElements = static_cast<int> (GetScope(kAudioUnitScope_Output).GetNumberOfElements()); | ||||
| @@ -1994,7 +1994,7 @@ private: | |||||
| return kAudioUnitErr_FormatNotSupported; | return kAudioUnitErr_FormatNotSupported; | ||||
| #endif | #endif | ||||
| if (! AudioUnitHelpers::setBusesLayout (juceFilter, requestedLayouts)) | |||||
| if (! AudioUnitHelpers::setBusesLayout (juceFilter.get(), requestedLayouts)) | |||||
| return kAudioUnitErr_FormatNotSupported; | return kAudioUnitErr_FormatNotSupported; | ||||
| // update total channel count | // update total channel count | ||||
| @@ -2094,7 +2094,7 @@ private: | |||||
| { | { | ||||
| auto& layouts = isInput ? supportedInputLayouts : supportedOutputLayouts; | auto& layouts = isInput ? supportedInputLayouts : supportedOutputLayouts; | ||||
| layouts.clear(); | layouts.clear(); | ||||
| auto numBuses = AudioUnitHelpers::getBusCount (juceFilter, isInput); | |||||
| auto numBuses = AudioUnitHelpers::getBusCount (juceFilter.get(), isInput); | |||||
| for (int busNr = 0; busNr < numBuses; ++busNr) | for (int busNr = 0; busNr < numBuses; ++busNr) | ||||
| { | { | ||||
| @@ -2109,8 +2109,8 @@ private: | |||||
| { | { | ||||
| currentInputLayout.clear(); currentOutputLayout.clear(); | currentInputLayout.clear(); currentOutputLayout.clear(); | ||||
| currentInputLayout. resize (AudioUnitHelpers::getBusCount (juceFilter, true)); | |||||
| currentOutputLayout.resize (AudioUnitHelpers::getBusCount (juceFilter, false)); | |||||
| currentInputLayout. resize (AudioUnitHelpers::getBusCount (juceFilter.get(), true)); | |||||
| currentOutputLayout.resize (AudioUnitHelpers::getBusCount (juceFilter.get(), false)); | |||||
| addSupportedLayoutTagsForDirection (true); | addSupportedLayoutTagsForDirection (true); | ||||
| addSupportedLayoutTagsForDirection (false); | addSupportedLayoutTagsForDirection (false); | ||||
| @@ -102,8 +102,8 @@ struct AudioProcessorHolder : public ReferenceCountedObject | |||||
| AudioProcessorHolder() {} | AudioProcessorHolder() {} | ||||
| AudioProcessorHolder (AudioProcessor* p) : processor (p) {} | AudioProcessorHolder (AudioProcessor* p) : processor (p) {} | ||||
| AudioProcessor& operator*() noexcept { return *processor; } | AudioProcessor& operator*() noexcept { return *processor; } | ||||
| AudioProcessor* operator->() noexcept { return processor; } | |||||
| AudioProcessor* get() noexcept { return processor; } | |||||
| AudioProcessor* operator->() noexcept { return processor.get(); } | |||||
| AudioProcessor* get() noexcept { return processor.get(); } | |||||
| struct ViewConfig | struct ViewConfig | ||||
| { | { | ||||
| @@ -468,7 +468,7 @@ public: | |||||
| if (editorObserverToken != nullptr) | if (editorObserverToken != nullptr) | ||||
| { | { | ||||
| [paramTree removeParameterObserver: editorObserverToken]; | |||||
| [paramTree.get() removeParameterObserver: editorObserverToken]; | |||||
| editorObserverToken = nullptr; | editorObserverToken = nullptr; | ||||
| } | } | ||||
| } | } | ||||
| @@ -509,15 +509,14 @@ public: | |||||
| totalOutChannels = processor.getTotalNumOutputChannels(); | totalOutChannels = processor.getTotalNumOutputChannels(); | ||||
| { | { | ||||
| channelCapabilities = [[NSMutableArray<NSNumber*> alloc] init]; | |||||
| channelCapabilities.reset ([[NSMutableArray<NSNumber*> alloc] init]); | |||||
| for (int i = 0; i < channelInfos.size(); ++i) | for (int i = 0; i < channelInfos.size(); ++i) | ||||
| { | { | ||||
| AUChannelInfo& info = channelInfos.getReference (i); | AUChannelInfo& info = channelInfos.getReference (i); | ||||
| [channelCapabilities addObject: [NSNumber numberWithInteger: info.inChannels]]; | |||||
| [channelCapabilities addObject: [NSNumber numberWithInteger: info.outChannels]]; | |||||
| [channelCapabilities.get() addObject: [NSNumber numberWithInteger: info.inChannels]]; | |||||
| [channelCapabilities.get() addObject: [NSNumber numberWithInteger: info.outChannels]]; | |||||
| } | } | ||||
| } | } | ||||
| @@ -547,18 +546,18 @@ public: | |||||
| //============================================================================== | //============================================================================== | ||||
| AUAudioUnitPreset* getCurrentPreset() override | AUAudioUnitPreset* getCurrentPreset() override | ||||
| { | { | ||||
| const int n = static_cast<int> ([factoryPresets count]); | |||||
| const int n = static_cast<int> ([factoryPresets.get() count]); | |||||
| const int idx = static_cast<int> (getAudioProcessor().getCurrentProgram()); | const int idx = static_cast<int> (getAudioProcessor().getCurrentProgram()); | ||||
| if (idx < n) | if (idx < n) | ||||
| return [factoryPresets objectAtIndex:static_cast<unsigned int> (idx)]; | |||||
| return [factoryPresets.get() objectAtIndex:static_cast<unsigned int> (idx)]; | |||||
| return nullptr; | return nullptr; | ||||
| } | } | ||||
| void setCurrentPreset(AUAudioUnitPreset* preset) override | void setCurrentPreset(AUAudioUnitPreset* preset) override | ||||
| { | { | ||||
| const int n = static_cast<int> ([factoryPresets count]); | |||||
| const int n = static_cast<int> ([factoryPresets.get() count]); | |||||
| const int idx = static_cast<int> ([preset number]); | const int idx = static_cast<int> ([preset number]); | ||||
| if (isPositiveAndBelow (idx, n)) | if (isPositiveAndBelow (idx, n)) | ||||
| @@ -567,7 +566,7 @@ public: | |||||
| NSArray<AUAudioUnitPreset*>* getFactoryPresets() override | NSArray<AUAudioUnitPreset*>* getFactoryPresets() override | ||||
| { | { | ||||
| return factoryPresets; | |||||
| return factoryPresets.get(); | |||||
| } | } | ||||
| NSDictionary<NSString*, id>* getFullState() override | NSDictionary<NSString*, id>* getFullState() override | ||||
| @@ -637,17 +636,17 @@ public: | |||||
| AUParameterTree* getParameterTree() override | AUParameterTree* getParameterTree() override | ||||
| { | { | ||||
| return paramTree; | |||||
| return paramTree.get(); | |||||
| } | } | ||||
| NSArray<NSNumber*>* parametersForOverviewWithCount (int count) override | NSArray<NSNumber*>* parametersForOverviewWithCount (int count) override | ||||
| { | { | ||||
| const int n = static_cast<int> ([overviewParams count]); | |||||
| const int n = static_cast<int> ([overviewParams.get() count]); | |||||
| if (count >= n) | if (count >= n) | ||||
| return overviewParams; | |||||
| return overviewParams.get(); | |||||
| NSMutableArray<NSNumber*>* retval = [[NSMutableArray<NSNumber*>alloc] initWithArray: overviewParams]; | |||||
| NSMutableArray<NSNumber*>* retval = [[NSMutableArray<NSNumber*>alloc] initWithArray: overviewParams.get()]; | |||||
| [retval removeObjectsInRange: NSMakeRange (static_cast<unsigned int> (count), static_cast<unsigned int> (n - count))]; | [retval removeObjectsInRange: NSMakeRange (static_cast<unsigned int> (count), static_cast<unsigned int> (n - count))]; | ||||
| return [retval autorelease]; | return [retval autorelease]; | ||||
| @@ -666,9 +665,9 @@ public: | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| AUAudioUnitBusArray* getInputBusses() override { return inputBusses; } | |||||
| AUAudioUnitBusArray* getOutputBusses() override { return outputBusses; } | |||||
| NSArray<NSNumber*>* getChannelCapabilities() override { return channelCapabilities; } | |||||
| AUAudioUnitBusArray* getInputBusses() override { return inputBusses.get(); } | |||||
| AUAudioUnitBusArray* getOutputBusses() override { return outputBusses.get(); } | |||||
| NSArray<NSNumber*>* getChannelCapabilities() override { return channelCapabilities.get(); } | |||||
| bool shouldChangeToFormat (AVAudioFormat* format, AUAudioUnitBus* auBus) override | bool shouldChangeToFormat (AVAudioFormat* format, AUAudioUnitBus* auBus) override | ||||
| { | { | ||||
| @@ -858,7 +857,7 @@ public: | |||||
| audioBuffer.prepare (totalInChannels, totalOutChannels, static_cast<int> (maxFrames)); | audioBuffer.prepare (totalInChannels, totalOutChannels, static_cast<int> (maxFrames)); | ||||
| double sampleRate = (jmax (AudioUnitHelpers::getBusCount (&processor, true), AudioUnitHelpers::getBusCount (&processor, false)) > 0 ? | double sampleRate = (jmax (AudioUnitHelpers::getBusCount (&processor, true), AudioUnitHelpers::getBusCount (&processor, false)) > 0 ? | ||||
| [[[([inputBusses count] > 0 ? inputBusses : outputBusses) objectAtIndexedSubscript: 0] format] sampleRate] : 44100.0); | |||||
| [[[([inputBusses.get() count] > 0 ? inputBusses.get() : outputBusses.get()) objectAtIndexedSubscript: 0] format] sampleRate] : 44100.0); | |||||
| processor.setRateAndBufferSizeDetails (sampleRate, static_cast<int> (maxFrames)); | processor.setRateAndBufferSizeDetails (sampleRate, static_cast<int> (maxFrames)); | ||||
| processor.prepareToPlay (sampleRate, static_cast<int> (maxFrames)); | processor.prepareToPlay (sampleRate, static_cast<int> (maxFrames)); | ||||
| @@ -948,7 +947,7 @@ public: | |||||
| if (isPositiveAndBelow (idx, juceParameters.getNumParameters())) | if (isPositiveAndBelow (idx, juceParameters.getNumParameters())) | ||||
| { | { | ||||
| if (AUParameter* param = [paramTree parameterWithAddress: getAUParameterAddressForIndex (idx)]) | |||||
| if (AUParameter* param = [paramTree.get() parameterWithAddress: getAUParameterAddressForIndex (idx)]) | |||||
| { | { | ||||
| if (editorObserverToken != nullptr) | if (editorObserverToken != nullptr) | ||||
| [param setValue: newValue originator: editorObserverToken]; | [param setValue: newValue originator: editorObserverToken]; | ||||
| @@ -1133,7 +1132,7 @@ private: | |||||
| //============================================================================== | //============================================================================== | ||||
| void addAudioUnitBusses (bool isInput) | void addAudioUnitBusses (bool isInput) | ||||
| { | { | ||||
| ScopedPointer<NSMutableArray<AUAudioUnitBus*>> array = [[NSMutableArray<AUAudioUnitBus*> alloc] init]; | |||||
| ScopedPointer<NSMutableArray<AUAudioUnitBus*>> array ([[NSMutableArray<AUAudioUnitBus*> alloc] init]); | |||||
| AudioProcessor& processor = getAudioProcessor(); | AudioProcessor& processor = getAudioProcessor(); | ||||
| const int n = AudioUnitHelpers::getBusCount (&processor, isInput); | const int n = AudioUnitHelpers::getBusCount (&processor, isInput); | ||||
| @@ -1142,19 +1141,19 @@ private: | |||||
| ScopedPointer<AUAudioUnitBus> audioUnitBus; | ScopedPointer<AUAudioUnitBus> audioUnitBus; | ||||
| { | { | ||||
| ScopedPointer<AVAudioFormat> defaultFormat = [[AVAudioFormat alloc] initStandardFormatWithSampleRate: kDefaultSampleRate | |||||
| channels: static_cast<AVAudioChannelCount> (processor.getChannelCountOfBus (isInput, i))]; | |||||
| ScopedPointer<AVAudioFormat> defaultFormat ([[AVAudioFormat alloc] initStandardFormatWithSampleRate: kDefaultSampleRate | |||||
| channels: static_cast<AVAudioChannelCount> (processor.getChannelCountOfBus (isInput, i))]); | |||||
| audioUnitBus = [[AUAudioUnitBus alloc] initWithFormat: defaultFormat | |||||
| error: nullptr]; | |||||
| audioUnitBus.reset ([[AUAudioUnitBus alloc] initWithFormat: defaultFormat.get() | |||||
| error: nullptr]); | |||||
| } | } | ||||
| [array addObject: audioUnitBus]; | |||||
| [array.get() addObject: audioUnitBus.get()]; | |||||
| } | } | ||||
| (isInput ? inputBusses : outputBusses) = [[AUAudioUnitBusArray alloc] initWithAudioUnit: au | |||||
| busType: (isInput ? AUAudioUnitBusTypeInput : AUAudioUnitBusTypeOutput) | |||||
| busses: array]; | |||||
| (isInput ? inputBusses : outputBusses).reset ([[AUAudioUnitBusArray alloc] initWithAudioUnit: au | |||||
| busType: (isInput ? AUAudioUnitBusTypeInput : AUAudioUnitBusTypeOutput) | |||||
| busses: array.get()]); | |||||
| } | } | ||||
| // When parameters are discrete we need to use integer values. | // When parameters are discrete we need to use integer values. | ||||
| @@ -1170,9 +1169,9 @@ private: | |||||
| void addParameters() | void addParameters() | ||||
| { | { | ||||
| ScopedPointer<NSMutableArray<AUParameterNode*>> params = [[NSMutableArray<AUParameterNode*> alloc] init]; | |||||
| ScopedPointer<NSMutableArray<AUParameterNode*>> params ([[NSMutableArray<AUParameterNode*> alloc] init]); | |||||
| overviewParams = [[NSMutableArray<NSNumber*> alloc] init]; | |||||
| overviewParams.reset ([[NSMutableArray<NSNumber*> alloc] init]); | |||||
| auto& processor = getAudioProcessor(); | auto& processor = getAudioProcessor(); | ||||
| juceParameters.update (processor, forceLegacyParamIDs); | juceParameters.update (processor, forceLegacyParamIDs); | ||||
| @@ -1252,40 +1251,40 @@ private: | |||||
| #endif | #endif | ||||
| // create methods in AUParameterTree return unretained objects (!) -> see Apple header AUAudioUnitImplementation.h | // create methods in AUParameterTree return unretained objects (!) -> see Apple header AUAudioUnitImplementation.h | ||||
| ScopedPointer<AUParameter> param = [[AUParameterTree createParameterWithIdentifier: juceStringToNS (identifier) | |||||
| name: juceStringToNS (name) | |||||
| address: address | |||||
| min: 0.0f | |||||
| max: getMaximumParameterValue (juceParam) | |||||
| unit: unit | |||||
| unitName: nullptr | |||||
| flags: flags | |||||
| valueStrings: valueStrings.get() | |||||
| dependentParameters: nullptr] retain]; | |||||
| ScopedPointer<AUParameter> param ([[AUParameterTree createParameterWithIdentifier: juceStringToNS (identifier) | |||||
| name: juceStringToNS (name) | |||||
| address: address | |||||
| min: 0.0f | |||||
| max: getMaximumParameterValue (juceParam) | |||||
| unit: unit | |||||
| unitName: nullptr | |||||
| flags: flags | |||||
| valueStrings: valueStrings.get() | |||||
| dependentParameters: nullptr] retain]); | |||||
| [param.get() setValue: juceParam->getDefaultValue()]; | [param.get() setValue: juceParam->getDefaultValue()]; | ||||
| [params addObject: param]; | |||||
| [overviewParams addObject: [NSNumber numberWithUnsignedLongLong:address]]; | |||||
| [params.get() addObject: param.get()]; | |||||
| [overviewParams.get() addObject: [NSNumber numberWithUnsignedLongLong:address]]; | |||||
| } | } | ||||
| // create methods in AUParameterTree return unretained objects (!) -> see Apple header AUAudioUnitImplementation.h | // create methods in AUParameterTree return unretained objects (!) -> see Apple header AUAudioUnitImplementation.h | ||||
| paramTree = [[AUParameterTree createTreeWithChildren: params] retain]; | |||||
| paramTree.reset ([[AUParameterTree createTreeWithChildren: params.get()] retain]); | |||||
| paramObserver = CreateObjCBlock (this, &JuceAudioUnitv3::valueChangedFromHost); | paramObserver = CreateObjCBlock (this, &JuceAudioUnitv3::valueChangedFromHost); | ||||
| paramProvider = CreateObjCBlock (this, &JuceAudioUnitv3::getValue); | paramProvider = CreateObjCBlock (this, &JuceAudioUnitv3::getValue); | ||||
| stringFromValueProvider = CreateObjCBlock (this, &JuceAudioUnitv3::stringFromValue); | stringFromValueProvider = CreateObjCBlock (this, &JuceAudioUnitv3::stringFromValue); | ||||
| valueFromStringProvider = CreateObjCBlock (this, &JuceAudioUnitv3::valueFromString); | valueFromStringProvider = CreateObjCBlock (this, &JuceAudioUnitv3::valueFromString); | ||||
| [paramTree setImplementorValueObserver: paramObserver]; | |||||
| [paramTree setImplementorValueProvider: paramProvider]; | |||||
| [paramTree setImplementorStringFromValueCallback: stringFromValueProvider]; | |||||
| [paramTree setImplementorValueFromStringCallback: valueFromStringProvider]; | |||||
| [paramTree.get() setImplementorValueObserver: paramObserver]; | |||||
| [paramTree.get() setImplementorValueProvider: paramProvider]; | |||||
| [paramTree.get() setImplementorStringFromValueCallback: stringFromValueProvider]; | |||||
| [paramTree.get() setImplementorValueFromStringCallback: valueFromStringProvider]; | |||||
| if (processor.hasEditor()) | if (processor.hasEditor()) | ||||
| { | { | ||||
| editorParamObserver = CreateObjCBlock (this, &JuceAudioUnitv3::valueChangedForObserver); | editorParamObserver = CreateObjCBlock (this, &JuceAudioUnitv3::valueChangedForObserver); | ||||
| editorObserverToken = [paramTree tokenByAddingParameterObserver: editorParamObserver]; | |||||
| editorObserverToken = [paramTree.get() tokenByAddingParameterObserver: editorParamObserver]; | |||||
| } | } | ||||
| if ((bypassParam = processor.getBypassParameter()) != nullptr) | if ((bypassParam = processor.getBypassParameter()) != nullptr) | ||||
| @@ -1305,7 +1304,7 @@ private: | |||||
| void addPresets() | void addPresets() | ||||
| { | { | ||||
| factoryPresets = [[NSMutableArray<AUAudioUnitPreset*> alloc] init]; | |||||
| factoryPresets.reset ([[NSMutableArray<AUAudioUnitPreset*> alloc] init]); | |||||
| const int n = getAudioProcessor().getNumPrograms(); | const int n = getAudioProcessor().getNumPrograms(); | ||||
| @@ -1313,11 +1312,11 @@ private: | |||||
| { | { | ||||
| String name = getAudioProcessor().getProgramName (idx); | String name = getAudioProcessor().getProgramName (idx); | ||||
| ScopedPointer<AUAudioUnitPreset> preset = [[AUAudioUnitPreset alloc] init]; | |||||
| [preset setName: juceStringToNS (name)]; | |||||
| [preset setNumber: static_cast<NSInteger> (idx)]; | |||||
| ScopedPointer<AUAudioUnitPreset> preset ([[AUAudioUnitPreset alloc] init]); | |||||
| [preset.get() setName: juceStringToNS (name)]; | |||||
| [preset.get() setNumber: static_cast<NSInteger> (idx)]; | |||||
| [factoryPresets addObject: preset]; | |||||
| [factoryPresets.get() addObject: preset.get()]; | |||||
| } | } | ||||
| } | } | ||||
| @@ -1331,7 +1330,7 @@ private: | |||||
| const AUAudioFrameCount maxFrames = [getAudioUnit() maximumFramesToRender]; | const AUAudioFrameCount maxFrames = [getAudioUnit() maximumFramesToRender]; | ||||
| for (int busIdx = 0; busIdx < n; ++busIdx) | for (int busIdx = 0; busIdx < n; ++busIdx) | ||||
| busBuffers.add (new BusBuffer ([(isInput ? inputBusses : outputBusses) objectAtIndexedSubscript: static_cast<unsigned int> (busIdx)], | |||||
| busBuffers.add (new BusBuffer ([(isInput ? inputBusses.get() : outputBusses.get()) objectAtIndexedSubscript: static_cast<unsigned int> (busIdx)], | |||||
| static_cast<int> (maxFrames))); | static_cast<int> (maxFrames))); | ||||
| } | } | ||||
| @@ -1848,7 +1847,7 @@ private: | |||||
| ScopedPointer<JuceAUViewController> cpp; | ScopedPointer<JuceAUViewController> cpp; | ||||
| } | } | ||||
| - (instancetype) initWithNibName: (nullable NSString*) nib bundle: (nullable NSBundle*) bndl { self = [super initWithNibName: nib bundle: bndl]; cpp = new JuceAUViewController (self); return self; } | |||||
| - (instancetype) initWithNibName: (nullable NSString*) nib bundle: (nullable NSBundle*) bndl { self = [super initWithNibName: nib bundle: bndl]; cpp.reset (new JuceAUViewController (self)); return self; } | |||||
| - (void) loadView { cpp->loadView(); } | - (void) loadView { cpp->loadView(); } | ||||
| - (AUAudioUnit *) createAudioUnitWithComponentDescription: (AudioComponentDescription) desc error: (NSError **) error { return cpp->createAudioUnit (desc, error); } | - (AUAudioUnit *) createAudioUnitWithComponentDescription: (AudioComponentDescription) desc error: (NSError **) error { return cpp->createAudioUnit (desc, error); } | ||||
| - (CGSize) preferredContentSize { return cpp->getPreferredContentSize(); } | - (CGSize) preferredContentSize { return cpp->getPreferredContentSize(); } | ||||
| @@ -99,7 +99,7 @@ public: | |||||
| //============================================================================== | //============================================================================== | ||||
| void initialise (const String&) override | void initialise (const String&) override | ||||
| { | { | ||||
| mainWindow = createWindow(); | |||||
| mainWindow.reset (createWindow()); | |||||
| #if JUCE_STANDALONE_FILTER_WINDOW_USE_KIOSK_MODE | #if JUCE_STANDALONE_FILTER_WINDOW_USE_KIOSK_MODE | ||||
| Desktop::getInstance().setKioskModeComponent (mainWindow, false); | Desktop::getInstance().setKioskModeComponent (mainWindow, false); | ||||
| @@ -87,7 +87,7 @@ public: | |||||
| : processor->getMainBusNumInputChannels()); | : processor->getMainBusNumInputChannels()); | ||||
| if (preferredSetupOptions != nullptr) | if (preferredSetupOptions != nullptr) | ||||
| options = new AudioDeviceManager::AudioDeviceSetup (*preferredSetupOptions); | |||||
| options.reset (new AudioDeviceManager::AudioDeviceSetup (*preferredSetupOptions)); | |||||
| if (inChannels > 0 && RuntimePermissions::isRequired (RuntimePermissions::recordAudio) | if (inChannels > 0 && RuntimePermissions::isRequired (RuntimePermissions::recordAudio) | ||||
| && ! RuntimePermissions::isGranted (RuntimePermissions::recordAudio)) | && ! RuntimePermissions::isGranted (RuntimePermissions::recordAudio)) | ||||
| @@ -99,7 +99,7 @@ public: | |||||
| void init (bool enableAudioInput, const String& preferredDefaultDeviceName) | void init (bool enableAudioInput, const String& preferredDefaultDeviceName) | ||||
| { | { | ||||
| setupAudioDevices (enableAudioInput, preferredDefaultDeviceName, options); | |||||
| setupAudioDevices (enableAudioInput, preferredDefaultDeviceName, options.get()); | |||||
| reloadPluginState(); | reloadPluginState(); | ||||
| startPlaying(); | startPlaying(); | ||||
| @@ -120,7 +120,7 @@ public: | |||||
| { | { | ||||
| #if JUCE_MODULE_AVAILABLE_juce_audio_plugin_client | #if JUCE_MODULE_AVAILABLE_juce_audio_plugin_client | ||||
| processor = ::createPluginFilterOfType (AudioProcessor::wrapperType_Standalone); | |||||
| processor.reset (::createPluginFilterOfType (AudioProcessor::wrapperType_Standalone)); | |||||
| #else | #else | ||||
| AudioProcessor::setTypeOfNextNewPlugin (AudioProcessor::wrapperType_Standalone); | AudioProcessor::setTypeOfNextNewPlugin (AudioProcessor::wrapperType_Standalone); | ||||
| processor = createPluginFilter(); | processor = createPluginFilter(); | ||||
| @@ -228,7 +228,7 @@ public: | |||||
| //============================================================================== | //============================================================================== | ||||
| void startPlaying() | void startPlaying() | ||||
| { | { | ||||
| player.setProcessor (processor); | |||||
| player.setProcessor (processor.get()); | |||||
| #if JucePlugin_Enable_IAA && JUCE_IOS | #if JucePlugin_Enable_IAA && JUCE_IOS | ||||
| if (auto device = dynamic_cast<iOSAudioIODevice*> (deviceManager.getCurrentAudioDevice())) | if (auto device = dynamic_cast<iOSAudioIODevice*> (deviceManager.getCurrentAudioDevice())) | ||||
| @@ -297,7 +297,7 @@ public: | |||||
| { | { | ||||
| ScopedPointer<XmlElement> xml (deviceManager.createStateXml()); | ScopedPointer<XmlElement> xml (deviceManager.createStateXml()); | ||||
| settings->setValue ("audioSetup", xml); | |||||
| settings->setValue ("audioSetup", xml.get()); | |||||
| #if ! (JUCE_IOS || JUCE_ANDROID) | #if ! (JUCE_IOS || JUCE_ANDROID) | ||||
| settings->setValue ("shouldMuteInput", (bool) shouldMuteInput.getValue()); | settings->setValue ("shouldMuteInput", (bool) shouldMuteInput.getValue()); | ||||
| @@ -313,7 +313,7 @@ public: | |||||
| if (settings != nullptr) | if (settings != nullptr) | ||||
| { | { | ||||
| savedState = settings->getXmlValue ("audioSetup"); | |||||
| savedState.reset (settings->getXmlValue ("audioSetup")); | |||||
| #if ! (JUCE_IOS || JUCE_ANDROID) | #if ! (JUCE_IOS || JUCE_ANDROID) | ||||
| shouldMuteInput.setValue (settings->getBoolValue ("shouldMuteInput", true)); | shouldMuteInput.setValue (settings->getBoolValue ("shouldMuteInput", true)); | ||||
| @@ -332,7 +332,7 @@ public: | |||||
| deviceManager.initialise (enableAudioInput ? totalInChannels : 0, | deviceManager.initialise (enableAudioInput ? totalInChannels : 0, | ||||
| totalOutChannels, | totalOutChannels, | ||||
| savedState, | |||||
| savedState.get(), | |||||
| true, | true, | ||||
| preferredDefaultDeviceName, | preferredDefaultDeviceName, | ||||
| preferredSetupOptions); | preferredSetupOptions); | ||||
| @@ -603,9 +603,9 @@ public: | |||||
| optionsButton.setTriggeredOnMouseDown (true); | optionsButton.setTriggeredOnMouseDown (true); | ||||
| #endif | #endif | ||||
| pluginHolder = new StandalonePluginHolder (settingsToUse, takeOwnershipOfSettings, | |||||
| preferredDefaultDeviceName, preferredSetupOptions, | |||||
| constrainToConfiguration, autoOpenMidiDevices); | |||||
| pluginHolder.reset (new StandalonePluginHolder (settingsToUse, takeOwnershipOfSettings, | |||||
| preferredDefaultDeviceName, preferredSetupOptions, | |||||
| constrainToConfiguration, autoOpenMidiDevices)); | |||||
| #if JUCE_IOS || JUCE_ANDROID | #if JUCE_IOS || JUCE_ANDROID | ||||
| setFullScreen (true); | setFullScreen (true); | ||||
| @@ -646,7 +646,7 @@ public: | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| AudioProcessor* getAudioProcessor() const noexcept { return pluginHolder->processor; } | |||||
| AudioProcessor* getAudioProcessor() const noexcept { return pluginHolder->processor.get(); } | |||||
| AudioDeviceManager& getDeviceManager() const noexcept { return pluginHolder->deviceManager; } | AudioDeviceManager& getDeviceManager() const noexcept { return pluginHolder->deviceManager; } | ||||
| /** Deletes and re-creates the plugin, resetting it to its default state. */ | /** Deletes and re-creates the plugin, resetting it to its default state. */ | ||||
| @@ -710,7 +710,7 @@ public: | |||||
| optionsButton.setBounds (8, 6, 60, getTitleBarHeight() - 8); | optionsButton.setBounds (8, 6, 60, getTitleBarHeight() - 8); | ||||
| } | } | ||||
| virtual StandalonePluginHolder* getPluginHolder() { return pluginHolder; } | |||||
| virtual StandalonePluginHolder* getPluginHolder() { return pluginHolder.get(); } | |||||
| ScopedPointer<StandalonePluginHolder> pluginHolder; | ScopedPointer<StandalonePluginHolder> pluginHolder; | ||||
| @@ -733,7 +733,7 @@ private: | |||||
| editor->addComponentListener (this); | editor->addComponentListener (this); | ||||
| componentMovedOrResized (*editor, false, true); | componentMovedOrResized (*editor, false, true); | ||||
| addAndMakeVisible (editor); | |||||
| addAndMakeVisible (editor.get()); | |||||
| } | } | ||||
| addChildComponent (notification); | addChildComponent (notification); | ||||
| @@ -752,7 +752,7 @@ private: | |||||
| if (editor != nullptr) | if (editor != nullptr) | ||||
| { | { | ||||
| editor->removeComponentListener (this); | editor->removeComponentListener (this); | ||||
| owner.pluginHolder->processor->editorBeingDeleted (editor); | |||||
| owner.pluginHolder->processor->editorBeingDeleted (editor.get()); | |||||
| editor = nullptr; | editor = nullptr; | ||||
| } | } | ||||
| } | } | ||||
| @@ -1072,7 +1072,7 @@ public: | |||||
| if (auto* ed = processor->createEditorIfNeeded()) | if (auto* ed = processor->createEditorIfNeeded()) | ||||
| { | { | ||||
| vstEffect.flags |= vstEffectFlagHasEditor; | vstEffect.flags |= vstEffectFlagHasEditor; | ||||
| editorComp = new EditorCompWrapper (*this, *ed); | |||||
| editorComp.reset (new EditorCompWrapper (*this, *ed)); | |||||
| #if ! (JUCE_MAC || JUCE_IOS) | #if ! (JUCE_MAC || JUCE_IOS) | ||||
| ed->setScaleFactor (editorScaleFactor); | ed->setScaleFactor (editorScaleFactor); | ||||
| @@ -98,7 +98,7 @@ public: | |||||
| virtual ~JuceAudioProcessor() {} | virtual ~JuceAudioProcessor() {} | ||||
| AudioProcessor* get() const noexcept { return audioProcessor; } | |||||
| AudioProcessor* get() const noexcept { return audioProcessor.get(); } | |||||
| JUCE_DECLARE_VST3_COM_QUERY_METHODS | JUCE_DECLARE_VST3_COM_QUERY_METHODS | ||||
| JUCE_DECLARE_VST3_COM_REF_METHODS | JUCE_DECLARE_VST3_COM_REF_METHODS | ||||
| @@ -169,7 +169,8 @@ private: | |||||
| if (bypassParameter == nullptr) | if (bypassParameter == nullptr) | ||||
| { | { | ||||
| vst3WrapperProvidedBypassParam = true; | vst3WrapperProvidedBypassParam = true; | ||||
| bypassParameter = ownedBypassParameter = new AudioParameterBool ("byps", "Bypass", false, {}, {}, {}); | |||||
| ownedBypassParameter.reset (new AudioParameterBool ("byps", "Bypass", false, {}, {}, {})); | |||||
| bypassParameter = ownedBypassParameter.get(); | |||||
| } | } | ||||
| // if the bypass parameter is not part of the exported parameters that the plug-in supports | // if the bypass parameter is not part of the exported parameters that the plug-in supports | ||||
| @@ -789,7 +790,7 @@ private: | |||||
| : Vst::EditorView (&ec, nullptr), | : Vst::EditorView (&ec, nullptr), | ||||
| owner (&ec), pluginInstance (p) | owner (&ec), pluginInstance (p) | ||||
| { | { | ||||
| component = new ContentWrapperComponent (*this, p); | |||||
| component.reset (new ContentWrapperComponent (*this, p)); | |||||
| } | } | ||||
| tresult PLUGIN_API queryInterface (const TUID targetIID, void** obj) override | tresult PLUGIN_API queryInterface (const TUID targetIID, void** obj) override | ||||
| @@ -822,7 +823,7 @@ private: | |||||
| return kResultFalse; | return kResultFalse; | ||||
| if (component == nullptr) | if (component == nullptr) | ||||
| component = new ContentWrapperComponent (*this, pluginInstance); | |||||
| component.reset (new ContentWrapperComponent (*this, pluginInstance)); | |||||
| #if JUCE_WINDOWS | #if JUCE_WINDOWS | ||||
| component->addToDesktop (0, parent); | component->addToDesktop (0, parent); | ||||
| @@ -830,7 +831,7 @@ private: | |||||
| component->setVisible (true); | component->setVisible (true); | ||||
| #else | #else | ||||
| isNSView = (strcmp (type, kPlatformTypeNSView) == 0); | isNSView = (strcmp (type, kPlatformTypeNSView) == 0); | ||||
| macHostWindow = juce::attachComponentToWindowRefVST (component, parent, isNSView); | |||||
| macHostWindow = juce::attachComponentToWindowRefVST (component.get(), parent, isNSView); | |||||
| #endif | #endif | ||||
| component->resizeHostWindow(); | component->resizeHostWindow(); | ||||
| @@ -853,7 +854,7 @@ private: | |||||
| #else | #else | ||||
| if (macHostWindow != nullptr) | if (macHostWindow != nullptr) | ||||
| { | { | ||||
| juce::detachComponentFromWindowRefVST (component, macHostWindow, isNSView); | |||||
| juce::detachComponentFromWindowRefVST (component.get(), macHostWindow, isNSView); | |||||
| macHostWindow = nullptr; | macHostWindow = nullptr; | ||||
| } | } | ||||
| #endif | #endif | ||||
| @@ -912,8 +913,8 @@ private: | |||||
| if (auto* editor = component->pluginEditor.get()) | if (auto* editor = component->pluginEditor.get()) | ||||
| { | { | ||||
| // checkSizeConstraint | // checkSizeConstraint | ||||
| auto juceRect = editor->getLocalArea (component, Rectangle<int>::leftTopRightBottom (rectToCheck->left, rectToCheck->top, | |||||
| rectToCheck->right, rectToCheck->bottom)); | |||||
| auto juceRect = editor->getLocalArea (component.get(), Rectangle<int>::leftTopRightBottom (rectToCheck->left, rectToCheck->top, | |||||
| rectToCheck->right, rectToCheck->bottom)); | |||||
| if (auto* constrainer = editor->getConstrainer()) | if (auto* constrainer = editor->getConstrainer()) | ||||
| { | { | ||||
| Rectangle<int> limits (0, 0, constrainer->getMaximumWidth(), constrainer->getMaximumHeight()); | Rectangle<int> limits (0, 0, constrainer->getMaximumWidth(), constrainer->getMaximumHeight()); | ||||
| @@ -972,7 +973,7 @@ private: | |||||
| if (pluginEditor != nullptr) | if (pluginEditor != nullptr) | ||||
| { | { | ||||
| addAndMakeVisible (pluginEditor); | |||||
| addAndMakeVisible (pluginEditor.get()); | |||||
| pluginEditor->setTopLeftPosition (0, 0); | pluginEditor->setTopLeftPosition (0, 0); | ||||
| lastBounds = getSizeToContainChild(); | lastBounds = getSizeToContainChild(); | ||||
| @@ -991,7 +992,7 @@ private: | |||||
| if (pluginEditor != nullptr) | if (pluginEditor != nullptr) | ||||
| { | { | ||||
| PopupMenu::dismissAllActiveMenus(); | PopupMenu::dismissAllActiveMenus(); | ||||
| pluginEditor->processor.editorBeingDeleted (pluginEditor); | |||||
| pluginEditor->processor.editorBeingDeleted (pluginEditor.get()); | |||||
| } | } | ||||
| } | } | ||||
| @@ -1003,7 +1004,7 @@ private: | |||||
| juce::Rectangle<int> getSizeToContainChild() | juce::Rectangle<int> getSizeToContainChild() | ||||
| { | { | ||||
| if (pluginEditor != nullptr) | if (pluginEditor != nullptr) | ||||
| return getLocalArea (pluginEditor, pluginEditor->getLocalBounds()); | |||||
| return getLocalArea (pluginEditor.get(), pluginEditor->getLocalBounds()); | |||||
| return {}; | return {}; | ||||
| } | } | ||||
| @@ -1452,7 +1452,7 @@ public: | |||||
| auSupportsBypass = (AudioUnitGetPropertyInfo (audioUnit, kAudioUnitProperty_BypassEffect, | auSupportsBypass = (AudioUnitGetPropertyInfo (audioUnit, kAudioUnitProperty_BypassEffect, | ||||
| kAudioUnitScope_Global, 0, &propertySize, &writable) == noErr | kAudioUnitScope_Global, 0, &propertySize, &writable) == noErr | ||||
| && propertySize >= sizeof (UInt32) && writable); | && propertySize >= sizeof (UInt32) && writable); | ||||
| bypassParam = new AUBypassParameter (*this); | |||||
| bypassParam.reset (new AUBypassParameter (*this)); | |||||
| } | } | ||||
| void updateLatency() | void updateLatency() | ||||
| @@ -1477,7 +1477,7 @@ private: | |||||
| { | { | ||||
| #if JUCE_WINDOWS | #if JUCE_WINDOWS | ||||
| if (auto* topComp = getTopLevelComponent()) | if (auto* topComp = getTopLevelComponent()) | ||||
| peer = embeddedComponent.createNewPeer (0, topComp->getWindowHandle()); | |||||
| peer.reset (embeddedComponent.createNewPeer (0, topComp->getWindowHandle())); | |||||
| else | else | ||||
| peer = nullptr; | peer = nullptr; | ||||
| @@ -659,11 +659,11 @@ struct ModuleHandle : public ReferenceCountedObject | |||||
| if (moduleMain != nullptr) | if (moduleMain != nullptr) | ||||
| { | { | ||||
| vstXml = XmlDocument::parse (file.withFileExtension ("vstxml")); | |||||
| vstXml.reset (XmlDocument::parse (file.withFileExtension ("vstxml"))); | |||||
| #if JUCE_WINDOWS | #if JUCE_WINDOWS | ||||
| if (vstXml == nullptr) | if (vstXml == nullptr) | ||||
| vstXml = XmlDocument::parse (getDLLResource (file, "VSTXML", 1)); | |||||
| vstXml.reset (XmlDocument::parse (getDLLResource (file, "VSTXML", 1))); | |||||
| #endif | #endif | ||||
| } | } | ||||
| @@ -1333,7 +1333,7 @@ void AudioProcessorGraph::processBlock (AudioBuffer<float>& buffer, MidiBuffer& | |||||
| if (isPrepared.get() == 0 && MessageManager::getInstance()->isThisTheMessageThread()) | if (isPrepared.get() == 0 && MessageManager::getInstance()->isThisTheMessageThread()) | ||||
| handleAsyncUpdate(); | handleAsyncUpdate(); | ||||
| processBlockForBuffer<float> (buffer, midiMessages, *this, renderSequenceFloat, isPrepared); | |||||
| processBlockForBuffer<float> (buffer, midiMessages, *this, renderSequenceFloat.get(), isPrepared); | |||||
| } | } | ||||
| void AudioProcessorGraph::processBlock (AudioBuffer<double>& buffer, MidiBuffer& midiMessages) | void AudioProcessorGraph::processBlock (AudioBuffer<double>& buffer, MidiBuffer& midiMessages) | ||||
| @@ -1341,7 +1341,7 @@ void AudioProcessorGraph::processBlock (AudioBuffer<double>& buffer, MidiBuffer& | |||||
| if (isPrepared.get() == 0 && MessageManager::getInstance()->isThisTheMessageThread()) | if (isPrepared.get() == 0 && MessageManager::getInstance()->isThisTheMessageThread()) | ||||
| handleAsyncUpdate(); | handleAsyncUpdate(); | ||||
| processBlockForBuffer<double> (buffer, midiMessages, *this, renderSequenceDouble, isPrepared); | |||||
| processBlockForBuffer<double> (buffer, midiMessages, *this, renderSequenceDouble.get(), isPrepared); | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -428,7 +428,7 @@ public: | |||||
| parameterComp.reset (new SliderParameterComponent (param)); | parameterComp.reset (new SliderParameterComponent (param)); | ||||
| } | } | ||||
| addAndMakeVisible (parameterComp); | |||||
| addAndMakeVisible (parameterComp.get()); | |||||
| setSize (400, 40); | setSize (400, 40); | ||||
| } | } | ||||
| @@ -90,7 +90,7 @@ struct RuleBasedTopologySource::Internal : public TopologySource::Listener, | |||||
| RuleBasedTopologySource::RuleBasedTopologySource (TopologySource& d) | RuleBasedTopologySource::RuleBasedTopologySource (TopologySource& d) | ||||
| { | { | ||||
| internal = new Internal (*this, d); | |||||
| internal.reset (new Internal (*this, d)); | |||||
| } | } | ||||
| RuleBasedTopologySource::~RuleBasedTopologySource() | RuleBasedTopologySource::~RuleBasedTopologySource() | ||||
| @@ -149,9 +149,9 @@ private: | |||||
| const SpinLock::ScopedLockType sl (holder.lock); | const SpinLock::ScopedLockType sl (holder.lock); | ||||
| if (++(holder.refCount) == 1) | if (++(holder.refCount) == 1) | ||||
| holder.sharedInstance = new SharedObjectType(); | |||||
| holder.sharedInstance.reset (new SharedObjectType()); | |||||
| sharedObject = holder.sharedInstance; | |||||
| sharedObject = holder.sharedInstance.get(); | |||||
| } | } | ||||
| // There's no need to assign to a SharedResourcePointer because every | // There's no need to assign to a SharedResourcePointer because every | ||||
| @@ -509,7 +509,7 @@ private: | |||||
| bool ChildProcess::start (const String& command, int streamFlags) | bool ChildProcess::start (const String& command, int streamFlags) | ||||
| { | { | ||||
| activeProcess = new ActiveProcess (command, streamFlags); | |||||
| activeProcess.reset (new ActiveProcess (command, streamFlags)); | |||||
| if (! activeProcess->ok) | if (! activeProcess->ok) | ||||
| activeProcess = nullptr; | activeProcess = nullptr; | ||||
| @@ -176,7 +176,7 @@ public: | |||||
| //============================================================================== | //============================================================================== | ||||
| /** Used to receive callbacks for thread exit calls */ | /** Used to receive callbacks for thread exit calls */ | ||||
| class Listener | |||||
| class JUCE_API Listener | |||||
| { | { | ||||
| public: | public: | ||||
| virtual ~Listener() {} | virtual ~Listener() {} | ||||
| @@ -119,7 +119,7 @@ struct ConvolutionEngine | |||||
| buffersImpulseSegments.add (newImpulseSegment); | buffersImpulseSegments.add (newImpulseSegment); | ||||
| } | } | ||||
| ScopedPointer<FFT> FFTTempObject = new FFT (roundToInt (std::log2 (FFTSize))); | |||||
| ScopedPointer<FFT> FFTTempObject (new FFT (roundToInt (std::log2 (FFTSize)))); | |||||
| auto* channelData = info.buffer->getWritePointer (channel); | auto* channelData = info.buffer->getWritePointer (channel); | ||||
| @@ -829,8 +829,9 @@ private: | |||||
| { | { | ||||
| AudioFormatManager manager; | AudioFormatManager manager; | ||||
| manager.registerBasicFormats(); | manager.registerBasicFormats(); | ||||
| ScopedPointer<AudioFormatReader> formatReader (manager.createReaderFor (stream)); | |||||
| if (ScopedPointer<AudioFormatReader> formatReader = manager.createReaderFor (stream)) | |||||
| if (formatReader != nullptr) | |||||
| { | { | ||||
| currentInfo.originalNumChannels = formatReader->numChannels > 1 ? 2 : 1; | currentInfo.originalNumChannels = formatReader->numChannels > 1 ? 2 : 1; | ||||
| currentInfo.originalSampleRate = formatReader->sampleRate; | currentInfo.originalSampleRate = formatReader->sampleRate; | ||||
| @@ -92,8 +92,8 @@ struct FFTFallback : public FFT::Instance | |||||
| FFTFallback (int order) | FFTFallback (int order) | ||||
| { | { | ||||
| configForward = new FFTConfig (1 << order, false); | |||||
| configInverse = new FFTConfig (1 << order, true); | |||||
| configForward.reset (new FFTConfig (1 << order, false)); | |||||
| configInverse.reset (new FFTConfig (1 << order, true)); | |||||
| size = 1 << order; | size = 1 << order; | ||||
| } | } | ||||
| @@ -57,7 +57,7 @@ public: | |||||
| pfds[INTERNAL_QUEUE_FD].fd = getReadHandle(); | pfds[INTERNAL_QUEUE_FD].fd = getReadHandle(); | ||||
| pfds[INTERNAL_QUEUE_FD].events = POLLIN; | pfds[INTERNAL_QUEUE_FD].events = POLLIN; | ||||
| readCallback[INTERNAL_QUEUE_FD] = new LinuxEventLoop::CallbackFunction<decltype(internalQueueCb)> (internalQueueCb); | |||||
| readCallback[INTERNAL_QUEUE_FD].reset (new LinuxEventLoop::CallbackFunction<decltype(internalQueueCb)> (internalQueueCb)); | |||||
| } | } | ||||
| ~InternalMessageQueue() | ~InternalMessageQueue() | ||||
| @@ -96,7 +96,7 @@ public: | |||||
| fdCount = 2; | fdCount = 2; | ||||
| pfds[WINDOW_SYSTEM_FD].fd = _fd; | pfds[WINDOW_SYSTEM_FD].fd = _fd; | ||||
| pfds[WINDOW_SYSTEM_FD].events = POLLIN; | pfds[WINDOW_SYSTEM_FD].events = POLLIN; | ||||
| readCallback[WINDOW_SYSTEM_FD] = _readCallback; | |||||
| readCallback[WINDOW_SYSTEM_FD].reset (_readCallback); | |||||
| readCallback[WINDOW_SYSTEM_FD]->active = true; | readCallback[WINDOW_SYSTEM_FD]->active = true; | ||||
| } | } | ||||
| @@ -199,7 +199,7 @@ void MessageManager::doPlatformSpecificInitialisation() | |||||
| OleInitialize (0); | OleInitialize (0); | ||||
| using namespace WindowsMessageHelpers; | using namespace WindowsMessageHelpers; | ||||
| messageWindow = new HiddenMessageWindow (messageWindowName, (WNDPROC) messageWndProc); | |||||
| messageWindow.reset (new HiddenMessageWindow (messageWindowName, (WNDPROC) messageWndProc)); | |||||
| juce_messageWindowHandle = messageWindow->getHWND(); | juce_messageWindowHandle = messageWindow->getHWND(); | ||||
| } | } | ||||
| @@ -48,7 +48,9 @@ StringArray FTTypefaceList::getDefaultFontDirectories() | |||||
| if (fontDirs.isEmpty()) | if (fontDirs.isEmpty()) | ||||
| { | { | ||||
| if (ScopedPointer<XmlElement> fontsInfo = findFontsConfFile()) | |||||
| ScopedPointer<XmlElement> fontsInfo (findFontsConfFile()); | |||||
| if (fontsInfo != nullptr) | |||||
| { | { | ||||
| forEachXmlChildElementWithTagName (*fontsInfo, e, "dir") | forEachXmlChildElementWithTagName (*fontsInfo, e, "dir") | ||||
| { | { | ||||
| @@ -1176,7 +1176,9 @@ private: | |||||
| for (int i = 0; i < numMonitors; ++i) | for (int i = 0; i < numMonitors; ++i) | ||||
| { | { | ||||
| if ((screens = xrandr.getScreenResources (display, RootWindow (display, i))).get()) | |||||
| screens.reset (xrandr.getScreenResources (display, RootWindow (display, i))); | |||||
| if (screens != nullptr) | |||||
| { | { | ||||
| for (int j = 0; j < screens->noutput; ++j) | for (int j = 0; j < screens->noutput; ++j) | ||||
| { | { | ||||
| @@ -1188,16 +1190,16 @@ private: | |||||
| if (! mainDisplay) | if (! mainDisplay) | ||||
| mainDisplay = screens->outputs[j]; | mainDisplay = screens->outputs[j]; | ||||
| ScopedPointer<XRROutputInfo> output; | |||||
| ScopedPointer<XRROutputInfo> output (xrandr.getOutputInfo (display, screens.get(), screens->outputs[j])); | |||||
| if ((output = xrandr.getOutputInfo (display, screens.get(), screens->outputs[j])).get()) | |||||
| if (output != nullptr) | |||||
| { | { | ||||
| if (! output->crtc) | if (! output->crtc) | ||||
| continue; | continue; | ||||
| ScopedPointer<XRRCrtcInfo> crtc; | |||||
| ScopedPointer<XRRCrtcInfo> crtc (xrandr.getCrtcInfo (display, screens.get(), output->crtc)); | |||||
| if ((crtc = xrandr.getCrtcInfo (display, screens.get(), output->crtc)).get()) | |||||
| if (crtc != nullptr) | |||||
| { | { | ||||
| ExtendedInfo e; | ExtendedInfo e; | ||||
| e.totalBounds = Rectangle<int> (crtc->x, crtc->y, | e.totalBounds = Rectangle<int> (crtc->x, crtc->y, | ||||
| @@ -1471,9 +1473,9 @@ public: | |||||
| display = XWindowSystem::getInstance()->displayRef(); | display = XWindowSystem::getInstance()->displayRef(); | ||||
| atoms = new Atoms (display); | |||||
| dragState = new DragState (display); | |||||
| repainter = new LinuxRepaintManager (*this, display); | |||||
| atoms.reset (new Atoms (display)); | |||||
| dragState.reset (new DragState (display)); | |||||
| repainter.reset (new LinuxRepaintManager (*this, display)); | |||||
| if (isAlwaysOnTop) | if (isAlwaysOnTop) | ||||
| ++numAlwaysOnTopPeers; | ++numAlwaysOnTopPeers; | ||||
| @@ -3216,7 +3218,7 @@ private: | |||||
| void resetExternalDragState() | void resetExternalDragState() | ||||
| { | { | ||||
| dragState = new DragState (display); | |||||
| dragState.reset (new DragState (display)); | |||||
| } | } | ||||
| void sendDragAndDropMessage (XClientMessageEvent& msg) | void sendDragAndDropMessage (XClientMessageEvent& msg) | ||||
| @@ -74,7 +74,7 @@ public: | |||||
| if (! selectsDirectories) | if (! selectsDirectories) | ||||
| { | { | ||||
| if (previewComp != nullptr) | if (previewComp != nullptr) | ||||
| customComponent = new CustomComponentHolder (previewComp); | |||||
| customComponent.reset (new CustomComponentHolder (previewComp)); | |||||
| setupFilters(); | setupFilters(); | ||||
| } | } | ||||
| @@ -357,7 +357,7 @@ private: | |||||
| if (customComponent) | if (customComponent) | ||||
| { | { | ||||
| Component::SafePointer<Component> custom (customComponent); | |||||
| Component::SafePointer<Component> custom (customComponent.get()); | |||||
| RECT r, cr; | RECT r, cr; | ||||
| GetWindowRect (hdlg, &r); | GetWindowRect (hdlg, &r); | ||||
| @@ -1003,7 +1003,7 @@ public: | |||||
| if ((windowStyleFlags & windowHasDropShadow) != 0 | if ((windowStyleFlags & windowHasDropShadow) != 0 | ||||
| && ((! hasTitleBar()) || SystemStats::getOperatingSystemType() < SystemStats::WinVista)) | && ((! hasTitleBar()) || SystemStats::getOperatingSystemType() < SystemStats::WinVista)) | ||||
| { | { | ||||
| shadower = component.getLookAndFeel().createDropShadowerForComponent (&component); | |||||
| shadower.reset (component.getLookAndFeel().createDropShadowerForComponent (&component)); | |||||
| if (shadower != nullptr) | if (shadower != nullptr) | ||||
| shadower->setOwner (&component); | shadower->setOwner (&component); | ||||
| @@ -3937,7 +3937,7 @@ void Desktop::setScreenSaverEnabled (const bool isEnabled) | |||||
| if (isEnabled) | if (isEnabled) | ||||
| screenSaverDefeater = nullptr; | screenSaverDefeater = nullptr; | ||||
| else if (screenSaverDefeater == nullptr) | else if (screenSaverDefeater == nullptr) | ||||
| screenSaverDefeater = new ScreenSaverDefeater(); | |||||
| screenSaverDefeater.reset (new ScreenSaverDefeater()); | |||||
| } | } | ||||
| bool Desktop::isScreenSaverEnabled() | bool Desktop::isScreenSaverEnabled() | ||||
| @@ -449,17 +449,18 @@ public: | |||||
| unsigned long windowHandle; | unsigned long windowHandle; | ||||
| ssize_t actual = read (inChannel, &windowHandle, sizeof (windowHandle)); | ssize_t actual = read (inChannel, &windowHandle, sizeof (windowHandle)); | ||||
| if (actual != sizeof (windowHandle)) | if (actual != sizeof (windowHandle)) | ||||
| { | { | ||||
| killChild(); | killChild(); | ||||
| return; | return; | ||||
| } | } | ||||
| receiver = new CommandReceiver (this, inChannel); | |||||
| receiver.reset (new CommandReceiver (this, inChannel)); | |||||
| startThread(); | startThread(); | ||||
| xembed = new XEmbedComponent (windowHandle); | |||||
| owner.addAndMakeVisible (xembed); | |||||
| xembed.reset (new XEmbedComponent (windowHandle)); | |||||
| owner.addAndMakeVisible (xembed.get()); | |||||
| } | } | ||||
| void quit() | void quit() | ||||
| @@ -380,7 +380,7 @@ bool ActiveXControlComponent::createControl (const void* controlIID) | |||||
| if (newControl->control->DoVerb (OLEIVERB_SHOW, 0, newControl->clientSite, 0, hwnd, &rect) == S_OK) | if (newControl->control->DoVerb (OLEIVERB_SHOW, 0, newControl->clientSite, 0, hwnd, &rect) == S_OK) | ||||
| { | { | ||||
| control = newControl; | |||||
| control.reset (newControl.release()); | |||||
| control->controlHWND = ActiveXHelpers::getHWND (this); | control->controlHWND = ActiveXHelpers::getHWND (this); | ||||
| if (control->controlHWND != 0) | if (control->controlHWND != 0) | ||||
| @@ -146,7 +146,7 @@ public: | |||||
| if (JuceWindowIdentifier::isJUCEWindow (hwnd)) | if (JuceWindowIdentifier::isJUCEWindow (hwnd)) | ||||
| if (ComponentPeer* peer = (ComponentPeer*) GetWindowLongPtr (hwnd, 8)) | if (ComponentPeer* peer = (ComponentPeer*) GetWindowLongPtr (hwnd, 8)) | ||||
| if (SystemTrayIconComponent* const iconComp = dynamic_cast<SystemTrayIconComponent*> (&(peer->getComponent()))) | if (SystemTrayIconComponent* const iconComp = dynamic_cast<SystemTrayIconComponent*> (&(peer->getComponent()))) | ||||
| return iconComp->pimpl; | |||||
| return iconComp->pimpl.get(); | |||||
| return nullptr; | return nullptr; | ||||
| } | } | ||||
| @@ -246,7 +246,7 @@ WebBrowserComponent::WebBrowserComponent (const bool unloadPageWhenBrowserIsHidd | |||||
| unloadPageWhenBrowserIsHidden (unloadPageWhenBrowserIsHidden_) | unloadPageWhenBrowserIsHidden (unloadPageWhenBrowserIsHidden_) | ||||
| { | { | ||||
| setOpaque (true); | setOpaque (true); | ||||
| addAndMakeVisible (browser); | |||||
| addAndMakeVisible (browser.get()); | |||||
| } | } | ||||
| WebBrowserComponent::~WebBrowserComponent() | WebBrowserComponent::~WebBrowserComponent() | ||||
| @@ -39,7 +39,7 @@ public: | |||||
| bool /*useMultisampling*/, | bool /*useMultisampling*/, | ||||
| OpenGLVersion) | OpenGLVersion) | ||||
| { | { | ||||
| dummyComponent = new DummyComponent (*this); | |||||
| dummyComponent.reset (new DummyComponent (*this)); | |||||
| createNativeWindow (component); | createNativeWindow (component); | ||||
| PIXELFORMATDESCRIPTOR pfd; | PIXELFORMATDESCRIPTOR pfd; | ||||
| @@ -171,7 +171,7 @@ private: | |||||
| void createNativeWindow (Component& component) | void createNativeWindow (Component& component) | ||||
| { | { | ||||
| auto* topComp = component.getTopLevelComponent(); | auto* topComp = component.getTopLevelComponent(); | ||||
| nativeWindow = createNonRepaintingEmbeddedWindowsPeer (*dummyComponent, topComp->getWindowHandle()); | |||||
| nativeWindow.reset (createNonRepaintingEmbeddedWindowsPeer (*dummyComponent, topComp->getWindowHandle())); | |||||
| if (auto* peer = topComp->getPeer()) | if (auto* peer = topComp->getPeer()) | ||||
| updateWindowPosition (peer->getAreaCoveredBy (component)); | updateWindowPosition (peer->getAreaCoveredBy (component)); | ||||
| @@ -58,9 +58,9 @@ OSCBundle::Element::Element (const Element& other) | |||||
| bundle = nullptr; | bundle = nullptr; | ||||
| if (other.isMessage()) | if (other.isMessage()) | ||||
| message = new OSCMessage (other.getMessage()); | |||||
| message.reset (new OSCMessage (other.getMessage())); | |||||
| else | else | ||||
| bundle = new OSCBundle (other.getBundle()); | |||||
| bundle.reset (new OSCBundle (other.getBundle())); | |||||
| } | } | ||||
| } | } | ||||
| @@ -94,10 +94,10 @@ CameraDevice* CameraDevice::openDevice (int index, | |||||
| int maxWidth, int maxHeight, | int maxWidth, int maxHeight, | ||||
| bool useHighQuality) | bool useHighQuality) | ||||
| { | { | ||||
| if (ScopedPointer<CameraDevice> d = new CameraDevice (getAvailableDevices() [index], index, | |||||
| minWidth, minHeight, maxWidth, maxHeight, useHighQuality)) | |||||
| if (d->pimpl->openedOk()) | |||||
| return d.release(); | |||||
| ScopedPointer<CameraDevice> d (new CameraDevice (getAvailableDevices() [index], index, | |||||
| minWidth, minHeight, maxWidth, maxHeight, useHighQuality)); | |||||
| if (d != nullptr && d->pimpl->openedOk()) | |||||
| return d.release(); | |||||
| return nullptr; | return nullptr; | ||||
| } | } | ||||
| @@ -163,8 +163,8 @@ struct VideoComponent::Pimpl : public Component | |||||
| Pimpl() : videoLoaded (false) | Pimpl() : videoLoaded (false) | ||||
| { | { | ||||
| setOpaque (true); | setOpaque (true); | ||||
| context = new DirectShowContext (*this); | |||||
| componentWatcher = new ComponentWatcher (*this); | |||||
| context.reset (new DirectShowContext (*this)); | |||||
| componentWatcher.reset (new ComponentWatcher (*this)); | |||||
| } | } | ||||
| ~Pimpl() | ~Pimpl() | ||||
| @@ -462,7 +462,7 @@ private: | |||||
| { | { | ||||
| if (SystemStats::getOperatingSystemType() >= SystemStats::WinVista) | if (SystemStats::getOperatingSystemType() >= SystemStats::WinVista) | ||||
| { | { | ||||
| videoRenderer = new VideoRenderers::EVR(); | |||||
| videoRenderer.reset (new VideoRenderers::EVR()); | |||||
| hr = videoRenderer->create (graphBuilder, baseFilter, hwnd); | hr = videoRenderer->create (graphBuilder, baseFilter, hwnd); | ||||
| if (FAILED (hr)) | if (FAILED (hr)) | ||||
| @@ -471,7 +471,7 @@ private: | |||||
| if (videoRenderer == nullptr) | if (videoRenderer == nullptr) | ||||
| { | { | ||||
| videoRenderer = new VideoRenderers::VMR7(); | |||||
| videoRenderer.reset (new VideoRenderers::VMR7()); | |||||
| hr = videoRenderer->create (graphBuilder, baseFilter, hwnd); | hr = videoRenderer->create (graphBuilder, baseFilter, hwnd); | ||||
| } | } | ||||
| } | } | ||||
| @@ -700,7 +700,7 @@ private: | |||||
| if (auto* topLevelPeer = component.getTopLevelComponent()->getPeer()) | if (auto* topLevelPeer = component.getTopLevelComponent()->getPeer()) | ||||
| { | { | ||||
| nativeWindow = new NativeWindow ((HWND) topLevelPeer->getNativeHandle(), this); | |||||
| nativeWindow.reset (new NativeWindow ((HWND) topLevelPeer->getNativeHandle(), this)); | |||||
| hwnd = nativeWindow->hwnd; | hwnd = nativeWindow->hwnd; | ||||