Printing/misc merges

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@38686 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Marcian Lytwyn 2015-06-26 00:00:53 +00:00
parent 279df92218
commit beccb8503d
25 changed files with 953 additions and 297 deletions

View file

@ -78,10 +78,18 @@ after-distclean::
rm -f config.status config.log config.cache TAGS config.make gui.make
gui.make: gui.make.in Version configure
./configure
if [ -x config.status ]; then \
./config.status --recheck && ./config.status; \
else \
./configure; \
fi
config.make: config.make.in configure
./configure
if [ -x config.status ]; then \
./config.status --recheck && ./config.status; \
else \
./configure; \
fi
# Things to do before checking
# before-check::

View file

@ -111,6 +111,8 @@
#import <AppKit/NSSpellChecker.h>
#import <AppKit/NSSpellProtocol.h>
#import <AppKit/NSSplitView.h>
#import <AppKit/NSStatusBar.h>
#import <AppKit/NSStatusItem.h>
#import <AppKit/NSStringDrawing.h>
#import <AppKit/NSText.h>
#import <AppKit/NSTextField.h>
@ -134,6 +136,7 @@
#import <AppKit/NSDrawer.h>
#import <AppKit/NSFileWrapper.h>
#import <AppKit/NSFontDescriptor.h>
#import <AppKit/NSGlyphGenerator.h>
#import <AppKit/NSGradient.h>
#import <AppKit/NSGraphicsContext.h>
#import <AppKit/NSHelpManager.h>
@ -178,8 +181,14 @@
#import <AppKit/NSTextStorage.h>
#import <AppKit/NSTextTable.h>
#import <AppKit/NSTextView.h>
#import <AppKit/NSTokenField.h>
#import <AppKit/NSTokenFieldCell.h>
#import <AppKit/NSToolbar.h>
#import <AppKit/NSToolbarItem.h>
#import <AppKit/NSToolbarItemGroup.h>
#import <AppKit/NSTrackingArea.h>
#import <AppKit/NSTreeController.h>
#import <AppKit/NSTreeNode.h>
#import <AppKit/NSUserDefaultsController.h>
#import <AppKit/NSUserInterfaceValidation.h>
#import <AppKit/NSViewController.h>

View file

