| @@ -47,12 +47,7 @@ void DocumentEditorComponent::documentAboutToClose (OpenDocumentManager::Documen | |||||
| jassert (document != nullptr); | jassert (document != nullptr); | ||||
| if (ProjectContentComponent* pcc = findParentComponentOfClass<ProjectContentComponent>()) | if (ProjectContentComponent* pcc = findParentComponentOfClass<ProjectContentComponent>()) | ||||
| { | |||||
| pcc->hideDocument (document); | pcc->hideDocument (document); | ||||
| return; | |||||
| } | |||||
| jassertfalse | |||||
| } | } | ||||
| } | } | ||||
| @@ -77,23 +77,21 @@ public: | |||||
| Component* refreshComponentForRow (int rowNumber, bool /*isRowSelected*/, Component* existingComponentToUpdate) | Component* refreshComponentForRow (int rowNumber, bool /*isRowSelected*/, Component* existingComponentToUpdate) | ||||
| { | { | ||||
| ScopedPointer<Component> existing (existingComponentToUpdate); | |||||
| if (rowNumber < getNumRows()) | if (rowNumber < getNumRows()) | ||||
| { | { | ||||
| Project::Item child (item.getChild (rowNumber)); | Project::Item child (item.getChild (rowNumber)); | ||||
| if (existingComponentToUpdate == nullptr | if (existingComponentToUpdate == nullptr | ||||
| || dynamic_cast <FileOptionComponent*> (existingComponentToUpdate)->item != child) | |||||
| || dynamic_cast <FileOptionComponent*> (existing.get())->item != child) | |||||
| { | { | ||||
| delete existingComponentToUpdate; | |||||
| existingComponentToUpdate = new FileOptionComponent (child); | |||||
| existing = nullptr; | |||||
| existing = new FileOptionComponent (child); | |||||
| } | } | ||||
| } | } | ||||
| else | |||||
| { | |||||
| deleteAndZero (existingComponentToUpdate); | |||||
| } | |||||
| return existingComponentToUpdate; | |||||
| return existing.release(); | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -267,6 +267,23 @@ namespace CodeHelpers | |||||
| return result + currentLine.trimEnd() + ")"; | 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) | String colourToCode (const Colour& col) | ||||
| { | { | ||||
| const Colour colours[] = | const Colour colours[] = | ||||
| @@ -292,6 +309,33 @@ namespace CodeHelpers | |||||
| return "Colour (0x" + hexString8Digits ((int) col.getARGB()) + ')'; | 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, | void writeDataAsCppLiteral (const MemoryBlock& mb, OutputStream& out, | ||||
| bool breakAtNewLines, bool allowStringBreaks) | bool breakAtNewLines, bool allowStringBreaks) | ||||
| { | { | ||||
| @@ -39,8 +39,12 @@ namespace CodeHelpers | |||||
| String makeBinaryDataIdentifierName (const File& file); | String makeBinaryDataIdentifierName (const File& file); | ||||
| String stringLiteral (const String& text, int maxLineLength = -1); | String stringLiteral (const String& text, int maxLineLength = -1); | ||||
| String floatLiteral (float value, int numDecPlaces); | |||||
| String boolLiteral (bool value); | |||||
| String colourToCode (const Colour& col); | String colourToCode (const Colour& col); | ||||
| String justificationToCode (const Justification&); | |||||
| String alignFunctionCallParams (const String& call, const StringArray& parameters, int maxLineLength); | String alignFunctionCallParams (const String& call, const StringArray& parameters, int maxLineLength); | ||||
| void writeDataAsCppLiteral (const MemoryBlock& data, OutputStream& out, | void writeDataAsCppLiteral (const MemoryBlock& data, OutputStream& out, | ||||
| @@ -267,7 +267,7 @@ public: | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| selector.setBounds (0, 0, getWidth(), getHeight()); | |||||
| selector.setBounds (getLocalBounds()); | |||||
| } | } | ||||
| } | } | ||||
| @@ -78,9 +78,9 @@ void DrawablePath::applyRelativePath (const RelativePointPath& newRelativePath, | |||||
| class DrawablePath::RelativePositioner : public RelativeCoordinatePositionerBase | class DrawablePath::RelativePositioner : public RelativeCoordinatePositionerBase | ||||
| { | { | ||||
| public: | public: | ||||
| RelativePositioner (DrawablePath& component_) | |||||
| : RelativeCoordinatePositionerBase (component_), | |||||
| owner (component_) | |||||
| RelativePositioner (DrawablePath& comp) | |||||
| : RelativeCoordinatePositionerBase (comp), | |||||
| owner (comp) | |||||
| { | { | ||||
| } | } | ||||
| @@ -46,11 +46,11 @@ DrawableShape::~DrawableShape() | |||||
| class DrawableShape::RelativePositioner : public RelativeCoordinatePositionerBase | class DrawableShape::RelativePositioner : public RelativeCoordinatePositionerBase | ||||
| { | { | ||||
| public: | 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) | |||||
| { | { | ||||
| } | } | ||||
| @@ -27,13 +27,13 @@ class FileChooserDialogBox::ContentComponent : public Component | |||||
| { | { | ||||
| public: | public: | ||||
| //============================================================================== | //============================================================================== | ||||
| ContentComponent (const String& name, const String& instructions_, FileBrowserComponent& chooserComponent_) | |||||
| ContentComponent (const String& name, const String& desc, FileBrowserComponent& chooser) | |||||
| : Component (name), | : Component (name), | ||||
| chooserComponent (chooserComponent_), | |||||
| okButton (chooserComponent_.getActionVerb()), | |||||
| chooserComponent (chooser), | |||||
| okButton (chooser.getActionVerb()), | |||||
| cancelButton (TRANS ("Cancel")), | cancelButton (TRANS ("Cancel")), | ||||
| newFolderButton (TRANS ("New Folder")), | newFolderButton (TRANS ("New Folder")), | ||||
| instructions (instructions_) | |||||
| instructions (desc) | |||||
| { | { | ||||
| addAndMakeVisible (&chooserComponent); | addAndMakeVisible (&chooserComponent); | ||||
| @@ -60,7 +60,7 @@ void FilenameComponent::paintOverChildren (Graphics& g) | |||||
| if (isFileDragOver) | if (isFileDragOver) | ||||
| { | { | ||||
| g.setColour (Colours::red.withAlpha (0.2f)); | g.setColour (Colours::red.withAlpha (0.2f)); | ||||
| g.drawRect (0, 0, getWidth(), getHeight(), 3); | |||||
| g.drawRect (getLocalBounds(), 3); | |||||
| } | } | ||||
| } | } | ||||
| @@ -62,13 +62,11 @@ void ImagePreviewComponent::timerCallback() | |||||
| currentDetails = String::empty; | currentDetails = String::empty; | ||||
| repaint(); | repaint(); | ||||
| ScopedPointer <FileInputStream> in (fileToLoad.createInputStream()); | |||||
| ScopedPointer<FileInputStream> in (fileToLoad.createInputStream()); | |||||
| if (in != nullptr) | if (in != nullptr) | ||||
| { | { | ||||
| ImageFileFormat* const format = ImageFileFormat::findImageFormatForStream (*in); | |||||
| if (format != nullptr) | |||||
| if (ImageFileFormat* const format = ImageFileFormat::findImageFormatForStream (*in)) | |||||
| { | { | ||||
| currentThumbnail = format->decodeImage (*in); | currentThumbnail = format->decodeImage (*in); | ||||
| @@ -23,11 +23,11 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| */ | */ | ||||
| ComponentMovementWatcher::ComponentMovementWatcher (Component* const component_) | |||||
| : component (component_), | |||||
| ComponentMovementWatcher::ComponentMovementWatcher (Component* const comp) | |||||
| : component (comp), | |||||
| lastPeerID (0), | lastPeerID (0), | ||||
| reentrant (false), | reentrant (false), | ||||
| wasShowing (component_->isShowing()) | |||||
| wasShowing (comp->isShowing()) | |||||
| { | { | ||||
| jassert (component != nullptr); // can't use this with a null pointer.. | jassert (component != nullptr); // can't use this with a null pointer.. | ||||
| @@ -435,10 +435,10 @@ bool DragAndDropContainer::shouldDropFilesWhenDraggedExternally (const DragAndDr | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| DragAndDropTarget::SourceDetails::SourceDetails (const var& description_, Component* sourceComponent_, const Point<int>& localPosition_) noexcept | |||||
| : description (description_), | |||||
| sourceComponent (sourceComponent_), | |||||
| localPosition (localPosition_) | |||||
| DragAndDropTarget::SourceDetails::SourceDetails (const var& desc, Component* comp, const Point<int>& pos) noexcept | |||||
| : description (desc), | |||||
| sourceComponent (comp), | |||||
| localPosition (pos) | |||||
| { | { | ||||
| } | } | ||||
| @@ -26,7 +26,7 @@ | |||||
| class MarkerListScope : public Expression::Scope | class MarkerListScope : public Expression::Scope | ||||
| { | { | ||||
| public: | public: | ||||
| MarkerListScope (Component& component_) : component (component_) {} | |||||
| MarkerListScope (Component& comp) : component (comp) {} | |||||
| Expression getSymbolValue (const String& symbol) const | 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 | class RelativeCoordinatePositionerBase::DependencyFinderScope : public ComponentScope | ||||
| { | { | ||||
| public: | 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) | |||||
| { | { | ||||
| } | } | ||||
| @@ -187,9 +187,9 @@ void RelativeRectangle::renameSymbol (const Expression::Symbol& oldSymbol, const | |||||
| class RelativeRectangleComponentPositioner : public RelativeCoordinatePositionerBase | class RelativeRectangleComponentPositioner : public RelativeCoordinatePositionerBase | ||||
| { | { | ||||
| public: | public: | ||||
| RelativeRectangleComponentPositioner (Component& component_, const RelativeRectangle& rectangle_) | |||||
| : RelativeCoordinatePositionerBase (component_), | |||||
| rectangle (rectangle_) | |||||
| RelativeRectangleComponentPositioner (Component& comp, const RelativeRectangle& r) | |||||
| : RelativeCoordinatePositionerBase (comp), | |||||
| rectangle (r) | |||||
| { | { | ||||
| } | } | ||||
| @@ -427,7 +427,7 @@ void ListBox::paintOverChildren (Graphics& g) | |||||
| if (outlineThickness > 0) | if (outlineThickness > 0) | ||||
| { | { | ||||
| g.setColour (findColour (outlineColourId)); | g.setColour (findColour (outlineColourId)); | ||||
| g.drawRect (0, 0, getWidth(), getHeight(), outlineThickness); | |||||
| g.drawRect (getLocalBounds(), outlineThickness); | |||||
| } | } | ||||
| } | } | ||||
| @@ -51,8 +51,8 @@ public: | |||||
| && tc->getEditingMode() == ToolbarItemComponent::editableOnToolbar) | && tc->getEditingMode() == ToolbarItemComponent::editableOnToolbar) | ||||
| { | { | ||||
| g.setColour (findColour (Toolbar::editingModeOutlineColourId, true)); | 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)); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -610,7 +610,6 @@ public: | |||||
| TreeViewItem* getRootItem() const noexcept { return rootItem; } | TreeViewItem* getRootItem() const noexcept { return rootItem; } | ||||
| /** This will remove and delete the current root item. | /** This will remove and delete the current root item. | ||||
| It's a convenient way of deleting the item and calling setRootItem (nullptr). | It's a convenient way of deleting the item and calling setRootItem (nullptr). | ||||
| */ | */ | ||||
| void deleteRootItem(); | void deleteRootItem(); | ||||
| @@ -27,9 +27,9 @@ static Array <ComponentPeer*> heavyweightPeers; | |||||
| static uint32 lastUniqueID = 1; | 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), | constrainer (nullptr), | ||||
| lastDragAndDropCompUnderMouse (nullptr), | lastDragAndDropCompUnderMouse (nullptr), | ||||
| uniqueID (lastUniqueID += 2), // increment by 2 so that this can never hit 0 | uniqueID (lastUniqueID += 2), // increment by 2 so that this can never hit 0 | ||||
| @@ -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), | charPointer (nullptr), | ||||
| line (0), | line (0), | ||||
| position (0) | position (0) | ||||