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

Small socket fix. Minor changes to MouseCursor static data.

This commit is contained in:
Julian Storer 2010-04-16 10:04:53 +01:00
parent af73276aea
commit 0490668407
9 changed files with 824 additions and 853 deletions

File diff suppressed because it is too large Load diff

View file

@ -7491,7 +7491,9 @@ bool StreamingSocket::connect (const String& remoteHostName,
void StreamingSocket::close()
{
#if JUCE_WINDOWS
closesocket (handle);
if (handle != SOCKET_ERROR || connected)
closesocket (handle);
connected = false;
#else
if (connected)
@ -7506,7 +7508,8 @@ void StreamingSocket::close()
}
}
::close (handle);
if (handle != -1)
::close (handle);
#endif
hostName = String::empty;
@ -17409,7 +17412,7 @@ ApplicationCommandTarget::CommandTargetMessageInvoker::~CommandTargetMessageInvo
void ApplicationCommandTarget::CommandTargetMessageInvoker::handleMessage (const Message& message)
{
const ScopedPointer <InvocationInfo> info ((InvocationInfo*) message.pointerParameter);
const ScopedPointer <InvocationInfo> info (static_cast <InvocationInfo*> (message.pointerParameter));
owner->tryToInvoke (*info, false);
}
@ -25909,7 +25912,7 @@ void AudioSampleBuffer::readFromAudioReader (AudioFormatReader* reader,
{
for (int j = 0; j < 2; ++j)
{
float* const d = (float*) (chans[j]);
float* const d = reinterpret_cast <float*> (chans[j]);
if (d != 0)
{
@ -36216,7 +36219,7 @@ void SamplerVoice::controllerMoved (const int /*controllerNumber*/,
void SamplerVoice::renderNextBlock (AudioSampleBuffer& outputBuffer, int startSample, int numSamples)
{
const SamplerSound* const playingSound = (SamplerSound*) (SynthesiserSound*) getCurrentlyPlayingSound();
const SamplerSound* const playingSound = static_cast <SamplerSound*> (getCurrentlyPlayingSound().getObject());
if (playingSound != 0)
{
@ -36732,10 +36735,7 @@ void ActionListenerList::sendActionMessage (const String& message) const
const ScopedLock sl (actionListenerLock_);
for (int i = actionListeners_.size(); --i >= 0;)
{
postMessage (new ActionMessage (message,
(ActionListener*) actionListeners_.getUnchecked(i)));
}
postMessage (new ActionMessage (message, static_cast <ActionListener*> (actionListeners_.getUnchecked(i))));
}
void ActionListenerList::handleMessage (const Message& message)
@ -36743,7 +36743,7 @@ void ActionListenerList::handleMessage (const Message& message)
const ActionMessage& am = (const ActionMessage&) message;
if (actionListeners_.contains (am.pointerParameter))
((ActionListener*) am.pointerParameter)->actionListenerCallback (am.message);
static_cast <ActionListener*> (am.pointerParameter)->actionListenerCallback (am.message);
}
END_JUCE_NAMESPACE
@ -36906,7 +36906,7 @@ void ChangeListenerList::sendSynchronousChangeMessage (void* const objectThatHas
for (int i = listeners.size(); --i >= 0;)
{
ChangeListener* const l = (ChangeListener*) listeners.getUnchecked (i);
ChangeListener* const l = static_cast <ChangeListener*> (listeners.getUnchecked (i));
{
const ScopedUnlock tempUnlocker (lock);
@ -39447,7 +39447,7 @@ void Component::internalHierarchyChanged()
void* Component::runModalLoopCallback (void* userData)
{
return (void*) (pointer_sized_int) ((Component*) userData)->runModalLoop();
return (void*) (pointer_sized_int) static_cast <Component*> (userData)->runModalLoop();
}
int Component::runModalLoop()
@ -40201,7 +40201,7 @@ void Component::addMouseListener (MouseListener* const newListener,
checkMessageManagerIsLocked
if (mouseListeners_ == 0)
mouseListeners_ = new VoidArray();
mouseListeners_ = new Array<MouseListener*>();
if (! mouseListeners_->contains (newListener))
{
@ -40276,7 +40276,7 @@ void Component::internalMouseEnter (MouseInputSource& source, const Point<int>&
{
for (int i = mouseListeners_->size(); --i >= 0;)
{
((MouseListener*) mouseListeners_->getUnchecked(i))->mouseEnter (me);
mouseListeners_->getUnchecked(i)->mouseEnter (me);
if (checker.shouldBailOut())
return;
@ -40295,7 +40295,7 @@ void Component::internalMouseEnter (MouseInputSource& source, const Point<int>&
for (int i = p->numDeepMouseListeners; --i >= 0;)
{
((MouseListener*) (p->mouseListeners_->getUnchecked(i)))->mouseEnter (me);
p->mouseListeners_->getUnchecked(i)->mouseEnter (me);
if (checker.shouldBailOut())
return;
@ -40367,7 +40367,7 @@ void Component::internalMouseExit (MouseInputSource& source, const Point<int>& r
for (int i = p->numDeepMouseListeners; --i >= 0;)
{
((MouseListener*) (p->mouseListeners_->getUnchecked (i)))->mouseExit (me);
p->mouseListeners_->getUnchecked (i)->mouseExit (me);
if (checker.shouldBailOut())
return;
@ -40531,7 +40531,7 @@ void Component::internalMouseDown (MouseInputSource& source, const Point<int>& r
for (int i = p->numDeepMouseListeners; --i >= 0;)
{
((MouseListener*) (p->mouseListeners_->getUnchecked (i)))->mouseDown (me);
p->mouseListeners_->getUnchecked (i)->mouseDown (me);
if (checker.shouldBailOut())
return;
@ -40599,7 +40599,7 @@ void Component::internalMouseUp (MouseInputSource& source, const Point<int>& rel
for (int i = p->numDeepMouseListeners; --i >= 0;)
{
((MouseListener*) (p->mouseListeners_->getUnchecked (i)))->mouseUp (me);
p->mouseListeners_->getUnchecked (i)->mouseUp (me);
if (checker.shouldBailOut())
return;
@ -40650,7 +40650,7 @@ void Component::internalMouseUp (MouseInputSource& source, const Point<int>& rel
for (int i = p->numDeepMouseListeners; --i >= 0;)
{
((MouseListener*) (p->mouseListeners_->getUnchecked (i)))->mouseDoubleClick (me);
p->mouseListeners_->getUnchecked (i)->mouseDoubleClick (me);
if (checker.shouldBailOut())
return;
@ -40716,7 +40716,7 @@ void Component::internalMouseDrag (MouseInputSource& source, const Point<int>& r
for (int i = p->numDeepMouseListeners; --i >= 0;)
{
((MouseListener*) (p->mouseListeners_->getUnchecked (i)))->mouseDrag (me);
p->mouseListeners_->getUnchecked (i)->mouseDrag (me);
if (checker.shouldBailOut())
return;
@ -40782,7 +40782,7 @@ void Component::internalMouseMove (MouseInputSource& source, const Point<int>& r
for (int i = p->numDeepMouseListeners; --i >= 0;)
{
((MouseListener*) (p->mouseListeners_->getUnchecked (i)))->mouseMove (me);
p->mouseListeners_->getUnchecked (i)->mouseMove (me);
if (checker.shouldBailOut())
return;
@ -40848,7 +40848,7 @@ void Component::internalMouseWheel (MouseInputSource& source, const Point<int>&
for (int i = p->numDeepMouseListeners; --i >= 0;)
{
((MouseListener*) (p->mouseListeners_->getUnchecked (i)))->mouseWheelMove (me, wheelIncrementX, wheelIncrementY);
p->mouseListeners_->getUnchecked (i)->mouseWheelMove (me, wheelIncrementX, wheelIncrementY);
if (checker.shouldBailOut())
return;
@ -50706,7 +50706,7 @@ struct TextAtom
};
// a run of text with a single font and colour
class UniformTextSection
class TextEditor::UniformTextSection
{
public:
@ -50727,7 +50727,7 @@ public:
atoms.ensureStorageAllocated (other.atoms.size());
for (int i = 0; i < other.atoms.size(); ++i)
atoms.add (new TextAtom (*(const TextAtom*) other.atoms.getUnchecked(i)));
atoms.add (new TextAtom (*other.atoms.getUnchecked(i)));
}
~UniformTextSection()
@ -50748,16 +50748,16 @@ public:
return atoms.size();
}
TextAtom* getAtom (const int index) const
TextAtom* getAtom (const int index) const throw()
{
return (TextAtom*) atoms.getUnchecked (index);
return atoms.getUnchecked (index);
}
void append (const UniformTextSection& other, const juce_wchar passwordCharacter)
{
if (other.atoms.size() > 0)
{
TextAtom* const lastAtom = (TextAtom*) atoms.getLast();
TextAtom* const lastAtom = atoms.getLast();
int i = 0;
if (lastAtom != 0)
@ -50891,7 +50891,7 @@ public:
for (int i = atoms.size(); --i >= 0;)
{
TextAtom* const atom = (TextAtom*) atoms.getUnchecked(i);
TextAtom* const atom = atoms.getUnchecked(i);
atom->width = newFont.getStringWidthFloat (atom->getText (passwordCharacter));
}
}
@ -50903,7 +50903,7 @@ public:
Colour colour;
private:
VoidArray atoms;
Array <TextAtom*> atoms;
void initialiseAtoms (const String& textToParse,
const juce_wchar passwordCharacter)
@ -50965,13 +50965,13 @@ private:
UniformTextSection& operator= (const UniformTextSection& other);
};
class TextEditorIterator
class TextEditor::Iterator
{
public:
TextEditorIterator (const VoidArray& sections_,
const float wordWrapWidth_,
const juce_wchar passwordCharacter_)
Iterator (const Array <UniformTextSection*>& sections_,
const float wordWrapWidth_,
const juce_wchar passwordCharacter_)
: indexInText (0),
lineY (0),
lineHeight (0),
@ -50990,14 +50990,14 @@ public:
if (sections.size() > 0)
{
currentSection = (const UniformTextSection*) sections.getUnchecked (sectionIndex);
currentSection = sections.getUnchecked (sectionIndex);
if (currentSection != 0)
beginNewLine();
}
}
TextEditorIterator (const TextEditorIterator& other)
Iterator (const Iterator& other)
: indexInText (other.indexInText),
lineY (other.lineY),
lineHeight (other.lineHeight),
@ -51015,7 +51015,7 @@ public:
{
}
~TextEditorIterator()
~Iterator()
{
}
@ -51072,7 +51072,7 @@ public:
}
atomIndex = 0;
currentSection = (const UniformTextSection*) sections.getUnchecked (sectionIndex);
currentSection = sections.getUnchecked (sectionIndex);
}
else
{
@ -51088,7 +51088,7 @@ public:
for (int section = sectionIndex + 1; section < sections.size(); ++section)
{
const UniformTextSection* const s = (const UniformTextSection*) sections.getUnchecked (section);
const UniformTextSection* const s = sections.getUnchecked (section);
if (s->getNumAtoms() == 0)
break;
@ -51171,7 +51171,7 @@ public:
int tempSectionIndex = sectionIndex;
int tempAtomIndex = atomIndex;
const UniformTextSection* section = (const UniformTextSection*) sections.getUnchecked (tempSectionIndex);
const UniformTextSection* section = sections.getUnchecked (tempSectionIndex);
lineHeight = section->font.getHeight();
maxDescent = section->font.getDescent();
@ -51191,7 +51191,7 @@ public:
break;
tempAtomIndex = 0;
section = (const UniformTextSection*) sections.getUnchecked (tempSectionIndex);
section = sections.getUnchecked (tempSectionIndex);
checkSize = true;
}
@ -51354,13 +51354,13 @@ public:
const UniformTextSection* currentSection;
private:
const VoidArray& sections;
const Array <UniformTextSection*>& sections;
int sectionIndex, atomIndex;
const float wordWrapWidth;
const juce_wchar passwordCharacter;
TextAtom tempAtom;
TextEditorIterator& operator= (const TextEditorIterator&);
Iterator& operator= (const Iterator&);
void moveToEndOfLastAtom()
{
@ -51382,7 +51382,7 @@ private:
}
};
class TextEditorInsertAction : public UndoableAction
class TextEditor::InsertAction : public UndoableAction
{
TextEditor& owner;
const String text;
@ -51390,17 +51390,17 @@ class TextEditorInsertAction : public UndoableAction
const Font font;
const Colour colour;
TextEditorInsertAction (const TextEditorInsertAction&);
TextEditorInsertAction& operator= (const TextEditorInsertAction&);
InsertAction (const InsertAction&);
InsertAction& operator= (const InsertAction&);
public:
TextEditorInsertAction (TextEditor& owner_,
const String& text_,
const int insertIndex_,
const Font& font_,
const Colour& colour_,
const int oldCaretPos_,
const int newCaretPos_)
InsertAction (TextEditor& owner_,
const String& text_,
const int insertIndex_,
const Font& font_,
const Colour& colour_,
const int oldCaretPos_,
const int newCaretPos_)
: owner (owner_),
text (text_),
insertIndex (insertIndex_),
@ -51411,7 +51411,7 @@ public:
{
}
~TextEditorInsertAction()
~InsertAction()
{
}
@ -51433,22 +51433,22 @@ public:
}
};
class TextEditorRemoveAction : public UndoableAction
class TextEditor::RemoveAction : public UndoableAction
{
TextEditor& owner;
const Range<int> range;
const int oldCaretPos, newCaretPos;
VoidArray removedSections;
Array <UniformTextSection*> removedSections;
TextEditorRemoveAction (const TextEditorRemoveAction&);
TextEditorRemoveAction& operator= (const TextEditorRemoveAction&);
RemoveAction (const RemoveAction&);
RemoveAction& operator= (const RemoveAction&);
public:
TextEditorRemoveAction (TextEditor& owner_,
const Range<int> range_,
const int oldCaretPos_,
const int newCaretPos_,
const VoidArray& removedSections_)
RemoveAction (TextEditor& owner_,
const Range<int> range_,
const int oldCaretPos_,
const int newCaretPos_,
const Array <UniformTextSection*>& removedSections_)
: owner (owner_),
range (range_),
oldCaretPos (oldCaretPos_),
@ -51457,11 +51457,11 @@ public:
{
}
~TextEditorRemoveAction()
~RemoveAction()
{
for (int i = removedSections.size(); --i >= 0;)
{
UniformTextSection* const section = (UniformTextSection*) removedSections.getUnchecked (i);
UniformTextSection* const section = removedSections.getUnchecked (i);
section->clear();
delete section;
}
@ -51485,24 +51485,16 @@ public:
int n = 0;
for (int i = removedSections.size(); --i >= 0;)
{
UniformTextSection* const section = (UniformTextSection*) removedSections.getUnchecked (i);
n += section->getTotalLength();
}
n += removedSections.getUnchecked (i)->getTotalLength();
return n + 16;
}
};
class TextHolderComponent : public Component,
public Timer,
public Value::Listener
class TextEditor::TextHolderComponent : public Component,
public Timer,
public Value::Listener
{
TextEditor& owner;
TextHolderComponent (const TextHolderComponent&);
TextHolderComponent& operator= (const TextHolderComponent&);
public:
TextHolderComponent (TextEditor& owner_)
: owner (owner_)
@ -51537,16 +51529,16 @@ public:
{
owner.textWasChangedByValue();
}
private:
TextEditor& owner;
TextHolderComponent (const TextHolderComponent&);
TextHolderComponent& operator= (const TextHolderComponent&);
};
class TextEditorViewport : public Viewport
{
TextEditor* const owner;
float lastWordWrapWidth;
TextEditorViewport (const TextEditorViewport&);
TextEditorViewport& operator= (const TextEditorViewport&);
public:
TextEditorViewport (TextEditor* const owner_)
: owner (owner_),
@ -51568,6 +51560,13 @@ public:
owner->updateTextHolderSize();
}
}
private:
TextEditor* const owner;
float lastWordWrapWidth;
TextEditorViewport (const TextEditorViewport&);
TextEditorViewport& operator= (const TextEditorViewport&);
};
namespace TextEditorDefs
@ -51730,7 +51729,7 @@ void TextEditor::applyFontToAllText (const Font& newFont)
for (int i = sections.size(); --i >= 0;)
{
UniformTextSection* const uts = (UniformTextSection*) sections.getUnchecked(i);
UniformTextSection* const uts = sections.getUnchecked (i);
uts->setFont (newFont, passwordCharacter);
uts->colour = overallColour;
}
@ -51924,7 +51923,7 @@ void TextEditor::repaintText (const Range<int>& range)
if (wordWrapWidth > 0)
{
TextEditorIterator i (sections, wordWrapWidth, passwordCharacter);
Iterator i (sections, wordWrapWidth, passwordCharacter);
i.getCharPosition (range.getStart(), x, y, lh);
@ -52040,7 +52039,7 @@ void TextEditor::updateTextHolderSize()
{
float maxWidth = 0.0f;
TextEditorIterator i (sections, wordWrapWidth, passwordCharacter);
Iterator i (sections, wordWrapWidth, passwordCharacter);
while (i.next())
maxWidth = jmax (maxWidth, i.atomRight);
@ -52274,7 +52273,7 @@ void TextEditor::drawContent (Graphics& g)
const Rectangle<int> clip (g.getClipBounds());
Colour selectedTextColour;
TextEditorIterator i (sections, wordWrapWidth, passwordCharacter);
Iterator i (sections, wordWrapWidth, passwordCharacter);
while (i.lineY + 200.0 < clip.getY() && i.next())
{}
@ -52286,7 +52285,7 @@ void TextEditor::drawContent (Graphics& g)
selectedTextColour = findColour (highlightedTextColourId);
TextEditorIterator i2 (i);
Iterator i2 (i);
while (i2.next() && i2.lineY < clip.getBottom())
{
@ -52826,13 +52825,8 @@ void TextEditor::insert (const String& text,
if (um->getNumActionsInCurrentTransaction() > TextEditorDefs::maxActionsPerTransaction)
newTransaction();
um->perform (new TextEditorInsertAction (*this,
text,
insertIndex,
font,
colour,
caretPosition,
caretPositionToMoveTo));
um->perform (new InsertAction (*this, text, insertIndex, font, colour,
caretPosition, caretPositionToMoveTo));
}
else
{
@ -52844,7 +52838,7 @@ void TextEditor::insert (const String& text,
for (int i = 0; i < sections.size(); ++i)
{
nextIndex = index + ((UniformTextSection*) sections.getUnchecked(i))->getTotalLength();
nextIndex = index + sections.getUnchecked (i)->getTotalLength();
if (insertIndex == index)
{
@ -52882,19 +52876,19 @@ void TextEditor::insert (const String& text,
}
void TextEditor::reinsert (const int insertIndex,
const VoidArray& sectionsToInsert)
const Array <UniformTextSection*>& sectionsToInsert)
{
int index = 0;
int nextIndex = 0;
for (int i = 0; i < sections.size(); ++i)
{
nextIndex = index + ((UniformTextSection*) sections.getUnchecked(i))->getTotalLength();
nextIndex = index + sections.getUnchecked (i)->getTotalLength();
if (insertIndex == index)
{
for (int j = sectionsToInsert.size(); --j >= 0;)
sections.insert (i, new UniformTextSection (*(UniformTextSection*) sectionsToInsert.getUnchecked(j)));
sections.insert (i, new UniformTextSection (*sectionsToInsert.getUnchecked(j)));
break;
}
@ -52903,7 +52897,7 @@ void TextEditor::reinsert (const int insertIndex,
splitSection (i, insertIndex - index);
for (int j = sectionsToInsert.size(); --j >= 0;)
sections.insert (i + 1, new UniformTextSection (*(UniformTextSection*) sectionsToInsert.getUnchecked(j)));
sections.insert (i + 1, new UniformTextSection (*sectionsToInsert.getUnchecked(j)));
break;
}
@ -52914,7 +52908,7 @@ void TextEditor::reinsert (const int insertIndex,
if (nextIndex == insertIndex)
{
for (int j = 0; j < sectionsToInsert.size(); ++j)
sections.add (new UniformTextSection (*(UniformTextSection*) sectionsToInsert.getUnchecked(j)));
sections.add (new UniformTextSection (*sectionsToInsert.getUnchecked(j)));
}
coalesceSimilarSections();
@ -52932,7 +52926,7 @@ void TextEditor::remove (const Range<int>& range,
for (int i = 0; i < sections.size(); ++i)
{
const int nextIndex = index + ((UniformTextSection*) sections[i])->getTotalLength();
const int nextIndex = index + sections.getUnchecked(i)->getTotalLength();
if (range.getStart() > index && range.getStart() < nextIndex)
{
@ -52957,14 +52951,14 @@ void TextEditor::remove (const Range<int>& range,
if (um != 0)
{
VoidArray removedSections;
Array <UniformTextSection*> removedSections;
for (int i = 0; i < sections.size(); ++i)
{
if (range.getEnd() <= range.getStart())
break;
UniformTextSection* const section = (UniformTextSection*) sections.getUnchecked (i);
UniformTextSection* const section = sections.getUnchecked (i);
const int nextIndex = index + section->getTotalLength();
@ -52977,11 +52971,8 @@ void TextEditor::remove (const Range<int>& range,
if (um->getNumActionsInCurrentTransaction() > TextEditorDefs::maxActionsPerTransaction)
newTransaction();
um->perform (new TextEditorRemoveAction (*this,
range,
caretPosition,
caretPositionToMoveTo,
removedSections));
um->perform (new RemoveAction (*this, range, caretPosition,
caretPositionToMoveTo, removedSections));
}
else
{
@ -52989,7 +52980,7 @@ void TextEditor::remove (const Range<int>& range,
for (int i = 0; i < sections.size(); ++i)
{
UniformTextSection* const section = (UniformTextSection*) sections.getUnchecked (i);
UniformTextSection* const section = sections.getUnchecked (i);
const int nextIndex = index + section->getTotalLength();
@ -53029,7 +53020,7 @@ const String TextEditor::getText() const
String::Concatenator concatenator (t);
for (int i = 0; i < sections.size(); ++i)
((const UniformTextSection*) sections.getUnchecked(i))->appendAllText (concatenator);
sections.getUnchecked (i)->appendAllText (concatenator);
return t;
}
@ -53046,7 +53037,7 @@ const String TextEditor::getTextInRange (const Range<int>& range) const
for (int i = 0; i < sections.size(); ++i)
{
const UniformTextSection* const s = (const UniformTextSection*) sections.getUnchecked(i);
const UniformTextSection* const s = sections.getUnchecked (i);
const int nextIndex = index + s->getTotalLength();
if (range.getStart() < nextIndex)
@ -53076,7 +53067,7 @@ int TextEditor::getTotalNumChars() const
totalNumChars = 0;
for (int i = sections.size(); --i >= 0;)
totalNumChars += ((const UniformTextSection*) sections.getUnchecked(i))->getTotalLength();
totalNumChars += sections.getUnchecked (i)->getTotalLength();
}
return totalNumChars;
@ -53093,7 +53084,7 @@ void TextEditor::getCharPosition (const int index, float& cx, float& cy, float&
if (wordWrapWidth > 0 && sections.size() > 0)
{
TextEditorIterator i (sections, wordWrapWidth, passwordCharacter);
Iterator i (sections, wordWrapWidth, passwordCharacter);
i.getCharPosition (index, cx, cy, lineHeight);
}
@ -53110,7 +53101,7 @@ int TextEditor::indexAtPosition (const float x, const float y)
if (wordWrapWidth > 0)
{
TextEditorIterator i (sections, wordWrapWidth, passwordCharacter);
Iterator i (sections, wordWrapWidth, passwordCharacter);
while (i.next())
{
@ -53188,16 +53179,15 @@ void TextEditor::splitSection (const int sectionIndex,
jassert (sections[sectionIndex] != 0);
sections.insert (sectionIndex + 1,
((UniformTextSection*) sections.getUnchecked (sectionIndex))
->split (charToSplitAt, passwordCharacter));
sections.getUnchecked (sectionIndex)->split (charToSplitAt, passwordCharacter));
}
void TextEditor::coalesceSimilarSections()
{
for (int i = 0; i < sections.size() - 1; ++i)
{
UniformTextSection* const s1 = (UniformTextSection*) sections.getUnchecked (i);
UniformTextSection* const s2 = (UniformTextSection*) sections.getUnchecked (i + 1);
UniformTextSection* const s1 = sections.getUnchecked (i);
UniformTextSection* const s2 = sections.getUnchecked (i + 1);
if (s1->font == s2->font
&& s1->colour == s2->colour)
@ -60307,7 +60297,7 @@ void ComponentMovementWatcher::registerWithParentComps() throw()
void ComponentMovementWatcher::unregister() throw()
{
for (int i = registeredParentComps.size(); --i >= 0;)
((Component*) registeredParentComps.getUnchecked(i))->removeComponentListener (this);
static_cast <Component*> (registeredParentComps.getUnchecked(i))->removeComponentListener (this);
registeredParentComps.clear();
}
@ -67052,7 +67042,7 @@ void MenuBarComponent::mouseUp (const MouseEvent& e)
updateItemUnderMouse (e2.x, e2.y);
if (itemUnderMouse < 0 && dynamic_cast <DummyMenuComponent*> ((Component*) currentPopup) != 0)
if (itemUnderMouse < 0 && dynamic_cast <DummyMenuComponent*> (static_cast <Component*> (currentPopup)) != 0)
hideCurrentMenu();
}
@ -69462,18 +69452,18 @@ public:
static SharedCursorHandle* createStandard (const MouseCursor::StandardCursorType type)
{
const ScopedLock sl (lock);
const ScopedLock sl (getLock());
for (int i = standardCursors.size(); --i >= 0;)
for (int i = getCursors().size(); --i >= 0;)
{
SharedCursorHandle* const sc = standardCursors.getUnchecked(i);
SharedCursorHandle* const sc = getCursors().getUnchecked(i);
if (sc->standardType == type)
return sc->retain();
}
SharedCursorHandle* const sc = new SharedCursorHandle (type);
standardCursors.add (sc);
getCursors().add (sc);
return sc;
}
@ -69489,8 +69479,8 @@ public:
{
if (isStandard)
{
const ScopedLock sl (lock);
standardCursors.removeValue (this);
const ScopedLock sl (getLock());
getCursors().removeValue (this);
}
delete this;
@ -69507,8 +69497,17 @@ private:
const MouseCursor::StandardCursorType standardType;
const bool isStandard;
static CriticalSection lock;
static Array <SharedCursorHandle*> standardCursors;
static CriticalSection& getLock()
{
static CriticalSection lock;
return lock;
}
static Array <SharedCursorHandle*>& getCursors()
{
static Array <SharedCursorHandle*> cursors;
return cursors;
}
~SharedCursorHandle()
{
@ -69518,9 +69517,6 @@ private:
SharedCursorHandle& operator= (const SharedCursorHandle&);
};
CriticalSection MouseCursor::SharedCursorHandle::lock;
Array <MouseCursor::SharedCursorHandle*> MouseCursor::SharedCursorHandle::standardCursors;
MouseCursor::MouseCursor()
: cursorHandle (SharedCursorHandle::createStandard (NormalCursor))
{
@ -188299,7 +188295,7 @@ namespace JPEGHelpers
static void jpegWriteTerminate (j_compress_ptr cinfo)
{
JuceJpegDest* const dest = (JuceJpegDest*) cinfo->dest;
JuceJpegDest* const dest = static_cast <JuceJpegDest*> (cinfo->dest);
const size_t numToWrite = jpegBufferSize - dest->free_in_buffer;
dest->output->write (dest->buffer, (int) numToWrite);
@ -188307,11 +188303,11 @@ namespace JPEGHelpers
static boolean jpegWriteFlush (j_compress_ptr cinfo)
{
JuceJpegDest* const dest = (JuceJpegDest*) cinfo->dest;
JuceJpegDest* const dest = static_cast <JuceJpegDest*> (cinfo->dest);
const int numToWrite = jpegBufferSize;
dest->next_output_byte = (JOCTET*) dest->buffer;
dest->next_output_byte = reinterpret_cast <JOCTET*> (dest->buffer);
dest->free_in_buffer = jpegBufferSize;
return dest->output->write (dest->buffer, numToWrite);
@ -188347,7 +188343,7 @@ Image* juce_loadJPEGImageFromStream (InputStream& in)
jpegDecompStruct.src->resync_to_restart = jpeg_resync_to_restart;
jpegDecompStruct.src->term_source = dummyCallback1;
jpegDecompStruct.src->next_input_byte = (const unsigned char*) mb.getData();
jpegDecompStruct.src->next_input_byte = static_cast <const unsigned char*> (mb.getData());
jpegDecompStruct.src->bytes_in_buffer = mb.getSize();
try
@ -188442,7 +188438,7 @@ bool juce_writeJPEGImageToStream (const Image& image,
dest.output = &out;
HeapBlock <char> tempBuffer (jpegBufferSize);
dest.buffer = (char*) tempBuffer;
dest.buffer = tempBuffer;
dest.next_output_byte = (JOCTET*) dest.buffer;
dest.free_in_buffer = jpegBufferSize;
dest.init_destination = jpegWriteInit;
@ -210997,7 +210993,7 @@ bool juce_writePNGImageToStream (const Image& image, OutputStream& out)
PNG_COMPRESSION_TYPE_BASE,
PNG_FILTER_TYPE_BASE);
HeapBlock <png_byte> rowData (width * 4);
HeapBlock <uint8> rowData (width * 4);
png_color_8 sig_bit;
sig_bit.red = 8;
@ -211015,7 +211011,7 @@ bool juce_writePNGImageToStream (const Image& image, OutputStream& out)
for (int y = 0; y < height; ++y)
{
uint8* dst = (uint8*) rowData;
uint8* dst = rowData;
const uint8* src = srcData.getLinePointer (y);
if (image.hasAlphaChannel())
@ -211780,7 +211776,7 @@ void* PlatformUtilities::loadDynamicLibrary (const String& name)
JUCE_TRY
{
result = (void*) LoadLibrary (name);
result = LoadLibrary (name);
}
JUCE_CATCH_ALL
@ -212877,7 +212873,7 @@ void* juce_openInternetFile (const String& url,
if (bytesToDo > 0
&& ! InternetWriteFile (request,
((const char*) postData.getData()) + bytesSent,
static_cast <const char*> (postData.getData()) + bytesSent,
bytesToDo, &bytesDone))
{
break;
@ -212915,8 +212911,7 @@ void* juce_openInternetFile (const String& url,
int juce_readFromInternetFile (void* handle, void* buffer, int bytesToRead)
{
DWORD bytesRead = 0;
const ConnectionAndRequestStruct* const crs = (const ConnectionAndRequestStruct*) handle;
const ConnectionAndRequestStruct* const crs = static_cast <ConnectionAndRequestStruct*> (handle);
if (crs != 0)
InternetReadFile (crs->request,
@ -212930,11 +212925,8 @@ int juce_seekInInternetFile (void* handle, int newPosition)
{
if (handle != 0)
{
const ConnectionAndRequestStruct* const crs = (const ConnectionAndRequestStruct*) handle;
return InternetSetFilePointer (crs->request,
newPosition, 0,
FILE_BEGIN, 0);
const ConnectionAndRequestStruct* const crs = static_cast <ConnectionAndRequestStruct*> (handle);
return InternetSetFilePointer (crs->request, newPosition, 0, FILE_BEGIN, 0);
}
else
{
@ -212944,19 +212936,14 @@ int juce_seekInInternetFile (void* handle, int newPosition)
int64 juce_getInternetFileContentLength (void* handle)
{
const ConnectionAndRequestStruct* const crs = (const ConnectionAndRequestStruct*) handle;
const ConnectionAndRequestStruct* const crs = static_cast <ConnectionAndRequestStruct*> (handle);
if (crs != 0)
{
DWORD index = 0;
DWORD result = 0;
DWORD size = sizeof (result);
DWORD index = 0, result = 0, size = sizeof (result);
if (HttpQueryInfo (crs->request,
HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER,
&result,
&size,
&index))
if (HttpQueryInfo (crs->request, HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER,
&result, &size, &index))
{
return (int64) result;
}
@ -212969,7 +212956,7 @@ void juce_closeInternetFile (void* handle)
{
if (handle != 0)
{
ConnectionAndRequestStruct* const crs = (ConnectionAndRequestStruct*) handle;
ConnectionAndRequestStruct* const crs = static_cast <ConnectionAndRequestStruct*> (handle);
InternetCloseHandle (crs->request);
InternetCloseHandle (crs->connection);
delete crs;
@ -213122,9 +213109,8 @@ bool PlatformUtilities::launchEmailWithAttachments (const String& targetEmailAdd
message.nRecipCount = 1;
message.lpRecips = &recip;
MemoryBlock mb (sizeof (MapiFileDesc) * filesToAttach.size());
mb.fillWith (0);
MapiFileDesc* files = (MapiFileDesc*) mb.getData();
HeapBlock <MapiFileDesc> files;
files.calloc (filesToAttach.size());
message.nFileCount = filesToAttach.size();
message.lpFiles = files;
@ -239247,7 +239233,7 @@ public:
if (atsFont == 0)
atsFont = ATSFontFindFromPostScriptName ((CFStringRef) [nsFont fontName], kATSOptionFlagsDefault);
fontRef = CGFontCreateWithPlatformFont ((void*) &atsFont);
fontRef = CGFontCreateWithPlatformFont (&atsFont);
const float totalHeight = fabsf ([nsFont ascender]) + fabsf([nsFont descender]);
unitsToHeightScaleFactor = 1.0f / totalHeight;
@ -239261,7 +239247,7 @@ public:
if (atsFont == 0)
atsFont = ATSFontFindFromPostScriptName ((CFStringRef) [nsFont fontName], kATSOptionFlagsDefault);
fontRef = CGFontCreateWithPlatformFont ((void*) &atsFont);
fontRef = CGFontCreateWithPlatformFont (&atsFont);
const float totalHeight = fabsf ([nsFont ascender]) + fabsf([nsFont descender]);
unitsToHeightScaleFactor = 1.0f / totalHeight;
@ -240090,7 +240076,7 @@ public:
state->fontRef = 0;
state->font = newFont;
MacTypeface* mf = dynamic_cast <MacTypeface*> ((Typeface*) state->font.getTypeface());
MacTypeface* mf = dynamic_cast <MacTypeface*> (state->font.getTypeface());
if (mf != 0)
{
@ -240184,7 +240170,7 @@ private:
static void gradientCallback (void* info, const CGFloat* inData, CGFloat* outData)
{
const CoreGraphicsContext* const g = (const CoreGraphicsContext*) info;
const CoreGraphicsContext* const g = static_cast <const CoreGraphicsContext*> (info);
const int index = roundToInt (g->numGradientLookupEntries * inData[0]);
PixelARGB colour (g->gradientLookupTable [jlimit (0, g->numGradientLookupEntries, index)]);
@ -243939,7 +243925,7 @@ public:
if (atsFont == 0)
atsFont = ATSFontFindFromPostScriptName ((CFStringRef) [nsFont fontName], kATSOptionFlagsDefault);
fontRef = CGFontCreateWithPlatformFont ((void*) &atsFont);
fontRef = CGFontCreateWithPlatformFont (&atsFont);
const float totalHeight = fabsf ([nsFont ascender]) + fabsf([nsFont descender]);
unitsToHeightScaleFactor = 1.0f / totalHeight;
@ -243953,7 +243939,7 @@ public:
if (atsFont == 0)
atsFont = ATSFontFindFromPostScriptName ((CFStringRef) [nsFont fontName], kATSOptionFlagsDefault);
fontRef = CGFontCreateWithPlatformFont ((void*) &atsFont);
fontRef = CGFontCreateWithPlatformFont (&atsFont);
const float totalHeight = fabsf ([nsFont ascender]) + fabsf([nsFont descender]);
unitsToHeightScaleFactor = 1.0f / totalHeight;
@ -244782,7 +244768,7 @@ public:
state->fontRef = 0;
state->font = newFont;
MacTypeface* mf = dynamic_cast <MacTypeface*> ((Typeface*) state->font.getTypeface());
MacTypeface* mf = dynamic_cast <MacTypeface*> (state->font.getTypeface());
if (mf != 0)
{
@ -244876,7 +244862,7 @@ private:
static void gradientCallback (void* info, const CGFloat* inData, CGFloat* outData)
{
const CoreGraphicsContext* const g = (const CoreGraphicsContext*) info;
const CoreGraphicsContext* const g = static_cast <const CoreGraphicsContext*> (info);
const int index = roundToInt (g->numGradientLookupEntries * inData[0]);
PixelARGB colour (g->gradientLookupTable [jlimit (0, g->numGradientLookupEntries, index)]);
@ -250808,13 +250794,13 @@ private:
const AudioTimeStamp* inOutputTime,
void* device)
{
((CoreAudioInternal*) device)->audioCallback (inInputData, outOutputData);
static_cast <CoreAudioInternal*> (device)->audioCallback (inInputData, outOutputData);
return noErr;
}
static OSStatus deviceListenerProc (AudioDeviceID /*inDevice*/, UInt32 /*inLine*/, const AudioObjectPropertyAddress* pa, void* inClientData)
{
CoreAudioInternal* const intern = (CoreAudioInternal*) inClientData;
CoreAudioInternal* const intern = static_cast <CoreAudioInternal*> (inClientData);
switch (pa->mSelector)
{
@ -251089,7 +251075,7 @@ private:
static OSStatus hardwareListenerProc (AudioDeviceID /*inDevice*/, UInt32 /*inLine*/, const AudioObjectPropertyAddress* pa, void* inClientData)
{
CoreAudioInternal* const intern = (CoreAudioInternal*) inClientData;
CoreAudioInternal* const intern = static_cast <CoreAudioInternal*> (inClientData);
switch (pa->mSelector)
{

View file

@ -3337,6 +3337,11 @@ public:
return referencedObject;
}
inline ReferenceCountedObjectClass* getObject() const throw()
{
return referencedObject;
}
private:
ReferenceCountedObjectClass* referencedObject;
@ -12773,7 +12778,7 @@ private:
MouseCursor cursor_;
ImageEffectFilter* effect_;
Image* bufferedImage_;
VoidArray* mouseListeners_;
Array <MouseListener*>* mouseListeners_;
VoidArray* keyListeners_;
ListenerList <ComponentListener> componentListeners;
NamedValueSet properties;
@ -16492,7 +16497,6 @@ public:
/*** End of inlined file: juce_TextInputTarget.h ***/
class TextEditor;
class TextHolderComponent;
class JUCE_API TextEditorListener
{
@ -16698,6 +16702,14 @@ protected:
private:
class Iterator;
class UniformTextSection;
class TextHolderComponent;
class InsertAction;
class RemoveAction;
friend class InsertAction;
friend class RemoveAction;
ScopedPointer <Viewport> viewport;
TextHolderComponent* textHolder;
BorderSize borderSize;
@ -16726,7 +16738,7 @@ private:
Font currentFont;
mutable int totalNumChars;
int caretPosition;
VoidArray sections;
Array <UniformTextSection*> sections;
String textToShowWhenEmpty;
Colour colourForTextWhenEmpty;
juce_wchar passwordCharacter;
@ -16742,15 +16754,12 @@ private:
String allowedCharacters;
ListenerList <TextEditorListener> listeners;
friend class TextEditorInsertAction;
friend class TextEditorRemoveAction;
void coalesceSimilarSections();
void splitSection (int sectionIndex, int charToSplitAt);
void clearInternal (UndoManager* um);
void insert (const String& text, int insertIndex, const Font& font,
const Colour& colour, UndoManager* um, int caretPositionToMoveTo);
void reinsert (int insertIndex, const VoidArray& sections);
void reinsert (int insertIndex, const Array <UniformTextSection*>& sections);
void remove (const Range<int>& range, UndoManager* um, int caretPositionToMoveTo);
void getCharPosition (int index, float& x, float& y, float& lineHeight) const;
void updateCaretPosition();

View file

@ -192,7 +192,7 @@ ApplicationCommandTarget::CommandTargetMessageInvoker::~CommandTargetMessageInvo
void ApplicationCommandTarget::CommandTargetMessageInvoker::handleMessage (const Message& message)
{
const ScopedPointer <InvocationInfo> info ((InvocationInfo*) message.pointerParameter);
const ScopedPointer <InvocationInfo> info (static_cast <InvocationInfo*> (message.pointerParameter));
owner->tryToInvoke (*info, false);
}

View file

@ -309,18 +309,6 @@ private:
HeapBlock <AudioBufferList> bufferList;
Handle dataHandle;
/*OSErr readMovieStream (long offset, long size, void* dataPtr)
{
input->setPosition (offset);
input->read (dataPtr, size);
return noErr;
}
static OSErr readMovieStreamProc (long offset, long size, void* dataPtr, void* userRef)
{
return ((QTAudioReader*) userRef)->readMovieStream (offset, size, dataPtr);
}*/
//==============================================================================
void checkThreadIsAttached()
{

View file

@ -607,7 +607,7 @@ void AudioSampleBuffer::readFromAudioReader (AudioFormatReader* reader,
{
for (int j = 0; j < 2; ++j)
{
float* const d = (float*) (chans[j]);
float* const d = reinterpret_cast <float*> (chans[j]);
if (d != 0)
{

View file

@ -170,7 +170,7 @@ void SamplerVoice::controllerMoved (const int /*controllerNumber*/,
//==============================================================================
void SamplerVoice::renderNextBlock (AudioSampleBuffer& outputBuffer, int startSample, int numSamples)
{
const SamplerSound* const playingSound = (SamplerSound*) (SynthesiserSound*) getCurrentlyPlayingSound();
const SamplerSound* const playingSound = static_cast <SamplerSound*> (getCurrentlyPlayingSound().getObject());
if (playingSound != 0)
{

View file

@ -60,18 +60,18 @@ public:
static SharedCursorHandle* createStandard (const MouseCursor::StandardCursorType type)
{
const ScopedLock sl (lock);
const ScopedLock sl (getLock());
for (int i = standardCursors.size(); --i >= 0;)
for (int i = getCursors().size(); --i >= 0;)
{
SharedCursorHandle* const sc = standardCursors.getUnchecked(i);
SharedCursorHandle* const sc = getCursors().getUnchecked(i);
if (sc->standardType == type)
return sc->retain();
}
SharedCursorHandle* const sc = new SharedCursorHandle (type);
standardCursors.add (sc);
getCursors().add (sc);
return sc;
}
@ -87,8 +87,8 @@ public:
{
if (isStandard)
{
const ScopedLock sl (lock);
standardCursors.removeValue (this);
const ScopedLock sl (getLock());
getCursors().removeValue (this);
}
delete this;
@ -107,8 +107,17 @@ private:
const MouseCursor::StandardCursorType standardType;
const bool isStandard;
static CriticalSection lock;
static Array <SharedCursorHandle*> standardCursors;
static CriticalSection& getLock()
{
static CriticalSection lock;
return lock;
}
static Array <SharedCursorHandle*>& getCursors()
{
static Array <SharedCursorHandle*> cursors;
return cursors;
}
~SharedCursorHandle()
{
@ -118,10 +127,6 @@ private:
SharedCursorHandle& operator= (const SharedCursorHandle&);
};
CriticalSection MouseCursor::SharedCursorHandle::lock;
Array <MouseCursor::SharedCursorHandle*> MouseCursor::SharedCursorHandle::standardCursors;
//==============================================================================
MouseCursor::MouseCursor()
: cursorHandle (SharedCursorHandle::createStandard (NormalCursor))

View file

@ -404,7 +404,9 @@ bool StreamingSocket::connect (const String& remoteHostName,
void StreamingSocket::close()
{
#if JUCE_WINDOWS
closesocket (handle);
if (handle != SOCKET_ERROR || connected)
closesocket (handle);
connected = false;
#else
if (connected)
@ -419,7 +421,8 @@ void StreamingSocket::close()
}
}
::close (handle);
if (handle != -1)
::close (handle);
#endif
hostName = String::empty;