@ -475,7 +475,7 @@
- (void) encodeShort: (short)value withName: (NSString*)name
{
if (!findingConditionals && name) {
id valueString = [NSString stringWithFormat: @"%s", value];
id valueString = [NSString stringWithFormat: @"%hd", value];
[lastObjectRepresentation setObject: valueString forKey: name];
}
@ -511,7 +511,7 @@
- (void) encodeLong: (long)value withName: (NSString*)name
{
if (!findingConditionals && name) {
id valueString = [NSString stringWithFormat: @"%l", value];
id valueString = [NSString stringWithFormat: @"%ld", value];
[lastObjectRepresentation setObject: valueString forKey: name];
}

134
NEWS
View file

@ -1,9 +1,37 @@
1 NEWS
******
The currently released version of the library is `0.22.0'.
The currently released version of the library is `0.24.1'.
1.1 Noteworthy changes in version `0.22.0'
1.1 Noteworthy changes in version `0.24.1'
==========================================
From a look through ChangeLog, we can see a lot of bugfixes for this
release, with the main focus on avoiding display glitches and improving
OSX compatibility.
1.2 Noteworthy changes in version `0.24.0'
==========================================
New features include:
* Require newer base release as we moved the
-replaceObject:withObject: of NSKeyedUnarchiver there.
* Support for newer releases of the gif library.
* NSTabView is now flipped.
* Theme improvements and changes to image mapping.
Many bugfixes.
1.3 Noteworthy changes in version `0.23.1'
==========================================
This is a bugfix release, primarily to deal with coding/archiving
issues.
1.4 Noteworthy changes in version `0.22.0'
==========================================
New features include:
@ -22,19 +50,19 @@ New features include:
selection of image reps, better support for icons). Many bugfixes,
including in Xib loading, printing, and NSView geometry.
1.2 Noteworthy changes in version `0.20.0'
1.5 Noteworthy changes in version `0.20.0'
==========================================
A new stable release. Many improvments with Nib loading, documents and
document controllers. Fixed many drawing issues, particularly ones
related to flipping. Much improved theming.
1.3 Noteworthy changes in version `0.19.0'
1.6 Noteworthy changes in version `0.19.0'
==========================================
This is an (unstable) copy of the 0.18.0 release
1.4 Noteworthy changes in version `0.18.0'
1.7 Noteworthy changes in version `0.18.0'
==========================================
A new stable release that has had many improvements. Many new Mac OS X
@ -43,14 +71,14 @@ were made (particularly with the use of the Windows theme). There is
also better compatibility with Mac OS X in terms of usage of NSInteger
and other definitions.
1.5 Noteworthy changes in version `0.17.1'
1.8 Noteworthy changes in version `0.17.1'
==========================================
* New Mac OS X 10.5 methods in NSFont
* Add live resize in NSSplitView
1.6 Noteworthy changes in version `0.17.0'
1.9 Noteworthy changes in version `0.17.0'
==========================================
* New Mac OS X 10.5 methods in many classes
@ -59,8 +87,8 @@ and other definitions.
* Several improvements for Garbage Collection
1.7 Noteworthy changes in version `0.16.0'
==========================================
1.10 Noteworthy changes in version `0.16.0'
===========================================
* Nib loading refractored and improved.
@ -70,8 +98,8 @@ and other definitions.
* NSTokenField and netokenFiledCell classes added.
1.8 Noteworthy changes in version `0.14.0'
==========================================
1.11 Noteworthy changes in version `0.14.0'
===========================================
* New class NSGlyphGenerator for glyph generation
@ -81,8 +109,8 @@ and other definitions.
* Manu bug fixes.
1.9 Noteworthy changes in version `0.13.2'
==========================================
1.12 Noteworthy changes in version `0.13.2'
===========================================
* Printing works a little better now.
@ -97,7 +125,7 @@ and other definitions.
* NSDrawer was implemented.
1.10 Noteworthy changes in version `0.13.1'
1.13 Noteworthy changes in version `0.13.1'
===========================================
* NSMenu - Added more MacOS X methods and an ivar.
@ -111,7 +139,7 @@ and other definitions.
* Changed the NSCursor hot point to 0,0 for MacOS X compatibility.
1.11 Noteworthy changes in version `0.13.0'
1.14 Noteworthy changes in version `0.13.0'
===========================================
This is an unstable release. There may be backward compatibility issues
@ -148,7 +176,7 @@ with previous releases of the gui library.
* Base library version 1.15.1 is required for this release
1.12 Noteworthy changes in version `0.12.0'
1.15 Noteworthy changes in version `0.12.0'
===========================================
It has been a long time since the last release and many things have been
@ -173,7 +201,7 @@ added and changed, including new classes, new ivars, and new methods.
* NSSpellServer and NSAffineTransform was moved to GNUstep base for
Mac OS X compatibility.
1.13 Noteworthy changes in version `0.11.0'
1.16 Noteworthy changes in version `0.11.0'
===========================================
* Added support for keyed encoding in all gui classes.
@ -184,26 +212,26 @@ added and changed, including new classes, new ivars, and new methods.
* Implemented glue code in GSNibCompatibility for classes such as
NSIBObjectData, NSClassSwapper, etc. to facilitate nib loading.
1.14 Noteworthy changes in version `0.10.3'
1.17 Noteworthy changes in version `0.10.3'
===========================================
* Horizontal menus now work
* Better support for tracking active applications.
1.15 Noteworthy changes in version `0.10.2'
1.18 Noteworthy changes in version `0.10.2'
===========================================
Mostly bug fixes.
1.16 Noteworthy changes in version `0.10.1'
1.19 Noteworthy changes in version `0.10.1'
===========================================
GNUstep now uses v19 of portaudio for the sound daemon. Version v19
hasn't been officially released, but it is still used in several
distributions (SuSE, etc) as v18 is very old.
1.17 Noteworthy changes in version `0.10.0'
1.20 Noteworthy changes in version `0.10.0'
===========================================
This release is binary incompatible with previous releases. The
@ -215,7 +243,7 @@ new version.
* Keyed encoding is supported in many classes.
1.18 Noteworthy changes in version `0.9.5'
1.21 Noteworthy changes in version `0.9.5'
==========================================
* Beginnings of CUPS interface were added.
@ -228,7 +256,7 @@ new version.
* You can find the GUI library's version using the Info.plist
1.19 Noteworthy changes in version `0.9.4'
1.22 Noteworthy changes in version `0.9.4'
==========================================
* The printing classes have been completely reorganized to
@ -243,7 +271,7 @@ new version.
* Some improvement of NSDataLink classes.
1.20 Noteworthy changes in version `0.9.3'
1.23 Noteworthy changes in version `0.9.3'
==========================================
* Spell checker reimplemented using libaspell
@ -255,7 +283,7 @@ new version.
* Binary incompatibilites from ivar additions in NSView and
subclasses.
1.21 Noteworthy changes in version `0.9.2'
1.24 Noteworthy changes in version `0.9.2'
==========================================
* Working NSToolbar implementation
@ -274,7 +302,7 @@ new version.
* Much improved loading of gorm files
1.22 Noteworthy changes in version `0.9.1'
1.25 Noteworthy changes in version `0.9.1'
==========================================
* NSWindow - DnD works on whole window and events are propogated up
@ -282,14 +310,14 @@ new version.
* Absolute paths and DnD works in OpenPanels.
1.23 Noteworthy changes in version `0.9.0'
1.26 Noteworthy changes in version `0.9.0'
==========================================
Improvements in various classes, include NSPopUpButton,
NSBitmapImageRep, NSMenu, NSToolbar. Added support for thumbnail images
in NSWorkspace.
1.24 Noteworthy changes in version `0.8.9'
1.27 Noteworthy changes in version `0.8.9'
==========================================
Note that many headers have moved to new locations (both in the package
@ -298,14 +326,14 @@ applications may not compile because they cannot find the right header.
* New Language Setup documentation.
1.25 Noteworthy changes in version `0.8.8'
1.28 Noteworthy changes in version `0.8.8'
==========================================
* Updated LanguageSetup documentation
* Improved RTF reader (unicode support, etc).
1.26 Noteworthy changes in version `0.8.7'
1.29 Noteworthy changes in version `0.8.7'
==========================================
* NSBezierPath glyph methods implemented (depends on backend).
@ -315,7 +343,7 @@ applications may not compile because they cannot find the right header.
* Added default to load user-defined bundles (GSAppKitUserBundles
default).
1.27 Noteworthy changes in version `0.8.6'
1.30 Noteworthy changes in version `0.8.6'
==========================================
Updated to install in new locations based on changes in gnustep-make
@ -327,12 +355,12 @@ Updated to install in new locations based on changes in gnustep-make
* Lots of menu improvements.
1.28 Noteworthy changes in version `0.8.5'
1.31 Noteworthy changes in version `0.8.5'
==========================================
Bug fixes. NSStringDrawing now uses text system implementation.
1.29 Noteworthy changes in version `0.8.4'
1.32 Noteworthy changes in version `0.8.4'
==========================================
This release features a brand new text and layout system thanks to
@ -346,7 +374,7 @@ Alexander Malmberg. Other improvements include:
* NSToolbar partially implemented.
1.30 Noteworthy changes in version `0.8.3'
1.33 Noteworthy changes in version `0.8.3'
==========================================
* Additions for Gorm support.
@ -363,7 +391,7 @@ Alexander Malmberg. Other improvements include:
* Key view handling rewritten.
1.31 Noteworthy changes in version `0.8.2'
1.34 Noteworthy changes in version `0.8.2'
==========================================
* Handle fonts that aren't found better.
@ -380,7 +408,7 @@ Alexander Malmberg. Other improvements include:
* Fix firstResponder status in text fields.
1.32 Noteworthy changes in version `0.8.1'
1.35 Noteworthy changes in version `0.8.1'
==========================================
* Handle scaled curves correctly.
@ -393,10 +421,10 @@ Alexander Malmberg. Other improvements include:
* Spell checker starts correctly now.
1.33 Noteworthy changes in version `0.8.0'
1.36 Noteworthy changes in version `0.8.0'
==========================================
1.34 Noteworthy changes in version `0.7.9'
1.37 Noteworthy changes in version `0.7.9'
==========================================
* NSTableView, NSOutlineView improvements.
@ -405,14 +433,14 @@ Alexander Malmberg. Other improvements include:
* Skeleton implementation of NSToolBar
1.35 Noteworthy changes in version `0.7.8'
1.38 Noteworthy changes in version `0.7.8'
==========================================
* Wheel color picker, standard color picker (bundles) added.
* System colors now use named colors. Easier configuration
1.36 Noteworthy changes in version `0.7.7'
1.39 Noteworthy changes in version `0.7.7'
==========================================
The graphics/window interface was completely revamped. Window functions
@ -436,7 +464,7 @@ computers, although it is in a very alpha state.
* NSOutlineView much improved.
1.37 Noteworthy changes in version `0.7.6'
1.40 Noteworthy changes in version `0.7.6'
==========================================
* NSOutlineView implemented.
@ -449,7 +477,7 @@ computers, although it is in a very alpha state.
* Memory panel available from Info Panel.
1.38 Noteworthy changes in version `0.7.5'
1.41 Noteworthy changes in version `0.7.5'
==========================================
* Drag and drop and image sliding much improved.
@ -480,7 +508,7 @@ computers, although it is in a very alpha state.
* Gmodel code compiled as a separate bundle.
1.39 Noteworthy changes in version `0.7.0'
1.42 Noteworthy changes in version `0.7.0'
==========================================
* Much improvement in NSBrowser, NSMatrix, NSPopUpButton, combo
@ -496,7 +524,7 @@ computers, although it is in a very alpha state.
* NSColorWell works.
1.40 Noteworthy changes in version `0.6.7'
1.43 Noteworthy changes in version `0.6.7'
==========================================
* App Icons can support documents dropped using DnD.
@ -523,7 +551,7 @@ computers, although it is in a very alpha state.
* Support middle mouse button.
1.41 Noteworthy changes in version `0.6.6'
1.44 Noteworthy changes in version `0.6.6'
==========================================
* Window hints for motif and generic window managers.
@ -560,7 +588,7 @@ however, that the xdps backend is still considered experimental and you
may have to deal with many problems in order to get it working. We
recommend sticking with the xgps backend (the default) for now.
1.42 Noteworthy changes in version `0.6.5'
1.45 Noteworthy changes in version `0.6.5'
==========================================
Many of the basic GUI classes have been vastly improved or rewritten,
@ -594,7 +622,7 @@ thanks to Nicola Pero <n.pero@mi.flashnet.it> and many others.
been written, thanks to Richard Frith-Macdonald
<richard@brainstorm.co.uk>
1.43 Noteworthy changes in version `0.6.0'
1.46 Noteworthy changes in version `0.6.0'
==========================================
A Huge amount of progress, although a lot still needs to be done. It's
@ -625,7 +653,7 @@ apps and libraries have been ported with little changes.
* Several fixes that at least double the speed of the gui.
1.44 Noteworthy changes in version `0.5.5'
1.47 Noteworthy changes in version `0.5.5'
==========================================
Too extensive to list.
@ -634,7 +662,7 @@ Too extensive to list.
cleanup of coordinate conversion code, etc.
1.45 Noteworthy changes in version `0.5.0'
1.48 Noteworthy changes in version `0.5.0'
==========================================
* NSBrowser and NSBrowserCell have been implemented. There is one
@ -684,7 +712,7 @@ Too extensive to list.
* Several cleanups and as usual, many bug fixes.
1.46 Noteworthy changes in version `0.3.0'
1.49 Noteworthy changes in version `0.3.0'
==========================================
* Completely reworked the menu class. The NSMenu class is now
@ -716,7 +744,7 @@ Too extensive to list.
implement the NSCopying protocol and many others.
1.47 Noteworthy changes in version `0.2.0'
1.50 Noteworthy changes in version `0.2.0'
==========================================
* Additional NSImage and NSImageRep class work. Incorporated common
@ -751,7 +779,7 @@ Too extensive to list.
* Many bug fixes and minor enhancements.
1.48 Noteworthy changes in version `0.1.1'
1.51 Noteworthy changes in version `0.1.1'
==========================================
* Almost complete implementation of the PXKMenu and PXKMenuCell
@ -775,7 +803,7 @@ Too extensive to list.
manipulating tiff files and images.
1.49 Noteworthy changes in version `0.1.0'
1.52 Noteworthy changes in version `0.1.0'
==========================================
* Integration of the GNUstep X/DPS GUI Backend. This has finally

View file

@ -42,5 +42,9 @@ ifeq ($(BUILD_GSCUPS), YES)
SUBPROJECTS += GSCUPS
endif
ifeq ($(GNUSTEP_TARGET_OS),mingw32)
SUBPROJECTS = GSWIN32
endif
include $(GNUSTEP_MAKEFILES)/aggregate.make

View file

@ -69,12 +69,10 @@ GSCUPS_BUNDLE_LIBS += $(GSCUPS_LIBS)
# Header files
#
GSCUPS_HEADERS= \
GSCUPSPrincipalClass.m \
GSCUPSPageLayout.m \
GSCUPSPrintInfo.m \
GSCUPSPrintOperation \
GSCUPSPrintPanel.m \
GSCUPSPrinter.m
GSCUPSPrincipalClass.h \
GSCUPSPrintInfo.h \
GSCUPSPrintOperation.h \
GSCUPSPrinter.h
#
@ -82,10 +80,8 @@ GSCUPS_HEADERS= \
#
GSCUPS_OBJC_FILES= \
GSCUPSPrincipalClass.m \
GSCUPSPageLayout.m \
GSCUPSPrintInfo.m \
GSCUPSPrintOperation.m \
GSCUPSPrintPanel.m \
GSCUPSPrinter.m

View file

@ -1,41 +0,0 @@
/** <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 Lesser 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _GNUstep_H_GSCUPSPageLayout
#define _GNUstep_H_GSCUPSPageLayout
#import "AppKit/NSPageLayout.h"
@interface GSCUPSPageLayout: NSPageLayout
{
}
@end
#endif // _GNUstep_H_GSCUPSPageLayout

View file

@ -1,51 +0,0 @@
/** <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 Lesser 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#import <Foundation/NSDebug.h>
#import "GSCUPSPageLayout.h"
@implementation GSCUPSPageLayout
//
// Class methods
//
+ (void)initialize
{
if (self == [GSCUPSPageLayout class])
{
// Initial version
[self setVersion:1];
}
}
+ (id) allocWithZone: (NSZone*)zone
{
return NSAllocateObject(self, 0, zone);
}
@end

View file

@ -29,10 +29,8 @@
#import <Foundation/NSDebug.h>
#import "GSCUPSPrincipalClass.h"
#import "GSCUPSPageLayout.h"
#import "GSCUPSPrintInfo.h"
#import "GSCUPSPrintOperation.h"
#import "GSCUPSPrintPanel.h"
#import "GSCUPSPrinter.h"
@ -40,10 +38,6 @@
//
// Class methods
//
+(Class) pageLayoutClass
{
return [GSCUPSPageLayout class];
}
+(Class) printInfoClass
{
@ -55,19 +49,11 @@
return [GSCUPSPrintOperation class];
}
+(Class) printPanelClass
{
return [GSCUPSPrintPanel class];
}
+(Class) printerClass
{
return [GSCUPSPrinter class];
}
+(Class) gsPrintOperationClass
{
return [GSCUPSPrintOperation class];

View file

@ -1,42 +0,0 @@
/** <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 Lesser 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#import <Foundation/NSDebug.h>
#import "GSCUPSPrintPanel.h"
@implementation GSCUPSPrintPanel
//
// Class methods
//
+ (id) allocWithZone: (NSZone*)zone
{
return NSAllocateObject(self, 0, zone);
}
@end

View file

@ -57,22 +57,18 @@ endif
# Header files
#
GSLPR_HEADERS= \
GSLPRPrincipalClass.m \
GSLPRPageLayout.m \
GSLPRPrintInfo.m \
GSLPRPrintOperation \
GSLPRPrintPanel.m \
GSLPRPrinter.m
GSLPRPrincipalClass.h \
GSLPRPrintInfo.h \
GSLPRPrintOperation.h \
GSLPRPrinter.h
#
# Class files
#
GSLPR_OBJC_FILES= \
GSLPRPrincipalClass.m \
GSLPRPageLayout.m \
GSLPRPrintInfo.m \
GSLPRPrintOperation.m \
GSLPRPrintPanel.m \
GSLPRPrinter.m
#

View file

@ -29,10 +29,8 @@
#import <Foundation/NSDebug.h>
#import "GSLPRPrincipalClass.h"
#import "GSLPRPageLayout.h"
#import "GSLPRPrintInfo.h"
#import "GSLPRPrintOperation.h"
#import "GSLPRPrintPanel.h"
#import "GSLPRPrinter.h"
@ -40,11 +38,6 @@
//
// Class methods
//
+(Class) pageLayoutClass
{
return [GSLPRPageLayout class];
}
+(Class) printInfoClass
{
return [GSLPRPrintInfo class];
@ -55,19 +48,11 @@
return [GSLPRPrintOperation class];
}
+(Class) printPanelClass
{
return [GSLPRPrintPanel class];
}
+(Class) printerClass
{
return [GSLPRPrinter class];
}
+(Class) gsPrintOperationClass
{
return [GSLPRPrintOperation class];

View file

@ -0,0 +1,98 @@
#
# GSWIN32 Printing Backend Bundle makefile for GNUstep GUI Library
#
# 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.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; see the file COPYING.LIB.
# If not, see <http://www.gnu.org/licenses/> or write to the
# Free Software Foundation, 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
PACKAGE_NAME = gnustep-gui
GNUSTEP_LOCAL_ADDITIONAL_MAKEFILES=../../gui.make
include $(GNUSTEP_MAKEFILES)/common.make
include ../../config.make
include ../../Version
BUNDLE_NAME=GSWIN32
BUNDLE_INSTALL_DIR= $(GNUSTEP_BUNDLES)/GSPrinting
GSWIN32_PRINCIPAL_CLASS=GSWIN32PrincipalClass
ifeq ($(GNUSTEP_TARGET_OS),mingw32)
GSWIN32_BUNDLE_LIBS += -lgnustep-gui $(FND_LIBS) $(OBJC_LIBS)
endif
ifeq ($(GNUSTEP_TARGET_OS),cygwin)
GSWIN32_BUNDLE_LIBS += -lgnustep-gui $(FND_LIBS) $(OBJC_LIBS)
endif
#
# Libraries
#
#GSWIN32_LIBRARIES_DEPEND_UPON +=
#
# Resource files
#
#GSWIN32_RESOURCE_FILES =
#
# Header files
#
GSWIN32_HEADERS= \
GSWIN32PrincipalClass.h \
GSWIN32PrintInfo.h \
GSWIN32PrintOperation.h \
GSWIN32Printer.h
#
# Class files
#
GSWIN32_OBJC_FILES= \
GSWIN32PrincipalClass.m \
GSWIN32PrintInfo.m \
GSWIN32PrintOperation.m \
GSWIN32Printer.m
#
# C files
#
#GSWIN32_C_FILES =
#
# Languages
#
#GSWIN32_LANGUAGES= \
# English
#
# Localized Resource Files
#
#GSWIN32_LOCALIZED_RESOURCE_FILES= \
# GSWIN32PrintPanel.gorm \
# GSWIN32PageLayout.gorm
#
# Makefiles
#
-include GNUmakefile.preamble
#include $(GNUSTEP_MAKEFILES)/aggregate.make
include $(GNUSTEP_MAKEFILES)/bundle.make
-include GNUmakefile.postamble

View file

@ -0,0 +1,42 @@
#
# GNUmakefile.postamble
#
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# 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::

View file

@ -0,0 +1,43 @@
#
# GNUmakefile.postamble
#
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# 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 +=
# 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 +=
# 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 +=
# ObjC stuff
ADDITIONAL_OBJC_LIBS += -lwinspool
#-lgnustep-gui $(SYSTEM_LIBS)
# Tools
ADDITIONAL_TOOL_LIBS +=
# WebObjects
ADDITIONAL_WO_LIBS +=
# Additional directories to be created during installation
#ADDITIONAL_INSTALL_DIRS +=

View file

@ -1,12 +1,11 @@
/*
GSCUPSPrintPanel.h
/** <title>GSWIN32PrincipalClass</title>
Standard panel to query users for info on a print job
<abstract>Principal class for the GSWIN32 Bundle.</abstract>
Copyright (C) 2004 Free Software Foundation, Inc.
Author: Chad Hardin <cehardin@mac.com>
Date: October 2004
Date: June 2004
This file is part of the GNUstep GUI Library.
@ -27,16 +26,16 @@
Boston, MA 02110-1301, USA.
*/
#ifndef _GNUstep_H_GSCUPSPrintPanel
#define _GNUstep_H_GSCUPSPrintPanel
#ifndef _GNUstep_H_GSWIN32PrincipalClass
#define _GNUstep_H_GSWIN32PrincipalClass
#import "AppKit/NSPrintPanel.h"
#import "GNUstepGUI/GSPrinting.h"
@interface GSCUPSPrintPanel : NSPrintPanel
@interface GSWIN32PrincipalClass : GSPrintingPrincipalClass
{
}
@end
#endif // _GNUstep_H_GSCUPSPrintPanel
#endif // _GNUstep_H_GSWIN32PrincipalClass

View file

@ -1,8 +1,10 @@
/** <title>GSLPRPageLayout</title>
/*
GSWIN32PrincipalClass.m
<abstract></abstract>
Principal class for the GSWIN32 Bundle
Copyright (C) 2004 Free Software Foundation, Inc.
Author: Chad Hardin <cehardin@mac.com>
Date: June 2004
@ -26,26 +28,34 @@
*/
#import <Foundation/NSDebug.h>
#import "GSLPRPageLayout.h"
#import "GSWIN32PrincipalClass.h"
#import "GSWIN32PrintInfo.h"
#import "GSWIN32PrintOperation.h"
#import "GSWIN32Printer.h"
@implementation GSLPRPageLayout
@implementation GSWIN32PrincipalClass
//
// Class methods
//
+ (void)initialize
+(Class) printInfoClass
{
if (self == [GSLPRPageLayout class])
{
// Initial version
[self setVersion:1];
}
return [GSWIN32PrintInfo class];
}
+ (id) allocWithZone: (NSZone*)zone
+(Class) printOperationClass
{
return NSAllocateObject(self, 0, zone);
return [GSWIN32PrintOperation class];
}
+(Class) printerClass
{
return [GSWIN32Printer class];
}
+(Class) gsPrintOperationClass
{
return [GSWIN32PrintOperation class];
}
@end

View file

@ -1,10 +1,12 @@
/** <title>GSLPRPageLayout</title>
/** <title>GSWIN32PrintInfo</title>
<abstract>Standard panel for querying user about page layout.</abstract>
<abstract>Stores information used in printing.</abstract>
Copyright (C) 2001,2004 Free Software Foundation, Inc.
Copyright (C) 1996,1997,2004 Free Software Foundation, Inc.
Written By: Adam Fedor <fedor@gnu.org>
Author: Simon Frankau <sgf@frankau.demon.co.uk>
Date: July 1997
Author: Adam Fedor <fedor@gnu.org>
Date: Oct 2001
Modified for Printing Backend Support
Author: Chad Hardin <cehardin@mac.com>
@ -29,18 +31,15 @@
Boston, MA 02110-1301, USA.
*/
#ifndef _GNUstep_H_GSLPRPageLayout
#define _GNUstep_H_GSLPRPageLayout
#ifndef _GNUstep_H_GSWIN32PrintInfo
#define _GNUstep_H_GSWIN32PrintInfo
#import "AppKit/NSPageLayout.h"
#import <Foundation/NSCoder.h>
#import "AppKit/NSPrintInfo.h"
@class NSPrintInfo;
@class NSView;
@interface GSLPRPageLayout: NSPageLayout
@interface GSWIN32PrintInfo: NSPrintInfo
{
}
@end
#endif // _GNUstep_H_GSLPRPageLayout
#endif // _GNUstep_H_GSWIN32PrintInfo

View file

@ -0,0 +1,114 @@
/*
GSWIN32PrintInfo.m
Stores information used in printing
Copyright (C) 1996,1997,2004 Free Software Foundation, Inc.
Author: Simon Frankau <sgf@frankau.demon.co.uk>
Date: July 1997
Modified for Printing Backend Support
Author: Chad Hardin <cehardin@mac.com>
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 Lesser 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#import <Foundation/NSArray.h>
#import <Foundation/NSDebug.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSUserDefaults.h>
#import <Foundation/NSValue.h>
#import "AppKit/NSPrinter.h"
#import "GSWIN32PrintInfo.h"
@implementation GSWIN32PrintInfo
//
// Class methods
//
+ (void)initialize
{
if (self == [GSWIN32PrintInfo class])
{
// Initial version
[self setVersion:1];
}
}
+ (id) allocWithZone: (NSZone*)zone
{
return NSAllocateObject(self, 0, zone);
}
+(NSPrinter*) defaultPrinter
{
NSUserDefaults *defaults;
NSString *name;
NSDebugMLLog(@"GSPrinting", @"defaultPrinter");
defaults = [NSUserDefaults standardUserDefaults];
name = [defaults objectForKey: @"GSWIN32DefaultPrinter"];
if (name == nil)
{
name = [[NSPrinter printerNames] objectAtIndex: 0];
}
else
{
if ([NSPrinter printerWithName: name] == nil)
{
name = [[NSPrinter printerNames] objectAtIndex: 0];
}
}
return [NSPrinter printerWithName: name];
}
+ (void)setDefaultPrinter:(NSPrinter *)printer
{
NSUserDefaults *defaults;
NSMutableDictionary *globalDomain;
NSDebugMLLog(@"GSPrinting", @"setDefaultPrinter");
defaults = [NSUserDefaults standardUserDefaults];
globalDomain = (NSMutableDictionary*)[defaults persistentDomainForName: NSGlobalDomain];
if (globalDomain)
{
globalDomain = [globalDomain mutableCopy];
[globalDomain setObject: [printer name]
forKey: @"GSWIN32DefaultPrinter"];
[defaults setPersistentDomain: globalDomain
forName: NSGlobalDomain];
RELEASE(globalDomain);
}
else
{
NSDebugMLLog(@"GSPrinting", @"(GSWIN32) Could not save default printer named %@ to NSUserDefaults GSWIN32DefaultPrinter in NSGlobalDomain.", [printer name]);
}
}
@end

View file

@ -1,15 +1,22 @@
/** <title>GSLPRPrintPanel</title>
/** <title>GSWIN32PrintOperation</title>
<abstract>Standard panel for querying user about printing.</abstract>
<abstract>Controls generation of EPS, PDF or PS print jobs.</abstract>
Copyright (C) 2001,2004 Free Software Foundation, Inc.
Written By: Adam Fedor <fedor@gnu.org>
Copyright (C) 1996,2004 Free Software Foundation, Inc.
Author: Gregory Casamento <greg.casamento@gmail.com>
Date: 2014
Author: Scott Christley <scottc@net-community.com>
Date: 1996
Author: Fred Kiefer <FredKiefer@gmx.de>
Date: November 2000
Updated to new specification
Author: Adam Fedor <fedor@gnu.org>
Date: Oct 2001
Modified for Printing Backend Support
Author: Chad Hardin <cehardin@mac.com>
Date: June 2004
This file is part of the GNUstep GUI Library.
This library is free software; you can redistribute it and/or
@ -27,19 +34,23 @@
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
*/
#import <Foundation/NSDebug.h>
#import "GSLPRPrintPanel.h"
#ifndef _GNUstep_H_GSWIN32PrintOperation
#define _GNUstep_H_GSWIN32PrintOperation
#import "GNUstepGUI/GSPrintOperation.h"
@implementation GSLPRPrintPanel
//
// Class methods
//
+ (id) allocWithZone: (NSZone*)zone
//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 GSWIN32PrintOperation : GSPrintOperation
{
return NSAllocateObject(self, 0, zone);
}
@end
#endif // _GNUstep_H_GSWIN32PrintOperation

View file

@ -0,0 +1,223 @@
/*
GWIN32PrintOperation.m
Controls operations generating windows print
Copyright (C) 2014 Free Software Foundation, Inc.
Author: Gregory John Casamento <greg.casamento@gmail.com>
Date 2014
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 Lesser 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include <config.h>
#import <Foundation/NSDebug.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSPathUtilities.h>
#import <Foundation/NSString.h>
#import <Foundation/NSTask.h>
#import <Foundation/NSValue.h>
#import <Foundation/NSData.h>
#import "AppKit/NSGraphicsContext.h"
#import "AppKit/NSView.h"
#import "AppKit/NSPrinter.h"
#import "AppKit/NSPrintPanel.h"
#import "AppKit/NSPrintInfo.h"
#import "AppKit/NSPrintOperation.h"
#import "GSGuiPrivate.h"
#import "GSWIN32PrintOperation.h"
BOOL RawDataToPrinter(LPSTR szPrinterName, LPBYTE lpData, DWORD dwCount)
{
HANDLE hPrinter;
DOC_INFO_1 DocInfo;
DWORD dwJob;
DWORD dwBytesWritten;
// Need a handle to the printer.
if( ! OpenPrinter( szPrinterName, &hPrinter, NULL ) )
{
return FALSE;
}
// Fill in the structure with info about this "document."
DocInfo.pDocName = "My Document";
DocInfo.pOutputFile = NULL;
DocInfo.pDatatype = "RAW";
// Inform the spooler the document is beginning.
if( (dwJob = StartDocPrinter( hPrinter, 1, (LPSTR)&DocInfo )) == 0 )
{
ClosePrinter( hPrinter );
return FALSE;
}
// Start a page.
if( ! StartPagePrinter( hPrinter ) )
{
EndDocPrinter( hPrinter );
ClosePrinter( hPrinter );
return FALSE;
}
// Send the data to the printer.
if( ! WritePrinter( hPrinter, lpData, dwCount, &dwBytesWritten ) )
{
EndPagePrinter( hPrinter );
EndDocPrinter( hPrinter );
ClosePrinter( hPrinter );
return FALSE;
}
// End the page.
if( ! EndPagePrinter( hPrinter ) )
{
EndDocPrinter( hPrinter );
ClosePrinter( hPrinter );
return FALSE;
}
// Inform the spooler that the document is ending.
if( ! EndDocPrinter( hPrinter ) )
{
ClosePrinter( hPrinter );
return FALSE;
}
// Tidy up the printer handle.
ClosePrinter( hPrinter );
// Check to see if correct number of bytes were written.
if( dwBytesWritten != dwCount )
{
return FALSE;
}
return TRUE;
}
//A subclass of GSPrintOperation, NOT NSPrintOperation.
@implementation GSWIN32PrintOperation
//
// Class methods
//
+ (id) allocWithZone: (NSZone*)zone
{
return NSAllocateObject(self, 0, zone);
}
- (id)initWithView:(NSView *)aView
printInfo:(NSPrintInfo *)aPrintInfo
{
self = [super initWithView: aView
printInfo: aPrintInfo];
if (self == nil)
return nil;
_path = [NSTemporaryDirectory()
stringByAppendingPathComponent: @"GSWIN32PrintJob-"];
_path = [_path stringByAppendingString:
[[NSProcessInfo processInfo] globallyUniqueString]];
_path = [_path stringByAppendingPathExtension: @"ps"];
RETAIN(_path);
return self;
}
- (BOOL) _deliverSpooledResult
{
NSString *name = nil;
NSData *fileData = nil;
LPSTR szPrinterName = NULL;
DWORD dwCount = 0;
LPBYTE lpData = NULL;
BOOL result = FALSE;
name = [[[self printInfo] printer] name];
if(name != nil)
{
szPrinterName = (LPSTR)[name cString];
fileData = [NSData dataWithContentsOfFile:_path];
if(fileData != nil)
{
dwCount = (DWORD)[fileData length];
lpData = (LPBYTE)[fileData bytes];
result = RawDataToPrinter(szPrinterName, lpData, dwCount);
}
else
{
NSLog(@"File is blank");
}
}
else
{
NSLog(@"No printer name supplied");
}
return (result ? YES : NO); // Paranoid conversion to ObjC type...
}
- (NSGraphicsContext*)createContext
{
NSMutableDictionary *info;
NSString *output;
if (_context)
{
NSDebugMLLog(@"GSPrinting", @"Already had context, returning it.");
return _context;
}
NSDebugMLLog(@"GSPrinting", @"Creating context.");
info = [[self printInfo] dictionary];
output = [info objectForKey: NSPrintSavePath];
if (output)
{
ASSIGN(_path, output);
}
NSDebugMLLog(@"GSPrinting", @"_path is %@", _path);
[info setObject: _path
forKey: @"NSOutputFile"];
if ([[[_path pathExtension] lowercaseString] isEqualToString: @"pdf"])
{
[info setObject: NSGraphicsContextPDFFormat
forKey: NSGraphicsContextRepresentationFormatAttributeName];
}
else
{
[info setObject: NSGraphicsContextPSFormat
forKey: NSGraphicsContextRepresentationFormatAttributeName];
}
_context = RETAIN([NSGraphicsContext graphicsContextWithAttributes: info]);
return _context;
}
@end

View file

@ -1,12 +1,12 @@
/*
GSLPRPrintPanel.h
GSWIN32Printer.h
Standard panel to query users for info on a print job
Class representing a printer's or printer model's capabilities.
Copyright (C) 1996,2004 Free Software Foundation, Inc.
Copyright (C) 1996, 1997,2004 Free Software Foundation, Inc.
Author: Scott Christley <scottc@net-community.com>
Date: 1996
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
@ -30,15 +30,17 @@
Boston, MA 02110-1301, USA.
*/
#ifndef _GNUstep_H_GSLPRPrintPanel
#define _GNUstep_H_GSLPRPrintPanel
#ifndef _GNUstep_H_GSWIN32Printer
#define _GNUstep_H_GSWIN32Printer
#import "AppKit/NSPrintPanel.h"
#import "AppKit/NSPrinter.h"
@interface GSLPRPrintPanel : NSPrintPanel
@interface GSWIN32Printer : NSPrinter
{
}
+(NSDictionary*) printersDictionary;
@end
#endif // _GNUstep_H_GSLPRPrintPanel
#endif // _GNUstep_H_GSWIN32Printer

View file

@ -0,0 +1,233 @@
/** <title>GSWIN32Printer</title>
<abstract>Class representing a printer's or printer model's capabilities.</abstract>
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
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 Lesser 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, 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"
#import <Foundation/NSDebug.h>
#import <Foundation/NSBundle.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSException.h>
#import <Foundation/NSString.h>
#import <Foundation/NSUserDefaults.h>
#import <Foundation/NSValue.h>
#import "GSWIN32Printer.h"
#import "GNUstepGUI/GSPrinting.h"
NSMutableDictionary *EnumeratePrinters(DWORD flags)
{
PRINTER_INFO_2* prninfo=NULL;
DWORD needed, returned;
NSMutableDictionary *printers = nil;
//find required size for the buffer
EnumPrinters(flags, NULL, 2, NULL, 0, &needed, &returned);
//allocate array of PRINTER_INFO structures
prninfo = (PRINTER_INFO_2*) GlobalAlloc(GPTR,needed);
//call again
if (!EnumPrinters(flags, NULL,
2, (LPBYTE) prninfo, needed, &needed, &returned))
{
NSLog(@"Error: %s\n", GetLastError());
}
else
{
int i = 0;
printers = [NSMutableDictionary dictionary];
NSLog(@"Printers found: %d\n\n",returned);
for (i = 0; i < returned; i++)
{
NSMutableDictionary *entry = [NSMutableDictionary dictionary];
NSString *printerName =
[NSString stringWithCString:prninfo[i].pPrinterName
encoding:NSASCIIStringEncoding];
if (printerName != nil)
{
NSString *portName =
[NSString stringWithCString:prninfo[i].pPortName
encoding:NSASCIIStringEncoding];
if (portName != nil)
{
[entry setObject:portName
forKey:@"Host"];
[entry setObject:[NSString stringWithFormat:@"Current Status: %d",prninfo[i].Status]
forKey:@"Note"];
[entry setObject:@"Generic Postscript Printer"
forKey:@"Type"];
[printers setObject:entry
forKey:printerName];
/*
NSLog(@"%s on %s, Status = %d, jobs=%d\n",
prninfo[i].pPrinterName,
prninfo[i].pPortName,
prninfo[i].Status,
prninfo[i].cJobs);
*/
}
else
{
NSLog(@"Port name is nil for %@",printerName);
}
}
else
{
NSLog(@"Printer name is nil");
}
}
}
GlobalFree(prninfo);
return printers;
}
@implementation GSWIN32Printer
//
// Class methods
//
+(void) initialize
{
if (self == [GSWIN32Printer class])
{
// Initial version
[self setVersion:1];
}
}
+(id) allocWithZone: (NSZone*) zone
{
return NSAllocateObject(self, 0, zone);
}
//
// Finding an NSPrinter
//
+ (NSPrinter*) printerWithName: (NSString*) name
{
NSDictionary* printersDict;
NSDictionary* printerEntry;
NSPrinter* printer;
printersDict = [self printersDictionary];
printerEntry = [printersDict objectForKey: name];
if( printerEntry == nil)
{
[NSException raise: NSGenericException
format: @"(GSWIN32) Could not find printer named %@", name];
return nil;
}
NSDebugMLLog(@"GSPrinting", @"Creating NSPrinter with Printer Entry: %@",
[printerEntry description]);
printer = [(GSWIN32Printer*)[self alloc]
initWithName: name
withType: [printerEntry objectForKey: @"Type"]
withHost: [printerEntry objectForKey: @"Host"]
withNote: [printerEntry objectForKey: @"Note"]];
// [printer parsePPDAtPath: [printerEntry objectForKey: @"PPDPath"]];
return AUTORELEASE(printer);
}
+ (NSArray *)printerNames
{
return [[self printersDictionary] allKeys];
}
//
// Load the printer setup
//
+ (NSDictionary*) printersDictionary
{
static BOOL didWarn;
NSDictionary *printers;
printers = EnumeratePrinters(PRINTER_ENUM_LOCAL);
if (!printers) //Not set, make a default printer because we are nice.
{
NSString *ppdPath;
NSMutableDictionary *printerEntry;
printers = [NSMutableDictionary dictionary];
printerEntry = [NSMutableDictionary dictionary];
ppdPath = [NSBundle
pathForLibraryResource: @"Generic-PostScript_Printer-Postscript"
ofType: @"ppd"
inDirectory: @"PostScript/PPD"];
NSAssert(ppdPath,
@"Couldn't find the PPD file for the fallback printer.");
[printerEntry setObject: ppdPath
forKey: @"PPDPath"];
[printerEntry setObject: @"localhost"
forKey: @"Host"];
[printerEntry setObject: @"Automatically Generated"
forKey: @"Note"];
[printerEntry setObject: @"Unknown"
forKey: @"Type"];
[(NSMutableDictionary*)printers setObject: printerEntry
forKey: @"Unnamed"];
if (!didWarn)
{
NSLog(@"Creating a default printer since no printer has been set "
@"in the user defaults (under the GSWIN32Printers key).");
didWarn = YES;
}
}
return printers;
}
@end

View file

@ -34,6 +34,7 @@
#import "GSGuiPrivate.h"
#import "AppKit/NSApplication.h"
#import "AppKit/NSBezierPath.h"
#import "AppKit/NSBitmapImageRep.h"
#import "AppKit/NSNibLoading.h"
#import "AppKit/NSEvent.h"

View file

@ -4,6 +4,9 @@ License: LGPL
Group: Development/Libraries
Source: ftp://ftp.gnustep.org/pub/gnustep/core/%{gs_name}-%{gs_version}.tar.gz
Requires: gnustep-base >= 1.15.1
Packager: GNUstep Development <bug-gnustep@gnu.org>
Vendor: The GNUstep Project
URL: http://www.gnustep.org/
%description
The GNUstep gui Library is a powerful library of graphical user interface