From 032f7656032833ff0279dcf4844871d13d23affa Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Thu, 7 Feb 2008 15:06:30 +0000 Subject: [PATCH] Also set the scrollbar steps when the terminal size changes. Moved SetFlags() from _InitObject() to unarchiving constructor as other constructors already set the flags. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23914 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/terminal/TermView.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/apps/terminal/TermView.cpp b/src/apps/terminal/TermView.cpp index 087019c69e..7459998d83 100644 --- a/src/apps/terminal/TermView.cpp +++ b/src/apps/terminal/TermView.cpp @@ -235,6 +235,9 @@ TermView::TermView(BMessage *archive) if (archive->FindInt32("rows", (int32 *)&fTermRows) < B_OK) fTermRows = ROWS_DEFAULT; + // We need this + SetFlags(Flags() | B_WILL_DRAW | B_PULSE_NEEDED); + // TODO: Retrieve arguments, colors, history size, etc. from archive _InitObject(0, NULL); } @@ -266,8 +269,6 @@ TermView::_InitObject(int32 argc, const char **argv) if (status < B_OK) return status; - // We need this - SetFlags(Flags() | B_WILL_DRAW | B_PULSE_NEEDED); SetLowColor(fTextBackColor); SetViewColor(fTextBackColor); @@ -364,6 +365,9 @@ TermView::SetTermSize(int rows, int cols, bool resize) if (resize) ResizeTo(rect.Width(), rect.Height()); + if (fScrollBar != NULL) + fScrollBar->SetSteps(fFontHeight, fFontHeight * fTermRows); + return rect; } @@ -424,7 +428,6 @@ TermView::GetTermFont(BFont *font) const void TermView::SetTermFont(const BFont *font) { - char buf[4]; int halfWidth = 0; fHalfFont = font; @@ -434,6 +437,7 @@ TermView::SetTermFont(const BFont *font) // calculate half font's max width // Not Bounding, check only A-Z(For case of fHalfFont is KanjiFont. ) for (int c = 0x20 ; c <= 0x7e; c++){ + char buf[4]; sprintf(buf, "%c", c); int tmpWidth = (int)fHalfFont.StringWidth(buf); if (tmpWidth > halfWidth)