mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 12:00:52 +00:00
Use correct graphic context for print operations.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@24898 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b6fd63f8bd
commit
dfe4cd8073
3 changed files with 63 additions and 21 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2007-03-19 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSPrintOperation.m (NSView -_endSheet, NSView
|
||||
-_displayPageInRect:atPlacement:withInfo:): Get graphics context
|
||||
from the print operation.
|
||||
* Source/NSView.m (-_lockFocusInContext:inRect:): When not set,
|
||||
get graphics context either from window or from the print operation.
|
||||
* Source/NSView.m (-lockFocusInRect, -lockFocusIfCanDraw): Don't
|
||||
set the graphics context.
|
||||
* Source/NSView.m: For all print methods get the context from
|
||||
the print operation.
|
||||
|
||||
2007-03-17 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSView.m (-setBoundsRotation:): Adjust _bounds ivar to
|
||||
|
|
|
@ -1063,8 +1063,8 @@ scaleRect(NSRect rect, double scale)
|
|||
int currentPage;
|
||||
float xoffset, yoffset, scale;
|
||||
NSString *label;
|
||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
||||
NSGraphicsContext *ctxt = [printOp context];
|
||||
|
||||
currentPage = [printOp currentPage];
|
||||
|
||||
|
@ -1141,12 +1141,13 @@ scaleRect(NSRect rect, double scale)
|
|||
|
||||
- (void) _endSheet
|
||||
{
|
||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
||||
NSGraphicsContext *ctxt = [printOp context];
|
||||
|
||||
if ([printOp isEPSOperation] == NO)
|
||||
DPSPrintf(ctxt, "showpage\n");
|
||||
DPSPrintf(ctxt, "%%%%PageTrailer\n");
|
||||
DPSPrintf(ctxt, "\n");
|
||||
}
|
||||
@end
|
||||
|
||||
@end
|
||||
|
|
|
@ -1742,7 +1742,7 @@ static NSRect convert_rect_using_matrices(NSRect aRect, NSAffineTransform *matri
|
|||
{
|
||||
}
|
||||
|
||||
- (void) _lockFocusInContext: ctxt inRect: (NSRect)rect
|
||||
- (void) _lockFocusInContext: (NSGraphicsContext *)ctxt inRect: (NSRect)rect
|
||||
{
|
||||
NSRect wrect;
|
||||
int window_gstate = 0;
|
||||
|
@ -1757,7 +1757,21 @@ static NSRect convert_rect_using_matrices(NSRect aRect, NSAffineTransform *matri
|
|||
}
|
||||
}
|
||||
|
||||
// FIXME: Set current context?
|
||||
if (ctxt == nil)
|
||||
{
|
||||
if (viewIsPrinting != nil)
|
||||
{
|
||||
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
||||
|
||||
ctxt = [printOp context];
|
||||
}
|
||||
else
|
||||
{
|
||||
ctxt = [_window graphicsContext];
|
||||
}
|
||||
}
|
||||
// FIXME: Set current context
|
||||
|
||||
|
||||
[ctxt lockFocusView: self inRect: rect];
|
||||
wrect = [self convertRect: rect toView: nil];
|
||||
|
@ -1903,7 +1917,7 @@ static NSRect convert_rect_using_matrices(NSRect aRect, NSAffineTransform *matri
|
|||
|
||||
- (void) lockFocusInRect: (NSRect)rect
|
||||
{
|
||||
[self _lockFocusInContext: [_window graphicsContext] inRect: rect];
|
||||
[self _lockFocusInContext: nil inRect: rect];
|
||||
}
|
||||
|
||||
- (void) lockFocus
|
||||
|
@ -1918,7 +1932,7 @@ static NSRect convert_rect_using_matrices(NSRect aRect, NSAffineTransform *matri
|
|||
|
||||
- (BOOL) lockFocusIfCanDraw
|
||||
{
|
||||
return [self lockFocusIfCanDrawInContext: [_window graphicsContext]];
|
||||
return [self lockFocusIfCanDrawInContext: nil];
|
||||
}
|
||||
|
||||
- (BOOL) lockFocusIfCanDrawInContext: (NSGraphicsContext *)context;
|
||||
|
@ -3743,7 +3757,8 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
|||
bBox: (NSRect)pageRect
|
||||
fonts: (NSString*)fontNames
|
||||
{
|
||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
||||
NSGraphicsContext *ctxt = [printOp context];
|
||||
|
||||
if (aString == nil)
|
||||
aString = [[NSNumber numberWithInt: ordinalNum] description];
|
||||
|
@ -3770,8 +3785,8 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
|||
pages: (int)numPages
|
||||
title: (NSString*)aTitle
|
||||
{
|
||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
||||
NSGraphicsContext *ctxt = [printOp context];
|
||||
NSPrintingOrientation orient;
|
||||
BOOL epsOp;
|
||||
|
||||
|
@ -3829,13 +3844,17 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
|||
|
||||
- (void) beginSetup
|
||||
{
|
||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
||||
NSGraphicsContext *ctxt = [printOp context];
|
||||
|
||||
DPSPrintf(ctxt, "%%%%BeginSetup\n");
|
||||
}
|
||||
|
||||
- (void) beginTrailer
|
||||
{
|
||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
||||
NSGraphicsContext *ctxt = [printOp context];
|
||||
|
||||
DPSPrintf(ctxt, "%%%%Trailer\n");
|
||||
}
|
||||
|
||||
|
@ -3849,33 +3868,41 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
|||
|
||||
- (void) endHeaderComments
|
||||
{
|
||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
||||
NSGraphicsContext *ctxt = [printOp context];
|
||||
|
||||
DPSPrintf(ctxt, "%%%%EndComments\n\n");
|
||||
}
|
||||
|
||||
- (void) endPrologue
|
||||
{
|
||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
||||
NSGraphicsContext *ctxt = [printOp context];
|
||||
|
||||
DPSPrintf(ctxt, "%%%%EndProlog\n\n");
|
||||
}
|
||||
|
||||
- (void) endSetup
|
||||
{
|
||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
||||
NSGraphicsContext *ctxt = [printOp context];
|
||||
|
||||
DPSPrintf(ctxt, "%%%%EndSetup\n\n");
|
||||
}
|
||||
|
||||
- (void) endPageSetup
|
||||
{
|
||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
||||
NSGraphicsContext *ctxt = [printOp context];
|
||||
|
||||
DPSPrintf(ctxt, "%%%%EndPageSetup\n");
|
||||
}
|
||||
|
||||
- (void) endPage
|
||||
{
|
||||
int nup;
|
||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
||||
NSGraphicsContext *ctxt = [printOp context];
|
||||
NSDictionary *dict = [[printOp printInfo] dictionary];
|
||||
|
||||
nup = [[dict objectForKey: NSPrintPagesPerSheet] intValue];
|
||||
|
@ -3889,7 +3916,9 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
|||
|
||||
- (void) endTrailer
|
||||
{
|
||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
||||
NSGraphicsContext *ctxt = [printOp context];
|
||||
|
||||
DPSPrintf(ctxt, "%%%%EOF\n");
|
||||
}
|
||||
|
||||
|
@ -3946,10 +3975,10 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
|||
{
|
||||
int first, last, pages, nup;
|
||||
NSRect bbox;
|
||||
NSDictionary *dict;
|
||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
||||
dict = [[printOp printInfo] dictionary];
|
||||
NSGraphicsContext *ctxt = [printOp context];
|
||||
NSDictionary *dict = [[printOp printInfo] dictionary];
|
||||
|
||||
if (printOp == nil)
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
|
@ -4051,8 +4080,8 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
|||
{
|
||||
int first, last, current, pages;
|
||||
NSSet *fontNames;
|
||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
||||
NSGraphicsContext *ctxt = [printOp context];
|
||||
NSDictionary *dict = [[printOp printInfo] dictionary];
|
||||
|
||||
first = [[dict objectForKey: NSPrintFirstPage] intValue];
|
||||
|
|
Loading…
Reference in a new issue