mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-06 04:00:08 +00:00
Minor clean-ups.
This commit is contained in:
parent
0fe89aa299
commit
af73276aea
16 changed files with 146 additions and 159 deletions
|
|
@ -216,7 +216,6 @@ public:
|
|||
}
|
||||
|
||||
/** Returns the object that this pointer references.
|
||||
|
||||
The pointer returned may be zero, of course.
|
||||
*/
|
||||
inline operator ReferenceCountedObjectClass*() const throw()
|
||||
|
|
@ -242,6 +241,13 @@ public:
|
|||
return referencedObject;
|
||||
}
|
||||
|
||||
/** Returns the object that this pointer references.
|
||||
The pointer returned may be zero, of course.
|
||||
*/
|
||||
inline ReferenceCountedObjectClass* getObject() const throw()
|
||||
{
|
||||
return referencedObject;
|
||||
}
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -95,10 +95,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)
|
||||
|
|
@ -106,7 +103,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
|
||||
|
|
|
|||
|
|
@ -87,7 +87,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);
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ struct TextAtom
|
|||
|
||||
//==============================================================================
|
||||
// a run of text with a single font and colour
|
||||
class UniformTextSection
|
||||
class TextEditor::UniformTextSection
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
|
|
@ -92,7 +92,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()
|
||||
|
|
@ -113,16 +113,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)
|
||||
|
|
@ -256,7 +256,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));
|
||||
}
|
||||
}
|
||||
|
|
@ -269,7 +269,7 @@ public:
|
|||
Colour colour;
|
||||
|
||||
private:
|
||||
VoidArray atoms;
|
||||
Array <TextAtom*> atoms;
|
||||
|
||||
//==============================================================================
|
||||
void initialiseAtoms (const String& textToParse,
|
||||
|
|
@ -333,13 +333,13 @@ private:
|
|||
};
|
||||
|
||||
//==============================================================================
|
||||
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),
|
||||
|
|
@ -358,14 +358,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),
|
||||
|
|
@ -383,7 +383,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
~TextEditorIterator()
|
||||
~Iterator()
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -441,7 +441,7 @@ public:
|
|||
}
|
||||
|
||||
atomIndex = 0;
|
||||
currentSection = (const UniformTextSection*) sections.getUnchecked (sectionIndex);
|
||||
currentSection = sections.getUnchecked (sectionIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -457,7 +457,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;
|
||||
|
|
@ -540,7 +540,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();
|
||||
|
|
@ -560,7 +560,7 @@ public:
|
|||
break;
|
||||
|
||||
tempAtomIndex = 0;
|
||||
section = (const UniformTextSection*) sections.getUnchecked (tempSectionIndex);
|
||||
section = sections.getUnchecked (tempSectionIndex);
|
||||
checkSize = true;
|
||||
}
|
||||
|
||||
|
|
@ -727,13 +727,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()
|
||||
{
|
||||
|
|
@ -757,7 +757,7 @@ private:
|
|||
|
||||
|
||||
//==============================================================================
|
||||
class TextEditorInsertAction : public UndoableAction
|
||||
class TextEditor::InsertAction : public UndoableAction
|
||||
{
|
||||
TextEditor& owner;
|
||||
const String text;
|
||||
|
|
@ -765,17 +765,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_),
|
||||
|
|
@ -786,7 +786,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
~TextEditorInsertAction()
|
||||
~InsertAction()
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -809,22 +809,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_),
|
||||
|
|
@ -833,11 +833,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;
|
||||
}
|
||||
|
|
@ -861,25 +861,17 @@ 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_)
|
||||
|
|
@ -914,17 +906,17 @@ 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_),
|
||||
|
|
@ -946,6 +938,13 @@ public:
|
|||
owner->updateTextHolderSize();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
TextEditor* const owner;
|
||||
float lastWordWrapWidth;
|
||||
|
||||
TextEditorViewport (const TextEditorViewport&);
|
||||
TextEditorViewport& operator= (const TextEditorViewport&);
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -1113,7 +1112,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;
|
||||
}
|
||||
|
|
@ -1311,7 +1310,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);
|
||||
|
||||
|
|
@ -1429,7 +1428,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);
|
||||
|
|
@ -1665,7 +1664,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())
|
||||
{}
|
||||
|
|
@ -1677,7 +1676,7 @@ void TextEditor::drawContent (Graphics& g)
|
|||
|
||||
selectedTextColour = findColour (highlightedTextColourId);
|
||||
|
||||
TextEditorIterator i2 (i);
|
||||
Iterator i2 (i);
|
||||
|
||||
while (i2.next() && i2.lineY < clip.getBottom())
|
||||
{
|
||||
|
|
@ -2223,13 +2222,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
|
||||
{
|
||||
|
|
@ -2241,7 +2235,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)
|
||||
{
|
||||
|
|
@ -2279,19 +2273,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;
|
||||
}
|
||||
|
|
@ -2300,7 +2294,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;
|
||||
}
|
||||
|
|
@ -2311,7 +2305,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();
|
||||
|
|
@ -2329,7 +2323,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)
|
||||
{
|
||||
|
|
@ -2354,14 +2348,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();
|
||||
|
||||
|
|
@ -2374,11 +2368,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
|
||||
{
|
||||
|
|
@ -2386,7 +2377,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();
|
||||
|
||||
|
|
@ -2427,7 +2418,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;
|
||||
}
|
||||
|
|
@ -2444,7 +2435,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)
|
||||
|
|
@ -2474,7 +2465,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;
|
||||
|
|
@ -2491,7 +2482,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);
|
||||
}
|
||||
|
|
@ -2508,7 +2499,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())
|
||||
{
|
||||
|
|
@ -2589,16 +2580,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)
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@
|
|||
#include "../../../containers/juce_Value.h"
|
||||
#include "../keyboard/juce_TextInputTarget.h"
|
||||
class TextEditor;
|
||||
class TextHolderComponent;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -609,6 +608,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;
|
||||
|
|
@ -637,7 +644,7 @@ private:
|
|||
Font currentFont;
|
||||
mutable int totalNumChars;
|
||||
int caretPosition;
|
||||
VoidArray sections;
|
||||
Array <UniformTextSection*> sections;
|
||||
String textToShowWhenEmpty;
|
||||
Colour colourForTextWhenEmpty;
|
||||
juce_wchar passwordCharacter;
|
||||
|
|
@ -653,15 +660,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();
|
||||
|
|
|
|||
|
|
@ -1321,7 +1321,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()
|
||||
|
|
@ -2092,7 +2092,7 @@ void Component::addMouseListener (MouseListener* const newListener,
|
|||
checkMessageManagerIsLocked
|
||||
|
||||
if (mouseListeners_ == 0)
|
||||
mouseListeners_ = new VoidArray();
|
||||
mouseListeners_ = new Array<MouseListener*>();
|
||||
|
||||
if (! mouseListeners_->contains (newListener))
|
||||
{
|
||||
|
|
@ -2168,7 +2168,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;
|
||||
|
|
@ -2187,7 +2187,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;
|
||||
|
|
@ -2259,7 +2259,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;
|
||||
|
|
@ -2426,7 +2426,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;
|
||||
|
|
@ -2495,7 +2495,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;
|
||||
|
|
@ -2546,7 +2546,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;
|
||||
|
|
@ -2612,7 +2612,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;
|
||||
|
|
@ -2678,7 +2678,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;
|
||||
|
|
@ -2744,7 +2744,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;
|
||||
|
|
|
|||
|
|
@ -2001,7 +2001,7 @@ private:
|
|||
MouseCursor cursor_;
|
||||
ImageEffectFilter* effect_;
|
||||
Image* bufferedImage_;
|
||||
VoidArray* mouseListeners_;
|
||||
Array <MouseListener*>* mouseListeners_;
|
||||
VoidArray* keyListeners_;
|
||||
ListenerList <ComponentListener> componentListeners;
|
||||
NamedValueSet properties;
|
||||
|
|
|
|||
|
|
@ -116,7 +116,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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -340,7 +340,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();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -196,7 +196,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);
|
||||
|
|
@ -204,11 +204,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);
|
||||
|
|
@ -245,7 +245,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
|
||||
|
|
@ -341,7 +341,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;
|
||||
|
|
|
|||
|
|
@ -272,7 +272,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;
|
||||
|
|
@ -290,7 +290,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())
|
||||
|
|
|
|||
|
|
@ -806,13 +806,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)
|
||||
{
|
||||
|
|
@ -1090,7 +1090,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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -485,7 +485,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)
|
||||
{
|
||||
|
|
@ -579,7 +579,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)]);
|
||||
|
|
|
|||
|
|
@ -135,7 +135,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;
|
||||
|
|
@ -149,7 +149,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;
|
||||
|
|
|
|||
|
|
@ -210,7 +210,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;
|
||||
|
|
@ -248,8 +248,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,
|
||||
|
|
@ -263,11 +262,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
|
||||
{
|
||||
|
|
@ -277,19 +273,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;
|
||||
}
|
||||
|
|
@ -302,7 +293,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;
|
||||
|
|
@ -457,9 +448,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;
|
||||
|
|
|
|||
|
|
@ -313,7 +313,7 @@ void* PlatformUtilities::loadDynamicLibrary (const String& name)
|
|||
|
||||
JUCE_TRY
|
||||
{
|
||||
result = (void*) LoadLibrary (name);
|
||||
result = LoadLibrary (name);
|
||||
}
|
||||
JUCE_CATCH_ALL
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue