New NSPageLayout UI

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@19767 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Chad Hardin 2004-07-22 04:59:09 +00:00
parent c7d52d3fd8
commit 73dbff47ec
18 changed files with 1071 additions and 584 deletions

View file

@ -1,3 +1,26 @@
2004-07-22 04:46 Chad Hardin <cehardin@mac.com>
* Headers/AppKit/NSPageLayout.h: Changed to MVC and a whole new UI.
* Headers/AppKit/NSPrintInfo.h: Format cleanup.
* Headers/AppKit/NSPrintOperation.h: Format cleanup.
* Headers/AppKit/NSPrintPanel.h: Format cleanup.
* Headers/AppKit/NSPrinter.h: Format cleanup.
* Panels/English.lproj/GSPageLayout.gorm/data.classes: New UI.
* Panels/English.lproj/GSPageLayout.gorm/objects.gorm: New UI.
* Printing/GSLPR/GSLPRPrintInfo.m: Format cleanup.
* Printing/GSLPR/GSLPRPrintOperation.m: Format cleanup.
* Printing/GSLPR/GSLPRPrintPanel.m: Format cleanup.
* Printing/GSLPR/GSLPRPrinter.m: Format cleanup.
* Source/GSEPSPrintOperation.m: Format cleanup.
* Source/GSPDFPrintOperation.m: Format cleanup.
* Source/GSPrintOperation.m: Format cleanup.
* Source/GSPrinting.m: Format cleanup.
* Source/NSPageLayout.m: Changed to MVS and a whole new UI.
* Source/NSPrintInfo.m: Format cleanup.
The big thing changed here is that NSPageLayout has a whole new
UI and is MVC based. I have not yet implemented the ability
to create and edit custom papers, that is next.
2004-07-22 00:18 Gregory John Casamento <greg_casamento@yahoo.com>
* Source/GSNibContainer.m: Corrected spelling mistake in comment.

View file

@ -2,10 +2,13 @@
<abstract>Standard panel for querying user about page layout.</abstract>
Copyright (C) 2001 Free Software Foundation, Inc.
Copyright (C) 2001,2004 Free Software Foundation, Inc.
Written By: Adam Fedor <fedor@gnu.org>
Date: Oct 2001
Author: Chad Hardin <cehardin@mac.com>
Date: July 2004
This file is part of the GNUstep GUI Library.
@ -34,25 +37,26 @@
@class NSPrintInfo;
//
// Note: not all of these tags are currently used in the
// NSPageLayout panel, see below for details.
//
enum {
NSPLImageButton = 0,
NSPLTitleField = 1,
NSPLPaperNameButton = 2,
NSPLUnitsButton = 3,
NSPLWidthField = 4, //Not OpenStep, but used in the panel.
NSPLHeightField = 5, //Not OpenStep, but used in the panel.
NSPLOrientationMatrix = 6,
NSPLCancelButton = 7,
NSPLOKButton = 8,
NSPLPageLayout = 9, //Not OpenStep, previously used in this panel.
//Not anymore though, this is now solely in the
//Print Panel. This used to select the number
//of pages printed per sheet of paper. It is
//best kept in the Print Panel only though.
NSPLScaleField = 10, //Not OpenStep, but used in this panel.
NSPLWidthForm = 20, //These were added because they
NSPLHeightForm = 21, //have been seen in OpenStep
NSPLMiniPageView = 22 //Not OpenStep, but used in this panel.
NSPLImageButton = 1, //Used.
NSPLTitleField = 2, //Used.
NSPLPaperNameButton = 3, //Used, only for the standard paper size
//NSPopUpButton though. Not the
//NSPopUpButton used to select custom
//paper sizes.
NSPLUnitsButton = 4, //NOT used.
NSPLWidthField = 5, //NOT used.
NSPLHeightField = 6, //NOT used.
NSPLOrientationMatrix = 7, //Used.
NSPLCancelButton = 8, //Used.
NSPLOKButton = 9, //Used.
NSPLPageLayout = 10, //NOT used.
NSPLScaleField = 11 //Used.
};
@ -77,10 +81,10 @@ enum {
- (int)runModalWithPrintInfo:(NSPrintInfo *)pInfo;
#ifndef STRICT_OPENSTEP
- (void)beginSheetWithPrintInfo:(NSPrintInfo *)printInfo
modalForWindow:(NSWindow *)docWindow
delegate:(id)delegate
didEndSelector:(SEL)didEndSelector
contextInfo:(void *)contextInfo;
modalForWindow:(NSWindow *)docWindow
delegate:(id)delegate
didEndSelector:(SEL)didEndSelector
contextInfo:(void *)contextInfo;
#endif
//
@ -93,7 +97,7 @@ enum {
// Updating the Panel's Display
//
- (void)convertOldFactor:(float *)old
newFactor:(float *)new;
newFactor:(float *)new;
- (void)pickedButton:(id)sender;
- (void)pickedOrientation:(id)sender;
- (void)pickedPaperSize:(id)sender;

View file

@ -129,16 +129,6 @@ typedef enum _NSPrintingPaginationMode {
@end
//
// Used by printing backend bundles
//
@interface NSPrintInfo (Private)
+(NSPrinter*) _resolvePrinterName: (NSString*) printerName;
@end
//
// Printing Information Dictionary Keys
//

View file

@ -77,41 +77,41 @@ typedef enum _NSPrintingPageOrder {
// Creating and Initializing an NSPrintOperation Object
//
+ (NSPrintOperation *)EPSOperationWithView:(NSView *)aView
insideRect:(NSRect)rect
toData:(NSMutableData *)data;
insideRect:(NSRect)rect
toData:(NSMutableData *)data;
+ (NSPrintOperation *)EPSOperationWithView:(NSView *)aView
insideRect:(NSRect)rect
toData:(NSMutableData *)data
printInfo:(NSPrintInfo *)aPrintInfo;
insideRect:(NSRect)rect
toData:(NSMutableData *)data
printInfo:(NSPrintInfo *)aPrintInfo;
+ (NSPrintOperation *)EPSOperationWithView:(NSView *)aView
insideRect:(NSRect)rect
toPath:(NSString *)path
printInfo:(NSPrintInfo *)aPrintInfo;
insideRect:(NSRect)rect
toPath:(NSString *)path
printInfo:(NSPrintInfo *)aPrintInfo;
+ (NSPrintOperation *)printOperationWithView:(NSView *)aView;
+ (NSPrintOperation *)printOperationWithView:(NSView *)aView
printInfo:(NSPrintInfo *)aPrintInfo;
printInfo:(NSPrintInfo *)aPrintInfo;
#ifndef STRICT_OPENSTEP
+ (NSPrintOperation *)PDFOperationWithView:(NSView *)aView
insideRect:(NSRect)rect
toData:(NSMutableData *)data;
insideRect:(NSRect)rect
toData:(NSMutableData *)data;
+ (NSPrintOperation *)PDFOperationWithView:(NSView *)aView
insideRect:(NSRect)rect
toData:(NSMutableData *)data
printInfo:(NSPrintInfo*)aPrintInfo;
insideRect:(NSRect)rect
toData:(NSMutableData *)data
printInfo:(NSPrintInfo*)aPrintInfo;
+ (NSPrintOperation *)PDFOperationWithView:(NSView *)aView
insideRect:(NSRect)rect
toPath:(NSString *)path
printInfo:(NSPrintInfo*)aPrintInfo;
insideRect:(NSRect)rect
toPath:(NSString *)path
printInfo:(NSPrintInfo*)aPrintInfo;
#endif
- (id)initEPSOperationWithView:(NSView *)aView
insideRect:(NSRect)rect
toData:(NSMutableData *)data
printInfo:(NSPrintInfo *)aPrintInfo;
insideRect:(NSRect)rect
toData:(NSMutableData *)data
printInfo:(NSPrintInfo *)aPrintInfo;
- (id)initWithView:(NSView *)aView
printInfo:(NSPrintInfo *)aPrintInfo;
printInfo:(NSPrintInfo *)aPrintInfo;
//
// Setting the Print Operation
@ -163,9 +163,9 @@ typedef enum _NSPrintingPageOrder {
- (BOOL)runOperation;
#ifndef STRICT_OPENSTEP
- (void)runOperationModalForWindow: (NSWindow *)docWindow
delegate: (id)delegate
didRunSelector: (SEL)didRunSelector
contextInfo:(void *)contextInfo;
delegate: (id)delegate
didRunSelector: (SEL)didRunSelector
contextInfo:(void *)contextInfo;
#endif
//
@ -192,9 +192,9 @@ typedef enum _NSPrintingPageOrder {
@interface NSPrintOperation (Private)
- (id) initWithView:(NSView *)aView
insideRect:(NSRect)rect
toData:(NSMutableData *)data
printInfo:(NSPrintInfo *)aPrintInfo;
insideRect:(NSRect)rect
toData:(NSMutableData *)data
printInfo:(NSPrintInfo *)aPrintInfo;
@end

View file

@ -92,10 +92,10 @@ enum {
- (int) runModal;
#ifndef STRICT_OPENSTEP
- (void) beginSheetWithPrintInfo: (NSPrintInfo *)printInfo
modalForWindow: (NSWindow *)docWindow
delegate: (id)delegate
didEndSelector: (SEL)didEndSelector
contextInfo: (void *)contextInfo;
modalForWindow: (NSWindow *)docWindow
delegate: (id)delegate
didEndSelector: (SEL)didEndSelector
contextInfo: (void *)contextInfo;
#endif
//

View file

@ -106,20 +106,20 @@ typedef enum _NSPrinterTableStatus {
// Querying the NSPrinter Tables
//
- (BOOL)booleanForKey:(NSString *)key
inTable:(NSString *)table;
inTable:(NSString *)table;
- (NSDictionary *)deviceDescription;
- (float)floatForKey:(NSString *)key
inTable:(NSString *)table;
inTable:(NSString *)table;
- (int)intForKey:(NSString *)key
inTable:(NSString *)table;
inTable:(NSString *)table;
- (NSRect)rectForKey:(NSString *)key
inTable:(NSString *)table;
inTable:(NSString *)table;
- (NSSize)sizeForKey:(NSString *)key
inTable:(NSString *)table;
inTable:(NSString *)table;
- (NSString *)stringForKey:(NSString *)key
inTable:(NSString *)table;
inTable:(NSString *)table;
- (NSArray *)stringListForKey:(NSString *)key
inTable:(NSString *)table;
inTable:(NSString *)table;
- (NSPrinterTableStatus)statusForTable:(NSString *)table;
- (BOOL)isKey:(NSString *)key
inTable:(NSString *)table;

View file

@ -145,36 +145,55 @@
"pickedUnits:",
"pickedButton:",
"pickedPaperSize:",
"buttonClicked:",
"paperSelected:",
"unitsSelected:",
"orientationMatrixClicked:",
"scaleSelected:",
"widthSelected:",
"heightSelected:"
"okButtonClicked:",
"cancelButtonClicked:",
"customPaperButtonsClicked:",
"paperRadioMatrixClicked:",
"printerPopUpClicked:",
"paperPopUpClicked:",
"paperOrientationMatrixClicked:"
);
Super = NSObject;
};
GSPageLayoutController = {
Actions = (
"buttonClicked:",
"paperSelected:",
"unitsSelected:",
"orientationMatrixClicked:",
"scaleSelected:",
"widthSelected:",
"heightSelected:"
"okButtonClicked:",
"cancelButtonClicked:",
"customPaperButtonsClicked:",
"paperRadioMatrixClicked:",
"printerPopUpClicked:",
"paperPopUpClicked:",
"paperOrientationMatrixClicked:"
);
Outlets = (
_panel,
_orientationMatrix,
_widthField,
_heightField,
_unitsButton,
_paperNameButton,
_scaleField,
_imageButton,
_miniPageView
panel,
paperRadioMatrix,
standardPaperSizePopUp,
customPaperSizePopUp,
dimensionsTextField,
paperOrientationMatrix,
paperAttributesPreview,
scaleTextField,
customPaperTableView,
customPaperWidthTextField,
customPaperHeightTextField,
customPaperMarginTopTextField,
customPaperMarginBottomTextField,
customPaperMarginRightTextField,
customPaperMarginLeftTextField,
customPaperPreview,
summaryTableView,
newCustomPaperButton,
duplicateCustomPaperButton,
deleteCustomPaperButton,
saveCustomPaperButton,
applicationImageButton,
panelTitleField,
customPaperNameColumn,
summarySettingColumn,
summaryValueColumn,
printerPopUp,
tabView
);
Super = NSObject;
};
@ -186,6 +205,13 @@
);
Super = NSView;
};
NSNumberFormatter = {
Actions = (
);
Outlets = (
);
Super = NSFormatter;
};
NSPageLayout = {
Actions = (
"pickedButton:",

View file

@ -138,7 +138,7 @@
/* Set up other defaults from the printer object */
pageSize = [printer stringForKey: @"DefaultPageSize"
inTable: @"PPD"];
inTable: @"PPD"];
/* FIXME: Need to check for AutoSelect and probably a million other things... */
if (pageSize == nil)

View file

@ -148,7 +148,7 @@
if (output)
{
ASSIGN(_path, output);
ASSIGN(_path, output);
}
}
@ -158,7 +158,7 @@
forKey: @"NSOutputFile"];
[info setObject: NSGraphicsContextPSFormat
forKey: NSGraphicsContextRepresentationFormatAttributeName];
forKey: NSGraphicsContextRepresentationFormatAttributeName];
_context = RETAIN([NSGraphicsContext graphicsContextWithAttributes: info]);

View file

@ -29,25 +29,8 @@
*/
//#include "config.h"
#include <Foundation/NSDebug.h>
//#include <Foundation/NSArray.h>
//#include <Foundation/NSBundle.h>
//#include <Foundation/NSDictionary.h>
//#include <Foundation/NSValue.h>
//#include "AppKit/NSApplication.h"
//#include "AppKit/NSForm.h"
//#include "AppKit/NSNibLoading.h"
//#include "AppKit/NSPrinter.h"
//#include "AppKit/NSPrintPanel.h"
//#include "AppKit/NSPrintInfo.h"
//#include "AppKit/NSPrintOperation.h"
//#include "AppKit/NSPopUpButton.h"
//#include "AppKit/NSSavePanel.h"
//#include "AppKit/NSView.h"
//#include "GSGuiPrivate.h"
#include "GSLPRPrintPanel.h"
//#include "GNUstepGUI/GSPrinting.h"

View file

@ -128,32 +128,32 @@ static int gethex(unichar character)
{
switch (character)
{
case '0': return 0;
case '1': return 1;
case '2': return 2;
case '3': return 3;
case '4': return 4;
case '5': return 5;
case '6': return 6;
case '7': return 7;
case '8': return 8;
case '9': return 9;
case 'A': return 10;
case 'B': return 11;
case 'C': return 12;
case 'D': return 13;
case 'E': return 14;
case 'F': return 15;
case 'a': return 10;
case 'b': return 11;
case 'c': return 12;
case 'd': return 13;
case 'e': return 14;
case 'f': return 15;
case '0': return 0;
case '1': return 1;
case '2': return 2;
case '3': return 3;
case '4': return 4;
case '5': return 5;
case '6': return 6;
case '7': return 7;
case '8': return 8;
case '9': return 9;
case 'A': return 10;
case 'B': return 11;
case 'C': return 12;
case 'D': return 13;
case 'E': return 14;
case 'F': return 15;
case 'a': return 10;
case 'b': return 11;
case 'c': return 12;
case 'd': return 13;
case 'e': return 14;
case 'f': return 15;
}
[NSException
raise:NSPPDParseException
format:@"Badly formatted hexadeximal substring in PPD printer file."];
raise:NSPPDParseException
format:@"Badly formatted hexadeximal substring in PPD printer file."];
// NOT REACHED
return 0; /* Quiet compiler warnings */
}

View file

@ -58,19 +58,19 @@
@implementation GSEPSPrintOperation
- (id)initWithView:(NSView *)aView
insideRect:(NSRect)rect
toData:(NSMutableData *)data
printInfo:(NSPrintInfo *)aPrintInfo
insideRect:(NSRect)rect
toData:(NSMutableData *)data
printInfo:(NSPrintInfo *)aPrintInfo
{
self = [super initWithView: aView
insideRect: rect
toData: data
printInfo: aPrintInfo];
insideRect: rect
toData: data
printInfo: aPrintInfo];
_path = [NSTemporaryDirectory() stringByAppendingPathComponent: @"GSPrint-"];
_path = [_path stringByAppendingString:
[[NSProcessInfo processInfo] globallyUniqueString]];
[[NSProcessInfo processInfo] globallyUniqueString]];
_path = [_path stringByAppendingPathExtension: @"ps"];
RETAIN( _path );
@ -78,16 +78,16 @@
}
- (id) initWithView:(NSView *)aView
insideRect:(NSRect)rect
toPath:(NSString *)path
printInfo:(NSPrintInfo *)aPrintInfo
insideRect:(NSRect)rect
toPath:(NSString *)path
printInfo:(NSPrintInfo *)aPrintInfo
{
NSMutableData *data = [NSMutableData data];
self = [super initWithView: aView
insideRect: rect
insideRect: rect
toData: data
printInfo: aPrintInfo];
printInfo: aPrintInfo];
ASSIGN(_path, path);
@ -99,7 +99,7 @@
/* Save this for the view to look at. Seems like there should
be a better way to pass it to beginDocument */
[[_printInfo dictionary] setObject: [NSValue valueWithRect: _rect]
forKey: @"NSPrintSheetBounds"];
forKey: @"NSPrintSheetBounds"];
[_view beginDocument];
@ -142,7 +142,7 @@
forKey: @"NSOutputFile"];
[info setObject: NSGraphicsContextPSFormat
forKey: NSGraphicsContextRepresentationFormatAttributeName];
forKey: NSGraphicsContextRepresentationFormatAttributeName];
_context = RETAIN([NSGraphicsContext graphicsContextWithAttributes: info]);
return _context;

View file

@ -52,19 +52,19 @@
@implementation GSPDFPrintOperation
- (id) initWithView:(NSView *)aView
insideRect:(NSRect)rect
toData:(NSMutableData *)data
printInfo:(NSPrintInfo*)aPrintInfo
insideRect:(NSRect)rect
toData:(NSMutableData *)data
printInfo:(NSPrintInfo*)aPrintInfo
{
self = [super initWithView: aView
insideRect: rect
toData: data
printInfo: aPrintInfo];
insideRect: rect
toData: data
printInfo: aPrintInfo];
_path = [NSTemporaryDirectory() stringByAppendingPathComponent: @"GSPrint-"];
_path = [_path stringByAppendingString:
[[NSProcessInfo processInfo] globallyUniqueString]];
[[NSProcessInfo processInfo] globallyUniqueString]];
_path = [_path stringByAppendingPathExtension: @"pdf"];
RETAIN( _path );
@ -73,16 +73,16 @@
}
- (id) initWithView:(NSView *)aView
insideRect:(NSRect)rect
toPath:(NSString *)path
printInfo:(NSPrintInfo*)aPrintInfo
insideRect:(NSRect)rect
toPath:(NSString *)path
printInfo:(NSPrintInfo*)aPrintInfo
{
NSMutableData *data = [NSMutableData data];
self = [super initWithView: aView
insideRect: rect
toData: data
printInfo: aPrintInfo];
insideRect: rect
toData: data
printInfo: aPrintInfo];
ASSIGN(_path, path);

View file

@ -79,13 +79,13 @@
- (id)initWithView:(NSView *)aView
printInfo:(NSPrintInfo *)aPrintInfo
printInfo:(NSPrintInfo *)aPrintInfo
{
self = [self initWithView: aView
insideRect: [aView bounds]
toData: [NSMutableData data]
printInfo: aPrintInfo];
insideRect: [aView bounds]
toData: [NSMutableData data]
printInfo: aPrintInfo];
_showPanels = YES;
@ -130,23 +130,23 @@
preview = [ws getBestAppInRole: @"Viewer"
forExtension: @"ps"];
if (preview)
{
[ws openFile: _path withApplication: preview];
}
{
[ws openFile: _path withApplication: preview];
}
else
{
NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
preview = [def objectForKey: @"NSPreviewApp"];
{
NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
preview = [def objectForKey: @"NSPreviewApp"];
if (preview == nil || [preview length] == 0)
preview = @"gv";
if (preview == nil || [preview length] == 0)
preview = @"gv";
task = [NSTask new];
[task setLaunchPath: preview];
[task setArguments: [NSArray arrayWithObject: _path]];
[task launch];
AUTORELEASE(task);
}
task = [NSTask new];
[task setLaunchPath: preview];
[task setArguments: [NSArray arrayWithObject: _path]];
[task launch];
AUTORELEASE(task);
}
}
else if ([job isEqual: NSPrintSpoolJob])
{
@ -161,7 +161,7 @@
if ( _path )
{
[[NSFileManager defaultManager] removeFileAtPath: _path
handler: nil];
handler: nil];
}
*/
return success;

