1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Projucer: Code cleanup

This commit is contained in:
ed 2018-01-22 12:30:19 +00:00
parent 1f405d6cd5
commit d668adb81b
15 changed files with 255 additions and 273 deletions

View file

@ -62,7 +62,7 @@ public:
Array<File> filesToTrash;
Array<Project::Item> itemsToRemove;
for (auto i = 0; i < tree->getNumSelectedItems(); ++i)
for (int i = 0; i < tree->getNumSelectedItems(); ++i)
{
if (auto* p = dynamic_cast<FileTreeItemBase*> (tree->getSelectedItem (i)))
{
@ -70,7 +70,7 @@ public:
if (p->item.isGroup())
{
for (auto j = 0; j < p->item.getNumChildren(); ++j)
for (int j = 0; j < p->item.getNumChildren(); ++j)
{
auto associatedFile = p->item.getChild (j).getFile();
@ -112,9 +112,9 @@ public:
if (auto* treeRootItem = dynamic_cast<FileTreeItemBase*> (tree->getRootItem()))
{
OpenDocumentManager& om = ProjucerApplication::getApp().openDocumentManager;
auto& om = ProjucerApplication::getApp().openDocumentManager;
for (int i = filesToTrash.size(); --i >= 0;)
for (auto i = filesToTrash.size(); --i >= 0;)
{
auto f = filesToTrash.getUnchecked(i);
@ -155,8 +155,8 @@ public:
virtual void browseToAddExistingFiles()
{
const File location (item.isGroup() ? item.determineGroupFolder() : getFile());
FileChooser fc ("Add Files to Jucer Project", location, String());
auto location = item.isGroup() ? item.determineGroupFolder() : getFile();
FileChooser fc ("Add Files to Jucer Project", location, {});
if (fc.browseForMultipleFilesOrDirectories())
{
@ -171,8 +171,8 @@ public:
virtual void checkFileStatus() // (recursive)
{
const File file (getFile());
const bool nowMissing = file != File() && ! file.exists();
auto file = getFile();
auto nowMissing = (file != File() && ! file.exists());
if (nowMissing != isFileMissing)
{
@ -221,10 +221,10 @@ public:
if (item == itemToFind)
return this;
const bool wasOpen = isOpen();
auto wasOpen = isOpen();
setOpen (true);
for (int i = getNumSubItems(); --i >= 0;)
for (auto i = getNumSubItems(); --i >= 0;)
{
if (auto* pg = dynamic_cast<FileTreeItemBase*> (getSubItem(i)))
if (auto* found = pg->findTreeViewItem (itemToFind))
@ -302,7 +302,7 @@ public:
if (selectedNodes.size() > 0)
{
TreeView* tree = getOwnerView();
auto* tree = getOwnerView();
ScopedPointer<XmlElement> oldOpenness (tree->getOpennessState (false));
moveSelectedItemsTo (selectedNodes, insertIndex);
@ -324,14 +324,14 @@ public:
{
if (dragSourceDetails.description == projectItemDragType)
{
TreeView* tree = dynamic_cast<TreeView*> (dragSourceDetails.sourceComponent.get());
auto* tree = dynamic_cast<TreeView*> (dragSourceDetails.sourceComponent.get());
if (tree == nullptr)
tree = dragSourceDetails.sourceComponent->findParentComponentOfClass<TreeView>();
if (tree != nullptr)
{
const int numSelected = tree->getNumSelectedItems();
auto numSelected = tree->getNumSelectedItems();
for (int i = 0; i < numSelected; ++i)
if (auto* p = dynamic_cast<FileTreeItemBase*> (tree->getSelectedItem (i)))
@ -398,9 +398,9 @@ protected:
static void moveItems (OwnedArray<Project::Item>& selectedNodes, Project::Item destNode, int insertIndex)
{
for (int i = selectedNodes.size(); --i >= 0;)
for (auto i = selectedNodes.size(); --i >= 0;)
{
Project::Item* const n = selectedNodes.getUnchecked(i);
auto* n = selectedNodes.getUnchecked(i);
if (destNode == *n || destNode.state.isAChildOf (n->state)) // Check for recursion.
return;
@ -410,11 +410,11 @@ protected:
}
// Don't include any nodes that are children of other selected nodes..
for (int i = selectedNodes.size(); --i >= 0;)
for (auto i = selectedNodes.size(); --i >= 0;)
{
Project::Item* const n = selectedNodes.getUnchecked(i);
auto* n = selectedNodes.getUnchecked(i);
for (int j = selectedNodes.size(); --j >= 0;)
for (auto j = selectedNodes.size(); --j >= 0;)
{
if (j != i && n->state.isAChildOf (selectedNodes.getUnchecked(j)->state))
{
@ -427,7 +427,7 @@ protected:
// Remove and re-insert them one at a time..
for (int i = 0; i < selectedNodes.size(); ++i)
{
Project::Item* selectedNode = selectedNodes.getUnchecked(i);
auto* selectedNode = selectedNodes.getUnchecked(i);
if (selectedNode->state.getParent() == destNode.state
&& indexOfNode (destNode.state, selectedNode->state) < insertIndex)
@ -440,7 +440,7 @@ protected:
static int indexOfNode (const ValueTree& parent, const ValueTree& child)
{
for (int i = parent.getNumChildren(); --i >= 0;)
for (auto i = parent.getNumChildren(); --i >= 0;)
if (parent.getChild (i) == child)
return i;
@ -483,13 +483,13 @@ public:
return;
}
File oldFile (getFile());
File newFile (oldFile.getSiblingFile (newName));
File correspondingFile (findCorrespondingHeaderOrCpp (oldFile));
auto oldFile = getFile();
auto newFile = oldFile.getSiblingFile (newName);
auto correspondingFile = findCorrespondingHeaderOrCpp (oldFile);
if (correspondingFile.exists() && newFile.hasFileExtension (oldFile.getFileExtension()))
{
Project::Item correspondingItem (item.project.getMainGroup().findItemForFile (correspondingFile));
auto correspondingItem = item.project.getMainGroup().findItemForFile (correspondingFile);
if (correspondingItem.isValid())
{
@ -528,10 +528,10 @@ public:
void showDocument() override
{
const File f (getFile());
auto f = getFile();
if (f.exists())
if (ProjectContentComponent* pcc = getProjectContentComponent())
if (auto* pcc = getProjectContentComponent())
pcc->showEditorForFile (f, false);
}
@ -585,7 +585,7 @@ public:
case 7: item.getShouldCompileValue().setValue (! item.shouldBeCompiled()); break;
default:
if (GroupItem* parentGroup = dynamic_cast<GroupItem*> (getParentProjectItem()))
if (auto* parentGroup = dynamic_cast<GroupItem*> (getParentProjectItem()))
parentGroup->processCreateFileMenuItem (resultCode);
break;
@ -597,7 +597,7 @@ public:
class GroupItem : public FileTreeItemBase
{
public:
GroupItem (const Project::Item& projectItem, const String& filter = String())
GroupItem (const Project::Item& projectItem, const String& filter = {})
: FileTreeItemBase (projectItem),
searchFilter (filter)
{
@ -608,13 +608,13 @@ public:
void addNewGroup()
{
Project::Item newGroup (item.addNewSubGroup ("New Group", 0));
auto newGroup = item.addNewSubGroup ("New Group", 0);
triggerAsyncRename (newGroup);
}
bool acceptsDragItems (const OwnedArray<Project::Item>& selectedNodes) override
{
for (int i = selectedNodes.size(); --i >= 0;)
for (auto i = selectedNodes.size(); --i >= 0;)
if (item.canContain (*selectedNodes.getUnchecked(i)))
return true;
@ -623,18 +623,16 @@ public:
void addFilesAtIndex (const StringArray& files, int insertIndex) override
{
for (int i = 0; i < files.size(); ++i)
for (auto f : files)
{
const File file (files[i]);
if (item.addFileAtIndex (file, insertIndex, true))
if (item.addFileAtIndex (f, insertIndex, true))
++insertIndex;
}
}
void addFilesRetainingSortOrder (const StringArray& files) override
{
for (int i = files.size(); --i >= 0;)
for (auto i = files.size(); --i >= 0;)
item.addFileRetainingSortOrder (files[i], true);
}
@ -652,7 +650,7 @@ public:
bool isGroupEmpty (const Project::Item& group) // recursive
{
for (auto i = 0; i < group.getNumChildren(); ++i)
for (int i = 0; i < group.getNumChildren(); ++i)
{
auto child = group.getChild (i);
@ -688,20 +686,20 @@ public:
void showDocument() override
{
if (ProjectContentComponent* pcc = getProjectContentComponent())
if (auto* pcc = getProjectContentComponent())
pcc->setEditorComponent (new FileGroupInformationComponent (item), nullptr);
}
static void openAllGroups (TreeViewItem* root)
{
for (auto i = 0; i < root->getNumSubItems(); ++i)
for (int i = 0; i < root->getNumSubItems(); ++i)
if (auto* sub = root->getSubItem (i))
openOrCloseAllSubGroups (*sub, true);
}
static void closeAllGroups (TreeViewItem* root)
{
for (auto i = 0; i < root->getNumSubItems(); ++i)
for (int i = 0; i < root->getNumSubItems(); ++i)
if (auto* sub = root->getSubItem (i))
openOrCloseAllSubGroups (*sub, false);
}
@ -710,7 +708,7 @@ public:
{
item.setOpen (shouldOpen);
for (int i = item.getNumSubItems(); --i >= 0;)
for (auto i = item.getNumSubItems(); --i >= 0;)
if (auto* sub = item.getSubItem (i))
openOrCloseAllSubGroups (*sub, shouldOpen);
}
@ -720,7 +718,7 @@ public:
if (item.isFile())
item.getShouldCompileValue() = shouldCompile;
for (int i = item.getNumChildren(); --i >= 0;)
for (auto i = item.getNumChildren(); --i >= 0;)
setFilesToCompile (item.getChild (i), shouldCompile);
}
@ -811,8 +809,8 @@ public:
Project* getProject()
{
if (TreeView* tv = getOwnerView())
if (ProjectContentComponent* pcc = tv->findParentComponentOfClass<ProjectContentComponent>())
if (auto* tv = getOwnerView())
if (auto* pcc = tv->findParentComponentOfClass<ProjectContentComponent>())
return pcc->getProject();
return nullptr;

View file

@ -31,8 +31,6 @@
struct LiveBuildSettingsComponent : public Component
{
LiveBuildSettingsComponent (Project& p)
: group ("Live Build Settings",
Icon (getIcons().settings, Colours::transparentBlack))
{
addAndMakeVisible (&group);
@ -51,7 +49,7 @@ struct LiveBuildSettingsComponent : public Component
void parentSizeChanged() override
{
const auto width = jmax (550, getParentWidth());
auto width = jmax (550, getParentWidth());
auto y = group.updateSize (12, 0, width - 12);
y = jmax (getParentHeight(), y);
@ -59,7 +57,7 @@ struct LiveBuildSettingsComponent : public Component
setSize (width, y);
}
PropertyGroupComponent group;
PropertyGroupComponent group { "Live Build Settings", Icon (getIcons().settings, Colours::transparentBlack) };
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LiveBuildSettingsComponent)
};
@ -104,7 +102,7 @@ public:
if (showEnableButton)
{
auto buttonText = "Enable Now";
String buttonText ("Enable Now");
if (! lastErrorMessage.isEmpty())
{
@ -179,39 +177,39 @@ private:
showDownloadButton = false;
showEnableButton = false;
const auto osType = SystemStats::getOperatingSystemType();
auto osType = SystemStats::getOperatingSystemType();
const bool isMac = (osType & SystemStats::MacOSX) != 0;
const bool isWin = (osType & SystemStats::Windows) != 0;
const bool isLinux = (osType & SystemStats::Linux) != 0;
auto isMac = (osType & SystemStats::MacOSX) != 0;
auto isWin = (osType & SystemStats::Windows) != 0;
auto isLinux = (osType & SystemStats::Linux) != 0;
if (! isMac && ! isWin && ! isLinux)
return String ("Live-build features are not supported on your system.\n\n"
"Please check supported platforms at www.juce.com!");
return "Live-build features are not supported on your system.\n\n"
"Please check supported platforms at www.juce.com!";
if (isLinux)
return String ("Live-build features for Linux are under development.\n\n"
"Please check for updates at www.juce.com!");
return "Live-build features for Linux are under development.\n\n"
"Please check for updates at www.juce.com!";
if (isMac)
if (osType < SystemStats::MacOSX_10_9)
return String ("Live-build features are available only on MacOSX 10.9 or higher.");
return "Live-build features are available only on MacOSX 10.9 or higher.";
if (isWin)
if (! SystemStats::isOperatingSystem64Bit() || osType < SystemStats::Windows8_0)
return String ("Live-build features are available only on 64-Bit Windows 8 or higher.");
return "Live-build features are available only on 64-Bit Windows 8 or higher.";
const auto& compileEngineDll = *CompileEngineDLL::getInstance();
const auto dllPresent = compileEngineDll.isLoaded();
auto& compileEngineDll = *CompileEngineDLL::getInstance();
auto dllPresent = compileEngineDll.isLoaded();
if (! dllPresent)
{
showDownloadButton = true;
return String ("Download the live-build engine to get started");
return "Download the live-build engine to get started";
}
showEnableButton = true;
return String ("Enable compilation to use the live-build engine");
return "Enable compilation to use the live-build engine";
}
void downloadDLL()
@ -233,7 +231,7 @@ private:
void buildConcertina (CompileEngineChildProcess* child)
{
for (int i = concertinaPanel.getNumPanels() - 1; i >= 0 ; --i)
for (auto i = concertinaPanel.getNumPanels() - 1; i >= 0 ; --i)
concertinaPanel.removePanel (concertinaPanel.getPanel (i));
headers.clear();

View file

@ -111,8 +111,8 @@ public:
void refreshModuleInfoIfCurrentlyShowing (bool juceModulePathChanged)
{
const bool isJuceModule = EnabledModuleList::isJuceModule (moduleID);
const bool shouldRefresh = (juceModulePathChanged && isJuceModule) || (! juceModulePathChanged && ! isJuceModule);
auto isJuceModule = EnabledModuleList::isJuceModule (moduleID);
auto shouldRefresh = (juceModulePathChanged && isJuceModule) || (! juceModulePathChanged && ! isJuceModule);
if (! shouldRefresh)
return;
@ -336,8 +336,7 @@ private:
MissingDependenciesComponent (Project& p, const String& modID)
: PropertyComponent ("Dependencies", 100),
project (p), moduleID (modID),
missingDependencies (project.getModules().getExtraDependenciesNeeded (modID)),
fixButton ("Add Required Modules")
missingDependencies (project.getModules().getExtraDependenciesNeeded (modID))
{
addAndMakeVisible (fixButton);
fixButton.setColour (TextButton::buttonColourId, Colours::red);
@ -395,7 +394,7 @@ private:
Project& project;
String moduleID;
StringArray missingDependencies;
TextButton fixButton;
TextButton fixButton { "Add Required Modules" };
bool tryToFix (ModuleList& list)
{
@ -429,7 +428,7 @@ private:
if (rootItem == nullptr)
return;
for (auto i = 0; i < rootItem->getNumSubItems(); ++i)
for (int i = 0; i < rootItem->getNumSubItems(); ++i)
{
if (auto* subItem = dynamic_cast<ProjectTreeItemBase*> (rootItem->getSubItem (i)))
{
@ -521,7 +520,7 @@ public:
bool isInterestedInFileDrag (const StringArray& files) override
{
for (int i = files.size(); --i >= 0;)
for (auto i = files.size(); --i >= 0;)
if (ModuleDescription (getModuleFolder (files[i])).isValid())
return true;
@ -532,9 +531,9 @@ public:
{
Array<ModuleDescription> modules;
for (int i = files.size(); --i >= 0;)
for (auto f : files)
{
ModuleDescription m (getModuleFolder (files[i]));
ModuleDescription m (getModuleFolder (f));
if (m.isValid())
modules.add (m);
@ -557,7 +556,7 @@ public:
auto& modules = project.getModules();
PopupMenu knownModules, jucePathModules, userPathModules, exporterPathsModules;
auto index = 100;
int index = 100;
for (auto m : getAvailableModulesInGlobalJucePath())
jucePathModules.addItem (index++, m, ! modules.isModuleEnabled (m));
@ -681,7 +680,7 @@ private:
}
else if (v == defaultJuceModulePathValue || v == defaultUserModulePathValue)
{
const bool juceModulePathChanged = (v == defaultJuceModulePathValue);
auto juceModulePathChanged = (v == defaultJuceModulePathValue);
for (int i = 0; i < getNumSubItems(); ++i)
if (auto* moduleItem = dynamic_cast<ModuleItem*> (getSubItem (i)))

View file

@ -72,7 +72,7 @@ struct ProjectSettingsComponent : public Component,
void parentSizeChanged() override
{
const auto width = jmax (550, getParentWidth());
auto width = jmax (550, getParentWidth());
auto y = group.updateSize (12, 0, width - 12);
y = jmax (getParentHeight(), y);
@ -158,7 +158,7 @@ public:
TreePanelBase* getTreeWithSelectedItems()
{
for (int i = concertinaPanel.getNumPanels() - 1; i >= 0; --i)
for (auto i = concertinaPanel.getNumPanels() - 1; i >= 0; --i)
{
if (auto* treeComponent = dynamic_cast<ConcertinaTreeComponent*> (concertinaPanel.getPanel (i)))
{
@ -234,7 +234,7 @@ private:
void buildConcertina()
{
for (int i = concertinaPanel.getNumPanels() - 1; i >= 0 ; --i)
for (auto i = concertinaPanel.getNumPanels() - 1; i >= 0 ; --i)
concertinaPanel.removePanel (concertinaPanel.getPanel (i));
headers.clear();
@ -266,7 +266,7 @@ private:
void mouseDown (const MouseEvent& e) override
{
for (int i = concertinaPanel.getNumPanels() - 1; i >= 0; --i)
for (auto i = concertinaPanel.getNumPanels() - 1; i >= 0; --i)
{
auto* p = concertinaPanel.getPanel (i);

View file

@ -53,7 +53,7 @@ struct ProjectTreeItemBase : public JucerTreeViewBase,
void deleteAllSelectedItems() override
{
TreeView* const tree = getOwnerView();
auto* tree = getOwnerView();
jassert (tree->getNumSelectedItems() <= 1); // multi-select should be disabled
if (auto* s = dynamic_cast<ProjectTreeItemBase*> (tree->getSelectedItem (0)))
@ -77,7 +77,7 @@ struct ProjectTreeItemBase : public JucerTreeViewBase,
static void updateSize (Component& comp, PropertyGroupComponent& group)
{
const auto width = jmax (550, comp.getParentWidth() - 12);
auto width = jmax (550, comp.getParentWidth() - 12);
auto y = 0;
y += group.updateSize (12, y, width - 12);

View file

@ -112,7 +112,7 @@ public:
int getColumnX (int index)
{
auto prop = 0.0f;
for (auto i = 0; i < index; ++i)
for (int i = 0; i < index; ++i)
prop += widths.getUnchecked (i);
return roundToInt (prop * getWidth());
@ -141,7 +141,7 @@ private:
auto diff = 1.0f - total;
auto amount = diff / static_cast<float> (indexToIgnore == -1 ? widths.size() : widths.size() - 1);
for (auto i = 0; i < widths.size(); ++i)
for (int i = 0; i < widths.size(); ++i)
{
if (i != indexToIgnore)
{
@ -156,8 +156,8 @@ private:
class InfoButton : public Button
{
public:
InfoButton (const String& infoToDisplay = String())
: Button (String())
InfoButton (const String& infoToDisplay = {})
: Button ({})
{
if (infoToDisplay.isNotEmpty())
setInfoToDisplay (infoToDisplay);
@ -166,7 +166,7 @@ public:
void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown) override
{
auto bounds = getLocalBounds().toFloat().reduced (2);
const auto& icon = getIcons().info;
auto& icon = getIcons().info;
g.setColour (findColour (treeIconColourId).withMultipliedAlpha (isMouseOverButton || isButtonDown ? 1.0f : 0.5f));
@ -211,7 +211,7 @@ private:
struct InfoWindow : public Component
{
InfoWindow (const String& s)
: stringToDisplay (s)
: stringToDisplay (s)
{
setSize (150, 14);
}
@ -241,7 +241,7 @@ public:
{
addAndMakeVisible (header);
description.setFont (Font (16.0f));
description.setFont ({ 16.0f });
description.setColour (getLookAndFeel().findColour (defaultTextColourId));
description.setLineSpacing (5.0f);
description.setJustification (Justification::centredLeft);
@ -253,17 +253,15 @@ public:
properties.clear();
properties.addArray (newProps.components);
for (auto i = properties.size(); --i >= 0;)
for (auto* prop : properties)
{
auto* prop = properties.getUnchecked (i);
addAndMakeVisible (prop);
if (! prop->getTooltip().isEmpty())
{
addAndMakeVisible (infoButtons.add (new InfoButton (prop->getTooltip())));
infoButtons.getLast()->setAssociatedComponent (prop);
prop->setTooltip (String()); // set the tooltip to empty so it only displays when its button is clicked
prop->setTooltip ({}); // set the tooltip to empty so it only displays when its button is clicked
}
}
}
@ -274,18 +272,16 @@ public:
auto height = header.getBottom() + 10;
descriptionLayout.createLayout (description, (float) (width - 40));
const auto descriptionHeight = (int) descriptionLayout.getHeight();
auto descriptionHeight = (int) descriptionLayout.getHeight();
if (descriptionHeight > 0)
height += (int) descriptionLayout.getHeight() + 25;
for (auto i = 0; i < properties.size(); ++i)
for (auto* pp : properties)
{
auto* pp = properties.getUnchecked (i);
auto propertyHeight = pp->getPreferredHeight() + (getHeightMultiplier (pp) * pp->getPreferredHeight());
InfoButton* buttonToUse = nullptr;
for (auto* b : infoButtons)
if (b->getAssociatedComponent() == pp)
buttonToUse = b;
@ -337,7 +333,7 @@ public:
if (pp->getName() == "Dependencies")
return;
for (int i = pp->getNumChildComponents() - 1; i >= 0; --i)
for (auto i = pp->getNumChildComponents() - 1; i >= 0; --i)
{
auto* child = pp->getChildComponent (i);
@ -353,7 +349,7 @@ private:
ContentViewHeader header;
AttributedString description;
TextLayout descriptionLayout;
const int headerSize = 40;
int headerSize = 40;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PropertyGroupComponent)
};

View file

@ -35,7 +35,7 @@ class FileGroupInformationComponent : public Component,
public:
FileGroupInformationComponent (const Project::Item& group)
: item (group),
header (item.getName(), Icon (getIcons().openFolder, Colours::transparentBlack))
header (item.getName(), { getIcons().openFolder, Colours::transparentBlack })
{
list.setHeaderComponent (new ListBoxHeader ( { "File", "Binary Resource", "Xcode Resource", "Compile" },
{ 0.4f, 0.2f, 0.2f, 0.2f } ));
@ -93,7 +93,7 @@ public:
if (rowNumber < getNumRows())
{
Project::Item child (item.getChild (rowNumber));
auto child = item.getChild (rowNumber);
if (existingComponentToUpdate == nullptr
|| dynamic_cast<FileOptionComponent*> (existing.get())->item != child)

View file

@ -62,7 +62,7 @@ public:
void resized() override
{
auto bounds = getLocalBounds();
configLabel.setFont (Font (bounds.getHeight() / 3.0f));
configLabel.setFont ({ bounds.getHeight() / 3.0f });
//======================================================================
auto projectHeaderBounds = bounds.removeFromLeft (tabsWidth);
@ -159,7 +159,7 @@ public:
return false;
}
int getUserButtonWidth() { return userSettingsButton->getWidth(); }
int getUserButtonWidth() { return userSettingsButton->getWidth(); }
void sidebarTabsWidthChanged (int newWidth)
{
@ -312,7 +312,7 @@ private:
void updateUserAvatar()
{
if (LicenseController* controller = ProjucerApplication::getApp().licenseController)
if (auto* controller = ProjucerApplication::getApp().licenseController.get())
{
auto state = controller->getState();

View file

@ -35,11 +35,7 @@ class ModulesInformationComponent : public Component,
public:
ModulesInformationComponent (Project& p)
: project (p),
modulesValueTree (p.getModules().state),
header ("Modules", Icon (getIcons().modules, Colours::transparentBlack)),
setCopyModeButton ("Set copy-mode for all modules..."),
copyPathButton ("Set paths for all modules..."),
globalPathsButton ("Enable/disable global path for modules...")
modulesValueTree (p.getModules().state)
{
listHeader = new ListBoxHeader ( { "Module", "Version", "Make Local Copy", "Paths" },
{ 0.25f, 0.2f, 0.2f, 0.35f } );
@ -100,7 +96,7 @@ public:
void parentSizeChanged() override
{
const auto width = jmax (550, getParentWidth());
auto width = jmax (550, getParentWidth());
auto y = list.getRowPosition (getNumRows() - 1, true).getBottom() + 200;
y = jmax (getParentHeight(), y);
@ -117,7 +113,7 @@ public:
{
ignoreUnused (height);
auto bounds = Rectangle<int> (0, 0, width, height);
Rectangle<int> bounds (0, 0, width, height);
g.setColour (rowIsSelected ? findColour (defaultHighlightColourId) : findColour (rowNumber % 2 == 0 ? widgetBackgroundColourId
: secondaryWidgetBackgroundColourId));
@ -127,7 +123,7 @@ public:
g.setColour (rowIsSelected ? findColour (defaultHighlightedTextColourId) : findColour (widgetTextColourId));
//======================================================================
const auto moduleID = project.getModules().getModuleID (rowNumber);
auto moduleID = project.getModules().getModuleID (rowNumber);
g.drawFittedText (moduleID, bounds.removeFromLeft (roundToInt (listHeader->getProportionAtIndex (0) * width)), Justification::centredLeft, 1);
@ -139,8 +135,7 @@ public:
g.drawFittedText (version, bounds.removeFromLeft (roundToInt (listHeader->getProportionAtIndex (1) * width)), Justification::centredLeft, 1);
//======================================================================
const auto copyLocally = project.getModules().shouldCopyModuleFilesLocally (moduleID).getValue()
? "Yes" : "No";
auto copyLocally = project.getModules().shouldCopyModuleFilesLocally (moduleID).getValue() ? "Yes" : "No";
g.drawFittedText (copyLocally, bounds.removeFromLeft (roundToInt (listHeader->getProportionAtIndex (2) * width)), Justification::centredLeft, 1);
@ -166,10 +161,10 @@ public:
void listBoxItemDoubleClicked (int row, const MouseEvent&) override
{
const String moduleID (project.getModules().getModuleID (row));
auto moduleID = project.getModules().getModuleID (row);
if (moduleID.isNotEmpty())
if (ProjectContentComponent* pcc = findParentComponentOfClass<ProjectContentComponent>())
if (auto* pcc = findParentComponentOfClass<ProjectContentComponent>())
pcc->showModule (moduleID);
}
@ -196,10 +191,15 @@ private:
Project& project;
ValueTree modulesValueTree;
ContentViewHeader header;
ContentViewHeader header { "Modules", { getIcons().modules, Colours::transparentBlack } };
ListBox list;
ListBoxHeader* listHeader;
TextButton setCopyModeButton, copyPathButton, globalPathsButton;
TextButton setCopyModeButton { "Set copy-mode for all modules..." };
TextButton copyPathButton { "Set paths for all modules..." };
TextButton globalPathsButton { "Enable/disable global path for modules..." };
std::map<String, var> modulePathClipboard;
void valueTreePropertyChanged (ValueTree&, const Identifier&) override { itemChanged(); }
@ -229,7 +229,7 @@ private:
void showGlobalPathsMenu()
{
const bool areAnyModulesSelected = (list.getNumSelectedRows() > 0);
auto areAnyModulesSelected = (list.getNumSelectedRows() > 0);
PopupMenu m;
m.addItem (1, "Set all modules to use global paths");
@ -256,7 +256,7 @@ private:
{
auto selected = list.getSelectedRows();
for (auto i = 0; i < selected.size(); ++i)
for (int i = 0; i < selected.size(); ++i)
moduleList.getShouldUseGlobalPathValue (moduleList.getModuleID (selected[i])).setValue (enableGlobalPaths);
}
}

View file

@ -46,7 +46,7 @@ struct LogoComponent : public Component
{
g.setColour (findColour (defaultTextColourId));
Rectangle<int> r (getLocalBounds());
auto r = getLocalBounds();
g.setFont (15.0f);
g.drawFittedText (getVersionInfo(), r.removeFromBottom (50), Justification::centredBottom, 3);
@ -67,9 +67,6 @@ struct LogoComponent : public Component
//==============================================================================
ProjectContentComponent::ProjectContentComponent()
: project (nullptr),
currentDocument (nullptr),
sidebarTabs (TabbedButtonBar::TabsAtTop)
{
setOpaque (true);
setWantsKeyboardFocus (true);
@ -204,12 +201,12 @@ void ProjectContentComponent::createProjectTabs()
{
jassert (project != nullptr);
const auto tabColour = Colours::transparentBlack;
auto tabColour = Colours::transparentBlack;
auto* pTab = new ProjectTab (project);
sidebarTabs.addTab ("Project", tabColour, pTab, true);
const CompileEngineChildProcess::Ptr childProc (getChildProcess());
CompileEngineChildProcess::Ptr childProc (getChildProcess());
sidebarTabs.addTab ("Build", tabColour, new LiveBuildTab (childProc, lastCrashMessage), true);
@ -227,7 +224,7 @@ void ProjectContentComponent::deleteProjectTabs()
{
if (project != nullptr && sidebarTabs.getNumTabs() > 0)
{
PropertiesFile& settings = project->getStoredProperties();
auto& settings = project->getStoredProperties();
if (sidebarTabs.getWidth() > 0)
settings.setValue ("projectPanelWidth", sidebarTabs.getWidth());
@ -264,7 +261,7 @@ void ProjectContentComponent::rebuildProjectTabs()
auto* projectTab = getProjectTab();
for (int i = 2; i >= 0; --i)
projectTab->setPanelHeightProportion (i, settings.getValue ("projectTabPanelHeight" + String (i), String ("1"))
projectTab->setPanelHeightProportion (i, settings.getValue ("projectTabPanelHeight" + String (i), "1")
.getFloatValue());
//======================================================================
@ -380,7 +377,7 @@ bool ProjectContentComponent::showDocument (OpenDocumentManager::Document* doc,
recentDocumentList.newDocumentOpened (doc);
bool opened = setEditorComponent (doc->createEditor(), doc);
auto opened = setEditorComponent (doc->createEditor(), doc);
if (opened && grabFocus && isShowing())
contentView->grabKeyboardFocus();
@ -404,7 +401,7 @@ void ProjectContentComponent::hideDocument (OpenDocumentManager::Document* doc)
{
if (doc == currentDocument)
{
if (OpenDocumentManager::Document* replacement = recentDocumentList.getClosestPreviousDocOtherThan (doc))
if (auto* replacement = recentDocumentList.getClosestPreviousDocOtherThan (doc))
showDocument (replacement, true);
else
hideEditor();
@ -492,7 +489,7 @@ void ProjectContentComponent::saveAs()
bool ProjectContentComponent::goToPreviousFile()
{
OpenDocumentManager::Document* doc = recentDocumentList.getCurrentDocument();
auto* doc = recentDocumentList.getCurrentDocument();
if (doc == nullptr || doc == getCurrentDocument())
doc = recentDocumentList.getPrevious();
@ -515,7 +512,7 @@ bool ProjectContentComponent::goToCounterpart()
{
if (currentDocument != nullptr)
{
const File file (currentDocument->getCounterpartFile());
auto file = currentDocument->getCounterpartFile();
if (file.exists())
return showEditorForFile (file, true);
@ -537,7 +534,7 @@ bool ProjectContentComponent::saveProject (bool shouldWait)
void ProjectContentComponent::closeProject()
{
if (auto* const mw = findParentComponentOfClass<MainWindow>())
if (auto* mw = findParentComponentOfClass<MainWindow>())
mw->closeCurrentProject();
}
@ -563,7 +560,7 @@ void ProjectContentComponent::showExporterSettings (const String& exporterName)
{
if (auto* exporters = dynamic_cast<TreeItemTypes::ExportersTreeRoot*>(exportersPanel->rootItem.get()))
{
for (int i = exporters->getNumSubItems(); i >= 0; --i)
for (auto i = exporters->getNumSubItems(); i >= 0; --i)
{
if (auto* e = dynamic_cast<TreeItemTypes::ExporterItem*> (exporters->getSubItem (i)))
{
@ -588,7 +585,7 @@ void ProjectContentComponent::showModule (const String& moduleID)
{
if (auto* mods = dynamic_cast<TreeItemTypes::EnabledModulesItem*> (modsPanel->rootItem.get()))
{
for (int i = mods->getNumSubItems(); --i >= 0;)
for (auto i = mods->getNumSubItems(); --i >= 0;)
{
if (auto* m = dynamic_cast<TreeItemTypes::ModuleItem*> (mods->getSubItem (i)))
{
@ -655,9 +652,9 @@ static void newExporterMenuCallback (int result, ProjectContentComponent* comp)
{
if (comp != nullptr && result > 0)
{
if (Project* p = comp->getProject())
if (auto* p = comp->getProject())
{
String exporterName (ProjectExporter::getExporterNames() [result - 1]);
auto exporterName= ProjectExporter::getExporterNames() [result - 1];
if (exporterName.isNotEmpty())
p->addNewExporter (exporterName);
@ -673,11 +670,11 @@ void ProjectContentComponent::showNewExporterMenu()
menu.addSectionHeader ("Create a new export target:");
Array<ProjectExporter::ExporterTypeInfo> exporters (ProjectExporter::getExporterTypes());
auto exporters = ProjectExporter::getExporterTypes();
for (int i = 0; i < exporters.size(); ++i)
{
const ProjectExporter::ExporterTypeInfo& type = exporters.getReference(i);
auto& type = exporters.getReference(i);
menu.addItem (i + 1, type.name, true, false, type.getIcon());
}
@ -689,7 +686,7 @@ void ProjectContentComponent::showNewExporterMenu()
void ProjectContentComponent::deleteSelectedTreeItems()
{
if (auto* const tree = getProjectTab()->getTreeWithSelectedItems())
if (auto* tree = getProjectTab()->getTreeWithSelectedItems())
tree->deleteSelectedItems();
}
@ -761,38 +758,36 @@ ApplicationCommandTarget* ProjectContentComponent::getNextCommandTarget()
void ProjectContentComponent::getAllCommands (Array <CommandID>& commands)
{
const CommandID ids[] = { CommandIDs::saveProject,
CommandIDs::closeProject,
CommandIDs::saveDocument,
CommandIDs::saveDocumentAs,
CommandIDs::closeDocument,
CommandIDs::goToPreviousDoc,
CommandIDs::goToNextDoc,
CommandIDs::goToCounterpart,
CommandIDs::showProjectSettings,
CommandIDs::showProjectTab,
CommandIDs::showBuildTab,
CommandIDs::showFileExplorerPanel,
CommandIDs::showModulesPanel,
CommandIDs::showExportersPanel,
CommandIDs::showExporterSettings,
CommandIDs::openInIDE,
CommandIDs::saveAndOpenInIDE,
CommandIDs::createNewExporter,
CommandIDs::deleteSelectedItem,
CommandIDs::showTranslationTool,
CommandIDs::cleanAll,
CommandIDs::toggleBuildEnabled,
CommandIDs::buildNow,
CommandIDs::toggleContinuousBuild,
CommandIDs::launchApp,
CommandIDs::killApp,
CommandIDs::reinstantiateComp,
CommandIDs::showWarnings,
CommandIDs::nextError,
CommandIDs::prevError };
commands.addArray (ids, numElementsInArray (ids));
commands.addArray ({ CommandIDs::saveProject,
CommandIDs::closeProject,
CommandIDs::saveDocument,
CommandIDs::saveDocumentAs,
CommandIDs::closeDocument,
CommandIDs::goToPreviousDoc,
CommandIDs::goToNextDoc,
CommandIDs::goToCounterpart,
CommandIDs::showProjectSettings,
CommandIDs::showProjectTab,
CommandIDs::showBuildTab,
CommandIDs::showFileExplorerPanel,
CommandIDs::showModulesPanel,
CommandIDs::showExportersPanel,
CommandIDs::showExporterSettings,
CommandIDs::openInIDE,
CommandIDs::saveAndOpenInIDE,
CommandIDs::createNewExporter,
CommandIDs::deleteSelectedItem,
CommandIDs::showTranslationTool,
CommandIDs::cleanAll,
CommandIDs::toggleBuildEnabled,
CommandIDs::buildNow,
CommandIDs::toggleContinuousBuild,
CommandIDs::launchApp,
CommandIDs::killApp,
CommandIDs::reinstantiateComp,
CommandIDs::showWarnings,
CommandIDs::nextError,
CommandIDs::prevError });
}
void ProjectContentComponent::getCommandInfo (const CommandID commandID, ApplicationCommandInfo& result)
@ -802,9 +797,9 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica
documentName = " '" + currentDocument->getName().substring (0, 32) + "'";
#if JUCE_MAC
const ModifierKeys cmdCtrl (ModifierKeys::ctrlModifier | ModifierKeys::commandModifier);
auto cmdCtrl = (ModifierKeys::ctrlModifier | ModifierKeys::commandModifier);
#else
const ModifierKeys cmdCtrl (ModifierKeys::ctrlModifier | ModifierKeys::altModifier);
auto cmdCtrl = (ModifierKeys::ctrlModifier | ModifierKeys::altModifier);
#endif
switch (commandID)
@ -828,7 +823,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica
"Saves the current document",
CommandCategories::general, 0);
result.setActive (currentDocument != nullptr || (project != nullptr && ! project->isCurrentlySaving()));
result.defaultKeypresses.add (KeyPress ('s', ModifierKeys::commandModifier, 0));
result.defaultKeypresses.add ({ 's', ModifierKeys::commandModifier, 0 });
break;
case CommandIDs::saveDocumentAs:
@ -836,7 +831,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica
"Saves the current document to a new location",
CommandCategories::general, 0);
result.setActive (currentDocument != nullptr);
result.defaultKeypresses.add (KeyPress ('s', ModifierKeys::commandModifier | ModifierKeys::shiftModifier, 0));
result.defaultKeypresses.add ({ 's', ModifierKeys::commandModifier | ModifierKeys::shiftModifier, 0 });
break;
case CommandIDs::closeDocument:
@ -844,7 +839,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica
"Closes the current document",
CommandCategories::general, 0);
result.setActive (contentView != nullptr);
result.defaultKeypresses.add (KeyPress ('w', cmdCtrl, 0));
result.defaultKeypresses.add ({ 'w', cmdCtrl, 0 });
break;
case CommandIDs::goToPreviousDoc:
@ -852,7 +847,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica
"Go to previous document",
CommandCategories::general, 0);
result.setActive (recentDocumentList.canGoToPrevious());
result.defaultKeypresses.add (KeyPress (KeyPress::leftKey, cmdCtrl, 0));
result.defaultKeypresses.add ({ KeyPress::leftKey, cmdCtrl, 0 });
break;
case CommandIDs::goToNextDoc:
@ -860,7 +855,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica
"Go to next document",
CommandCategories::general, 0);
result.setActive (recentDocumentList.canGoToNext());
result.defaultKeypresses.add (KeyPress (KeyPress::rightKey, cmdCtrl, 0));
result.defaultKeypresses.add ({ KeyPress::rightKey, cmdCtrl, 0 });
break;
case CommandIDs::goToCounterpart:
@ -868,7 +863,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica
"Open corresponding header or cpp file",
CommandCategories::general, 0);
result.setActive (canGoToCounterpart());
result.defaultKeypresses.add (KeyPress (KeyPress::upKey, cmdCtrl, 0));
result.defaultKeypresses.add ({ KeyPress::upKey, cmdCtrl, 0 });
break;
case CommandIDs::showProjectSettings:
@ -876,7 +871,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica
"Shows the main project options page",
CommandCategories::general, 0);
result.setActive (project != nullptr);
result.defaultKeypresses.add (KeyPress ('x', cmdCtrl, 0));
result.defaultKeypresses.add ({ 'x', cmdCtrl, 0 });
break;
case CommandIDs::showProjectTab:
@ -884,7 +879,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica
"Shows the tab containing the project information",
CommandCategories::general, 0);
result.setActive (project != nullptr);
result.defaultKeypresses.add (KeyPress ('p', cmdCtrl, 0));
result.defaultKeypresses.add ({ 'p', cmdCtrl, 0 });
break;
case CommandIDs::showBuildTab:
@ -892,7 +887,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica
"Shows the tab containing the build panel",
CommandCategories::general, 0);
result.setActive (project != nullptr);
result.defaultKeypresses.add (KeyPress ('b', cmdCtrl, 0));
result.defaultKeypresses.add ({ 'b', cmdCtrl, 0 });
break;
case CommandIDs::showFileExplorerPanel:
@ -900,7 +895,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica
"Shows the panel containing the tree of files for this project",
CommandCategories::general, 0);
result.setActive (project != nullptr);
result.defaultKeypresses.add (KeyPress ('f', cmdCtrl, 0));
result.defaultKeypresses.add ({ 'f', cmdCtrl, 0 });
break;
case CommandIDs::showModulesPanel:
@ -908,7 +903,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica
"Shows the panel containing the project's list of modules",
CommandCategories::general, 0);
result.setActive (project != nullptr);
result.defaultKeypresses.add (KeyPress ('m', cmdCtrl, 0));
result.defaultKeypresses.add ({ 'm', cmdCtrl, 0 });
break;
case CommandIDs::showExportersPanel:
@ -916,7 +911,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica
"Shows the panel containing the project's list of exporters",
CommandCategories::general, 0);
result.setActive (project != nullptr);
result.defaultKeypresses.add (KeyPress ('e', cmdCtrl, 0));
result.defaultKeypresses.add ({ 'e', cmdCtrl, 0 });
break;
case CommandIDs::showExporterSettings:
@ -924,7 +919,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica
"Shows the settings page for the currently selected exporter",
CommandCategories::general, 0);
result.setActive (project != nullptr);
result.defaultKeypresses.add (KeyPress ('e', ModifierKeys::commandModifier | ModifierKeys::shiftModifier, 0));
result.defaultKeypresses.add ({ 'e', ModifierKeys::commandModifier | ModifierKeys::shiftModifier, 0 });
break;
case CommandIDs::openInIDE:
@ -939,7 +934,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica
"Saves the project and launches it in an external IDE",
CommandCategories::general, 0);
result.setActive (ProjectExporter::canProjectBeLaunched (project) && ! project->isCurrentlySaving());
result.defaultKeypresses.add (KeyPress ('l', ModifierKeys::commandModifier | ModifierKeys::shiftModifier, 0));
result.defaultKeypresses.add ({ 'l', ModifierKeys::commandModifier | ModifierKeys::shiftModifier, 0 });
break;
case CommandIDs::createNewExporter:
@ -953,8 +948,8 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica
result.setInfo ("Delete Selected File",
String(),
CommandCategories::general, 0);
result.defaultKeypresses.add (KeyPress (KeyPress::deleteKey, 0, 0));
result.defaultKeypresses.add (KeyPress (KeyPress::backspaceKey, 0, 0));
result.defaultKeypresses.add ({ KeyPress::deleteKey, 0, 0 });
result.defaultKeypresses.add ({ KeyPress::backspaceKey, 0, 0 });
result.setActive (sidebarTabs.getCurrentTabIndex() == 0);
break;
@ -968,7 +963,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica
result.setInfo ("Clean All",
"Cleans all intermediate files",
CommandCategories::general, 0);
result.defaultKeypresses.add (KeyPress ('k', ModifierKeys::commandModifier | ModifierKeys::shiftModifier, 0));
result.defaultKeypresses.add ({ 'k', ModifierKeys::commandModifier | ModifierKeys::shiftModifier, 0 });
result.setActive (project != nullptr);
break;
@ -976,7 +971,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica
result.setInfo ("Enable Compilation",
"Enables/disables the compiler",
CommandCategories::general, 0);
result.defaultKeypresses.add (KeyPress ('b', ModifierKeys::commandModifier | ModifierKeys::shiftModifier, 0));
result.defaultKeypresses.add ({ 'b', ModifierKeys::commandModifier | ModifierKeys::shiftModifier, 0 });
result.setActive (project != nullptr);
result.setTicked (childProcess != nullptr);
break;
@ -985,7 +980,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica
result.setInfo ("Build Now",
"Recompiles any out-of-date files and updates the JIT engine",
CommandCategories::general, 0);
result.defaultKeypresses.add (KeyPress ('b', ModifierKeys::commandModifier, 0));
result.defaultKeypresses.add ({ 'b', ModifierKeys::commandModifier, 0 });
result.setActive (childProcess != nullptr);
break;
@ -1001,7 +996,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica
result.setInfo ("Launch Application",
"Invokes the app's main() function",
CommandCategories::general, 0);
result.defaultKeypresses.add (KeyPress ('r', ModifierKeys::commandModifier, 0));
result.defaultKeypresses.add ({ 'r', ModifierKeys::commandModifier, 0 });
result.setActive (childProcess != nullptr && childProcess->canLaunchApp());
break;
@ -1009,7 +1004,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica
result.setInfo ("Stop Application",
"Kills the app if it's running",
CommandCategories::general, 0);
result.defaultKeypresses.add (KeyPress ('.', ModifierKeys::commandModifier, 0));
result.defaultKeypresses.add ({ '.', ModifierKeys::commandModifier, 0 });
result.setActive (childProcess != nullptr && childProcess->canKillApp());
break;
@ -1017,7 +1012,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica
result.setInfo ("Re-instantiate Components",
"Re-loads any component editors that are open",
CommandCategories::general, 0);
result.defaultKeypresses.add (KeyPress ('r', ModifierKeys::commandModifier | ModifierKeys::shiftModifier, 0));
result.defaultKeypresses.add ({ 'r', ModifierKeys::commandModifier | ModifierKeys::shiftModifier, 0 });
result.setActive (childProcess != nullptr);
break;
@ -1033,7 +1028,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica
result.setInfo ("Highlight next error",
"Jumps to the next error or warning",
CommandCategories::general, 0);
result.defaultKeypresses.add (KeyPress ('\'', ModifierKeys::commandModifier, 0));
result.defaultKeypresses.add ({ '\'', ModifierKeys::commandModifier, 0 });
result.setActive (childProcess != nullptr && ! childProcess->errorList.isEmpty());
break;
@ -1041,7 +1036,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica
result.setInfo ("Highlight previous error",
"Jumps to the last error or warning",
CommandCategories::general, 0);
result.defaultKeypresses.add (KeyPress ('\"', ModifierKeys::commandModifier, 0));
result.defaultKeypresses.add ({ '\"', ModifierKeys::commandModifier, 0 });
result.setActive (childProcess != nullptr && ! childProcess->errorList.isEmpty());
break;
@ -1110,16 +1105,16 @@ bool ProjectContentComponent::perform (const InvocationInfo& info)
case CommandIDs::showTranslationTool: showTranslationTool(); break;
case CommandIDs::cleanAll: cleanAll(); break;
case CommandIDs::toggleBuildEnabled: setBuildEnabled (! isBuildEnabled()); break;
case CommandIDs::buildNow: rebuildNow(); break;
case CommandIDs::cleanAll: cleanAll(); break;
case CommandIDs::toggleBuildEnabled: setBuildEnabled (! isBuildEnabled()); break;
case CommandIDs::buildNow: rebuildNow(); break;
case CommandIDs::toggleContinuousBuild: setContinuousRebuildEnabled (! isContinuousRebuildEnabled()); break;
case CommandIDs::launchApp: launchApp(); break;
case CommandIDs::killApp: killApp(); break;
case CommandIDs::reinstantiateComp: reinstantiateLivePreviewWindows(); break;
case CommandIDs::showWarnings: toggleWarnings(); break;
case CommandIDs::nextError: showNextError(); break;
case CommandIDs::prevError: showPreviousError(); break;
case CommandIDs::launchApp: launchApp(); break;
case CommandIDs::killApp: killApp(); break;
case CommandIDs::reinstantiateComp: reinstantiateLivePreviewWindows(); break;
case CommandIDs::showWarnings: toggleWarnings(); break;
case CommandIDs::nextError: showNextError(); break;
case CommandIDs::prevError: showPreviousError(); break;
default:
return false;
@ -1172,7 +1167,7 @@ void ProjectContentComponent::cleanAll()
if (childProcess != nullptr)
childProcess->cleanAll();
else if (Project* p = getProject())
else if (auto* p = getProject())
CompileEngineChildProcess::cleanAllCachedFilesForProject (*p);
}
@ -1224,7 +1219,7 @@ void ProjectContentComponent::toggleWarnings()
static ProjucerAppClasses::ErrorListComp* findErrorListComp (const TabbedComponent& tabs)
{
if (LiveBuildTab* bt = findBuildTab (tabs))
if (auto* bt = findBuildTab (tabs))
return bt->errorListComp;
return nullptr;
@ -1232,7 +1227,7 @@ static ProjucerAppClasses::ErrorListComp* findErrorListComp (const TabbedCompone
void ProjectContentComponent::showNextError()
{
if (ProjucerAppClasses::ErrorListComp* el = findErrorListComp (sidebarTabs))
if (auto* el = findErrorListComp (sidebarTabs))
{
showBuildTab();
el->showNext();
@ -1241,7 +1236,7 @@ void ProjectContentComponent::showNextError()
void ProjectContentComponent::showPreviousError()
{
if (ProjucerAppClasses::ErrorListComp* el = findErrorListComp (sidebarTabs))
if (auto* el = findErrorListComp (sidebarTabs))
{
showBuildTab();
el->showPrevious();
@ -1274,8 +1269,8 @@ void ProjectContentComponent::rebuildNow()
void ProjectContentComponent::globalFocusChanged (Component* focusedComponent)
{
const bool nowForeground = (Process::isForegroundProcess()
&& (focusedComponent == this || isParentOf (focusedComponent)));
auto nowForeground = (Process::isForegroundProcess()
&& (focusedComponent == this || isParentOf (focusedComponent)));
if (nowForeground != isForeground)
{
@ -1330,14 +1325,14 @@ ReferenceCountedObjectPtr<CompileEngineChildProcess> ProjectContentComponent::ge
void ProjectContentComponent::handleMissingSystemHeaders()
{
#if JUCE_MAC
const String tabMessage = "Compiler not available due to missing system headers\nPlease install a recent version of Xcode";
const String alertWindowMessage = "Missing system headers\nPlease install a recent version of Xcode";
String tabMessage ("Compiler not available due to missing system headers\nPlease install a recent version of Xcode");
String alertWindowMessage ("Missing system headers\nPlease install a recent version of Xcode");
#elif JUCE_WINDOWS
const String tabMessage = "Compiler not available due to missing system headers\nPlease install a recent version of Visual Studio and the Windows Desktop SDK";
const String alertWindowMessage = "Missing system headers\nPlease install a recent version of Visual Studio and the Windows Desktop SDK";
String tabMessage ("Compiler not available due to missing system headers\nPlease install a recent version of Visual Studio and the Windows Desktop SDK");
String alertWindowMessage ("Missing system headers\nPlease install a recent version of Visual Studio and the Windows Desktop SDK");
#elif JUCE_LINUX
const String tabMessage = "Compiler not available due to missing system headers\nPlease do a sudo apt-get install ...";
const String alertWindowMessage = "Missing system headers\nPlease do sudo apt-get install ...";
String tabMessage ("Compiler not available due to missing system headers\nPlease do a sudo apt-get install ...");
String alertWindowMessage ("Missing system headers\nPlease do sudo apt-get install ...");
#endif
setBuildEnabled (false, true);

View file

@ -142,12 +142,12 @@ private:
friend HeaderComponent;
//==============================================================================
Project* project;
OpenDocumentManager::Document* currentDocument;
Project* project = nullptr;
OpenDocumentManager::Document* currentDocument = nullptr;
RecentDocumentList recentDocumentList;
ScopedPointer<Component> logo, translationTool, contentView, header;
TabbedComponent sidebarTabs;
TabbedComponent sidebarTabs { TabbedButtonBar::TabsAtTop };
ScopedPointer<ResizableEdgeComponent> resizerBar;
ComponentBoundsConstrainer sidebarSizeConstrainer;

View file

@ -40,16 +40,16 @@ static var parseModuleDesc (const StringArray& lines)
DynamicObject* o = new DynamicObject();
var result (o);
for (int i = 0; i < lines.size(); ++i)
for (auto line : lines)
{
String line = trimCommentCharsFromStartOfLine (lines[i]);
line = trimCommentCharsFromStartOfLine (line);
int colon = line.indexOfChar (':');
auto colon = line.indexOfChar (':');
if (colon >= 0)
{
String key = line.substring (0, colon).trim();
String value = line.substring (colon + 1).trim();
auto key = line.substring (0, colon).trim();
auto value = line.substring (colon + 1).trim();
o->setProperty (key, value);
}
@ -98,7 +98,7 @@ File ModuleDescription::getHeader() const
for (auto e : extensions)
{
File header (moduleFolder.getChildFile (moduleFolder.getFileName() + e));
auto header = moduleFolder.getChildFile (moduleFolder.getFileName() + e);
if (header.existsAsFile())
return header;
@ -178,7 +178,7 @@ Result ModuleList::addAllModulesInFolder (const File& path)
{
if (! tryToAddModuleFromFolder (path))
{
const int subfolders = 2;
int subfolders = 2;
return addAllModulesInSubfoldersRecursively (path, subfolders);
}
@ -259,13 +259,13 @@ static Array<File> getAllPossibleModulePathsFromExporters (Project& project)
if (modules.shouldUseGlobalPath (id))
continue;
const auto path = exporter->getPathForModuleString (id);
auto path = exporter->getPathForModuleString (id);
if (path.isNotEmpty())
paths.addIfNotAlreadyThere (path);
}
String oldPath (exporter->getLegacyModulePath());
auto oldPath = exporter->getLegacyModulePath();
if (oldPath.isNotEmpty())
paths.addIfNotAlreadyThere (oldPath);
@ -345,16 +345,16 @@ LibraryModule::LibraryModule (const ModuleDescription& d)
//==============================================================================
void LibraryModule::writeIncludes (ProjectSaver& projectSaver, OutputStream& out)
{
Project& project = projectSaver.project;
EnabledModuleList& modules = project.getModules();
auto& project = projectSaver.project;
auto& modules = project.getModules();
const String id (getID());
auto id = getID();
if (modules.shouldCopyModuleFilesLocally (id).getValue())
{
const File juceModuleFolder (moduleInfo.getFolder());
auto juceModuleFolder = moduleInfo.getFolder();
const File localModuleFolder (project.getLocalModuleFolder (id));
auto localModuleFolder = project.getLocalModuleFolder (id);
localModuleFolder.createDirectory();
projectSaver.copyFolder (juceModuleFolder, localModuleFolder);
}
@ -377,7 +377,7 @@ void LibraryModule::addSettingsForModuleToExporter (ProjectExporter& exporter, P
{
auto& project = exporter.getProject();
const auto moduleRelativePath = exporter.getModuleFolderRelativeToProject (getID());
auto moduleRelativePath = exporter.getModuleFolderRelativeToProject (getID());
exporter.addToExtraSearchPaths (moduleRelativePath.getParentDirectory());
@ -389,25 +389,24 @@ void LibraryModule::addSettingsForModuleToExporter (ProjectExporter& exporter, P
else
libDirPlatform = exporter.getTargetFolder().getFileName();
const auto libSubdirPath = String (moduleRelativePath.toUnixStyle() + "/libs/") + libDirPlatform;
const auto moduleLibDir = File (project.getProjectFolder().getFullPathName() + "/" + libSubdirPath);
auto libSubdirPath = moduleRelativePath.toUnixStyle() + "/libs/" + libDirPlatform;
auto moduleLibDir = File (project.getProjectFolder().getFullPathName() + "/" + libSubdirPath);
if (moduleLibDir.exists())
exporter.addToModuleLibPaths (RelativePath (libSubdirPath, moduleRelativePath.getRoot()));
exporter.addToModuleLibPaths ({ libSubdirPath, moduleRelativePath.getRoot() });
const auto extraInternalSearchPaths = moduleInfo.getExtraSearchPaths().trim();
auto extraInternalSearchPaths = moduleInfo.getExtraSearchPaths().trim();
if (extraInternalSearchPaths.isNotEmpty())
{
StringArray paths;
paths.addTokens (extraInternalSearchPaths, true);
auto paths = StringArray::fromTokens (extraInternalSearchPaths, true);
for (auto& path : paths)
exporter.addToExtraSearchPaths (moduleRelativePath.getChildFile (path.unquoted()));
}
{
const String extraDefs (moduleInfo.getPreprocessorDefs().trim());
auto extraDefs = moduleInfo.getPreprocessorDefs().trim();
if (extraDefs.isNotEmpty())
exporter.getExporterPreprocessorDefsValue() = exporter.getExporterPreprocessorDefsString() + "\n" + extraDefs;
@ -418,9 +417,8 @@ void LibraryModule::addSettingsForModuleToExporter (ProjectExporter& exporter, P
auto& modules = project.getModules();
auto id = getID();
const File localModuleFolder = modules.shouldCopyModuleFilesLocally (id).getValue()
? project.getLocalModuleFolder (id)
: moduleInfo.getFolder();
auto localModuleFolder = modules.shouldCopyModuleFilesLocally (id).getValue() ? project.getLocalModuleFolder (id)
: moduleInfo.getFolder();
findAndAddCompiledUnits (exporter, &projectSaver, compiled);
@ -435,7 +433,7 @@ void LibraryModule::addSettingsForModuleToExporter (ProjectExporter& exporter, P
if (project.isAUPluginHost())
xcodeExporter.xcodeFrameworks.addTokens (xcodeExporter.isOSX() ? "AudioUnit CoreAudioKit" : "CoreAudioKit", false);
const String frameworks (moduleInfo.moduleInfo [xcodeExporter.isOSX() ? "OSXFrameworks" : "iOSFrameworks"].toString());
auto frameworks = moduleInfo.moduleInfo [xcodeExporter.isOSX() ? "OSXFrameworks" : "iOSFrameworks"].toString();
xcodeExporter.xcodeFrameworks.addTokens (frameworks, ", ", {});
parseAndAddLibs (xcodeExporter.xcodeLibs, moduleInfo.moduleInfo [exporter.isOSX() ? "OSXLibs" : "iOSLibs"].toString());
@ -460,7 +458,7 @@ void LibraryModule::addSettingsForModuleToExporter (ProjectExporter& exporter, P
void LibraryModule::getConfigFlags (Project& project, OwnedArray<Project::ConfigFlag>& flags) const
{
const File header (moduleInfo.getHeader());
auto header = moduleInfo.getHeader();
jassert (header.exists());
StringArray lines;
@ -468,7 +466,7 @@ void LibraryModule::getConfigFlags (Project& project, OwnedArray<Project::Config
for (int i = 0; i < lines.size(); ++i)
{
String line (lines[i].trim());
auto line = lines[i].trim();
if (line.startsWith ("/**") && line.containsIgnoreCase ("Config:"))
{
@ -650,9 +648,9 @@ void LibraryModule::addBrowseableCode (ProjectExporter& exporter, const Array<Fi
if (sourceFiles.isEmpty())
findBrowseableFiles (localModuleFolder, sourceFiles);
Project::Item sourceGroup (Project::Item::createGroup (exporter.getProject(), getID(), "__mainsourcegroup" + getID(), false));
auto sourceGroup = Project::Item::createGroup (exporter.getProject(), getID(), "__mainsourcegroup" + getID(), false);
const RelativePath moduleFromProject (exporter.getModuleFolderRelativeToProject (getID()));
auto moduleFromProject = exporter.getModuleFolderRelativeToProject (getID());
auto moduleHeader = moduleInfo.getHeader();
@ -787,7 +785,7 @@ void EnabledModuleList::addModule (const File& moduleFolder, bool copyLocally, b
if (info.isValid())
{
const String moduleID (info.getID());
auto moduleID = info.getID();
if (! isModuleEnabled (moduleID))
{
@ -812,7 +810,7 @@ void EnabledModuleList::addModule (const File& moduleFolder, bool copyLocally, b
void EnabledModuleList::removeModule (String moduleID) // must be pass-by-value, and not a const ref!
{
for (int i = state.getNumChildren(); --i >= 0;)
for (auto i = state.getNumChildren(); --i >= 0;)
if (state.getChild(i) [Ids::ID] == moduleID)
state.removeChild (i, getUndoManager());
@ -838,7 +836,7 @@ StringArray EnabledModuleList::getAllModules() const
static void getDependencies (Project& project, const String& moduleID, StringArray& dependencies)
{
ModuleDescription info (project.getModules().getModuleInfo (moduleID));
auto info = project.getModules().getModuleInfo (moduleID);
for (auto uid : info.getDependencies())
{
@ -876,7 +874,7 @@ bool EnabledModuleList::doesModuleHaveHigherCppStandardThanProject (const String
bool EnabledModuleList::areMostModulesUsingGlobalPath() const
{
auto numYes = 0, numNo = 0;
int numYes = 0, numNo = 0;
for (auto i = getNumModules(); --i >= 0;)
{
@ -891,7 +889,7 @@ bool EnabledModuleList::areMostModulesUsingGlobalPath() const
bool EnabledModuleList::areMostModulesCopiedLocally() const
{
auto numYes = 0, numNo = 0;
int numYes = 0, numNo = 0;
for (auto i = getNumModules(); --i >= 0;)
{
@ -906,7 +904,7 @@ bool EnabledModuleList::areMostModulesCopiedLocally() const
void EnabledModuleList::setLocalCopyModeForAllModules (bool copyLocally)
{
for (int i = getNumModules(); --i >= 0;)
for (auto i = getNumModules(); --i >= 0;)
shouldCopyModuleFilesLocally (project.getModules().getModuleID (i)) = copyLocally;
}
@ -915,7 +913,7 @@ File EnabledModuleList::findGlobalModulesFolder()
auto& settings = getAppSettings();
auto path = settings.getStoredPath (Ids::defaultJuceModulePath).toString();
if (settings.isGlobalPathValid (File(), Ids::defaultJuceModulePath, path))
if (settings.isGlobalPathValid ({}, Ids::defaultJuceModulePath, path))
return { path };
return {};
@ -931,9 +929,9 @@ File EnabledModuleList::findDefaultModulesFolder (Project& project)
ModuleList available;
available.scanProjectExporterModulePaths (project);
for (int i = available.modules.size(); --i >= 0;)
for (auto i = available.modules.size(); --i >= 0;)
{
File f (available.modules.getUnchecked(i)->getFolder());
auto f = available.modules.getUnchecked(i)->getFolder();
if (f.isDirectory())
return f.getParentDirectory();
@ -974,9 +972,9 @@ bool EnabledModuleList::isJuceModule (const String& moduleID)
void EnabledModuleList::addModuleFromUserSelectedFile()
{
static File lastLocation (findDefaultModulesFolder (project));
static auto lastLocation = findDefaultModulesFolder (project);
FileChooser fc ("Select a module to add...", lastLocation, String());
FileChooser fc ("Select a module to add...", lastLocation, {});
if (fc.browseForDirectory())
{

View file

@ -45,8 +45,7 @@ Project::Project (const File& f)
: FileBasedDocument (projectFileExtension,
String ("*") + projectFileExtension,
"Choose a Jucer project to load",
"Save Jucer project"),
projectRoot (Ids::JUCERPROJECT)
"Save Jucer project")
{
Logger::writeToLog ("Loading project: " + f.getFullPathName());
setFile (f);
@ -262,7 +261,7 @@ void Project::updateOldStyleConfigList()
if (! exporter->isXcode())
{
for (int j = newConfigs.getNumChildren(); --j >= 0;)
for (auto j = newConfigs.getNumChildren(); --j >= 0;)
{
auto config = newConfigs.getChild (j);
@ -322,8 +321,7 @@ void Project::updateOldModulePaths()
//==============================================================================
static int getVersionElement (StringRef v, int index)
{
StringArray parts;
parts.addTokens (v, "., ", StringRef());
StringArray parts = StringArray::fromTokens (v, "., ", {});
return parts [parts.size() - index - 1].getIntValue();
}
@ -344,7 +342,7 @@ static int getBuiltJuceVersion()
static bool isAnyModuleNewerThanProjucer (const OwnedArray<ModuleDescription>& modules)
{
for (int i = modules.size(); --i >= 0;)
for (auto i = modules.size(); --i >= 0;)
{
auto* m = modules.getUnchecked(i);
@ -1145,8 +1143,8 @@ struct ItemSorterWithGroupsAtStart
{
static int compareElements (const ValueTree& first, const ValueTree& second)
{
auto firstIsGroup = first.hasType (Ids::GROUP);
auto secondIsGroup = second.hasType (Ids::GROUP);
auto firstIsGroup = first.hasType (Ids::GROUP);
auto secondIsGroup = second.hasType (Ids::GROUP);
if (firstIsGroup == secondIsGroup)
return first [Ids::name].toString().compareNatural (second [Ids::name].toString());

View file

@ -336,7 +336,7 @@ public:
String specifiedExporterToSave = {};
private:
ValueTree projectRoot;
ValueTree projectRoot { Ids::JUCERPROJECT };
ValueWithDefault projectNameValue, projectUIDValue, projectTypeValue, versionValue, bundleIdentifierValue, companyNameValue, companyCopyrightValue,
companyWebsiteValue, companyEmailValue, displaySplashScreenValue, reportAppUsageValue, splashScreenColourValue, cppStandardValue,

View file

@ -110,7 +110,7 @@ private:
//==============================================================================
inline ProjectType::ProjectType (const String& t, const String& d)
: type (t), desc (d)
: type (t), desc (d)
{
}
@ -121,9 +121,9 @@ inline ProjectType::~ProjectType()
inline const ProjectType* ProjectType::findType (const String& typeCode)
{
const Array<ProjectType*>& types = getAllTypes();
const auto& types = getAllTypes();
for (int i = types.size(); --i >= 0;)
for (auto i = types.size(); --i >= 0;)
if (types.getUnchecked(i)->getType() == typeCode)
return types.getUnchecked(i);