Linker error and new function.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@38098 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2014-09-28 01:12:31 +00:00
parent b28fde9173
commit ce5923f681
3 changed files with 79 additions and 3 deletions

View file

@ -1,3 +1,11 @@
2014-09-27 12:19-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Printing/GSWIN32/GSWIN32PrinterOperation.m: Addition of function
to output to printer directly.
* Printing/GSWIN32/GNUmakefile: Change to correct linker issue
winspool was not being linked in the proper place so it was
causing unresolved references.
2014-09-16 12:19-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Source/GSPrinting.m: Reorder printing backend load order.

View file

@ -18,7 +18,7 @@ ADDITIONAL_INCLUDE_DIRS += -I../../Headers/Additions -I../../Headers \
-I../../Source/$(GNUSTEP_TARGET_DIR)
# Additional LDFLAGS to pass to the linker
ADDITIONAL_LDFLAGS += -lwinspool
ADDITIONAL_LDFLAGS +=
# Additional library directories the linker should search
ADDITIONAL_LIB_DIRS += -L../../Source/$(GNUSTEP_OBJ_DIR)
@ -32,7 +32,7 @@ ADDITIONAL_GUI_LIBS +=
# Libraries
ADDITIONAL_LIBRARY_LIBS +=
# ObjC stuff
ADDITIONAL_OBJC_LIBS +=
ADDITIONAL_OBJC_LIBS += -lwinspool
#-lgnustep-gui $(SYSTEM_LIBS)
# Tools
ADDITIONAL_TOOL_LIBS +=

View file

@ -51,6 +51,75 @@
#import "GSGuiPrivate.h"
#import "GSWIN32PrintOperation.h"
BOOL RawDataToPrinter(LPSTR szPrinterName, LPBYTE lpData, DWORD dwCount)
{
HANDLE hPrinter;
DOC_INFO_1 DocInfo;
DWORD dwJob;
DWORD dwBytesWritten;
// Need a handle to the printer.
if( ! OpenPrinter( szPrinterName, &hPrinter, NULL ) )
{
return FALSE;
}
// Fill in the structure with info about this "document."
DocInfo.pDocName = "My Document";
DocInfo.pOutputFile = NULL;
DocInfo.pDatatype = "RAW";
// Inform the spooler the document is beginning.
if( (dwJob = StartDocPrinter( hPrinter, 1, (LPSTR)&DocInfo )) == 0 )
{
ClosePrinter( hPrinter );
return FALSE;
}
// Start a page.
if( ! StartPagePrinter( hPrinter ) )
{
EndDocPrinter( hPrinter );
ClosePrinter( hPrinter );
return FALSE;
}
// Send the data to the printer.
if( ! WritePrinter( hPrinter, lpData, dwCount, &dwBytesWritten ) )
{
EndPagePrinter( hPrinter );
EndDocPrinter( hPrinter );
ClosePrinter( hPrinter );
return FALSE;
}
// End the page.
if( ! EndPagePrinter( hPrinter ) )
{
EndDocPrinter( hPrinter );
ClosePrinter( hPrinter );
return FALSE;
}
// Inform the spooler that the document is ending.
if( ! EndDocPrinter( hPrinter ) )
{
ClosePrinter( hPrinter );
return FALSE;
}
// Tidy up the printer handle.
ClosePrinter( hPrinter );
// Check to see if correct number of bytes were written.
if( dwBytesWritten != dwCount )
{
return FALSE;
}
return TRUE;
}
//A subclass of GSPrintOperation, NOT NSPrintOperation.
@implementation GSWIN32PrintOperation
//
@ -61,7 +130,6 @@
return NSAllocateObject(self, 0, zone);
}
- (id)initWithView:(NSView *)aView
printInfo:(NSPrintInfo *)aPrintInfo
{