GSPrinting changes

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@19839 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
cehardin 2004-08-08 01:08:55 +00:00
parent 374c5a85fe
commit 40087b4477
16 changed files with 2640 additions and 1670 deletions

View file

@ -1,3 +1,35 @@
2004-08-08 00:43 Chad Hardin <cehardin@mac.com>
* config.make.in: Added CUPS specific make variables.
* configure: Regenerated.
* configure.ac: Added code to detect the presence of
cups for the new GSCUPS printing backend bundle.
Detects cups but the GSCUPS bundle is not ready yet
so it does not actually try to build anything related
to cups.
* Headers/AppKit/NSPrinter.h:
* Source/NSPrinter.m:
* Printing/GSLPR/GSLPRPrinter.m:
NSPrinter no longer assumes it is PPD specific. However,
it does include a catagory named PPDParsing, which the
backend printing bundles can call to have a PPD file parsed
and placed into NSPrinter's tables. All the PPD parsing code
was taken out of GSLPRPrinter.m. Also, a lot of code format
cleanup was done.
* Printing/GSLPR/GSLPRPrintInfo.m:
* Source/AppKit/NSPrintInfo.m: Moved initWithDictionary: code
out of GSLPR's GSLPRPrintInfo implementation into here.
* Printing/GSLPR/GSLPRPrincipalClass.h: Correct copyright.
* Printing/GSLPR/GSLPRPrincipalClass.m: Correct copyright.
* Printing/GSLPR/GSLPRPrintInfo.h: Fixed reference to NSPrintInfo.
* Printing/GSLPR/GSLPRPrintOperation.h: Fixed referece to
NSPrintOperation.
* Printing/GSLPR/GSLPRPrinter.h: Fixed reference to NSPrinter.
* Panels/English.lproj/GSPageLayout.gorm/objects.gorm: Increased the
size of the panel's title and made it bold.
* Printing/GNUmakefile: Added code to optionally build the (upcoming)
GSCUPS printing backend bundle. Currently it's disabled.
2004-08-07 13:18 Alexander Malmberg <alexander@malmberg.org> 2004-08-07 13:18 Alexander Malmberg <alexander@malmberg.org>
* Source/NSTextView.m (-mouseDown:): Remove -containsAttachments * Source/NSTextView.m (-mouseDown:): Remove -containsAttachments

View file

