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>
* Source/NSTextView.m (-mouseDown:): Remove -containsAttachments

View file

@ -1,15 +1,15 @@
/*
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>
Date: June 1997
Modified for Printing Backend Support
Author: Chad Hardin <cehardin@mac.com>
Date: June 2004
Date: July 2004
This file is part of the GNUstep GUI Library.
@ -49,7 +49,6 @@ typedef enum _NSPrinterTableStatus {
@interface NSPrinter : NSObject <NSCoding>
{
NSString *_printerHost, *_printerName, *_printerNote, *_printerType;
int _cacheAcceptsBinary, _cacheOutputOrder;
//The way openstep handled NSPrinter was odd, it had a concept of "real"
//printers and
@ -67,68 +66,89 @@ typedef enum _NSPrinterTableStatus {
//to put a lot of generic code in ths class that would have otherwise had
//to have been handles by each bundle. See +printerWithType: in NSPrinter.m
//BOOL _isRealPrinter;
NSMutableDictionary *_PPD;
NSMutableDictionary *_PPDOptionTranslation;
NSMutableDictionary *_PPDArgumentTranslation;
NSMutableDictionary *_PPDOrderDependency;
NSMutableDictionary *_PPDUIConstraints;
NSMutableDictionary *_tables; //maps the tables, which are
//NSMutableDictionaries, to their names
//(such as PPD, PPDOptionTranslation, etc)
}
//
// Finding an NSPrinter
//
+ (NSPrinter *)printerWithName:(NSString *)name;
+ (NSPrinter *)printerWithType:(NSString *)type;
+ (NSArray *)printerNames;
+ (NSArray *)printerTypes;
+ (NSPrinter*) printerWithName: (NSString*) name;
+ (NSPrinter*) printerWithType: (NSString*) type;
+ (NSArray*) printerNames;
+ (NSArray*) printerTypes;
//
// Printer Attributes
//
- (NSString *)host;
- (NSString *)name;
- (NSString *)note;
- (NSString *)type;
- (NSString*) host;
- (NSString*) name;
- (NSString*) note;
- (NSString*) type;
//
// Retrieving Specific Information
//
- (BOOL)acceptsBinary;
- (NSRect)imageRectForPaper:(NSString *)paperName;
- (NSSize)pageSizeForPaper:(NSString *)paperName;
- (BOOL)isColor;
- (BOOL)isFontAvailable:(NSString *)fontName;
- (int)languageLevel;
- (BOOL)isOutputStackInReverseOrder;
- (BOOL) acceptsBinary;
- (NSRect) imageRectForPaper: (NSString*) paperName;
- (NSSize) pageSizeForPaper: (NSString*) paperName;
- (BOOL) isColor;
- (BOOL) isFontAvailable: (NSString*) fontName;
- (int) languageLevel;
- (BOOL) isOutputStackInReverseOrder;
//
// Querying the NSPrinter Tables
//
- (BOOL)booleanForKey:(NSString *)key
inTable:(NSString *)table;
- (NSDictionary *)deviceDescription;
- (float)floatForKey:(NSString *)key
inTable:(NSString *)table;
- (int)intForKey:(NSString *)key
inTable:(NSString *)table;
- (NSRect)rectForKey:(NSString *)key
inTable:(NSString *)table;
- (NSSize)sizeForKey:(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;
- (BOOL) booleanForKey: (NSString*) key
inTable: (NSString*) table;
- (NSDictionary*) deviceDescription;
- (float) floatForKey: (NSString*) key
inTable: (NSString*) table;
- (int) intForKey: (NSString*) key
inTable: (NSString*) table;
- (NSRect) rectForKey: (NSString*) key
inTable: (NSString*) table;
- (NSSize) sizeForKey: (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
//
- (void)encodeWithCoder: (NSCoder *)aCoder;
- initWithCoder: (NSCoder *)aDecoder;
- (void) encodeWithCoder: (NSCoder*) aCoder;
- initWithCoder: (NSCoder*) aDecoder;
@end
@ -141,20 +161,23 @@ typedef enum _NSPrinterTableStatus {
//
// Initialisation method used by backend bundles
//
-(id) initWithName:(NSString *)name
withType:(NSString *)type
withHost:(NSString *)host
withNote:(NSString *)note;
-(id) initWithName: (NSString*) name
withType: (NSString*) type
withHost: (NSString*) host
withNote: (NSString*) note;
-(id) addValue:(NSString *)value
andValueTranslation:(NSString *)valueTranslation
andOptionTranslation:(NSString *)optionTranslation
forKey:(NSString *)key;
-(id) addString: (NSString*) string
forKey: (NSString*) key
inTable: (NSMutableDictionary*) table;
@end
//
// 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
#endif // _GNUstep_H_NSPrinter

View file

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

View file

@ -1,26 +1,29 @@
/*
Project: GSLPR
/** <title>GSLPRPrincipalClass</title>
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>
Date: June 2004
This file is part of the GNUstep GUI Library.
Created: 2004-06-12 19:40:40 +0000 by Chad Hardin
This application is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
*/
You should have received a copy of the GNU Library General Public
License along with this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _GSLPRPRINCIPALCLASS_H_
#define _GSLPRPRINCIPALCLASS_H_

View file

@ -1,26 +1,30 @@
/*
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>
Date: June 2004
This file is part of the GNUstep GUI Library.
Created: 2004-06-12 19:40:40 +0000 by Chad Hardin
This application is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
*/
You should have received a copy of the GNU Library General Public
License along with this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <Foundation/NSDebug.h>
#include "GSLPRPrincipalClass.h"

View file

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

View file

@ -119,46 +119,6 @@
}
-(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

View file

@ -1,4 +1,4 @@
/** <title>NSPrintOperation</title>
/** <title>GSLPRPrintOperation</title>
<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.
@ -40,8 +40,6 @@
{
}
@end
#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
{
[super init];
NSPrinter *printer;
NSString *pageSize;
self = [super init];
_info = [[NSMutableDictionary alloc] init];
@ -166,6 +169,31 @@ static NSPrintInfo *sharedPrintInfo = nil;
[self setVerticallyCentered: YES];
[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 )
{
@ -174,7 +202,6 @@ static NSPrintInfo *sharedPrintInfo = nil;
if([[_info objectForKey: NSPrintPrinter] isKindOfClass: [NSString class]])
{
NSString *printerName;
NSPrinter *printer;
printerName = [_info objectForKey: NSPrintPrinter];
printer = [NSPrinter printerWithName: printerName];
@ -188,6 +215,7 @@ static NSPrintInfo *sharedPrintInfo = nil;
return self;
}
- (void) dealloc
{
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@
BUILD_GSND=@BUILD_GSND@
GSCUPS_CFLAGS = @GSCUPS_CFLAGS@
GSCUPS_LDFLAGS = @GSCUPS_LDFLAGS@
GSCUPS_LIBS = @GSCUPS_LIBS@
GSCUPS_DATADIR = @GSCUPS_DATADIR@
BUILD_GSCUPS = @BUILD_GSCUPS@

1425
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
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
#--------------------------------------------------------------------