--- a/browser/app/Makefile.in
+++ b/browser/app/Makefile.in
@@ -338,18 +338,16 @@ libs repackage:: $(PROGRAM) application.
rsync -a $(DIST)/bin/ $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)
$(RM) $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)/mangle $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)/shlibsign
ifdef LIBXUL_SDK
cp $(LIBXUL_DIST)/bin/$(XR_STUB_NAME) $(DIST)/$(APP_NAME).app/Contents/MacOS/firefox-bin
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
printf APPLMOZB > $(DIST)/$(APP_NAME).app/Contents/PkgInfo
# remove CVS dirs from packaged app
find $(DIST)/$(APP_NAME).app -type d -name "CVS" -prune -exec rm -rf {} \;
else
--- a/browser/installer/removed-files.in
+++ b/browser/installer/removed-files.in
@@ -631,16 +631,22 @@ res/broken-image.gif
res/loading-image.gif
components/browsersearch.xpt
components/nsResetPref.js
plugins/Default Plugin.plugin/Contents/Info.plist
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
res/cursors/CVS/Tag
components/alerts.xpt
components/appshell.xpt
components/appstartup.xpt
components/autocomplete.xpt
deleted file mode 100644
--- a/dom/locales/en-US/chrome/printdialog.properties
+++ /dev/null
@@ -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
--- a/dom/locales/jar.mn
+++ b/dom/locales/jar.mn
@@ -9,17 +9,16 @@
locale/@AB_CD@/global/netError.dtd (%chrome/netError.dtd)
locale/@AB_CD@/global/netErrorApp.dtd (%chrome/netErrorApp.dtd)
locale/@AB_CD@/global/global.dtd (%chrome/global.dtd)
locale/@AB_CD@/global/appstrings.properties (%chrome/appstrings.properties)
locale/@AB_CD@/global/charsetTitles.properties (%chrome/charsetTitles.properties)
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
locale/@AB_CD@/global/svg/svg.properties (%chrome/svg/svg.properties)
#endif
locale/@AB_CD@/global/layout/MediaDocument.properties (%chrome/layout/MediaDocument.properties)
locale/@AB_CD@/global/layout/xmlparser.properties (%chrome/layout/xmlparser.properties)
locale/@AB_CD@/global/layout/HtmlForm.properties (%chrome/layout/HtmlForm.properties)
--- a/embedding/components/printingui/src/mac/Makefile.in
+++ b/embedding/components/printingui/src/mac/Makefile.in
@@ -42,27 +42,25 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = embedcomponents
LIBRARY_NAME = printingui_s
LIBXUL_LIBRARY = 1
-DIRS = printpde
CMMSRCS = nsPrintingPromptServiceX.mm
CPPSRCS = \
nsPrintProgressParams.cpp \
nsPrintProgress.cpp \
$(NULL)
LOCAL_INCLUDES = \
- -I$(srcdir)/printpde/public \
$(NULL)
# we don't want the shared lib, but we want to force the creation of a
# static lib.
FORCE_STATIC_LIB = 1
include $(topsrcdir)/config/rules.mk
--- a/embedding/components/printingui/src/mac/nsPrintingPromptService.h
+++ b/embedding/components/printingui/src/mac/nsPrintingPromptService.h
@@ -46,17 +46,16 @@
#include "nsCOMPtr.h"
#include "nsIPrintingPromptService.h"
#include "nsPIPromptService.h"
#include "nsIWindowWatcher.h"
// Printing Progress Includes
#include "nsPrintProgress.h"
-#include "nsPrintProgressParams.h"
#include "nsIWebProgressListener.h"
class nsIDOMWindow;
class nsIDialogParamBlock;
class nsPrintingPromptService: public nsIPrintingPromptService,
public nsIWebProgressListener
@@ -67,14 +66,12 @@ public:
nsresult Init();
NS_DECL_NSIPRINTINGPROMPTSERVICE
NS_DECL_NSIWEBPROGRESSLISTENER
NS_DECL_ISUPPORTS
private:
- nsCOMPtr<nsIWindowWatcher> mWatcher;
nsCOMPtr<nsIPrintProgress> mPrintProgress;
- nsCOMPtr<nsIWebProgressListener> mWebProgressListener;
};
#endif
--- a/embedding/components/printingui/src/mac/nsPrintingPromptServiceX.mm
+++ b/embedding/components/printingui/src/mac/nsPrintingPromptServiceX.mm
@@ -35,177 +35,30 @@
* 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 "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
//*****************************************************************************
NS_IMPL_ISUPPORTS2(nsPrintingPromptService, nsIPrintingPromptService, nsIWebProgressListener)
-nsPrintingPromptService::nsPrintingPromptService() :
- mWatcher(do_GetService(NS_WINDOWWATCHER_CONTRACTID))
+nsPrintingPromptService::nsPrintingPromptService()
{
}
nsPrintingPromptService::~nsPrintingPromptService()
{
}
nsresult nsPrintingPromptService::Init()
@@ -215,237 +68,26 @@ nsresult nsPrintingPromptService::Init()
//*****************************************************************************
// nsPrintingPromptService::nsIPrintingPromptService
//*****************************************************************************
NS_IMETHODIMP
nsPrintingPromptService::ShowPrintDialog(nsIDOMWindow *parent, nsIWebBrowserPrint *webBrowserPrint, nsIPrintSettings *printSettings)
{
- 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;
-
- 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;
- }
-
- // 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);
+ NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
- 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);
+ nsCOMPtr<nsIPrintDialogService> dlgPrint(do_GetService(
+ NS_PRINTDIALOGSERVICE_CONTRACTID));
+ if (dlgPrint)
+ return dlgPrint->Show(parent, printSettings);
- 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());
+ return NS_ERROR_FAILURE;
- 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
nsPrintingPromptService::ShowProgress(nsIDOMWindow* parent,
nsIWebBrowserPrint* webBrowserPrint, // ok to be null
nsIPrintSettings* printSettings, // ok to be null
nsIObserver* openDialogObserver, // ok to be null
PRBool isForPrinting,
@@ -455,54 +97,22 @@ nsPrintingPromptService::ShowProgress(ns
{
return NS_ERROR_NOT_IMPLEMENTED;
}
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;
}
NS_IMETHODIMP
nsPrintingPromptService::ShowPrinterProperties(nsIDOMWindow *parent, const PRUnichar *printerName, nsIPrintSettings *printSettings)
{
return NS_ERROR_NOT_IMPLEMENTED;
@@ -511,57 +121,38 @@ nsPrintingPromptService::ShowPrinterProp
//*****************************************************************************
// nsPrintingPromptService::nsIWebProgressListener
//*****************************************************************************
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;
}
/* void onProgressChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aCurSelfProgress, in long aMaxSelfProgress, in long aCurTotalProgress, in long aMaxTotalProgress); */
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;
}
/* void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI location); */
NS_IMETHODIMP
nsPrintingPromptService::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location)
{
- if (mWebProgressListener) {
- return mWebProgressListener->OnLocationChange(aWebProgress, aRequest, location);
- }
return NS_OK;
}
/* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */
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;
}
/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */
NS_IMETHODIMP
nsPrintingPromptService::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 state)
{
- if (mWebProgressListener) {
- return mWebProgressListener->OnSecurityChange(aWebProgress, aRequest, state);
- }
return NS_OK;
}
deleted file mode 100644
--- a/embedding/components/printingui/src/mac/printpde/Info-PrintPDE.plist
+++ /dev/null
@@ -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>
deleted file mode 100644
--- a/embedding/components/printingui/src/mac/printpde/Makefile.in
+++ /dev/null
@@ -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
deleted file mode 100644
--- a/embedding/components/printingui/src/mac/printpde/PrintPDE.xcode/project.pbxproj
+++ /dev/null
@@ -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;
-}
deleted file mode 100644
--- a/embedding/components/printingui/src/mac/printpde/public/nsPDECommon.h
+++ /dev/null
@@ -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
deleted file mode 100644
index e8d9b56ae01e2c715a3851e40cfd9f431854c5d7..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
--- a/embedding/components/printingui/src/mac/printpde/res/English.lproj/PrintPDE.nib/classes.nib
+++ /dev/null
@@ -1,4 +0,0 @@
-{
-IBClasses = ();
-IBVersion = 1;
-}
deleted file mode 100644
--- a/embedding/components/printingui/src/mac/printpde/res/English.lproj/PrintPDE.nib/info.nib
+++ /dev/null
@@ -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>
deleted file mode 100644
--- a/embedding/components/printingui/src/mac/printpde/res/English.lproj/PrintPDE.nib/objects.xib
+++ /dev/null
@@ -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>
deleted file mode 100644
--- a/embedding/components/printingui/src/mac/printpde/src/PDECore.c
+++ /dev/null
@@ -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
deleted file mode 100644
--- a/embedding/components/printingui/src/mac/printpde/src/PDECore.h
+++ /dev/null
@@ -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
deleted file mode 100644
--- a/embedding/components/printingui/src/mac/printpde/src/PDECustom.c
+++ /dev/null
@@ -1,1006 +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 ***** */
-
-#include <Carbon/Carbon.h>
-#include <Print/PMPrintingDialogExtensions.h>
-
-#include "PDECore.h"
-#include "PDECustom.h"
-#include "PDEUtilities.h"
-
-// Static Prototypes
-static void InitSettings(MySettings* settings);
-static void InternSettings(CFDictionaryRef srcDict, MySettings* settings);
-static void ExternSettings(MySettings* settings, CFMutableDictionaryRef destDict);
-static void SyncPaneFromSettings(MyCustomContext context);
-static void SyncSettingsFromPane(MyCustomContext context);
-static CFStringRef GetSummaryTextBooleanValue(Boolean value);
-static CFStringRef GetSummaryTextNAValue();
-static CFStringRef GetSummaryTextHeaderFooterValue(CFStringRef inStr);
-static int GetIndexForPrintString(CFStringRef stringCode);
-static CFStringRef GetPrintStringFromIndex(int index);
-
-/*
---------------------------------------------------------------------------------
- MyCreateCustomContext
---------------------------------------------------------------------------------
-*/
-
-extern MyCustomContext MyCreateCustomContext()
-{
- // allocate zeroed storage for a custom context
- MyCustomContext context = calloc (1, sizeof (MyCustomContextBlock));
-
- return context;
-}
-
-
-/*
---------------------------------------------------------------------------------
- MyReleaseCustomContext
---------------------------------------------------------------------------------
-*/
-
-extern void MyReleaseCustomContext (MyCustomContext context)
-{
- MyCFAssign(NULL, context->settings.mHeaderLeft);
- MyCFAssign(NULL, context->settings.mHeaderCenter);
- MyCFAssign(NULL, context->settings.mHeaderRight);
- MyCFAssign(NULL, context->settings.mFooterLeft);
- MyCFAssign(NULL, context->settings.mFooterCenter);
- MyCFAssign(NULL, context->settings.mFooterRight);
-
- free (context);
-}
-
-
-#pragma mark -
-
-/*
---------------------------------------------------------------------------------
- MyGetCustomTitle
---------------------------------------------------------------------------------
-*/
-
-/*
- In this implementation, we only copy the localized title string once.
- We keep a static reference to the copy for re-use.
-*/
-
-extern CFStringRef MyGetCustomTitle (Boolean stillNeeded)
-{
- static CFStringRef sTitle = NULL;
-
- if (stillNeeded)
- {
- if (sTitle == NULL)
- {
- // Get the name of the application hosting us.
- CFBundleRef appBundle = CFBundleGetMainBundle();
- if (appBundle)
- {
- CFStringRef bundleString = CFBundleGetValueForInfoDictionaryKey(
- appBundle, CFSTR("CFBundleName"));
- // We don't get an owning reference here, so make a copy.
- if (bundleString && (CFGetTypeID(bundleString) == CFStringGetTypeID()))
- sTitle = CFStringCreateCopy(NULL, bundleString);
- }
- }
- // If that failed, use a resource - we may be hosted by an unbundled app.
- if (sTitle == NULL)
- {
- sTitle = CFCopyLocalizedStringFromTableInBundle (
- CFSTR("Web Browser"),
- CFSTR("Localizable"),
- MyGetBundle(),
- "the custom pane title");
- }
- }
- else
- {
- if (sTitle != NULL)
- {
- CFRelease (sTitle);
- sTitle = NULL;
- }
- }
-
- return sTitle;
-}
-
-
-/*
---------------------------------------------------------------------------------
- MyEmbedCustomControls
---------------------------------------------------------------------------------
-*/
-
-extern OSStatus MyEmbedCustomControls (
- MyCustomContext context,
- WindowRef nibWindow,
- ControlRef userPane
-)
-
-{
- static const ControlID containerControlID = { kMozPDECreatorCode, 4000 };
- static const ControlID radioGroupControlID = { kMozPDECreatorCode, 4001 };
- static const ControlID printSelCheckControlID = { kMozPDECreatorCode, 4002 };
- static const ControlID shrinkToFitCheckControlID = { kMozPDECreatorCode, 4003 };
- static const ControlID printBGColorsCheckControlID = { kMozPDECreatorCode, 4004 };
- static const ControlID printBGImagesCheckControlID = { kMozPDECreatorCode, 4005 };
- static const ControlID headerLeftPopupControlID = { kMozPDECreatorCode, 4006 };
- static const ControlID headerCenterPopupControlID = { kMozPDECreatorCode, 4007 };
- static const ControlID headerRightPopupControlID = { kMozPDECreatorCode, 4008 };
- static const ControlID footerLeftPopupControlID = { kMozPDECreatorCode, 4009 };
- static const ControlID footerCenterPopupControlID = { kMozPDECreatorCode, 4010 };
- static const ControlID footerRightPopupControlID = { kMozPDECreatorCode, 4011 };
-
- OSStatus result = noErr;
-
- if (context != NULL)
- {
- ControlHandle paneControl = NULL;
-
- // The control we're embedding into the given
- // userPane is itself a user pane control.
- result = MyEmbedControl(nibWindow,
- userPane,
- &containerControlID,
- &paneControl);
-
- if (paneControl)
- {
- WindowRef controlOwner = GetControlOwner(paneControl);
-
- GetControlByID(controlOwner,
- &radioGroupControlID,
- &(context->controls.frameRadioGroup));
- if (context->controls.frameRadioGroup != NULL)
- {
-
- // It doesn't seem to be possible to specify the titles of the
- // radio buttons within a radio group control, so do it by hand :-/
- // This is not done as a loop, but instead using CFSTR("abc") so
- // that genstrings can grok this file. Maybe that's not worth it?
-
- CFStringRef radioTitle;
- ControlRef radioControl;
-
- if (GetIndexedSubControl(context->controls.frameRadioGroup,
- kFramesAsLaidOutIndex, &radioControl) == noErr)
- {
- radioTitle = CFCopyLocalizedStringFromTableInBundle(
- CFSTR("As laid out on the screen"),
- CFSTR("Localizable"),
- MyGetBundle(),
- "top radio title");
- if (radioTitle)
- {
- SetControlTitleWithCFString(radioControl, radioTitle);
- CFRelease(radioTitle);
- }
- }
- if (GetIndexedSubControl(context->controls.frameRadioGroup,
- kFramesSelectedIndex, &radioControl) == noErr)
- {
- radioTitle = CFCopyLocalizedStringFromTableInBundle(
- CFSTR("The selected frame"),
- CFSTR("Localizable"),
- MyGetBundle(),
- "middle radio title");
- if (radioTitle)
- {
- SetControlTitleWithCFString(radioControl, radioTitle);
- CFRelease(radioTitle);
- }
- }
- if (GetIndexedSubControl(context->controls.frameRadioGroup,
- kFramesEachSeparatelyIndex, &radioControl) == noErr)
- {
- radioTitle = CFCopyLocalizedStringFromTableInBundle(
- CFSTR("Each frame separately"),
- CFSTR("Localizable"),
- MyGetBundle(),
- "bottom radio title");
- if (radioTitle)
- {
- SetControlTitleWithCFString(radioControl, radioTitle);
- CFRelease(radioTitle);
- }
- }
- }
-
- GetControlByID(controlOwner,
- &printSelCheckControlID,
- &(context->controls.printSelCheck));
- GetControlByID(controlOwner,
- &shrinkToFitCheckControlID,
- &(context->controls.shrinkToFitCheck));
- GetControlByID(controlOwner,
- &printBGColorsCheckControlID,
- &(context->controls.printBGColorsCheck));
- GetControlByID(controlOwner,
- &printBGImagesCheckControlID,
- &(context->controls.printBGImagesCheck));
-
- GetControlByID(controlOwner,
- &headerLeftPopupControlID,
- &(context->controls.headerLeftPopup));
-
- GetControlByID(controlOwner,
- &headerCenterPopupControlID,
- &(context->controls.headerCenterPopup));
-
- GetControlByID(controlOwner,
- &headerRightPopupControlID,
- &(context->controls.headerRightPopup));
-
- GetControlByID(controlOwner,
- &footerLeftPopupControlID,
- &(context->controls.footerLeftPopup));
-
- GetControlByID(controlOwner,
- &footerCenterPopupControlID,
- &(context->controls.footerCenterPopup));
-
- GetControlByID(controlOwner,
- &footerRightPopupControlID,
- &(context->controls.footerRightPopup));
-
- // Now that the controls are in, sync with data.
- SyncPaneFromSettings(context);
- }
- }
-
- return result;
-}
-
-
-/*
---------------------------------------------------------------------------------
- MyGetSummaryText
---------------------------------------------------------------------------------
-*/
-
-extern OSStatus MyGetSummaryText (
- MyCustomContext context,
- CFMutableArrayRef titleArray,
- CFMutableArrayRef valueArray
-)
-
-{
- CFStringRef title = NULL;
- CFStringRef value = NULL;
- CFStringRef format = NULL;
-
- OSStatus result = noErr;
-
- // "Print Frames" Radio Group
- title = CFCopyLocalizedStringFromTableInBundle (
- CFSTR("Print Frames"),
- CFSTR("Localizable"),
- MyGetBundle(),
- "the Print Frames radio group (for summary)");
-
- if (title != NULL)
- {
- if (context->settings.mHaveFrames)
- {
- if (context->settings.mPrintFrameAsIs)
- value = CFCopyLocalizedStringFromTableInBundle(
- CFSTR("As laid out on the screen"),
- CFSTR("Localizable"),
- MyGetBundle(),
- "Print Frames choice #1 (for summary)");
- else if (context->settings.mPrintSelectedFrame)
- value = CFCopyLocalizedStringFromTableInBundle(
- CFSTR("The selected frame"),
- CFSTR("Localizable"),
- MyGetBundle(),
- "Print Frames choice #2 (for summary)");
- else if (context->settings.mPrintFramesSeparately)
- value = CFCopyLocalizedStringFromTableInBundle(
- CFSTR("Each frame separately"),
- CFSTR("Localizable"),
- MyGetBundle(),
- "Print Frames choice #3 (for summary)");
- }
- else
- value = GetSummaryTextNAValue();
-
- if (value != NULL)
- {
- // append the title-value pair to the arrays
- CFArrayAppendValue (titleArray, title);
- CFArrayAppendValue (valueArray, value);
-
- CFRelease (value);
- }
- CFRelease (title);
- }
-
- // Print Selection
- title = CFCopyLocalizedStringFromTableInBundle(
- CFSTR("Print Selection"),
- CFSTR("Localizable"),
- MyGetBundle(),
- "Print Selection title (for summary)");
- if (title != NULL)
- {
- if (context->settings.mHaveSelection)
- value = GetSummaryTextBooleanValue(context->settings.mPrintSelection);
- else
- value = GetSummaryTextNAValue();
-
- if (value != NULL)
- {
- // append the title-value pair to the arrays
- CFArrayAppendValue (titleArray, title);
- CFArrayAppendValue (valueArray, value);
-
- CFRelease (value);
- }
- CFRelease (title);
- }
-
- // Shrink To Fit
- title = CFCopyLocalizedStringFromTableInBundle(
- CFSTR("Shrink To Fit"),
- CFSTR("Localizable"),
- MyGetBundle(),
- "Shrink To Fit title (for summary)");
- if (title != NULL)
- {
- value = GetSummaryTextBooleanValue(context->settings.mShrinkToFit);
- if (value != NULL)
- {
- // append the title-value pair to the arrays
- CFArrayAppendValue (titleArray, title);
- CFArrayAppendValue (valueArray, value);
-
- CFRelease (value);
- }
- CFRelease (title);
- }
-
- // Print BG Colors
- title = CFCopyLocalizedStringFromTableInBundle(
- CFSTR("Print BG Colors"),
- CFSTR("Localizable"),
- MyGetBundle(),
- "Print BG Colors title (for summary)");
- if (title != NULL)
- {
- value = GetSummaryTextBooleanValue(context->settings.mPrintBGColors);
- if (value != NULL)
- {
- // append the title-value pair to the arrays
- CFArrayAppendValue (titleArray, title);
- CFArrayAppendValue (valueArray, value);
-
- CFRelease (value);
- }
- CFRelease (title);
- }
-
- // Print BG Images
- title = CFCopyLocalizedStringFromTableInBundle(
- CFSTR("Print BG Images"),
- CFSTR("Localizable"),
- MyGetBundle(),
- "Print BG Images title (for summary)");
- if (title != NULL)
- {
- value = GetSummaryTextBooleanValue(context->settings.mPrintBGImages);
- if (value != NULL)
- {
- // append the title-value pair to the arrays
- CFArrayAppendValue (titleArray, title);
- CFArrayAppendValue (valueArray, value);
-
- CFRelease (value);
- }
- CFRelease (title);
- }
-
- // Page Headers
- title = CFCopyLocalizedStringFromTableInBundle(
- CFSTR("Page Headers"),
- CFSTR("Localizable"),
- MyGetBundle(),
- "Page Headers (for summary)");
- if (title != NULL)
- {
- format = CFCopyLocalizedStringFromTableInBundle(
- CFSTR("%@, %@, %@"),
- CFSTR("Localizable"),
- MyGetBundle(),
- "Page Heaader/Footer format (for summary)");
-
- if (format != NULL)
- {
- value = CFStringCreateWithFormat(NULL, NULL, format,
- GetSummaryTextHeaderFooterValue(context->settings.mHeaderLeft),
- GetSummaryTextHeaderFooterValue(context->settings.mHeaderCenter),
- GetSummaryTextHeaderFooterValue(context->settings.mHeaderRight));
- if (value != NULL)
- {
- // append the title-value pair to the arrays
- CFArrayAppendValue (titleArray, title);
- CFArrayAppendValue (valueArray, value);
-
- CFRelease (value);
- }
- CFRelease(format);
- }
- CFRelease (title);
- }
-
- // Page Footers
- title = CFCopyLocalizedStringFromTableInBundle(
- CFSTR("Page Footers"),
- CFSTR("Localizable"),
- MyGetBundle(),
- "Page Footers (for summary)");
- if (title != NULL)
- {
- format = CFCopyLocalizedStringFromTableInBundle(
- CFSTR("%@, %@, %@"),
- CFSTR("Localizable"),
- MyGetBundle(),
- "Page Heaader/Footer format (for summary)");
-
- if (format != NULL)
- {
- value = CFStringCreateWithFormat(NULL, NULL, format,
- GetSummaryTextHeaderFooterValue(context->settings.mFooterLeft),
- GetSummaryTextHeaderFooterValue(context->settings.mFooterCenter),
- GetSummaryTextHeaderFooterValue(context->settings.mFooterRight));
- if (value != NULL)
- {
- // append the title-value pair to the arrays
- CFArrayAppendValue (titleArray, title);
- CFArrayAppendValue (valueArray, value);
-
- CFRelease (value);
- }
- CFRelease(format);
- }
- CFRelease (title);
- }
-
- return result;
-}
-
-
-#pragma mark -
-
-
-/*
---------------------------------------------------------------------------------
- MySyncPaneFromTicket
---------------------------------------------------------------------------------
-*/
-
-extern OSStatus MySyncPaneFromTicket (
- MyCustomContext context,
- PMPrintSession session
-)
-
-{
- OSStatus result = noErr;
- PMTicketRef ticket = NULL;
-
- result = MyGetTicket (session, kPDE_PMPrintSettingsRef, &ticket);
- if (result == noErr)
- {
- CFDataRef xmlData = NULL;
- CFDictionaryRef dict = NULL;
-
- result = PMTicketGetCFData (
- ticket,
- kPMTopLevel,
- kPMTopLevel,
- kAppPrintDialogPDEOnlyKey,
- &xmlData
- );
- if (result == noErr)
- {
- dict = CFPropertyListCreateFromXMLData (
- kCFAllocatorDefault,
- xmlData,
- kCFPropertyListImmutable,
- NULL
- );
- if (dict)
- {
- InternSettings(dict, &context->settings);
- CFRelease(dict);
- }
- else
- result = kPMKeyNotFound; // bad XML?
- }
- if (result == kPMKeyNotFound)
- {
- InitSettings(&context->settings);
- result = noErr;
- }
- }
-
- if (result == noErr)
- SyncPaneFromSettings(context);
-
- MyDebugMessage("MySyncPane", result);
- return result;
-}
-
-
-/*
---------------------------------------------------------------------------------
- MySyncTicketFromPane
---------------------------------------------------------------------------------
-*/
-
-extern OSStatus MySyncTicketFromPane (
- MyCustomContext context,
- PMPrintSession session
-)
-
-{
- OSStatus result = noErr;
- PMTicketRef ticket = NULL;
- CFMutableDictionaryRef dict = NULL;
- CFDataRef xmlData = NULL;
-
- result = MyGetTicket (session, kPDE_PMPrintSettingsRef, &ticket);
- if (result == noErr)
- {
- // If our pane has never been shown, this will be a noop.
- SyncSettingsFromPane(context);
-
- dict = CFDictionaryCreateMutable(kCFAllocatorDefault, 0,
- (const CFDictionaryKeyCallBacks *)&kCFTypeDictionaryKeyCallBacks,
- (const CFDictionaryValueCallBacks *)&kCFTypeDictionaryValueCallBacks);
- if (dict)
- {
- ExternSettings(&context->settings, dict);
- xmlData = CFPropertyListCreateXMLData(kCFAllocatorDefault, dict);
- if (xmlData)
- {
- result = PMTicketSetCFData (
- ticket,
- kMyBundleIdentifier,
- kAppPrintDialogPDEOnlyKey,
- xmlData,
- kPMUnlocked
- );
- CFRelease(xmlData);
- }
- CFRelease(dict);
- }
- }
-
- MyDebugMessage("MySyncTicket", result);
- return result;
-}
-
-#pragma mark -
-
-/*
---------------------------------------------------------------------------------
- Static Routines
---------------------------------------------------------------------------------
-*/
-
-static void InitSettings(MySettings* settings)
-{
- settings->mHaveSelection = false;
- settings->mHaveFrames = false;
- settings->mHaveFrameSelected = false;
-
- settings->mPrintFrameAsIs = false;
- settings->mPrintSelectedFrame = false;
- settings->mPrintFramesSeparately = false;
- settings->mPrintSelection = false;
- settings->mShrinkToFit = true;
- settings->mPrintBGColors = true;
- settings->mPrintBGImages = true;
-
- settings->mHeaderLeft = MyCFAssign(NULL, settings->mHeaderLeft);
- settings->mHeaderCenter = MyCFAssign(NULL, settings->mHeaderCenter);
- settings->mHeaderRight = MyCFAssign(NULL, settings->mHeaderRight);
- settings->mFooterLeft = MyCFAssign(NULL, settings->mFooterLeft);
- settings->mFooterCenter = MyCFAssign(NULL, settings->mFooterCenter);
- settings->mFooterRight = MyCFAssign(NULL, settings->mFooterRight);
-}
-
-static void InternSettings(CFDictionaryRef srcDict, MySettings* settings)
-{
- CFTypeRef dictValue;
-
- if ((dictValue = CFDictionaryGetValue(srcDict, kPDEKeyHaveSelection)) &&
- (CFGetTypeID(dictValue) == CFBooleanGetTypeID()))
- settings->mHaveSelection = CFBooleanGetValue((CFBooleanRef)dictValue);
-
- if ((dictValue = CFDictionaryGetValue(srcDict, kPDEKeyHaveFrames)) &&
- (CFGetTypeID(dictValue) == CFBooleanGetTypeID()))
- settings->mHaveFrames = CFBooleanGetValue((CFBooleanRef)dictValue);
-
- if ((dictValue = CFDictionaryGetValue(srcDict, kPDEKeyHaveFrameSelected)) &&
- (CFGetTypeID(dictValue) == CFBooleanGetTypeID()))
- settings->mHaveFrameSelected = CFBooleanGetValue((CFBooleanRef)dictValue);
-
- if ((dictValue = CFDictionaryGetValue(srcDict, kPDEKeyPrintFrameType)) &&
- (CFGetTypeID(dictValue) == CFStringGetTypeID())) {
- if (CFEqual(dictValue, kPDEValueFramesAsIs))
- settings->mPrintFrameAsIs = true;
- else if (CFEqual(dictValue, kPDEValueSelectedFrame))
- settings->mPrintSelectedFrame = true;
- else if (CFEqual(dictValue, kPDEValueEachFrameSep))
- settings->mPrintFramesSeparately = true;
- }
-
- if ((dictValue = CFDictionaryGetValue(srcDict, kPDEKeyPrintSelection)) &&
- (CFGetTypeID(dictValue) == CFBooleanGetTypeID()))
- settings->mPrintSelection = CFBooleanGetValue((CFBooleanRef)dictValue);
- if ((dictValue = CFDictionaryGetValue(srcDict, kPDEKeyShrinkToFit)) &&
- (CFGetTypeID(dictValue) == CFBooleanGetTypeID()))
- settings->mShrinkToFit = CFBooleanGetValue((CFBooleanRef)dictValue);
- if ((dictValue = CFDictionaryGetValue(srcDict, kPDEKeyPrintBGColors)) &&
- (CFGetTypeID(dictValue) == CFBooleanGetTypeID()))
- settings->mPrintBGColors = CFBooleanGetValue((CFBooleanRef)dictValue);
- if ((dictValue = CFDictionaryGetValue(srcDict, kPDEKeyPrintBGImages)) &&
- (CFGetTypeID(dictValue) == CFBooleanGetTypeID()))
- settings->mPrintBGImages = CFBooleanGetValue((CFBooleanRef)dictValue);
-
-
- if ((dictValue = CFDictionaryGetValue(srcDict, kPDEKeyHeaderLeft)) &&
- (CFGetTypeID(dictValue) == CFStringGetTypeID()))
- settings->mHeaderLeft = MyCFAssign(dictValue, settings->mHeaderLeft);
- if ((dictValue = CFDictionaryGetValue(srcDict, kPDEKeyHeaderCenter)) &&
- (CFGetTypeID(dictValue) == CFStringGetTypeID()))
- settings->mHeaderCenter = MyCFAssign(dictValue, settings->mHeaderCenter);
- if ((dictValue = CFDictionaryGetValue(srcDict, kPDEKeyHeaderRight)) &&
- (CFGetTypeID(dictValue) == CFStringGetTypeID()))
- settings->mHeaderRight = MyCFAssign(dictValue, settings->mHeaderRight);
- if ((dictValue = CFDictionaryGetValue(srcDict, kPDEKeyFooterLeft)) &&
- (CFGetTypeID(dictValue) == CFStringGetTypeID()))
- settings->mFooterLeft = MyCFAssign(dictValue, settings->mFooterLeft);
- if ((dictValue = CFDictionaryGetValue(srcDict, kPDEKeyFooterCenter)) &&
- (CFGetTypeID(dictValue) == CFStringGetTypeID()))
- settings->mFooterCenter = MyCFAssign(dictValue, settings->mFooterCenter);
- if ((dictValue = CFDictionaryGetValue(srcDict, kPDEKeyFooterRight)) &&
- (CFGetTypeID(dictValue) == CFStringGetTypeID()))
- settings->mFooterRight = MyCFAssign(dictValue, settings->mFooterRight);
-}
-
-static void ExternSettings(MySettings* settings, CFMutableDictionaryRef destDict)
-{
- // Do not write the state info mHaveSelection, mHaveFrames, mHaveFrameSelected
- // That info is used to enable/disable UI for this session only. It's not read
- // back by the application, nor should it be saved in custom print settings
-
- if (settings->mPrintFrameAsIs)
- CFDictionaryAddValue(destDict, kPDEKeyPrintFrameType, kPDEValueFramesAsIs);
- else if (settings->mPrintSelectedFrame)
- CFDictionaryAddValue(destDict, kPDEKeyPrintFrameType, kPDEValueSelectedFrame);
- else if (settings->mPrintFramesSeparately)
- CFDictionaryAddValue(destDict, kPDEKeyPrintFrameType, kPDEValueEachFrameSep);
-
- CFDictionaryAddValue(destDict, kPDEKeyPrintSelection, settings->mPrintSelection ? kCFBooleanTrue : kCFBooleanFalse);
- CFDictionaryAddValue(destDict, kPDEKeyShrinkToFit, settings->mShrinkToFit ? kCFBooleanTrue : kCFBooleanFalse);
- CFDictionaryAddValue(destDict, kPDEKeyPrintBGColors, settings->mPrintBGColors ? kCFBooleanTrue : kCFBooleanFalse);
- CFDictionaryAddValue(destDict, kPDEKeyPrintBGImages, settings->mPrintBGImages ? kCFBooleanTrue : kCFBooleanFalse);
-
- CFDictionaryAddValue(destDict, kPDEKeyHeaderLeft, settings->mHeaderLeft ? settings->mHeaderLeft : CFSTR(""));
- CFDictionaryAddValue(destDict, kPDEKeyHeaderCenter, settings->mHeaderCenter ? settings->mHeaderCenter : CFSTR(""));
- CFDictionaryAddValue(destDict, kPDEKeyHeaderRight, settings->mHeaderRight ? settings->mHeaderRight : CFSTR(""));
- CFDictionaryAddValue(destDict, kPDEKeyFooterLeft, settings->mFooterLeft ? settings->mFooterLeft : CFSTR(""));
- CFDictionaryAddValue(destDict, kPDEKeyFooterCenter, settings->mFooterCenter ? settings->mFooterCenter : CFSTR(""));
- CFDictionaryAddValue(destDict, kPDEKeyFooterRight, settings->mFooterRight ? settings->mFooterRight : CFSTR(""));
-}
-
-static void SyncPaneFromSettings(MyCustomContext context)
-{
- if (context->controls.frameRadioGroup)
- {
- if (context->settings.mHaveFrames)
- {
- EnableControl(context->controls.frameRadioGroup);
-
- if (context->settings.mPrintSelectedFrame &&
- context->settings.mHaveFrameSelected)
- SetControl32BitValue(context->controls.frameRadioGroup,
- kFramesSelectedIndex);
- else if (context->settings.mPrintFramesSeparately)
- SetControl32BitValue(context->controls.frameRadioGroup,
- kFramesEachSeparatelyIndex);
- else /* (context->settings.mPrintFrameAsIs) */
- SetControl32BitValue(context->controls.frameRadioGroup,
- kFramesAsLaidOutIndex);
-
- if (!context->settings.mHaveFrameSelected)
- {
- ControlRef radioControl;
- if (GetIndexedSubControl(context->controls.frameRadioGroup,
- kFramesSelectedIndex, &radioControl) == noErr)
- DisableControl(radioControl);
- }
- }
- else
- {
- DisableControl(context->controls.frameRadioGroup);
- SetControl32BitValue(context->controls.frameRadioGroup, 0);
- }
- }
-
- if (context->controls.printSelCheck)
- {
- if (context->settings.mHaveSelection)
- {
- EnableControl(context->controls.printSelCheck);
- SetControl32BitValue(context->controls.printSelCheck,
- context->settings.mPrintSelection);
- }
- else
- {
- DisableControl(context->controls.printSelCheck);
- SetControl32BitValue(context->controls.printSelCheck, 0);
- }
- }
- if (context->controls.shrinkToFitCheck)
- SetControl32BitValue(context->controls.shrinkToFitCheck,
- context->settings.mShrinkToFit);
- if (context->controls.printBGColorsCheck)
- SetControl32BitValue(context->controls.printBGColorsCheck,
- context->settings.mPrintBGColors);
- if (context->controls.printBGImagesCheck)
- SetControl32BitValue(context->controls.printBGImagesCheck,
- context->settings.mPrintBGImages);
-
- if (context->controls.headerLeftPopup)
- SetControl32BitValue(context->controls.headerLeftPopup,
- GetIndexForPrintString(context->settings.mHeaderLeft));
- if (context->controls.headerCenterPopup)
- SetControl32BitValue(context->controls.headerCenterPopup,
- GetIndexForPrintString(context->settings.mHeaderCenter));
- if (context->controls.headerRightPopup)
- SetControl32BitValue(context->controls.headerRightPopup,
- GetIndexForPrintString(context->settings.mHeaderRight));
-
- if (context->controls.footerLeftPopup)
- SetControl32BitValue(context->controls.footerLeftPopup,
- GetIndexForPrintString(context->settings.mFooterLeft));
- if (context->controls.footerCenterPopup)
- SetControl32BitValue(context->controls.footerCenterPopup,
- GetIndexForPrintString(context->settings.mFooterCenter));
- if (context->controls.footerRightPopup)
- SetControl32BitValue(context->controls.footerRightPopup,
- GetIndexForPrintString(context->settings.mFooterRight));
-
-}
-
-
-static void SyncSettingsFromPane(MyCustomContext context)
-{
- SInt32 controlVal;
-
- if (context->controls.frameRadioGroup)
- {
- context->settings.mPrintFrameAsIs = false;
- context->settings.mPrintSelectedFrame = false;
- context->settings.mPrintFramesSeparately = false;
- switch (GetControl32BitValue(context->controls.frameRadioGroup))
- {
- case kFramesAsLaidOutIndex:
- context->settings.mPrintFrameAsIs = true;
- break;
- case kFramesSelectedIndex:
- context->settings.mPrintSelectedFrame = true;
- break;
- case kFramesEachSeparatelyIndex:
- context->settings.mPrintFramesSeparately = true;
- break;
- }
- }
-
- if (context->controls.printSelCheck)
- context->settings.mPrintSelection =
- GetControl32BitValue(context->controls.printSelCheck);
- if (context->controls.printSelCheck)
- context->settings.mShrinkToFit =
- GetControl32BitValue(context->controls.shrinkToFitCheck);
- if (context->controls.printSelCheck)
- context->settings.mPrintBGColors =
- GetControl32BitValue(context->controls.printBGColorsCheck);
- if (context->controls.printSelCheck)
- context->settings.mPrintBGImages =
- GetControl32BitValue(context->controls.printBGImagesCheck);
-
- if (context->controls.headerLeftPopup) {
- controlVal = GetControl32BitValue(context->controls.headerLeftPopup);
- context->settings.mHeaderLeft = MyCFAssign(GetPrintStringFromIndex(controlVal),
- context->settings.mHeaderLeft);
- }
- if (context->controls.headerCenterPopup) {
- controlVal = GetControl32BitValue(context->controls.headerCenterPopup);
- context->settings.mHeaderCenter = MyCFAssign(GetPrintStringFromIndex(controlVal),
- context->settings.mHeaderCenter);
- }
- if (context->controls.headerRightPopup) {
- controlVal = GetControl32BitValue(context->controls.headerRightPopup);
- context->settings.mHeaderRight = MyCFAssign(GetPrintStringFromIndex(controlVal),
- context->settings.mHeaderRight);
- }
- if (context->controls.footerLeftPopup) {
- controlVal = GetControl32BitValue(context->controls.footerLeftPopup);
- context->settings.mFooterLeft = MyCFAssign(GetPrintStringFromIndex(controlVal),
- context->settings.mFooterLeft);
- }
- if (context->controls.footerCenterPopup) {
- controlVal = GetControl32BitValue(context->controls.footerCenterPopup);
- context->settings.mFooterCenter = MyCFAssign(GetPrintStringFromIndex(controlVal),
- context->settings.mFooterCenter);
- }
- if (context->controls.footerRightPopup) {
- controlVal = GetControl32BitValue(context->controls.footerRightPopup);
- context->settings.mFooterRight = MyCFAssign(GetPrintStringFromIndex(controlVal),
- context->settings.mFooterRight);
- }
-
-}
-
-#pragma mark -
-
-CFStringRef GetSummaryTextBooleanValue(Boolean value)
-{
- if (value)
- return CFCopyLocalizedStringFromTableInBundle(
- CFSTR("On"),
- CFSTR("Localizable"),
- MyGetBundle(),
- CFSTR("the value of a checkbox when selected"));
-
- return CFCopyLocalizedStringFromTableInBundle(
- CFSTR("Off"),
- CFSTR("Localizable"),
- MyGetBundle(),
- CFSTR("the value of a checkbox when not selected"));
-}
-
-
-static CFStringRef GetSummaryTextNAValue()
-{
- return CFCopyLocalizedStringFromTableInBundle(
- CFSTR("N/A"),
- CFSTR("Localizable"),
- MyGetBundle(),
- "Not Applicable (for summary)");
-
-}
-
-static CFStringRef GetSummaryTextHeaderFooterValue(CFStringRef inStr)
-{
- if (!inStr || !CFStringGetLength(inStr))
- return CFCopyLocalizedStringFromTableInBundle(
- CFSTR("(Blank)"),
- CFSTR("Localizable"),
- MyGetBundle(),
- "Page Heaader/Footer <blank> (for summary)");
- else if (CFEqual(inStr, CFSTR("&T")))
- return CFCopyLocalizedStringFromTableInBundle(
- CFSTR("Title"),
- CFSTR("Localizable"),
- MyGetBundle(),
- "Page Heaader/Footer <title> (for summary)");
- else if (CFEqual(inStr, CFSTR("&U")))
- return CFCopyLocalizedStringFromTableInBundle(
- CFSTR("URL"),
- CFSTR("Localizable"),
- MyGetBundle(),
- "Page Heaader/Footer <url> (for summary)");
- else if (CFEqual(inStr, CFSTR("&D")))
- return CFCopyLocalizedStringFromTableInBundle(
- CFSTR("Date"),
- CFSTR("Localizable"),
- MyGetBundle(),
- "Page Heaader/Footer <date> (for summary)");
- else if (CFEqual(inStr, CFSTR("&P")))
- return CFCopyLocalizedStringFromTableInBundle(
- CFSTR("Page #"),
- CFSTR("Localizable"),
- MyGetBundle(),
- "Page Heaader/Footer <page #> (for summary)");
- else if (CFEqual(inStr, CFSTR("&PT")))
- return CFCopyLocalizedStringFromTableInBundle(
- CFSTR("Page # of #"),
- CFSTR("Localizable"),
- MyGetBundle(),
- "Page Heaader/Footer <page # of #> (for summary)");
- else
- return CFRetain(inStr);
-}
-
-//
-// Here we have a mapping of control codes to pop-up button messages
-//
-
-static int GetIndexForPrintString(CFStringRef stringCode)
-{
- if (stringCode)
- {
- // title
- if (CFEqual(stringCode, CFSTR("&T")))
- return 2;
- // URL
- if (CFEqual(stringCode, CFSTR("&U")))
- return 3;
- // Date/Time
- if (CFEqual(stringCode, CFSTR("&D")))
- return 4;
- // Page Number
- if (CFEqual(stringCode, CFSTR("&P")))
- return 5;
- // Page Number of Total Page Numbers
- if (CFEqual(stringCode, CFSTR("&PT")))
- return 6;
- }
- // Something Else - aka "Blank"
- return 1;
-}
-
-CFStringRef GetPrintStringFromIndex(int index)
-{
- switch (index)
- {
- case 2: // title
- return CFSTR("&T");
- case 3: // url
- return CFSTR("&U");
- case 4: // date/time
- return CFSTR("&D");
- case 5: // Page #
- return CFSTR("&P");
- case 6: // Page # of #
- return CFSTR("&PT");
- default: // blank OR custom (need to implement custom)
- return CFSTR("");
- }
- }
-
-/* END OF SOURCE */
deleted file mode 100644
--- a/embedding/components/printingui/src/mac/printpde/src/PDECustom.h
+++ /dev/null
@@ -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
deleted file mode 100644
--- a/embedding/components/printingui/src/mac/printpde/src/PDEUtilities.c
+++ /dev/null
@@ -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
deleted file mode 100644
--- a/embedding/components/printingui/src/mac/printpde/src/PDEUtilities.h
+++ /dev/null
@@ -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
--- a/embedding/components/printingui/src/win/nsPrintDialogUtil.cpp
+++ b/embedding/components/printingui/src/win/nsPrintDialogUtil.cpp
@@ -458,20 +458,20 @@ static void SetRadioOfGroup(HWND aDlg, i
typedef struct {
char * mKeyStr;
long mKeyId;
} PropKeyInfo;
// 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}};
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
//--------------------------------------------------------
// Get the absolute coords of the child windows relative
// to its parent window
@@ -1275,17 +1275,17 @@ ShowNativePrintDialogEx(HWND
prntdlg.nMinPage = 1;
prntdlg.nMaxPage = 0xFFFF;
prntdlg.nCopies = 1;
if (ShouldExtendPrintDialog()) {
// 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);
}
// Temporarily borrow this variable for setting up the radiobuttons
// if we don't use this, we will need to define a new global var
gFrameSelectedRadioBtn = howToEnableFrameUI;
HPROPSHEETPAGE psp[1];
rename from toolkit/locales/en-US/chrome/global/gnomeprintdialog.properties
rename to toolkit/locales/en-US/chrome/global/printdialog.properties
--- a/toolkit/locales/en-US/chrome/global/gnomeprintdialog.properties
+++ b/toolkit/locales/en-US/chrome/global/printdialog.properties
@@ -1,19 +1,38 @@
-printTitle=Print
-optionsTabLabel=Options
-printFramesTitle=Print Frames
+# 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.
+# 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
@@ -21,8 +40,20 @@ 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
--- a/toolkit/locales/jar.mn
+++ b/toolkit/locales/jar.mn
@@ -40,17 +40,17 @@
locale/@AB_CD@/global/mozilla.dtd (%chrome/global/mozilla.dtd)
locale/@AB_CD@/global/notification.dtd (%chrome/global/notification.dtd)
locale/@AB_CD@/global/preferences.dtd (%chrome/global/preferences.dtd)
+ locale/@AB_CD@/global/printdialog.dtd (%chrome/global/printdialog.dtd)
+ locale/@AB_CD@/global/printjoboptions.dtd (%chrome/global/printjoboptions.dtd)
+ 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)
+ locale/@AB_CD@/global/tree.dtd (%chrome/global/tree.dtd)
+ locale/@AB_CD@/global/textcontext.dtd (%chrome/global/textcontext.dtd)
locale/@AB_CD@/global/videocontrols.dtd (%chrome/global/videocontrols.dtd)
+ locale/@AB_CD@/global/viewSource.dtd (%chrome/global/viewSource.dtd)
+ locale/@AB_CD@/global/viewSource.properties (%chrome/global/viewSource.properties)
--- a/widget/public/Makefile.in
+++ b/widget/public/Makefile.in
@@ -56,17 +56,20 @@ EXPORTS = \
nsILookAndFeel.h \
nsIPluginWidget.h \
nsINativeKeyBindings.h \
nsIDeviceContextSpec.h \
nsIMenuRollup.h \
$(NULL)
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
-EXPORTS += nsINativeMenuService.h
+EXPORTS += \
+ nsINativeMenuService.h \
+ nsIPrintDialogService.h \
+ $(NULL)
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
EXPORTS += nsIDragSessionOS2.h
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),beos)
EXPORTS += nsIDragSessionBeOS.h
@@ -116,21 +119,16 @@ XPIDLSRCS += nsIPrintSettingsWin.idl \
nsITaskbarPreviewButton.idl \
nsITaskbarProgress.idl \
nsITaskbarPreviewButton.idl \
nsIJumpListBuilder.idl \
nsIJumpListItem.idl \
$(NULL)
endif
-ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
-XPIDLSRCS += nsIPrintSettingsX.idl \
- nsIPrintSessionX.idl
-endif
-
ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
XPIDLSRCS += nsIRwsService.idl
endif
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
include $(topsrcdir)/config/rules.mk
deleted file mode 100644
--- a/widget/public/nsIPrintSessionX.idl
+++ /dev/null
@@ -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;
-};
deleted file mode 100644
--- a/widget/public/nsIPrintSettingsX.idl
+++ /dev/null
@@ -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();
-
-};
--- a/widget/src/cocoa/Makefile.in
+++ b/widget/src/cocoa/Makefile.in
@@ -78,19 +78,19 @@ CMMSRCS = \
nsCursorManager.mm \
nsMacCursor.mm \
nsScreenCocoa.mm \
nsScreenManagerCocoa.mm \
nsSound.mm \
nsLookAndFeel.mm \
nsNativeThemeCocoa.mm \
nsDeviceContextSpecX.mm \
+ nsPrintDialogX.mm \
nsPrintOptionsX.mm \
nsPrintSettingsX.mm \
- nsPrintSessionX.mm \
nsIdleServiceX.mm \
nsAccelerometerX.mm \
nsCocoaTextInputHandler.mm \
$(NULL)
XPIDLSRCS += \
nsPIWidgetCocoa.idl \
$(NULL)
--- a/widget/src/cocoa/nsDeviceContextSpecX.h
+++ b/widget/src/cocoa/nsDeviceContextSpecX.h
@@ -36,46 +36,39 @@
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsDeviceContextSpecX_h_
#define nsDeviceContextSpecX_h_
#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,
PRInt32 aStartPage,
PRInt32 aEndPage);
NS_IMETHOD EndDocument();
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.
PMPageFormat mPageFormat; // page format.
PMPrintSettings mPrintSettings; // print settings.
};
#endif //nsDeviceContextSpecX_h_
--- a/widget/src/cocoa/nsDeviceContextSpecX.mm
+++ b/widget/src/cocoa/nsDeviceContextSpecX.mm
@@ -43,17 +43,17 @@
#include "prmem.h"
#include "plstr.h"
#include "nsCRT.h"
#include <unistd.h>
#include "nsIServiceManager.h"
#include "nsIPrintOptions.h"
-#include "nsIPrintSettingsX.h"
+#include "nsPrintSettingsX.h"
#include "gfxQuartzSurface.h"
#include "gfxImageSurface.h"
nsDeviceContextSpecX::nsDeviceContextSpecX()
: mPrintSession(NULL)
, mPageFormat(kPMNoPageFormat)
, mPrintSettings(kPMNoPrintSettings)
@@ -73,34 +73,24 @@ nsDeviceContextSpecX::~nsDeviceContextSp
NS_IMPL_ISUPPORTS1(nsDeviceContextSpecX, nsIDeviceContextSpec)
NS_IMETHODIMP nsDeviceContextSpecX::Init(nsIWidget *aWidget,
nsIPrintSettings* aPS,
PRBool aIsPrintPreview)
{
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;
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
NS_IMETHODIMP nsDeviceContextSpecX::BeginDocument(PRUnichar* aTitle,
PRUnichar* aPrintToFileName,
@@ -137,23 +127,16 @@ NS_IMETHODIMP nsDeviceContextSpecX::EndD
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
::PMSessionEndDocumentNoDialog(mPrintSession);
return NS_OK;
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
-/*
-NS_IMETHODIMP nsDeviceContextSpecX::AbortDocument()
-{
- return EndDocument();
-}
-*/
-
NS_IMETHODIMP nsDeviceContextSpecX::BeginPage()
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
PMSessionError(mPrintSession);
OSStatus status = ::PMSessionBeginPageNoDialog(mPrintSession, mPageFormat, NULL);
if (status != noErr) return NS_ERROR_ABORT;
return NS_OK;
new file mode 100644
--- /dev/null
+++ b/widget/src/cocoa/nsPrintDialogX.h
@@ -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
new file mode 100644
--- /dev/null
+++ b/widget/src/cocoa/nsPrintDialogX.mm
@@ -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
--- a/widget/src/cocoa/nsPrintOptionsX.h
+++ b/widget/src/cocoa/nsPrintOptionsX.h
@@ -41,18 +41,15 @@
#include "nsPrintOptionsImpl.h"
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);
nsresult WritePrefs(nsIPrintSettings* aPS, const nsAString& aPrinterName, PRUint32 aFlags);
};
#endif // nsPrintOptionsX_h_
--- a/widget/src/cocoa/nsPrintOptionsX.mm
+++ b/widget/src/cocoa/nsPrintOptionsX.mm
@@ -36,58 +36,39 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsCOMPtr.h"
#include "nsIServiceManager.h"
#include "nsPrintOptionsX.h"
#include "nsPrintSettingsX.h"
-#include "nsCRT.h"
-#include "plbase64.h"
-#include "prmem.h"
-
nsPrintOptionsX::nsPrintOptionsX()
{
}
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)
{
nsresult rv;
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)
{
nsresult rv;
*_retval = nsnull;
nsPrintSettingsX* printSettings = new nsPrintSettingsX; // does not initially ref count
@@ -107,16 +88,16 @@ nsresult nsPrintOptionsX::_CreatePrintSe
nsresult
nsPrintOptionsX::WritePrefs(nsIPrintSettings* aPS, const nsAString& aPrinterName, PRUint32 aFlags)
{
nsresult rv;
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;
}
deleted file mode 100644
--- a/widget/src/cocoa/nsPrintSessionX.h
+++ /dev/null
@@ -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_
deleted file mode 100644
--- a/widget/src/cocoa/nsPrintSessionX.mm
+++ /dev/null
@@ -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;
-}
--- a/widget/src/cocoa/nsPrintSettingsX.h
+++ b/widget/src/cocoa/nsPrintSettingsX.h
@@ -34,42 +34,47 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsPrintSettingsX_h_
#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();
- nsresult Init();
+ PMPrintSettings GetPMPrintSettings();
+ PMPrintSession GetPMPrintSession();
+ PMPageFormat GetPMPageFormat();
+ void SetPMPageFormat(PMPageFormat aPageFormat);
protected:
nsPrintSettingsX(const nsPrintSettingsX& src);
nsPrintSettingsX& operator=(const nsPrintSettingsX& rhs);
nsresult _Clone(nsIPrintSettings **_retval);
nsresult _Assign(nsIPrintSettings *aPS);
// Re-initialize mUnwriteableMargin with values from mPageFormat.
// Should be called whenever mPageFormat is initialized or overwritten.
nsresult InitUnwriteableMargin();
// The out param has a ref count of 1 on return so caller needs to PMRelase() when done.
OSStatus CreateDefaultPageFormat(PMPrintSession aSession, PMPageFormat& outFormat);
OSStatus CreateDefaultPrintSettings(PMPrintSession aSession, PMPrintSettings& outSettings);
- PMPageFormat mPageFormat;
- PMPrintSettings mPrintSettings;
+ NSPrintInfo* mPrintInfo;
};
#endif // nsPrintSettingsX_h_
--- a/widget/src/cocoa/nsPrintSettingsX.mm
+++ b/widget/src/cocoa/nsPrintSettingsX.mm
@@ -16,16 +16,17 @@
*
* 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):
* 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"),
* 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
@@ -33,422 +34,177 @@
* 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 "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 "nsCocoaWindow.h"
-#include "nsMenuBarX.h"
-#include "nsMenuUtilsX.h"
+#include "plstr.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
-{
-public:
- StHandleOwner(Handle inHandle)
- : mHandle(inHandle)
- {
- }
-
- ~StHandleOwner()
- {
- NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
-
- 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;
-};
+NS_IMPL_ISUPPORTS_INHERITED1(nsPrintSettingsX, nsPrintSettings, nsPrintSettingsX)
-// Utility class for saving, locking, and restoring handle state.
-// Ok with null handle.
-class StHandleLocker
+nsPrintSettingsX::nsPrintSettingsX()
{
-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;
- }
+ NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
- ~StHandleLocker()
- {
- NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
-
- if (mHandle)
- ::HSetState(mHandle, mOldHandleState);
-
- NS_OBJC_END_TRY_ABORT_BLOCK;
- }
+ mPrintInfo = [[NSPrintInfo sharedPrintInfo] copy];
-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;
}
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;
}
nsPrintSettingsX& nsPrintSettingsX::operator=(const nsPrintSettingsX& rhs)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
if (this == &rhs) {
return *this;
}
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;
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(*this);
}
nsresult nsPrintSettingsX::Init()
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
- OSStatus status;
-
- PMPrintSession printSession = NULL;
- status = ::PMCreateSession(&printSession);
-
- if (status == noErr) {
- // First, create a default page format
- status = CreateDefaultPageFormat(printSession, mPageFormat);
- InitUnwriteableMargin();
+ 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);
mUnwriteableMargin.bottom = NS_POINTS_TO_TWIPS(paperMargin.bottom);
mUnwriteableMargin.right = NS_POINTS_TO_TWIPS(paperMargin.right);
return NS_OK;
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
-NS_IMETHODIMP nsPrintSettingsX::GetNativePrintSession(PMPrintSession *aNativePrintSession)
-{
- 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)
+void
+nsPrintSettingsX::SetCocoaPrintInfo(NSPrintInfo* aPrintInfo)
{
- 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()
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
nsresult rv;
nsCOMPtr<nsIPrefService> prefService(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
if (NS_FAILED(rv))
return rv;
nsCOMPtr<nsIPrefBranch> prefBranch;
rv = prefService->GetBranch(PRINTING_PREF_BRANCH, getter_AddRefs(prefBranch));
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;
}
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))
return rv;
nsCOMPtr<nsIPrefBranch> prefBranch;
rv = prefService->GetBranch(PRINTING_PREF_BRANCH, getter_AddRefs(prefBranch));
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;
return prefBranch->SetCharPref(MAC_OS_X_PAGE_SETUP_PREFNAME, encodedData);
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
@@ -469,65 +225,90 @@ NS_IMETHODIMP nsPrintSettingsX::_Assign(
{
nsPrintSettingsX *printSettingsX = static_cast<nsPrintSettingsX*>(aPS);
if (!printSettingsX)
return NS_ERROR_UNEXPECTED;
*this = *printSettingsX;
return NS_OK;
}
-OSStatus nsPrintSettingsX::CreateDefaultPageFormat(PMPrintSession aSession, PMPageFormat& outFormat)
-{
- NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
+// 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
- 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 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
- NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(noErr);
+PMPrintSettings
+nsPrintSettingsX::GetPMPrintSettings()
+{
+ if ([mPrintInfo respondsToSelector:@selector(PMPrintSettings)])
+ return static_cast<PMPrintSettings>([mPrintInfo PMPrintSettings]); // 10.5+
+
+ if ([mPrintInfo respondsToSelector:@selector(pmPrintSettings)])
+ return static_cast<PMPrintSettings>([mPrintInfo pmPrintSettings]); // 10.4
+
+ NS_ASSERTION(PR_FALSE, "no way of getting PMPrintSettings from NSPrintInfo");
+ PMPrintSettings printSettings;
+ PMCreatePrintSettings(&printSettings);
+ return printSettings;
}
-OSStatus nsPrintSettingsX::CreateDefaultPrintSettings(PMPrintSession aSession, PMPrintSettings& outSettings)
+PMPrintSession
+nsPrintSettingsX::GetPMPrintSession()
{
- NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
+ if ([mPrintInfo respondsToSelector:@selector(PMPrintSession)])
+ return static_cast<PMPrintSession>([mPrintInfo PMPrintSession]); // 10.5+
- OSStatus status;
- 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;
+ if ([mPrintInfo respondsToSelector:@selector(_pmPrintSession)])
+ return static_cast<PMPrintSession>([mPrintInfo _pmPrintSession]); // 10.4
- NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(noErr);
+ NS_ASSERTION(PR_FALSE, "no way of getting PMPrintSession from NSPrintInfo");
+ PMPrintSession printSession;
+ PMCreateSession(&printSession);
+ return printSession;
}
-NS_IMETHODIMP nsPrintSettingsX::CleanUpAfterCarbonDialog()
+PMPageFormat
+nsPrintSettingsX::GetPMPageFormat()
{
- NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
+ 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
- NSWindow* mainWindow = [NSApp mainWindow];
- if (mainWindow) {
- [WindowDelegate paintMenubarForWindow:mainWindow];
- } else {
- nsMenuBarX* hiddenWindowMenuBar = nsMenuUtilsX::GetHiddenWindowMenuBar();
- if (hiddenWindowMenuBar)
- hiddenWindowMenuBar->Paint();
+ 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
}
-
- NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
+
--- a/widget/src/cocoa/nsWidgetFactory.mm
+++ b/widget/src/cocoa/nsWidgetFactory.mm
@@ -59,34 +59,36 @@
#include "nsAccelerometerX.h"
#include "nsSound.h"
#include "nsIdleServiceX.h"
#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)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFilePicker)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsToolkit)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsLookAndFeel)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSound)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAccelerometerX)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboard)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardHelper)
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"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsNativeMenuServiceX)
#include "nsBidiKeyboard.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBidiKeyboard)
@@ -162,24 +164,28 @@ static const nsModuleComponentInfo gComp
{ "nsScreenManager",
NS_SCREENMANAGER_CID,
"@mozilla.org/gfx/screenmanager;1",
nsScreenManagerCocoaConstructor },
{ "nsDeviceContextSpec",
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",
nsIdleServiceXConstructor },
{ "Native Menu Service",
NS_NATIVEMENUSERVICE_CID,
"@mozilla.org/widget/nativemenuservice;1",
nsNativeMenuServiceXConstructor },
--- a/widget/src/gtk2/nsPrintDialogGTK.cpp
+++ b/widget/src/gtk2/nsPrintDialogGTK.cpp
@@ -130,17 +130,17 @@ ShowCustomDialog(GtkComboBox *changed_bo
g_object_set_data(G_OBJECT(changed_box), "previous-active", GINT_TO_POINTER(gtk_combo_box_get_active(changed_box)));
return;
}
nsCOMPtr<nsIStringBundleService> bundleSvc =
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));
GtkWidget* prompt_dialog = gtk_dialog_new_with_buttons(NS_ConvertUTF16toUTF8(intlString).get(), NULL,
GTK_DIALOG_MODAL,
GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
NULL);
@@ -225,35 +225,35 @@ class nsPrintDialogWidgetGTK {
};
nsPrintDialogWidgetGTK::nsPrintDialogWidgetGTK(nsIDOMWindow *aParent, nsIPrintSettings *aSettings)
{
GtkWindow* gtkParent = get_gtk_window_for_nsiwidget(DOMWindowToWidget(aParent));
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(
GTK_PRINT_CAPABILITY_PAGE_SET
| GTK_PRINT_CAPABILITY_COPIES
| GTK_PRINT_CAPABILITY_COLLATE
| GTK_PRINT_CAPABILITY_REVERSE
| GTK_PRINT_CAPABILITY_SCALE
)
);
// The vast majority of magic numbers in this widget construction are padding. e.g. for
// 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);
radio_as_laid_out = gtk_radio_button_new_with_mnemonic(NULL, GetUTF8FromBundle("asLaidOut").get());
if (frameUIFlag == nsIPrintSettings::kFrameEnableNone)
gtk_widget_set_sensitive(radio_as_laid_out, FALSE);
radio_selected_frame = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(radio_as_laid_out),
@@ -264,17 +264,17 @@ nsPrintDialogWidgetGTK::nsPrintDialogWid
radio_separate_frames = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(radio_as_laid_out),
GetUTF8FromBundle("separateFrames").get());
if (frameUIFlag == nsIPrintSettings::kFrameEnableNone)
gtk_widget_set_sensitive(radio_separate_frames, FALSE);
// "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);
// Align the radio buttons slightly so they appear to fall under the aforementioned label as per the GNOME HIG
GtkWidget* frames_radio_container = gtk_alignment_new(0, 0, 0, 0);
gtk_alignment_set_padding(GTK_ALIGNMENT(frames_radio_container), 8, 0, 12, 0);