StyledEdit didn't print anything if there's only one line (bug #1288).

Note, though, that printing in StyledEdit is still very much broken. 
Often it prints only the current page, for example.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22511 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2007-10-12 07:58:33 +00:00
parent e0049e2c37
commit cbcae6ef9b
+7 -3
View File
@@ -1115,12 +1115,14 @@ StyledEditWindow::Print(const char* documentName)
lastLine = currentLine - 1;
}
printJob.BeginJob();
if (fTextView->CountLines() > 0 && fTextView->TextLength() > 0) {
int32 printLine = firstLine;
while (printLine < lastLine) {
while (printLine <= lastLine) {
float currentHeight = 0;
int32 firstLineOnPage = printLine;
while (currentHeight < printableRect.Height() && printLine < lastLine) {
while (currentHeight < printableRect.Height() && printLine <= lastLine) {
currentHeight += fTextView->LineHeight(printLine);
if (currentHeight < printableRect.Height())
printLine++;
@@ -1132,9 +1134,11 @@ StyledEditWindow::Print(const char* documentName)
float bottom = fTextView->TextHeight(0, printLine - 1);
BRect textRect(0.0, top + TEXT_INSET, printableRect.Width(), bottom + TEXT_INSET);
printJob.DrawView(fTextView, textRect, BPoint(0.0,0.0));
printJob.DrawView(fTextView, textRect, B_ORIGIN);
printJob.SpoolPage();
}
}
printJob.CommitJob();
}