From 5d81827b2c7e74821b00e8ad546166a00dec1e4b Mon Sep 17 00:00:00 2001 From: Karsten Heimrich Date: Sun, 30 Mar 2008 16:25:23 +0000 Subject: [PATCH] * push the states on the server instead on the client side * DrawState::SetOrigin needs to take the view scaling into account * set the orgin in BPrintJob, to be able to print more then one page properly Note: This would make printing work on HAIKU as on BeOS, but still it does not because of 1; BPortLink size limit and 2; because we can only print/ draw the visible region of a view? I had to resize StyledEdit to a i.e 10000 to test and to be able to print the full syslog. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24682 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/PrintJob.cpp | 3 ++- src/servers/app/DrawState.cpp | 13 +++++++++---- src/servers/app/ServerWindow.cpp | 6 +++++- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/kits/interface/PrintJob.cpp b/src/kits/interface/PrintJob.cpp index 6b8b779b15..5462a26339 100644 --- a/src/kits/interface/PrintJob.cpp +++ b/src/kits/interface/PrintJob.cpp @@ -531,7 +531,7 @@ BPrintJob::DrawView(BView *view, BRect rect, BPoint where) if (view->LockLooper()) { BPicture picture; - _RecurseView(view, where, &picture, rect); + _RecurseView(view, B_ORIGIN - rect.LeftTop(), &picture, rect); _AddPicture(picture, rect, where); view->UnlockLooper(); } @@ -664,6 +664,7 @@ BPrintJob::_RecurseView(BView *view, BPoint origin, view->AppendToPicture(picture); view->f_is_printing = true; view->PushState(); + view->SetOrigin(origin); view->Draw(rect); view->PopState(); view->f_is_printing = false; diff --git a/src/servers/app/DrawState.cpp b/src/servers/app/DrawState.cpp index 8cfa17054d..8e2f3bc6fe 100644 --- a/src/servers/app/DrawState.cpp +++ b/src/servers/app/DrawState.cpp @@ -283,10 +283,15 @@ DrawState::SetOrigin(const BPoint& origin) // NOTE: the origins of earlier states are never expected to // change, only the topmost state ever changes - if (fPreviousState) - fCombinedOrigin = fPreviousState->fCombinedOrigin + fOrigin; - else - fCombinedOrigin = fOrigin; + if (fPreviousState) { + fCombinedOrigin.x = fPreviousState->fCombinedOrigin.x + + fOrigin.x * fPreviousState->fCombinedScale; + fCombinedOrigin.y = fPreviousState->fCombinedOrigin.y + + fOrigin.y * fPreviousState->fCombinedScale; + } else { + fCombinedOrigin.x = fOrigin.x * fCombinedScale; + fCombinedOrigin.y = fOrigin.y * fCombinedScale; + } } diff --git a/src/servers/app/ServerWindow.cpp b/src/servers/app/ServerWindow.cpp index 31a3e8e149..b9aefc9168 100644 --- a/src/servers/app/ServerWindow.cpp +++ b/src/servers/app/ServerWindow.cpp @@ -2364,8 +2364,12 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code, BPrivate::LinkReceiver &li ServerPicture *picture = App()->FindPicture(token); if (picture != NULL) { - fCurrentView->CurrentState()->SetOrigin(where); + fCurrentView->PushState(); + fCurrentView->SetDrawingOrigin(where); + fCurrentView->PushState(); picture->Play(fCurrentView); + fCurrentView->PopState(); + fCurrentView->PopState(); } } break;