mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 18:11:06 +00:00
Added GSCUPS
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@20212 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
08529677f0
commit
6dc099b85e
17 changed files with 1109 additions and 1 deletions
22
ChangeLog
22
ChangeLog
|
@ -1,3 +1,25 @@
|
|||
2004-10-08 22:08 Chad Hardin <cehardin@mac.com>
|
||||
|
||||
* Printing/GNUmakefile: Now goes in and build GSCUPS (Work in progress!)
|
||||
* Printing/GSCUPS/GNUmakefile: Added
|
||||
* Printing/GSCUPS/GNUmakefile.postamble: Added
|
||||
* Printing/GSCUPS/GNUmakefile.preamble: Added
|
||||
* Printing/GSCUPS/GSCUPSPageLayout.h: Added
|
||||
* Printing/GSCUPS/GSCUPSPageLayout.m: Added
|
||||
* Printing/GSCUPS/GSCUPSPrincipalClass.h: Added
|
||||
* Printing/GSCUPS/GSCUPSPrincipalClass.m: Added
|
||||
* Printing/GSCUPS/GSCUPSPrintInfo.h: Added
|
||||
* Printing/GSCUPS/GSCUPSPrintInfo.m: Added
|
||||
* Printing/GSCUPS/GSCUPSPrintOperation.h: Added
|
||||
* Printing/GSCUPS/GSCUPSPrintOperation.m: Added
|
||||
* Printing/GSCUPS/GSCUPSPrintPanel.h: Added
|
||||
* Printing/GSCUPS/GSCUPSPrintPanel.m: Added
|
||||
* Printing/GSCUPS/GSCUPSPrinter.h: Added
|
||||
* Printing/GSCUPS/GSCUPSPrinter.m: Added. GSCUPS is a work in
|
||||
progress. Some changes still need to be made to NSPrinter,
|
||||
NSPrinterInfo. Additionally, NSPrintPanel needs to be improved
|
||||
to take advantage of the new features that GSCUPS will provide.
|
||||
|
||||
2004-10-08 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSFormCell.m: (-initWithCoder:):
|
||||
|
|
|
@ -40,7 +40,7 @@ SUBPROJECTS = \
|
|||
GSLPR
|
||||
|
||||
ifeq ($(BUILD_GSCUPS), YES)
|
||||
#SUBPROJECTS += GSCUPS
|
||||
SUBPROJECTS += GSCUPS
|
||||
endif
|
||||
|
||||
include $(GNUSTEP_MAKEFILES)/aggregate.make
|
||||
|
|
122
Printing/GSCUPS/GNUmakefile
Normal file
122
Printing/GSCUPS/GNUmakefile
Normal file
|
@ -0,0 +1,122 @@
|
|||
#
|
||||
# GSCUPS Printing Backend Bundle makefile for GNUstep GUI Library
|
||||
#
|
||||
# Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
#
|
||||
# Author: Chad Hardin <cehardin@mac.com
|
||||
#
|
||||
# Date: October 2004
|
||||
#
|
||||
# This file is part of the GNUstep GUI Library.
|
||||
#
|
||||
# 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 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 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.
|
||||
|
||||
GNUSTEP_LOCAL_ADDITIONAL_MAKEFILES=../../gui.make
|
||||
|
||||
include $(GNUSTEP_MAKEFILES)/common.make
|
||||
include ../../config.make
|
||||
include ../../Version
|
||||
|
||||
GNUSTEP_INSTALLATION_DIR=$(GNUSTEP_SYSTEM_ROOT)
|
||||
|
||||
|
||||
|
||||
|
||||
BUNDLE_NAME=GSCUPS
|
||||
BUNDLE_INSTALL_DIR= $(GNUSTEP_BUNDLES)/GSPrinting
|
||||
GSCUPS_PRINCIPAL_CLASS=GSCUPSPrincipalClass
|
||||
|
||||
|
||||
|
||||
ifeq ($(GNUSTEP_TARGET_OS),mingw32)
|
||||
GSCUPS_BUNDLE_LIBS += -lgnustep-gui $(FND_LIBS) $(OBJC_LIBS)
|
||||
endif
|
||||
ifeq ($(GNUSTEP_TARGET_OS),cygwin)
|
||||
GSCUPS_BUNDLE_LIBS += -lgnustep-gui $(FND_LIBS) $(OBJC_LIBS)
|
||||
endif
|
||||
|
||||
|
||||
GSCUPS_BUNDLE_LIBS += $(GSCUPS_LIBS)
|
||||
|
||||
#
|
||||
# Libraries
|
||||
#
|
||||
#GSCUPS_LIBRARIES_DEPEND_UPON +=
|
||||
|
||||
|
||||
#
|
||||
# Resource files
|
||||
#
|
||||
#GSCUPS_RESOURCE_FILES =
|
||||
|
||||
|
||||
#
|
||||
# Header files
|
||||
#
|
||||
GSCUPS_HEADERS= \
|
||||
GSCUPSPrincipalClass.m \
|
||||
GSCUPSPageLayout.m \
|
||||
GSCUPSPrintInfo.m \
|
||||
GSCUPSPrintOperation \
|
||||
GSCUPSPrintPanel.m \
|
||||
GSCUPSPrinter.m
|
||||
|
||||
|
||||
#
|
||||
# Class files
|
||||
#
|
||||
GSCUPS_OBJC_FILES= \
|
||||
GSCUPSPrincipalClass.m \
|
||||
GSCUPSPageLayout.m \
|
||||
GSCUPSPrintInfo.m \
|
||||
GSCUPSPrintOperation.m \
|
||||
GSCUPSPrintPanel.m \
|
||||
GSCUPSPrinter.m
|
||||
|
||||
|
||||
#
|
||||
# C files
|
||||
#
|
||||
#GSCUPS_C_FILES =
|
||||
|
||||
|
||||
#
|
||||
# Languages
|
||||
#
|
||||
#GSCUPS_LANGUAGES= \
|
||||
# English
|
||||
|
||||
|
||||
#
|
||||
# Localized Resource Files
|
||||
#
|
||||
#GSCUPS_LOCALIZED_RESOURCE_FILES= \
|
||||
# GSCUPSPrintPanel.gorm \
|
||||
# GSCUPSPageLayout.gorm
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Makefiles
|
||||
#
|
||||
-include GNUmakefile.preamble
|
||||
#include $(GNUSTEP_MAKEFILES)/aggregate.make
|
||||
include $(GNUSTEP_MAKEFILES)/bundle.make
|
||||
-include GNUmakefile.postamble
|
40
Printing/GSCUPS/GNUmakefile.postamble
Normal file
40
Printing/GSCUPS/GNUmakefile.postamble
Normal file
|
@ -0,0 +1,40 @@
|
|||
#
|
||||
# GNUmakefile.postamble
|
||||
#
|
||||
|
||||
# Things to do before compiling
|
||||
# before-all::
|
||||
|
||||
# Things to do after compiling
|
||||
# after-all::
|
||||
|
||||
# Things to do before installing
|
||||
# before-install::
|
||||
|
||||
# Things to do after installing
|
||||
# after-install::
|
||||
|
||||
# Things to do before uninstalling
|
||||
# before-uninstall::
|
||||
|
||||
# Things to do after uninstalling
|
||||
# after-uninstall::
|
||||
|
||||
# Things to do before cleaning
|
||||
# before-clean::
|
||||
|
||||
# Things to do after cleaning
|
||||
# after-clean::
|
||||
|
||||
# Things to do before distcleaning
|
||||
# before-distclean::
|
||||
|
||||
# Things to do after distcleaning
|
||||
# after-distclean::
|
||||
|
||||
# Things to do before checking
|
||||
# before-check::
|
||||
|
||||
# Things to do after checking
|
||||
# after-check::
|
||||
|
37
Printing/GSCUPS/GNUmakefile.preamble
Normal file
37
Printing/GSCUPS/GNUmakefile.preamble
Normal file
|
@ -0,0 +1,37 @@
|
|||
# Additional flags to pass to the preprocessor
|
||||
ADDITIONAL_CPPFLAGS +=
|
||||
|
||||
# Additional flags to pass to the Objective-C compiler
|
||||
ADDITIONAL_OBJCFLAGS += -Wall
|
||||
|
||||
# Additional flags to pass to the C compiler
|
||||
ADDITIONAL_CFLAGS += $(GSCUPS_CFLAGS)
|
||||
|
||||
# Additional include directories the compiler should search
|
||||
ADDITIONAL_INCLUDE_DIRS += -I../../Headers/Additions -I../../Headers \
|
||||
-I../../Source/$(GNUSTEP_TARGET_DIR)
|
||||
|
||||
# Additional LDFLAGS to pass to the linker
|
||||
ADDITIONAL_LDFLAGS += $(GSCUPS_LDFLAGS)
|
||||
|
||||
# Additional library directories the linker should search
|
||||
ADDITIONAL_LIB_DIRS += -L../../Source/$(GNUSTEP_OBJ_DIR)
|
||||
|
||||
# Additional libraries
|
||||
|
||||
# GNUstepWeb
|
||||
ADDITIONAL_GSW_LIBS +=
|
||||
# GUI apps
|
||||
ADDITIONAL_GUI_LIBS +=
|
||||
# Libraries
|
||||
ADDITIONAL_LIBRARY_LIBS += $(GSCUPS_LIBS)
|
||||
# ObjC stuff
|
||||
ADDITIONAL_OBJC_LIBS +=
|
||||
#-lgnustep-gui $(SYSTEM_LIBS)
|
||||
# Tools
|
||||
ADDITIONAL_TOOL_LIBS +=
|
||||
# WebObjects
|
||||
ADDITIONAL_WO_LIBS +=
|
||||
|
||||
# Additional directories to be created during installation
|
||||
#ADDITIONAL_INSTALL_DIRS +=
|
44
Printing/GSCUPS/GSCUPSPageLayout.h
Normal file
44
Printing/GSCUPS/GSCUPSPageLayout.h
Normal file
|
@ -0,0 +1,44 @@
|
|||
/** <title>GSCUPSPageLayout</title>
|
||||
|
||||
<abstract>Standard panel for querying user about page layout.</abstract>
|
||||
|
||||
Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
|
||||
Written By: Chad Hardin <cehardin@mac.com>
|
||||
Date: October 2004
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
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 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 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 _GNUstep_H_GSCUPSPageLayout
|
||||
#define _GNUstep_H_GSCUPSPageLayout
|
||||
|
||||
#include <AppKit/NSPageLayout.h>
|
||||
|
||||
|
||||
@class NSPrintInfo;
|
||||
@class NSView;
|
||||
|
||||
|
||||
@interface GSCUPSPageLayout: NSPageLayout
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#endif // _GNUstep_H_GSCUPSPageLayout
|
53
Printing/GSCUPS/GSCUPSPageLayout.m
Normal file
53
Printing/GSCUPS/GSCUPSPageLayout.m
Normal file
|
@ -0,0 +1,53 @@
|
|||
/** <title>GSCUPSPageLayout</title>
|
||||
|
||||
<abstract></abstract>
|
||||
|
||||
Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
Author: Chad Hardin <cehardin@mac.com>
|
||||
Date: October 2004
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
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 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 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 "GSCUPSPageLayout.h"
|
||||
|
||||
|
||||
@implementation GSCUPSPageLayout
|
||||
//
|
||||
// Class methods
|
||||
//
|
||||
+ (void)initialize
|
||||
{
|
||||
NSDebugMLLog(@"GSPrinting", @"");
|
||||
if (self == [GSCUPSPageLayout class])
|
||||
{
|
||||
// Initial version
|
||||
[self setVersion:1];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+ (id) allocWithZone: (NSZone*)zone
|
||||
{
|
||||
NSDebugMLLog(@"GSPrinting", @"");
|
||||
return NSAllocateObject(self, 0, zone);
|
||||
}
|
||||
|
||||
|
||||
@end
|
40
Printing/GSCUPS/GSCUPSPrincipalClass.h
Normal file
40
Printing/GSCUPS/GSCUPSPrincipalClass.h
Normal file
|
@ -0,0 +1,40 @@
|
|||
/** <title>GSCUPSPrincipalClass</title>
|
||||
|
||||
<abstract>Principal class for the GSCUPS Bundle.</abstract>
|
||||
|
||||
Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
|
||||
Author: Chad Hardin <cehardin@mac.com>
|
||||
Date: October 2004
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
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 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 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 _GSCUPSPRINCIPALCLASS_H_
|
||||
#define _GSCUPSPRINCIPALCLASS_H_
|
||||
|
||||
#include <GNUstepGUI/GSPrinting.h>
|
||||
|
||||
@interface GSCUPSPrincipalClass : GSPrintingPrincipalClass
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#endif // _GSCUPSPRINCIPALCLASS_H_
|
||||
|
83
Printing/GSCUPS/GSCUPSPrincipalClass.m
Normal file
83
Printing/GSCUPS/GSCUPSPrincipalClass.m
Normal file
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
GSCUPSPrincipalClass.m
|
||||
|
||||
Principal class for the GSCUPS Bundle
|
||||
|
||||
Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
|
||||
Author: Chad Hardin <cehardin@mac.com>
|
||||
Date: October 2004
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
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 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 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 "GSCUPSPrincipalClass.h"
|
||||
#include "GSCUPSPageLayout.h"
|
||||
#include "GSCUPSPrintInfo.h"
|
||||
#include "GSCUPSPrintOperation.h"
|
||||
#include "GSCUPSPrintPanel.h"
|
||||
#include "GSCUPSPrinter.h"
|
||||
|
||||
|
||||
@implementation GSCUPSPrincipalClass
|
||||
//
|
||||
// Class methods
|
||||
//
|
||||
+(Class) pageLayoutClass
|
||||
{
|
||||
NSDebugMLLog(@"GSPrinting", @"");
|
||||
return [GSCUPSPageLayout class];
|
||||
}
|
||||
|
||||
+(Class) printInfoClass
|
||||
{
|
||||
NSDebugMLLog(@"GSPrinting", @"");
|
||||
return [GSCUPSPrintInfo class];
|
||||
}
|
||||
|
||||
+(Class) printOperationClass
|
||||
{
|
||||
NSDebugMLLog(@"GSPrinting", @"");
|
||||
return [GSCUPSPrintOperation class];
|
||||
}
|
||||
|
||||
|
||||
+(Class) printPanelClass
|
||||
{
|
||||
NSDebugMLLog(@"GSPrinting", @"");
|
||||
return [GSCUPSPrintPanel class];
|
||||
}
|
||||
|
||||
|
||||
+(Class) printerClass
|
||||
{
|
||||
NSDebugMLLog(@"GSPrinting", @"");
|
||||
return [GSCUPSPrinter class];
|
||||
}
|
||||
|
||||
|
||||
+(Class) gsPrintOperationClass
|
||||
{
|
||||
NSDebugMLLog(@"GSPrinting", @"");
|
||||
return [GSCUPSPrintOperation class];
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
43
Printing/GSCUPS/GSCUPSPrintInfo.h
Normal file
43
Printing/GSCUPS/GSCUPSPrintInfo.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
/** <title>GSCUPSPrintInfo</title>
|
||||
|
||||
<abstract>Stores information used in printing.</abstract>
|
||||
|
||||
Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
|
||||
Author: Chad Hardin <cehardin@mac.com>
|
||||
Date: October 2004
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
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 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 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 _GNUstep_H_GSCUPSPrintInfo
|
||||
#define _GNUstep_H_GSCUPSPrintInfo
|
||||
|
||||
#include <Foundation/NSCoder.h>
|
||||
#include <AppKit/NSPrintInfo.h>
|
||||
|
||||
|
||||
|
||||
@interface GSCUPSPrintInfo: NSPrintInfo
|
||||
{
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
|
||||
#endif // _GNUstep_H_GSCUPSPrintInfo
|
133
Printing/GSCUPS/GSCUPSPrintInfo.m
Normal file
133
Printing/GSCUPS/GSCUPSPrintInfo.m
Normal file
|
@ -0,0 +1,133 @@
|
|||
/*
|
||||
GSCUPSPrintInfo.m
|
||||
|
||||
Stores information used in printing
|
||||
|
||||
Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
|
||||
Author: Chad Hardin <cehardin@mac.com>
|
||||
Date: October 2004
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
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 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 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/NSArray.h>
|
||||
#include <Foundation/NSBundle.h>
|
||||
#include <Foundation/NSDebug.h>
|
||||
#include <Foundation/NSDictionary.h>
|
||||
#include <Foundation/NSException.h>
|
||||
#include <Foundation/NSEnumerator.h>
|
||||
#include <Foundation/NSUserDefaults.h>
|
||||
#include <Foundation/NSValue.h>
|
||||
#include <AppKit/NSPrinter.h>
|
||||
#include "GSCUPSPrintInfo.h"
|
||||
#include "GSCUPSPrinter.h"
|
||||
#include <cups/cups.h>
|
||||
|
||||
|
||||
@implementation GSCUPSPrintInfo
|
||||
|
||||
//
|
||||
// Class methods
|
||||
//
|
||||
+ (void)initialize
|
||||
{
|
||||
NSDebugMLLog(@"GSPrinting", @"");
|
||||
if (self == [GSCUPSPrintInfo class])
|
||||
{
|
||||
// Initial version
|
||||
[self setVersion:1];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+ (id) allocWithZone: (NSZone*)zone
|
||||
{
|
||||
NSDebugMLLog(@"GSPrinting", @"");
|
||||
return NSAllocateObject(self, 0, zone);
|
||||
}
|
||||
|
||||
|
||||
+(NSPrinter*) defaultPrinter
|
||||
{
|
||||
const char* defaultName;
|
||||
|
||||
defaultName = cupsGetDefault();
|
||||
|
||||
if( defaultName )
|
||||
{
|
||||
NSLog(@"The default printer name is %s", defaultName);
|
||||
return [NSPrinter printerWithName:
|
||||
[NSString stringWithCString: defaultName]];
|
||||
}
|
||||
else
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+ (void)setDefaultPrinter:(NSPrinter *)printer
|
||||
{
|
||||
NSString* name;
|
||||
int numDests;
|
||||
cups_dest_t* dests;
|
||||
int n;
|
||||
BOOL found = NO;
|
||||
|
||||
name = [printer name];
|
||||
|
||||
numDests = cupsGetDests( &dests );
|
||||
|
||||
for( n = 0; n < numDests; n++ )
|
||||
{
|
||||
if( [name isEqualToString: [NSString stringWithCString: dests[n].name]] &&
|
||||
dests[n].instance == NULL)
|
||||
{
|
||||
found = YES;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( found == NO )
|
||||
{
|
||||
NSDebugMLLog(@"GSPrinting", @"Printer %@ not found", name);
|
||||
return;
|
||||
}
|
||||
|
||||
for( n = 0; n < numDests; n++ )
|
||||
{
|
||||
dests[n].is_default = 0;
|
||||
}
|
||||
|
||||
for( n = 0; n < numDests; n++ )
|
||||
{
|
||||
if( [name isEqualToString: [NSString stringWithCString: dests[n].name]] &&
|
||||
dests[n].instance == NULL)
|
||||
{
|
||||
dests[n].is_default = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
cupsSetDests( numDests, dests );
|
||||
cupsFreeDests( numDests, dests );
|
||||
}
|
||||
|
||||
@end
|
45
Printing/GSCUPS/GSCUPSPrintOperation.h
Normal file
45
Printing/GSCUPS/GSCUPSPrintOperation.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
/** <title>GSCUPSPrintOperation</title>
|
||||
|
||||
<abstract>Controls generation of EPS, PDF or PS print jobs.</abstract>
|
||||
|
||||
Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
|
||||
Author: Chad Hardin <cehardin@mac.com>
|
||||
Date: October 2004
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
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 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 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 _GNUstep_H_GSCUPSPrintOperation
|
||||
#define _GNUstep_H_GSCUPSPrintOperation
|
||||
|
||||
#include <GNUstepGUI/GSPrintOperation.h>
|
||||
|
||||
//GSPrintOperation is subclasses of GSPrintOperation, NOT NSPrintOperation.
|
||||
//NSPrintOperation does a lot of work that is pretty generic.
|
||||
//GSPrintOperation contains the method that does the actual
|
||||
//spooling. A future Win32 printing printing bundle
|
||||
//will likely have to implement much more
|
||||
@interface GSCUPSPrintOperation : GSPrintOperation
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
#endif // _GNUstep_H_GSCUPSPrintOperation
|
165
Printing/GSCUPS/GSCUPSPrintOperation.m
Normal file
165
Printing/GSCUPS/GSCUPSPrintOperation.m
Normal file
|
@ -0,0 +1,165 @@
|
|||
/*
|
||||
GSCUPSPrintOperation.m
|
||||
|
||||
Controls operations generating EPS, PDF or PS print jobs.
|
||||
|
||||
Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
|
||||
Author: Chad Hardin
|
||||
Date: June 2004
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
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 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 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 <math.h>
|
||||
#include <config.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <Foundation/NSDebug.h>
|
||||
#include <Foundation/NSData.h>
|
||||
#include <Foundation/NSFileManager.h>
|
||||
#include <Foundation/NSException.h>
|
||||
#include <Foundation/NSPathUtilities.h>
|
||||
#include <Foundation/NSTask.h>
|
||||
#include <Foundation/NSThread.h>
|
||||
#include <Foundation/NSUserDefaults.h>
|
||||
#include <Foundation/NSValue.h>
|
||||
#include <AppKit/AppKitExceptions.h>
|
||||
#include <AppKit/NSAffineTransform.h>
|
||||
#include <AppKit/NSApplication.h>
|
||||
#include <AppKit/NSGraphicsContext.h>
|
||||
#include <AppKit/NSView.h>
|
||||
#include <AppKit/NSPrinter.h>
|
||||
#include <AppKit/NSPrintPanel.h>
|
||||
#include <AppKit/NSPrintInfo.h>
|
||||
#include <AppKit/NSPrintOperation.h>
|
||||
#include <AppKit/NSWorkspace.h>
|
||||
#include <AppKit/PSOperators.h>
|
||||
#include "GSCUPSPrintOperation.h"
|
||||
#include <cups/cups.h>
|
||||
|
||||
|
||||
|
||||
|
||||
//A subclass of GSPrintOperation, NOT NSPrintOperation.
|
||||
@implementation GSCUPSPrintOperation
|
||||
//
|
||||
// Class methods
|
||||
//
|
||||
+ (id) allocWithZone: (NSZone*)zone
|
||||
{
|
||||
NSDebugMLLog(@"GSPrinting", @"");
|
||||
return NSAllocateObject(self, 0, zone);
|
||||
}
|
||||
|
||||
|
||||
- (id)initWithView:(NSView *)aView
|
||||
printInfo:(NSPrintInfo *)aPrintInfo
|
||||
{
|
||||
self = [super initWithView: aView
|
||||
printInfo: aPrintInfo];
|
||||
|
||||
_path = [NSTemporaryDirectory()
|
||||
stringByAppendingPathComponent: @"GSCUPSPrintJob-"];
|
||||
|
||||
_path = [_path stringByAppendingString:
|
||||
[[NSProcessInfo processInfo] globallyUniqueString]];
|
||||
|
||||
_path = [_path stringByAppendingPathExtension: @"ps"];
|
||||
|
||||
RETAIN(_path);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
|
||||
- (BOOL) _deliverSpooledResult
|
||||
{
|
||||
//int copies;
|
||||
//NSDictionary *dict;
|
||||
//NSTask *task;
|
||||
NSString *name, *status;
|
||||
//NSMutableArray *args;
|
||||
|
||||
NSDebugMLLog(@"GSPrinting", @"");
|
||||
name = [[_printInfo printer] name];
|
||||
status = [NSString stringWithFormat: @"Spooling to printer %@.", name];
|
||||
[_printPanel _setStatusStringValue: status];
|
||||
|
||||
cupsPrintFile( [name UTF8String],
|
||||
[_path UTF8String],
|
||||
[_path UTF8String],
|
||||
0, NULL );
|
||||
|
||||
|
||||
//dict = [_printInfo dictionary];
|
||||
//args = [NSMutableArray array];
|
||||
//copies = [[dict objectForKey: NSPrintCopies] intValue];
|
||||
//if (copies > 1)
|
||||
// [args addObject: [NSString stringWithFormat: @"-#%0d", copies]];
|
||||
//if ([name isEqual: @"Unknown"] == NO)
|
||||
// {
|
||||
// [args addObject: @"-P"];
|
||||
// [args addObject: name];
|
||||
// }
|
||||
//[args addObject: _path];
|
||||
|
||||
//task = [NSTask new];
|
||||
//[task setLaunchPath: @"lpr"];
|
||||
//[task setArguments: args];
|
||||
//[task launch];
|
||||
//[task waitUntilExit];
|
||||
//AUTORELEASE(task);
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (NSGraphicsContext*)createContext
|
||||
{
|
||||
NSMutableDictionary *info;
|
||||
NSString *output;
|
||||
|
||||
//NSDebugMLLog(@"GSPrinting", @"_path is %@", _path);
|
||||
if (_context)
|
||||
{
|
||||
NSDebugMLLog(@"GSPrinting", @"Already had context, returning it.");
|
||||
return _context;
|
||||
}
|
||||
NSDebugMLLog(@"GSPrinting", @"Creating context.");
|
||||
|
||||
info = [_printInfo dictionary];
|
||||
|
||||
output = [info objectForKey: NSPrintSavePath];
|
||||
if (output)
|
||||
{
|
||||
ASSIGN(_path, output);
|
||||
}
|
||||
|
||||
NSDebugMLLog(@"GSPrinting", @"_path is %@", _path);
|
||||
|
||||
[info setObject: _path
|
||||
forKey: @"NSOutputFile"];
|
||||
|
||||
[info setObject: NSGraphicsContextPSFormat
|
||||
forKey: NSGraphicsContextRepresentationFormatAttributeName];
|
||||
|
||||
_context = RETAIN([NSGraphicsContext graphicsContextWithAttributes: info]);
|
||||
|
||||
return _context;
|
||||
}
|
||||
|
||||
@end
|
43
Printing/GSCUPS/GSCUPSPrintPanel.h
Normal file
43
Printing/GSCUPS/GSCUPSPrintPanel.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
GSCUPSPrintPanel.h
|
||||
|
||||
Standard panel to query users for info on a print job
|
||||
|
||||
Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
|
||||
Author: Chad Hardin <cehardin@mac.com>
|
||||
Date: October 2004
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
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 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 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 _GNUstep_H_GSCUPSPrintPanel
|
||||
#define _GNUstep_H_GSCUPSPrintPanel
|
||||
|
||||
#include <AppKit/NSPrintPanel.h>
|
||||
|
||||
|
||||
@interface GSCUPSPrintPanel : NSPrintPanel
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
#endif // _GNUstep_H_GSCUPSPrintPanel
|
44
Printing/GSCUPS/GSCUPSPrintPanel.m
Normal file
44
Printing/GSCUPS/GSCUPSPrintPanel.m
Normal file
|
@ -0,0 +1,44 @@
|
|||
/** <title>GSCUPSPrintPanel</title>
|
||||
|
||||
<abstract>Standard panel for querying user about printing.</abstract>
|
||||
|
||||
Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
|
||||
Author: Chad Hardin <cehardin@mac.com>
|
||||
Date: October 2004
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
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 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 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 "GSCUPSPrintPanel.h"
|
||||
|
||||
|
||||
|
||||
@implementation GSCUPSPrintPanel
|
||||
//
|
||||
// Class methods
|
||||
//
|
||||
+ (id) allocWithZone: (NSZone*)zone
|
||||
{
|
||||
NSDebugMLLog(@"GSPrinting", @"");
|
||||
return NSAllocateObject(self, 0, zone);
|
||||
}
|
||||
|
||||
@end
|
42
Printing/GSCUPS/GSCUPSPrinter.h
Normal file
42
Printing/GSCUPS/GSCUPSPrinter.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
GSCUPSPrinter.h
|
||||
|
||||
Class representing a printer's or printer model's capabilities.
|
||||
|
||||
Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
|
||||
Author: Chad Hardin <cehardin@mac.com>
|
||||
Date: October 2004
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
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 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 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 _GNUstep_H_GSCUPSPrinter
|
||||
#define _GNUstep_H_GSCUPSPrinter
|
||||
|
||||
#include <AppKit/NSPrinter.h>
|
||||
|
||||
|
||||
|
||||
@interface GSCUPSPrinter : NSPrinter <NSCoding>
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#endif // _GNUstep_H_GSCUPSPrinter
|
152
Printing/GSCUPS/GSCUPSPrinter.m
Normal file
152
Printing/GSCUPS/GSCUPSPrinter.m
Normal file
|
@ -0,0 +1,152 @@
|
|||
/** <title>GSCUPSPrinter</title>
|
||||
|
||||
<abstract>Class representing a printer's or printer model's capabilities.</abstract>
|
||||
|
||||
Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
|
||||
Author: Chad Hardin <cehardin@mac.com>
|
||||
Date: October 2004
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
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 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.
|
||||
|
||||
If you are interested in a warranty or support for this source code,
|
||||
contact Scott Christley <scottc@net-community.com> for more information.
|
||||
|
||||
You should have received a copy of the GNU Library 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.
|
||||
*/
|
||||
|
||||
/* NB:
|
||||
* There are a few FIXMEs in the functionality left.
|
||||
* Parsing of the PPDs is somewhat suboptimal.
|
||||
* (I think it's best to leave optimisation until more of GNUstep is done).
|
||||
* The *OpenUI, *CloseUI, *OpenGroup and *CloseGroup are not processed.
|
||||
* (This is not required in the OpenStep standard, but could be useful).
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <Foundation/NSDebug.h>
|
||||
//#include <Foundation/NSAutoreleasePool.h>
|
||||
#include <Foundation/NSArray.h>
|
||||
//#include <Foundation/NSDictionary.h>
|
||||
#include <Foundation/NSString.h>
|
||||
//#include <Foundation/NSBundle.h>
|
||||
//#include <Foundation/NSCharacterSet.h>
|
||||
//#include <Foundation/NSDictionary.h>
|
||||
#include <Foundation/NSException.h>
|
||||
#include <Foundation/NSFileManager.h>
|
||||
#include <Foundation/NSPathUtilities.h>
|
||||
//#include <Foundation/NSScanner.h>
|
||||
//#include <Foundation/NSString.h>
|
||||
//#include <Foundation/NSUserDefaults.h>
|
||||
//#include <Foundation/NSUtilities.h>
|
||||
//#include <Foundation/NSValue.h>
|
||||
//#include <Foundation/NSMapTable.h>
|
||||
#include <Foundation/NSSet.h>
|
||||
#include "AppKit/AppKitExceptions.h"
|
||||
#include "AppKit/NSGraphics.h"
|
||||
#include "GSCUPSPrinter.h"
|
||||
#include "GNUstepGUI/GSPrinting.h"
|
||||
#include <cups/cups.h>
|
||||
|
||||
|
||||
@implementation GSCUPSPrinter
|
||||
|
||||
//
|
||||
// Class methods
|
||||
//
|
||||
+(void) initialize
|
||||
{
|
||||
NSDebugMLLog(@"GSPrinting", @"");
|
||||
if (self == [GSCUPSPrinter class])
|
||||
{
|
||||
// Initial version
|
||||
[self setVersion:1];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+(id) allocWithZone: (NSZone*) zone
|
||||
{
|
||||
NSDebugMLLog(@"GSPrinting", @"");
|
||||
return NSAllocateObject(self, 0, zone);
|
||||
}
|
||||
|
||||
//
|
||||
// Finding an NSPrinter
|
||||
//
|
||||
+ (NSPrinter*) printerWithName: (NSString*) name
|
||||
{
|
||||
NSPrinter* printer;
|
||||
const char* ppdFile;
|
||||
|
||||
printer = [[GSCUPSPrinter alloc]
|
||||
initWithName: name
|
||||
withType: @"Type Unknown"
|
||||
withHost: @"Host Unknown"
|
||||
withNote: @"No Note"];
|
||||
|
||||
ppdFile = cupsGetPPD( [name UTF8String] );
|
||||
|
||||
if( ppdFile )
|
||||
{
|
||||
[printer parsePPDAtPath: [NSString stringWithCString: ppdFile]];
|
||||
unlink( ppdFile );
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"Printer %@ does not have a PPD!", name);
|
||||
}
|
||||
|
||||
return AUTORELEASE(printer);
|
||||
}
|
||||
|
||||
|
||||
+ (NSArray *)printerNames
|
||||
{
|
||||
NSMutableSet *set;
|
||||
int numDests;
|
||||
cups_dest_t* dests;
|
||||
int n;
|
||||
|
||||
set = [[NSMutableSet alloc] init];
|
||||
AUTORELEASE( set );
|
||||
|
||||
numDests = cupsGetDests( &dests );
|
||||
|
||||
for( n = 0; n < numDests; n++ )
|
||||
{
|
||||
[set addObject: [NSString stringWithCString: dests[n].name]];
|
||||
}
|
||||
|
||||
cupsFreeDests( numDests, dests );
|
||||
|
||||
return [set allObjects];
|
||||
}
|
||||
|
||||
|
||||
-(id) initWithCoder: (NSCoder*) coder
|
||||
{
|
||||
return [super initWithCoder: coder];
|
||||
}
|
||||
|
||||
|
||||
-(void) encodeWithCoder: (NSCoder*) coder
|
||||
{
|
||||
[super encodeWithCoder: coder];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
Loading…
Reference in a new issue