mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Introjucer: added a button to copy module paths across all modules.
This commit is contained in:
parent
aa408bd982
commit
a9c4a69408
2 changed files with 62 additions and 15 deletions
|
|
@ -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!");
|
||||
if (coreModule != nullptr)
|
||||
{
|
||||
File javaDestFile (classFolder.getChildFile (className + ".java"));
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -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<ModuleList> 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
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue