mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Added flag JUCE_STRICT_REFCOUNTEDPOINTER which is recommended to avoid accidental leaks when using ref-counted pointers. Enabled this flag in the demo projects, and used it to help tidy up some dubious smart-pointer use
This commit is contained in:
parent
f80df37183
commit
49aa9c9db4
42 changed files with 345 additions and 209 deletions
|
|
@ -35,13 +35,13 @@ ifeq ($(CONFIG),Debug)
|
|||
TARGET_ARCH := -march=native
|
||||
endif
|
||||
|
||||
JUCE_CPPFLAGS := $(DEPFLAGS) -DLINUX=1 -DDEBUG=1 -D_DEBUG=1 -DJUCE_DEMO_RUNNER=1 -DJUCE_UNIT_TESTS=1 -DJUCER_LINUX_MAKE_6D53C8B4=1 -DJUCE_APP_VERSION=5.3.2 -DJUCE_APP_VERSION_HEX=0x50302 $(shell pkg-config --cflags alsa freetype2 libcurl x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0) -pthread -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS)
|
||||
JUCE_CPPFLAGS := $(DEPFLAGS) -DLINUX=1 -DDEBUG=1 -D_DEBUG=1 -DJUCE_DEMO_RUNNER=1 -DJUCE_UNIT_TESTS=1 -DJUCER_LINUX_MAKE_6D53C8B4=1 -DJUCE_APP_VERSION=5.3.2 -DJUCE_APP_VERSION_HEX=0x50302 $(shell pkg-config --cflags alsa freetype2 x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0 libcurl) -pthread -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS)
|
||||
JUCE_CPPFLAGS_APP := -DJucePlugin_Build_VST=0 -DJucePlugin_Build_VST3=0 -DJucePlugin_Build_AU=0 -DJucePlugin_Build_AUv3=0 -DJucePlugin_Build_RTAS=0 -DJucePlugin_Build_AAX=0 -DJucePlugin_Build_Standalone=0 -DJucePlugin_Build_Unity=0
|
||||
JUCE_TARGET_APP := DemoRunner
|
||||
|
||||
JUCE_CFLAGS += $(JUCE_CPPFLAGS) $(TARGET_ARCH) -g -ggdb -O0 $(CFLAGS)
|
||||
JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++14 $(CXXFLAGS)
|
||||
JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell pkg-config --libs alsa freetype2 libcurl x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0) -lGL -ldl -lpthread -lrt $(LDFLAGS)
|
||||
JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell pkg-config --libs alsa freetype2 x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0 libcurl) -lGL -ldl -lpthread -lrt $(LDFLAGS)
|
||||
|
||||
CLEANCMD = rm -rf $(JUCE_OUTDIR)/$(TARGET) $(JUCE_OBJDIR)
|
||||
endif
|
||||
|
|
@ -56,13 +56,13 @@ ifeq ($(CONFIG),Release)
|
|||
TARGET_ARCH := -march=native
|
||||
endif
|
||||
|
||||
JUCE_CPPFLAGS := $(DEPFLAGS) -DLINUX=1 -DNDEBUG=1 -DJUCE_DEMO_RUNNER=1 -DJUCE_UNIT_TESTS=1 -DJUCER_LINUX_MAKE_6D53C8B4=1 -DJUCE_APP_VERSION=5.3.2 -DJUCE_APP_VERSION_HEX=0x50302 $(shell pkg-config --cflags alsa freetype2 libcurl x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0) -pthread -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS)
|
||||
JUCE_CPPFLAGS := $(DEPFLAGS) -DLINUX=1 -DNDEBUG=1 -DJUCE_DEMO_RUNNER=1 -DJUCE_UNIT_TESTS=1 -DJUCER_LINUX_MAKE_6D53C8B4=1 -DJUCE_APP_VERSION=5.3.2 -DJUCE_APP_VERSION_HEX=0x50302 $(shell pkg-config --cflags alsa freetype2 x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0 libcurl) -pthread -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS)
|
||||
JUCE_CPPFLAGS_APP := -DJucePlugin_Build_VST=0 -DJucePlugin_Build_VST3=0 -DJucePlugin_Build_AU=0 -DJucePlugin_Build_AUv3=0 -DJucePlugin_Build_RTAS=0 -DJucePlugin_Build_AAX=0 -DJucePlugin_Build_Standalone=0 -DJucePlugin_Build_Unity=0
|
||||
JUCE_TARGET_APP := DemoRunner
|
||||
|
||||
JUCE_CFLAGS += $(JUCE_CPPFLAGS) $(TARGET_ARCH) -O3 $(CFLAGS)
|
||||
JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++14 $(CXXFLAGS)
|
||||
JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell pkg-config --libs alsa freetype2 libcurl x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0) -fvisibility=hidden -lGL -ldl -lpthread -lrt $(LDFLAGS)
|
||||
JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell pkg-config --libs alsa freetype2 x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0 libcurl) -fvisibility=hidden -lGL -ldl -lpthread -lrt $(LDFLAGS)
|
||||
|
||||
CLEANCMD = rm -rf $(JUCE_OUTDIR)/$(TARGET) $(JUCE_OBJDIR)
|
||||
endif
|
||||
|
|
@ -238,7 +238,7 @@ $(JUCE_OBJDIR)/include_juce_video_be78589.o: ../../JuceLibraryCode/include_juce_
|
|||
|
||||
check-pkg-config:
|
||||
@command -v pkg-config >/dev/null 2>&1 || { echo >&2 "pkg-config not installed. Please, install it."; exit 1; }
|
||||
@pkg-config --print-errors alsa freetype2 libcurl x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0
|
||||
@pkg-config --print-errors alsa freetype2 x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0 libcurl
|
||||
|
||||
clean:
|
||||
@echo Cleaning DemoRunner
|
||||
|
|
|
|||
|
|
@ -258,7 +258,8 @@
|
|||
useGlobalPath="0"/>
|
||||
<MODULE id="juce_video" showAllCode="1" useLocalCopy="0" useGlobalPath="0"/>
|
||||
</MODULES>
|
||||
<JUCEOPTIONS JUCE_USE_CAMERA="1" JUCE_USE_MP3AUDIOFORMAT="1" JUCE_ALLOW_STATIC_NULL_VARIABLES="0"/>
|
||||
<JUCEOPTIONS JUCE_USE_CAMERA="1" JUCE_USE_MP3AUDIOFORMAT="1" JUCE_ALLOW_STATIC_NULL_VARIABLES="0"
|
||||
JUCE_STRICT_REFCOUNTEDPOINTER="1"/>
|
||||
<LIVE_SETTINGS>
|
||||
<OSX/>
|
||||
</LIVE_SETTINGS>
|
||||
|
|
|
|||
|
|
@ -198,6 +198,10 @@
|
|||
//#define JUCE_USE_CURL 0
|
||||
#endif
|
||||
|
||||
#ifndef JUCE_LOAD_CURL_SYMBOLS_LAZILY
|
||||
//#define JUCE_LOAD_CURL_SYMBOLS_LAZILY 0
|
||||
#endif
|
||||
|
||||
#ifndef JUCE_CATCH_UNHANDLED_EXCEPTIONS
|
||||
//#define JUCE_CATCH_UNHANDLED_EXCEPTIONS 1
|
||||
#endif
|
||||
|
|
@ -206,6 +210,10 @@
|
|||
#define JUCE_ALLOW_STATIC_NULL_VARIABLES 0
|
||||
#endif
|
||||
|
||||
#ifndef JUCE_STRICT_REFCOUNTEDPOINTER
|
||||
#define JUCE_STRICT_REFCOUNTEDPOINTER 1
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
// juce_dsp flags:
|
||||
|
||||
|
|
@ -247,6 +255,10 @@
|
|||
//#define JUCE_USE_DIRECTWRITE 1
|
||||
#endif
|
||||
|
||||
#ifndef JUCE_DISABLE_COREGRAPHICS_FONT_SMOOTHING
|
||||
//#define JUCE_DISABLE_COREGRAPHICS_FONT_SMOOTHING 0
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
// juce_gui_basics flags:
|
||||
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ PluginWindow* FilterGraph::getOrCreateWindowFor (AudioProcessorGraph::Node* node
|
|||
closeAnyOpenPluginWindows();
|
||||
#else
|
||||
for (auto* w : activePluginWindows)
|
||||
if (w->node == node && w->type == type)
|
||||
if (w->node.get() == node && w->type == type)
|
||||
return w;
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -35,13 +35,13 @@ ifeq ($(CONFIG),Debug)
|
|||
TARGET_ARCH := -march=native
|
||||
endif
|
||||
|
||||
JUCE_CPPFLAGS := $(DEPFLAGS) -DLINUX=1 -DDEBUG=1 -D_DEBUG=1 -DJUCER_LINUX_MAKE_6D53C8B4=1 -DJUCE_APP_VERSION=5.3.2 -DJUCE_APP_VERSION_HEX=0x50302 $(shell pkg-config --cflags freetype2 libcurl x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0) -pthread -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS)
|
||||
JUCE_CPPFLAGS := $(DEPFLAGS) -DLINUX=1 -DDEBUG=1 -D_DEBUG=1 -DJUCER_LINUX_MAKE_6D53C8B4=1 -DJUCE_APP_VERSION=5.3.2 -DJUCE_APP_VERSION_HEX=0x50302 $(shell pkg-config --cflags freetype2 x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0 libcurl) -pthread -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS)
|
||||
JUCE_CPPFLAGS_APP := -DJucePlugin_Build_VST=0 -DJucePlugin_Build_VST3=0 -DJucePlugin_Build_AU=0 -DJucePlugin_Build_AUv3=0 -DJucePlugin_Build_RTAS=0 -DJucePlugin_Build_AAX=0 -DJucePlugin_Build_Standalone=0 -DJucePlugin_Build_Unity=0
|
||||
JUCE_TARGET_APP := Projucer
|
||||
|
||||
JUCE_CFLAGS += $(JUCE_CPPFLAGS) $(TARGET_ARCH) -g -ggdb -O0 $(CFLAGS)
|
||||
JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++11 $(CXXFLAGS)
|
||||
JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell pkg-config --libs freetype2 libcurl x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0) -ldl -lpthread -lrt $(LDFLAGS)
|
||||
JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell pkg-config --libs freetype2 x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0 libcurl) -ldl -lpthread -lrt $(LDFLAGS)
|
||||
|
||||
CLEANCMD = rm -rf $(JUCE_OUTDIR)/$(TARGET) $(JUCE_OBJDIR)
|
||||
endif
|
||||
|
|
@ -56,13 +56,13 @@ ifeq ($(CONFIG),Release)
|
|||
TARGET_ARCH := -march=native
|
||||
endif
|
||||
|
||||
JUCE_CPPFLAGS := $(DEPFLAGS) -DLINUX=1 -DNDEBUG=1 -DJUCER_LINUX_MAKE_6D53C8B4=1 -DJUCE_APP_VERSION=5.3.2 -DJUCE_APP_VERSION_HEX=0x50302 $(shell pkg-config --cflags freetype2 libcurl x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0) -pthread -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS)
|
||||
JUCE_CPPFLAGS := $(DEPFLAGS) -DLINUX=1 -DNDEBUG=1 -DJUCER_LINUX_MAKE_6D53C8B4=1 -DJUCE_APP_VERSION=5.3.2 -DJUCE_APP_VERSION_HEX=0x50302 $(shell pkg-config --cflags freetype2 x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0 libcurl) -pthread -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS)
|
||||
JUCE_CPPFLAGS_APP := -DJucePlugin_Build_VST=0 -DJucePlugin_Build_VST3=0 -DJucePlugin_Build_AU=0 -DJucePlugin_Build_AUv3=0 -DJucePlugin_Build_RTAS=0 -DJucePlugin_Build_AAX=0 -DJucePlugin_Build_Standalone=0 -DJucePlugin_Build_Unity=0
|
||||
JUCE_TARGET_APP := Projucer
|
||||
|
||||
JUCE_CFLAGS += $(JUCE_CPPFLAGS) $(TARGET_ARCH) -O3 $(CFLAGS)
|
||||
JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++11 $(CXXFLAGS)
|
||||
JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell pkg-config --libs freetype2 libcurl x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0) -fvisibility=hidden -ldl -lpthread -lrt $(LDFLAGS)
|
||||
JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell pkg-config --libs freetype2 x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0 libcurl) -fvisibility=hidden -ldl -lpthread -lrt $(LDFLAGS)
|
||||
|
||||
CLEANCMD = rm -rf $(JUCE_OUTDIR)/$(TARGET) $(JUCE_OBJDIR)
|
||||
endif
|
||||
|
|
@ -454,7 +454,7 @@ $(JUCE_OBJDIR)/include_juce_gui_extra_6dee1c1a.o: ../../JuceLibraryCode/include_
|
|||
|
||||
check-pkg-config:
|
||||
@command -v pkg-config >/dev/null 2>&1 || { echo >&2 "pkg-config not installed. Please, install it."; exit 1; }
|
||||
@pkg-config --print-errors freetype2 libcurl x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0
|
||||
@pkg-config --print-errors freetype2 x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0 libcurl
|
||||
|
||||
clean:
|
||||
@echo Cleaning Projucer
|
||||
|
|
|
|||
|
|
@ -105,6 +105,10 @@
|
|||
#define JUCE_USE_CURL 1
|
||||
#endif
|
||||
|
||||
#ifndef JUCE_LOAD_CURL_SYMBOLS_LAZILY
|
||||
//#define JUCE_LOAD_CURL_SYMBOLS_LAZILY 0
|
||||
#endif
|
||||
|
||||
#ifndef JUCE_CATCH_UNHANDLED_EXCEPTIONS
|
||||
//#define JUCE_CATCH_UNHANDLED_EXCEPTIONS 1
|
||||
#endif
|
||||
|
|
@ -113,6 +117,10 @@
|
|||
#define JUCE_ALLOW_STATIC_NULL_VARIABLES 0
|
||||
#endif
|
||||
|
||||
#ifndef JUCE_STRICT_REFCOUNTEDPOINTER
|
||||
#define JUCE_STRICT_REFCOUNTEDPOINTER 1
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
// juce_events flags:
|
||||
|
||||
|
|
@ -131,6 +139,10 @@
|
|||
//#define JUCE_USE_DIRECTWRITE 1
|
||||
#endif
|
||||
|
||||
#ifndef JUCE_DISABLE_COREGRAPHICS_FONT_SMOOTHING
|
||||
//#define JUCE_DISABLE_COREGRAPHICS_FONT_SMOOTHING 0
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
// juce_gui_basics flags:
|
||||
|
||||
|
|
|
|||
|
|
@ -719,7 +719,8 @@
|
|||
resource="0" file="Source/Wizards/jucer_TemplateThumbnailsComponent.h"/>
|
||||
</GROUP>
|
||||
</MAINGROUP>
|
||||
<JUCEOPTIONS JUCE_LOG_ASSERTIONS="1" JUCE_USE_CURL="1" JUCE_ALLOW_STATIC_NULL_VARIABLES="0"/>
|
||||
<JUCEOPTIONS JUCE_LOG_ASSERTIONS="1" JUCE_USE_CURL="1" JUCE_ALLOW_STATIC_NULL_VARIABLES="0"
|
||||
JUCE_STRICT_REFCOUNTEDPOINTER="1"/>
|
||||
<MODULES>
|
||||
<MODULE id="juce_analytics" showAllCode="1" useLocalCopy="0" useGlobalPath="0"/>
|
||||
<MODULE id="juce_core" showAllCode="1"/>
|
||||
|
|
|
|||
|
|
@ -450,7 +450,7 @@ private:
|
|||
{
|
||||
public:
|
||||
ControlsComponent (CodeDocument& doc, const Range<int>& selection,
|
||||
CompileEngineChildProcess* cp, bool showColourSelector)
|
||||
CompileEngineChildProcess::Ptr cp, bool showColourSelector)
|
||||
: document (doc),
|
||||
start (doc, selection.getStart()),
|
||||
end (doc, selection.getEnd()),
|
||||
|
|
@ -629,7 +629,7 @@ private:
|
|||
|
||||
~LiteralHighlightOverlay()
|
||||
{
|
||||
if (Component* p = getParentComponent())
|
||||
if (auto* p = getParentComponent())
|
||||
{
|
||||
p->removeChildComponent (this);
|
||||
|
||||
|
|
|
|||
|
|
@ -117,34 +117,31 @@ struct ChildProcessCache
|
|||
|
||||
CompileEngineChildProcess::Ptr getExisting (Project& project) const noexcept
|
||||
{
|
||||
for (CompileEngineChildProcess* p : processes)
|
||||
for (auto& p : processes)
|
||||
if (&(p->project) == &project)
|
||||
return p;
|
||||
|
||||
return nullptr;
|
||||
return {};
|
||||
}
|
||||
|
||||
CompileEngineChildProcess::Ptr getOrCreate (Project& project)
|
||||
{
|
||||
CompileEngineChildProcess::Ptr p (getExisting (project));
|
||||
|
||||
if (p == nullptr)
|
||||
{
|
||||
p = new CompileEngineChildProcess (project);
|
||||
tellNewProcessAboutExistingEditors (p);
|
||||
processes.add (p);
|
||||
}
|
||||
if (auto p = getExisting (project))
|
||||
return p;
|
||||
|
||||
auto p = new CompileEngineChildProcess (project);
|
||||
tellNewProcessAboutExistingEditors (*p);
|
||||
processes.add (p);
|
||||
return p;
|
||||
}
|
||||
|
||||
static void tellNewProcessAboutExistingEditors (CompileEngineChildProcess* process)
|
||||
static void tellNewProcessAboutExistingEditors (CompileEngineChildProcess& process)
|
||||
{
|
||||
OpenDocumentManager& odm = ProjucerApplication::getApp().openDocumentManager;
|
||||
auto& odm = ProjucerApplication::getApp().openDocumentManager;
|
||||
|
||||
for (int i = odm.getNumOpenDocuments(); --i >= 0;)
|
||||
if (SourceCodeDocument* d = dynamic_cast<SourceCodeDocument*> (odm.getOpenDocument (i)))
|
||||
process->editorOpened (d->getFile(), d->getCodeDocument());
|
||||
if (auto d = dynamic_cast<SourceCodeDocument*> (odm.getOpenDocument (i)))
|
||||
process.editorOpened (d->getFile(), d->getCodeDocument());
|
||||
}
|
||||
|
||||
void removeOrphans()
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ public:
|
|||
|
||||
void showDocument() override
|
||||
{
|
||||
showSettingsPage (new SettingsComp (exporter.get()));
|
||||
showSettingsPage (new SettingsComp (*exporter));
|
||||
}
|
||||
|
||||
void deleteItem() override
|
||||
|
|
@ -186,15 +186,15 @@ private:
|
|||
//==============================================================================
|
||||
struct SettingsComp : public Component
|
||||
{
|
||||
SettingsComp (ProjectExporter* exp)
|
||||
: group (exp->getName(),
|
||||
ExporterItem::getIconForExporter (exp),
|
||||
exp->getDescription())
|
||||
SettingsComp (ProjectExporter& exp)
|
||||
: group (exp.getName(),
|
||||
ExporterItem::getIconForExporter (&exp),
|
||||
exp.getDescription())
|
||||
{
|
||||
addAndMakeVisible (group);
|
||||
|
||||
PropertyListBuilder props;
|
||||
exp->createPropertyEditors (props);
|
||||
exp.createPropertyEditors (props);
|
||||
group.setProperties (props);
|
||||
parentSizeChanged();
|
||||
}
|
||||
|
|
@ -234,7 +234,7 @@ public:
|
|||
|
||||
void showDocument() override
|
||||
{
|
||||
showSettingsPage (new SettingsComp (config));
|
||||
showSettingsPage (new SettingsComp (*config));
|
||||
}
|
||||
|
||||
void deleteItem() override
|
||||
|
|
@ -283,13 +283,13 @@ private:
|
|||
class SettingsComp : public Component
|
||||
{
|
||||
public:
|
||||
SettingsComp (ProjectExporter::BuildConfiguration* conf)
|
||||
: group (conf->exporter.getName() + " - " + conf->getName(), Icon (getIcons().config, Colours::transparentBlack))
|
||||
SettingsComp (ProjectExporter::BuildConfiguration& conf)
|
||||
: group (conf.exporter.getName() + " - " + conf.getName(), Icon (getIcons().config, Colours::transparentBlack))
|
||||
{
|
||||
addAndMakeVisible (group);
|
||||
|
||||
PropertyListBuilder props;
|
||||
conf->createPropertyEditors (props);
|
||||
conf.createPropertyEditors (props);
|
||||
group.setProperties (props);
|
||||
parentSizeChanged();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ class LiveBuildTab : public Component,
|
|||
private ChangeListener
|
||||
{
|
||||
public:
|
||||
LiveBuildTab (CompileEngineChildProcess* child, String lastErrorMessage)
|
||||
LiveBuildTab (const CompileEngineChildProcess::Ptr& child, String lastErrorMessage)
|
||||
{
|
||||
settingsButton.reset (new IconButton ("Settings", &getIcons().settings));
|
||||
addAndMakeVisible (settingsButton.get());
|
||||
|
|
@ -80,13 +80,11 @@ public:
|
|||
if (child != nullptr)
|
||||
{
|
||||
addAndMakeVisible (concertinaPanel);
|
||||
buildConcertina (child);
|
||||
buildConcertina (*child);
|
||||
isEnabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
isEnabled = false;
|
||||
|
||||
errorMessage = getErrorMessage();
|
||||
errorMessageLabel.reset (new Label ("Error", errorMessage));
|
||||
errorMessageLabel->setJustificationType (Justification::centred);
|
||||
|
|
@ -158,7 +156,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
bool isEnabled;
|
||||
bool isEnabled = false;
|
||||
String errorMessage;
|
||||
Component::SafePointer<ProjucerAppClasses::ErrorListComp> errorListComp;
|
||||
|
||||
|
|
@ -232,16 +230,16 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
void buildConcertina (CompileEngineChildProcess* child)
|
||||
void buildConcertina (CompileEngineChildProcess& child)
|
||||
{
|
||||
for (auto i = concertinaPanel.getNumPanels() - 1; i >= 0 ; --i)
|
||||
concertinaPanel.removePanel (concertinaPanel.getPanel (i));
|
||||
|
||||
headers.clear();
|
||||
|
||||
errorListComp = new ProjucerAppClasses::ErrorListComp (child->errorList);
|
||||
auto* activities = new CurrentActivitiesComp (child->activityList);
|
||||
auto* comps = new ComponentListComp (*child);
|
||||
errorListComp = new ProjucerAppClasses::ErrorListComp (child.errorList);
|
||||
auto* activities = new CurrentActivitiesComp (child.activityList);
|
||||
auto* comps = new ComponentListComp (child);
|
||||
|
||||
concertinaPanel.addPanel (-1, errorListComp, true);
|
||||
concertinaPanel.addPanel (-1, comps, true);
|
||||
|
|
|
|||
|
|
@ -303,7 +303,7 @@ public:
|
|||
bool next();
|
||||
|
||||
BuildConfiguration& operator*() const { return *config; }
|
||||
BuildConfiguration* operator->() const { return config; }
|
||||
BuildConfiguration* operator->() const { return config.get(); }
|
||||
|
||||
BuildConfiguration::Ptr config;
|
||||
int index;
|
||||
|
|
@ -320,7 +320,7 @@ public:
|
|||
bool next();
|
||||
|
||||
const BuildConfiguration& operator*() const { return *config; }
|
||||
const BuildConfiguration* operator->() const { return config; }
|
||||
const BuildConfiguration* operator->() const { return config.get(); }
|
||||
|
||||
BuildConfiguration::Ptr config;
|
||||
int index;
|
||||
|
|
|
|||
|
|
@ -35,13 +35,13 @@ ifeq ($(CONFIG),Debug)
|
|||
TARGET_ARCH := -march=native
|
||||
endif
|
||||
|
||||
JUCE_CPPFLAGS := $(DEPFLAGS) -DLINUX=1 -DDEBUG=1 -D_DEBUG=1 -DJUCE_UNIT_TESTS=1 -DJUCER_LINUX_MAKE_6D53C8B4=1 -DJUCE_APP_VERSION=1.0.0 -DJUCE_APP_VERSION_HEX=0x10000 $(shell pkg-config --cflags alsa freetype2 libcurl x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0) -pthread -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS)
|
||||
JUCE_CPPFLAGS := $(DEPFLAGS) -DLINUX=1 -DDEBUG=1 -D_DEBUG=1 -DJUCE_UNIT_TESTS=1 -DJUCER_LINUX_MAKE_6D53C8B4=1 -DJUCE_APP_VERSION=1.0.0 -DJUCE_APP_VERSION_HEX=0x10000 $(shell pkg-config --cflags alsa freetype2 x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0 libcurl) -pthread -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS)
|
||||
JUCE_CPPFLAGS_CONSOLEAPP := -DJucePlugin_Build_VST=0 -DJucePlugin_Build_VST3=0 -DJucePlugin_Build_AU=0 -DJucePlugin_Build_AUv3=0 -DJucePlugin_Build_RTAS=0 -DJucePlugin_Build_AAX=0 -DJucePlugin_Build_Standalone=0 -DJucePlugin_Build_Unity=0
|
||||
JUCE_TARGET_CONSOLEAPP := UnitTestRunner
|
||||
|
||||
JUCE_CFLAGS += $(JUCE_CPPFLAGS) $(TARGET_ARCH) -g -ggdb -O0 $(CFLAGS)
|
||||
JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++14 $(CXXFLAGS)
|
||||
JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) -L/usr/X11R6/lib/ $(shell pkg-config --libs alsa freetype2 libcurl x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0) -lGL -ldl -lpthread -lrt $(LDFLAGS)
|
||||
JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) -L/usr/X11R6/lib/ $(shell pkg-config --libs alsa freetype2 x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0 libcurl) -lGL -ldl -lpthread -lrt $(LDFLAGS)
|
||||
|
||||
CLEANCMD = rm -rf $(JUCE_OUTDIR)/$(TARGET) $(JUCE_OBJDIR)
|
||||
endif
|
||||
|
|
@ -56,13 +56,13 @@ ifeq ($(CONFIG),Release)
|
|||
TARGET_ARCH := -march=native
|
||||
endif
|
||||
|
||||
JUCE_CPPFLAGS := $(DEPFLAGS) -DLINUX=1 -DNDEBUG=1 -DJUCE_UNIT_TESTS=1 -DJUCER_LINUX_MAKE_6D53C8B4=1 -DJUCE_APP_VERSION=1.0.0 -DJUCE_APP_VERSION_HEX=0x10000 $(shell pkg-config --cflags alsa freetype2 libcurl x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0) -pthread -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS)
|
||||
JUCE_CPPFLAGS := $(DEPFLAGS) -DLINUX=1 -DNDEBUG=1 -DJUCE_UNIT_TESTS=1 -DJUCER_LINUX_MAKE_6D53C8B4=1 -DJUCE_APP_VERSION=1.0.0 -DJUCE_APP_VERSION_HEX=0x10000 $(shell pkg-config --cflags alsa freetype2 x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0 libcurl) -pthread -I../../JuceLibraryCode -I../../../../modules $(CPPFLAGS)
|
||||
JUCE_CPPFLAGS_CONSOLEAPP := -DJucePlugin_Build_VST=0 -DJucePlugin_Build_VST3=0 -DJucePlugin_Build_AU=0 -DJucePlugin_Build_AUv3=0 -DJucePlugin_Build_RTAS=0 -DJucePlugin_Build_AAX=0 -DJucePlugin_Build_Standalone=0 -DJucePlugin_Build_Unity=0
|
||||
JUCE_TARGET_CONSOLEAPP := UnitTestRunner
|
||||
|
||||
JUCE_CFLAGS += $(JUCE_CPPFLAGS) $(TARGET_ARCH) -O3 $(CFLAGS)
|
||||
JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++14 $(CXXFLAGS)
|
||||
JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) -L/usr/X11R6/lib/ $(shell pkg-config --libs alsa freetype2 libcurl x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0) -fvisibility=hidden -lGL -ldl -lpthread -lrt $(LDFLAGS)
|
||||
JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) -L/usr/X11R6/lib/ $(shell pkg-config --libs alsa freetype2 x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0 libcurl) -fvisibility=hidden -lGL -ldl -lpthread -lrt $(LDFLAGS)
|
||||
|
||||
CLEANCMD = rm -rf $(JUCE_OUTDIR)/$(TARGET) $(JUCE_OBJDIR)
|
||||
endif
|
||||
|
|
@ -202,7 +202,7 @@ $(JUCE_OBJDIR)/include_juce_video_be78589.o: ../../JuceLibraryCode/include_juce_
|
|||
|
||||
check-pkg-config:
|
||||
@command -v pkg-config >/dev/null 2>&1 || { echo >&2 "pkg-config not installed. Please, install it."; exit 1; }
|
||||
@pkg-config --print-errors alsa freetype2 libcurl x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0
|
||||
@pkg-config --print-errors alsa freetype2 x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0 libcurl
|
||||
|
||||
clean:
|
||||
@echo Cleaning UnitTestRunner
|
||||
|
|
|
|||
|
|
@ -197,6 +197,10 @@
|
|||
//#define JUCE_USE_CURL 0
|
||||
#endif
|
||||
|
||||
#ifndef JUCE_LOAD_CURL_SYMBOLS_LAZILY
|
||||
//#define JUCE_LOAD_CURL_SYMBOLS_LAZILY 0
|
||||
#endif
|
||||
|
||||
#ifndef JUCE_CATCH_UNHANDLED_EXCEPTIONS
|
||||
//#define JUCE_CATCH_UNHANDLED_EXCEPTIONS 1
|
||||
#endif
|
||||
|
|
@ -205,6 +209,10 @@
|
|||
//#define JUCE_ALLOW_STATIC_NULL_VARIABLES 1
|
||||
#endif
|
||||
|
||||
#ifndef JUCE_STRICT_REFCOUNTEDPOINTER
|
||||
#define JUCE_STRICT_REFCOUNTEDPOINTER 1
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
// juce_dsp flags:
|
||||
|
||||
|
|
@ -246,6 +254,10 @@
|
|||
//#define JUCE_USE_DIRECTWRITE 1
|
||||
#endif
|
||||
|
||||
#ifndef JUCE_DISABLE_COREGRAPHICS_FONT_SMOOTHING
|
||||
//#define JUCE_DISABLE_COREGRAPHICS_FONT_SMOOTHING 0
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
// juce_gui_basics flags:
|
||||
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@
|
|||
useGlobalPath="0"/>
|
||||
<MODULES id="juce_video" showAllCode="1" useLocalCopy="0"/>
|
||||
</MODULES>
|
||||
<JUCEOPTIONS/>
|
||||
<JUCEOPTIONS JUCE_STRICT_REFCOUNTEDPOINTER="1"/>
|
||||
<LIVE_SETTINGS>
|
||||
<OSX enableCxx11="1"/>
|
||||
</LIVE_SETTINGS>
|
||||
|
|
|
|||
|
|
@ -323,7 +323,7 @@ void Synthesiser::stopVoice (SynthesiserVoice* voice, float velocity, const bool
|
|||
voice->stopNote (velocity, allowTailOff);
|
||||
|
||||
// the subclass MUST call clearCurrentNote() if it's not tailing off! RTFM for stopNote()!
|
||||
jassert (allowTailOff || (voice->getCurrentlyPlayingNote() < 0 && voice->getCurrentlyPlayingSound() == 0));
|
||||
jassert (allowTailOff || (voice->getCurrentlyPlayingNote() < 0 && voice->getCurrentlyPlayingSound() == nullptr));
|
||||
}
|
||||
|
||||
void Synthesiser::noteOff (const int midiChannel,
|
||||
|
|
@ -338,7 +338,7 @@ void Synthesiser::noteOff (const int midiChannel,
|
|||
if (voice->getCurrentlyPlayingNote() == midiNoteNumber
|
||||
&& voice->isPlayingChannel (midiChannel))
|
||||
{
|
||||
if (SynthesiserSound* const sound = voice->getCurrentlyPlayingSound())
|
||||
if (auto sound = voice->getCurrentlyPlayingSound())
|
||||
{
|
||||
if (sound->appliesToNote (midiNoteNumber)
|
||||
&& sound->appliesToChannel (midiChannel))
|
||||
|
|
|
|||
|
|
@ -352,7 +352,7 @@ public:
|
|||
int getNumSounds() const noexcept { return sounds.size(); }
|
||||
|
||||
/** Returns one of the sounds. */
|
||||
SynthesiserSound* getSound (int index) const noexcept { return sounds [index]; }
|
||||
SynthesiserSound::Ptr getSound (int index) const noexcept { return sounds[index]; }
|
||||
|
||||
/** Adds a new sound to the synthesiser.
|
||||
|
||||
|
|
|
|||
|
|
@ -938,7 +938,7 @@ AudioProcessorGraph::Node::Ptr AudioProcessorGraph::addNode (AudioProcessor* new
|
|||
newProcessor->setPlayHead (getPlayHead());
|
||||
|
||||
Node::Ptr n (new Node (nodeID, newProcessor));
|
||||
nodes.add (n);
|
||||
nodes.add (n.get());
|
||||
n->setParentGraph (this);
|
||||
topologyChanged();
|
||||
return n;
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ public:
|
|||
This will return nullptr if the index is out of range.
|
||||
@see getNodeForId
|
||||
*/
|
||||
Node* getNode (int index) const noexcept { return nodes [index]; }
|
||||
Node::Ptr getNode (int index) const noexcept { return nodes[index]; }
|
||||
|
||||
/** Searches the graph for a node with the given ID number and returns it.
|
||||
If no such node was found, this returns nullptr.
|
||||
|
|
|
|||
|
|
@ -944,7 +944,7 @@ struct PhysicalTopologySource::Internal
|
|||
if (auto bi = BlockImplementation::getFrom (*currentBlock))
|
||||
bi->invalidate();
|
||||
|
||||
disconnectedBlocks.addIfNotAlreadyThere (currentTopology.blocks.removeAndReturn (i));
|
||||
disconnectedBlocks.addIfNotAlreadyThere (currentTopology.blocks.removeAndReturn (i).get());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ public:
|
|||
/** Returns a raw pointer to the object at this index in the array, without checking
|
||||
whether the index is in-range.
|
||||
*/
|
||||
inline ObjectClass* getObjectPointerUnchecked (const int index) const noexcept
|
||||
inline ObjectClass* getObjectPointerUnchecked (int index) const noexcept
|
||||
{
|
||||
const ScopedLockType lock (getLock());
|
||||
jassert (isPositiveAndBelow (index, numUsed) && data.elements != nullptr);
|
||||
|
|
@ -308,6 +308,13 @@ public:
|
|||
return -1;
|
||||
}
|
||||
|
||||
/** Finds the index of the first occurrence of an object in the array.
|
||||
|
||||
@param objectToLookFor the object to look for
|
||||
@returns the index at which the object was found, or -1 if it's not found
|
||||
*/
|
||||
int indexOf (const ObjectClassPtr& objectToLookFor) const noexcept { return indexOf (objectToLookFor.get()); }
|
||||
|
||||
/** Returns true if the array contains a specified object.
|
||||
|
||||
@param objectToLookFor the object to look for
|
||||
|
|
@ -330,6 +337,13 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
/** Returns true if the array contains a specified object.
|
||||
|
||||
@param objectToLookFor the object to look for
|
||||
@returns true if the object is in the array
|
||||
*/
|
||||
bool contains (const ObjectClassPtr& objectToLookFor) const noexcept { return contains (objectToLookFor.get()); }
|
||||
|
||||
/** Appends a new object to the end of the array.
|
||||
|
||||
This will increase the new object's reference count.
|
||||
|
|
@ -337,7 +351,7 @@ public:
|
|||
@param newObject the new object to add to the array
|
||||
@see set, insert, addIfNotAlreadyThere, addSorted, addArray
|
||||
*/
|
||||
ObjectClass* add (ObjectClass* newObject) noexcept
|
||||
ObjectClass* add (ObjectClass* newObject)
|
||||
{
|
||||
const ScopedLockType lock (getLock());
|
||||
data.ensureAllocatedSize (numUsed + 1);
|
||||
|
|
@ -350,6 +364,15 @@ public:
|
|||
return newObject;
|
||||
}
|
||||
|
||||
/** Appends a new object to the end of the array.
|
||||
|
||||
This will increase the new object's reference count.
|
||||
|
||||
@param newObject the new object to add to the array
|
||||
@see set, insert, addIfNotAlreadyThere, addSorted, addArray
|
||||
*/
|
||||
ObjectClass* add (const ObjectClassPtr& newObject) { return add (newObject.get()); }
|
||||
|
||||
/** Inserts a new object into the array at the given index.
|
||||
|
||||
If the index is less than 0 or greater than the size of the array, the
|
||||
|
|
@ -363,7 +386,7 @@ public:
|
|||
@param newObject the new object to add to the array
|
||||
@see add, addSorted, addIfNotAlreadyThere, set
|
||||
*/
|
||||
ObjectClass* insert (int indexToInsertAt, ObjectClass* newObject) noexcept
|
||||
ObjectClass* insert (int indexToInsertAt, ObjectClass* newObject)
|
||||
{
|
||||
if (indexToInsertAt < 0)
|
||||
return add (newObject);
|
||||
|
|
@ -391,6 +414,21 @@ public:
|
|||
return newObject;
|
||||
}
|
||||
|
||||
/** Inserts a new object into the array at the given index.
|
||||
|
||||
If the index is less than 0 or greater than the size of the array, the
|
||||
element will be added to the end of the array.
|
||||
Otherwise, it will be inserted into the array, moving all the later elements
|
||||
along to make room.
|
||||
|
||||
This will increase the new object's reference count.
|
||||
|
||||
@param indexToInsertAt the index at which the new element should be inserted
|
||||
@param newObject the new object to add to the array
|
||||
@see add, addSorted, addIfNotAlreadyThere, set
|
||||
*/
|
||||
ObjectClass* insert (int indexToInsertAt, const ObjectClassPtr& newObject) { return insert (indexToInsertAt, newObject.get()); }
|
||||
|
||||
/** Appends a new object at the end of the array as long as the array doesn't
|
||||
already contain it.
|
||||
|
||||
|
|
@ -399,7 +437,7 @@ public:
|
|||
@param newObject the new object to add to the array
|
||||
@returns true if the object has been added, false otherwise
|
||||
*/
|
||||
bool addIfNotAlreadyThere (ObjectClass* newObject) noexcept
|
||||
bool addIfNotAlreadyThere (ObjectClass* newObject)
|
||||
{
|
||||
const ScopedLockType lock (getLock());
|
||||
|
||||
|
|
@ -410,6 +448,16 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
/** Appends a new object at the end of the array as long as the array doesn't
|
||||
already contain it.
|
||||
|
||||
If the array already contains a matching object, nothing will be done.
|
||||
|
||||
@param newObject the new object to add to the array
|
||||
@returns true if the object has been added, false otherwise
|
||||
*/
|
||||
bool addIfNotAlreadyThere (const ObjectClassPtr& newObject) { return addIfNotAlreadyThere (newObject.get()); }
|
||||
|
||||
/** Replaces an object in the array with a different one.
|
||||
|
||||
If the index is less than zero, this method does nothing.
|
||||
|
|
@ -638,6 +686,16 @@ public:
|
|||
remove (indexOf (objectToRemove));
|
||||
}
|
||||
|
||||
/** Removes the first occurrence of a specified object from the array.
|
||||
|
||||
If the item isn't found, no action is taken. If it is found, it is
|
||||
removed and has its reference count decreased.
|
||||
|
||||
@param objectToRemove the object to try to remove
|
||||
@see remove, removeRange
|
||||
*/
|
||||
void removeObject (const ObjectClassPtr& objectToRemove) { removeObject (objectToRemove.get()); }
|
||||
|
||||
/** Removes a range of objects from the array.
|
||||
|
||||
This will remove a set of objects, starting from the given index,
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ struct JavascriptEngine::RootObject : public DynamicObject
|
|||
static bool isNumericOrUndefined (const var& v) noexcept { return isNumeric (v) || v.isUndefined(); }
|
||||
static int64 getOctalValue (const String& s) { BigInteger b; b.parseString (s.initialSectionContainingOnly ("01234567"), 8); return b.toInt64(); }
|
||||
static Identifier getPrototypeIdentifier() { static const Identifier i ("prototype"); return i; }
|
||||
static var* getPropertyPointer (DynamicObject* o, const Identifier& i) noexcept { return o->getProperties().getVarPointer (i); }
|
||||
static var* getPropertyPointer (DynamicObject& o, const Identifier& i) noexcept { return o.getProperties().getVarPointer (i); }
|
||||
|
||||
//==============================================================================
|
||||
struct CodeLocation
|
||||
|
|
@ -131,9 +131,11 @@ struct JavascriptEngine::RootObject : public DynamicObject
|
|||
//==============================================================================
|
||||
struct Scope
|
||||
{
|
||||
Scope (const Scope* p, RootObject* r, DynamicObject* s) noexcept : parent (p), root (r), scope (s) {}
|
||||
Scope (const Scope* p, ReferenceCountedObjectPtr<RootObject> rt, DynamicObject::Ptr scp) noexcept
|
||||
: parent (p), root (static_cast<ReferenceCountedObjectPtr<RootObject>&&> (rt)),
|
||||
scope (static_cast<DynamicObject::Ptr&&> (scp)) {}
|
||||
|
||||
const Scope* parent;
|
||||
const Scope* const parent;
|
||||
ReferenceCountedObjectPtr<RootObject> root;
|
||||
DynamicObject::Ptr scope;
|
||||
|
||||
|
|
@ -141,13 +143,13 @@ struct JavascriptEngine::RootObject : public DynamicObject
|
|||
{
|
||||
if (auto* o = targetObject.getDynamicObject())
|
||||
{
|
||||
if (auto* prop = getPropertyPointer (o, functionName))
|
||||
if (auto* prop = getPropertyPointer (*o, functionName))
|
||||
return *prop;
|
||||
|
||||
for (auto* p = o->getProperty (getPrototypeIdentifier()).getDynamicObject(); p != nullptr;
|
||||
p = p->getProperty (getPrototypeIdentifier()).getDynamicObject())
|
||||
{
|
||||
if (auto* prop = getPropertyPointer (p, functionName))
|
||||
if (auto* prop = getPropertyPointer (*p, functionName))
|
||||
return *prop;
|
||||
}
|
||||
|
||||
|
|
@ -174,14 +176,14 @@ struct JavascriptEngine::RootObject : public DynamicObject
|
|||
var* findRootClassProperty (const Identifier& className, const Identifier& propName) const
|
||||
{
|
||||
if (auto* cls = root->getProperty (className).getDynamicObject())
|
||||
return getPropertyPointer (cls, propName);
|
||||
return getPropertyPointer (*cls, propName);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
var findSymbolInParentScopes (const Identifier& name) const
|
||||
{
|
||||
if (auto* v = getPropertyPointer (scope, name))
|
||||
if (auto v = getPropertyPointer (*scope, name))
|
||||
return *v;
|
||||
|
||||
return parent != nullptr ? parent->findSymbolInParentScopes (name)
|
||||
|
|
@ -192,9 +194,9 @@ struct JavascriptEngine::RootObject : public DynamicObject
|
|||
{
|
||||
auto* target = args.thisObject.getDynamicObject();
|
||||
|
||||
if (target == nullptr || target == scope)
|
||||
if (target == nullptr || target == scope.get())
|
||||
{
|
||||
if (auto* m = getPropertyPointer (scope, function))
|
||||
if (auto* m = getPropertyPointer (*scope, function))
|
||||
{
|
||||
if (auto fo = dynamic_cast<FunctionObject*> (m->getObject()))
|
||||
{
|
||||
|
|
@ -220,7 +222,7 @@ struct JavascriptEngine::RootObject : public DynamicObject
|
|||
{
|
||||
auto* target = args.thisObject.getDynamicObject();
|
||||
|
||||
if (target == nullptr || target == scope)
|
||||
if (target == nullptr || target == scope.get())
|
||||
{
|
||||
if (auto fo = dynamic_cast<FunctionObject*> (m.getObject()))
|
||||
{
|
||||
|
|
@ -238,6 +240,8 @@ struct JavascriptEngine::RootObject : public DynamicObject
|
|||
if (Time::getCurrentTime() > root->timeout)
|
||||
location.throwError (root->timeout == Time() ? "Interrupted" : "Execution timed-out");
|
||||
}
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Scope)
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -378,7 +382,7 @@ struct JavascriptEngine::RootObject : public DynamicObject
|
|||
|
||||
void assign (const Scope& s, const var& newValue) const override
|
||||
{
|
||||
if (auto* v = getPropertyPointer (s.scope, name))
|
||||
if (auto* v = getPropertyPointer (*s.scope, name))
|
||||
*v = newValue;
|
||||
else
|
||||
s.root->setProperty (name, newValue);
|
||||
|
|
@ -403,7 +407,7 @@ struct JavascriptEngine::RootObject : public DynamicObject
|
|||
}
|
||||
|
||||
if (auto* o = p.getDynamicObject())
|
||||
if (auto* v = getPropertyPointer (o, child))
|
||||
if (auto* v = getPropertyPointer (*o, child))
|
||||
return *v;
|
||||
|
||||
return var::undefined();
|
||||
|
|
@ -436,7 +440,7 @@ struct JavascriptEngine::RootObject : public DynamicObject
|
|||
|
||||
if (auto* o = arrayVar.getDynamicObject())
|
||||
if (key.isString())
|
||||
if (auto* v = getPropertyPointer (o, Identifier (key)))
|
||||
if (auto* v = getPropertyPointer (*o, Identifier (key)))
|
||||
return *v;
|
||||
|
||||
return var::undefined();
|
||||
|
|
@ -1865,13 +1869,13 @@ var JavascriptEngine::evaluate (const String& code, Result* result)
|
|||
|
||||
var JavascriptEngine::callFunction (const Identifier& function, const var::NativeFunctionArgs& args, Result* result)
|
||||
{
|
||||
var returnVal (var::undefined());
|
||||
auto returnVal = var::undefined();
|
||||
|
||||
try
|
||||
{
|
||||
prepareTimeout();
|
||||
if (result != nullptr) *result = Result::ok();
|
||||
RootObject::Scope (nullptr, root, root).findAndInvokeMethod (function, args, returnVal);
|
||||
RootObject::Scope ({}, root, root).findAndInvokeMethod (function, args, returnVal);
|
||||
}
|
||||
catch (String& error)
|
||||
{
|
||||
|
|
@ -1884,13 +1888,13 @@ var JavascriptEngine::callFunction (const Identifier& function, const var::Nativ
|
|||
var JavascriptEngine::callFunctionObject (DynamicObject* objectScope, const var& functionObject,
|
||||
const var::NativeFunctionArgs& args, Result* result)
|
||||
{
|
||||
var returnVal (var::undefined());
|
||||
auto returnVal = var::undefined();
|
||||
|
||||
try
|
||||
{
|
||||
prepareTimeout();
|
||||
if (result != nullptr) *result = Result::ok();
|
||||
RootObject::Scope rootScope (nullptr, root, root);
|
||||
RootObject::Scope rootScope ({}, root, root);
|
||||
RootObject::Scope (&rootScope, root, objectScope).invokeMethod (functionObject, args, returnVal);
|
||||
}
|
||||
catch (String& error)
|
||||
|
|
|
|||
|
|
@ -173,6 +173,15 @@
|
|||
#define JUCE_ALLOW_STATIC_NULL_VARIABLES 1
|
||||
#endif
|
||||
|
||||
/** Config: JUCE_STRICT_REFCOUNTEDPOINTER
|
||||
If enabled, this will make the ReferenceCountedObjectPtr class stricter about allowing
|
||||
itself to be cast directly to a raw pointer. By default this is disabled, for compatibility
|
||||
with old code, but if possible, you should always enable it to improve code safety!
|
||||
*/
|
||||
#ifndef JUCE_STRICT_REFCOUNTEDPOINTER
|
||||
#define JUCE_STRICT_REFCOUNTEDPOINTER 0
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef JUCE_STRING_UTF_TYPE
|
||||
#define JUCE_STRING_UTF_TYPE 8
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ struct Expression::Helpers
|
|||
class Constant : public Term
|
||||
{
|
||||
public:
|
||||
Constant (const double val, const bool resolutionTarget)
|
||||
Constant (double val, bool resolutionTarget)
|
||||
: value (val), isResolutionTarget (resolutionTarget) {}
|
||||
|
||||
Type getType() const noexcept { return constantType; }
|
||||
|
|
@ -133,9 +133,9 @@ struct Expression::Helpers
|
|||
class BinaryTerm : public Term
|
||||
{
|
||||
public:
|
||||
BinaryTerm (Term* const l, Term* const r) : left (l), right (r)
|
||||
BinaryTerm (TermPtr l, TermPtr r) : left (static_cast<TermPtr&&> (l)), right (static_cast<TermPtr&&> (r))
|
||||
{
|
||||
jassert (l != nullptr && r != nullptr);
|
||||
jassert (left != nullptr && right != nullptr);
|
||||
}
|
||||
|
||||
int getInputIndexFor (const Term* possibleInput) const
|
||||
|
|
@ -183,9 +183,9 @@ struct Expression::Helpers
|
|||
{
|
||||
jassert (input == left || input == right);
|
||||
if (input != left && input != right)
|
||||
return TermPtr();
|
||||
return {};
|
||||
|
||||
if (const Term* const dest = findDestinationFor (topLevelTerm, this))
|
||||
if (auto dest = findDestinationFor (topLevelTerm, this))
|
||||
return dest->createTermToEvaluateInput (scope, this, overallTarget, topLevelTerm);
|
||||
|
||||
return new Constant (overallTarget, false);
|
||||
|
|
@ -238,7 +238,7 @@ struct Expression::Helpers
|
|||
Type getType() const noexcept { return functionType; }
|
||||
Term* clone() const { return new Function (functionName, parameters); }
|
||||
int getNumInputs() const { return parameters.size(); }
|
||||
Term* getInput (int i) const { return parameters.getReference(i).term; }
|
||||
Term* getInput (int i) const { return parameters.getReference(i).term.get(); }
|
||||
String getName() const { return functionName; }
|
||||
|
||||
TermPtr resolve (const Scope& scope, int recursionDepth)
|
||||
|
|
@ -300,7 +300,7 @@ struct Expression::Helpers
|
|||
class DotOperator : public BinaryTerm
|
||||
{
|
||||
public:
|
||||
DotOperator (SymbolTerm* const l, Term* const r) : BinaryTerm (l, r) {}
|
||||
DotOperator (SymbolTerm* const l, TermPtr r) : BinaryTerm (l, r) {}
|
||||
|
||||
TermPtr resolve (const Scope& scope, int recursionDepth)
|
||||
{
|
||||
|
|
@ -311,7 +311,7 @@ struct Expression::Helpers
|
|||
return visitor.output;
|
||||
}
|
||||
|
||||
Term* clone() const { return new DotOperator (getSymbol(), right); }
|
||||
Term* clone() const { return new DotOperator (getSymbol(), right.get()); }
|
||||
String getName() const { return "."; }
|
||||
int getOperatorPrecedence() const { return 1; }
|
||||
void writeOperator (String& dest) const { dest << '.'; }
|
||||
|
|
@ -451,7 +451,7 @@ struct Expression::Helpers
|
|||
class Add : public BinaryTerm
|
||||
{
|
||||
public:
|
||||
Add (Term* const l, Term* const r) : BinaryTerm (l, r) {}
|
||||
Add (TermPtr l, TermPtr r) : BinaryTerm (l, r) {}
|
||||
|
||||
Term* clone() const { return new Add (left->clone(), right->clone()); }
|
||||
double performFunction (double lhs, double rhs) const { return lhs + rhs; }
|
||||
|
|
@ -461,11 +461,10 @@ struct Expression::Helpers
|
|||
|
||||
TermPtr createTermToEvaluateInput (const Scope& scope, const Term* input, double overallTarget, Term* topLevelTerm) const
|
||||
{
|
||||
const TermPtr newDest (createDestinationTerm (scope, input, overallTarget, topLevelTerm));
|
||||
if (newDest == nullptr)
|
||||
return TermPtr();
|
||||
if (auto newDest = createDestinationTerm (scope, input, overallTarget, topLevelTerm))
|
||||
return new Subtract (newDest, (input == left ? right : left)->clone());
|
||||
|
||||
return new Subtract (newDest, (input == left ? right : left)->clone());
|
||||
return {};
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
@ -476,7 +475,7 @@ struct Expression::Helpers
|
|||
class Subtract : public BinaryTerm
|
||||
{
|
||||
public:
|
||||
Subtract (Term* const l, Term* const r) : BinaryTerm (l, r) {}
|
||||
Subtract (TermPtr l, TermPtr r) : BinaryTerm (l, r) {}
|
||||
|
||||
Term* clone() const { return new Subtract (left->clone(), right->clone()); }
|
||||
double performFunction (double lhs, double rhs) const { return lhs - rhs; }
|
||||
|
|
@ -486,14 +485,15 @@ struct Expression::Helpers
|
|||
|
||||
TermPtr createTermToEvaluateInput (const Scope& scope, const Term* input, double overallTarget, Term* topLevelTerm) const
|
||||
{
|
||||
const TermPtr newDest (createDestinationTerm (scope, input, overallTarget, topLevelTerm));
|
||||
if (newDest == nullptr)
|
||||
return TermPtr();
|
||||
if (auto newDest = createDestinationTerm (scope, input, overallTarget, topLevelTerm))
|
||||
{
|
||||
if (input == left)
|
||||
return new Add (newDest, right->clone());
|
||||
|
||||
if (input == left)
|
||||
return new Add (newDest, right->clone());
|
||||
return new Subtract (left->clone(), newDest);
|
||||
}
|
||||
|
||||
return new Subtract (left->clone(), newDest);
|
||||
return {};
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
@ -504,7 +504,7 @@ struct Expression::Helpers
|
|||
class Multiply : public BinaryTerm
|
||||
{
|
||||
public:
|
||||
Multiply (Term* const l, Term* const r) : BinaryTerm (l, r) {}
|
||||
Multiply (TermPtr l, TermPtr r) : BinaryTerm (l, r) {}
|
||||
|
||||
Term* clone() const { return new Multiply (left->clone(), right->clone()); }
|
||||
double performFunction (double lhs, double rhs) const { return lhs * rhs; }
|
||||
|
|
@ -514,14 +514,12 @@ struct Expression::Helpers
|
|||
|
||||
TermPtr createTermToEvaluateInput (const Scope& scope, const Term* input, double overallTarget, Term* topLevelTerm) const
|
||||
{
|
||||
const TermPtr newDest (createDestinationTerm (scope, input, overallTarget, topLevelTerm));
|
||||
if (newDest == nullptr)
|
||||
return TermPtr();
|
||||
if (auto newDest = createDestinationTerm (scope, input, overallTarget, topLevelTerm))
|
||||
return new Divide (newDest, (input == left ? right : left)->clone());
|
||||
|
||||
return new Divide (newDest, (input == left ? right : left)->clone());
|
||||
return {};
|
||||
}
|
||||
|
||||
private:
|
||||
JUCE_DECLARE_NON_COPYABLE (Multiply)
|
||||
};
|
||||
|
||||
|
|
@ -529,7 +527,7 @@ struct Expression::Helpers
|
|||
class Divide : public BinaryTerm
|
||||
{
|
||||
public:
|
||||
Divide (Term* const l, Term* const r) : BinaryTerm (l, r) {}
|
||||
Divide (TermPtr l, TermPtr r) : BinaryTerm (l, r) {}
|
||||
|
||||
Term* clone() const { return new Divide (left->clone(), right->clone()); }
|
||||
double performFunction (double lhs, double rhs) const { return lhs / rhs; }
|
||||
|
|
@ -541,7 +539,7 @@ struct Expression::Helpers
|
|||
{
|
||||
const TermPtr newDest (createDestinationTerm (scope, input, overallTarget, topLevelTerm));
|
||||
if (newDest == nullptr)
|
||||
return TermPtr();
|
||||
return {};
|
||||
|
||||
if (input == left)
|
||||
return new Multiply (newDest, right->clone());
|
||||
|
|
@ -549,7 +547,6 @@ struct Expression::Helpers
|
|||
return new Divide (left->clone(), newDest);
|
||||
}
|
||||
|
||||
private:
|
||||
JUCE_DECLARE_NON_COPYABLE (Divide)
|
||||
};
|
||||
|
||||
|
|
@ -610,13 +607,13 @@ struct Expression::Helpers
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
static bool containsAnySymbols (const Term* const t)
|
||||
static bool containsAnySymbols (const Term& t)
|
||||
{
|
||||
if (t->getType() == Expression::symbolType)
|
||||
if (t.getType() == Expression::symbolType)
|
||||
return true;
|
||||
|
||||
for (int i = t->getNumInputs(); --i >= 0;)
|
||||
if (containsAnySymbols (t->getInput (i)))
|
||||
for (int i = t.getNumInputs(); --i >= 0;)
|
||||
if (containsAnySymbols (*t.getInput (i)))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
@ -905,17 +902,17 @@ struct Expression::Helpers
|
|||
return new SymbolTerm (identifier);
|
||||
}
|
||||
|
||||
return TermPtr();
|
||||
return {};
|
||||
}
|
||||
|
||||
TermPtr readParenthesisedExpression()
|
||||
{
|
||||
if (! readOperator ("("))
|
||||
return TermPtr();
|
||||
return {};
|
||||
|
||||
const TermPtr e (readExpression());
|
||||
if (e == nullptr || ! readOperator (")"))
|
||||
return TermPtr();
|
||||
return {};
|
||||
|
||||
return e;
|
||||
}
|
||||
|
|
@ -1089,7 +1086,7 @@ void Expression::findReferencedSymbols (Array<Symbol>& results, const Scope& sco
|
|||
}
|
||||
|
||||
String Expression::toString() const { return term->toString(); }
|
||||
bool Expression::usesAnySymbols() const { return Helpers::containsAnySymbols (term); }
|
||||
bool Expression::usesAnySymbols() const { return Helpers::containsAnySymbols (*term); }
|
||||
Expression::Type Expression::getType() const noexcept { return term->getType(); }
|
||||
String Expression::getSymbolOrFunction() const { return term->getName(); }
|
||||
int Expression::getNumInputs() const { return term->getNumInputs(); }
|
||||
|
|
|
|||
|
|
@ -269,6 +269,13 @@ public:
|
|||
incIfNotNull (referencedObject);
|
||||
}
|
||||
|
||||
/** Takes-over the object from another pointer. */
|
||||
ReferenceCountedObjectPtr (ReferenceCountedObjectPtr&& other) noexcept
|
||||
: referencedObject (other.referencedObject)
|
||||
{
|
||||
other.referencedObject = nullptr;
|
||||
}
|
||||
|
||||
/** Copies another pointer.
|
||||
This will increment the object's reference-count (if it is non-null).
|
||||
*/
|
||||
|
|
@ -317,14 +324,7 @@ public:
|
|||
}
|
||||
|
||||
/** Takes-over the object from another pointer. */
|
||||
ReferenceCountedObjectPtr (ReferenceCountedObjectPtr&& other) noexcept
|
||||
: referencedObject (other.referencedObject)
|
||||
{
|
||||
other.referencedObject = nullptr;
|
||||
}
|
||||
|
||||
/** Takes-over the object from another pointer. */
|
||||
ReferenceCountedObjectPtr& operator= (ReferenceCountedObjectPtr&& other)
|
||||
ReferenceCountedObjectPtr& operator= (ReferenceCountedObjectPtr&& other) noexcept
|
||||
{
|
||||
std::swap (referencedObject, other.referencedObject);
|
||||
return *this;
|
||||
|
|
@ -343,17 +343,7 @@ public:
|
|||
/** Returns the object that this pointer references.
|
||||
The pointer returned may be null, of course.
|
||||
*/
|
||||
operator ReferencedType*() const noexcept { return referencedObject; }
|
||||
|
||||
/** Returns the object that this pointer references.
|
||||
The pointer returned may be null, of course.
|
||||
*/
|
||||
ReferencedType* get() const noexcept { return referencedObject; }
|
||||
|
||||
/** Returns the object that this pointer references.
|
||||
The pointer returned may be null, of course.
|
||||
*/
|
||||
ReferencedType* getObject() const noexcept { return referencedObject; }
|
||||
ReferencedType* get() const noexcept { return referencedObject; }
|
||||
|
||||
// the -> operator is called on the referenced object
|
||||
ReferencedType* operator->() const noexcept
|
||||
|
|
@ -362,6 +352,34 @@ public:
|
|||
return referencedObject;
|
||||
}
|
||||
|
||||
/** Dereferences the object that this pointer references.
|
||||
The pointer returned may be null, of course.
|
||||
*/
|
||||
ReferencedType& operator*() const noexcept { jassert (referencedObject != nullptr); return *referencedObject; }
|
||||
|
||||
/** Checks whether this pointer is null */
|
||||
bool operator== (decltype (nullptr)) const noexcept { return referencedObject == nullptr; }
|
||||
/** Checks whether this pointer is null */
|
||||
bool operator!= (decltype (nullptr)) const noexcept { return referencedObject != nullptr; }
|
||||
|
||||
#if JUCE_STRICT_REFCOUNTEDPOINTER
|
||||
/** Checks whether this pointer is null */
|
||||
operator bool() const noexcept { return referencedObject != nullptr; }
|
||||
|
||||
#else
|
||||
/** Returns the object that this pointer references.
|
||||
The pointer returned may be null, of course.
|
||||
Note that this methods allows the compiler to be very lenient with what it allows you to do
|
||||
with the pointer, it's safer to disable this by setting JUCE_STRICT_REFCOUNTEDPOINTER=1, which
|
||||
increased type safety and can prevent some common slip-ups.
|
||||
*/
|
||||
operator ReferencedType*() const noexcept { return referencedObject; }
|
||||
#endif
|
||||
|
||||
|
||||
// This old method is deprecated in favour of the shorter and more standard get() method.
|
||||
JUCE_DEPRECATED_WITH_BODY (ReferencedType* getObject() const, { return get(); })
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
ReferencedType* referencedObject = nullptr;
|
||||
|
|
@ -382,43 +400,43 @@ private:
|
|||
|
||||
//==============================================================================
|
||||
/** Compares two ReferenceCountedObjectPtrs. */
|
||||
template <typename ObjectType>
|
||||
bool operator== (const ReferenceCountedObjectPtr<ObjectType>& object1, ObjectType* const object2) noexcept
|
||||
template <typename Type>
|
||||
bool operator== (const ReferenceCountedObjectPtr<Type>& object1, const Type* object2) noexcept
|
||||
{
|
||||
return object1.get() == object2;
|
||||
}
|
||||
|
||||
/** Compares two ReferenceCountedObjectPtrs. */
|
||||
template <typename ObjectType>
|
||||
bool operator== (const ReferenceCountedObjectPtr<ObjectType>& object1, const ReferenceCountedObjectPtr<ObjectType>& object2) noexcept
|
||||
template <typename Type>
|
||||
bool operator== (const ReferenceCountedObjectPtr<Type>& object1, const ReferenceCountedObjectPtr<Type>& object2) noexcept
|
||||
{
|
||||
return object1.get() == object2.get();
|
||||
}
|
||||
|
||||
/** Compares two ReferenceCountedObjectPtrs. */
|
||||
template <typename ObjectType>
|
||||
bool operator== (ObjectType* object1, const ReferenceCountedObjectPtr<ObjectType>& object2) noexcept
|
||||
template <typename Type>
|
||||
bool operator== (const Type* object1, const ReferenceCountedObjectPtr<Type>& object2) noexcept
|
||||
{
|
||||
return object1 == object2.get();
|
||||
}
|
||||
|
||||
/** Compares two ReferenceCountedObjectPtrs. */
|
||||
template <typename ObjectType>
|
||||
bool operator!= (const ReferenceCountedObjectPtr<ObjectType>& object1, const ObjectType* object2) noexcept
|
||||
template <typename Type>
|
||||
bool operator!= (const ReferenceCountedObjectPtr<Type>& object1, const Type* object2) noexcept
|
||||
{
|
||||
return object1.get() != object2;
|
||||
}
|
||||
|
||||
/** Compares two ReferenceCountedObjectPtrs. */
|
||||
template <typename ObjectType>
|
||||
bool operator!= (const ReferenceCountedObjectPtr<ObjectType>& object1, const ReferenceCountedObjectPtr<ObjectType>& object2) noexcept
|
||||
template <typename Type>
|
||||
bool operator!= (const ReferenceCountedObjectPtr<Type>& object1, const ReferenceCountedObjectPtr<Type>& object2) noexcept
|
||||
{
|
||||
return object1.get() != object2.get();
|
||||
}
|
||||
|
||||
/** Compares two ReferenceCountedObjectPtrs. */
|
||||
template <typename ObjectType>
|
||||
bool operator!= (ObjectType* object1, const ReferenceCountedObjectPtr<ObjectType>& object2) noexcept
|
||||
template <typename Type>
|
||||
bool operator!= (const Type* object1, const ReferenceCountedObjectPtr<Type>& object2) noexcept
|
||||
{
|
||||
return object1 != object2.get();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ public:
|
|||
/** The first call to this method will create an internal object that is shared by all weak
|
||||
references to the object.
|
||||
*/
|
||||
SharedPointer* getSharedPointer (ObjectType* object)
|
||||
SharedRef getSharedPointer (ObjectType* object)
|
||||
{
|
||||
if (sharedPointer == nullptr)
|
||||
{
|
||||
|
|
@ -206,9 +206,12 @@ public:
|
|||
private:
|
||||
SharedRef holder;
|
||||
|
||||
static inline SharedPointer* getRef (ObjectType* o)
|
||||
static inline SharedRef getRef (ObjectType* o)
|
||||
{
|
||||
return (o != nullptr) ? o->masterReference.getSharedPointer (o) : nullptr;
|
||||
if (o != nullptr)
|
||||
return o->masterReference.getSharedPointer (o);
|
||||
|
||||
return {};
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -394,7 +394,7 @@ public:
|
|||
writeObjectToStream (output, children.getObjectPointerUnchecked(i));
|
||||
}
|
||||
|
||||
static void writeObjectToStream (OutputStream& output, const SharedObject* object)
|
||||
static void writeObjectToStream (OutputStream& output, const Ptr& object)
|
||||
{
|
||||
if (object != nullptr)
|
||||
{
|
||||
|
|
@ -411,10 +411,11 @@ public:
|
|||
//==============================================================================
|
||||
struct SetPropertyAction : public UndoableAction
|
||||
{
|
||||
SetPropertyAction (SharedObject* so, const Identifier& propertyName,
|
||||
SetPropertyAction (Ptr targetObject, const Identifier& propertyName,
|
||||
const var& newVal, const var& oldVal, bool isAdding, bool isDeleting,
|
||||
ValueTree::Listener* listenerToExclude = nullptr)
|
||||
: target (so), name (propertyName), newValue (newVal), oldValue (oldVal),
|
||||
: target (static_cast<Ptr&&> (targetObject)),
|
||||
name (propertyName), newValue (newVal), oldValue (oldVal),
|
||||
isAddingNewProperty (isAdding), isDeletingProperty (isDeleting),
|
||||
excludeListener (listenerToExclude)
|
||||
{
|
||||
|
|
@ -474,8 +475,8 @@ public:
|
|||
//==============================================================================
|
||||
struct AddOrRemoveChildAction : public UndoableAction
|
||||
{
|
||||
AddOrRemoveChildAction (SharedObject* parentObject, int index, SharedObject* newChild)
|
||||
: target (parentObject),
|
||||
AddOrRemoveChildAction (Ptr parentObject, int index, SharedObject* newChild)
|
||||
: target (static_cast<Ptr&&> (parentObject)),
|
||||
child (newChild != nullptr ? newChild : parentObject->children.getObjectPointer (index)),
|
||||
childIndex (index),
|
||||
isDeleting (newChild == nullptr)
|
||||
|
|
@ -488,7 +489,7 @@ public:
|
|||
if (isDeleting)
|
||||
target->removeChild (childIndex, nullptr);
|
||||
else
|
||||
target->addChild (child, childIndex, nullptr);
|
||||
target->addChild (child.get(), childIndex, nullptr);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -497,7 +498,7 @@ public:
|
|||
{
|
||||
if (isDeleting)
|
||||
{
|
||||
target->addChild (child, childIndex, nullptr);
|
||||
target->addChild (child.get(), childIndex, nullptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -526,8 +527,8 @@ public:
|
|||
//==============================================================================
|
||||
struct MoveChildAction : public UndoableAction
|
||||
{
|
||||
MoveChildAction (SharedObject* parentObject, int fromIndex, int toIndex) noexcept
|
||||
: parent (parentObject), startIndex (fromIndex), endIndex (toIndex)
|
||||
MoveChildAction (Ptr parentObject, int fromIndex, int toIndex) noexcept
|
||||
: parent (static_cast<Ptr&&> (parentObject)), startIndex (fromIndex), endIndex (toIndex)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -597,7 +598,8 @@ ValueTree::ValueTree (const Identifier& type,
|
|||
addChild (tree, -1, nullptr);
|
||||
}
|
||||
|
||||
ValueTree::ValueTree (SharedObject* so) noexcept : object (so)
|
||||
ValueTree::ValueTree (ReferenceCountedObjectPtr<SharedObject> so) noexcept
|
||||
: object (static_cast<ReferenceCountedObjectPtr<SharedObject>&&> (so))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -892,7 +894,7 @@ ValueTree ValueTree::getChildWithProperty (const Identifier& propertyName, const
|
|||
|
||||
bool ValueTree::isAChildOf (const ValueTree& possibleParent) const noexcept
|
||||
{
|
||||
return object != nullptr && object->isAChildOf (possibleParent.object);
|
||||
return object != nullptr && object->isAChildOf (possibleParent.object.get());
|
||||
}
|
||||
|
||||
int ValueTree::indexOf (const ValueTree& child) const noexcept
|
||||
|
|
@ -905,7 +907,7 @@ void ValueTree::addChild (const ValueTree& child, int index, UndoManager* undoMa
|
|||
jassert (object != nullptr); // Trying to add a child to a null ValueTree!
|
||||
|
||||
if (object != nullptr)
|
||||
object->addChild (child.object, index, undoManager);
|
||||
object->addChild (child.object.get(), index, undoManager);
|
||||
}
|
||||
|
||||
void ValueTree::appendChild (const ValueTree& child, UndoManager* undoManager)
|
||||
|
|
@ -1056,7 +1058,7 @@ ValueTree ValueTree::readFromStream (InputStream& input)
|
|||
return v;
|
||||
|
||||
v.object->children.add (child.object);
|
||||
child.object->parent = v.object;
|
||||
child.object->parent = v.object.get();
|
||||
}
|
||||
|
||||
return v;
|
||||
|
|
|
|||
|
|
@ -632,7 +632,7 @@ private:
|
|||
void createListOfChildren (OwnedArray<ValueTree>&) const;
|
||||
void reorderChildren (const OwnedArray<ValueTree>&, UndoManager*);
|
||||
|
||||
explicit ValueTree (SharedObject*) noexcept;
|
||||
explicit ValueTree (ReferenceCountedObjectPtr<SharedObject>) noexcept;
|
||||
};
|
||||
|
||||
} // namespace juce
|
||||
|
|
|
|||
|
|
@ -60,12 +60,15 @@ namespace FIR
|
|||
*/
|
||||
using NumericType = typename SampleTypeHelpers::ElementType<SampleType>::Type;
|
||||
|
||||
/** A typedef for a ref-counted pointer to the coefficients object */
|
||||
using CoefficientsPtr = typename Coefficients<NumericType>::Ptr;
|
||||
|
||||
//==============================================================================
|
||||
/** This will create a filter which will produce silence. */
|
||||
Filter() : coefficients (new Coefficients<NumericType>) { reset(); }
|
||||
|
||||
/** Creates a filter with a given set of coefficients. */
|
||||
Filter (Coefficients<NumericType>* coefficientsToUse) : coefficients (coefficientsToUse) { reset(); }
|
||||
Filter (CoefficientsPtr coefficientsToUse) : coefficients (static_cast<CoefficientsPtr&&> (coefficientsToUse)) { reset(); }
|
||||
|
||||
Filter (const Filter&) = default;
|
||||
Filter (Filter&&) = default;
|
||||
|
|
|
|||
|
|
@ -59,6 +59,9 @@ namespace IIR
|
|||
*/
|
||||
using NumericType = typename SampleTypeHelpers::ElementType<SampleType>::Type;
|
||||
|
||||
/** A typedef for a ref-counted pointer to the coefficients object */
|
||||
using CoefficientsPtr = typename Coefficients<NumericType>::Ptr;
|
||||
|
||||
//==============================================================================
|
||||
/** Creates a filter.
|
||||
|
||||
|
|
@ -69,7 +72,7 @@ namespace IIR
|
|||
Filter();
|
||||
|
||||
/** Creates a filter with a given set of coefficients. */
|
||||
Filter (Coefficients<NumericType>* coefficientsToUse);
|
||||
Filter (CoefficientsPtr coefficientsToUse);
|
||||
|
||||
Filter (const Filter&) = default;
|
||||
Filter (Filter&&) = default;
|
||||
|
|
@ -83,7 +86,7 @@ namespace IIR
|
|||
If you change the order of the coefficients then you must call reset after
|
||||
modifying them.
|
||||
*/
|
||||
typename Coefficients<NumericType>::Ptr coefficients;
|
||||
CoefficientsPtr coefficients;
|
||||
|
||||
//==============================================================================
|
||||
/** Resets the filter's processing pipeline, ready to start a new stream of data.
|
||||
|
|
|
|||
|
|
@ -42,8 +42,7 @@ Filter<SampleType>::Filter()
|
|||
}
|
||||
|
||||
template <typename SampleType>
|
||||
Filter<SampleType>::Filter (Coefficients<typename Filter<SampleType>::NumericType>* c)
|
||||
: coefficients (c)
|
||||
Filter<SampleType>::Filter (CoefficientsPtr c) : coefficients (static_cast<CoefficientsPtr&&> (c))
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ struct ProcessorDuplicator
|
|||
{
|
||||
ProcessorDuplicator() : state (new StateType()) {}
|
||||
ProcessorDuplicator (StateType* stateToUse) : state (stateToUse) {}
|
||||
ProcessorDuplicator (typename StateType::Ptr stateToUse) : state (static_cast<typename StateType::Ptr&&> (stateToUse)) {}
|
||||
ProcessorDuplicator (const ProcessorDuplicator&) = default;
|
||||
ProcessorDuplicator (ProcessorDuplicator&&) = default;
|
||||
|
||||
|
|
|
|||
|
|
@ -60,11 +60,14 @@ namespace StateVariableFilter
|
|||
*/
|
||||
using NumericType = typename SampleTypeHelpers::ElementType<SampleType>::Type;
|
||||
|
||||
/** A typedef for a ref-counted pointer to the coefficients object */
|
||||
using ParametersPtr = typename Parameters<NumericType>::Ptr;
|
||||
|
||||
//==============================================================================
|
||||
/** Creates a filter with default parameters. */
|
||||
Filter() : parameters (new Parameters<NumericType>) { reset(); }
|
||||
Filter() : parameters (new Parameters<NumericType>) { reset(); }
|
||||
|
||||
Filter (Parameters<NumericType>* parametersToUse) : parameters (parametersToUse) { reset(); }
|
||||
Filter (ParametersPtr parametersToUse) : parameters (static_cast<ParametersPtr&&> (parametersToUse)) { reset(); }
|
||||
|
||||
/** Creates a copy of another filter. */
|
||||
Filter (const Filter&) = default;
|
||||
|
|
|
|||
|
|
@ -313,7 +313,7 @@ float CustomTypeface::getStringWidth (const String& text)
|
|||
else
|
||||
{
|
||||
if (auto fallbackTypeface = Typeface::getFallbackTypeface())
|
||||
if (fallbackTypeface != this)
|
||||
if (fallbackTypeface.get() != this)
|
||||
x += fallbackTypeface->getStringWidth (String::charToString (c));
|
||||
}
|
||||
}
|
||||
|
|
@ -342,7 +342,7 @@ void CustomTypeface::getGlyphPositions (const String& text, Array<int>& resultGl
|
|||
{
|
||||
auto fallbackTypeface = getFallbackTypeface();
|
||||
|
||||
if (fallbackTypeface != nullptr && fallbackTypeface != this)
|
||||
if (fallbackTypeface != nullptr && fallbackTypeface.get() != this)
|
||||
{
|
||||
Array<int> subGlyphs;
|
||||
Array<float> subOffsets;
|
||||
|
|
@ -371,7 +371,7 @@ bool CustomTypeface::getOutlineForGlyph (int glyphNumber, Path& path)
|
|||
}
|
||||
|
||||
if (auto fallbackTypeface = getFallbackTypeface())
|
||||
if (fallbackTypeface != this)
|
||||
if (fallbackTypeface.get() != this)
|
||||
return fallbackTypeface->getOutlineForGlyph (glyphNumber, path);
|
||||
|
||||
return false;
|
||||
|
|
@ -389,7 +389,7 @@ EdgeTable* CustomTypeface::getEdgeTableForGlyph (int glyphNumber, const AffineTr
|
|||
else
|
||||
{
|
||||
if (auto fallbackTypeface = getFallbackTypeface())
|
||||
if (fallbackTypeface != this)
|
||||
if (fallbackTypeface.get() != this)
|
||||
return fallbackTypeface->getEdgeTableForGlyph (glyphNumber, transform, fontHeight);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -392,7 +392,7 @@ Typeface* Font::getTypeface() const
|
|||
jassert (font->typeface != nullptr);
|
||||
}
|
||||
|
||||
return font->typeface;
|
||||
return font->typeface.get();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -156,9 +156,9 @@ ImagePixelData::Ptr NativeImageType::create (Image::PixelFormat format, int widt
|
|||
class SubsectionPixelData : public ImagePixelData
|
||||
{
|
||||
public:
|
||||
SubsectionPixelData (ImagePixelData* im, Rectangle<int> r)
|
||||
: ImagePixelData (im->pixelFormat, r.getWidth(), r.getHeight()),
|
||||
sourceImage (im), area (r)
|
||||
SubsectionPixelData (ImagePixelData::Ptr source, Rectangle<int> r)
|
||||
: ImagePixelData (source->pixelFormat, r.getWidth(), r.getHeight()),
|
||||
sourceImage (static_cast<ImagePixelData::Ptr&&> (source)), area (r)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -225,8 +225,8 @@ Image::Image() noexcept
|
|||
{
|
||||
}
|
||||
|
||||
Image::Image (ImagePixelData* instance) noexcept
|
||||
: image (instance)
|
||||
Image::Image (ReferenceCountedObjectPtr<ImagePixelData> instance) noexcept
|
||||
: image (static_cast<ReferenceCountedObjectPtr<ImagePixelData>&&> (instance))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -409,10 +409,10 @@ public:
|
|||
|
||||
//==============================================================================
|
||||
/** @internal */
|
||||
ImagePixelData* getPixelData() const noexcept { return image; }
|
||||
ImagePixelData* getPixelData() const noexcept { return image.get(); }
|
||||
|
||||
/** @internal */
|
||||
explicit Image (ImagePixelData*) noexcept;
|
||||
explicit Image (ReferenceCountedObjectPtr<ImagePixelData>) noexcept;
|
||||
|
||||
/* A null Image object that can be used when you need to return an invalid image.
|
||||
@deprecated If you need a default-constructed var, just use Image() or {}.
|
||||
|
|
|
|||
|
|
@ -194,14 +194,14 @@ public:
|
|||
{
|
||||
const ScopedLock sl (lock);
|
||||
|
||||
if (auto* g = findExistingGlyph (font, glyphNumber))
|
||||
if (auto g = findExistingGlyph (font, glyphNumber))
|
||||
{
|
||||
++hits;
|
||||
return g;
|
||||
}
|
||||
|
||||
++misses;
|
||||
auto* g = getGlyphForReuse();
|
||||
auto g = getGlyphForReuse();
|
||||
jassert (g != nullptr);
|
||||
g->generate (font, glyphNumber);
|
||||
return g;
|
||||
|
|
@ -212,16 +212,16 @@ private:
|
|||
Atomic<int> accessCounter, hits, misses;
|
||||
CriticalSection lock;
|
||||
|
||||
CachedGlyphType* findExistingGlyph (const Font& font, int glyphNumber) const noexcept
|
||||
ReferenceCountedObjectPtr<CachedGlyphType> findExistingGlyph (const Font& font, int glyphNumber) const noexcept
|
||||
{
|
||||
for (auto* g : glyphs)
|
||||
for (auto g : glyphs)
|
||||
if (g->glyph == glyphNumber && g->font == font)
|
||||
return g;
|
||||
|
||||
return nullptr;
|
||||
return {};
|
||||
}
|
||||
|
||||
CachedGlyphType* getGlyphForReuse()
|
||||
ReferenceCountedObjectPtr<CachedGlyphType> getGlyphForReuse()
|
||||
{
|
||||
if (hits.get() + misses.get() > glyphs.size() * 16)
|
||||
{
|
||||
|
|
@ -2397,7 +2397,7 @@ public:
|
|||
void drawImage (const Image& sourceImage, const AffineTransform& trans)
|
||||
{
|
||||
if (clip != nullptr && ! fillType.colour.isTransparent())
|
||||
renderImage (sourceImage, trans, nullptr);
|
||||
renderImage (sourceImage, trans, {});
|
||||
}
|
||||
|
||||
static bool isOnlyTranslationAllowingError (const AffineTransform& t, float tolerence) noexcept
|
||||
|
|
@ -2490,7 +2490,7 @@ public:
|
|||
}
|
||||
else if (fillType.isTiledImage())
|
||||
{
|
||||
renderImage (fillType.image, fillType.transform, shapeToFill);
|
||||
renderImage (fillType.image, fillType.transform, shapeToFill.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ struct CustomMenuBarItemHolder : public Component
|
|||
removeChildComponent (custom);
|
||||
|
||||
custom = newComponent;
|
||||
addAndMakeVisible (custom);
|
||||
addAndMakeVisible (*custom);
|
||||
resized();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,8 @@ struct ItemComponent : public Component
|
|||
if (item.isSectionHeader)
|
||||
customComp = new HeaderItemComponent (item.text);
|
||||
|
||||
addAndMakeVisible (customComp);
|
||||
if (customComp != nullptr)
|
||||
addAndMakeVisible (*customComp);
|
||||
|
||||
parent.addAndMakeVisible (this);
|
||||
|
||||
|
|
@ -95,7 +96,7 @@ struct ItemComponent : public Component
|
|||
|
||||
~ItemComponent()
|
||||
{
|
||||
removeChildComponent (customComp);
|
||||
removeChildComponent (customComp.get());
|
||||
}
|
||||
|
||||
void getIdealSize (int& idealWidth, int& idealHeight, const int standardItemHeight)
|
||||
|
|
@ -1853,7 +1854,9 @@ bool PopupMenu::MenuItemIterator::next()
|
|||
menus.add (currentItem->subMenu.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
index.setUnchecked (index.size() - 1, index.getLast() + 1);
|
||||
}
|
||||
|
||||
while (index.size() > 0 && index.getLast() >= menus.getLast()->items.size())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1008,8 +1008,8 @@ ReferenceCountedObject* OpenGLContext::getAssociatedObject (const char* name) co
|
|||
jassert (c != nullptr && nativeContext != nullptr);
|
||||
jassert (getCurrentContext() != nullptr);
|
||||
|
||||
const int index = c->associatedObjectNames.indexOf (name);
|
||||
return index >= 0 ? c->associatedObjects.getUnchecked (index) : nullptr;
|
||||
auto index = c->associatedObjectNames.indexOf (name);
|
||||
return index >= 0 ? c->associatedObjects.getUnchecked (index).get() : nullptr;
|
||||
}
|
||||
|
||||
void OpenGLContext::setAssociatedObject (const char* name, ReferenceCountedObject* newObject)
|
||||
|
|
|
|||
|
|
@ -1298,7 +1298,7 @@ struct StateHelpers
|
|||
if (programs == nullptr)
|
||||
{
|
||||
programs = new ShaderPrograms (context);
|
||||
context.setAssociatedObject (programValueID, programs);
|
||||
context.setAssociatedObject (programValueID, programs.get());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1430,7 +1430,7 @@ struct GLState
|
|||
auto p3 = Point<float> (g.point1.x + (g.point2.y - g.point1.y),
|
||||
g.point1.y - (g.point2.x - g.point1.x)).transformedBy (t);
|
||||
|
||||
ShaderPrograms* const programs = currentShader.programs;
|
||||
auto programs = currentShader.programs;
|
||||
const ShaderPrograms::MaskedShaderParams* maskParams = nullptr;
|
||||
|
||||
if (g.isRadial)
|
||||
|
|
@ -1507,7 +1507,7 @@ struct GLState
|
|||
{
|
||||
blendMode.setPremultipliedBlendingMode (shaderQuadQueue);
|
||||
|
||||
ShaderPrograms* const programs = currentShader.programs;
|
||||
auto programs = currentShader.programs;
|
||||
|
||||
const ShaderPrograms::MaskedShaderParams* maskParams = nullptr;
|
||||
const ShaderPrograms::ImageParams* imageParams;
|
||||
|
|
@ -1842,18 +1842,18 @@ struct CustomProgram : public ReferenceCountedObject,
|
|||
{
|
||||
}
|
||||
|
||||
static CustomProgram* get (const String& hashName)
|
||||
static ReferenceCountedObjectPtr<CustomProgram> get (const String& hashName)
|
||||
{
|
||||
if (auto* c = OpenGLContext::getCurrentContext())
|
||||
return static_cast<CustomProgram*> (c->getAssociatedObject (hashName.toRawUTF8()));
|
||||
|
||||
return nullptr;
|
||||
return {};
|
||||
}
|
||||
|
||||
static CustomProgram* getOrCreate (LowLevelGraphicsContext& gc, const String& hashName,
|
||||
const String& code, String& errorMessage)
|
||||
static ReferenceCountedObjectPtr<CustomProgram> getOrCreate (LowLevelGraphicsContext& gc, const String& hashName,
|
||||
const String& code, String& errorMessage)
|
||||
{
|
||||
if (auto* c = get (hashName))
|
||||
if (auto c = get (hashName))
|
||||
return c;
|
||||
|
||||
if (auto* sc = dynamic_cast<OpenGLRendering::ShaderContext*> (&gc))
|
||||
|
|
@ -1865,7 +1865,7 @@ struct CustomProgram : public ReferenceCountedObject,
|
|||
{
|
||||
if (auto context = OpenGLContext::getCurrentContext())
|
||||
{
|
||||
context->setAssociatedObject (hashName.toRawUTF8(), c);
|
||||
context->setAssociatedObject (hashName.toRawUTF8(), c.get());
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue