[Igarden-commit] Garden/source/LayoutDB UserTextBox.cpp, 1.11.2.4, 1.11.2.5
Status: Beta
Brought to you by:
jlbedell
|
From: Jeffrey B. <jlb...@us...> - 2008-05-09 13:31:30
|
Update of /cvsroot/igarden/Garden/source/LayoutDB In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv4827/source/LayoutDB Modified Files: Tag: Release_branch_v1 UserTextBox.cpp Log Message: Clip horizontally if the text box is too narrow Index: UserTextBox.cpp =================================================================== RCS file: /cvsroot/igarden/Garden/source/LayoutDB/UserTextBox.cpp,v retrieving revision 1.11.2.4 retrieving revision 1.11.2.5 diff -C2 -d -r1.11.2.4 -r1.11.2.5 *** UserTextBox.cpp 26 Mar 2008 22:21:46 -0000 1.11.2.4 --- UserTextBox.cpp 9 May 2008 13:30:43 -0000 1.11.2.5 *************** *** 192,195 **** --- 192,200 ---- _sizeX = rect.xSize-(2*xInset*_defaultScale); _sizeY = rect.ySize-(2*yInset*_defaultScale); + if(_sizeX < 0) + _sizeX = 0; + if(_sizeY < 0) + _sizeY = 0; + _x = _boundX; _y = _boundY+_sizeY; *************** *** 465,471 **** void UserTextBox::HandleWord(PlanView* view, RGGLBitmapFont *font, const char *txt, long len) { ! double width; ! PRECONDITION(_sizeX > 0.0 && _sizeY > 0.0); while(*txt == '\n' && len > 0) --- 470,476 ---- void UserTextBox::HandleWord(PlanView* view, RGGLBitmapFont *font, const char *txt, long len) { ! double width, origWidth; ! PRECONDITION(_sizeX >= 0.0 && _sizeY >= 0.0); while(*txt == '\n' && len > 0) *************** *** 481,494 **** width = font->StringWidth(txt, len);// * _scaleByPercent/100.0; ! if((_x + (width * view->GetScale()/*_defaultScale*/)) >= (_boundX+_sizeX)) { ! _x = _boundX; ! _y -= _lineHeight * view->GetScale(); } ! if(_y > _boundY) { ! font->DrawCountedString(_x, _y, view->GetScale(), txt, len); ! _x += width * view->GetScale(); //_defaultScale; } } --- 486,506 ---- width = font->StringWidth(txt, len);// * _scaleByPercent/100.0; ! if(_y > _boundY) { ! origWidth = width; ! while((_x + (width * view->GetScale())) > (_boundX+_sizeX)) ! { ! len--; ! width = font->StringWidth(txt, len); ! } ! ! font->DrawCountedString(_x, _y, view->GetScale(), txt, len); ! _x += origWidth * view->GetScale(); //_defaultScale; } ! if((_x + (width * view->GetScale()/*_defaultScale*/)) >= (_boundX+_sizeX)) { ! _x = _boundX; ! _y -= _lineHeight * view->GetScale(); } } |