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

Cleaned up some compiler warnings. Jucer development.

This commit is contained in:
Julian Storer 2010-05-04 21:27:45 +01:00
parent e6a5f1501f
commit b9443c8ba3
88 changed files with 862 additions and 688 deletions

View file

@ -657,7 +657,6 @@ int ListBox::getRowNumberOfComponent (Component* const rowComponent) const throw
const Rectangle<int> ListBox::getRowPosition (const int rowNumber,
const bool relativeToComponentTopLeft) const throw()
{
const int rowHeight = getRowHeight();
int y = viewport->getY() + rowHeight * rowNumber;
if (relativeToComponentTopLeft)

View file

@ -579,14 +579,6 @@ public:
*/
virtual void valueChanged();
/** Callback to indicate that the user has just moved the slider.
Note - the valueChanged() method has changed its format and now no longer has
any parameters. Update your code to use the new version.
This version has been left here with an int as its return value to cause
a syntax error if you've got existing code that uses the old version.
*/
virtual int valueChanged (double) { jassertfalse; return 0; }
//==============================================================================
/** Subclasses can override this to convert a text string to a value.

View file

@ -1631,10 +1631,10 @@ void TextEditor::copy()
{
if (passwordCharacter == 0)
{
const String selection (getHighlightedText());
const String selectedText (getHighlightedText());
if (selection.isNotEmpty())
SystemClipboard::copyTextToClipboard (selection);
if (selectedText.isNotEmpty())
SystemClipboard::copyTextToClipboard (selectedText);
}
}

View file

@ -190,11 +190,11 @@ void ToolbarItemComponent::setStyle (const Toolbar::ToolbarItemStyle& newStyle)
}
}
void ToolbarItemComponent::paintButton (Graphics& g, bool isMouseOver, bool isMouseDown)
void ToolbarItemComponent::paintButton (Graphics& g, const bool over, const bool down)
{
if (isBeingUsedAsAButton)
getLookAndFeel().paintToolbarButtonBackground (g, getWidth(), getHeight(),
isMouseOver, isMouseDown, *this);
over, down, *this);
if (toolbarStyle != Toolbar::iconsOnly)
{
@ -218,7 +218,7 @@ void ToolbarItemComponent::paintButton (Graphics& g, bool isMouseOver, bool isMo
g.setOrigin (contentArea.getX(), contentArea.getY());
g.reduceClipRegion (0, 0, contentArea.getWidth(), contentArea.getHeight());
paintButtonArea (g, contentArea.getWidth(), contentArea.getHeight(), isMouseOver, isMouseDown);
paintButtonArea (g, contentArea.getWidth(), contentArea.getHeight(), over, down);
g.restoreState();
}

View file

@ -205,37 +205,40 @@ public:
const int visibleBottom = visibleTop + getParentHeight();
BigInteger itemsToKeep;
TreeViewItem* item = owner.rootItem;
int y = (item != 0 && ! owner.rootItemVisible) ? -item->itemHeight : 0;
while (item != 0 && y < visibleBottom)
{
y += item->itemHeight;
TreeViewItem* item = owner.rootItem;
int y = (item != 0 && ! owner.rootItemVisible) ? -item->itemHeight : 0;
if (y >= visibleTop)
while (item != 0 && y < visibleBottom)
{
const int index = rowComponentIds.indexOf (item->uid);
y += item->itemHeight;
if (index < 0)
if (y >= visibleTop)
{
Component* const comp = item->createItemComponent();
const int index = rowComponentIds.indexOf (item->uid);
if (comp != 0)
if (index < 0)
{
addAndMakeVisible (comp);
itemsToKeep.setBit (rowComponentItems.size());
rowComponentItems.add (item);
rowComponentIds.add (item->uid);
rowComponents.add (comp);
Component* const comp = item->createItemComponent();
if (comp != 0)
{
addAndMakeVisible (comp);
itemsToKeep.setBit (rowComponentItems.size());
rowComponentItems.add (item);
rowComponentIds.add (item->uid);
rowComponents.add (comp);
}
}
else
{
itemsToKeep.setBit (index);
}
}
else
{
itemsToKeep.setBit (index);
}
}
item = item->getNextVisibleItem (true);
item = item->getNextVisibleItem (true);
}
}
for (int i = rowComponentItems.size(); --i >= 0;)
@ -1716,14 +1719,14 @@ const String TreeViewItem::getItemIdentifierString() const
TreeViewItem* TreeViewItem::findItemFromIdentifierString (const String& identifierString)
{
const String uid (getUniqueName());
const String thisId (getUniqueName());
if (uid == identifierString)
if (thisId == identifierString)
return this;
if (identifierString.startsWith (uid + "/"))
if (identifierString.startsWith (thisId + "/"))
{
const String remainingPath (identifierString.substring (uid.length() + 1));
const String remainingPath (identifierString.substring (thisId.length() + 1));
bool wasOpen = isOpen();
setOpen (true);

View file

@ -370,6 +370,8 @@ void FileBrowserComponent::fileDoubleClicked (const File& f)
bool FileBrowserComponent::keyPressed (const KeyPress& key)
{
(void) key;
#if JUCE_LINUX || JUCE_WINDOWS
if (key.getModifiers().isCommandDown()
&& (key.getKeyCode() == 'H' || key.getKeyCode() == 'h'))

View file

@ -2186,13 +2186,13 @@ void Component::internalMouseEnter (MouseInputSource& source, const Point<int>&
{
if (p->numDeepMouseListeners > 0)
{
BailOutChecker checker (this, p);
BailOutChecker checker2 (this, p);
for (int i = p->numDeepMouseListeners; --i >= 0;)
{
p->mouseListeners_->getUnchecked(i)->mouseEnter (me);
if (checker.shouldBailOut())
if (checker2.shouldBailOut())
return;
i = jmin (i, p->numDeepMouseListeners);
@ -2258,13 +2258,13 @@ void Component::internalMouseExit (MouseInputSource& source, const Point<int>& r
{
if (p->numDeepMouseListeners > 0)
{
BailOutChecker checker (this, p);
BailOutChecker checker2 (this, p);
for (int i = p->numDeepMouseListeners; --i >= 0;)
{
p->mouseListeners_->getUnchecked (i)->mouseExit (me);
if (checker.shouldBailOut())
if (checker2.shouldBailOut())
return;
i = jmin (i, p->numDeepMouseListeners);
@ -2425,13 +2425,13 @@ void Component::internalMouseDown (MouseInputSource& source, const Point<int>& r
{
if (p->numDeepMouseListeners > 0)
{
BailOutChecker checker (this, p);
BailOutChecker checker2 (this, p);
for (int i = p->numDeepMouseListeners; --i >= 0;)
{
p->mouseListeners_->getUnchecked (i)->mouseDown (me);
if (checker.shouldBailOut())
if (checker2.shouldBailOut())
return;
i = jmin (i, p->numDeepMouseListeners);
@ -2494,13 +2494,13 @@ void Component::internalMouseUp (MouseInputSource& source, const Point<int>& rel
{
if (p->numDeepMouseListeners > 0)
{
BailOutChecker checker (this, p);
BailOutChecker checker2 (this, p);
for (int i = p->numDeepMouseListeners; --i >= 0;)
{
p->mouseListeners_->getUnchecked (i)->mouseUp (me);
if (checker.shouldBailOut())
if (checker2.shouldBailOut())
return;
i = jmin (i, p->numDeepMouseListeners);
@ -2545,13 +2545,13 @@ void Component::internalMouseUp (MouseInputSource& source, const Point<int>& rel
{
if (p->numDeepMouseListeners > 0)
{
BailOutChecker checker (this, p);
BailOutChecker checker2 (this, p);
for (int i = p->numDeepMouseListeners; --i >= 0;)
{
p->mouseListeners_->getUnchecked (i)->mouseDoubleClick (me);
if (checker.shouldBailOut())
if (checker2.shouldBailOut())
return;
i = jmin (i, p->numDeepMouseListeners);
@ -2611,13 +2611,13 @@ void Component::internalMouseDrag (MouseInputSource& source, const Point<int>& r
{
if (p->numDeepMouseListeners > 0)
{
BailOutChecker checker (this, p);
BailOutChecker checker2 (this, p);
for (int i = p->numDeepMouseListeners; --i >= 0;)
{
p->mouseListeners_->getUnchecked (i)->mouseDrag (me);
if (checker.shouldBailOut())
if (checker2.shouldBailOut())
return;
i = jmin (i, p->numDeepMouseListeners);
@ -2677,13 +2677,13 @@ void Component::internalMouseMove (MouseInputSource& source, const Point<int>& r
{
if (p->numDeepMouseListeners > 0)
{
BailOutChecker checker (this, p);
BailOutChecker checker2 (this, p);
for (int i = p->numDeepMouseListeners; --i >= 0;)
{
p->mouseListeners_->getUnchecked (i)->mouseMove (me);
if (checker.shouldBailOut())
if (checker2.shouldBailOut())
return;
i = jmin (i, p->numDeepMouseListeners);
@ -2743,13 +2743,13 @@ void Component::internalMouseWheel (MouseInputSource& source, const Point<int>&
{
if (p->numDeepMouseListeners > 0)
{
BailOutChecker checker (this, p);
BailOutChecker checker2 (this, p);
for (int i = p->numDeepMouseListeners; --i >= 0;)
{
p->mouseListeners_->getUnchecked (i)->mouseWheelMove (me, wheelIncrementX, wheelIncrementY);
if (checker.shouldBailOut())
if (checker2.shouldBailOut())
return;
i = jmin (i, p->numDeepMouseListeners);

View file

@ -2084,13 +2084,8 @@ private:
// hierarchies. You might need to give your subclasses a private dummy constructor like
// this one to avoid compiler warnings.
Component (const Component&);
Component& operator= (const Component&);
// (dummy method to cause a deliberate compile error - if you hit this, you need to update your
// subclass to use the new parameters to keyStateChanged)
virtual void keyStateChanged() {};
protected:
/** @internal */
virtual void internalRepaint (int x, int y, int w, int h);

View file

@ -356,10 +356,9 @@ void KeyMappingEditorComponent::resized()
const int buttonHeight = 20;
h -= buttonHeight + 8;
int x = getWidth() - 8;
const int y = h + 6;
resetButton->changeWidthToFitText (buttonHeight);
resetButton->setTopRightPosition (x, y);
resetButton->setTopRightPosition (x, h + 6);
}
tree->setBounds (0, 0, getWidth(), h);
@ -381,7 +380,7 @@ void KeyMappingEditorComponent::buttonClicked (Button* button)
void KeyMappingEditorComponent::changeListenerCallback (void*)
{
ScopedPointer <XmlElement> openness (tree->getOpennessState (true));
ScopedPointer <XmlElement> oldOpenness (tree->getOpennessState (true));
clearSubItems();
@ -400,8 +399,8 @@ void KeyMappingEditorComponent::changeListenerCallback (void*)
addSubItem (new KeyCategoryTreeViewItem (this, categories[i]));
}
if (openness != 0)
tree->restoreOpennessState (*openness);
if (oldOpenness != 0)
tree->restoreOpennessState (*oldOpenness);
}
//==============================================================================