@ -1,15 +1,15 @@
/* /*
NSPrinter.h NSPrinter.h
Class representing a printer's or printer model's capabilities. Class representing a printer's capabilities.
Copyright (C) 1996, 1997,2004 Free Software Foundation, Inc. Copyright (C) 1996, 1997, 2004 Free Software Foundation, Inc.
Authors: Simon Frankau <sgf@frankau.demon.co.uk> Authors: Simon Frankau <sgf@frankau.demon.co.uk>
Date: June 1997 Date: June 1997
Modified for Printing Backend Support Modified for Printing Backend Support
Author: Chad Hardin <cehardin@mac.com> Author: Chad Hardin <cehardin@mac.com>
Date: June 2004 Date: July 2004
This file is part of the GNUstep GUI Library. This file is part of the GNUstep GUI Library.
@ -49,7 +49,6 @@ typedef enum _NSPrinterTableStatus {
@interface NSPrinter : NSObject <NSCoding> @interface NSPrinter : NSObject <NSCoding>
{ {
NSString *_printerHost, *_printerName, *_printerNote, *_printerType; NSString *_printerHost, *_printerName, *_printerNote, *_printerType;
int _cacheAcceptsBinary, _cacheOutputOrder;
//The way openstep handled NSPrinter was odd, it had a concept of "real" //The way openstep handled NSPrinter was odd, it had a concept of "real"
//printers and //printers and
@ -68,67 +67,88 @@ typedef enum _NSPrinterTableStatus {
//to have been handles by each bundle. See +printerWithType: in NSPrinter.m //to have been handles by each bundle. See +printerWithType: in NSPrinter.m
//BOOL _isRealPrinter; //BOOL _isRealPrinter;
NSMutableDictionary *_PPD; NSMutableDictionary *_tables; //maps the tables, which are
NSMutableDictionary *_PPDOptionTranslation; //NSMutableDictionaries, to their names
NSMutableDictionary *_PPDArgumentTranslation; //(such as PPD, PPDOptionTranslation, etc)
NSMutableDictionary *_PPDOrderDependency;
NSMutableDictionary *_PPDUIConstraints;
} }
// //
// Finding an NSPrinter // Finding an NSPrinter
// //
+ (NSPrinter *)printerWithName:(NSString *)name; + (NSPrinter*) printerWithName: (NSString*) name;
+ (NSPrinter *)printerWithType:(NSString *)type;
+ (NSArray *)printerNames; + (NSPrinter*) printerWithType: (NSString*) type;
+ (NSArray *)printerTypes;
+ (NSArray*) printerNames;
+ (NSArray*) printerTypes;
// //
// Printer Attributes // Printer Attributes
// //
- (NSString *)host; - (NSString*) host;
- (NSString *)name;
- (NSString *)note; - (NSString*) name;
- (NSString *)type;
- (NSString*) note;
- (NSString*) type;
// //
// Retrieving Specific Information // Retrieving Specific Information
// //
- (BOOL)acceptsBinary; - (BOOL) acceptsBinary;
- (NSRect)imageRectForPaper:(NSString *)paperName;
- (NSSize)pageSizeForPaper:(NSString *)paperName; - (NSRect) imageRectForPaper: (NSString*) paperName;
- (BOOL)isColor;
- (BOOL)isFontAvailable:(NSString *)fontName; - (NSSize) pageSizeForPaper: (NSString*) paperName;
- (int)languageLevel;
- (BOOL)isOutputStackInReverseOrder; - (BOOL) isColor;
- (BOOL) isFontAvailable: (NSString*) fontName;
- (int) languageLevel;
- (BOOL) isOutputStackInReverseOrder;
// //
// Querying the NSPrinter Tables // Querying the NSPrinter Tables
// //
- (BOOL)booleanForKey:(NSString *)key - (BOOL) booleanForKey: (NSString*) key
inTable:(NSString *)table; inTable: (NSString*) table;
- (NSDictionary *)deviceDescription;
- (float)floatForKey:(NSString *)key - (NSDictionary*) deviceDescription;
inTable:(NSString *)table;
- (int)intForKey:(NSString *)key - (float) floatForKey: (NSString*) key
inTable:(NSString *)table; inTable: (NSString*) table;
- (NSRect)rectForKey:(NSString *)key
inTable:(NSString *)table; - (int) intForKey: (NSString*) key
- (NSSize)sizeForKey:(NSString *)key inTable: (NSString*) table;
inTable:(NSString *)table;
- (NSString *)stringForKey:(NSString *)key - (NSRect) rectForKey: (NSString*) key
inTable:(NSString *)table; inTable: (NSString*) table;
- (NSArray *)stringListForKey:(NSString *)key
inTable:(NSString *)table; - (NSSize) sizeForKey: (NSString*) key
- (NSPrinterTableStatus)statusForTable:(NSString *)table; inTable: (NSString*) table;
- (BOOL)isKey:(NSString *)key
inTable:(NSString *)table; - (NSString*) stringForKey: (NSString*) key
inTable: (NSString*) table;
- (NSArray*) stringListForKey: (NSString*) key
inTable: (NSString*) table;
- (NSPrinterTableStatus) statusForTable: (NSString*) table;
- (BOOL) isKey: (NSString*) key
inTable: (NSString*) table;
// //
// NSCoding protocol // NSCoding protocol
// //
- (void)encodeWithCoder: (NSCoder *)aCoder; - (void) encodeWithCoder: (NSCoder*) aCoder;
- initWithCoder: (NSCoder *)aDecoder;
- initWithCoder: (NSCoder*) aDecoder;
@end @end
@ -141,20 +161,23 @@ typedef enum _NSPrinterTableStatus {
// //
// Initialisation method used by backend bundles // Initialisation method used by backend bundles
// //
-(id) initWithName:(NSString *)name -(id) initWithName: (NSString*) name
withType:(NSString *)type withType: (NSString*) type
withHost:(NSString *)host withHost: (NSString*) host
withNote:(NSString *)note; withNote: (NSString*) note;
-(id) addValue:(NSString *)value @end
andValueTranslation:(NSString *)valueTranslation
andOptionTranslation:(NSString *)optionTranslation
forKey:(NSString *)key;
-(id) addString: (NSString*) string
forKey: (NSString*) key //
inTable: (NSMutableDictionary*) table; // Have the NSPrinter parse a PPD and put it into its
// tables. Used by the printing backend bundles.
//
@interface NSPrinter (PPDParsing)
-(BOOL) parsePPDAtPath: (NSString*) ppdPath;
@end @end
#endif // _GNUstep_H_NSPrinter #endif // _GNUstep_H_NSPrinter

View file

@ -28,12 +28,20 @@
include $(GNUSTEP_MAKEFILES)/common.make include $(GNUSTEP_MAKEFILES)/common.make
GNUSTEP_LOCAL_ADDITIONAL_MAKEFILES=../gui.make
include ../config.make
include ../Version
# #
# The list of subproject directories # The list of subproject directories
# #
SUBPROJECTS = \ SUBPROJECTS = \
GSLPR GSLPR
ifeq ($(BUILD_GSCUPS), YES)
#SUBPROJECTS += GSCUPS
endif
include $(GNUSTEP_MAKEFILES)/aggregate.make include $(GNUSTEP_MAKEFILES)/aggregate.make

View file

@ -1,25 +1,28 @@
/* /** <title>GSLPRPrincipalClass</title>
Project: GSLPR
Copyright (C) 2004 Free Software Foundation <abstract>Principal class for the GSLPR Bundle.</abstract>
Copyright (C) 2004 Free Software Foundation, Inc.
Author: Chad Hardin <cehardin@mac.com> Author: Chad Hardin <cehardin@mac.com>
Date: June 2004
Created: 2004-06-12 19:40:40 +0000 by Chad Hardin This file is part of the GNUstep GUI Library.
This application is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version. version 2 of the License, or (at your option) any later version.
This application is distributed in the hope that it will be useful, This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details. Library General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; see the file COPYING.LIB.
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA. If not, write to the Free Software Foundation,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef _GSLPRPRINCIPALCLASS_H_ #ifndef _GSLPRPRINCIPALCLASS_H_

View file

@ -1,25 +1,29 @@
/* /*
Project: GSLPR GSLPRPrincipalClass.m
Copyright (C) 2004 Free Software Foundation Principal class for the GSLPR Bundle
Copyright (C) 2004 Free Software Foundation, Inc.
Author: Chad Hardin <cehardin@mac.com> Author: Chad Hardin <cehardin@mac.com>
Date: June 2004
Created: 2004-06-12 19:40:40 +0000 by Chad Hardin This file is part of the GNUstep GUI Library.
This application is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version. version 2 of the License, or (at your option) any later version.
This application is distributed in the hope that it will be useful, This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details. Library General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; see the file COPYING.LIB.
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA. If not, write to the Free Software Foundation,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#include <Foundation/NSDebug.h> #include <Foundation/NSDebug.h>

View file

@ -1,4 +1,4 @@
/** <title>NSPrintInfo</title> /** <title>GSLPRPrintInfo</title>
<abstract>Stores information used in printing.</abstract> <abstract>Stores information used in printing.</abstract>

View file

@ -121,44 +121,4 @@
-(id) initWithDictionary:(NSDictionary *)aDict
{
NSPrinter *printer;
NSString *pageSize;
NSSize size;
NSMutableDictionary *dict;
NSDebugMLLog(@"GPrinting", @"");
self = [super initWithDictionary: nil];
printer = [GSLPRPrintInfo defaultPrinter];
[self setPrinter: printer];
/* Set up other defaults from the printer object */
pageSize = [printer stringForKey: @"DefaultPageSize"
inTable: @"PPD"];
/* FIXME: Need to check for AutoSelect and probably a million other things... */
if (pageSize == nil)
pageSize = @"A4";
[self setPaperName: pageSize];
/* Set default margins. FIXME: Probably should check ImageableArea */
[self setRightMargin: 36];
[self setLeftMargin: 36];
[self setTopMargin: 72];
[self setBottomMargin: 72];
return self;
}
@end @end

