Load prolog.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@14863 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2002-10-29 03:46:39 +00:00
parent cce683f608
commit 06a5c62fa5
9 changed files with 47 additions and 12 deletions

View file

@ -1,3 +1,12 @@
2002-10-28 Adam Fedor <fedor@gnu.org>
* Source/NSTextView.m (-drawRect:): Don't draw insertion point
when printing.
* PrinterTypes/GSProlog.ps: New file.
* Source/NSView.m (-_loadPrinterProlog): New.
(beginPage:...): Use it.
2002-10-28 Adam Fedor <fedor@gnu.org>
* Source/NSScreen.m (-visibleFrame): Don't include dock

View file

@ -452,11 +452,11 @@ __attribute__((unused));
/* Postscript Client functions */
/* ----------------------------------------------------------------------- */
static inline void
DPSPrintf(GSCTXT *ctxt, char * fmt, ...)
DPSPrintf(GSCTXT *ctxt, const char * fmt, ...)
__attribute__((unused));
static inline void
DPSWriteData(GSCTXT *ctxt, char * buf, unsigned int count)
DPSWriteData(GSCTXT *ctxt, const char * buf, unsigned int count)
__attribute__((unused));
/* ----------------------------------------------------------------------- */
@ -1172,7 +1172,7 @@ GSDrawImage(GSCTXT *ctxt, NSRect rect, void * imageref)
/* Postscript Client functions */
/* ----------------------------------------------------------------------- */
static inline void
DPSPrintf(GSCTXT *ctxt, char * fmt, ...)
DPSPrintf(GSCTXT *ctxt, const char * fmt, ...)
{
va_list ap;
@ -1184,7 +1184,7 @@ DPSPrintf(GSCTXT *ctxt, char * fmt, ...)
}
static inline void
DPSWriteData(GSCTXT *ctxt, char * buf, unsigned int count)
DPSWriteData(GSCTXT *ctxt, const char * buf, unsigned int count)
{
(ctxt->methods->DPSWriteData__)
(ctxt, @selector(DPSWriteData::), buf, count);

View file

@ -357,8 +357,8 @@ APPKIT_EXPORT NSGraphicsContext *GSCurrentContext();
/* ----------------------------------------------------------------------- */
/* Postscript Client functions */
/* ----------------------------------------------------------------------- */
- (void) DPSPrintf: (char *)fmt : (va_list)args;
- (void) DPSWriteData: (char *)buf : (unsigned int)count;
- (void) DPSPrintf: (const char *)fmt : (va_list)args;
- (void) DPSWriteData: (const char *)buf : (unsigned int)count;
@end

View file

@ -41,7 +41,7 @@ Spanish.lproj \
Swedish.lproj
RESOURCE_FILES = Printers
RESOURCE_FILES = Printers GSProlog.ps
-include GNUmakefile.preamble

7
PrinterTypes/GSProlog.ps Normal file
View file

@ -0,0 +1,7 @@
%%LanguageLevel defines
/_GSsetalpha { pop } bind def
/setalpha where
{pop /GSsetalpha /setalpha load def}
{/GSsetalpha /_GSsetalpha load def}
ifelse

View file

@ -1384,14 +1384,14 @@ NSGraphicsContext *GSCurrentContext()
/* ----------------------------------------------------------------------- */
/** Write the string (with printf substitutions) to a PostScript context.
Other output contexts will likely ignore this */
- (void) DPSPrintf: (char *)fmt : (va_list)args
- (void) DPSPrintf: (const char *)fmt : (va_list)args
{
[self subclassResponsibility: _cmd];
}
/** Write the encoded data to a PostScript context.
Other output contexts will likely ignore this */
- (void) DPSWriteData: (char *)buf : (unsigned int)count
- (void) DPSWriteData: (const char *)buf : (unsigned int)count
{
[self subclassResponsibility: _cmd];
}

View file

@ -1231,7 +1231,7 @@ scaleRect(NSRect rect, double scale)
}
else if ([job isEqual: NSPrintSpoolJob])
{
sucess = [self _deliverSpooledResult];
success = [self _deliverSpooledResult];
}
else if ([job isEqual: NSPrintFaxJob])
{

View file

@ -66,6 +66,9 @@
#include <AppKit/NSColorPanel.h>
#include <AppKit/NSAttributedString.h>
/* From NSView.m */
self NSView *viewIsPrinting;
static const int currentVersion = 2;
#define HUGE 1e7
@ -3451,7 +3454,7 @@ afterString in order over charRange. */
if (NSLocationInRange (location, drawnRange)
|| location == NSMaxRange (drawnRange))
{
if (_drawInsertionPointNow)
if (_drawInsertionPointNow && viewIsPrinting != self)
{
[self drawInsertionPointInRect: _insertionPointRect
color: _caret_color

View file

@ -3321,6 +3321,22 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
DPSPrintf(ctxt, "%%%%EOF\n");
}
- (void) _loadPrinterProlog: (NSGraphicsContext *)ctxt
{
NSString *prolog;
prolog = [NSBundle pathForGNUstepResource: @"GSProlog"
ofType: @"ps"
inDirectory: @"PrinterTypes"];
if (prolog == nil)
{
NSLog(@"Cannot find printer prolog file");
return;
}
prolog = [NSString stringWithContentsOfFile: prolog];
DPSPrintf(ctxt, [prolog cString]);
}
/**
Writes header and job information for the PostScript document. This
includes at a minimum, PostScript header information. It may also
@ -3377,7 +3393,7 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
[self endHeaderComments];
DPSPrintf(ctxt, "%%%%BeginProlog\n");
// Prolog goes here !
[self _loadPrinterProlog: ctxt];
[self endPrologue];
if ([printOp isEPSOperation] == NO)
{