From 9fde239d9c864ef5a1e0de7f6744ee6098f3316e Mon Sep 17 00:00:00 2001 From: jules Date: Sat, 8 Sep 2012 11:31:51 +0100 Subject: [PATCH] Misc minor tidying up. --- .../jucer_ProjectExport_Android.h | 3 +- .../Project Saving/jucer_ProjectExport_MSVC.h | 12 +-- .../Project Saving/jucer_ProjectExport_Make.h | 3 +- .../jucer_ProjectExport_XCode.h | 10 +- .../Project Saving/jucer_ProjectSaver.h | 16 +-- .../Project/jucer_GroupInformationComponent.h | 8 +- .../Source/Project/jucer_ModulesPanel.h | 30 +++--- .../Source/Utility/jucer_JucerTreeViewBase.h | 2 +- .../Source/Utility/jucer_MiscUtilities.h | 16 +-- .../Source/Utility/jucer_RelativePath.h | 8 +- modules/juce_core/time/juce_RelativeTime.cpp | 98 ++++++------------- .../native/juce_RenderingHelpers.h | 93 +++++++++--------- .../widgets/juce_TextEditor.cpp | 92 ++++++++--------- 13 files changed, 172 insertions(+), 219 deletions(-) diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Android.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Android.h index 9b186c6454..0f1c981d98 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Android.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Android.h @@ -46,8 +46,7 @@ public: } //============================================================================== - AndroidProjectExporter (Project& project_, const ValueTree& settings_) - : ProjectExporter (project_, settings_) + AndroidProjectExporter (Project& p, const ValueTree& t) : ProjectExporter (p, t) { name = getNameAndroid(); diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h index f4106d45f5..f6793ac162 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_MSVC.h @@ -33,8 +33,8 @@ class MSVCProjectExporterBase : public ProjectExporter { public: - MSVCProjectExporterBase (Project& project_, const ValueTree& settings_, const char* const folderName) - : ProjectExporter (project_, settings_) + MSVCProjectExporterBase (Project& p, const ValueTree& t, const char* const folderName) + : ProjectExporter (p, t) { if (getTargetLocationString().isEmpty()) getTargetLocationValue() = getDefaultBuildsRootFolder() + folderName; @@ -863,8 +863,8 @@ protected: class MSVCProjectExporterVC2005 : public MSVCProjectExporterVC2008 { public: - MSVCProjectExporterVC2005 (Project& project_, const ValueTree& settings_) - : MSVCProjectExporterVC2008 (project_, settings_, "VisualStudio2005") + MSVCProjectExporterVC2005 (Project& p, const ValueTree& t) + : MSVCProjectExporterVC2008 (p, t, "VisualStudio2005") { name = getName(); } @@ -892,8 +892,8 @@ protected: class MSVCProjectExporterVC2010 : public MSVCProjectExporterBase { public: - MSVCProjectExporterVC2010 (Project& project_, const ValueTree& settings_) - : MSVCProjectExporterBase (project_, settings_, "VisualStudio2010") + MSVCProjectExporterVC2010 (Project& p, const ValueTree& t) + : MSVCProjectExporterBase (p, t, "VisualStudio2010") { name = getName(); } diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Make.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Make.h index 5ae099396e..08f472fb3d 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Make.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_Make.h @@ -47,8 +47,7 @@ public: //============================================================================== - MakefileProjectExporter (Project& project_, const ValueTree& settings_) - : ProjectExporter (project_, settings_) + MakefileProjectExporter (Project& p, const ValueTree& t) : ProjectExporter (p, t) { name = getNameLinux(); diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h index 71f82034b2..90a28d5c87 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h @@ -53,9 +53,9 @@ public: static const char* getValueTreeTypeName (bool iOS) { return iOS ? "XCODE_IPHONE" : "XCODE_MAC"; } //============================================================================== - XCodeProjectExporter (Project& project_, const ValueTree& settings_, const bool iOS_) - : ProjectExporter (project_, settings_), - iOS (iOS_) + XCodeProjectExporter (Project& p, const ValueTree& t, const bool isIOS) + : ProjectExporter (p, t), + iOS (isIOS) { name = iOS ? getNameiOS() : getNameMac(); @@ -176,8 +176,8 @@ protected: class XcodeBuildConfiguration : public BuildConfiguration { public: - XcodeBuildConfiguration (Project& project, const ValueTree& settings, const bool iOS_) - : BuildConfiguration (project, settings), iOS (iOS_) + XcodeBuildConfiguration (Project& p, const ValueTree& t, const bool isIOS) + : BuildConfiguration (p, t), iOS (isIOS) { if (iOS) { diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectSaver.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectSaver.h index a2c5b96e2b..af2fa3a4fe 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectSaver.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectSaver.h @@ -35,9 +35,9 @@ class ProjectSaver { public: - ProjectSaver (Project& project_, const File& projectFile_) - : project (project_), - projectFile (projectFile_), + ProjectSaver (Project& p, const File& file) + : project (p), + projectFile (file), generatedCodeFolder (project.getGeneratedCodeFolder()), generatedFilesGroup (Project::Item::createGroup (project, getJuceCodeGroupName(), "__generatedcode__")) { @@ -49,9 +49,9 @@ public: struct SaveThread : public ThreadWithProgressWindow { public: - SaveThread (ProjectSaver& saver_) + SaveThread (ProjectSaver& ps) : ThreadWithProgressWindow ("Saving...", true, false), - saver (saver_), result (Result::ok()) + saver (ps), result (Result::ok()) {} void run() @@ -567,10 +567,10 @@ private: class ExporterJob : public ThreadPoolJob { public: - ExporterJob (ProjectSaver& owner_, ProjectExporter* exporter_, - const OwnedArray& modules_) + ExporterJob (ProjectSaver& ps, ProjectExporter* pe, + const OwnedArray& moduleList) : ThreadPoolJob ("export"), - owner (owner_), exporter (exporter_), modules (modules_) + owner (ps), exporter (pe), modules (moduleList) { } diff --git a/extras/Introjucer/Source/Project/jucer_GroupInformationComponent.h b/extras/Introjucer/Source/Project/jucer_GroupInformationComponent.h index d35642ef41..58f358cc77 100644 --- a/extras/Introjucer/Source/Project/jucer_GroupInformationComponent.h +++ b/extras/Introjucer/Source/Project/jucer_GroupInformationComponent.h @@ -37,8 +37,8 @@ class GroupInformationComponent : public Component, { public: //============================================================================== - GroupInformationComponent (const Project::Item& item_) - : item (item_) + GroupInformationComponent (const Project::Item& group) + : item (group) { list.setModel (this); list.setColour (ListBox::backgroundColourId, Colours::transparentBlack); @@ -113,8 +113,8 @@ private: class FileOptionComponent : public Component { public: - FileOptionComponent (const Project::Item& item_) - : item (item_), + FileOptionComponent (const Project::Item& fileItem) + : item (fileItem), compileButton ("Compile"), resourceButton ("Add to Binary Resources") { diff --git a/extras/Introjucer/Source/Project/jucer_ModulesPanel.h b/extras/Introjucer/Source/Project/jucer_ModulesPanel.h index aa548b318c..53b4d12d29 100644 --- a/extras/Introjucer/Source/Project/jucer_ModulesPanel.h +++ b/extras/Introjucer/Source/Project/jucer_ModulesPanel.h @@ -32,16 +32,16 @@ class ModulesPanel : public PropertyComponent, public ButtonListener { public: - ModulesPanel (Project& project_) + ModulesPanel (Project& p) : PropertyComponent ("Modules", 500), - project (project_), + project (p), modulesLocation ("modules", ModuleList::getLocalModulesFolder (&project), true, true, false, "*", String::empty, "Select a folder containing your JUCE modules..."), modulesLabel (String::empty, "Module source folder:"), updateModulesButton ("Check for module updates..."), moduleListBox (moduleList), - copyingMessage (project_, moduleList) + copyingMessage (p, moduleList) { moduleList.rescan (ModuleList::getLocalModulesFolder (&project)); @@ -138,17 +138,17 @@ public: public ListBoxModel { public: - ModuleSelectionListBox (ModuleList& list_) - : list (list_), owner (nullptr) + ModuleSelectionListBox (ModuleList& ml) + : list (ml), owner (nullptr) { setColour (ListBox::backgroundColourId, Colours::white.withAlpha (0.4f)); setTooltip ("Use this list to select which modules should be included in your app.\n" "Any modules which have missing dependencies will be shown in red."); } - void setOwner (ModulesPanel* owner_) + void setOwner (ModulesPanel* newOwner) { - owner = owner_; + owner = newOwner; setModel (this); } @@ -225,8 +225,8 @@ public: class ModuleSettingsPanel : public PropertyPanel { public: - ModuleSettingsPanel (Project& project_, ModuleList& moduleList_, const String& moduleID_) - : project (project_), moduleList (moduleList_), moduleID (moduleID_) + ModuleSettingsPanel (Project& p, ModuleList& list, const String& modID) + : project (p), moduleList (list), moduleID (modID) { refreshAll(); } @@ -296,8 +296,8 @@ public: class ModuleInfoComponent : public PropertyComponent { public: - ModuleInfoComponent (Project& project_, ModuleList& moduleList_, const String& moduleID_) - : PropertyComponent ("Module", 100), project (project_), moduleList (moduleList_), moduleID (moduleID_) + ModuleInfoComponent (Project& p, ModuleList& list, const String& modID) + : PropertyComponent ("Module", 100), project (p), moduleList (list), moduleID (modID) { } @@ -336,9 +336,9 @@ public: public ButtonListener { public: - MissingDependenciesComponent (Project& project_, ModuleList& moduleList_, const String& moduleID_) + MissingDependenciesComponent (Project& p, ModuleList& list, const String& modID) : PropertyComponent ("Dependencies", 100), - project (project_), moduleList (moduleList_), moduleID (moduleID_), + project (p), moduleList (list), moduleID (modID), fixButton ("Enable Required Modules") { const ModuleList::Module* module = moduleList.findModuleInfo (moduleID); @@ -402,8 +402,8 @@ public: public Timer { public: - ModuleCopyingInfo (Project& project_, ModuleList& list_) - : project (project_), list (list_), + ModuleCopyingInfo (Project& p, ModuleList& modules) + : project (p), list (modules), copyModeButton ("Set Copying Mode...") { addAndMakeVisible (©ModeButton); diff --git a/extras/Introjucer/Source/Utility/jucer_JucerTreeViewBase.h b/extras/Introjucer/Source/Utility/jucer_JucerTreeViewBase.h index 97f1a7bc21..675a2e55a7 100644 --- a/extras/Introjucer/Source/Utility/jucer_JucerTreeViewBase.h +++ b/extras/Introjucer/Source/Utility/jucer_JucerTreeViewBase.h @@ -184,7 +184,7 @@ private: class TreeItemComponent : public Component { public: - TreeItemComponent (JucerTreeViewBase& item_) : item (item_) + TreeItemComponent (JucerTreeViewBase& i) : item (i) { setInterceptsMouseClicks (false, true); } diff --git a/extras/Introjucer/Source/Utility/jucer_MiscUtilities.h b/extras/Introjucer/Source/Utility/jucer_MiscUtilities.h index 45a148b221..e11d6c41cd 100644 --- a/extras/Introjucer/Source/Utility/jucer_MiscUtilities.h +++ b/extras/Introjucer/Source/Utility/jucer_MiscUtilities.h @@ -224,12 +224,12 @@ class PopupColourSelector : public Component, public ButtonListener { public: - PopupColourSelector (const Value& colourValue_, - const Colour& defaultColour_, + PopupColourSelector (const Value& colour, + const Colour& defaultCol, const bool canResetToDefault) : defaultButton ("Reset to Default"), - colourValue (colourValue_), - defaultColour (defaultColour_) + colourValue (colour), + defaultColour (defaultCol) { addAndMakeVisible (&selector); selector.setName ("Colour"); @@ -312,10 +312,10 @@ class ColourEditorComponent : public Component, public Value::Listener { public: - ColourEditorComponent (UndoManager* undoManager_, const Value& colourValue_, - const Colour& defaultColour_, const bool canResetToDefault_) - : undoManager (undoManager_), colourValue (colourValue_), defaultColour (defaultColour_), - canResetToDefault (canResetToDefault_) + ColourEditorComponent (UndoManager* um, const Value& colour, + const Colour& defaultCol, const bool canReset) + : undoManager (um), colourValue (colour), defaultColour (defaultCol), + canResetToDefault (canReset) { colourValue.addListener (this); } diff --git a/extras/Introjucer/Source/Utility/jucer_RelativePath.h b/extras/Introjucer/Source/Utility/jucer_RelativePath.h index 481bac02a0..163e1e1f73 100644 --- a/extras/Introjucer/Source/Utility/jucer_RelativePath.h +++ b/extras/Introjucer/Source/Utility/jucer_RelativePath.h @@ -47,13 +47,13 @@ public: : root (unknown) {} - RelativePath (const String& path_, const RootFolder root_) - : path (FileHelpers::unixStylePath (path_)), root (root_) + RelativePath (const String& relPath, const RootFolder rootType) + : path (FileHelpers::unixStylePath (relPath)), root (rootType) { } - RelativePath (const File& file, const File& rootFolder, const RootFolder root_) - : path (FileHelpers::unixStylePath (FileHelpers::getRelativePathFrom (file, rootFolder))), root (root_) + RelativePath (const File& file, const File& rootFolder, const RootFolder rootType) + : path (FileHelpers::unixStylePath (FileHelpers::getRelativePathFrom (file, rootFolder))), root (rootType) { } diff --git a/modules/juce_core/time/juce_RelativeTime.cpp b/modules/juce_core/time/juce_RelativeTime.cpp index 378ad4e05f..9b03841166 100644 --- a/modules/juce_core/time/juce_RelativeTime.cpp +++ b/modules/juce_core/time/juce_RelativeTime.cpp @@ -23,19 +23,9 @@ ============================================================================== */ -RelativeTime::RelativeTime (const double seconds_) noexcept - : seconds (seconds_) -{ -} - -RelativeTime::RelativeTime (const RelativeTime& other) noexcept - : seconds (other.seconds) -{ -} - -RelativeTime::~RelativeTime() noexcept -{ -} +RelativeTime::RelativeTime (const double secs) noexcept : seconds (secs) {} +RelativeTime::RelativeTime (const RelativeTime& other) noexcept : seconds (other.seconds) {} +RelativeTime::~RelativeTime() noexcept {} //============================================================================== const RelativeTime RelativeTime::milliseconds (const int milliseconds) noexcept { return RelativeTime (milliseconds * 0.001); } @@ -52,6 +42,24 @@ double RelativeTime::inHours() const noexcept { return seconds / (60.0 * 6 double RelativeTime::inDays() const noexcept { return seconds / (60.0 * 60.0 * 24.0); } double RelativeTime::inWeeks() const noexcept { return seconds / (60.0 * 60.0 * 24.0 * 7.0); } +//============================================================================== +RelativeTime& RelativeTime::operator= (const RelativeTime& other) noexcept { seconds = other.seconds; return *this; } + +const RelativeTime& RelativeTime::operator+= (const RelativeTime& t) noexcept { seconds += t.seconds; return *this; } +const RelativeTime& RelativeTime::operator-= (const RelativeTime& t) noexcept { seconds -= t.seconds; return *this; } +const RelativeTime& RelativeTime::operator+= (const double secs) noexcept { seconds += secs; return *this; } +const RelativeTime& RelativeTime::operator-= (const double secs) noexcept { seconds -= secs; return *this; } + +RelativeTime operator+ (const RelativeTime& t1, const RelativeTime& t2) noexcept { RelativeTime t (t1); return t += t2; } +RelativeTime operator- (const RelativeTime& t1, const RelativeTime& t2) noexcept { RelativeTime t (t1); return t -= t2; } + +bool operator== (const RelativeTime& t1, const RelativeTime& t2) noexcept { return t1.inSeconds() == t2.inSeconds(); } +bool operator!= (const RelativeTime& t1, const RelativeTime& t2) noexcept { return t1.inSeconds() != t2.inSeconds(); } +bool operator> (const RelativeTime& t1, const RelativeTime& t2) noexcept { return t1.inSeconds() > t2.inSeconds(); } +bool operator< (const RelativeTime& t1, const RelativeTime& t2) noexcept { return t1.inSeconds() < t2.inSeconds(); } +bool operator>= (const RelativeTime& t1, const RelativeTime& t2) noexcept { return t1.inSeconds() >= t2.inSeconds(); } +bool operator<= (const RelativeTime& t1, const RelativeTime& t2) noexcept { return t1.inSeconds() <= t2.inSeconds(); } + //============================================================================== String RelativeTime::getDescription (const String& returnValueForZeroTime) const { @@ -68,16 +76,16 @@ String RelativeTime::getDescription (const String& returnValueForZeroTime) const int n = std::abs ((int) inWeeks()); if (n > 0) { - result << n << (n == 1 ? TRANS(" week ") - : TRANS(" weeks ")); + result << n << TRANS (n == 1 ? " week " + : " weeks "); ++fieldsShown; } n = std::abs ((int) inDays()) % 7; if (n > 0) { - result << n << (n == 1 ? TRANS(" day ") - : TRANS(" days ")); + result << n << TRANS (n == 1 ? " day " + : " days "); ++fieldsShown; } @@ -86,8 +94,8 @@ String RelativeTime::getDescription (const String& returnValueForZeroTime) const n = std::abs ((int) inHours()) % 24; if (n > 0) { - result << n << (n == 1 ? TRANS(" hr ") - : TRANS(" hrs ")); + result << n << TRANS (n == 1 ? " hr " + : " hrs "); ++fieldsShown; } @@ -96,8 +104,8 @@ String RelativeTime::getDescription (const String& returnValueForZeroTime) const n = std::abs ((int) inMinutes()) % 60; if (n > 0) { - result << n << (n == 1 ? TRANS(" min ") - : TRANS(" mins ")); + result << n << TRANS (n == 1 ? " min " + : " mins "); ++fieldsShown; } @@ -106,8 +114,8 @@ String RelativeTime::getDescription (const String& returnValueForZeroTime) const n = std::abs ((int) inSeconds()) % 60; if (n > 0) { - result << n << (n == 1 ? TRANS(" sec ") - : TRANS(" secs ")); + result << n << TRANS (n == 1 ? " sec " + : " secs "); ++fieldsShown; } @@ -115,7 +123,7 @@ String RelativeTime::getDescription (const String& returnValueForZeroTime) const { n = std::abs ((int) inMilliseconds()) % 1000; if (n > 0) - result << n << TRANS(" ms"); + result << n << TRANS (" ms"); } } } @@ -123,45 +131,3 @@ String RelativeTime::getDescription (const String& returnValueForZeroTime) const return result.trimEnd(); } - -//============================================================================== -RelativeTime& RelativeTime::operator= (const RelativeTime& other) noexcept -{ - seconds = other.seconds; - return *this; -} - -//============================================================================== -const RelativeTime& RelativeTime::operator+= (const RelativeTime& timeToAdd) noexcept -{ - seconds += timeToAdd.seconds; - return *this; -} - -const RelativeTime& RelativeTime::operator-= (const RelativeTime& timeToSubtract) noexcept -{ - seconds -= timeToSubtract.seconds; - return *this; -} - -const RelativeTime& RelativeTime::operator+= (const double secondsToAdd) noexcept -{ - seconds += secondsToAdd; - return *this; -} - -const RelativeTime& RelativeTime::operator-= (const double secondsToSubtract) noexcept -{ - seconds -= secondsToSubtract; - return *this; -} - -bool operator== (const RelativeTime& t1, const RelativeTime& t2) noexcept { return t1.inSeconds() == t2.inSeconds(); } -bool operator!= (const RelativeTime& t1, const RelativeTime& t2) noexcept { return t1.inSeconds() != t2.inSeconds(); } -bool operator> (const RelativeTime& t1, const RelativeTime& t2) noexcept { return t1.inSeconds() > t2.inSeconds(); } -bool operator< (const RelativeTime& t1, const RelativeTime& t2) noexcept { return t1.inSeconds() < t2.inSeconds(); } -bool operator>= (const RelativeTime& t1, const RelativeTime& t2) noexcept { return t1.inSeconds() >= t2.inSeconds(); } -bool operator<= (const RelativeTime& t1, const RelativeTime& t2) noexcept { return t1.inSeconds() <= t2.inSeconds(); } - -RelativeTime operator+ (const RelativeTime& t1, const RelativeTime& t2) noexcept { RelativeTime t (t1); return t += t2; } -RelativeTime operator- (const RelativeTime& t1, const RelativeTime& t2) noexcept { RelativeTime t (t1); return t -= t2; } diff --git a/modules/juce_graphics/native/juce_RenderingHelpers.h b/modules/juce_graphics/native/juce_RenderingHelpers.h index 492ba56389..838b4f074b 100644 --- a/modules/juce_graphics/native/juce_RenderingHelpers.h +++ b/modules/juce_graphics/native/juce_RenderingHelpers.h @@ -40,8 +40,8 @@ namespace RenderingHelpers class TranslationOrTransform { public: - TranslationOrTransform (int xOffset_, int yOffset_) noexcept - : xOffset (xOffset_), yOffset (yOffset_), isOnlyTranslated (true) + TranslationOrTransform (int x, int y) noexcept + : xOffset (x), yOffset (y), isOnlyTranslated (true) { } @@ -393,11 +393,11 @@ namespace GradientPixelIterators { public: Linear (const ColourGradient& gradient, const AffineTransform& transform, - const PixelARGB* const lookupTable_, const int numEntries_) - : lookupTable (lookupTable_), - numEntries (numEntries_) + const PixelARGB* const colours, const int numColours) + : lookupTable (colours), + numEntries (numColours) { - jassert (numEntries_ >= 0); + jassert (numColours >= 0); Point p1 (gradient.point1); Point p2 (gradient.point2); @@ -467,13 +467,13 @@ namespace GradientPixelIterators { public: Radial (const ColourGradient& gradient, const AffineTransform&, - const PixelARGB* const lookupTable_, const int numEntries_) - : lookupTable (lookupTable_), - numEntries (numEntries_), + const PixelARGB* const colours, const int numColours) + : lookupTable (colours), + numEntries (numColours), gx1 (gradient.point1.x), gy1 (gradient.point1.y) { - jassert (numEntries_ >= 0); + jassert (numColours >= 0); const Point diff (gradient.point1 - gradient.point2); maxDist = diff.x * diff.x + diff.y * diff.y; invScale = numEntries / std::sqrt (maxDist); @@ -510,8 +510,8 @@ namespace GradientPixelIterators { public: TransformedRadial (const ColourGradient& gradient, const AffineTransform& transform, - const PixelARGB* const lookupTable_, const int numEntries_) - : Radial (gradient, transform, lookupTable_, numEntries_), + const PixelARGB* const colours, const int numColours) + : Radial (gradient, transform, colours, numColours), inverseTransform (transform.inverted()) { tM10 = inverseTransform.mat10; @@ -555,9 +555,8 @@ namespace EdgeTableFillers class SolidColour { public: - SolidColour (const Image::BitmapData& data_, const PixelARGB& colour) - : data (data_), - sourceColour (colour) + SolidColour (const Image::BitmapData& image, const PixelARGB& colour) + : data (image), sourceColour (colour) { if (sizeof (PixelType) == 3 && data.pixelStride == sizeof (PixelType)) { @@ -727,10 +726,10 @@ namespace EdgeTableFillers class Gradient : public GradientType { public: - Gradient (const Image::BitmapData& destData_, const ColourGradient& gradient, const AffineTransform& transform, - const PixelARGB* const lookupTable_, const int numEntries_) - : GradientType (gradient, transform, lookupTable_, numEntries_ - 1), - destData (destData_) + Gradient (const Image::BitmapData& dest, const ColourGradient& gradient, const AffineTransform& transform, + const PixelARGB* const colours, const int numColours) + : GradientType (gradient, transform, colours, numColours - 1), + destData (dest) { } @@ -808,13 +807,13 @@ namespace EdgeTableFillers class ImageFill { public: - ImageFill (const Image::BitmapData& destData_, const Image::BitmapData& srcData_, - const int extraAlpha_, const int x, const int y) - : destData (destData_), - srcData (srcData_), - extraAlpha (extraAlpha_ + 1), - xOffset (repeatPattern ? negativeAwareModulo (x, srcData_.width) - srcData_.width : x), - yOffset (repeatPattern ? negativeAwareModulo (y, srcData_.height) - srcData_.height : y) + ImageFill (const Image::BitmapData& dest, const Image::BitmapData& src, + const int alpha, const int x, const int y) + : destData (dest), + srcData (src), + extraAlpha (alpha + 1), + xOffset (repeatPattern ? negativeAwareModulo (x, src.width) - src.width : x), + yOffset (repeatPattern ? negativeAwareModulo (y, src.height) - src.height : y) { } @@ -969,17 +968,17 @@ namespace EdgeTableFillers class TransformedImageFill { public: - TransformedImageFill (const Image::BitmapData& destData_, const Image::BitmapData& srcData_, - const AffineTransform& transform, const int extraAlpha_, const bool betterQuality_) + TransformedImageFill (const Image::BitmapData& dest, const Image::BitmapData& src, + const AffineTransform& transform, const int alpha, const bool higherQuality) : interpolator (transform, - betterQuality_ ? 0.5f : 0.0f, - betterQuality_ ? -128 : 0), - destData (destData_), - srcData (srcData_), - extraAlpha (extraAlpha_ + 1), - betterQuality (betterQuality_), - maxX (srcData_.width - 1), - maxY (srcData_.height - 1), + higherQuality ? 0.5f : 0.0f, + higherQuality ? -128 : 0), + destData (dest), + srcData (src), + extraAlpha (alpha + 1), + betterQuality (higherQuality), + maxX (src.width - 1), + maxY (src.height - 1), scratchSize (2048) { scratchBuffer.malloc (scratchSize); @@ -1353,9 +1352,9 @@ namespace EdgeTableFillers { public: TransformedImageSpanInterpolator (const AffineTransform& transform, - const float pixelOffset_, const int pixelOffsetInt_) noexcept + const float offsetFloat, const int offsetInt) noexcept : inverseTransform (transform.inverted()), - pixelOffset (pixelOffset_), pixelOffsetInt (pixelOffsetInt_) + pixelOffset (offsetFloat), pixelOffsetInt (offsetInt) {} void setStartOfLine (float x, float y, const int numPixels) noexcept @@ -1971,8 +1970,8 @@ namespace ClipRegions class SubRectangleIterator { public: - SubRectangleIterator (const RectangleList& clip_, const Rectangle& area_) - : clip (clip_), area (area_) + SubRectangleIterator (const RectangleList& clipList, const Rectangle& clipBounds) + : clip (clipList), area (clipBounds) {} template @@ -2010,8 +2009,8 @@ namespace ClipRegions class SubRectangleIteratorFloat { public: - SubRectangleIteratorFloat (const RectangleList& clip_, const Rectangle& area_) noexcept - : clip (clip_), area (area_) + SubRectangleIteratorFloat (const RectangleList& clipList, const Rectangle& clipBounds) noexcept + : clip (clipList), area (clipBounds) { } @@ -2107,17 +2106,17 @@ namespace ClipRegions class SoftwareRendererSavedState { public: - SoftwareRendererSavedState (const Image& image_, const Rectangle& clip_) - : image (image_), clip (new ClipRegions::RectangleListRegion (clip_)), + SoftwareRendererSavedState (const Image& im, const Rectangle& clipBounds) + : image (im), clip (new ClipRegions::RectangleListRegion (clipBounds)), transform (0, 0), interpolationQuality (Graphics::mediumResamplingQuality), transparencyLayerAlpha (1.0f) { } - SoftwareRendererSavedState (const Image& image_, const RectangleList& clip_, const int xOffset_, const int yOffset_) - : image (image_), clip (new ClipRegions::RectangleListRegion (clip_)), - transform (xOffset_, yOffset_), + SoftwareRendererSavedState (const Image& im, const RectangleList& clipList, const int x, const int y) + : image (im), clip (new ClipRegions::RectangleListRegion (clipList)), + transform (x, y), interpolationQuality (Graphics::mediumResamplingQuality), transparencyLayerAlpha (1.0f) { diff --git a/modules/juce_gui_basics/widgets/juce_TextEditor.cpp b/modules/juce_gui_basics/widgets/juce_TextEditor.cpp index ba10fc3e34..e502aa28ff 100644 --- a/modules/juce_gui_basics/widgets/juce_TextEditor.cpp +++ b/modules/juce_gui_basics/widgets/juce_TextEditor.cpp @@ -60,19 +60,14 @@ struct TextAtom class TextEditor::UniformTextSection { public: - UniformTextSection (const String& text, - const Font& font_, - const Colour& colour_, - const juce_wchar passwordCharacter) - : font (font_), - colour (colour_) + UniformTextSection (const String& text, const Font& f, const Colour& col, const juce_wchar passwordChar) + : font (f), colour (col) { - initialiseAtoms (text, passwordCharacter); + initialiseAtoms (text, passwordChar); } UniformTextSection (const UniformTextSection& other) - : font (other.font), - colour (other.colour) + : font (other.font), colour (other.colour) { atoms.ensureStorageAllocated (other.atoms.size()); @@ -80,10 +75,7 @@ public: atoms.add (new TextAtom (*other.atoms.getUnchecked(i))); } - ~UniformTextSection() - { - // (no need to delete the atoms, as they're explicitly deleted by the caller) - } + ~UniformTextSection() {} // (no need to delete the atoms, as they're explicitly deleted by the caller) void clear() { @@ -320,9 +312,9 @@ private: class TextEditor::Iterator { public: - Iterator (const Array & sections_, - const float wordWrapWidth_, - const juce_wchar passwordCharacter_) + Iterator (const Array & sectionList, + const float wrapWidth, + const juce_wchar passwordChar) : indexInText (0), lineY (0), lineHeight (0), @@ -331,13 +323,13 @@ public: atomRight (0), atom (0), currentSection (nullptr), - sections (sections_), + sections (sectionList), sectionIndex (0), atomIndex (0), - wordWrapWidth (wordWrapWidth_), - passwordCharacter (passwordCharacter_) + wordWrapWidth (wrapWidth), + passwordCharacter (passwordChar) { - jassert (wordWrapWidth_ > 0); + jassert (wordWrapWidth > 0); if (sections.size() > 0) { @@ -687,7 +679,7 @@ public: } //============================================================================== - bool getCharPosition (const int index, float& cx, float& cy, float& lineHeight_) + bool getCharPosition (const int index, float& cx, float& cy, float& lineHeightFound) { while (next()) { @@ -695,14 +687,14 @@ public: { cx = indexToX (index); cy = lineY; - lineHeight_ = lineHeight; + lineHeightFound = lineHeight; return true; } } cx = atomX; cy = lineY; - lineHeight_ = lineHeight; + lineHeightFound = lineHeight; return false; } @@ -750,19 +742,19 @@ class TextEditor::InsertAction : public UndoableAction { public: InsertAction (TextEditor& ed, - const String& text_, - const int insertIndex_, - const Font& font_, - const Colour& colour_, - const int oldCaretPos_, - const int newCaretPos_) + const String& newText, + const int insertPos, + const Font& newFont, + const Colour& newColour, + const int oldCaret, + const int newCaret) : owner (ed), - text (text_), - insertIndex (insertIndex_), - oldCaretPos (oldCaretPos_), - newCaretPos (newCaretPos_), - font (font_), - colour (colour_) + text (newText), + insertIndex (insertPos), + oldCaretPos (oldCaret), + newCaretPos (newCaret), + font (newFont), + colour (newColour) { } @@ -798,15 +790,15 @@ class TextEditor::RemoveAction : public UndoableAction { public: RemoveAction (TextEditor& ed, - const Range range_, - const int oldCaretPos_, - const int newCaretPos_, - const Array & removedSections_) + const Range rangeToRemove, + const int oldCaret, + const int newCaret, + const Array & oldSections) : owner (ed), - range (range_), - oldCaretPos (oldCaretPos_), - newCaretPos (newCaretPos_), - removedSections (removedSections_) + range (rangeToRemove), + oldCaretPos (oldCaret), + newCaretPos (newCaret), + removedSections (oldSections) { } @@ -814,9 +806,8 @@ public: { for (int i = removedSections.size(); --i >= 0;) { - UniformTextSection* const section = removedSections.getUnchecked (i); + ScopedPointer section (removedSections.getUnchecked (i)); section->clear(); - delete section; } } @@ -952,7 +943,7 @@ namespace TextEditorDefs //============================================================================== TextEditor::TextEditor (const String& name, - const juce_wchar passwordCharacter_) + const juce_wchar passwordChar) : Component (name), borderSize (1, 1, 1, 3), readOnly (false), @@ -975,7 +966,7 @@ TextEditor::TextEditor (const String& name, currentFont (14.0f), totalNumChars (0), caretPosition (0), - passwordCharacter (passwordCharacter_), + passwordCharacter (passwordChar), dragType (notDragging) { setOpaque (true); @@ -1564,16 +1555,15 @@ void TextEditor::moveCaretTo (const int newPosition, } } -int TextEditor::getTextIndexAt (const int x, - const int y) +int TextEditor::getTextIndexAt (const int x, const int y) { return indexAtPosition ((float) (x + viewport->getViewPositionX() - leftIndent), (float) (y + viewport->getViewPositionY() - topIndent)); } -void TextEditor::insertTextAtCaret (const String& newText_) +void TextEditor::insertTextAtCaret (const String& t) { - String newText (newText_); + String newText (t); if (allowedCharacters.isNotEmpty()) newText = newText.retainCharacters (allowedCharacters);