mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Added some new window-handling features to the plugin host demo.
This commit is contained in:
parent
b1d30ba82a
commit
4a951f2136
20 changed files with 14637 additions and 35 deletions
|
|
@ -0,0 +1,19 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2012
|
||||
Project("{1432F632-8806-81AA-A50D-5B2696FD2BC8}") = "Plugin Host", "Plugin Host.vcxproj", "{0628E63C-9BCD-C866-7DA3-ACF9F6AD986E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{0628E63C-9BCD-C866-7DA3-ACF9F6AD986E}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{0628E63C-9BCD-C866-7DA3-ACF9F6AD986E}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{0628E63C-9BCD-C866-7DA3-ACF9F6AD986E}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{0628E63C-9BCD-C866-7DA3-ACF9F6AD986E}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,30 @@
|
|||
#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 "FileDescription", "Plugin Host\0"
|
||||
VALUE "FileVersion", "1.0.0\0"
|
||||
VALUE "ProductName", "Plugin Host\0"
|
||||
VALUE "ProductVersion", "1.0.0\0"
|
||||
END
|
||||
END
|
||||
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 65001
|
||||
END
|
||||
END
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2013
|
||||
Project("{1432F632-8806-81AA-A50D-5B2696FD2BC8}") = "Plugin Host", "Plugin Host.vcxproj", "{0628E63C-9BCD-C866-7DA3-ACF9F6AD986E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{0628E63C-9BCD-C866-7DA3-ACF9F6AD986E}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{0628E63C-9BCD-C866-7DA3-ACF9F6AD986E}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{0628E63C-9BCD-C866-7DA3-ACF9F6AD986E}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{0628E63C-9BCD-C866-7DA3-ACF9F6AD986E}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,30 @@
|
|||
#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 "FileDescription", "Plugin Host\0"
|
||||
VALUE "FileVersion", "1.0.0\0"
|
||||
VALUE "ProductName", "Plugin Host\0"
|
||||
VALUE "ProductVersion", "1.0.0\0"
|
||||
END
|
||||
END
|
||||
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 65001
|
||||
END
|
||||
END
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2015
|
||||
Project("{1432F632-8806-81AA-A50D-5B2696FD2BC8}") = "Plugin Host", "Plugin Host.vcxproj", "{0628E63C-9BCD-C866-7DA3-ACF9F6AD986E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{0628E63C-9BCD-C866-7DA3-ACF9F6AD986E}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{0628E63C-9BCD-C866-7DA3-ACF9F6AD986E}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{0628E63C-9BCD-C866-7DA3-ACF9F6AD986E}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{0628E63C-9BCD-C866-7DA3-ACF9F6AD986E}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,30 @@
|
|||
#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 "FileDescription", "Plugin Host\0"
|
||||
VALUE "FileVersion", "1.0.0\0"
|
||||
VALUE "ProductName", "Plugin Host\0"
|
||||
VALUE "ProductVersion", "1.0.0\0"
|
||||
END
|
||||
END
|
||||
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 65001
|
||||
END
|
||||
END
|
||||
|
||||
#endif
|
||||
|
|
@ -37,6 +37,30 @@
|
|||
<MODULEPATH id="juce_audio_basics" path="../../modules"/>
|
||||
</MODULEPATHS>
|
||||
</XCODE_MAC>
|
||||
<LINUX_MAKE targetFolder="Builds/Linux" vstFolder="~/SDKs/vstsdk2.4">
|
||||
<CONFIGURATIONS>
|
||||
<CONFIGURATION name="Debug" isDebug="1" optimisation="1" targetName="Plugin Host"
|
||||
libraryPath="/usr/X11R6/lib/"/>
|
||||
<CONFIGURATION name="Release" isDebug="0" optimisation="2" targetName="Plugin Host"
|
||||
libraryPath="/usr/X11R6/lib/"/>
|
||||
</CONFIGURATIONS>
|
||||
<MODULEPATHS>
|
||||
<MODULEPATH id="juce_video" path="../../modules"/>
|
||||
<MODULEPATH id="juce_opengl" 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_events" path="../../modules"/>
|
||||
<MODULEPATH id="juce_data_structures" path="../../modules"/>
|
||||
<MODULEPATH id="juce_cryptography" path="../../modules"/>
|
||||
<MODULEPATH id="juce_core" 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>
|
||||
</LINUX_MAKE>
|
||||
<VS2010 targetFolder="Builds/VisualStudio2010" vstFolder="c:\SDKs\vstsdk2.4"
|
||||
vst3Folder="c:\SDKs\VST3 SDK">
|
||||
<CONFIGURATIONS>
|
||||
|
|
@ -62,12 +86,13 @@
|
|||
<MODULEPATH id="juce_audio_basics" path="../../modules"/>
|
||||
</MODULEPATHS>
|
||||
</VS2010>
|
||||
<LINUX_MAKE targetFolder="Builds/Linux" vstFolder="~/SDKs/vstsdk2.4">
|
||||
<VS2012 targetFolder="Builds/VisualStudio2012" vstFolder="c:\SDKs\vstsdk2.4"
|
||||
vst3Folder="c:\SDKs\VST3 SDK">
|
||||
<CONFIGURATIONS>
|
||||
<CONFIGURATION name="Debug" isDebug="1" optimisation="1" targetName="Plugin Host"
|
||||
libraryPath="/usr/X11R6/lib/"/>
|
||||
<CONFIGURATION name="Release" isDebug="0" optimisation="2" targetName="Plugin Host"
|
||||
libraryPath="/usr/X11R6/lib/"/>
|
||||
<CONFIGURATION name="Debug" winWarningLevel="4" generateManifest="1" winArchitecture="32-bit"
|
||||
isDebug="1" optimisation="1" targetName="Plugin Host"/>
|
||||
<CONFIGURATION name="Release" winWarningLevel="4" generateManifest="1" winArchitecture="32-bit"
|
||||
isDebug="0" optimisation="3" targetName="Plugin Host"/>
|
||||
</CONFIGURATIONS>
|
||||
<MODULEPATHS>
|
||||
<MODULEPATH id="juce_video" path="../../modules"/>
|
||||
|
|
@ -85,7 +110,57 @@
|
|||
<MODULEPATH id="juce_audio_devices" path="../../modules"/>
|
||||
<MODULEPATH id="juce_audio_basics" path="../../modules"/>
|
||||
</MODULEPATHS>
|
||||
</LINUX_MAKE>
|
||||
</VS2012>
|
||||
<VS2013 targetFolder="Builds/VisualStudio2013" vstFolder="c:\SDKs\vstsdk2.4"
|
||||
vst3Folder="c:\SDKs\VST3 SDK">
|
||||
<CONFIGURATIONS>
|
||||
<CONFIGURATION name="Debug" winWarningLevel="4" generateManifest="1" winArchitecture="32-bit"
|
||||
isDebug="1" optimisation="1" targetName="Plugin Host"/>
|
||||
<CONFIGURATION name="Release" winWarningLevel="4" generateManifest="1" winArchitecture="32-bit"
|
||||
isDebug="0" optimisation="3" targetName="Plugin Host"/>
|
||||
</CONFIGURATIONS>
|
||||
<MODULEPATHS>
|
||||
<MODULEPATH id="juce_video" path="../../modules"/>
|
||||
<MODULEPATH id="juce_opengl" 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_events" path="../../modules"/>
|
||||
<MODULEPATH id="juce_data_structures" path="../../modules"/>
|
||||
<MODULEPATH id="juce_cryptography" path="../../modules"/>
|
||||
<MODULEPATH id="juce_core" 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>
|
||||
</VS2013>
|
||||
<VS2015 targetFolder="Builds/VisualStudio2015" vstFolder="c:\SDKs\vstsdk2.4"
|
||||
vst3Folder="c:\SDKs\VST3 SDK">
|
||||
<CONFIGURATIONS>
|
||||
<CONFIGURATION name="Debug" winWarningLevel="4" generateManifest="1" winArchitecture="32-bit"
|
||||
isDebug="1" optimisation="1" targetName="Plugin Host"/>
|
||||
<CONFIGURATION name="Release" winWarningLevel="4" generateManifest="1" winArchitecture="32-bit"
|
||||
isDebug="0" optimisation="3" targetName="Plugin Host"/>
|
||||
</CONFIGURATIONS>
|
||||
<MODULEPATHS>
|
||||
<MODULEPATH id="juce_video" path="../../modules"/>
|
||||
<MODULEPATH id="juce_opengl" 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_events" path="../../modules"/>
|
||||
<MODULEPATH id="juce_data_structures" path="../../modules"/>
|
||||
<MODULEPATH id="juce_cryptography" path="../../modules"/>
|
||||
<MODULEPATH id="juce_core" 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>
|
||||
</VS2015>
|
||||
</EXPORTFORMATS>
|
||||
<MAINGROUP id="YdWL7hi7p" name="Plugin Host">
|
||||
<FILE id="8tLeuntR4" name="FilterGraph.cpp" compile="1" resource="0"
|
||||
|
|
|
|||
|
|
@ -212,6 +212,21 @@ String FilterGraph::getDocumentTitle()
|
|||
return getFile().getFileNameWithoutExtension();
|
||||
}
|
||||
|
||||
void FilterGraph::newDocument()
|
||||
{
|
||||
clear();
|
||||
|
||||
setFile (File());
|
||||
|
||||
InternalPluginFormat internalFormat;
|
||||
|
||||
addFilter (internalFormat.getDescriptionFor (InternalPluginFormat::audioInputFilter), 0.5f, 0.1f);
|
||||
addFilter (internalFormat.getDescriptionFor (InternalPluginFormat::midiInputFilter), 0.25f, 0.1f);
|
||||
addFilter (internalFormat.getDescriptionFor (InternalPluginFormat::audioOutputFilter), 0.5f, 0.9f);
|
||||
|
||||
setChangedFlag (false);
|
||||
}
|
||||
|
||||
Result FilterGraph::loadDocument (const File& file)
|
||||
{
|
||||
XmlDocument doc (file);
|
||||
|
|
@ -270,8 +285,18 @@ static XmlElement* createNodeXml (AudioProcessorGraph::Node* const node) noexcep
|
|||
e->setAttribute ("uid", (int) node->nodeId);
|
||||
e->setAttribute ("x", node->properties ["x"].toString());
|
||||
e->setAttribute ("y", node->properties ["y"].toString());
|
||||
e->setAttribute ("uiLastX", node->properties ["uiLastX"].toString());
|
||||
e->setAttribute ("uiLastY", node->properties ["uiLastY"].toString());
|
||||
|
||||
for (int i = 0; i < PluginWindow::NumTypes; ++i)
|
||||
{
|
||||
PluginWindow::WindowFormatType type = (PluginWindow::WindowFormatType) i;
|
||||
|
||||
if (node->properties.contains (getOpenProp (type)))
|
||||
{
|
||||
e->setAttribute (getLastXProp (type), node->properties[getLastXProp (type)].toString());
|
||||
e->setAttribute (getLastYProp (type), node->properties[getLastYProp (type)].toString());
|
||||
e->setAttribute (getOpenProp (type), node->properties[getOpenProp (type)].toString());
|
||||
}
|
||||
}
|
||||
|
||||
PluginDescription pd;
|
||||
plugin->fillInPluginDescription (pd);
|
||||
|
|
@ -322,8 +347,27 @@ void FilterGraph::createNodeFromXml (const XmlElement& xml)
|
|||
|
||||
node->properties.set ("x", xml.getDoubleAttribute ("x"));
|
||||
node->properties.set ("y", xml.getDoubleAttribute ("y"));
|
||||
node->properties.set ("uiLastX", xml.getIntAttribute ("uiLastX"));
|
||||
node->properties.set ("uiLastY", xml.getIntAttribute ("uiLastY"));
|
||||
|
||||
for (int i = 0; i < PluginWindow::NumTypes; ++i)
|
||||
{
|
||||
PluginWindow::WindowFormatType type = (PluginWindow::WindowFormatType) i;
|
||||
|
||||
if (xml.hasAttribute (getOpenProp (type)))
|
||||
{
|
||||
node->properties.set (getLastXProp (type), xml.getIntAttribute (getLastXProp (type)));
|
||||
node->properties.set (getLastYProp (type), xml.getIntAttribute (getLastYProp (type)));
|
||||
node->properties.set (getOpenProp (type), xml.getIntAttribute (getOpenProp (type)));
|
||||
|
||||
if (node->properties[getOpenProp (type)])
|
||||
{
|
||||
AudioProcessor* const processor = node->getProcessor();
|
||||
jassert (processor != nullptr);
|
||||
|
||||
if (PluginWindow* const w = PluginWindow::getWindowFor (node, type))
|
||||
w->toFront (true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
XmlElement* FilterGraph::createXml() const
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@ public:
|
|||
void restoreFromXml (const XmlElement& xml);
|
||||
|
||||
//==============================================================================
|
||||
void newDocument();
|
||||
String getDocumentTitle();
|
||||
Result loadDocument (const File& file);
|
||||
Result saveDocument (const File& file);
|
||||
|
|
|
|||
|
|
@ -44,8 +44,11 @@ PluginWindow::PluginWindow (Component* const pluginEditor,
|
|||
|
||||
setContentOwned (pluginEditor, true);
|
||||
|
||||
setTopLeftPosition (owner->properties.getWithDefault ("uiLastX", Random::getSystemRandom().nextInt (500)),
|
||||
owner->properties.getWithDefault ("uiLastY", Random::getSystemRandom().nextInt (500)));
|
||||
setTopLeftPosition (owner->properties.getWithDefault (getLastXProp (type), Random::getSystemRandom().nextInt (500)),
|
||||
owner->properties.getWithDefault (getLastYProp (type), Random::getSystemRandom().nextInt (500)));
|
||||
|
||||
owner->properties.set (getOpenProp (type), true);
|
||||
|
||||
setVisible (true);
|
||||
|
||||
activePluginWindows.add (this);
|
||||
|
|
@ -198,12 +201,13 @@ PluginWindow::~PluginWindow()
|
|||
|
||||
void PluginWindow::moved()
|
||||
{
|
||||
owner->properties.set ("uiLastX", getX());
|
||||
owner->properties.set ("uiLastY", getY());
|
||||
owner->properties.set (getLastXProp (type), getX());
|
||||
owner->properties.set (getLastYProp (type), getY());
|
||||
}
|
||||
|
||||
void PluginWindow::closeButtonPressed()
|
||||
{
|
||||
owner->properties.set (getOpenProp (type), false);
|
||||
delete this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -118,7 +118,8 @@ public:
|
|||
Normal = 0,
|
||||
Generic,
|
||||
Programs,
|
||||
Parameters
|
||||
Parameters,
|
||||
NumTypes
|
||||
};
|
||||
|
||||
PluginWindow (Component* pluginEditor, AudioProcessorGraph::Node*, WindowFormatType);
|
||||
|
|
@ -141,4 +142,21 @@ private:
|
|||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PluginWindow)
|
||||
};
|
||||
|
||||
inline String toString (PluginWindow::WindowFormatType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case PluginWindow::Normal: return "Normal";
|
||||
case PluginWindow::Generic: return "Generic";
|
||||
case PluginWindow::Programs: return "Programs";
|
||||
case PluginWindow::Parameters: return "Parameters";
|
||||
default: return String();
|
||||
}
|
||||
}
|
||||
|
||||
inline String getLastXProp (PluginWindow::WindowFormatType type) { return "uiLastX_" + toString (type); }
|
||||
inline String getLastYProp (PluginWindow::WindowFormatType type) { return "uiLastY_" + toString (type); }
|
||||
inline String getOpenProp (PluginWindow::WindowFormatType type) { return "uiopen_" + toString (type); }
|
||||
|
||||
|
||||
#endif // __GRAPHEDITORPANEL_JUCEHEADER__
|
||||
|
|
|
|||
|
|
@ -62,9 +62,24 @@ public:
|
|||
if (commandLine.isNotEmpty()
|
||||
&& ! commandLine.trimStart().startsWith ("-")
|
||||
&& mainWindow->getGraphEditor() != nullptr)
|
||||
{
|
||||
mainWindow->getGraphEditor()->graph.loadFrom (File::getCurrentWorkingDirectory()
|
||||
.getChildFile (commandLine), true);
|
||||
}
|
||||
else
|
||||
{
|
||||
RecentlyOpenedFilesList recentFiles;
|
||||
recentFiles.restoreFromString (getAppProperties().getUserSettings()->getValue ("recentFilterGraphFiles"));
|
||||
|
||||
if (recentFiles.getNumFiles() > 0)
|
||||
{
|
||||
File f = recentFiles.getFile (0);
|
||||
|
||||
if (f.existsAsFile())
|
||||
mainWindow->getGraphEditor()->graph.loadFrom (f, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void shutdown() override
|
||||
{
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@ MainHostWindow::MainHostWindow()
|
|||
->getIntValue ("pluginSortMethod", KnownPluginList::sortByManufacturer);
|
||||
|
||||
knownPluginList.addChangeListener (this);
|
||||
getGraphEditor()->graph.addChangeListener (this);
|
||||
|
||||
addKeyListener (getCommandManager().getKeyMappings());
|
||||
|
||||
|
|
@ -130,6 +131,7 @@ MainHostWindow::~MainHostWindow()
|
|||
#endif
|
||||
|
||||
knownPluginList.removeChangeListener (this);
|
||||
getGraphEditor()->graph.removeChangeListener (this);
|
||||
|
||||
getAppProperties().getUserSettings()->setValue ("mainWindowPos", getWindowStateAsString());
|
||||
clearContentComponent();
|
||||
|
|
@ -154,8 +156,10 @@ bool MainHostWindow::tryToQuitApplication()
|
|||
return false;
|
||||
}
|
||||
|
||||
void MainHostWindow::changeListenerCallback (ChangeBroadcaster*)
|
||||
void MainHostWindow::changeListenerCallback (ChangeBroadcaster* changed)
|
||||
{
|
||||
if (changed == &knownPluginList)
|
||||
{
|
||||
menuItemsChanged();
|
||||
|
||||
// save the plugin list every time it gets chnaged, so that if we're scanning
|
||||
|
|
@ -167,11 +171,23 @@ void MainHostWindow::changeListenerCallback (ChangeBroadcaster*)
|
|||
getAppProperties().getUserSettings()->setValue ("pluginList", savedPluginList);
|
||||
getAppProperties().saveIfNeeded();
|
||||
}
|
||||
}
|
||||
else if (changed == &getGraphEditor()->graph)
|
||||
{
|
||||
String title = JUCEApplication::getInstance()->getApplicationName();
|
||||
|
||||
File f = getGraphEditor()->graph.getFile();
|
||||
|
||||
if (f.existsAsFile())
|
||||
title = f.getFileName() + " - " + title;
|
||||
|
||||
setName (title);
|
||||
}
|
||||
}
|
||||
|
||||
StringArray MainHostWindow::getMenuBarNames()
|
||||
{
|
||||
const char* const names[] = { "File", "Plugins", "Options", nullptr };
|
||||
const char* const names[] = { "File", "Plugins", "Options", "Windows", nullptr };
|
||||
|
||||
return StringArray (names);
|
||||
}
|
||||
|
|
@ -183,6 +199,7 @@ PopupMenu MainHostWindow::getMenuForIndex (int topLevelMenuIndex, const String&
|
|||
if (topLevelMenuIndex == 0)
|
||||
{
|
||||
// "File" menu
|
||||
menu.addCommandItem (&getCommandManager(), CommandIDs::newFile);
|
||||
menu.addCommandItem (&getCommandManager(), CommandIDs::open);
|
||||
|
||||
RecentlyOpenedFilesList recentFiles;
|
||||
|
|
@ -227,6 +244,10 @@ PopupMenu MainHostWindow::getMenuForIndex (int topLevelMenuIndex, const String&
|
|||
menu.addSeparator();
|
||||
menu.addCommandItem (&getCommandManager(), CommandIDs::aboutBox);
|
||||
}
|
||||
else if (topLevelMenuIndex == 3)
|
||||
{
|
||||
menu.addCommandItem (&getCommandManager(), CommandIDs::allWindowsForward);
|
||||
}
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
|
@ -304,12 +325,14 @@ ApplicationCommandTarget* MainHostWindow::getNextCommandTarget()
|
|||
void MainHostWindow::getAllCommands (Array <CommandID>& commands)
|
||||
{
|
||||
// this returns the set of all commands that this target can perform..
|
||||
const CommandID ids[] = { CommandIDs::open,
|
||||
const CommandID ids[] = { CommandIDs::newFile,
|
||||
CommandIDs::open,
|
||||
CommandIDs::save,
|
||||
CommandIDs::saveAs,
|
||||
CommandIDs::showPluginListEditor,
|
||||
CommandIDs::showAudioSettings,
|
||||
CommandIDs::aboutBox
|
||||
CommandIDs::aboutBox,
|
||||
CommandIDs::allWindowsForward
|
||||
};
|
||||
|
||||
commands.addArray (ids, numElementsInArray (ids));
|
||||
|
|
@ -321,17 +344,18 @@ void MainHostWindow::getCommandInfo (const CommandID commandID, ApplicationComma
|
|||
|
||||
switch (commandID)
|
||||
{
|
||||
case CommandIDs::newFile:
|
||||
result.setInfo ("New", "Creates a new filter graph file", category, 0);
|
||||
result.defaultKeypresses.add(KeyPress('n', ModifierKeys::commandModifier, 0));
|
||||
break;
|
||||
|
||||
case CommandIDs::open:
|
||||
result.setInfo ("Open...",
|
||||
"Opens a filter graph file",
|
||||
category, 0);
|
||||
result.setInfo ("Open...", "Opens a filter graph file", category, 0);
|
||||
result.defaultKeypresses.add (KeyPress ('o', ModifierKeys::commandModifier, 0));
|
||||
break;
|
||||
|
||||
case CommandIDs::save:
|
||||
result.setInfo ("Save",
|
||||
"Saves the current graph to a file",
|
||||
category, 0);
|
||||
result.setInfo ("Save", "Saves the current graph to a file", category, 0);
|
||||
result.defaultKeypresses.add (KeyPress ('s', ModifierKeys::commandModifier, 0));
|
||||
break;
|
||||
|
||||
|
|
@ -356,6 +380,11 @@ void MainHostWindow::getCommandInfo (const CommandID commandID, ApplicationComma
|
|||
result.setInfo ("About...", String::empty, category, 0);
|
||||
break;
|
||||
|
||||
case CommandIDs::allWindowsForward:
|
||||
result.setInfo ("All Windows Forward", "Bring all plug-in windows forward", category, 0);
|
||||
result.addDefaultKeypress ('w', ModifierKeys::commandModifier);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -367,10 +396,14 @@ bool MainHostWindow::perform (const InvocationInfo& info)
|
|||
|
||||
switch (info.commandID)
|
||||
{
|
||||
case CommandIDs::newFile:
|
||||
if (graphEditor != nullptr && graphEditor->graph.saveIfNeededAndUserAgrees() == FileBasedDocument::savedOk)
|
||||
graphEditor->graph.newDocument();
|
||||
break;
|
||||
|
||||
case CommandIDs::open:
|
||||
if (graphEditor != nullptr && graphEditor->graph.saveIfNeededAndUserAgrees() == FileBasedDocument::savedOk)
|
||||
graphEditor->graph.loadFromUserSpecifiedFile (true);
|
||||
|
||||
break;
|
||||
|
||||
case CommandIDs::save:
|
||||
|
|
@ -398,6 +431,16 @@ bool MainHostWindow::perform (const InvocationInfo& info)
|
|||
// TODO
|
||||
break;
|
||||
|
||||
case CommandIDs::allWindowsForward:
|
||||
{
|
||||
Desktop& desktop = Desktop::getInstance();
|
||||
|
||||
for (int i = 0; i < desktop.getNumComponents(); ++i)
|
||||
desktop.getComponent (i)->toBehind (this);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,9 +35,11 @@ namespace CommandIDs
|
|||
static const int open = 0x30000;
|
||||
static const int save = 0x30001;
|
||||
static const int saveAs = 0x30002;
|
||||
static const int newFile = 0x30003;
|
||||
static const int showPluginListEditor = 0x30100;
|
||||
static const int showAudioSettings = 0x30200;
|
||||
static const int aboutBox = 0x30300;
|
||||
static const int allWindowsForward = 0x30400;
|
||||
}
|
||||
|
||||
ApplicationCommandManager& getCommandManager();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue