Merge pull request #34 from gnustep/NSImageReps_branch

NSImageReps branch
This commit is contained in:
Gregory Casamento 2019-12-04 16:39:26 -05:00 committed by GitHub
commit 091cc6db99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 1057 additions and 54 deletions

View file

@ -58,6 +58,7 @@
#import <AppKit/NSButtonCell.h>
#import <AppKit/NSCachedImageRep.h>
#import <AppKit/NSCell.h>
#import <AppKit/NSCIImageRep.h>
#import <AppKit/NSClipView.h>
#import <AppKit/NSCollectionView.h>
#import <AppKit/NSCollectionViewItem.h>
@ -97,6 +98,10 @@
#import <AppKit/NSPanel.h>
#import <AppKit/NSPasteboard.h>
#import <AppKit/NSPasteboardItem.h>
#import <AppKit/NSPDFInfo.h>
#import <AppKit/NSPDFImageRep.h>
#import <AppKit/NSPDFPanel.h>
#import <AppKit/NSPICTImageRep.h>
#import <AppKit/NSPopover.h>
#import <AppKit/NSPopUpButton.h>
#import <AppKit/NSPopUpButtonCell.h>
@ -137,6 +142,7 @@
#import <AppKit/NSComboBox.h>
#import <AppKit/NSComboBoxCell.h>
#import <AppKit/NSController.h>
#import <AppKit/NSDockTile.h>
#import <AppKit/NSDocument.h>
#import <AppKit/NSDocumentController.h>
#import <AppKit/NSDrawer.h>

View file

@ -0,0 +1,47 @@
/* Definition of class NSCIImageRep
Copyright (C) 2019 Free Software Foundation, Inc.
By: Gregory Casamento <greg.casamento@gmail.com>
Date: Fri Nov 15 04:24:11 EST 2019
This file is part of the GNUstep 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
Library General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#ifndef _NSCIImageRep_h_GNUSTEP_GUI_INCLUDE
#define _NSCIImageRep_h_GNUSTEP_GUI_INCLUDE
#import <AppKit/NSImageRep.h>
#if OS_API_VERSION(MAC_OS_X_VERSION_10_0, GS_API_LATEST)
#if defined(__cplusplus)
extern "C" {
#endif
@interface NSCIImageRep : NSImageRep
@end
#if defined(__cplusplus)
}
#endif
#endif /* GS_API_MACOSX */
#endif /* _NSCIImageRep_h_GNUSTEP_GUI_INCLUDE */

View file

@ -0,0 +1,73 @@
/* Definition of class NSDockTile
Copyright (C) 2019 Free Software Foundation, Inc.
By: Gregory Casamento <greg.casamento@gmail.com>
Date: Sat Nov 16 21:11:06 EST 2019
This file is part of the GNUstep 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
Library General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#ifndef _NSDockTile_h_GNUSTEP_GUI_INCLUDE
#define _NSDockTile_h_GNUSTEP_GUI_INCLUDE
#import <Foundation/NSObject.h>
#import <Foundation/NSGeometry.h>
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
#if defined(__cplusplus)
extern "C" {
#endif
@class NSView, NSString;
@interface NSDockTile : NSObject
{
NSView *_contentView;
NSSize _size;
id _owner;
BOOL _showsApplicationBadge;
NSString *_badgeLabel;
}
- (NSView *) contentView;
- (void) setContentView: (NSView *)contentView;
- (NSSize) size;
- (id) owner;
- (void) setOwner: (id)owner;
- (BOOL) showsApplicationBadge;
- (void) setShowsApplicationBadge: (BOOL)flag;
- (NSString *) badgeLabel;
- (void) setBadgeLabel: (NSString *)label;
- (void) display;
@end
#if defined(__cplusplus)
}
#endif
#endif /* GS_API_MACOSX */
#endif /* _NSDockTile_h_GNUSTEP_GUI_INCLUDE */

View file

@ -39,6 +39,7 @@
@interface NSEPSImageRep : NSImageRep
{
// Attributes
NSBitmapImageRep *_pageRep;
NSRect _bounds;
NSData *_epsData;
}

View file

@ -0,0 +1,65 @@
/* Definition of class NSPDFImageRep
Copyright (C) 2019 Free Software Foundation, Inc.
By: Gregory Casamento <greg.casamento@gmail.com>
Date: Fri Nov 15 04:24:27 EST 2019
This file is part of the GNUstep 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
Library General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#ifndef _NSPDFImageRep_h_GNUSTEP_GUI_INCLUDE
#define _NSPDFImageRep_h_GNUSTEP_GUI_INCLUDE
#import <AppKit/NSImageRep.h>
#if OS_API_VERSION(MAC_OS_X_VERSION_10_0, GS_API_LATEST)
#if defined(__cplusplus)
extern "C" {
#endif
@interface NSPDFImageRep : NSImageRep
{
NSArray *_pageReps;
NSUInteger _currentPage;
NSData *_pdfRepresentation;
}
+ (instancetype) imageRepWithData: (NSData *)imageData;
- (instancetype) initWithData: (NSData *)imageData;
- (NSRect) bounds;
- (NSInteger) currentPage;
- (void) setCurrentPage: (NSInteger)currentPage;
- (NSInteger) pageCount;
- (NSData *) PDFRepresentation;
@end
#if defined(__cplusplus)
}
#endif
#endif /* GS_API_MACOSX */
#endif /* _NSPDFImageRep_h_GNUSTEP_GUI_INCLUDE */

View file

@ -0,0 +1,74 @@
/* Definition of class NSPDFInfo
Copyright (C) 2019 Free Software Foundation, Inc.
By: Gregory Casamento <greg.casamento@gmail.com>
Date: Sat Nov 16 21:20:46 EST 2019
This file is part of the GNUstep 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
Library General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#ifndef _NSPDFInfo_h_GNUSTEP_GUI_INCLUDE
#define _NSPDFInfo_h_GNUSTEP_GUI_INCLUDE
#import <Foundation/NSObject.h>
#import <Foundation/NSGeometry.h>
#import <AppKit/NSPrintInfo.h>
#if OS_API_VERSION(MAC_OS_X_VERSION_10_9, GS_API_LATEST)
#if defined(__cplusplus)
extern "C" {
#endif
@class NSURL, NSArray, NSMutableDictionary;
@interface NSPDFInfo : NSObject <NSCoding, NSCopying>
{
NSURL *_url;
BOOL _fileExtensionHidden;
NSArray *_tagNames;
NSSize _paperSize;
NSMutableDictionary *_attributes;
NSPaperOrientation _orientation;
}
- (NSURL *) URL;
- (BOOL) isFileExtensionHidden;
- (void) setFileExtensionHidden: (BOOL)flag;
- (NSArray *) tagNames;
- (NSPaperOrientation) orientation;
- (void) setOrientation: (NSPaperOrientation)or;
- (NSSize) paperSize;
- (void) setPaperSize: (NSSize)size;
- (NSMutableDictionary *) attributes;
@end
#if defined(__cplusplus)
}
#endif
#endif /* GS_API_MACOSX */
#endif /* _NSPDFInfo_h_GNUSTEP_GUI_INCLUDE */

View file

