mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-03 03:30:06 +00:00
Minor fix to Atomic. Jucer development.
This commit is contained in:
parent
7299608550
commit
e6a5f1501f
13 changed files with 152 additions and 20 deletions
|
|
@ -267,6 +267,9 @@ void ComponentDocument::checkRootObject()
|
|||
{
|
||||
jassert (root.hasType (componentDocumentTag));
|
||||
|
||||
if (root [idProperty].toString().isEmpty())
|
||||
root.setProperty (idProperty, createAlphaNumericUID(), 0);
|
||||
|
||||
createSubTreeIfNotThere (componentGroupTag);
|
||||
createSubTreeIfNotThere (markersGroupXTag);
|
||||
createSubTreeIfNotThere (markersGroupYTag);
|
||||
|
|
|
|||
|
|
@ -52,6 +52,8 @@ public:
|
|||
const File getCppFile() const { return cppFile; }
|
||||
|
||||
//==============================================================================
|
||||
const String getUniqueId() const { return root [idProperty]; }
|
||||
|
||||
Value getClassName() const { return getRootValueNonUndoable ("className"); }
|
||||
Value getClassDescription() const { return getRootValueNonUndoable ("classDesc"); }
|
||||
|
||||
|
|
|
|||
|
|
@ -57,6 +57,11 @@ public:
|
|||
getDocument().beginNewTransaction();
|
||||
}
|
||||
|
||||
Component* createComponentHolder()
|
||||
{
|
||||
return new Component();
|
||||
}
|
||||
|
||||
static Component* findComponentForState (Component* compHolder, ComponentDocument& doc, const ValueTree& state)
|
||||
{
|
||||
for (int i = compHolder->getNumChildComponents(); --i >= 0;)
|
||||
|
|
|
|||
|
|
@ -69,7 +69,6 @@ namespace ComponentEditorTreeView
|
|||
virtual const String getItemId() const = 0;
|
||||
|
||||
void setName (const String& newName) {}
|
||||
|
||||
void itemClicked (const MouseEvent& e) {}
|
||||
void itemDoubleClicked (const MouseEvent& e) {}
|
||||
|
||||
|
|
@ -95,6 +94,10 @@ namespace ComponentEditorTreeView
|
|||
ComponentEditor& editor;
|
||||
};
|
||||
|
||||
static const String getDragIdFor (ComponentEditor& editor)
|
||||
{
|
||||
return componentItemDragType + editor.getDocument().getUniqueId();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
class ComponentItem : public Base
|
||||
|
|
@ -123,7 +126,7 @@ namespace ComponentEditorTreeView
|
|||
|
||||
Image* getIcon() const { return LookAndFeel::getDefaultLookAndFeel().getDefaultDocumentFileImage(); }
|
||||
|
||||
const String getDragSourceDescription() { return componentItemDragType; }
|
||||
const String getDragSourceDescription() { return getDragIdFor (editor); }
|
||||
|
||||
void valueTreePropertyChanged (ValueTree& tree, const var::identifier& property)
|
||||
{
|
||||
|
|
@ -131,7 +134,6 @@ namespace ComponentEditorTreeView
|
|||
repaintItem();
|
||||
}
|
||||
|
||||
private:
|
||||
ValueTree componentState;
|
||||
};
|
||||
|
||||
|
|
@ -180,6 +182,93 @@ namespace ComponentEditorTreeView
|
|||
Image* getIcon() const { return LookAndFeel::getDefaultLookAndFeel().getDefaultFolderImage(); }
|
||||
const String getDragSourceDescription() { return String::empty; }
|
||||
|
||||
bool isInterestedInDragSource (const String& sourceDescription, Component* sourceComponent)
|
||||
{
|
||||
return sourceDescription == getDragIdFor (editor)
|
||||
&& editor.getSelection().getNumSelected() > 0;
|
||||
}
|
||||
|
||||
void itemDropped (const String& sourceDescription, Component* sourceComponent, int insertIndex)
|
||||
{
|
||||
if (editor.getSelection().getNumSelected() > 0)
|
||||
{
|
||||
TreeView* tree = getOwnerView();
|
||||
const ScopedPointer <XmlElement> openness (tree->getOpennessState (false));
|
||||
|
||||
Array <ValueTree> selectedComps;
|
||||
// scan the source tree rather than look at the selection manager, because it might
|
||||
// be from a different editor, and the order needs to be correct.
|
||||
getAllSelectedNodesInTree (sourceComponent, selectedComps);
|
||||
insertItems (selectedComps, insertIndex);
|
||||
|
||||
if (openness != 0)
|
||||
tree->restoreOpennessState (*openness);
|
||||
}
|
||||
}
|
||||
|
||||
static void getAllSelectedNodesInTree (Component* componentInTree, Array<ValueTree>& selectedComps)
|
||||
{
|
||||
TreeView* tree = dynamic_cast <TreeView*> (componentInTree);
|
||||
|
||||
if (tree == 0)
|
||||
tree = componentInTree->findParentComponentOfClass ((TreeView*) 0);
|
||||
|
||||
if (tree != 0)
|
||||
{
|
||||
const int numSelected = tree->getNumSelectedItems();
|
||||
|
||||
for (int i = 0; i < numSelected; ++i)
|
||||
{
|
||||
const ComponentItem* const item = dynamic_cast <ComponentItem*> (tree->getSelectedItem (i));
|
||||
|
||||
if (item != 0)
|
||||
selectedComps.add (item->componentState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void insertItems (Array <ValueTree>& comps, int insertIndex)
|
||||
{
|
||||
int i;
|
||||
for (i = comps.size(); --i >= 0;)
|
||||
if (componentTree == comps.getReference(i) || componentTree.isAChildOf (comps.getReference(i))) // Check for recursion.
|
||||
return;
|
||||
|
||||
// Don't include any nodes that are children of other selected nodes..
|
||||
for (i = comps.size(); --i >= 0;)
|
||||
{
|
||||
const ValueTree& n = comps.getReference(i);
|
||||
|
||||
for (int j = comps.size(); --j >= 0;)
|
||||
{
|
||||
if (j != i && n.isAChildOf (comps.getReference(j)))
|
||||
{
|
||||
comps.remove (i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove and re-insert them one at a time..
|
||||
for (i = 0; i < comps.size(); ++i)
|
||||
{
|
||||
ValueTree& n = comps.getReference(i);
|
||||
|
||||
if (n.getParent() == componentTree && componentTree.indexOf (n) < insertIndex)
|
||||
--insertIndex;
|
||||
|
||||
if (n.getParent() == componentTree)
|
||||
{
|
||||
n.getParent().moveChild (componentTree.indexOf (n), insertIndex++, editor.getDocument().getUndoManager());
|
||||
}
|
||||
else
|
||||
{
|
||||
n.getParent().removeChild (n, editor.getDocument().getUndoManager());
|
||||
componentTree.addChild (n, insertIndex++, editor.getDocument().getUndoManager());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
ValueTree componentTree;
|
||||
};
|
||||
|
|
@ -212,7 +301,7 @@ namespace ComponentEditorTreeView
|
|||
|
||||
Image* getIcon() const { return LookAndFeel::getDefaultLookAndFeel().getDefaultDocumentFileImage(); }
|
||||
|
||||
const String getDragSourceDescription() { return componentItemDragType; }
|
||||
const String getDragSourceDescription() { return String::empty; }
|
||||
|
||||
void valueTreePropertyChanged (ValueTree& tree, const var::identifier& property)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -47,10 +47,15 @@ public:
|
|||
shutdown();
|
||||
}
|
||||
|
||||
Component* createComponentHolder()
|
||||
{
|
||||
return new DrawableComponent (this);
|
||||
}
|
||||
|
||||
void updateComponents()
|
||||
{
|
||||
|
||||
|
||||
drawable = Drawable::createFromValueTree (getEditor().getDocument().getRootDrawableNode());
|
||||
getComponentHolder()->repaint();
|
||||
startTimer (500);
|
||||
}
|
||||
|
||||
|
|
@ -180,6 +185,7 @@ public:
|
|||
return *getDocument().getUndoManager();
|
||||
}
|
||||
|
||||
DrawableEditor& getEditor() throw() { return editor; }
|
||||
DrawableDocument& getDocument() throw() { return editor.getDocument(); }
|
||||
|
||||
void timerCallback()
|
||||
|
|
@ -190,6 +196,38 @@ public:
|
|||
getUndoManager().beginNewTransaction();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
class DrawableComponent : public Component
|
||||
{
|
||||
public:
|
||||
DrawableComponent (DrawableEditorCanvas* canvas_)
|
||||
: canvas (canvas_)
|
||||
{
|
||||
setOpaque (true);
|
||||
}
|
||||
|
||||
~DrawableComponent()
|
||||
{
|
||||
}
|
||||
|
||||
void updateDrawable()
|
||||
{
|
||||
repaint();
|
||||
}
|
||||
|
||||
void paint (Graphics& g)
|
||||
{
|
||||
g.fillAll (Colours::white);
|
||||
canvas->drawable->draw (g, 1.0f);
|
||||
}
|
||||
|
||||
private:
|
||||
DrawableEditorCanvas* canvas;
|
||||
DrawableEditor& getEditor() const { return canvas->getEditor(); }
|
||||
};
|
||||
|
||||
ScopedPointer<Drawable> drawable;
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
DrawableEditor& editor;
|
||||
|
|
|
|||
|
|
@ -735,7 +735,7 @@ EditorCanvasBase::~EditorCanvasBase()
|
|||
|
||||
void EditorCanvasBase::initialise()
|
||||
{
|
||||
addAndMakeVisible (componentHolder = new Component());
|
||||
addAndMakeVisible (componentHolder = createComponentHolder());
|
||||
addAndMakeVisible (overlay = new OverlayComponent (this));
|
||||
overlay->addAndMakeVisible (resizeFrame = new DocumentResizeFrame (this));
|
||||
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ public:
|
|||
virtual UndoManager& getUndoManager() = 0;
|
||||
virtual void deselectNonDraggableObjects() = 0;
|
||||
virtual void findLassoItemsInArea (Array <SelectedItems::ItemType>& itemsFound, const Rectangle<int>& area) = 0;
|
||||
virtual Component* createComponentHolder() = 0;
|
||||
|
||||
class DragOperation
|
||||
{
|
||||
|
|
|
|||
|
|
@ -336,7 +336,7 @@ static void getAllSelectedNodesInTree (Component* componentInTree, OwnedArray <P
|
|||
|
||||
bool ProjectTreeViewBase::isInterestedInDragSource (const String& sourceDescription, Component* sourceComponent)
|
||||
{
|
||||
if (sourceDescription != String (projectItemDragType))
|
||||
if (sourceDescription != projectItemDragType)
|
||||
return false;
|
||||
|
||||
OwnedArray <Project::Item> selectedNodes;
|
||||
|
|
|
|||
|
|
@ -45367,12 +45367,12 @@ void CodeEditorComponent::scrollBarMoved (ScrollBar* scrollBarThatHasMoved, doub
|
|||
scrollToColumnInternal (newRangeStart);
|
||||
}
|
||||
|
||||
void CodeEditorComponent::focusGained (FocusChangeType cause)
|
||||
void CodeEditorComponent::focusGained (FocusChangeType)
|
||||
{
|
||||
caret->updatePosition();
|
||||
}
|
||||
|
||||
void CodeEditorComponent::focusLost (FocusChangeType cause)
|
||||
void CodeEditorComponent::focusLost (FocusChangeType)
|
||||
{
|
||||
caret->updatePosition();
|
||||
}
|
||||
|
|
@ -237992,9 +237992,6 @@ void* MouseCursor::createMouseCursorFromImage (const Image& image, int hotspotX,
|
|||
hotspotY = (hotspotY * maxH) / image.getHeight();
|
||||
}
|
||||
|
||||
void* cursorH = 0;
|
||||
const SystemStats::OperatingSystemType os = SystemStats::getOperatingSystemType();
|
||||
|
||||
return createHICONFromImage (*im, FALSE, hotspotX, hotspotY);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5720,7 +5720,7 @@ public:
|
|||
#define juce_InterlockedExchangeAdd(a, b) _InterlockedExchangeAdd(a, b)
|
||||
#define juce_InterlockedCompareExchange(a, b, c) _InterlockedCompareExchange(a, b, c)
|
||||
#define juce_InterlockedCompareExchange64(a, b, c) _InterlockedCompareExchange64(a, b, c)
|
||||
#define juce_MemoryBarrier MemoryBarrier
|
||||
#define juce_MemoryBarrier _ReadWriteBarrier
|
||||
#else
|
||||
// (these are defined in juce_win32_Threads.cpp)
|
||||
long juce_InterlockedExchange (volatile long* a, long b) throw();
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ public:
|
|||
#define juce_InterlockedExchangeAdd(a, b) _InterlockedExchangeAdd(a, b)
|
||||
#define juce_InterlockedCompareExchange(a, b, c) _InterlockedCompareExchange(a, b, c)
|
||||
#define juce_InterlockedCompareExchange64(a, b, c) _InterlockedCompareExchange64(a, b, c)
|
||||
#define juce_MemoryBarrier MemoryBarrier
|
||||
#define juce_MemoryBarrier _ReadWriteBarrier
|
||||
#else
|
||||
// (these are defined in juce_win32_Threads.cpp)
|
||||
long juce_InterlockedExchange (volatile long* a, long b) throw();
|
||||
|
|
|
|||
|
|
@ -1100,12 +1100,12 @@ void CodeEditorComponent::scrollBarMoved (ScrollBar* scrollBarThatHasMoved, doub
|
|||
}
|
||||
|
||||
//==============================================================================
|
||||
void CodeEditorComponent::focusGained (FocusChangeType cause)
|
||||
void CodeEditorComponent::focusGained (FocusChangeType)
|
||||
{
|
||||
caret->updatePosition();
|
||||
}
|
||||
|
||||
void CodeEditorComponent::focusLost (FocusChangeType cause)
|
||||
void CodeEditorComponent::focusLost (FocusChangeType)
|
||||
{
|
||||
caret->updatePosition();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2465,9 +2465,6 @@ void* MouseCursor::createMouseCursorFromImage (const Image& image, int hotspotX,
|
|||
hotspotY = (hotspotY * maxH) / image.getHeight();
|
||||
}
|
||||
|
||||
void* cursorH = 0;
|
||||
const SystemStats::OperatingSystemType os = SystemStats::getOperatingSystemType();
|
||||
|
||||
return createHICONFromImage (*im, FALSE, hotspotX, hotspotY);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue