1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-20 01:14:20 +00:00

Projucer: Added an option when right-clicking on an exporter to save just the selected exporter

This commit is contained in:
ed 2017-05-16 15:53:45 +01:00
parent 75666cfdee
commit 90fbed7889
5 changed files with 33 additions and 19 deletions

View file

@ -48,29 +48,32 @@ public:
struct SaveThread : public ThreadWithProgressWindow
{
public:
SaveThread (ProjectSaver& ps, bool wait = false)
SaveThread (ProjectSaver& ps, bool wait, const String& exp)
: ThreadWithProgressWindow ("Saving...", true, false),
saver (ps), result (Result::ok()), shouldWaitAfterSaving (wait)
saver (ps), result (Result::ok()),
shouldWaitAfterSaving (wait),
specifiedExporterToSave (exp)
{}
void run() override
{
setProgress (-1);
result = saver.save (false, shouldWaitAfterSaving);
result = saver.save (false, shouldWaitAfterSaving, specifiedExporterToSave);
}
ProjectSaver& saver;
Result result;
bool shouldWaitAfterSaving;
String specifiedExporterToSave;
JUCE_DECLARE_NON_COPYABLE (SaveThread)
};
Result save (bool showProgressBox, bool waitAfterSaving)
Result save (bool showProgressBox, bool waitAfterSaving, const String& specifiedExporterToSave)
{
if (showProgressBox)
{
SaveThread thread (*this, waitAfterSaving);
SaveThread thread (*this, waitAfterSaving, specifiedExporterToSave);
thread.runThread();
return thread.result;
}
@ -94,7 +97,7 @@ public:
writeBinaryDataFiles();
writeAppHeader (modules);
writeModuleCppWrappers (modules);
writeProjects (modules);
writeProjects (modules, specifiedExporterToSave);
writeAppConfigFile (modules, appConfigUserContent); // (this is repeated in case the projects added anything to it)
if (generatedCodeFolder.exists())
@ -648,7 +651,7 @@ private:
void writePluginCharacteristicsFile();
void writeProjects (const OwnedArray<LibraryModule>& modules)
void writeProjects (const OwnedArray<LibraryModule>& modules, const String& specifiedExporterToSave)
{
ThreadPool threadPool;
@ -659,6 +662,9 @@ private:
{
for (Project::ExporterIterator exporter (project); exporter.next();)
{
if (specifiedExporterToSave.isNotEmpty() && exporter->getName() != specifiedExporterToSave)
continue;
if (exporter->getTargetFolder().createDirectory())
{
exporter->copyMainGroupFromProject();

View file

@ -92,8 +92,9 @@ public:
{
PopupMenu menu;
menu.addItem (1, "Add a new configuration", exporter->supportsUserDefinedConfigurations());
menu.addItem (2, "Save this exporter");
menu.addSeparator();
menu.addItem (2, "Delete this exporter");
menu.addItem (3, "Delete this exporter");
launchPopupMenu (menu);
}
@ -108,10 +109,19 @@ public:
void handlePopupMenuResult (int resultCode) override
{
if (resultCode == 2)
deleteAllSelectedItems();
else if (resultCode == 1)
if (resultCode == 1)
{
exporter->addNewConfiguration (nullptr);
}
else if (resultCode == 2)
{
const ScopedValueSetter<String> valueSetter (project.specifiedExporterToSave, exporter->getName(), {});
project.save (true, true);
}
else if (resultCode == 3)
{
deleteAllSelectedItems();
}
}
var getDragSourceDescription() override
@ -243,14 +253,10 @@ public:
void handlePopupMenuResult (int resultCode) override
{
if (resultCode == 2)
{
deleteAllSelectedItems();
}
else if (resultCode == 1)
{
if (resultCode == 1)
exporter.addNewConfiguration (config);
}
else if (resultCode == 2)
deleteAllSelectedItems();
}
var getDragSourceDescription() override

View file

@ -383,7 +383,7 @@ Result Project::saveProject (const File& file, bool isCommandLineApp)
const ScopedValueSetter<bool> vs (isSaving, true, false);
ProjectSaver saver (*this, file);
return saver.save (! isCommandLineApp, shouldWaitAfterSaving);
return saver.save (! isCommandLineApp, shouldWaitAfterSaving, specifiedExporterToSave);
}
Result Project::saveResourcesOnly (const File& file)

View file

@ -346,6 +346,7 @@ public:
//==============================================================================
bool shouldWaitAfterSaving = false;
String specifiedExporterToSave = {};
private:
//==============================================================================

View file

@ -546,6 +546,7 @@ bool ProjectContentComponent::setEditorComponent (Component* editor,
{
contentView = editor;
currentDocument = doc;
fileNameLabel->setText (doc->getFile().getFileName(), dontSendNotification);
fileNameLabel->setVisible (true);
addAndMakeVisible (editor);