1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Minor clean-ups. Jucer development.

This commit is contained in:
Julian Storer 2010-04-14 20:08:21 +01:00
parent 61252d75c6
commit d4435ca8b8
85 changed files with 900 additions and 569 deletions

View file

@ -27,7 +27,6 @@
#include "Component Types/jucer_TextButton.h"
#include "Component Types/jucer_ToggleButton.h"
//==============================================================================
static const char* const componentDocumentTag = "COMPONENT";
static const char* const componentGroupTag = "COMPONENTS";
@ -40,6 +39,112 @@ static const char* const compNameProperty = "name";
static const char* const metadataTagStart = "JUCER_" "COMPONENT_METADATA_START"; // written like this to avoid thinking this file is a component!
static const char* const metadataTagEnd = "JUCER_" "COMPONENT_METADATA_END";
//==============================================================================
class ComponentBoundsEditor : public PropertyComponent
{
public:
enum Type
{
left, top, right, bottom
};
//==============================================================================
ComponentBoundsEditor (const String& name, Type type_, const Value& state_)
: PropertyComponent (name, 40), type (type_), state (state_)
{
addAndMakeVisible (label = new Label (String::empty, String::empty));
label->setEditable (true, true, false);
label->setColour (Label::backgroundColourId, Colours::white);
label->setColour (Label::outlineColourId, findColour (ComboBox::outlineColourId));
label->getTextValue().referTo (Value (new BoundsCoordValueSource (state, type)));
}
~ComponentBoundsEditor()
{
}
void resized()
{
const Rectangle<int> content (getLookAndFeel().getPropertyComponentContentPosition (*this));
label->setBounds (content.getX(), content.getY(), content.getWidth(), content.getHeight() / 2);
}
void refresh()
{
}
//==============================================================================
class BoundsCoordValueSource : public Value::ValueSource,
public Value::Listener
{
public:
BoundsCoordValueSource (const Value& sourceValue_, Type type_)
: sourceValue (sourceValue_), type (type_)
{
sourceValue.addListener (this);
}
~BoundsCoordValueSource() {}
const var getValue() const
{
RectangleCoordinates r (sourceValue.toString());
Coordinate& coord = getCoord (r);
return coord.getEditableValue();
}
void setValue (const var& newValue)
{
RectangleCoordinates r (sourceValue.toString());
Coordinate& coord = getCoord (r);
coord.setEditableValue ((double) newValue);
const String newVal (r.toString());
if (sourceValue != newVal)
sourceValue = newVal;
}
void valueChanged (Value&)
{
sendChangeMessage (true);
}
//==============================================================================
juce_UseDebuggingNewOperator
protected:
Value sourceValue;
Type type;
Coordinate& getCoord (RectangleCoordinates& r) const
{
switch (type)
{
case left: return r.left;
case right: return r.right;
case top: return r.top;
case bottom: return r.bottom;
default: jassertfalse; break;
}
return r.left;
}
BoundsCoordValueSource (const BoundsCoordValueSource&);
const BoundsCoordValueSource& operator= (const BoundsCoordValueSource&);
};
private:
Type type;
Value state;
Label* label;
};
//==============================================================================
ComponentTypeHandler::ComponentTypeHandler (const String& name_, const String& xmlTag_,
const String& memberNameRoot_)
@ -82,8 +187,10 @@ void ComponentTypeHandler::initialiseNewItem (ComponentDocument& document, Value
void ComponentTypeHandler::createPropertyEditors (ComponentDocument& document, ValueTree& state, Array <PropertyComponent*>& props)
{
props.add (new TextPropertyComponent (getValue (compBoundsProperty, state, document), "Bounds", 512, false));
props.getLast()->setTooltip ("The component's position.");
props.add (new ComponentBoundsEditor ("Left", ComponentBoundsEditor::left, getValue (compBoundsProperty, state, document)));
props.add (new ComponentBoundsEditor ("Right", ComponentBoundsEditor::right, getValue (compBoundsProperty, state, document)));
props.add (new ComponentBoundsEditor ("Top", ComponentBoundsEditor::top, getValue (compBoundsProperty, state, document)));
props.add (new ComponentBoundsEditor ("Bottom", ComponentBoundsEditor::bottom, getValue (compBoundsProperty, state, document)));
}
//==============================================================================

View file

@ -38,14 +38,14 @@ public:
};
SizeGuideComponent (ComponentDocument& document_, const ValueTree& state_, Component* component_,
Component* parentForOverlays, Type type_)
Component& parentForOverlays, Type type_)
: document (document_), state (state_), component (component_), type (type_),
font (10.0f)
{
component->addComponentListener (this);
setAlwaysOnTop (true);
parentForOverlays->addAndMakeVisible (this);
parentForOverlays.addAndMakeVisible (this);
updatePosition();
}
@ -72,55 +72,64 @@ public:
setName (coord.toString());
ScopedPointer<Coordinate::MarkerResolver> markers (document.createMarkerResolver (state, component->getParentComponent()));
int anchor1 = roundToInt (coord.getAnchorPoint1().resolve (*markers));
int anchor2 = roundToInt (coord.getAnchorPoint2().resolve (*markers));
//ScopedPointer<Coordinate::MarkerResolver> markers (document.createMarkerResolver (state, component->getParentComponent()));
//int anchor1 = roundToInt (coord.getAnchorPoint1().resolve (*markers));
//int anchor2 = roundToInt (coord.getAnchorPoint2().resolve (*markers));
int textW = (int) font.getStringWidth (getName());
int textH = (int) font.getHeight();
Point<int> p1, p2;
switch (type)
{
case left: p1 = Point<int> (component->getX(), component->getY() + component->proportionOfHeight (0.33f));
p2 = Point<int> (anchor1, p1.getY()); break;
case right: p1 = Point<int> (component->getRight(), component->getY() + component->proportionOfHeight (0.66f));
p2 = Point<int> (anchor1, p1.getY()); break;
case top: p1 = Point<int> (component->getX() + component->proportionOfWidth (0.33f), component->getY());
p2 = Point<int> (p1.getX(), anchor1); break;
case bottom: p1 = Point<int> (component->getX() + component->proportionOfWidth (0.66f), component->getBottom());
p2 = Point<int> (p1.getX(), anchor1); break;
default: jassertfalse; break;
case left:
p1 = Point<int> (component->getX(), 0);
p2 = Point<int> (component->getX(), component->getY());
textArea.setBounds (p1.getX() - textW - 2, 4, textW, textH);
break;
case right:
p1 = Point<int> (component->getRight(), 0);
p2 = Point<int> (component->getRight(), component->getY());
textArea.setBounds (p1.getX() + 2, 4, textW, textH);
break;
case top:
p1 = Point<int> (0, component->getY());
p2 = Point<int> (component->getX(), component->getY());
textArea.setBounds (4, p1.getY() - textH - 2, textW, textH);
break;
case bottom:
p1 = Point<int> (0, component->getBottom());
p2 = Point<int> (component->getX(), component->getBottom());
textArea.setBounds (4, p1.getY() + 2, textW, textH);
break;
default:
jassertfalse;
break;
}
Rectangle<int> bounds (Rectangle<int> (p1, p2).expanded (4, 4));
Point<int> textPos ((p1.getX() + p2.getX()) / 2,
(p1.getY() + p2.getY()) / 2);
int textW = (int) font.getStringWidth (getName());
int textH = (int) font.getHeight();
Rectangle<int> textRect (textPos.getX() - textW / 2, textPos.getY() - textH / 2, textW, textH);
if (isHorizontal)
textRect = textRect - Point<int> (0, textH / 2 + 4);
bounds = bounds.getUnion (textRect);
Rectangle<int> bounds (Rectangle<int> (p1, p2).expanded (2, 2).getUnion (textArea));
bounds.setPosition (component->getParentComponent()->relativePositionToOtherComponent (getParentComponent(), bounds.getPosition()));
setBounds (bounds);
lineEnd1 = p1 - bounds.getPosition();
lineEnd2 = p2 - bounds.getPosition();
textArea = textRect - bounds.getPosition();
lineEnd1 = component->getParentComponent()->relativePositionToOtherComponent (this, p1);
lineEnd2 = component->getParentComponent()->relativePositionToOtherComponent (this, p2);
textArea.setPosition (component->getParentComponent()->relativePositionToOtherComponent (this, textArea.getPosition()));
repaint();
}
void paint (Graphics& g)
{
Path p;
p.addLineSegment ((float) lineEnd1.getX(), (float) lineEnd1.getY(), (float) lineEnd2.getX(), (float) lineEnd2.getY(), 1.6f);
const float startBlobSize = 2.0f;
p.addEllipse (lineEnd1.getX() - startBlobSize, lineEnd1.getY() - startBlobSize, startBlobSize * 2.0f, startBlobSize * 2.0f);
const float endBlobSize = 4.0f;
p.addEllipse (lineEnd2.getX() - endBlobSize, lineEnd2.getY() - endBlobSize, endBlobSize * 2.0f, endBlobSize * 2.0f);
const float dashes[] = { 4.0f, 3.0f };
g.setColour (Colours::black.withAlpha (0.3f));
g.fillPath (p);
g.setColour (Colours::grey.withAlpha (0.4f));
g.drawDashedLine (lineEnd1.getX() + 0.5f, lineEnd1.getY() + 0.5f,
lineEnd2.getX() + 0.5f, lineEnd2.getY() + 0.5f,
dashes, 2, 1.0f);
g.setFont (font);
g.setColour (Colours::white);
@ -154,6 +163,111 @@ private:
Rectangle<int> textArea;
};
//==============================================================================
static const double tickSizes[] = { 1.0, 2.0, 5.0,
10.0, 20.0, 50.0,
100.0, 200.0, 500.0, 1000.0 };
class TickIterator
{
public:
TickIterator (const double startValue_, const double endValue_, const double valuePerPixel_,
int minPixelsPerTick, int minWidthForLabels)
: startValue (startValue_),
endValue (endValue_),
valuePerPixel (valuePerPixel_)
{
tickLevelIndex = findLevelIndexForValue (valuePerPixel * minPixelsPerTick);
labelLevelIndex = findLevelIndexForValue (valuePerPixel * minWidthForLabels);
tickPosition = pixelsToValue (-minWidthForLabels);
tickPosition = snapValueDown (tickPosition, tickLevelIndex);
}
bool getNextTick (float& pixelX, float& tickLength, String& label)
{
const double tickUnits = tickSizes [tickLevelIndex];
tickPosition += tickUnits;
const int totalLevels = sizeof (tickSizes) / sizeof (*tickSizes);
int highestIndex = tickLevelIndex;
while (++highestIndex < totalLevels)
{
const double ticksAtThisLevel = tickPosition / tickSizes [highestIndex];
if (fabs (ticksAtThisLevel - floor (ticksAtThisLevel + 0.5)) > 0.000001)
break;
}
--highestIndex;
if (highestIndex >= labelLevelIndex)
label = getDescriptionOfValue (tickPosition, labelLevelIndex);
else
label = String::empty;
tickLength = (highestIndex + 1 - tickLevelIndex) / (float) (totalLevels + 1 - tickLevelIndex);
pixelX = valueToPixels (tickPosition);
return tickPosition < endValue;
}
private:
double tickPosition;
int tickLevelIndex, labelLevelIndex;
const double startValue, endValue, valuePerPixel;
int findLevelIndexForValue (const double value) const
{
int i;
for (i = 0; i < sizeof (tickSizes) / sizeof (*tickSizes); ++i)
if (tickSizes [i] >= value)
break;
return i;
}
double pixelsToValue (int pixels) const
{
return startValue + pixels * valuePerPixel;
}
float valueToPixels (double value) const
{
return (float) ((value - startValue) / valuePerPixel);
}
static double snapValueToNearest (const double t, const int valueLevelIndex)
{
const double unitsPerInterval = tickSizes [valueLevelIndex];
return unitsPerInterval * floor (t / unitsPerInterval + 0.5);
}
static double snapValueDown (const double t, const int valueLevelIndex)
{
const double unitsPerInterval = tickSizes [valueLevelIndex];
return unitsPerInterval * floor (t / unitsPerInterval);
}
static inline int roundDoubleToInt (const double value)
{
union { int asInt[2]; double asDouble; } n;
n.asDouble = value + 6755399441055744.0;
#if TARGET_RT_BIG_ENDIAN
return n.asInt [1];
#else
return n.asInt [0];
#endif
}
static const String getDescriptionOfValue (const double value, const int valueLevelIndex)
{
return String (roundToInt (value));
}
};
//==============================================================================
class ComponentEditor::Canvas : public Component,
@ -162,7 +276,7 @@ class ComponentEditor::Canvas : public Component,
{
public:
Canvas (ComponentEditor& editor_)
: editor (editor_), borderThickness (4)
: editor (editor_), border (14), resizerThickness (4)
{
setOpaque (true);
addAndMakeVisible (componentHolder = new Component());
@ -184,12 +298,61 @@ public:
{
g.fillAll (Colours::white);
g.setColour (Colour::greyLevel (0.9f));
g.drawRect (0, 0, getWidth(), getHeight(), borderThickness);
g.drawRect (getContentArea().expanded (resizerThickness, resizerThickness), resizerThickness);
g.setFont (border.getBottom() - 5.0f);
g.setColour (Colours::grey);
g.drawText (String (componentHolder->getWidth()) + " x " + String (componentHolder->getHeight()),
0, 0, getWidth() - border.getRight(), getHeight(), Justification::bottomRight, false);
g.setFont (border.getTop() - 5.0f);
g.setColour (Colours::darkgrey);
const float x = border.getLeft();
const float y = border.getTop();
g.drawHorizontalLine (y, 2.0f, getWidth() - border.getRight());
g.drawVerticalLine (x, 2.0f, getHeight() - border.getBottom());
{
TickIterator ticks (0, componentHolder->getWidth(), 1.0, 10, 50);
float pos, tickLength;
String label;
while (ticks.getNextTick (pos, tickLength, label))
{
if (pos > 0)
{
g.drawVerticalLine (x + pos, y - tickLength * y, y);
g.drawSingleLineText (label, x + pos + 2, y - 6);
}
}
}
{
TickIterator ticks (0, componentHolder->getHeight(), 1.0, 10, 80);
float pos, tickLength;
String label;
while (ticks.getNextTick (pos, tickLength, label))
{
if (pos > 0)
{
g.drawHorizontalLine (y + pos, x - tickLength * x, x);
g.drawTextAsPath (label, AffineTransform::rotation (float_Pi / -2.0f)
.translated (x - 6, y + pos - 2));
}
}
}
}
void resized()
{
componentHolder->setBounds (getLocalBounds().reduced (borderThickness, borderThickness));
componentHolder->setBounds (getContentArea());
overlay->setBounds (componentHolder->getBounds());
updateComponents();
}
@ -310,15 +473,17 @@ public:
{
updateDragZone (e.getPosition());
dragStartSize = getBounds();
showSizeGuides();
}
void mouseDrag (const MouseEvent& e)
{
if (dragZone.isDraggingRightEdge() || dragZone.isDraggingBottomEdge())
{
showSizeGuides();
setSize (jmax (0, dragStartSize.getWidth() + e.getDistanceFromDragStartX()),
jmax (0, dragStartSize.getHeight() + e.getDistanceFromDragStartY()));
setSize (dragZone.isDraggingRightEdge() ? jmax (0, dragStartSize.getWidth() + e.getDistanceFromDragStartX())
: dragStartSize.getWidth(),
dragZone.isDraggingBottomEdge() ? jmax (0, dragStartSize.getHeight() + e.getDistanceFromDragStartY())
: dragStartSize.getHeight());
}
}
@ -331,11 +496,8 @@ public:
void updateDragZone (const Point<int>& p)
{
ResizableBorderComponent::Zone newZone
= ResizableBorderComponent::Zone::fromPositionOnBorder (getLocalBounds(),
BorderSize (borderThickness), p);
newZone = ResizableBorderComponent::Zone (newZone.getZoneFlags()
& (ResizableBorderComponent::Zone::right | ResizableBorderComponent::Zone::bottom));
= ResizableBorderComponent::Zone::fromPositionOnBorder (getContentArea().expanded (resizerThickness, resizerThickness),
BorderSize (0, 0, resizerThickness, resizerThickness), p);
if (dragZone != newZone)
{
@ -349,10 +511,16 @@ public:
private:
ComponentEditor& editor;
const int borderThickness;
const BorderSize border;
const int resizerThickness;
ResizableBorderComponent::Zone dragZone;
Rectangle<int> dragStartSize;
const Rectangle<int> getContentArea() const
{
return border.subtractedFrom (getLocalBounds());
}
//==============================================================================
class ComponentResizeFrame : public Component,
public ComponentListener
@ -405,16 +573,14 @@ private:
{
updateDragZone (e.getPosition());
canvas.getDocument().beginDrag (canvas.getSelectedComps(), e, getParentComponent(), dragZone);
canvas.showSizeGuides();
}
}
void mouseDrag (const MouseEvent& e)
{
if (component != 0)
{
canvas.showSizeGuides();
canvas.getDocument().continueDrag (e);
}
}
void mouseUp (const MouseEvent& e)
@ -445,10 +611,10 @@ private:
if (sizeGuides.size() == 0)
{
const ValueTree v (canvas.getDocument().getComponentState (component));
sizeGuides.add (new SizeGuideComponent (canvas.getDocument(), v, component, getParentComponent(), SizeGuideComponent::left));
sizeGuides.add (new SizeGuideComponent (canvas.getDocument(), v, component, getParentComponent(), SizeGuideComponent::right));
sizeGuides.add (new SizeGuideComponent (canvas.getDocument(), v, component, getParentComponent(), SizeGuideComponent::top));
sizeGuides.add (new SizeGuideComponent (canvas.getDocument(), v, component, getParentComponent(), SizeGuideComponent::bottom));
sizeGuides.add (new SizeGuideComponent (canvas.getDocument(), v, component, canvas, SizeGuideComponent::left));
sizeGuides.add (new SizeGuideComponent (canvas.getDocument(), v, component, canvas, SizeGuideComponent::right));
sizeGuides.add (new SizeGuideComponent (canvas.getDocument(), v, component, canvas, SizeGuideComponent::top));
sizeGuides.add (new SizeGuideComponent (canvas.getDocument(), v, component, canvas, SizeGuideComponent::bottom));
}
}

View file

@ -774,6 +774,16 @@ const String Coordinate::toString() const
}
}
const double Coordinate::getEditableValue() const
{
return isProportion ? value * 100.0 : value;
}
void Coordinate::setEditableValue (const double newValue)
{
value = isProportion ? newValue / 100.0 : newValue;
}
//==============================================================================
RectangleCoordinates::RectangleCoordinates()
: left (true), right (true), top (false), bottom (false)