View file

@ -65,35 +65,38 @@ static NSBundle *printingBundle = nil;
libraryPathsEnumerator = [NSStandardLibraryPaths() objectEnumerator];
while( (path = [libraryPathsEnumerator nextObject]) )
{
path = [path stringByAppendingPathComponent: @"Bundles"];
path = [path stringByAppendingPathComponent: @"GSPrinting"];
path = [path stringByAppendingPathComponent: bundleName];
{
path = [path stringByAppendingPathComponent: @"Bundles"];
path = [path stringByAppendingPathComponent: @"GSPrinting"];
path = [path stringByAppendingPathComponent: bundleName];
if ([[NSFileManager defaultManager] fileExistsAtPath: path])
{
NSBundle *bundle;
bundle = [NSBundle bundleWithPath: path];
if( [bundle load] == NO )
{
NSDebugLLog(@"GSPrinting", @"Error loading printing bundle at %@", path);
return nil;
}
else
{
//one last check to make sure the principle class can be loaded
if( [bundle principalClass] == Nil)
if ([[NSFileManager defaultManager] fileExistsAtPath: path])
{
NSDebugLLog(@"GSPrinting", @"Error loading principal class from printing bundle at %@", path);
return nil;
NSBundle *bundle;
bundle = [NSBundle bundleWithPath: path];
if( [bundle load] == NO )
{
NSDebugLLog(@"GSPrinting", @"Error loading printing bundle at %@",
path);
return nil;
}
//one last check to make sure the principle class can be loaded
if( [bundle principalClass] == Nil)
{
NSDebugLLog(@"GSPrinting",
@"Error loading principal class from printing bundle at %@",
path);
return nil;
}
//if we get here, finally, then everything should be ok, barring
//errors from later in loading resources.
NSDebugLLog(@"GSPrinting", @"Loaded printing bundle at %@", path);
return bundle;
}
//if we get here, finally, then everything should be ok, barring errors from later in loading resources.
NSDebugLLog(@"GSPrinting", @"Loaded printing bundle at %@", path);
return bundle;
}
}
}
}
NSDebugLLog(@"GSPrinting", @"Unable to find printing bundle %@", bundleName);
return nil;
@ -109,7 +112,7 @@ static NSBundle *printingBundle = nil;
return bundle;
if( (bundle = [GSPrinting loadPrintingBundle: @"GSLPR"]) )
return bundle;
return bundle;
if( (bundle = [GSPrinting loadPrintingBundle: @"GSWin32"]) )
return bundle;
@ -125,49 +128,72 @@ static NSBundle *printingBundle = nil;
NSBundle *bundle;
if( printingBundle )
{
return printingBundle;
}
{
return printingBundle;
}
NSDebugLLog(@"GSPrinting", @"Bundle has not been loaded. Loading in progress...");
defaultBundleName = [[NSUserDefaults standardUserDefaults] stringForKey: @"GSPrinting"];
defaultBundleName = [[NSUserDefaults standardUserDefaults]
stringForKey: @"GSPrinting"];
/*Which Printing Bundle?*/
if( defaultBundleName == nil )
{
NSDebugLLog(@"GSPrinting", @"User did not set a printing bundle, trying till something works");
bundle = [GSPrinting loadAnyWorkingPrintingBundle];
if( bundle == nil )
{
NSDebugLLog(@"GSPrinting", @"Could not load any working printing bundle");
NSRunAlertPanel(@"GNUstep Printing Backend System", @"Could not open any working printing bundle. Printing will not work.", @"Ok", NULL, NULL );
return nil;
{
NSDebugLLog(@"GSPrinting",
@"User did not set a printing bundle, trying till something works");
bundle = [GSPrinting loadAnyWorkingPrintingBundle];
if( bundle == nil )
{
NSDebugLLog(@"GSPrinting",
@"Could not load any working printing bundle");
NSRunAlertPanel(@"GNUstep Printing Backend System",
@"Could not open any working printing bundle. Printing will not work.",
@"Ok", NULL, NULL );
return nil;
}
}
}
else
{
NSDebugLLog(@"GSPrinting", @"User set %@ as the printing bundle", defaultBundleName);
{
NSDebugLLog(@"GSPrinting",
@"User set %@ as the printing bundle",
defaultBundleName);
bundle = [GSPrinting loadPrintingBundle: defaultBundleName];
if( bundle == nil )
bundle = [GSPrinting loadPrintingBundle: defaultBundleName];
if( bundle == nil )
{
NSDebugLLog(@"GSPrinting", @"User set %@ as the printing bundle but that did not work. Will try to find anything that will work", defaultBundleName);
bundle = [GSPrinting loadAnyWorkingPrintingBundle];
if( bundle == nil )
{
NSDebugLLog(@"GSPrinting", @"Could not load any working printing bundle");
NSRunAlertPanel(@"GNUstep Printing Backend System", @"Could not open any working printing bundle. Printing will not work.", @"Ok", NULL, NULL );
return nil;
}
else
{
NSString *msg;
msg = [NSString stringWithFormat: @"Your chosen printing bundle, %@, could not be loaded. %@ was loaded instead", defaultBundleName, [[bundle bundlePath] lastPathComponent]];
NSRunAlertPanel(@"GNUstep Printing Backend System", msg, @"Ok", NULL, NULL );
}
}
}
NSDebugLLog(@"GSPrinting",
@"User set %@ as the printing bundle but that did not work.\
Will try to find anything that will work",
defaultBundleName);
bundle = [GSPrinting loadAnyWorkingPrintingBundle];
if( bundle == nil )
{
NSDebugLLog(@"GSPrinting",
@"Could not load any working printing bundle");
NSRunAlertPanel(@"GNUstep Printing Backend System",
@"Could not open any working printing bundle. Printing will not work.",
@"Ok", NULL, NULL );
return nil;
}
else
{
NSString *msg;
msg = [NSString stringWithFormat:
@"Your chosen printing bundle, %@, could not be loaded.\
%@ was loaded instead",
defaultBundleName, [[bundle bundlePath] lastPathComponent]];
NSRunAlertPanel(@"GNUstep Printing Backend System",
msg, @"Ok", NULL, NULL );
}
}
}
printingBundle = bundle;
[printingBundle retain];

