| @@ -36,9 +36,10 @@ public: | |||||
| SourceFileTreeViewItem (const Project::Item& item); | SourceFileTreeViewItem (const Project::Item& item); | ||||
| ~SourceFileTreeViewItem(); | ~SourceFileTreeViewItem(); | ||||
| bool acceptsFileDrop (const StringArray& files) const { return false; } | |||||
| bool acceptsFileDrop (const StringArray& files) const { return false; } | |||||
| bool acceptsDragItems (const OwnedArray <Project::Item>& selectedNodes) { return false; } | bool acceptsDragItems (const OwnedArray <Project::Item>& selectedNodes) { return false; } | ||||
| ProjectTreeViewBase* createSubItem (const Project::Item& child); | ProjectTreeViewBase* createSubItem (const Project::Item& child); | ||||
| void createLeftEdgeComponents (Array<Component*>& components) {} | |||||
| void showDocument(); | void showDocument(); | ||||
| void showPopupMenu(); | void showPopupMenu(); | ||||
| const String getDisplayName() const; | const String getDisplayName() const; | ||||
| @@ -58,6 +59,7 @@ public: | |||||
| void checkFileStatus(); | void checkFileStatus(); | ||||
| void moveSelectedItemsTo (OwnedArray <Project::Item>& selectedNodes, int insertIndex); | void moveSelectedItemsTo (OwnedArray <Project::Item>& selectedNodes, int insertIndex); | ||||
| ProjectTreeViewBase* createSubItem (const Project::Item& child); | ProjectTreeViewBase* createSubItem (const Project::Item& child); | ||||
| void createLeftEdgeComponents (Array<Component*>& components) {} | |||||
| void showDocument(); | void showDocument(); | ||||
| void showPopupMenu(); | void showPopupMenu(); | ||||
| @@ -28,6 +28,7 @@ | |||||
| //============================================================================== | //============================================================================== | ||||
| JucerTreeViewBase::JucerTreeViewBase() | JucerTreeViewBase::JucerTreeViewBase() | ||||
| : numLeftHandComps (0) | |||||
| { | { | ||||
| setLinesDrawnForSubItems (false); | setLinesDrawnForSubItems (false); | ||||
| } | } | ||||
| @@ -43,7 +44,7 @@ const Font JucerTreeViewBase::getFont() const | |||||
| int JucerTreeViewBase::getTextX() const | int JucerTreeViewBase::getTextX() const | ||||
| { | { | ||||
| return getItemHeight() + 6; | |||||
| return (numLeftHandComps + 1) * getItemHeight() + 8; | |||||
| } | } | ||||
| void JucerTreeViewBase::paintItem (Graphics& g, int width, int height) | void JucerTreeViewBase::paintItem (Graphics& g, int width, int height) | ||||
| @@ -55,7 +56,7 @@ void JucerTreeViewBase::paintItem (Graphics& g, int width, int height) | |||||
| g.setColour (isMissing() ? Colours::red : Colours::black); | g.setColour (isMissing() ? Colours::red : Colours::black); | ||||
| g.drawImageWithin (getIcon(), 2, 2, x - 4, height - 4, | |||||
| g.drawImageWithin (getIcon(), 0, 2, height + 6, height - 4, | |||||
| RectanglePlacement::centred | RectanglePlacement::onlyReduceInSize, | RectanglePlacement::centred | RectanglePlacement::onlyReduceInSize, | ||||
| false); | false); | ||||
| @@ -76,6 +77,41 @@ void JucerTreeViewBase::paintOpenCloseButton (Graphics& g, int width, int height | |||||
| g.fillPath (p); | g.fillPath (p); | ||||
| } | } | ||||
| //============================================================================== | |||||
| class TreeLeftHandButtonHolderComponent : public Component | |||||
| { | |||||
| public: | |||||
| TreeLeftHandButtonHolderComponent (const Array<Component*>& comps) | |||||
| { | |||||
| components.addArray (comps); | |||||
| setInterceptsMouseClicks (false, true); | |||||
| for (int i = 0; i < comps.size(); ++i) | |||||
| addAndMakeVisible (comps.getUnchecked(i)); | |||||
| } | |||||
| void resized() | |||||
| { | |||||
| const int edge = 1; | |||||
| const int itemSize = getHeight() - edge * 2; | |||||
| for (int i = 0; i < components.size(); ++i) | |||||
| components.getUnchecked(i)->setBounds (5 + (i + 1) * getHeight(), edge, itemSize, itemSize); | |||||
| } | |||||
| private: | |||||
| OwnedArray<Component> components; | |||||
| }; | |||||
| Component* JucerTreeViewBase::createItemComponent() | |||||
| { | |||||
| Array<Component*> components; | |||||
| createLeftEdgeComponents (components); | |||||
| numLeftHandComps = components.size(); | |||||
| return numLeftHandComps == 0 ? 0 : new TreeLeftHandButtonHolderComponent (components); | |||||
| } | |||||
| //============================================================================== | //============================================================================== | ||||
| void JucerTreeViewBase::showRenameBox() | void JucerTreeViewBase::showRenameBox() | ||||
| { | { | ||||
| @@ -42,10 +42,10 @@ public: | |||||
| //============================================================================== | //============================================================================== | ||||
| int getItemWidth() const { return -1; } | int getItemWidth() const { return -1; } | ||||
| int getItemHeight() const { return 20; } | int getItemHeight() const { return 20; } | ||||
| Component* createItemComponent() { return 0; } | |||||
| void paintItem (Graphics& g, int width, int height); | void paintItem (Graphics& g, int width, int height); | ||||
| void paintOpenCloseButton (Graphics& g, int width, int height, bool isMouseOver); | void paintOpenCloseButton (Graphics& g, int width, int height, bool isMouseOver); | ||||
| Component* createItemComponent(); | |||||
| //============================================================================== | //============================================================================== | ||||
| virtual const String getRenamingName() const = 0; | virtual const String getRenamingName() const = 0; | ||||
| @@ -53,6 +53,7 @@ public: | |||||
| virtual void setName (const String& newName) = 0; | virtual void setName (const String& newName) = 0; | ||||
| virtual bool isMissing() = 0; | virtual bool isMissing() = 0; | ||||
| virtual const Image getIcon() const = 0; | virtual const Image getIcon() const = 0; | ||||
| virtual void createLeftEdgeComponents (Array<Component*>& components) = 0; | |||||
| virtual void showRenameBox(); | virtual void showRenameBox(); | ||||
| @@ -64,6 +65,7 @@ public: | |||||
| //============================================================================== | //============================================================================== | ||||
| private: | private: | ||||
| int numLeftHandComps; | |||||
| const Font getFont() const; | const Font getFont() const; | ||||
| int getTextX() const; | int getTextX() const; | ||||
| }; | }; | ||||
| @@ -70558,14 +70558,14 @@ int PopupMenu::showMenu (const Rectangle<int>& target, | |||||
| if (callback->component == 0) | if (callback->component == 0) | ||||
| return 0; | return 0; | ||||
| callbackDeleter.release(); | |||||
| callback->component->enterModalState (false, userCallbackDeleter.release()); | callback->component->enterModalState (false, userCallbackDeleter.release()); | ||||
| callback->component->toFront (false); // need to do this after making it modal, or it could | callback->component->toFront (false); // need to do this after making it modal, or it could | ||||
| // be stuck behind other comps that are already modal.. | // be stuck behind other comps that are already modal.. | ||||
| ModalComponentManager::getInstance()->attachCallback (callback->component, callback); | ModalComponentManager::getInstance()->attachCallback (callback->component, callback); | ||||
| callbackDeleter.release(); | |||||
| if (userCallback != 0) | if (userCallback != 0) | ||||
| return 0; | return 0; | ||||
| @@ -273245,7 +273245,8 @@ NSRect NSViewComponentPeer::constrainRect (NSRect r) | |||||
| #if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MIN_ALLOWED >= MAC_OS_X_VERSION_10_6 | #if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MIN_ALLOWED >= MAC_OS_X_VERSION_10_6 | ||||
| if ([window inLiveResize]) | if ([window inLiveResize]) | ||||
| #else | #else | ||||
| if ([window performSelector: @selector (inLiveResize)]) | |||||
| if ([window respondsToSelector: @selector (inLiveResize)] | |||||
| && [window performSelector: @selector (inLiveResize)]) | |||||
| #endif | #endif | ||||
| { | { | ||||
| constrainer->checkBounds (pos, original, | constrainer->checkBounds (pos, original, | ||||
| @@ -1546,14 +1546,14 @@ int PopupMenu::showMenu (const Rectangle<int>& target, | |||||
| if (callback->component == 0) | if (callback->component == 0) | ||||
| return 0; | return 0; | ||||
| callbackDeleter.release(); | |||||
| callback->component->enterModalState (false, userCallbackDeleter.release()); | callback->component->enterModalState (false, userCallbackDeleter.release()); | ||||
| callback->component->toFront (false); // need to do this after making it modal, or it could | callback->component->toFront (false); // need to do this after making it modal, or it could | ||||
| // be stuck behind other comps that are already modal.. | // be stuck behind other comps that are already modal.. | ||||
| ModalComponentManager::getInstance()->attachCallback (callback->component, callback); | ModalComponentManager::getInstance()->attachCallback (callback->component, callback); | ||||
| callbackDeleter.release(); | |||||
| if (userCallback != 0) | if (userCallback != 0) | ||||
| return 0; | return 0; | ||||
| @@ -1075,7 +1075,8 @@ NSRect NSViewComponentPeer::constrainRect (NSRect r) | |||||
| #if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MIN_ALLOWED >= MAC_OS_X_VERSION_10_6 | #if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MIN_ALLOWED >= MAC_OS_X_VERSION_10_6 | ||||
| if ([window inLiveResize]) | if ([window inLiveResize]) | ||||
| #else | #else | ||||
| if ([window performSelector: @selector (inLiveResize)]) | |||||
| if ([window respondsToSelector: @selector (inLiveResize)] | |||||
| && [window performSelector: @selector (inLiveResize)]) | |||||
| #endif | #endif | ||||
| { | { | ||||
| constrainer->checkBounds (pos, original, | constrainer->checkBounds (pos, original, | ||||