View file

@ -120,13 +120,13 @@ class Coordinate
public:
//==============================================================================
/** Creates a zero coordinate. */
Coordinate (bool isHorizontal);
explicit Coordinate (bool isHorizontal);
/** Recreates a coordinate from its stringified version. */
explicit Coordinate (const String& stringVersion, bool isHorizontal);
Coordinate (const String& stringVersion, bool isHorizontal);
/** Creates an absolute position from the parent origin. */
explicit Coordinate (double absoluteDistanceFromOrigin, bool isHorizontal);
Coordinate (double absoluteDistanceFromOrigin, bool isHorizontal);
/** Creates an absolute position relative to a named marker. */
Coordinate (double absolutePosition, const String& relativeToMarker, bool isHorizontal);
@ -160,6 +160,9 @@ public:
const Coordinate getAnchorPoint1() const;
const Coordinate getAnchorPoint2() const;
const double getEditableValue() const;
void setEditableValue (const double newValue);
//==============================================================================
/*
Position string formats:

View file

@ -37,12 +37,14 @@ public:
ValueRemapperSource (const Value& sourceValue_)
: sourceValue (sourceValue_)
{
sourceValue.addListener (this);
}
ValueRemapperSource (const Value& sourceValue_, const char** mappings)
: sourceValue (sourceValue_)
{
addMappings (mappings);
sourceValue.addListener (this);
}
~ValueRemapperSource() {}
@ -75,21 +77,24 @@ public:
void setValue (const var& newValue)
{
var remappedVal (newValue);
for (int i = 1; i < mappings.size(); i += 2)
{
if (newValue == mappings.getReference(i))
{
sourceValue = mappings.getReference (i - 1);
return;
remappedVal = mappings.getReference (i - 1);
break;
}
}
sourceValue = newValue;
if (remappedVal != sourceValue)
sourceValue = remappedVal;
}
void valueChanged (Value&)
{
sendChangeMessage (false);
sendChangeMessage (true);
}
//==============================================================================

File diff suppressed because it is too large Load diff

View file

@ -13943,7 +13943,7 @@ public:
protected:
AudioFormat (const String& formatName,
const tchar** const fileExtensions);
const juce_wchar** const fileExtensions);
private:
@ -16189,8 +16189,9 @@ private:
int dragStartMousePos, lastMousePos;
int initialDelayInMillisecs, repeatDelayInMillisecs, minimumDelayInMillisecs;
bool vertical, isDraggingThumb, alwaysVisible;
Button* upButton;
Button* downButton;
class ScrollbarButton;
ScrollbarButton* upButton;
ScrollbarButton* downButton;
ListenerList <ScrollBarListener> listeners;
void updateThumbPosition();
@ -17469,7 +17470,7 @@ private:
MidiFile (const MidiFile&);
MidiFile& operator= (const MidiFile&);
void readNextTrack (const char* data, int size);
void readNextTrack (const uint8* data, int size);
void writeTrack (OutputStream& mainOut, const int trackNum);
};
@ -19149,7 +19150,8 @@ public:
private:
Viewport* viewport;
Component* propertyHolderComponent;
class PropertyHolderComponent;
PropertyHolderComponent* propertyHolderComponent;
String messageWhenEmpty;
void updatePropHolderLayout() const;
@ -20803,7 +20805,7 @@ private:
UndoManager undoManager;
int currentActionIndex, indexOfSavedState;
int maximumLineLength;
VoidArray listeners;
ListenerList <Listener> listeners;
String newLineChars;
void sendListenerChangeMessage (int startLine, int endLine);
@ -20979,7 +20981,8 @@ private:
CodeDocument::Position caretPos;
CodeDocument::Position selectionStart, selectionEnd;
Component* caret;
class CaretComponent;
CaretComponent* caret;
ScrollBar* verticalScrollBar;
ScrollBar* horizontalScrollBar;
@ -21419,7 +21422,6 @@ private:
bool incDecButtonsSideBySide : 1, sendChangeOnlyOnRelease : 1, popupDisplayEnabled : 1;
bool menuEnabled : 1, menuShown : 1, mouseWasHidden : 1, incDecDragged : 1;
bool scrollWheelEnabled : 1, snapsToMousePos : 1;
Font font;
Label* valueBox;
Button* incButton;
Button* decButton;
@ -22031,7 +22033,7 @@ public:
void scrollToKeepItemVisible (TreeViewItem* item);
Viewport* getViewport() const throw() { return viewport; }
Viewport* getViewport() const throw();
int getIndentSize() const throw() { return indentSize; }
@ -22071,11 +22073,14 @@ public:
private:
friend class TreeViewItem;
friend class TreeViewContentComponent;
Viewport* viewport;
class TreeViewport;
TreeViewport* viewport;
CriticalSection nodeAlterationLock;
TreeViewItem* rootItem;
Component* dragInsertPointHighlight;
Component* dragTargetGroupHighlight;
class InsertPointHighlight;
class TargetGroupHighlight;
InsertPointHighlight* dragInsertPointHighlight;
TargetGroupHighlight* dragTargetGroupHighlight;
int indentSize;
bool defaultOpenness : 1;
bool needsRecalculating : 1;
@ -23459,9 +23464,9 @@ private:
ListBox* listBox;
Button* addButton;
Button* removeButton;
Button* changeButton;
Button* upButton;
Button* downButton;
TextButton* changeButton;
DrawableButton* upButton;
DrawableButton* downButton;
void changed();
void updateButtons();
@ -26401,14 +26406,17 @@ public:
juce_UseDebuggingNewOperator
private:
class ColourSpaceView;
class HueSelectorComp;
class SwatchComponent;
friend class ColourSpaceView;
friend class HueSelectorComp;
Colour colour;
float h, s, v;
Slider* sliders[4];
Component* colourSpace;
Component* hueSelector;
class SwatchComponent;
ColourSpaceView* colourSpace;
HueSelectorComp* hueSelector;
OwnedArray <SwatchComponent> swatchComponents;
const int flags;
int topSpace, edgeGap;

View file

@ -230,7 +230,7 @@ int JUCEApplication::shutdownAppAndClearUp()
ScopedPointer<JUCEApplication> app (appInstance);
int returnValue = 0;
MessageManager::getInstance()->deregisterBroadcastListener ((JUCEApplication*) app);
MessageManager::getInstance()->deregisterBroadcastListener (static_cast <JUCEApplication*> (app));
static bool reentrancyCheck = false;

View file

@ -512,7 +512,7 @@ bool AudioFormatWriter::writeFromAudioSource (AudioSource& source,
//==============================================================================
AudioFormat::AudioFormat (const String& name,
const tchar** const extensions)
const juce_wchar** const extensions)
: formatName (name),
fileExtensions (extensions)
{

View file

@ -161,7 +161,7 @@ protected:
be returned by getFileExtension()
*/
AudioFormat (const String& formatName,
const tchar** const fileExtensions);
const juce_wchar** const fileExtensions);
private:
//==============================================================================

