1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-02 03:20:06 +00:00

Updates to plugin host code.

This commit is contained in:
Julian Storer 2010-02-19 09:22:13 +00:00
parent 8820020213
commit 1d598e38b9
4 changed files with 16 additions and 21 deletions

View file

@ -221,8 +221,6 @@ public:
numInputs (0),
numOutputs (0),
pinSize (16),
originalX (0),
originalY (0),
font (13.0f, Font::bold),
numIns (0),
numOuts (0)
@ -240,9 +238,7 @@ public:
void mouseDown (const MouseEvent& e)
{
originalX = 0;
originalY = 0;
relativePositionToGlobal (originalX, originalY);
originalPos = relativePositionToGlobal (Point<int>());
toFront (true);
@ -285,15 +281,14 @@ public:
{
if (! e.mods.isPopupMenu())
{
int x = originalX + e.getDistanceFromDragStartX();
int y = originalY + e.getDistanceFromDragStartY();
Point<int> pos (originalPos + Point<int> (e.getDistanceFromDragStartX(), e.getDistanceFromDragStartY()));
if (getParentComponent() != 0)
getParentComponent()->globalPositionToRelative (x, y);
pos = getParentComponent()->globalPositionToRelative (pos);
graph.setNodePosition (filterID,
(x + getWidth() / 2) / (double) getParentWidth(),
(y + getHeight() / 2) / (double) getParentHeight());
(pos.getX() + getWidth() / 2) / (double) getParentWidth(),
(pos.getY() + getHeight() / 2) / (double) getParentHeight());
getGraphPanel()->updateComponents();
}
@ -450,7 +445,7 @@ public:
private:
int pinSize;
int originalX, originalY;
Point<int> originalPos;
int numIns, numOuts;
DropShadowEffect shadow;
Font font;

View file

@ -495,11 +495,13 @@ void MainHostWindow::filesDropped (const StringArray& files, int x, int y)
knownPluginList.scanAndAddDragAndDroppedFiles (files, typesFound);
GraphDocumentComponent* const graphEditor = getGraphEditor();
Point<int> pos (x, y);
if (graphEditor != 0)
relativePositionToOtherComponent (graphEditor, x, y);
pos = relativePositionToOtherComponent (graphEditor, pos);
for (int i = 0; i < jmin (5, typesFound.size()); ++i)
createPlugin (typesFound.getUnchecked(i), x, y);
createPlugin (typesFound.getUnchecked(i), pos.getX(), pos.getY());
}
}

View file

@ -656,7 +656,7 @@ class WavAudioFormatWriter : public AudioFormatWriter
if (smplChunk.getSize() > 0)
{
output->writeInt (chunkName ("smpl"));
output->writeInt (smplChunk.getSize());
output->writeInt ((int) smplChunk.getSize());
output->write (smplChunk.getData(), (int) smplChunk.getSize());
}

View file

@ -1218,19 +1218,18 @@ public:
if (topComp->getPeer() != 0)
{
int x = 0, y = 0;
relativePositionToOtherComponent (topComp, x, y);
const Point<int> pos (relativePositionToOtherComponent (topComp, Point<int>()));
recursiveResize = true;
#if JUCE_WIN32
if (pluginHWND != 0)
MoveWindow (pluginHWND, x, y, getWidth(), getHeight(), TRUE);
MoveWindow (pluginHWND, pos.getX(), pos.getY(), getWidth(), getHeight(), TRUE);
#elif JUCE_LINUX
if (pluginWindow != 0)
{
XResizeWindow (display, pluginWindow, getWidth(), getHeight());
XMoveWindow (display, pluginWindow, x, y);
XMoveWindow (display, pluginWindow, pos.getX(), pos.getY());
XMapRaised (display, pluginWindow);
}
#endif
@ -1289,9 +1288,8 @@ public:
if (peer != 0)
{
peer->addMaskedRegion (getScreenX() - peer->getScreenX(),
getScreenY() - peer->getScreenY(),
getWidth(), getHeight());
const Point<int> pos (getScreenPosition() - peer->getScreenPosition());
peer->addMaskedRegion (pos.getX(), pos.getY(), getWidth(), getHeight());
#if JUCE_LINUX
if (pluginWindow != 0)