Expander: Smarter window resize
* Rather than enlarging the window on (potentially) every line, simply keep the largest delta and use it only once at the end of the listing. Ref: r33073 and ticket #3797. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33075 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -365,9 +365,8 @@ ExpanderWindow::MessageReceived(BMessage *msg)
|
|||||||
// expand the window if we need...
|
// expand the window if we need...
|
||||||
float delta = fListingText->StringWidth(string.String())
|
float delta = fListingText->StringWidth(string.String())
|
||||||
- fListingText->Frame().Width();
|
- fListingText->Frame().Width();
|
||||||
if (delta > 0) {
|
if (delta > fLargestDelta) {
|
||||||
ResizeTo(Frame().Width() + delta,
|
fLargestDelta = delta;
|
||||||
Frame().Height());
|
|
||||||
}
|
}
|
||||||
fListingText->Insert(string.String());
|
fListingText->Insert(string.String());
|
||||||
}
|
}
|
||||||
@@ -385,6 +384,9 @@ ExpanderWindow::MessageReceived(BMessage *msg)
|
|||||||
} else if (fListingStarted){
|
} else if (fListingStarted){
|
||||||
fSourceChanged = false;
|
fSourceChanged = false;
|
||||||
StopListing();
|
StopListing();
|
||||||
|
if (fLargestDelta > 0.0f)
|
||||||
|
ResizeBy(fLargestDelta, 0.0f);
|
||||||
|
fLargestDelta = 0.0f;
|
||||||
} else
|
} else
|
||||||
fStatusView->SetText("");
|
fStatusView->SetText("");
|
||||||
break;
|
break;
|
||||||
@@ -597,6 +599,8 @@ ExpanderWindow::StartListing()
|
|||||||
{
|
{
|
||||||
_UpdateWindowSize(true);
|
_UpdateWindowSize(true);
|
||||||
|
|
||||||
|
fLargestDelta = 0.0f;
|
||||||
|
|
||||||
if (fListingScroll->IsHidden())
|
if (fListingScroll->IsHidden())
|
||||||
fListingScroll->Show();
|
fListingScroll->Show();
|
||||||
|
|
||||||
|
|||||||
@@ -77,6 +77,8 @@ class ExpanderWindow : public BWindow {
|
|||||||
BMessage fSettings;
|
BMessage fSettings;
|
||||||
ExpanderPreferences *fPreferences;
|
ExpanderPreferences *fPreferences;
|
||||||
ExpanderRules fRules;
|
ExpanderRules fRules;
|
||||||
|
|
||||||
|
float fLargestDelta;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* EXPANDER_WINDOW_H */
|
#endif /* EXPANDER_WINDOW_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user