mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-16 00:34:19 +00:00
Jucer development.
This commit is contained in:
parent
59c217f0a4
commit
6fd0c918d9
12 changed files with 242 additions and 123 deletions
|
|
@ -48,18 +48,57 @@ public:
|
|||
Component* createComponent() { return new ComboBox (String::empty); }
|
||||
const Rectangle<int> getDefaultSize() { return Rectangle<int> (0, 0, 180, 24); }
|
||||
|
||||
void update (ComponentDocument& document, ComboBox* comp, const ValueTree& state)
|
||||
{
|
||||
}
|
||||
|
||||
void initialiseNew (ComponentDocument& document, ValueTree& state)
|
||||
{
|
||||
state.setProperty ("items", "Item 1\nItem 2", 0);
|
||||
state.setProperty ("editable", false, 0);
|
||||
state.setProperty ("textJustification", (int) Justification::centredLeft, 0);
|
||||
state.setProperty ("unselectedText", "", 0);
|
||||
state.setProperty ("noItemsText", "(No Choices)", 0);
|
||||
}
|
||||
|
||||
void updateItems (ComboBox* comp, const String& itemString)
|
||||
{
|
||||
StringArray items;
|
||||
items.addLines (itemString);
|
||||
items.removeEmptyStrings (true);
|
||||
|
||||
StringArray existingItems;
|
||||
|
||||
for (int i = 0; i < comp->getNumItems(); ++i)
|
||||
existingItems.add (comp->getItemText (i));
|
||||
|
||||
if (existingItems != items)
|
||||
{
|
||||
comp->clear();
|
||||
|
||||
for (int i = 0; i < items.size(); ++i)
|
||||
comp->addItem (items[i], i + 1);
|
||||
}
|
||||
}
|
||||
|
||||
void update (ComponentDocument& document, ComboBox* comp, const ValueTree& state)
|
||||
{
|
||||
updateItems (comp, state ["items"]);
|
||||
comp->setEditableText (state ["editable"]);
|
||||
comp->setJustificationType ((int) state ["textJustification"]);
|
||||
comp->setTextWhenNothingSelected (state ["unselectedText"].toString());
|
||||
comp->setTextWhenNoChoicesAvailable (state ["noItemsText"].toString());
|
||||
}
|
||||
|
||||
void createProperties (ComponentDocument& document, ValueTree& state, Array <PropertyComponent*>& props)
|
||||
{
|
||||
addTooltipProperty (document, state, props);
|
||||
addFocusOrderProperty (document, state, props);
|
||||
|
||||
props.add (new TextPropertyComponent (getValue ("items", state, document), "Items", 16384, true));
|
||||
props.getLast()->setTooltip ("A list of items to use to initialise the ComboBox");
|
||||
|
||||
props.add (new BooleanPropertyComponent (getValue ("editable", state, document), "Editable", "Text is editable"));
|
||||
props.add (createJustificationProperty ("Text Position", getValue ("textJustification", state, document), false));
|
||||
props.add (new TextPropertyComponent (getValue ("unselectedText", state, document), "Text when none selected", 512, false));
|
||||
props.add (new TextPropertyComponent (getValue ("noItemsText", state, document), "Text when no items", 512, false));
|
||||
|
||||
addEditableColourProperties (document, state, props);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -136,8 +136,8 @@ protected:
|
|||
|
||||
void addFocusOrderProperty (ComponentDocument& document, ValueTree& state, Array <PropertyComponent*>& props)
|
||||
{
|
||||
props.add (new TextPropertyComponent (Value (new IntegerValueSource (getValue (ComponentDocument::compFocusOrderProperty,
|
||||
state, document))),
|
||||
props.add (new TextPropertyComponent (Value (new NumericValueSource<int> (getValue (ComponentDocument::compFocusOrderProperty,
|
||||
state, document))),
|
||||
"Focus Order", 10, false));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,16 +58,7 @@ public:
|
|||
|
||||
void paint (Graphics& g)
|
||||
{
|
||||
g.fillAll (Colours::white.withAlpha (0.2f));
|
||||
g.setColour (Colours::grey);
|
||||
g.drawRect (getLocalBounds());
|
||||
|
||||
g.drawLine (0.5f, 0.5f, getWidth() - 0.5f, getHeight() - 0.5f);
|
||||
g.drawLine (0.5f, getHeight() - 0.5f, getWidth() - 0.5f, 0.5f);
|
||||
|
||||
g.setColour (Colours::black);
|
||||
g.setFont (11.0f);
|
||||
g.drawFittedText (getName(), 2, 2, getWidth() - 4, getHeight() - 4, Justification::centredTop, 2);
|
||||
drawComponentPlaceholder (g, getWidth(), getHeight(), getName());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -48,11 +48,13 @@ public:
|
|||
void update (ComponentDocument& document, GroupComponent* comp, const ValueTree& state)
|
||||
{
|
||||
comp->setText (state ["text"].toString());
|
||||
comp->setTextLabelPosition ((int) state ["justification"]);
|
||||
}
|
||||
|
||||
void initialiseNew (ComponentDocument& document, ValueTree& state)
|
||||
{
|
||||
state.setProperty ("text", "Group", 0);
|
||||
state.setProperty ("justification", (int) Justification::left, 0);
|
||||
}
|
||||
|
||||
void createProperties (ComponentDocument& document, ValueTree& state, Array <PropertyComponent*>& props)
|
||||
|
|
@ -63,6 +65,7 @@ public:
|
|||
props.add (new TextPropertyComponent (getValue ("text", state, document), "Label", 512, false));
|
||||
props.getLast()->setTooltip ("The group's display name.");
|
||||
|
||||
props.add (createJustificationProperty ("Text Position", state.getPropertyAsValue ("justification", document.getUndoManager()), true));
|
||||
addEditableColourProperties (document, state, props);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -50,9 +50,9 @@ ComponentDocument::ComponentDocument (Project* project_, const File& cppFile_)
|
|||
: project (project_),
|
||||
cppFile (cppFile_),
|
||||
root (componentDocumentTag),
|
||||
changedSinceSaved (false)
|
||||
changedSinceSaved (false),
|
||||
usingTemporaryCanvasSize (false)
|
||||
{
|
||||
reload();
|
||||
checkRootObject();
|
||||
|
||||
root.addListener (this);
|
||||
|
|
@ -61,7 +61,7 @@ ComponentDocument::ComponentDocument (Project* project_, const File& cppFile_)
|
|||
ComponentDocument::ComponentDocument (const ComponentDocument& other)
|
||||
: project (other.project),
|
||||
cppFile (other.cppFile),
|
||||
root (other.root.createCopy()),
|
||||
root (other.root),
|
||||
changedSinceSaved (false)
|
||||
{
|
||||
checkRootObject();
|
||||
|
|
@ -248,10 +248,13 @@ bool ComponentDocument::reload()
|
|||
markersX = 0;
|
||||
markersY = 0;
|
||||
checkRootObject();
|
||||
customCode.reloadFrom (cppFile.loadFileAsString());
|
||||
|
||||
root.addChild (ValueTree ("dummy"), 0, 0);
|
||||
root.removeChild (root.getChildWithName("dummy"), 0);
|
||||
|
||||
undoManager.clearUndoHistory();
|
||||
changedSinceSaved = false;
|
||||
|
||||
customCode.reloadFrom (cppFile.loadFileAsString());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -297,6 +300,23 @@ void ComponentDocument::checkRootObject()
|
|||
getCanvasHeight() = 480;
|
||||
}
|
||||
|
||||
void ComponentDocument::setUsingTemporaryCanvasSize (bool b)
|
||||
{
|
||||
tempCanvasWidth = root.getProperty ("width");
|
||||
tempCanvasHeight = root.getProperty ("height");
|
||||
usingTemporaryCanvasSize = b;
|
||||
}
|
||||
|
||||
Value ComponentDocument::getCanvasWidth() const
|
||||
{
|
||||
return usingTemporaryCanvasSize ? tempCanvasWidth : getRootValueNonUndoable ("width");
|
||||
}
|
||||
|
||||
Value ComponentDocument::getCanvasHeight() const
|
||||
{
|
||||
return usingTemporaryCanvasSize ? tempCanvasHeight : getRootValueNonUndoable ("height");
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
const int menuItemOffset = 0x63451fa4;
|
||||
|
||||
|
|
@ -332,6 +352,102 @@ const ValueTree ComponentDocument::performNewComponentMenuItem (int menuResultCo
|
|||
return ValueTree::invalid;
|
||||
}
|
||||
|
||||
Component* ComponentDocument::findComponentForState (Component* compHolder, const ValueTree& state)
|
||||
{
|
||||
for (int i = compHolder->getNumChildComponents(); --i >= 0;)
|
||||
{
|
||||
Component* const c = compHolder->getChildComponent (i);
|
||||
if (isStateForComponent (state, c))
|
||||
return c;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ComponentDocument::updateComponentsIn (Component* compHolder)
|
||||
{
|
||||
int i;
|
||||
for (i = compHolder->getNumChildComponents(); --i >= 0;)
|
||||
{
|
||||
Component* c = compHolder->getChildComponent (i);
|
||||
|
||||
if (! containsComponent (c))
|
||||
delete c;
|
||||
}
|
||||
|
||||
Array <Component*> componentsInOrder;
|
||||
|
||||
const int num = getNumComponents();
|
||||
for (i = 0; i < num; ++i)
|
||||
{
|
||||
const ValueTree v (getComponent (i));
|
||||
Component* c = findComponentForState (compHolder, v);
|
||||
|
||||
if (c == 0)
|
||||
{
|
||||
c = createComponent (i);
|
||||
compHolder->addAndMakeVisible (c);
|
||||
}
|
||||
|
||||
updateComponent (c);
|
||||
componentsInOrder.add (c);
|
||||
}
|
||||
|
||||
// Make sure the z-order is correct..
|
||||
if (num > 0)
|
||||
{
|
||||
componentsInOrder.getLast()->toFront (false);
|
||||
|
||||
for (i = num - 1; --i >= 0;)
|
||||
componentsInOrder.getUnchecked(i)->toBehind (componentsInOrder.getUnchecked (i + 1));
|
||||
}
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
ComponentDocument::TestComponent::TestComponent (ComponentDocument& document_)
|
||||
: document (new ComponentDocument (document_))
|
||||
{
|
||||
setupDocument();
|
||||
}
|
||||
|
||||
ComponentDocument::TestComponent::TestComponent (Project* project, const File& cppFile)
|
||||
: document (new ComponentDocument (project, cppFile))
|
||||
{
|
||||
if (document->reload())
|
||||
setupDocument();
|
||||
else
|
||||
document = 0;
|
||||
}
|
||||
|
||||
ComponentDocument::TestComponent::~TestComponent()
|
||||
{
|
||||
deleteAllChildren();
|
||||
}
|
||||
|
||||
void ComponentDocument::TestComponent::setupDocument()
|
||||
{
|
||||
document->setUsingTemporaryCanvasSize (true);
|
||||
|
||||
setSize (document->getCanvasWidth().getValue(),
|
||||
document->getCanvasHeight().getValue());
|
||||
}
|
||||
|
||||
void ComponentDocument::TestComponent::resized()
|
||||
{
|
||||
if (document != 0)
|
||||
{
|
||||
document->getCanvasWidth() = getWidth();
|
||||
document->getCanvasHeight() = getHeight();
|
||||
document->updateComponentsIn (this);
|
||||
}
|
||||
}
|
||||
|
||||
void ComponentDocument::TestComponent::paint (Graphics& g)
|
||||
{
|
||||
if (document == 0)
|
||||
drawComponentPlaceholder (g, getWidth(), getHeight(), "(Not a valid Jucer component)");
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
ValueTree ComponentDocument::getComponentGroup() const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ public:
|
|||
bool hasChangedSinceLastSave();
|
||||
void changed();
|
||||
|
||||
Project* getProject() const { return project; }
|
||||
const File getCppFile() const { return cppFile; }
|
||||
void cppFileHasMoved (const File& newFile) { cppFile = newFile; }
|
||||
|
||||
|
|
@ -59,8 +60,9 @@ public:
|
|||
Value getClassName() const { return getRootValueNonUndoable ("className"); }
|
||||
Value getClassDescription() const { return getRootValueNonUndoable ("classDesc"); }
|
||||
|
||||
Value getCanvasWidth() const { return getRootValueNonUndoable ("width"); }
|
||||
Value getCanvasHeight() const { return getRootValueNonUndoable ("height"); }
|
||||
void setUsingTemporaryCanvasSize (bool b);
|
||||
Value getCanvasWidth() const;
|
||||
Value getCanvasHeight() const;
|
||||
|
||||
void createClassProperties (Array <PropertyComponent*>& props);
|
||||
|
||||
|
|
@ -91,6 +93,8 @@ public:
|
|||
void addNewComponentMenuItems (PopupMenu& menu) const;
|
||||
const ValueTree performNewComponentMenuItem (int menuResultCode);
|
||||
|
||||
void updateComponentsIn (Component* compHolder);
|
||||
|
||||
//==============================================================================
|
||||
class MarkerList : public MarkerListBase
|
||||
{
|
||||
|
|
@ -157,14 +161,34 @@ public:
|
|||
static const char* const jucerIDProperty;
|
||||
static const String getJucerIDFor (Component* c);
|
||||
|
||||
//==============================================================================
|
||||
class TestComponent : public Component
|
||||
{
|
||||
public:
|
||||
TestComponent (ComponentDocument& document_);
|
||||
TestComponent (Project* project, const File& cppFile);
|
||||
~TestComponent();
|
||||
|
||||
void resized();
|
||||
void paint (Graphics& g);
|
||||
|
||||
private:
|
||||
ScopedPointer<ComponentDocument> document;
|
||||
void setupDocument();
|
||||
};
|
||||
|
||||
juce_UseDebuggingNewOperator
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
Project* project;
|
||||
File cppFile;
|
||||
ValueTree root;
|
||||
ScopedPointer<MarkerList> markersX, markersY;
|
||||
CodeGenerator::CustomCodeList customCode;
|
||||
mutable UndoManager undoManager;
|
||||
bool changedSinceSaved;
|
||||
bool changedSinceSaved, usingTemporaryCanvasSize;
|
||||
Value tempCanvasWidth, tempCanvasHeight;
|
||||
|
||||
void checkRootObject();
|
||||
void createSubTreeIfNotThere (const String& name);
|
||||
|
|
@ -178,6 +202,8 @@ private:
|
|||
void writeMetadata (OutputStream& out);
|
||||
|
||||
bool createItemProperties (Array <PropertyComponent*>& props, const String& itemId);
|
||||
|
||||
Component* findComponentForState (Component* compHolder, const ValueTree& state);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -271,38 +271,10 @@ void ComponentEditor::showNewComponentMenu (Component* componentToAttachTo)
|
|||
}
|
||||
|
||||
//==============================================================================
|
||||
class TestComponent : public Component
|
||||
{
|
||||
public:
|
||||
TestComponent (ComponentDocument& document_)
|
||||
: document (document_)
|
||||
{
|
||||
setSize (document.getCanvasWidth().getValue(),
|
||||
document.getCanvasHeight().getValue());
|
||||
}
|
||||
|
||||
~TestComponent()
|
||||
{
|
||||
deleteAllChildren();
|
||||
}
|
||||
|
||||
void resized()
|
||||
{
|
||||
document.getCanvasWidth() = getWidth();
|
||||
document.getCanvasHeight() = getHeight();
|
||||
|
||||
ComponentEditorCanvas::updateComponentsIn (this, document, selected);
|
||||
}
|
||||
|
||||
private:
|
||||
ComponentDocument document;
|
||||
ComponentEditorCanvas::SelectedItems selected;
|
||||
TooltipWindow tooltipWindow;
|
||||
};
|
||||
|
||||
void ComponentEditor::test()
|
||||
{
|
||||
TestComponent testComp (getDocument());
|
||||
ComponentDocument::TestComponent testComp (getDocument());
|
||||
TooltipWindow tooltipWindow;
|
||||
|
||||
DialogWindow::showModalDialog ("Testing: " + getDocument().getClassName().toString(),
|
||||
&testComp, this, Colours::lightgrey, true, true);
|
||||
|
|
|
|||
|
|
@ -62,63 +62,9 @@ public:
|
|||
return new Component();
|
||||
}
|
||||
|
||||
static Component* findComponentForState (Component* compHolder, ComponentDocument& doc, const ValueTree& state)
|
||||
{
|
||||
for (int i = compHolder->getNumChildComponents(); --i >= 0;)
|
||||
{
|
||||
Component* const c = compHolder->getChildComponent (i);
|
||||
if (doc.isStateForComponent (state, c))
|
||||
return c;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void updateComponentsIn (Component* compHolder, ComponentDocument& doc, SelectedItems& selection)
|
||||
{
|
||||
int i;
|
||||
for (i = compHolder->getNumChildComponents(); --i >= 0;)
|
||||
{
|
||||
Component* c = compHolder->getChildComponent (i);
|
||||
|
||||
if (! doc.containsComponent (c))
|
||||
{
|
||||
selection.deselect (ComponentDocument::getJucerIDFor (c));
|
||||
delete c;
|
||||
}
|
||||
}
|
||||
|
||||
Array <Component*> componentsInOrder;
|
||||
|
||||
const int num = doc.getNumComponents();
|
||||
for (i = 0; i < num; ++i)
|
||||
{
|
||||
const ValueTree v (doc.getComponent (i));
|
||||
Component* c = findComponentForState (compHolder, doc, v);
|
||||
|
||||
if (c == 0)
|
||||
{
|
||||
c = doc.createComponent (i);
|
||||
compHolder->addAndMakeVisible (c);
|
||||
}
|
||||
|
||||
doc.updateComponent (c);
|
||||
componentsInOrder.add (c);
|
||||
}
|
||||
|
||||
// Make sure the z-order is correct..
|
||||
if (num > 0)
|
||||
{
|
||||
componentsInOrder.getLast()->toFront (false);
|
||||
|
||||
for (i = num - 1; --i >= 0;)
|
||||
componentsInOrder.getUnchecked(i)->toBehind (componentsInOrder.getUnchecked (i + 1));
|
||||
}
|
||||
}
|
||||
|
||||
void updateComponents()
|
||||
{
|
||||
updateComponentsIn (getComponentHolder(), getDocument(), editor.getSelection());
|
||||
getDocument().updateComponentsIn (getComponentHolder());
|
||||
startTimer (500);
|
||||
}
|
||||
|
||||
|
|
@ -239,6 +185,12 @@ public:
|
|||
|
||||
return doc.setCoordsFor (state, pr);
|
||||
}
|
||||
|
||||
float getMarkerPosition (const ValueTree& marker, bool isX)
|
||||
{
|
||||
ComponentDocument& doc = getDocument();
|
||||
return doc.getMarkerList (isX).getCoordinate (marker).resolve (doc);
|
||||
}
|
||||
};
|
||||
|
||||
DragOperation* createDragOperation (const MouseEvent& e, Component* snapGuideParentComponent,
|
||||
|
|
|
|||
|
|
@ -158,6 +158,11 @@ public:
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
float getMarkerPosition (const ValueTree& marker, bool isX)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
DragOperation* createDragOperation (const MouseEvent& e, Component* snapGuideParentComponent,
|
||||
|
|
|
|||
|
|
@ -53,9 +53,13 @@ public:
|
|||
g.drawRect (0, 0, getWidth(), getHeight(), borderThickness);
|
||||
}
|
||||
|
||||
void valueTreePropertyChanged (ValueTree&, const var::identifier&) { updatePosition(); }
|
||||
void valueTreeChildrenChanged (ValueTree& treeWhoseChildHasChanged) { updatePosition(); }
|
||||
void valueTreeParentChanged (ValueTree& treeWhoseParentHasChanged) {}
|
||||
void valueTreePropertyChanged (ValueTree&, const var::identifier&) { updatePosition(); }
|
||||
void valueTreeChildrenChanged (ValueTree&) { updatePosition(); }
|
||||
void valueTreeParentChanged (ValueTree&)
|
||||
{
|
||||
if (! objectState.getParent().isValid())
|
||||
canvas->getSelection().deselect (objectState ["id"]);
|
||||
}
|
||||
|
||||
void mouseEnter (const MouseEvent& e) { updateDragZone (e.getPosition()); }
|
||||
void mouseExit (const MouseEvent& e) { updateDragZone (e.getPosition()); }
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public:
|
|||
verticalSnapPositions.add (SnapLine (floatPos.getX(), floatPos.getY(), floatPos.getBottom()));
|
||||
|
||||
if (zone.isDraggingWholeObject() || (zone.isDraggingLeftEdge() && zone.isDraggingRightEdge()))
|
||||
verticalSnapPositions.add (SnapLine (floatPos.getCentreX(), floatPos.getY(), floatPos.getBottom()));
|
||||
verticalSnapPositions.add (SnapLine ((int) floatPos.getCentreX(), floatPos.getY(), floatPos.getBottom()));
|
||||
|
||||
if (zone.isDraggingWholeObject() || zone.isDraggingRightEdge())
|
||||
verticalSnapPositions.add (SnapLine (floatPos.getRight(), floatPos.getY(), floatPos.getBottom()));
|
||||
|
|
@ -71,7 +71,7 @@ public:
|
|||
horizontalSnapPositions.add (SnapLine (floatPos.getY(), floatPos.getX(), floatPos.getRight()));
|
||||
|
||||
if (zone.isDraggingWholeObject() || (zone.isDraggingTopEdge() && zone.isDraggingBottomEdge()))
|
||||
horizontalSnapPositions.add (SnapLine (floatPos.getCentreY(), floatPos.getX(), floatPos.getRight()));
|
||||
horizontalSnapPositions.add (SnapLine ((int) floatPos.getCentreY(), floatPos.getX(), floatPos.getRight()));
|
||||
|
||||
if (zone.isDraggingWholeObject() || zone.isDraggingBottomEdge())
|
||||
horizontalSnapPositions.add (SnapLine (floatPos.getBottom(), floatPos.getX(), floatPos.getRight()));
|
||||
|
|
@ -79,20 +79,30 @@ public:
|
|||
|
||||
if (isDraggingLeftRight())
|
||||
{
|
||||
verticalSnapTargets.add (SnapLine (0, -100.0f, 10000.0f));
|
||||
verticalSnapTargets.add (SnapLine ((float) getCanvasWidth(), -100.0f, 10000.0f));
|
||||
const float y1 = -100.0f, y2 = 10000.0f;
|
||||
verticalSnapTargets.add (SnapLine (0, y1, y2));
|
||||
verticalSnapTargets.add (SnapLine ((float) getCanvasWidth(), y1, y2));
|
||||
|
||||
if (zone.isDraggingWholeObject() || (zone.isDraggingLeftEdge() && zone.isDraggingRightEdge()))
|
||||
verticalSnapTargets.add (SnapLine ((float) getCanvasWidth() / 2.0f, 0, 10000.0f));
|
||||
verticalSnapTargets.add (SnapLine ((float) getCanvasWidth() / 2.0f, y1, y2));
|
||||
|
||||
MarkerListBase& markers = canvas->getMarkerList (true);
|
||||
for (int i = markers.size(); --i >= 0;)
|
||||
verticalSnapTargets.add (SnapLine (getMarkerPosition (markers.getMarker(i), true), y1, y2));
|
||||
}
|
||||
|
||||
if (isDraggingUpDown())
|
||||
{
|
||||
horizontalSnapTargets.add (SnapLine (0, -100.0f, 10000.0f));
|
||||
horizontalSnapTargets.add (SnapLine ((float) getCanvasHeight(), -100.0f, 10000.0f));
|
||||
const float x1 = -100.0f, x2 = 10000.0f;
|
||||
horizontalSnapTargets.add (SnapLine (0, x1, x2));
|
||||
horizontalSnapTargets.add (SnapLine ((float) getCanvasHeight(), x1, x2));
|
||||
|
||||
if (zone.isDraggingWholeObject() || (zone.isDraggingTopEdge() && zone.isDraggingBottomEdge()))
|
||||
horizontalSnapTargets.add (SnapLine ((float) getCanvasHeight() / 2.0f, 0, 10000.0f));
|
||||
horizontalSnapTargets.add (SnapLine ((float) getCanvasHeight() / 2.0f, x1, x2));
|
||||
|
||||
MarkerListBase& markers = canvas->getMarkerList (false);
|
||||
for (int i = markers.size(); --i >= 0;)
|
||||
horizontalSnapTargets.add (SnapLine (getMarkerPosition (markers.getMarker(i), false), x1, x2));
|
||||
}
|
||||
|
||||
for (i = 0; i < objectsToSnapTo.size(); ++i)
|
||||
|
|
@ -106,7 +116,7 @@ public:
|
|||
}
|
||||
|
||||
if (zone.isDraggingWholeObject() || (zone.isDraggingLeftEdge() && zone.isDraggingRightEdge()))
|
||||
verticalSnapTargets.add (SnapLine (floatPos.getCentreX(), floatPos.getY(), floatPos.getBottom()));
|
||||
verticalSnapTargets.add (SnapLine ((int) floatPos.getCentreX(), floatPos.getY(), floatPos.getBottom()));
|
||||
|
||||
if (isDraggingUpDown())
|
||||
{
|
||||
|
|
@ -115,7 +125,7 @@ public:
|
|||
}
|
||||
|
||||
if (zone.isDraggingWholeObject() || (zone.isDraggingTopEdge() && zone.isDraggingBottomEdge()))
|
||||
horizontalSnapTargets.add (SnapLine (floatPos.getCentreY(), floatPos.getX(), floatPos.getRight()));
|
||||
horizontalSnapTargets.add (SnapLine ((int) floatPos.getCentreY(), floatPos.getX(), floatPos.getRight()));
|
||||
}
|
||||
|
||||
mergeSnapLines (verticalSnapTargets);
|
||||
|
|
@ -221,6 +231,7 @@ protected:
|
|||
//==============================================================================
|
||||
virtual int getCanvasWidth() = 0;
|
||||
virtual int getCanvasHeight() = 0;
|
||||
virtual float getMarkerPosition (const ValueTree& marker, bool isX) = 0;
|
||||
|
||||
virtual const Rectangle<float> getObjectPosition (const ValueTree& state) = 0;
|
||||
virtual bool setObjectPosition (ValueTree& state, const Rectangle<float>& newBounds) = 0;
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ public:
|
|||
resized();
|
||||
}
|
||||
|
||||
bool arePropertiesVisible() const { return infoPanel->isVisible(); }
|
||||
bool arePropertiesVisible() const { return infoPanel->isVisible(); }
|
||||
|
||||
void showOrHideTree()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue