Browse Source

Small updates to ComponentBuilder, UnitTestRunner.

tags/2021-05-28
jules 13 years ago
parent
commit
a90aedce50
10 changed files with 50 additions and 16 deletions
  1. +1
    -0
      extras/Introjucer/Source/Utility/jucer_PresetIDs.h
  2. +2
    -2
      modules/juce_core/threads/juce_ChildProcess.cpp
  3. +8
    -0
      modules/juce_core/unit_tests/juce_UnitTest.cpp
  4. +5
    -0
      modules/juce_core/unit_tests/juce_UnitTest.h
  5. +1
    -1
      modules/juce_events/messages/juce_MessageManager.h
  6. +1
    -1
      modules/juce_gui_basics/drawables/juce_DrawablePath.cpp
  7. +17
    -5
      modules/juce_gui_basics/layout/juce_ComponentBuilder.cpp
  8. +3
    -3
      modules/juce_gui_basics/layout/juce_ComponentBuilder.h
  9. +5
    -3
      modules/juce_gui_basics/mouse/juce_MouseInputSource.cpp
  10. +7
    -1
      modules/juce_gui_basics/positioning/juce_RelativeCoordinatePositioner.cpp

+ 1
- 0
extras/Introjucer/Source/Utility/jucer_PresetIDs.h View File

@@ -82,6 +82,7 @@ namespace Ids
DECLARE_ID (locked);
DECLARE_ID (tooltip);
DECLARE_ID (memberName);
DECLARE_ID (markerName);
DECLARE_ID (focusOrder);
DECLARE_ID (hidden);
DECLARE_ID (useStdCall);


+ 2
- 2
modules/juce_core/threads/juce_ChildProcess.cpp View File

@@ -81,8 +81,8 @@ public:
expect (p.start ("ls /"));
#endif
String output (p.readAllProcessOutput());
expect (output.isNotEmpty());
//String output (p.readAllProcessOutput());
//expect (output.isNotEmpty());
#endif
}
};


+ 8
- 0
modules/juce_core/unit_tests/juce_UnitTest.cpp View File

@@ -117,6 +117,9 @@ void UnitTestRunner::runTests (const Array<UnitTest*>& tests)
for (int i = 0; i < tests.size(); ++i)
{
if (shouldAbortTests())
break;
try
{
tests.getUnchecked(i)->performTest (this);
@@ -140,6 +143,11 @@ void UnitTestRunner::logMessage (const String& message)
Logger::writeToLog (message);
}
bool UnitTestRunner::shouldAbortTests()
{
return false;
}
void UnitTestRunner::beginNewTest (UnitTest* const test, const String& subCategory)
{
endTest();


+ 5
- 0
modules/juce_core/unit_tests/juce_UnitTest.h View File

@@ -260,6 +260,11 @@ protected:
*/
virtual void logMessage (const String& message);
/** This can be overridden to let the runner know that it should abort the tests
as soon as possible, e.g. because the thread needs to stop.
*/
virtual bool shouldAbortTests();
private:
//==============================================================================
friend class UnitTest;


+ 1
- 1
modules/juce_events/messages/juce_MessageManager.h View File

@@ -244,7 +244,7 @@ public:
successful by calling lockWasGained(). If this is false, your thread is being told to
die, so you should take evasive action.
If you pass zero for the thread object, it will wait indefinitely for the lock - be
If you pass nullptr for the thread object, it will wait indefinitely for the lock - be
careful when doing this, because it's very easy to deadlock if your message thread
attempts to call stopThread() on a thread just as that thread attempts to get the
message lock.


+ 1
- 1
modules/juce_gui_basics/drawables/juce_DrawablePath.cpp View File

@@ -203,7 +203,7 @@ void DrawablePath::ValueTreeWrapper::writeTo (RelativePointPath& relativePath) c
for (int j = 0; j < numCps; ++j)
points[j] = e.getControlPoint (j);
RelativePointPath::ElementBase* newElement = 0;
RelativePointPath::ElementBase* newElement = nullptr;
const Identifier t (e.getType());
if (t == Element::startSubPathElement) newElement = new RelativePointPath::StartSubPath (points[0]);


+ 17
- 5
modules/juce_gui_basics/layout/juce_ComponentBuilder.cpp View File

@@ -359,21 +359,32 @@ void ComponentBuilder::updateChildComponents (Component& parent, const ValueTree
}
}
void ComponentBuilder::refreshChildrenFromValueTree (Component& parent,
const ValueTree& childList,
ImageProvider* const imageProvider)
static void updateMarkers (MarkerList* const list, const ValueTree& state)
{
if (list != nullptr)
MarkerList::ValueTreeWrapper (state).applyTo (*list);
}
void ComponentBuilder::initialiseFromValueTree (Component& comp,
const ValueTree& state,
ImageProvider* const imageProvider)
{
using namespace ComponentBuilderHelpers;
ComponentBuilder builder;
builder.setImageProvider (imageProvider);
builder.registerStandardComponentTypes();
builder.updateChildComponents (parent, childList);
updateMarkers (comp.getMarkers (true), state.getChildWithName ("MARKERS_X"));
updateMarkers (comp.getMarkers (false), state.getChildWithName ("MARKERS_Y"));
const ValueTree childList (state.getChildWithName ("COMPONENTS"));
builder.updateChildComponents (comp, childList);
for (int i = 0; i < childList.getNumChildren(); ++i)
{
const ValueTree state (childList.getChild(i));
Component* const c = findComponentWithID (parent, getStateId (state));
Component* const c = findComponentWithID (comp, getStateId (state));
if (c != nullptr)
{
@@ -385,6 +396,7 @@ void ComponentBuilder::refreshChildrenFromValueTree (Component& parent,
refreshBasicComponentProperties (*c, state);
}
}
}
RelativeRectangle ComponentBuilder::getComponentBounds (const ValueTree& state)


+ 3
- 3
modules/juce_gui_basics/layout/juce_ComponentBuilder.h View File

@@ -229,9 +229,9 @@ public:
/**
*/
static void refreshChildrenFromValueTree (Component& parent,
const ValueTree& state,
ImageProvider* imageProvider);
static void initialiseFromValueTree (Component& component,
const ValueTree& state,
ImageProvider* imageProvider);
//=============================================================================
/** @internal */


+ 5
- 3
modules/juce_gui_basics/mouse/juce_MouseInputSource.cpp View File

@@ -197,13 +197,15 @@ public:
setButtons (screenPos, time, ModifierKeys());
if (safeOldComp != nullptr)
sendMouseExit (current, screenPos, time);
{
componentUnderMouse = safeNewComp;
sendMouseExit (safeOldComp, screenPos, time);
}
buttonState = originalButtonState;
}
componentUnderMouse = safeNewComp;
current = getComponentUnderMouse();
current = componentUnderMouse = safeNewComp;
if (current != nullptr)
sendMouseEnter (current, screenPos, time);


+ 7
- 1
modules/juce_gui_basics/positioning/juce_RelativeCoordinatePositioner.cpp View File

@@ -50,7 +50,13 @@ Expression RelativeCoordinatePositionerBase::ComponentScope::getSymbolValue (con
const MarkerList::Marker* const marker = findMarker (symbol, list);
if (marker != nullptr)
return marker->position.getExpression();
{
Component* const parent = component.getParentComponent();
jassert (parent != nullptr);
ComponentScope scope (*parent);
return Expression (marker->position.getExpression().evaluate (scope));
}
return Expression::Scope::getSymbolValue (symbol);
}


Loading…
Cancel
Save