Browse Source

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

tags/2021-05-28
ed 8 years ago
parent
commit
90fbed7889
5 changed files with 33 additions and 19 deletions
  1. +13
    -7
      extras/Projucer/Source/Project Saving/jucer_ProjectSaver.h
  2. +17
    -11
      extras/Projucer/Source/Project/jucer_ConfigTree_Exporter.h
  3. +1
    -1
      extras/Projucer/Source/Project/jucer_Project.cpp
  4. +1
    -0
      extras/Projucer/Source/Project/jucer_Project.h
  5. +1
    -0
      extras/Projucer/Source/Project/jucer_ProjectContentComponent.cpp

+ 13
- 7
extras/Projucer/Source/Project Saving/jucer_ProjectSaver.h View File

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


+ 17
- 11
extras/Projucer/Source/Project/jucer_ConfigTree_Exporter.h View File

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


+ 1
- 1
extras/Projucer/Source/Project/jucer_Project.cpp View File

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


+ 1
- 0
extras/Projucer/Source/Project/jucer_Project.h View File

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


+ 1
- 0
extras/Projucer/Source/Project/jucer_ProjectContentComponent.cpp View File

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


Loading…
Cancel
Save