1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00
This commit is contained in:
jules 2008-03-13 20:01:47 +00:00
parent 8b1a9b3c38
commit b1acc26909
5 changed files with 36 additions and 14 deletions

View file

@ -681,8 +681,8 @@ void JucerDocumentHolder::addComponent (const int index)
document->getUndoManager().beginNewTransaction (T("Add new ") + ObjectTypes::componentTypeHandlers [index]->getTypeName());
const int randomness = jmin (80, area.getWidth() / 2, area.getHeight() / 2);
int x = area.getX() + area.getWidth() / 2 + Random::getSystemRandom().nextInt (randomness) - randomness / 2;
int y = area.getY() + area.getHeight() / 2 + Random::getSystemRandom().nextInt (randomness) - randomness / 2;
int x = area.getWidth() / 2 + Random::getSystemRandom().nextInt (randomness) - randomness / 2;
int y = area.getHeight() / 2 + Random::getSystemRandom().nextInt (randomness) - randomness / 2;
x = document->snapPosition (x);
y = document->snapPosition (y);

View file

@ -443,6 +443,12 @@ void AudioDeviceManager::audioDeviceIOCallbackInt (const float** inputChannelDat
const double filterAmount = 0.2;
cpuUsageMs += filterAmount * (msTaken - cpuUsageMs);
}
else
{
for (int i = 0; i < totalNumOutputChannels; ++i)
if (outputChannelData [i] != 0)
zeromem (outputChannelData[i], sizeof (float) * numSamples);
}
}
void AudioDeviceManager::audioDeviceAboutToStartInt (AudioIODevice* const device)

View file

@ -682,25 +682,39 @@ void TableHeaderComponent::mouseDrag (const MouseEvent& e)
if (newIndex > 0)
{
const int leftOfPrevious = getColumnPosition (newIndex - 1).getX();
const int rightOfCurrent = getColumnPosition (newIndex).getRight();
// if the previous column isn't draggable, we can't move our column
// past it, because that'd change the undraggable column's position..
const ColumnInfo* const previous = columns.getUnchecked (newIndex - 1);
if (abs (dragOverlayComp->getX() - leftOfPrevious)
< abs (dragOverlayComp->getRight() - rightOfCurrent))
if ((previous->propertyFlags & draggable) != 0)
{
--newIndex;
const int leftOfPrevious = getColumnPosition (newIndex - 1).getX();
const int rightOfCurrent = getColumnPosition (newIndex).getRight();
if (abs (dragOverlayComp->getX() - leftOfPrevious)
< abs (dragOverlayComp->getRight() - rightOfCurrent))
{
--newIndex;
}
}
}
if (newIndex < columns.size() - 1)
{
const int leftOfCurrent = getColumnPosition (newIndex).getX();
const int rightOfNext = getColumnPosition (newIndex + 1).getRight();
// if the next column isn't draggable, we can't move our column
// past it, because that'd change the undraggable column's position..
const ColumnInfo* const nextCol = columns.getUnchecked (newIndex + 1);
if (abs (dragOverlayComp->getX() - leftOfCurrent)
> abs (dragOverlayComp->getRight() - rightOfNext))
if ((nextCol->propertyFlags & draggable) != 0)
{
++newIndex;
const int leftOfCurrent = getColumnPosition (newIndex).getX();
const int rightOfNext = getColumnPosition (newIndex + 1).getRight();
if (abs (dragOverlayComp->getX() - leftOfCurrent)
> abs (dragOverlayComp->getRight() - rightOfNext))
{
++newIndex;
}
}
}

View file

@ -255,7 +255,8 @@ public:
enum ColourIds
{
backgroundColourId = 0x1000300, /**< The background colour of the scrollbar. */
thumbColourId = 0x1000400 /**< A base colour to use for the thumb. The look and feel will probably use variations on this colour. */
thumbColourId = 0x1000400, /**< A base colour to use for the thumb. The look and feel will probably use variations on this colour. */
trackColourId = 0x1000401 /**< A base colour to use for the slot area of the bar. The look and feel will probably use variations on this colour. */
};
//==============================================================================

View file

@ -130,6 +130,7 @@ LookAndFeel::LookAndFeel()
ScrollBar::backgroundColourId, 0x00000000,
ScrollBar::thumbColourId, 0xffffffff,
ScrollBar::trackColourId, 0xffffffff,
TreeView::linesColourId, 0x4c000000,
TreeView::backgroundColourId, 0x00000000,
@ -622,7 +623,7 @@ void LookAndFeel::drawScrollbar (Graphics& g,
gy2 = y + height * 0.7f;
}
const Colour thumbColour (scrollbar.findColour (ScrollBar::thumbColourId));
const Colour thumbColour (scrollbar.findColour (ScrollBar::trackColourId));
GradientBrush gb (thumbColour.overlaidWith (Colour (0x44000000)),
gx1, gy1,