| @@ -416,13 +416,9 @@ void ProjectTreeViewBase::addSubItems() | |||||
| void ProjectTreeViewBase::refreshSubItems() | void ProjectTreeViewBase::refreshSubItems() | ||||
| { | { | ||||
| ScopedPointer <XmlElement> oldOpenness (getOpennessState()); | |||||
| OpennessRestorer openness (*this); | |||||
| clearSubItems(); | clearSubItems(); | ||||
| addSubItems(); | addSubItems(); | ||||
| if (oldOpenness != 0) | |||||
| restoreOpennessState (*oldOpenness); | |||||
| } | } | ||||
| void ProjectTreeViewBase::showMultiSelectionPopupMenu() | void ProjectTreeViewBase::showMultiSelectionPopupMenu() | ||||
| @@ -52220,16 +52220,12 @@ private: | |||||
| TableListBox::TableListBox (const String& name, TableListBoxModel* const model_) | TableListBox::TableListBox (const String& name, TableListBoxModel* const model_) | ||||
| : ListBox (name, 0), | : ListBox (name, 0), | ||||
| model (model_), | |||||
| header (0), model (model_), | |||||
| autoSizeOptionsShown (true) | autoSizeOptionsShown (true) | ||||
| { | { | ||||
| ListBox::model = this; | ListBox::model = this; | ||||
| header = new TableListBoxHeader (*this); | |||||
| header->setSize (100, 28); | |||||
| header->addListener (this); | |||||
| setHeaderComponent (header); | |||||
| setHeader (new TableListBoxHeader (*this)); | |||||
| } | } | ||||
| TableListBox::~TableListBox() | TableListBox::~TableListBox() | ||||
| @@ -52246,6 +52242,22 @@ void TableListBox::setModel (TableListBoxModel* const newModel) | |||||
| } | } | ||||
| } | } | ||||
| void TableListBox::setHeader (TableHeaderComponent* newHeader) | |||||
| { | |||||
| jassert (newHeader != 0); // you need to supply a real header for a table! | |||||
| Rectangle<int> newBounds (0, 0, 100, 28); | |||||
| if (header != 0) | |||||
| newBounds = header->getBounds(); | |||||
| header = newHeader; | |||||
| header->setBounds (newBounds); | |||||
| setHeaderComponent (header); | |||||
| header->addListener (this); | |||||
| } | |||||
| int TableListBox::getHeaderHeight() const | int TableListBox::getHeaderHeight() const | ||||
| { | { | ||||
| return header->getHeight(); | return header->getHeight(); | ||||
| @@ -57873,6 +57885,18 @@ XmlElement* TreeViewItem::getOpennessState() const throw() | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| TreeViewItem::OpennessRestorer::OpennessRestorer (TreeViewItem& treeViewItem_) | |||||
| : treeViewItem (treeViewItem_), | |||||
| oldOpenness (treeViewItem_.getOpennessState()) | |||||
| { | |||||
| } | |||||
| TreeViewItem::OpennessRestorer::~OpennessRestorer() | |||||
| { | |||||
| if (oldOpenness != 0) | |||||
| treeViewItem.restoreOpennessState (*oldOpenness); | |||||
| } | |||||
| END_JUCE_NAMESPACE | END_JUCE_NAMESPACE | ||||
| /*** End of inlined file: juce_TreeView.cpp ***/ | /*** End of inlined file: juce_TreeView.cpp ***/ | ||||
| @@ -60574,8 +60598,7 @@ public: | |||||
| void changeListenerCallback (ChangeBroadcaster*) | void changeListenerCallback (ChangeBroadcaster*) | ||||
| { | { | ||||
| const ScopedPointer <XmlElement> oldOpenness (owner.tree.getOpennessState (true)); | |||||
| const OpennessRestorer openness (*this); | |||||
| clearSubItems(); | clearSubItems(); | ||||
| const StringArray categories (owner.getMappings().getCommandManager()->getCommandCategories()); | const StringArray categories (owner.getMappings().getCommandManager()->getCommandCategories()); | ||||
| @@ -60592,9 +60615,6 @@ public: | |||||
| if (count > 0) | if (count > 0) | ||||
| addSubItem (new CategoryItem (owner, categories[i])); | addSubItem (new CategoryItem (owner, categories[i])); | ||||
| } | } | ||||
| if (oldOpenness != 0) | |||||
| owner.tree.restoreOpennessState (*oldOpenness); | |||||
| } | } | ||||
| void buttonClicked (Button*) | void buttonClicked (Button*) | ||||
| @@ -83782,10 +83802,6 @@ END_JUCE_NAMESPACE | |||||
| /*** Start of inlined file: juce_LowLevelGraphicsSoftwareRenderer.cpp ***/ | /*** Start of inlined file: juce_LowLevelGraphicsSoftwareRenderer.cpp ***/ | ||||
| BEGIN_JUCE_NAMESPACE | BEGIN_JUCE_NAMESPACE | ||||
| #if (JUCE_WINDOWS || JUCE_LINUX) && ! JUCE_64BIT | |||||
| #define JUCE_USE_SSE_INSTRUCTIONS 1 | |||||
| #endif | |||||
| #if JUCE_MSVC | #if JUCE_MSVC | ||||
| #pragma warning (push) | #pragma warning (push) | ||||
| #pragma warning (disable: 4127) // "expression is constant" warning | #pragma warning (disable: 4127) // "expression is constant" warning | ||||
| @@ -87291,7 +87307,7 @@ const ValueTree DrawableComposite::createValueTree (ComponentBuilder::ImageProvi | |||||
| ValueTree childList (v.getChildListCreating (0)); | ValueTree childList (v.getChildListCreating (0)); | ||||
| for (int i = getNumChildComponents(); --i >= 0;) | |||||
| for (int i = 0; i < getNumChildComponents(); ++i) | |||||
| { | { | ||||
| const Drawable* const d = dynamic_cast <const Drawable*> (getChildComponent(i)); | const Drawable* const d = dynamic_cast <const Drawable*> (getChildComponent(i)); | ||||
| jassert (d != 0); // You can't save a mix of Drawables and normal components! | jassert (d != 0); // You can't save a mix of Drawables and normal components! | ||||
| @@ -50025,6 +50025,12 @@ public: | |||||
| /** Returns the header component being used in this table. */ | /** Returns the header component being used in this table. */ | ||||
| TableHeaderComponent& getHeader() const { return *header; } | TableHeaderComponent& getHeader() const { return *header; } | ||||
| /** Sets the header component to use for the table. | |||||
| The table will take ownership of the component that you pass in, and will delete it | |||||
| when it's no longer needed. | |||||
| */ | |||||
| void setHeader (TableHeaderComponent* newHeader); | |||||
| /** Changes the height of the table header component. | /** Changes the height of the table header component. | ||||
| @see getHeaderHeight | @see getHeaderHeight | ||||
| */ | */ | ||||
| @@ -50781,6 +50787,40 @@ public: | |||||
| */ | */ | ||||
| const String getItemIdentifierString() const; | const String getItemIdentifierString() const; | ||||
| /** | |||||
| This handy class takes a copy of a TreeViewItem's openness when you create it, | |||||
| and restores that openness state when its destructor is called. | |||||
| This can very handy when you're refreshing sub-items - e.g. | |||||
| @code | |||||
| void MyTreeViewItem::updateChildItems() | |||||
| { | |||||
| OpennessRestorer openness (*this); // saves the openness state here.. | |||||
| clearSubItems(); | |||||
| // add a bunch of sub-items here which may or may not be the same as the ones that | |||||
| // were previously there | |||||
| addSubItem (... | |||||
| // ..and at this point, the old openness is restored, so any items that haven't | |||||
| // changed will have their old openness retained. | |||||
| } | |||||
| @endcode | |||||
| */ | |||||
| class OpennessRestorer | |||||
| { | |||||
| public: | |||||
| OpennessRestorer (TreeViewItem& treeViewItem); | |||||
| ~OpennessRestorer(); | |||||
| private: | |||||
| TreeViewItem& treeViewItem; | |||||
| ScopedPointer <XmlElement> oldOpenness; | |||||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OpennessRestorer); | |||||
| }; | |||||
| private: | private: | ||||
| TreeView* ownerView; | TreeView* ownerView; | ||||
| @@ -268,16 +268,12 @@ private: | |||||
| //============================================================================== | //============================================================================== | ||||
| TableListBox::TableListBox (const String& name, TableListBoxModel* const model_) | TableListBox::TableListBox (const String& name, TableListBoxModel* const model_) | ||||
| : ListBox (name, 0), | : ListBox (name, 0), | ||||
| model (model_), | |||||
| header (0), model (model_), | |||||
| autoSizeOptionsShown (true) | autoSizeOptionsShown (true) | ||||
| { | { | ||||
| ListBox::model = this; | ListBox::model = this; | ||||
| header = new TableListBoxHeader (*this); | |||||
| header->setSize (100, 28); | |||||
| header->addListener (this); | |||||
| setHeaderComponent (header); | |||||
| setHeader (new TableListBoxHeader (*this)); | |||||
| } | } | ||||
| TableListBox::~TableListBox() | TableListBox::~TableListBox() | ||||
| @@ -294,6 +290,22 @@ void TableListBox::setModel (TableListBoxModel* const newModel) | |||||
| } | } | ||||
| } | } | ||||
| void TableListBox::setHeader (TableHeaderComponent* newHeader) | |||||
| { | |||||
| jassert (newHeader != 0); // you need to supply a real header for a table! | |||||
| Rectangle<int> newBounds (0, 0, 100, 28); | |||||
| if (header != 0) | |||||
| newBounds = header->getBounds(); | |||||
| header = newHeader; | |||||
| header->setBounds (newBounds); | |||||
| setHeaderComponent (header); | |||||
| header->addListener (this); | |||||
| } | |||||
| int TableListBox::getHeaderHeight() const | int TableListBox::getHeaderHeight() const | ||||
| { | { | ||||
| return header->getHeight(); | return header->getHeight(); | ||||
| @@ -226,6 +226,12 @@ public: | |||||
| /** Returns the header component being used in this table. */ | /** Returns the header component being used in this table. */ | ||||
| TableHeaderComponent& getHeader() const { return *header; } | TableHeaderComponent& getHeader() const { return *header; } | ||||
| /** Sets the header component to use for the table. | |||||
| The table will take ownership of the component that you pass in, and will delete it | |||||
| when it's no longer needed. | |||||
| */ | |||||
| void setHeader (TableHeaderComponent* newHeader); | |||||
| /** Changes the height of the table header component. | /** Changes the height of the table header component. | ||||
| @see getHeaderHeight | @see getHeaderHeight | ||||
| */ | */ | ||||
| @@ -1800,4 +1800,18 @@ XmlElement* TreeViewItem::getOpennessState() const throw() | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| //============================================================================== | |||||
| TreeViewItem::OpennessRestorer::OpennessRestorer (TreeViewItem& treeViewItem_) | |||||
| : treeViewItem (treeViewItem_), | |||||
| oldOpenness (treeViewItem_.getOpennessState()) | |||||
| { | |||||
| } | |||||
| TreeViewItem::OpennessRestorer::~OpennessRestorer() | |||||
| { | |||||
| if (oldOpenness != 0) | |||||
| treeViewItem.restoreOpennessState (*oldOpenness); | |||||
| } | |||||
| END_JUCE_NAMESPACE | END_JUCE_NAMESPACE | ||||
| @@ -457,6 +457,41 @@ public: | |||||
| */ | */ | ||||
| const String getItemIdentifierString() const; | const String getItemIdentifierString() const; | ||||
| //============================================================================== | |||||
| /** | |||||
| This handy class takes a copy of a TreeViewItem's openness when you create it, | |||||
| and restores that openness state when its destructor is called. | |||||
| This can very handy when you're refreshing sub-items - e.g. | |||||
| @code | |||||
| void MyTreeViewItem::updateChildItems() | |||||
| { | |||||
| OpennessRestorer openness (*this); // saves the openness state here.. | |||||
| clearSubItems(); | |||||
| // add a bunch of sub-items here which may or may not be the same as the ones that | |||||
| // were previously there | |||||
| addSubItem (... | |||||
| // ..and at this point, the old openness is restored, so any items that haven't | |||||
| // changed will have their old openness retained. | |||||
| } | |||||
| @endcode | |||||
| */ | |||||
| class OpennessRestorer | |||||
| { | |||||
| public: | |||||
| OpennessRestorer (TreeViewItem& treeViewItem); | |||||
| ~OpennessRestorer(); | |||||
| private: | |||||
| TreeViewItem& treeViewItem; | |||||
| ScopedPointer <XmlElement> oldOpenness; | |||||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OpennessRestorer); | |||||
| }; | |||||
| private: | private: | ||||
| //============================================================================== | //============================================================================== | ||||
| TreeView* ownerView; | TreeView* ownerView; | ||||
| @@ -353,8 +353,7 @@ public: | |||||
| void changeListenerCallback (ChangeBroadcaster*) | void changeListenerCallback (ChangeBroadcaster*) | ||||
| { | { | ||||
| const ScopedPointer <XmlElement> oldOpenness (owner.tree.getOpennessState (true)); | |||||
| const OpennessRestorer openness (*this); | |||||
| clearSubItems(); | clearSubItems(); | ||||
| const StringArray categories (owner.getMappings().getCommandManager()->getCommandCategories()); | const StringArray categories (owner.getMappings().getCommandManager()->getCommandCategories()); | ||||
| @@ -371,9 +370,6 @@ public: | |||||
| if (count > 0) | if (count > 0) | ||||
| addSubItem (new CategoryItem (owner, categories[i])); | addSubItem (new CategoryItem (owner, categories[i])); | ||||
| } | } | ||||
| if (oldOpenness != 0) | |||||
| owner.tree.restoreOpennessState (*oldOpenness); | |||||
| } | } | ||||
| void buttonClicked (Button*) | void buttonClicked (Button*) | ||||
| @@ -37,10 +37,6 @@ BEGIN_JUCE_NAMESPACE | |||||
| #include "../../../core/juce_Singleton.h" | #include "../../../core/juce_Singleton.h" | ||||
| #include "../../../utilities/juce_DeletedAtShutdown.h" | #include "../../../utilities/juce_DeletedAtShutdown.h" | ||||
| #if (JUCE_WINDOWS || JUCE_LINUX) && ! JUCE_64BIT | |||||
| #define JUCE_USE_SSE_INSTRUCTIONS 1 | |||||
| #endif | |||||
| #if JUCE_MSVC | #if JUCE_MSVC | ||||
| #pragma warning (push) | #pragma warning (push) | ||||
| #pragma warning (disable: 4127) // "expression is constant" warning | #pragma warning (disable: 4127) // "expression is constant" warning | ||||
| @@ -333,7 +333,7 @@ const ValueTree DrawableComposite::createValueTree (ComponentBuilder::ImageProvi | |||||
| ValueTree childList (v.getChildListCreating (0)); | ValueTree childList (v.getChildListCreating (0)); | ||||
| for (int i = getNumChildComponents(); --i >= 0;) | |||||
| for (int i = 0; i < getNumChildComponents(); ++i) | |||||
| { | { | ||||
| const Drawable* const d = dynamic_cast <const Drawable*> (getChildComponent(i)); | const Drawable* const d = dynamic_cast <const Drawable*> (getChildComponent(i)); | ||||
| jassert (d != 0); // You can't save a mix of Drawables and normal components! | jassert (d != 0); // You can't save a mix of Drawables and normal components! | ||||