* maintain our own rect while printing, this makes it possible to print all pages e.g. syslog from StyledEdit

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26304 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Karsten Heimrich 2008-07-07 19:10:39 +00:00
parent 3ad86c7ff5
commit f56301c9e8
3 changed files with 24 additions and 9 deletions

View File

@ -30,8 +30,8 @@ enum {
B_VIEW_BLENDING_BIT = 0x00000020,
B_VIEW_SCALE_BIT = 0x00000040,
B_VIEW_FONT_ALIASING_BIT = 0x00000080,
B_VIEW_FRAME_BIT = 0x00000100,
B_VIEW_ORIGIN_BIT = 0x00000200,
B_VIEW_FRAME_BIT = 0x00000100,
B_VIEW_ORIGIN_BIT = 0x00000200,
B_VIEW_PEN_SIZE_BIT = 0x00000400,
B_VIEW_PEN_LOCATION_BIT = 0x00000800,
B_VIEW_LOW_COLOR_BIT = 0x00008000,
@ -101,6 +101,9 @@ class ViewState {
uint32 valid_flags;
// flags used for archiving
uint32 archiving_flags;
// maintain our own rect as seen from the app while printing
BRect print_rect;
};
inline bool
@ -120,7 +123,7 @@ ViewState::IsAllValid() const
struct _array_hdr_{
float startX;
float startY;
float startY;
float endX;
float endY;
rgb_color color;
@ -129,7 +132,7 @@ struct _array_hdr_{
struct _array_data_{
// the max number of points in the array
uint32 maxCount;
// the current number of points in the array
// the current number of points in the array
uint32 count;
// the array of points
_array_hdr_* array;

View File

@ -27,6 +27,7 @@
#include <pr_server.h>
#include <ViewPrivate.h>
#include <stdio.h>
@ -506,9 +507,9 @@ BPrintJob::_RecurseView(BView *view, BPoint origin, BPicture *picture,
BRegion region;
region.Set(BRect(rect.left, rect.top, rect.right, rect.bottom));
view->fState->print_rect = rect;
view->AppendToPicture(picture);
view->fIsPrinting = true;
view->PushState();
view->SetOrigin(origin);
view->ConstrainClippingRegion(&region);
@ -520,9 +521,11 @@ BPrintJob::_RecurseView(BView *view, BPoint origin, BPicture *picture,
view->SetHighColor(highColor);
}
view->fIsPrinting = true;
view->Draw(rect);
view->PopState();
view->fIsPrinting = false;
view->PopState();
view->EndPicture();
BView *child = view->ChildAt(0);
@ -538,13 +541,13 @@ BPrintJob::_RecurseView(BView *view, BPoint origin, BPicture *picture,
if (view->Flags() & B_DRAW_ON_CHILDREN) {
view->AppendToPicture(picture);
view->fIsPrinting = true;
view->PushState();
view->SetOrigin(origin);
view->ConstrainClippingRegion(&region);
view->fIsPrinting = true;
view->DrawAfterChildren(rect);
view->PopState();
view->fIsPrinting = false;
view->PopState();
view->EndPicture();
}
}

View File

@ -639,6 +639,9 @@ BView::Bounds() const
}
}
*/
if (fIsPrinting)
return fState->print_rect;
return fBounds;
}
@ -1506,7 +1509,7 @@ BView::ScrollTo(BPoint where)
// no reason to process this further if no scroll is intended.
if (where.x == fBounds.left && where.y == fBounds.top)
return;
// make sure scrolling is within valid bounds
if (fHorScroller) {
float min, max;
@ -2286,7 +2289,13 @@ BView::GetClippingRegion(BRegion* region) const
// changed, so it is always read from the server
region->MakeEmpty();
if (fOwner) {
if (fIsPrinting && _CheckOwnerLock()) {
region->Set(fState->print_rect);
return;
}
_CheckLockAndSwitchCurrent();
fOwner->fLink->StartMessage(AS_VIEW_GET_CLIP_REGION);