From 84de2fecee6ff204d27979aa1173b38549dbd9a2 Mon Sep 17 00:00:00 2001 From: Tom Poole Date: Thu, 21 Sep 2023 15:07:29 +0100 Subject: [PATCH] Projucer: Remove some unused source files --- .../UI/jucer_ActivityListComponent.h | 106 ------- .../UI/jucer_BuildTabStatusComponent.h | 139 --------- .../UI/jucer_ComponentListComponent.h | 282 ------------------ 3 files changed, 527 deletions(-) delete mode 100644 extras/Projucer/Source/LiveBuildEngine/UI/jucer_ActivityListComponent.h delete mode 100644 extras/Projucer/Source/LiveBuildEngine/UI/jucer_BuildTabStatusComponent.h delete mode 100644 extras/Projucer/Source/LiveBuildEngine/UI/jucer_ComponentListComponent.h diff --git a/extras/Projucer/Source/LiveBuildEngine/UI/jucer_ActivityListComponent.h b/extras/Projucer/Source/LiveBuildEngine/UI/jucer_ActivityListComponent.h deleted file mode 100644 index 9acef3b239..0000000000 --- a/extras/Projucer/Source/LiveBuildEngine/UI/jucer_ActivityListComponent.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - ============================================================================== - - This file is part of the JUCE library. - Copyright (c) 2022 - Raw Material Software Limited - - JUCE is an open source library subject to commercial or open-source - licensing. - - By using JUCE, you agree to the terms of both the JUCE 7 End-User License - Agreement and JUCE Privacy Policy. - - End User License Agreement: www.juce.com/juce-7-licence - Privacy Policy: www.juce.com/juce-privacy-policy - - Or: You may also use this code under the terms of the GPL v3 (see - www.gnu.org/licenses). - - JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER - EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE - DISCLAIMED. - - ============================================================================== -*/ - -#pragma once - - -//============================================================================== -class CurrentActivitiesComp : public Component, - private ChangeListener, - private ListBoxModel, - private Timer -{ -public: - CurrentActivitiesComp (ActivityList& activities) - : Component ("Activities"), activityList (activities) - { - addAndMakeVisible (&list); - list.setColour (ListBox::backgroundColourId, Colours::transparentBlack); - list.setRowHeight (16); - list.setModel (this); - - activityList.addChangeListener (this); - } - - ~CurrentActivitiesComp() override - { - activityList.removeChangeListener (this); - } - - void resized() override { list.setBounds (getLocalBounds()); } - - int getNumRows() override - { - return activityList.getNumActivities(); - } - - void paintListBoxItem (int rowNumber, Graphics& g, - int width, int height, bool /*rowIsSelected*/) override - { - const StringArray activities (activityList.getActivities()); - - if (rowNumber >= 0 && rowNumber < activities.size()) - { - g.setColour (findColour (defaultTextColourId)); - - g.setFont ((float) height * 0.7f); - g.drawText (activities [rowNumber], - 4, 0, width - 5, height, Justification::centredLeft, true); - } - } - - void paint (Graphics& g) override - { - if (getNumRows() == 0) - TreePanelBase::drawEmptyPanelMessage (*this, g, "(No activities)"); - } - - static int getMaxPanelHeight() { return 200; } - -private: - ActivityList& activityList; - ListBox list; - int panelHeightToSet; - - void timerCallback() override - { - stopTimer(); - - if (ConcertinaPanel* cp = findParentComponentOfClass()) - cp->setPanelSize (this, panelHeightToSet, true); - } - - void changeListenerCallback (ChangeBroadcaster*) override - { - list.updateContent(); - - panelHeightToSet = jmax (3, getNumRows()) * list.getRowHeight() + 15; - - if (! isTimerRunning()) - startTimer (100); - - repaint(); - } -}; diff --git a/extras/Projucer/Source/LiveBuildEngine/UI/jucer_BuildTabStatusComponent.h b/extras/Projucer/Source/LiveBuildEngine/UI/jucer_BuildTabStatusComponent.h deleted file mode 100644 index 7be5df694b..0000000000 --- a/extras/Projucer/Source/LiveBuildEngine/UI/jucer_BuildTabStatusComponent.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - ============================================================================== - - This file is part of the JUCE library. - Copyright (c) 2022 - Raw Material Software Limited - - JUCE is an open source library subject to commercial or open-source - licensing. - - By using JUCE, you agree to the terms of both the JUCE 7 End-User License - Agreement and JUCE Privacy Policy. - - End User License Agreement: www.juce.com/juce-7-licence - Privacy Policy: www.juce.com/juce-privacy-policy - - Or: You may also use this code under the terms of the GPL v3 (see - www.gnu.org/licenses). - - JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER - EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE - DISCLAIMED. - - ============================================================================== -*/ - -#pragma once - - -//============================================================================== -class BuildStatusTabComp : public Component, - private ChangeListener, - private Timer -{ -public: - BuildStatusTabComp (ErrorList& el, ActivityList& al) - : errorList (el), activityList (al) - { - setInterceptsMouseClicks (false, false); - addAndMakeVisible (&spinner); - activityList.addChangeListener (this); - errorList.addChangeListener (this); - } - - ~BuildStatusTabComp() override - { - activityList.removeChangeListener (this); - errorList.removeChangeListener (this); - } - - enum { size = 20 }; - - void updateStatus() - { - State newState = nothing; - - if (activityList.getNumActivities() > 0) newState = busy; - else if (errorList.getNumErrors() > 0) newState = errors; - else if (errorList.getNumWarnings() > 0) newState = warnings; - - if (newState != state) - { - state = newState; - setSize (state != nothing ? size : 0, size); - spinner.setVisible (state == busy); - repaint(); - } - } - - void paint (Graphics& g) override - { - if (state == errors || state == warnings) - { - g.setColour (state == errors ? Colours::red : Colours::yellow); - const Path& icon = (state == errors) ? getIcons().warning - : getIcons().info; - - g.fillPath (icon, RectanglePlacement (RectanglePlacement::centred) - .getTransformToFit (icon.getBounds(), - getCentralArea().reduced (1, 1).toFloat())); - } - } - - void resized() override - { - spinner.setBounds (getCentralArea()); - } - - Rectangle getCentralArea() const - { - return getLocalBounds().withTrimmedRight (4); - } - -private: - ErrorList& errorList; - ActivityList& activityList; - - void changeListenerCallback (ChangeBroadcaster*) override { if (! isTimerRunning()) startTimer (150); } - void timerCallback() override { stopTimer(); updateStatus(); } - - enum State - { - nothing, - busy, - errors, - warnings - }; - - State state; - - //============================================================================== - struct Spinner : public Component, - private Timer - { - Spinner() - { - setInterceptsMouseClicks (false, false); - } - - void paint (Graphics& g) override - { - if (findParentComponentOfClass() != nullptr) - { - getLookAndFeel().drawSpinningWaitAnimation (g, findColour (treeIconColourId), - 0, 0, getWidth(), getHeight()); - startTimer (1000 / 20); - } - } - - void timerCallback() override - { - if (isVisible()) - repaint(); - else - stopTimer(); - } - }; - - Spinner spinner; -}; diff --git a/extras/Projucer/Source/LiveBuildEngine/UI/jucer_ComponentListComponent.h b/extras/Projucer/Source/LiveBuildEngine/UI/jucer_ComponentListComponent.h deleted file mode 100644 index 796b477158..0000000000 --- a/extras/Projucer/Source/LiveBuildEngine/UI/jucer_ComponentListComponent.h +++ /dev/null @@ -1,282 +0,0 @@ -/* - ============================================================================== - - This file is part of the JUCE library. - Copyright (c) 2022 - Raw Material Software Limited - - JUCE is an open source library subject to commercial or open-source - licensing. - - By using JUCE, you agree to the terms of both the JUCE 7 End-User License - Agreement and JUCE Privacy Policy. - - End User License Agreement: www.juce.com/juce-7-licence - Privacy Policy: www.juce.com/juce-privacy-policy - - Or: You may also use this code under the terms of the GPL v3 (see - www.gnu.org/licenses). - - JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER - EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE - DISCLAIMED. - - ============================================================================== -*/ - -#pragma once - - -//============================================================================== -class ComponentListComp : public TreePanelBase, - private ActivityList::Listener -{ -public: - ComponentListComp (CompileEngineChildProcess& c) - : TreePanelBase (&c.project, "compClassTreeState"), - owner (c) - { - setName ("Components"); - - tree.setRootItemVisible (false); - tree.setMultiSelectEnabled (false); - tree.setDefaultOpenness (true); - setRoot (new NamespaceItem (&owner.getComponentList().globalNamespace)); - - classListChanged (owner.getComponentList()); - - owner.activityList.addListener (this); - } - - ~ComponentListComp() override - { - saveOpenness(); - owner.activityList.removeListener (this); - } - - void classListChanged (const ClassDatabase::ClassList& newClasses) override - { - rootItem->clearSubItems(); - static_cast (rootItem.get())->setNamespace (&newClasses.globalNamespace); - } - - void openPreview (const ClassDatabase::Class& comp) - { - owner.openPreview (comp); - } - - void showClassDeclaration (const ClassDatabase::Class& comp) - { - owner.handleHighlightCode (comp.getClassDeclarationRange()); - } - -private: - CompileEngineChildProcess& owner; - struct ClassItem; - - struct NamespaceItem : public JucerTreeViewBase - { - NamespaceItem (const ClassDatabase::Namespace* n) - { - setNamespace (n); - } - - void setNamespace (const ClassDatabase::Namespace* newNamespace) - { - namespaceToShow = newNamespace; - uniqueID = namespaceToShow != nullptr ? "ns_" + namespaceToShow->fullName : "null"; - refreshSubItems(); - } - - String getRenamingName() const override { return getDisplayName(); } - String getDisplayName() const override { return (namespaceToShow != nullptr ? namespaceToShow->name : String()) + "::"; } - void setName (const String&) override {} - bool isMissing() const override { return false; } - Icon getIcon() const override { return Icon (getIcons().graph, getContentColour (true)); } - bool canBeSelected() const override { return true; } - bool mightContainSubItems() override { return namespaceToShow != nullptr && ! namespaceToShow->isEmpty(); } - String getUniqueName() const override { return uniqueID; } - - void addSubItems() override - { - if (namespaceToShow != nullptr) - { - Array newComps; - Array newNamespaces; - - for (const auto& c : namespaceToShow->components) - newComps.addSorted (*this, new ClassItem (c, *namespaceToShow)); - - for(const auto& n : namespaceToShow->namespaces) - { - if (n.getTotalClassesAndNamespaces() < 10) - createFlatItemList (n, newComps); - else - newNamespaces.add (new NamespaceItem (&n)); - } - - for (auto c : newComps) - addSubItem (c); - - for (auto n : newNamespaces) - addSubItem (n); - } - } - - void createFlatItemList (const ClassDatabase::Namespace& ns, Array& newComps) - { - for (const auto& c : ns.components) - newComps.addSorted (*this, new ClassItem (c, *namespaceToShow)); - - for (const auto& n : ns.namespaces) - createFlatItemList (n, newComps); - } - - static int compareElements (ClassItem* c1, ClassItem* c2) - { - return c1->comp.getName().compareIgnoreCase (c2->comp.getName()); - } - - private: - const ClassDatabase::Namespace* namespaceToShow = nullptr; - String uniqueID; // must be stored rather than calculated, in case the namespace obj is dangling - }; - - struct ClassItem : public JucerTreeViewBase - { - ClassItem (const ClassDatabase::Class& c, const ClassDatabase::Namespace& parentNS) - : comp (c), - displayName (comp.getName().substring (parentNS.fullName.length())) - { - } - - String getRenamingName() const override { return getDisplayName(); } - String getDisplayName() const override { return displayName; } - void setName (const String&) override {} - bool isMissing() const override { return false; } - Icon getIcon() const override { return Icon (getIcons().box, getContentColour (true)); } - bool canBeSelected() const override { return true; } - bool mightContainSubItems() override { return false; } - String getUniqueName() const override { return comp.getName(); } - int getRightHandButtonSpace() override { return canBeLaunched() ? 60 : 40; } - - std::unique_ptr createItemComponent() override - { - auto content = std::make_unique (*this); - - content->addRightHandButton (new ClassItemButton (*this, true)); - - if (canBeLaunched()) - content->addRightHandButton (new ClassItemButton (*this, false)); - - JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wredundant-move") - return std::move (content); - JUCE_END_IGNORE_WARNINGS_GCC_LIKE - } - - Colour getContentColour (bool isIcon) const override - { - auto alpha = comp.getInstantiationFlags().canBeInstantiated() ? 1.0f : 0.4f; - auto& lf = ProjucerApplication::getApp().lookAndFeel; - - if (isSelected()) - return lf.findColour (defaultHighlightedTextColourId).withMultipliedAlpha (alpha); - - return lf.findColour (isIcon ? treeIconColourId : defaultTextColourId).withMultipliedAlpha (alpha); - } - - bool canBeLaunched() const - { - return comp.getInstantiationFlags().canBeInstantiated(); - } - - void showClassDeclaration() const - { - if (ComponentListComp* clc = getOwnerView()->findParentComponentOfClass()) - clc->showClassDeclaration (comp); - } - - void launchEditor() const - { - if (ComponentListComp* clc = getOwnerView()->findParentComponentOfClass()) - clc->openPreview (comp); - } - - void itemClicked (const MouseEvent&) override - { - if (! canBeLaunched()) - if (ProjectContentComponent* const pcc = getOwnerView()->findParentComponentOfClass()) - pcc->showBubbleMessage (pcc->getLocalArea (getOwnerView(), getItemPosition (true)), - "Cannot create a live view:\n" + comp.getInstantiationFlags().getReasonForUnavailability()); - } - - void itemDoubleClicked (const MouseEvent&) override - { - if (canBeLaunched()) - launchEditor(); - else - showClassDeclaration(); - } - - struct ClassItemButton : public Button - { - ClassItemButton (const ClassItem& c, bool isShowCodeButton) - : Button (String()), classItem (c), isShowCode (isShowCodeButton) - { - setMouseCursor (MouseCursor::PointingHandCursor); - } - - void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown) override - { - const Path& path = isShowCode ? getIcons().code - : getIcons().play; - - auto colour = classItem.getContentColour (true).withAlpha (isButtonDown ? 1.0f - : (isMouseOverButton ? 0.8f - : 0.5f)); - - Icon (path, colour).draw (g, getLocalBounds().reduced (getHeight() / 5).toFloat(), false); - } - - void clicked() override - { - if (isShowCode) - classItem.showClassDeclaration(); - else - classItem.launchEditor(); - } - - using Button::clicked; - - const ClassItem& classItem; - bool isShowCode; - }; - - struct ClassComponent : public Component - { - ClassComponent (ClassItem& item, bool canBeLaunched) - { - addAndMakeVisible (buttons.add (new ClassItemButton (item, true))); - - if (canBeLaunched) - addAndMakeVisible (buttons.add (new ClassItemButton (item, false))); - - setInterceptsMouseClicks (false, true); - } - - void resized() override - { - auto bounds = getLocalBounds(); - - for (auto b : buttons) - b->setBounds (bounds.removeFromRight (25).reduced (2)); - } - - OwnedArray buttons; - }; - - const ClassDatabase::Class comp; - String displayName; - }; - - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ComponentListComp) -};