View file

@ -50,14 +50,14 @@ public:
{
}
void paintButton (Graphics& g, bool isMouseOver, bool isMouseDown)
void paintButton (Graphics& g, bool over, bool down)
{
getLookAndFeel()
.drawScrollbarButton (g, owner,
getWidth(), getHeight(),
direction,
owner.isVertical(),
isMouseOver, isMouseDown);
over, down);
}
void clicked()

View file

@ -36,8 +36,8 @@ class TabCompButtonBar : public TabbedButtonBar
{
public:
TabCompButtonBar (TabbedComponent* const owner_,
const TabbedButtonBar::Orientation orientation)
: TabbedButtonBar (orientation),
const TabbedButtonBar::Orientation orientation_)
: TabbedButtonBar (orientation_),
owner (owner_)
{
}

View file

@ -228,7 +228,7 @@ public:
}
/** @internal */
bool hitTest (int x, int y) { return false; }
bool hitTest (int, int) { return false; }
//==============================================================================
juce_UseDebuggingNewOperator

View file

@ -124,12 +124,12 @@ public:
for (int y = 0; y < height; ++y)
{
const float v = 1.0f - y / (float) height;
const float val = 1.0f - y / (float) height;
for (int x = 0; x < width; ++x)
{
const float s = x / (float) width;
const Colour col (h, s, v, 1.0f);
const float sat = x / (float) width;
const Colour col (h, sat, val, 1.0f);
PixelRGB* const pix = (PixelRGB*) pixels.getPixelPointer (x, y);
pix->set (col.getPixelARGB());
@ -149,10 +149,10 @@ public:
void mouseDrag (const MouseEvent& e)
{
const float s = (e.x - edge) / (float) (getWidth() - edge * 2);
const float v = 1.0f - (e.y - edge) / (float) (getHeight() - edge * 2);
const float sat = (e.x - edge) / (float) (getWidth() - edge * 2);
const float val = 1.0f - (e.y - edge) / (float) (getHeight() - edge * 2);
owner->setSV (s, v);
owner->setSV (sat, val);
}
void updateIfNeeded()
@ -486,16 +486,16 @@ void ColourSelector::paint (Graphics& g)
if ((flags & showColourAtTop) != 0)
{
const Colour colour (getCurrentColour());
const Colour currentColour (getCurrentColour());
g.fillCheckerBoard (edgeGap, edgeGap, getWidth() - edgeGap - edgeGap, topSpace - edgeGap - edgeGap,
10, 10,
Colour (0xffdddddd).overlaidWith (colour),
Colour (0xffffffff).overlaidWith (colour));
Colour (0xffdddddd).overlaidWith (currentColour),
Colour (0xffffffff).overlaidWith (currentColour));
g.setColour (Colours::white.overlaidWith (colour).contrasting());
g.setColour (Colours::white.overlaidWith (currentColour).contrasting());
g.setFont (14.0f, true);
g.drawText (colour.toDisplayString ((flags & showAlphaChannel) != 0),
g.drawText (currentColour.toDisplayString ((flags & showAlphaChannel) != 0),
0, edgeGap, getWidth(), topSpace - edgeGap * 2,
Justification::centred, false);
}

View file

@ -204,7 +204,7 @@ void MidiKeyboardComponent::setVelocity (const float velocity_, const bool useMo
}
//==============================================================================
void MidiKeyboardComponent::getKeyPosition (int midiNoteNumber, const float keyWidth, int& x, int& w) const
void MidiKeyboardComponent::getKeyPosition (int midiNoteNumber, const float keyWidth_, int& x, int& w) const
{
jassert (midiNoteNumber >= 0 && midiNoteNumber < 128);
@ -227,8 +227,8 @@ void MidiKeyboardComponent::getKeyPosition (int midiNoteNumber, const float keyW
const int octave = midiNoteNumber / 12;
const int note = midiNoteNumber % 12;
x = roundToInt (octave * 7.0f * keyWidth + notePos [note] * keyWidth);
w = roundToInt (widths [note] * keyWidth);
x = roundToInt (octave * 7.0f * keyWidth_ + notePos [note] * keyWidth_);
w = roundToInt (widths [note] * keyWidth_);
}
void MidiKeyboardComponent::getKeyPos (int midiNoteNumber, int& x, int& w) const
@ -551,7 +551,7 @@ const String MidiKeyboardComponent::getWhiteNoteText (const int midiNoteNumber)
}
void MidiKeyboardComponent::drawUpDownButton (Graphics& g, int w, int h,
const bool isMouseOver,
const bool isMouseOver_,
const bool isButtonDown,
const bool movesOctavesUp)
{
@ -574,7 +574,7 @@ void MidiKeyboardComponent::drawUpDownButton (Graphics& g, int w, int h,
path.applyTransform (AffineTransform::rotation (float_Pi * 2.0f * angle, 0.5f, 0.5f));
g.setColour (findColour (upDownButtonArrowColourId)
.withAlpha (isButtonDown ? 1.0f : (isMouseOver ? 0.6f : 0.4f)));
.withAlpha (isButtonDown ? 1.0f : (isMouseOver_ ? 0.6f : 0.4f)));
g.fillPath (path, path.getTransformToScaleToFit (1.0f, 1.0f,
w - 2.0f,

View file

@ -297,9 +297,9 @@ private:
AlertTextComp& operator= (const AlertTextComp&);
};
void AlertWindow::addTextBlock (const String& text)
void AlertWindow::addTextBlock (const String& textBlock)
{
AlertTextComp* const c = new AlertTextComp (text, font);
AlertTextComp* const c = new AlertTextComp (textBlock, font);
textBlocks.add (c);
allComps.add (c);
@ -519,7 +519,7 @@ void AlertWindow::updateLayout (const bool onlyIncreaseSize)
for (i = 0; i < allComps.size(); ++i)
{
Component* const c = (Component*) allComps[i];
int h = 22;
h = 22;
const int comboIndex = comboBoxes.indexOf (c);
if (comboIndex >= 0 && comboBoxNames [comboIndex].isNotEmpty())
@ -601,10 +601,10 @@ bool AlertWindow::keyPressed (const KeyPress& key)
void AlertWindow::lookAndFeelChanged()
{
const int flags = getLookAndFeel().getAlertBoxWindowFlags();
const int newFlags = getLookAndFeel().getAlertBoxWindowFlags();
setUsingNativeTitleBar ((flags & ComponentPeer::windowHasTitleBar) != 0);
setDropShadowEnabled (isOpaque() && (flags & ComponentPeer::windowHasDropShadow) != 0);
setUsingNativeTitleBar ((newFlags & ComponentPeer::windowHasTitleBar) != 0);
setDropShadowEnabled (isOpaque() && (newFlags & ComponentPeer::windowHasDropShadow) != 0);
}
int AlertWindow::getDesktopWindowStyleFlags() const

View file

@ -304,18 +304,18 @@ Button* DocumentWindow::getMaximiseButton() const throw()
int DocumentWindow::getDesktopWindowStyleFlags() const
{
int flags = ResizableWindow::getDesktopWindowStyleFlags();
int styleFlags = ResizableWindow::getDesktopWindowStyleFlags();
if ((requiredButtons & minimiseButton) != 0)
flags |= ComponentPeer::windowHasMinimiseButton;
styleFlags |= ComponentPeer::windowHasMinimiseButton;
if ((requiredButtons & maximiseButton) != 0)
flags |= ComponentPeer::windowHasMaximiseButton;
styleFlags |= ComponentPeer::windowHasMaximiseButton;
if ((requiredButtons & closeButton) != 0)
flags |= ComponentPeer::windowHasCloseButton;
styleFlags |= ComponentPeer::windowHasCloseButton;
return flags;
return styleFlags;
}
void DocumentWindow::lookAndFeelChanged()

View file

@ -88,12 +88,12 @@ ResizableWindow::~ResizableWindow()
int ResizableWindow::getDesktopWindowStyleFlags() const
{
int flags = TopLevelWindow::getDesktopWindowStyleFlags();
int styleFlags = TopLevelWindow::getDesktopWindowStyleFlags();
if (isResizable() && (flags & ComponentPeer::windowHasTitleBar) != 0)
flags |= ComponentPeer::windowIsResizable;
if (isResizable() && (styleFlags & ComponentPeer::windowHasTitleBar) != 0)
styleFlags |= ComponentPeer::windowIsResizable;
return flags;
return styleFlags;
}
//==============================================================================

View file

@ -202,15 +202,15 @@ void TopLevelWindow::visibilityChanged()
int TopLevelWindow::getDesktopWindowStyleFlags() const
{
int flags = ComponentPeer::windowAppearsOnTaskbar;
int styleFlags = ComponentPeer::windowAppearsOnTaskbar;
if (useDropShadow)
flags |= ComponentPeer::windowHasDropShadow;
styleFlags |= ComponentPeer::windowHasDropShadow;
if (useNativeTitleBar)
flags |= ComponentPeer::windowHasTitleBar;
styleFlags |= ComponentPeer::windowHasTitleBar;
return flags;
return styleFlags;
}
void TopLevelWindow::setDropShadowEnabled (const bool useShadow)