@ -0,0 +1,78 @@
/* Definition of class NSPDFPanel
Copyright (C) 2019 Free Software Foundation, Inc.
By: Gregory Casamento <greg.casamento@gmail.com>
Date: Sat Nov 16 21:21:00 EST 2019
This file is part of the GNUstep 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
Library General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#ifndef _NSPDFPanel_h_GNUSTEP_GUI_INCLUDE
#define _NSPDFPanel_h_GNUSTEP_GUI_INCLUDE
#import <Foundation/NSObject.h>
#if OS_API_VERSION(MAC_OS_X_VERSION_10_9, GS_API_LATEST)
#if defined(__cplusplus)
extern "C" {
#endif
@class NSString, NSPDFInfo, NSWindow, NSViewController;
enum {
NSPDFPanelShowsPaperSize = 1 << 2,
NSPDFPanelShowsOrientation = 1 << 3,
NSPDFPanelRequestsParentDirectory = 1 << 24,
};
typedef NSUInteger NSPDFPanelOptions;
DEFINE_BLOCK_TYPE(GSPDFPanelCompletionHandler, void, NSInteger);
@interface NSPDFPanel : NSObject
{
NSViewController *_accessoryController;
NSPDFPanelOptions _options;
NSString *_defaultFileName;
}
+ (NSPDFPanel *) panel;
- (NSViewController *) accessoryController;
- (void) setAccessoryController: (NSViewController *)accessoryController;
- (NSPDFPanelOptions) options;
- (void) setOptions: (NSPDFPanelOptions)opts;
- (NSString *) defaultFileName;
- (void) setDefaultFileName: (NSString *)fileName;
- (void) beginSheetWithPDFInfo: (NSPDFInfo *)pdfInfo
modalForWindow: (NSWindow *)window
completionHandler: (GSPDFPanelCompletionHandler)handler;
@end
#if defined(__cplusplus)
}
#endif
#endif /* GS_API_MACOSX */
#endif /* _NSPDFPanel_h_GNUSTEP_GUI_INCLUDE */

View file

@ -0,0 +1,63 @@
/* Definition of class NSPICTImageRep
Copyright (C) 2019 Free Software Foundation, Inc.
By: Gregory Casamento <greg.casamento@gmail.com>
Date: Fri Nov 15 04:24:51 EST 2019
This file is part of the GNUstep 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
Library General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#ifndef _NSPICTImageRep_h_GNUSTEP_GUI_INCLUDE
#define _NSPICTImageRep_h_GNUSTEP_GUI_INCLUDE
#import <AppKit/NSImageRep.h>
#import <Foundation/NSGeometry.h>
#if OS_API_VERSION(MAC_OS_X_VERSION_10_0, GS_API_LATEST)
#if defined(__cplusplus)
extern "C" {
#endif
@class NSData;
@interface NSPICTImageRep : NSImageRep
{
NSBitmapImageRep *_pageRep;
NSData *_pictRepresentation;
NSRect _boundingBox;
}
+ (instancetype) imageRepWithData: (NSData *)imageData;
- (instancetype) initWithData: (NSData *)imageData;
- (NSRect) boundingBox;
- (NSData *) PICTRepresentation;
@end
#if defined(__cplusplus)
}
#endif
#endif /* GS_API_MACOSX */
#endif /* _NSPICTImageRep_h_GNUSTEP_GUI_INCLUDE */

View file

