| @@ -221,16 +221,15 @@ private: | |||
| { | |||
| RadioButtonsGroupComponent() | |||
| { | |||
| int index = 1; | |||
| for (auto& b : radioButtons) | |||
| for (const auto [n, b] : enumerate (radioButtons, 1)) | |||
| { | |||
| b.setRadioGroupId (1); | |||
| b.setButtonText ("Button " + String (index++)); | |||
| b.setButtonText ("Button " + String (n)); | |||
| b.setHasFocusOutline (true); | |||
| addAndMakeVisible (b); | |||
| } | |||
| radioButtons[(size_t) Random::getSystemRandom().nextInt (numRadioButtons)].setToggleState (true, dontSendNotification); | |||
| radioButtons[(size_t) Random::getSystemRandom().nextInt ((int) radioButtons.size())].setToggleState (true, dontSendNotification); | |||
| setTitle ("Radio Buttons Group"); | |||
| setFocusContainerType (FocusContainerType::focusContainer); | |||
| @@ -239,14 +238,13 @@ private: | |||
| void resized() override | |||
| { | |||
| auto bounds = getLocalBounds(); | |||
| const auto height = bounds.getHeight() / numRadioButtons; | |||
| const auto height = bounds.getHeight() / (int) radioButtons.size(); | |||
| for (auto& b : radioButtons) | |||
| b.setBounds (bounds.removeFromTop (height).reduced (2)); | |||
| } | |||
| static constexpr int numRadioButtons = 3; | |||
| std::array<ToggleButton, numRadioButtons> radioButtons; | |||
| std::array<ToggleButton, 3> radioButtons; | |||
| }; | |||
| //============================================================================== | |||
| @@ -519,13 +519,14 @@ public: | |||
| auto& enabledModules = project.getEnabledModules(); | |||
| PopupMenu allModules; | |||
| int index = 100; | |||
| // JUCE path | |||
| PopupMenu jucePathModules; | |||
| for (auto& mod : ProjucerApplication::getApp().getJUCEPathModulesList().getAllModules()) | |||
| jucePathModules.addItem (index++, mod.first, ! enabledModules.isModuleEnabled (mod.first)); | |||
| for (const auto [index, mod] : enumerate (ProjucerApplication::getApp().getJUCEPathModulesList().getAllModules(), | |||
| 100)) | |||
| { | |||
| jucePathModules.addItem (index, mod.first, ! enabledModules.isModuleEnabled (mod.first)); | |||
| } | |||
| jucePathModules.addSeparator(); | |||
| jucePathModules.addItem (-1, "Re-scan path"); | |||
| @@ -533,11 +534,13 @@ public: | |||
| allModules.addSubMenu ("Global JUCE modules path", jucePathModules); | |||
| // User path | |||
| index = 200; | |||
| PopupMenu userPathModules; | |||
| for (auto& mod : ProjucerApplication::getApp().getUserPathsModulesList().getAllModules()) | |||
| userPathModules.addItem (index++, mod.first, ! enabledModules.isModuleEnabled (mod.first)); | |||
| for (const auto [index, mod] : enumerate (ProjucerApplication::getApp().getUserPathsModulesList().getAllModules(), | |||
| 200)) | |||
| { | |||
| userPathModules.addItem (index, mod.first, ! enabledModules.isModuleEnabled (mod.first)); | |||
| } | |||
| userPathModules.addSeparator(); | |||
| userPathModules.addItem (-2, "Re-scan path"); | |||
| @@ -545,11 +548,13 @@ public: | |||
| allModules.addSubMenu ("Global user modules path", userPathModules); | |||
| // Exporter path | |||
| index = 300; | |||
| PopupMenu exporterPathModules; | |||
| for (auto& mod : project.getExporterPathsModulesList().getAllModules()) | |||
| exporterPathModules.addItem (index++, mod.first, ! enabledModules.isModuleEnabled (mod.first)); | |||
| for (const auto [index, mod] : enumerate (project.getExporterPathsModulesList().getAllModules(), | |||
| 300)) | |||
| { | |||
| exporterPathModules.addItem (index, mod.first, ! enabledModules.isModuleEnabled (mod.first)); | |||
| } | |||
| exporterPathModules.addSeparator(); | |||
| exporterPathModules.addItem (-3, "Re-scan path"); | |||
| @@ -72,11 +72,10 @@ public: | |||
| { | |||
| jassert (columnHeaders.size() == columnWidths.size()); | |||
| auto index = 0; | |||
| for (auto s : columnHeaders) | |||
| for (const auto [index, s] : enumerate (columnHeaders)) | |||
| { | |||
| addAndMakeVisible (headers.add (new Label (s, s))); | |||
| widths.add (columnWidths.getUnchecked (index++)); | |||
| widths.add (columnWidths.getUnchecked ((int) index)); | |||
| } | |||
| recalculateWidths(); | |||
| @@ -55,10 +55,8 @@ struct Factory | |||
| std::array<uint32_t, 2> words; | |||
| size_t index = 0; | |||
| for (auto& word : words) | |||
| word = ByteOrder::bigEndianInt (bytes.data() + 4 * index++); | |||
| for (const auto [index, word] : enumerate (words)) | |||
| word = ByteOrder::bigEndianInt (bytes.data() + 4 * index); | |||
| return PacketX2 { words }; | |||
| } | |||
| @@ -79,10 +77,8 @@ struct Factory | |||
| std::array<uint32_t, 4> words; | |||
| size_t index = 0; | |||
| for (auto& word : words) | |||
| word = ByteOrder::bigEndianInt (bytes.data() + 4 * index++); | |||
| for (const auto [index, word] : enumerate (words)) | |||
| word = ByteOrder::bigEndianInt (bytes.data() + 4 * index); | |||
| return PacketX4 { words }; | |||
| } | |||
| @@ -1759,18 +1759,16 @@ namespace AAXClasses | |||
| if (! bypassPartOfRegularParams) | |||
| juceParameters.addNonOwning (bypassParameter); | |||
| int parameterIndex = 0; | |||
| for (auto* juceParam : juceParameters) | |||
| for (const auto [parameterIndex, juceParam] : enumerate (juceParameters)) | |||
| { | |||
| auto isBypassParameter = (juceParam == bypassParameter); | |||
| auto category = juceParam->getCategory(); | |||
| auto paramID = isBypassParameter ? String (cDefaultMasterBypassID) | |||
| : juceParameters.getParamID (audioProcessor, parameterIndex); | |||
| : juceParameters.getParamID (audioProcessor, (int) parameterIndex); | |||
| aaxParamIDs.add (paramID); | |||
| auto* aaxParamID = aaxParamIDs.getReference (parameterIndex++).toRawUTF8(); | |||
| auto* aaxParamID = aaxParamIDs.getReference ((int) parameterIndex).toRawUTF8(); | |||
| paramMap.set (AAXClasses::getAAXParamHash (aaxParamID), juceParam); | |||
| @@ -251,10 +251,9 @@ private: | |||
| const std::map<LV2_URID, size_t> uridToIndexMap = [&] | |||
| { | |||
| std::map<LV2_URID, size_t> result; | |||
| size_t index = 0; | |||
| for (const auto& urid : indexToUridMap) | |||
| result.emplace (urid, index++); | |||
| for (const auto [index, urid] : enumerate (indexToUridMap)) | |||
| result.emplace (urid, index); | |||
| return result; | |||
| }(); | |||
| @@ -1079,9 +1078,9 @@ private: | |||
| "\tlv2:portProperty lv2:enumeration " << (param.isBoolean() ? ", lv2:toggled " : "") << ";\n" | |||
| "\tlv2:scalePoint "; | |||
| auto counter = 0; | |||
| const auto strings = param.getAllValueStrings(); | |||
| for (const auto& string : param.getAllValueStrings()) | |||
| for (const auto& [counter, string] : enumerate (strings)) | |||
| { | |||
| const auto value = jmap ((float) counter, 0.0f, (float) numSteps - 1.0f, min, max); | |||
| @@ -1089,8 +1088,6 @@ private: | |||
| "\t\trdfs:label \"" << string << "\" ;\n" | |||
| "\t\trdf:value " << value << " ;\n" | |||
| "\t]"; | |||
| ++counter; | |||
| } | |||
| } | |||
| @@ -2231,10 +2231,8 @@ public: | |||
| void initialise (const std::vector<Vst::ParamID>& idsIn) | |||
| { | |||
| Steinberg::int32 index = 0; | |||
| for (const auto& id : idsIn) | |||
| map.emplace (id, Entry { std::make_unique<ParamValueQueue> (id, Steinberg::int32 { index++ }) }); | |||
| for (const auto [index, id] : enumerate (idsIn)) | |||
| map.emplace (id, Entry { std::make_unique<ParamValueQueue> (id, (Steinberg::int32) index) }); | |||
| queues.reserve (map.size()); | |||
| queues.clear(); | |||
| @@ -592,10 +592,8 @@ private: | |||
| void init() | |||
| { | |||
| auto index = 1; | |||
| for (auto& channel : buffers) | |||
| std::fill (channel.begin(), channel.end(), (float) index++); | |||
| for (const auto [index, channel] : enumerate (buffers, 1)) | |||
| std::fill (channel.begin(), channel.end(), (float) index); | |||
| } | |||
| bool allMatch (int channel, float value) const | |||
| @@ -281,9 +281,9 @@ struct Grid::Helpers | |||
| const auto lines = getArrayOfLinesFromTracks (tracks); | |||
| int count = 0; | |||
| for (int i = 0; i < lines.size(); i++) | |||
| for (const auto [index, line] : enumerate (lines)) | |||
| { | |||
| for (const auto& name : lines.getReference (i).lineNames) | |||
| for (const auto& name : line.lineNames) | |||
| { | |||
| if (prop.getName() == name) | |||
| { | |||
| @@ -293,7 +293,7 @@ struct Grid::Helpers | |||
| } | |||
| if (count == prop.getNumber()) | |||
| return i + 1; | |||
| return (int) index + 1; | |||
| } | |||
| jassertfalse; | |||
| @@ -328,9 +328,11 @@ struct Grid::Helpers | |||
| const auto lines = getArrayOfLinesFromTracks (tracks); | |||
| int count = 0; | |||
| for (int i = startLineNumber; i < lines.size(); i++) | |||
| const auto enumerated = enumerate (lines); | |||
| for (const auto [index, line] : makeRange (enumerated.begin() + startLineNumber, enumerated.end())) | |||
| { | |||
| for (const auto& name : lines.getReference (i).lineNames) | |||
| for (const auto& name : line.lineNames) | |||
| { | |||
| if (propertyWithSpan.getName() == name) | |||
| { | |||
| @@ -340,7 +342,7 @@ struct Grid::Helpers | |||
| } | |||
| if (count == propertyWithSpan.getNumber()) | |||
| return i + 1; | |||
| return (int) index + 1; | |||
| } | |||
| jassertfalse; | |||