diff --git a/extras/Projucer/Source/Utility/jucer_ProjucerLookAndFeel.cpp b/extras/Projucer/Source/Utility/jucer_ProjucerLookAndFeel.cpp index 004176e15d..890c549214 100644 --- a/extras/Projucer/Source/Utility/jucer_ProjucerLookAndFeel.cpp +++ b/extras/Projucer/Source/Utility/jucer_ProjucerLookAndFeel.cpp @@ -246,11 +246,11 @@ void ProjucerLookAndFeel::layoutFileBrowserComponent (FileBrowserComponent& brow } void ProjucerLookAndFeel::drawFileBrowserRow (Graphics& g, int width, int height, - const String& filename, Image* icon, + const File& file, const String& filename, Image* icon, const String& fileSizeDescription, const String& fileTimeDescription, - const bool isDirectory, const bool isItemSelected, - const int itemIndex, DirectoryContentsDisplayComponent& dcc) + bool isDirectory, bool isItemSelected, + int itemIndex, DirectoryContentsDisplayComponent& dcc) { if (auto fileListComp = dynamic_cast (&dcc)) { @@ -262,7 +262,7 @@ void ProjucerLookAndFeel::drawFileBrowserRow (Graphics& g, int width, int height } - LookAndFeel_V2::drawFileBrowserRow (g, width, height, filename, icon, + LookAndFeel_V2::drawFileBrowserRow (g, width, height, file, filename, icon, fileSizeDescription, fileTimeDescription, isDirectory, isItemSelected, itemIndex, dcc); } diff --git a/extras/Projucer/Source/Utility/jucer_ProjucerLookAndFeel.h b/extras/Projucer/Source/Utility/jucer_ProjucerLookAndFeel.h index 093284cc48..4922afbba0 100644 --- a/extras/Projucer/Source/Utility/jucer_ProjucerLookAndFeel.h +++ b/extras/Projucer/Source/Utility/jucer_ProjucerLookAndFeel.h @@ -53,7 +53,7 @@ public: void layoutFileBrowserComponent (FileBrowserComponent&, DirectoryContentsDisplayComponent*, FilePreviewComponent*, ComboBox* currentPathBox, TextEditor* filenameBox,Button* goUpButton) override; - void drawFileBrowserRow (Graphics&, int width, int height, const String& filename, Image* icon, + void drawFileBrowserRow (Graphics&, int width, int height, const File&, const String& filename, Image* icon, const String& fileSizeDescription, const String& fileTimeDescription, bool isDirectory, bool isItemSelected, int itemIndex, DirectoryContentsDisplayComponent&) override; diff --git a/modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.h b/modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.h index 1e9b03391f..6d1f159141 100644 --- a/modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.h +++ b/modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.h @@ -195,6 +195,7 @@ public: const String& instructions) = 0; virtual void drawFileBrowserRow (Graphics&, int width, int height, + const File& file, const String& filename, Image* optionalIcon, const String& fileSizeDescription, diff --git a/modules/juce_gui_basics/filebrowser/juce_FileListComponent.cpp b/modules/juce_gui_basics/filebrowser/juce_FileListComponent.cpp index 53baf371c0..4e201007c4 100644 --- a/modules/juce_gui_basics/filebrowser/juce_FileListComponent.cpp +++ b/modules/juce_gui_basics/filebrowser/juce_FileListComponent.cpp @@ -107,7 +107,7 @@ public: void paint (Graphics& g) override { getLookAndFeel().drawFileBrowserRow (g, getWidth(), getHeight(), - file.getFileName(), + file, file.getFileName(), &icon, fileSize, modTime, isDirectory, highlighted, index, owner); diff --git a/modules/juce_gui_basics/filebrowser/juce_FileTreeComponent.cpp b/modules/juce_gui_basics/filebrowser/juce_FileTreeComponent.cpp index fa85bc557d..15bc43a44a 100644 --- a/modules/juce_gui_basics/filebrowser/juce_FileTreeComponent.cpp +++ b/modules/juce_gui_basics/filebrowser/juce_FileTreeComponent.cpp @@ -183,7 +183,7 @@ public: } owner.getLookAndFeel().drawFileBrowserRow (g, width, height, - file.getFileName(), + file, file.getFileName(), &icon, fileSize, modTime, isDirectory, isSelected(), indexInContentsList, owner); diff --git a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.cpp b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.cpp index 072a0fa8d0..678629d7ec 100644 --- a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.cpp +++ b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.cpp @@ -1482,14 +1482,14 @@ Button* LookAndFeel_V2::createSliderButton (Slider&, const bool isIncrement) class LookAndFeel_V2::SliderLabelComp : public Label { public: - SliderLabelComp() : Label (String(), String()) {} + SliderLabelComp() : Label ({}, {}) {} void mouseWheelMove (const MouseEvent&, const MouseWheelDetails&) {} }; Label* LookAndFeel_V2::createSliderTextBox (Slider& slider) { - Label* const l = new SliderLabelComp(); + auto l = new SliderLabelComp(); l->setJustificationType (Justification::centred); l->setKeyboardType (TextInputTarget::decimalKeyboard); @@ -1636,7 +1636,7 @@ void LookAndFeel_V2::layoutFilenameComponent (FilenameComponent& filenameComp, { browseButton->setSize (80, filenameComp.getHeight()); - if (TextButton* const tb = dynamic_cast (browseButton)) + if (auto* tb = dynamic_cast (browseButton)) tb->changeWidthToFitText(); browseButton->setTopRightPosition (filenameComp.getWidth(), 0); @@ -2048,7 +2048,7 @@ int LookAndFeel_V2::getTabButtonBestWidth (TabBarButton& button, int tabDepth) int width = Font (tabDepth * 0.6f).getStringWidth (button.getButtonText().trim()) + getTabButtonOverlap (tabDepth) * 2; - if (Component* const extraComponent = button.getExtraComponent()) + if (auto* extraComponent = button.getExtraComponent()) width += button.getTabbedButtonBar().isVertical() ? extraComponent->getHeight() : extraComponent->getWidth(); @@ -2059,7 +2059,7 @@ Rectangle LookAndFeel_V2::getTabButtonExtraComponentBounds (const TabBarBut { Rectangle extraComp; - const TabbedButtonBar::Orientation orientation = button.getTabbedButtonBar().getOrientation(); + auto orientation = button.getTabbedButtonBar().getOrientation(); if (button.getExtraComponentPlacement() == TabBarButton::beforeText) { @@ -2089,7 +2089,7 @@ Rectangle LookAndFeel_V2::getTabButtonExtraComponentBounds (const TabBarBut void LookAndFeel_V2::createTabButtonShape (TabBarButton& button, Path& p, bool /*isMouseOver*/, bool /*isMouseDown*/) { - const Rectangle activeArea (button.getActiveArea()); + auto activeArea = button.getActiveArea(); const float w = (float) activeArea.getWidth(); const float h = (float) activeArea.getHeight(); @@ -2149,7 +2149,7 @@ void LookAndFeel_V2::createTabButtonShape (TabBarButton& button, Path& p, bool / void LookAndFeel_V2::fillTabButtonShape (TabBarButton& button, Graphics& g, const Path& path, bool /*isMouseOver*/, bool /*isMouseDown*/) { - const Colour tabBackground (button.getTabBackgroundColour()); + auto tabBackground = button.getTabBackgroundColour(); const bool isFrontTab = button.isFrontTab(); g.setColour (isFrontTab ? tabBackground @@ -2491,7 +2491,7 @@ AttributedString LookAndFeel_V2::createFileChooserHeaderText (const String& titl AttributedString s; s.setJustification (Justification::centred); - const Colour colour (findColour (FileChooserDialogBox::titleTextColourId)); + auto colour = findColour (FileChooserDialogBox::titleTextColourId); s.append (title + "\n\n", Font (17.0f, Font::bold), colour); s.append (instructions, Font (14.0f), colour); @@ -2499,13 +2499,13 @@ AttributedString LookAndFeel_V2::createFileChooserHeaderText (const String& titl } void LookAndFeel_V2::drawFileBrowserRow (Graphics& g, int width, int height, - const String& filename, Image* icon, + const File&, const String& filename, Image* icon, const String& fileSizeDescription, const String& fileTimeDescription, - const bool isDirectory, const bool isItemSelected, - const int /*itemIndex*/, DirectoryContentsDisplayComponent& dcc) + bool isDirectory, bool isItemSelected, + int /*itemIndex*/, DirectoryContentsDisplayComponent& dcc) { - Component* const fileListComp = dynamic_cast (&dcc); + auto fileListComp = dynamic_cast (&dcc); if (isItemSelected) g.fillAll (fileListComp != nullptr ? fileListComp->findColour (DirectoryContentsDisplayComponent::highlightColourId) @@ -2522,8 +2522,8 @@ void LookAndFeel_V2::drawFileBrowserRow (Graphics& g, int width, int height, } else { - if (const Drawable* d = isDirectory ? getDefaultFolderImage() - : getDefaultDocumentFileImage()) + if (auto* d = isDirectory ? getDefaultFolderImage() + : getDefaultDocumentFileImage()) d->drawWithin (g, Rectangle (2.0f, 2.0f, x - 4.0f, height - 4.0f), RectanglePlacement::centred | RectanglePlacement::onlyReduceInSize, 1.0f); } @@ -2566,10 +2566,10 @@ void LookAndFeel_V2::drawFileBrowserRow (Graphics& g, int width, int height, Button* LookAndFeel_V2::createFileBrowserGoUpButton() { - DrawableButton* goUpButton = new DrawableButton ("up", DrawableButton::ImageOnButtonBackground); + auto goUpButton = new DrawableButton ("up", DrawableButton::ImageOnButtonBackground); Path arrowPath; - arrowPath.addArrow (Line (50.0f, 100.0f, 50.0f, 0.0f), 40.0f, 100.0f, 50.0f); + arrowPath.addArrow ({ 50.0f, 100.0f, 50.0f, 0.0f }, 40.0f, 100.0f, 50.0f); DrawablePath arrowImage; arrowImage.setFill (Colours::black.withAlpha (0.4f)); @@ -2588,11 +2588,11 @@ void LookAndFeel_V2::layoutFileBrowserComponent (FileBrowserComponent& browserCo Button* goUpButton) { const int x = 8; - int w = browserComp.getWidth() - x - x; + auto w = browserComp.getWidth() - x - x; if (previewComp != nullptr) { - const int previewWidth = w / 3; + auto previewWidth = w / 3; previewComp->setBounds (x + w - previewWidth, 0, previewWidth, browserComp.getHeight()); w -= previewWidth + 4; @@ -2609,7 +2609,7 @@ void LookAndFeel_V2::layoutFileBrowserComponent (FileBrowserComponent& browserCo y += controlsHeight + 4; - if (Component* const listAsComp = dynamic_cast (fileListComponent)) + if (auto listAsComp = dynamic_cast (fileListComponent)) { listAsComp->setBounds (x, y, w, browserComp.getHeight() - y - bottomSectionHeight); y = listAsComp->getBottom() + 4; diff --git a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.h b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.h index bc11dd7982..2b84d819b2 100644 --- a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.h +++ b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.h @@ -129,7 +129,7 @@ public: AttributedString createFileChooserHeaderText (const String& title, const String& instructions) override; void drawFileBrowserRow (Graphics&, int width, int height, - const String& filename, Image* icon, + const File& file, const String& filename, Image* icon, const String& fileSizeDescription, const String& fileTimeDescription, bool isDirectory, bool isItemSelected, int itemIndex, DirectoryContentsDisplayComponent&) override; diff --git a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V4.cpp b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V4.cpp index a0d86faa4d..7c6bba5c27 100644 --- a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V4.cpp +++ b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V4.cpp @@ -724,18 +724,18 @@ void LookAndFeel_V4::layoutFileBrowserComponent (FileBrowserComponent& browserCo } void LookAndFeel_V4::drawFileBrowserRow (Graphics& g, int width, int height, - const String& filename, Image* icon, + const File& file, const String& filename, Image* icon, const String& fileSizeDescription, const String& fileTimeDescription, - const bool isDirectory, const bool isItemSelected, - const int itemIndex, DirectoryContentsDisplayComponent& dcc) + bool isDirectory, bool isItemSelected, + int itemIndex, DirectoryContentsDisplayComponent& dcc) { if (auto fileListComp = dynamic_cast (&dcc)) fileListComp->setColour (DirectoryContentsDisplayComponent::textColourId, currentColourScheme.getUIColour (isItemSelected ? ColourScheme::UIColour::highlightedText : ColourScheme::UIColour::menuText)); - LookAndFeel_V2::drawFileBrowserRow (g, width, height, filename, icon, + LookAndFeel_V2::drawFileBrowserRow (g, width, height, file, filename, icon, fileSizeDescription, fileTimeDescription, isDirectory, isItemSelected, itemIndex, dcc); } diff --git a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V4.h b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V4.h index fead65aec4..76b1371f98 100644 --- a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V4.h +++ b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V4.h @@ -155,7 +155,7 @@ public: Button* goUpButton) override; void drawFileBrowserRow (Graphics&, int width, int height, - const String& filename, Image* icon, + const File& file, const String& filename, Image* icon, const String& fileSizeDescription, const String& fileTimeDescription, bool isDirectory, bool isItemSelected, int itemIndex, DirectoryContentsDisplayComponent&) override;