diff --git a/extras/Introjucer/Source/Application/jucer_DocumentEditorComponent.cpp b/extras/Introjucer/Source/Application/jucer_DocumentEditorComponent.cpp index 60a4852829..83a578eeb1 100644 --- a/extras/Introjucer/Source/Application/jucer_DocumentEditorComponent.cpp +++ b/extras/Introjucer/Source/Application/jucer_DocumentEditorComponent.cpp @@ -47,12 +47,7 @@ void DocumentEditorComponent::documentAboutToClose (OpenDocumentManager::Documen jassert (document != nullptr); if (ProjectContentComponent* pcc = findParentComponentOfClass()) - { pcc->hideDocument (document); - return; - } - - jassertfalse } } diff --git a/extras/Introjucer/Source/Project/jucer_GroupInformationComponent.h b/extras/Introjucer/Source/Project/jucer_GroupInformationComponent.h index 90b60387c6..7cc36c534f 100644 --- a/extras/Introjucer/Source/Project/jucer_GroupInformationComponent.h +++ b/extras/Introjucer/Source/Project/jucer_GroupInformationComponent.h @@ -77,23 +77,21 @@ public: Component* refreshComponentForRow (int rowNumber, bool /*isRowSelected*/, Component* existingComponentToUpdate) { + ScopedPointer existing (existingComponentToUpdate); + if (rowNumber < getNumRows()) { Project::Item child (item.getChild (rowNumber)); if (existingComponentToUpdate == nullptr - || dynamic_cast (existingComponentToUpdate)->item != child) + || dynamic_cast (existing.get())->item != child) { - delete existingComponentToUpdate; - existingComponentToUpdate = new FileOptionComponent (child); + existing = nullptr; + existing = new FileOptionComponent (child); } } - else - { - deleteAndZero (existingComponentToUpdate); - } - return existingComponentToUpdate; + return existing.release(); } //============================================================================== diff --git a/extras/Introjucer/Source/Utility/jucer_CodeHelpers.cpp b/extras/Introjucer/Source/Utility/jucer_CodeHelpers.cpp index 1c572b90ca..dba63df84f 100644 --- a/extras/Introjucer/Source/Utility/jucer_CodeHelpers.cpp +++ b/extras/Introjucer/Source/Utility/jucer_CodeHelpers.cpp @@ -267,6 +267,23 @@ namespace CodeHelpers return result + currentLine.trimEnd() + ")"; } + String floatLiteral (float value, int numDecPlaces) + { + String s ((double) value, numDecPlaces); + + if (s.containsChar ('.')) + s << 'f'; + else + s << ".0f"; + + return s; + } + + String boolLiteral (bool value) + { + return value ? "true" : "false"; + } + String colourToCode (const Colour& col) { const Colour colours[] = @@ -292,6 +309,33 @@ namespace CodeHelpers return "Colour (0x" + hexString8Digits ((int) col.getARGB()) + ')'; } + String justificationToCode (const Justification& justification) + { + switch (justification.getFlags()) + { + case Justification::centred: return "Justification::centred"; + case Justification::centredLeft: return "Justification::centredLeft"; + case Justification::centredRight: return "Justification::centredRight"; + case Justification::centredTop: return "Justification::centredTop"; + case Justification::centredBottom: return "Justification::centredBottom"; + case Justification::topLeft: return "Justification::topLeft"; + case Justification::topRight: return "Justification::topRight"; + case Justification::bottomLeft: return "Justification::bottomLeft"; + case Justification::bottomRight: return "Justification::bottomRight"; + case Justification::left: return "Justification::left"; + case Justification::right: return "Justification::right"; + case Justification::horizontallyCentred: return "Justification::horizontallyCentred"; + case Justification::top: return "Justification::top"; + case Justification::bottom: return "Justification::bottom"; + case Justification::verticallyCentred: return "Justification::verticallyCentred"; + case Justification::horizontallyJustified: return "Justification::horizontallyJustified"; + default: break; + } + + jassertfalse; + return "Justification (" + String (justification.getFlags()) + ")"; + } + void writeDataAsCppLiteral (const MemoryBlock& mb, OutputStream& out, bool breakAtNewLines, bool allowStringBreaks) { diff --git a/extras/Introjucer/Source/Utility/jucer_CodeHelpers.h b/extras/Introjucer/Source/Utility/jucer_CodeHelpers.h index d2aa1d3e9f..8ee989585d 100644 --- a/extras/Introjucer/Source/Utility/jucer_CodeHelpers.h +++ b/extras/Introjucer/Source/Utility/jucer_CodeHelpers.h @@ -39,8 +39,12 @@ namespace CodeHelpers String makeBinaryDataIdentifierName (const File& file); String stringLiteral (const String& text, int maxLineLength = -1); + String floatLiteral (float value, int numDecPlaces); + String boolLiteral (bool value); String colourToCode (const Colour& col); + String justificationToCode (const Justification&); + String alignFunctionCallParams (const String& call, const StringArray& parameters, int maxLineLength); void writeDataAsCppLiteral (const MemoryBlock& data, OutputStream& out, diff --git a/extras/Introjucer/Source/Utility/jucer_MiscUtilities.h b/extras/Introjucer/Source/Utility/jucer_MiscUtilities.h index 159641a5de..bddfb701e1 100644 --- a/extras/Introjucer/Source/Utility/jucer_MiscUtilities.h +++ b/extras/Introjucer/Source/Utility/jucer_MiscUtilities.h @@ -267,7 +267,7 @@ public: } else { - selector.setBounds (0, 0, getWidth(), getHeight()); + selector.setBounds (getLocalBounds()); } } diff --git a/modules/juce_gui_basics/drawables/juce_DrawablePath.cpp b/modules/juce_gui_basics/drawables/juce_DrawablePath.cpp index 3679debe96..d3005220c9 100644 --- a/modules/juce_gui_basics/drawables/juce_DrawablePath.cpp +++ b/modules/juce_gui_basics/drawables/juce_DrawablePath.cpp @@ -78,9 +78,9 @@ void DrawablePath::applyRelativePath (const RelativePointPath& newRelativePath, class DrawablePath::RelativePositioner : public RelativeCoordinatePositionerBase { public: - RelativePositioner (DrawablePath& component_) - : RelativeCoordinatePositionerBase (component_), - owner (component_) + RelativePositioner (DrawablePath& comp) + : RelativeCoordinatePositionerBase (comp), + owner (comp) { } diff --git a/modules/juce_gui_basics/drawables/juce_DrawableShape.cpp b/modules/juce_gui_basics/drawables/juce_DrawableShape.cpp index 90905a7dc0..3a5a87f779 100644 --- a/modules/juce_gui_basics/drawables/juce_DrawableShape.cpp +++ b/modules/juce_gui_basics/drawables/juce_DrawableShape.cpp @@ -46,11 +46,11 @@ DrawableShape::~DrawableShape() class DrawableShape::RelativePositioner : public RelativeCoordinatePositionerBase { public: - RelativePositioner (DrawableShape& component_, const DrawableShape::RelativeFillType& fill_, bool isMainFill_) - : RelativeCoordinatePositionerBase (component_), - owner (component_), - fill (fill_), - isMainFill (isMainFill_) + RelativePositioner (DrawableShape& comp, const DrawableShape::RelativeFillType& f, bool isMain) + : RelativeCoordinatePositionerBase (comp), + owner (comp), + fill (f), + isMainFill (isMain) { } diff --git a/modules/juce_gui_basics/filebrowser/juce_FileChooserDialogBox.cpp b/modules/juce_gui_basics/filebrowser/juce_FileChooserDialogBox.cpp index 892d5b3e14..7175145a82 100644 --- a/modules/juce_gui_basics/filebrowser/juce_FileChooserDialogBox.cpp +++ b/modules/juce_gui_basics/filebrowser/juce_FileChooserDialogBox.cpp @@ -27,13 +27,13 @@ class FileChooserDialogBox::ContentComponent : public Component { public: //============================================================================== - ContentComponent (const String& name, const String& instructions_, FileBrowserComponent& chooserComponent_) + ContentComponent (const String& name, const String& desc, FileBrowserComponent& chooser) : Component (name), - chooserComponent (chooserComponent_), - okButton (chooserComponent_.getActionVerb()), + chooserComponent (chooser), + okButton (chooser.getActionVerb()), cancelButton (TRANS ("Cancel")), newFolderButton (TRANS ("New Folder")), - instructions (instructions_) + instructions (desc) { addAndMakeVisible (&chooserComponent); diff --git a/modules/juce_gui_basics/filebrowser/juce_FilenameComponent.cpp b/modules/juce_gui_basics/filebrowser/juce_FilenameComponent.cpp index a38c4a6fd9..57be7bbd76 100644 --- a/modules/juce_gui_basics/filebrowser/juce_FilenameComponent.cpp +++ b/modules/juce_gui_basics/filebrowser/juce_FilenameComponent.cpp @@ -60,7 +60,7 @@ void FilenameComponent::paintOverChildren (Graphics& g) if (isFileDragOver) { g.setColour (Colours::red.withAlpha (0.2f)); - g.drawRect (0, 0, getWidth(), getHeight(), 3); + g.drawRect (getLocalBounds(), 3); } } diff --git a/modules/juce_gui_basics/filebrowser/juce_ImagePreviewComponent.cpp b/modules/juce_gui_basics/filebrowser/juce_ImagePreviewComponent.cpp index 4a664d61e1..94be326f00 100644 --- a/modules/juce_gui_basics/filebrowser/juce_ImagePreviewComponent.cpp +++ b/modules/juce_gui_basics/filebrowser/juce_ImagePreviewComponent.cpp @@ -62,13 +62,11 @@ void ImagePreviewComponent::timerCallback() currentDetails = String::empty; repaint(); - ScopedPointer in (fileToLoad.createInputStream()); + ScopedPointer in (fileToLoad.createInputStream()); if (in != nullptr) { - ImageFileFormat* const format = ImageFileFormat::findImageFormatForStream (*in); - - if (format != nullptr) + if (ImageFileFormat* const format = ImageFileFormat::findImageFormatForStream (*in)) { currentThumbnail = format->decodeImage (*in); diff --git a/modules/juce_gui_basics/layout/juce_ComponentMovementWatcher.cpp b/modules/juce_gui_basics/layout/juce_ComponentMovementWatcher.cpp index fc0e658bb7..bff5513c2a 100644 --- a/modules/juce_gui_basics/layout/juce_ComponentMovementWatcher.cpp +++ b/modules/juce_gui_basics/layout/juce_ComponentMovementWatcher.cpp @@ -23,11 +23,11 @@ ============================================================================== */ -ComponentMovementWatcher::ComponentMovementWatcher (Component* const component_) - : component (component_), +ComponentMovementWatcher::ComponentMovementWatcher (Component* const comp) + : component (comp), lastPeerID (0), reentrant (false), - wasShowing (component_->isShowing()) + wasShowing (comp->isShowing()) { jassert (component != nullptr); // can't use this with a null pointer.. diff --git a/modules/juce_gui_basics/mouse/juce_DragAndDropContainer.cpp b/modules/juce_gui_basics/mouse/juce_DragAndDropContainer.cpp index 8c155abf9d..abc63f026d 100644 --- a/modules/juce_gui_basics/mouse/juce_DragAndDropContainer.cpp +++ b/modules/juce_gui_basics/mouse/juce_DragAndDropContainer.cpp @@ -435,10 +435,10 @@ bool DragAndDropContainer::shouldDropFilesWhenDraggedExternally (const DragAndDr } //============================================================================== -DragAndDropTarget::SourceDetails::SourceDetails (const var& description_, Component* sourceComponent_, const Point& localPosition_) noexcept - : description (description_), - sourceComponent (sourceComponent_), - localPosition (localPosition_) +DragAndDropTarget::SourceDetails::SourceDetails (const var& desc, Component* comp, const Point& pos) noexcept + : description (desc), + sourceComponent (comp), + localPosition (pos) { } diff --git a/modules/juce_gui_basics/positioning/juce_RelativeCoordinatePositioner.cpp b/modules/juce_gui_basics/positioning/juce_RelativeCoordinatePositioner.cpp index 8f7e83ab4d..6c74753875 100644 --- a/modules/juce_gui_basics/positioning/juce_RelativeCoordinatePositioner.cpp +++ b/modules/juce_gui_basics/positioning/juce_RelativeCoordinatePositioner.cpp @@ -26,7 +26,7 @@ class MarkerListScope : public Expression::Scope { public: - MarkerListScope (Component& component_) : component (component_) {} + MarkerListScope (Component& comp) : component (comp) {} Expression getSymbolValue (const String& symbol) const { @@ -90,8 +90,8 @@ private: }; //============================================================================== -RelativeCoordinatePositionerBase::ComponentScope::ComponentScope (Component& component_) - : component (component_) +RelativeCoordinatePositionerBase::ComponentScope::ComponentScope (Component& comp) + : component (comp) { } @@ -151,8 +151,8 @@ Component* RelativeCoordinatePositionerBase::ComponentScope::findSiblingComponen class RelativeCoordinatePositionerBase::DependencyFinderScope : public ComponentScope { public: - DependencyFinderScope (Component& component_, RelativeCoordinatePositionerBase& positioner_, bool& ok_) - : ComponentScope (component_), positioner (positioner_), ok (ok_) + DependencyFinderScope (Component& comp, RelativeCoordinatePositionerBase& positioner_, bool& ok_) + : ComponentScope (comp), positioner (positioner_), ok (ok_) { } @@ -221,8 +221,8 @@ private: }; //============================================================================== -RelativeCoordinatePositionerBase::RelativeCoordinatePositionerBase (Component& component_) - : Component::Positioner (component_), registeredOk (false) +RelativeCoordinatePositionerBase::RelativeCoordinatePositionerBase (Component& comp) + : Component::Positioner (comp), registeredOk (false) { } diff --git a/modules/juce_gui_basics/positioning/juce_RelativeRectangle.cpp b/modules/juce_gui_basics/positioning/juce_RelativeRectangle.cpp index 9da6fafefe..6a48e851e9 100644 --- a/modules/juce_gui_basics/positioning/juce_RelativeRectangle.cpp +++ b/modules/juce_gui_basics/positioning/juce_RelativeRectangle.cpp @@ -187,9 +187,9 @@ void RelativeRectangle::renameSymbol (const Expression::Symbol& oldSymbol, const class RelativeRectangleComponentPositioner : public RelativeCoordinatePositionerBase { public: - RelativeRectangleComponentPositioner (Component& component_, const RelativeRectangle& rectangle_) - : RelativeCoordinatePositionerBase (component_), - rectangle (rectangle_) + RelativeRectangleComponentPositioner (Component& comp, const RelativeRectangle& r) + : RelativeCoordinatePositionerBase (comp), + rectangle (r) { } diff --git a/modules/juce_gui_basics/widgets/juce_ListBox.cpp b/modules/juce_gui_basics/widgets/juce_ListBox.cpp index 6a3e67377f..a9f7397929 100644 --- a/modules/juce_gui_basics/widgets/juce_ListBox.cpp +++ b/modules/juce_gui_basics/widgets/juce_ListBox.cpp @@ -427,7 +427,7 @@ void ListBox::paintOverChildren (Graphics& g) if (outlineThickness > 0) { g.setColour (findColour (outlineColourId)); - g.drawRect (0, 0, getWidth(), getHeight(), outlineThickness); + g.drawRect (getLocalBounds(), outlineThickness); } } diff --git a/modules/juce_gui_basics/widgets/juce_ToolbarItemComponent.cpp b/modules/juce_gui_basics/widgets/juce_ToolbarItemComponent.cpp index d8c11e2a8a..f620d897c8 100644 --- a/modules/juce_gui_basics/widgets/juce_ToolbarItemComponent.cpp +++ b/modules/juce_gui_basics/widgets/juce_ToolbarItemComponent.cpp @@ -51,8 +51,8 @@ public: && tc->getEditingMode() == ToolbarItemComponent::editableOnToolbar) { g.setColour (findColour (Toolbar::editingModeOutlineColourId, true)); - g.drawRect (0, 0, getWidth(), getHeight(), - jmin (2, (getWidth() - 1) / 2, (getHeight() - 1) / 2)); + g.drawRect (getLocalBounds(), jmin (2, (getWidth() - 1) / 2, + (getHeight() - 1) / 2)); } } } diff --git a/modules/juce_gui_basics/widgets/juce_TreeView.h b/modules/juce_gui_basics/widgets/juce_TreeView.h index e0d7890b65..443c1e6bd6 100644 --- a/modules/juce_gui_basics/widgets/juce_TreeView.h +++ b/modules/juce_gui_basics/widgets/juce_TreeView.h @@ -610,7 +610,6 @@ public: TreeViewItem* getRootItem() const noexcept { return rootItem; } /** This will remove and delete the current root item. - It's a convenient way of deleting the item and calling setRootItem (nullptr). */ void deleteRootItem(); diff --git a/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp b/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp index f545b5263b..759ff8f6cc 100644 --- a/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp +++ b/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp @@ -27,9 +27,9 @@ static Array heavyweightPeers; static uint32 lastUniqueID = 1; //============================================================================== -ComponentPeer::ComponentPeer (Component& component_, const int styleFlags_) - : component (component_), - styleFlags (styleFlags_), +ComponentPeer::ComponentPeer (Component& comp, const int flags) + : component (comp), + styleFlags (flags), constrainer (nullptr), lastDragAndDropCompUnderMouse (nullptr), uniqueID (lastUniqueID += 2), // increment by 2 so that this can never hit 0 diff --git a/modules/juce_gui_extra/code_editor/juce_CodeDocument.cpp b/modules/juce_gui_extra/code_editor/juce_CodeDocument.cpp index 7b71d0d4da..af2115b1bb 100644 --- a/modules/juce_gui_extra/code_editor/juce_CodeDocument.cpp +++ b/modules/juce_gui_extra/code_editor/juce_CodeDocument.cpp @@ -123,8 +123,8 @@ public: }; //============================================================================== -CodeDocument::Iterator::Iterator (const CodeDocument& document_) noexcept - : document (&document_), +CodeDocument::Iterator::Iterator (const CodeDocument& doc) noexcept + : document (&doc), charPointer (nullptr), line (0), position (0)