@ -49,6 +49,11 @@ typedef enum _NSPrintingOrientation {
NSLandscapeOrientation
} NSPrintingOrientation;
typedef enum _NSPaperOrientation {
NSPaperOrientationPortrait,
NSPaperOrientationLandscape
} NSPaperOrientation;
typedef enum _NSPrintingPaginationMode {
NSAutoPagination,
NSFitPagination,

View file

@ -9,7 +9,7 @@
Date: 1996
Fixes and updates made by
Author: Gregory John Casamento <borgheron@yahoo.com>
Author: Gregory John Casamento <greg.casamento@gmail.com>
Date: 2000
This file is part of the GNUstep GUI Library.

75
MISSING
View file

@ -1,5 +1,5 @@
MISSING HEADERS
---
> AppKitErrors.h
> NSATSTypesetter.h
> NSAccessibilityCustomAction.h
@ -8,27 +8,17 @@ MISSING HEADERS
> NSAccessibilityProtocols.h
> NSAlignmentFeedbackFilter.h
> NSAppearance.h
> NSAppleScriptExtensions.h
> NSApplicationScripting.h
> NSButtonTouchBarItem.h
> NSCIImageRep.h
> NSCandidateListTouchBarItem.h
> NSClickGestureRecognizer.h
> NSCollectionViewCompositionalLayout.h
> NSCollectionViewFlowLayout.h
> NSCollectionViewGridLayout.h
> NSCollectionViewLayout.h
> NSCollectionViewTransitionLayout.h
> NSColorPickerTouchBarItem.h
> NSColorSampler.h
> NSCustomTouchBarItem.h
> NSDataAsset.h
> NSDatePicker.h
> NSDatePickerCell.h
> NSDictionaryController.h
> NSDiffableDataSource.h
> NSDockTile.h
> NSDocumentScripting.h
> NSDraggingItem.h
> NSDraggingSession.h
> NSErrors.h
@ -38,51 +28,36 @@ MISSING HEADERS
> NSFontCollection.h
> NSGlyphInfo.h
> NSGridView.h
> NSGroupTouchBarItem.h
> NSHapticFeedback.h
> NSItemProvider.h
> NSLayoutAnchor.h
> NSLayoutConstraint.h
> NSLayoutGuide.h
> NSMagnificationGestureRecognizer.h
> NSMediaLibraryBrowserController.h
> NSMenuToolbarItem.h
> NSNibControlConnector.h
> NSNibOutletConnector.h
> NSOpenGLLayer.h
> NSPDFImageRep.h
> NSPDFInfo.h
> NSPDFPanel.h
> NSPICTImageRep.h
> NSPageController.h
> NSPanGestureRecognizer.h
> NSPathCell.h
> NSPathComponentCell.h
> NSPathControl.h
> NSPathControlItem.h
> NSPersistentDocument.h
> NSPickerTouchBarItem.h
> NSPopoverTouchBarItem.h
> NSPredicateEditor.h
> NSPredicateEditorRowTemplate.h
> NSPressGestureRecognizer.h
> NSPressureConfiguration.h
> NSQuickDrawView.h
> NSRotationGestureRecognizer.h
> NSRuleEditor.h
> NSScrubber.h
> NSScrubberItemView.h
> NSScrubberLayout.h
> NSSharingServicePickerToolbarItem.h
> NSSharingServicePickerTouchBarItem.h
> NSSliderAccessory.h
> NSSliderTouchBarItem.h
> NSSpeechRecognizer.h
> NSSplitViewController.h
> NSSplitViewItem.h
> NSStackView.h
> NSStatusBarButton.h
> NSStepperTouchBarItem.h
> NSStoryboard.h
> NSStoryboardSegue.h
> NSSwitch.h
@ -95,16 +70,56 @@ MISSING HEADERS
> NSTextFinder.h
> NSTextInputClient.h
> NSTextInputContext.h
> NSTextStorageScripting.h
> NSTitlebarAccessoryViewController.h
> NSTouch.h
> NSTouchBar.h
> NSTouchBarItem.h
> NSTypesetter.h
> NSUserActivity.h
> NSUserInterfaceCompression.h
> NSUserInterfaceItemSearching.h
> NSWindowRestoration.h
> NSWindowScripting.h
> NSWindowTab.h
> NSWindowTabGroup.h
> NSWindowTabGroup.h
Total: 86
Completed
---
> NSCIIImageRep.h
> NSPDFImageRep.h
> NSPDFInfo.h
> NSPDFPanel.h
> NSPICTImageRep.h
> NSDockTile.h
Total: 6
Additional
---
> GSSVGImageRep.h
Total: 1
Mac Specific
---
> NSButtonTouchBarItem.h
> NSCandidateListTouchBarItem.h
> NSColorPickerTouchBarItem.h
> NSCustomTouchBarItem.h
> NSGroupTouchBarItem.h
> NSPickerTouchBarItem.h
> NSPopoverTouchBarItem.h
> NSSharingServicePickerTouchBarItem.h
> NSSliderTouchBarItem.h
> NSStepperTouchBarItem.h
> NSTouchBarItem.h
> NSClickGestureRecognizer.h
> NSMagnificationGestureRecognizer.h
> NSPanGestureRecognizer.h
> NSPressGestureRecognizer.h
> NSRotationGestureRecognizer.h
> NSSpeechRecognizer.h
> NSApplicationScripting.h
> NSDocumentScripting.h
> NSTextStorageScripting.h
> NSWindowScripting.h
> NSHapticFeedback.h
> NSAppleScriptExtensions.h
Total: 23

View file

@ -68,6 +68,7 @@ NSButton.m \
NSButtonCell.m \
NSCachedImageRep.m \
NSCell.m \
NSCIImageRep.m \
NSClipView.m \
NSCollectionView.m \
NSCollectionViewItem.m \
@ -86,6 +87,7 @@ NSCustomImageRep.m \
NSDataLink.m \
NSDataLinkManager.m \
NSDataLinkPanel.m \
NSDockTile.m \
NSDocument.m \
NSDocumentController.m \
NSDrawer.m \
@ -137,6 +139,10 @@ NSPageLayout.m \
NSPanel.m \
NSParagraphStyle.m \
NSPasteboardItem.m \
NSPDFInfo.m \
NSPDFImageRep.m \
NSPDFPanel.m \
NSPICTImageRep.m \
NSPopover.m \
NSPopUpButton.m \
NSPopUpButtonCell.m \
@ -303,6 +309,7 @@ NSButton.h \
NSButtonCell.h \
NSCachedImageRep.h \
NSCell.h \
NSCIImageRep.h \
NSClipView.h \
NSCollectionView.h \
NSCollectionViewItem.h \
@ -321,6 +328,7 @@ NSCustomImageRep.h \
NSDataLink.h \
NSDataLinkManager.h \
NSDataLinkPanel.h \
NSDockTile.h \
NSDocument.h \
NSDocumentController.h \
NSDrawer.h \
@ -368,6 +376,10 @@ NSPanel.h \
NSParagraphStyle.h \
NSPasteboard.h \
NSPasteboardItem.h \
NSPDFInfo.h \
NSPDFImageRep.h \
NSPDFPanel.h \
NSPICTImageRep.h \
NSPopover.h \
NSPopUpButton.h \
NSPopUpButtonCell.h \
@ -487,6 +499,7 @@ GSPrintOperation.h \
GSEPSPrintOperation.h \
GSPDFPrintOperation.h \
GSModelLoaderFactory.h \
GSImageMagickImageRep.h \
GSInstantiator.h \
GSSoundSink.h \
GSSoundSource.h \

View file

@ -232,7 +232,7 @@
+ (id) imageRepWithData: (NSData *)data
{
return [[[self alloc] initWithData: data] autorelease];
return AUTORELEASE([[self alloc] initWithData: data]);
}
- (id) initWithData: (NSData *)data

30
Source/NSCIImageRep.m Normal file
View file

@ -0,0 +1,30 @@
/* Implementation of class NSCIImageRep
Copyright (C) 2019 Free Software Foundation, Inc.
By: Gregory Casamento <greg.casamento@gmail.com>
Date: Fri Nov 15 04:24:11 EST 2019
This file is part of the GNUstep 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
Library General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#import <AppKit/NSCIImageRep.h>
@implementation NSCIImageRep
@end

102
Source/NSDockTile.m Normal file
View file

@ -0,0 +1,102 @@
/* Implementation of class NSDockTile
Copyright (C) 2019 Free Software Foundation, Inc.
By: Gregory John Casamento <greg.casamento@gmail.com>
Date: Sat Nov 16 21:11:06 EST 2019
This file is part of the GNUstep 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
Library General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#import <AppKit/NSDockTile.h>
#import <AppKit/NSView.h>
@implementation NSDockTile
- (instancetype) init
{
self = [super init];
if (self != nil)
{
NSRect rect = NSMakeRect(0,0,48,48);
_size = rect.size;
_contentView = [[NSView alloc] initWithFrame: rect];
_badgeLabel = nil;
_owner = nil;
}
return self;
}
- (oneway void) release
{
RELEASE(_contentView);
RELEASE(_badgeLabel);
[super release];
}
- (NSView *) contentView
{
return _contentView;
}
- (void) setContentView: (NSView *)contentView
{
ASSIGN(_contentView, contentView);
}
- (NSSize) size
{
return _size;
}
- (id) owner
{
return _owner;
}
- (void) setOwner: (id)owner
{
_owner = owner; // weak...
}
- (BOOL) showsApplicationBadge
{
return _showsApplicationBadge;
}
- (void) setShowsApplicationBadge: (BOOL)flag
{
_showsApplicationBadge = flag;
}
- (NSString *) badgeLabel
{
return _badgeLabel;
}
- (void) setBadgeLabel: (NSString *)label
{
ASSIGNCOPY(_badgeLabel, label);
}
- (void) display
{
[_contentView setNeedsDisplay: YES];
}
@end

View file

@ -26,25 +26,24 @@
Boston, MA 02110-1301, USA.
*/
#import "config.h"
#import <Foundation/NSArray.h>
#import <Foundation/NSCoder.h>
#import <Foundation/NSData.h>
#import "AppKit/NSPasteboard.h"
#import "AppKit/NSEPSImageRep.h"
#import "GNUstepGUI/GSImageMagickImageRep.h"
@implementation NSEPSImageRep
+ (BOOL) canInitWithData: (NSData *)data
{
char buffer[2];
[data getBytes: buffer length: 2];
// Simple check for Postscript
if (buffer[0] == '%' && buffer[1] == '!')
return YES;
else
return NO;
NSData *header = [data subdataWithRange: NSMakeRange(0,4)];
NSString *str = [[NSString alloc] initWithData: header encoding: NSUTF8StringEncoding];
BOOL result = [str isEqualToString: @"%!PS"];
AUTORELEASE(str);
return result;
}
+ (NSArray *) imageUnfilteredFileTypes
@ -79,18 +78,35 @@
- (id) initWithData: (NSData *)epsData
{
[self notImplemented: _cmd];
_epsData = epsData;
// Set bounds from parsed header
//_bounds = NSMakeRect();
self = [super init];
if (self != nil)
{
#if HAVE_IMAGEMAGICK
ASSIGN(_pageRep, [GSImageMagickImageRep imageRepWithData: epsData]);
_size = [_pageRep size];
#else
_pageRep = nil;
_size = NSMakeSize(0,0);
#endif
ASSIGNCOPY(_epsData, epsData);
}
return self;
}
- (void) dealloc
{
RELEASE(_epsData);
RELEASE(_pageRep);
[super dealloc];
}
// Getting Image Data
- (NSRect) boundingBox
{
return _bounds;
NSSize size = [self size];
NSRect rect = NSMakeRect(0, 0, size.width, size.height);
return rect;
}
- (NSData *) EPSRepresentation
@ -103,14 +119,12 @@
// This is for subclasses only
}
// Drawing the Image
// Override to draw the specified page...
- (BOOL) draw
{
[self notImplemented: _cmd];
[self prepareGState];
return YES;
return [_pageRep draw];
}
// NSCopying protocol