View file

@ -1,4 +1,4 @@
/** <title>NSPrintOperation</title> /** <title>GSLPRPrintOperation</title>
<abstract>Controls generation of EPS, PDF or PS print jobs.</abstract> <abstract>Controls generation of EPS, PDF or PS print jobs.</abstract>

View file

@ -1,5 +1,5 @@
/* /*
NSPrinter.h GSLPRPrinter.h
Class representing a printer's or printer model's capabilities. Class representing a printer's or printer model's capabilities.
@ -40,8 +40,6 @@
{ {
} }
@end @end
#endif // _GNUstep_H_GSLPRPrinter #endif // _GNUstep_H_GSLPRPrinter

File diff suppressed because it is too large Load diff

View file

@ -150,7 +150,10 @@ static NSPrintInfo *sharedPrintInfo = nil;
// //
- (id)initWithDictionary:(NSDictionary *)aDict - (id)initWithDictionary:(NSDictionary *)aDict
{ {
[super init]; NSPrinter *printer;
NSString *pageSize;
self = [super init];
_info = [[NSMutableDictionary alloc] init]; _info = [[NSMutableDictionary alloc] init];
@ -167,6 +170,31 @@ static NSPrintInfo *sharedPrintInfo = nil;
[self setOrientation: NSPortraitOrientation]; [self setOrientation: NSPortraitOrientation];
printer = [NSPrintInfo defaultPrinter];
[self setPrinter: printer];
/* Set up other defaults from the printer object */
pageSize = [printer stringForKey: @"DefaultPageSize"
inTable: @"PPD"];
/* FIXME: Need to check for AutoSelect and probably a million other things... */
if (pageSize == nil)
pageSize = @"A4";
[self setPaperName: pageSize];
/* Set default margins. FIXME: Probably should check ImageableArea */
[self setRightMargin: 36];
[self setLeftMargin: 36];
[self setTopMargin: 72];
[self setBottomMargin: 72];
if( aDict != nil ) if( aDict != nil )
{ {
[_info addEntriesFromDictionary: aDict]; [_info addEntriesFromDictionary: aDict];
@ -174,7 +202,6 @@ static NSPrintInfo *sharedPrintInfo = nil;
if([[_info objectForKey: NSPrintPrinter] isKindOfClass: [NSString class]]) if([[_info objectForKey: NSPrintPrinter] isKindOfClass: [NSString class]])
{ {
NSString *printerName; NSString *printerName;
NSPrinter *printer;
printerName = [_info objectForKey: NSPrintPrinter]; printerName = [_info objectForKey: NSPrintPrinter];
printer = [NSPrinter printerWithName: printerName]; printer = [NSPrinter printerWithName: printerName];
@ -188,6 +215,7 @@ static NSPrintInfo *sharedPrintInfo = nil;
return self; return self;
} }
- (void) dealloc - (void) dealloc
{ {
RELEASE(_info); RELEASE(_info);

File diff suppressed because it is too large Load diff

View file

@ -7,3 +7,9 @@ ADDITIONAL_LIB_DIRS += @ADDITIONAL_LIB_DIRS@
ADDITIONAL_DEPENDS = @LIBS@ ADDITIONAL_DEPENDS = @LIBS@
BUILD_GSND=@BUILD_GSND@ BUILD_GSND=@BUILD_GSND@
GSCUPS_CFLAGS = @GSCUPS_CFLAGS@
GSCUPS_LDFLAGS = @GSCUPS_LDFLAGS@
GSCUPS_LIBS = @GSCUPS_LIBS@
GSCUPS_DATADIR = @GSCUPS_DATADIR@
BUILD_GSCUPS = @BUILD_GSCUPS@

1107
configure vendored

File diff suppressed because it is too large Load diff

View file

@ -294,6 +294,61 @@ if test $ac_cv_lib_audiofile_afGetVirtualFrameSize = yes -a $enable_gsnd = yes;
fi fi
AC_SUBST(BUILD_GSND) AC_SUBST(BUILD_GSND)
#--------------------------------------------------------------------
# Find CUPS
#--------------------------------------------------------------------
GSCUPS_CFLAGS=
GSCUPS_LDFLAGS=
GSCUPS_LIBS=
GSCUPS_DATADIR=
BUILD_GSCUPS=NO
AC_ARG_ENABLE(cups,
[ --disable-cups Disable cups printing support],,
enable_cups=yes)
if test $enable_cups = yes; then
BUILD_GSCUPS=YES
AC_CHECK_PROG(have_cups, cups-config, yes, no)
if test $have_cups = no; then
echo "Could not find cups-config program, cups printing support will not be built."
enable_cups=no
BUILD_GSCUPS=NO
else
GSCUPS_CFLAGS=`cups-config --cflags`
GSCUPS_LDFLAGS=`cups-config --ldflags`
GSCUPS_LIBS=`cups-config --libs`
GSCUPS_DATADIR=`cups-config --datadir`
orig_CPPFLAGS="${CPPFLAGS}"
orig_LDFLAGS="${LDFLAGS}"
CPPFLAGS="$GSCUPS_CFLAGS ${CPPFLAGS}"
LDFLAGS="$GSCUPS_LDFLAGS ${LDFLAGS}"
AC_CHECK_HEADERS(cups/cups.h, have_cups=yes, have_cups=no)
if test "$have_cups" = no; then
enable_cups=no
BUILD_GSCUPS=NO
echo "Could not find cups.h, cups printing support will not be built."
fi
AC_CHECK_LIB(cups, cupsServer, have_cups=yes, have_cups=no)
if test "$have_cups" = no; then
enable_cups=no
BUILD_GSCUPS=NO
echo "Could not find the cups library, cups printing support will not be built."
fi
CPPFLAGS="${orig_CPPFLAGS}"
LDFLAGS="${orig_LDFLAGS}"
fi
fi
AC_SUBST(GSCUPS_CFLAGS)
AC_SUBST(GSCUPS_LDFLAGS)
AC_SUBST(GSCUPS_LIBS)
AC_SUBST(GSCUPS_DATADIR)
AC_SUBST(BUILD_GSCUPS)
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Record the version # Record the version
#-------------------------------------------------------------------- #--------------------------------------------------------------------