View file

@ -382,7 +382,7 @@ void AudioThumbnail::refillCache (const int numSamples,
{
startTimer (timeBeforeDeletingReader);
char* cacheData = (char*) cachedLevels.getData();
char* cacheData = static_cast <char*> (cachedLevels.getData());
int sample = roundToInt (startTime * d->sampleRate);
for (int i = numSamples; --i >= 0;)
@ -421,7 +421,7 @@ void AudioThumbnail::refillCache (const int numSamples,
for (int channelNum = 0; channelNum < numChannelsCached; ++channelNum)
{
char* const channelData = getChannelData (channelNum);
char* cacheData = ((char*) cachedLevels.getData()) + channelNum * 2;
char* cacheData = static_cast <char*> (cachedLevels.getData()) + channelNum * 2;
const double timeToThumbSampleFactor = d->sampleRate / (double) d->samplesPerThumbSample;
@ -504,7 +504,7 @@ void AudioThumbnail::drawChannel (Graphics& g,
w -= skipLeft;
x += skipLeft;
const char* cacheData = ((const char*) cachedLevels.getData())
const char* cacheData = static_cast <const char*> (cachedLevels.getData())
+ (channelNum << 1)
+ skipLeft * (numChannelsCached << 1);

View file

@ -60,10 +60,7 @@ bool AudioThumbnailCache::loadThumb (AudioThumbnail& thumb, const int64 hashCode
{
if (thumbs[i]->hash == hashCode)
{
MemoryInputStream in ((const char*) thumbs[i]->data.getData(),
thumbs[i]->data.getSize(),
false);
MemoryInputStream in (thumbs[i]->data, false);
thumb.loadFrom (in);
thumbs[i]->lastUsed = Time::getMillisecondCounter();

View file

@ -109,7 +109,7 @@ public:
ok = FLAC__stream_decoder_init_stream (decoder,
readCallback_, seekCallback_, tellCallback_, lengthCallback_,
eofCallback_, writeCallback_, metadataCallback_, errorCallback_,
(void*) this) == FLAC__STREAM_DECODER_INIT_STATUS_OK;
this) == FLAC__STREAM_DECODER_INIT_STATUS_OK;
if (ok)
{
@ -343,7 +343,7 @@ public:
ok = FLAC__stream_encoder_init_stream (encoder,
encodeWriteCallback, encodeSeekCallback,
encodeTellCallback, encodeMetadataCallback,
(void*) this) == FLAC__STREAM_ENCODER_INIT_STATUS_OK;
this) == FLAC__STREAM_ENCODER_INIT_STATUS_OK;
}
~FlacWriter()

View file

@ -215,12 +215,12 @@ public:
//==============================================================================
static size_t oggReadCallback (void* ptr, size_t size, size_t nmemb, void* datasource)
{
return (size_t) (((InputStream*) datasource)->read (ptr, (int) (size * nmemb)) / size);
return (size_t) (static_cast <InputStream*> (datasource)->read (ptr, (int) (size * nmemb)) / size);
}
static int oggSeekCallback (void* datasource, OggVorbisNamespace::ogg_int64_t offset, int whence)
{
InputStream* const in = (InputStream*) datasource;
InputStream* const in = static_cast <InputStream*> (datasource);
if (whence == SEEK_CUR)
offset += in->getPosition();
@ -238,7 +238,7 @@ public:
static long oggTellCallback (void* datasource)
{
return (long) ((InputStream*) datasource)->getPosition();
return (long) static_cast <InputStream*> (datasource)->getPosition();
}
juce_UseDebuggingNewOperator

View file

@ -426,7 +426,7 @@ public:
if (bitsPerSample == 16)
{
const short* src = (const short*) tempBuffer;
const short* src = reinterpret_cast <const short*> (tempBuffer);
if (numChannels > 1)
{
@ -465,7 +465,7 @@ public:
}
else if (bitsPerSample == 24)
{
const char* src = (const char*) tempBuffer;
const char* src = tempBuffer;
if (numChannels > 1)
{
@ -705,7 +705,7 @@ public:
const int bytes = numChannels * numSamples * bitsPerSample / 8;
tempBlock.ensureSize (bytes, false);
char* buffer = (char*) tempBlock.getData();
char* buffer = static_cast <char*> (tempBlock.getData());
const int* left = data[0];
const int* right = data[1];
@ -734,7 +734,7 @@ public:
}
else if (bitsPerSample == 24)
{
char* b = (char*) buffer;
char* b = buffer;
if (numChannels > 1)
{

View file

@ -58,9 +58,9 @@ public:
{
const ScopedLock sl (lock);
if (! sources.contains ((void*) source))
if (! sources.contains (source))
{
sources.add ((void*) source);
sources.add (source);
startThread();
stopTimer();
@ -72,14 +72,14 @@ public:
void removeSource (BufferingAudioSource* source)
{
const ScopedLock sl (lock);
sources.removeValue ((void*) source);
sources.removeValue (source);
if (sources.size() == 0)
startTimer (5000);
}
private:
VoidArray sources;
Array <BufferingAudioSource*> sources;
CriticalSection lock;
void run()
@ -95,7 +95,7 @@ private:
const ScopedLock sl (lock);
BufferingAudioSource* const b = (BufferingAudioSource*) sources[i];
BufferingAudioSource* const b = sources[i];
if (b != 0 && b->readNextBufferChunk())
busy = true;

View file

@ -77,7 +77,7 @@ void MixerAudioSource::removeInputSource (AudioSource* input, const bool deleteI
{
const ScopedLock sl (lock);
index = inputs.indexOf ((void*) input);
index = inputs.indexOf (input);
if (index >= 0)
{

View file

@ -34,13 +34,13 @@ BEGIN_JUCE_NAMESPACE
void AudioDataConverters::convertFloatToInt16LE (const float* source, void* dest, int numSamples, const int destBytesPerSample)
{
const double maxVal = (double) 0x7fff;
char* intData = (char*) dest;
char* intData = static_cast <char*> (dest);
if (dest != (void*) source || destBytesPerSample <= 4)
{
for (int i = 0; i < numSamples; ++i)
{
*(uint16*)intData = ByteOrder::swapIfBigEndian ((uint16) (short) roundToInt (jlimit (-maxVal, maxVal, maxVal * source[i])));
*(uint16*) intData = ByteOrder::swapIfBigEndian ((uint16) (short) roundToInt (jlimit (-maxVal, maxVal, maxVal * source[i])));
intData += destBytesPerSample;
}
}
@ -51,7 +51,7 @@ void AudioDataConverters::convertFloatToInt16LE (const float* source, void* dest
for (int i = numSamples; --i >= 0;)
{
intData -= destBytesPerSample;
*(uint16*)intData = ByteOrder::swapIfBigEndian ((uint16) (short) roundToInt (jlimit (-maxVal, maxVal, maxVal * source[i])));
*(uint16*) intData = ByteOrder::swapIfBigEndian ((uint16) (short) roundToInt (jlimit (-maxVal, maxVal, maxVal * source[i])));
}
}
}
@ -59,7 +59,7 @@ void AudioDataConverters::convertFloatToInt16LE (const float* source, void* dest
void AudioDataConverters::convertFloatToInt16BE (const float* source, void* dest, int numSamples, const int destBytesPerSample)
{
const double maxVal = (double) 0x7fff;
char* intData = (char*) dest;
char* intData = static_cast <char*> (dest);
if (dest != (void*) source || destBytesPerSample <= 4)
{
@ -76,7 +76,7 @@ void AudioDataConverters::convertFloatToInt16BE (const float* source, void* dest
for (int i = numSamples; --i >= 0;)
{
intData -= destBytesPerSample;
*(uint16*)intData = ByteOrder::swapIfLittleEndian ((uint16) (short) roundToInt (jlimit (-maxVal, maxVal, maxVal * source[i])));
*(uint16*) intData = ByteOrder::swapIfLittleEndian ((uint16) (short) roundToInt (jlimit (-maxVal, maxVal, maxVal * source[i])));
}
}
}
@ -84,7 +84,7 @@ void AudioDataConverters::convertFloatToInt16BE (const float* source, void* dest
void AudioDataConverters::convertFloatToInt24LE (const float* source, void* dest, int numSamples, const int destBytesPerSample)
{
const double maxVal = (double) 0x7fffff;
char* intData = (char*) dest;
char* intData = static_cast <char*> (dest);
if (dest != (void*) source || destBytesPerSample <= 4)
{
@ -109,7 +109,7 @@ void AudioDataConverters::convertFloatToInt24LE (const float* source, void* dest
void AudioDataConverters::convertFloatToInt24BE (const float* source, void* dest, int numSamples, const int destBytesPerSample)
{
const double maxVal = (double) 0x7fffff;
char* intData = (char*) dest;
char* intData = static_cast <char*> (dest);
if (dest != (void*) source || destBytesPerSample <= 4)
{
@ -134,7 +134,7 @@ void AudioDataConverters::convertFloatToInt24BE (const float* source, void* dest
void AudioDataConverters::convertFloatToInt32LE (const float* source, void* dest, int numSamples, const int destBytesPerSample)
{
const double maxVal = (double) 0x7fffffff;
char* intData = (char*) dest;
char* intData = static_cast <char*> (dest);
if (dest != (void*) source || destBytesPerSample <= 4)
{
@ -159,7 +159,7 @@ void AudioDataConverters::convertFloatToInt32LE (const float* source, void* dest
void AudioDataConverters::convertFloatToInt32BE (const float* source, void* dest, int numSamples, const int destBytesPerSample)
{
const double maxVal = (double) 0x7fffffff;
char* intData = (char*) dest;
char* intData = static_cast <char*> (dest);
if (dest != (void*) source || destBytesPerSample <= 4)
{
@ -185,7 +185,7 @@ void AudioDataConverters::convertFloatToFloat32LE (const float* source, void* de
{
jassert (dest != (void*) source || destBytesPerSample <= 4); // This op can't be performed on in-place data!
char* d = (char*) dest;
char* d = static_cast <char*> (dest);
for (int i = 0; i < numSamples; ++i)
{
@ -203,7 +203,7 @@ void AudioDataConverters::convertFloatToFloat32BE (const float* source, void* de
{
jassert (dest != (void*) source || destBytesPerSample <= 4); // This op can't be performed on in-place data!
char* d = (char*) dest;
char* d = static_cast <char*> (dest);
for (int i = 0; i < numSamples; ++i)
{
@ -221,7 +221,7 @@ void AudioDataConverters::convertFloatToFloat32BE (const float* source, void* de
void AudioDataConverters::convertInt16LEToFloat (const void* const source, float* const dest, int numSamples, const int srcBytesPerSample)
{
const float scale = 1.0f / 0x7fff;
const char* intData = (const char*) source;
const char* intData = static_cast <const char*> (source);
if (source != (void*) dest || srcBytesPerSample >= 4)
{
@ -246,7 +246,7 @@ void AudioDataConverters::convertInt16LEToFloat (const void* const source, float
void AudioDataConverters::convertInt16BEToFloat (const void* const source, float* const dest, int numSamples, const int srcBytesPerSample)
{
const float scale = 1.0f / 0x7fff;
const char* intData = (const char*) source;
const char* intData = static_cast <const char*> (source);
if (source != (void*) dest || srcBytesPerSample >= 4)
{
@ -271,7 +271,7 @@ void AudioDataConverters::convertInt16BEToFloat (const void* const source, float
void AudioDataConverters::convertInt24LEToFloat (const void* const source, float* const dest, int numSamples, const int srcBytesPerSample)
{
const float scale = 1.0f / 0x7fffff;
const char* intData = (const char*) source;
const char* intData = static_cast <const char*> (source);
if (source != (void*) dest || srcBytesPerSample >= 4)
{
@ -296,7 +296,7 @@ void AudioDataConverters::convertInt24LEToFloat (const void* const source, float
void AudioDataConverters::convertInt24BEToFloat (const void* const source, float* const dest, int numSamples, const int srcBytesPerSample)
{
const float scale = 1.0f / 0x7fffff;
const char* intData = (const char*) source;
const char* intData = static_cast <const char*> (source);
if (source != (void*) dest || srcBytesPerSample >= 4)
{
@ -321,7 +321,7 @@ void AudioDataConverters::convertInt24BEToFloat (const void* const source, float
void AudioDataConverters::convertInt32LEToFloat (const void* const source, float* const dest, int numSamples, const int srcBytesPerSample)
{
const float scale = 1.0f / 0x7fffffff;
const char* intData = (const char*) source;
const char* intData = static_cast <const char*> (source);
if (source != (void*) dest || srcBytesPerSample >= 4)
{
@ -346,7 +346,7 @@ void AudioDataConverters::convertInt32LEToFloat (const void* const source, float
void AudioDataConverters::convertInt32BEToFloat (const void* const source, float* const dest, int numSamples, const int srcBytesPerSample)
{
const float scale = 1.0f / 0x7fffffff;
const char* intData = (const char*) source;
const char* intData = static_cast <const char*> (source);
if (source != (void*) dest || srcBytesPerSample >= 4)
{
@ -370,7 +370,7 @@ void AudioDataConverters::convertInt32BEToFloat (const void* const source, float
void AudioDataConverters::convertFloat32LEToFloat (const void* const source, float* const dest, int numSamples, const int srcBytesPerSample)
{
const char* s = (const char*) source;
const char* s = static_cast <const char*> (source);
for (int i = 0; i < numSamples; ++i)
{
@ -387,7 +387,7 @@ void AudioDataConverters::convertFloat32LEToFloat (const void* const source, flo
void AudioDataConverters::convertFloat32BEToFloat (const void* const source, float* const dest, int numSamples, const int srcBytesPerSample)
{
const char* s = (const char*) source;
const char* s = static_cast <const char*> (source);
for (int i = 0; i < numSamples; ++i)
{

View file

@ -55,7 +55,7 @@ namespace MidiFileHelpers
}
}
static bool parseMidiHeader (const char* &data, short& timeFormat, short& fileType, short& numberOfTracks) throw()
static bool parseMidiHeader (const uint8* &data, short& timeFormat, short& fileType, short& numberOfTracks) throw()
{
unsigned int ch = (int) ByteOrder::bigEndianInt (data);
data += 4;
@ -266,12 +266,12 @@ bool MidiFile::readFrom (InputStream& sourceStream)
if (sourceStream.readIntoMemoryBlock (data, maxSensibleMidiFileSize))
{
size_t size = data.getSize();
const char* d = (char*) data.getData();
const uint8* d = static_cast <const uint8*> (data.getData());
short fileType, expectedTracks;
if (size > 16 && MidiFileHelpers::parseMidiHeader (d, timeFormat, fileType, expectedTracks))
{
size -= (int) (d - (char*) data.getData());
size -= (int) (d - static_cast <const uint8*> (data.getData()));
int track = 0;
@ -326,7 +326,7 @@ int MidiFile::compareElements (const MidiMessageSequence::MidiEventHolder* const
}
}
void MidiFile::readNextTrack (const char* data, int size)
void MidiFile::readNextTrack (const uint8* data, int size)
{
double time = 0;
char lastStatusByte = 0;
@ -336,13 +336,13 @@ void MidiFile::readNextTrack (const char* data, int size)
while (size > 0)
{
int bytesUsed;
const int delay = MidiMessage::readVariableLengthVal ((const uint8*) data, bytesUsed);
const int delay = MidiMessage::readVariableLengthVal (data, bytesUsed);
data += bytesUsed;
size -= bytesUsed;
time += delay;
int messSize = 0;
const MidiMessage mm ((const uint8*) data, size, messSize, lastStatusByte, time);
const MidiMessage mm (data, size, messSize, lastStatusByte, time);
if (messSize <= 0)
break;

View file

@ -188,7 +188,7 @@ private:
MidiFile (const MidiFile&);
MidiFile& operator= (const MidiFile&);
void readNextTrack (const char* data, int size);
void readNextTrack (const uint8* data, int size);
void writeTrack (OutputStream& mainOut, const int trackNum);
};

View file

@ -548,7 +548,7 @@ bool MidiMessage::isSysEx() const throw()
const MidiMessage MidiMessage::createSysExMessage (const uint8* sysexData, const int dataSize)
{
MemoryBlock mm (dataSize + 2);
uint8* const m = (uint8*) mm.getData();
uint8* const m = static_cast <uint8*> (mm.getData());
m[0] = 0xf0;
memcpy (m + 1, sysexData, dataSize);
@ -624,7 +624,7 @@ bool MidiMessage::isTextMetaEvent() const throw()
const String MidiMessage::getTextFromTextMetaEvent() const
{
return String ((const char*) getMetaEventData(), getMetaEventLength());
return String (reinterpret_cast <const char*> (getMetaEventData()), getMetaEventLength());
}
bool MidiMessage::isTrackNameEvent() const throw()

View file

@ -920,7 +920,7 @@ const String BigInteger::toString (const int base, const int minimumNumCharacter
void BigInteger::parseString (const String& text, const int base)
{
clear();
const juce_wchar* t = (const juce_wchar*) text;
const juce_wchar* t = text;
if (base == 2 || base == 8 || base == 16)
{

View file

@ -239,7 +239,7 @@ void MemoryBlock::removeSection (size_t startByte, size_t numBytesToRemove) thro
const String MemoryBlock::toString() const throw()
{
return String ((const char*) data, size);
return String (static_cast <const char*> (getData()), size);
}
//==============================================================================
@ -348,7 +348,8 @@ const String MemoryBlock::toBase64Encoding() const throw()
const int initialLen = destString.length();
destString.preallocateStorage (initialLen + 2 + numChars);
tchar* d = const_cast <tchar*> (((const tchar*) destString) + initialLen);
juce_wchar* d = destString;
d += initialLen;
*d++ = '.';
for (size_t i = 0; i < numChars; ++i)
@ -371,7 +372,8 @@ bool MemoryBlock::fromBase64Encoding (const String& s) throw()
setSize (numBytesNeeded, true);
const int numChars = s.length() - startPos;
const tchar* const srcChars = ((const tchar*) s) + startPos;
const juce_wchar* srcChars = s;
srcChars += startPos;
int pos = 0;
for (int i = 0; i < numChars; ++i)

View file

@ -273,7 +273,7 @@ const var var::readFromStream (InputStream& input)
{
MemoryBlock mb;
input.readIntoMemoryBlock (mb, numBytes - 1);
return var (String::fromUTF8 ((const char*) mb.getData(), (int) mb.getSize()));
return var (String::fromUTF8 (static_cast <const char*> (mb.getData()), (int) mb.getSize()));
}
default: input.skipNextBytes (numBytes - 1); break;

View file

@ -217,7 +217,7 @@ void InterprocessConnection::handleMessage (const Message& message)
{
case 0:
{
ScopedPointer <MemoryBlock> data ((MemoryBlock*) message.pointerParameter);
ScopedPointer <MemoryBlock> data (static_cast <MemoryBlock*> (message.pointerParameter));
messageReceived (*data);
break;
}

View file

@ -99,9 +99,9 @@ void MessageManager::postCallbackMessage (Message* const message)
//==============================================================================
// not for public use..
void MessageManager::deliverMessage (void* message)
void MessageManager::deliverMessage (void* const message)
{
const ScopedPointer <Message> m ((Message*) message);
const ScopedPointer <Message> m (static_cast <Message*> (message));
MessageListener* const recipient = m->messageRecipient;
JUCE_TRY
@ -118,7 +118,7 @@ void MessageManager::deliverMessage (void* message)
}
else
{
CallbackMessage* const cm = dynamic_cast <CallbackMessage*> ((Message*) m);
CallbackMessage* const cm = dynamic_cast <CallbackMessage*> (static_cast <Message*> (m));
if (cm != 0)
cm->messageCallback();

View file

@ -51,7 +51,7 @@ public:
static void createLines (Array <CodeDocumentLine*>& newLines, const String& text)
{
const tchar* const t = (const tchar*) text;
const juce_wchar* const t = text;
int pos = 0;
while (t [pos] != 0)
@ -709,26 +709,20 @@ void CodeDocument::checkLastLineStatus()
//==============================================================================
void CodeDocument::addListener (CodeDocument::Listener* const listener) throw()
{
listeners.addIfNotAlreadyThere (listener);
listeners.add (listener);
}
void CodeDocument::removeListener (CodeDocument::Listener* const listener) throw()
{
listeners.removeValue (listener);
listeners.remove (listener);
}
void CodeDocument::sendListenerChangeMessage (const int startLine, const int endLine)
{
const Position startPos (this, startLine, 0);
const Position endPos (this, endLine, 0);
Position startPos (this, startLine, 0);
Position endPos (this, endLine, 0);
for (int i = listeners.size(); --i >= 0;)
{
Listener* const l = (Listener*) listeners[i];
if (l != 0)
l->codeDocumentChanged (startPos, endPos);
}
listeners.call (&Listener::codeDocumentChanged, startPos, endPos);
}
//==============================================================================

View file

@ -28,7 +28,7 @@
#include "../../../utilities/juce_UndoManager.h"
#include "../../graphics/colour/juce_Colour.h"
#include "../../../containers/juce_VoidArray.h"
#include "../../../events/juce_ListenerList.h"
#include "../../../io/streams/juce_InputStream.h"
#include "../../../io/streams/juce_OutputStream.h"
class CodeDocumentLine;
@ -392,7 +392,7 @@ private:
UndoManager undoManager;
int currentActionIndex, indexOfSavedState;
int maximumLineLength;
VoidArray listeners;
ListenerList <Listener> listeners;
String newLineChars;
void sendListenerChangeMessage (int startLine, int endLine);

View file

@ -33,8 +33,8 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
class CaretComponent : public Component,
public Timer
class CodeEditorComponent::CaretComponent : public Component,
public Timer
{
public:
CaretComponent()
@ -66,6 +66,10 @@ public:
const Rectangle<int> pos (owner.getCharacterBounds (owner.getCaretPos()));
setBounds (pos.getX(), pos.getY(), 2, pos.getHeight());
}
private:
CaretComponent (const CaretComponent&);
CaretComponent& operator= (const CaretComponent&);
};
//==============================================================================
@ -348,7 +352,7 @@ void CodeEditorComponent::codeDocumentChanged (const CodeDocument::Position& aff
triggerAsyncUpdate();
((CaretComponent*) caret)->updatePosition (*this);
caret->updatePosition (*this);
columnToTryToMaintain = -1;
if (affectedTextEnd.getPosition() >= selectionStart.getPosition()
@ -368,7 +372,7 @@ void CodeEditorComponent::resized()
columnsOnScreen = (int) ((getWidth() - scrollbarThickness) / charWidth);
lines.clear();
rebuildLineTokens();
((CaretComponent*) caret)->updatePosition (*this);
caret->updatePosition (*this);
verticalScrollBar->setBounds (getWidth() - scrollbarThickness, 0, scrollbarThickness, getHeight() - scrollbarThickness);
horizontalScrollBar->setBounds (gutter, getHeight() - scrollbarThickness, getWidth() - scrollbarThickness - gutter, scrollbarThickness);
@ -511,7 +515,7 @@ void CodeEditorComponent::moveCaretTo (const CodeDocument::Position& newPos, con
deselectAll();
}
((CaretComponent*) caret)->updatePosition (*this);
caret->updatePosition (*this);
scrollToKeepCaretOnScreen();
updateScrollBars();
}
@ -542,7 +546,7 @@ void CodeEditorComponent::scrollToLineInternal (int newFirstLineOnScreen)
if (newFirstLineOnScreen != firstLineOnScreen)
{
firstLineOnScreen = newFirstLineOnScreen;
((CaretComponent*) caret)->updatePosition (*this);
caret->updatePosition (*this);
updateCachedIterators (firstLineOnScreen);
triggerAsyncUpdate();
@ -556,7 +560,7 @@ void CodeEditorComponent::scrollToColumnInternal (double column)
if (xOffset != newOffset)
{
xOffset = newOffset;
((CaretComponent*) caret)->updatePosition (*this);
caret->updatePosition (*this);
repaint();
}
}

View file

@ -260,7 +260,8 @@ private:
CodeDocument::Position caretPos;
CodeDocument::Position selectionStart, selectionEnd;
Component* caret;
class CaretComponent;
CaretComponent* caret;
ScrollBar* verticalScrollBar;
ScrollBar* horizontalScrollBar;

View file

@ -197,8 +197,8 @@ public:
ListBoxRowComponent* getComponentForRow (const int row) const throw()
{
return (ListBoxRowComponent*) getViewedComponent()
->getChildComponent (row % jmax (1, getViewedComponent()->getNumChildComponents()));
return static_cast <ListBoxRowComponent*>
(getViewedComponent()->getChildComponent (row % jmax (1, getViewedComponent()->getNumChildComponents())));
}
int getRowNumberOfComponent (Component* const rowComponent) const throw()

View file

@ -775,7 +775,6 @@ private:
bool incDecButtonsSideBySide : 1, sendChangeOnlyOnRelease : 1, popupDisplayEnabled : 1;
bool menuEnabled : 1, menuShown : 1, mouseWasHidden : 1, incDecDragged : 1;
bool scrollWheelEnabled : 1, snapsToMousePos : 1;
Font font;
Label* valueBox;
Button* incButton;
Button* decButton;

View file

@ -426,7 +426,7 @@ Component* TableListBox::refreshComponentForRow (int rowNumber, bool isRowSelect
if (existingComponentToUpdate == 0)
existingComponentToUpdate = new TableListRowComp (*this);
((TableListRowComp*) existingComponentToUpdate)->update (rowNumber, isRowSelected_);
static_cast <TableListRowComp*> (existingComponentToUpdate)->update (rowNumber, isRowSelected_);
return existingComponentToUpdate;
}

View file

@ -277,7 +277,7 @@ private:
{
int i = 0;
const int len = textToParse.length();
const tchar* const text = (const tchar*) textToParse;
const juce_wchar* const text = textToParse;
while (i < len)
{

View file

@ -228,7 +228,7 @@ public:
for (int i = rowComponentItems.size(); --i >= 0;)
{
Component* const comp = (Component*) rowComponents.getUnchecked(i);
Component* const comp = rowComponents.getUnchecked(i);
bool keep = false;
@ -236,7 +236,7 @@ public:
{
if (itemsToKeep[i])
{
const TreeViewItem* const item = (TreeViewItem*) rowComponentItems.getUnchecked(i);
const TreeViewItem* const item = rowComponentItems.getUnchecked(i);
Rectangle<int> pos (item->getItemPosition (false));
pos.setSize (pos.getWidth(), item->itemHeight);
@ -328,9 +328,9 @@ public:
private:
TreeView* const owner;
VoidArray rowComponentItems;
Array <TreeViewItem*> rowComponentItems;
Array <int> rowComponentIds;
VoidArray rowComponents;
Array <Component*> rowComponents;
TreeViewItem* buttonUnderMouse;
bool isDragging, needSelectionOnMouseUp;
@ -371,7 +371,7 @@ private:
bool containsItem (TreeViewItem* const item) const
{
for (int i = rowComponentItems.size(); --i >= 0;)
if ((TreeViewItem*) rowComponentItems.getUnchecked (i) == item)
if (rowComponentItems.getUnchecked(i) == item)
return true;
return false;
@ -379,7 +379,7 @@ private:
};
//==============================================================================
class TreeViewport : public Viewport
class TreeView::TreeViewport : public Viewport
{
public:
TreeViewport() throw() {}
@ -387,8 +387,9 @@ public:
void updateComponents()
{
if (getViewedComponent() != 0)
((TreeViewContentComponent*) getViewedComponent())->updateComponents();
TreeViewContentComponent* const tvc = static_cast <TreeViewContentComponent*> (getViewedComponent());
if (tvc != 0)
tvc->updateComponents();
repaint();
}
@ -522,6 +523,11 @@ void TreeView::setOpenCloseButtonsVisible (const bool shouldBeVisible)
}
}
Viewport* TreeView::getViewport() const throw()
{
return viewport;
}
//==============================================================================
void TreeView::clearSelectedItems()
{
@ -560,7 +566,7 @@ TreeViewItem* TreeView::getItemOnRow (int index) const
TreeViewItem* TreeView::getItemAt (int y) const throw()
{
TreeViewContentComponent* const tc = (TreeViewContentComponent*) viewport->getViewedComponent();
TreeViewContentComponent* const tc = static_cast <TreeViewContentComponent*> (viewport->getViewedComponent());
Rectangle<int> pos;
return tc->findItemAt (relativePositionToOtherComponent (tc, Point<int> (0, y)).getY(), pos);
}
@ -788,7 +794,7 @@ void TreeView::handleAsyncUpdate()
if (rootItem != 0)
rootItem->updatePositions (rootItemVisible ? 0 : -rootItem->itemHeight);
((TreeViewport*) viewport)->updateComponents();
viewport->updateComponents();
if (rootItem != 0)
{
@ -804,10 +810,10 @@ void TreeView::handleAsyncUpdate()
}
//==============================================================================
class TreeViewDragInsertPointHighlight : public Component
class TreeView::InsertPointHighlight : public Component
{
public:
TreeViewDragInsertPointHighlight()
InsertPointHighlight()
: lastItem (0)
{
setSize (100, 12);
@ -815,7 +821,7 @@ public:
setInterceptsMouseClicks (false, false);
}
~TreeViewDragInsertPointHighlight() {}
~InsertPointHighlight() {}
void setTargetPosition (TreeViewItem* const item, int insertIndex, const int x, const int y, const int width) throw()
{
@ -839,18 +845,23 @@ public:
TreeViewItem* lastItem;
int lastIndex;
private:
InsertPointHighlight (const InsertPointHighlight&);
InsertPointHighlight& operator= (const InsertPointHighlight&);
};
class TreeViewDragTargetGroupHighlight : public Component
//==============================================================================
class TreeView::TargetGroupHighlight : public Component
{
public:
TreeViewDragTargetGroupHighlight()
TargetGroupHighlight()
{
setAlwaysOnTop (true);
setInterceptsMouseClicks (false, false);
}
~TreeViewDragTargetGroupHighlight() {}
~TargetGroupHighlight() {}
void setTargetPosition (TreeViewItem* const item) throw()
{
@ -864,6 +875,10 @@ public:
g.setColour (findColour (TreeView::dragAndDropIndicatorColourId, true));
g.drawRoundedRectangle (1.0f, 1.0f, getWidth() - 2.0f, getHeight() - 2.0f, 3.0f, 2.0f);
}
private:
TargetGroupHighlight (const TargetGroupHighlight&);
TargetGroupHighlight& operator= (const TargetGroupHighlight&);
};
//==============================================================================
@ -873,15 +888,12 @@ void TreeView::showDragHighlight (TreeViewItem* item, int insertIndex, int x, in
if (dragInsertPointHighlight == 0)
{
addAndMakeVisible (dragInsertPointHighlight = new TreeViewDragInsertPointHighlight());
addAndMakeVisible (dragTargetGroupHighlight = new TreeViewDragTargetGroupHighlight());
addAndMakeVisible (dragInsertPointHighlight = new InsertPointHighlight());
addAndMakeVisible (dragTargetGroupHighlight = new TargetGroupHighlight());
}
((TreeViewDragInsertPointHighlight*) dragInsertPointHighlight)
->setTargetPosition (item, insertIndex, x, y, viewport->getViewWidth());
((TreeViewDragTargetGroupHighlight*) dragTargetGroupHighlight)
->setTargetPosition (item);
dragInsertPointHighlight->setTargetPosition (item, insertIndex, x, y, viewport->getViewWidth());
dragTargetGroupHighlight->setTargetPosition (item);
}
void TreeView::hideDragHighlight() throw()
@ -954,8 +966,8 @@ void TreeView::handleDrag (const StringArray& files, const String& sourceDescrip
if (item != 0)
{
if (scrolled || dragInsertPointHighlight == 0
|| ((TreeViewDragInsertPointHighlight*) dragInsertPointHighlight)->lastItem != item
|| ((TreeViewDragInsertPointHighlight*) dragInsertPointHighlight)->lastIndex != insertIndex)
|| dragInsertPointHighlight->lastItem != item
|| dragInsertPointHighlight->lastIndex != insertIndex)
{
if (files.size() > 0 ? item->isInterestedInFileDrag (files)
: item->isInterestedInDragSource (sourceDescription, sourceComponent))
@ -1470,7 +1482,7 @@ void TreeViewItem::paintRecursively (Graphics& g, int width)
g.reduceClipRegion (0, 0, indentWidth, itemHeight);
paintOpenCloseButton (g, indentWidth, itemHeight,
((TreeViewContentComponent*) ownerView->viewport->getViewedComponent())
static_cast <TreeViewContentComponent*> (ownerView->viewport->getViewedComponent())
->isMouseOverButton (this));
g.restoreState();

View file

@ -650,7 +650,7 @@ public:
void scrollToKeepItemVisible (TreeViewItem* item);
/** Returns the treeview's Viewport object. */
Viewport* getViewport() const throw() { return viewport; }
Viewport* getViewport() const throw();
/** Returns the number of pixels by which each nested level of the tree is indented.
@see setIndentSize
@ -751,11 +751,14 @@ public:
private:
friend class TreeViewItem;
friend class TreeViewContentComponent;
Viewport* viewport;
class TreeViewport;
TreeViewport* viewport;
CriticalSection nodeAlterationLock;
TreeViewItem* rootItem;
Component* dragInsertPointHighlight;
Component* dragTargetGroupHighlight;
class InsertPointHighlight;
class TargetGroupHighlight;
InsertPointHighlight* dragInsertPointHighlight;
TargetGroupHighlight* dragTargetGroupHighlight;
int indentSize;
bool defaultOpenness : 1;
bool needsRecalculating : 1;

View file

@ -31,8 +31,6 @@ BEGIN_JUCE_NAMESPACE
#include "../lookandfeel/juce_LookAndFeel.h"
#include "../filebrowser/juce_FileChooser.h"
#include "../../../text/juce_LocalisedStrings.h"
#include "../buttons/juce_TextButton.h"
#include "../buttons/juce_DrawableButton.h"
#include "../../graphics/drawables/juce_DrawablePath.h"
@ -65,7 +63,7 @@ FileSearchPathListComponent::FileSearchPathListComponent()
arrowImage.setFill (Colours::black.withAlpha (0.4f));
arrowImage.setPath (arrowPath);
((DrawableButton*) upButton)->setImages (&arrowImage);
upButton->setImages (&arrowImage);
}
addAndMakeVisible (downButton = new DrawableButton (String::empty, DrawableButton::ImageOnButtonBackground));
@ -78,7 +76,7 @@ FileSearchPathListComponent::FileSearchPathListComponent()
arrowImage.setFill (Colours::black.withAlpha (0.4f));
arrowImage.setPath (arrowPath);
((DrawableButton*) downButton)->setImages (&arrowImage);
downButton->setImages (&arrowImage);
}
updateButtons();
@ -187,7 +185,7 @@ void FileSearchPathListComponent::resized()
addButton->setBounds (2, buttonY, buttonH, buttonH);
removeButton->setBounds (addButton->getRight(), buttonY, buttonH, buttonH);
((TextButton*) changeButton)->changeWidthToFitText (buttonH);
changeButton->changeWidthToFitText (buttonH);
downButton->setSize (buttonH * 2, buttonH);
upButton->setSize (buttonH * 2, buttonH);

View file

@ -27,7 +27,8 @@
#define __JUCE_FILESEARCHPATHLISTCOMPONENT_JUCEHEADER__
#include "../controls/juce_ListBox.h"
#include "../buttons/juce_Button.h"
#include "../buttons/juce_DrawableButton.h"
#include "../buttons/juce_TextButton.h"
#include "../mouse/juce_FileDragAndDropTarget.h"
#include "../../../io/files/juce_FileSearchPath.h"
@ -116,9 +117,9 @@ private:
ListBox* listBox;
Button* addButton;
Button* removeButton;
Button* changeButton;
Button* upButton;
Button* downButton;
TextButton* changeButton;
DrawableButton* upButton;
DrawableButton* downButton;
void changed();
void updateButtons();

View file

@ -1331,7 +1331,7 @@ int Component::runModalLoop()
// use a callback so this can be called from non-gui threads
return (int) (pointer_sized_int)
MessageManager::getInstance()
->callFunctionOnMessageThread (&runModalLoopCallback, (void*) this);
->callFunctionOnMessageThread (&runModalLoopCallback, this);
}
SafePointer<Component> prevFocused (getCurrentlyFocusedComponent());

View file

@ -33,7 +33,7 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
class ScrollbarButton : public Button
class ScrollBar::ScrollbarButton : public Button
{
public:
int direction;
@ -246,8 +246,8 @@ void ScrollBar::setOrientation (const bool shouldBeVertical)
if (upButton != 0)
{
((ScrollbarButton*) upButton)->direction = (vertical) ? 0 : 3;
((ScrollbarButton*) downButton)->direction = (vertical) ? 2 : 1;
upButton->direction = vertical ? 0 : 3;
downButton->direction = vertical ? 2 : 1;
}
updateThumbPosition();
@ -256,13 +256,15 @@ void ScrollBar::setOrientation (const bool shouldBeVertical)
void ScrollBar::setButtonVisibility (const bool buttonsAreVisible)
{
deleteAndZero (upButton);
deleteAndZero (downButton);
delete upButton;
upButton = 0;
delete downButton;
downButton = 0;
if (buttonsAreVisible)
{
addAndMakeVisible (upButton = new ScrollbarButton ((vertical) ? 0 : 3, *this));
addAndMakeVisible (downButton = new ScrollbarButton ((vertical) ? 2 : 1, *this));
addAndMakeVisible (upButton = new ScrollbarButton (vertical ? 0 : 3, *this));
addAndMakeVisible (downButton = new ScrollbarButton (vertical ? 2 : 1, *this));
setButtonRepeatSpeed (initialDelayInMillisecs, repeatDelayInMillisecs, minimumDelayInMillisecs);
}

View file

@ -316,8 +316,9 @@ private:
int dragStartMousePos, lastMousePos;
int initialDelayInMillisecs, repeatDelayInMillisecs, minimumDelayInMillisecs;
bool vertical, isDraggingThumb, alwaysVisible;
Button* upButton;
Button* downButton;
class ScrollbarButton;
ScrollbarButton* upButton;
ScrollbarButton* downButton;
ListenerList <ScrollBarListener> listeners;
void updateThumbPosition();

View file

@ -968,7 +968,7 @@ private:
for (int i = getNumChildComponents(); --i >= 0;)
{
PopupMenu::ItemComponent* const m = (PopupMenu::ItemComponent*) getChildComponent (i);
PopupMenu::ItemComponent* const m = static_cast <PopupMenu::ItemComponent*> (getChildComponent (i));
if (m != 0
&& m->itemInfo.itemId == itemId

View file

@ -77,7 +77,7 @@ public:
{
for (int i = activeCursors.size(); --i >= 0;)
{
SharedMouseCursorInternal* const r = (SharedMouseCursorInternal*) activeCursors.getUnchecked(i);
SharedMouseCursorInternal* const r = static_cast <SharedMouseCursorInternal*> (activeCursors.getUnchecked(i));
if (r->standardType == type)
return r;

View file

@ -33,7 +33,7 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
class PropertyHolderComponent : public Component
class PropertyPanel::PropertyHolderComponent : public Component
{
public:
PropertyHolderComponent()
@ -49,9 +49,12 @@ public:
{
}
void updateLayout (const int width);
void updateLayout (int width);
void refreshAll() const;
private:
PropertyHolderComponent (const PropertyHolderComponent&);
PropertyHolderComponent& operator= (const PropertyHolderComponent&);
};
//==============================================================================
@ -180,9 +183,12 @@ public:
private:
int titleHeight;
bool isOpen_;
PropertySectionComponent (const PropertySectionComponent&);
PropertySectionComponent& operator= (const PropertySectionComponent&);
};
void PropertyHolderComponent::updateLayout (const int width)
void PropertyPanel::PropertyHolderComponent::updateLayout (const int width)
{
int y = 0;
@ -203,7 +209,7 @@ void PropertyHolderComponent::updateLayout (const int width)
repaint();
}
void PropertyHolderComponent::refreshAll() const
void PropertyPanel::PropertyHolderComponent::refreshAll() const
{
for (int i = getNumChildComponents(); --i >= 0;)
{
@ -289,19 +295,19 @@ void PropertyPanel::addSection (const String& sectionTitle,
void PropertyPanel::updatePropHolderLayout() const
{
const int maxWidth = viewport->getMaximumVisibleWidth();
((PropertyHolderComponent*) propertyHolderComponent)->updateLayout (maxWidth);
propertyHolderComponent->updateLayout (maxWidth);
const int newMaxWidth = viewport->getMaximumVisibleWidth();
if (maxWidth != newMaxWidth)
{
// need to do this twice because of scrollbars changing the size, etc.
((PropertyHolderComponent*) propertyHolderComponent)->updateLayout (newMaxWidth);
propertyHolderComponent->updateLayout (newMaxWidth);
}
}
void PropertyPanel::refreshAll() const
{
((PropertyHolderComponent*) propertyHolderComponent)->refreshAll();
propertyHolderComponent->refreshAll();
}
//==============================================================================

View file

@ -153,7 +153,8 @@ public:
private:
Viewport* viewport;
Component* propertyHolderComponent;
class PropertyHolderComponent;
PropertyHolderComponent* propertyHolderComponent;
String messageWhenEmpty;
void updatePropHolderLayout() const;

View file

@ -92,16 +92,8 @@ private:
};
//==============================================================================
class ColourSpaceView : public Component
class ColourSelector::ColourSpaceView : public Component
{
ColourSelector* const owner;
float& h;
float& s;
float& v;
float lastHue;
ColourSpaceMarker* marker;
const int edge;
public:
ColourSpaceView (ColourSelector* owner_,
float& h_, float& s_, float& v_,
@ -182,6 +174,14 @@ public:
}
private:
ColourSelector* const owner;
float& h;
float& s;
float& v;
float lastHue;
ColourSpaceMarker* marker;
const int edge;
ScopedPointer <Image> colours;
void updateMarker() const throw()
@ -232,7 +232,7 @@ private:
};
//==============================================================================
class HueSelectorComp : public Component
class ColourSelector::HueSelectorComp : public Component
{
public:
HueSelectorComp (ColourSelector* owner_,
@ -469,8 +469,8 @@ void ColourSelector::update()
if (colourSpace != 0)
{
((ColourSpaceView*) colourSpace)->updateIfNeeded();
((HueSelectorComp*) hueSelector)->updateIfNeeded();
colourSpace->updateIfNeeded();
hueSelector->updateIfNeeded();
}
if ((flags & showColourAtTop) != 0)

View file

@ -136,14 +136,17 @@ public:
juce_UseDebuggingNewOperator
private:
class ColourSpaceView;
class HueSelectorComp;
class SwatchComponent;
friend class ColourSpaceView;
friend class HueSelectorComp;
Colour colour;
float h, s, v;
Slider* sliders[4];
Component* colourSpace;
Component* hueSelector;
class SwatchComponent;
ColourSpaceView* colourSpace;
HueSelectorComp* hueSelector;
OwnedArray <SwatchComponent> swatchComponents;
const int flags;
int topSpace, edgeGap;

View file

@ -103,7 +103,7 @@ void ResizableWindow::setContentComponent (Component* const newContentComponent,
{
resizeToFitContent = resizeToFit;
if (newContentComponent != (Component*) contentComponent)
if (newContentComponent != static_cast <Component*> (contentComponent))
{
if (! deleteOldOne)
removeChildComponent (contentComponent.release());

View file

@ -319,7 +319,7 @@ int TopLevelWindow::getNumTopLevelWindows() throw()
TopLevelWindow* TopLevelWindow::getTopLevelWindow (const int index) throw()
{
return (TopLevelWindow*) TopLevelWindowManager::getInstance()->windows [index];
return static_cast <TopLevelWindow*> (TopLevelWindowManager::getInstance()->windows [index]);
}
TopLevelWindow* TopLevelWindow::getActiveTopLevelWindow() throw()

View file

@ -1034,7 +1034,7 @@ private:
//==============================================================================
static bool parseNextNumber (const String& source, String& value, int& index, const bool allowUnits)
{
const tchar* const s = (const tchar*) source;
const juce_wchar* const s = source;
while (CharacterFunctions::isWhitespace (s[index]) || s[index] == ',')
++index;

View file

@ -200,7 +200,7 @@ void GlyphArrangement::addCurtailedLineOfText (const Font& font,
font.getGlyphPositions (text, newGlyphs, xOffsets);
const int textLen = newGlyphs.size();
const juce_wchar* const unicodeText = (const juce_wchar*) text;
const juce_wchar* const unicodeText = text;
for (int i = 0; i < textLen; ++i)
{

View file

@ -326,7 +326,7 @@ float CustomTypeface::getDescent() const
float CustomTypeface::getStringWidth (const String& text)
{
float x = 0;
const juce_wchar* t = (const juce_wchar*) text;
const juce_wchar* t = text;
while (*t != 0)
{
@ -343,7 +343,7 @@ void CustomTypeface::getGlyphPositions (const String& text, Array <int>& resultG
{
xOffsets.add (0);
float x = 0;
const juce_wchar* t = (const juce_wchar*) text;
const juce_wchar* t = text;
while (*t != 0)
{

View file

@ -114,12 +114,12 @@ GIFLoader::~GIFLoader()
bool GIFLoader::getSizeFromHeader (int& w, int& h)
{
unsigned char b [8];
char b[8];
if (input.read (b, 6) == 6)
{
if ((strncmp ("GIF87a", (char*) b, 6) == 0)
|| (strncmp ("GIF89a", (char*) b, 6) == 0))
if ((strncmp ("GIF87a", b, 6) == 0)
|| (strncmp ("GIF89a", b, 6) == 0))
{
if (input.read (b, 4) == 4)
{

View file

@ -213,10 +213,9 @@ int ZipFile::getNumEntries() const throw()
const ZipFile::ZipEntry* ZipFile::getEntry (const int index) const throw()
{
ZipEntryInfo* const zei = (ZipEntryInfo*) entries [index];
ZipEntryInfo* const zei = entries [index];
return (zei != 0) ? &(zei->entry)
: 0;
return zei != 0 ? &(zei->entry) : 0;
}
int ZipFile::getIndexOfFileName (const String& fileName) const throw()
@ -303,7 +302,7 @@ void ZipFile::init()
if (pos + 46 > size)
break;
const char* const buffer = ((const char*) headerData.getData()) + pos;
const char* const buffer = static_cast <const char*> (headerData.getData()) + pos;
const int fileNameLen = ByteOrder::littleEndianShort (buffer + 28);

View file

@ -140,7 +140,7 @@ int BufferedInputStream::read (void* destBuffer, int maxBytesToRead)
maxBytesToRead -= bytesAvailable;
bytesRead += bytesAvailable;
position += bytesAvailable;
destBuffer = (void*) (((char*) destBuffer) + bytesAvailable);
destBuffer = static_cast <char*> (destBuffer) + bytesAvailable;
}
const int64 oldLastReadPos = lastReadPos;

View file

@ -78,7 +78,7 @@ public:
return dataSize <= 0;
}
void setInput (uint8* const newData, const int size) throw()
void setInput (const uint8* const newData, const int size) throw()
{
data = newData;
dataSize = size;
@ -89,7 +89,7 @@ public:
using namespace zlibNamespace;
if (streamIsValid)
{
stream.next_in = data;
stream.next_in = const_cast <uint8*> (data);
stream.next_out = dest;
stream.avail_in = dataSize;
stream.avail_out = destSize;
@ -120,7 +120,7 @@ public:
private:
zlibNamespace::z_stream stream;
uint8* data;
const uint8* data;
int dataSize, compLevel, strategy;
bool setParams, streamIsValid;
@ -169,7 +169,7 @@ bool GZIPCompressorOutputStream::write (const void* destBuffer, int howMany)
{
if (! helper->finished)
{
helper->setInput ((uint8*) destBuffer, howMany);
helper->setInput (static_cast <const uint8*> (destBuffer), howMany);
while (! helper->needsInput())
{

View file

@ -196,7 +196,7 @@ int GZIPDecompressorInputStream::read (void* destBuffer, int howMany)
if (destBuffer != 0)
{
int numRead = 0;
uint8* d = (uint8*) destBuffer;
uint8* d = static_cast <uint8*> (destBuffer);
while (! helper->error)
{
@ -217,7 +217,7 @@ int GZIPDecompressorInputStream::read (void* destBuffer, int howMany)
if (activeBufferSize > 0)
{
helper->setInput ((uint8*) buffer, activeBufferSize);
helper->setInput (buffer, activeBufferSize);
}
else
{

View file

@ -183,7 +183,7 @@ void OutputStream::writeText (const String& text, const bool asUnicode,
if (writeUnicodeHeaderBytes)
write ("\x0ff\x0fe", 2);
const juce_wchar* src = (const juce_wchar*) text;
const juce_wchar* src = text;
bool lastCharWasReturn = false;
while (*src != 0)

View file

@ -239,7 +239,7 @@ public:
AudioDataConverters::interleaveSamples ((const float**) data, interleaved, numSamples, numChannelsRunning);
AudioDataConverters::convertFloatToFormat (sampleFormat, interleaved, interleaved, numSamples * numChannelsRunning);
snd_pcm_sframes_t num = snd_pcm_writei (handle, (void*) interleaved, numSamples);
snd_pcm_sframes_t num = snd_pcm_writei (handle, interleaved, numSamples);
if (failed (num) && num != -EPIPE && num != -ESTRPIPE)
return false;
@ -274,7 +274,7 @@ public:
scratch.ensureSize (sizeof (float) * numSamples * numChannelsRunning, false);
float* interleaved = static_cast <float*> (scratch.getData());
snd_pcm_sframes_t num = snd_pcm_readi (handle, (void*) interleaved, numSamples);
snd_pcm_sframes_t num = snd_pcm_readi (handle, interleaved, numSamples);
if (failed (num))
{

View file

@ -150,7 +150,7 @@ public:
struct sockaddr_in address;
zerostruct (address);
memcpy ((void*) &address.sin_addr, (const void*) host->h_addr, host->h_length);
memcpy (&address.sin_addr, host->h_addr, host->h_length);
address.sin_family = host->h_addrtype;
address.sin_port = htons (port);

View file

@ -51,7 +51,7 @@ void* juce_createThread (void* userData)
if (pthread_create (&handle, 0, threadEntryProc, userData) == 0)
{
pthread_detach (handle);
return (void*)handle;
return (void*) handle;
}
return 0;

View file

@ -1246,7 +1246,7 @@ public:
::setlocale (LC_ALL, oldLocale);
}
const juce_wchar unicodeChar = *(const juce_wchar*) String::fromUTF8 (utf8, sizeof (utf8) - 1);
const juce_wchar unicodeChar = String::fromUTF8 (utf8, sizeof (utf8) - 1) [0];
int keyCode = (int) unicodeChar;
if (keyCode < 0x20)

View file

@ -345,7 +345,7 @@ public:
AudioValueTranslation avt;
char buffer[256];
avt.mInputData = (void*) &(types[i]);
avt.mInputData = &(types[i]);
avt.mInputDataSize = sizeof (UInt32);
avt.mOutputData = buffer;
avt.mOutputDataSize = 256;
@ -502,9 +502,9 @@ public:
if (deviceID != 0)
{
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
if (OK (AudioDeviceAddIOProc (deviceID, audioIOProc, (void*) this)))
if (OK (AudioDeviceAddIOProc (deviceID, audioIOProc, this)))
#else
if (OK (AudioDeviceCreateIOProcID (deviceID, audioIOProc, (void*) this, &audioProcID)))
if (OK (AudioDeviceCreateIOProcID (deviceID, audioIOProc, this, &audioProcID)))
#endif
{
if (OK (AudioDeviceStart (deviceID, audioIOProc)))

View file

@ -597,7 +597,7 @@ private:
--numGradientLookupEntries;
CGShadingRef result = 0;
CGFunctionRef function = CGFunctionCreate ((void*) this, 1, 0, 4, 0, &gradientCallbacks);
CGFunctionRef function = CGFunctionCreate (this, 1, 0, 4, 0, &gradientCallbacks);
CGPoint p1 (CGPointMake (gradient.x1, gradient.y1));
if (gradient.isRadial)

View file

@ -274,7 +274,7 @@ MidiOutput* MidiOutput::openDevice (int index)
if (OK (MIDIOutputPortCreate (globalMidiClient, pname, &port)))
{
mo = new MidiOutput();
mo->internal = (void*) new MidiPortAndEndpoint (port, endPoint);
mo->internal = new MidiPortAndEndpoint (port, endPoint);
}
}
@ -297,7 +297,7 @@ MidiOutput* MidiOutput::createNewDevice (const String& deviceName)
if (OK (MIDISourceCreate (globalMidiClient, name, &endPoint)))
{
mo = new MidiOutput();
mo->internal = (void*) new MidiPortAndEndpoint (0, endPoint);
mo->internal = new MidiPortAndEndpoint (0, endPoint);
}
CFRelease (name);
@ -560,7 +560,7 @@ MidiInput* MidiInput::openDevice (int index, MidiInputCallback* callback)
mi = new MidiInput (getDevices() [index]);
mpc->input = mi;
mi->internal = (void*) mpc;
mi->internal = mpc;
const ScopedLock sl (CoreMidiCallbacks::callbackLock);
CoreMidiCallbacks::activeCallbacks.add (mpc.release());
@ -600,7 +600,7 @@ MidiInput* MidiInput::createNewDevice (const String& deviceName, MidiInputCallba
mi = new MidiInput (deviceName);
mpc->input = mi;
mi->internal = (void*) mpc;
mi->internal = mpc;
const ScopedLock sl (CoreMidiCallbacks::callbackLock);
CoreMidiCallbacks::activeCallbacks.add (mpc.release());

View file

@ -39,7 +39,7 @@ void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hot
hotSpot: NSMakePoint (hotspotX, hotspotY)];
[im release];
return (void*) c;
return c;
}
static void* juce_cursorFromData (const unsigned char* data, const size_t size, float hx, float hy) throw()
@ -135,7 +135,7 @@ void* juce_createStandardMouseCursor (MouseCursor::StandardCursorType type) thro
}
[c retain];
return (void*) c;
return c;
}
void juce_deleteMouseCursor (void* const cursorHandle, const bool isStandard) throw()

View file

@ -265,7 +265,7 @@ public:
static ModifierKeys currentModifiers;
static ComponentPeer* currentlyFocusedPeer;
static VoidArray keysCurrentlyDown;
static Array<int> keysCurrentlyDown;
};
//==============================================================================
@ -755,20 +755,20 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
ModifierKeys NSViewComponentPeer::currentModifiers;
ComponentPeer* NSViewComponentPeer::currentlyFocusedPeer = 0;
VoidArray NSViewComponentPeer::keysCurrentlyDown;
Array<int> NSViewComponentPeer::keysCurrentlyDown;
//==============================================================================
bool KeyPress::isKeyCurrentlyDown (const int keyCode)
{
if (NSViewComponentPeer::keysCurrentlyDown.contains ((void*) keyCode))
if (NSViewComponentPeer::keysCurrentlyDown.contains (keyCode))
return true;
if (keyCode >= 'A' && keyCode <= 'Z'
&& NSViewComponentPeer::keysCurrentlyDown.contains ((void*) (int) CharacterFunctions::toLowerCase ((tchar) keyCode)))
&& NSViewComponentPeer::keysCurrentlyDown.contains ((int) CharacterFunctions::toLowerCase ((tchar) keyCode)))
return true;
if (keyCode >= 'a' && keyCode <= 'z'
&& NSViewComponentPeer::keysCurrentlyDown.contains ((void*) (int) CharacterFunctions::toUpperCase ((tchar) keyCode)))
&& NSViewComponentPeer::keysCurrentlyDown.contains ((int) CharacterFunctions::toUpperCase ((tchar) keyCode)))
return true;
return false;
@ -794,9 +794,9 @@ void NSViewComponentPeer::updateKeysDown (NSEvent* ev, bool isKeyDown)
if (keyCode != 0)
{
if (isKeyDown)
keysCurrentlyDown.addIfNotAlreadyThere ((void*) keyCode);
keysCurrentlyDown.addIfNotAlreadyThere (keyCode);
else
keysCurrentlyDown.removeValue ((void*) keyCode);
keysCurrentlyDown.removeValue (keyCode);
}
}

View file

@ -398,7 +398,7 @@ public:
}
const OpenGLPixelFormat getPixelFormat() const { return pixelFormat; }
void* getRawContext() const throw() { return (void*) glLayer; }
void* getRawContext() const throw() { return glLayer; }
void updateWindowPosition (int x, int y, int w, int h, int outerWindowHeight)
{

View file

@ -69,11 +69,10 @@ const String PlatformUtilities::cfStringToJuceString (CFStringRef cfString)
CFStringRef PlatformUtilities::juceStringToCFString (const String& s)
{
const int len = s.length();
const juce_wchar* t = (const juce_wchar*) s;
HeapBlock <UniChar> temp (len + 2);
for (int i = 0; i <= len; ++i)
temp[i] = t[i];
temp[i] = s[i];
return CFStringCreateWithCharacters (kCFAllocatorDefault, temp, len);
}
@ -122,7 +121,7 @@ const String PlatformUtilities::convertToPrecomposedUnicode (const String& s)
{
result.preallocateStorage (bytesRead / sizeof (UniChar) + 2);
tchar* t = const_cast <tchar*> ((const tchar*) result);
tchar* t = result;
unsigned int i;
for (i = 0; i < bytesRead / sizeof (UniChar); ++i)

View file

@ -1066,7 +1066,7 @@ void CDController::prepare (SRB_ExecSCSICmd& s)
void CDController::perform (SRB_ExecSCSICmd& s)
{
HANDLE event = CreateEvent (0, TRUE, FALSE, 0);
s.SRB_PostProc = (void*)event;
s.SRB_PostProc = event;
ResetEvent (event);
@ -1227,7 +1227,7 @@ bool CDDeviceHandle::readTOC (TOC* lpToc, bool useMSF)
s.SRB_BufPointer = (BYTE*)lpToc;
s.SRB_SenseLen = 0x0E;
s.SRB_CDBLen = 0x0A;
s.SRB_PostProc = (void*)event;
s.SRB_PostProc = event;
s.CDBByte[0] = 0x43;
s.CDBByte[1] = (BYTE)(useMSF ? 0x02 : 0x00);
s.CDBByte[7] = 0x03;
@ -1306,7 +1306,7 @@ void CDDeviceHandle::openDrawer (bool shouldBeOpen)
s.CDBByte[4] = (BYTE)((shouldBeOpen) ? 2 : 3);
HANDLE event = CreateEvent (0, TRUE, FALSE, 0);
s.SRB_PostProc = (void*)event;
s.SRB_PostProc = event;
ResetEvent (event);
@ -1388,7 +1388,7 @@ static void GetAspiDeviceInfo (CDDeviceInfo* dev, BYTE ha, BYTE tgt, BYTE lun)
s.SRB_BufPointer = buffer;
s.SRB_SenseLen = SENSE_LEN;
s.SRB_CDBLen = 6;
s.SRB_PostProc = (void*)event;
s.SRB_PostProc = event;
s.CDBByte[0] = SCSI_INQUIRY;
s.CDBByte[4] = 100;

View file

@ -43,7 +43,7 @@ DynamicLibraryLoader::~DynamicLibraryLoader()
void* DynamicLibraryLoader::findProcAddress (const String& functionName)
{
return (void*) GetProcAddress ((HMODULE) libHandle, functionName.toCString());
return GetProcAddress ((HMODULE) libHandle, functionName.toCString());
}

View file

@ -163,7 +163,7 @@ void* juce_fileOpen (const String& fileName, bool forWriting)
h = 0;
}
return (void*) h;
return h;
}
void juce_fileClose (void* handle)

View file

@ -228,7 +228,7 @@ void MessageManager::broadcastMessage (const String& value) throw()
COPYDATASTRUCT data;
data.dwData = broadcastId;
data.cbData = (localCopy.length() + 1) * sizeof (juce_wchar);
data.lpData = (void*) (const juce_wchar*) localCopy;
data.lpData = (void*) static_cast <const juce_wchar*> (localCopy);
for (int i = windows.size(); --i >= 0;)
{

View file

@ -378,7 +378,7 @@ MidiInput* MidiInput::openDevice (const int index, MidiInputCallback* const call
if (err == MMSYSERR_NOERROR)
{
thread->hIn = h;
in->internal = (void*) thread.release();
in->internal = thread.release();
return in.release();
}
@ -498,7 +498,7 @@ MidiOutput* MidiOutput::openDevice (int index)
han->refCount++;
MidiOutput* const out = new MidiOutput();
out->internal = (void*) han;
out->internal = han;
return out;
}
}
@ -517,7 +517,7 @@ MidiOutput* MidiOutput::openDevice (int index)
MidiOutHandle::activeHandles.add (han);
MidiOutput* const out = new MidiOutput();
out->internal = (void*) han;
out->internal = han;
return out;
}
else if (res == MMSYSERR_ALLOCATED)

View file

@ -44,7 +44,7 @@ void SystemClipboard::copyTextToClipboard (const String& text)
if (bufH != 0)
{
WCHAR* const data = (WCHAR*) GlobalLock (bufH);
WCHAR* const data = static_cast <WCHAR*> (GlobalLock (bufH));
text.copyToUnicode (data, len);
GlobalUnlock (bufH);

View file

@ -335,7 +335,7 @@ static Handle createHandleDataRef (Handle dataHandle, const char* fileName)
static CFStringRef juceStringToCFString (const String& s)
{
const int len = s.length();
const juce_wchar* const t = (const juce_wchar*) s;
const juce_wchar* const t = s;
HeapBlock <UniChar> temp (len + 2);
for (int i = 0; i <= len; ++i)
@ -390,7 +390,7 @@ bool juce_OpenQuickTimeMovieFromStream (InputStream* input, Movie& movie, Handle
props[prop].propClass = kQTPropertyClass_DataLocation;
props[prop].propID = kQTDataLocationPropertyID_DataReference;
props[prop].propValueSize = sizeof (dr);
props[prop].propValueAddress = (void*) &dr;
props[prop].propValueAddress = &dr;
++prop;
FileInputStream* const fin = dynamic_cast <FileInputStream*> (input);

View file

@ -332,7 +332,7 @@ void PlatformUtilities::freeDynamicLibrary (void* h)
void* PlatformUtilities::getProcedureEntryPoint (void* h, const String& name)
{
return (h != 0) ? (void*) GetProcAddress ((HMODULE) h, name.toCString()) : 0;
return (h != 0) ? GetProcAddress ((HMODULE) h, name.toCString()) : 0;
}

View file

@ -381,7 +381,7 @@ public:
taskBarIcon (0),
dropTarget (0)
{
callFunctionIfNotLocked (&createWindowCallback, (void*) this);
callFunctionIfNotLocked (&createWindowCallback, this);
setTitle (component->getName());
@ -423,7 +423,7 @@ public:
//==============================================================================
void* getNativeHandle() const
{
return (void*) hwnd;
return hwnd;
}
void setVisible (bool shouldBeVisible)
@ -646,9 +646,7 @@ public:
const bool oldDeactivate = shouldDeactivateTitleBar;
shouldDeactivateTitleBar = ((styleFlags & windowIsTemporary) == 0);
callFunctionIfNotLocked (makeActive ? &toFrontCallback1
: &toFrontCallback2,
(void*) hwnd);
callFunctionIfNotLocked (makeActive ? &toFrontCallback1 : &toFrontCallback2, hwnd);
shouldDeactivateTitleBar = oldDeactivate;
@ -690,7 +688,7 @@ public:
const bool oldDeactivate = shouldDeactivateTitleBar;
shouldDeactivateTitleBar = ((styleFlags & windowIsTemporary) == 0);
callFunctionIfNotLocked (&setFocusCallback, (void*) hwnd);
callFunctionIfNotLocked (&setFocusCallback, hwnd);
shouldDeactivateTitleBar = oldDeactivate;
}
@ -940,7 +938,7 @@ private:
//==============================================================================
static void* createWindowCallback (void* userData)
{
((Win32ComponentPeer*) userData)->createWindow();
static_cast <Win32ComponentPeer*> (userData)->createWindow();
return 0;
}
@ -1042,7 +1040,7 @@ private:
static void* getFocusCallback (void*)
{
return (void*) GetFocus();
return GetFocus();
}
void offsetWithinParent (int& x, int& y) const
@ -2536,7 +2534,7 @@ void* juce_createMouseCursorFromImage (const Image& image, int hotspotX, int hot
if (os == SystemStats::WinXP)
{
cursorH = (void*) createHICONFromImage (*im, FALSE, hotspotX, hotspotY);
cursorH = createHICONFromImage (*im, FALSE, hotspotX, hotspotY);
}
else
{
@ -2659,7 +2657,7 @@ void* juce_createStandardMouseCursor (MouseCursor::StandardCursorType type) thro
if (cursorH == 0)
cursorH = LoadCursor (0, IDC_ARROW);
return (void*) cursorH;
return cursorH;
}
//==============================================================================
@ -2999,9 +2997,9 @@ bool DragAndDropContainer::performExternalDragDropOfText (const String& text)
const int numChars = text.length();
medium.hGlobal = GlobalAlloc (GMEM_MOVEABLE | GMEM_ZEROINIT, (numChars + 2) * sizeof (WCHAR));
char* d = (char*) GlobalLock (medium.hGlobal);
WCHAR* const data = static_cast <WCHAR*> (GlobalLock (medium.hGlobal));
text.copyToUnicode ((WCHAR*) d, numChars + 1);
text.copyToUnicode (data, numChars + 1);
format.cfFormat = CF_UNICODETEXT;
GlobalUnlock (medium.hGlobal);

View file

@ -630,13 +630,13 @@ String& String::operator+= (const String& other)
String& String::operator+= (const char ch)
{
const juce_wchar asString[] = { (juce_wchar) ch, 0 };
return operator+= ((const juce_wchar*) asString);
return operator+= (static_cast <const juce_wchar*> (asString));
}
String& String::operator+= (const juce_wchar ch)
{
const juce_wchar asString[] = { (juce_wchar) ch, 0 };
return operator+= ((const juce_wchar*) asString);
return operator+= (static_cast <const juce_wchar*> (asString));
}
String& String::operator+= (const int number)
@ -1884,7 +1884,7 @@ int64 String::getHexValue64() const throw()
//==============================================================================
const String String::createStringFromData (const void* const data_, const int size)
{
const char* const data = (const char*) data_;
const char* const data = static_cast <const char*> (data_);
if (size <= 0 || data == 0)
{
@ -1905,7 +1905,7 @@ const String String::createStringFromData (const void* const data_, const int si
result.preallocateStorage (numChars + 2);
const uint16* const src = (const uint16*) (data + 2);
juce_wchar* const dst = const_cast <juce_wchar*> ((const juce_wchar*) result);
juce_wchar* const dst = const_cast <juce_wchar*> (static_cast <const juce_wchar*> (result));
if (bigEndian)
{
@ -2190,7 +2190,7 @@ void String::Concatenator::append (const String& s)
if (len > 0)
{
result.preallocateStorage (nextIndex + len);
s.copyToUnicode (((juce_wchar*) result) + nextIndex, len);
s.copyToUnicode (static_cast <juce_wchar*> (result) + nextIndex, len);
nextIndex += len;
}
}

View file

@ -307,7 +307,7 @@ const String StringArray::joinIntoString (const String& separator, int start, in
String result;
result.preallocateStorage (charsNeeded);
juce_wchar* dest = (juce_wchar*) result;
juce_wchar* dest = result;
while (start < last)
{

View file

@ -87,11 +87,11 @@ XmlElement* XmlDocument::getDocumentElement (const bool onlyReadOuterDocumentEle
&& ((data[0] == (char)-2 && data[1] == (char)-1)
|| (data[0] == (char)-1 && data[1] == (char)-2)))
{
textToParse = String::createStringFromData ((const char*) data.getData(), (int) data.getSize());
textToParse = String::createStringFromData (static_cast <const char*> (data.getData()), (int) data.getSize());
}
else
{
textToParse = String::fromUTF8 ((const char*) data.getData(), (int) data.getSize());
textToParse = String::fromUTF8 (static_cast <const char*> (data.getData()), (int) data.getSize());
}
if (! onlyReadOuterDocumentElement)

View file

@ -198,7 +198,7 @@ namespace XmlOutputFunctions
static void escapeIllegalXmlChars (OutputStream& outputStream, const String& text, const bool changeNewLines)
{
const juce_wchar* t = (const juce_wchar*) text;
const juce_wchar* t = text;
for (;;)
{

View file

@ -85,7 +85,7 @@ void Thread::threadEntryPoint (Thread* const thread)
// used to wrap the incoming call from the platform-specific code
void JUCE_API juce_threadEntryPoint (void* userData)
{
Thread::threadEntryPoint ((Thread*) userData);
Thread::threadEntryPoint (static_cast <Thread*> (userData));
}
@ -114,7 +114,7 @@ void Thread::startThread()
if (threadHandle_ == 0)
{
threadHandle_ = juce_createThread ((void*) this);
threadHandle_ = juce_createThread (this);
juce_setThreadPriority (threadHandle_, threadPriority_);
startSuspensionEvent_.signal();
}

View file

@ -183,7 +183,7 @@ int ThreadPool::getNumJobs() const
ThreadPoolJob* ThreadPool::getJob (const int index) const
{
const ScopedLock sl (lock);
return (ThreadPoolJob*) jobs [index];
return jobs [index];
}
bool ThreadPool::contains (const ThreadPoolJob* const job) const

View file

@ -65,7 +65,7 @@ void DeletedAtShutdown::deleteAll()
{
JUCE_TRY
{
DeletedAtShutdown* deletee = (DeletedAtShutdown*) localCopy.getUnchecked(i);
DeletedAtShutdown* deletee = static_cast <DeletedAtShutdown*> (localCopy.getUnchecked(i));
// double-check that it's not already been deleted during another object's destructor.
{