View file

@ -42,6 +42,8 @@
#import "AppKit/NSBitmapImageRep.h"
#import "AppKit/NSCachedImageRep.h"
#import "AppKit/NSEPSImageRep.h"
#import "AppKit/NSPDFImageRep.h"
#import "AppKit/NSPICTImageRep.h"
#import "AppKit/NSPasteboard.h"
#import "AppKit/NSGraphicsContext.h"
#import "AppKit/NSView.h"
@ -67,6 +69,9 @@ static Class NSImageRep_class = NULL;
imageReps = [[NSMutableArray alloc] initWithCapacity: 4];
[imageReps addObject: [NSBitmapImageRep class]];
#if HAVE_IMAGEMAGICK
[imageReps addObject: [NSPDFImageRep class]];
[imageReps addObject: [NSEPSImageRep class]];
[imageReps addObject: [NSPICTImageRep class]];
[imageReps addObject: [GSImageMagickImageRep class]];
#endif
}

129
Source/NSPDFImageRep.m Normal file
View file

@ -0,0 +1,129 @@
/* Implementation of class NSPDFImageRep
Copyright (C) 2019 Free Software Foundation, Inc.
By: Gregory Casamento <greg.casamento@gmail.com>
Date: Fri Nov 15 04:24:27 EST 2019
This file is part of the GNUstep 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
Library General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#import "config.h"
#import <Foundation/NSString.h>
#import <Foundation/NSData.h>
#import "AppKit/NSPasteboard.h"
#import "AppKit/NSPDFImageRep.h"
#import <GNUstepGUI/GSImageMagickImageRep.h>
@implementation NSPDFImageRep
+ (BOOL) canInitWithData: (NSData *)imageData
{
NSData *header = [imageData subdataWithRange: NSMakeRange(0,4)];
NSString *str = [[NSString alloc] initWithData: header encoding: NSUTF8StringEncoding];
BOOL result = [str isEqualToString: @"%PDF"];
AUTORELEASE(str);
return result;
}
+ (NSArray *) imagePasteboardTypes
{
return [NSArray arrayWithObjects: NSPDFPboardType];
}
+ (NSArray *) imageUnfilteredPasteboardTYpes
{
return [self imagePasteboardTypes];
}
+ (NSArray *) imageFileTypes
{
return [NSArray arrayWithObjects: @"pdf", @"PDF", nil];
}
+ (NSArray *) imageUnfilteredFileTypes
{
return [self imageFileTypes];
}
+ (instancetype) imageRepWithData: (NSData *)imageData
{
return [[[self class] alloc] initWithData: imageData];
}
- (instancetype) initWithData: (NSData *)imageData
{
self = [super init];
if(self != nil)
{
#if HAVE_IMAGEMAGICK
ASSIGN(_pageReps, [GSImageMagickImageRep imageRepsWithData: imageData]);
_size = [[_pageReps objectAtIndex: 0] size];
_currentPage = 1;
#else
ASSIGN(_pageReps, [NSArray array]);
_size = NSMakeSize(0,0);
_currentPage = 0;
#endif
ASSIGNCOPY(_pdfRepresentation, imageData);
}
return self;
}
- (void) dealloc
{
RELEASE(_pageReps);
RELEASE(_pdfRepresentation);
[super dealloc];
}
- (NSRect) bounds
{
NSSize size = [self size];
NSRect rect = NSMakeRect(0, 0, size.width, size.height);
return rect;
}
- (NSInteger) currentPage
{
return _currentPage;
}
- (void) setCurrentPage: (NSInteger)currentPage
{
_currentPage = currentPage;
}
- (NSInteger) pageCount
{
return [_pageReps count];
}
- (NSData *) PDFRepresentation
{
return _pdfRepresentation;
}
// Override to draw the specified page...
- (BOOL) draw
{
NSBitmapImageRep *rep = [_pageReps objectAtIndex: _currentPage - 1];
return [rep draw];
}
@end

99
Source/NSPDFInfo.m Normal file
View file

@ -0,0 +1,99 @@
/* Implementation of class NSPDFInfo
Copyright (C) 2019 Free Software Foundation, Inc.
By: Gregory Casamento <greg.casamento@gmail.com>
Date: Sat Nov 16 21:20:46 EST 2019
This file is part of the GNUstep 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
Library General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#import <AppKit/NSPDFInfo.h>
#import <Foundation/NSArray.h>
#import <Foundation/NSDictionary.h>
@implementation NSPDFInfo
- (instancetype) initWithCoder: (NSCoder *)coder
{
return nil;
}
- (void) encodeWithCoder: (NSCoder *)coder
{
}
- (void) dealloc
{
RELEASE(_url);
RELEASE(_tagNames);
RELEASE(_attributes);
[super dealloc];
}
- (instancetype) copyWithZone: (NSZone *)zone
{
return nil;
}
- (NSURL *) URL
{
return _url;
}
- (BOOL) isFileExtensionHidden
{
return _fileExtensionHidden;
}
- (void) setFileExtensionHidden: (BOOL)flag
{
_fileExtensionHidden = flag;
}
- (NSArray *) tagNames
{
return _tagNames;
}
- (NSPaperOrientation) orientation
{
return _orientation;
}
- (void) setOrientation: (NSPaperOrientation)or
{
_orientation = or;
}
- (NSSize) paperSize;
{
return _paperSize;
}
- (void) setPaperSize: (NSSize)size
{
_paperSize = size;
}
- (NSMutableDictionary *) attributes
{
return _attributes;
}
@end

86
Source/NSPDFPanel.m Normal file
View file

@ -0,0 +1,86 @@
/* Implementation of class NSPDFPanel
Copyright (C) 2019 Free Software Foundation, Inc.
By: Gregory Casamento <greg.casamento@gmail.com>
Date: Sat Nov 16 21:21:00 EST 2019
This file is part of the GNUstep 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
Library General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#import <AppKit/NSPDFPanel.h>
#import <AppKit/NSPDFInfo.h>
#import <AppKit/NSWindow.h>
#import <AppKit/NSViewController.h>
#import <Foundation/NSString.h>
@implementation NSPDFPanel
+ (NSPDFPanel *) panel
{
return [[self class] alloc] ;
}
- init
{
self = [super init];
if (self != nil)
{
_options = NSPDFPanelShowsPaperSize;
_defaultFileName = @"";
}
return self;
}
- (NSViewController *) accessoryController
{
return _accessoryController;
}
- (void) setAccessoryController: (NSViewController *)accessoryController
{
ASSIGN(_accessoryController, accessoryController);
}
- (NSPDFPanelOptions) options
{
return _options;
}
- (void) setOptions: (NSPDFPanelOptions)opts
{
_options = opts;
}
- (NSString *) defaultFileName
{
return _defaultFileName;
}
- (void) setDefaultFileName: (NSString *)fileName
{
ASSIGNCOPY(_defaultFileName, fileName);
}
- (void) beginSheetWithPDFInfo: (NSPDFInfo *)pdfInfo
modalForWindow: (NSWindow *)window
completionHandler: (GSPDFPanelCompletionHandler)handler
{
}
@end

98
Source/NSPICTImageRep.m Normal file
View file

@ -0,0 +1,98 @@
/* Implementation of class NSPICTImageRep
Copyright (C) 2019 Free Software Foundation, Inc.
By: Gregory Casamento <greg.casamento@gmail.com>
Date: Fri Nov 15 04:24:51 EST 2019
This file is part of the GNUstep 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
Library General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#import "config.h"
#import <AppKit/NSPICTImageRep.h>
#import <AppKit/NSPasteboard.h>
#import <Foundation/NSData.h>
#import <Foundation/NSArray.h>
#import <GNUstepGUI/GSImageMagickImageRep.h>
@implementation NSPICTImageRep
+ (NSArray *) imageUnfilteredFileTypes
{
static NSArray *types = nil;
if (types == nil)
{
types = [[NSArray alloc] initWithObjects: @"pct", @"pict", nil];
}
return types;
}
+ (NSArray *) imageUnfilteredPasteboardTypes
{
static NSArray *types = nil;
if (types == nil)
{
types = [[NSArray alloc] initWithObjects: NSPICTPboardType, nil];
}
return types;
}
+ (instancetype) imageRepWithData: (NSData *)imageData
{
return [[[self class] alloc] initWithData: imageData];
}
- (instancetype) initWithData: (NSData *)imageData
{
self = [super init];
if (self != nil)
{
#if HAVE_IMAGEMAGICK
ASSIGN(_pageRep, [GSImageMagickImageRep imageRepWithData: imageData]);
_size = [_pageRep size];
#else
_pageRep = nil;
_size = NSMakeSize(0,0);
#endif
ASSIGNCOPY(_pictRepresentation, imageData);
}
return self;
}
- (NSRect) boundingBox
{
NSSize size = [self size];
NSRect rect = NSMakeRect(0, 0, size.width, size.height);
return rect;
}
- (NSData *) PICTRepresentation
{
return [_pictRepresentation copy];
}
// Override to draw the specified page...
- (BOOL) draw
{
return [_pageRep draw];
}
@end

View file

@ -4,7 +4,7 @@
Copyright (C) 1999 Free Software Foundation, Inc.
Author: Gregory John Casamento <borgheron@yahoo.com>
Author: Gregory John Casamento <greg.casamento@gmail.com>
Date: 2000
Author: Nicola Pero <nicola@brainstorm.co.uk>

View file

@ -5,7 +5,7 @@
Copyright (C) 1996 Free Software Foundation, Inc.
Author: Gregory John Casamento <borgheron@yahoo.com>
Author: Gregory John Casamento <greg.casamento@gmail.com>
Date: 2001
Author: Scott Christley <scottc@net-community.com>