| @@ -15,6 +15,10 @@ | |||||
| 840F1DA610AD674F002A03A6 /* juce_CPlusPlusCodeTokeniser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84AB91F910A078190048FC39 /* juce_CPlusPlusCodeTokeniser.cpp */; }; | 840F1DA610AD674F002A03A6 /* juce_CPlusPlusCodeTokeniser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84AB91F910A078190048FC39 /* juce_CPlusPlusCodeTokeniser.cpp */; }; | ||||
| 840F1DA710AD6750002A03A6 /* juce_CPlusPlusCodeTokeniser.h in Headers */ = {isa = PBXBuildFile; fileRef = 84AB91FA10A078190048FC39 /* juce_CPlusPlusCodeTokeniser.h */; }; | 840F1DA710AD6750002A03A6 /* juce_CPlusPlusCodeTokeniser.h in Headers */ = {isa = PBXBuildFile; fileRef = 84AB91FA10A078190048FC39 /* juce_CPlusPlusCodeTokeniser.h */; }; | ||||
| 840F80BC092B399D005E7B4E /* juce.h in Headers */ = {isa = PBXBuildFile; fileRef = 840F80BB092B399D005E7B4E /* juce.h */; }; | 840F80BC092B399D005E7B4E /* juce.h in Headers */ = {isa = PBXBuildFile; fileRef = 840F80BB092B399D005E7B4E /* juce.h */; }; | ||||
| 8414DE78111229B300DAF75A /* juce_NamedValueSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8414DE76111229B300DAF75A /* juce_NamedValueSet.cpp */; }; | |||||
| 8414DE79111229B300DAF75A /* juce_NamedValueSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 8414DE77111229B300DAF75A /* juce_NamedValueSet.h */; }; | |||||
| 8414DE8411122A8D00DAF75A /* juce_DynamicObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8414DE8211122A8D00DAF75A /* juce_DynamicObject.cpp */; }; | |||||
| 8414DE8511122A8D00DAF75A /* juce_DynamicObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 8414DE8311122A8D00DAF75A /* juce_DynamicObject.h */; }; | |||||
| 843D4A3B10D3C54500624BA6 /* juce_ValueTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 843D4A3910D3C54500624BA6 /* juce_ValueTree.cpp */; }; | 843D4A3B10D3C54500624BA6 /* juce_ValueTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 843D4A3910D3C54500624BA6 /* juce_ValueTree.cpp */; }; | ||||
| 843D4A3C10D3C54500624BA6 /* juce_ValueTree.h in Headers */ = {isa = PBXBuildFile; fileRef = 843D4A3A10D3C54500624BA6 /* juce_ValueTree.h */; }; | 843D4A3C10D3C54500624BA6 /* juce_ValueTree.h in Headers */ = {isa = PBXBuildFile; fileRef = 843D4A3A10D3C54500624BA6 /* juce_ValueTree.h */; }; | ||||
| 844BB95B10C5578800DF5536 /* juce_TargetPlatform.h in Headers */ = {isa = PBXBuildFile; fileRef = 8481730E10832513008FEC33 /* juce_TargetPlatform.h */; }; | 844BB95B10C5578800DF5536 /* juce_TargetPlatform.h in Headers */ = {isa = PBXBuildFile; fileRef = 8481730E10832513008FEC33 /* juce_TargetPlatform.h */; }; | ||||
| @@ -1225,6 +1229,10 @@ | |||||
| /* Begin PBXFileReference section */ | /* Begin PBXFileReference section */ | ||||
| 840F80BB092B399D005E7B4E /* juce.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; lineEnding = 2; name = juce.h; path = ../../juce.h; sourceTree = SOURCE_ROOT; }; | 840F80BB092B399D005E7B4E /* juce.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; lineEnding = 2; name = juce.h; path = ../../juce.h; sourceTree = SOURCE_ROOT; }; | ||||
| 8414DE76111229B300DAF75A /* juce_NamedValueSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = juce_NamedValueSet.cpp; sourceTree = "<group>"; }; | |||||
| 8414DE77111229B300DAF75A /* juce_NamedValueSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = juce_NamedValueSet.h; sourceTree = "<group>"; }; | |||||
| 8414DE8211122A8D00DAF75A /* juce_DynamicObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = juce_DynamicObject.cpp; sourceTree = "<group>"; }; | |||||
| 8414DE8311122A8D00DAF75A /* juce_DynamicObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = juce_DynamicObject.h; sourceTree = "<group>"; }; | |||||
| 843D4A3910D3C54500624BA6 /* juce_ValueTree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = juce_ValueTree.cpp; sourceTree = "<group>"; }; | 843D4A3910D3C54500624BA6 /* juce_ValueTree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = juce_ValueTree.cpp; sourceTree = "<group>"; }; | ||||
| 843D4A3A10D3C54500624BA6 /* juce_ValueTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = juce_ValueTree.h; sourceTree = "<group>"; }; | 843D4A3A10D3C54500624BA6 /* juce_ValueTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = juce_ValueTree.h; sourceTree = "<group>"; }; | ||||
| 8456EC6508A2A6C80087C412 /* juce_Config.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; lineEnding = 2; name = juce_Config.h; path = ../../juce_Config.h; sourceTree = SOURCE_ROOT; }; | 8456EC6508A2A6C80087C412 /* juce_Config.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; lineEnding = 2; name = juce_Config.h; path = ../../juce_Config.h; sourceTree = SOURCE_ROOT; }; | ||||
| @@ -2175,11 +2183,15 @@ | |||||
| 84F1E8D110403671006A1807 /* juce_ArrayAllocationBase.h */, | 84F1E8D110403671006A1807 /* juce_ArrayAllocationBase.h */, | ||||
| 84F1E8D210403671006A1807 /* juce_BitArray.cpp */, | 84F1E8D210403671006A1807 /* juce_BitArray.cpp */, | ||||
| 84F1E8D310403671006A1807 /* juce_BitArray.h */, | 84F1E8D310403671006A1807 /* juce_BitArray.h */, | ||||
| 8414DE8211122A8D00DAF75A /* juce_DynamicObject.cpp */, | |||||
| 8414DE8311122A8D00DAF75A /* juce_DynamicObject.h */, | |||||
| 84F1E8D410403671006A1807 /* juce_ElementComparator.h */, | 84F1E8D410403671006A1807 /* juce_ElementComparator.h */, | ||||
| 84F1E8D510403671006A1807 /* juce_MemoryBlock.cpp */, | 84F1E8D510403671006A1807 /* juce_MemoryBlock.cpp */, | ||||
| 84F1E8D610403671006A1807 /* juce_MemoryBlock.h */, | 84F1E8D610403671006A1807 /* juce_MemoryBlock.h */, | ||||
| 84F1E8D710403671006A1807 /* juce_OwnedArray.h */, | 84F1E8D710403671006A1807 /* juce_OwnedArray.h */, | ||||
| 84DEDD9E10EE496500909D01 /* juce_HeapBlock.h */, | 84DEDD9E10EE496500909D01 /* juce_HeapBlock.h */, | ||||
| 8414DE76111229B300DAF75A /* juce_NamedValueSet.cpp */, | |||||
| 8414DE77111229B300DAF75A /* juce_NamedValueSet.h */, | |||||
| 84F1E8D810403671006A1807 /* juce_PropertySet.cpp */, | 84F1E8D810403671006A1807 /* juce_PropertySet.cpp */, | ||||
| 84F1E8D910403671006A1807 /* juce_PropertySet.h */, | 84F1E8D910403671006A1807 /* juce_PropertySet.h */, | ||||
| 84F1E8DA10403671006A1807 /* juce_ReferenceCountedArray.h */, | 84F1E8DA10403671006A1807 /* juce_ReferenceCountedArray.h */, | ||||
| @@ -3560,6 +3572,8 @@ | |||||
| 84BA604110F2017A001D9D70 /* juce_Value.h in Headers */, | 84BA604110F2017A001D9D70 /* juce_Value.h in Headers */, | ||||
| 848432C310F933B800490977 /* juce_ByteOrder.h in Headers */, | 848432C310F933B800490977 /* juce_ByteOrder.h in Headers */, | ||||
| 84CABF6A1101292D0088D64D /* juce_TemporaryFile.h in Headers */, | 84CABF6A1101292D0088D64D /* juce_TemporaryFile.h in Headers */, | ||||
| 8414DE79111229B300DAF75A /* juce_NamedValueSet.h in Headers */, | |||||
| 8414DE8511122A8D00DAF75A /* juce_DynamicObject.h in Headers */, | |||||
| ); | ); | ||||
| runOnlyForDeploymentPostprocessing = 0; | runOnlyForDeploymentPostprocessing = 0; | ||||
| }; | }; | ||||
| @@ -4202,6 +4216,8 @@ | |||||
| 843D4A3B10D3C54500624BA6 /* juce_ValueTree.cpp in Sources */, | 843D4A3B10D3C54500624BA6 /* juce_ValueTree.cpp in Sources */, | ||||
| 84BA604010F2017A001D9D70 /* juce_Value.cpp in Sources */, | 84BA604010F2017A001D9D70 /* juce_Value.cpp in Sources */, | ||||
| 84CABF691101292D0088D64D /* juce_TemporaryFile.cpp in Sources */, | 84CABF691101292D0088D64D /* juce_TemporaryFile.cpp in Sources */, | ||||
| 8414DE78111229B300DAF75A /* juce_NamedValueSet.cpp in Sources */, | |||||
| 8414DE8411122A8D00DAF75A /* juce_DynamicObject.cpp in Sources */, | |||||
| ); | ); | ||||
| runOnlyForDeploymentPostprocessing = 0; | runOnlyForDeploymentPostprocessing = 0; | ||||
| }; | }; | ||||
| @@ -1081,6 +1081,14 @@ | |||||
| RelativePath="..\..\..\src\containers\juce_BitArray.h" | RelativePath="..\..\..\src\containers\juce_BitArray.h" | ||||
| > | > | ||||
| </File> | </File> | ||||
| <File | |||||
| RelativePath="..\..\..\src\containers\juce_DynamicObject.cpp" | |||||
| > | |||||
| </File> | |||||
| <File | |||||
| RelativePath="..\..\..\src\containers\juce_DynamicObject.h" | |||||
| > | |||||
| </File> | |||||
| <File | <File | ||||
| RelativePath="..\..\..\src\containers\juce_ElementComparator.h" | RelativePath="..\..\..\src\containers\juce_ElementComparator.h" | ||||
| > | > | ||||
| @@ -1097,6 +1105,14 @@ | |||||
| RelativePath="..\..\..\src\containers\juce_MemoryBlock.h" | RelativePath="..\..\..\src\containers\juce_MemoryBlock.h" | ||||
| > | > | ||||
| </File> | </File> | ||||
| <File | |||||
| RelativePath="..\..\..\src\containers\juce_NamedValueSet.cpp" | |||||
| > | |||||
| </File> | |||||
| <File | |||||
| RelativePath="..\..\..\src\containers\juce_NamedValueSet.h" | |||||
| > | |||||
| </File> | |||||
| <File | <File | ||||
| RelativePath="..\..\..\src\containers\juce_OwnedArray.h" | RelativePath="..\..\..\src\containers\juce_OwnedArray.h" | ||||
| > | > | ||||
| @@ -65,7 +65,7 @@ static pascal OSStatus windowVisibilityBodge (EventHandlerCallRef, EventRef e, v | |||||
| static void updateComponentPos (Component* const comp) | static void updateComponentPos (Component* const comp) | ||||
| { | { | ||||
| HIViewRef dummyView = (HIViewRef) (void*) (pointer_sized_int) | HIViewRef dummyView = (HIViewRef) (void*) (pointer_sized_int) | ||||
| comp->getComponentProperty ("dummyViewRef", false, String::empty).getHexValue64(); | |||||
| comp->getProperties() ["dummyViewRef"].toString().getHexValue64(); | |||||
| HIRect r; | HIRect r; | ||||
| HIViewGetFrame (dummyView, &r); | HIViewGetFrame (dummyView, &r); | ||||
| @@ -128,12 +128,12 @@ void* attachComponentToWindowRef (Component* comp, void* windowRef) | |||||
| HIRect r = { {0, 0}, {comp->getWidth(), comp->getHeight()} }; | HIRect r = { {0, 0}, {comp->getWidth(), comp->getHeight()} }; | ||||
| HIViewSetFrame (dummyView, &r); | HIViewSetFrame (dummyView, &r); | ||||
| HIViewAddSubview (parentView, dummyView); | HIViewAddSubview (parentView, dummyView); | ||||
| comp->setComponentProperty ("dummyViewRef", String::toHexString ((pointer_sized_int) (void*) dummyView)); | |||||
| comp->getProperties().set ("dummyViewRef", String::toHexString ((pointer_sized_int) (void*) dummyView)); | |||||
| EventHandlerRef ref; | EventHandlerRef ref; | ||||
| const EventTypeSpec kControlBoundsChangedEvent = { kEventClassControl, kEventControlBoundsChanged }; | const EventTypeSpec kControlBoundsChangedEvent = { kEventClassControl, kEventControlBoundsChanged }; | ||||
| InstallEventHandler (GetControlEventTarget (dummyView), NewEventHandlerUPP (viewBoundsChangedEvent), 1, &kControlBoundsChangedEvent, (void*) comp, &ref); | InstallEventHandler (GetControlEventTarget (dummyView), NewEventHandlerUPP (viewBoundsChangedEvent), 1, &kControlBoundsChangedEvent, (void*) comp, &ref); | ||||
| comp->setComponentProperty ("boundsEventRef", String::toHexString ((pointer_sized_int) (void*) ref)); | |||||
| comp->getProperties().set ("boundsEventRef", String::toHexString ((pointer_sized_int) (void*) ref)); | |||||
| updateComponentPos (comp); | updateComponentPos (comp); | ||||
| @@ -168,7 +168,7 @@ void* attachComponentToWindowRef (Component* comp, void* windowRef) | |||||
| NewEventHandlerUPP (windowVisibilityBodge), | NewEventHandlerUPP (windowVisibilityBodge), | ||||
| GetEventTypeCount (eventsToCatch), eventsToCatch, | GetEventTypeCount (eventsToCatch), eventsToCatch, | ||||
| (void*) hostWindow, &ref); | (void*) hostWindow, &ref); | ||||
| comp->setComponentProperty ("carbonEventRef", String::toHexString ((pointer_sized_int) (void*) ref)); | |||||
| comp->getProperties().set ("carbonEventRef", String::toHexString ((pointer_sized_int) (void*) ref)); | |||||
| #endif | #endif | ||||
| return hostWindow; | return hostWindow; | ||||
| @@ -180,17 +180,17 @@ void detachComponentFromWindowRef (Component* comp, void* nsWindow) | |||||
| const ScopedAutoReleasePool pool; | const ScopedAutoReleasePool pool; | ||||
| EventHandlerRef ref = (EventHandlerRef) (void*) (pointer_sized_int) | EventHandlerRef ref = (EventHandlerRef) (void*) (pointer_sized_int) | ||||
| comp->getComponentProperty ("boundsEventRef", false, String::empty).getHexValue64(); | |||||
| comp->getProperties() ["boundsEventRef"].toString().getHexValue64(); | |||||
| RemoveEventHandler (ref); | RemoveEventHandler (ref); | ||||
| #if ADD_CARBON_BODGE | #if ADD_CARBON_BODGE | ||||
| ref = (EventHandlerRef) (void*) (pointer_sized_int) | ref = (EventHandlerRef) (void*) (pointer_sized_int) | ||||
| comp->getComponentProperty ("carbonEventRef", false, String::empty).getHexValue64(); | |||||
| comp->getProperties() ["carbonEventRef"].toString().getHexValue64(); | |||||
| RemoveEventHandler (ref); | RemoveEventHandler (ref); | ||||
| #endif | #endif | ||||
| HIViewRef dummyView = (HIViewRef) (void*) (pointer_sized_int) | HIViewRef dummyView = (HIViewRef) (void*) (pointer_sized_int) | ||||
| comp->getComponentProperty ("dummyViewRef", false, String::empty).getHexValue64(); | |||||
| comp->getProperties() ["dummyViewRef"].toString().getHexValue64(); | |||||
| if (HIViewIsValid (dummyView)) | if (HIViewIsValid (dummyView)) | ||||
| CFRelease (dummyView); | CFRelease (dummyView); | ||||
| @@ -169,12 +169,12 @@ public: | |||||
| static bool needsButtonListener (Component* button) | static bool needsButtonListener (Component* button) | ||||
| { | { | ||||
| return button->getComponentPropertyBool (T("generateListenerCallback"), false, true); | |||||
| return button->getProperties().getWithDefault ("generateListenerCallback", true); | |||||
| } | } | ||||
| static void setNeedsButtonListener (Component* button, const bool shouldDoCallback) | static void setNeedsButtonListener (Component* button, const bool shouldDoCallback) | ||||
| { | { | ||||
| button->setComponentProperty (T("generateListenerCallback"), shouldDoCallback); | |||||
| button->getProperties().set ("generateListenerCallback", shouldDoCallback); | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -53,7 +53,7 @@ public: | |||||
| e->setAttribute (T("editable"), c->isTextEditable()); | e->setAttribute (T("editable"), c->isTextEditable()); | ||||
| e->setAttribute (T("layout"), c->getJustificationType().getFlags()); | e->setAttribute (T("layout"), c->getJustificationType().getFlags()); | ||||
| e->setAttribute (T("items"), c->getComponentProperty (T("items"), false)); | |||||
| e->setAttribute (T("items"), c->getProperties() ["items"].toString()); | |||||
| e->setAttribute (T("textWhenNonSelected"), c->getTextWhenNothingSelected()); | e->setAttribute (T("textWhenNonSelected"), c->getTextWhenNothingSelected()); | ||||
| e->setAttribute (T("textWhenNoItems"), c->getTextWhenNoChoicesAvailable()); | e->setAttribute (T("textWhenNoItems"), c->getTextWhenNoChoicesAvailable()); | ||||
| @@ -72,7 +72,7 @@ public: | |||||
| c->setEditableText (xml.getBoolAttribute (T("editable"), defaultBox.isTextEditable())); | c->setEditableText (xml.getBoolAttribute (T("editable"), defaultBox.isTextEditable())); | ||||
| c->setJustificationType (Justification (xml.getIntAttribute (T("layout"), defaultBox.getJustificationType().getFlags()))); | c->setJustificationType (Justification (xml.getIntAttribute (T("layout"), defaultBox.getJustificationType().getFlags()))); | ||||
| c->setComponentProperty (T("items"), xml.getStringAttribute (T("items"), String::empty)); | |||||
| c->getProperties().set ("items", xml.getStringAttribute (T("items"), String::empty)); | |||||
| c->setTextWhenNothingSelected (xml.getStringAttribute (T("textWhenNonSelected"), defaultBox.getTextWhenNothingSelected())); | c->setTextWhenNothingSelected (xml.getStringAttribute (T("textWhenNonSelected"), defaultBox.getTextWhenNothingSelected())); | ||||
| c->setTextWhenNoChoicesAvailable (xml.getStringAttribute (T("textWhenNoItems"), defaultBox.getTextWhenNoChoicesAvailable())); | c->setTextWhenNoChoicesAvailable (xml.getStringAttribute (T("textWhenNoItems"), defaultBox.getTextWhenNoChoicesAvailable())); | ||||
| @@ -114,7 +114,7 @@ public: | |||||
| << memberVariableName << "->setTextWhenNoChoicesAvailable (" << quotedString (c->getTextWhenNoChoicesAvailable()) << ");\n"; | << memberVariableName << "->setTextWhenNoChoicesAvailable (" << quotedString (c->getTextWhenNoChoicesAvailable()) << ");\n"; | ||||
| StringArray lines; | StringArray lines; | ||||
| lines.addLines (c->getComponentProperty (T("items"), false)); | |||||
| lines.addLines (c->getProperties() ["items"].toString()); | |||||
| int itemId = 1; | int itemId = 1; | ||||
| for (int i = 0; i < lines.size(); ++i) | for (int i = 0; i < lines.size(); ++i) | ||||
| @@ -160,7 +160,7 @@ public: | |||||
| static void updateItems (ComboBox* c) | static void updateItems (ComboBox* c) | ||||
| { | { | ||||
| StringArray lines; | StringArray lines; | ||||
| lines.addLines (c->getComponentProperty (T("items"), false)); | |||||
| lines.addLines (c->getProperties() ["items"].toString()); | |||||
| c->clear(); | c->clear(); | ||||
| int itemId = 1; | int itemId = 1; | ||||
| @@ -306,7 +306,7 @@ private: | |||||
| const String getText() const | const String getText() const | ||||
| { | { | ||||
| return component->getComponentProperty (T("items"), false); | |||||
| return component->getProperties() ["items"]; | |||||
| } | } | ||||
| private: | private: | ||||
| @@ -317,13 +317,13 @@ private: | |||||
| : ComponentUndoableAction <ComboBox> (comp, layout), | : ComponentUndoableAction <ComboBox> (comp, layout), | ||||
| newState (newState_) | newState (newState_) | ||||
| { | { | ||||
| oldState = comp->getComponentProperty (T("items"), false); | |||||
| oldState = comp->getProperties() ["items"]; | |||||
| } | } | ||||
| bool perform() | bool perform() | ||||
| { | { | ||||
| showCorrectTab(); | showCorrectTab(); | ||||
| getComponent()->setComponentProperty (T("items"), newState); | |||||
| getComponent()->getProperties().set ("items", newState); | |||||
| ComboBoxHandler::updateItems (getComponent()); | ComboBoxHandler::updateItems (getComponent()); | ||||
| changed(); | changed(); | ||||
| return true; | return true; | ||||
| @@ -332,7 +332,7 @@ private: | |||||
| bool undo() | bool undo() | ||||
| { | { | ||||
| showCorrectTab(); | showCorrectTab(); | ||||
| getComponent()->setComponentProperty (T("items"), oldState); | |||||
| getComponent()->getProperties().set ("items", oldState); | |||||
| ComboBoxHandler::updateItems (getComponent()); | ComboBoxHandler::updateItems (getComponent()); | ||||
| changed(); | changed(); | ||||
| return true; | return true; | ||||
| @@ -146,8 +146,8 @@ XmlElement* ComponentTypeHandler::createXmlFor (Component* comp, const Component | |||||
| e->setAttribute (T("name"), comp->getName()); | e->setAttribute (T("name"), comp->getName()); | ||||
| e->setAttribute (T("id"), String::toHexString (getComponentId (comp))); | e->setAttribute (T("id"), String::toHexString (getComponentId (comp))); | ||||
| e->setAttribute (T("memberName"), comp->getComponentProperty (T("memberName"), false)); | |||||
| e->setAttribute (T("virtualName"), comp->getComponentProperty (T("virtualName"), false)); | |||||
| e->setAttribute (T("memberName"), comp->getProperties() ["memberName"].toString()); | |||||
| e->setAttribute (T("virtualName"), comp->getProperties() ["virtualName"].toString()); | |||||
| e->setAttribute (T("explicitFocusOrder"), comp->getExplicitFocusOrder()); | e->setAttribute (T("explicitFocusOrder"), comp->getExplicitFocusOrder()); | ||||
| RelativePositionedRectangle pos (getComponentPosition (comp)); | RelativePositionedRectangle pos (getComponentPosition (comp)); | ||||
| @@ -181,8 +181,8 @@ bool ComponentTypeHandler::restoreFromXml (const XmlElement& xml, | |||||
| comp->setName (xml.getStringAttribute (T("name"), comp->getName())); | comp->setName (xml.getStringAttribute (T("name"), comp->getName())); | ||||
| setComponentId (comp, xml.getStringAttribute (T("id")).getHexValue64()); | setComponentId (comp, xml.getStringAttribute (T("id")).getHexValue64()); | ||||
| comp->setComponentProperty (T("memberName"), xml.getStringAttribute (T("memberName"))); | |||||
| comp->setComponentProperty (T("virtualName"), xml.getStringAttribute (T("virtualName"))); | |||||
| comp->getProperties().set ("memberName", xml.getStringAttribute (T("memberName"))); | |||||
| comp->getProperties().set ("virtualName", xml.getStringAttribute (T("virtualName"))); | |||||
| comp->setExplicitFocusOrder (xml.getIntAttribute (T("explicitFocusOrder"))); | comp->setExplicitFocusOrder (xml.getIntAttribute (T("explicitFocusOrder"))); | ||||
| RelativePositionedRectangle currentPos (getComponentPosition (comp)); | RelativePositionedRectangle currentPos (getComponentPosition (comp)); | ||||
| @@ -218,7 +218,7 @@ int64 ComponentTypeHandler::getComponentId (Component* comp) | |||||
| if (comp == 0) | if (comp == 0) | ||||
| return 0; | return 0; | ||||
| int64 compId = comp->getComponentProperty (T("jucerCompId"), false).getHexValue64(); | |||||
| int64 compId = comp->getProperties() ["jucerCompId"].toString().getHexValue64(); | |||||
| if (compId == 0) | if (compId == 0) | ||||
| { | { | ||||
| @@ -233,17 +233,17 @@ void ComponentTypeHandler::setComponentId (Component* comp, const int64 newID) | |||||
| { | { | ||||
| jassert (comp != 0); | jassert (comp != 0); | ||||
| if (newID != 0) | if (newID != 0) | ||||
| comp->setComponentProperty (T("jucerCompId"), String::toHexString (newID)); | |||||
| comp->getProperties().set ("jucerCompId", String::toHexString (newID)); | |||||
| } | } | ||||
| const RelativePositionedRectangle ComponentTypeHandler::getComponentPosition (Component* comp) | const RelativePositionedRectangle ComponentTypeHandler::getComponentPosition (Component* comp) | ||||
| { | { | ||||
| RelativePositionedRectangle rp; | RelativePositionedRectangle rp; | ||||
| rp.rect = PositionedRectangle (comp->getComponentProperty (T("pos"), false)); | |||||
| rp.relativeToX = comp->getComponentProperty (T("relativeToX"), false).getHexValue64(); | |||||
| rp.relativeToY = comp->getComponentProperty (T("relativeToY"), false).getHexValue64(); | |||||
| rp.relativeToW = comp->getComponentProperty (T("relativeToW"), false).getHexValue64(); | |||||
| rp.relativeToH = comp->getComponentProperty (T("relativeToH"), false).getHexValue64(); | |||||
| rp.rect = PositionedRectangle (comp->getProperties() ["pos"]); | |||||
| rp.relativeToX = comp->getProperties() ["relativeToX"].toString().getHexValue64(); | |||||
| rp.relativeToY = comp->getProperties() ["relativeToY"].toString().getHexValue64(); | |||||
| rp.relativeToW = comp->getProperties() ["relativeToW"].toString().getHexValue64(); | |||||
| rp.relativeToH = comp->getProperties() ["relativeToH"].toString().getHexValue64(); | |||||
| return rp; | return rp; | ||||
| } | } | ||||
| @@ -252,11 +252,11 @@ void ComponentTypeHandler::setComponentPosition (Component* comp, | |||||
| const RelativePositionedRectangle& newPos, | const RelativePositionedRectangle& newPos, | ||||
| const ComponentLayout* layout) | const ComponentLayout* layout) | ||||
| { | { | ||||
| comp->setComponentProperty (T("pos"), newPos.rect.toString()); | |||||
| comp->setComponentProperty (T("relativeToX"), String::toHexString (newPos.relativeToX)); | |||||
| comp->setComponentProperty (T("relativeToY"), String::toHexString (newPos.relativeToY)); | |||||
| comp->setComponentProperty (T("relativeToW"), String::toHexString (newPos.relativeToW)); | |||||
| comp->setComponentProperty (T("relativeToH"), String::toHexString (newPos.relativeToH)); | |||||
| comp->getProperties().set ("pos", newPos.rect.toString()); | |||||
| comp->getProperties().set ("relativeToX", String::toHexString (newPos.relativeToX)); | |||||
| comp->getProperties().set ("relativeToY", String::toHexString (newPos.relativeToY)); | |||||
| comp->getProperties().set ("relativeToW", String::toHexString (newPos.relativeToW)); | |||||
| comp->getProperties().set ("relativeToH", String::toHexString (newPos.relativeToH)); | |||||
| comp->setBounds (newPos.getRectangle (Rectangle (0, 0, comp->getParentWidth(), comp->getParentHeight()), | comp->setBounds (newPos.getRectangle (Rectangle (0, 0, comp->getParentWidth(), comp->getParentHeight()), | ||||
| layout)); | layout)); | ||||
| @@ -507,7 +507,7 @@ void ComponentTypeHandler::fillInGeneratedCode (Component* component, GeneratedC | |||||
| void ComponentTypeHandler::fillInMemberVariableDeclarations (GeneratedCode& code, Component* component, const String& memberVariableName) | void ComponentTypeHandler::fillInMemberVariableDeclarations (GeneratedCode& code, Component* component, const String& memberVariableName) | ||||
| { | { | ||||
| const String virtualName (component->getComponentProperty (T("virtualName"), false)); | |||||
| const String virtualName (component->getProperties() ["virtualName"].toString()); | |||||
| if (virtualName.isNotEmpty()) | if (virtualName.isNotEmpty()) | ||||
| { | { | ||||
| @@ -550,7 +550,7 @@ const String ComponentTypeHandler::getCreationParameters (Component* component) | |||||
| void ComponentTypeHandler::fillInCreationCode (GeneratedCode& code, Component* component, const String& memberVariableName) | void ComponentTypeHandler::fillInCreationCode (GeneratedCode& code, Component* component, const String& memberVariableName) | ||||
| { | { | ||||
| String params (getCreationParameters (component)); | String params (getCreationParameters (component)); | ||||
| const String virtualName (component->getComponentProperty (T("virtualName"), false)); | |||||
| const String virtualName (component->getProperties() ["virtualName"].toString()); | |||||
| String s; | String s; | ||||
| s << "addAndMakeVisible (" << memberVariableName << " = new "; | s << "addAndMakeVisible (" << memberVariableName << " = new "; | ||||
| @@ -247,7 +247,7 @@ public: | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| button->setComponentProperty ("resource" + String ((int) role), newName); | |||||
| button->getProperties().set ("resource" + String ((int) role), newName); | |||||
| updateButtonImages (*layout.getDocument(), button); | updateButtonImages (*layout.getDocument(), button); | ||||
| layout.changed(); | layout.changed(); | ||||
| } | } | ||||
| @@ -257,7 +257,7 @@ public: | |||||
| static const String getImageResource (ImageButton* button, const ImageRole role) | static const String getImageResource (ImageButton* button, const ImageRole role) | ||||
| { | { | ||||
| jassert (role < 3); | jassert (role < 3); | ||||
| return button->getComponentProperty ("resource" + String ((int) role), false); | |||||
| return button->getProperties() ["resource" + String ((int) role)].toString(); | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -295,7 +295,7 @@ public: | |||||
| static bool doesImageKeepProportions (ImageButton* button) | static bool doesImageKeepProportions (ImageButton* button) | ||||
| { | { | ||||
| return button->getComponentPropertyBool ("keepImageProp", false, true); | |||||
| return button->getProperties().getWithDefault ("keepImageProp", true); | |||||
| } | } | ||||
| static void setImageKeepProportions (ComponentLayout& layout, ImageButton* button, const bool newState, const bool undoable) | static void setImageKeepProportions (ComponentLayout& layout, ImageButton* button, const bool newState, const bool undoable) | ||||
| @@ -306,7 +306,7 @@ public: | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| button->setComponentProperty ("keepImageProp", newState); | |||||
| button->getProperties().set ("keepImageProp", newState); | |||||
| updateButtonImages (*layout.getDocument(), button); | updateButtonImages (*layout.getDocument(), button); | ||||
| layout.changed(); | layout.changed(); | ||||
| } | } | ||||
| @@ -375,7 +375,7 @@ public: | |||||
| static float getImageOpacity (ImageButton* button, const ImageRole role) | static float getImageOpacity (ImageButton* button, const ImageRole role) | ||||
| { | { | ||||
| return (float) button->getComponentPropertyDouble ("imageOpacity" + String ((int) role), false, 1.0f); | |||||
| return (float) button->getProperties().getWithDefault ("imageOpacity" + String ((int) role), 1.0f); | |||||
| } | } | ||||
| static void setImageOpacity (ComponentLayout& layout, ImageButton* button, const ImageRole role, const float opacity, const bool undoable) | static void setImageOpacity (ComponentLayout& layout, ImageButton* button, const ImageRole role, const float opacity, const bool undoable) | ||||
| @@ -386,7 +386,7 @@ public: | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| button->setComponentProperty ("imageOpacity" + String ((int) role), opacity); | |||||
| button->getProperties().set ("imageOpacity" + String ((int) role), opacity); | |||||
| updateButtonImages (*layout.getDocument(), button); | updateButtonImages (*layout.getDocument(), button); | ||||
| layout.changed(); | layout.changed(); | ||||
| } | } | ||||
| @@ -459,7 +459,7 @@ public: | |||||
| static const Colour getImageColour (ImageButton* button, const ImageRole role) | static const Colour getImageColour (ImageButton* button, const ImageRole role) | ||||
| { | { | ||||
| return Colour::fromString (button->getComponentProperty ("imageColour" + String ((int) role), false, "0")); | |||||
| return Colour::fromString (button->getProperties().getWithDefault ("imageColour" + String ((int) role), "0").toString()); | |||||
| } | } | ||||
| static void setImageColour (ComponentLayout& layout, ImageButton* button, const ImageRole role, const Colour& colour, const bool undoable) | static void setImageColour (ComponentLayout& layout, ImageButton* button, const ImageRole role, const Colour& colour, const bool undoable) | ||||
| @@ -470,7 +470,7 @@ public: | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| button->setComponentProperty ("imageColour" + String ((int) role), colour.toString()); | |||||
| button->getProperties().set ("imageColour" + String ((int) role), colour.toString()); | |||||
| updateButtonImages (*layout.getDocument(), button); | updateButtonImages (*layout.getDocument(), button); | ||||
| layout.changed(); | layout.changed(); | ||||
| } | } | ||||
| @@ -66,7 +66,7 @@ public: | |||||
| e->setAttribute (T("editableDoubleClick"), l->isEditableOnDoubleClick()); | e->setAttribute (T("editableDoubleClick"), l->isEditableOnDoubleClick()); | ||||
| e->setAttribute (T("focusDiscardsChanges"), l->doesLossOfFocusDiscardChanges()); | e->setAttribute (T("focusDiscardsChanges"), l->doesLossOfFocusDiscardChanges()); | ||||
| e->setAttribute (T("fontname"), l->getComponentProperty (T("typefaceName"), false, FontPropertyComponent::defaultFont)); | |||||
| e->setAttribute (T("fontname"), l->getProperties().getWithDefault ("typefaceName", FontPropertyComponent::defaultFont).toString()); | |||||
| e->setAttribute (T("fontsize"), roundToInt (l->getFont().getHeight() * 100.0) / 100.0); | e->setAttribute (T("fontsize"), roundToInt (l->getFont().getHeight() * 100.0) / 100.0); | ||||
| e->setAttribute (T("bold"), l->getFont().isBold()); | e->setAttribute (T("bold"), l->getFont().isBold()); | ||||
| e->setAttribute (T("italic"), l->getFont().isItalic()); | e->setAttribute (T("italic"), l->getFont().isItalic()); | ||||
| @@ -90,7 +90,7 @@ public: | |||||
| font.setItalic (xml.getBoolAttribute (T("italic"), false)); | font.setItalic (xml.getBoolAttribute (T("italic"), false)); | ||||
| l->setFont (font); | l->setFont (font); | ||||
| l->setComponentProperty (T("typefaceName"), xml.getStringAttribute (T("fontname"), FontPropertyComponent::defaultFont)); | |||||
| l->getProperties().set ("typefaceName", xml.getStringAttribute (T("fontname"), FontPropertyComponent::defaultFont)); | |||||
| updateLabelFont (l); | updateLabelFont (l); | ||||
| l->setJustificationType (Justification (xml.getIntAttribute (T("justification"), Justification::centred))); | l->setJustificationType (Justification (xml.getIntAttribute (T("justification"), Justification::centred))); | ||||
| @@ -107,7 +107,7 @@ public: | |||||
| static void updateLabelFont (Label* label) | static void updateLabelFont (Label* label) | ||||
| { | { | ||||
| Font f (label->getFont()); | Font f (label->getFont()); | ||||
| f = FontPropertyComponent::applyNameToFont (label->getComponentProperty (T("typefaceName"), false, FontPropertyComponent::defaultFont), f); | |||||
| f = FontPropertyComponent::applyNameToFont (label->getProperties().getWithDefault ("typefaceName", FontPropertyComponent::defaultFont), f); | |||||
| label->setFont (f); | label->setFont (f); | ||||
| } | } | ||||
| @@ -129,7 +129,7 @@ public: | |||||
| String s; | String s; | ||||
| s << memberVariableName << "->setFont (" | s << memberVariableName << "->setFont (" | ||||
| << FontPropertyComponent::getCompleteFontCode (l->getFont(), l->getComponentProperty (T("typefaceName"), false, FontPropertyComponent::defaultFont)) | |||||
| << FontPropertyComponent::getCompleteFontCode (l->getFont(), l->getProperties().getWithDefault ("typefaceName", FontPropertyComponent::defaultFont)) | |||||
| << ");\n" | << ");\n" | ||||
| << memberVariableName << "->setJustificationType (" | << memberVariableName << "->setJustificationType (" | ||||
| << justificationToCode (l->getJustificationType()) | << justificationToCode (l->getJustificationType()) | ||||
| @@ -463,7 +463,7 @@ private: | |||||
| const String getTypefaceName() const | const String getTypefaceName() const | ||||
| { | { | ||||
| return label->getComponentProperty (T("typefaceName"), false, FontPropertyComponent::defaultFont); | |||||
| return label->getProperties().getWithDefault ("typefaceName", FontPropertyComponent::defaultFont); | |||||
| } | } | ||||
| void changeListenerCallback (void*) { refresh(); } | void changeListenerCallback (void*) { refresh(); } | ||||
| @@ -479,13 +479,13 @@ private: | |||||
| : ComponentUndoableAction <Label> (comp, layout), | : ComponentUndoableAction <Label> (comp, layout), | ||||
| newState (newState_) | newState (newState_) | ||||
| { | { | ||||
| oldState = comp->getComponentProperty (T("typefaceName"), false, FontPropertyComponent::defaultFont); | |||||
| oldState = comp->getProperties().getWithDefault ("typefaceName", FontPropertyComponent::defaultFont); | |||||
| } | } | ||||
| bool perform() | bool perform() | ||||
| { | { | ||||
| showCorrectTab(); | showCorrectTab(); | ||||
| getComponent()->setComponentProperty (T("typefaceName"), newState); | |||||
| getComponent()->getProperties().set ("typefaceName", newState); | |||||
| LabelHandler::updateLabelFont (getComponent()); | LabelHandler::updateLabelFont (getComponent()); | ||||
| changed(); | changed(); | ||||
| return true; | return true; | ||||
| @@ -494,7 +494,7 @@ private: | |||||
| bool undo() | bool undo() | ||||
| { | { | ||||
| showCorrectTab(); | showCorrectTab(); | ||||
| getComponent()->setComponentProperty (T("typefaceName"), oldState); | |||||
| getComponent()->getProperties().set ("typefaceName", oldState); | |||||
| LabelHandler::updateLabelFont (getComponent()); | LabelHandler::updateLabelFont (getComponent()); | ||||
| changed(); | changed(); | ||||
| return true; | return true; | ||||
| @@ -56,7 +56,7 @@ public: | |||||
| XmlElement* e = ComponentTypeHandler::createXmlFor (comp, layout); | XmlElement* e = ComponentTypeHandler::createXmlFor (comp, layout); | ||||
| TextEditor* te = (TextEditor*) comp; | TextEditor* te = (TextEditor*) comp; | ||||
| e->setAttribute (T("initialText"), comp->getComponentProperty (T("initialText"), false)); | |||||
| e->setAttribute (T("initialText"), comp->getProperties() ["initialText"].toString()); | |||||
| e->setAttribute (T("multiline"), te->isMultiLine()); | e->setAttribute (T("multiline"), te->isMultiLine()); | ||||
| e->setAttribute (T("retKeyStartsLine"), te->getReturnKeyStartsNewLine()); | e->setAttribute (T("retKeyStartsLine"), te->getReturnKeyStartsNewLine()); | ||||
| @@ -85,7 +85,7 @@ public: | |||||
| const String initialText (xml.getStringAttribute (T("initialText"))); | const String initialText (xml.getStringAttribute (T("initialText"))); | ||||
| te->setText (initialText, false); | te->setText (initialText, false); | ||||
| te->setComponentProperty (T("initialText"), initialText); | |||||
| te->getProperties().set ("initialText", initialText); | |||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -126,7 +126,7 @@ public: | |||||
| << memberVariableName << "->setCaretVisible (" << boolToString (te->isCaretVisible()) << ");\n" | << memberVariableName << "->setCaretVisible (" << boolToString (te->isCaretVisible()) << ");\n" | ||||
| << memberVariableName << "->setPopupMenuEnabled (" << boolToString (te->isPopupMenuEnabled()) << ");\n" | << memberVariableName << "->setPopupMenuEnabled (" << boolToString (te->isPopupMenuEnabled()) << ");\n" | ||||
| << getColourIntialisationCode (component, memberVariableName) | << getColourIntialisationCode (component, memberVariableName) | ||||
| << memberVariableName << "->setText (" << quotedString (te->getComponentProperty (T("initialText"), false)) << ");\n\n"; | |||||
| << memberVariableName << "->setText (" << quotedString (te->getProperties() ["initialText"].toString()) << ");\n\n"; | |||||
| code.constructorCode += s; | code.constructorCode += s; | ||||
| } | } | ||||
| @@ -405,7 +405,7 @@ private: | |||||
| const String getText() const | const String getText() const | ||||
| { | { | ||||
| return component->getComponentProperty (T("initialText"), false); | |||||
| return component->getProperties() ["initialText"]; | |||||
| } | } | ||||
| private: | private: | ||||
| @@ -416,14 +416,14 @@ private: | |||||
| : ComponentUndoableAction <TextEditor> (comp, layout), | : ComponentUndoableAction <TextEditor> (comp, layout), | ||||
| newState (newState_) | newState (newState_) | ||||
| { | { | ||||
| oldState = comp->getComponentProperty (T("initialText"), false); | |||||
| oldState = comp->getProperties() ["initialText"]; | |||||
| } | } | ||||
| bool perform() | bool perform() | ||||
| { | { | ||||
| showCorrectTab(); | showCorrectTab(); | ||||
| getComponent()->setText (newState, false); | getComponent()->setText (newState, false); | ||||
| getComponent()->setComponentProperty (T("initialText"), newState); | |||||
| getComponent()->getProperties().set ("initialText", newState); | |||||
| changed(); | changed(); | ||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -432,7 +432,7 @@ private: | |||||
| { | { | ||||
| showCorrectTab(); | showCorrectTab(); | ||||
| getComponent()->setText (oldState, false); | getComponent()->setText (oldState, false); | ||||
| getComponent()->setComponentProperty (T("initialText"), oldState); | |||||
| getComponent()->getProperties().set ("initialText", oldState); | |||||
| changed(); | changed(); | ||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -205,56 +205,56 @@ public: | |||||
| static int getViewportContentType (Viewport* vp) | static int getViewportContentType (Viewport* vp) | ||||
| { | { | ||||
| return vp->getComponentPropertyInt (T("contentType"), false, 0); | |||||
| return vp->getProperties() ["contentType"]; | |||||
| } | } | ||||
| static void setViewportContentType (Viewport* vp, int newValue) | static void setViewportContentType (Viewport* vp, int newValue) | ||||
| { | { | ||||
| if (newValue != getViewportContentType (vp)) | if (newValue != getViewportContentType (vp)) | ||||
| { | { | ||||
| vp->setComponentProperty (T("contentType"), newValue); | |||||
| vp->getProperties().set ("contentType", newValue); | |||||
| updateViewportContentComp (vp); | updateViewportContentComp (vp); | ||||
| } | } | ||||
| } | } | ||||
| static const String getViewportJucerComponentFile (Viewport* vp) | static const String getViewportJucerComponentFile (Viewport* vp) | ||||
| { | { | ||||
| return vp->getComponentProperty (T("jucerFile"), false); | |||||
| return vp->getProperties() ["jucerFile"].toString(); | |||||
| } | } | ||||
| static void setViewportJucerComponentFile (Viewport* vp, const String& file) | static void setViewportJucerComponentFile (Viewport* vp, const String& file) | ||||
| { | { | ||||
| if (file != getViewportJucerComponentFile (vp)) | if (file != getViewportJucerComponentFile (vp)) | ||||
| { | { | ||||
| vp->setComponentProperty (T("jucerFile"), file); | |||||
| vp->getProperties().set ("jucerFile", file); | |||||
| updateViewportContentComp (vp); | updateViewportContentComp (vp); | ||||
| } | } | ||||
| } | } | ||||
| static const String getViewportGenericComponentClass (Viewport* vp) | static const String getViewportGenericComponentClass (Viewport* vp) | ||||
| { | { | ||||
| return vp->getComponentProperty (T("contentClass"), false); | |||||
| return vp->getProperties() ["contentClass"].toString(); | |||||
| } | } | ||||
| static void setViewportGenericComponentClass (Viewport* vp, const String& className) | static void setViewportGenericComponentClass (Viewport* vp, const String& className) | ||||
| { | { | ||||
| if (className != getViewportGenericComponentClass (vp)) | if (className != getViewportGenericComponentClass (vp)) | ||||
| { | { | ||||
| vp->setComponentProperty (T("contentClass"), className); | |||||
| vp->getProperties().set ("contentClass", className); | |||||
| updateViewportContentComp (vp); | updateViewportContentComp (vp); | ||||
| } | } | ||||
| } | } | ||||
| static const String getViewportConstructorParams (Viewport* vp) | static const String getViewportConstructorParams (Viewport* vp) | ||||
| { | { | ||||
| return vp->getComponentProperty (T("constructorParams"), false); | |||||
| return vp->getProperties() ["constructorParams"].toString(); | |||||
| } | } | ||||
| static void setViewportConstructorParams (Viewport* vp, const String& newParams) | static void setViewportConstructorParams (Viewport* vp, const String& newParams) | ||||
| { | { | ||||
| if (newParams != getViewportConstructorParams (vp)) | if (newParams != getViewportConstructorParams (vp)) | ||||
| { | { | ||||
| vp->setComponentProperty (T("constructorParams"), newParams); | |||||
| vp->getProperties().set ("constructorParams", newParams); | |||||
| updateViewportContentComp (vp); | updateViewportContentComp (vp); | ||||
| } | } | ||||
| } | } | ||||
| @@ -378,7 +378,7 @@ Component* ComponentLayout::addNewComponent (ComponentTypeHandler* const type, i | |||||
| c->setCentrePosition (x, y); | c->setCentrePosition (x, y); | ||||
| updateStoredComponentPosition (c, false); | updateStoredComponentPosition (c, false); | ||||
| c->setComponentProperty (T("id"), nextCompUID++); | |||||
| c->getProperties().set ("id", nextCompUID++); | |||||
| XmlElement* xml = type->createXmlFor (c, this); | XmlElement* xml = type->createXmlFor (c, this); | ||||
| delete c; | delete c; | ||||
| @@ -472,8 +472,9 @@ Component* ComponentLayout::getComponentRelativePosTarget (Component* comp, int | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| return findComponentWithId (comp->getComponentProperty (String (T("relativeTo")) | |||||
| + dimensionSuffixes [whichDimension], false).getHexValue64()); | |||||
| return findComponentWithId (comp->getProperties() [String (T("relativeTo")) | |||||
| + dimensionSuffixes [whichDimension]] | |||||
| .toString().getHexValue64()); | |||||
| } | } | ||||
| } | } | ||||
| @@ -641,8 +642,8 @@ void ComponentLayout::startDragging() | |||||
| for (int i = 0; i < components.size(); ++i) | for (int i = 0; i < components.size(); ++i) | ||||
| { | { | ||||
| Component* const c = components[i]; | Component* const c = components[i]; | ||||
| c->setComponentProperty (T("xDragStart"), c->getX()); | |||||
| c->setComponentProperty (T("yDragStart"), c->getY()); | |||||
| c->getProperties().set ("xDragStart", c->getX()); | |||||
| c->getProperties().set ("yDragStart", c->getY()); | |||||
| } | } | ||||
| jassert (document != 0); | jassert (document != 0); | ||||
| @@ -661,8 +662,8 @@ void ComponentLayout::dragSelectedComps (int dx, int dy, const bool allowSnap) | |||||
| { | { | ||||
| Component* const c = selected.getSelectedItem (i); | Component* const c = selected.getSelectedItem (i); | ||||
| const int startX = c->getComponentPropertyInt (T("xDragStart"), false); | |||||
| const int startY = c->getComponentPropertyInt (T("yDragStart"), false); | |||||
| const int startX = c->getProperties() ["xDragStart"]; | |||||
| const int startY = c->getProperties() ["yDragStart"]; | |||||
| if (allowSnap && document != 0 && selected.getNumSelected() == 1) | if (allowSnap && document != 0 && selected.getNumSelected() == 1) | ||||
| { | { | ||||
| @@ -692,8 +693,8 @@ void ComponentLayout::endDragging() | |||||
| const int newX = c->getX(); | const int newX = c->getX(); | ||||
| const int newY = c->getY(); | const int newY = c->getY(); | ||||
| const int startX = c->getComponentPropertyInt (T("xDragStart"), false); | |||||
| const int startY = c->getComponentPropertyInt (T("yDragStart"), false); | |||||
| const int startX = c->getProperties() ["xDragStart"]; | |||||
| const int startY = c->getProperties() ["yDragStart"]; | |||||
| c->setTopLeftPosition (startX, startY); | c->setTopLeftPosition (startX, startY); | ||||
| updateStoredComponentPosition (c, false); | updateStoredComponentPosition (c, false); | ||||
| @@ -774,7 +775,7 @@ const String ComponentLayout::getComponentMemberVariableName (Component* comp) c | |||||
| if (comp == 0) | if (comp == 0) | ||||
| return String::empty; | return String::empty; | ||||
| String name (comp->getComponentProperty (T("memberName"), false)); | |||||
| String name (comp->getProperties() ["memberName"].toString()); | |||||
| if (name.isEmpty()) | if (name.isEmpty()) | ||||
| name = getUnusedMemberName (makeValidCppIdentifier (comp->getName(), true, true, false), comp); | name = getUnusedMemberName (makeValidCppIdentifier (comp->getName(), true, true, false), comp); | ||||
| @@ -786,10 +787,10 @@ void ComponentLayout::setComponentMemberVariableName (Component* comp, const Str | |||||
| { | { | ||||
| const String oldName (getComponentMemberVariableName (comp)); | const String oldName (getComponentMemberVariableName (comp)); | ||||
| comp->setComponentProperty (T("memberName"), String::empty); | |||||
| comp->getProperties().set ("memberName", String::empty); | |||||
| const String n (getUnusedMemberName (makeValidCppIdentifier (newName, false, true, false), comp)); | const String n (getUnusedMemberName (makeValidCppIdentifier (newName, false, true, false), comp)); | ||||
| comp->setComponentProperty (T("memberName"), n); | |||||
| comp->getProperties().set ("memberName", n); | |||||
| if (n != oldName) | if (n != oldName) | ||||
| changed(); | changed(); | ||||
| @@ -811,7 +812,7 @@ const String ComponentLayout::getUnusedMemberName (String nameRoot, Component* c | |||||
| for (int i = 0; i < components.size(); ++i) | for (int i = 0; i < components.size(); ++i) | ||||
| { | { | ||||
| if (components[i] != comp | if (components[i] != comp | ||||
| && components[i]->getComponentProperty (T("memberName"), false) == n) | |||||
| && components[i]->getProperties() ["memberName"] == n) | |||||
| { | { | ||||
| alreadyUsed = true; | alreadyUsed = true; | ||||
| break; | break; | ||||
| @@ -833,7 +834,7 @@ const String ComponentLayout::getComponentVirtualClassName (Component* comp) con | |||||
| if (comp == 0) | if (comp == 0) | ||||
| return String::empty; | return String::empty; | ||||
| return comp->getComponentProperty (T("virtualName"), false); | |||||
| return comp->getProperties() ["virtualName"]; | |||||
| } | } | ||||
| void ComponentLayout::setComponentVirtualClassName (Component* comp, const String& newName) | void ComponentLayout::setComponentVirtualClassName (Component* comp, const String& newName) | ||||
| @@ -842,7 +843,7 @@ void ComponentLayout::setComponentVirtualClassName (Component* comp, const Strin | |||||
| if (name != getComponentVirtualClassName (comp)) | if (name != getComponentVirtualClassName (comp)) | ||||
| { | { | ||||
| comp->setComponentProperty (T("virtualName"), name); | |||||
| comp->getProperties().set ("virtualName", name); | |||||
| changed(); | changed(); | ||||
| } | } | ||||
| } | } | ||||
| @@ -460,8 +460,8 @@ void PaintRoutine::startDragging (const Rectangle& parentArea) | |||||
| Rectangle r (c->getCurrentBounds (parentArea)); | Rectangle r (c->getCurrentBounds (parentArea)); | ||||
| c->setComponentProperty (T("xDragStart"), r.getX()); | |||||
| c->setComponentProperty (T("yDragStart"), r.getY()); | |||||
| c->getProperties().set ("xDragStart", r.getX()); | |||||
| c->getProperties().set ("yDragStart", r.getY()); | |||||
| } | } | ||||
| getDocument()->getUndoManager().beginNewTransaction(); | getDocument()->getUndoManager().beginNewTransaction(); | ||||
| @@ -481,8 +481,8 @@ void PaintRoutine::dragSelectedComps (int dx, int dy, const Rectangle& parentAre | |||||
| { | { | ||||
| PaintElement* const c = selectedElements.getSelectedItem (i); | PaintElement* const c = selectedElements.getSelectedItem (i); | ||||
| const int startX = c->getComponentPropertyInt (T("xDragStart"), false); | |||||
| const int startY = c->getComponentPropertyInt (T("yDragStart"), false); | |||||
| const int startX = c->getProperties() ["xDragStart"]; | |||||
| const int startY = c->getProperties() ["yDragStart"]; | |||||
| Rectangle r (c->getCurrentBounds (parentArea)); | Rectangle r (c->getCurrentBounds (parentArea)); | ||||
| @@ -29,6 +29,7 @@ | |||||
| #include "juce_AudioProcessorEditor.h" | #include "juce_AudioProcessorEditor.h" | ||||
| #include "../dsp/juce_AudioSampleBuffer.h" | #include "../dsp/juce_AudioSampleBuffer.h" | ||||
| #include "../midi/juce_MidiBuffer.h" | #include "../midi/juce_MidiBuffer.h" | ||||
| #include "../../text/juce_XmlElement.h" | |||||
| #include "../../containers/juce_BitArray.h" | #include "../../containers/juce_BitArray.h" | ||||
| #include "juce_AudioProcessorListener.h" | #include "juce_AudioProcessorListener.h" | ||||
| #include "juce_AudioPlayHead.h" | #include "juce_AudioPlayHead.h" | ||||
| @@ -29,6 +29,7 @@ | |||||
| #include "juce_AudioProcessor.h" | #include "juce_AudioProcessor.h" | ||||
| #include "../plugins/juce_AudioPluginFormatManager.h" | #include "../plugins/juce_AudioPluginFormatManager.h" | ||||
| #include "../plugins/juce_KnownPluginList.h" | #include "../plugins/juce_KnownPluginList.h" | ||||
| #include "../../containers/juce_PropertySet.h" | |||||
| #include "../../containers/juce_ReferenceCountedArray.h" | #include "../../containers/juce_ReferenceCountedArray.h" | ||||
| @@ -0,0 +1,87 @@ | |||||
| /* | |||||
| ============================================================================== | |||||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||||
| Copyright 2004-9 by Raw Material Software Ltd. | |||||
| ------------------------------------------------------------------------------ | |||||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||||
| Public License (Version 2), as published by the Free Software Foundation. | |||||
| A copy of the license is included in the JUCE distribution, or can be found | |||||
| online at www.gnu.org/licenses. | |||||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||||
| ------------------------------------------------------------------------------ | |||||
| To release a closed-source product which uses JUCE, commercial licenses are | |||||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||||
| ============================================================================== | |||||
| */ | |||||
| #include "../core/juce_StandardHeader.h" | |||||
| BEGIN_JUCE_NAMESPACE | |||||
| #include "juce_DynamicObject.h" | |||||
| //============================================================================== | |||||
| DynamicObject::DynamicObject() | |||||
| { | |||||
| } | |||||
| DynamicObject::~DynamicObject() | |||||
| { | |||||
| } | |||||
| bool DynamicObject::hasProperty (const var::identifier& propertyName) const | |||||
| { | |||||
| var* const v = properties.getItem (propertyName); | |||||
| return v != 0 && ! v->isMethod(); | |||||
| } | |||||
| const var DynamicObject::getProperty (const var::identifier& propertyName) const | |||||
| { | |||||
| return properties [propertyName]; | |||||
| } | |||||
| void DynamicObject::setProperty (const var::identifier& propertyName, const var& newValue) | |||||
| { | |||||
| properties.set (propertyName, newValue); | |||||
| } | |||||
| void DynamicObject::removeProperty (const var::identifier& propertyName) | |||||
| { | |||||
| properties.remove (propertyName); | |||||
| } | |||||
| bool DynamicObject::hasMethod (const var::identifier& methodName) const | |||||
| { | |||||
| return getProperty (methodName).isMethod(); | |||||
| } | |||||
| const var DynamicObject::invokeMethod (const var::identifier& methodName, | |||||
| const var* parameters, | |||||
| int numParameters) | |||||
| { | |||||
| return properties [methodName].invoke (var (this), parameters, numParameters); | |||||
| } | |||||
| void DynamicObject::setMethod (const var::identifier& name, | |||||
| var::MethodFunction methodFunction) | |||||
| { | |||||
| properties.set (name, var (methodFunction)); | |||||
| } | |||||
| void DynamicObject::clear() | |||||
| { | |||||
| properties.clear(); | |||||
| } | |||||
| END_JUCE_NAMESPACE | |||||
| @@ -0,0 +1,119 @@ | |||||
| /* | |||||
| ============================================================================== | |||||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||||
| Copyright 2004-9 by Raw Material Software Ltd. | |||||
| ------------------------------------------------------------------------------ | |||||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||||
| Public License (Version 2), as published by the Free Software Foundation. | |||||
| A copy of the license is included in the JUCE distribution, or can be found | |||||
| online at www.gnu.org/licenses. | |||||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||||
| ------------------------------------------------------------------------------ | |||||
| To release a closed-source product which uses JUCE, commercial licenses are | |||||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||||
| ============================================================================== | |||||
| */ | |||||
| #ifndef __JUCE_DYNAMICOBJECT_JUCEHEADER__ | |||||
| #define __JUCE_DYNAMICOBJECT_JUCEHEADER__ | |||||
| #include "juce_NamedValueSet.h" | |||||
| #include "juce_ReferenceCountedObject.h" | |||||
| //============================================================================== | |||||
| /** | |||||
| Represents a dynamically implemented object. | |||||
| This class is primarily intended for wrapping scripting language objects, | |||||
| but could be used for other purposes. | |||||
| An instance of a DynamicObject can be used to store named properties, and | |||||
| by subclassing hasMethod() and invokeMethod(), you can give your object | |||||
| methods. | |||||
| */ | |||||
| class JUCE_API DynamicObject : public ReferenceCountedObject | |||||
| { | |||||
| public: | |||||
| //============================================================================== | |||||
| DynamicObject(); | |||||
| /** Destructor. */ | |||||
| virtual ~DynamicObject(); | |||||
| //============================================================================== | |||||
| /** Returns true if the object has a property with this name. | |||||
| Note that if the property is actually a method, this will return false. | |||||
| */ | |||||
| virtual bool hasProperty (const var::identifier& propertyName) const; | |||||
| /** Returns a named property. | |||||
| This returns a void if no such property exists. | |||||
| */ | |||||
| virtual const var getProperty (const var::identifier& propertyName) const; | |||||
| /** Sets a named property. */ | |||||
| virtual void setProperty (const var::identifier& propertyName, const var& newValue); | |||||
| /** Removes a named property. */ | |||||
| virtual void removeProperty (const var::identifier& propertyName); | |||||
| //============================================================================== | |||||
| /** Checks whether this object has the specified method. | |||||
| The default implementation of this just checks whether there's a property | |||||
| with this name that's actually a method, but this can be overridden for | |||||
| building objects with dynamic invocation. | |||||
| */ | |||||
| virtual bool hasMethod (const var::identifier& methodName) const; | |||||
| /** Invokes a named method on this object. | |||||
| The default implementation looks up the named property, and if it's a method | |||||
| call, then it invokes it. | |||||
| This method is virtual to allow more dynamic invocation to used for objects | |||||
| where the methods may not already be set as properies. | |||||
| */ | |||||
| virtual const var invokeMethod (const var::identifier& methodName, | |||||
| const var* parameters, | |||||
| int numParameters); | |||||
| /** Sets up a method. | |||||
| This is basically the same as calling setProperty (methodName, (var::MethodFunction) myFunction), but | |||||
| helps to avoid accidentally invoking the wrong type of var constructor. It also makes | |||||
| the code easier to read, | |||||
| The compiler will probably force you to use an explicit cast your method to a (var::MethodFunction), e.g. | |||||
| @code | |||||
| setMethod ("doSomething", (var::MethodFunction) &MyClass::doSomething); | |||||
| @endcode | |||||
| */ | |||||
| void setMethod (const var::identifier& methodName, | |||||
| var::MethodFunction methodFunction); | |||||
| //============================================================================== | |||||
| /** Removes all properties and methods from the object. */ | |||||
| void clear(); | |||||
| //============================================================================== | |||||
| juce_UseDebuggingNewOperator | |||||
| private: | |||||
| NamedValueSet properties; | |||||
| }; | |||||
| #endif // __JUCE_DYNAMICOBJECT_JUCEHEADER__ | |||||
| @@ -0,0 +1,151 @@ | |||||
| /* | |||||
| ============================================================================== | |||||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||||
| Copyright 2004-9 by Raw Material Software Ltd. | |||||
| ------------------------------------------------------------------------------ | |||||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||||
| Public License (Version 2), as published by the Free Software Foundation. | |||||
| A copy of the license is included in the JUCE distribution, or can be found | |||||
| online at www.gnu.org/licenses. | |||||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||||
| ------------------------------------------------------------------------------ | |||||
| To release a closed-source product which uses JUCE, commercial licenses are | |||||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||||
| ============================================================================== | |||||
| */ | |||||
| #include "../core/juce_StandardHeader.h" | |||||
| BEGIN_JUCE_NAMESPACE | |||||
| #include "juce_NamedValueSet.h" | |||||
| //============================================================================== | |||||
| NamedValueSet::NamedValue::NamedValue() throw() | |||||
| { | |||||
| } | |||||
| inline NamedValueSet::NamedValue::NamedValue (const var::identifier& name_, const var& value_) | |||||
| : name (name_), value (value_) | |||||
| { | |||||
| } | |||||
| //============================================================================== | |||||
| NamedValueSet::NamedValueSet() throw() | |||||
| { | |||||
| } | |||||
| NamedValueSet::NamedValueSet (const NamedValueSet& other) | |||||
| : values (other.values) | |||||
| { | |||||
| } | |||||
| NamedValueSet& NamedValueSet::operator= (const NamedValueSet& other) | |||||
| { | |||||
| values = other.values; | |||||
| return *this; | |||||
| } | |||||
| NamedValueSet::~NamedValueSet() | |||||
| { | |||||
| } | |||||
| int NamedValueSet::size() const throw() | |||||
| { | |||||
| return values.size(); | |||||
| } | |||||
| const var& NamedValueSet::operator[] (const var::identifier& name) const | |||||
| { | |||||
| for (int i = values.size(); --i >= 0;) | |||||
| { | |||||
| const NamedValue& v = values.getReference(i); | |||||
| if (v.name == name) | |||||
| return v.value; | |||||
| } | |||||
| return var::null; | |||||
| } | |||||
| const var NamedValueSet::getWithDefault (const var::identifier& name, const var& defaultReturnValue) const | |||||
| { | |||||
| const var* v = getItem (name); | |||||
| return v != 0 ? *v : defaultReturnValue; | |||||
| } | |||||
| var* NamedValueSet::getItem (const var::identifier& name) const | |||||
| { | |||||
| for (int i = values.size(); --i >= 0;) | |||||
| { | |||||
| NamedValue& v = values.getReference(i); | |||||
| if (v.name == name) | |||||
| return &(v.value); | |||||
| } | |||||
| return 0; | |||||
| } | |||||
| bool NamedValueSet::set (const var::identifier& name, const var& newValue) | |||||
| { | |||||
| for (int i = values.size(); --i >= 0;) | |||||
| { | |||||
| NamedValue& v = values.getReference(i); | |||||
| if (v.name == name) | |||||
| { | |||||
| if (v.value == newValue) | |||||
| return false; | |||||
| v.value = newValue; | |||||
| return true; | |||||
| } | |||||
| } | |||||
| values.add (NamedValue (name, newValue)); | |||||
| return true; | |||||
| } | |||||
| bool NamedValueSet::contains (const var::identifier& name) const | |||||
| { | |||||
| return getItem (name) != 0; | |||||
| } | |||||
| bool NamedValueSet::remove (const var::identifier& name) | |||||
| { | |||||
| for (int i = values.size(); --i >= 0;) | |||||
| { | |||||
| if (values.getReference(i).name == name) | |||||
| { | |||||
| values.remove (i); | |||||
| return true; | |||||
| } | |||||
| } | |||||
| return false; | |||||
| } | |||||
| const var::identifier NamedValueSet::getName (int index) const | |||||
| { | |||||
| jassert (((unsigned int) index) < (unsigned int) values.size()); | |||||
| return values [index].name; | |||||
| } | |||||
| void NamedValueSet::clear() | |||||
| { | |||||
| values.clear(); | |||||
| } | |||||
| END_JUCE_NAMESPACE | |||||
| @@ -0,0 +1,114 @@ | |||||
| /* | |||||
| ============================================================================== | |||||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||||
| Copyright 2004-9 by Raw Material Software Ltd. | |||||
| ------------------------------------------------------------------------------ | |||||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||||
| Public License (Version 2), as published by the Free Software Foundation. | |||||
| A copy of the license is included in the JUCE distribution, or can be found | |||||
| online at www.gnu.org/licenses. | |||||
| JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||||
| WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||||
| A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||||
| ------------------------------------------------------------------------------ | |||||
| To release a closed-source product which uses JUCE, commercial licenses are | |||||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||||
| ============================================================================== | |||||
| */ | |||||
| #ifndef __JUCE_NAMEDVALUESET_JUCEHEADER__ | |||||
| #define __JUCE_NAMEDVALUESET_JUCEHEADER__ | |||||
| #include "juce_Variant.h" | |||||
| #include "../containers/juce_Array.h" | |||||
| //============================================================================== | |||||
| /** Holds a set of named var objects. | |||||
| This can be used as a basic structure to hold a set of var object, which can | |||||
| be retrieved by using their identifier. | |||||
| */ | |||||
| class JUCE_API NamedValueSet | |||||
| { | |||||
| public: | |||||
| /** Creates an empty set. */ | |||||
| NamedValueSet() throw(); | |||||
| /** Creates a copy of another set. */ | |||||
| NamedValueSet (const NamedValueSet& other); | |||||
| /** Replaces this set with a copy of another set. */ | |||||
| NamedValueSet& operator= (const NamedValueSet& other); | |||||
| /** Destructor. */ | |||||
| ~NamedValueSet(); | |||||
| //============================================================================== | |||||
| /** Returns the total number of values that the set contains. */ | |||||
| int size() const throw(); | |||||
| /** Returns the value of a named item. | |||||
| If the name isn't found, this will return a void variant. | |||||
| @see getProperty | |||||
| */ | |||||
| const var& operator[] (const var::identifier& name) const; | |||||
| /** Tries to return the named value, but if no such value is found, this will | |||||
| instead return the supplied default value. | |||||
| */ | |||||
| const var getWithDefault (const var::identifier& name, const var& defaultReturnValue) const; | |||||
| /** Returns a pointer to the object holding a named value, or | |||||
| null if there is no value with this name. */ | |||||
| var* getItem (const var::identifier& name) const; | |||||
| /** Changes or adds a named value. | |||||
| @returns true if a value was changed or added; false if the | |||||
| value was already set the the value passed-in. | |||||
| */ | |||||
| bool set (const var::identifier& name, const var& newValue); | |||||
| /** Returns true if the node contains an item with the specified name. */ | |||||
| bool contains (const var::identifier& name) const; | |||||
| /** Removes a value from the set. | |||||
| @returns true if a value was removed; false if there was no value | |||||
| with the name that was given. | |||||
| */ | |||||
| bool remove (const var::identifier& name); | |||||
| /** Returns the name of the value at a given index. | |||||
| The index must be between 0 and size() - 1. Out-of-range indexes will | |||||
| return an empty identifier. | |||||
| */ | |||||
| const var::identifier getName (int index) const; | |||||
| /** Removes all values. */ | |||||
| void clear(); | |||||
| //============================================================================== | |||||
| juce_UseDebuggingNewOperator | |||||
| private: | |||||
| struct NamedValue | |||||
| { | |||||
| NamedValue() throw(); | |||||
| NamedValue (const var::identifier& name, const var& value); | |||||
| var::identifier name; | |||||
| var value; | |||||
| }; | |||||
| Array <NamedValue> values; | |||||
| }; | |||||
| #endif // __JUCE_NAMEDVALUESET_JUCEHEADER__ | |||||
| @@ -142,16 +142,9 @@ ValueTree::SharedObject::SharedObject (const String& type_) | |||||
| } | } | ||||
| ValueTree::SharedObject::SharedObject (const SharedObject& other) | ValueTree::SharedObject::SharedObject (const SharedObject& other) | ||||
| : type (other.type), parent (0) | |||||
| : type (other.type), properties (other.properties), parent (0) | |||||
| { | { | ||||
| int i; | |||||
| for (i = 0; i < other.properties.size(); ++i) | |||||
| { | |||||
| const Property* const p = other.properties.getUnchecked(i); | |||||
| properties.add (new Property (p->name, p->value)); | |||||
| } | |||||
| for (i = 0; i < other.children.size(); ++i) | |||||
| for (int i = 0; i < other.children.size(); ++i) | |||||
| children.add (new SharedObject (*other.children.getUnchecked(i))); | children.add (new SharedObject (*other.children.getUnchecked(i))); | ||||
| } | } | ||||
| @@ -168,11 +161,6 @@ ValueTree::SharedObject::~SharedObject() | |||||
| } | } | ||||
| } | } | ||||
| ValueTree::SharedObject::Property::Property (const var::identifier& name_, const var& value_) | |||||
| : name (name_), value (value_) | |||||
| { | |||||
| } | |||||
| //============================================================================== | //============================================================================== | ||||
| void ValueTree::deliverPropertyChangeMessage (ValueTree& tree, const var::identifier& property) | void ValueTree::deliverPropertyChangeMessage (ValueTree& tree, const var::identifier& property) | ||||
| { | { | ||||
| @@ -269,83 +257,50 @@ void ValueTree::SharedObject::sendParentChangeMessage() | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| const var ValueTree::SharedObject::getProperty (const var::identifier& name) const | |||||
| const var& ValueTree::SharedObject::getProperty (const var::identifier& name) const | |||||
| { | { | ||||
| for (int i = properties.size(); --i >= 0;) | |||||
| { | |||||
| const Property* const p = properties.getUnchecked(i); | |||||
| if (p->name == name) | |||||
| return p->value; | |||||
| } | |||||
| return var(); | |||||
| return properties [name]; | |||||
| } | } | ||||
| void ValueTree::SharedObject::setProperty (const var::identifier& name, const var& newValue, UndoManager* const undoManager) | void ValueTree::SharedObject::setProperty (const var::identifier& name, const var& newValue, UndoManager* const undoManager) | ||||
| { | { | ||||
| for (int i = properties.size(); --i >= 0;) | |||||
| { | |||||
| Property* const p = properties.getUnchecked(i); | |||||
| if (p->name == name) | |||||
| { | |||||
| if (p->value != newValue) | |||||
| { | |||||
| if (undoManager == 0) | |||||
| { | |||||
| p->value = newValue; | |||||
| sendPropertyChangeMessage (name); | |||||
| } | |||||
| else | |||||
| { | |||||
| undoManager->perform (new ValueTreeSetPropertyAction (this, name, newValue, false, false)); | |||||
| } | |||||
| } | |||||
| return; | |||||
| } | |||||
| } | |||||
| if (undoManager == 0) | if (undoManager == 0) | ||||
| { | { | ||||
| properties.add (new Property (name, newValue)); | |||||
| sendPropertyChangeMessage (name); | |||||
| if (properties.set (name, newValue)) | |||||
| sendPropertyChangeMessage (name); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| undoManager->perform (new ValueTreeSetPropertyAction (this, name, newValue, true, false)); | |||||
| var* const existingValue = properties.getItem (name); | |||||
| if (existingValue != 0) | |||||
| { | |||||
| if (*existingValue != newValue) | |||||
| undoManager->perform (new ValueTreeSetPropertyAction (this, name, newValue, false, false)); | |||||
| } | |||||
| else | |||||
| { | |||||
| undoManager->perform (new ValueTreeSetPropertyAction (this, name, newValue, true, false)); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| bool ValueTree::SharedObject::hasProperty (const var::identifier& name) const | bool ValueTree::SharedObject::hasProperty (const var::identifier& name) const | ||||
| { | { | ||||
| for (int i = properties.size(); --i >= 0;) | |||||
| if (properties.getUnchecked(i)->name == name) | |||||
| return true; | |||||
| return false; | |||||
| return properties.contains (name); | |||||
| } | } | ||||
| void ValueTree::SharedObject::removeProperty (const var::identifier& name, UndoManager* const undoManager) | void ValueTree::SharedObject::removeProperty (const var::identifier& name, UndoManager* const undoManager) | ||||
| { | { | ||||
| for (int i = properties.size(); --i >= 0;) | |||||
| if (undoManager == 0) | |||||
| { | { | ||||
| Property* const p = properties.getUnchecked(i); | |||||
| if (p->name == name) | |||||
| { | |||||
| if (undoManager == 0) | |||||
| { | |||||
| properties.remove (i); | |||||
| sendPropertyChangeMessage (name); | |||||
| } | |||||
| else | |||||
| { | |||||
| undoManager->perform (new ValueTreeSetPropertyAction (this, name, var(), false, true)); | |||||
| } | |||||
| break; | |||||
| } | |||||
| if (properties.remove (name)) | |||||
| sendPropertyChangeMessage (name); | |||||
| } | |||||
| else | |||||
| { | |||||
| if (properties.contains (name)) | |||||
| undoManager->perform (new ValueTreeSetPropertyAction (this, name, var::null, false, true)); | |||||
| } | } | ||||
| } | } | ||||
| @@ -355,15 +310,15 @@ void ValueTree::SharedObject::removeAllProperties (UndoManager* const undoManage | |||||
| { | { | ||||
| while (properties.size() > 0) | while (properties.size() > 0) | ||||
| { | { | ||||
| const var::identifier name (properties.getLast()->name); | |||||
| properties.removeLast(); | |||||
| const var::identifier name (properties.getName (properties.size() - 1)); | |||||
| properties.remove (name); | |||||
| sendPropertyChangeMessage (name); | sendPropertyChangeMessage (name); | ||||
| } | } | ||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| for (int i = properties.size(); --i >= 0;) | for (int i = properties.size(); --i >= 0;) | ||||
| undoManager->perform (new ValueTreeSetPropertyAction (this, properties.getUnchecked(i)->name, var(), false, true)); | |||||
| undoManager->perform (new ValueTreeSetPropertyAction (this, properties.getName(i), var::null, false, true)); | |||||
| } | } | ||||
| } | } | ||||
| @@ -534,14 +489,14 @@ ValueTree ValueTree::getParent() const | |||||
| return object != 0 ? ValueTree (object->parent) : ValueTree ((SharedObject*) 0); | return object != 0 ? ValueTree (object->parent) : ValueTree ((SharedObject*) 0); | ||||
| } | } | ||||
| const var ValueTree::operator[] (const var::identifier& name) const | |||||
| const var& ValueTree::operator[] (const var::identifier& name) const | |||||
| { | { | ||||
| return object == 0 ? var() : object->getProperty (name); | |||||
| return object == 0 ? var::null : object->getProperty (name); | |||||
| } | } | ||||
| const var ValueTree::getProperty (const var::identifier& name) const | |||||
| const var& ValueTree::getProperty (const var::identifier& name) const | |||||
| { | { | ||||
| return object == 0 ? var() : object->getProperty (name); | |||||
| return object == 0 ? var::null : object->getProperty (name); | |||||
| } | } | ||||
| void ValueTree::setProperty (const var::identifier& name, const var& newValue, UndoManager* const undoManager) | void ValueTree::setProperty (const var::identifier& name, const var& newValue, UndoManager* const undoManager) | ||||
| @@ -576,8 +531,8 @@ int ValueTree::getNumProperties() const | |||||
| const var::identifier ValueTree::getPropertyName (int index) const | const var::identifier ValueTree::getPropertyName (int index) const | ||||
| { | { | ||||
| const SharedObject::Property* const p = (object == 0) ? 0 : object->properties [index]; | |||||
| return p != 0 ? p->name : var::identifier (String::empty); | |||||
| return (object == 0) ? var::identifier() | |||||
| : object->properties.getName (index); | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -710,11 +665,12 @@ XmlElement* ValueTree::SharedObject::createXml() const | |||||
| int i; | int i; | ||||
| for (i = 0; i < properties.size(); ++i) | for (i = 0; i < properties.size(); ++i) | ||||
| { | { | ||||
| const Property* const p = properties.getUnchecked(i); | |||||
| var::identifier name (properties.getName(i)); | |||||
| const var& v = properties [name]; | |||||
| jassert (! p->value.isObject()); // DynamicObjects can't be stored as XML! | |||||
| jassert (! v.isObject()); // DynamicObjects can't be stored as XML! | |||||
| xml->setAttribute (p->name.name, p->value.toString()); | |||||
| xml->setAttribute (name.name, v.toString()); | |||||
| } | } | ||||
| for (i = 0; i < children.size(); ++i) | for (i = 0; i < children.size(); ++i) | ||||
| @@ -26,12 +26,13 @@ | |||||
| #ifndef __JUCE_VALUETREE_JUCEHEADER__ | #ifndef __JUCE_VALUETREE_JUCEHEADER__ | ||||
| #define __JUCE_VALUETREE_JUCEHEADER__ | #define __JUCE_VALUETREE_JUCEHEADER__ | ||||
| #include "juce_Variant.h" | |||||
| #include "juce_NamedValueSet.h" | |||||
| #include "juce_Value.h" | #include "juce_Value.h" | ||||
| #include "../utilities/juce_UndoManager.h" | #include "../utilities/juce_UndoManager.h" | ||||
| #include "../text/juce_XmlElement.h" | #include "../text/juce_XmlElement.h" | ||||
| #include "juce_ReferenceCountedArray.h" | #include "juce_ReferenceCountedArray.h" | ||||
| //============================================================================== | //============================================================================== | ||||
| /** | /** | ||||
| A powerful tree structure that can be used to hold free-form data, and which can | A powerful tree structure that can be used to hold free-form data, and which can | ||||
| @@ -126,14 +127,14 @@ public: | |||||
| You can also use operator[] to get a property. | You can also use operator[] to get a property. | ||||
| @see var, setProperty, hasProperty | @see var, setProperty, hasProperty | ||||
| */ | */ | ||||
| const var getProperty (const var::identifier& name) const; | |||||
| const var& getProperty (const var::identifier& name) const; | |||||
| /** Returns the value of a named property. | /** Returns the value of a named property. | ||||
| If no such property has been set, this will return a void variant. This is the same as | If no such property has been set, this will return a void variant. This is the same as | ||||
| calling getProperty(). | calling getProperty(). | ||||
| @see getProperty | @see getProperty | ||||
| */ | */ | ||||
| const var operator[] (const var::identifier& name) const; | |||||
| const var& operator[] (const var::identifier& name) const; | |||||
| /** Changes a named property of the node. | /** Changes a named property of the node. | ||||
| If the undoManager parameter is non-null, its UndoManager::perform() method will be used, | If the undoManager parameter is non-null, its UndoManager::perform() method will be used, | ||||
| @@ -354,16 +355,8 @@ private: | |||||
| SharedObject (const SharedObject& other); | SharedObject (const SharedObject& other); | ||||
| ~SharedObject(); | ~SharedObject(); | ||||
| struct Property | |||||
| { | |||||
| Property (const var::identifier& name, const var& value); | |||||
| var::identifier name; | |||||
| var value; | |||||
| }; | |||||
| const String type; | const String type; | ||||
| OwnedArray <Property> properties; | |||||
| NamedValueSet properties; | |||||
| ReferenceCountedArray <SharedObject> children; | ReferenceCountedArray <SharedObject> children; | ||||
| SortedSet <ValueTree*> valueTreesWithListeners; | SortedSet <ValueTree*> valueTreesWithListeners; | ||||
| SharedObject* parent; | SharedObject* parent; | ||||
| @@ -373,7 +366,7 @@ private: | |||||
| void sendChildChangeMessage(); | void sendChildChangeMessage(); | ||||
| void sendChildChangeMessage (ValueTree& tree); | void sendChildChangeMessage (ValueTree& tree); | ||||
| void sendParentChangeMessage(); | void sendParentChangeMessage(); | ||||
| const var getProperty (const var::identifier& name) const; | |||||
| const var& getProperty (const var::identifier& name) const; | |||||
| void setProperty (const var::identifier& name, const var& newValue, UndoManager* const undoManager); | void setProperty (const var::identifier& name, const var& newValue, UndoManager* const undoManager); | ||||
| bool hasProperty (const var::identifier& name) const; | bool hasProperty (const var::identifier& name) const; | ||||
| void removeProperty (const var::identifier& name, UndoManager* const undoManager); | void removeProperty (const var::identifier& name, UndoManager* const undoManager); | ||||
| @@ -28,7 +28,7 @@ | |||||
| BEGIN_JUCE_NAMESPACE | BEGIN_JUCE_NAMESPACE | ||||
| #include "juce_Variant.h" | #include "juce_Variant.h" | ||||
| #include "juce_DynamicObject.h" | |||||
| //============================================================================== | //============================================================================== | ||||
| var::var() throw() | var::var() throw() | ||||
| @@ -37,7 +37,7 @@ var::var() throw() | |||||
| value.doubleValue = 0; | value.doubleValue = 0; | ||||
| } | } | ||||
| var::~var() | |||||
| var::~var() throw() | |||||
| { | { | ||||
| if (type == stringType) | if (type == stringType) | ||||
| delete value.stringValue; | delete value.stringValue; | ||||
| @@ -45,6 +45,8 @@ var::~var() | |||||
| value.objectValue->decReferenceCount(); | value.objectValue->decReferenceCount(); | ||||
| } | } | ||||
| const var var::null; | |||||
| //============================================================================== | //============================================================================== | ||||
| var::var (const var& valueToCopy) | var::var (const var& valueToCopy) | ||||
| : type (valueToCopy.type), | : type (valueToCopy.type), | ||||
| @@ -190,6 +192,7 @@ const String var::toString() const | |||||
| case doubleType: return String (value.doubleValue); | case doubleType: return String (value.doubleValue); | ||||
| case stringType: return *(value.stringValue); | case stringType: return *(value.stringValue); | ||||
| case objectType: return "Object 0x" + String::toHexString ((int) (pointer_sized_int) value.objectValue); | case objectType: return "Object 0x" + String::toHexString ((int) (pointer_sized_int) value.objectValue); | ||||
| case methodType: return "Method"; | |||||
| default: jassertfalse; break; | default: jassertfalse; break; | ||||
| } | } | ||||
| @@ -216,6 +219,7 @@ bool var::operator== (const var& other) const throw() | |||||
| case doubleType: return value.doubleValue == (double) other; | case doubleType: return value.doubleValue == (double) other; | ||||
| case stringType: return (*(value.stringValue)) == other.toString(); | case stringType: return (*(value.stringValue)) == other.toString(); | ||||
| case objectType: return value.objectValue == other.getObject(); | case objectType: return value.objectValue == other.getObject(); | ||||
| case methodType: return value.methodValue == other.value.methodValue && other.isMethod(); | |||||
| default: jassertfalse; break; | default: jassertfalse; break; | ||||
| } | } | ||||
| @@ -245,7 +249,8 @@ void var::writeToStream (OutputStream& output) const | |||||
| output.write (temp, len); | output.write (temp, len); | ||||
| break; | break; | ||||
| } | } | ||||
| case objectType: output.writeCompressedInt (0); jassertfalse; break; // Can't write an object to a stream! | |||||
| case objectType: | |||||
| case methodType: output.writeCompressedInt (0); jassertfalse; break; // Can't write an object to a stream! | |||||
| default: jassertfalse; break; // Is this a corrupted object? | default: jassertfalse; break; // Is this a corrupted object? | ||||
| } | } | ||||
| } | } | ||||
| @@ -273,7 +278,7 @@ const var var::readFromStream (InputStream& input) | |||||
| } | } | ||||
| } | } | ||||
| return var(); | |||||
| return var::null; | |||||
| } | } | ||||
| const var var::operator[] (const var::identifier& propertyName) const | const var var::operator[] (const var::identifier& propertyName) const | ||||
| @@ -281,7 +286,7 @@ const var var::operator[] (const var::identifier& propertyName) const | |||||
| if (type == objectType && value.objectValue != 0) | if (type == objectType && value.objectValue != 0) | ||||
| return value.objectValue->getProperty (propertyName); | return value.objectValue->getProperty (propertyName); | ||||
| return var(); | |||||
| return var::null; | |||||
| } | } | ||||
| const var var::invoke (const var::identifier& method, const var* arguments, int numArguments) const | const var var::invoke (const var::identifier& method, const var* arguments, int numArguments) const | ||||
| @@ -289,7 +294,7 @@ const var var::invoke (const var::identifier& method, const var* arguments, int | |||||
| if (type == objectType && value.objectValue != 0) | if (type == objectType && value.objectValue != 0) | ||||
| return value.objectValue->invokeMethod (method, arguments, numArguments); | return value.objectValue->invokeMethod (method, arguments, numArguments); | ||||
| return var(); | |||||
| return var::null; | |||||
| } | } | ||||
| const var var::invoke (const var& targetObject, const var* arguments, int numArguments) const | const var var::invoke (const var& targetObject, const var* arguments, int numArguments) const | ||||
| @@ -302,7 +307,7 @@ const var var::invoke (const var& targetObject, const var* arguments, int numArg | |||||
| return (target->*(value.methodValue)) (arguments, numArguments); | return (target->*(value.methodValue)) (arguments, numArguments); | ||||
| } | } | ||||
| return var(); | |||||
| return var::null; | |||||
| } | } | ||||
| const var var::call (const var::identifier& method) const | const var var::call (const var::identifier& method) const | ||||
| @@ -341,6 +346,11 @@ const var var::call (const var::identifier& method, const var& arg1, const var& | |||||
| //============================================================================== | //============================================================================== | ||||
| var::identifier::identifier() throw() | |||||
| : hashCode (0) | |||||
| { | |||||
| } | |||||
| var::identifier::identifier (const String& name_) | var::identifier::identifier (const String& name_) | ||||
| : name (name_), | : name (name_), | ||||
| hashCode (name_.hashCode()) | hashCode (name_.hashCode()) | ||||
| @@ -359,79 +369,5 @@ var::identifier::~identifier() | |||||
| { | { | ||||
| } | } | ||||
| //============================================================================== | |||||
| //============================================================================== | |||||
| DynamicObject::DynamicObject() | |||||
| { | |||||
| } | |||||
| DynamicObject::~DynamicObject() | |||||
| { | |||||
| } | |||||
| bool DynamicObject::hasProperty (const var::identifier& propertyName) const | |||||
| { | |||||
| const int index = propertyIds.indexOf (propertyName.hashCode); | |||||
| return index >= 0 && ! propertyValues.getUnchecked (index)->isMethod(); | |||||
| } | |||||
| const var DynamicObject::getProperty (const var::identifier& propertyName) const | |||||
| { | |||||
| const int index = propertyIds.indexOf (propertyName.hashCode); | |||||
| if (index >= 0) | |||||
| return *propertyValues.getUnchecked (index); | |||||
| return var(); | |||||
| } | |||||
| void DynamicObject::setProperty (const var::identifier& propertyName, const var& newValue) | |||||
| { | |||||
| const int index = propertyIds.indexOf (propertyName.hashCode); | |||||
| if (index >= 0) | |||||
| { | |||||
| propertyValues.set (index, new var (newValue)); | |||||
| } | |||||
| else | |||||
| { | |||||
| propertyIds.add (propertyName.hashCode); | |||||
| propertyValues.add (new var (newValue)); | |||||
| } | |||||
| } | |||||
| void DynamicObject::removeProperty (const var::identifier& propertyName) | |||||
| { | |||||
| const int index = propertyIds.indexOf (propertyName.hashCode); | |||||
| if (index >= 0) | |||||
| { | |||||
| propertyIds.remove (index); | |||||
| propertyValues.remove (index); | |||||
| } | |||||
| } | |||||
| bool DynamicObject::hasMethod (const var::identifier& methodName) const | |||||
| { | |||||
| return getProperty (methodName).isMethod(); | |||||
| } | |||||
| const var DynamicObject::invokeMethod (const var::identifier& methodName, | |||||
| const var* parameters, | |||||
| int numParameters) | |||||
| { | |||||
| return getProperty (methodName).invoke (var (this), parameters, numParameters); | |||||
| } | |||||
| void DynamicObject::setMethod (const var::identifier& name, | |||||
| var::MethodFunction methodFunction) | |||||
| { | |||||
| setProperty (name, var (methodFunction)); | |||||
| } | |||||
| void DynamicObject::clear() | |||||
| { | |||||
| propertyIds.clear(); | |||||
| propertyValues.clear(); | |||||
| } | |||||
| END_JUCE_NAMESPACE | END_JUCE_NAMESPACE | ||||
| @@ -26,10 +26,6 @@ | |||||
| #ifndef __JUCE_VARIANT_JUCEHEADER__ | #ifndef __JUCE_VARIANT_JUCEHEADER__ | ||||
| #define __JUCE_VARIANT_JUCEHEADER__ | #define __JUCE_VARIANT_JUCEHEADER__ | ||||
| #include "juce_ReferenceCountedObject.h" | |||||
| #include "juce_OwnedArray.h" | |||||
| #include "../text/juce_StringArray.h" | |||||
| #include "../containers/juce_Array.h" | |||||
| #include "../io/streams/juce_OutputStream.h" | #include "../io/streams/juce_OutputStream.h" | ||||
| #include "../io/streams/juce_InputStream.h" | #include "../io/streams/juce_InputStream.h" | ||||
| @@ -57,7 +53,10 @@ public: | |||||
| var() throw(); | var() throw(); | ||||
| /** Destructor. */ | /** Destructor. */ | ||||
| ~var(); | |||||
| ~var() throw(); | |||||
| /** A static var object that can be used where you need an empty variant object. */ | |||||
| static const var null; | |||||
| var (const var& valueToCopy); | var (const var& valueToCopy); | ||||
| var (const int value) throw(); | var (const int value) throw(); | ||||
| @@ -116,6 +115,7 @@ public: | |||||
| class JUCE_API identifier | class JUCE_API identifier | ||||
| { | { | ||||
| public: | public: | ||||
| identifier() throw(); | |||||
| identifier (const char* const name); | identifier (const char* const name); | ||||
| identifier (const String& name); | identifier (const String& name); | ||||
| ~identifier(); | ~identifier(); | ||||
| @@ -183,90 +183,5 @@ private: | |||||
| ValueUnion value; | ValueUnion value; | ||||
| }; | }; | ||||
| //============================================================================== | |||||
| /** | |||||
| Represents a dynamically implemented object. | |||||
| An instance of this class can be used to store named properties, and | |||||
| by subclassing hasMethod() and invokeMethod(), you can give your object | |||||
| methods. | |||||
| This is intended for use as a wrapper for scripting language objects. | |||||
| */ | |||||
| class JUCE_API DynamicObject : public ReferenceCountedObject | |||||
| { | |||||
| public: | |||||
| //============================================================================== | |||||
| DynamicObject(); | |||||
| /** Destructor. */ | |||||
| virtual ~DynamicObject(); | |||||
| //============================================================================== | |||||
| /** Returns true if the object has a property with this name. | |||||
| Note that if the property is actually a method, this will return false. | |||||
| */ | |||||
| virtual bool hasProperty (const var::identifier& propertyName) const; | |||||
| /** Returns a named property. | |||||
| This returns a void if no such property exists. | |||||
| */ | |||||
| virtual const var getProperty (const var::identifier& propertyName) const; | |||||
| /** Sets a named property. */ | |||||
| virtual void setProperty (const var::identifier& propertyName, const var& newValue); | |||||
| /** Removes a named property. */ | |||||
| virtual void removeProperty (const var::identifier& propertyName); | |||||
| //============================================================================== | |||||
| /** Checks whether this object has the specified method. | |||||
| The default implementation of this just checks whether there's a property | |||||
| with this name that's actually a method, but this can be overridden for | |||||
| building objects with dynamic invocation. | |||||
| */ | |||||
| virtual bool hasMethod (const var::identifier& methodName) const; | |||||
| /** Invokes a named method on this object. | |||||
| The default implementation looks up the named property, and if it's a method | |||||
| call, then it invokes it. | |||||
| This method is virtual to allow more dynamic invocation to used for objects | |||||
| where the methods may not already be set as properies. | |||||
| */ | |||||
| virtual const var invokeMethod (const var::identifier& methodName, | |||||
| const var* parameters, | |||||
| int numParameters); | |||||
| /** Sets up a method. | |||||
| This is basically the same as calling setProperty (methodName, (var::MethodFunction) myFunction), but | |||||
| helps to avoid accidentally invoking the wrong type of var constructor. It also makes | |||||
| the code easier to read, | |||||
| The compiler will probably force you to use an explicit cast your method to a (var::MethodFunction), e.g. | |||||
| @code | |||||
| setMethod ("doSomething", (var::MethodFunction) &MyClass::doSomething); | |||||
| @endcode | |||||
| */ | |||||
| void setMethod (const var::identifier& methodName, | |||||
| var::MethodFunction methodFunction); | |||||
| //============================================================================== | |||||
| /** Removes all properties and methods from the object. */ | |||||
| void clear(); | |||||
| //============================================================================== | |||||
| juce_UseDebuggingNewOperator | |||||
| private: | |||||
| Array <int> propertyIds; | |||||
| OwnedArray <var> propertyValues; | |||||
| }; | |||||
| #endif // __JUCE_VARIANT_JUCEHEADER__ | #endif // __JUCE_VARIANT_JUCEHEADER__ | ||||
| @@ -27,6 +27,7 @@ | |||||
| #define __JUCE_PLATFORMUTILITIES_JUCEHEADER__ | #define __JUCE_PLATFORMUTILITIES_JUCEHEADER__ | ||||
| #include "../text/juce_StringArray.h" | #include "../text/juce_StringArray.h" | ||||
| #include "../io/files/juce_File.h" | |||||
| //============================================================================== | //============================================================================== | ||||
| @@ -36,7 +36,7 @@ BEGIN_JUCE_NAMESPACE | |||||
| //============================================================================== | //============================================================================== | ||||
| static const tchar* const tableColumnPropertyTag = T("_tableColumnID"); | |||||
| static const char* const tableColumnPropertyTag = "_tableColumnID"; | |||||
| class TableListRowComp : public Component, | class TableListRowComp : public Component, | ||||
| public TooltipClient | public TooltipClient | ||||
| @@ -100,7 +100,7 @@ public: | |||||
| { | { | ||||
| jassert (row >= 0); | jassert (row >= 0); | ||||
| const tchar* const tagPropertyName = T("_tableLastUseNum"); | |||||
| const var::identifier tagPropertyName ("_tableLastUseNum"); | |||||
| const int newTag = Random::getSystemRandom().nextInt(); | const int newTag = Random::getSystemRandom().nextInt(); | ||||
| const TableHeaderComponent* const header = owner.getHeader(); | const TableHeaderComponent* const header = owner.getHeader(); | ||||
| @@ -122,8 +122,8 @@ public: | |||||
| if (newComp != 0) | if (newComp != 0) | ||||
| { | { | ||||
| addAndMakeVisible (newComp); | addAndMakeVisible (newComp); | ||||
| newComp->setComponentProperty (tagPropertyName, newTag); | |||||
| newComp->setComponentProperty (tableColumnPropertyTag, columnId); | |||||
| newComp->getProperties().set (tagPropertyName, newTag); | |||||
| newComp->getProperties().set (tableColumnPropertyTag, columnId); | |||||
| const Rectangle columnRect (header->getColumnPosition (i)); | const Rectangle columnRect (header->getColumnPosition (i)); | ||||
| newComp->setBounds (columnRect.getX(), 0, columnRect.getWidth(), getHeight()); | newComp->setBounds (columnRect.getX(), 0, columnRect.getWidth(), getHeight()); | ||||
| @@ -137,7 +137,7 @@ public: | |||||
| { | { | ||||
| Component* const c = getChildComponent (i); | Component* const c = getChildComponent (i); | ||||
| if (c->getComponentPropertyInt (tagPropertyName, false, 0) != newTag) | |||||
| if ((int) c->getProperties() [tagPropertyName] != newTag) | |||||
| delete c; | delete c; | ||||
| } | } | ||||
| } | } | ||||
| @@ -154,7 +154,7 @@ public: | |||||
| { | { | ||||
| Component* const c = getChildComponent (i); | Component* const c = getChildComponent (i); | ||||
| const int columnId = c->getComponentPropertyInt (tableColumnPropertyTag, false, 0); | |||||
| const int columnId = c->getProperties() [tableColumnPropertyTag]; | |||||
| if (columnId != 0) | if (columnId != 0) | ||||
| { | { | ||||
| @@ -254,7 +254,7 @@ private: | |||||
| { | { | ||||
| Component* const c = getChildComponent (i); | Component* const c = getChildComponent (i); | ||||
| if (c->getComponentPropertyInt (tableColumnPropertyTag, false, 0) == columnId) | |||||
| if ((int) c->getProperties() [tableColumnPropertyTag] == columnId) | |||||
| return c; | return c; | ||||
| } | } | ||||
| @@ -114,7 +114,6 @@ Component::Component() throw() | |||||
| mouseListeners_ (0), | mouseListeners_ (0), | ||||
| keyListeners_ (0), | keyListeners_ (0), | ||||
| componentListeners_ (0), | componentListeners_ (0), | ||||
| propertySet_ (0), | |||||
| componentFlags_ (0) | componentFlags_ (0) | ||||
| { | { | ||||
| } | } | ||||
| @@ -130,7 +129,6 @@ Component::Component (const String& name) throw() | |||||
| mouseListeners_ (0), | mouseListeners_ (0), | ||||
| keyListeners_ (0), | keyListeners_ (0), | ||||
| componentListeners_ (0), | componentListeners_ (0), | ||||
| propertySet_ (0), | |||||
| componentFlags_ (0) | componentFlags_ (0) | ||||
| { | { | ||||
| } | } | ||||
| @@ -162,7 +160,6 @@ Component::~Component() | |||||
| delete mouseListeners_; | delete mouseListeners_; | ||||
| delete keyListeners_; | delete keyListeners_; | ||||
| delete componentListeners_; | delete componentListeners_; | ||||
| delete propertySet_; | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -1904,7 +1901,7 @@ void Component::sendLookAndFeelChange() | |||||
| } | } | ||||
| } | } | ||||
| static const String getColourPropertyName (const int colourId) throw() | |||||
| static const var::identifier getColourPropertyId (const int colourId) | |||||
| { | { | ||||
| String s; | String s; | ||||
| s.preallocateStorage (18); | s.preallocateStorage (18); | ||||
| @@ -1914,62 +1911,49 @@ static const String getColourPropertyName (const int colourId) throw() | |||||
| const Colour Component::findColour (const int colourId, const bool inheritFromParent) const throw() | const Colour Component::findColour (const int colourId, const bool inheritFromParent) const throw() | ||||
| { | { | ||||
| const String customColour (getComponentProperty (getColourPropertyName (colourId), | |||||
| inheritFromParent, | |||||
| String::empty)); | |||||
| var* v = properties.getItem (getColourPropertyId (colourId)); | |||||
| if (customColour.isNotEmpty()) | |||||
| return Colour (customColour.getIntValue()); | |||||
| if (v != 0) | |||||
| return Colour ((int) *v); | |||||
| if (inheritFromParent && parentComponent_ != 0) | |||||
| return parentComponent_->findColour (colourId, true); | |||||
| return getLookAndFeel().findColour (colourId); | return getLookAndFeel().findColour (colourId); | ||||
| } | } | ||||
| bool Component::isColourSpecified (const int colourId) const throw() | bool Component::isColourSpecified (const int colourId) const throw() | ||||
| { | { | ||||
| return getComponentProperty (getColourPropertyName (colourId), | |||||
| false, | |||||
| String::empty).isNotEmpty(); | |||||
| return properties.contains (getColourPropertyId (colourId)); | |||||
| } | } | ||||
| void Component::removeColour (const int colourId) | void Component::removeColour (const int colourId) | ||||
| { | { | ||||
| if (isColourSpecified (colourId)) | |||||
| { | |||||
| removeComponentProperty (getColourPropertyName (colourId)); | |||||
| if (properties.remove (getColourPropertyId (colourId))) | |||||
| colourChanged(); | colourChanged(); | ||||
| } | |||||
| } | } | ||||
| void Component::setColour (const int colourId, const Colour& colour) | void Component::setColour (const int colourId, const Colour& colour) | ||||
| { | { | ||||
| const String colourName (getColourPropertyName (colourId)); | |||||
| const String customColour (getComponentProperty (colourName, false, String::empty)); | |||||
| if (customColour.isEmpty() || Colour (customColour.getIntValue()) != colour) | |||||
| { | |||||
| setComponentProperty (colourName, colour); | |||||
| if (properties.set (getColourPropertyId (colourId), (int) colour.getARGB())) | |||||
| colourChanged(); | colourChanged(); | ||||
| } | |||||
| } | } | ||||
| void Component::copyAllExplicitColoursTo (Component& target) const throw() | void Component::copyAllExplicitColoursTo (Component& target) const throw() | ||||
| { | { | ||||
| if (propertySet_ != 0) | |||||
| bool changed = false; | |||||
| for (int i = properties.size(); --i >= 0;) | |||||
| { | { | ||||
| const StringPairArray& props = propertySet_->getAllProperties(); | |||||
| const StringArray& keys = props.getAllKeys(); | |||||
| const var::identifier name (properties.getName(i)); | |||||
| for (int i = 0; i < keys.size(); ++i) | |||||
| { | |||||
| if (keys[i].startsWith (T("jcclr_"))) | |||||
| { | |||||
| target.setComponentProperty (keys[i], | |||||
| props.getAllValues() [i]); | |||||
| } | |||||
| } | |||||
| if (name.name.startsWith (T("jcclr_"))) | |||||
| if (target.properties.set (name, properties [name])) | |||||
| changed = true; | |||||
| } | |||||
| if (changed) | |||||
| target.colourChanged(); | target.colourChanged(); | ||||
| } | |||||
| } | } | ||||
| void Component::colourChanged() | void Component::colourChanged() | ||||
| @@ -3242,12 +3226,12 @@ bool Component::isFocusContainer() const throw() | |||||
| int Component::getExplicitFocusOrder() const throw() | int Component::getExplicitFocusOrder() const throw() | ||||
| { | { | ||||
| return getComponentPropertyInt (T("_jexfo"), false, 0); | |||||
| return properties ["_jexfo"]; | |||||
| } | } | ||||
| void Component::setExplicitFocusOrder (const int newFocusOrderIndex) throw() | void Component::setExplicitFocusOrder (const int newFocusOrderIndex) throw() | ||||
| { | { | ||||
| setComponentProperty (T("_jexfo"), newFocusOrderIndex); | |||||
| properties.set ("_jexfo", newFocusOrderIndex); | |||||
| } | } | ||||
| KeyboardFocusTraverser* Component::createFocusTraverser() | KeyboardFocusTraverser* Component::createFocusTraverser() | ||||
| @@ -3552,111 +3536,6 @@ ComponentPeer* Component::getPeer() const throw() | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| //============================================================================== | |||||
| const String Component::getComponentProperty (const String& keyName, | |||||
| const bool useParentComponentIfNotFound, | |||||
| const String& defaultReturnValue) const throw() | |||||
| { | |||||
| if (propertySet_ != 0 && ((! useParentComponentIfNotFound) || propertySet_->containsKey (keyName))) | |||||
| return propertySet_->getValue (keyName, defaultReturnValue); | |||||
| if (useParentComponentIfNotFound && (parentComponent_ != 0)) | |||||
| return parentComponent_->getComponentProperty (keyName, true, defaultReturnValue); | |||||
| return defaultReturnValue; | |||||
| } | |||||
| int Component::getComponentPropertyInt (const String& keyName, | |||||
| const bool useParentComponentIfNotFound, | |||||
| const int defaultReturnValue) const throw() | |||||
| { | |||||
| if (propertySet_ != 0 && ((! useParentComponentIfNotFound) || propertySet_->containsKey (keyName))) | |||||
| return propertySet_->getIntValue (keyName, defaultReturnValue); | |||||
| if (useParentComponentIfNotFound && (parentComponent_ != 0)) | |||||
| return parentComponent_->getComponentPropertyInt (keyName, true, defaultReturnValue); | |||||
| return defaultReturnValue; | |||||
| } | |||||
| double Component::getComponentPropertyDouble (const String& keyName, | |||||
| const bool useParentComponentIfNotFound, | |||||
| const double defaultReturnValue) const throw() | |||||
| { | |||||
| if (propertySet_ != 0 && ((! useParentComponentIfNotFound) || propertySet_->containsKey (keyName))) | |||||
| return propertySet_->getDoubleValue (keyName, defaultReturnValue); | |||||
| if (useParentComponentIfNotFound && (parentComponent_ != 0)) | |||||
| return parentComponent_->getComponentPropertyDouble (keyName, true, defaultReturnValue); | |||||
| return defaultReturnValue; | |||||
| } | |||||
| bool Component::getComponentPropertyBool (const String& keyName, | |||||
| const bool useParentComponentIfNotFound, | |||||
| const bool defaultReturnValue) const throw() | |||||
| { | |||||
| if (propertySet_ != 0 && ((! useParentComponentIfNotFound) || propertySet_->containsKey (keyName))) | |||||
| return propertySet_->getBoolValue (keyName, defaultReturnValue); | |||||
| if (useParentComponentIfNotFound && (parentComponent_ != 0)) | |||||
| return parentComponent_->getComponentPropertyBool (keyName, true, defaultReturnValue); | |||||
| return defaultReturnValue; | |||||
| } | |||||
| const Colour Component::getComponentPropertyColour (const String& keyName, | |||||
| const bool useParentComponentIfNotFound, | |||||
| const Colour& defaultReturnValue) const throw() | |||||
| { | |||||
| return Colour ((uint32) getComponentPropertyInt (keyName, | |||||
| useParentComponentIfNotFound, | |||||
| defaultReturnValue.getARGB())); | |||||
| } | |||||
| void Component::setComponentProperty (const String& keyName, const String& value) throw() | |||||
| { | |||||
| if (propertySet_ == 0) | |||||
| propertySet_ = new PropertySet(); | |||||
| propertySet_->setValue (keyName, value); | |||||
| } | |||||
| void Component::setComponentProperty (const String& keyName, const int value) throw() | |||||
| { | |||||
| if (propertySet_ == 0) | |||||
| propertySet_ = new PropertySet(); | |||||
| propertySet_->setValue (keyName, value); | |||||
| } | |||||
| void Component::setComponentProperty (const String& keyName, const double value) throw() | |||||
| { | |||||
| if (propertySet_ == 0) | |||||
| propertySet_ = new PropertySet(); | |||||
| propertySet_->setValue (keyName, value); | |||||
| } | |||||
| void Component::setComponentProperty (const String& keyName, const bool value) throw() | |||||
| { | |||||
| if (propertySet_ == 0) | |||||
| propertySet_ = new PropertySet(); | |||||
| propertySet_->setValue (keyName, value); | |||||
| } | |||||
| void Component::setComponentProperty (const String& keyName, const Colour& colour) throw() | |||||
| { | |||||
| setComponentProperty (keyName, (int) colour.getARGB()); | |||||
| } | |||||
| void Component::removeComponentProperty (const String& keyName) throw() | |||||
| { | |||||
| if (propertySet_ != 0) | |||||
| propertySet_->removeValue (keyName); | |||||
| } | |||||
| //============================================================================== | //============================================================================== | ||||
| ComponentDeletionWatcher::ComponentDeletionWatcher (const Component* const componentToWatch_) throw() | ComponentDeletionWatcher::ComponentDeletionWatcher (const Component* const componentToWatch_) throw() | ||||
| : componentToWatch (componentToWatch_), | : componentToWatch (componentToWatch_), | ||||
| @@ -38,7 +38,7 @@ | |||||
| #include "../../events/juce_MessageListener.h" | #include "../../events/juce_MessageListener.h" | ||||
| #include "../../text/juce_StringArray.h" | #include "../../text/juce_StringArray.h" | ||||
| #include "../../containers/juce_VoidArray.h" | #include "../../containers/juce_VoidArray.h" | ||||
| #include "../../containers/juce_PropertySet.h" | |||||
| #include "../../containers/juce_NamedValueSet.h" | |||||
| class LookAndFeel; | class LookAndFeel; | ||||
| @@ -1815,123 +1815,17 @@ public: | |||||
| //============================================================================== | //============================================================================== | ||||
| /** Returns one of the component's properties as a string. | |||||
| @param keyName the name of the property to retrieve | |||||
| @param useParentComponentIfNotFound if this is true and the key isn't present in this component's | |||||
| properties, then it will check whether the parent component has | |||||
| the key. | |||||
| @param defaultReturnValue a value to return if the named property doesn't actually exist | |||||
| */ | |||||
| const String getComponentProperty (const String& keyName, | |||||
| const bool useParentComponentIfNotFound, | |||||
| const String& defaultReturnValue = String::empty) const throw(); | |||||
| /** Returns one of the properties as an integer. | |||||
| @param keyName the name of the property to retrieve | |||||
| @param useParentComponentIfNotFound if this is true and the key isn't present in this component's | |||||
| properties, then it will check whether the parent component has | |||||
| the key. | |||||
| @param defaultReturnValue a value to return if the named property doesn't actually exist | |||||
| */ | |||||
| int getComponentPropertyInt (const String& keyName, | |||||
| const bool useParentComponentIfNotFound, | |||||
| const int defaultReturnValue = 0) const throw(); | |||||
| /** Returns one of the properties as an double. | |||||
| @param keyName the name of the property to retrieve | |||||
| @param useParentComponentIfNotFound if this is true and the key isn't present in this component's | |||||
| properties, then it will check whether the parent component has | |||||
| the key. | |||||
| @param defaultReturnValue a value to return if the named property doesn't actually exist | |||||
| */ | |||||
| double getComponentPropertyDouble (const String& keyName, | |||||
| const bool useParentComponentIfNotFound, | |||||
| const double defaultReturnValue = 0.0) const throw(); | |||||
| /** Returns one of the properties as an boolean. | |||||
| The result will be true if the string found for this key name can be parsed as a non-zero | |||||
| integer. | |||||
| @param keyName the name of the property to retrieve | |||||
| @param useParentComponentIfNotFound if this is true and the key isn't present in this component's | |||||
| properties, then it will check whether the parent component has | |||||
| the key. | |||||
| @param defaultReturnValue a value to return if the named property doesn't actually exist | |||||
| */ | |||||
| bool getComponentPropertyBool (const String& keyName, | |||||
| const bool useParentComponentIfNotFound, | |||||
| const bool defaultReturnValue = false) const throw(); | |||||
| /** Returns one of the properties as an colour. | |||||
| @param keyName the name of the property to retrieve | |||||
| @param useParentComponentIfNotFound if this is true and the key isn't present in this component's | |||||
| properties, then it will check whether the parent component has | |||||
| the key. | |||||
| @param defaultReturnValue a colour to return if the named property doesn't actually exist | |||||
| */ | |||||
| const Colour getComponentPropertyColour (const String& keyName, | |||||
| const bool useParentComponentIfNotFound, | |||||
| const Colour& defaultReturnValue = Colours::black) const throw(); | |||||
| /** Sets a named property as a string. | |||||
| @param keyName the name of the property to set. (This mustn't be an empty string) | |||||
| @param value the new value to set it to | |||||
| @see removeComponentProperty | |||||
| /** Returns the set of properties that belong to this component. | |||||
| Each component has a NamedValueSet object which you can use to attach arbitrary | |||||
| items of data to it. | |||||
| */ | */ | ||||
| void setComponentProperty (const String& keyName, const String& value) throw(); | |||||
| /** Sets a named property to an integer. | |||||
| @param keyName the name of the property to set. (This mustn't be an empty string) | |||||
| @param value the new value to set it to | |||||
| @see removeComponentProperty | |||||
| */ | |||||
| void setComponentProperty (const String& keyName, const int value) throw(); | |||||
| /** Sets a named property to a double. | |||||
| @param keyName the name of the property to set. (This mustn't be an empty string) | |||||
| @param value the new value to set it to | |||||
| @see removeComponentProperty | |||||
| */ | |||||
| void setComponentProperty (const String& keyName, const double value) throw(); | |||||
| /** Sets a named property to a boolean. | |||||
| @param keyName the name of the property to set. (This mustn't be an empty string) | |||||
| @param value the new value to set it to | |||||
| @see removeComponentProperty | |||||
| */ | |||||
| void setComponentProperty (const String& keyName, const bool value) throw(); | |||||
| /** Sets a named property to a colour. | |||||
| @param keyName the name of the property to set. (This mustn't be an empty string) | |||||
| @param newColour the new colour to set it to | |||||
| @see removeComponentProperty | |||||
| */ | |||||
| void setComponentProperty (const String& keyName, const Colour& newColour) throw(); | |||||
| /** Deletes a named component property. | |||||
| @param keyName the name of the property to delete. (This mustn't be an empty string) | |||||
| @see setComponentProperty, getComponentProperty | |||||
| */ | |||||
| void removeComponentProperty (const String& keyName) throw(); | |||||
| /** Returns the complete set of properties that have been set for this component. | |||||
| If no properties have been set, this will return a null pointer. | |||||
| NamedValueSet& getProperties() throw() { return properties; } | |||||
| @see getComponentProperty, setComponentProperty | |||||
| /** Returns the set of properties that belong to this component. | |||||
| Each component has a NamedValueSet object which you can use to attach arbitrary | |||||
| items of data to it. | |||||
| */ | */ | ||||
| PropertySet* getComponentProperties() const throw() { return propertySet_; } | |||||
| const NamedValueSet& getProperties() const throw() { return properties; } | |||||
| //============================================================================== | //============================================================================== | ||||
| /** Looks for a colour that has been registered with the given colour ID number. | /** Looks for a colour that has been registered with the given colour ID number. | ||||
| @@ -2023,7 +1917,7 @@ private: | |||||
| VoidArray* mouseListeners_; | VoidArray* mouseListeners_; | ||||
| VoidArray* keyListeners_; | VoidArray* keyListeners_; | ||||
| VoidArray* componentListeners_; | VoidArray* componentListeners_; | ||||
| PropertySet* propertySet_; | |||||
| NamedValueSet properties; | |||||
| struct ComponentFlags | struct ComponentFlags | ||||
| { | { | ||||
| @@ -131,7 +131,7 @@ MultiDocumentPanel::~MultiDocumentPanel() | |||||
| //============================================================================== | //============================================================================== | ||||
| static bool shouldDeleteComp (Component* const c) | static bool shouldDeleteComp (Component* const c) | ||||
| { | { | ||||
| return c->getComponentPropertyBool (T("mdiDocumentDelete_"), false); | |||||
| return c->getProperties() ["mdiDocumentDelete_"]; | |||||
| } | } | ||||
| bool MultiDocumentPanel::closeAllDocuments (const bool checkItsOkToCloseFirst) | bool MultiDocumentPanel::closeAllDocuments (const bool checkItsOkToCloseFirst) | ||||
| @@ -155,7 +155,9 @@ void MultiDocumentPanel::addWindow (Component* component) | |||||
| dw->setResizable (true, false); | dw->setResizable (true, false); | ||||
| dw->setContentComponent (component, false, true); | dw->setContentComponent (component, false, true); | ||||
| dw->setName (component->getName()); | dw->setName (component->getName()); | ||||
| dw->setBackgroundColour (component->getComponentPropertyColour (T("mdiDocumentBkg_"), false, backgroundColour)); | |||||
| const var bkg (component->getProperties() ["mdiDocumentBkg_"]); | |||||
| dw->setBackgroundColour (bkg.isVoid() ? backgroundColour : Colour ((int) bkg)); | |||||
| int x = 4; | int x = 4; | ||||
| Component* const topComp = getChildComponent (getNumChildComponents() - 1); | Component* const topComp = getChildComponent (getNumChildComponents() - 1); | ||||
| @@ -165,8 +167,9 @@ void MultiDocumentPanel::addWindow (Component* component) | |||||
| dw->setTopLeftPosition (x, x); | dw->setTopLeftPosition (x, x); | ||||
| if (component->getComponentProperty (T("mdiDocumentPos_"), false, String::empty).isNotEmpty()) | |||||
| dw->restoreWindowStateFromString (component->getComponentProperty (T("mdiDocumentPos_"), false, String::empty)); | |||||
| const var pos (component->getProperties() ["mdiDocumentPos_"]); | |||||
| if (pos.toString().isNotEmpty()) | |||||
| dw->restoreWindowStateFromString (pos.toString()); | |||||
| addAndMakeVisible (dw); | addAndMakeVisible (dw); | ||||
| dw->toFront (true); | dw->toFront (true); | ||||
| @@ -184,8 +187,8 @@ bool MultiDocumentPanel::addDocument (Component* const component, | |||||
| return false; | return false; | ||||
| components.add (component); | components.add (component); | ||||
| component->setComponentProperty (T("mdiDocumentDelete_"), deleteWhenRemoved); | |||||
| component->setComponentProperty (T("mdiDocumentBkg_"), docColour); | |||||
| component->getProperties().set ("mdiDocumentDelete_", deleteWhenRemoved); | |||||
| component->getProperties().set ("mdiDocumentBkg_", (int) docColour.getARGB()); | |||||
| component->addComponentListener (this); | component->addComponentListener (this); | ||||
| if (mode == FloatingWindows) | if (mode == FloatingWindows) | ||||
| @@ -249,8 +252,8 @@ bool MultiDocumentPanel::closeDocument (Component* component, | |||||
| component->removeComponentListener (this); | component->removeComponentListener (this); | ||||
| const bool shouldDelete = shouldDeleteComp (component); | const bool shouldDelete = shouldDeleteComp (component); | ||||
| component->removeComponentProperty (T("mdiDocumentDelete_")); | |||||
| component->removeComponentProperty (T("mdiDocumentBkg_")); | |||||
| component->getProperties().remove ("mdiDocumentDelete_"); | |||||
| component->getProperties().remove ("mdiDocumentBkg_"); | |||||
| if (mode == FloatingWindows) | if (mode == FloatingWindows) | ||||
| { | { | ||||
| @@ -417,7 +420,7 @@ void MultiDocumentPanel::setLayoutMode (const LayoutMode newLayoutMode) | |||||
| if (dw != 0) | if (dw != 0) | ||||
| { | { | ||||
| dw->getContentComponent()->setComponentProperty (T("mdiDocumentPos_"), dw->getWindowStateAsString()); | |||||
| dw->getContentComponent()->getProperties().set ("mdiDocumentPos_", dw->getWindowStateAsString()); | |||||
| dw->setContentComponent (0, false); | dw->setContentComponent (0, false); | ||||
| delete dw; | delete dw; | ||||
| } | } | ||||
| @@ -432,8 +435,9 @@ void MultiDocumentPanel::setLayoutMode (const LayoutMode newLayoutMode) | |||||
| for (int i = 0; i < tempComps.size(); ++i) | for (int i = 0; i < tempComps.size(); ++i) | ||||
| { | { | ||||
| Component* const c = tempComps.getUnchecked(i); | Component* const c = tempComps.getUnchecked(i); | ||||
| addDocument (c, | addDocument (c, | ||||
| c->getComponentPropertyColour (T("mdiDocumentBkg_"), false, Colours::white), | |||||
| Colour ((int) c->getProperties().getWithDefault ("mdiDocumentBkg_", (int) Colours::white.getARGB())), | |||||
| shouldDeleteComp (c)); | shouldDeleteComp (c)); | ||||
| } | } | ||||
| } | } | ||||
| @@ -138,7 +138,7 @@ void TabbedComponent::clearTabs() | |||||
| // be careful not to delete these components until they've been removed from the tab component | // be careful not to delete these components until they've been removed from the tab component | ||||
| jassert (c == 0 || c->isValidComponent()); | jassert (c == 0 || c->isValidComponent()); | ||||
| if (c != 0 && c->getComponentPropertyBool (T("deleteByTabComp_"), false, false)) | |||||
| if (c != 0 && c->getProperties() ["deleteByTabComp_"]) | |||||
| delete c; | delete c; | ||||
| } | } | ||||
| @@ -154,7 +154,7 @@ void TabbedComponent::addTab (const String& tabName, | |||||
| contentComponents.insert (insertIndex, contentComponent); | contentComponents.insert (insertIndex, contentComponent); | ||||
| if (contentComponent != 0) | if (contentComponent != 0) | ||||
| contentComponent->setComponentProperty (T("deleteByTabComp_"), deleteComponentWhenNotNeeded); | |||||
| contentComponent->getProperties().set ("deleteByTabComp_", deleteComponentWhenNotNeeded); | |||||
| tabs->addTab (tabName, tabBackgroundColour, insertIndex); | tabs->addTab (tabName, tabBackgroundColour, insertIndex); | ||||
| } | } | ||||
| @@ -169,7 +169,7 @@ void TabbedComponent::removeTab (const int tabIndex) | |||||
| { | { | ||||
| Component* const c = contentComponents [tabIndex]; | Component* const c = contentComponents [tabIndex]; | ||||
| if (c != 0 && c->getComponentPropertyBool (T("deleteByTabComp_"), false, false)) | |||||
| if (c != 0 && c->getProperties() ["deleteByTabComp_"]) | |||||
| { | { | ||||
| if (c == panelComponent) | if (c == panelComponent) | ||||
| panelComponent = 0; | panelComponent = 0; | ||||
| @@ -28,6 +28,7 @@ | |||||
| #include "juce_PropertyComponent.h" | #include "juce_PropertyComponent.h" | ||||
| #include "../layout/juce_Viewport.h" | #include "../layout/juce_Viewport.h" | ||||
| #include "../../../text/juce_XmlElement.h" | |||||
| //============================================================================== | //============================================================================== | ||||
| @@ -103,7 +103,7 @@ private: | |||||
| PixelRGB filler [4]; | PixelRGB filler [4]; | ||||
| bool areRGBComponentsEqual; | bool areRGBComponentsEqual; | ||||
| forcedinline void blendLine (PixelType* dest, const PixelARGB& colour, int width) const | |||||
| inline void blendLine (PixelType* dest, const PixelARGB& colour, int width) const | |||||
| { | { | ||||
| do | do | ||||
| { | { | ||||
| @@ -82,6 +82,8 @@ | |||||
| #include "containers/juce_MemoryBlock.cpp" | #include "containers/juce_MemoryBlock.cpp" | ||||
| #include "containers/juce_PropertySet.cpp" | #include "containers/juce_PropertySet.cpp" | ||||
| #include "containers/juce_Variant.cpp" | #include "containers/juce_Variant.cpp" | ||||
| #include "containers/juce_NamedValueSet.cpp" | |||||
| #include "containers/juce_DynamicObject.cpp" | |||||
| #include "cryptography/juce_BlowFish.cpp" | #include "cryptography/juce_BlowFish.cpp" | ||||
| #include "cryptography/juce_MD5.cpp" | #include "cryptography/juce_MD5.cpp" | ||||
| #include "cryptography/juce_Primes.cpp" | #include "cryptography/juce_Primes.cpp" | ||||
| @@ -35,6 +35,9 @@ | |||||
| #ifndef __JUCE_BITARRAY_JUCEHEADER__ | #ifndef __JUCE_BITARRAY_JUCEHEADER__ | ||||
| #include "containers/juce_BitArray.h" | #include "containers/juce_BitArray.h" | ||||
| #endif | #endif | ||||
| #ifndef __JUCE_DYNAMICOBJECT_JUCEHEADER__ | |||||
| #include "containers/juce_DynamicObject.h" | |||||
| #endif | |||||
| #ifndef __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__ | #ifndef __JUCE_ELEMENTCOMPARATOR_JUCEHEADER__ | ||||
| #include "containers/juce_ElementComparator.h" | #include "containers/juce_ElementComparator.h" | ||||
| #endif | #endif | ||||
| @@ -44,6 +47,9 @@ | |||||
| #ifndef __JUCE_MEMORYBLOCK_JUCEHEADER__ | #ifndef __JUCE_MEMORYBLOCK_JUCEHEADER__ | ||||
| #include "containers/juce_MemoryBlock.h" | #include "containers/juce_MemoryBlock.h" | ||||
| #endif | #endif | ||||
| #ifndef __JUCE_NAMEDVALUESET_JUCEHEADER__ | |||||
| #include "containers/juce_NamedValueSet.h" | |||||
| #endif | |||||
| #ifndef __JUCE_OWNEDARRAY_JUCEHEADER__ | #ifndef __JUCE_OWNEDARRAY_JUCEHEADER__ | ||||
| #include "containers/juce_OwnedArray.h" | #include "containers/juce_OwnedArray.h" | ||||
| #endif | #endif | ||||
| @@ -384,7 +384,7 @@ const StringArray CameraDevice::getAvailableDevices() | |||||
| StringArray results; | StringArray results; | ||||
| NSArray* devs = [QTCaptureDevice inputDevicesWithMediaType: QTMediaTypeVideo]; | NSArray* devs = [QTCaptureDevice inputDevicesWithMediaType: QTMediaTypeVideo]; | ||||
| for (int i = 0; i < [devs count]; ++i) | |||||
| for (int i = 0; i < (int) [devs count]; ++i) | |||||
| { | { | ||||
| QTCaptureDevice* dev = (QTCaptureDevice*) [devs objectAtIndex: i]; | QTCaptureDevice* dev = (QTCaptureDevice*) [devs objectAtIndex: i]; | ||||
| results.add (nsStringToJuce ([dev localizedDisplayName])); | results.add (nsStringToJuce ([dev localizedDisplayName])); | ||||
| @@ -67,7 +67,7 @@ public: | |||||
| { | { | ||||
| const Image::BitmapData srcData (juceImage, 0, 0, juceImage.getWidth(), juceImage.getHeight()); | const Image::BitmapData srcData (juceImage, 0, 0, juceImage.getWidth(), juceImage.getHeight()); | ||||
| CGDataProviderRef provider = CGDataProviderCreateWithData (0, srcData.data, srcData.lineStride * srcData.pixelStride, 0); | |||||
| CGDataProviderRef provider = CGDataProviderCreateWithData (0, srcData.data, srcData.lineStride * srcData.height, 0); | |||||
| CGImageRef imageRef = CGImageCreate (srcData.width, srcData.height, | CGImageRef imageRef = CGImageCreate (srcData.width, srcData.height, | ||||
| 8, srcData.pixelStride * 8, srcData.lineStride, | 8, srcData.pixelStride * 8, srcData.lineStride, | ||||
| @@ -353,7 +353,7 @@ XmlElement* XmlDocument::readNextElement (const bool alsoParseSubElements) throw | |||||
| } | } | ||||
| } | } | ||||
| node = new XmlElement (input, tagLen); | |||||
| node = new XmlElement (String (input, tagLen)); | |||||
| input += tagLen; | input += tagLen; | ||||
| XmlElement::XmlAttributeNode* lastAttribute = 0; | XmlElement::XmlAttributeNode* lastAttribute = 0; | ||||
| @@ -69,15 +69,6 @@ XmlElement::XmlElement (int /*dummy*/) throw() | |||||
| { | { | ||||
| } | } | ||||
| XmlElement::XmlElement (const tchar* const tagName_, | |||||
| const int nameLen) throw() | |||||
| : tagName (tagName_, nameLen), | |||||
| firstChildElement (0), | |||||
| nextElement (0), | |||||
| attributes (0) | |||||
| { | |||||
| } | |||||
| XmlElement::XmlElement (const XmlElement& other) throw() | XmlElement::XmlElement (const XmlElement& other) throw() | ||||
| : tagName (other.tagName), | : tagName (other.tagName), | ||||
| firstChildElement (0), | firstChildElement (0), | ||||
| @@ -383,7 +374,7 @@ void XmlElement::writeElementAsText (OutputStream& outputStream, | |||||
| const String XmlElement::createDocument (const String& dtdToUse, | const String XmlElement::createDocument (const String& dtdToUse, | ||||
| const bool allOnOneLine, | const bool allOnOneLine, | ||||
| const bool includeXmlHeader, | const bool includeXmlHeader, | ||||
| const tchar* const encodingType, | |||||
| const String& encodingType, | |||||
| const int lineWrapLength) const throw() | const int lineWrapLength) const throw() | ||||
| { | { | ||||
| MemoryOutputStream mem (2048, 4096); | MemoryOutputStream mem (2048, 4096); | ||||
| @@ -396,7 +387,7 @@ void XmlElement::writeToStream (OutputStream& output, | |||||
| const String& dtdToUse, | const String& dtdToUse, | ||||
| const bool allOnOneLine, | const bool allOnOneLine, | ||||
| const bool includeXmlHeader, | const bool includeXmlHeader, | ||||
| const tchar* const encodingType, | |||||
| const String& encodingType, | |||||
| const int lineWrapLength) const throw() | const int lineWrapLength) const throw() | ||||
| { | { | ||||
| if (includeXmlHeader) | if (includeXmlHeader) | ||||
| @@ -424,7 +415,7 @@ void XmlElement::writeToStream (OutputStream& output, | |||||
| bool XmlElement::writeToFile (const File& file, | bool XmlElement::writeToFile (const File& file, | ||||
| const String& dtdToUse, | const String& dtdToUse, | ||||
| const tchar* const encodingType, | |||||
| const String& encodingType, | |||||
| const int lineWrapLength) const throw() | const int lineWrapLength) const throw() | ||||
| { | { | ||||
| if (file.hasWriteAccess()) | if (file.hasWriteAccess()) | ||||
| @@ -445,7 +436,7 @@ bool XmlElement::writeToFile (const File& file, | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| bool XmlElement::hasTagName (const tchar* const tagNameWanted) const throw() | |||||
| bool XmlElement::hasTagName (const String& tagNameWanted) const throw() | |||||
| { | { | ||||
| #ifdef JUCE_DEBUG | #ifdef JUCE_DEBUG | ||||
| // if debugging, check that the case is actually the same, because | // if debugging, check that the case is actually the same, because | ||||
| @@ -465,7 +456,7 @@ bool XmlElement::hasTagName (const tchar* const tagNameWanted) const throw() | |||||
| #endif | #endif | ||||
| } | } | ||||
| XmlElement* XmlElement::getNextElementWithTagName (const tchar* const requiredTagName) const | |||||
| XmlElement* XmlElement::getNextElementWithTagName (const String& requiredTagName) const | |||||
| { | { | ||||
| XmlElement* e = nextElement; | XmlElement* e = nextElement; | ||||
| @@ -525,7 +516,7 @@ const String& XmlElement::getAttributeValue (const int index) const throw() | |||||
| return String::empty; | return String::empty; | ||||
| } | } | ||||
| bool XmlElement::hasAttribute (const tchar* const attributeName) const throw() | |||||
| bool XmlElement::hasAttribute (const String& attributeName) const throw() | |||||
| { | { | ||||
| const XmlAttributeNode* att = attributes; | const XmlAttributeNode* att = attributes; | ||||
| @@ -541,8 +532,8 @@ bool XmlElement::hasAttribute (const tchar* const attributeName) const throw() | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| const String XmlElement::getStringAttribute (const tchar* const attributeName, | |||||
| const tchar* const defaultReturnValue) const throw() | |||||
| const String XmlElement::getStringAttribute (const String& attributeName, | |||||
| const String& defaultReturnValue) const throw() | |||||
| { | { | ||||
| const XmlAttributeNode* att = attributes; | const XmlAttributeNode* att = attributes; | ||||
| @@ -557,7 +548,7 @@ const String XmlElement::getStringAttribute (const tchar* const attributeName, | |||||
| return defaultReturnValue; | return defaultReturnValue; | ||||
| } | } | ||||
| int XmlElement::getIntAttribute (const tchar* const attributeName, | |||||
| int XmlElement::getIntAttribute (const String& attributeName, | |||||
| const int defaultReturnValue) const throw() | const int defaultReturnValue) const throw() | ||||
| { | { | ||||
| const XmlAttributeNode* att = attributes; | const XmlAttributeNode* att = attributes; | ||||
| @@ -573,7 +564,7 @@ int XmlElement::getIntAttribute (const tchar* const attributeName, | |||||
| return defaultReturnValue; | return defaultReturnValue; | ||||
| } | } | ||||
| double XmlElement::getDoubleAttribute (const tchar* const attributeName, | |||||
| double XmlElement::getDoubleAttribute (const String& attributeName, | |||||
| const double defaultReturnValue) const throw() | const double defaultReturnValue) const throw() | ||||
| { | { | ||||
| const XmlAttributeNode* att = attributes; | const XmlAttributeNode* att = attributes; | ||||
| @@ -589,7 +580,7 @@ double XmlElement::getDoubleAttribute (const tchar* const attributeName, | |||||
| return defaultReturnValue; | return defaultReturnValue; | ||||
| } | } | ||||
| bool XmlElement::getBoolAttribute (const tchar* const attributeName, | |||||
| bool XmlElement::getBoolAttribute (const String& attributeName, | |||||
| const bool defaultReturnValue) const throw() | const bool defaultReturnValue) const throw() | ||||
| { | { | ||||
| const XmlAttributeNode* att = attributes; | const XmlAttributeNode* att = attributes; | ||||
| @@ -616,8 +607,8 @@ bool XmlElement::getBoolAttribute (const tchar* const attributeName, | |||||
| return defaultReturnValue; | return defaultReturnValue; | ||||
| } | } | ||||
| bool XmlElement::compareAttribute (const tchar* const attributeName, | |||||
| const tchar* const stringToCompareAgainst, | |||||
| bool XmlElement::compareAttribute (const String& attributeName, | |||||
| const String& stringToCompareAgainst, | |||||
| const bool ignoreCase) const throw() | const bool ignoreCase) const throw() | ||||
| { | { | ||||
| const XmlAttributeNode* att = attributes; | const XmlAttributeNode* att = attributes; | ||||
| @@ -639,7 +630,7 @@ bool XmlElement::compareAttribute (const tchar* const attributeName, | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| void XmlElement::setAttribute (const tchar* const attributeName, | |||||
| void XmlElement::setAttribute (const String& attributeName, | |||||
| const String& value) throw() | const String& value) throw() | ||||
| { | { | ||||
| #ifdef JUCE_DEBUG | #ifdef JUCE_DEBUG | ||||
| @@ -681,25 +672,19 @@ void XmlElement::setAttribute (const tchar* const attributeName, | |||||
| } | } | ||||
| } | } | ||||
| void XmlElement::setAttribute (const tchar* const attributeName, | |||||
| const tchar* const text) throw() | |||||
| { | |||||
| setAttribute (attributeName, String (text)); | |||||
| } | |||||
| void XmlElement::setAttribute (const tchar* const attributeName, | |||||
| void XmlElement::setAttribute (const String& attributeName, | |||||
| const int number) throw() | const int number) throw() | ||||
| { | { | ||||
| setAttribute (attributeName, String (number)); | setAttribute (attributeName, String (number)); | ||||
| } | } | ||||
| void XmlElement::setAttribute (const tchar* const attributeName, | |||||
| void XmlElement::setAttribute (const String& attributeName, | |||||
| const double number) throw() | const double number) throw() | ||||
| { | { | ||||
| setAttribute (attributeName, String (number)); | setAttribute (attributeName, String (number)); | ||||
| } | } | ||||
| void XmlElement::removeAttribute (const tchar* const attributeName) throw() | |||||
| void XmlElement::removeAttribute (const String& attributeName) throw() | |||||
| { | { | ||||
| XmlAttributeNode* att = attributes; | XmlAttributeNode* att = attributes; | ||||
| XmlAttributeNode* lastAtt = 0; | XmlAttributeNode* lastAtt = 0; | ||||
| @@ -761,7 +746,7 @@ XmlElement* XmlElement::getChildElement (const int index) const throw() | |||||
| return child; | return child; | ||||
| } | } | ||||
| XmlElement* XmlElement::getChildByName (const tchar* const childName) const throw() | |||||
| XmlElement* XmlElement::getChildByName (const String& childName) const throw() | |||||
| { | { | ||||
| XmlElement* child = firstChildElement; | XmlElement* child = firstChildElement; | ||||
| @@ -995,7 +980,7 @@ void XmlElement::deleteAllChildElements() throw() | |||||
| } | } | ||||
| } | } | ||||
| void XmlElement::deleteAllChildElementsWithTagName (const tchar* const name) throw() | |||||
| void XmlElement::deleteAllChildElementsWithTagName (const String& name) throw() | |||||
| { | { | ||||
| XmlElement* child = firstChildElement; | XmlElement* child = firstChildElement; | ||||
| @@ -1122,7 +1107,7 @@ const String XmlElement::getAllSubText() const throw() | |||||
| return result; | return result; | ||||
| } | } | ||||
| const String XmlElement::getChildElementAllSubText (const tchar* const childTagName, | |||||
| const String XmlElement::getChildElementAllSubText (const String& childTagName, | |||||
| const String& defaultReturnValue) const throw() | const String& defaultReturnValue) const throw() | ||||
| { | { | ||||
| const XmlElement* const child = getChildByName (childTagName); | const XmlElement* const child = getChildByName (childTagName); | ||||
| @@ -192,7 +192,7 @@ public: | |||||
| const String createDocument (const String& dtdToUse, | const String createDocument (const String& dtdToUse, | ||||
| const bool allOnOneLine = false, | const bool allOnOneLine = false, | ||||
| const bool includeXmlHeader = true, | const bool includeXmlHeader = true, | ||||
| const tchar* const encodingType = JUCE_T("UTF-8"), | |||||
| const String& encodingType = JUCE_T("UTF-8"), | |||||
| const int lineWrapLength = 60) const throw(); | const int lineWrapLength = 60) const throw(); | ||||
| /** Writes the document to a stream as UTF-8. | /** Writes the document to a stream as UTF-8. | ||||
| @@ -214,7 +214,7 @@ public: | |||||
| const String& dtdToUse, | const String& dtdToUse, | ||||
| const bool allOnOneLine = false, | const bool allOnOneLine = false, | ||||
| const bool includeXmlHeader = true, | const bool includeXmlHeader = true, | ||||
| const tchar* const encodingType = JUCE_T("UTF-8"), | |||||
| const String& encodingType = JUCE_T("UTF-8"), | |||||
| const int lineWrapLength = 60) const throw(); | const int lineWrapLength = 60) const throw(); | ||||
| /** Writes the element to a file as an XML document. | /** Writes the element to a file as an XML document. | ||||
| @@ -238,7 +238,7 @@ public: | |||||
| */ | */ | ||||
| bool writeToFile (const File& destinationFile, | bool writeToFile (const File& destinationFile, | ||||
| const String& dtdToUse, | const String& dtdToUse, | ||||
| const tchar* const encodingType = JUCE_T("UTF-8"), | |||||
| const String& encodingType = JUCE_T("UTF-8"), | |||||
| const int lineWrapLength = 60) const throw(); | const int lineWrapLength = 60) const throw(); | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -257,7 +257,7 @@ public: | |||||
| @see getTagName | @see getTagName | ||||
| */ | */ | ||||
| bool hasTagName (const tchar* const possibleTagName) const throw(); | |||||
| bool hasTagName (const String& possibleTagName) const throw(); | |||||
| //============================================================================== | //============================================================================== | ||||
| /** Returns the number of XML attributes this element contains. | /** Returns the number of XML attributes this element contains. | ||||
| @@ -289,7 +289,7 @@ public: | |||||
| // Attribute-handling methods.. | // Attribute-handling methods.. | ||||
| /** Checks whether the element contains an attribute with a certain name. */ | /** Checks whether the element contains an attribute with a certain name. */ | ||||
| bool hasAttribute (const tchar* const attributeName) const throw(); | |||||
| bool hasAttribute (const String& attributeName) const throw(); | |||||
| /** Returns the value of a named attribute. | /** Returns the value of a named attribute. | ||||
| @@ -297,8 +297,8 @@ public: | |||||
| @param defaultReturnValue a value to return if the element doesn't have an attribute | @param defaultReturnValue a value to return if the element doesn't have an attribute | ||||
| with this name | with this name | ||||
| */ | */ | ||||
| const String getStringAttribute (const tchar* const attributeName, | |||||
| const tchar* const defaultReturnValue = 0) const throw(); | |||||
| const String getStringAttribute (const String& attributeName, | |||||
| const String& defaultReturnValue = String::empty) const throw(); | |||||
| /** Compares the value of a named attribute with a value passed-in. | /** Compares the value of a named attribute with a value passed-in. | ||||
| @@ -308,8 +308,8 @@ public: | |||||
| @returns true if the value of the attribute is the same as the string passed-in; | @returns true if the value of the attribute is the same as the string passed-in; | ||||
| false if it's different (or if no such attribute exists) | false if it's different (or if no such attribute exists) | ||||
| */ | */ | ||||
| bool compareAttribute (const tchar* const attributeName, | |||||
| const tchar* const stringToCompareAgainst, | |||||
| bool compareAttribute (const String& attributeName, | |||||
| const String& stringToCompareAgainst, | |||||
| const bool ignoreCase = false) const throw(); | const bool ignoreCase = false) const throw(); | ||||
| /** Returns the value of a named attribute as an integer. | /** Returns the value of a named attribute as an integer. | ||||
| @@ -320,9 +320,9 @@ public: | |||||
| @param attributeName the name of the attribute to look up | @param attributeName the name of the attribute to look up | ||||
| @param defaultReturnValue a value to return if the element doesn't have an attribute | @param defaultReturnValue a value to return if the element doesn't have an attribute | ||||
| with this name | with this name | ||||
| @see setAttribute (const tchar* const, int) | |||||
| @see setAttribute | |||||
| */ | */ | ||||
| int getIntAttribute (const tchar* const attributeName, | |||||
| int getIntAttribute (const String& attributeName, | |||||
| const int defaultReturnValue = 0) const throw(); | const int defaultReturnValue = 0) const throw(); | ||||
| /** Returns the value of a named attribute as floating-point. | /** Returns the value of a named attribute as floating-point. | ||||
| @@ -333,9 +333,9 @@ public: | |||||
| @param attributeName the name of the attribute to look up | @param attributeName the name of the attribute to look up | ||||
| @param defaultReturnValue a value to return if the element doesn't have an attribute | @param defaultReturnValue a value to return if the element doesn't have an attribute | ||||
| with this name | with this name | ||||
| @see setAttribute (const tchar* const, double) | |||||
| @see setAttribute | |||||
| */ | */ | ||||
| double getDoubleAttribute (const tchar* const attributeName, | |||||
| double getDoubleAttribute (const String& attributeName, | |||||
| const double defaultReturnValue = 0.0) const throw(); | const double defaultReturnValue = 0.0) const throw(); | ||||
| /** Returns the value of a named attribute as a boolean. | /** Returns the value of a named attribute as a boolean. | ||||
| @@ -348,7 +348,7 @@ public: | |||||
| @param defaultReturnValue a value to return if the element doesn't have an attribute | @param defaultReturnValue a value to return if the element doesn't have an attribute | ||||
| with this name | with this name | ||||
| */ | */ | ||||
| bool getBoolAttribute (const tchar* const attributeName, | |||||
| bool getBoolAttribute (const String& attributeName, | |||||
| const bool defaultReturnValue = false) const throw(); | const bool defaultReturnValue = false) const throw(); | ||||
| /** Adds a named attribute to the element. | /** Adds a named attribute to the element. | ||||
| @@ -364,24 +364,9 @@ public: | |||||
| @param newValue the value to set it to | @param newValue the value to set it to | ||||
| @see removeAttribute | @see removeAttribute | ||||
| */ | */ | ||||
| void setAttribute (const tchar* const attributeName, | |||||
| void setAttribute (const String& attributeName, | |||||
| const String& newValue) throw(); | const String& newValue) throw(); | ||||
| /** Adds a named attribute to the element. | |||||
| If the element already contains an attribute with this name, it's value will | |||||
| be updated to the new value. If there's no such attribute yet, a new one will | |||||
| be added. | |||||
| Note that there are other setAttribute() methods that take integers, | |||||
| doubles, etc. to make it easy to store numbers. | |||||
| @param attributeName the name of the attribute to set | |||||
| @param newValue the value to set it to | |||||
| */ | |||||
| void setAttribute (const tchar* const attributeName, | |||||
| const tchar* const newValue) throw(); | |||||
| /** Adds a named attribute to the element, setting it to an integer value. | /** Adds a named attribute to the element, setting it to an integer value. | ||||
| If the element already contains an attribute with this name, it's value will | If the element already contains an attribute with this name, it's value will | ||||
| @@ -394,7 +379,7 @@ public: | |||||
| @param attributeName the name of the attribute to set | @param attributeName the name of the attribute to set | ||||
| @param newValue the value to set it to | @param newValue the value to set it to | ||||
| */ | */ | ||||
| void setAttribute (const tchar* const attributeName, | |||||
| void setAttribute (const String& attributeName, | |||||
| const int newValue) throw(); | const int newValue) throw(); | ||||
| /** Adds a named attribute to the element, setting it to a floating-point value. | /** Adds a named attribute to the element, setting it to a floating-point value. | ||||
| @@ -409,7 +394,7 @@ public: | |||||
| @param attributeName the name of the attribute to set | @param attributeName the name of the attribute to set | ||||
| @param newValue the value to set it to | @param newValue the value to set it to | ||||
| */ | */ | ||||
| void setAttribute (const tchar* const attributeName, | |||||
| void setAttribute (const String& attributeName, | |||||
| const double newValue) throw(); | const double newValue) throw(); | ||||
| /** Removes a named attribute from the element. | /** Removes a named attribute from the element. | ||||
| @@ -417,7 +402,7 @@ public: | |||||
| @param attributeName the name of the attribute to remove | @param attributeName the name of the attribute to remove | ||||
| @see removeAllAttributes | @see removeAllAttributes | ||||
| */ | */ | ||||
| void removeAttribute (const tchar* const attributeName) throw(); | |||||
| void removeAttribute (const String& attributeName) throw(); | |||||
| /** Removes all attributes from this element. | /** Removes all attributes from this element. | ||||
| */ | */ | ||||
| @@ -460,7 +445,7 @@ public: | |||||
| @see getNextElement, isTextElement, forEachXmlChildElement | @see getNextElement, isTextElement, forEachXmlChildElement | ||||
| */ | */ | ||||
| inline XmlElement* getNextElement() const throw() { return nextElement; } | |||||
| inline XmlElement* getNextElement() const throw() { return nextElement; } | |||||
| /** Returns the next of this element's siblings which has the specified tag | /** Returns the next of this element's siblings which has the specified tag | ||||
| name. | name. | ||||
| @@ -470,7 +455,7 @@ public: | |||||
| @see getNextElement, forEachXmlChildElementWithTagName | @see getNextElement, forEachXmlChildElementWithTagName | ||||
| */ | */ | ||||
| XmlElement* getNextElementWithTagName (const tchar* const requiredTagName) const; | |||||
| XmlElement* getNextElementWithTagName (const String& requiredTagName) const; | |||||
| /** Returns the number of sub-elements in this element. | /** Returns the number of sub-elements in this element. | ||||
| @@ -494,7 +479,7 @@ public: | |||||
| @returns the first element with this tag name, or 0 if none is found | @returns the first element with this tag name, or 0 if none is found | ||||
| @see getNextElement, isTextElement, getChildElement | @see getNextElement, isTextElement, getChildElement | ||||
| */ | */ | ||||
| XmlElement* getChildByName (const tchar* const tagNameToLookFor) const throw(); | |||||
| XmlElement* getChildByName (const String& tagNameToLookFor) const throw(); | |||||
| //============================================================================== | //============================================================================== | ||||
| /** Appends an element to this element's list of children. | /** Appends an element to this element's list of children. | ||||
| @@ -551,7 +536,7 @@ public: | |||||
| @see removeChildElement | @see removeChildElement | ||||
| */ | */ | ||||
| void deleteAllChildElementsWithTagName (const tchar* const tagName) throw(); | |||||
| void deleteAllChildElementsWithTagName (const String& tagName) throw(); | |||||
| /** Returns true if the given element is a child of this one. */ | /** Returns true if the given element is a child of this one. */ | ||||
| bool containsChildElement (const XmlElement* const possibleChild) const throw(); | bool containsChildElement (const XmlElement* const possibleChild) const throw(); | ||||
| @@ -653,7 +638,7 @@ public: | |||||
| @see getAllSubText | @see getAllSubText | ||||
| */ | */ | ||||
| const String getChildElementAllSubText (const tchar* const childTagName, | |||||
| const String getChildElementAllSubText (const String& childTagName, | |||||
| const String& defaultReturnValue) const throw(); | const String& defaultReturnValue) const throw(); | ||||
| /** Appends a section of text to this element. | /** Appends a section of text to this element. | ||||
| @@ -698,7 +683,6 @@ private: | |||||
| XmlAttributeNode* attributes; | XmlAttributeNode* attributes; | ||||
| XmlElement (int) throw(); // for internal use | XmlElement (int) throw(); // for internal use | ||||
| XmlElement (const tchar* const tagNameText, const int nameLen) throw(); | |||||
| void copyChildrenAndAttributesFrom (const XmlElement& other) throw(); | void copyChildrenAndAttributesFrom (const XmlElement& other) throw(); | ||||