diff --git a/mozilla/embedding/components/printingui/src/mac/Makefile.in b/mozilla/embedding/components/printingui/src/mac/Makefile.in index 5b094e60521..14b418aa5ee 100644 --- a/mozilla/embedding/components/printingui/src/mac/Makefile.in +++ b/mozilla/embedding/components/printingui/src/mac/Makefile.in @@ -44,12 +44,18 @@ REQUIRES = xpcom \ intl \ $(NULL) +DIRS = printpde + CPPSRCS = \ nsPrintingPromptServiceX.cpp \ 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 diff --git a/mozilla/embedding/components/printingui/src/mac/nsPrintingPromptServiceX.cpp b/mozilla/embedding/components/printingui/src/mac/nsPrintingPromptServiceX.cpp index d7124195e4f..e0faa039b41 100644 --- a/mozilla/embedding/components/printingui/src/mac/nsPrintingPromptServiceX.cpp +++ b/mozilla/embedding/components/printingui/src/mac/nsPrintingPromptServiceX.cpp @@ -54,10 +54,6 @@ #include "nsDirectoryServiceDefs.h" #include "nsPDECommon.h" -#ifndef XP_MACOSX -#include "nsILocalFIleMac.h" -#endif - // Printing Progress Includes #include "nsPrintProgress.h" #include "nsPrintProgressParams.h" @@ -71,56 +67,30 @@ // Constants static const char *kPrintProgressDialogURL = "chrome://global/content/printProgress.xul"; -// Globals -static CFPlugInRef gPDEPlugIn = nsnull; - //----------------------------------------------------------------------------- // Static Helpers //----------------------------------------------------------------------------- -static CFPlugInRef LoadPDEPlugIn() +static nsresult LoadPDEPlugIn() { -#ifndef XP_MACOSX + static CFPlugInRef gPDEPlugIn = nsnull; + if (!gPDEPlugIn) { - - nsresult rv; - nsCOMPtr dirService(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID)); - if (!dirService) - return nsnull; - nsCOMPtr pluginDir; - rv = dirService->Get(NS_XPCOM_CURRENT_PROCESS_DIR, NS_GET_IID(nsILocalFileMac), getter_AddRefs(pluginDir)); - if (NS_FAILED(rv)) - return nsnull; - pluginDir->AppendNative(NS_LITERAL_CSTRING("Essential Files")); - pluginDir->AppendNative(NS_LITERAL_CSTRING("PrintDialogPDE.plugin")); - FSSpec pluginSpec; - rv = pluginDir->GetFSSpec(&pluginSpec); - if (NS_FAILED(rv)) - return nsnull; - - OSErr err; - FSRef pluginFSRef; - char pathBuf[512]; - - err = ::FSpMakeFSRef(&pluginSpec, &pluginFSRef); - if (err) - return nsnull; - err = ::FSRefMakePath(&pluginFSRef, (UInt8 *)pathBuf, sizeof(pathBuf)-1); - if (err) - return nsnull; - - CFStringRef pathRef = ::CFStringCreateWithCString(NULL, pathBuf, kCFStringEncodingUTF8); - if (!pathRef) - return nsnull; - CFURLRef url = ::CFURLCreateWithFileSystemPath(NULL, pathRef, kCFURLPOSIXPathStyle, TRUE); - if (url) - gPDEPlugIn = ::CFPlugInCreate(NULL, url); - - ::CFRelease(pathRef); - ::CFRelease(url); + + 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); + } } -#endif - return gPDEPlugIn; + return gPDEPlugIn ? NS_OK : NS_ERROR_FAILURE; } //***************************************************************************** @@ -186,8 +156,14 @@ nsPrintingPromptService::ShowPrintDialog(nsIDOMWindow *parent, nsIWebBrowserPrin PRBool isOn; PRInt16 howToEnableFrameUI = nsIPrintSettings::kFrameEnableNone; - nsPrintExtensions printData = {false,false,false,false,false,false,false,false}; + nsPrintExtensions printData = {false,false,false,false,false,false,false,false,true,true}; + // Fetch the current extended data from the print settings + UInt32 bytesNeeded; + status = ::PMGetPrintSettingsExtendedData(nativePrintSettings, kMozPDECreatorCode, &bytesNeeded, NULL); + if (status == noErr && bytesNeeded == sizeof(printData)) + (void)::PMGetPrintSettingsExtendedData(nativePrintSettings, kMozPDECreatorCode,&bytesNeeded, &printData); + // set the values for the plugin here printSettings->GetPrintOptions(nsIPrintSettings::kEnableSelectionRB, &isOn); printData.mHaveSelection = isOn; @@ -201,20 +177,25 @@ nsPrintingPromptService::ShowPrintDialog(nsIDOMWindow *parent, nsIWebBrowserPrin printData.mHaveFrameSelected = false; } printSettings->GetShrinkToFit(&isOn); - printData.mShrinkToFit = isOn; + printData.mShrinkToFit = isOn; + printSettings->GetPrintBGColors(&isOn); + printData.mPrintBGColors = isOn; + printSettings->GetPrintBGImages(&isOn); + printData.mPrintBGImages = isOn; - CFPlugInRef pdePlugIn = ::LoadPDEPlugIn(); - status = ::PMSetPrintSettingsExtendedData(nativePrintSettings, kPDE_Creator, sizeof(printData),&printData); + rv = ::LoadPDEPlugIn(); + NS_ASSERTION(NS_SUCCEEDED(rv), "LoadPDEPlugIn() failed"); + status = ::PMSetPrintSettingsExtendedData(nativePrintSettings, kMozPDECreatorCode, sizeof(printData),&printData); + NS_ASSERTION(status == noErr, "PMSetPrintSettingsExtendedData() failed"); Boolean accepted; status = ::PMSessionPrintDialog(printSession, nativePrintSettings, pageFormat, &accepted); if (status == noErr && accepted) { - UInt32 bytesNeeded; int pageRange = -1; - status = ::PMGetPrintSettingsExtendedData(nativePrintSettings, kPDE_Creator, &bytesNeeded, NULL); + status = ::PMGetPrintSettingsExtendedData(nativePrintSettings, kMozPDECreatorCode, &bytesNeeded, NULL); if (status == noErr && bytesNeeded == sizeof(printData)) { - status = ::PMGetPrintSettingsExtendedData(nativePrintSettings, kPDE_Creator,&bytesNeeded, &printData); + status = ::PMGetPrintSettingsExtendedData(nativePrintSettings, kMozPDECreatorCode,&bytesNeeded, &printData); // set the correct data fields if (printData.mPrintSelection) { @@ -234,6 +215,8 @@ nsPrintingPromptService::ShowPrintDialog(nsIDOMWindow *parent, nsIWebBrowserPrin printSettings->SetPrintFrameType(nsIPrintSettings::kEachFrameSep); printSettings->SetShrinkToFit(printData.mShrinkToFit); + printSettings->SetPrintBGColors(printData.mPrintBGColors); + printSettings->SetPrintBGImages(printData.mPrintBGImages); } if (pageRange == -1) { diff --git a/mozilla/embedding/components/printingui/src/mac/printpde/Makefile.in b/mozilla/embedding/components/printingui/src/mac/printpde/Makefile.in new file mode 100644 index 00000000000..ddeb1eafd57 --- /dev/null +++ b/mozilla/embedding/components/printingui/src/mac/printpde/Makefile.in @@ -0,0 +1,65 @@ +# ***** 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 + +ifdef MOZ_DEBUG +BUILDSTYLE = Development +else +BUILDSTYLE = Deployment +endif + +include $(topsrcdir)/config/rules.mk + +ABS_topsrcdir := $(shell cd $(topsrcdir); pwd) +ifneq ($(ABS_topsrcdir),$(MOZ_BUILD_ROOT)) +export:: + rsync -a --exclude .DS_Store --exclude "CVS/" $(srcdir)/PrintPDE.pbproj . + ln -fs $(srcdir)/src + ln -fs $(srcdir)/res + ln -fs $(srcdir)/public +endif + +libs:: + pbxbuild -buildstyle $(BUILDSTYLE) install + cp -R build/UninstalledProducts/PrintPDE.plugin $(DIST) +clean clobber:: + rm -rf build diff --git a/mozilla/embedding/components/printingui/src/mac/printpde/PrintPDE.pbproj/project.pbxproj b/mozilla/embedding/components/printingui/src/mac/printpde/PrintPDE.pbproj/project.pbxproj new file mode 100644 index 00000000000..36096144e32 --- /dev/null +++ b/mozilla/embedding/components/printingui/src/mac/printpde/PrintPDE.pbproj/project.pbxproj @@ -0,0 +1,409 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 38; + objects = { + 015B6DBE004B2AF27F000001 = { + isa = PBXBundleReference; + path = PrintPDE.plugin; + refType = 3; + }; + 015B6DC0004B2AF27F000001 = { + buildPhases = ( + 015B6DC1004B2AF27F000001, + 015B6DC2004B2AF27F000001, + 015B6DC3004B2AF27F000001, + 015B6DC4004B2AF27F000001, + 015B6DC5004B2AF27F000001, + ); + buildSettings = { + FRAMEWORK_SEARCH_PATHS = "\"$(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks\" \"$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Frameworks\""; + HEADER_SEARCH_PATHS = .; + INSTALL_MODE_FLAG = "u+w"; + OPTIMIZATION_CFLAGS = "-O2"; + 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 = PBXBundleTarget; + name = PrintPDE; + productName = PrintDialogPDE.plugin; + productReference = 015B6DBE004B2AF27F000001; + productSettingsXML = " + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + PrintPDE + CFBundleGetInfoString + + CFBundleIconFile + + CFBundleIdentifier + org.mozilla.pde.MOZZ + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + PrintPDE + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + MOZZ + CFBundleVersion + 1.0 + CFPlugInDynamicRegistration + NO + CFPlugInFactories + + 00000000-0000-0000-0000-000000000000 + MyCFPlugInFactory + + CFPlugInTypes + + BCB07250-E57F-11D3-8CA6-0050E4603277 + + 00000000-0000-0000-0000-000000000000 + + + + +"; + shouldUseHeadermap = 0; + }; + 015B6DC1004B2AF27F000001 = { + buildActionMask = 2147483647; + files = ( + F73AA2E0026B518801CB2098, + F73AA2E1026B518801CB2098, + F73AA2E2026B518801CB2098, + F586CCD603BC18BC01202892, + ); + isa = PBXHeadersBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 015B6DC2004B2AF27F000001 = { + buildActionMask = 2147483647; + files = ( + F73AA2E4026B518801CB2098, + F73AA2E5026B518801CB2098, + ); + isa = PBXResourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 015B6DC3004B2AF27F000001 = { + buildActionMask = 2147483647; + files = ( + F73AA2E6026B518801CB2098, + F73AA2E7026B518801CB2098, + F73AA2E8026B518801CB2098, + ); + isa = PBXSourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 015B6DC4004B2AF27F000001 = { + buildActionMask = 2147483647; + files = ( + 015B6DD2004B2D337F000001, + ); + isa = PBXFrameworksBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 015B6DC5004B2AF27F000001 = { + buildActionMask = 2147483647; + files = ( + ); + isa = PBXRezBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 015B6DD2004B2D337F000001 = { + fileRef = 01823927FFE8053411CA24C1; + isa = PBXBuildFile; + settings = { + }; + }; + 01823927FFE8053411CA24C1 = { + isa = PBXFrameworkReference; + name = Carbon.framework; + path = /System/Library/Frameworks/Carbon.framework; + refType = 0; + }; + 01ACF443FFC1C83D11CA2470 = { + buildRules = ( + ); + buildSettings = { + COPY_PHASE_STRIP = NO; + OPTIMIZATION_CFLAGS = "-O0"; + }; + isa = PBXBuildStyle; + name = Development; + }; + 01ACF444FFC1C83D11CA2470 = { + buildRules = ( + ); + buildSettings = { + COPY_PHASE_STRIP = YES; + }; + isa = PBXBuildStyle; + name = Deployment; + }; +//010 +//011 +//012 +//013 +//014 +//080 +//081 +//082 +//083 +//084 + 089C1669FE841209C02AAC07 = { + buildStyles = ( + 01ACF443FFC1C83D11CA2470, + 01ACF444FFC1C83D11CA2470, + ); + isa = PBXProject; + mainGroup = 089C166AFE841209C02AAC07; + projectDirPath = ""; + targets = ( + 015B6DC0004B2AF27F000001, + ); + }; + 089C166AFE841209C02AAC07 = { + children = ( + F849B8C8029C68B901CB2098, + 089C1671FE841209C02AAC07, + 19C28FB6FE9D52B211CA2CBB, + ); + isa = PBXGroup; + name = CFPlugInBundle; + refType = 4; + }; + 089C1671FE841209C02AAC07 = { + children = ( + 01823927FFE8053411CA24C1, + ); + isa = PBXGroup; + name = "External Frameworks and Libraries"; + refType = 4; + }; +//080 +//081 +//082 +//083 +//084 +//190 +//191 +//192 +//193 +//194 + 19C28FB6FE9D52B211CA2CBB = { + children = ( + 015B6DBE004B2AF27F000001, + ); + isa = PBXGroup; + name = Products; + refType = 4; + }; +//190 +//191 +//192 +//193 +//194 +//F50 +//F51 +//F52 +//F53 +//F54 + F57C986203B8293D01202892 = { + isa = PBXFileReference; + path = nsPDECommon.h; + refType = 4; + }; + F586CCD503BC184501202892 = { + children = ( + F57C986203B8293D01202892, + ); + isa = PBXGroup; + path = public; + refType = 4; + }; + F586CCD603BC18BC01202892 = { + fileRef = F57C986203B8293D01202892; + isa = PBXBuildFile; + settings = { + }; + }; +//F50 +//F51 +//F52 +//F53 +//F54 +//F70 +//F71 +//F72 +//F73 +//F74 + F73AA2D2026B518801CB2098 = { + isa = PBXFileReference; + path = PDECore.h; + refType = 4; + }; + F73AA2D3026B518801CB2098 = { + isa = PBXFileReference; + path = PDECustom.h; + refType = 4; + }; + F73AA2D4026B518801CB2098 = { + isa = PBXFileReference; + path = PDEUtilities.h; + refType = 4; + }; + F73AA2D5026B518801CB2098 = { + children = ( + F73AA2D8026B518801CB2098, + F73AA2DA026B518801CB2098, + ); + isa = PBXGroup; + path = res; + refType = 4; + }; + F73AA2D8026B518801CB2098 = { + children = ( + F73AA2D9026B518801CB2098, + ); + isa = PBXVariantGroup; + name = Localizable.strings; + path = ""; + refType = 4; + }; + F73AA2D9026B518801CB2098 = { + isa = PBXFileReference; + name = English; + path = English.lproj/Localizable.strings; + refType = 4; + }; + F73AA2DA026B518801CB2098 = { + children = ( + F73AA2DB026B518801CB2098, + ); + isa = PBXVariantGroup; + name = PrintPDE.nib; + path = ""; + refType = 4; + }; + F73AA2DB026B518801CB2098 = { + isa = PBXFileReference; + name = English; + path = English.lproj/PrintPDE.nib; + refType = 4; + }; + F73AA2DC026B518801CB2098 = { + children = ( + F73AA2DD026B518801CB2098, + F73AA2D2026B518801CB2098, + F73AA2DE026B518801CB2098, + F73AA2D3026B518801CB2098, + F73AA2DF026B518801CB2098, + F73AA2D4026B518801CB2098, + ); + isa = PBXGroup; + path = src; + refType = 4; + }; + F73AA2DD026B518801CB2098 = { + isa = PBXFileReference; + path = PDECore.c; + refType = 4; + }; + F73AA2DE026B518801CB2098 = { + isa = PBXFileReference; + path = PDECustom.c; + refType = 4; + }; + F73AA2DF026B518801CB2098 = { + isa = PBXFileReference; + path = PDEUtilities.c; + refType = 4; + }; + F73AA2E0026B518801CB2098 = { + fileRef = F73AA2D2026B518801CB2098; + isa = PBXBuildFile; + settings = { + }; + }; + F73AA2E1026B518801CB2098 = { + fileRef = F73AA2D3026B518801CB2098; + isa = PBXBuildFile; + settings = { + }; + }; + F73AA2E2026B518801CB2098 = { + fileRef = F73AA2D4026B518801CB2098; + isa = PBXBuildFile; + settings = { + }; + }; + F73AA2E4026B518801CB2098 = { + fileRef = F73AA2D8026B518801CB2098; + isa = PBXBuildFile; + settings = { + }; + }; + F73AA2E5026B518801CB2098 = { + fileRef = F73AA2DA026B518801CB2098; + isa = PBXBuildFile; + settings = { + }; + }; + F73AA2E6026B518801CB2098 = { + fileRef = F73AA2DD026B518801CB2098; + isa = PBXBuildFile; + settings = { + }; + }; + F73AA2E7026B518801CB2098 = { + fileRef = F73AA2DE026B518801CB2098; + isa = PBXBuildFile; + settings = { + }; + }; + F73AA2E8026B518801CB2098 = { + fileRef = F73AA2DF026B518801CB2098; + isa = PBXBuildFile; + settings = { + }; + }; +//F70 +//F71 +//F72 +//F73 +//F74 +//F80 +//F81 +//F82 +//F83 +//F84 + F849B8C8029C68B901CB2098 = { + children = ( + F586CCD503BC184501202892, + F73AA2DC026B518801CB2098, + F73AA2D5026B518801CB2098, + ); + isa = PBXGroup; + name = PrintPDE; + refType = 4; + }; + }; + rootObject = 089C1669FE841209C02AAC07; +} diff --git a/mozilla/gfx/public/nsPDECommon.h b/mozilla/embedding/components/printingui/src/mac/printpde/public/nsPDECommon.h similarity index 90% rename from mozilla/gfx/public/nsPDECommon.h rename to mozilla/embedding/components/printingui/src/mac/printpde/public/nsPDECommon.h index 7b4dafbc496..28eb0f29c3d 100644 --- a/mozilla/gfx/public/nsPDECommon.h +++ b/mozilla/embedding/components/printingui/src/mac/printpde/public/nsPDECommon.h @@ -40,31 +40,31 @@ #define nsPDECommon_h___ -#define kPDE_Creator 'MOZZ' +#define kMozPDESignature "MOZZ" +#define kMozPDECreatorCode 'MOZZ' typedef struct { + // State info supplied by printing app Boolean mHaveSelection; Boolean mHaveFrames; Boolean mHaveFrameSelected; - Boolean mPrintSelection; + // The UI of the PDE allows control of these Boolean mPrintFrameAsIs; Boolean mPrintSelectedFrame; Boolean mPrintFramesSeparately; + Boolean mPrintSelection; Boolean mShrinkToFit; + Boolean mPrintBGColors; + Boolean mPrintBGImages; } nsPrintExtensions; -#define kPrintTitlesDefault false // the initial default value of our page format custom data - // Our tag for the Print Settings ticket. This should be defined in an application // header that is common to this file and the applications' files so that it // can get access to the data set in the Print Settings. -#define kAppPrintDialogPDEOnlyKey CFSTR("com.apple.print.PrintSettingsTicket.MOZZ") - -#define kPrintSelectionOnlyDefault false // the initial default value of custom print settings custom data +#define kAppPrintDialogPDEOnlyKey CFSTR("com.apple.print.PrintSettingsTicket." kMozPDESignature) - -#endif +#endif \ No newline at end of file diff --git a/mozilla/embedding/components/printingui/src/mac/printpde/res/English.lproj/Localizable.strings b/mozilla/embedding/components/printingui/src/mac/printpde/res/English.lproj/Localizable.strings new file mode 100644 index 00000000000..2d07e3e0cff Binary files /dev/null and b/mozilla/embedding/components/printingui/src/mac/printpde/res/English.lproj/Localizable.strings differ diff --git a/mozilla/embedding/components/printingui/src/mac/printpde/res/English.lproj/PrintPDE.nib/classes.nib b/mozilla/embedding/components/printingui/src/mac/printpde/res/English.lproj/PrintPDE.nib/classes.nib new file mode 100644 index 00000000000..ea58db1189a --- /dev/null +++ b/mozilla/embedding/components/printingui/src/mac/printpde/res/English.lproj/PrintPDE.nib/classes.nib @@ -0,0 +1,4 @@ +{ +IBClasses = (); +IBVersion = 1; +} diff --git a/mozilla/embedding/components/printingui/src/mac/printpde/res/English.lproj/PrintPDE.nib/info.nib b/mozilla/embedding/components/printingui/src/mac/printpde/res/English.lproj/PrintPDE.nib/info.nib new file mode 100644 index 00000000000..b8f83ace691 --- /dev/null +++ b/mozilla/embedding/components/printingui/src/mac/printpde/res/English.lproj/PrintPDE.nib/info.nib @@ -0,0 +1,16 @@ + + + + + IBDocumentLocation + 615 91 356 240 0 0 1600 1002 + IBFramework Version + 286.0 + IBLockedObjects + + IBSystem Version + 6G30 + targetFramework + IBCarbonFramework + + diff --git a/mozilla/embedding/components/printingui/src/mac/printpde/res/English.lproj/PrintPDE.nib/objects.xib b/mozilla/embedding/components/printingui/src/mac/printpde/res/English.lproj/PrintPDE.nib/objects.xib new file mode 100644 index 00000000000..46e6ab36b45 --- /dev/null +++ b/mozilla/embedding/components/printingui/src/mac/printpde/res/English.lproj/PrintPDE.nib/objects.xib @@ -0,0 +1,113 @@ + + + IBCarbonFramework + + NSApplication + + + + 195 570 431 1074 + Window + + 0 0 236 504 + + + 0 0 216 478 + + + 20 117 38 325 + MOZZ + 4002 + Print Selection Only + + + 46 117 60 325 + MOZZ + 4003 + Shrink To Fit Page Width + + + 82 117 96 325 + MOZZ + 4004 + Print Background Colors + + + 104 117 118 325 + MOZZ + 4005 + Print Background Images + + + 135 116 196 325 + MOZZ + 4001 + 3 + 4 + + + Radio1 + + + Radio2 + + + Radio + + + + + 133 20 149 109 + Frames: + -1 + + + 20 20 36 109 + Options: + -1 + + + 80 20 96 109 + Appearance: + -1 + + + MOZZ + 4000 + 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + File's Owner + + PrintPDE + + + 219 + diff --git a/mozilla/embedding/components/printingui/src/mac/printpde/src/PDECore.c b/mozilla/embedding/components/printingui/src/mac/printpde/src/PDECore.c new file mode 100644 index 00000000000..c6068798aab --- /dev/null +++ b/mozilla/embedding/components/printingui/src/mac/printpde/src/PDECore.c @@ -0,0 +1,741 @@ +/* +******************************************************************************** + + $Log: not supported by cvs2svn $ + + + (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 +#include + +#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 diff --git a/mozilla/embedding/components/printingui/src/mac/printpde/src/PDECore.h b/mozilla/embedding/components/printingui/src/mac/printpde/src/PDECore.h new file mode 100644 index 00000000000..1d83f1e4c80 --- /dev/null +++ b/mozilla/embedding/components/printingui/src/mac/printpde/src/PDECore.h @@ -0,0 +1,75 @@ +/* +******************************************************************************** + + $Log: not supported by cvs2svn $ + + + (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 + + +/* +-------------------------------------------------------------------------------- + session context +-------------------------------------------------------------------------------- +*/ + +typedef struct +{ + ControlRef userPane; + EventHandlerRef helpHandler; + EventHandlerUPP helpHandlerUPP; + void* customContext; + Boolean initialized; + +} MyContextBlock; + +typedef MyContextBlock* MyContext; + + +#endif diff --git a/mozilla/embedding/components/printingui/src/mac/printpde/src/PDECustom.c b/mozilla/embedding/components/printingui/src/mac/printpde/src/PDECustom.c new file mode 100644 index 00000000000..8988b160f9e --- /dev/null +++ b/mozilla/embedding/components/printingui/src/mac/printpde/src/PDECustom.c @@ -0,0 +1,662 @@ +/* -*- 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 + * + * 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 +#include + +#include "PDECore.h" +#include "PDECustom.h" +#include "PDEUtilities.h" + +// Static Prototypes +static void InitSettings(nsPrintExtensions* settings); +static void SyncPaneFromSettings(MyCustomContext context); +static void SyncSettingsFromPane(MyCustomContext context); +static CFStringRef GetSummaryTextBooleanValue(Boolean value); +static CFStringRef GetSummaryTextNAValue(); + +/* +-------------------------------------------------------------------------------- + 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) +{ + 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 }; + + 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)); + + // 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; + + 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); + } + + return result; +} + + +#pragma mark - + +/* +-------------------------------------------------------------------------------- + MySyncPaneFromTicket +-------------------------------------------------------------------------------- +*/ + +extern OSStatus MySyncPaneFromTicket ( + MyCustomContext context, + PMPrintSession session +) + +{ + CFDataRef data = NULL; + CFIndex length = 0; + OSStatus result = noErr; + PMTicketRef ticket = NULL; + + result = MyGetTicket (session, kPDE_PMPrintSettingsRef, &ticket); + + if (result == noErr) + { + // copy ticket data into our settings + result = PMTicketGetCFData ( + ticket, + kPMTopLevel, + kPMTopLevel, + kMyAppPrintSettingsKey, + &data + ); + + if (result == noErr) + { + length = CFDataGetLength (data); + + if (length == sizeof(nsPrintExtensions)) + { + CFDataGetBytes ( + data, + CFRangeMake(0,length), + (UInt8*) &(context->settings) + ); + } + else + { // so below we use the default value for mismatched length + result = kPMKeyNotFound; + } + } + + 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 +) + +{ + CFDataRef data = NULL; + OSStatus result = noErr; + PMTicketRef ticket = NULL; + + result = MyGetTicket (session, kPDE_PMPrintSettingsRef, &ticket); + if (result == noErr) + { + // If our pane has never been shown, this will be a noop. + SyncSettingsFromPane(context); + + data = CFDataCreate ( + kCFAllocatorDefault, + (UInt8*) &context->settings, + sizeof(nsPrintExtensions) + ); + + if (data != NULL) + { + // update ticket + result = PMTicketSetCFData ( + ticket, + kMyBundleIdentifier, + kMyAppPrintSettingsKey, + data, + kPMUnlocked + ); + + CFRelease (data); + } + } + + MyDebugMessage("MySyncTicket", result); + return result; +} + +#pragma mark - + +/* +-------------------------------------------------------------------------------- + Static Routines +-------------------------------------------------------------------------------- +*/ + +static void InitSettings(nsPrintExtensions* 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; +} + + +static void SyncPaneFromSettings(MyCustomContext context) +{ + if (context->controls.frameRadioGroup) + { + if (context->settings.mHaveFrames) + { + EnableControl(context->controls.frameRadioGroup); + + if (context->settings.mPrintSelectedFrame && + context->settings.mHaveFrameSelected) + SetControlValue(context->controls.frameRadioGroup, + kFramesSelectedIndex); + else if (context->settings.mPrintFramesSeparately) + SetControlValue(context->controls.frameRadioGroup, + kFramesEachSeparatelyIndex); + else /* (context->settings.mPrintFrameAsIs) */ + SetControlValue(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); + SetControlValue(context->controls.frameRadioGroup, 0); + } + } + + if (context->controls.printSelCheck) + { + if (context->settings.mHaveSelection) + { + EnableControl(context->controls.printSelCheck); + SetControlValue(context->controls.printSelCheck, + context->settings.mPrintSelection); + } + else + { + DisableControl(context->controls.printSelCheck); + SetControlValue(context->controls.printSelCheck, 0); + } + } + if (context->controls.shrinkToFitCheck) + SetControlValue(context->controls.shrinkToFitCheck, + context->settings.mShrinkToFit); + if (context->controls.printBGColorsCheck) + SetControlValue(context->controls.printBGColorsCheck, + context->settings.mPrintBGColors); + if (context->controls.printBGImagesCheck) + SetControlValue(context->controls.printBGImagesCheck, + context->settings.mPrintBGImages); +} + + +static void SyncSettingsFromPane(MyCustomContext context) +{ + if (context->controls.frameRadioGroup) + { + context->settings.mPrintFrameAsIs = false; + context->settings.mPrintSelectedFrame = false; + context->settings.mPrintFramesSeparately = false; + switch (GetControlValue(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 = + GetControlValue(context->controls.printSelCheck); + if (context->controls.printSelCheck) + context->settings.mShrinkToFit = + GetControlValue(context->controls.shrinkToFitCheck); + if (context->controls.printSelCheck) + context->settings.mPrintBGColors = + GetControlValue(context->controls.printBGColorsCheck); + if (context->controls.printSelCheck) + context->settings.mPrintBGImages = + GetControlValue(context->controls.printBGImagesCheck); +} + +#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)"); + +} + +/* END OF SOURCE */ diff --git a/mozilla/embedding/components/printingui/src/mac/printpde/src/PDECustom.h b/mozilla/embedding/components/printingui/src/mac/printpde/src/PDECustom.h new file mode 100644 index 00000000000..2050ffecb48 --- /dev/null +++ b/mozilla/embedding/components/printingui/src/mac/printpde/src/PDECustom.h @@ -0,0 +1,212 @@ +/* -*- 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 + * + * 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 = 216, + 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; +} MyControls; + +typedef nsPrintExtensions 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 diff --git a/mozilla/embedding/components/printingui/src/mac/printpde/src/PDEUtilities.c b/mozilla/embedding/components/printingui/src/mac/printpde/src/PDEUtilities.c new file mode 100644 index 00000000000..bd3e8565a95 --- /dev/null +++ b/mozilla/embedding/components/printingui/src/mac/printpde/src/PDEUtilities.c @@ -0,0 +1,394 @@ +/* +******************************************************************************** + + $Log: not supported by cvs2svn $ + + + (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 +#include + +#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); + } +} + + +/* +-------------------------------------------------------------------------------- + _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 diff --git a/mozilla/embedding/components/printingui/src/mac/printpde/src/PDEUtilities.h b/mozilla/embedding/components/printingui/src/mac/printpde/src/PDEUtilities.h new file mode 100644 index 00000000000..69af8504db6 --- /dev/null +++ b/mozilla/embedding/components/printingui/src/mac/printpde/src/PDEUtilities.h @@ -0,0 +1,81 @@ +/* +******************************************************************************** + + $Log: not supported by cvs2svn $ + + + (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 +#include + +#include "PDECore.h" + + +/* +-------------------------------------------------------------------------------- + Prototypes +-------------------------------------------------------------------------------- +*/ + +extern void MyDebugMessage (char *msg, SInt32 err); + +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 diff --git a/mozilla/gfx/public/Makefile.in b/mozilla/gfx/public/Makefile.in index 8cca5f8007a..fa3a92e8f14 100644 --- a/mozilla/gfx/public/Makefile.in +++ b/mozilla/gfx/public/Makefile.in @@ -59,7 +59,6 @@ EXPORTS = \ ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT))) EXPORTS += \ nsIPrintingContext.h \ - nsPDECommon.h \ nsRepeater.h \ $(NULL) endif diff --git a/mozilla/gfx/src/mac/nsPDECommon.h b/mozilla/gfx/src/mac/nsPDECommon.h deleted file mode 100644 index 7b4dafbc496..00000000000 --- a/mozilla/gfx/src/mac/nsPDECommon.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape 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/NPL/ - * - * 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 NPL, 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 NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef nsPDECommon_h___ -#define nsPDECommon_h___ - - -#define kPDE_Creator 'MOZZ' - - -typedef struct { - Boolean mHaveSelection; - Boolean mHaveFrames; - Boolean mHaveFrameSelected; - Boolean mPrintSelection; - Boolean mPrintFrameAsIs; - Boolean mPrintSelectedFrame; - Boolean mPrintFramesSeparately; - Boolean mShrinkToFit; -} nsPrintExtensions; - - - -#define kPrintTitlesDefault false // the initial default value of our page format custom data - -// Our tag for the Print Settings ticket. This should be defined in an application -// header that is common to this file and the applications' files so that it -// can get access to the data set in the Print Settings. -#define kAppPrintDialogPDEOnlyKey CFSTR("com.apple.print.PrintSettingsTicket.MOZZ") - -#define kPrintSelectionOnlyDefault false // the initial default value of custom print settings custom data - - - -#endif diff --git a/mozilla/gfx/src/mac/printerplugin/Headers/PrintDialogPDE.h b/mozilla/gfx/src/mac/printerplugin/Headers/PrintDialogPDE.h deleted file mode 100644 index cf75850487a..00000000000 --- a/mozilla/gfx/src/mac/printerplugin/Headers/PrintDialogPDE.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape 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/NPL/ - * - * 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 NPL, 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 NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef PrintDialogPDE_h___ -#define PrintDialogPDE_h___ - - - - -enum { -ePrintSelectionControlID = 4000, -ePrintFrameAsIsControlID, -ePrintSelectedFrameControlID, -ePrintFramesSeparatelyControlID, -eShrinkToFiControlID, -eRadioGroupControlID, -}; - -#endif diff --git a/mozilla/gfx/src/mac/printerplugin/PrintDialogPDE.plugin/Contents/Info.plist b/mozilla/gfx/src/mac/printerplugin/PrintDialogPDE.plugin/Contents/Info.plist deleted file mode 100644 index 50f1c1e5426..00000000000 Binary files a/mozilla/gfx/src/mac/printerplugin/PrintDialogPDE.plugin/Contents/Info.plist and /dev/null differ diff --git a/mozilla/gfx/src/mac/printerplugin/PrintDialogPDE.plugin/Contents/MacOS/PrintDialogPDE b/mozilla/gfx/src/mac/printerplugin/PrintDialogPDE.plugin/Contents/MacOS/PrintDialogPDE deleted file mode 100644 index 6662ba3adfa..00000000000 Binary files a/mozilla/gfx/src/mac/printerplugin/PrintDialogPDE.plugin/Contents/MacOS/PrintDialogPDE and /dev/null differ diff --git a/mozilla/gfx/src/mac/printerplugin/PrintDialogPDE.plugin/Contents/PkgInfo b/mozilla/gfx/src/mac/printerplugin/PrintDialogPDE.plugin/Contents/PkgInfo deleted file mode 100644 index 7b0b7159c12..00000000000 Binary files a/mozilla/gfx/src/mac/printerplugin/PrintDialogPDE.plugin/Contents/PkgInfo and /dev/null differ diff --git a/mozilla/gfx/src/mac/printerplugin/PrintDialogPDE.plugin/Contents/Resources/English.lproj/Localizable.strings b/mozilla/gfx/src/mac/printerplugin/PrintDialogPDE.plugin/Contents/Resources/English.lproj/Localizable.strings deleted file mode 100644 index 5294398b024..00000000000 Binary files a/mozilla/gfx/src/mac/printerplugin/PrintDialogPDE.plugin/Contents/Resources/English.lproj/Localizable.strings and /dev/null differ diff --git a/mozilla/gfx/src/mac/printerplugin/PrintDialogPDE.plugin/Contents/Resources/English.lproj/Localized.rsrc b/mozilla/gfx/src/mac/printerplugin/PrintDialogPDE.plugin/Contents/Resources/English.lproj/Localized.rsrc deleted file mode 100644 index d3344588e70..00000000000 Binary files a/mozilla/gfx/src/mac/printerplugin/PrintDialogPDE.plugin/Contents/Resources/English.lproj/Localized.rsrc and /dev/null differ diff --git a/mozilla/gfx/src/mac/printerplugin/PrintDialogPDE.plugin/Contents/pbdevelopment.plist b/mozilla/gfx/src/mac/printerplugin/PrintDialogPDE.plugin/Contents/pbdevelopment.plist deleted file mode 100644 index 9c9b7e6c18d..00000000000 Binary files a/mozilla/gfx/src/mac/printerplugin/PrintDialogPDE.plugin/Contents/pbdevelopment.plist and /dev/null differ diff --git a/mozilla/gfx/src/mac/printerplugin/Source/PrintDialogPDE.c b/mozilla/gfx/src/mac/printerplugin/Source/PrintDialogPDE.c deleted file mode 100644 index afc22a0447e..00000000000 --- a/mozilla/gfx/src/mac/printerplugin/Source/PrintDialogPDE.c +++ /dev/null @@ -1,822 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape 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/NPL/ - * - * 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. - * - * - * - * 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 NPL, 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 NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include -#include -#include -#include - -#include -#include -#include - - -#include "PrintDialogPDE.h" -#include "nsPDECommon.h" - -/* - * The text and labels for the PDE are localized using a strings file. - * You can use the command genstrings to create a strings file from this source. Use: - * genstrings -s CopyLocalizedStringFromPlugin PrintDialogPDE.cp - */ -#define CopyLocalizedStringFromPlugin(key, pluginBundleRef) \ - CFBundleCopyLocalizedString((pluginBundleRef), (key), (key), NULL) - -// each application needs to customize these CFSTRs to identify their application -#define kPMPrintingManager CFSTR("org.mozilla.printingmanager") -#define kSampleAppUserOptionKindID CFSTR("org.mozilla.print.pde.PrintDialogPDEOnly") -#define kPrintDialogPDEBundleID CFSTR("org.mozilla.print.pde.PrintDialogPDE") - -// Generated from GUIDGEN -#define kPrintDialogPDEIntfFactoryIDStr CFSTR("F48965F3-45C2-11D6-A87C-00105A183419") - -#define kMAXH 150 // max size of our drawing area -#define kMAXV 130 // should be calculated based on our needs - -enum { - kSyncDirectionSetTickets = false, // Set Ticket(s) based on UI - kSyncDirectionSetUserInterface = true // Set UI to reflect Ticket(s) -}; - -const ResType kPlugInCreator = kPDE_Creator; // should be set to an appropriate creator - -/*---------------------------------------------------------------------------- - Type definitions -------------------------------------------------------------------------------*/ - - -typedef struct { - const IUnknownVTbl* vtable; // Pointer to the vtable: - IUnknownVTbl vtableStorage; // Our vtable storage: - CFUUIDRef factoryID; // Factory ID this instance is for: - ULONG refCount; // Reference counter: -} IUnknownInstance; - - -typedef struct{ - PlugInIntfVTable* vtable; - UInt32 refCount; // Reference counter -} PrintSelOnlyPlugInInterface; - -typedef struct{ - SInt16 theResFile; // Resource File of this PDE - CFBundleRef theBundleRef; // Our bundle reference - CFStringRef titleStringRef; // Our PDE's title string ref - ControlRef thePrintSelectionOnly; - ControlRef thePrintFrameAsIs; - ControlRef thePrintSelectedFrame; - ControlRef thePrintFramesSeparately; - ControlRef theShrinkToFit; - ControlRef theRadioGroup; -} PrintDialogPDEOnlyContext, *PrintDialogPDEOnlyContextPtr; - - -static OSStatus GetTicketRef(PMPrintSession printSession, CFStringRef aTicket, - PMTicketRef* aPrintSettingsPtr); - -static OSStatus InitContext ( PrintDialogPDEOnlyContextPtr* aContext); - -#pragma export on -#if __cplusplus -extern "C" { -#endif - -// The following define prototypes for the PDE API... -static OSStatus MozPDEPrologue( PMPDEContext *aContext, - OSType *aCreator, - CFStringRef *aUserOptionKind, - CFStringRef *aTtitle, - UInt32 *aMaxH, - UInt32 *aMaxV); - -static OSStatus MozPDEInitialize( PMPDEContext aContext, - PMPDEFlags *aFlags, - PMPDERef aRef, - ControlRef aParentUserPane, - PMPrintSession aPrintSession); - -static OSStatus MozPDEGetSummaryText( PMPDEContext aContext, - CFArrayRef *aTitleArray, - CFArrayRef *aSummaryArray); - -static OSStatus MozPDESync( PMPDEContext aContext, - PMPrintSession aPrintSession, - Boolean aReinitializePlugin); - -static OSStatus MozPDEOpen(PMPDEContext aContext); - -static OSStatus MozPDEClose(PMPDEContext aContext); - -static OSStatus MozPDETerminate(PMPDEContext aContext,OSStatus aStatus); - -#if __cplusplus -} -#endif -#pragma export off - - -// Factory ID and routine. -// Plugin factory names must not be mangled by C++ compiler. - -#if __cplusplus -extern "C" { -#endif - // Factory function: - void* PrintDialogPDEPluginFactory( CFAllocatorRef aAllocator, CFUUIDRef aTypeID ); -#if __cplusplus -} -#endif - -// More Prototypes -static OSStatus MozCreatePlugInInterface( PlugInIntf** aObjPtr ); -static ULONG IUnknownAddRef( void* aObj ); -static ULONG IUnknownRelease( void* aObj ); - - -//======================================================================================== - -static ULONG -IUnknownAddRef(void* aObj) -{ - IUnknownInstance* instance = (IUnknownInstance*) aObj; - ULONG refCount = 0; // We can't do much with errors here since we can only - // update reference count value. - if (instance != NULL) { - // Get updated refCount value (should be under mutex): - refCount = ++instance->refCount; - } else { - refCount = 0; - } - return refCount; -} - -//======================================================================================== - -static ULONG -IUnknownRelease(void* aObj) -{ - IUnknownInstance* instance = (IUnknownInstance*) aObj; - ULONG refCount = 0; - - // We can't do much with errors here since we can only return - // updated reference count value. - if (instance != NULL) { - // Get updated refCount value (should be under mutex): - // Make sure refCount is non-zero: - if (0 == instance->refCount) { - instance = NULL; - return(refCount); - } - - refCount = --instance->refCount; - - // Is it time to self-destruct? - if (0 == refCount) { - // Unregister 'instance for factory' with CoreFoundation: - CFPlugInRemoveInstanceForFactory(instance->factoryID); - // Release used factoryID: - CFRelease(instance->factoryID); - instance->factoryID = NULL; - - // Deallocate object's memory block: - free((void*) instance); - instance = NULL; - } - } - - return refCount; -} - -//======================================================================================== - -static OSStatus -MozPMRetain(PMPlugInHeaderInterface* aObj) -{ - if (aObj != NULL) { - PrintSelOnlyPlugInInterface* plugin = (PrintSelOnlyPlugInInterface*) aObj; - - // Increment reference count: - plugin->refCount++; - } - return noErr; -} - -//======================================================================================== - -static OSStatus -MozPMRelease(PMPlugInHeaderInterface** aObjPtr) -{ - if (*aObjPtr != NULL) { - PrintSelOnlyPlugInInterface* plugin = (PrintSelOnlyPlugInInterface*) *aObjPtr; - - // Clear caller's variable: - *aObjPtr = NULL; - - // Decrement reference count: - plugin->refCount--; - - // When reference count is zero it's time self-destruct: - if (0 == plugin->refCount) { - // Delete object's vtable: - free((char *)plugin->vtable); - // Delete object's memory block: - free((char *)plugin); - } - } - return noErr; -} - -//======================================================================================== - -static OSStatus -MozPMGetAPIVersion(PMPlugInHeaderInterface* aObj,PMPlugInAPIVersion* aVersionPtr) -{ - // Return versioning info: - aVersionPtr->buildVersionMajor = kPDEBuildVersionMajor; - aVersionPtr->buildVersionMinor = kPDEBuildVersionMinor; - aVersionPtr->baseVersionMajor = kPDEBaseVersionMajor; - aVersionPtr->baseVersionMinor = kPDEBaseVersionMinor; - - return noErr; -} - -//======================================================================================== - -static OSStatus -MozCreatePlugInInterface(PlugInIntf** aObjPtr ) -{ - PrintSelOnlyPlugInInterface* intf = NULL; - PlugInIntfVTable* vtable = NULL; - - // Allocate object and clear it: - intf = (PrintSelOnlyPlugInInterface*) calloc(1, sizeof( PrintSelOnlyPlugInInterface )); - - if (intf != NULL) { - // Assign all plugin data members: - intf->refCount = 1; - - // Allocate object's vtable and clear it: - vtable = (PlugInIntfVTable*) calloc(1, sizeof( PlugInIntfVTable )); - if (vtable != NULL) { - intf->vtable = vtable; - - // Assign all plugin header methods: - vtable->plugInHeader.Retain = MozPMRetain; - vtable->plugInHeader.Release = MozPMRelease; - vtable->plugInHeader.GetAPIVersion = MozPMGetAPIVersion; - - // Assign all plugin methods: - vtable->Prologue = MozPDEPrologue; - vtable->Initialize = MozPDEInitialize; - vtable->Sync = MozPDESync; - vtable->GetSummaryText = MozPDEGetSummaryText; - vtable->Open = MozPDEOpen; - vtable->Close = MozPDEClose; - vtable->Terminate = MozPDETerminate; - } - } - - // Return results: - *aObjPtr = (PlugInIntf*) intf; - - return noErr; -} - -//======================================================================================== - -static HRESULT -IUnknownQueryInterface(void* aObj,REFIID aIID,LPVOID* aIntfPtr ) -{ - IUnknownInstance* instance = (IUnknownInstance*) aObj; - CFUUIDRef theIntfID = NULL, reqIntfID = NULL; - HRESULT err = E_UNEXPECTED; - PlugInIntf* interface; - - // Get IDs for requested and PDE interfaces: - reqIntfID = CFUUIDCreateFromUUIDBytes( kCFAllocatorDefault, aIID ); - theIntfID = CFUUIDCreateFromString( kCFAllocatorDefault, kDialogExtensionIntfIDStr ); - if (reqIntfID && theIntfID) { - // If we are asked to return the interface for - // the IUnknown vtable, which the system already has access to, - // just increment the refcount value - if (CFEqual( reqIntfID, IUnknownUUID ) ) { - instance->vtable->AddRef( (void*) instance ); - *aIntfPtr = (LPVOID) instance; - err = S_OK; - } else if (CFEqual(reqIntfID, theIntfID)) { - err = MozCreatePlugInInterface( &interface ); - if ( noErr == err ) { - *aIntfPtr = (LPVOID) interface; - err = S_OK; - } else { - *aIntfPtr = NULL; - err = E_NOINTERFACE; - } - } else { - *aIntfPtr = NULL; - err = E_NOINTERFACE; - } - } else { // we will return the err = E_NOINTERFACE and a *aIntfPtr of NULL; - *aIntfPtr = NULL; - err = E_NOINTERFACE; - } - // Clean up and return status: - if (reqIntfID) { - CFRelease( reqIntfID ); - } - if (theIntfID) { - CFRelease( theIntfID ); - } - - return( err ); -} - -//======================================================================================== - -void* -PrintDialogPDEPluginFactory(CFAllocatorRef aAllocator,CFUUIDRef aReqTypeID ) -{ - CFUUIDRef theInstID; - IUnknownInstance* instance = NULL; - - // There is not much we can do with errors - just return NULL. - theInstID = CFUUIDCreateFromString(kCFAllocatorDefault, kAppPrintDialogTypeIDStr); - // If the requested type matches our plugin type (it should!) - // have a plugin instance created which will query us for - // interfaces: - if (theInstID && CFEqual(aReqTypeID, theInstID)) { - CFUUIDRef theFactoryID = CFUUIDCreateFromString(kCFAllocatorDefault, kPrintDialogPDEIntfFactoryIDStr); - if (theFactoryID) { - // allocate and clear our instance structure - instance = (IUnknownInstance*) calloc(1, sizeof(IUnknownInstance)); - if (instance != NULL) { - // Assign all members: - instance->vtable = &instance->vtableStorage; - - instance->vtableStorage.QueryInterface = IUnknownQueryInterface; - instance->vtableStorage.AddRef = IUnknownAddRef; - instance->vtableStorage.Release = IUnknownRelease; - - instance->factoryID = theFactoryID; - instance->refCount = 1; - - // Register the newly created instance - CFPlugInAddInstanceForFactory(theFactoryID); - } - } - } - if (theInstID) { - CFRelease(theInstID); - } - - return ((void*) instance); -} - -//======================================================================================== - -static OSStatus -MozPDEPrologue(PMPDEContext *aContext,OSType *aCreator,CFStringRef *aUserOptionKind,CFStringRef *aTitle,UInt32 *aMaxH,UInt32 *aMaxV) -{ - OSStatus err = noErr; - PrintDialogPDEOnlyContextPtr theContext = NULL; // Pointer to our context data. - - err = InitContext(&theContext); - - if (noErr == err) { - *aContext = (PMPDEContext) theContext; - - // calculate the maximum amount of screen real estate that this plugin needs. - *aMaxH = kMAXH; - *aMaxV = kMAXV; - - /* The semantics of the CFStrings represented by *aTitle and *aUserOptionKind - are 'Get' semantics: the caller will retain what it needs to retain. - This means that we need to release this title string sometime after - this routine returns. We put our reference to the string into our context - data so we can release that string when we dispose of the context data. - */ - theContext->titleStringRef = CopyLocalizedStringFromPlugin( - CFSTR("Mozilla Printing Extensions"), - theContext->theBundleRef); - - if (theContext->titleStringRef != NULL) { - *aTitle = theContext->titleStringRef; - } - - *aUserOptionKind = kSampleAppUserOptionKindID; - *aCreator = kPlugInCreator; - } else { - err = kPMInvalidPDEContext; // return an error - } - - return (err); -} - -//======================================================================================== - -static OSStatus -MozPDEInitialize( PMPDEContext aContext, - PMPDEFlags* aFlags, - PMPDERef aRef, - ControlRef aParentUserPane, - PMPrintSession aPrintSession) -{ - OSStatus err = noErr; - PrintDialogPDEOnlyContextPtr theContext = NULL; // Pointer to our context data. - - theContext = (PrintDialogPDEOnlyContextPtr) aContext; - - if ((theContext != NULL) && (aPrintSession != NULL)) { - WindowRef theWindow = NULL; - short savedResFile = CurResFile(); - UseResFile(theContext->theResFile); - theWindow = GetControlOwner(aParentUserPane); // get the windowref from the user pane - - // get controls - theContext->thePrintSelectionOnly = GetNewControl(ePrintSelectionControlID, theWindow); - theContext->thePrintFrameAsIs = GetNewControl(ePrintFrameAsIsControlID, theWindow); - theContext->thePrintSelectedFrame = GetNewControl(ePrintSelectedFrameControlID, theWindow); - theContext->thePrintFramesSeparately = GetNewControl(ePrintFramesSeparatelyControlID, theWindow); - theContext->theShrinkToFit = GetNewControl(eShrinkToFiControlID, theWindow); - theContext->theRadioGroup = GetNewControl(eRadioGroupControlID, theWindow); - - // embed controls - EmbedControl(theContext->thePrintSelectionOnly, aParentUserPane); - EmbedControl(theContext->theShrinkToFit, aParentUserPane); - EmbedControl(theContext->thePrintFrameAsIs, theContext->theRadioGroup); - EmbedControl(theContext->thePrintSelectedFrame, theContext->theRadioGroup); - EmbedControl(theContext->thePrintFramesSeparately, theContext->theRadioGroup); - EmbedControl(theContext->theRadioGroup, aParentUserPane); - - // set controls as visible - SetControlVisibility(theContext->theRadioGroup, true, false); - SetControlVisibility(theContext->thePrintSelectionOnly, true, false); - SetControlVisibility(theContext->thePrintFrameAsIs, true, false); - SetControlVisibility(theContext->thePrintSelectedFrame, true, false); - SetControlVisibility(theContext->thePrintFramesSeparately, true, false); - SetControlVisibility(theContext->theShrinkToFit, true, false); - - // Set default value - SetControlValue(theContext->thePrintSelectionOnly, 0); - SetControlValue(theContext->thePrintFrameAsIs, 0); - SetControlValue(theContext->thePrintSelectedFrame, 0); - SetControlValue(theContext->thePrintFramesSeparately, 0); - SetControlValue(theContext->theShrinkToFit, 0); - - // Set flags - *aFlags = kPMPDENoFlags; - - // Initialize this plugins controls based on the information in the - // PageSetup or PrintSettings ticket. - err = MozPDESync(aContext, aPrintSession, kSyncDirectionSetUserInterface); - if (err == kPMKeyNotFound) - err = noErr; - - UseResFile(savedResFile); - } else { - err = kPMInvalidPDEContext; - } - - return (err); -} - -//======================================================================================== - -static OSStatus -MozPDEGetSummaryText(PMPDEContext aContext, CFArrayRef *aTitleArray,CFArrayRef *aSummaryArray) -{ - OSStatus err = noErr; - CFMutableArrayRef theTitleArray = NULL; // Init CF strings - CFMutableArrayRef theSummaryArray = NULL; - CFStringRef titleStringRef = NULL; - CFStringRef summaryStringRef = NULL; - PrintDialogPDEOnlyContextPtr theContext = NULL; // Pointer to our context data. - - theContext = (PrintDialogPDEOnlyContextPtr) aContext; - *aTitleArray = NULL; - *aSummaryArray = NULL; - - if (theContext != NULL) { - // NOTE: if the second parameter to CFArrayCreateMutable - // is not 0 then the array is a FIXED size - theTitleArray = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks); - theSummaryArray = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks); - - if ((theTitleArray != NULL) && (theSummaryArray != NULL)) { - SInt16 theControlValue = -1; - titleStringRef = CopyLocalizedStringFromPlugin(CFSTR(" Print Selected Text Only"),theContext->theBundleRef); - - theControlValue = GetControlValue(theContext->thePrintSelectionOnly); - switch (theControlValue) { - case 0: - summaryStringRef = CopyLocalizedStringFromPlugin(CFSTR(" No, Print All Text"),theContext->theBundleRef); - break; - case 1: - summaryStringRef = CopyLocalizedStringFromPlugin(CFSTR(" Yes"),theContext->theBundleRef); - break; - } - - if (titleStringRef && summaryStringRef) { - CFArrayAppendValue(theTitleArray, titleStringRef); - CFArrayAppendValue(theSummaryArray, summaryStringRef); - } else { - err = memFullErr; - } - }else{ - err = memFullErr; - } - } else { - err = kPMInvalidPDEContext; - } - - // we release these because we've added them already to the title and summary array - // or we don't need them because there was an error - if (titleStringRef) { - CFRelease(titleStringRef); - } - if (summaryStringRef) { - CFRelease(summaryStringRef); - } - - // update the data passed in. - if (!err) { - *aTitleArray = theTitleArray; - *aSummaryArray = theSummaryArray; - } else { - if (theTitleArray) { - CFRelease(theTitleArray); - } - if (theSummaryArray) { - CFRelease(theSummaryArray); - } - } - - return (err); -} - -//======================================================================================== - -static OSStatus -MozPDESync(PMPDEContext aContext,PMPrintSession aPrintSession,Boolean aSyncDirection) -{ - OSStatus err = noErr; - PrintDialogPDEOnlyContextPtr theContext = NULL; // Pointer to our context data. - CFDataRef ourPDEPrintSettingsDataRef = NULL; - - theContext = (PrintDialogPDEOnlyContextPtr) aContext; - - if ((theContext != NULL) && (aPrintSession != NULL)) { - PMTicketRef printSettingsContainer = NULL; - err = GetTicketRef(aPrintSession, kPDE_PMPrintSettingsRef, &printSettingsContainer); - - if (noErr == err) { - nsPrintExtensions printSettings; - SInt16 theControlValue = -1; - - printSettings.mHaveSelection = false; - printSettings.mHaveFrames = false; - printSettings.mHaveFrameSelected = false; - printSettings.mPrintSelection = false; - printSettings.mPrintFrameAsIs = false; - printSettings.mPrintSelectedFrame = false; - printSettings.mPrintFramesSeparately = false; - printSettings.mShrinkToFit = false; - - switch (aSyncDirection){ - case kSyncDirectionSetUserInterface: - err = PMTicketGetCFData(printSettingsContainer, kPMTopLevel, kPMTopLevel, kAppPrintDialogPDEOnlyKey, &ourPDEPrintSettingsDataRef); - if (!err) { - if (CFDataGetLength(ourPDEPrintSettingsDataRef) == sizeof(printSettings) ) { - printSettings = *(nsPrintExtensions *)CFDataGetBytePtr(ourPDEPrintSettingsDataRef); - } - - if (printSettings.mHaveSelection == true) { - EnableControl((ControlHandle)theContext->thePrintSelectionOnly); - theControlValue = (printSettings.mPrintSelection) ? 1 : 0; - SetControlValue(theContext->thePrintSelectionOnly, theControlValue); - } else { - DisableControl((ControlHandle)theContext->thePrintSelectionOnly); - SetControlValue(theContext->thePrintSelectionOnly, 0); - } - - if (printSettings.mHaveFrames == true) { - EnableControl((ControlHandle)theContext->thePrintFrameAsIs); - SetControlValue(theContext->thePrintFrameAsIs, 1); - - // control for printing selected frame - if (printSettings.mHaveFrameSelected == true) { - EnableControl((ControlHandle)theContext->thePrintSelectedFrame); - theControlValue = ( printSettings.mPrintSelectedFrame) ? 1 : 0; - SetControlValue(theContext->thePrintSelectedFrame, theControlValue); - } else { - DisableControl((ControlHandle)theContext->thePrintSelectedFrame); - SetControlValue(theContext->thePrintSelectedFrame, 0); - } - - // control to print all frames separately - EnableControl((ControlHandle)theContext->thePrintFramesSeparately); - theControlValue = (printSettings.mPrintFramesSeparately) ? 1 : 0; - SetControlValue(theContext->thePrintFramesSeparately, theControlValue); - } else { - DisableControl((ControlHandle)theContext->thePrintFrameAsIs); - SetControlValue(theContext->thePrintFrameAsIs, 0); - DisableControl((ControlHandle)theContext->thePrintSelectedFrame); - SetControlValue(theContext->thePrintSelectedFrame, 0); - DisableControl((ControlHandle)theContext->thePrintFramesSeparately); - SetControlValue(theContext->thePrintFramesSeparately, 0); - } - - // shrink to fit - theControlValue = (printSettings.mShrinkToFit) ? 1 : 0; - SetControlValue(theContext->theShrinkToFit, theControlValue); - } - break; - - case kSyncDirectionSetTickets: - theControlValue = GetControlValue(theContext->thePrintSelectionOnly); - printSettings.mPrintSelection = theControlValue != 0; - theControlValue = GetControlValue(theContext->thePrintFrameAsIs); - printSettings.mPrintFrameAsIs = theControlValue != 0; - theControlValue = GetControlValue(theContext->thePrintSelectedFrame); - printSettings.mPrintSelectedFrame = theControlValue != 0; - theControlValue = GetControlValue(theContext->thePrintFramesSeparately); - printSettings.mPrintFramesSeparately = theControlValue != 0; - theControlValue = GetControlValue(theContext->theShrinkToFit); - printSettings.mShrinkToFit = theControlValue != 0; - - ourPDEPrintSettingsDataRef = CFDataCreate(kCFAllocatorDefault, (UInt8*)&printSettings, sizeof(printSettings)); - if (ourPDEPrintSettingsDataRef) { - err = PMTicketSetCFData(printSettingsContainer, kPMPrintingManager, kAppPrintDialogPDEOnlyKey, ourPDEPrintSettingsDataRef,kPMUnlocked); - CFRelease(ourPDEPrintSettingsDataRef); - } else { - err = memFullErr; - } - break; - } - } - } else { - err = kPMInvalidPDEContext; - } - - return (err); -} - -//======================================================================================== - -static OSStatus -MozPDEOpen(PMPDEContext aContext ) -{ - OSStatus err = noErr; - PrintDialogPDEOnlyContextPtr theContext = NULL; // Pointer to our context data. - - theContext = (PrintDialogPDEOnlyContextPtr) aContext; - if (theContext != NULL) { - // make sure you make yourself the current resource file if you need - // access to your resources - - //short savedResFile = CurResFile(); - //UseResFile(theContext->theResFile); - - // Do something useful here - //UseResFile(savedResFile); - } else { - err = kPMInvalidPDEContext; - } - - return err; -} -//======================================================================================== - -static OSStatus -MozPDEClose(PMPDEContext aContext ) -{ - OSStatus err = noErr; - PrintDialogPDEOnlyContextPtr theContext = NULL; // Pointer to our context data. - - theContext = (PrintDialogPDEOnlyContextPtr) aContext; - if (theContext != NULL) { - // Do something useful here - } else { - err = kPMInvalidPDEContext; - } - return ( err ); -} - -//======================================================================================== - -static OSStatus -MozPDETerminate(PMPDEContext aContext,OSStatus aStatus) -{ - OSStatus err = noErr; - PrintDialogPDEOnlyContextPtr theContext = NULL; // Pointer to our context data. - - theContext = (PrintDialogPDEOnlyContextPtr) aContext; - - if (theContext != NULL) { - if (theContext->theResFile != -1) { // Close the resource fork - CFBundleCloseBundleResourceMap(theContext->theBundleRef, theContext->theResFile); - theContext->theResFile = -1; - } - - if (theContext->titleStringRef) { - CFRelease(theContext->titleStringRef); - } - - // Free the global aContext. - free((char*) theContext); - theContext = NULL; - } else { - err = kPMInvalidPDEContext; - } - return ( err ); -} - -//======================================================================================== - -static OSStatus -InitContext(PrintDialogPDEOnlyContextPtr* aContext) -{ - OSStatus err = noErr; - - *aContext = (PrintDialogPDEOnlyContextPtr) calloc(1, sizeof(PrintDialogPDEOnlyContext)); - - if (NULL != *aContext) { - CFBundleRef theBundleRef = NULL; - - (*aContext)->theResFile = -1; - - // Open the resource fork - theBundleRef = CFBundleGetBundleWithIdentifier(kPrintDialogPDEBundleID); - if (theBundleRef) { - (*aContext)->theResFile = CFBundleOpenBundleResourceMap(theBundleRef); - if ((*aContext)->theResFile == -1) { - err = kPMGeneralError; - } - - (*aContext)->theBundleRef = theBundleRef; - } else { - err = kPMInvalidPDEContext; // this really needs a better error code - } - } else { - err = kPMInvalidPDEContext; - } - return (err); -} - -//======================================================================================== - -static OSStatus -GetTicketRef(PMPrintSession aPrintSession,CFStringRef aTicket,PMTicketRef* aPrintSettingsPtr) -{ - OSStatus err = noErr; - CFTypeRef cfTicketRef = NULL; - - err = PMSessionGetDataFromSession(aPrintSession, aTicket, &cfTicketRef); - - if ((noErr == err) && (cfTicketRef)) { - // This returns a Boolean (lossy data) that we don't care about - Boolean lossy; - lossy = CFNumberGetValue((CFNumberRef)cfTicketRef, kCFNumberSInt32Type, (void*)aPrintSettingsPtr); - - if (NULL == *aPrintSettingsPtr) { - err = kPMInvalidValue; - } - } else { - err = kPMInvalidTicket; - } - return err; -} diff --git a/mozilla/xpfe/bootstrap/Makefile.in b/mozilla/xpfe/bootstrap/Makefile.in index 01eb6c3a729..0995f401b12 100644 --- a/mozilla/xpfe/bootstrap/Makefile.in +++ b/mozilla/xpfe/bootstrap/Makefile.in @@ -420,6 +420,8 @@ libs:: $(PROGRAM) rsync -a $(DIST)/bin/ $(DIST)/$(APP_NAME).app/Contents/MacOS rm -f $(DIST)/$(APP_NAME).app/Contents/MacOS/$(PROGRAM) rsync -aL $(PROGRAM) $(DIST)/$(APP_NAME).app/Contents/MacOS + mkdir -p $(DIST)/$(APP_NAME).app/Contents/Plug-Ins + cp -R $(DIST)/PrintPDE.plugin $(DIST)/$(APP_NAME).app/Contents/Plug-Ins cp -RL $(srcdir)/macbuild/mach.icns $(DIST)/$(APP_NAME).app/Contents/Resources/mach.icns echo -n APPLMOZZ > $(DIST)/$(APP_NAME).app/Contents/PkgInfo clean clobber::