diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Android.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Android.h index cf21e71a10..ba30583af2 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Android.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Android.h @@ -350,21 +350,21 @@ private: LibraryModule* const coreModule = getCoreModule (modules); - if (coreModule == nullptr) - throw SaveError ("To build an Android app, the juce_core module must be included in your project!"); - - File javaDestFile (classFolder.getChildFile (className + ".java")); + if (coreModule != nullptr) + { + File javaDestFile (classFolder.getChildFile (className + ".java")); - File javaSourceFile (coreModule->getFolder().getChildFile ("native") - .getChildFile ("java") - .getChildFile ("JuceAppActivity.java")); + File javaSourceFile (coreModule->getFolder().getChildFile ("native") + .getChildFile ("java") + .getChildFile ("JuceAppActivity.java")); - MemoryOutputStream newFile; - newFile << javaSourceFile.loadFileAsString() - .replace ("JuceAppActivity", className) - .replace ("package com.juce;", "package " + package + ";"); + MemoryOutputStream newFile; + newFile << javaSourceFile.loadFileAsString() + .replace ("JuceAppActivity", className) + .replace ("package com.juce;", "package " + package + ";"); - overwriteFileIfDifferentOrThrow (javaDestFile, newFile); + overwriteFileIfDifferentOrThrow (javaDestFile, newFile); + } } void writeApplicationMk (const File& file) const diff --git a/extras/Introjucer/Source/Project/jucer_ModulesPanel.h b/extras/Introjucer/Source/Project/jucer_ModulesPanel.h index 14051214c3..ee938f84f5 100644 --- a/extras/Introjucer/Source/Project/jucer_ModulesPanel.h +++ b/extras/Introjucer/Source/Project/jucer_ModulesPanel.h @@ -34,7 +34,8 @@ public: modulesValueTree (p.getModules().state), addWebModuleButton ("Download and add a module..."), updateModuleButton ("Install updates to modules..."), - setCopyModeButton ("Set copy-mode for all modules...") + setCopyModeButton ("Set copy-mode for all modules..."), + copyPathButton ("Set paths for all modules...") { table.getHeader().addColumn ("Module", nameCol, 180, 100, 400, TableHeaderComponent::notSortable); table.getHeader().addColumn ("Installed Version", versionCol, 100, 100, 100, TableHeaderComponent::notSortable); @@ -51,11 +52,14 @@ public: addAndMakeVisible (&addWebModuleButton); addAndMakeVisible (&updateModuleButton); addAndMakeVisible (&setCopyModeButton); + addAndMakeVisible (©PathButton); addWebModuleButton.addListener (this); updateModuleButton.addListener (this); updateModuleButton.setEnabled (false); setCopyModeButton.addListener (this); setCopyModeButton.setTriggeredOnMouseDown (true); + copyPathButton.addListener (this); + copyPathButton.setTriggeredOnMouseDown (true); modulesValueTree.addListener (this); lookAndFeelChanged(); @@ -80,7 +84,11 @@ public: buttonRow.removeFromLeft (8); updateModuleButton.setBounds (buttonRow.removeFromLeft (jmin (260, r.getWidth() / 3))); buttonRow.removeFromLeft (8); + + buttonRow = r.removeFromTop (34).removeFromBottom (28); setCopyModeButton.setBounds (buttonRow.removeFromLeft (jmin (260, r.getWidth() / 3))); + buttonRow.removeFromLeft (8); + copyPathButton.setBounds (buttonRow.removeFromLeft (jmin (260, r.getWidth() / 3))); } int getNumRows() override @@ -178,7 +186,8 @@ public: { if (b == &addWebModuleButton) showAddModuleMenu(); else if (b == &updateModuleButton) showUpdateModulesMenu(); - else if (b == &setCopyModeButton) showCopyModeMenu(); + else if (b == &setCopyModeButton) showCopyModeMenu(); + else if (b == ©PathButton) showSetPathsMenu(); } private: @@ -194,7 +203,7 @@ private: Project& project; ValueTree modulesValueTree; TableListBox table; - TextButton addWebModuleButton, updateModuleButton, setCopyModeButton; + TextButton addWebModuleButton, updateModuleButton, setCopyModeButton, copyPathButton; ScopedPointer listFromWebsite; void valueTreePropertyChanged (ValueTree&, const Identifier&) override { itemChanged(); } @@ -327,6 +336,44 @@ private: project.getModules().setLocalCopyModeForAllModules (res == 1); } + void showSetPathsMenu() + { + EnabledModuleList& moduleList = project.getModules(); + + const String moduleToCopy (moduleList.getModuleID (table.getSelectedRow())); + + if (moduleToCopy.isNotEmpty()) + { + PopupMenu m; + m.addItem (1, "Copy the paths from the module '" + moduleToCopy + "' to all other modules"); + + int res = m.showAt (©PathButton); + + if (res != 0) + { + for (Project::ExporterIterator exporter (project); exporter.next();) + { + for (int i = 0; i < moduleList.getNumModules(); ++i) + { + String modID = moduleList.getModuleID (i); + + if (modID != moduleToCopy) + exporter->getPathForModuleValue (modID) = exporter->getPathForModuleValue (moduleToCopy).getValue(); + } + } + } + + table.repaint(); + } + else + { + PopupMenu m; + m.addItem (1, "Copy the paths from the selected module to all other modules", false); + + m.showAt (©PathButton); + } + } + struct WebsiteUpdateFetchThread : private Thread, private AsyncUpdater {