1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-27 02:20:05 +00:00

The Point and Rectangle classes are now templated, so can be used for either float or int co-ordinates. This means that wherever you've used these classes, you'll need to replace them with Rectangle<int> or Point<float> in your code. A couple of methods in Path have changed to take advantage of the new ability.

This commit is contained in:
Julian Storer 2010-02-07 00:52:30 +00:00
parent 31a102008d
commit 7bc24ae42a
153 changed files with 2258 additions and 2753 deletions

View file

@ -547,7 +547,7 @@ bool CodeDocument::writeToStream (OutputStream& stream)
String temp (lines.getUnchecked(i)->line); // use a copy to avoid bloating the memory footprint of the stored string.
const char* utf8 = temp.toUTF8();
if (! stream.write (utf8, strlen (utf8)))
if (! stream.write (utf8, (int) strlen (utf8)))
return false;
}

View file

@ -63,7 +63,7 @@ public:
startTimer (400);
setVisible (true);
const Rectangle pos (owner.getCharacterBounds (owner.getCaretPos()));
const Rectangle<int> pos (owner.getCharacterBounds (owner.getCaretPos()));
setBounds (pos.getX(), pos.getY(), 2, pos.getHeight());
}
};
@ -388,7 +388,7 @@ void CodeEditorComponent::paint (Graphics& g)
const Colour defaultColour (findColour (CodeEditorComponent::defaultTextColourId));
const Colour highlightColour (findColour (CodeEditorComponent::highlightColourId));
const Rectangle clip (g.getClipBounds());
const Rectangle<int> clip (g.getClipBounds());
const int firstLineToDraw = jmax (0, clip.getY() / lineHeight);
const int lastLineToDraw = jmin (lines.size(), clip.getBottom() / lineHeight + 1);
@ -592,12 +592,12 @@ void CodeEditorComponent::scrollToKeepCaretOnScreen()
scrollToColumn (column);
}
const Rectangle CodeEditorComponent::getCharacterBounds (const CodeDocument::Position& pos) const throw()
const Rectangle<int> CodeEditorComponent::getCharacterBounds (const CodeDocument::Position& pos) const throw()
{
return Rectangle (roundToInt ((gutter - xOffset * charWidth) + indexToColumn (pos.getLineNumber(), pos.getIndexInLine()) * charWidth),
(pos.getLineNumber() - firstLineOnScreen) * lineHeight,
roundToInt (charWidth),
lineHeight);
return Rectangle<int> (roundToInt ((gutter - xOffset * charWidth) + indexToColumn (pos.getLineNumber(), pos.getIndexInLine()) * charWidth),
(pos.getLineNumber() - firstLineOnScreen) * lineHeight,
roundToInt (charWidth),
lineHeight);
}
const CodeDocument::Position CodeEditorComponent::getPositionAt (int x, int y)

View file

@ -102,7 +102,7 @@ public:
/** Returns the on-screen position of a character in the document.
The rectangle returned is relative to this component's top-left origin.
*/
const Rectangle getCharacterBounds (const CodeDocument::Position& pos) const throw();
const Rectangle<int> getCharacterBounds (const CodeDocument::Position& pos) const throw();
/** Finds the character at a given on-screen position.
The co-ordinates are relative to this component's top-left origin.