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

Viewport positioning fix. Changed parameters of Viewport::visibleAreaChanged(). Small plugin header fix.

This commit is contained in:
Julian Storer 2011-01-10 12:33:38 +00:00
parent 5d30aecaf2
commit efd1e4c88a
10 changed files with 119 additions and 121 deletions

View file

@ -382,10 +382,6 @@ public:
{
}
~Iterator()
{
}
//==============================================================================
bool next()
{
@ -912,35 +908,31 @@ private:
class TextEditorViewport : public Viewport
{
public:
TextEditorViewport (TextEditor* const owner_)
TextEditorViewport (TextEditor& owner_)
: owner (owner_), lastWordWrapWidth (0), rentrant (false)
{
}
~TextEditorViewport()
{
}
void visibleAreaChanged (int, int, int, int)
void visibleAreaChanged (const Rectangle<int>&)
{
if (! rentrant) // it's rare, but possible to get into a feedback loop as the viewport's scrollbars
// appear and disappear, causing the wrap width to change.
{
const float wordWrapWidth = owner->getWordWrapWidth();
const float wordWrapWidth = owner.getWordWrapWidth();
if (wordWrapWidth != lastWordWrapWidth)
{
lastWordWrapWidth = wordWrapWidth;
rentrant = true;
owner->updateTextHolderSize();
owner.updateTextHolderSize();
rentrant = false;
}
}
}
private:
TextEditor* const owner;
TextEditor& owner;
float lastWordWrapWidth;
bool rentrant;
@ -1000,7 +992,7 @@ TextEditor::TextEditor (const String& name,
{
setOpaque (true);
addAndMakeVisible (viewport = new TextEditorViewport (this));
addAndMakeVisible (viewport = new TextEditorViewport (*this));
viewport->setViewedComponent (textHolder = new TextHolderComponent (*this));
viewport->setWantsKeyboardFocus (false);
viewport->setScrollBarsShown (false, false);