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:
parent
c0a72ca298
commit
8b93f21c22
@ -365,9 +365,8 @@ ExpanderWindow::MessageReceived(BMessage *msg)
|
||||
// expand the window if we need...
|
||||
float delta = fListingText->StringWidth(string.String())
|
||||
- fListingText->Frame().Width();
|
||||
if (delta > 0) {
|
||||
ResizeTo(Frame().Width() + delta,
|
||||
Frame().Height());
|
||||
if (delta > fLargestDelta) {
|
||||
fLargestDelta = delta;
|
||||
}
|
||||
fListingText->Insert(string.String());
|
||||
}
|
||||
@ -385,6 +384,9 @@ ExpanderWindow::MessageReceived(BMessage *msg)
|
||||
} else if (fListingStarted){
|
||||
fSourceChanged = false;
|
||||
StopListing();
|
||||
if (fLargestDelta > 0.0f)
|
||||
ResizeBy(fLargestDelta, 0.0f);
|
||||
fLargestDelta = 0.0f;
|
||||
} else
|
||||
fStatusView->SetText("");
|
||||
break;
|
||||
@ -597,6 +599,8 @@ ExpanderWindow::StartListing()
|
||||
{
|
||||
_UpdateWindowSize(true);
|
||||
|
||||
fLargestDelta = 0.0f;
|
||||
|
||||
if (fListingScroll->IsHidden())
|
||||
fListingScroll->Show();
|
||||
|
||||
|
@ -77,6 +77,8 @@ class ExpanderWindow : public BWindow {
|
||||
BMessage fSettings;
|
||||
ExpanderPreferences *fPreferences;
|
||||
ExpanderRules fRules;
|
||||
|
||||
float fLargestDelta;
|
||||
};
|
||||
|
||||
#endif /* EXPANDER_WINDOW_H */
|
||||
|
Loading…
Reference in New Issue
Block a user