mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 18:11:06 +00:00
Implement print panel
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@11100 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ea5372114d
commit
9e7640459b
11 changed files with 609 additions and 28 deletions
17
ChangeLog
17
ChangeLog
|
@ -1,3 +1,20 @@
|
|||
2001-10-06 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Headers/gnustep/gui/NSPrintPanel.h: Define ivars.
|
||||
* Panels/GNUmakefile: add GSPrintPanel.gorm
|
||||
* Source/NSPrintPanel.m: Implement.
|
||||
|
||||
* Source/NSPopUpButtonCell.m (initWithCoder:): Make menu owned
|
||||
by popup.
|
||||
|
||||
* Source/NSPrintOperation.m
|
||||
(-initWithView:insideRect:toData:printInfo:): set showPanel to YES.
|
||||
|
||||
* Source/NSView.m (displayRectIgnoringOpacity:): Move unlockFocus
|
||||
after drawing subviews (fix from georg@vhf.de).
|
||||
|
||||
* Source/libgnustep-gui.def: Remove NSMenuWindow.
|
||||
|
||||
2001-09-28 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Header/gnustep/gui/NSCell.h
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
@class NSView;
|
||||
|
||||
enum {
|
||||
NSPPSaveButton,
|
||||
NSPPSaveButton = 4,
|
||||
NSPPPreviewButton,
|
||||
NSFaxButton,
|
||||
NSPPTitleField,
|
||||
|
@ -57,7 +57,24 @@ enum {
|
|||
|
||||
@interface NSPrintPanel : NSPanel <NSCoding>
|
||||
{
|
||||
// Attributes
|
||||
id _cancelButton;
|
||||
id _copiesField;
|
||||
id _faxButton;
|
||||
id _fromRangeForm;
|
||||
id _pageMatrix;
|
||||
id _paperButton;
|
||||
id _previewButton;
|
||||
id _printButton;
|
||||
id _printForm;
|
||||
id _resButton;
|
||||
id _saveButton;
|
||||
id _toRangeForm;
|
||||
id _panelWindow;
|
||||
|
||||
id _accessoryView;
|
||||
id _savePath;
|
||||
int _picked;
|
||||
NSRange _pages;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
84
Panels/English.lproj/GSPrintPanel.classes
Normal file
84
Panels/English.lproj/GSPrintPanel.classes
Normal file
|
@ -0,0 +1,84 @@
|
|||
{
|
||||
NSApplication = {
|
||||
Outlets = (
|
||||
delegate
|
||||
);
|
||||
Super = NSResponder;
|
||||
};
|
||||
NSButton = {
|
||||
Super = NSControl;
|
||||
};
|
||||
NSControl = {
|
||||
Actions = (
|
||||
"takeDoubleValueFrom:",
|
||||
"takeFloatValueFrom:",
|
||||
"takeIntValueFrom:",
|
||||
"takeObjectValueFrom:",
|
||||
"takeStringValueFrom:"
|
||||
);
|
||||
Outlets = (
|
||||
target
|
||||
);
|
||||
Super = NSView;
|
||||
};
|
||||
NSMenu = {
|
||||
Super = NSObject;
|
||||
};
|
||||
NSMenuItem = {
|
||||
Outlets = (
|
||||
target
|
||||
);
|
||||
Super = NSObject;
|
||||
};
|
||||
NSPanel = {
|
||||
Actions = (
|
||||
);
|
||||
Outlets = (
|
||||
);
|
||||
Super = NSWindow;
|
||||
};
|
||||
NSPrintPanel = {
|
||||
Actions = (
|
||||
"_pickedButton:",
|
||||
"_pickedPage:",
|
||||
"_pickedPrintOp:"
|
||||
);
|
||||
Outlets = (
|
||||
_cancelButton,
|
||||
_copiesField,
|
||||
_faxButton,
|
||||
_fromRangeForm,
|
||||
_pageMatrix,
|
||||
_panelWindow,
|
||||
_paperButton,
|
||||
_previewButton,
|
||||
_printButton,
|
||||
_printForm,
|
||||
_resButton,
|
||||
_saveButton,
|
||||
_toRangeForm
|
||||
);
|
||||
Super = NSPanel;
|
||||
};
|
||||
NSResponder = {
|
||||
Super = NSObject;
|
||||
};
|
||||
NSSlider = {
|
||||
Super = NSControl;
|
||||
};
|
||||
NSTextField = {
|
||||
Outlets = (
|
||||
delegate
|
||||
);
|
||||
Super = NSControl;
|
||||
};
|
||||
NSView = {
|
||||
Super = NSResponder;
|
||||
};
|
||||
NSWindow = {
|
||||
Outlets = (
|
||||
delegate
|
||||
);
|
||||
Super = NSResponder;
|
||||
};
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
#
|
||||
# Makefile for GNUstep GUI Panels
|
||||
#
|
||||
# Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
#
|
||||
# Author: Lyndon Tremblay <tremblay2@home.com>
|
||||
# Date: November 1998
|
||||
# Author: Adam Fedor <fedor@gnu.org>
|
||||
# Date: November 2001
|
||||
#
|
||||
# This file is part of the GNUstep GUI Library.
|
||||
#
|
||||
|
@ -35,6 +35,10 @@ include $(GNUSTEP_MAKEFILES)/common.make
|
|||
|
||||
include ../Version
|
||||
|
||||
LANGUAGES = English
|
||||
|
||||
LOCALIZED_RESOURCE_FILES = GSPrintPanel.gorm
|
||||
|
||||
PANELS = ColorPanel.gmodel SavePanel.gmodel SpellPanel.gmodel
|
||||
|
||||
-include GNUmakefile.preamble
|
||||
|
|
|
@ -1,5 +1,27 @@
|
|||
after-distclean::
|
||||
rm -f GNUmakefile.local
|
||||
#
|
||||
# GNUmakefile.postamble
|
||||
#
|
||||
# Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
#
|
||||
# Written: Adam Fedor <fedor@gnu.org>
|
||||
# Date: Oct 2001
|
||||
#
|
||||
# This file is part of the GNUstep Base 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_INSTALLATION_DIR)/Library/Model:
|
||||
$(MKDIRS) $(GNUSTEP_INSTALLATION_DIR)/Library/Model
|
||||
|
@ -14,5 +36,29 @@ before-uninstall::
|
|||
rm -f $(GNUSTEP_INSTALLATION_DIR)/Library/Model/$$f; \
|
||||
done
|
||||
|
||||
clean::
|
||||
# Things to do after installing
|
||||
after-install::
|
||||
ifneq ($(strip $(LOCALIZED_RESOURCE_FILES)),)
|
||||
@(echo "Copying localized resources into system..."; \
|
||||
for l in $(LANGUAGES); do \
|
||||
if [ ! -f $$l.lproj ]; then \
|
||||
$(MKDIRS) $(GNUSTEP_RESOURCES)/$$l.lproj; \
|
||||
fi; \
|
||||
for f in $(LOCALIZED_RESOURCE_FILES); do \
|
||||
if [ -f $$l.lproj/$$f ]; then \
|
||||
cp -r $$l.lproj/$$f $(GNUSTEP_RESOURCES)/$$l.lproj; \
|
||||
fi; \
|
||||
done; \
|
||||
done;)
|
||||
endif
|
||||
|
||||
# Things to do after uninstalling
|
||||
after-uninstall::
|
||||
ifneq ($(strip $(LOCALIZED_RESOURCE_FILES)),)
|
||||
@(for l in $(LANGUAGES); do \
|
||||
if [ ! -f $$l.lproj ]; then \
|
||||
rm -rf $(GNUSTEP_RESOURCES)/$$l.lproj; \
|
||||
fi; \
|
||||
done;)
|
||||
endif
|
||||
|
||||
|
|
|
@ -632,6 +632,7 @@ static NSImage *_pbc_image[2];
|
|||
[aDecoder decodeValueOfObjCType: @encode(int) at: &flag];
|
||||
_pbcFlags.arrowPosition = flag;
|
||||
|
||||
[_menu _setOwnedByPopUp: YES];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
|
@ -453,7 +453,7 @@ static NSString *NSPrintOperationThreadKey = @"NSPrintOperationThreadKey";
|
|||
_rect = rect;
|
||||
ASSIGN(_data, data);
|
||||
_pageOrder = NSUnknownPageOrder;
|
||||
_showPanels = NO;
|
||||
_showPanels = YES;
|
||||
[self setPrintInfo: aPrintInfo];
|
||||
|
||||
ASSIGN(_path, @"/tmp/NSTempPrintFile");
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
/*
|
||||
NSPrintPanel.m
|
||||
|
||||
Description...
|
||||
Creates a Print panel for the user to select various print options.
|
||||
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
|
||||
Author: Scott Christley <scottc@net-community.com>
|
||||
Date: 1996
|
||||
Author: Adam Fedor <fedor@gnu.org>
|
||||
Date: 2001
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
|
@ -27,7 +27,22 @@
|
|||
*/
|
||||
|
||||
#include <gnustep/gui/config.h>
|
||||
#include <Foundation/NSArray.h>
|
||||
#include <Foundation/NSBundle.h>
|
||||
#include <Foundation/NSDictionary.h>
|
||||
#include <Foundation/NSValue.h>
|
||||
#include <AppKit/NSApplication.h>
|
||||
#include <AppKit/NSForm.h>
|
||||
#include <AppKit/NSNibLoading.h>
|
||||
#include <AppKit/NSPrinter.h>
|
||||
#include <AppKit/NSPrintPanel.h>
|
||||
#include <AppKit/NSPrintInfo.h>
|
||||
#include <AppKit/NSPrintOperation.h>
|
||||
#include <AppKit/NSPopUpButton.h>
|
||||
#include <AppKit/NSSavePanel.h>
|
||||
#include <AppKit/NSView.h>
|
||||
|
||||
#define GSPANELNAME @"GSPrintPanel"
|
||||
|
||||
@implementation NSPrintPanel
|
||||
|
||||
|
@ -46,24 +61,91 @@
|
|||
//
|
||||
// Creating an NSPrintPanel
|
||||
//
|
||||
/* It seems like this should be a singleton, but the docs say this
|
||||
returns a newly created panel object
|
||||
*/
|
||||
+ (NSPrintPanel *)printPanel
|
||||
{
|
||||
return nil;
|
||||
int style = NSTitledWindowMask | NSClosableWindowMask;
|
||||
NSRect frame = NSMakeRect(300, 300, 420, 350);
|
||||
return [[NSPrintPanel alloc] initWithContentRect: frame
|
||||
styleMask: style
|
||||
backing: NSBackingStoreBuffered
|
||||
defer: YES];
|
||||
}
|
||||
|
||||
//
|
||||
// Instance methods
|
||||
//
|
||||
/* Designated initializer */
|
||||
- (id) initWithContentRect: (NSRect)contentRect
|
||||
styleMask: (unsigned int)aStyle
|
||||
backing: (NSBackingStoreType)bufferingType
|
||||
defer: (BOOL)flag
|
||||
screen: (NSScreen*)aScreen
|
||||
{
|
||||
int i;
|
||||
NSArray *subviews;
|
||||
NSString *panel;
|
||||
NSDictionary *table;
|
||||
|
||||
self = [super initWithContentRect: contentRect
|
||||
styleMask: aStyle
|
||||
backing: bufferingType
|
||||
defer: flag
|
||||
screen: aScreen];
|
||||
if (self == nil)
|
||||
return nil;
|
||||
|
||||
panel = [NSBundle pathForGNUstepResource: GSPANELNAME ofType: @"gorm"
|
||||
inDirectory: nil];
|
||||
if (panel == nil)
|
||||
{
|
||||
NSRunAlertPanel(@"Error", @"Could not find print panel resource",
|
||||
@"OK", NULL, NULL);
|
||||
return nil;
|
||||
}
|
||||
table = [NSDictionary dictionaryWithObject: self forKey: @"NSOwner"];
|
||||
if ([NSBundle loadNibFile: panel
|
||||
externalNameTable: table
|
||||
withZone: [self zone]] == NO)
|
||||
{
|
||||
NSRunAlertPanel(@"Error", @"Could not load print panel resource",
|
||||
@"OK", NULL, NULL);
|
||||
return nil;
|
||||
}
|
||||
|
||||
/* Transfer the objects to us. FIXME: There must be a way to
|
||||
instantiate the panel directly */
|
||||
subviews = [[_panelWindow contentView] subviews];
|
||||
for (i = 0; i < [subviews count]; i++)
|
||||
{
|
||||
[_contentView addSubview: [subviews objectAtIndex: i]];
|
||||
}
|
||||
DESTROY(_panelWindow);
|
||||
/* FIXME: Can't do this in Gorm yet: */
|
||||
[_printForm setBezeled: NO];
|
||||
[_printForm setBordered: NO];
|
||||
[[_printForm cellAtIndex: 0] setEditable: NO];
|
||||
[[_printForm cellAtIndex: 1] setEditable: NO];
|
||||
[[_printForm cellAtIndex: 2] setEditable: NO];
|
||||
[[_printForm cellAtIndex: 0] setSelectable: NO];
|
||||
[[_printForm cellAtIndex: 1] setSelectable: NO];
|
||||
[[_printForm cellAtIndex: 2] setSelectable: NO];
|
||||
return self;
|
||||
}
|
||||
|
||||
//
|
||||
// Customizing the Panel
|
||||
//
|
||||
- (void)setAccessoryView:(NSView *)aView
|
||||
{}
|
||||
{
|
||||
ASSIGN(_accessoryView, aView);
|
||||
}
|
||||
|
||||
- (NSView *)accessoryView
|
||||
{
|
||||
return nil;
|
||||
return _accessoryView;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -71,29 +153,354 @@
|
|||
//
|
||||
- (int)runModal
|
||||
{
|
||||
return 0;
|
||||
_picked = NSCancelButton;
|
||||
[NSApp runModalForWindow: self];
|
||||
[self orderOut: self];
|
||||
return (_picked == NSCancelButton) ? NSCancelButton : NSOKButton;
|
||||
}
|
||||
|
||||
- (void)pickedButton:(id)sender
|
||||
{}
|
||||
- (BOOL) _getSavePath
|
||||
{
|
||||
int result;
|
||||
NSSavePanel *sp;
|
||||
|
||||
sp = [NSSavePanel savePanel];
|
||||
[sp setRequiredFileType: @"ps"];
|
||||
result = [sp runModal];
|
||||
if (result == NSOKButton)
|
||||
{
|
||||
NSFileManager *mgr = [NSFileManager defaultManager];
|
||||
NSString *path = [sp filename];
|
||||
|
||||
if ([path isEqual: _savePath] == NO
|
||||
&& [mgr fileExistsAtPath: path] == YES)
|
||||
{
|
||||
if (NSRunAlertPanel(NULL, @"A document with that name exists",
|
||||
@"Replace", @"Cancel", NULL) != NSAlertDefaultReturn)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
_savePath = RETAIN(path);
|
||||
}
|
||||
return (result == NSOKButton);
|
||||
}
|
||||
|
||||
/* Private communication with our panel objects */
|
||||
- (void) _pickedButton: (id)sender
|
||||
{
|
||||
if (sender == _saveButton)
|
||||
{
|
||||
_picked = NSPPSaveButton;
|
||||
if ([self _getSavePath] == NO)
|
||||
{
|
||||
/* User pressed save, then changed his mind, so go back to
|
||||
the print panel (don't stop the modal session) */
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (sender == _previewButton)
|
||||
{
|
||||
_picked = NSPPPreviewButton;
|
||||
}
|
||||
else if (sender == _faxButton)
|
||||
{
|
||||
_picked = NSFaxButton;
|
||||
NSRunAlertPanel(@"Warning", @"Fax of print file not implemented",
|
||||
@"OK", NULL, NULL);
|
||||
/* Don't stop the modal session */
|
||||
return;
|
||||
}
|
||||
else if (sender == _cancelButton)
|
||||
{
|
||||
_picked = NSCancelButton;
|
||||
}
|
||||
else if (sender == _printButton)
|
||||
{
|
||||
_picked = NSOKButton;
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"Print panel buttonAction: from unknown sender - x%x\n",
|
||||
(unsigned)sender);
|
||||
}
|
||||
[NSApp stopModalWithCode: _picked];
|
||||
}
|
||||
|
||||
- (void) _pickedPage: (id)sender
|
||||
{
|
||||
if ([_pageMatrix selectedColumn] == 0)
|
||||
{
|
||||
[[_fromRangeForm cellAtIndex: 0] setStringValue: @"" ];
|
||||
[[_toRangeForm cellAtIndex: 0] setStringValue: @"" ];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSString *str;
|
||||
str = [NSString stringWithFormat: @"%d", _pages.location];
|
||||
[[_fromRangeForm cellAtIndex: 0] setStringValue: str];
|
||||
str = [NSString stringWithFormat: @"%d", NSMaxRange(_pages)];
|
||||
[[_toRangeForm cellAtIndex: 0] setStringValue: str];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) _pickedPrintOp: (id)sender
|
||||
{
|
||||
NSLog(@"pick print op from sender %@, title %@", sender, [sender title]);
|
||||
}
|
||||
|
||||
/* Depreciated communication methods */
|
||||
- (void)pickedButton:(id)sender
|
||||
{
|
||||
NSLog(@"[NSPrintPanel -pickedButton:] method depreciated");
|
||||
[self pickedButton: sender];
|
||||
}
|
||||
|
||||
//
|
||||
// Updating the Panel's Display
|
||||
//
|
||||
- (void)pickedAllPages:(id)sender
|
||||
{}
|
||||
{
|
||||
NSLog(@"[NSPrintPanel -pickedAllPages:] method depreciated");
|
||||
[self _pickedPage: sender];
|
||||
}
|
||||
|
||||
- (void)pickedLayoutList:(id)sender
|
||||
{}
|
||||
{
|
||||
NSLog(@"[NSPrintPanel -pickedLayoutList:] method depreciated");
|
||||
}
|
||||
|
||||
//
|
||||
// Communicating with the NSPrintInfo Object
|
||||
//
|
||||
- (void)updateFromPrintInfo
|
||||
{}
|
||||
{
|
||||
NSString *str;
|
||||
NSPrinter *printer;
|
||||
NSDictionary *dict;
|
||||
NSPrintInfo* info = [[NSPrintOperation currentOperation] printInfo];
|
||||
|
||||
printer = [info printer];
|
||||
[[_printForm cellAtIndex: 0] setStringValue: [printer name] ];
|
||||
[[_printForm cellAtIndex: 1] setStringValue: [printer note] ];
|
||||
[[_printForm cellAtIndex: 2] setStringValue: @"" ];
|
||||
|
||||
[_copiesField setIntValue: 1];
|
||||
[[_fromRangeForm cellAtIndex: 0] setStringValue: @"" ];
|
||||
[[_toRangeForm cellAtIndex: 0] setStringValue: @"" ];
|
||||
[_pageMatrix selectCellAtRow: 0 column: 0];
|
||||
|
||||
dict = [info dictionary];
|
||||
NSDebugLLog(@"NSPrintPanel",
|
||||
@"Update PrintInfo dictionary\n %@ \n --------------", dict);
|
||||
_pages = NSMakeRange([[dict objectForKey: NSPrintFirstPage] intValue],
|
||||
[[dict objectForKey: NSPrintLastPage] intValue]);
|
||||
if (NSMaxRange(_pages) == 0)
|
||||
_pages = NSMakeRange(1, 0);
|
||||
|
||||
/* Setup the resolution popup */
|
||||
[_resButton removeAllItems];
|
||||
str = [printer stringForKey:@"DefaultResolution" inTable: @"PPD"];
|
||||
if (str)
|
||||
{
|
||||
NSArray *resList;
|
||||
resList = [printer stringListForKey:@"Resolution" inTable: @"PPD"];
|
||||
if ([resList count])
|
||||
{
|
||||
int i;
|
||||
NSString *displayRes, *listRes;
|
||||
for (i = 0; i < [resList count]; i++)
|
||||
{
|
||||
NSString *res = [resList objectAtIndex: i];
|
||||
listRes = [@"Resolution/" stringByAppendingString: res];
|
||||
displayRes = [printer stringForKey: listRes
|
||||
inTable: @"PPDOptionTranslation"];
|
||||
|
||||
if (displayRes == nil)
|
||||
displayRes = res;
|
||||
[_resButton addItemWithTitle: displayRes];
|
||||
}
|
||||
listRes = [@"Resolution/" stringByAppendingString: str];
|
||||
displayRes = [printer stringForKey: listRes
|
||||
inTable: @"PPDOptionTranslation"];
|
||||
|
||||
if (displayRes == nil)
|
||||
displayRes = str;
|
||||
[_resButton selectItemWithTitle: displayRes];
|
||||
}
|
||||
else
|
||||
{
|
||||
[_resButton addItemWithTitle: str];
|
||||
}
|
||||
}
|
||||
else
|
||||
[_resButton addItemWithTitle: @"Unknown"];
|
||||
|
||||
/* Setup the paper feed popup */
|
||||
[_paperButton removeAllItems];
|
||||
str = [printer stringForKey:@"DefaultInputSlot" inTable: @"PPD"];
|
||||
if (str)
|
||||
{
|
||||
NSString *manual;
|
||||
NSArray *inputList;
|
||||
manual = [printer stringForKey:@"DefaultManualFeed" inTable: @"PPD"];
|
||||
if (manual)
|
||||
[_paperButton addItemWithTitle: @"Manual"];
|
||||
inputList = [printer stringListForKey:@"InputSlot" inTable: @"PPD"];
|
||||
if ([inputList count])
|
||||
{
|
||||
int i;
|
||||
NSString *displayPaper, *listPaper;
|
||||
for (i = 0; i < [inputList count]; i++)
|
||||
{
|
||||
NSString *paper = [inputList objectAtIndex: i];
|
||||
listPaper = [@"InputSlot/" stringByAppendingString: paper];
|
||||
displayPaper = [printer stringForKey: listPaper
|
||||
inTable: @"PPDOptionTranslation"];
|
||||
|
||||
if (displayPaper == nil)
|
||||
displayPaper = paper;
|
||||
[_paperButton addItemWithTitle: displayPaper];
|
||||
}
|
||||
/* FIXME: What if manual is default ? */
|
||||
listPaper = [@"InputSlot/" stringByAppendingString: str];
|
||||
displayPaper = [printer stringForKey: listPaper
|
||||
inTable: @"PPDOptionTranslation"];
|
||||
|
||||
if (displayPaper == nil)
|
||||
displayPaper = str;
|
||||
[_paperButton selectItemWithTitle: displayPaper];
|
||||
}
|
||||
else
|
||||
{
|
||||
[_paperButton addItemWithTitle: str];
|
||||
}
|
||||
}
|
||||
else
|
||||
[_paperButton addItemWithTitle: @"Unknown"];
|
||||
|
||||
}
|
||||
|
||||
#define NSNUMBER(a) [NSNumber numberWithInt: (a)]
|
||||
|
||||
- (void)finalWritePrintInfo
|
||||
{}
|
||||
{
|
||||
NSString *sel;
|
||||
NSArray *list;
|
||||
NSPrinter *printer;
|
||||
NSMutableDictionary *dict;
|
||||
NSMutableDictionary *features;
|
||||
NSPrintInfo* info = [[NSPrintOperation currentOperation] printInfo];
|
||||
dict = [info dictionary];
|
||||
printer = [info printer];
|
||||
features = [dict objectForKey: NSPrintJobFeatures];
|
||||
|
||||
/* Copies */
|
||||
if ([_copiesField intValue] > 1)
|
||||
{
|
||||
[dict setObject: NSNUMBER([_copiesField intValue])
|
||||
forKey: NSPrintCopies];
|
||||
}
|
||||
|
||||
/* Pages */
|
||||
if ([_pageMatrix selectedColumn] != 0)
|
||||
{
|
||||
[dict setObject: NSNUMBER([[_fromRangeForm cellAtIndex: 0] intValue])
|
||||
forKey: NSPrintFirstPage];
|
||||
[dict setObject: NSNUMBER([[_toRangeForm cellAtIndex: 0] intValue])
|
||||
forKey: NSPrintLastPage];
|
||||
[dict setObject: NSNUMBER(NO) forKey: NSPrintAllPages];
|
||||
}
|
||||
else
|
||||
[dict setObject: NSNUMBER(YES) forKey: NSPrintAllPages];
|
||||
|
||||
/* Resolution */
|
||||
/* Here we take advantage of the fact the names in the popup list
|
||||
are in the same order as the PPD file, so we don't actually compare
|
||||
the values */
|
||||
list = [printer stringListForKey: @"Resolution" inTable: @"PPD"];
|
||||
if (list)
|
||||
{
|
||||
NSString *def;
|
||||
sel = [list objectAtIndex: [_resButton indexOfSelectedItem]];
|
||||
def = [printer stringForKey:@"DefaultResolution" inTable: @"PPD"];
|
||||
if ([sel isEqual: def] == NO)
|
||||
{
|
||||
if (features == nil)
|
||||
{
|
||||
features = [NSMutableDictionary dictionary];
|
||||
[dict setObject: features forKey: NSPrintJobFeatures];
|
||||
}
|
||||
sel = [@"Resolution/" stringByAppendingString: sel];
|
||||
[features setObject: sel forKey: @"Resolution"];
|
||||
}
|
||||
}
|
||||
|
||||
/* Input Slot */
|
||||
list = [printer stringListForKey:@"InputSlot" inTable: @"PPD"];
|
||||
if (list)
|
||||
{
|
||||
int selected;
|
||||
NSString *def, *manual;
|
||||
sel = nil;
|
||||
selected = [_paperButton indexOfSelectedItem];
|
||||
manual = [printer stringForKey:@"DefaultManualFeed" inTable: @"PPD"];
|
||||
|
||||
if (manual)
|
||||
{
|
||||
if (selected == 0)
|
||||
sel = @"Manual";
|
||||
else
|
||||
selected--;
|
||||
}
|
||||
if (sel == nil)
|
||||
sel = [list objectAtIndex: selected];
|
||||
def = [printer stringForKey:@"DefaultInputSlot" inTable: @"PPD"];
|
||||
if ([sel isEqual: @"Manual"] == YES)
|
||||
{
|
||||
[dict setObject: NSPrintManualFeed forKey: NSPrintPaperFeed];
|
||||
/* FIXME: This needs to be more robust. I'm just assuming
|
||||
that all Manual Feed keys can be True or False (which is
|
||||
the case for all the ppd files that I know of). */
|
||||
[dict setObject: @"ManualFeed/True" forKey: NSPrintManualFeed];
|
||||
[features setObject: @"ManualFeed/True" forKey: NSPrintPaperFeed];
|
||||
}
|
||||
else if ([sel isEqual: def] == NO)
|
||||
{
|
||||
if (features == nil)
|
||||
{
|
||||
features = [NSMutableDictionary dictionary];
|
||||
[dict setObject: features forKey: NSPrintJobFeatures];
|
||||
}
|
||||
sel = [@"InputSlot/" stringByAppendingString: sel];
|
||||
[features setObject: sel forKey: @"InputSlot"];
|
||||
[dict setObject: sel forKey: NSPrintPaperFeed];
|
||||
}
|
||||
}
|
||||
|
||||
/* Job Resolution */
|
||||
switch (_picked)
|
||||
{
|
||||
case NSPPSaveButton:
|
||||
sel = NSPrintSaveJob;
|
||||
[dict setObject: _savePath forKey: NSPrintSavePath];
|
||||
break;
|
||||
case NSPPPreviewButton:
|
||||
sel = NSPrintPreviewJob;
|
||||
break;
|
||||
case NSFaxButton:
|
||||
sel = NSPrintFaxJob;
|
||||
break;
|
||||
case NSOKButton:
|
||||
sel = NSPrintSpoolJob;
|
||||
break;
|
||||
case NSCancelButton:
|
||||
default:
|
||||
sel = NSPrintCancelJob;
|
||||
}
|
||||
[info setJobDisposition: sel];
|
||||
|
||||
NSDebugLLog(@"NSPrintPanel",
|
||||
@"Final info dictionary ----\n %@ \n --------------", dict);
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// NSCoding protocol
|
||||
|
|
|
@ -1728,7 +1728,6 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
|||
*/
|
||||
[self lockFocusInRect: aRect];
|
||||
[self drawRect: aRect];
|
||||
[self unlockFocusNeedsFlush: YES];
|
||||
}
|
||||
|
||||
if (_rFlags.has_subviews == YES)
|
||||
|
@ -1788,6 +1787,11 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
|||
}
|
||||
}
|
||||
|
||||
if (NSIsEmptyRect(aRect) == NO)
|
||||
{
|
||||
[self unlockFocusNeedsFlush: YES];
|
||||
}
|
||||
|
||||
/*
|
||||
* If the rect we displayed contains the _invalidRect or _visibleRect
|
||||
* then we can empty _invalidRect. If all subviews have been
|
||||
|
|
|
@ -996,6 +996,7 @@ static NSNotificationCenter *nc = nil;
|
|||
DPSsetinputfocus(GSCurrentContext(), _windowNum);
|
||||
[self resetCursorRects];
|
||||
[nc postNotificationName: NSWindowDidBecomeKeyNotification object: self];
|
||||
NSDebugLLog(@"NSWindow", @"%@ is now key window", [self title]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1009,6 +1010,7 @@ static NSNotificationCenter *nc = nil;
|
|||
DPSsetinputstate(GSCurrentContext(), _windowNum, GSTitleBarMain);
|
||||
}
|
||||
[nc postNotificationName: NSWindowDidBecomeMainNotification object: self];
|
||||
NSDebugLLog(@"NSWindow", @"%@ is now main window", [self title]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -121,7 +121,6 @@ __objc_class_name_NSLayoutManager
|
|||
__objc_class_name__GSRunSearchKey
|
||||
__objc_class_name_NSMatrix
|
||||
__objc_class_name_NSMenu
|
||||
__objc_class_name_NSMenuWindow
|
||||
__objc_class_name_NSMenuWindowTitleView
|
||||
__objc_class_name_NSMenuItem
|
||||
__objc_class_name_NSMenuItemCell
|
||||
|
|
Loading…
Reference in a new issue