File diff suppressed because it is too large Load diff

View file

@ -239,20 +239,21 @@ static NSPrintInfo *sharedPrintInfo = nil;
- (void)setBottomMargin:(float)value
{
[_info setObject:[NSNumber numberWithFloat:value]
forKey:NSPrintBottomMargin];
forKey:NSPrintBottomMargin];
}
- (void)setLeftMargin:(float)value
{
[_info setObject:[NSNumber numberWithFloat:value]
forKey:NSPrintLeftMargin];
forKey:NSPrintLeftMargin];
}
- (void)setOrientation:(NSPrintingOrientation)mode
{
NSSize size;
[_info setObject:[NSNumber numberWithInt:mode]
forKey:NSPrintOrientation];
forKey:NSPrintOrientation];
/* Set the paper size accordingly */
size = [self paperSize];
if ((mode == NSPortraitOrientation && size.width > size.height)
@ -262,7 +263,7 @@ static NSPrintInfo *sharedPrintInfo = nil;
size.width = size.height;
size.height = tmp;
[_info setObject: [NSValue valueWithSize: size]
forKey: NSPrintPaperSize];
forKey: NSPrintPaperSize];
}
}
@ -270,15 +271,16 @@ static NSPrintInfo *sharedPrintInfo = nil;
{
DICTSET(_info, name, NSPrintPaperName);
DICTSET(_info,
[NSValue valueWithSize: [NSPrintInfo sizeForPaperName: name]],
NSPrintPaperSize);
[NSValue valueWithSize: [NSPrintInfo sizeForPaperName: name]],
NSPrintPaperSize);
}
- (void)setPaperSize:(NSSize)size
{
NSPrintingOrientation orient;
[_info setObject:[NSValue valueWithSize:size]
forKey:NSPrintPaperSize];
forKey:NSPrintPaperSize];
/* Set orientation accordingly */
if (size.width <= size.height)
orient = NSPortraitOrientation;
@ -290,13 +292,13 @@ static NSPrintInfo *sharedPrintInfo = nil;
- (void)setRightMargin:(float)value
{
[_info setObject:[NSNumber numberWithFloat:value]
forKey:NSPrintRightMargin];
forKey:NSPrintRightMargin];
}
- (void)setTopMargin:(float)value
{
[_info setObject:[NSNumber numberWithFloat:value]
forKey:NSPrintTopMargin];
forKey:NSPrintTopMargin];
}
- (float)topMargin
@ -309,20 +311,19 @@ static NSPrintInfo *sharedPrintInfo = nil;
//
- (NSPrintingPaginationMode)horizontalPagination
{
return [(NSNumber *)[_info objectForKey:NSPrintHorizontalPagination]
intValue];
return [(NSNumber*)[_info objectForKey:NSPrintHorizontalPagination] intValue];
}
- (void)setHorizontalPagination:(NSPrintingPaginationMode)mode
{
[_info setObject:[NSNumber numberWithInt:mode]
forKey:NSPrintHorizontalPagination];
forKey:NSPrintHorizontalPagination];
}
- (void)setVerticalPagination:(NSPrintingPaginationMode)mode
{
[_info setObject:[NSNumber numberWithInt:mode]
forKey:NSPrintVerticalPagination];
forKey:NSPrintVerticalPagination];
}
- (NSPrintingPaginationMode)verticalPagination
@ -335,8 +336,7 @@ static NSPrintInfo *sharedPrintInfo = nil;
//
- (BOOL)isHorizontallyCentered
{
return [(NSNumber *)[_info objectForKey:NSPrintHorizontallyCentered]
boolValue];
return [(NSNumber*)[_info objectForKey:NSPrintHorizontallyCentered]boolValue];
}
- (BOOL)isVerticallyCentered
@ -347,13 +347,13 @@ static NSPrintInfo *sharedPrintInfo = nil;
- (void)setHorizontallyCentered:(BOOL)flag
{
[_info setObject:[NSNumber numberWithBool:flag]
forKey:NSPrintHorizontallyCentered];
forKey:NSPrintHorizontallyCentered];
}
- (void)setVerticallyCentered:(BOOL)flag
{
[_info setObject:[NSNumber numberWithBool:flag]
forKey:NSPrintVerticallyCentered];
forKey:NSPrintVerticallyCentered];
}
//
@ -366,7 +366,8 @@ static NSPrintInfo *sharedPrintInfo = nil;
- (void)setPrinter:(NSPrinter *)aPrinter
{
[_info setObject:aPrinter forKey:NSPrintPrinter];
[_info setObject:aPrinter
forKey:NSPrintPrinter];
}
//
@ -379,7 +380,8 @@ static NSPrintInfo *sharedPrintInfo = nil;
- (void)setJobDisposition:(NSString *)disposition
{
[_info setObject:disposition forKey:NSPrintJobDisposition];
[_info setObject:disposition
forKey:NSPrintJobDisposition];
}
- (void)setUpPrintOperationDefaultValues