mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 520494 - Implement the Cocoa print dialog in a way that works on 10.4. r=josh, r=rs
--HG-- rename : toolkit/locales/en-US/chrome/global/gnomeprintdialog.properties => toolkit/locales/en-US/chrome/global/printdialog.properties
This commit is contained in:
parent
49505be9f8
commit
1db2aff813
@ -343,8 +343,6 @@ else
|
||||
rm -f $(DIST)/$(APP_NAME).app/Contents/MacOS/$(PROGRAM)
|
||||
rsync -aL $(PROGRAM) $(DIST)/$(APP_NAME).app/Contents/MacOS
|
||||
endif
|
||||
mkdir -p $(DIST)/$(APP_NAME).app/Contents/Plug-Ins
|
||||
rsync -a --copy-unsafe-links $(LIBXUL_DIST)/package/PrintPDE.plugin $(DIST)/$(APP_NAME).app/Contents/Plug-Ins
|
||||
-cp -L $(DIST)/bin/mangle $(DIST)/bin/shlibsign $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)
|
||||
cp -RL $(DIST)/branding/firefox.icns $(DIST)/$(APP_NAME).app/Contents/Resources/firefox.icns
|
||||
cp -RL $(DIST)/branding/document.icns $(DIST)/$(APP_NAME).app/Contents/Resources/document.icns
|
||||
|
@ -636,6 +636,12 @@ plugins/Default Plugin.plugin/Contents/MacOS/Default Plugin
|
||||
plugins/Default Plugin.plugin/Contents/PkgInfo
|
||||
plugins/Default Plugin.plugin/Contents/Resources/Default Plugin.rsrc
|
||||
plugins/Default Plugin.plugin/Contents/Resources/English.lproj/InfoPlist.strings
|
||||
../Plug-Ins/PrintPDE.plugin/Contents/Info.plist
|
||||
../Plug-Ins/PrintPDE.plugin/Contents/MacOS/PrintPDE
|
||||
../Plug-Ins/PrintPDE.plugin/Contents/Resources/English.lproj/Localizable.strings
|
||||
../Plug-Ins/PrintPDE.plugin/Contents/Resources/English.lproj/PrintPDE.nib/classes.nib
|
||||
../Plug-Ins/PrintPDE.plugin/Contents/Resources/English.lproj/PrintPDE.nib/info.nib
|
||||
../Plug-Ins/PrintPDE.plugin/Contents/Resources/English.lproj/PrintPDE.nib/objects.xib
|
||||
res/cursors/CVS/Entries
|
||||
res/cursors/CVS/Repository
|
||||
res/cursors/CVS/Root
|
||||
|
@ -1,41 +0,0 @@
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
PrintFrames=Print Frames
|
||||
Aslaid=As &laid out on the screen
|
||||
selectedframe=The selected &frame
|
||||
Eachframe=&Each frame separately
|
||||
options=Options
|
@ -14,7 +14,6 @@
|
||||
locale/@AB_CD@/global/global-strres.properties (%chrome/global-strres.properties)
|
||||
locale/@AB_CD@/global/plugins.properties (%chrome/plugins.properties)
|
||||
locale/@AB_CD@/global/nsWebBrowserPersist.properties (%chrome/nsWebBrowserPersist.properties)
|
||||
locale/@AB_CD@/global/printdialog.properties (%chrome/printdialog.properties)
|
||||
locale/@AB_CD@/global/xslt/xslt.properties (%chrome/xslt/xslt.properties)
|
||||
locale/@AB_CD@/global/dom/dom.properties (%chrome/dom/dom.properties)
|
||||
#ifdef MOZ_SVG
|
||||
|
@ -47,7 +47,6 @@ LIBRARY_NAME = printingui_s
|
||||
LIBXUL_LIBRARY = 1
|
||||
|
||||
|
||||
DIRS = printpde
|
||||
|
||||
CMMSRCS = nsPrintingPromptServiceX.mm
|
||||
|
||||
@ -57,7 +56,6 @@ CPPSRCS = \
|
||||
$(NULL)
|
||||
|
||||
LOCAL_INCLUDES = \
|
||||
-I$(srcdir)/printpde/public \
|
||||
$(NULL)
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a
|
||||
|
@ -51,7 +51,6 @@
|
||||
|
||||
// Printing Progress Includes
|
||||
#include "nsPrintProgress.h"
|
||||
#include "nsPrintProgressParams.h"
|
||||
#include "nsIWebProgressListener.h"
|
||||
|
||||
|
||||
@ -72,9 +71,7 @@ public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIWindowWatcher> mWatcher;
|
||||
nsCOMPtr<nsIPrintProgress> mPrintProgress;
|
||||
nsCOMPtr<nsIWebProgressListener> mWebProgressListener;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -40,158 +40,12 @@
|
||||
#include "nsPrintingPromptService.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsObjCExceptions.h"
|
||||
|
||||
#include "nsIPrintingPromptService.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIEmbeddingSiteWindow.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIWebBrowserChrome.h"
|
||||
#include "nsIWindowWatcher.h"
|
||||
#include "nsIPrintSettingsX.h"
|
||||
#include "nsIDirectoryService.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
#include "nsPDECommon.h"
|
||||
|
||||
// Printing Progress Includes
|
||||
#include "nsPrintProgress.h"
|
||||
#include "nsPrintProgressParams.h"
|
||||
#include "nsIWebProgressListener.h"
|
||||
|
||||
#import <Carbon/Carbon.h>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Static Helpers
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static nsresult LoadPDEPlugIn()
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
static CFPlugInRef gPDEPlugIn = nsnull;
|
||||
|
||||
if (!gPDEPlugIn) {
|
||||
|
||||
CFURLRef pluginsURL = ::CFBundleCopyBuiltInPlugInsURL(CFBundleGetMainBundle());
|
||||
if (pluginsURL) {
|
||||
CFURLRef thePluginURL = ::CFURLCreateCopyAppendingPathComponent(nsnull,
|
||||
pluginsURL,
|
||||
CFSTR("PrintPDE.plugin"),
|
||||
PR_FALSE);
|
||||
if (thePluginURL) {
|
||||
gPDEPlugIn = ::CFPlugInCreate(nsnull, thePluginURL);
|
||||
::CFRelease(thePluginURL);
|
||||
}
|
||||
::CFRelease(pluginsURL);
|
||||
}
|
||||
}
|
||||
return gPDEPlugIn ? NS_OK : NS_ERROR_FAILURE;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
}
|
||||
|
||||
static CFDictionaryRef ExtractCustomSettingsDict(PMPrintSettings nativePrintSettings)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
|
||||
|
||||
CFDictionaryRef resultDict = NULL;
|
||||
UInt32 bytesNeeded;
|
||||
|
||||
OSStatus status = ::PMGetPrintSettingsExtendedData(nativePrintSettings, kAppPrintDialogAppOnlyKey, &bytesNeeded, NULL);
|
||||
if (status == noErr) {
|
||||
nsAutoTArray<UInt8, 512> dataBuffer;
|
||||
if (dataBuffer.SetLength(bytesNeeded)) {
|
||||
status = ::PMGetPrintSettingsExtendedData(nativePrintSettings, kAppPrintDialogAppOnlyKey, &bytesNeeded, dataBuffer.Elements());
|
||||
if (status == noErr) {
|
||||
CFDataRef xmlData = ::CFDataCreate(kCFAllocatorDefault, dataBuffer.Elements(), bytesNeeded);
|
||||
if (xmlData) {
|
||||
resultDict = (CFDictionaryRef)::CFPropertyListCreateFromXMLData(
|
||||
kCFAllocatorDefault,
|
||||
xmlData,
|
||||
kCFPropertyListImmutable,
|
||||
NULL);
|
||||
CFRelease(xmlData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
NS_ASSERTION(resultDict, "Failed to get custom print settings dict");
|
||||
return resultDict;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(NULL);
|
||||
}
|
||||
|
||||
static PRBool
|
||||
GetDictionaryStringValue(CFDictionaryRef aDictionary, CFStringRef aKey, nsAString& aResult)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
|
||||
|
||||
aResult.Truncate();
|
||||
CFTypeRef dictValue;
|
||||
if ((dictValue = CFDictionaryGetValue(aDictionary, aKey)) &&
|
||||
(CFGetTypeID(dictValue) == CFStringGetTypeID()))
|
||||
{
|
||||
CFIndex stringLen = CFStringGetLength((CFStringRef)dictValue);
|
||||
|
||||
nsAutoTArray<UniChar, 256> stringBuffer;
|
||||
if (stringBuffer.SetLength(stringLen + 1)) {
|
||||
::CFStringGetCharacters((CFStringRef)dictValue, CFRangeMake(0, stringLen), stringBuffer.Elements());
|
||||
aResult.Assign(stringBuffer.Elements(), stringLen);
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(PR_FALSE);
|
||||
}
|
||||
|
||||
// returns success or failure (not the read value)
|
||||
static PRBool
|
||||
GetDictionaryBooleanValue(CFDictionaryRef aDictionary, CFStringRef aKey, PRBool& aResult)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
|
||||
|
||||
aResult = PR_FALSE;
|
||||
CFTypeRef dictValue;
|
||||
if ((dictValue = CFDictionaryGetValue(aDictionary, aKey)) &&
|
||||
(CFGetTypeID(dictValue) == CFBooleanGetTypeID()))
|
||||
{
|
||||
aResult = CFBooleanGetValue((CFBooleanRef)dictValue);
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(PR_FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
SetDictionaryStringValue(CFMutableDictionaryRef aDictionary, CFStringRef aKey, const nsXPIDLString& aValue)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
CFStringRef cfString = CFStringCreateWithCharacters(NULL, aValue.get(), aValue.Length());
|
||||
if (cfString) {
|
||||
CFDictionaryAddValue(aDictionary, aKey, cfString);
|
||||
CFRelease(cfString);
|
||||
}
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
static void
|
||||
SetDictionaryBooleanvalue(CFMutableDictionaryRef aDictionary, CFStringRef aKey, PRBool aValue)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
CFDictionaryAddValue(aDictionary, aKey, aValue ? kCFBooleanTrue : kCFBooleanFalse);
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
#include "nsIPrintDialogService.h"
|
||||
|
||||
//*****************************************************************************
|
||||
// nsPrintingPromptService
|
||||
@ -199,8 +53,7 @@ SetDictionaryBooleanvalue(CFMutableDictionaryRef aDictionary, CFStringRef aKey,
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsPrintingPromptService, nsIPrintingPromptService, nsIWebProgressListener)
|
||||
|
||||
nsPrintingPromptService::nsPrintingPromptService() :
|
||||
mWatcher(do_GetService(NS_WINDOWWATCHER_CONTRACTID))
|
||||
nsPrintingPromptService::nsPrintingPromptService()
|
||||
{
|
||||
}
|
||||
|
||||
@ -220,227 +73,16 @@ nsresult nsPrintingPromptService::Init()
|
||||
NS_IMETHODIMP
|
||||
nsPrintingPromptService::ShowPrintDialog(nsIDOMWindow *parent, nsIWebBrowserPrint *webBrowserPrint, nsIPrintSettings *printSettings)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
nsresult rv;
|
||||
OSStatus status;
|
||||
|
||||
nsCOMPtr<nsIPrintSettingsX> printSettingsX(do_QueryInterface(printSettings));
|
||||
if (!printSettingsX)
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
|
||||
PMPrintSession printSession;
|
||||
rv = printSettingsX->GetNativePrintSession(&printSession);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
PMPageFormat pageFormat = kPMNoPageFormat;
|
||||
rv = printSettingsX->GetPMPageFormat(&pageFormat);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
nsCOMPtr<nsIPrintDialogService> dlgPrint(do_GetService(
|
||||
NS_PRINTDIALOGSERVICE_CONTRACTID));
|
||||
if (dlgPrint)
|
||||
return dlgPrint->Show(parent, printSettings);
|
||||
|
||||
PMPrintSettings nativePrintSettings = kPMNoPrintSettings;
|
||||
rv = printSettingsX->GetPMPrintSettings(&nativePrintSettings);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
status = ::PMSessionValidatePageFormat(printSession, pageFormat, kPMDontWantBoolean);
|
||||
if (status != noErr)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// Reset the print settings to their defaults each time. We don't want to remember
|
||||
// the last printed page range or whatever. This is expected Mac behavior.
|
||||
status = ::PMSessionDefaultPrintSettings(printSession, nativePrintSettings);
|
||||
if (status != noErr)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
::InitCursor();
|
||||
|
||||
rv = ::LoadPDEPlugIn();
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "LoadPDEPlugIn() failed");
|
||||
|
||||
// Set the print job title
|
||||
PRUnichar** docTitles;
|
||||
PRUint32 titleCount;
|
||||
rv = webBrowserPrint->EnumerateDocumentNames(&titleCount, &docTitles);
|
||||
if (NS_SUCCEEDED(rv) && titleCount > 0) {
|
||||
CFStringRef cfTitleString = CFStringCreateWithCharacters(NULL, docTitles[0], nsCRT::strlen(docTitles[0]));
|
||||
if (cfTitleString) {
|
||||
::PMPrintSettingsSetJobName(nativePrintSettings, cfTitleString);
|
||||
CFRelease(cfTitleString);
|
||||
}
|
||||
for (PRInt32 i = titleCount - 1; i >= 0; i--) {
|
||||
NS_Free(docTitles[i]);
|
||||
}
|
||||
NS_Free(docTitles);
|
||||
docTitles = NULL;
|
||||
titleCount = 0;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// Create a dictionary and store our settings into it
|
||||
CFMutableDictionaryRef dictToPDE = CFDictionaryCreateMutable(kCFAllocatorDefault, 0,
|
||||
(const CFDictionaryKeyCallBacks *)&kCFTypeDictionaryKeyCallBacks,
|
||||
(const CFDictionaryValueCallBacks *)&kCFTypeDictionaryValueCallBacks);
|
||||
NS_ASSERTION(dictToPDE, "Failed to create a CFDictionary for print settings");
|
||||
if (dictToPDE) {
|
||||
PRBool isOn;
|
||||
PRInt16 howToEnableFrameUI;
|
||||
|
||||
printSettings->GetPrintOptions(nsIPrintSettings::kEnableSelectionRB, &isOn);
|
||||
SetDictionaryBooleanvalue(dictToPDE, kPDEKeyHaveSelection, isOn);
|
||||
|
||||
printSettings->GetHowToEnableFrameUI(&howToEnableFrameUI);
|
||||
if (howToEnableFrameUI == nsIPrintSettings::kFrameEnableAll) {
|
||||
CFDictionaryAddValue(dictToPDE, kPDEKeyHaveFrames, kCFBooleanTrue);
|
||||
CFDictionaryAddValue(dictToPDE, kPDEKeyHaveFrameSelected, kCFBooleanTrue);
|
||||
}
|
||||
else if (howToEnableFrameUI == nsIPrintSettings::kFrameEnableAsIsAndEach) {
|
||||
CFDictionaryAddValue(dictToPDE, kPDEKeyHaveFrames, kCFBooleanTrue);
|
||||
CFDictionaryAddValue(dictToPDE, kPDEKeyHaveFrameSelected, kCFBooleanFalse);
|
||||
}
|
||||
else {
|
||||
CFDictionaryAddValue(dictToPDE, kPDEKeyHaveFrames, kCFBooleanFalse);
|
||||
CFDictionaryAddValue(dictToPDE, kPDEKeyHaveFrameSelected, kCFBooleanFalse);
|
||||
}
|
||||
|
||||
// get the boolean values
|
||||
printSettings->GetShrinkToFit(&isOn);
|
||||
SetDictionaryBooleanvalue(dictToPDE, kPDEKeyShrinkToFit, isOn);
|
||||
|
||||
printSettings->GetPrintBGColors(&isOn);
|
||||
SetDictionaryBooleanvalue(dictToPDE, kPDEKeyPrintBGColors, isOn);
|
||||
|
||||
printSettings->GetPrintBGImages(&isOn);
|
||||
SetDictionaryBooleanvalue(dictToPDE, kPDEKeyPrintBGImages, isOn);
|
||||
|
||||
// read headers
|
||||
nsXPIDLString tempString;
|
||||
printSettings->GetHeaderStrRight(getter_Copies(tempString));
|
||||
SetDictionaryStringValue(dictToPDE, kPDEKeyHeaderRight, tempString);
|
||||
|
||||
printSettings->GetHeaderStrCenter(getter_Copies(tempString));
|
||||
SetDictionaryStringValue(dictToPDE, kPDEKeyHeaderCenter, tempString);
|
||||
|
||||
printSettings->GetHeaderStrLeft(getter_Copies(tempString));
|
||||
SetDictionaryStringValue(dictToPDE, kPDEKeyHeaderLeft, tempString);
|
||||
|
||||
// read footers
|
||||
printSettings->GetFooterStrRight(getter_Copies(tempString));
|
||||
SetDictionaryStringValue(dictToPDE, kPDEKeyFooterRight, tempString);
|
||||
|
||||
printSettings->GetFooterStrCenter(getter_Copies(tempString));
|
||||
SetDictionaryStringValue(dictToPDE, kPDEKeyFooterCenter, tempString);
|
||||
|
||||
printSettings->GetFooterStrLeft(getter_Copies(tempString));
|
||||
SetDictionaryStringValue(dictToPDE, kPDEKeyFooterLeft, tempString);
|
||||
|
||||
CFDataRef xmlData = CFPropertyListCreateXMLData(kCFAllocatorDefault, dictToPDE);
|
||||
NS_ASSERTION(xmlData, "Could not create print settings CFData from CFDictionary");
|
||||
if (xmlData) {
|
||||
status = ::PMSetPrintSettingsExtendedData(nativePrintSettings, kAppPrintDialogAppOnlyKey, CFDataGetLength(xmlData), (void *)CFDataGetBytePtr(xmlData));
|
||||
NS_ASSERTION(status == noErr, "PMSetPrintSettingsExtendedData() failed");
|
||||
CFRelease(xmlData);
|
||||
}
|
||||
CFRelease(dictToPDE);
|
||||
}
|
||||
|
||||
Boolean accepted;
|
||||
status = ::PMSessionPrintDialog(printSession, nativePrintSettings, pageFormat, &accepted);
|
||||
printSettingsX->CleanUpAfterCarbonDialog();
|
||||
|
||||
if (status == noErr && accepted) {
|
||||
int pageRange = -1;
|
||||
|
||||
CFDictionaryRef dictFromPDE = ExtractCustomSettingsDict(nativePrintSettings);
|
||||
if (dictFromPDE) {
|
||||
//CFShow(dictFromPDE);
|
||||
|
||||
PRBool printSelectionOnly;
|
||||
if (GetDictionaryBooleanValue(dictFromPDE, kPDEKeyPrintSelection, printSelectionOnly)) {
|
||||
if (printSelectionOnly) {
|
||||
printSettings->SetPrintRange(nsIPrintSettings::kRangeSelection);
|
||||
pageRange = nsIPrintSettings::kRangeSelection;
|
||||
}
|
||||
else {
|
||||
printSettings->SetPrintRange(nsIPrintSettings::kRangeAllPages);
|
||||
pageRange = nsIPrintSettings::kRangeAllPages;
|
||||
}
|
||||
}
|
||||
|
||||
CFTypeRef dictValue;
|
||||
if ((dictValue = CFDictionaryGetValue(dictFromPDE, kPDEKeyPrintFrameType)) &&
|
||||
(CFGetTypeID(dictValue) == CFStringGetTypeID())) {
|
||||
if (CFEqual(dictValue, kPDEValueFramesAsIs))
|
||||
printSettings->SetPrintFrameType(nsIPrintSettings::kFramesAsIs);
|
||||
else if (CFEqual(dictValue, kPDEValueSelectedFrame))
|
||||
printSettings->SetPrintFrameType(nsIPrintSettings::kSelectedFrame);
|
||||
else if (CFEqual(dictValue, kPDEValueEachFrameSep))
|
||||
printSettings->SetPrintFrameType(nsIPrintSettings::kEachFrameSep);
|
||||
}
|
||||
|
||||
PRBool tempBool;
|
||||
if (GetDictionaryBooleanValue(dictFromPDE, kPDEKeyShrinkToFit, tempBool))
|
||||
printSettings->SetShrinkToFit(tempBool);
|
||||
|
||||
if (GetDictionaryBooleanValue(dictFromPDE, kPDEKeyPrintBGColors, tempBool))
|
||||
printSettings->SetPrintBGColors(tempBool);
|
||||
|
||||
if (GetDictionaryBooleanValue(dictFromPDE, kPDEKeyPrintBGImages, tempBool))
|
||||
printSettings->SetPrintBGImages(tempBool);
|
||||
|
||||
nsAutoString stringFromDict;
|
||||
|
||||
// top headers
|
||||
if (GetDictionaryStringValue(dictFromPDE, kPDEKeyHeaderLeft, stringFromDict))
|
||||
printSettings->SetHeaderStrLeft(stringFromDict.get());
|
||||
|
||||
if (GetDictionaryStringValue(dictFromPDE, kPDEKeyHeaderCenter, stringFromDict))
|
||||
printSettings->SetHeaderStrCenter(stringFromDict.get());
|
||||
|
||||
if (GetDictionaryStringValue(dictFromPDE, kPDEKeyHeaderRight, stringFromDict))
|
||||
printSettings->SetHeaderStrRight(stringFromDict.get());
|
||||
|
||||
// bottom footers
|
||||
if (GetDictionaryStringValue(dictFromPDE, kPDEKeyFooterLeft, stringFromDict))
|
||||
printSettings->SetFooterStrLeft(stringFromDict.get());
|
||||
|
||||
if (GetDictionaryStringValue(dictFromPDE, kPDEKeyFooterCenter, stringFromDict))
|
||||
printSettings->SetFooterStrCenter(stringFromDict.get());
|
||||
|
||||
if (GetDictionaryStringValue(dictFromPDE, kPDEKeyFooterRight, stringFromDict))
|
||||
printSettings->SetFooterStrRight(stringFromDict.get());
|
||||
|
||||
CFRelease(dictFromPDE);
|
||||
}
|
||||
|
||||
if (pageRange == -1) {
|
||||
printSettings->SetPrintRange(nsIPrintSettings::kRangeAllPages);
|
||||
pageRange = nsIPrintSettings::kRangeAllPages;
|
||||
}
|
||||
|
||||
if (pageRange != nsIPrintSettings::kRangeSelection) {
|
||||
UInt32 firstPage, lastPage;
|
||||
status = ::PMGetFirstPage(nativePrintSettings, &firstPage);
|
||||
if (status == noErr) {
|
||||
status = ::PMGetLastPage(nativePrintSettings, &lastPage);
|
||||
if (status == noErr && lastPage != LONG_MAX) {
|
||||
printSettings->SetPrintRange(nsIPrintSettings::kRangeSpecifiedPageRange);
|
||||
printSettings->SetStartPageRange(firstPage);
|
||||
printSettings->SetEndPageRange(lastPage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!accepted)
|
||||
return NS_ERROR_ABORT;
|
||||
|
||||
if (status != noErr)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return NS_OK;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -460,44 +102,12 @@ NS_IMETHODIMP
|
||||
nsPrintingPromptService::ShowPageSetup(nsIDOMWindow *parent, nsIPrintSettings *printSettings, nsIObserver *aObs)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
nsCOMPtr<nsIPrintDialogService> dlgPrint(do_GetService(
|
||||
NS_PRINTDIALOGSERVICE_CONTRACTID));
|
||||
if (dlgPrint)
|
||||
return dlgPrint->ShowPageSetup(parent, printSettings);
|
||||
|
||||
nsCOMPtr<nsIPrintSettingsX> printSettingsX(do_QueryInterface(printSettings));
|
||||
if (!printSettingsX)
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
|
||||
OSStatus status;
|
||||
|
||||
PMPrintSession printSession;
|
||||
status = ::PMCreateSession(&printSession);
|
||||
if (status != noErr)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PMPageFormat pageFormat;
|
||||
printSettingsX->GetPMPageFormat(&pageFormat);
|
||||
if (pageFormat == kPMNoPageFormat) {
|
||||
::PMRelease(printSession);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
Boolean validated;
|
||||
::PMSessionValidatePageFormat(printSession, pageFormat, &validated);
|
||||
|
||||
::InitCursor();
|
||||
|
||||
Boolean accepted = false;
|
||||
status = ::PMSessionPageSetupDialog(printSession, pageFormat, &accepted);
|
||||
printSettingsX->CleanUpAfterCarbonDialog();
|
||||
|
||||
OSStatus tempStatus = ::PMRelease(printSession);
|
||||
if (status == noErr)
|
||||
status = tempStatus;
|
||||
|
||||
if (status != noErr)
|
||||
return NS_ERROR_FAILURE;
|
||||
if (!accepted)
|
||||
return NS_ERROR_ABORT;
|
||||
|
||||
return NS_OK;
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
}
|
||||
@ -516,13 +126,6 @@ nsPrintingPromptService::ShowPrinterProperties(nsIDOMWindow *parent, const PRUni
|
||||
NS_IMETHODIMP
|
||||
nsPrintingPromptService::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 aStateFlags, nsresult aStatus)
|
||||
{
|
||||
if ((aStateFlags & STATE_STOP) && mWebProgressListener) {
|
||||
mWebProgressListener->OnStateChange(aWebProgress, aRequest, aStateFlags, aStatus);
|
||||
if (mPrintProgress)
|
||||
mPrintProgress->CloseProgressDialog(PR_TRUE);
|
||||
mPrintProgress = nsnull;
|
||||
mWebProgressListener = nsnull;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -530,9 +133,6 @@ nsPrintingPromptService::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest
|
||||
NS_IMETHODIMP
|
||||
nsPrintingPromptService::OnProgressChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress, PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress)
|
||||
{
|
||||
if (mWebProgressListener) {
|
||||
return mWebProgressListener->OnProgressChange(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -540,9 +140,6 @@ nsPrintingPromptService::OnProgressChange(nsIWebProgress *aWebProgress, nsIReque
|
||||
NS_IMETHODIMP
|
||||
nsPrintingPromptService::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location)
|
||||
{
|
||||
if (mWebProgressListener) {
|
||||
return mWebProgressListener->OnLocationChange(aWebProgress, aRequest, location);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -550,9 +147,6 @@ nsPrintingPromptService::OnLocationChange(nsIWebProgress *aWebProgress, nsIReque
|
||||
NS_IMETHODIMP
|
||||
nsPrintingPromptService::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const PRUnichar *aMessage)
|
||||
{
|
||||
if (mWebProgressListener) {
|
||||
return mWebProgressListener->OnStatusChange(aWebProgress, aRequest, aStatus, aMessage);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -560,8 +154,5 @@ nsPrintingPromptService::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest
|
||||
NS_IMETHODIMP
|
||||
nsPrintingPromptService::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 state)
|
||||
{
|
||||
if (mWebProgressListener) {
|
||||
return mWebProgressListener->OnSecurityChange(aWebProgress, aRequest, state);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1,42 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>PrintPDE</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string></string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string></string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.mozilla.pde.MOZZ</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>PrintPDE</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>MOZZ</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>CFPlugInDynamicRegistration</key>
|
||||
<string>NO</string>
|
||||
<key>CFPlugInFactories</key>
|
||||
<dict>
|
||||
<key>00000000-0000-0000-0000-000000000000</key>
|
||||
<string>MyCFPlugInFactory</string>
|
||||
</dict>
|
||||
<key>CFPlugInTypes</key>
|
||||
<dict>
|
||||
<key>BCB07250-E57F-11D3-8CA6-0050E4603277</key>
|
||||
<array>
|
||||
<string>00000000-0000-0000-0000-000000000000</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
@ -1,80 +0,0 @@
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2001
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = printpde
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
ifdef MOZ_DEBUG
|
||||
BUILDSTYLE = Development
|
||||
else
|
||||
BUILDSTYLE = Deployment
|
||||
endif
|
||||
|
||||
# pbbuild or xcodebuild indicates Xcode; the Xcode project contains
|
||||
# native targets needed for proper SDK builds.
|
||||
PROJECT=PrintPDE.xcode
|
||||
PROJECT_ARG=-project $(PROJECT)
|
||||
PBBUILD_ARG=$(PBBUILD_SETTINGS)
|
||||
|
||||
unexport CC CXX
|
||||
|
||||
ABS_topsrcdir := $(shell cd $(topsrcdir); pwd)
|
||||
ifneq ($(ABS_topsrcdir),$(MOZ_BUILD_ROOT))
|
||||
export::
|
||||
rsync -a --exclude .DS_Store --exclude "CVS/" $(srcdir)/$(PROJECT) .
|
||||
ln -fs $(srcdir)/src
|
||||
ln -fs $(srcdir)/res
|
||||
ln -fs $(srcdir)/public
|
||||
ln -fs $(srcdir)/Info-*.plist .
|
||||
|
||||
GARBAGE += src res public Info-*.plist
|
||||
GARBAGE_DIRS += $(PROJECT)
|
||||
endif
|
||||
|
||||
GARBAGE_DIRS += build
|
||||
|
||||
libs::
|
||||
$(PBBUILD) $(PROJECT_ARG) -target PrintPDE -buildstyle $(BUILDSTYLE) $(PBBUILD_ARG)
|
||||
mkdir -p $(DIST)/package
|
||||
$(INSTALL) $(XCODE_PRODUCT_DIR)/PrintPDE.plugin $(DIST)/package
|
@ -1,426 +0,0 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 39;
|
||||
objects = {
|
||||
01823927FFE8053411CA24C1 = {
|
||||
isa = PBXFileReference;
|
||||
lastKnownFileType = wrapper.framework;
|
||||
name = Carbon.framework;
|
||||
path = /System/Library/Frameworks/Carbon.framework;
|
||||
refType = 0;
|
||||
sourceTree = "<absolute>";
|
||||
};
|
||||
01ACF443FFC1C83D11CA2470 = {
|
||||
buildSettings = {
|
||||
COPY_PHASE_STRIP = NO;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_ENABLE_FIX_AND_CONTINUE = YES;
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
OPTIMIZATION_CFLAGS = "-O0";
|
||||
ZERO_LINK = YES;
|
||||
};
|
||||
isa = PBXBuildStyle;
|
||||
name = Development;
|
||||
};
|
||||
01ACF444FFC1C83D11CA2470 = {
|
||||
buildSettings = {
|
||||
COPY_PHASE_STRIP = YES;
|
||||
GCC_ENABLE_FIX_AND_CONTINUE = NO;
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
ZERO_LINK = NO;
|
||||
};
|
||||
isa = PBXBuildStyle;
|
||||
name = Deployment;
|
||||
};
|
||||
//010
|
||||
//011
|
||||
//012
|
||||
//013
|
||||
//014
|
||||
//080
|
||||
//081
|
||||
//082
|
||||
//083
|
||||
//084
|
||||
089C1669FE841209C02AAC07 = {
|
||||
buildSettings = {
|
||||
};
|
||||
buildStyles = (
|
||||
01ACF443FFC1C83D11CA2470,
|
||||
01ACF444FFC1C83D11CA2470,
|
||||
);
|
||||
hasScannedForEncodings = 0;
|
||||
isa = PBXProject;
|
||||
mainGroup = 089C166AFE841209C02AAC07;
|
||||
projectDirPath = "";
|
||||
targets = (
|
||||
4D1684240830212700080847,
|
||||
);
|
||||
};
|
||||
089C166AFE841209C02AAC07 = {
|
||||
children = (
|
||||
F849B8C8029C68B901CB2098,
|
||||
089C1671FE841209C02AAC07,
|
||||
19C28FB6FE9D52B211CA2CBB,
|
||||
4D1684340830212700080847,
|
||||
);
|
||||
isa = PBXGroup;
|
||||
name = CFPlugInBundle;
|
||||
refType = 4;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
089C1671FE841209C02AAC07 = {
|
||||
children = (
|
||||
01823927FFE8053411CA24C1,
|
||||
);
|
||||
isa = PBXGroup;
|
||||
name = "External Frameworks and Libraries";
|
||||
refType = 4;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
//080
|
||||
//081
|
||||
//082
|
||||
//083
|
||||
//084
|
||||
//190
|
||||
//191
|
||||
//192
|
||||
//193
|
||||
//194
|
||||
19C28FB6FE9D52B211CA2CBB = {
|
||||
children = (
|
||||
4D1684350830212700080847,
|
||||
);
|
||||
isa = PBXGroup;
|
||||
name = Products;
|
||||
refType = 4;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
//190
|
||||
//191
|
||||
//192
|
||||
//193
|
||||
//194
|
||||
//4D0
|
||||
//4D1
|
||||
//4D2
|
||||
//4D3
|
||||
//4D4
|
||||
4D1684240830212700080847 = {
|
||||
buildPhases = (
|
||||
4D1684250830212700080847,
|
||||
4D16842A0830212700080847,
|
||||
4D16842D0830212700080847,
|
||||
4D1684310830212700080847,
|
||||
4D1684330830212700080847,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
buildSettings = {
|
||||
FRAMEWORK_SEARCH_PATHS = "\"$(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks\" \"$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Frameworks\"";
|
||||
GCC_OPTIMIZATION_LEVEL = 2;
|
||||
HEADER_SEARCH_PATHS = .;
|
||||
INFOPLIST_FILE = "Info-PrintPDE.plist";
|
||||
INSTALL_MODE_FLAG = "u+w";
|
||||
OTHER_CFLAGS = "";
|
||||
OTHER_LDFLAGS = "-bundle";
|
||||
PRODUCT_NAME = PrintPDE;
|
||||
SECTORDER_FLAGS = "";
|
||||
WARNING_CFLAGS = "-Wall -Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
|
||||
WRAPPER_EXTENSION = plugin;
|
||||
};
|
||||
dependencies = (
|
||||
);
|
||||
isa = PBXNativeTarget;
|
||||
name = PrintPDE;
|
||||
productName = PrintDialogPDE.plugin;
|
||||
productReference = 4D1684350830212700080847;
|
||||
productType = "com.apple.product-type.bundle";
|
||||
};
|
||||
4D1684250830212700080847 = {
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
4D1684260830212700080847,
|
||||
4D1684270830212700080847,
|
||||
4D1684280830212700080847,
|
||||
4D1684290830212700080847,
|
||||
);
|
||||
isa = PBXHeadersBuildPhase;
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
4D1684260830212700080847 = {
|
||||
fileRef = F73AA2D2026B518801CB2098;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
4D1684270830212700080847 = {
|
||||
fileRef = F73AA2D3026B518801CB2098;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
4D1684280830212700080847 = {
|
||||
fileRef = F73AA2D4026B518801CB2098;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
4D1684290830212700080847 = {
|
||||
fileRef = F57C986203B8293D01202892;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
4D16842A0830212700080847 = {
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
4D16842B0830212700080847,
|
||||
4D16842C0830212700080847,
|
||||
);
|
||||
isa = PBXResourcesBuildPhase;
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
4D16842B0830212700080847 = {
|
||||
fileRef = F73AA2D8026B518801CB2098;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
4D16842C0830212700080847 = {
|
||||
fileRef = F73AA2DA026B518801CB2098;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
4D16842D0830212700080847 = {
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
4D16842E0830212700080847,
|
||||
4D16842F0830212700080847,
|
||||
4D1684300830212700080847,
|
||||
);
|
||||
isa = PBXSourcesBuildPhase;
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
4D16842E0830212700080847 = {
|
||||
fileRef = F73AA2DD026B518801CB2098;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
4D16842F0830212700080847 = {
|
||||
fileRef = F73AA2DE026B518801CB2098;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
4D1684300830212700080847 = {
|
||||
fileRef = F73AA2DF026B518801CB2098;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
4D1684310830212700080847 = {
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
4D1684320830212700080847,
|
||||
);
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
4D1684320830212700080847 = {
|
||||
fileRef = 01823927FFE8053411CA24C1;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
4D1684330830212700080847 = {
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
isa = PBXRezBuildPhase;
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
4D1684340830212700080847 = {
|
||||
isa = PBXFileReference;
|
||||
lastKnownFileType = text.xml;
|
||||
path = "Info-PrintPDE.plist";
|
||||
refType = 4;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
4D1684350830212700080847 = {
|
||||
explicitFileType = wrapper.cfbundle;
|
||||
includeInIndex = 0;
|
||||
isa = PBXFileReference;
|
||||
path = PrintPDE.plugin;
|
||||
refType = 3;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
//4D0
|
||||
//4D1
|
||||
//4D2
|
||||
//4D3
|
||||
//4D4
|
||||
//F50
|
||||
//F51
|
||||
//F52
|
||||
//F53
|
||||
//F54
|
||||
F57C986203B8293D01202892 = {
|
||||
isa = PBXFileReference;
|
||||
lastKnownFileType = sourcecode.c.h;
|
||||
path = nsPDECommon.h;
|
||||
refType = 4;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F586CCD503BC184501202892 = {
|
||||
children = (
|
||||
F57C986203B8293D01202892,
|
||||
);
|
||||
isa = PBXGroup;
|
||||
path = public;
|
||||
refType = 4;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
//F50
|
||||
//F51
|
||||
//F52
|
||||
//F53
|
||||
//F54
|
||||
//F70
|
||||
//F71
|
||||
//F72
|
||||
//F73
|
||||
//F74
|
||||
F73AA2D2026B518801CB2098 = {
|
||||
isa = PBXFileReference;
|
||||
lastKnownFileType = sourcecode.c.h;
|
||||
path = PDECore.h;
|
||||
refType = 4;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F73AA2D3026B518801CB2098 = {
|
||||
isa = PBXFileReference;
|
||||
lastKnownFileType = sourcecode.c.h;
|
||||
path = PDECustom.h;
|
||||
refType = 4;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F73AA2D4026B518801CB2098 = {
|
||||
isa = PBXFileReference;
|
||||
lastKnownFileType = sourcecode.c.h;
|
||||
path = PDEUtilities.h;
|
||||
refType = 4;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F73AA2D5026B518801CB2098 = {
|
||||
children = (
|
||||
F73AA2D8026B518801CB2098,
|
||||
F73AA2DA026B518801CB2098,
|
||||
);
|
||||
isa = PBXGroup;
|
||||
path = res;
|
||||
refType = 4;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F73AA2D8026B518801CB2098 = {
|
||||
children = (
|
||||
F73AA2D9026B518801CB2098,
|
||||
);
|
||||
isa = PBXVariantGroup;
|
||||
name = Localizable.strings;
|
||||
path = "";
|
||||
refType = 4;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F73AA2D9026B518801CB2098 = {
|
||||
isa = PBXFileReference;
|
||||
lastKnownFileType = text.plist.strings;
|
||||
name = English;
|
||||
path = English.lproj/Localizable.strings;
|
||||
refType = 4;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F73AA2DA026B518801CB2098 = {
|
||||
children = (
|
||||
F73AA2DB026B518801CB2098,
|
||||
);
|
||||
isa = PBXVariantGroup;
|
||||
name = PrintPDE.nib;
|
||||
path = "";
|
||||
refType = 4;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F73AA2DB026B518801CB2098 = {
|
||||
isa = PBXFileReference;
|
||||
lastKnownFileType = wrapper.nib;
|
||||
name = English;
|
||||
path = English.lproj/PrintPDE.nib;
|
||||
refType = 4;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F73AA2DC026B518801CB2098 = {
|
||||
children = (
|
||||
F73AA2DD026B518801CB2098,
|
||||
F73AA2D2026B518801CB2098,
|
||||
F73AA2DE026B518801CB2098,
|
||||
F73AA2D3026B518801CB2098,
|
||||
F73AA2DF026B518801CB2098,
|
||||
F73AA2D4026B518801CB2098,
|
||||
);
|
||||
isa = PBXGroup;
|
||||
path = src;
|
||||
refType = 4;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F73AA2DD026B518801CB2098 = {
|
||||
isa = PBXFileReference;
|
||||
lastKnownFileType = sourcecode.c.c;
|
||||
path = PDECore.c;
|
||||
refType = 4;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F73AA2DE026B518801CB2098 = {
|
||||
isa = PBXFileReference;
|
||||
lastKnownFileType = sourcecode.c.c;
|
||||
path = PDECustom.c;
|
||||
refType = 4;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F73AA2DF026B518801CB2098 = {
|
||||
isa = PBXFileReference;
|
||||
lastKnownFileType = sourcecode.c.c;
|
||||
path = PDEUtilities.c;
|
||||
refType = 4;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
//F70
|
||||
//F71
|
||||
//F72
|
||||
//F73
|
||||
//F74
|
||||
//F80
|
||||
//F81
|
||||
//F82
|
||||
//F83
|
||||
//F84
|
||||
F849B8C8029C68B901CB2098 = {
|
||||
children = (
|
||||
F586CCD503BC184501202892,
|
||||
F73AA2DC026B518801CB2098,
|
||||
F73AA2D5026B518801CB2098,
|
||||
);
|
||||
isa = PBXGroup;
|
||||
name = PrintPDE;
|
||||
refType = 4;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
};
|
||||
rootObject = 089C1669FE841209C02AAC07;
|
||||
}
|
@ -1,86 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsPDECommon_h___
|
||||
#define nsPDECommon_h___
|
||||
|
||||
|
||||
#define kMozPDESignature "MOZZ"
|
||||
#define kMozPDECreatorCode 'MOZZ'
|
||||
|
||||
// Our custom print settings data is stored in a CFDictionary. The dictionary
|
||||
// is flattened to XML for storage in the print ticket. The following keys
|
||||
// are currently supported:
|
||||
|
||||
// State info supplied by the printing app
|
||||
#define kPDEKeyHaveSelection CFSTR("HaveSelection") // Value: CFBoolean
|
||||
#define kPDEKeyHaveFrames CFSTR("HaveFrames") // Value: CFBoolean
|
||||
#define kPDEKeyHaveFrameSelected CFSTR("HaveFrameSelected") // Value: CFBoolean
|
||||
|
||||
// The UI of the PDE allows control of these
|
||||
#define kPDEKeyPrintSelection CFSTR("PrintSelection") // Value: CFBoolean
|
||||
#define kPDEKeyPrintFrameType CFSTR("PrintFrameType") // Value: CFStringReference - one of the following:
|
||||
#define kPDEValueFramesAsIs CFSTR("FramesAsIs")
|
||||
#define kPDEValueSelectedFrame CFSTR("SelectedFrame")
|
||||
#define kPDEValueEachFrameSep CFSTR("EachFrameSep")
|
||||
#define kPDEKeyShrinkToFit CFSTR("ShrinkToFit") // Value: CFBoolean
|
||||
#define kPDEKeyPrintBGColors CFSTR("PrintBGColors") // Value: CFBoolean
|
||||
#define kPDEKeyPrintBGImages CFSTR("PrintBGImages") // Value: CFBoolean
|
||||
|
||||
// Header/Footer strings
|
||||
// The following (case-sensitive) codes are expanded by the print engine at print-time
|
||||
// &D date
|
||||
// &PT page # of #
|
||||
// &P page #
|
||||
// &T title
|
||||
// &U doc URL
|
||||
#define kPDEKeyHeaderLeft CFSTR("HeaderLeft") // Value: CFStringReference
|
||||
#define kPDEKeyHeaderCenter CFSTR("HeaderCenter") // Value: CFStringReference
|
||||
#define kPDEKeyHeaderRight CFSTR("HeaderRight") // Value: CFStringReference
|
||||
#define kPDEKeyFooterLeft CFSTR("FooterLeft") // Value: CFStringReference
|
||||
#define kPDEKeyFooterCenter CFSTR("FooterCenter") // Value: CFStringReference
|
||||
#define kPDEKeyFooterRight CFSTR("FooterRight") // Value: CFStringReference
|
||||
|
||||
// Our tag for the Print Settings ticket. The PDE uses Ticket Services to read and write our
|
||||
// custom data, so its key is the standard string with our tag appended. The application
|
||||
// uses PM[Get|Set]PrintSettingsExtendedData, which takes an OSType for the tag because the
|
||||
// standard string prefix is implied. Short story: the last four bytes of the two must match.
|
||||
#define kAppPrintDialogPDEOnlyKey CFSTR("com.apple.print.PrintSettingsTicket." "GEKO")
|
||||
#define kAppPrintDialogAppOnlyKey 'GEKO'
|
||||
|
||||
|
||||
#endif
|
Binary file not shown.
@ -1,4 +0,0 @@
|
||||
{
|
||||
IBClasses = ();
|
||||
IBVersion = 1;
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>561 530 356 240 0 0 1600 1002 </string>
|
||||
<key>IBFramework Version</key>
|
||||
<string>437.0</string>
|
||||
<key>IBLockedObjects</key>
|
||||
<array/>
|
||||
<key>IBSystem Version</key>
|
||||
<string>8C46</string>
|
||||
<key>targetFramework</key>
|
||||
<string>IBCarbonFramework</string>
|
||||
</dict>
|
||||
</plist>
|
@ -1,429 +0,0 @@
|
||||
<?xml version="1.0" standalone="yes"?>
|
||||
<object class="NSIBObjectData">
|
||||
<string name="targetFramework">IBCarbonFramework</string>
|
||||
<object name="rootObject" class="NSCustomObject" id="1">
|
||||
<string name="customClass">NSApplication</string>
|
||||
</object>
|
||||
<array count="64" name="allObjects">
|
||||
<object class="IBCarbonWindow" id="166">
|
||||
<string name="windowRect">101 176 413 668 </string>
|
||||
<string name="title">Window</string>
|
||||
<object name="rootControl" class="IBCarbonRootControl" id="167">
|
||||
<string name="bounds">0 0 312 492 </string>
|
||||
<array count="1" name="subviews">
|
||||
<object class="IBCarbonUserPane" id="212">
|
||||
<string name="bounds">0 0 292 472 </string>
|
||||
<array count="19" name="subviews">
|
||||
<object class="IBCarbonCheckBox" id="210">
|
||||
<string name="bounds">20 117 38 325 </string>
|
||||
<ostype name="controlSignature">MOZZ</ostype>
|
||||
<int name="controlID">4002</int>
|
||||
<string name="title">Print Selection Only</string>
|
||||
</object>
|
||||
<object class="IBCarbonCheckBox" id="211">
|
||||
<string name="bounds">46 117 60 325 </string>
|
||||
<ostype name="controlSignature">MOZZ</ostype>
|
||||
<int name="controlID">4003</int>
|
||||
<string name="title">Shrink To Fit Page Width</string>
|
||||
</object>
|
||||
<object class="IBCarbonCheckBox" id="216">
|
||||
<string name="bounds">82 117 96 325 </string>
|
||||
<ostype name="controlSignature">MOZZ</ostype>
|
||||
<int name="controlID">4004</int>
|
||||
<string name="title">Print Background Colors</string>
|
||||
</object>
|
||||
<object class="IBCarbonCheckBox" id="214">
|
||||
<string name="bounds">104 117 118 325 </string>
|
||||
<ostype name="controlSignature">MOZZ</ostype>
|
||||
<int name="controlID">4005</int>
|
||||
<string name="title">Print Background Images</string>
|
||||
</object>
|
||||
<object class="IBCarbonRadioGroup" id="213">
|
||||
<string name="bounds">135 116 196 325 </string>
|
||||
<ostype name="controlSignature">MOZZ</ostype>
|
||||
<int name="controlID">4001</int>
|
||||
<int name="numRows">3</int>
|
||||
<int name="intercellHeight">4</int>
|
||||
<array count="3" name="radioTitles">
|
||||
<array count="1">
|
||||
<string>Radio1</string>
|
||||
</array>
|
||||
<array count="1">
|
||||
<string>Radio2</string>
|
||||
</array>
|
||||
<array count="1">
|
||||
<string>Radio</string>
|
||||
</array>
|
||||
</array>
|
||||
</object>
|
||||
<object class="IBCarbonStaticText" id="218">
|
||||
<string name="bounds">133 20 149 109 </string>
|
||||
<string name="title">Frames:</string>
|
||||
<int name="justification">-1</int>
|
||||
</object>
|
||||
<object class="IBCarbonStaticText" id="215">
|
||||
<string name="bounds">20 20 36 109 </string>
|
||||
<string name="title">Options:</string>
|
||||
<int name="justification">-1</int>
|
||||
</object>
|
||||
<object class="IBCarbonStaticText" id="217">
|
||||
<string name="bounds">80 20 96 109 </string>
|
||||
<string name="title">Appearance:</string>
|
||||
<int name="justification">-1</int>
|
||||
</object>
|
||||
<object class="IBCarbonStaticText" id="219">
|
||||
<string name="bounds">206 20 222 109 </string>
|
||||
<string name="title">Page Headers:</string>
|
||||
</object>
|
||||
<object class="IBCarbonPopupButton" id="220">
|
||||
<string name="bounds">207 116 224 208 </string>
|
||||
<ostype name="controlSignature">MOZZ</ostype>
|
||||
<int name="controlID">4006</int>
|
||||
<boolean name="small">TRUE</boolean>
|
||||
<int name="controlSize">1</int>
|
||||
<int name="titleJustification">1</int>
|
||||
<object name="menu" class="IBCarbonMenu" id="223">
|
||||
<string name="title">Popup:</string>
|
||||
<array count="6" name="items">
|
||||
<object class="IBCarbonMenuItem" id="224">
|
||||
<boolean name="checked">TRUE</boolean>
|
||||
<string name="title">(Blank)</string>
|
||||
</object>
|
||||
<object class="IBCarbonMenuItem" id="257">
|
||||
<string name="title">Title</string>
|
||||
</object>
|
||||
<object class="IBCarbonMenuItem" id="221">
|
||||
<string name="title">URL</string>
|
||||
</object>
|
||||
<object class="IBCarbonMenuItem" id="222">
|
||||
<string name="title">Date/Time</string>
|
||||
</object>
|
||||
<object class="IBCarbonMenuItem" id="254">
|
||||
<string name="title">Page #</string>
|
||||
</object>
|
||||
<object class="IBCarbonMenuItem" id="255">
|
||||
<string name="title">Page # of #</string>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBCarbonStaticText" id="225">
|
||||
<string name="bounds">232 116 248 208 </string>
|
||||
<string name="title">Left</string>
|
||||
<int name="justification">1</int>
|
||||
</object>
|
||||
<object class="IBCarbonStaticText" id="226">
|
||||
<string name="bounds">232 216 248 308 </string>
|
||||
<string name="title">Center</string>
|
||||
<int name="justification">1</int>
|
||||
</object>
|
||||
<object class="IBCarbonStaticText" id="227">
|
||||
<string name="bounds">231 316 247 408 </string>
|
||||
<string name="title">Right</string>
|
||||
<int name="justification">1</int>
|
||||
</object>
|
||||
<object class="IBCarbonStaticText" id="228">
|
||||
<string name="bounds">255 25 271 109 </string>
|
||||
<string name="title">Page Footers:</string>
|
||||
</object>
|
||||
<object class="IBCarbonPopupButton" id="266">
|
||||
<string name="bounds">207 216 224 308 </string>
|
||||
<ostype name="controlSignature">MOZZ</ostype>
|
||||
<int name="controlID">4007</int>
|
||||
<boolean name="small">TRUE</boolean>
|
||||
<int name="controlSize">1</int>
|
||||
<object name="menu" class="IBCarbonMenu" id="260">
|
||||
<string name="title">Popup:</string>
|
||||
<array count="6" name="items">
|
||||
<object class="IBCarbonMenuItem" id="263">
|
||||
<boolean name="checked">TRUE</boolean>
|
||||
<string name="title">(Blank)</string>
|
||||
</object>
|
||||
<object class="IBCarbonMenuItem" id="265">
|
||||
<string name="title">Title</string>
|
||||
</object>
|
||||
<object class="IBCarbonMenuItem" id="258">
|
||||
<string name="title">URL</string>
|
||||
</object>
|
||||
<object class="IBCarbonMenuItem" id="259">
|
||||
<string name="title">Date/Time</string>
|
||||
</object>
|
||||
<object class="IBCarbonMenuItem" id="261">
|
||||
<string name="title">Page #</string>
|
||||
</object>
|
||||
<object class="IBCarbonMenuItem" id="264">
|
||||
<string name="title">Page # of #</string>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBCarbonPopupButton" id="268">
|
||||
<string name="bounds">207 316 224 408 </string>
|
||||
<ostype name="controlSignature">MOZZ</ostype>
|
||||
<int name="controlID">4008</int>
|
||||
<boolean name="small">TRUE</boolean>
|
||||
<int name="controlSize">1</int>
|
||||
<object name="menu" class="IBCarbonMenu" id="267">
|
||||
<string name="title">Popup:</string>
|
||||
<array count="6" name="items">
|
||||
<object class="IBCarbonMenuItem" id="270">
|
||||
<boolean name="checked">TRUE</boolean>
|
||||
<string name="title">(Blank)</string>
|
||||
</object>
|
||||
<object class="IBCarbonMenuItem" id="269">
|
||||
<string name="title">Title</string>
|
||||
</object>
|
||||
<object class="IBCarbonMenuItem" id="272">
|
||||
<string name="title">URL</string>
|
||||
</object>
|
||||
<object class="IBCarbonMenuItem" id="273">
|
||||
<string name="title">Date/Time</string>
|
||||
</object>
|
||||
<object class="IBCarbonMenuItem" id="274">
|
||||
<string name="title">Page #</string>
|
||||
</object>
|
||||
<object class="IBCarbonMenuItem" id="275">
|
||||
<string name="title">Page # of #</string>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBCarbonPopupButton" id="277">
|
||||
<string name="bounds">256 116 273 208 </string>
|
||||
<ostype name="controlSignature">MOZZ</ostype>
|
||||
<int name="controlID">4009</int>
|
||||
<boolean name="small">TRUE</boolean>
|
||||
<int name="controlSize">1</int>
|
||||
<object name="menu" class="IBCarbonMenu" id="280">
|
||||
<string name="title">Popup:</string>
|
||||
<array count="6" name="items">
|
||||
<object class="IBCarbonMenuItem" id="283">
|
||||
<boolean name="checked">TRUE</boolean>
|
||||
<string name="title">(Blank)</string>
|
||||
</object>
|
||||
<object class="IBCarbonMenuItem" id="282">
|
||||
<string name="title">Title</string>
|
||||
</object>
|
||||
<object class="IBCarbonMenuItem" id="281">
|
||||
<string name="title">URL</string>
|
||||
</object>
|
||||
<object class="IBCarbonMenuItem" id="276">
|
||||
<string name="title">Date/Time</string>
|
||||
</object>
|
||||
<object class="IBCarbonMenuItem" id="284">
|
||||
<string name="title">Page #</string>
|
||||
</object>
|
||||
<object class="IBCarbonMenuItem" id="278">
|
||||
<string name="title">Page # of #</string>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBCarbonPopupButton" id="285">
|
||||
<string name="bounds">255 216 272 308 </string>
|
||||
<ostype name="controlSignature">MOZZ</ostype>
|
||||
<int name="controlID">4010</int>
|
||||
<boolean name="small">TRUE</boolean>
|
||||
<int name="controlSize">1</int>
|
||||
<object name="menu" class="IBCarbonMenu" id="291">
|
||||
<string name="title">Popup:</string>
|
||||
<array count="6" name="items">
|
||||
<object class="IBCarbonMenuItem" id="289">
|
||||
<boolean name="checked">TRUE</boolean>
|
||||
<string name="title">(Blank)</string>
|
||||
</object>
|
||||
<object class="IBCarbonMenuItem" id="287">
|
||||
<string name="title">Title</string>
|
||||
</object>
|
||||
<object class="IBCarbonMenuItem" id="288">
|
||||
<string name="title">URL</string>
|
||||
</object>
|
||||
<object class="IBCarbonMenuItem" id="290">
|
||||
<string name="title">Date/Time</string>
|
||||
</object>
|
||||
<object class="IBCarbonMenuItem" id="286">
|
||||
<string name="title">Page #</string>
|
||||
</object>
|
||||
<object class="IBCarbonMenuItem" id="293">
|
||||
<string name="title">Page # of #</string>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBCarbonPopupButton" id="298">
|
||||
<string name="bounds">255 316 272 408 </string>
|
||||
<ostype name="controlSignature">MOZZ</ostype>
|
||||
<int name="controlID">4011</int>
|
||||
<boolean name="small">TRUE</boolean>
|
||||
<int name="controlSize">1</int>
|
||||
<object name="menu" class="IBCarbonMenu" id="296">
|
||||
<string name="title">Popup:</string>
|
||||
<array count="6" name="items">
|
||||
<object class="IBCarbonMenuItem" id="297">
|
||||
<boolean name="checked">TRUE</boolean>
|
||||
<string name="title">(Blank)</string>
|
||||
</object>
|
||||
<object class="IBCarbonMenuItem" id="302">
|
||||
<string name="title">Title</string>
|
||||
</object>
|
||||
<object class="IBCarbonMenuItem" id="294">
|
||||
<string name="title">URL</string>
|
||||
</object>
|
||||
<object class="IBCarbonMenuItem" id="301">
|
||||
<string name="title">Date/Time</string>
|
||||
</object>
|
||||
<object class="IBCarbonMenuItem" id="300">
|
||||
<string name="title">Page #</string>
|
||||
</object>
|
||||
<object class="IBCarbonMenuItem" id="295">
|
||||
<string name="title">Page # of #</string>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
</object>
|
||||
</array>
|
||||
<ostype name="controlSignature">MOZZ</ostype>
|
||||
<int name="controlID">4000</int>
|
||||
<int name="featureBits">2</int>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
</object>
|
||||
<reference idRef="167"/>
|
||||
<reference idRef="210"/>
|
||||
<reference idRef="211"/>
|
||||
<reference idRef="212"/>
|
||||
<reference idRef="213"/>
|
||||
<reference idRef="214"/>
|
||||
<reference idRef="215"/>
|
||||
<reference idRef="216"/>
|
||||
<reference idRef="217"/>
|
||||
<reference idRef="218"/>
|
||||
<reference idRef="219"/>
|
||||
<reference idRef="220"/>
|
||||
<reference idRef="221"/>
|
||||
<reference idRef="222"/>
|
||||
<reference idRef="223"/>
|
||||
<reference idRef="224"/>
|
||||
<reference idRef="225"/>
|
||||
<reference idRef="226"/>
|
||||
<reference idRef="227"/>
|
||||
<reference idRef="228"/>
|
||||
<reference idRef="254"/>
|
||||
<reference idRef="255"/>
|
||||
<reference idRef="257"/>
|
||||
<reference idRef="258"/>
|
||||
<reference idRef="259"/>
|
||||
<reference idRef="260"/>
|
||||
<reference idRef="261"/>
|
||||
<reference idRef="263"/>
|
||||
<reference idRef="264"/>
|
||||
<reference idRef="265"/>
|
||||
<reference idRef="266"/>
|
||||
<reference idRef="267"/>
|
||||
<reference idRef="268"/>
|
||||
<reference idRef="269"/>
|
||||
<reference idRef="270"/>
|
||||
<reference idRef="272"/>
|
||||
<reference idRef="273"/>
|
||||
<reference idRef="274"/>
|
||||
<reference idRef="275"/>
|
||||
<reference idRef="276"/>
|
||||
<reference idRef="277"/>
|
||||
<reference idRef="278"/>
|
||||
<reference idRef="280"/>
|
||||
<reference idRef="281"/>
|
||||
<reference idRef="282"/>
|
||||
<reference idRef="283"/>
|
||||
<reference idRef="284"/>
|
||||
<reference idRef="285"/>
|
||||
<reference idRef="286"/>
|
||||
<reference idRef="287"/>
|
||||
<reference idRef="288"/>
|
||||
<reference idRef="289"/>
|
||||
<reference idRef="290"/>
|
||||
<reference idRef="291"/>
|
||||
<reference idRef="293"/>
|
||||
<reference idRef="294"/>
|
||||
<reference idRef="295"/>
|
||||
<reference idRef="296"/>
|
||||
<reference idRef="297"/>
|
||||
<reference idRef="298"/>
|
||||
<reference idRef="300"/>
|
||||
<reference idRef="301"/>
|
||||
<reference idRef="302"/>
|
||||
</array>
|
||||
<array count="64" name="allParents">
|
||||
<reference idRef="1"/>
|
||||
<reference idRef="166"/>
|
||||
<reference idRef="212"/>
|
||||
<reference idRef="212"/>
|
||||
<reference idRef="167"/>
|
||||
<reference idRef="212"/>
|
||||
<reference idRef="212"/>
|
||||
<reference idRef="212"/>
|
||||
<reference idRef="212"/>
|
||||
<reference idRef="212"/>
|
||||
<reference idRef="212"/>
|
||||
<reference idRef="212"/>
|
||||
<reference idRef="212"/>
|
||||
<reference idRef="223"/>
|
||||
<reference idRef="223"/>
|
||||
<reference idRef="220"/>
|
||||
<reference idRef="223"/>
|
||||
<reference idRef="212"/>
|
||||
<reference idRef="212"/>
|
||||
<reference idRef="212"/>
|
||||
<reference idRef="212"/>
|
||||
<reference idRef="223"/>
|
||||
<reference idRef="223"/>
|
||||
<reference idRef="223"/>
|
||||
<reference idRef="260"/>
|
||||
<reference idRef="260"/>
|
||||
<reference idRef="266"/>
|
||||
<reference idRef="260"/>
|
||||
<reference idRef="260"/>
|
||||
<reference idRef="260"/>
|
||||
<reference idRef="260"/>
|
||||
<reference idRef="212"/>
|
||||
<reference idRef="268"/>
|
||||
<reference idRef="212"/>
|
||||
<reference idRef="267"/>
|
||||
<reference idRef="267"/>
|
||||
<reference idRef="267"/>
|
||||
<reference idRef="267"/>
|
||||
<reference idRef="267"/>
|
||||
<reference idRef="267"/>
|
||||
<reference idRef="280"/>
|
||||
<reference idRef="212"/>
|
||||
<reference idRef="280"/>
|
||||
<reference idRef="277"/>
|
||||
<reference idRef="280"/>
|
||||
<reference idRef="280"/>
|
||||
<reference idRef="280"/>
|
||||
<reference idRef="280"/>
|
||||
<reference idRef="212"/>
|
||||
<reference idRef="291"/>
|
||||
<reference idRef="291"/>
|
||||
<reference idRef="291"/>
|
||||
<reference idRef="291"/>
|
||||
<reference idRef="291"/>
|
||||
<reference idRef="285"/>
|
||||
<reference idRef="291"/>
|
||||
<reference idRef="296"/>
|
||||
<reference idRef="296"/>
|
||||
<reference idRef="298"/>
|
||||
<reference idRef="296"/>
|
||||
<reference idRef="212"/>
|
||||
<reference idRef="296"/>
|
||||
<reference idRef="296"/>
|
||||
<reference idRef="296"/>
|
||||
</array>
|
||||
<dictionary count="2" name="nameTable">
|
||||
<string>File's Owner</string>
|
||||
<reference idRef="1"/>
|
||||
<string>PrintPDE</string>
|
||||
<reference idRef="166"/>
|
||||
</dictionary>
|
||||
<unsigned_int name="nextObjectID">307</unsigned_int>
|
||||
</object>
|
@ -1,744 +0,0 @@
|
||||
/*
|
||||
********************************************************************************
|
||||
|
||||
$Log: PDECore.c,v $
|
||||
Revision 1.2 2003/04/03 19:20:04 ccarlen%netscape.com
|
||||
Bug 188508 - Upgrade print dialog PDE. r=pinkerton/sr=sfraser
|
||||
|
||||
|
||||
|
||||
(c) Copyright 2002 Apple Computer, Inc. All rights reserved.
|
||||
|
||||
IMPORTANT: This Apple software is supplied to you by Apple Computer,
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
"Apple Software"), to use, reproduce, modify and redistribute the Apple
|
||||
Software, with or without modifications, in source and/or binary forms;
|
||||
provided that if you redistribute the Apple Software in its entirety and
|
||||
without modifications, you must retain this notice and the following
|
||||
text and disclaimers in all such redistributions of the Apple Software.
|
||||
Neither the name, trademarks, service marks or logos of Apple Computer,
|
||||
Inc. may be used to endorse or promote products derived from the Apple
|
||||
Software without specific prior written permission from Apple. Except
|
||||
as expressly stated in this notice, no other rights or licenses, express
|
||||
or implied, are granted by Apple herein, including but not limited to
|
||||
any patent rights that may be infringed by your derivative works or by
|
||||
other works in which the Apple Software may be incorporated.
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES
|
||||
NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE
|
||||
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
|
||||
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
********************************************************************************
|
||||
*/
|
||||
|
||||
#include <Carbon/Carbon.h>
|
||||
#include <Print/PMPrintingDialogExtensions.h>
|
||||
|
||||
#include "PDECustom.h"
|
||||
#include "PDEUtilities.h"
|
||||
|
||||
|
||||
enum SyncDirection {
|
||||
kSyncTicketFromPane = FALSE,
|
||||
kSyncPaneFromTicket = TRUE
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
Prototypes
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
// callbacks
|
||||
|
||||
static HRESULT MyQueryInterface (void*, REFIID, LPVOID*);
|
||||
static ULONG MyIUnknownRetain (void*);
|
||||
static ULONG MyIUnknownRelease (void*);
|
||||
|
||||
static OSStatus MyPMRetain (PMPlugInHeaderInterface*);
|
||||
static OSStatus MyPMRelease (PMPlugInHeaderInterface**);
|
||||
static OSStatus MyPMGetAPIVersion (PMPlugInHeaderInterface*, PMPlugInAPIVersion*);
|
||||
|
||||
static OSStatus MyPrologue (PMPDEContext*, OSType*, CFStringRef*, CFStringRef*, UInt32*, UInt32*);
|
||||
static OSStatus MyInitialize (PMPDEContext, PMPDEFlags*, PMPDERef, ControlRef, PMPrintSession);
|
||||
static OSStatus MySync (PMPDEContext, PMPrintSession, Boolean);
|
||||
static OSStatus MyGetSummary (PMPDEContext, CFArrayRef*, CFArrayRef*);
|
||||
static OSStatus MyOpen (PMPDEContext);
|
||||
static OSStatus MyClose (PMPDEContext);
|
||||
static OSStatus MyTerminate (PMPDEContext, OSStatus);
|
||||
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
instance types for the two interfaces we support
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const IUnknownVTbl *vtable;
|
||||
SInt32 refCount;
|
||||
CFUUIDRef factoryID;
|
||||
|
||||
} MyIUnknownInstance;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const PlugInIntfVTable *vtable;
|
||||
SInt32 refCount;
|
||||
|
||||
} MyPDEInstance;
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
** MyCFPlugInFactory
|
||||
**
|
||||
** Creates an instance of the IUnknown interface (see the COM
|
||||
** specification for more information about IUnknown). The name of this
|
||||
** factory function needs to be associated with the factory UUID in the
|
||||
** CFPlugInFactories property list entry, so it can be loaded by the
|
||||
** printing system for use in the dialog.
|
||||
**
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
extern void* MyCFPlugInFactory (
|
||||
CFAllocatorRef allocator,
|
||||
CFUUIDRef typeUUID
|
||||
)
|
||||
|
||||
{
|
||||
// our IUnknown interface function table
|
||||
static const IUnknownVTbl sMyIUnknownVTable =
|
||||
{
|
||||
NULL, // required padding for COM
|
||||
MyQueryInterface,
|
||||
MyIUnknownRetain,
|
||||
MyIUnknownRelease
|
||||
};
|
||||
|
||||
CFBundleRef myBundle = NULL;
|
||||
CFDictionaryRef myTypes = NULL;
|
||||
CFStringRef requestType = NULL;
|
||||
CFArrayRef factories = NULL;
|
||||
CFStringRef factory = NULL;
|
||||
CFUUIDRef factoryID = NULL;
|
||||
MyIUnknownInstance *instance = NULL;
|
||||
|
||||
myBundle = MyGetBundle();
|
||||
|
||||
if (myBundle != NULL)
|
||||
{
|
||||
myTypes = CFBundleGetValueForInfoDictionaryKey (
|
||||
myBundle, CFSTR("CFPlugInTypes"));
|
||||
|
||||
if (myTypes != NULL)
|
||||
{
|
||||
// get a reference to the requested type
|
||||
// verify that the requested type matches my type (it should!)
|
||||
requestType = CFUUIDCreateString (allocator, typeUUID);
|
||||
if (requestType != NULL)
|
||||
{
|
||||
factories = CFDictionaryGetValue (myTypes, requestType);
|
||||
CFRelease (requestType);
|
||||
if (factories != NULL)
|
||||
{ // assume the factory we want is entry [0]
|
||||
factory = CFArrayGetValueAtIndex (factories, 0);
|
||||
if (factory != NULL)
|
||||
{
|
||||
// get a reference to my factory ID
|
||||
factoryID = CFUUIDCreateFromString (
|
||||
allocator, factory);
|
||||
if (factoryID != NULL)
|
||||
{
|
||||
// construct an instance of the IUnknown interface
|
||||
instance = malloc (sizeof(MyIUnknownInstance));
|
||||
if (instance != NULL)
|
||||
{
|
||||
instance->vtable = &sMyIUnknownVTable;
|
||||
instance->refCount = 1;
|
||||
instance->factoryID = factoryID;
|
||||
CFPlugInAddInstanceForFactory (factoryID);
|
||||
}
|
||||
else {
|
||||
CFRelease (factoryID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MyDebugMessage ("Factory", (SInt32) instance);
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
** MyQueryInterface
|
||||
**
|
||||
** Finds the requested interface and returns an instance to the caller.
|
||||
** If the request is for the "base" IUnknown interface, we just bump
|
||||
** the refcount.
|
||||
**
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static HRESULT MyQueryInterface (
|
||||
void *this,
|
||||
REFIID iID,
|
||||
LPVOID *ppv
|
||||
)
|
||||
|
||||
{
|
||||
|
||||
// PDE interface function table
|
||||
|
||||
static const PlugInIntfVTable sMyPDEVTable =
|
||||
{
|
||||
{
|
||||
MyPMRetain,
|
||||
MyPMRelease,
|
||||
MyPMGetAPIVersion
|
||||
},
|
||||
MyPrologue,
|
||||
MyInitialize,
|
||||
MySync,
|
||||
MyGetSummary,
|
||||
MyOpen,
|
||||
MyClose,
|
||||
MyTerminate
|
||||
};
|
||||
|
||||
|
||||
CFUUIDRef requestID = NULL;
|
||||
CFUUIDRef actualID = NULL;
|
||||
HRESULT result = E_UNEXPECTED;
|
||||
|
||||
|
||||
// get a reference to the UUID for the requested interface
|
||||
requestID = CFUUIDCreateFromUUIDBytes (kCFAllocatorDefault, iID);
|
||||
if (requestID != NULL)
|
||||
{
|
||||
// get a reference to the UUID for all PDE interfaces
|
||||
actualID = CFUUIDCreateFromString (kCFAllocatorDefault, kDialogExtensionIntfIDStr);
|
||||
if (actualID != NULL)
|
||||
{
|
||||
if (CFEqual (requestID, actualID))
|
||||
{
|
||||
// caller wants an instance of my PDE interface
|
||||
|
||||
MyPDEInstance *instance = malloc (sizeof(MyPDEInstance));
|
||||
|
||||
if (instance != NULL)
|
||||
{
|
||||
instance->vtable = &sMyPDEVTable;
|
||||
instance->refCount = 1;
|
||||
*ppv = instance;
|
||||
result = S_OK;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CFEqual (requestID, IUnknownUUID))
|
||||
{
|
||||
// caller wants an instance of my IUnknown interface
|
||||
MyIUnknownRetain (this);
|
||||
*ppv = this;
|
||||
result = S_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
*ppv = NULL;
|
||||
result = E_NOINTERFACE;
|
||||
}
|
||||
}
|
||||
CFRelease (actualID);
|
||||
}
|
||||
CFRelease (requestID);
|
||||
}
|
||||
|
||||
MyDebugMessage("MyQueryInterface", result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
** MyIUnknownRetain
|
||||
**
|
||||
** Increments the reference count for the calling interface on an
|
||||
** object. It should be called for every new copy of a pointer to an
|
||||
** interface on a given object.
|
||||
**
|
||||
** Returns an integer from 1 to n, the value of the new reference
|
||||
** count. This information is meant to be used for diagnostic/testing
|
||||
** purposes only, because, in certain situations, the value might be
|
||||
** unstable.
|
||||
**
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static ULONG MyIUnknownRetain (void* this)
|
||||
{
|
||||
MyIUnknownInstance* instance = (MyIUnknownInstance*) this;
|
||||
ULONG refCount = 1;
|
||||
|
||||
if (instance != NULL) {
|
||||
refCount = ++instance->refCount;
|
||||
}
|
||||
|
||||
MyDebugMessage("MyIUnknownRetain", refCount);
|
||||
return refCount;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
** MyIUnknownRelease
|
||||
**
|
||||
** Decrements the reference count for the calling interface on an
|
||||
** object. If the reference count on the object reaches zero, the
|
||||
** object is freed from memory.
|
||||
**
|
||||
** Returns the resulting value of the reference count, which is for
|
||||
** diagnostic/testing purposes only.
|
||||
**
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static ULONG MyIUnknownRelease (void* this)
|
||||
{
|
||||
MyIUnknownInstance* instance = (MyIUnknownInstance*) this;
|
||||
ULONG refCount = 0;
|
||||
|
||||
if (instance != NULL)
|
||||
{
|
||||
refCount = --instance->refCount;
|
||||
if (refCount == 0)
|
||||
{
|
||||
CFPlugInRemoveInstanceForFactory (instance->factoryID);
|
||||
CFRelease (instance->factoryID);
|
||||
free (instance);
|
||||
}
|
||||
}
|
||||
|
||||
MyDebugMessage("MyIUnknownRelease", refCount);
|
||||
return refCount;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
MyPMRetain
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static OSStatus MyPMRetain (PMPlugInHeaderInterface* this)
|
||||
{
|
||||
MyPDEInstance* instance = (MyPDEInstance*) this;
|
||||
ULONG refCount = 1;
|
||||
OSStatus result = noErr;
|
||||
|
||||
if (instance != NULL) {
|
||||
refCount = ++instance->refCount;
|
||||
}
|
||||
|
||||
MyDebugMessage("MyPMRetain", refCount);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
MyPMRelease
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static OSStatus MyPMRelease (
|
||||
PMPlugInHeaderInterface** this
|
||||
)
|
||||
|
||||
{
|
||||
MyPDEInstance* instance = (MyPDEInstance*) *this;
|
||||
ULONG refCount = 0;
|
||||
OSStatus result = noErr;
|
||||
|
||||
// clear caller's instance variable (don't ask)
|
||||
*this = NULL;
|
||||
|
||||
if(instance != NULL)
|
||||
{
|
||||
// decrement instance reference count, and free if zero
|
||||
refCount = --instance->refCount;
|
||||
|
||||
if (refCount == 0)
|
||||
{
|
||||
free (instance);
|
||||
MyFreeTitle();
|
||||
MyFreeBundle();
|
||||
}
|
||||
}
|
||||
|
||||
MyDebugMessage("MyPMRelease", refCount);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
MyPMGetAPIVersion
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static OSStatus MyPMGetAPIVersion (
|
||||
PMPlugInHeaderInterface* this,
|
||||
PMPlugInAPIVersion* versionPtr
|
||||
)
|
||||
|
||||
{
|
||||
OSStatus result = noErr;
|
||||
|
||||
// constants defined in PMPrintingDialogExtensions.h
|
||||
versionPtr->buildVersionMajor = kPDEBuildVersionMajor;
|
||||
versionPtr->buildVersionMinor = kPDEBuildVersionMinor;
|
||||
versionPtr->baseVersionMajor = kPDEBaseVersionMajor;
|
||||
versionPtr->baseVersionMinor = kPDEBaseVersionMinor;
|
||||
|
||||
MyDebugMessage("MyPMGetAPIVersion", result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
MyPrologue
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
When the printing system displays a printing dialog, it calls the
|
||||
prologue function in each registered dialog extension. If the user
|
||||
chooses a different printer while the dialog is still open, each
|
||||
prologue function is called again.
|
||||
|
||||
If a prologue function returns a non-zero result code, the printing
|
||||
system will call the plug-in's terminate function.
|
||||
*/
|
||||
|
||||
static OSStatus MyPrologue (
|
||||
PMPDEContext *outContext, // session-specific global data
|
||||
OSType *creator, // not used
|
||||
CFStringRef *paneKind, // kind ID string for this PDE
|
||||
CFStringRef *title, // localized title string
|
||||
UInt32 *maxH, // maximum horizontal extent
|
||||
UInt32 *maxV // maximum vertical extent
|
||||
)
|
||||
|
||||
{
|
||||
MyContext context = NULL;
|
||||
OSStatus result = kPMInvalidPDEContext;
|
||||
|
||||
context = malloc (sizeof (MyContextBlock));
|
||||
|
||||
if (context != NULL)
|
||||
{
|
||||
context->customContext = MyCreateCustomContext();
|
||||
context->initialized = FALSE;
|
||||
context->userPane = NULL;
|
||||
context->helpHandler = NULL;
|
||||
context->helpHandlerUPP = NULL;
|
||||
|
||||
// assign output parameters
|
||||
*outContext = (PMPDEContext) context;
|
||||
*creator = kMozPDECreatorCode;
|
||||
*paneKind = kMyPaneKindID;
|
||||
*title = MyGetTitle();
|
||||
*maxH = kMyMaxH;
|
||||
*maxV = kMyMaxV;
|
||||
|
||||
result = noErr;
|
||||
}
|
||||
|
||||
MyDebugMessage("MyPrologue", result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
MyInitialize
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static OSStatus MyInitialize (
|
||||
PMPDEContext inContext,
|
||||
PMPDEFlags* flags,
|
||||
PMPDERef ref,
|
||||
ControlRef userPane,
|
||||
PMPrintSession session
|
||||
)
|
||||
|
||||
{
|
||||
MyContext context = (MyContext) inContext;
|
||||
OSStatus result = noErr;
|
||||
|
||||
*flags = kPMPDENoFlags;
|
||||
context->userPane = userPane;
|
||||
|
||||
result = MySync (
|
||||
inContext, session, kSyncPaneFromTicket);
|
||||
|
||||
MyDebugMessage("MyInitialize", result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
MySync
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static OSStatus MySync (
|
||||
PMPDEContext inContext,
|
||||
PMPrintSession session,
|
||||
Boolean syncDirection
|
||||
)
|
||||
|
||||
{
|
||||
MyContext context = (MyContext) inContext;
|
||||
OSStatus result = noErr;
|
||||
|
||||
if (syncDirection == kSyncPaneFromTicket)
|
||||
{
|
||||
result = MySyncPaneFromTicket (context->customContext, session);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = MySyncTicketFromPane (context->customContext, session);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
MyGetSummary
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
For each control, gets a localized description of the title & current value
|
||||
*/
|
||||
|
||||
static OSStatus MyGetSummary (
|
||||
PMPDEContext inContext,
|
||||
CFArrayRef *titles,
|
||||
CFArrayRef *values
|
||||
)
|
||||
|
||||
{
|
||||
MyContext context = (MyContext) inContext;
|
||||
CFMutableArrayRef titleArray = NULL;
|
||||
CFMutableArrayRef valueArray = NULL;
|
||||
|
||||
// assume the worst
|
||||
OSStatus result = kPMInvalidPDEContext;
|
||||
|
||||
// when the second argument to CFArrayCreateMutable is 0,
|
||||
// the array size is not fixed
|
||||
|
||||
titleArray = CFArrayCreateMutable (
|
||||
kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
|
||||
|
||||
if (titleArray != NULL)
|
||||
{
|
||||
valueArray = CFArrayCreateMutable (
|
||||
kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
|
||||
|
||||
if (valueArray != NULL)
|
||||
{
|
||||
result = MyGetSummaryText (
|
||||
context->customContext,
|
||||
titleArray,
|
||||
valueArray
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (result != noErr)
|
||||
{
|
||||
if (titleArray != NULL)
|
||||
{
|
||||
CFRelease (titleArray);
|
||||
titleArray = NULL;
|
||||
}
|
||||
if (valueArray != NULL)
|
||||
{
|
||||
CFRelease (valueArray);
|
||||
valueArray = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
*titles = titleArray;
|
||||
*values = valueArray;
|
||||
|
||||
MyDebugMessage("MyGetSummary", result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
MyOpen
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static OSStatus MyOpen (PMPDEContext inContext)
|
||||
{
|
||||
MyContext context = (MyContext) inContext;
|
||||
OSStatus result = noErr;
|
||||
|
||||
if (!context->initialized)
|
||||
{
|
||||
// initialize pane
|
||||
|
||||
IBNibRef nib = NULL;
|
||||
|
||||
result = CreateNibReferenceWithCFBundle (
|
||||
MyGetBundle(),
|
||||
kMyNibFile,
|
||||
&nib
|
||||
);
|
||||
|
||||
if (result == noErr)
|
||||
{
|
||||
WindowRef nibWindow = NULL;
|
||||
|
||||
result = CreateWindowFromNib (
|
||||
nib,
|
||||
kMyNibWindow,
|
||||
&nibWindow
|
||||
);
|
||||
|
||||
if (result == noErr)
|
||||
{
|
||||
result = MyEmbedCustomControls (
|
||||
context->customContext,
|
||||
nibWindow,
|
||||
context->userPane
|
||||
);
|
||||
|
||||
if (result == noErr)
|
||||
{
|
||||
context->initialized = TRUE;
|
||||
}
|
||||
|
||||
DisposeWindow (nibWindow);
|
||||
}
|
||||
|
||||
DisposeNibReference (nib);
|
||||
}
|
||||
}
|
||||
|
||||
if (context->initialized)
|
||||
{
|
||||
result = MyInstallHelpEventHandler (
|
||||
GetControlOwner (context->userPane),
|
||||
&(context->helpHandler),
|
||||
&(context->helpHandlerUPP)
|
||||
);
|
||||
}
|
||||
|
||||
MyDebugMessage("MyOpen", result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
MyClose
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static OSStatus MyClose (PMPDEContext inContext)
|
||||
{
|
||||
MyContext context = (MyContext) inContext;
|
||||
OSStatus result = noErr;
|
||||
|
||||
result = MyRemoveHelpEventHandler (
|
||||
&(context->helpHandler),
|
||||
&(context->helpHandlerUPP)
|
||||
);
|
||||
|
||||
MyDebugMessage("MyClose", result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
MyTerminate
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static OSStatus MyTerminate (
|
||||
PMPDEContext inContext,
|
||||
OSStatus inStatus
|
||||
)
|
||||
|
||||
{
|
||||
MyContext context = (MyContext) inContext;
|
||||
OSStatus result = noErr;
|
||||
|
||||
if (context != NULL)
|
||||
{
|
||||
result = MyRemoveHelpEventHandler (
|
||||
&(context->helpHandler),
|
||||
&(context->helpHandlerUPP)
|
||||
);
|
||||
|
||||
if (context->customContext != NULL) {
|
||||
MyReleaseCustomContext (context->customContext);
|
||||
}
|
||||
|
||||
free (context);
|
||||
}
|
||||
|
||||
MyDebugMessage("MyTerminate", result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// END OF SOURCE
|
@ -1,78 +0,0 @@
|
||||
/*
|
||||
********************************************************************************
|
||||
|
||||
$Log: PDECore.h,v $
|
||||
Revision 1.2 2003/04/03 19:20:05 ccarlen%netscape.com
|
||||
Bug 188508 - Upgrade print dialog PDE. r=pinkerton/sr=sfraser
|
||||
|
||||
|
||||
|
||||
(c) Copyright 2002 Apple Computer, Inc. All rights reserved.
|
||||
|
||||
IMPORTANT: This Apple software is supplied to you by Apple Computer,
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
"Apple Software"), to use, reproduce, modify and redistribute the Apple
|
||||
Software, with or without modifications, in source and/or binary forms;
|
||||
provided that if you redistribute the Apple Software in its entirety and
|
||||
without modifications, you must retain this notice and the following
|
||||
text and disclaimers in all such redistributions of the Apple Software.
|
||||
Neither the name, trademarks, service marks or logos of Apple Computer,
|
||||
Inc. may be used to endorse or promote products derived from the Apple
|
||||
Software without specific prior written permission from Apple. Except
|
||||
as expressly stated in this notice, no other rights or licenses, express
|
||||
or implied, are granted by Apple herein, including but not limited to
|
||||
any patent rights that may be infringed by your derivative works or by
|
||||
other works in which the Apple Software may be incorporated.
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES
|
||||
NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE
|
||||
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
|
||||
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
********************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __PDECORE__
|
||||
#define __PDECORE__
|
||||
|
||||
#include <Carbon/Carbon.h>
|
||||
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
session context
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ControlRef userPane;
|
||||
EventHandlerRef helpHandler;
|
||||
EventHandlerUPP helpHandlerUPP;
|
||||
void* customContext;
|
||||
Boolean initialized;
|
||||
|
||||
} MyContextBlock;
|
||||
|
||||
typedef MyContextBlock* MyContext;
|
||||
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@ -1,233 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Conrad Carlen <ccarlen@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef __PDECUSTOM__
|
||||
#define __PDECUSTOM__
|
||||
|
||||
#ifndef nsPDECommon_h___
|
||||
#include "nsPDECommon.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
** kMyBundleIdentifier
|
||||
**
|
||||
** The identifier that's also used as the CFBundleIdentifier entry in the
|
||||
** property list. This ID should always be a unique string in Java-style
|
||||
** package format (substitute your vendor domain for "com.appvendor").
|
||||
**
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define kMyBundleIdentifier \
|
||||
CFSTR("org.mozilla.pde." kMozPDESignature)
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
** kMyPaneKindID
|
||||
**
|
||||
** For application-hosted PDEs, this unique Java-style package name is used
|
||||
** to identify your custom pane. Here we simply use the bundle identifier.
|
||||
**
|
||||
** For printer module-hosted PDEs, a unique Java-style package name is
|
||||
** recommended too, unless you are overriding a standard (Apple-supplied)
|
||||
** pane -- then you should use the appropriate kind ID constant from
|
||||
** PMPrintingDialogExtensions.h.
|
||||
**
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define kMyPaneKindID kMyBundleIdentifier
|
||||
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
** kMyNibFile
|
||||
**
|
||||
** The name of your nib file (without the ".nib" extension).
|
||||
**
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define kMyNibFile CFSTR("PrintPDE")
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
** kMyNibWindow
|
||||
**
|
||||
** The name of the Carbon window created from the nib interface.
|
||||
**
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define kMyNibWindow CFSTR("PrintPDE")
|
||||
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
** kMyAppPrintSettingsKey
|
||||
**
|
||||
** In order to use the print settings ticket, your application-hosted PDE
|
||||
** needs to define a ticket data storage and retrieval key by concatenating
|
||||
** this standard prefix with its unique 4-byte signature.
|
||||
**
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define kMyAppPrintSettingsKey \
|
||||
CFSTR("com.apple.print.PrintSettingsTicket." kMozPDESignature)
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
** kMyAppPageFormatKey
|
||||
**
|
||||
** In order to use the page format ticket, your application-hosted PDE
|
||||
** needs to define a ticket data storage and retrieval key by concatenating
|
||||
** this standard prefix with its unique 4-byte signature.
|
||||
**
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define kMyAppPageFormatKey \
|
||||
CFSTR("com.apple.print.PageFormatTicket." kMozPDESignature)
|
||||
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
If you provide user assistance using Help Viewer, define these two
|
||||
constants. Otherwise, comment them out.
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
//#define kMyHelpFolder CFSTR("Help")
|
||||
//#define kMyHelpFile CFSTR("help.html")
|
||||
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
vertical and horizontal extent in pixels needed to display your
|
||||
custom interface
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
enum {
|
||||
kMyMaxV = 292,
|
||||
kMyMaxH = 478
|
||||
};
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
Indexes of radio buttons in our radio group control
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
enum {
|
||||
kFramesAsLaidOutIndex = 1,
|
||||
kFramesSelectedIndex,
|
||||
kFramesEachSeparatelyIndex,
|
||||
};
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
data types for a context that represents the state of the controls
|
||||
in an instance of your custom interface
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
ControlRef frameRadioGroup;
|
||||
ControlRef printSelCheck;
|
||||
ControlRef shrinkToFitCheck;
|
||||
ControlRef printBGColorsCheck;
|
||||
ControlRef printBGImagesCheck;
|
||||
ControlRef headerLeftPopup;
|
||||
ControlRef headerCenterPopup;
|
||||
ControlRef headerRightPopup;
|
||||
ControlRef footerLeftPopup;
|
||||
ControlRef footerCenterPopup;
|
||||
ControlRef footerRightPopup;
|
||||
} MyControls;
|
||||
|
||||
typedef struct {
|
||||
// State info supplied by printing app
|
||||
Boolean mHaveSelection;
|
||||
Boolean mHaveFrames;
|
||||
Boolean mHaveFrameSelected;
|
||||
// The UI of the PDE allows control of these
|
||||
Boolean mPrintFrameAsIs;
|
||||
Boolean mPrintSelectedFrame;
|
||||
Boolean mPrintFramesSeparately;
|
||||
Boolean mPrintSelection;
|
||||
Boolean mShrinkToFit;
|
||||
Boolean mPrintBGColors;
|
||||
Boolean mPrintBGImages;
|
||||
CFStringRef mHeaderLeft, mHeaderCenter, mHeaderRight;
|
||||
CFStringRef mFooterLeft, mFooterCenter, mFooterRight;
|
||||
} MySettings;
|
||||
|
||||
typedef struct {
|
||||
MyControls controls;
|
||||
MySettings settings;
|
||||
} MyCustomContextBlock;
|
||||
|
||||
typedef MyCustomContextBlock *MyCustomContext;
|
||||
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
functions you need to implement in your custom code
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
Sometime after calling MyGetCustomTitle (TRUE) to get the localized title
|
||||
of your custom pane, we call MyGetCustomTitle (FALSE) to release the copy.
|
||||
*/
|
||||
|
||||
extern CFStringRef MyGetCustomTitle (Boolean stillNeeded);
|
||||
|
||||
extern MyCustomContext MyCreateCustomContext();
|
||||
extern void MyReleaseCustomContext (MyCustomContext);
|
||||
|
||||
extern OSStatus MyEmbedCustomControls (MyCustomContext, WindowRef, ControlRef);
|
||||
extern OSStatus MyGetSummaryText (MyCustomContext, CFMutableArrayRef, CFMutableArrayRef);
|
||||
extern OSStatus MySyncPaneFromTicket (MyCustomContext, PMPrintSession);
|
||||
extern OSStatus MySyncTicketFromPane (MyCustomContext, PMPrintSession);
|
||||
|
||||
|
||||
#endif
|
@ -1,415 +0,0 @@
|
||||
/*
|
||||
********************************************************************************
|
||||
|
||||
$Log: PDEUtilities.c,v $
|
||||
Revision 1.3 2005/08/08 03:08:43 smfr%smfr.org
|
||||
Fix bug 202014: add UI to the Mac Print Dialog Extension (PDE) that allows the user to select which headers and footers to print. Patch by Conrad Carlen, r=pinkerton, sr=me, a=asa.
|
||||
|
||||
Revision 1.2 2003/04/03 19:20:05 ccarlen%netscape.com
|
||||
Bug 188508 - Upgrade print dialog PDE. r=pinkerton/sr=sfraser
|
||||
|
||||
|
||||
|
||||
(c) Copyright 2002 Apple Computer, Inc. All rights reserved.
|
||||
|
||||
IMPORTANT: This Apple software is supplied to you by Apple Computer,
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
"Apple Software"), to use, reproduce, modify and redistribute the Apple
|
||||
Software, with or without modifications, in source and/or binary forms;
|
||||
provided that if you redistribute the Apple Software in its entirety and
|
||||
without modifications, you must retain this notice and the following
|
||||
text and disclaimers in all such redistributions of the Apple Software.
|
||||
Neither the name, trademarks, service marks or logos of Apple Computer,
|
||||
Inc. may be used to endorse or promote products derived from the Apple
|
||||
Software without specific prior written permission from Apple. Except
|
||||
as expressly stated in this notice, no other rights or licenses, express
|
||||
or implied, are granted by Apple herein, including but not limited to
|
||||
any patent rights that may be infringed by your derivative works or by
|
||||
other works in which the Apple Software may be incorporated.
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES
|
||||
NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE
|
||||
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
|
||||
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
********************************************************************************
|
||||
*/
|
||||
|
||||
#include <Carbon/Carbon.h>
|
||||
#include <Print/PMPrintingDialogExtensions.h>
|
||||
|
||||
#include "PDECore.h"
|
||||
#include "PDECustom.h"
|
||||
#include "PDEUtilities.h"
|
||||
|
||||
// callback function to handle the 'help' event
|
||||
static OSStatus MyHandleHelpEvent (EventHandlerCallRef, EventRef, void *userData);
|
||||
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
MyDebugMessage
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
extern void MyDebugMessage (char *msg, SInt32 value)
|
||||
{
|
||||
char *debug = getenv ("PDEDebug");
|
||||
if (debug != NULL)
|
||||
{
|
||||
fprintf (stdout, "%s (%d)\n", msg, (int) value);
|
||||
fflush (stdout);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
MyCFAssign
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
extern CFTypeRef MyCFAssign(CFTypeRef srcRef, CFTypeRef dstRef)
|
||||
{
|
||||
if (srcRef)
|
||||
CFRetain(srcRef);
|
||||
if (dstRef)
|
||||
CFRelease(dstRef);
|
||||
dstRef = srcRef;
|
||||
return dstRef;
|
||||
}
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
_MyGetBundle
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static CFBundleRef _MyGetBundle (Boolean stillNeeded)
|
||||
{
|
||||
static CFBundleRef sBundle = NULL;
|
||||
|
||||
if (stillNeeded)
|
||||
{
|
||||
if (sBundle == NULL)
|
||||
{
|
||||
sBundle = CFBundleGetBundleWithIdentifier (kMyBundleIdentifier);
|
||||
CFRetain (sBundle);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sBundle != NULL)
|
||||
{
|
||||
CFRelease (sBundle);
|
||||
sBundle = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return sBundle;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
MyGetBundle
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
extern CFBundleRef MyGetBundle()
|
||||
{
|
||||
return _MyGetBundle (TRUE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
MyFreeBundle
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
extern void MyFreeBundle()
|
||||
{
|
||||
_MyGetBundle (FALSE);
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
MyGetTitle
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
extern CFStringRef MyGetTitle()
|
||||
{
|
||||
return MyGetCustomTitle (TRUE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
MyFreeTitle
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
extern void MyFreeTitle()
|
||||
{
|
||||
MyGetCustomTitle (FALSE);
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
MyGetTicket
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
extern OSStatus MyGetTicket (
|
||||
PMPrintSession session,
|
||||
CFStringRef ticketID,
|
||||
PMTicketRef* ticketPtr
|
||||
)
|
||||
|
||||
{
|
||||
OSStatus result = noErr;
|
||||
CFTypeRef type = NULL;
|
||||
PMTicketRef ticket = NULL;
|
||||
|
||||
*ticketPtr = NULL;
|
||||
|
||||
result = PMSessionGetDataFromSession (session, ticketID, &type);
|
||||
|
||||
if (result == noErr)
|
||||
{
|
||||
if (CFNumberGetValue (
|
||||
(CFNumberRef) type, kCFNumberSInt32Type, (void*) &ticket))
|
||||
{
|
||||
*ticketPtr = ticket;
|
||||
}
|
||||
else {
|
||||
result = kPMInvalidValue;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
MyEmbedControl
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
extern OSStatus MyEmbedControl (
|
||||
WindowRef nibWindow,
|
||||
ControlRef userPane,
|
||||
const ControlID *controlID,
|
||||
ControlRef* outControl
|
||||
)
|
||||
|
||||
{
|
||||
ControlRef control = NULL;
|
||||
OSStatus result = noErr;
|
||||
|
||||
*outControl = NULL;
|
||||
|
||||
result = GetControlByID (nibWindow, controlID, &control);
|
||||
if (result == noErr)
|
||||
{
|
||||
SInt16 dh, dv;
|
||||
Rect nibFrame, controlFrame, paneFrame;
|
||||
|
||||
(void) GetWindowBounds (nibWindow, kWindowContentRgn, &nibFrame);
|
||||
(void) GetControlBounds (userPane, &paneFrame);
|
||||
(void) GetControlBounds (control, &controlFrame);
|
||||
|
||||
// find vertical and horizontal deltas needed to position the control
|
||||
// such that the nib-based interface is centered inside the dialog pane
|
||||
|
||||
dh = ((paneFrame.right - paneFrame.left) -
|
||||
(nibFrame.right - nibFrame.left))/2;
|
||||
|
||||
if (dh < 0) dh = 0;
|
||||
|
||||
dv = ((paneFrame.bottom - paneFrame.top) -
|
||||
(nibFrame.bottom - nibFrame.top))/2;
|
||||
|
||||
if (dv < 0) dv = 0;
|
||||
|
||||
OffsetRect (
|
||||
&controlFrame,
|
||||
paneFrame.left + dh,
|
||||
paneFrame.top + dv
|
||||
);
|
||||
|
||||
(void) SetControlBounds (control, &controlFrame);
|
||||
|
||||
// make visible
|
||||
result = SetControlVisibility (control, TRUE, FALSE);
|
||||
|
||||
if (result == noErr)
|
||||
{
|
||||
result = EmbedControl (control, userPane);
|
||||
if (result == noErr)
|
||||
{
|
||||
// return the control only if everything worked
|
||||
*outControl = control;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
MyReleaseContext
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
extern void MyReleaseContext (MyContext context)
|
||||
{
|
||||
if (context != NULL)
|
||||
{
|
||||
if (context->customContext != NULL) {
|
||||
MyReleaseCustomContext (context->customContext);
|
||||
}
|
||||
|
||||
free (context);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
MyInstallHelpEventHandler
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define kMyNumberOfEventTypes 1
|
||||
|
||||
extern OSStatus MyInstallHelpEventHandler (
|
||||
WindowRef inWindow,
|
||||
EventHandlerRef *outHandler,
|
||||
EventHandlerUPP *outHandlerUPP
|
||||
)
|
||||
|
||||
{
|
||||
static const EventTypeSpec sEventTypes [kMyNumberOfEventTypes] =
|
||||
{
|
||||
{ kEventClassCommand, kEventCommandProcess }
|
||||
};
|
||||
|
||||
OSStatus result = noErr;
|
||||
EventHandlerRef handler = NULL;
|
||||
EventHandlerUPP handlerUPP = NewEventHandlerUPP (MyHandleHelpEvent);
|
||||
|
||||
result = InstallWindowEventHandler (
|
||||
inWindow,
|
||||
handlerUPP,
|
||||
kMyNumberOfEventTypes,
|
||||
sEventTypes,
|
||||
NULL,
|
||||
&handler
|
||||
);
|
||||
|
||||
*outHandler = handler;
|
||||
*outHandlerUPP = handlerUPP;
|
||||
|
||||
MyDebugMessage("InstallEventHandler", result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
MyRemoveHelpEventHandler
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
extern OSStatus MyRemoveHelpEventHandler (
|
||||
EventHandlerRef *helpHandlerP,
|
||||
EventHandlerUPP *helpHandlerUPP
|
||||
)
|
||||
|
||||
{
|
||||
OSStatus result = noErr;
|
||||
|
||||
// we remove the help handler if there is still one present
|
||||
if (*helpHandlerP != NULL)
|
||||
{
|
||||
MyDebugMessage("Removing event handler", result);
|
||||
result = RemoveEventHandler (*helpHandlerP);
|
||||
*helpHandlerP = NULL;
|
||||
}
|
||||
|
||||
if (*helpHandlerUPP != NULL)
|
||||
{
|
||||
DisposeEventHandlerUPP (*helpHandlerUPP);
|
||||
*helpHandlerUPP = NULL;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
MyHandleHelpEvent
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static OSStatus MyHandleHelpEvent
|
||||
(
|
||||
EventHandlerCallRef call,
|
||||
EventRef event,
|
||||
void *userData
|
||||
)
|
||||
|
||||
{
|
||||
HICommand commandStruct;
|
||||
OSStatus result = eventNotHandledErr;
|
||||
|
||||
GetEventParameter (
|
||||
event, kEventParamDirectObject,
|
||||
typeHICommand, NULL, sizeof(HICommand),
|
||||
NULL, &commandStruct
|
||||
);
|
||||
|
||||
if (commandStruct.commandID == 'help')
|
||||
{
|
||||
// result = MyDisplayHelp();
|
||||
// MyDebugMessage("handled help event", result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// END OF SOURCE
|
@ -1,88 +0,0 @@
|
||||
/*
|
||||
********************************************************************************
|
||||
|
||||
$Log: PDEUtilities.h,v $
|
||||
Revision 1.3 2005/08/08 03:08:43 smfr%smfr.org
|
||||
Fix bug 202014: add UI to the Mac Print Dialog Extension (PDE) that allows the user to select which headers and footers to print. Patch by Conrad Carlen, r=pinkerton, sr=me, a=asa.
|
||||
|
||||
Revision 1.2 2003/04/03 19:20:05 ccarlen%netscape.com
|
||||
Bug 188508 - Upgrade print dialog PDE. r=pinkerton/sr=sfraser
|
||||
|
||||
|
||||
|
||||
(c) Copyright 2002 Apple Computer, Inc. All rights reserved.
|
||||
|
||||
IMPORTANT: This Apple software is supplied to you by Apple Computer,
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
terms, and your use, installation, modification or redistribution of
|
||||
this Apple software constitutes acceptance of these terms. If you do
|
||||
not agree with these terms, please do not use, install, modify or
|
||||
redistribute this Apple software.
|
||||
|
||||
In consideration of your agreement to abide by the following terms, and
|
||||
subject to these terms, Apple grants you a personal, non-exclusive
|
||||
license, under Apple's copyrights in this original Apple software (the
|
||||
"Apple Software"), to use, reproduce, modify and redistribute the Apple
|
||||
Software, with or without modifications, in source and/or binary forms;
|
||||
provided that if you redistribute the Apple Software in its entirety and
|
||||
without modifications, you must retain this notice and the following
|
||||
text and disclaimers in all such redistributions of the Apple Software.
|
||||
Neither the name, trademarks, service marks or logos of Apple Computer,
|
||||
Inc. may be used to endorse or promote products derived from the Apple
|
||||
Software without specific prior written permission from Apple. Except
|
||||
as expressly stated in this notice, no other rights or licenses, express
|
||||
or implied, are granted by Apple herein, including but not limited to
|
||||
any patent rights that may be infringed by your derivative works or by
|
||||
other works in which the Apple Software may be incorporated.
|
||||
|
||||
The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES
|
||||
NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE
|
||||
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
|
||||
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
|
||||
|
||||
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
|
||||
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
|
||||
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
||||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
********************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __PDEUTILITIES__
|
||||
#define __PDEUTILITIES__
|
||||
|
||||
#include <Carbon/Carbon.h>
|
||||
#include <Print/PMPrintingDialogExtensions.h>
|
||||
|
||||
#include "PDECore.h"
|
||||
|
||||
|
||||
/*
|
||||
--------------------------------------------------------------------------------
|
||||
Prototypes
|
||||
--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
extern void MyDebugMessage (char *msg, SInt32 err);
|
||||
extern CFTypeRef MyCFAssign(CFTypeRef srcRef, CFTypeRef dstRef);
|
||||
|
||||
extern CFBundleRef MyGetBundle();
|
||||
extern void MyFreeBundle();
|
||||
|
||||
extern CFStringRef MyGetTitle();
|
||||
extern void MyFreeTitle();
|
||||
|
||||
extern OSStatus MyEmbedControl (WindowRef, ControlRef, const ControlID*, ControlRef*);
|
||||
extern OSStatus MyGetTicket (PMPrintSession, CFStringRef, PMTicketRef*);
|
||||
|
||||
extern void MyReleaseContext (MyContext);
|
||||
extern OSStatus MyInstallHelpEventHandler (WindowRef, EventHandlerRef*, EventHandlerUPP *);
|
||||
extern OSStatus MyRemoveHelpEventHandler (EventHandlerRef*, EventHandlerUPP *);
|
||||
|
||||
|
||||
#endif
|
@ -463,10 +463,10 @@ typedef struct {
|
||||
// These are the control ids used in the dialog and
|
||||
// defined by MS-Windows in commdlg.h
|
||||
static PropKeyInfo gAllPropKeys[] = {
|
||||
{"PrintFrames", grp3},
|
||||
{"Aslaid", rad4},
|
||||
{"selectedframe", rad5},
|
||||
{"Eachframe", rad6},
|
||||
{"printFramesTitleWindows", grp3},
|
||||
{"asLaidOutWindows", rad4},
|
||||
{"selectedFrameWindows", rad5},
|
||||
{"separateFramesWindows", rad6},
|
||||
{NULL, NULL}};
|
||||
|
||||
//--------------------------------------------------------
|
||||
@ -1280,7 +1280,7 @@ ShowNativePrintDialogEx(HWND aHWnd,
|
||||
// lLcalize the Property Sheet (Tab) title
|
||||
nsCAutoString title;
|
||||
nsString optionsStr;
|
||||
if (NS_SUCCEEDED(GetLocalizedString(strBundle, "options", optionsStr))) {
|
||||
if (NS_SUCCEEDED(GetLocalizedString(strBundle, "optionsTitleWindows", optionsStr))) {
|
||||
// Failure here just means a blank string
|
||||
NS_CopyUnicodeToNative(optionsStr, title);
|
||||
}
|
||||
|
@ -1,28 +0,0 @@
|
||||
printTitle=Print
|
||||
optionsTabLabel=Options
|
||||
printFramesTitle=Print Frames
|
||||
|
||||
# TRANSLATOR NOTE: For radio button labels and check button labels, an underscore _
|
||||
# before a character will turn that character into an accesskey.
|
||||
# e.g. "_As laid out" will make A the accesskey.
|
||||
|
||||
asLaidOut=_As Laid Out on the Screen
|
||||
selectedFrame=The _Selected Frame
|
||||
separateFrames=Each Frame on Separate _Pages
|
||||
shrinkToFit=Ignore Scaling and S_hrink To Fit Page Width
|
||||
selectionOnly=Print Selection _Only
|
||||
printBGOptions=Print Backgrounds
|
||||
printBGColors=Print Background _Colors
|
||||
printBGImages=Print Background I_mages
|
||||
headerFooter=Header and Footer
|
||||
left=Left
|
||||
center=Center
|
||||
right=Right
|
||||
headerFooterBlank=--blank--
|
||||
headerFooterTitle=Title
|
||||
headerFooterURL=URL
|
||||
headerFooterDate=Date/Time
|
||||
headerFooterPage=Page #
|
||||
headerFooterPageTotal=Page # of #
|
||||
headerFooterCustom=Custom...
|
||||
customHeaderFooterPrompt=Please enter your custom header/footer text
|
59
toolkit/locales/en-US/chrome/global/printdialog.properties
Normal file
59
toolkit/locales/en-US/chrome/global/printdialog.properties
Normal file
@ -0,0 +1,59 @@
|
||||
# These strings are used in the native GTK, Mac and Windows print dialogs.
|
||||
|
||||
# GTK titles:
|
||||
printTitleGTK=Print
|
||||
optionsTabLabelGTK=Options
|
||||
printFramesTitleGTK=Print Frames
|
||||
|
||||
# Mac titles:
|
||||
optionsTitleMac=Options:
|
||||
appearanceTitleMac=Appearance:
|
||||
framesTitleMac=Frames:
|
||||
pageHeadersTitleMac=Page Headers:
|
||||
pageFootersTitleMac=Page Footers:
|
||||
|
||||
# Windows titles:
|
||||
optionsTitleWindows=Options
|
||||
printFramesTitleWindows=Print Frames
|
||||
|
||||
# TRANSLATOR NOTE: For radio button labels and check button labels, an underscore _
|
||||
# before a character will turn that character into an accesskey in the GTK dialog.
|
||||
# e.g. "_As laid out" will make A the accesskey.
|
||||
# In the Windows labels, use an ampersand (&).
|
||||
# On Mac, underscores will be stripped.
|
||||
|
||||
asLaidOut=_As Laid Out on the Screen
|
||||
asLaidOutWindows=As &laid out on the screen
|
||||
selectedFrame=The _Selected Frame
|
||||
selectedFrameWindows=The selected &frame
|
||||
separateFrames=Each Frame on Separate _Pages
|
||||
separateFramesWindows=&Each frame separately
|
||||
shrinkToFit=Ignore Scaling and S_hrink To Fit Page Width
|
||||
selectionOnly=Print Selection _Only
|
||||
printBGOptions=Print Backgrounds
|
||||
printBGColors=Print Background _Colors
|
||||
printBGImages=Print Background I_mages
|
||||
headerFooter=Header and Footer
|
||||
left=Left
|
||||
center=Center
|
||||
right=Right
|
||||
headerFooterBlank=--blank--
|
||||
headerFooterTitle=Title
|
||||
headerFooterURL=URL
|
||||
headerFooterDate=Date/Time
|
||||
headerFooterPage=Page #
|
||||
headerFooterPageTotal=Page # of #
|
||||
headerFooterCustom=Custom...
|
||||
customHeaderFooterPrompt=Please enter your custom header/footer text
|
||||
|
||||
# These are for the summary view in the Mac dialog:
|
||||
summaryFramesTitle=Print Frames
|
||||
summarySelectionOnlyTitle=Print Selection
|
||||
summaryShrinkToFitTitle=Shrink To Fit
|
||||
summaryPrintBGColorsTitle=Print BG Colors
|
||||
summaryPrintBGImagesTitle=Print BG Images
|
||||
summaryHeaderTitle=Page Headers
|
||||
summaryFooterTitle=Page Footers
|
||||
summaryNAValue=N/A
|
||||
summaryOnValue=On
|
||||
summaryOffValue=Off
|
@ -45,7 +45,7 @@
|
||||
+ locale/@AB_CD@/global/printPageSetup.dtd (%chrome/global/printPageSetup.dtd)
|
||||
+ locale/@AB_CD@/global/printPreview.dtd (%chrome/global/printPreview.dtd)
|
||||
+ locale/@AB_CD@/global/printPreviewProgress.dtd (%chrome/global/printPreviewProgress.dtd)
|
||||
locale/@AB_CD@/global/gnomeprintdialog.properties (%chrome/global/gnomeprintdialog.properties)
|
||||
locale/@AB_CD@/global/printdialog.properties (%chrome/global/printdialog.properties)
|
||||
+ locale/@AB_CD@/global/printProgress.dtd (%chrome/global/printProgress.dtd)
|
||||
+ locale/@AB_CD@/global/regionNames.properties (%chrome/global/regionNames.properties)
|
||||
+ locale/@AB_CD@/global/dialog.properties (%chrome/global/dialog.properties)
|
||||
|
@ -61,7 +61,10 @@ EXPORTS = \
|
||||
$(NULL)
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
|
||||
EXPORTS += nsINativeMenuService.h
|
||||
EXPORTS += \
|
||||
nsINativeMenuService.h \
|
||||
nsIPrintDialogService.h \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
|
||||
@ -121,11 +124,6 @@ XPIDLSRCS += nsIPrintSettingsWin.idl \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
|
||||
XPIDLSRCS += nsIPrintSettingsX.idl \
|
||||
nsIPrintSessionX.idl
|
||||
endif
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
|
||||
XPIDLSRCS += nsIRwsService.idl
|
||||
endif
|
||||
|
@ -1,69 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Conrad Carlen <ccarlen@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIPrintSession.idl"
|
||||
|
||||
%{ C++
|
||||
#include <Carbon/Carbon.h>
|
||||
%}
|
||||
|
||||
/**
|
||||
* Native types
|
||||
*/
|
||||
native nsPMPrintSession(PMPrintSession);
|
||||
|
||||
/**
|
||||
* nsIPrintSessionX
|
||||
*
|
||||
* Stores a PMPrintSession
|
||||
*
|
||||
* @status
|
||||
*/
|
||||
|
||||
[uuid(2f977d54-5485-11d4-87e2-0010a4e75ef2)]
|
||||
|
||||
interface nsIPrintSessionX : nsIPrintSession
|
||||
{
|
||||
/**
|
||||
* nativeSession attribute
|
||||
*
|
||||
* Does NOT do PMRetain() on result.
|
||||
*/
|
||||
|
||||
readonly attribute nsPMPrintSession nativeSession;
|
||||
};
|
@ -1,99 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Conrad Carlen <ccarlen@netscape.com>
|
||||
* Don Cone <dcone@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
%{ C++
|
||||
#include <Carbon/Carbon.h>
|
||||
%}
|
||||
|
||||
/**
|
||||
* Native types
|
||||
*/
|
||||
native nsPMPageFormat(PMPageFormat);
|
||||
native nsPMPrintSettings(PMPrintSettings);
|
||||
native nsPMPrintSession(PMPrintSession);
|
||||
|
||||
/**
|
||||
* Simplified PrintSettings for OSX interface
|
||||
*
|
||||
* @status UNDER_REVIEW
|
||||
*/
|
||||
[scriptable, uuid(3D3CF688-D988-4319-9CA2-1D7D20A116D8)]
|
||||
|
||||
interface nsIPrintSettingsX : nsISupports
|
||||
{
|
||||
/**
|
||||
* nativePrintSession attribute
|
||||
*
|
||||
* Convenience method which gets the nsIPrintSession
|
||||
* and returns its native session object
|
||||
*
|
||||
* Does NOT do PMRetain() on result.
|
||||
*/
|
||||
[noscript] readonly attribute nsPMPrintSession nativePrintSession;
|
||||
|
||||
/**
|
||||
* PMPageFormat and PMPrintSettings attributes
|
||||
*
|
||||
* Getter does NOT do PMRetain() on result.
|
||||
* Setter does PMRetain() on parameter.
|
||||
*/
|
||||
[noscript] attribute nsPMPageFormat pMPageFormat;
|
||||
|
||||
[noscript] attribute nsPMPrintSettings pMPrintSettings;
|
||||
|
||||
/**
|
||||
* readPageFormatFromPrefs and writePageFormatToPrefs
|
||||
*
|
||||
* Read and write a flattened PMPageFormat to/from prefs.
|
||||
* This also contains any custom data we appended to the dialog
|
||||
*/
|
||||
[noscript] void readPageFormatFromPrefs();
|
||||
[noscript] void writePageFormatToPrefs();
|
||||
|
||||
/**
|
||||
* cleanUpAfterCarbonDialog
|
||||
*
|
||||
* After bringing up Carbon print dialogs, clean up menus.
|
||||
* See bug 425844 for details.
|
||||
*/
|
||||
[noscript] void cleanUpAfterCarbonDialog();
|
||||
|
||||
};
|
@ -83,9 +83,9 @@ CMMSRCS = \
|
||||
nsLookAndFeel.mm \
|
||||
nsNativeThemeCocoa.mm \
|
||||
nsDeviceContextSpecX.mm \
|
||||
nsPrintDialogX.mm \
|
||||
nsPrintOptionsX.mm \
|
||||
nsPrintSettingsX.mm \
|
||||
nsPrintSessionX.mm \
|
||||
nsIdleServiceX.mm \
|
||||
nsAccelerometerX.mm \
|
||||
nsCocoaTextInputHandler.mm \
|
||||
|
@ -41,14 +41,16 @@
|
||||
|
||||
#include "nsIDeviceContextSpec.h"
|
||||
|
||||
#include <Carbon/Carbon.h>
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
|
||||
class nsDeviceContextSpecX : public nsIDeviceContextSpec
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
nsDeviceContextSpecX();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_IMETHOD Init(nsIWidget *aWidget, nsIPrintSettings* aPS, PRBool aIsPrintPreview);
|
||||
NS_IMETHOD GetSurfaceForPrinter(gfxASurface **surface);
|
||||
NS_IMETHOD BeginDocument(PRUnichar* aTitle,
|
||||
PRUnichar* aPrintToFileName,
|
||||
@ -58,19 +60,10 @@ public:
|
||||
NS_IMETHOD BeginPage();
|
||||
NS_IMETHOD EndPage();
|
||||
|
||||
/**
|
||||
* Initialize the nsDeviceContextSpecX for use. This will allocate a printrecord for use
|
||||
* @param aWidget Unused
|
||||
* @param aPS Settings for this print job
|
||||
* @param aIsPrintPreview TRUE if doing print preview, FALSE if normal printing.
|
||||
* @return error status
|
||||
*/
|
||||
NS_IMETHOD Init(nsIWidget *aWidget, nsIPrintSettings* aPS, PRBool aIsPrintPreview);
|
||||
|
||||
void GetPaperRect(double* aTop, double* aLeft, double* aBottom, double* aRight);
|
||||
|
||||
protected:
|
||||
virtual ~nsDeviceContextSpecX();
|
||||
virtual ~nsDeviceContextSpecX();
|
||||
|
||||
protected:
|
||||
PMPrintSession mPrintSession; // printing context.
|
||||
|
@ -48,7 +48,7 @@
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIPrintOptions.h"
|
||||
#include "nsIPrintSettingsX.h"
|
||||
#include "nsPrintSettingsX.h"
|
||||
|
||||
#include "gfxQuartzSurface.h"
|
||||
#include "gfxImageSurface.h"
|
||||
@ -78,24 +78,14 @@ NS_IMETHODIMP nsDeviceContextSpecX::Init(nsIWidget *aWidget,
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIPrintSettingsX> printSettingsX(do_QueryInterface(aPS));
|
||||
if (!printSettingsX)
|
||||
nsCOMPtr<nsPrintSettingsX> settings(do_QueryInterface(aPS));
|
||||
if (!settings)
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
|
||||
rv = printSettingsX->GetNativePrintSession(&mPrintSession);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
mPrintSession = settings->GetPMPrintSession();
|
||||
::PMRetain(mPrintSession);
|
||||
|
||||
rv = printSettingsX->GetPMPageFormat(&mPageFormat);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = printSettingsX->GetPMPrintSettings(&mPrintSettings);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
mPageFormat = settings->GetPMPageFormat();
|
||||
mPrintSettings = settings->GetPMPrintSettings();
|
||||
|
||||
return NS_OK;
|
||||
|
||||
@ -142,13 +132,6 @@ NS_IMETHODIMP nsDeviceContextSpecX::EndDocument()
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
}
|
||||
|
||||
/*
|
||||
NS_IMETHODIMP nsDeviceContextSpecX::AbortDocument()
|
||||
{
|
||||
return EndDocument();
|
||||
}
|
||||
*/
|
||||
|
||||
NS_IMETHODIMP nsDeviceContextSpecX::BeginPage()
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
109
widget/src/cocoa/nsPrintDialogX.h
Normal file
109
widget/src/cocoa/nsPrintDialogX.h
Normal file
@ -0,0 +1,109 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Mozilla OS X print dialog interface.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Corporation
|
||||
* Portions created by the Initial Developer are Copyright (C) 2007
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Markus Stange <mstange@themasta.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsPrintDialog_h__
|
||||
#define nsPrintDialog_h__
|
||||
|
||||
#include "nsIPrintDialogService.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsCocoaUtils.h"
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
class nsIPrintSettings;
|
||||
class nsIStringBundle;
|
||||
|
||||
class nsPrintDialogServiceX : public nsIPrintDialogService
|
||||
{
|
||||
public:
|
||||
nsPrintDialogServiceX();
|
||||
virtual ~nsPrintDialogServiceX();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHODIMP Init();
|
||||
NS_IMETHODIMP Show(nsIDOMWindow *aParent, nsIPrintSettings *aSettings);
|
||||
NS_IMETHODIMP ShowPageSetup(nsIDOMWindow *aParent,
|
||||
nsIPrintSettings *aSettings);
|
||||
};
|
||||
|
||||
@interface PrintPanelAccessoryView : NSView
|
||||
{
|
||||
nsIPrintSettings* mSettings;
|
||||
nsIStringBundle* mPrintBundle;
|
||||
NSButton* mPrintSelectionOnlyCheckbox;
|
||||
NSButton* mShrinkToFitCheckbox;
|
||||
NSButton* mPrintBGColorsCheckbox;
|
||||
NSButton* mPrintBGImagesCheckbox;
|
||||
NSButtonCell* mAsLaidOutRadio;
|
||||
NSButtonCell* mSelectedFrameRadio;
|
||||
NSButtonCell* mSeparateFramesRadio;
|
||||
NSPopUpButton* mHeaderLeftList;
|
||||
NSPopUpButton* mHeaderCenterList;
|
||||
NSPopUpButton* mHeaderRightList;
|
||||
NSPopUpButton* mFooterLeftList;
|
||||
NSPopUpButton* mFooterCenterList;
|
||||
NSPopUpButton* mFooterRightList;
|
||||
}
|
||||
|
||||
- (id)initWithSettings:(nsIPrintSettings*)aSettings;
|
||||
|
||||
- (void)exportSettings;
|
||||
|
||||
@end
|
||||
|
||||
#ifdef NS_LEOPARD_AND_LATER
|
||||
@interface PrintPanelAccessoryController : NSViewController <NSPrintPanelAccessorizing>
|
||||
#else
|
||||
@interface PrintPanelAccessoryController : NSObject
|
||||
{
|
||||
NSView* mView;
|
||||
}
|
||||
|
||||
- (void)setView:(NSView*)aView;
|
||||
|
||||
- (NSView*)view;
|
||||
#endif
|
||||
|
||||
- (id)initWithSettings:(nsIPrintSettings*)aSettings;
|
||||
|
||||
- (void)exportSettings;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
656
widget/src/cocoa/nsPrintDialogX.mm
Normal file
656
widget/src/cocoa/nsPrintDialogX.mm
Normal file
@ -0,0 +1,656 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Mozilla OS X print dialog interface.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2007
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Markus Stange <mstange@themasta.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsPrintDialogX.h"
|
||||
#include "nsIPrintSettings.h"
|
||||
#include "nsPrintSettingsX.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIWebProgressListener.h"
|
||||
#include "nsIStringBundle.h"
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#include "nsObjCExceptions.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsPrintDialogServiceX, nsIPrintDialogService)
|
||||
|
||||
nsPrintDialogServiceX::nsPrintDialogServiceX()
|
||||
{
|
||||
}
|
||||
|
||||
nsPrintDialogServiceX::~nsPrintDialogServiceX()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPrintDialogServiceX::Init()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPrintDialogServiceX::Show(nsIDOMWindow *aParent, nsIPrintSettings *aSettings)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
NS_PRECONDITION(aSettings, "aSettings must not be null");
|
||||
|
||||
nsCOMPtr<nsPrintSettingsX> settingsX(do_QueryInterface(aSettings));
|
||||
if (!settingsX)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
NSPrintInfo* printInfo = settingsX->GetCocoaPrintInfo();
|
||||
|
||||
// Put the print info into the current print operation, since that's where
|
||||
// [panel runModal] will look for it. We create the view because otherwise
|
||||
// we'll get unrelated warnings printed to the console.
|
||||
NSView* tmpView = [[NSView alloc] init];
|
||||
NSPrintOperation* printOperation = [NSPrintOperation printOperationWithView:tmpView printInfo:printInfo];
|
||||
[NSPrintOperation setCurrentOperation:printOperation];
|
||||
|
||||
NSPrintPanel* panel = [NSPrintPanel printPanel];
|
||||
PrintPanelAccessoryController* viewController =
|
||||
[[PrintPanelAccessoryController alloc] initWithSettings:aSettings];
|
||||
#ifdef NS_LEOPARD_AND_LATER
|
||||
[panel addAccessoryController:viewController];
|
||||
[viewController release];
|
||||
#else
|
||||
[panel setAccessoryView:[viewController view]];
|
||||
[[viewController view] release];
|
||||
#endif
|
||||
|
||||
// Show the dialog.
|
||||
nsCocoaUtils::PrepareForNativeAppModalDialog();
|
||||
int button = [panel runModal];
|
||||
nsCocoaUtils::CleanUpAfterNativeAppModalDialog();
|
||||
|
||||
settingsX->SetCocoaPrintInfo([[[NSPrintOperation currentOperation] printInfo] copy]);
|
||||
[NSPrintOperation setCurrentOperation:nil];
|
||||
[printInfo release];
|
||||
[tmpView release];
|
||||
|
||||
if (button != NSOKButton)
|
||||
return NS_ERROR_ABORT;
|
||||
|
||||
// Export settings.
|
||||
[viewController exportSettings];
|
||||
|
||||
PRInt16 pageRange;
|
||||
aSettings->GetPrintRange(&pageRange);
|
||||
if (pageRange != nsIPrintSettings::kRangeSelection) {
|
||||
PMPrintSettings nativePrintSettings = settingsX->GetPMPrintSettings();
|
||||
UInt32 firstPage, lastPage;
|
||||
OSStatus status = ::PMGetFirstPage(nativePrintSettings, &firstPage);
|
||||
if (status == noErr) {
|
||||
status = ::PMGetLastPage(nativePrintSettings, &lastPage);
|
||||
if (status == noErr && lastPage != LONG_MAX) {
|
||||
aSettings->SetPrintRange(nsIPrintSettings::kRangeSpecifiedPageRange);
|
||||
aSettings->SetStartPageRange(firstPage);
|
||||
aSettings->SetEndPageRange(lastPage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPrintDialogServiceX::ShowPageSetup(nsIDOMWindow *aParent,
|
||||
nsIPrintSettings *aNSSettings)
|
||||
{
|
||||
NS_PRECONDITION(aParent, "aParent must not be null");
|
||||
NS_PRECONDITION(aNSSettings, "aSettings must not be null");
|
||||
NS_ENSURE_TRUE(aNSSettings, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsPrintSettingsX> settingsX(do_QueryInterface(aNSSettings));
|
||||
if (!settingsX)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
NSPrintInfo* printInfo = settingsX->GetCocoaPrintInfo();
|
||||
NSPageLayout *pageLayout = [NSPageLayout pageLayout];
|
||||
nsCocoaUtils::PrepareForNativeAppModalDialog();
|
||||
int button = [pageLayout runModalWithPrintInfo:printInfo];
|
||||
nsCocoaUtils::CleanUpAfterNativeAppModalDialog();
|
||||
|
||||
return button == NSOKButton ? NS_OK : NS_ERROR_ABORT;
|
||||
}
|
||||
|
||||
// Accessory view
|
||||
|
||||
@interface PrintPanelAccessoryView (Private)
|
||||
|
||||
- (NSString*)localizedString:(const char*)aKey;
|
||||
|
||||
- (PRInt16)chosenFrameSetting;
|
||||
|
||||
- (const char*)headerFooterStringForList:(NSPopUpButton*)aList;
|
||||
|
||||
- (void)exportHeaderFooterSettings;
|
||||
|
||||
- (void)initBundle;
|
||||
|
||||
- (NSTextField*)label:(const char*)aLabel
|
||||
withFrame:(NSRect)aRect
|
||||
alignment:(NSTextAlignment)aAlignment;
|
||||
|
||||
- (void)addLabel:(const char*)aLabel
|
||||
withFrame:(NSRect)aRect
|
||||
alignment:(NSTextAlignment)aAlignment;
|
||||
|
||||
- (void)addLabel:(const char*)aLabel withFrame:(NSRect)aRect;
|
||||
|
||||
- (void)addCenteredLabel:(const char*)aLabel withFrame:(NSRect)aRect;
|
||||
|
||||
- (NSButton*)checkboxWithLabel:(const char*)aLabel andFrame:(NSRect)aRect;
|
||||
|
||||
- (NSPopUpButton*)headerFooterItemListWithFrame:(NSRect)aRect
|
||||
selectedItem:(const PRUnichar*)aCurrentString;
|
||||
|
||||
- (void)addOptionsSection;
|
||||
|
||||
- (void)addAppearanceSection;
|
||||
|
||||
- (void)addFramesSection;
|
||||
|
||||
- (void)addHeaderFooterSection;
|
||||
|
||||
- (NSString*)summaryValueForCheckbox:(NSButton*)aCheckbox;
|
||||
|
||||
- (NSString*)framesSummaryValue;
|
||||
|
||||
- (NSString*)headerSummaryValue;
|
||||
|
||||
- (NSString*)footerSummaryValue;
|
||||
|
||||
@end
|
||||
|
||||
static const char sHeaderFooterTags[][4] = {"", "&T", "&U", "&D", "&P", "&PT"};
|
||||
|
||||
@implementation PrintPanelAccessoryView
|
||||
|
||||
// Public methods
|
||||
|
||||
- (id)initWithSettings:(nsIPrintSettings*)aSettings
|
||||
{
|
||||
[super initWithFrame:NSMakeRect(0, 0, 540, 270)];
|
||||
|
||||
mSettings = aSettings;
|
||||
[self initBundle];
|
||||
[self addOptionsSection];
|
||||
[self addAppearanceSection];
|
||||
[self addFramesSection];
|
||||
[self addHeaderFooterSection];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)exportSettings
|
||||
{
|
||||
mSettings->SetPrintRange([mPrintSelectionOnlyCheckbox state] == NSOnState ?
|
||||
(PRInt16)nsIPrintSettings::kRangeSelection :
|
||||
(PRInt16)nsIPrintSettings::kRangeAllPages);
|
||||
mSettings->SetShrinkToFit([mShrinkToFitCheckbox state] == NSOnState);
|
||||
mSettings->SetPrintBGColors([mPrintBGColorsCheckbox state] == NSOnState);
|
||||
mSettings->SetPrintBGImages([mPrintBGImagesCheckbox state] == NSOnState);
|
||||
mSettings->SetPrintFrameType([self chosenFrameSetting]);
|
||||
|
||||
[self exportHeaderFooterSettings];
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
NS_IF_RELEASE(mPrintBundle);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
// Localization
|
||||
|
||||
- (void)initBundle
|
||||
{
|
||||
nsCOMPtr<nsIStringBundleService> bundleSvc = do_GetService(NS_STRINGBUNDLE_CONTRACTID);
|
||||
bundleSvc->CreateBundle("chrome://global/locale/printdialog.properties", &mPrintBundle);
|
||||
}
|
||||
|
||||
- (NSString*)localizedString:(const char*)aKey
|
||||
{
|
||||
if (!mPrintBundle)
|
||||
return @"";
|
||||
|
||||
nsXPIDLString intlString;
|
||||
mPrintBundle->GetStringFromName(NS_ConvertUTF8toUTF16(aKey).get(), getter_Copies(intlString));
|
||||
NSMutableString* s = [NSMutableString stringWithUTF8String:NS_ConvertUTF16toUTF8(intlString).get()];
|
||||
|
||||
// Remove all underscores (they're used in the GTK dialog for accesskeys).
|
||||
[s replaceOccurrencesOfString:@"_" withString:@"" options:0 range:NSMakeRange(0, [s length])];
|
||||
return s;
|
||||
}
|
||||
|
||||
// Widget helpers
|
||||
|
||||
- (NSTextField*)label:(const char*)aLabel
|
||||
withFrame:(NSRect)aRect
|
||||
alignment:(NSTextAlignment)aAlignment
|
||||
{
|
||||
NSTextField* label = [[[NSTextField alloc] initWithFrame:aRect] autorelease];
|
||||
[label setStringValue:[self localizedString:aLabel]];
|
||||
[label setEditable:NO];
|
||||
[label setSelectable:NO];
|
||||
[label setBezeled:NO];
|
||||
[label setBordered:NO];
|
||||
[label setDrawsBackground:NO];
|
||||
[label setFont:[NSFont systemFontOfSize:[NSFont systemFontSize]]];
|
||||
[label setAlignment:aAlignment];
|
||||
return label;
|
||||
}
|
||||
|
||||
- (void)addLabel:(const char*)aLabel
|
||||
withFrame:(NSRect)aRect
|
||||
alignment:(NSTextAlignment)aAlignment
|
||||
{
|
||||
NSTextField* label = [self label:aLabel withFrame:aRect alignment:aAlignment];
|
||||
[self addSubview:label];
|
||||
}
|
||||
|
||||
- (void)addLabel:(const char*)aLabel withFrame:(NSRect)aRect
|
||||
{
|
||||
[self addLabel:aLabel withFrame:aRect alignment:NSRightTextAlignment];
|
||||
}
|
||||
|
||||
- (void)addCenteredLabel:(const char*)aLabel withFrame:(NSRect)aRect
|
||||
{
|
||||
[self addLabel:aLabel withFrame:aRect alignment:NSCenterTextAlignment];
|
||||
}
|
||||
|
||||
- (NSButton*)checkboxWithLabel:(const char*)aLabel andFrame:(NSRect)aRect
|
||||
{
|
||||
aRect.origin.y += 4.0f;
|
||||
NSButton* checkbox = [[[NSButton alloc] initWithFrame:aRect] autorelease];
|
||||
[checkbox setButtonType:NSSwitchButton];
|
||||
[checkbox setTitle:[self localizedString:aLabel]];
|
||||
[checkbox setFont:[NSFont systemFontOfSize:[NSFont systemFontSize]]];
|
||||
[checkbox sizeToFit];
|
||||
return checkbox;
|
||||
}
|
||||
|
||||
- (NSPopUpButton*)headerFooterItemListWithFrame:(NSRect)aRect
|
||||
selectedItem:(const PRUnichar*)aCurrentString
|
||||
{
|
||||
NSPopUpButton* list = [[[NSPopUpButton alloc] initWithFrame:aRect pullsDown:NO] autorelease];
|
||||
[list setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
|
||||
[[list cell] setControlSize:NSSmallControlSize];
|
||||
NSArray* items =
|
||||
[NSArray arrayWithObjects:[self localizedString:"headerFooterBlank"],
|
||||
[self localizedString:"headerFooterTitle"],
|
||||
[self localizedString:"headerFooterURL"],
|
||||
[self localizedString:"headerFooterDate"],
|
||||
[self localizedString:"headerFooterPage"],
|
||||
[self localizedString:"headerFooterPageTotal"],
|
||||
nil];
|
||||
[list addItemsWithTitles:items];
|
||||
|
||||
NS_ConvertUTF16toUTF8 currentStringUTF8(aCurrentString);
|
||||
for (unsigned int i = 0; i < NS_ARRAY_LENGTH(sHeaderFooterTags); i++) {
|
||||
if (!strcmp(currentStringUTF8.get(), sHeaderFooterTags[i])) {
|
||||
[list selectItemAtIndex:i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
// Build sections
|
||||
|
||||
- (void)addOptionsSection
|
||||
{
|
||||
// Title
|
||||
[self addLabel:"optionsTitleMac" withFrame:NSMakeRect(0, 240, 151, 22)];
|
||||
|
||||
// "Print Selection Only"
|
||||
mPrintSelectionOnlyCheckbox = [self checkboxWithLabel:"selectionOnly"
|
||||
andFrame:NSMakeRect(156, 240, 0, 0)];
|
||||
|
||||
PRBool canPrintSelection;
|
||||
mSettings->GetPrintOptions(nsIPrintSettings::kEnableSelectionRB,
|
||||
&canPrintSelection);
|
||||
[mPrintSelectionOnlyCheckbox setEnabled:canPrintSelection];
|
||||
|
||||
PRInt16 printRange;
|
||||
mSettings->GetPrintRange(&printRange);
|
||||
if (printRange == nsIPrintSettings::kRangeSelection) {
|
||||
[mPrintSelectionOnlyCheckbox setState:NSOnState];
|
||||
}
|
||||
|
||||
[self addSubview:mPrintSelectionOnlyCheckbox];
|
||||
|
||||
// "Shrink To Fit"
|
||||
mShrinkToFitCheckbox = [self checkboxWithLabel:"shrinkToFit"
|
||||
andFrame:NSMakeRect(156, 218, 0, 0)];
|
||||
|
||||
PRBool shrinkToFit;
|
||||
mSettings->GetShrinkToFit(&shrinkToFit);
|
||||
[mShrinkToFitCheckbox setState:(shrinkToFit ? NSOnState : NSOffState)];
|
||||
|
||||
[self addSubview:mShrinkToFitCheckbox];
|
||||
}
|
||||
|
||||
- (void)addAppearanceSection
|
||||
{
|
||||
// Title
|
||||
[self addLabel:"appearanceTitleMac" withFrame:NSMakeRect(0, 188, 151, 22)];
|
||||
|
||||
// "Print Background Colors"
|
||||
mPrintBGColorsCheckbox = [self checkboxWithLabel:"printBGColors"
|
||||
andFrame:NSMakeRect(156, 188, 0, 0)];
|
||||
|
||||
PRBool geckoBool;
|
||||
mSettings->GetPrintBGColors(&geckoBool);
|
||||
[mPrintBGColorsCheckbox setState:(geckoBool ? NSOnState : NSOffState)];
|
||||
|
||||
[self addSubview:mPrintBGColorsCheckbox];
|
||||
|
||||
// "Print Background Images"
|
||||
mPrintBGImagesCheckbox = [self checkboxWithLabel:"printBGImages"
|
||||
andFrame:NSMakeRect(156, 166, 0, 0)];
|
||||
|
||||
mSettings->GetPrintBGImages(&geckoBool);
|
||||
[mPrintBGImagesCheckbox setState:(geckoBool ? NSOnState : NSOffState)];
|
||||
|
||||
[self addSubview:mPrintBGImagesCheckbox];
|
||||
}
|
||||
|
||||
- (void)addFramesSection
|
||||
{
|
||||
// Title
|
||||
[self addLabel:"framesTitleMac" withFrame:NSMakeRect(0, 124, 151, 22)];
|
||||
|
||||
// Radio matrix
|
||||
NSButtonCell *radio = [[NSButtonCell alloc] init];
|
||||
[radio setButtonType:NSRadioButton];
|
||||
[radio setFont:[NSFont systemFontOfSize:[NSFont systemFontSize]]];
|
||||
NSMatrix *matrix = [[NSMatrix alloc] initWithFrame:NSMakeRect(156, 81, 400, 66)
|
||||
mode:NSRadioModeMatrix
|
||||
prototype:(NSCell*)radio
|
||||
numberOfRows:3
|
||||
numberOfColumns:1];
|
||||
[radio release];
|
||||
[matrix setCellSize:NSMakeSize(400, 21)];
|
||||
[self addSubview:matrix];
|
||||
[matrix release];
|
||||
NSArray *cellArray = [matrix cells];
|
||||
mAsLaidOutRadio = [cellArray objectAtIndex:0];
|
||||
mSelectedFrameRadio = [cellArray objectAtIndex:1];
|
||||
mSeparateFramesRadio = [cellArray objectAtIndex:2];
|
||||
[mAsLaidOutRadio setTitle:[self localizedString:"asLaidOut"]];
|
||||
[mSelectedFrameRadio setTitle:[self localizedString:"selectedFrame"]];
|
||||
[mSeparateFramesRadio setTitle:[self localizedString:"separateFrames"]];
|
||||
|
||||
// Radio enabled state
|
||||
PRInt16 frameUIFlag;
|
||||
mSettings->GetHowToEnableFrameUI(&frameUIFlag);
|
||||
if (frameUIFlag == nsIPrintSettings::kFrameEnableNone) {
|
||||
[mAsLaidOutRadio setEnabled:NO];
|
||||
[mSelectedFrameRadio setEnabled:NO];
|
||||
[mSeparateFramesRadio setEnabled:NO];
|
||||
} else if (frameUIFlag == nsIPrintSettings::kFrameEnableAsIsAndEach) {
|
||||
[mSelectedFrameRadio setEnabled:NO];
|
||||
}
|
||||
|
||||
// Radio values
|
||||
PRInt16 printFrameType;
|
||||
mSettings->GetPrintFrameType(&printFrameType);
|
||||
switch (printFrameType) {
|
||||
case nsIPrintSettings::kFramesAsIs:
|
||||
[mAsLaidOutRadio setState:NSOnState];
|
||||
break;
|
||||
case nsIPrintSettings::kSelectedFrame:
|
||||
[mSelectedFrameRadio setState:NSOnState];
|
||||
break;
|
||||
case nsIPrintSettings::kEachFrameSep:
|
||||
[mSeparateFramesRadio setState:NSOnState];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)addHeaderFooterSection
|
||||
{
|
||||
// Labels
|
||||
[self addLabel:"pageHeadersTitleMac" withFrame:NSMakeRect(0, 44, 151, 22)];
|
||||
[self addLabel:"pageFootersTitleMac" withFrame:NSMakeRect(0, 0, 151, 22)];
|
||||
[self addCenteredLabel:"left" withFrame:NSMakeRect(156, 22, 100, 22)];
|
||||
[self addCenteredLabel:"center" withFrame:NSMakeRect(256, 22, 100, 22)];
|
||||
[self addCenteredLabel:"right" withFrame:NSMakeRect(356, 22, 100, 22)];
|
||||
|
||||
// Lists
|
||||
nsXPIDLString sel;
|
||||
|
||||
mSettings->GetHeaderStrLeft(getter_Copies(sel));
|
||||
mHeaderLeftList = [self headerFooterItemListWithFrame:NSMakeRect(156, 44, 100, 22)
|
||||
selectedItem:sel];
|
||||
[self addSubview:mHeaderLeftList];
|
||||
|
||||
mSettings->GetHeaderStrCenter(getter_Copies(sel));
|
||||
mHeaderCenterList = [self headerFooterItemListWithFrame:NSMakeRect(256, 44, 100, 22)
|
||||
selectedItem:sel];
|
||||
[self addSubview:mHeaderCenterList];
|
||||
|
||||
mSettings->GetHeaderStrRight(getter_Copies(sel));
|
||||
mHeaderRightList = [self headerFooterItemListWithFrame:NSMakeRect(356, 44, 100, 22)
|
||||
selectedItem:sel];
|
||||
[self addSubview:mHeaderRightList];
|
||||
|
||||
mSettings->GetFooterStrLeft(getter_Copies(sel));
|
||||
mFooterLeftList = [self headerFooterItemListWithFrame:NSMakeRect(156, 0, 100, 22)
|
||||
selectedItem:sel];
|
||||
[self addSubview:mFooterLeftList];
|
||||
|
||||
mSettings->GetFooterStrCenter(getter_Copies(sel));
|
||||
mFooterCenterList = [self headerFooterItemListWithFrame:NSMakeRect(256, 0, 100, 22)
|
||||
selectedItem:sel];
|
||||
[self addSubview:mFooterCenterList];
|
||||
|
||||
mSettings->GetFooterStrRight(getter_Copies(sel));
|
||||
mFooterRightList = [self headerFooterItemListWithFrame:NSMakeRect(356, 0, 100, 22)
|
||||
selectedItem:sel];
|
||||
[self addSubview:mFooterRightList];
|
||||
}
|
||||
|
||||
// Export settings
|
||||
|
||||
- (PRInt16)chosenFrameSetting
|
||||
{
|
||||
if ([mAsLaidOutRadio state] == NSOnState)
|
||||
return nsIPrintSettings::kFramesAsIs;
|
||||
if ([mSelectedFrameRadio state] == NSOnState)
|
||||
return nsIPrintSettings::kSelectedFrame;
|
||||
if ([mSeparateFramesRadio state] == NSOnState)
|
||||
return nsIPrintSettings::kEachFrameSep;
|
||||
return nsIPrintSettings::kNoFrames;
|
||||
}
|
||||
|
||||
- (const char*)headerFooterStringForList:(NSPopUpButton*)aList
|
||||
{
|
||||
NSInteger index = [aList indexOfSelectedItem];
|
||||
NS_ASSERTION(index < NSInteger(NS_ARRAY_LENGTH(sHeaderFooterTags)), "Index of dropdown is higher than expected!");
|
||||
return sHeaderFooterTags[index];
|
||||
}
|
||||
|
||||
- (void)exportHeaderFooterSettings
|
||||
{
|
||||
const char* headerFooterStr;
|
||||
headerFooterStr = [self headerFooterStringForList:mHeaderLeftList];
|
||||
mSettings->SetHeaderStrLeft(NS_ConvertUTF8toUTF16(headerFooterStr).get());
|
||||
|
||||
headerFooterStr = [self headerFooterStringForList:mHeaderCenterList];
|
||||
mSettings->SetHeaderStrCenter(NS_ConvertUTF8toUTF16(headerFooterStr).get());
|
||||
|
||||
headerFooterStr = [self headerFooterStringForList:mHeaderRightList];
|
||||
mSettings->SetHeaderStrRight(NS_ConvertUTF8toUTF16(headerFooterStr).get());
|
||||
|
||||
headerFooterStr = [self headerFooterStringForList:mFooterLeftList];
|
||||
mSettings->SetFooterStrLeft(NS_ConvertUTF8toUTF16(headerFooterStr).get());
|
||||
|
||||
headerFooterStr = [self headerFooterStringForList:mFooterCenterList];
|
||||
mSettings->SetFooterStrCenter(NS_ConvertUTF8toUTF16(headerFooterStr).get());
|
||||
|
||||
headerFooterStr = [self headerFooterStringForList:mFooterRightList];
|
||||
mSettings->SetFooterStrRight(NS_ConvertUTF8toUTF16(headerFooterStr).get());
|
||||
}
|
||||
|
||||
// Summary
|
||||
|
||||
- (NSString*)summaryValueForCheckbox:(NSButton*)aCheckbox
|
||||
{
|
||||
if (![aCheckbox isEnabled])
|
||||
return [self localizedString:"summaryNAValue"];
|
||||
|
||||
return [aCheckbox state] == NSOnState ?
|
||||
[self localizedString:"summaryOnValue"] :
|
||||
[self localizedString:"summaryOffValue"];
|
||||
}
|
||||
|
||||
- (NSString*)framesSummaryValue
|
||||
{
|
||||
switch([self chosenFrameSetting]) {
|
||||
case nsIPrintSettings::kFramesAsIs:
|
||||
return [self localizedString:"asLaidOut"];
|
||||
case nsIPrintSettings::kSelectedFrame:
|
||||
return [self localizedString:"selectedFrame"];
|
||||
case nsIPrintSettings::kEachFrameSep:
|
||||
return [self localizedString:"separateFrames"];
|
||||
}
|
||||
return [self localizedString:"summaryNAValue"];
|
||||
}
|
||||
|
||||
- (NSString*)headerSummaryValue
|
||||
{
|
||||
return [[mHeaderLeftList titleOfSelectedItem] stringByAppendingString:
|
||||
[@", " stringByAppendingString:
|
||||
[[mHeaderCenterList titleOfSelectedItem] stringByAppendingString:
|
||||
[@", " stringByAppendingString:
|
||||
[mHeaderRightList titleOfSelectedItem]]]]];
|
||||
}
|
||||
|
||||
- (NSString*)footerSummaryValue
|
||||
{
|
||||
return [[mFooterLeftList titleOfSelectedItem] stringByAppendingString:
|
||||
[@", " stringByAppendingString:
|
||||
[[mFooterCenterList titleOfSelectedItem] stringByAppendingString:
|
||||
[@", " stringByAppendingString:
|
||||
[mFooterRightList titleOfSelectedItem]]]]];
|
||||
}
|
||||
|
||||
#ifdef NS_LEOPARD_AND_LATER
|
||||
- (NSArray*)localizedSummaryItems
|
||||
{
|
||||
return [NSArray arrayWithObjects:
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[self localizedString:"summaryFramesTitle"], NSPrintPanelAccessorySummaryItemNameKey,
|
||||
[self framesSummaryValue], NSPrintPanelAccessorySummaryItemDescriptionKey, nil],
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[self localizedString:"summarySelectionOnlyTitle"], NSPrintPanelAccessorySummaryItemNameKey,
|
||||
[self summaryValueForCheckbox:mPrintSelectionOnlyCheckbox], NSPrintPanelAccessorySummaryItemDescriptionKey, nil],
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[self localizedString:"summaryShrinkToFitTitle"], NSPrintPanelAccessorySummaryItemNameKey,
|
||||
[self summaryValueForCheckbox:mShrinkToFitCheckbox], NSPrintPanelAccessorySummaryItemDescriptionKey, nil],
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[self localizedString:"summaryPrintBGColorsTitle"], NSPrintPanelAccessorySummaryItemNameKey,
|
||||
[self summaryValueForCheckbox:mPrintBGColorsCheckbox], NSPrintPanelAccessorySummaryItemDescriptionKey, nil],
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[self localizedString:"summaryPrintBGImagesTitle"], NSPrintPanelAccessorySummaryItemNameKey,
|
||||
[self summaryValueForCheckbox:mPrintBGImagesCheckbox], NSPrintPanelAccessorySummaryItemDescriptionKey, nil],
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[self localizedString:"summaryHeaderTitle"], NSPrintPanelAccessorySummaryItemNameKey,
|
||||
[self headerSummaryValue], NSPrintPanelAccessorySummaryItemDescriptionKey, nil],
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[self localizedString:"summaryFooterTitle"], NSPrintPanelAccessorySummaryItemNameKey,
|
||||
[self footerSummaryValue], NSPrintPanelAccessorySummaryItemDescriptionKey, nil],
|
||||
nil];
|
||||
}
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
// Accessory controller
|
||||
|
||||
@implementation PrintPanelAccessoryController
|
||||
|
||||
- (id)initWithSettings:(nsIPrintSettings*)aSettings
|
||||
{
|
||||
#ifdef NS_LEOPARD_AND_LATER
|
||||
[super initWithNibName:nil bundle:nil];
|
||||
#else
|
||||
[super init];
|
||||
#endif
|
||||
NSView* accView = [[PrintPanelAccessoryView alloc] initWithSettings:aSettings];
|
||||
[self setView:accView];
|
||||
[accView release];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)exportSettings
|
||||
{
|
||||
return [(PrintPanelAccessoryView*)[self view] exportSettings];
|
||||
}
|
||||
|
||||
#ifdef NS_LEOPARD_AND_LATER
|
||||
- (NSArray *)localizedSummaryItems
|
||||
{
|
||||
return [(PrintPanelAccessoryView*)[self view] localizedSummaryItems];
|
||||
}
|
||||
#else
|
||||
- (void)setView:(NSView*)aView
|
||||
{
|
||||
mView = [aView retain];
|
||||
}
|
||||
|
||||
- (NSView*)view
|
||||
{
|
||||
return mView;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[mView release];
|
||||
[super dealloc];
|
||||
}
|
||||
#endif
|
||||
|
||||
@end
|
@ -46,9 +46,6 @@ class nsPrintOptionsX : public nsPrintOptions
|
||||
public:
|
||||
nsPrintOptionsX();
|
||||
virtual ~nsPrintOptionsX();
|
||||
NS_IMETHOD ShowPrintSetupDialog(nsIPrintSettings *aThePrintSettings);
|
||||
NS_IMETHOD GetNativeData(PRInt16 aDataType, void * *_retval);
|
||||
|
||||
protected:
|
||||
nsresult _CreatePrintSettings(nsIPrintSettings **_retval);
|
||||
nsresult ReadPrefs(nsIPrintSettings* aPS, const nsAString& aPrinterName, PRUint32 aFlags);
|
||||
|
@ -41,10 +41,6 @@
|
||||
#include "nsPrintOptionsX.h"
|
||||
#include "nsPrintSettingsX.h"
|
||||
|
||||
#include "nsCRT.h"
|
||||
#include "plbase64.h"
|
||||
#include "prmem.h"
|
||||
|
||||
nsPrintOptionsX::nsPrintOptionsX()
|
||||
{
|
||||
}
|
||||
@ -53,21 +49,6 @@ nsPrintOptionsX::~nsPrintOptionsX()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPrintOptionsX::ShowPrintSetupDialog(nsIPrintSettings *aThePrintSettings)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPrintOptionsX::GetNativeData(PRInt16 aDataType, void **_retval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
*_retval = nsnull;
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPrintOptionsX::ReadPrefs(nsIPrintSettings* aPS, const nsAString& aPrinterName, PRUint32 aFlags)
|
||||
{
|
||||
@ -76,13 +57,13 @@ nsPrintOptionsX::ReadPrefs(nsIPrintSettings* aPS, const nsAString& aPrinterName,
|
||||
rv = nsPrintOptions::ReadPrefs(aPS, aPrinterName, aFlags);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "nsPrintOptions::ReadPrefs() failed");
|
||||
|
||||
nsCOMPtr<nsIPrintSettingsX> printSettingsX(do_QueryInterface(aPS));
|
||||
nsCOMPtr<nsPrintSettingsX> printSettingsX(do_QueryInterface(aPS));
|
||||
if (!printSettingsX)
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
rv = printSettingsX->ReadPageFormatFromPrefs();
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "nsIPrintSettingsX::ReadPageFormatFromPrefs() failed");
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "nsPrintSettingsX::ReadPageFormatFromPrefs() failed");
|
||||
|
||||
return NS_OK;
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsPrintOptionsX::_CreatePrintSettings(nsIPrintSettings **_retval)
|
||||
@ -112,11 +93,11 @@ nsPrintOptionsX::WritePrefs(nsIPrintSettings* aPS, const nsAString& aPrinterName
|
||||
rv = nsPrintOptions::WritePrefs(aPS, aPrinterName, aFlags);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "nsPrintOptions::WritePrefs() failed");
|
||||
|
||||
nsCOMPtr<nsIPrintSettingsX> printSettingsX(do_QueryInterface(aPS));
|
||||
nsCOMPtr<nsPrintSettingsX> printSettingsX(do_QueryInterface(aPS));
|
||||
if (!printSettingsX)
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
rv = printSettingsX->WritePageFormatToPrefs();
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "nsIPrintSettingsX::WritePageFormatToPrefs() failed");
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "nsPrintSettingsX::WritePageFormatToPrefs() failed");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1,61 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Conrad Carlen <ccarlen@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsPrintSessionX_h_
|
||||
#define nsPrintSessionX_h_
|
||||
|
||||
#include "nsPrintSession.h"
|
||||
#include "nsIPrintSessionX.h"
|
||||
|
||||
class nsPrintSessionX : public nsPrintSession,
|
||||
public nsIPrintSessionX
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIPRINTSESSIONX
|
||||
|
||||
nsPrintSessionX();
|
||||
virtual ~nsPrintSessionX();
|
||||
|
||||
nsresult Init();
|
||||
|
||||
protected:
|
||||
PMPrintSession mSession;
|
||||
};
|
||||
|
||||
#endif // nsPrintSessionX_h_
|
@ -1,89 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Conrad Carlen <ccarlen@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsPrintSessionX.h"
|
||||
#include "nsObjCExceptions.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsPrintSessionX,
|
||||
nsPrintSession,
|
||||
nsIPrintSessionX)
|
||||
|
||||
nsPrintSessionX::nsPrintSessionX()
|
||||
{
|
||||
}
|
||||
|
||||
nsPrintSessionX::~nsPrintSessionX()
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
if (mSession) {
|
||||
::PMRelease(mSession);
|
||||
mSession = nsnull;
|
||||
}
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
nsresult nsPrintSessionX::Init()
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
nsresult rv = nsPrintSession::Init();
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
OSStatus status = ::PMCreateSession(&mSession);
|
||||
if (status != noErr)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return NS_OK;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPrintSessionX::GetNativeSession(PMPrintSession *aNativeSession)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aNativeSession);
|
||||
*aNativeSession = nsnull;
|
||||
|
||||
if (!mSession)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
*aNativeSession = mSession;
|
||||
return NS_OK;
|
||||
}
|
@ -39,19 +39,25 @@
|
||||
#define nsPrintSettingsX_h_
|
||||
|
||||
#include "nsPrintSettingsImpl.h"
|
||||
#include "nsIPrintSettingsX.h"
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
class nsPrintSettingsX : public nsPrintSettings,
|
||||
public nsIPrintSettingsX
|
||||
class nsPrintSettingsX : public nsPrintSettings
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIPRINTSETTINGSX
|
||||
|
||||
nsPrintSettingsX();
|
||||
virtual ~nsPrintSettingsX();
|
||||
|
||||
nsresult Init();
|
||||
NSPrintInfo* GetCocoaPrintInfo() { return mPrintInfo; }
|
||||
void SetCocoaPrintInfo(NSPrintInfo* aPrintInfo);
|
||||
virtual nsresult ReadPageFormatFromPrefs();
|
||||
virtual nsresult WritePageFormatToPrefs();
|
||||
|
||||
PMPrintSettings GetPMPrintSettings();
|
||||
PMPrintSession GetPMPrintSession();
|
||||
PMPageFormat GetPMPageFormat();
|
||||
void SetPMPageFormat(PMPageFormat aPageFormat);
|
||||
|
||||
protected:
|
||||
nsPrintSettingsX(const nsPrintSettingsX& src);
|
||||
@ -68,8 +74,7 @@ protected:
|
||||
OSStatus CreateDefaultPageFormat(PMPrintSession aSession, PMPageFormat& outFormat);
|
||||
OSStatus CreateDefaultPrintSettings(PMPrintSession aSession, PMPrintSettings& outSettings);
|
||||
|
||||
PMPageFormat mPageFormat;
|
||||
PMPrintSettings mPrintSettings;
|
||||
NSPrintInfo* mPrintInfo;
|
||||
};
|
||||
|
||||
#endif // nsPrintSettingsX_h_
|
||||
|
@ -21,6 +21,7 @@
|
||||
*
|
||||
* Contributor(s):
|
||||
* Conrad Carlen <ccarlen@netscape.com>
|
||||
* Markus Stange <mstange@themasta.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
@ -38,111 +39,31 @@
|
||||
|
||||
#include "nsPrintSettingsX.h"
|
||||
#include "nsObjCExceptions.h"
|
||||
#include "nsIPrintSessionX.h"
|
||||
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
#include "plbase64.h"
|
||||
#include "prmem.h"
|
||||
#include "prnetdb.h"
|
||||
#include "plstr.h"
|
||||
|
||||
#include "nsCocoaWindow.h"
|
||||
#include "nsMenuBarX.h"
|
||||
#include "nsMenuUtilsX.h"
|
||||
|
||||
// This struct should be represented identically on all architectures, and
|
||||
// there shouldn't be any padding before the data field.
|
||||
struct FrozenHandle {
|
||||
PRUint32 size;
|
||||
char data[0];
|
||||
};
|
||||
#include "nsCocoaUtils.h"
|
||||
|
||||
#define PRINTING_PREF_BRANCH "print."
|
||||
#define MAC_OS_X_PAGE_SETUP_PREFNAME "macosx.pagesetup-2"
|
||||
|
||||
// Utility class stack-based handle ownership
|
||||
class StHandleOwner
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsPrintSettingsX, nsPrintSettings, nsPrintSettingsX)
|
||||
|
||||
nsPrintSettingsX::nsPrintSettingsX()
|
||||
{
|
||||
public:
|
||||
StHandleOwner(Handle inHandle)
|
||||
: mHandle(inHandle)
|
||||
{
|
||||
}
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
~StHandleOwner()
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
mPrintInfo = [[NSPrintInfo sharedPrintInfo] copy];
|
||||
|
||||
if (mHandle)
|
||||
::DisposeHandle(mHandle);
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
Handle GetHandle() { return mHandle; }
|
||||
|
||||
void ClearHandle(Boolean disposeIt = false)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
if (disposeIt)
|
||||
::DisposeHandle(mHandle);
|
||||
|
||||
mHandle = nsnull;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
protected:
|
||||
Handle mHandle;
|
||||
};
|
||||
|
||||
// Utility class for saving, locking, and restoring handle state.
|
||||
// Ok with null handle.
|
||||
class StHandleLocker
|
||||
{
|
||||
public:
|
||||
StHandleLocker(Handle theHandle)
|
||||
: mHandle(theHandle)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
if (mHandle) {
|
||||
mOldHandleState = ::HGetState(mHandle);
|
||||
::HLock(mHandle);
|
||||
}
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
~StHandleLocker()
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
if (mHandle)
|
||||
::HSetState(mHandle, mOldHandleState);
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
protected:
|
||||
Handle mHandle;
|
||||
SInt8 mOldHandleState;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsPrintSettingsX, nsPrintSettings, nsIPrintSettingsX)
|
||||
|
||||
nsPrintSettingsX::nsPrintSettingsX() :
|
||||
mPageFormat(kPMNoPageFormat),
|
||||
mPrintSettings(kPMNoPrintSettings)
|
||||
{
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
nsPrintSettingsX::nsPrintSettingsX(const nsPrintSettingsX& src) :
|
||||
mPageFormat(kPMNoPageFormat),
|
||||
mPrintSettings(kPMNoPrintSettings)
|
||||
nsPrintSettingsX::nsPrintSettingsX(const nsPrintSettingsX& src)
|
||||
{
|
||||
*this = src;
|
||||
}
|
||||
@ -151,14 +72,7 @@ nsPrintSettingsX::~nsPrintSettingsX()
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
if (mPageFormat != kPMNoPageFormat) {
|
||||
::PMRelease(mPageFormat);
|
||||
mPageFormat = kPMNoPageFormat;
|
||||
}
|
||||
if (mPrintSettings != kPMNoPrintSettings) {
|
||||
::PMRelease(mPrintSettings);
|
||||
mPrintSettings = kPMNoPrintSettings;
|
||||
}
|
||||
[mPrintInfo release];
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
@ -173,43 +87,8 @@ nsPrintSettingsX& nsPrintSettingsX::operator=(const nsPrintSettingsX& rhs)
|
||||
|
||||
nsPrintSettings::operator=(rhs);
|
||||
|
||||
OSStatus status;
|
||||
|
||||
if (mPageFormat != kPMNoPageFormat) {
|
||||
::PMRelease(mPageFormat);
|
||||
mPageFormat = kPMNoPageFormat;
|
||||
}
|
||||
if (rhs.mPageFormat != kPMNoPageFormat) {
|
||||
PMPageFormat pageFormat;
|
||||
status = ::PMCreatePageFormat(&pageFormat);
|
||||
if (status == noErr) {
|
||||
status = ::PMCopyPageFormat(rhs.mPageFormat, pageFormat);
|
||||
if (status == noErr) {
|
||||
mPageFormat = pageFormat;
|
||||
// NOTE: No need to re-initialize mUnwriteableMargin here (even
|
||||
// though mPageFormat is changing). It'll be copied correctly by
|
||||
// nsPrintSettings::operator=.
|
||||
} else {
|
||||
::PMRelease(pageFormat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mPrintSettings != kPMNoPrintSettings) {
|
||||
::PMRelease(mPrintSettings);
|
||||
mPrintSettings = kPMNoPrintSettings;
|
||||
}
|
||||
if (rhs.mPrintSettings != kPMNoPrintSettings) {
|
||||
PMPrintSettings printSettings;
|
||||
status = ::PMCreatePrintSettings(&printSettings);
|
||||
if (status == noErr) {
|
||||
status = ::PMCopyPrintSettings(rhs.mPrintSettings, printSettings);
|
||||
if (status == noErr)
|
||||
mPrintSettings = printSettings;
|
||||
else
|
||||
::PMRelease(printSettings);
|
||||
}
|
||||
}
|
||||
[mPrintInfo release];
|
||||
mPrintInfo = [rhs.mPrintInfo copy];
|
||||
|
||||
return *this;
|
||||
|
||||
@ -220,40 +99,22 @@ nsresult nsPrintSettingsX::Init()
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
OSStatus status;
|
||||
InitUnwriteableMargin();
|
||||
|
||||
PMPrintSession printSession = NULL;
|
||||
status = ::PMCreateSession(&printSession);
|
||||
|
||||
if (status == noErr) {
|
||||
// First, create a default page format
|
||||
status = CreateDefaultPageFormat(printSession, mPageFormat);
|
||||
InitUnwriteableMargin();
|
||||
|
||||
// Then, if no error, create the default print settings
|
||||
if (status == noErr) {
|
||||
status = CreateDefaultPrintSettings(printSession, mPrintSettings);
|
||||
}
|
||||
OSStatus tempStatus = ::PMRelease(printSession);
|
||||
if (status == noErr)
|
||||
status = tempStatus;
|
||||
}
|
||||
return (status == noErr) ? NS_OK : NS_ERROR_FAILURE;
|
||||
return NS_OK;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
}
|
||||
|
||||
// Should be called whenever mPageFormat changes.
|
||||
// Should be called whenever the page format changes.
|
||||
NS_IMETHODIMP nsPrintSettingsX::InitUnwriteableMargin()
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
if (mPageFormat == kPMNoPageFormat)
|
||||
return NS_OK;
|
||||
|
||||
PMPaper paper;
|
||||
PMPaperMargins paperMargin;
|
||||
::PMGetPageFormatPaper(mPageFormat, &paper);
|
||||
PMPageFormat pageFormat = GetPMPageFormat();
|
||||
::PMGetPageFormatPaper(pageFormat, &paper);
|
||||
::PMPaperGetMargins(paper, &paperMargin);
|
||||
mUnwriteableMargin.top = NS_POINTS_TO_TWIPS(paperMargin.top);
|
||||
mUnwriteableMargin.left = NS_POINTS_TO_TWIPS(paperMargin.left);
|
||||
@ -265,78 +126,10 @@ NS_IMETHODIMP nsPrintSettingsX::InitUnwriteableMargin()
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPrintSettingsX::GetNativePrintSession(PMPrintSession *aNativePrintSession)
|
||||
void
|
||||
nsPrintSettingsX::SetCocoaPrintInfo(NSPrintInfo* aPrintInfo)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aNativePrintSession);
|
||||
*aNativePrintSession = nsnull;
|
||||
|
||||
nsCOMPtr<nsIPrintSession> printSession;
|
||||
GetPrintSession(getter_AddRefs(printSession));
|
||||
if (!printSession)
|
||||
return NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIPrintSessionX> printSessionX(do_QueryInterface(printSession));
|
||||
if (!printSession)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return printSessionX->GetNativeSession(aNativePrintSession);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPrintSettingsX::GetPMPageFormat(PMPageFormat *aPMPageFormat)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPMPageFormat);
|
||||
*aPMPageFormat = kPMNoPageFormat;
|
||||
NS_ENSURE_STATE(mPageFormat != kPMNoPageFormat);
|
||||
|
||||
*aPMPageFormat = mPageFormat;
|
||||
OSStatus status = noErr;
|
||||
|
||||
return (status == noErr) ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPrintSettingsX::SetPMPageFormat(PMPageFormat aPMPageFormat)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
NS_ENSURE_ARG(aPMPageFormat);
|
||||
|
||||
OSStatus status = ::PMRetain(aPMPageFormat);
|
||||
if (status == noErr) {
|
||||
if (mPageFormat)
|
||||
status = ::PMRelease(mPageFormat);
|
||||
mPageFormat = aPMPageFormat;
|
||||
InitUnwriteableMargin();
|
||||
}
|
||||
return (status == noErr) ? NS_OK : NS_ERROR_FAILURE;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPrintSettingsX::GetPMPrintSettings(PMPrintSettings *aPMPrintSettings)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPMPrintSettings);
|
||||
*aPMPrintSettings = kPMNoPrintSettings;
|
||||
NS_ENSURE_STATE(mPrintSettings != kPMNoPrintSettings);
|
||||
|
||||
*aPMPrintSettings = mPrintSettings;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPrintSettingsX::SetPMPrintSettings(PMPrintSettings aPMPrintSettings)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
NS_ENSURE_ARG(aPMPrintSettings);
|
||||
|
||||
OSStatus status = ::PMRetain(aPMPrintSettings);
|
||||
if (status == noErr) {
|
||||
if (mPrintSettings)
|
||||
status = ::PMRelease(mPrintSettings);
|
||||
mPrintSettings = aPMPrintSettings;
|
||||
}
|
||||
return (status == noErr) ? NS_OK : NS_ERROR_FAILURE;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
mPrintInfo = aPrintInfo;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPrintSettingsX::ReadPageFormatFromPrefs()
|
||||
@ -352,52 +145,29 @@ NS_IMETHODIMP nsPrintSettingsX::ReadPageFormatFromPrefs()
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsXPIDLCString encodedData;
|
||||
nsXPIDLCString encodedData;
|
||||
rv = prefBranch->GetCharPref(MAC_OS_X_PAGE_SETUP_PREFNAME, getter_Copies(encodedData));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
// decode the base64
|
||||
PRInt32 encodedDataLen = encodedData.Length();
|
||||
FrozenHandle* frozenHandle =
|
||||
(FrozenHandle*)::PL_Base64Decode(encodedData.get(), encodedDataLen, nsnull);
|
||||
if (!frozenHandle)
|
||||
char* decodedData = PL_Base64Decode(encodedData.get(), encodedData.Length(), nsnull);
|
||||
NSData* data = [NSData dataWithBytes:decodedData length:PL_strlen(decodedData)];
|
||||
if (!data)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PRUint32 handleSize = PR_ntohl(frozenHandle->size);
|
||||
|
||||
// Ensure that the length reported in the frozen handle agrees with the
|
||||
// amount of decoded data. At most 3 bytes of data map to 4 bytes when
|
||||
// base64-encoded.
|
||||
PRUint32 maximumDataSize = (encodedDataLen * 3) / 4 - sizeof(FrozenHandle);
|
||||
PRUint32 minimumDataSize = maximumDataSize - 2;
|
||||
if (handleSize > maximumDataSize || handleSize < minimumDataSize) {
|
||||
free(frozenHandle);
|
||||
return NS_ERROR_FAILURE;
|
||||
PMPageFormat newPageFormat;
|
||||
#ifdef NS_LEOPARD_AND_LATER
|
||||
OSStatus status = ::PMPageFormatCreateWithDataRepresentation((CFDataRef)data, &newPageFormat);
|
||||
#else
|
||||
OSStatus status = ::PMUnflattenPageFormatWithCFData((CFDataRef)data, &newPageFormat);
|
||||
#endif
|
||||
if (status == noErr) {
|
||||
SetPMPageFormat(newPageFormat);
|
||||
}
|
||||
InitUnwriteableMargin();
|
||||
|
||||
Handle decodedDataHandle = nsnull;
|
||||
OSErr err = ::PtrToHand(frozenHandle->data, &decodedDataHandle, handleSize);
|
||||
free(frozenHandle);
|
||||
if (err != noErr)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
StHandleOwner handleOwner(decodedDataHandle);
|
||||
|
||||
OSStatus status;
|
||||
PMPageFormat newPageFormat = kPMNoPageFormat;
|
||||
|
||||
status = ::PMCreatePageFormat(&newPageFormat);
|
||||
if (status == noErr) {
|
||||
status = ::PMUnflattenPageFormat(decodedDataHandle, &newPageFormat);
|
||||
if (status == noErr) {
|
||||
if (mPageFormat)
|
||||
status = ::PMRelease(mPageFormat);
|
||||
mPageFormat = newPageFormat; // PMCreatePageFormat returned it with a refcnt of 1
|
||||
InitUnwriteableMargin();
|
||||
}
|
||||
}
|
||||
return (status == noErr) ? NS_OK : NS_ERROR_FAILURE;
|
||||
return NS_OK;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
}
|
||||
@ -406,9 +176,10 @@ NS_IMETHODIMP nsPrintSettingsX::WritePageFormatToPrefs()
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
if (mPageFormat == kPMNoPageFormat)
|
||||
PMPageFormat pageFormat = GetPMPageFormat();
|
||||
if (pageFormat == kPMNoPageFormat)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPrefService> prefService(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||
if (NS_FAILED(rv))
|
||||
@ -418,32 +189,17 @@ NS_IMETHODIMP nsPrintSettingsX::WritePageFormatToPrefs()
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
Handle pageFormatHandle = nsnull;
|
||||
OSStatus err = ::PMFlattenPageFormat(mPageFormat, &pageFormatHandle);
|
||||
NSData* data = nil;
|
||||
#ifdef NS_LEOPARD_AND_LATER
|
||||
OSStatus err = ::PMPageFormatCreateDataRepresentation(pageFormat, (CFDataRef*)&data, kPMDataFormatXMLDefault);
|
||||
#else
|
||||
OSStatus err = ::PMFlattenPageFormatToCFData(pageFormat, (CFDataRef*)&data);
|
||||
#endif
|
||||
if (err != noErr)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
StHandleOwner handleOwner(pageFormatHandle);
|
||||
StHandleLocker handleLocker(pageFormatHandle);
|
||||
|
||||
// Save the handle in a struct that identifies the data length and
|
||||
// the data itself, and wrap it all up in base64. The length must be
|
||||
// included because PL_DecodeBase64 doesn't return the size of the
|
||||
// decoded data, and the handle will need to be reconstructed later with
|
||||
// the correct size.
|
||||
PRUint32 dataSize = ::GetHandleSize(pageFormatHandle);
|
||||
PRUint32 frozenDataSize = sizeof(FrozenHandle) + dataSize;
|
||||
FrozenHandle* frozenHandle = (FrozenHandle*)malloc(frozenDataSize);
|
||||
if (!frozenHandle)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
frozenHandle->size = PR_htonl(dataSize);
|
||||
memcpy(&frozenHandle->data, *pageFormatHandle, dataSize);
|
||||
|
||||
nsXPIDLCString encodedData;
|
||||
encodedData.Adopt(::PL_Base64Encode((char*)frozenHandle, frozenDataSize,
|
||||
nsnull));
|
||||
free(frozenHandle);
|
||||
nsXPIDLCString encodedData;
|
||||
encodedData.Adopt(PL_Base64Encode((char*)[data bytes], [data length], nsnull));
|
||||
if (!encodedData.get())
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
@ -474,60 +230,85 @@ NS_IMETHODIMP nsPrintSettingsX::_Assign(nsIPrintSettings *aPS)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
OSStatus nsPrintSettingsX::CreateDefaultPageFormat(PMPrintSession aSession, PMPageFormat& outFormat)
|
||||
// The methods below provide wrappers for the different ways of accessing the
|
||||
// Core Printing PM* objects from the NSPrintInfo object. On 10.4 we need to
|
||||
// use secret methods which have been made public in 10.5 with slightly
|
||||
// different names.
|
||||
|
||||
// Secret 10.4 methods (from Appkit class dump):
|
||||
@interface NSPrintInfo (NSTemporaryCompatibility)
|
||||
- (struct OpaquePMPrintSession *)_pmPrintSession;
|
||||
- (void)setPMPageFormat:(struct OpaquePMPageFormat *)arg1;
|
||||
- (struct OpaquePMPageFormat *)pmPageFormat;
|
||||
- (void)setPMPrintSettings:(struct OpaquePMPrintSettings *)arg1;
|
||||
- (struct OpaquePMPrintSettings *)pmPrintSettings;
|
||||
@end
|
||||
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
|
||||
// Official 10.5+ methods:
|
||||
@interface NSPrintInfo (OfficialPMAccessors)
|
||||
- (void*)PMPageFormat;
|
||||
- (void*)PMPrintSession;
|
||||
- (void*)PMPrintSettings;
|
||||
- (void)updateFromPMPageFormat;
|
||||
- (void)updateFromPMPrintSettings;
|
||||
@end
|
||||
#endif
|
||||
|
||||
PMPrintSettings
|
||||
nsPrintSettingsX::GetPMPrintSettings()
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
|
||||
if ([mPrintInfo respondsToSelector:@selector(PMPrintSettings)])
|
||||
return static_cast<PMPrintSettings>([mPrintInfo PMPrintSettings]); // 10.5+
|
||||
|
||||
OSStatus status;
|
||||
PMPageFormat pageFormat;
|
||||
|
||||
outFormat = kPMNoPageFormat;
|
||||
status = ::PMCreatePageFormat(&pageFormat);
|
||||
if (status == noErr && pageFormat != kPMNoPageFormat) {
|
||||
status = ::PMSessionDefaultPageFormat(aSession, pageFormat);
|
||||
if (status == noErr) {
|
||||
outFormat = pageFormat;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
return status;
|
||||
if ([mPrintInfo respondsToSelector:@selector(pmPrintSettings)])
|
||||
return static_cast<PMPrintSettings>([mPrintInfo pmPrintSettings]); // 10.4
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(noErr);
|
||||
}
|
||||
|
||||
OSStatus nsPrintSettingsX::CreateDefaultPrintSettings(PMPrintSession aSession, PMPrintSettings& outSettings)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
|
||||
|
||||
OSStatus status;
|
||||
NS_ASSERTION(PR_FALSE, "no way of getting PMPrintSettings from NSPrintInfo");
|
||||
PMPrintSettings printSettings;
|
||||
|
||||
outSettings = kPMNoPrintSettings;
|
||||
status = ::PMCreatePrintSettings(&printSettings);
|
||||
if (status == noErr && printSettings != kPMNoPrintSettings) {
|
||||
status = ::PMSessionDefaultPrintSettings(aSession, printSettings);
|
||||
if (status == noErr) {
|
||||
outSettings = printSettings;
|
||||
return noErr;
|
||||
}
|
||||
}
|
||||
return status;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(noErr);
|
||||
PMCreatePrintSettings(&printSettings);
|
||||
return printSettings;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPrintSettingsX::CleanUpAfterCarbonDialog()
|
||||
PMPrintSession
|
||||
nsPrintSettingsX::GetPMPrintSession()
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
if ([mPrintInfo respondsToSelector:@selector(PMPrintSession)])
|
||||
return static_cast<PMPrintSession>([mPrintInfo PMPrintSession]); // 10.5+
|
||||
|
||||
NSWindow* mainWindow = [NSApp mainWindow];
|
||||
if (mainWindow) {
|
||||
[WindowDelegate paintMenubarForWindow:mainWindow];
|
||||
} else {
|
||||
nsMenuBarX* hiddenWindowMenuBar = nsMenuUtilsX::GetHiddenWindowMenuBar();
|
||||
if (hiddenWindowMenuBar)
|
||||
hiddenWindowMenuBar->Paint();
|
||||
}
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
if ([mPrintInfo respondsToSelector:@selector(_pmPrintSession)])
|
||||
return static_cast<PMPrintSession>([mPrintInfo _pmPrintSession]); // 10.4
|
||||
|
||||
NS_ASSERTION(PR_FALSE, "no way of getting PMPrintSession from NSPrintInfo");
|
||||
PMPrintSession printSession;
|
||||
PMCreateSession(&printSession);
|
||||
return printSession;
|
||||
}
|
||||
|
||||
PMPageFormat
|
||||
nsPrintSettingsX::GetPMPageFormat()
|
||||
{
|
||||
if ([mPrintInfo respondsToSelector:@selector(PMPageFormat)])
|
||||
return static_cast<PMPageFormat>([mPrintInfo PMPageFormat]); // 10.5+
|
||||
|
||||
if ([mPrintInfo respondsToSelector:@selector(pmPageFormat)])
|
||||
return static_cast<PMPageFormat>([mPrintInfo pmPageFormat]); // 10.4
|
||||
|
||||
NS_ASSERTION(PR_FALSE, "no way of getting PMPageFormat from NSPrintInfo");
|
||||
PMPageFormat pageFormat;
|
||||
PMCreatePageFormat(&pageFormat);
|
||||
return pageFormat;
|
||||
}
|
||||
|
||||
void
|
||||
nsPrintSettingsX::SetPMPageFormat(PMPageFormat aPageFormat)
|
||||
{
|
||||
PMPageFormat oldPageFormat = GetPMPageFormat();
|
||||
::PMCopyPageFormat(aPageFormat, oldPageFormat);
|
||||
if ([mPrintInfo respondsToSelector:@selector(updateFromPMPageFormat)]) {
|
||||
[mPrintInfo updateFromPMPageFormat]; // 10.5+
|
||||
} else if ([mPrintInfo respondsToSelector:@selector(setPMPageFormat:)]) {
|
||||
[mPrintInfo setPMPageFormat:oldPageFormat]; // 10.4
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,8 @@
|
||||
#include "nsScreenManagerCocoa.h"
|
||||
#include "nsDeviceContextSpecX.h"
|
||||
#include "nsPrintOptionsX.h"
|
||||
#include "nsPrintSessionX.h"
|
||||
#include "nsPrintDialogX.h"
|
||||
#include "nsPrintSession.h"
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCocoaWindow)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsChildView)
|
||||
@ -81,7 +82,8 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragService)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsScreenManagerCocoa)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecX)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintOptionsX, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSessionX, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintDialogServiceX, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSession, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsIdleServiceX)
|
||||
|
||||
#include "nsMenuBarX.h"
|
||||
@ -167,14 +169,18 @@ static const nsModuleComponentInfo gComponents[] =
|
||||
NS_DEVICE_CONTEXT_SPEC_CID,
|
||||
"@mozilla.org/gfx/devicecontextspec;1",
|
||||
nsDeviceContextSpecXConstructor },
|
||||
{ "Print Session",
|
||||
NS_PRINTSESSION_CID,
|
||||
"@mozilla.org/gfx/printsession;1",
|
||||
nsPrintSessionConstructor },
|
||||
{ "PrintSettings Service",
|
||||
NS_PRINTSETTINGSSERVICE_CID,
|
||||
"@mozilla.org/gfx/printsettings-service;1",
|
||||
nsPrintOptionsXConstructor },
|
||||
{ "Print Session",
|
||||
NS_PRINTSESSION_CID,
|
||||
"@mozilla.org/gfx/printsession;1",
|
||||
nsPrintSessionXConstructor },
|
||||
{ "Native Print Dialog",
|
||||
NS_PRINTDIALOGSERVICE_CID,
|
||||
NS_PRINTDIALOGSERVICE_CONTRACTID,
|
||||
nsPrintDialogServiceXConstructor },
|
||||
{ "User Idle Service",
|
||||
NS_IDLE_SERVICE_CID,
|
||||
"@mozilla.org/widget/idleservice;1",
|
||||
|
@ -135,7 +135,7 @@ ShowCustomDialog(GtkComboBox *changed_box, gpointer user_data)
|
||||
do_GetService(NS_STRINGBUNDLE_CONTRACTID);
|
||||
|
||||
nsCOMPtr<nsIStringBundle> printBundle;
|
||||
bundleSvc->CreateBundle("chrome://global/locale/gnomeprintdialog.properties", getter_AddRefs(printBundle));
|
||||
bundleSvc->CreateBundle("chrome://global/locale/printdialog.properties", getter_AddRefs(printBundle));
|
||||
nsXPIDLString intlString;
|
||||
|
||||
printBundle->GetStringFromName(NS_LITERAL_STRING("headerFooterCustom").get(), getter_Copies(intlString));
|
||||
@ -230,9 +230,9 @@ nsPrintDialogWidgetGTK::nsPrintDialogWidgetGTK(nsIDOMWindow *aParent, nsIPrintSe
|
||||
NS_ASSERTION(gtkParent, "Need a GTK window for dialog to be modal.");
|
||||
|
||||
nsCOMPtr<nsIStringBundleService> bundleSvc = do_GetService(NS_STRINGBUNDLE_CONTRACTID);
|
||||
bundleSvc->CreateBundle("chrome://global/locale/gnomeprintdialog.properties", getter_AddRefs(printBundle));
|
||||
bundleSvc->CreateBundle("chrome://global/locale/printdialog.properties", getter_AddRefs(printBundle));
|
||||
|
||||
dialog = gtk_print_unix_dialog_new(GetUTF8FromBundle("printTitle").get(), gtkParent);
|
||||
dialog = gtk_print_unix_dialog_new(GetUTF8FromBundle("printTitleGTK").get(), gtkParent);
|
||||
|
||||
gtk_print_unix_dialog_set_manual_capabilities(GTK_PRINT_UNIX_DIALOG(dialog),
|
||||
GtkPrintCapabilities(
|
||||
@ -248,7 +248,7 @@ nsPrintDialogWidgetGTK::nsPrintDialogWidgetGTK(nsIDOMWindow *aParent, nsIPrintSe
|
||||
// the set_border_width below, 12px matches that of just about every other window.
|
||||
GtkWidget* custom_options_tab = gtk_vbox_new(FALSE, 0);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(custom_options_tab), 12);
|
||||
GtkWidget* tab_label = gtk_label_new(GetUTF8FromBundle("optionsTabLabel").get());
|
||||
GtkWidget* tab_label = gtk_label_new(GetUTF8FromBundle("optionsTabLabelGTK").get());
|
||||
|
||||
PRInt16 frameUIFlag;
|
||||
aSettings->GetHowToEnableFrameUI(&frameUIFlag);
|
||||
@ -269,7 +269,7 @@ nsPrintDialogWidgetGTK::nsPrintDialogWidgetGTK(nsIDOMWindow *aParent, nsIPrintSe
|
||||
|
||||
// "Print Frames" options label, bold and center-aligned
|
||||
GtkWidget* print_frames_label = gtk_label_new(NULL);
|
||||
char* pangoMarkup = g_markup_printf_escaped("<b>%s</b>", GetUTF8FromBundle("printFramesTitle").get());
|
||||
char* pangoMarkup = g_markup_printf_escaped("<b>%s</b>", GetUTF8FromBundle("printFramesTitleGTK").get());
|
||||
gtk_label_set_markup(GTK_LABEL(print_frames_label), pangoMarkup);
|
||||
g_free(pangoMarkup);
|
||||
gtk_misc_set_alignment(GTK_MISC(print_frames_label), 0, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user