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
+21 -17
View File
@@ -1115,26 +1115,30 @@ StyledEditWindow::Print(const char* documentName)
lastLine = currentLine - 1;
}
printJob.BeginJob();
int32 printLine = firstLine;
while (printLine < lastLine) {
float currentHeight = 0;
int32 firstLineOnPage = printLine;
while (currentHeight < printableRect.Height() && printLine < lastLine) {
currentHeight += fTextView->LineHeight(printLine);
if (currentHeight < printableRect.Height())
printLine++;
if (fTextView->CountLines() > 0 && fTextView->TextLength() > 0) {
int32 printLine = firstLine;
while (printLine <= lastLine) {
float currentHeight = 0;
int32 firstLineOnPage = printLine;
while (currentHeight < printableRect.Height() && printLine <= lastLine) {
currentHeight += fTextView->LineHeight(printLine);
if (currentHeight < printableRect.Height())
printLine++;
}
float top = 0;
if (firstLineOnPage != 0)
top = fTextView->TextHeight(0, firstLineOnPage - 1);
float bottom = fTextView->TextHeight(0, printLine - 1);
BRect textRect(0.0, top + TEXT_INSET, printableRect.Width(), bottom + TEXT_INSET);
printJob.DrawView(fTextView, textRect, B_ORIGIN);
printJob.SpoolPage();
}
float top = 0;
if (firstLineOnPage != 0)
top = fTextView->TextHeight(0, firstLineOnPage - 1);
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.SpoolPage();
}
printJob.CommitJob();
}