mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 15:51:55 +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
bbc902731f
commit
0332a51d99
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>
|
2007-03-17 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/NSView.m (-setBoundsRotation:): Adjust _bounds ivar to
|
* Source/NSView.m (-setBoundsRotation:): Adjust _bounds ivar to
|
||||||
|
|
|
@ -1063,8 +1063,8 @@ scaleRect(NSRect rect, double scale)
|
||||||
int currentPage;
|
int currentPage;
|
||||||
float xoffset, yoffset, scale;
|
float xoffset, yoffset, scale;
|
||||||
NSString *label;
|
NSString *label;
|
||||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
|
||||||
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
||||||
|
NSGraphicsContext *ctxt = [printOp context];
|
||||||
|
|
||||||
currentPage = [printOp currentPage];
|
currentPage = [printOp currentPage];
|
||||||
|
|
||||||
|
@ -1141,12 +1141,13 @@ scaleRect(NSRect rect, double scale)
|
||||||
|
|
||||||
- (void) _endSheet
|
- (void) _endSheet
|
||||||
{
|
{
|
||||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
|
||||||
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
||||||
|
NSGraphicsContext *ctxt = [printOp context];
|
||||||
|
|
||||||
if ([printOp isEPSOperation] == NO)
|
if ([printOp isEPSOperation] == NO)
|
||||||
DPSPrintf(ctxt, "showpage\n");
|
DPSPrintf(ctxt, "showpage\n");
|
||||||
DPSPrintf(ctxt, "%%%%PageTrailer\n");
|
DPSPrintf(ctxt, "%%%%PageTrailer\n");
|
||||||
DPSPrintf(ctxt, "\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;
|
NSRect wrect;
|
||||||
int window_gstate = 0;
|
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];
|
[ctxt lockFocusView: self inRect: rect];
|
||||||
wrect = [self convertRect: rect toView: nil];
|
wrect = [self convertRect: rect toView: nil];
|
||||||
|
@ -1903,7 +1917,7 @@ static NSRect convert_rect_using_matrices(NSRect aRect, NSAffineTransform *matri
|
||||||
|
|
||||||
- (void) lockFocusInRect: (NSRect)rect
|
- (void) lockFocusInRect: (NSRect)rect
|
||||||
{
|
{
|
||||||
[self _lockFocusInContext: [_window graphicsContext] inRect: rect];
|
[self _lockFocusInContext: nil inRect: rect];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) lockFocus
|
- (void) lockFocus
|
||||||
|
@ -1918,7 +1932,7 @@ static NSRect convert_rect_using_matrices(NSRect aRect, NSAffineTransform *matri
|
||||||
|
|
||||||
- (BOOL) lockFocusIfCanDraw
|
- (BOOL) lockFocusIfCanDraw
|
||||||
{
|
{
|
||||||
return [self lockFocusIfCanDrawInContext: [_window graphicsContext]];
|
return [self lockFocusIfCanDrawInContext: nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) lockFocusIfCanDrawInContext: (NSGraphicsContext *)context;
|
- (BOOL) lockFocusIfCanDrawInContext: (NSGraphicsContext *)context;
|
||||||
|
@ -3743,7 +3757,8 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
||||||
bBox: (NSRect)pageRect
|
bBox: (NSRect)pageRect
|
||||||
fonts: (NSString*)fontNames
|
fonts: (NSString*)fontNames
|
||||||
{
|
{
|
||||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
||||||
|
NSGraphicsContext *ctxt = [printOp context];
|
||||||
|
|
||||||
if (aString == nil)
|
if (aString == nil)
|
||||||
aString = [[NSNumber numberWithInt: ordinalNum] description];
|
aString = [[NSNumber numberWithInt: ordinalNum] description];
|
||||||
|
@ -3770,8 +3785,8 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
||||||
pages: (int)numPages
|
pages: (int)numPages
|
||||||
title: (NSString*)aTitle
|
title: (NSString*)aTitle
|
||||||
{
|
{
|
||||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
|
||||||
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
||||||
|
NSGraphicsContext *ctxt = [printOp context];
|
||||||
NSPrintingOrientation orient;
|
NSPrintingOrientation orient;
|
||||||
BOOL epsOp;
|
BOOL epsOp;
|
||||||
|
|
||||||
|
@ -3829,13 +3844,17 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
||||||
|
|
||||||
- (void) beginSetup
|
- (void) beginSetup
|
||||||
{
|
{
|
||||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
||||||
|
NSGraphicsContext *ctxt = [printOp context];
|
||||||
|
|
||||||
DPSPrintf(ctxt, "%%%%BeginSetup\n");
|
DPSPrintf(ctxt, "%%%%BeginSetup\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) beginTrailer
|
- (void) beginTrailer
|
||||||
{
|
{
|
||||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
||||||
|
NSGraphicsContext *ctxt = [printOp context];
|
||||||
|
|
||||||
DPSPrintf(ctxt, "%%%%Trailer\n");
|
DPSPrintf(ctxt, "%%%%Trailer\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3849,33 +3868,41 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
||||||
|
|
||||||
- (void) endHeaderComments
|
- (void) endHeaderComments
|
||||||
{
|
{
|
||||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
||||||
|
NSGraphicsContext *ctxt = [printOp context];
|
||||||
|
|
||||||
DPSPrintf(ctxt, "%%%%EndComments\n\n");
|
DPSPrintf(ctxt, "%%%%EndComments\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) endPrologue
|
- (void) endPrologue
|
||||||
{
|
{
|
||||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
||||||
|
NSGraphicsContext *ctxt = [printOp context];
|
||||||
|
|
||||||
DPSPrintf(ctxt, "%%%%EndProlog\n\n");
|
DPSPrintf(ctxt, "%%%%EndProlog\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) endSetup
|
- (void) endSetup
|
||||||
{
|
{
|
||||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
||||||
|
NSGraphicsContext *ctxt = [printOp context];
|
||||||
|
|
||||||
DPSPrintf(ctxt, "%%%%EndSetup\n\n");
|
DPSPrintf(ctxt, "%%%%EndSetup\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) endPageSetup
|
- (void) endPageSetup
|
||||||
{
|
{
|
||||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
||||||
|
NSGraphicsContext *ctxt = [printOp context];
|
||||||
|
|
||||||
DPSPrintf(ctxt, "%%%%EndPageSetup\n");
|
DPSPrintf(ctxt, "%%%%EndPageSetup\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) endPage
|
- (void) endPage
|
||||||
{
|
{
|
||||||
int nup;
|
int nup;
|
||||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
|
||||||
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
||||||
|
NSGraphicsContext *ctxt = [printOp context];
|
||||||
NSDictionary *dict = [[printOp printInfo] dictionary];
|
NSDictionary *dict = [[printOp printInfo] dictionary];
|
||||||
|
|
||||||
nup = [[dict objectForKey: NSPrintPagesPerSheet] intValue];
|
nup = [[dict objectForKey: NSPrintPagesPerSheet] intValue];
|
||||||
|
@ -3889,7 +3916,9 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
||||||
|
|
||||||
- (void) endTrailer
|
- (void) endTrailer
|
||||||
{
|
{
|
||||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
||||||
|
NSGraphicsContext *ctxt = [printOp context];
|
||||||
|
|
||||||
DPSPrintf(ctxt, "%%%%EOF\n");
|
DPSPrintf(ctxt, "%%%%EOF\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3946,10 +3975,10 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
||||||
{
|
{
|
||||||
int first, last, pages, nup;
|
int first, last, pages, nup;
|
||||||
NSRect bbox;
|
NSRect bbox;
|
||||||
NSDictionary *dict;
|
|
||||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
|
||||||
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
||||||
dict = [[printOp printInfo] dictionary];
|
NSGraphicsContext *ctxt = [printOp context];
|
||||||
|
NSDictionary *dict = [[printOp printInfo] dictionary];
|
||||||
|
|
||||||
if (printOp == nil)
|
if (printOp == nil)
|
||||||
{
|
{
|
||||||
[NSException raise: NSInternalInconsistencyException
|
[NSException raise: NSInternalInconsistencyException
|
||||||
|
@ -4051,8 +4080,8 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
||||||
{
|
{
|
||||||
int first, last, current, pages;
|
int first, last, current, pages;
|
||||||
NSSet *fontNames;
|
NSSet *fontNames;
|
||||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
|
||||||
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
NSPrintOperation *printOp = [NSPrintOperation currentOperation];
|
||||||
|
NSGraphicsContext *ctxt = [printOp context];
|
||||||
NSDictionary *dict = [[printOp printInfo] dictionary];
|
NSDictionary *dict = [[printOp printInfo] dictionary];
|
||||||
|
|
||||||
first = [[dict objectForKey: NSPrintFirstPage] intValue];
|
first = [[dict objectForKey: NSPrintFirstPage] intValue];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue