diff --git a/build/mac/build_scripts/MozillaBuildList.pm b/build/mac/build_scripts/MozillaBuildList.pm index 480fadfb924..8241b5f99f6 100644 --- a/build/mac/build_scripts/MozillaBuildList.pm +++ b/build/mac/build_scripts/MozillaBuildList.pm @@ -688,6 +688,7 @@ sub BuildRuntimeDist() InstallFromManifest(":mozilla:lib:mac:NSRuntime:include:MANIFEST", "$distdirectory:mac:common:"); InstallFromManifest(":mozilla:lib:mac:NSStdLib:include:MANIFEST", "$distdirectory:mac:common:"); InstallFromManifest(":mozilla:lib:mac:MoreFiles:MANIFEST", "$distdirectory:mac:common:morefiles:"); + InstallFromManifest(":mozilla:lib:mac:NSStartup:MANIFEST", "$distdirectory:mac:common:"); #GC_LEAK_DETECTOR InstallFromManifest(":mozilla:gc:boehm:MANIFEST", "$distdirectory:gc:"); @@ -2107,6 +2108,11 @@ sub BuildEmbeddingProjects() StartBuildModule("embedding"); + # Since there are separate Carbon targets, but the name is the same. + unlink ":mozilla:embedding:components:printingui:macbuild:printingUI$D.o"; + BuildProject(":mozilla:embedding:components:printingui:macbuild:printingUI.xml", "printingUI$C$D.o"); + MakeAlias(":mozilla:embedding:components:printingui:macbuild:printingUI$D.o", ":mozilla:dist:embedding:components:"); + BuildOneProject(":mozilla:embedding:components:build:macbuild:EmbedComponents.xml", "EmbedComponents$D.$S", 1, $main::ALIAS_SYM_FILES, 1); BuildOneProject(":mozilla:embedding:browser:macbuild:webBrowser.xml", "webBrowser$D.$S", 1, $main::ALIAS_SYM_FILES, 1); diff --git a/content/base/public/nsIPrintProgress.idl b/content/base/public/nsIPrintProgress.idl index a97dc12c041..d4b4374084a 100644 --- a/content/base/public/nsIPrintProgress.idl +++ b/content/base/public/nsIPrintProgress.idl @@ -42,6 +42,7 @@ #include "nsIWebProgressListener.idl" interface nsIDOMWindowInternal; +interface nsIObserver; [scriptable, uuid(7E46BC35-FB7D-4b45-AB35-82FD61015380)] interface nsIPrintProgress: nsIWebProgressListener { @@ -49,7 +50,11 @@ interface nsIPrintProgress: nsIWebProgressListener { /* Open the progress dialog you can specify parameters through an xpcom object */ - void openProgressDialog(in nsIDOMWindowInternal parent, in string dialogURL, in nsISupports parameters); + void openProgressDialog(in nsIDOMWindowInternal parent, + in string dialogURL, + in nsISupports parameters, + in nsIObserver openDialogObserver, + out boolean notifyOnOpen); /* Close the progress dialog */ void closeProgressDialog(in boolean forceClose); diff --git a/content/base/src/Makefile.in b/content/base/src/Makefile.in index c407c58886b..90d032a6554 100644 --- a/content/base/src/Makefile.in +++ b/content/base/src/Makefile.in @@ -70,8 +70,6 @@ CPPSRCS = \ nsDocumentEncoder.cpp \ nsDocumentFragment.cpp \ nsDocumentViewer.cpp \ - nsPrintProgress.cpp \ - nsPrintProgressParams.cpp \ nsDOMAttribute.cpp \ nsDOMAttributeMap.cpp \ nsDOMDocumentType.cpp \ diff --git a/content/base/src/makefile.win b/content/base/src/makefile.win index 34c578e05bc..5b44dd33307 100644 --- a/content/base/src/makefile.win +++ b/content/base/src/makefile.win @@ -63,8 +63,6 @@ REQUIRES = xpcom \ CPP_OBJS= \ .\$(OBJDIR)\nsPrintPreviewListener.obj \ - .\$(OBJDIR)\nsPrintProgress.obj \ - .\$(OBJDIR)\nsPrintProgressParams.obj \ .\$(OBJDIR)\nsStyleContext.obj \ .\$(OBJDIR)\nsStyleSet.obj \ .\$(OBJDIR)\nsCommentNode.obj \ diff --git a/content/base/src/nsDocumentViewer.cpp b/content/base/src/nsDocumentViewer.cpp index 28388738845..c834da20ed6 100644 --- a/content/base/src/nsDocumentViewer.cpp +++ b/content/base/src/nsDocumentViewer.cpp @@ -161,6 +161,10 @@ static NS_DEFINE_IID(kPrinterEnumeratorCID, NS_PRINTER_ENUMERATOR_CID); #include "nsIWindowWatcher.h" #include "nsIStringBundle.h" +// Printing Prompts +#include "nsIPrintingPromptService.h" +const char* kPrintingPromptService = "@mozilla.org/embedcomp/printingprompt-service;1"; + #define NS_ERROR_GFX_PRINTER_BUNDLE_URL "chrome://global/locale/printing.properties" // FrameSet @@ -215,12 +219,12 @@ static const char * gPrintRangeStr[] = {"kRangeAllPages", "kRangeSpecified static PRUint32 gDumpFileNameCnt = 0; static PRUint32 gDumpLOFileNameCnt = 0; -#define PRINT_DEBUG_MSG1(_msg1) fprintf(mPrt->mDebugFD, (_msg1)); -#define PRINT_DEBUG_MSG2(_msg1, _msg2) fprintf(mPrt->mDebugFD, (_msg1), (_msg2)); -#define PRINT_DEBUG_MSG3(_msg1, _msg2, _msg3) fprintf(mPrt->mDebugFD, (_msg1), (_msg2), (_msg3)); -#define PRINT_DEBUG_MSG4(_msg1, _msg2, _msg3, _msg4) fprintf(mPrt->mDebugFD, (_msg1), (_msg2), (_msg3), (_msg4)); -#define PRINT_DEBUG_MSG5(_msg1, _msg2, _msg3, _msg4, _msg5) fprintf(mPrt->mDebugFD, (_msg1), (_msg2), (_msg3), (_msg4), (_msg5)); -#define PRINT_DEBUG_FLUSH fflush(mPrt->mDebugFD); +#define PRINT_DEBUG_MSG1(_msg1) if (mPrt && mPrt->mDebugFD) fprintf(mPrt->mDebugFD, (_msg1)); +#define PRINT_DEBUG_MSG2(_msg1, _msg2) if (mPrt && mPrt->mDebugFD) fprintf(mPrt->mDebugFD, (_msg1), (_msg2)); +#define PRINT_DEBUG_MSG3(_msg1, _msg2, _msg3) if (mPrt && mPrt->mDebugFD) fprintf(mPrt->mDebugFD, (_msg1), (_msg2), (_msg3)); +#define PRINT_DEBUG_MSG4(_msg1, _msg2, _msg3, _msg4) if (mPrt && mPrt->mDebugFD) fprintf(mPrt->mDebugFD, (_msg1), (_msg2), (_msg3), (_msg4)); +#define PRINT_DEBUG_MSG5(_msg1, _msg2, _msg3, _msg4, _msg5) if (mPrt && mPrt->mDebugFD) fprintf(mPrt->mDebugFD, (_msg1), (_msg2), (_msg3), (_msg4), (_msg5)); +#define PRINT_DEBUG_FLUSH if (mPrt && mPrt->mDebugFD) fflush(mPrt->mDebugFD); #else //-------------- #define PRT_YESNO(_p) #define PRINT_DEBUG_MSG1(_msg) @@ -398,7 +402,9 @@ private: class PrintData { public: - PrintData(); + typedef enum ePrintDataType {eIsPrinting, eIsPrintPreview }; + + PrintData(ePrintDataType aType); ~PrintData(); // non-virtual // Listener Helper Methods @@ -410,6 +416,7 @@ public: PRBool aDoStartStop = PR_FALSE, PRInt32 aFlag = 0); + ePrintDataType mType; // the type of data this is (Printing or Print Preview) nsCOMPtr mPrintDC; nsIView *mPrintView; FILE *mDebugFilePtr; // a file where information can go to when printing @@ -466,6 +473,7 @@ public: #endif private: + PrintData() {} PrintData& operator=(const PrintData& aOther); // not implemented }; @@ -711,7 +719,6 @@ protected: nsIPageSequenceFrame* mPageSeqFrame; - PRBool mIsPrinting; PrintData* mPrt; nsPagePrintTimer* mPagePrintTimer; @@ -878,8 +885,8 @@ static nsresult NS_NewUpdateTimer(nsPagePrintTimer **aResult) //--------------------------------------------------- //-- PrintData Class Impl //--------------------------------------------------- -PrintData::PrintData() : - mPrintView(nsnull), mDebugFilePtr(nsnull), mPrintObject(nsnull), mSelectedPO(nsnull), +PrintData::PrintData(ePrintDataType aType) : + mType(aType), mPrintView(nsnull), mDebugFilePtr(nsnull), mPrintObject(nsnull), mSelectedPO(nsnull), mShowProgressDialog(PR_TRUE), mPrintDocList(nsnull), mIsIFrameSelected(PR_FALSE), mIsParentAFrameSet(PR_FALSE), mPrintingAsIsSubDoc(PR_FALSE), mOnStartSent(PR_FALSE), mIsAborted(PR_FALSE), mPreparingForPrint(PR_FALSE), mDocWasToBeDestroyed(PR_FALSE), @@ -940,13 +947,15 @@ PrintData::~PrintData() mPrintSettings->GetIsCancelled(&isCancelled); nsresult rv = NS_OK; - if (!isCancelled && !mIsAborted) { - rv = mPrintDC->EndDocument(); - } else { - rv = mPrintDC->AbortDocument(); - } - if (NS_FAILED(rv)) { - DocumentViewerImpl::ShowPrintErrorDialog(rv); + if (mType == eIsPrinting) { + if (!isCancelled && !mIsAborted) { + rv = mPrintDC->EndDocument(); + } else { + rv = mPrintDC->AbortDocument(); + } + if (NS_FAILED(rv)) { + DocumentViewerImpl::ShowPrintErrorDialog(rv); + } } } @@ -1103,7 +1112,6 @@ void DocumentViewerImpl::PrepareToStartLoad() mStopped = PR_FALSE; mLoaded = PR_FALSE; mPrt = nsnull; - mIsPrinting = PR_FALSE; #ifdef NS_PRINT_PREVIEW mIsDoingPrintPreview = PR_FALSE; @@ -4312,7 +4320,7 @@ DocumentViewerImpl::FindXMostFrameInList(nsIPresContext* aPresContext, xMost = 0; } -#ifdef DEBUG_PRINTING // keep this here but leave it turned off +#ifdef DEBUG_PRINTING_X // keep this here but leave it turned off nsAutoString tmp; nsIFrameDebug* frameDebug; if (NS_SUCCEEDED(CallQueryInterface(child, &frameDebug))) { @@ -4323,7 +4331,7 @@ DocumentViewerImpl::FindXMostFrameInList(nsIPresContext* aPresContext, if (xMost > aMaxWidth) { aMaxWidth = xMost; -#ifdef DEBUG_PRINTING // keep this here but leave it turned off +#ifdef DEBUG_PRINTING_X // keep this here but leave it turned off printf("%p - %d %s ", child, aMaxWidth, NS_LossyConvertUCS2toASCII(tmp).get()); if (aList == nsLayoutAtoms::overflowList) printf(" nsLayoutAtoms::overflowList\n"); if (aList == nsLayoutAtoms::floaterList) printf(" nsLayoutAtoms::floaterList\n"); @@ -4453,7 +4461,7 @@ DocumentViewerImpl::SetupToPrintContent(nsIWebShell* aParent, } // Only Shrink if we are smaller - if (mPrt->mShrinkRatio < 1.0f) { + if (mPrt->mShrinkRatio < 0.998f) { // Clamp Shrink to Fit to 50% mPrt->mShrinkRatio = PR_MAX(mPrt->mShrinkRatio, 0.5f); @@ -4471,6 +4479,30 @@ DocumentViewerImpl::SetupToPrintContent(nsIWebShell* aParent, return NS_ERROR_FAILURE; } } +#ifdef DEBUG_rods + { + float calcRatio; + if (mPrt->mPrintDocList->Count() > 1 && mPrt->mPrintObject->mFrameType == eFrameSet) { + PrintObject* xMostPO = FindXMostPO(); + NS_ASSERTION(xMostPO, "There must always be an XMost PO!"); + if (xMostPO) { + // The margin is included in the PO's mRect so we need to subtract it + nsMargin margin(0,0,0,0); + mPrt->mPrintSettings->GetMarginInTwips(margin); + nsRect rect = xMostPO->mRect; + rect.x -= margin.left; + // Calc the shrinkage based on the entire content area + calcRatio = float(rect.XMost()) / float(rect.x + xMostPO->mXMost); + } + } else { + // Single document so use the Shrink as calculated for the PO + calcRatio = mPrt->mPrintObject->mShrinkRatio; + } + printf("**************************************************************************\n"); + printf("STF Ratio is: %8.5f Effective Ratio: %8.5f Diff: %8.5f\n", mPrt->mShrinkRatio, calcRatio, mPrt->mShrinkRatio-calcRatio); + printf("**************************************************************************\n"); + } +#endif } DUMP_DOC_LIST("\nAfter Reflow------------------------------------------"); @@ -4510,12 +4542,54 @@ DocumentViewerImpl::SetupToPrintContent(nsIWebShell* aParent, mPrt->mPrintDocDW = aCurrentFocusedDOMWin; + PRUnichar* fileName = nsnull; + // check to see if we are printing to a file + PRBool isPrintToFile = PR_FALSE; + mPrt->mPrintSettings->GetPrintToFile(&isPrintToFile); + if (isPrintToFile) { + // On some platforms The BeginDocument needs to know the name of the file + // and it uses the PrintService to get it, so we need to set it into the PrintService here + mPrt->mPrintSettings->GetToFileName(&fileName); + } + + PRUnichar * docTitleStr; + PRUnichar * docURLStr; + GetDisplayTitleAndURL(mPrt->mPrintObject, mPrt->mPrintSettings, mPrt->mBrandName, &docTitleStr, &docURLStr, eDocTitleDefURLDoc); + + PRInt32 startPage = 1; + PRInt32 endPage = mPrt->mNumPrintablePages; + + PRInt16 printRangeType = nsIPrintSettings::kRangeAllPages; + mPrt->mPrintSettings->GetPrintRange(&printRangeType); + if (printRangeType == nsIPrintSettings::kRangeSpecifiedPageRange) { + mPrt->mPrintSettings->GetStartPageRange(&startPage); + mPrt->mPrintSettings->GetEndPageRange(&endPage); + if (endPage > mPrt->mNumPrintablePages) { + endPage = mPrt->mNumPrintablePages; + } + } + + nsresult rv = NS_OK; + // BeginDocument may pass back a FAILURE code + // i.e. On Windows, if you are printing to a file and hit "Cancel" + // to the "File Name" dialog, this comes back as an error + // Don't start printing when regression test are executed + if (!mPrt->mDebugFilePtr && mIsDoingPrinting) { + rv = mPrt->mPrintDC->BeginDocument(docTitleStr, fileName, startPage, endPage); + } + + PRINT_DEBUG_MSG1("****************** Begin Document ************************\n"); + + if (docTitleStr) nsMemory::Free(docTitleStr); + if (docURLStr) nsMemory::Free(docURLStr); + + NS_ENSURE_SUCCESS(rv, rv); + // This will print the webshell document // when it completes asynchronously in the DonePrintingPages method // it will check to see if there are more webshells to be printed and // then PrintDocContent will be called again. - nsresult rv = NS_OK; if (mIsDoingPrinting) { PrintDocContent(mPrt->mPrintObject, rv); // ignore return value } @@ -4688,23 +4762,11 @@ DocumentViewerImpl::DoPrint(PrintObject * aPO, PRBool aDoSyncPrinting, PRBool& a #endif if (mPrt->mPrintSettings) { + PRUnichar * docTitleStr = nsnull; + PRUnichar * docURLStr = nsnull; + if (!skipSetTitle) { - PRUnichar * docTitleStr; - PRUnichar * docURLStr; - GetDisplayTitleAndURL(aPO, mPrt->mPrintSettings, mPrt->mBrandName, - &docTitleStr, &docURLStr, eDocTitleDefBlank); - - // Set them down into the PrintOptions so - // they can used by the DeviceContext - if (docTitleStr) { - mPrt->mPrintOptions->SetTitle(docTitleStr); - nsMemory::Free(docTitleStr); - } - - if (docURLStr) { - mPrt->mPrintOptions->SetDocURL(docURLStr); - nsMemory::Free(docURLStr); - } + GetDisplayTitleAndURL(aPO, mPrt->mPrintSettings, mPrt->mBrandName, &docTitleStr, &docURLStr, eDocTitleDefBlank); } if (nsIPrintSettings::kRangeSelection == printRangeType) { @@ -4794,7 +4856,7 @@ DocumentViewerImpl::DoPrint(PrintObject * aPO, PRBool aDoSyncPrinting, PRBool& a rootFrame->SetRect(poPresContext, r); mPageSeqFrame = pageSequence; - mPageSeqFrame->StartPrint(poPresContext, mPrt->mPrintSettings); + mPageSeqFrame->StartPrint(poPresContext, mPrt->mPrintSettings, docTitleStr, docURLStr); if (!aDoSyncPrinting) { // Get the delay time in between the printing of each page @@ -5493,25 +5555,26 @@ DocumentViewerImpl::IsThereAnIFrameSelected(nsIWebShell* aWebShell, { aIsParentFrameSet = IsParentAFrameSet(aWebShell); PRBool iFrameIsSelected = PR_FALSE; -#if 1 - PrintObject* po = FindPrintObjectByDOMWin(mPrt->mPrintObject, aDOMWin); - iFrameIsSelected = po && po->mFrameType == eIFrame; -#else - // First, check to see if we are a frameset - if (!aIsParentFrameSet) { - // Check to see if there is a currenlt focused frame - // if so, it means the selected frame is either the main webshell - // or an IFRAME - if (aDOMWin != nsnull) { - // Get the main webshell's DOMWin to see if it matches - // the frame that is selected - nsCOMPtr domWin = getter_AddRefs(GetDOMWinForWebShell(aWebShell)); - if (aDOMWin != nsnull && domWin != aDOMWin) { - iFrameIsSelected = PR_TRUE; // we have a selected IFRAME + if (mPrt && mPrt->mPrintObject) { + PrintObject* po = FindPrintObjectByDOMWin(mPrt->mPrintObject, aDOMWin); + iFrameIsSelected = po && po->mFrameType == eIFrame; + } else { + // First, check to see if we are a frameset + if (!aIsParentFrameSet) { + // Check to see if there is a currenlt focused frame + // if so, it means the selected frame is either the main webshell + // or an IFRAME + if (aDOMWin != nsnull) { + // Get the main webshell's DOMWin to see if it matches + // the frame that is selected + nsCOMPtr domWin = getter_AddRefs(GetDOMWinForWebShell(aWebShell)); + if (aDOMWin != nsnull && domWin != aDOMWin) { + iFrameIsSelected = PR_TRUE; // we have a selected IFRAME + } } } } -#endif + return iFrameIsSelected; } @@ -6326,7 +6389,7 @@ DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings) mPrtPreview = nsnull; } - mPrt = new PrintData(); + mPrt = new PrintData(PrintData::eIsPrintPreview); if (!mPrt) { mIsCreatingPrintPreview = PR_FALSE; return NS_ERROR_OUT_OF_MEMORY; @@ -6468,8 +6531,6 @@ DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings) } #endif - PRBool doSilent = PR_TRUE; - nscoord width = NS_INCHES_TO_TWIPS(8.5); nscoord height = NS_INCHES_TO_TWIPS(11.0); @@ -6478,7 +6539,7 @@ DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings) if (factory) { nsCOMPtr devspec; nsCOMPtr dx; - nsresult rv = factory->CreateDeviceContextSpec(mWindow, aPrintSettings, *getter_AddRefs(devspec), doSilent); + nsresult rv = factory->CreateDeviceContextSpec(mWindow, aPrintSettings, *getter_AddRefs(devspec), PR_TRUE); if (NS_SUCCEEDED(rv)) { rv = mDeviceContext->GetDeviceContextFor(devspec, *getter_AddRefs(ppDC)); if (NS_SUCCEEDED(rv)) { @@ -6496,9 +6557,7 @@ DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings) } } - if (doSilent) { - mPrt->mPrintSettings->SetPrintFrameType(nsIPrintSettings::kFramesAsIs); - } + mPrt->mPrintSettings->SetPrintFrameType(nsIPrintSettings::kFramesAsIs); // override any UI that wants to PrintPreview any selection PRInt16 printRangeType = nsIPrintSettings::kRangeAllPages; @@ -6603,28 +6662,20 @@ DocumentViewerImpl::SetDocAndURLIntoProgress(PrintObject* aPO, docURLStr = ToNewUnicode(newURLStr); } - mPrt->mPrintProgressParams->SetDocTitle((const PRUnichar*) docTitleStr); - mPrt->mPrintProgressParams->SetDocURL((const PRUnichar*) docURLStr); + aParams->SetDocTitle((const PRUnichar*) docTitleStr); + aParams->SetDocURL((const PRUnichar*) docURLStr); if (docTitleStr != nsnull) nsMemory::Free(docTitleStr); if (docURLStr != nsnull) nsMemory::Free(docURLStr); } +//---------------------------------------------------------------------- +// Set up to use the "pluggable" Print Progress Dialog void DocumentViewerImpl::DoPrintProgress(PRBool aIsForPrinting) { - nsPrintProgress* prtProgress = new nsPrintProgress(); - nsresult rv = prtProgress->QueryInterface(NS_GET_IID(nsIPrintProgress), (void**)getter_AddRefs(mPrt->mPrintProgress)); - if (NS_FAILED(rv)) return; - - - rv = prtProgress->QueryInterface(NS_GET_IID(nsIWebProgressListener), (void**)getter_AddRefs(mPrt->mPrintProgressListener)); - if (NS_FAILED(rv)) return; - // add to listener list - mPrt->mPrintProgressListeners.AppendElement((void*)mPrt->mPrintProgressListener); - nsIWebProgressListener* wpl = NS_STATIC_CAST(nsIWebProgressListener*, mPrt->mPrintProgressListener.get()); - NS_ASSERTION(wpl, "nsIWebProgressListener is NULL!"); - NS_ADDREF(wpl); + // Assume we can't do progress and then see if we can + mPrt->mShowProgressDialog = PR_FALSE; nsCOMPtr prefs (do_GetService(NS_PREF_CONTRACTID)); if (prefs) { @@ -6638,20 +6689,27 @@ DocumentViewerImpl::DoPrintProgress(PRBool aIsForPrinting) mPrt->mPrintSettings->GetShowPrintProgress(&mPrt->mShowProgressDialog); } - if (mPrt->mShowProgressDialog) { - nsPrintProgressParams* prtProgressParams = new nsPrintProgressParams(); - nsCOMPtr params; - rv = prtProgressParams->QueryInterface(NS_GET_IID(nsIPrintProgressParams), (void**)getter_AddRefs(mPrt->mPrintProgressParams)); - if (NS_SUCCEEDED(rv) && mPrt->mPrintProgressParams) { - SetDocAndURLIntoProgress(mPrt->mPrintObject, mPrt->mPrintProgressParams); + // Now open the service to get the progress dialog + nsCOMPtr printPromptService(do_GetService(kPrintingPromptService)); + if (printPromptService) { + nsCOMPtr scriptGlobalObject; + mDocument->GetScriptGlobalObject(getter_AddRefs(scriptGlobalObject)); + if (!scriptGlobalObject) return; + nsCOMPtr domWin = do_QueryInterface(scriptGlobalObject); + if (!domWin) return; - nsCOMPtr wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1")); - if (wwatch) { - nsCOMPtr active; - wwatch->GetActiveWindow(getter_AddRefs(active)); + // If we don't get a service, that's ok, then just don't show progress + PRBool notifyOnOpen; + nsresult rv = printPromptService->ShowProgress(domWin, this, mPrt->mPrintSettings, nsnull, getter_AddRefs(mPrt->mPrintProgressListener), getter_AddRefs(mPrt->mPrintProgressParams), ¬ifyOnOpen); + if (NS_SUCCEEDED(rv)) { + mPrt->mShowProgressDialog = mPrt->mPrintProgressListener != nsnull && mPrt->mPrintProgressParams != nsnull; - nsCOMPtr parent(do_QueryInterface(active)); - mPrt->mPrintProgress->OpenProgressDialog(parent, "chrome://global/content/printProgress.xul", mPrt->mPrintProgressParams); + if (mPrt->mShowProgressDialog) { + mPrt->mPrintProgressListeners.AppendElement((void*)mPrt->mPrintProgressListener); + nsIWebProgressListener* wpl = NS_STATIC_CAST(nsIWebProgressListener*, mPrt->mPrintProgressListener.get()); + NS_ASSERTION(wpl, "nsIWebProgressListener is NULL!"); + NS_ADDREF(wpl); + SetDocAndURLIntoProgress(mPrt->mPrintObject, mPrt->mPrintProgressParams); } } } @@ -6749,9 +6807,9 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings, ShowPrintErrorDialog(rv); return rv; } - - mPrt = new PrintData(); - if (mPrt == nsnull) { + + mPrt = new PrintData(PrintData::eIsPrinting); + if (!mPrt) { return NS_ERROR_OUT_OF_MEMORY; } @@ -6888,14 +6946,65 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings, mPrt->mDebugFilePtr = mDebugFile; #endif - // we have to turn off printpreview mode for now.. because this is a real request to print. - if (mIsDoingPrintPreview) { - aPrintSettings->SetIsPrintPreview(PR_FALSE); - } + // we have to turn off printpreview mode for now.. because this is a real request to print. + if (mIsDoingPrintPreview) { + aPrintSettings->SetIsPrintPreview(PR_FALSE); + } PRBool printSilently; mPrt->mPrintSettings->GetPrintSilent(&printSilently); - rv = factory->CreateDeviceContextSpec(mWindow, mPrt->mPrintSettings, *getter_AddRefs(devspec), printSilently); + + // Ask dialog to be Print Shown via the Plugable Printing Dialog Service + // This service is for the Print Dialog and the Print Progress Dialog + // If printing silently or you can't get the service continue on + if (!printSilently) { + nsCOMPtr printPromptService(do_GetService(kPrintingPromptService)); + if (printPromptService) { + nsCOMPtr scriptGlobalObject; + mDocument->GetScriptGlobalObject(getter_AddRefs(scriptGlobalObject)); + if (!scriptGlobalObject) return nsnull; + nsCOMPtr domWin = do_QueryInterface(scriptGlobalObject); + if (!domWin) return nsnull; + + // Platforms not implementing a given dialog for the service may + // return NS_ERROR_NOT_IMPLEMENTED or an error code. + // + // NS_ERROR_NOT_IMPLEMENTED indicates they want default behavior + // Any other error code means we must bail out + // + rv = printPromptService->ShowPrintDialog(domWin, this, aPrintSettings); + if (rv == NS_ERROR_NOT_IMPLEMENTED) { + // This means the Dialog service was there, + // but they choose not to implement this dialog and + // are looking for default behavior from the toolkit + rv = NS_OK; + + } else if (NS_SUCCEEDED(rv)) { + // since we got the dialog and it worked then make sure we + // are telling GFX we want to print silent + printSilently = PR_TRUE; + } + } else { + rv = NS_ERROR_GFX_NO_PRINTROMPTSERVICE; + } + } + + if (NS_FAILED(rv)) { + if (rv != NS_ERROR_ABORT) { + ShowPrintErrorDialog(rv); + } + delete mPrt; + mPrt = nsnull; + return rv; + } + + // we have to turn off printpreview mode for now.. because this is a real request to print. + if ( mIsDoingPrintPreview == PR_TRUE) { + aPrintSettings->SetIsPrintPreview(PR_FALSE); + } + + // Create DeviceSpec for Printing + rv = factory->CreateDeviceContextSpec(mWindow, mPrt->mPrintSettings, *getter_AddRefs(devspec), PR_FALSE); // If the page was intended to be destroyed while we were in the print dialog // then we need to clean up and abort the printing. @@ -7019,70 +7128,42 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings, } } - if (mPrt->mPrintOptions) { - // check to see if we are printing to a file - PRBool isPrintToFile = PR_FALSE; - mPrt->mPrintSettings->GetPrintToFile(&isPrintToFile); - if (isPrintToFile) { - // On some platforms The BeginDocument needs to know the name of the file + // Get the Needed info for Calling PrepareDocument + PRUnichar* fileName = nsnull; + // check to see if we are printing to a file + PRBool isPrintToFile = PR_FALSE; + mPrt->mPrintSettings->GetPrintToFile(&isPrintToFile); + if (isPrintToFile) { + // On some platforms The PrepareDocument needs to know the name of the file // and it uses the PrintService to get it, so we need to set it into the PrintService here - PRUnichar* fileName; - mPrt->mPrintSettings->GetToFileName(&fileName); - if (fileName != nsnull) { - mPrt->mPrintOptions->SetPrintToFile(PR_TRUE); - mPrt->mPrintOptions->SetToFileName(fileName); - nsMemory::Free(fileName); - } - } else { - mPrt->mPrintOptions->SetPrintToFile(PR_FALSE); - mPrt->mPrintOptions->SetToFileName(nsnull); - } + mPrt->mPrintSettings->GetToFileName(&fileName); } PRUnichar * docTitleStr; PRUnichar * docURLStr; - GetDisplayTitleAndURL(mPrt->mPrintObject, mPrt->mPrintSettings, - mPrt->mBrandName, &docTitleStr, &docURLStr, - eDocTitleDefURLDoc); - // BeginDocument may pass back a FAILURE code - // i.e. On Windows, if you are printing to a file and hit "Cancel" - // to the "File Name" dialog, this comes back as an error - // Don't start printing when regression test are executed - rv = mPrt->mDebugFilePtr ? NS_OK: mPrt->mPrintDC->BeginDocument(docTitleStr); - PRINT_DEBUG_MSG1("****************** Begin Document ************************\n"); + GetDisplayTitleAndURL(mPrt->mPrintObject, mPrt->mPrintSettings, mPrt->mBrandName, &docTitleStr, &docURLStr, eDocTitleDefURLDoc); + + rv = mPrt->mPrintDC->PrepareDocument(docTitleStr, fileName); if (docTitleStr) nsMemory::Free(docTitleStr); if (docURLStr) nsMemory::Free(docURLStr); + NS_ENSURE_SUCCESS(rv, rv); - if (NS_SUCCEEDED(rv)) { + DoPrintProgress(PR_TRUE); - DoPrintProgress(PR_TRUE); - - // Print listener setup... - if (mPrt != nsnull) { - mPrt->OnStartPrinting(); - } - - // - // The mIsPrinting flag is set when the ImageGroup observer is - // notified that images must be loaded as a result of the - // InitialReflow... - // - if(!mIsPrinting || mPrt->mDebugFilePtr) { - rv = DocumentReadyForPrinting(); - PRINT_DEBUG_MSG1("PRINT JOB ENDING, OBSERVER WAS NOT CALLED\n"); - } else { - // use the observer mechanism to finish the printing - PRINT_DEBUG_MSG1("PRINTING OBSERVER STARTED\n"); - } + // Print listener setup... + if (mPrt != nsnull) { + mPrt->OnStartPrinting(); } + + rv = DocumentReadyForPrinting(); + PRINT_DEBUG_MSG1("PRINT JOB ENDING, OBSERVER WAS NOT CALLED\n"); } } } } else { mPrt->mPrintSettings->SetIsCancelled(PR_TRUE); - mPrt->mPrintOptions->SetIsCancelled(PR_TRUE); } // Set that we are once again in print preview @@ -7174,6 +7255,8 @@ DocumentViewerImpl::ShowPrintErrorDialog(nsresult aPrintError, PRBool aIsPrintin NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_XPRINT_BROKEN_XPRT) NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_DOC_IS_BUSY_PP) NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_DOC_WAS_DESTORYED) + NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_NO_PRINTDIALOG_IN_TOOLKIT) + NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_NO_PRINTROMPTSERVICE) NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_NO_XUL) // Temporary code for Bug 136185 default: @@ -8298,12 +8381,10 @@ DocumentViewerImpl::GetCurrentPrintSettings(nsIPrintSettings * *aCurrentPrintSet NS_IMETHODIMP DocumentViewerImpl::Cancel() { - nsresult rv; - nsCOMPtr printService = do_GetService(kPrintOptionsCID, &rv); - if (NS_SUCCEEDED(rv) && printService) { - return printService->SetIsCancelled(PR_TRUE); + if (mPrt && mPrt->mPrintSettings) { + return mPrt->mPrintSettings->SetIsCancelled(PR_TRUE); } - return NS_OK; + return NS_ERROR_FAILURE; } /* void initPrintSettingsFromPrefs (in nsIPrintSettings aPrintSettings, in boolean aUsePrinterNamePrefix, in unsigned long aFlags); */ diff --git a/content/base/src/nsPrintPreviewListener.h b/content/base/src/nsPrintPreviewListener.h index 9efa2808bd0..be3709badce 100644 --- a/content/base/src/nsPrintPreviewListener.h +++ b/content/base/src/nsPrintPreviewListener.h @@ -62,7 +62,7 @@ public: // nsIDOMContextMenuListener NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; } - NS_IMETHOD ContextMenu (nsIDOMEvent* aEvent) { printf("preventing ContextMenu\n"); aEvent->PreventDefault(); return NS_OK; } + NS_IMETHOD ContextMenu (nsIDOMEvent* aEvent) { aEvent->PreventDefault(); return NS_OK; } // nsIDOMKeyListener NS_IMETHOD KeyDown(nsIDOMEvent* aKeyEvent); diff --git a/content/base/src/nsPrintProgress.cpp b/content/base/src/nsPrintProgress.cpp index 3b14564f3bb..e85ca0b25eb 100644 --- a/content/base/src/nsPrintProgress.cpp +++ b/content/base/src/nsPrintProgress.cpp @@ -72,8 +72,11 @@ nsPrintProgress::~nsPrintProgress() /* void openProgressDialog (in nsIDOMWindowInternal parent, in string dialogURL, in nsISupports parameters); */ NS_IMETHODIMP nsPrintProgress::OpenProgressDialog(nsIDOMWindowInternal *parent, const char *dialogURL, - nsISupports *parameters) + nsISupports *parameters, + nsIObserver *openDialogObserver, + PRBool *notifyOnOpen) { + *notifyOnOpen = PR_FALSE; nsresult rv = NS_ERROR_FAILURE; if (m_dialog) diff --git a/content/macbuild/content.xml b/content/macbuild/content.xml index 0b27eb8ba8d..78ae88c819e 100644 --- a/content/macbuild/content.xml +++ b/content/macbuild/content.xml @@ -1610,20 +1610,6 @@ Text Debug - - Name - nsPrintProgress.cpp - MacOS - Text - Debug - - - Name - nsPrintProgressParams.cpp - MacOS - Text - Debug - Name nsCSSLoader.cpp @@ -2957,16 +2943,6 @@ nsPrintPreviewListener.cpp MacOS - - Name - nsPrintProgress.cpp - MacOS - - - Name - nsPrintProgressParams.cpp - MacOS - Name nsCSSLoader.cpp @@ -5111,20 +5087,6 @@ Text Debug - - Name - nsPrintProgress.cpp - MacOS - Text - Debug - - - Name - nsPrintProgressParams.cpp - MacOS - Text - Debug - Name nsCSSLoader.cpp @@ -6458,16 +6420,6 @@ nsPrintPreviewListener.cpp MacOS - - Name - nsPrintProgress.cpp - MacOS - - - Name - nsPrintProgressParams.cpp - MacOS - Name nsCSSLoader.cpp @@ -7124,18 +7076,6 @@ nsPrintPreviewListener.cpp MacOS - - content.shlb - Name - nsPrintProgress.cpp - MacOS - - - content.shlb - Name - nsPrintProgressParams.cpp - MacOS - content.shlb Name diff --git a/embedding/browser/macbuild/browserIDL.xml b/embedding/browser/macbuild/browserIDL.xml index 62388d5d3d1..f5ae07c4672 100644 --- a/embedding/browser/macbuild/browserIDL.xml +++ b/embedding/browser/macbuild/browserIDL.xml @@ -801,6 +801,20 @@ Text + + Name + nsIPrintingPrompt.idl + MacOS + Text + + + + Name + nsIPrintingPromptService.idl + MacOS + Text + + @@ -868,6 +882,16 @@ nsITooltipTextProvider.idl MacOS + + Name + nsIPrintingPrompt.idl + MacOS + + + Name + nsIPrintingPromptService.idl + MacOS + @@ -1618,6 +1642,20 @@ Text + + Name + nsIPrintingPrompt.idl + MacOS + Text + + + + Name + nsIPrintingPromptService.idl + MacOS + Text + + @@ -1685,6 +1723,16 @@ nsITooltipTextProvider.idl MacOS + + Name + nsIPrintingPrompt.idl + MacOS + + + Name + nsIPrintingPromptService.idl + MacOS + @@ -1773,6 +1821,18 @@ nsIWebBrowserSetup.idl MacOS + + embeddingbrowser.xpt + Name + nsIPrintingPrompt.idl + MacOS + + + embeddingbrowser.xpt + Name + nsIPrintingPromptService.idl + MacOS + diff --git a/embedding/browser/webBrowser/MANIFEST_IDL b/embedding/browser/webBrowser/MANIFEST_IDL index 016f3e5d5a7..e69de29bb2d 100644 --- a/embedding/browser/webBrowser/MANIFEST_IDL +++ b/embedding/browser/webBrowser/MANIFEST_IDL @@ -1,32 +0,0 @@ -# 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 Netscape are -# Copyright (C) 1998 Netscape Communications Corporation. All -# Rights Reserved. -# -# Contributor(s): -# -# This is a list of local files which get copied to the mozilla:dist:editor directory -# - -nsCWebBrowser.idl -nsIWebBrowser.idl -nsIWebBrowserChrome.idl -nsIWebBrowserChromeFocus.idl -nsIWebBrowserSetup.idl -nsIEmbeddingSiteWindow.idl -nsIWebBrowserFocus.idl -nsIWebBrowserPrint.idl -nsITooltipListener.idl -nsITooltipTextProvider.idl diff --git a/embedding/browser/webBrowser/Makefile.in b/embedding/browser/webBrowser/Makefile.in index 0f88e6133d9..821d3166b1c 100644 --- a/embedding/browser/webBrowser/Makefile.in +++ b/embedding/browser/webBrowser/Makefile.in @@ -65,6 +65,8 @@ XPIDLSRCS = \ nsITooltipTextProvider.idl \ nsIWebBrowserFocus.idl \ nsIWebBrowserPrint.idl \ + nsIPrintingPrompt.idl \ + nsIPrintingPromptService.idl \ $(NULL) CPPSRCS = \ diff --git a/embedding/browser/webBrowser/makefile.win b/embedding/browser/webBrowser/makefile.win index 60acc230407..e69de29bb2d 100644 --- a/embedding/browser/webBrowser/makefile.win +++ b/embedding/browser/webBrowser/makefile.win @@ -1,76 +0,0 @@ -#!nmake -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Mozilla browser. -# -# The Initial Developer of the Original Code is Netscape -# Communications, Inc. Portions created by Netscape are -# Copyright (C) 1999, Mozilla. All Rights Reserved. -# -# Contributor(s): -# Travis Bogard - -DEPTH=..\..\.. -MODULE=webBrowser_core -REQUIRES = xpcom \ - string \ - docshell \ - widget \ - layout \ - dom \ - js \ - necko \ - uriloader \ - shistory \ - webshell \ - windowwatcher \ - gfx \ - content \ - history \ - webbrowserpersist \ - unicharutil \ - $(NULL) - -EXPORTS = \ - nsCTooltipTextProvider.h \ - $(NULL) - -XPIDLSRCS= \ - .\nsIContextMenuListener.idl \ - .\nsITooltipListener.idl \ - .\nsITooltipTextProvider.idl \ - .\nsCWebBrowser.idl \ - .\nsIWebBrowser.idl \ - .\nsIWebBrowserChrome.idl \ - .\nsIWebBrowserChromeFocus.idl \ - .\nsICommandHandler.idl \ - .\nsIWebBrowserSetup.idl \ - .\nsIEmbeddingSiteWindow.idl \ - .\nsIEmbeddingSiteWindow2.idl \ - .\nsIWebBrowserFocus.idl \ - .\nsIWebBrowserPrint.idl \ - $(NULL) - -LIBRARY_NAME=nsWebBrowser_s - -CPP_OBJS= \ - .\$(OBJDIR)\nsDocShellTreeOwner.obj \ - .\$(OBJDIR)\nsWebBrowser.obj \ - .\$(OBJDIR)\nsCommandHandler.obj \ - .\$(OBJDIR)\nsWebBrowserContentPolicy.obj \ - $(NULL) - -include <$(DEPTH)\config\rules.mak> -include <$(DEPTH)\config\config.mak> - -libs:: $(LIBRARY) - $(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib diff --git a/embedding/browser/webBrowser/nsIPrintingPrompt.idl b/embedding/browser/webBrowser/nsIPrintingPrompt.idl new file mode 100644 index 00000000000..05deac8c2d8 --- /dev/null +++ b/embedding/browser/webBrowser/nsIPrintingPrompt.idl @@ -0,0 +1,189 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** 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 ***** */ + +/** + * @status UNDER_REVIEW + */ + +/** + * This is the printing prompt interface which can be used without knowlege of a + * parent window. The parentage is hidden by the GetInterface though + * which it is gotten. This interface is identical to nsIPintingPromptService + * but without the parent nsIDOMWindow parameter. See nsIPrintingPromptService + * for all documentation. + */ + +#include "nsISupports.idl" +#include "nsIWebBrowserPrint.idl" +#include "nsIWebProgressListener.idl" +#include "nsIPrintSettings.idl" +#include "nsIPrintProgressParams.idl" +#include "nsIObserver.idl" + +[scriptable, uuid(44E314CA-75B1-4f3d-9553-9B3507912108)] +interface nsIPrintingPrompt : nsISupports +{ + /** + * This service enables embedders to implement their own Print and Progress Dialogs. + * Each platform has a "base" or "basckstop" implementation of the service. The + * service is automatically registered at start up. + * + * Historically, platform toolkits with native dialogs have implemented them in the GFX layer + * Usually they were displayed when a new DeviceContextSpec specific to that platform + * was created. + * + * Windows: The GFX layer no longers supports default toolkit behavior for displaying the + * native Print Dialog. + * If an embedder implemented service returns any error code (other than NS_ERROR_ABORT) + * printing will terminate. + * + * Returning NS_OK assumes that the PrintSettings object was correctly filled in and + * if it does not have valid fields for printer name, etc. it may also terminate. + * + * Defaults for platform service: + * showPrintDialog - displays a native dialog + * showPageSetup - displays a XUL dialog + * showProgress - displays a XUL dialog + * showPrinterProperties - n/a + * + * Summary for Windows Embedders: + * Stated once again: There is no "fallback" native platform support in GFX for the + * displaying of the native print dialog. The current default implementation for Windows + * display a native print dialog but a XUL-based progress dialog. + * If you wish to have a native progress dialog on Windows you will have to create and + * register your own service. + * + * Note: The Windows version Mozilla implements this service which is + * automatically built and registered for you. You can use it as an example. + * It is located at "mozilla/embedding/components/printingui/src/win". That service + * is capable of displaying a native print dialog and a XUL progress dialog. + * + * To fly your own dialog you may: + * + * 1) Implement this service to display at least the Print Dialog and a Print Progress Dialog + * or you may implement just one of the dialogs and pass back NS_ERROR_NOT_IMPLEMENTED + * for any of the others. + * + * 2) For the Print Dialog: + * You may stub out this service by having all the methods return NS_ERROR_NOT_IMPLEMENTED. + * You can then fly you own dialog and then properly fill in the PrintSettings object + * before calling nsIWebBrowserPrint's Print method. If you stub out this service + * you MUST set "printSilent" to true, if you do not, Printing will terminate and an + * error dialog will be displayed. + * + * Mac: The GFX layer still supports default toolkit behavior for displaying the Print Dialog. + * If an embedder implemented service returns NS_ERROR_NOT_IMPLEMENTED for "showPrintDialog" + * The toolkit will display the native print dialog. + * + * Defaults for platform service: + * Mac OS9: showPrintDialog - displays a native dialog + * showPageSetup - displays a native dialog + * showProgress - displays a XUL dialog + * showPrinterProperties - n/a + * + * Mac OSX: showPrintDialog - displays a native dialog + * showPageSetup - displays a native dialog + * showProgress - not implemented (provided by OS) + * showPrinterProperties - n/a + * + * GTK: There are no native dialog for GTK. + * + * Defaults for platform service: + * showPrintDialog - displays a XUL dialog + * showPageSetup - displays a XUL dialog + * showProgress - displays a XUL dialog + * showPrinterProperties - displays a XUL dialog + * + * OS2: + * + * Defaults for platform service: + * showPrintDialog - displays a XUL dialog + * showPageSetup - displays a XUL dialog + * showProgress - displays a XUL dialog + * showPrinterProperties - displays a native dialog + * + * + */ + + + /** + * Show the Print Dialog + * + * @param webBrowserPrint - represents the document to be printed + * @param printSettings - PrintSettings for print "job" + * + */ + void showPrintDialog(in nsIWebBrowserPrint webBrowserPrint, + in nsIPrintSettings printSettings); + + /** + * Shows the print progress dialog + * + * @param webBrowserPrint - represents the document to be printed + * @param printSettings - PrintSettings for print "job" + * @param openDialogObserver - an observer that will be notifed when the dialog is opened + * @param webProgressListener - additional listener can be registered for progress notifications + * @param printProgressParams - parameter object for passing progress state + * @param notifyOnOpen - this indicates that the observer will be notified when the progress + * dialog has been opened + */ + void showProgress(in nsIWebBrowserPrint webBrowserPrint, + in nsIPrintSettings printSettings, + in nsIObserver openDialogObserver, + out nsIWebProgressListener webProgressListener, + out nsIPrintProgressParams printProgressParams, + out boolean notifyOnOpen); + + /** + * Shows the print progress dialog + * + * @param printSettings - PrintSettings for page setup (required) + */ + void showPageSetup(in nsIPrintSettings printSettings); + + /** + * Sometimes platforms need to bring up a special properties dialog for showing + * print specific properties. Although the PrintSettings has a place to set the + * printer name, here is is an argument to be clear as to what printer is being + * asked to have the properties set for it. The Printer name in the PS is ignored. + * + * @param printerName - name of printer (required) + * @param printSettings - PrintSettings for page setup (required) + */ + void showPrinterProperties(in wstring printerName, + in nsIPrintSettings printSettings); +}; diff --git a/embedding/browser/webBrowser/nsIPrintingPromptService.idl b/embedding/browser/webBrowser/nsIPrintingPromptService.idl new file mode 100644 index 00000000000..9f62b4614fb --- /dev/null +++ b/embedding/browser/webBrowser/nsIPrintingPromptService.idl @@ -0,0 +1,199 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** 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) 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 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 ***** */ + +/* Doc interface here */ + +#include "nsISupports.idl" +#include "nsIWebBrowserPrint.idl" +#include "nsIWebProgressListener.idl" +#include "nsIPrintProgressParams.idl" +#include "nsIPrintSettings.idl" +#include "nsIObserver.idl" + +interface nsIDOMWindow; + +[scriptable, uuid(75D1553D-63BF-4b5d-A8F7-E4E4CAC21BA4)] +interface nsIPrintingPromptService : nsISupports +{ + /** + * This service enables embedders to implement their own Print and Progress Dialogs. + * Each platform has a "base" or "basckstop" implementation of the service. The + * service is automatically registered at start up. + * + * Historically, platform toolkits with native dialogs have implemented them in the GFX layer + * Usually they were displayed when a new DeviceContextSpec specific to that platform + * was created. + * + * Windows: The GFX layer no longers supports default toolkit behavior for displaying the + * native Print Dialog. + * If an embedder implemented service returns any error code (other than NS_ERROR_ABORT) + * printing will terminate. + * + * Returning NS_OK assumes that the PrintSettings object was correctly filled in and + * if it does not have valid fields for printer name, etc. it may also terminate. + * + * Defaults for platform service: + * showPrintDialog - displays a native dialog + * showPageSetup - displays a XUL dialog + * showProgress - displays a XUL dialog + * showPrinterProperties - n/a + * + * Summary for Windows Embedders: + * Stated once again: There is no "fallback" native platform support in GFX for the + * displaying of the native print dialog. The current default implementation for Windows + * display a native print dialog but a XUL-based progress dialog. + * If you wish to have a native progress dialog on Windows you will have to create and + * register your own service. + * + * Note: The Windows version Mozilla implements this service which is + * automatically built and registered for you. You can use it as an example. + * It is located at "mozilla/embedding/components/printingui/src/win". That service + * is capable of displaying a native print dialog and a XUL progress dialog. + * + * To fly your own dialog you may: + * + * 1) Implement this service to display at least the Print Dialog and a Print Progress Dialog + * or you may implement just one of the dialogs and pass back NS_ERROR_NOT_IMPLEMENTED + * for any of the others. + * + * 2) For the Print Dialog: + * You may stub out this service by having all the methods return NS_ERROR_NOT_IMPLEMENTED. + * You can then fly you own dialog and then properly fill in the PrintSettings object + * before calling nsIWebBrowserPrint's Print method. If you stub out this service + * you MUST set "printSilent" to true, if you do not, Printing will terminate and an + * error dialog will be displayed. + * + * Mac: The GFX layer still supports default toolkit behavior for displaying the Print Dialog. + * If an embedder implemented service returns NS_ERROR_NOT_IMPLEMENTED for "showPrintDialog" + * The toolkit will display the native print dialog. + * + * Defaults for platform service: + * Mac OS9: showPrintDialog - displays a native dialog + * showPageSetup - displays a native dialog + * showProgress - displays a XUL dialog + * showPrinterProperties - n/a + * + * Mac OSX: showPrintDialog - displays a native dialog + * showPageSetup - displays a native dialog + * showProgress - not implemented (provided by OS) + * showPrinterProperties - n/a + * + * GTK: There are no native dialog for GTK. + * + * Defaults for platform service: + * showPrintDialog - displays a XUL dialog + * showPageSetup - displays a XUL dialog + * showProgress - displays a XUL dialog + * showPrinterProperties - displays a XUL dialog + * + * OS2: + * + * Defaults for platform service: + * showPrintDialog - displays a XUL dialog + * showPageSetup - displays a XUL dialog + * showProgress - displays a XUL dialog + * showPrinterProperties - displays a native dialog + * + * + */ + + + + /** + * Show the Print Dialog + * + * @param parent - a DOM windows the dialog will be parented to (required) + * @param webBrowserPrint - represents the document to be printed (required) + * @param printSettings - PrintSettings for print "job" (required) + * + */ + void showPrintDialog(in nsIDOMWindow parent, + in nsIWebBrowserPrint webBrowserPrint, + in nsIPrintSettings printSettings); + + /** + * Shows the print progress dialog + * + * @param parent - a DOM windows the dialog will be parented to + * @param webBrowserPrint - represents the document to be printed + * @param printSettings - PrintSettings for print "job" + * @param openDialogObserver - an observer that will be notifed when the dialog is opened + * @param webProgressListener - additional listener can be registered for progress notifications + * @param printProgressParams - parameter object for passing progress state + * @param notifyOnOpen - this indicates that the observer will be notified when the progress + * dialog has been opened + */ + void showProgress(in nsIDOMWindow parent, + in nsIWebBrowserPrint webBrowserPrint, + in nsIPrintSettings printSettings, + in nsIObserver openDialogObserver, + out nsIWebProgressListener webProgressListener, + out nsIPrintProgressParams printProgressParams, + out boolean notifyOnOpen); + + /** + * Shows the print progress dialog + * + * @param parent - a DOM windows the dialog will be parented to (required) + * @param printSettings - PrintSettings for page setup (required) + */ + void showPageSetup(in nsIDOMWindow parent, + in nsIPrintSettings printSettings); + + /** + * Sometimes platforms need to bring up a special properties dialog for showing + * print specific properties. Although the PrintSettings has a place to set the + * printer name, here is is an argument to be clear as to what printer is being + * asked to have the properties set for it. The Printer name in the PS is ignored. + * + * @param parent - a DOM windows the dialog will be parented to (required) + * @param printerName - name of printer (required) + * @param printSettings - PrintSettings for page setup (required) + */ + void showPrinterProperties(in nsIDOMWindow parent, + in wstring printerName, + in nsIPrintSettings printSettings); + +}; + +%{C++ +// {260FEDC5-524D-4aa6-9A41-E829F4C78B92} +#define NS_PRINTINGPROMPTSERVICE_IID \ + {0x260fedc5, 0x524d, 0x4aa6, { 0x9a, 0x41, 0xe8, 0x29, 0xf4, 0xc7, 0x8b, 0x92}} +%} + diff --git a/embedding/components/Makefile.in b/embedding/components/Makefile.in index 05b640702dd..9a63d017085 100644 --- a/embedding/components/Makefile.in +++ b/embedding/components/Makefile.in @@ -24,6 +24,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -DIRS = windowwatcher appstartup find ui jsconsole webbrowserpersist commandhandler build +DIRS = windowwatcher appstartup find ui printingui jsconsole webbrowserpersist commandhandler build include $(topsrcdir)/config/rules.mk diff --git a/embedding/components/build/Makefile.in b/embedding/components/build/Makefile.in index 7dfbf0ae9d9..86bee6cf71e 100644 --- a/embedding/components/build/Makefile.in +++ b/embedding/components/build/Makefile.in @@ -39,6 +39,9 @@ REQUIRES = js \ xpcom \ string \ windowwatcher \ + printingui \ + webbrwsr \ + gfx \ webbrowserpersist \ jsconsole \ find \ @@ -59,6 +62,7 @@ CPPSRCS = nsModule.cpp SHARED_LIBRARY_LIBS = \ $(DIST)/lib/$(LIB_PREFIX)windowwatcher_s.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)printingui_s.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)appstartupnotifier_s.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)jsconsole_s.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)find_s.$(LIB_SUFFIX) \ @@ -75,6 +79,33 @@ LOCAL_INCLUDES = \ -I$(srcdir)/../commandhandler/src \ $(NULL) +ifeq ($(MOZ_GFX_TOOLKIT),os2) +LOCAL_INCLUDES += -I$(srcdir)/../printingui/src/os2 +endif + +ifeq ($(MOZ_GFX_TOOLKIT),gtk) +LOCAL_INCLUDES += -I$(srcdir)/../printingui/src/gtk +endif + +ifeq ($(MOZ_GFX_TOOLKIT),beos) +LOCAL_INCLUDES += -I$(srcdir)/../printingui/src/gtk +endif + +ifeq ($(MOZ_GFX_TOOLKIT),qt) +LOCAL_INCLUDES += -I$(srcdir)/../printingui/src/gtk +endif + +ifeq ($(MOZ_GFX_TOOLKIT),windows) +LOCAL_INCLUDES += -I$(srcdir)/../printingui/src/win +OS_LIBS += winspool.lib comdlg32.lib +endif + +ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT))) +LOCAL_INCLUDES += -I$(srcdir)/../printingui/src/mac +endif + +EXTRA_DSO_LIBS = gkgfx + EXTRA_DSO_LDOPTS = \ $(LIBS_DIR) \ $(EXTRA_DSO_LIBS) \ @@ -83,6 +114,12 @@ EXTRA_DSO_LDOPTS = \ $(MOZ_JS_LIBS) \ $(NULL) +ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT))) +EXTRA_DSO_LDOPTS += \ + $(TK_LIBS) \ + $(NULL) +endif + include $(topsrcdir)/config/rules.mk ifeq ($(OS_ARCH),WINNT) diff --git a/embedding/components/build/macbuild/EmbedComponents.xml b/embedding/components/build/macbuild/EmbedComponents.xml index 89c0cbd2c6f..4362890b0cb 100644 --- a/embedding/components/build/macbuild/EmbedComponents.xml +++ b/embedding/components/build/macbuild/EmbedComponents.xml @@ -85,6 +85,16 @@ FrameworkPathfalse HostFlagsAll + + SearchPath + Path:::printingui:src:mac: + PathFormatMacOS + PathRootProject + + Recursivefalse + FrameworkPathfalse + HostFlagsAll + SearchPath Path::: @@ -752,9 +762,9 @@ MWLinker_PPC_dontdeadstripinitcode0 MWLinker_PPC_permitmultdefs0 MWLinker_PPC_linkmodeFast - MWLinker_PPC_initname__NSInitialize + MWLinker_PPC_initname__NSInitializeWithResources MWLinker_PPC_mainname - MWLinker_PPC_termname__NSTerminate + MWLinker_PPC_termname__NSTerminateWithResources MWLinker_MachO_exportsNone @@ -1077,6 +1087,13 @@ Library Debug + + Name + printingUIDebug.o + MacOS + Library + Debug + Name nsCommandGroup.cpp @@ -1105,6 +1122,13 @@ Text Debug + + Name + nsPrintDialogExtension.r + MacOS + Text + Debug + @@ -1207,6 +1231,11 @@ UnicharUtilsStaticDebug.o MacOS + + Name + printingUIDebug.o + MacOS + Name nsCommandGroup.cpp @@ -1227,6 +1256,11 @@ nsControllerCommandManager.cpp MacOS + + Name + nsPrintDialogExtension.r + MacOS + @@ -1261,6 +1295,16 @@ FrameworkPathfalse HostFlagsAll + + SearchPath + Path:::printingui:src:mac: + PathFormatMacOS + PathRootProject + + Recursivefalse + FrameworkPathfalse + HostFlagsAll + SearchPath Path::: @@ -1928,9 +1972,9 @@ MWLinker_PPC_dontdeadstripinitcode0 MWLinker_PPC_permitmultdefs0 MWLinker_PPC_linkmodeFast - MWLinker_PPC_initname__NSInitialize + MWLinker_PPC_initname__NSInitializeWithResources MWLinker_PPC_mainname - MWLinker_PPC_termname__NSTerminate + MWLinker_PPC_termname__NSTerminateWithResources MWLinker_MachO_exportsNone @@ -2253,6 +2297,13 @@ Unknown Debug + + Name + printingUI.o + MacOS + Unknown + + Name nsCommandGroup.cpp @@ -2281,6 +2332,13 @@ Text Debug + + Name + nsPrintDialogExtension.r + MacOS + Text + Debug + @@ -2383,6 +2441,11 @@ UnicharUtilsStatic.o MacOS + + Name + printingUI.o + MacOS + Name nsCommandGroup.cpp @@ -2403,6 +2466,11 @@ nsControllerCommandManager.cpp MacOS + + Name + nsPrintDialogExtension.r + MacOS + @@ -2513,6 +2581,14 @@ MacOS + Resources + + EmbedComponentsDebug.shlb + Name + nsPrintDialogExtension.r + MacOS + + Build EmbedComponentsDebug.shlb @@ -2522,18 +2598,34 @@ Static Libs - - EmbedComponents.shlb - Name - UnicharUtilsStatic.o - MacOS - - - EmbedComponentsDebug.shlb - Name - UnicharUtilsStaticDebug.o - MacOS - + Debug + + EmbedComponentsDebug.shlb + Name + UnicharUtilsStaticDebug.o + MacOS + + + EmbedComponentsDebug.shlb + Name + printingUIDebug.o + MacOS + + + Optimized + + EmbedComponents.shlb + Name + UnicharUtilsStatic.o + MacOS + + + EmbedComponents.shlb + Name + printingUI.o + MacOS + + NS Libraries Debug diff --git a/embedding/components/build/makefile.win b/embedding/components/build/makefile.win index 1fe41d2d4a7..2db432d672e 100644 --- a/embedding/components/build/makefile.win +++ b/embedding/components/build/makefile.win @@ -26,6 +26,8 @@ REQUIRES = js \ string \ windowwatcher \ webbrowserpersist \ + webBrowser_core \ + gfx \ jsconsole \ find \ htmlparser \ @@ -54,6 +56,7 @@ CPP_OBJS = \ SUB_LIBRARIES = \ $(DIST)\lib\windowwatcher_s.lib \ + $(DIST)\lib\printingui_s.lib \ $(DIST)\lib\jsconsole_s.lib \ $(DIST)\lib\appstartupnotifier_s.lib \ $(DIST)\lib\find_s.lib \ @@ -63,12 +66,19 @@ SUB_LIBRARIES = \ LLIBS = \ $(LIBNSPR) \ + $(DIST)\lib\gkgfx.lib \ $(DIST)\lib\js3250.lib \ $(DIST)\lib\unicharutil_s.lib \ $(DIST)\lib\xpcom.lib \ $(NULL) +WIN_LIBS = \ + comdlg32.lib \ + winspool.lib \ + $(NULL) + INCS = $(INCS) \ + -I$(DEPTH)\embedding\components\printingui\src\gtk \ -I$(DEPTH)\embedding\components\windowwatcher\src \ -I$(DEPTH)\embedding\components\jsconsole\src \ -I$(DEPTH)\embedding\components\appstartup\src \ diff --git a/embedding/components/build/nsModule.cpp b/embedding/components/build/nsModule.cpp index ffc39a86d0e..26498c62ea0 100644 --- a/embedding/components/build/nsModule.cpp +++ b/embedding/components/build/nsModule.cpp @@ -49,6 +49,7 @@ #include "nsControllerCommandManager.h" #include "nsCommandParams.h" #include "nsCommandGroup.h" +#include "nsPrintingPromptService.h" NS_GENERIC_FACTORY_CONSTRUCTOR(nsDialogParamBlock) NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPromptService, Init) @@ -62,6 +63,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsControllerCommandManager) NS_GENERIC_FACTORY_CONSTRUCTOR(nsCommandManager) NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsCommandParams, Init) NS_GENERIC_FACTORY_CONSTRUCTOR(nsControllerCommandGroup) +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintingPromptService, Init) static const nsModuleComponentInfo gComponents[] = { @@ -76,7 +78,8 @@ static const nsModuleComponentInfo gComponents[] = { { "Controller Command Manager", NS_CONTROLLERCOMMANDMANAGER_CID, NS_CONTROLLERCOMMANDMANAGER_CONTRACTID, nsControllerCommandManagerConstructor }, { "Command Manager", NS_COMMAND_MANAGER_CID, NS_COMMAND_MANAGER_CONTRACTID, nsCommandManagerConstructor }, { "Command Params", NS_COMMAND_PARAMS_CID, NS_COMMAND_PARAMS_CONTRACTID, nsCommandParamsConstructor }, - { "Command Group", NS_CONTROLLER_COMMAND_GROUP_CID, NS_CONTROLLER_COMMAND_GROUP_CONTRACTID, nsControllerCommandGroupConstructor } + { "Command Group", NS_CONTROLLER_COMMAND_GROUP_CID, NS_CONTROLLER_COMMAND_GROUP_CONTRACTID, nsControllerCommandGroupConstructor }, + { "Printing Prompt Service", NS_PRINTINGPROMPTSERVICE_CID, NS_PRINTINGPROMPTSERVICE_CONTRACTID, nsPrintingPromptServiceConstructor } }; NS_IMPL_NSGETMODULE(embedcomponents, gComponents) diff --git a/embedding/components/makefile.win b/embedding/components/makefile.win index 2d8486121a2..e69de29bb2d 100644 --- a/embedding/components/makefile.win +++ b/embedding/components/makefile.win @@ -1,34 +0,0 @@ -#!nmake -# -# 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, Inc. Portions created by Netscape are -# Copyright (C) 2001, Mozilla. All Rights Reserved. -# -# Contributor(s): - -DEPTH=..\.. - -DIRS= \ - windowwatcher \ - appstartup \ - find \ - commandhandler \ - jsconsole \ - ui \ - webbrowserpersist \ - build \ - $(NULL) - -include <$(DEPTH)\config\rules.mak> diff --git a/embedding/components/windowwatcher/src/Makefile.in b/embedding/components/windowwatcher/src/Makefile.in index 632e408a6a3..b22101c7822 100644 --- a/embedding/components/windowwatcher/src/Makefile.in +++ b/embedding/components/windowwatcher/src/Makefile.in @@ -31,11 +31,13 @@ REQUIRES = xpcom \ dom \ windowwatcher \ widget \ + gfx \ js \ xpconnect \ caps \ content \ necko \ + uriloader \ docshell \ webbrwsr \ embed_base \ @@ -47,6 +49,7 @@ CPPSRCS = nsDialogParamBlock.cpp \ nsPromptService.cpp \ nsWWJSUtils.cpp \ nsWindowWatcher.cpp \ + nsPrintingPrompt.cpp \ $(NULL) # we don't want the shared lib, but we want to force the creation of a diff --git a/embedding/components/windowwatcher/src/makefile.win b/embedding/components/windowwatcher/src/makefile.win index 92683d20621..9b2f2edca6d 100644 --- a/embedding/components/windowwatcher/src/makefile.win +++ b/embedding/components/windowwatcher/src/makefile.win @@ -25,11 +25,13 @@ REQUIRES = xpcom \ string \ dom \ widget \ + gfx \ js \ xpconnect \ caps \ content \ necko \ + uriloader \ docshell \ webBrowser_core \ embed_base \ @@ -44,6 +46,7 @@ CPP_OBJS= \ .\$(OBJDIR)\nsPromptService.obj \ .\$(OBJDIR)\nsWWJSUtils.obj \ .\$(OBJDIR)\nsWindowWatcher.obj \ + .\$(OBJDIR)\nsPrintingPrompt.obj \ $(NULL) include <$(DEPTH)\config\rules.mak> diff --git a/embedding/components/windowwatcher/src/nsPrintingPrompt.cpp b/embedding/components/windowwatcher/src/nsPrintingPrompt.cpp new file mode 100644 index 00000000000..a36d8eaa34e --- /dev/null +++ b/embedding/components/windowwatcher/src/nsPrintingPrompt.cpp @@ -0,0 +1,112 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** 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) 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 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 "nsIServiceManager.h" +#include "nsPrintingPrompt.h" +#include "nsReadableUtils.h" + +#include "nsIWebProgressListener.h" + +nsresult +NS_NewPrintingPrompter(nsIPrintingPrompt **result, nsIDOMWindow *aParent) +{ + nsresult rv; + *result = 0; + + nsPrintingPrompt *prompter = new nsPrintingPrompt(aParent); + if (!prompter) + return NS_ERROR_OUT_OF_MEMORY; + + NS_ADDREF(prompter); + rv = prompter->Init(); + if (NS_FAILED(rv)) { + NS_RELEASE(prompter); + return rv; + } + + *result = prompter; + return NS_OK; +} + +NS_IMPL_THREADSAFE_ISUPPORTS1(nsPrintingPrompt, nsIPrintingPrompt) + +nsPrintingPrompt::nsPrintingPrompt(nsIDOMWindow *aParent) + : mParent(aParent) +{ + NS_INIT_REFCNT(); +} + +nsresult +nsPrintingPrompt::Init() +{ + mPromptService = do_GetService("@mozilla.org/embedcomp/printingprompt-service;1"); + return mPromptService ? NS_OK : NS_ERROR_FAILURE; +} + +//***************************************************************************** +// nsPrintingPrompt::nsIPrintingPrompt +//***************************************************************************** + +/* void showPrintDialog (in nsIWebBrowserPrint webBrowserPrint, in nsIPrintSettings printSettings); */ +NS_IMETHODIMP +nsPrintingPrompt::ShowPrintDialog(nsIWebBrowserPrint *webBrowserPrint, nsIPrintSettings *printSettings) +{ + return mPromptService->ShowPrintDialog(mParent, webBrowserPrint, printSettings); +} + +/* void showProgress (in nsIWebBrowserPrint webBrowserPrint, in nsIPrintSettings printSettings, out nsIWebProgressListener webProgressListener, out nsIPrintProgressParams printProgressParams); */ +NS_IMETHODIMP +nsPrintingPrompt::ShowProgress(nsIWebBrowserPrint *webBrowserPrint, nsIPrintSettings *printSettings, nsIObserver *openDialogObserver, nsIWebProgressListener **webProgressListener, nsIPrintProgressParams** printProgressParams, PRBool* notifyOnOpen) +{ + return mPromptService->ShowProgress(mParent, webBrowserPrint, printSettings, openDialogObserver, webProgressListener, printProgressParams, notifyOnOpen); +} + +/* void showPageSetup (in nsIPrintSettings printSettings); */ +NS_IMETHODIMP +nsPrintingPrompt::ShowPageSetup(nsIPrintSettings *printSettings) +{ + return mPromptService->ShowPageSetup(mParent, printSettings); +} + +/* void showPrinterProperties (in wstring printerName, in nsIPrintSettings printSettings); */ +NS_IMETHODIMP +nsPrintingPrompt::ShowPrinterProperties(const PRUnichar *printerName, nsIPrintSettings *printSettings) +{ + return mPromptService->ShowPrinterProperties(mParent, printerName, printSettings); +} + diff --git a/embedding/components/windowwatcher/src/nsPrintingPrompt.h b/embedding/components/windowwatcher/src/nsPrintingPrompt.h new file mode 100644 index 00000000000..e69de29bb2d diff --git a/gfx/idl/Makefile.in b/gfx/idl/Makefile.in index f132f703e74..6036b401fa1 100644 --- a/gfx/idl/Makefile.in +++ b/gfx/idl/Makefile.in @@ -40,6 +40,10 @@ XPIDLSRCS = \ nsIPrintSettings.idl \ $(NULL) +ifneq (,$(filter mac cocoa,$(MOZ_GFX_TOOLKIT))) +XPIDLSRCS += nsIPrintSettingsX.idl +endif + ifeq ($(MOZ_GFX_TOOLKIT),windows) XPIDLSRCS += nsIPrintSettingsWin.idl endif diff --git a/gfx/idl/nsIPrintOptions.idl b/gfx/idl/nsIPrintOptions.idl index 2b201a9d981..2568bdbf187 100644 --- a/gfx/idl/nsIPrintOptions.idl +++ b/gfx/idl/nsIPrintOptions.idl @@ -107,15 +107,6 @@ interface nsIPrintOptions : nsISupports */ void displayJobProperties (in wstring aPrinter, in nsIPrintSettings aPrintSettings, out boolean aDisplayed); - // Attributes - attribute boolean isCancelled; - - attribute wstring title; - attribute wstring docURL; - - attribute boolean printToFile; - attribute wstring toFileName; - // no script methods [noscript] void SetFontNamePointSize(in nsNativeStringRef aName, in PRInt32 aPointSize); diff --git a/gfx/idl/nsIPrintSettings.idl b/gfx/idl/nsIPrintSettings.idl index a7792fc91e6..34f610ed9c7 100644 --- a/gfx/idl/nsIPrintSettings.idl +++ b/gfx/idl/nsIPrintSettings.idl @@ -88,6 +88,7 @@ interface nsIPrintSettings : nsISupports const unsigned long kInitSaveToFileName = 0x00400000; const unsigned long kInitSavePageDelay = 0x00800000; const unsigned long kInitSaveMargins = 0x01000000; + const unsigned long kInitSaveNativeData = 0x02000000; const unsigned long kInitSaveAll = 0xFFFFFFFF; /* Print Option Flags for Bit Field*/ @@ -165,6 +166,11 @@ interface nsIPrintSettings : nsISupports */ void GetPageSizeInTwips(out long aWidth, out long aHeight); + /** + * Makes a new copy + */ + nsIPrintSettings clone(); + /** * Data Members */ diff --git a/gfx/idl/nsIPrintSettingsMac.idl b/gfx/idl/nsIPrintSettingsMac.idl new file mode 100644 index 00000000000..443117b2d9e --- /dev/null +++ b/gfx/idl/nsIPrintSettingsMac.idl @@ -0,0 +1,77 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** 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) 2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Don Cone + * 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 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 "nsISupports.idl" + +%{ C++ +#include +%} + +/** + * Native types + */ +native nsTHPrint(THPrint); + +/** + * Simplified PrintSettings for Mac interface + * + * @status UNDER_REVIEW + */ +[scriptable, uuid(3C85F9F5-3A9D-4bce-8CF8-A1B14E5E8508)] + +interface nsIPrintSettingsMac : nsISupports +{ + /* + * thPrint attribute + * + * Getter returns a clone of the current data + * Setter copies (does not take ownership of) the input + */ + + [noscript] attribute nsTHPrint tHPrint; + + /* + * readPageSetupFromPrefs and writePageSetupToPrefs + * + * Read and write a print record to/from prefs. + */ + [noscript] void readPageSetupFromPrefs(); + [noscript] void writePageSetupToPrefs(); +}; diff --git a/gfx/idl/nsIPrintSettingsX.idl b/gfx/idl/nsIPrintSettingsX.idl new file mode 100644 index 00000000000..d6a414897ad --- /dev/null +++ b/gfx/idl/nsIPrintSettingsX.idl @@ -0,0 +1,82 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** 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) 2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Conrad Carlen + * Don Cone + * + * + * 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 "nsISupports.idl" + +%{ C++ +#include +%} + +/** + * Native types + */ +native nsPMPageFormat(PMPageFormat); +native nsPMPrintSettings(PMPrintSettings); + + +/** + * Simplified PrintSettings for OSX interface + * + * @status UNDER_REVIEW + */ +[scriptable, uuid(CD2A0A4F-0DE9-4c51-9232-42668F559F94)] + +interface nsIPrintSettingsX : nsISupports +{ + + /* + * PMPageFormat and PMPrintSettings attributes + * + * Getter returns a clone of the current data + * Setter copies (does not take ownership of) the input + */ + [noscript] attribute nsPMPageFormat pMPageFormat; + + [noscript] attribute nsPMPrintSettings pMPrintSettings; + + /* + * readPageFormatFromPrefs and writePageFormatToPrefs + * + * Read and write a flattened PMPageFormat to/from prefs. + * This also contains any custom data we appended to the dialog + */ + [noscript] void readPageFormatFromPrefs(); + [noscript] void writePageFormatToPrefs(); +}; diff --git a/gfx/macbuild/gfxComponent.xml b/gfx/macbuild/gfxComponent.xml index caa8cbe34ed..897ad808031 100644 --- a/gfx/macbuild/gfxComponent.xml +++ b/gfx/macbuild/gfxComponent.xml @@ -1060,6 +1060,20 @@ Text Debug + + Name + nsPrintSettingsMac.cpp + MacOS + Text + Debug + + + Name + nsPrintSettingsMac.cpp + MacOS + Text + Debug + Name InterfacesStubs @@ -1300,6 +1314,16 @@ nsPrintOptionsMac.cpp MacOS + + Name + nsPrintSettingsMac.cpp + MacOS + + + Name + nsPrintSettingsMac.cpp + MacOS + Name InterfacesStubs @@ -2399,6 +2423,20 @@ Text Debug + + Name + nsPrintSettingsMac.cpp + MacOS + Text + Debug + + + Name + nsPrintSettingsMac.cpp + MacOS + Text + Debug + Name InterfacesStubs @@ -2639,6 +2677,16 @@ nsPrintOptionsMac.cpp MacOS + + Name + nsPrintSettingsMac.cpp + MacOS + + + Name + nsPrintSettingsMac.cpp + MacOS + Name InterfacesStubs @@ -3773,6 +3821,20 @@ Text Debug + + Name + nsPrintSettingsX.cpp + MacOS + Text + Debug + + + Name + nsPrintSettingsX.cpp + MacOS + Text + Debug + Name nsPrintOptionsImpl.cpp @@ -3991,6 +4053,16 @@ nsPrintOptionsX.cpp MacOS + + Name + nsPrintSettingsX.cpp + MacOS + + + Name + nsPrintSettingsX.cpp + MacOS + Name nsPrintOptionsImpl.cpp @@ -5107,6 +5179,20 @@ Text Debug + + Name + nsPrintSettingsX.cpp + MacOS + Text + Debug + + + Name + nsPrintSettingsX.cpp + MacOS + Text + Debug + Name nsPrintOptionsImpl.cpp @@ -5323,6 +5409,16 @@ nsPrintOptionsX.cpp MacOS + + Name + nsPrintSettingsX.cpp + MacOS + + + Name + nsPrintSettingsX.cpp + MacOS + Name nsPrintOptionsImpl.cpp @@ -5516,12 +5612,36 @@ nsPrintOptionsMac.cpp MacOS + + gfxComponentDbg.shlb + Name + nsPrintSettingsMac.cpp + MacOS + + + gfxComponentDbg.shlb + Name + nsPrintSettingsMac.cpp + MacOS + gfxComponentCarbon.shlb Name nsPrintOptionsX.cpp MacOS + + gfxComponentCarbon.shlb + Name + nsPrintSettingsX.cpp + MacOS + + + gfxComponentCarbon.shlb + Name + nsPrintSettingsX.cpp + MacOS + gfxComponentDbg.shlb Name diff --git a/gfx/macbuild/gfxIDL.xml b/gfx/macbuild/gfxIDL.xml index d41ff43801a..b1c47bdad63 100644 --- a/gfx/macbuild/gfxIDL.xml +++ b/gfx/macbuild/gfxIDL.xml @@ -776,6 +776,20 @@ Text + + Name + nsIPrintSettingsMac.idl + MacOS + Text + + + + Name + nsIPrintSettingsX.idl + MacOS + Text + + @@ -818,6 +832,16 @@ nsIPrintSettings.idl MacOS + + Name + nsIPrintSettingsMac.idl + MacOS + + + Name + nsIPrintSettingsX.idl + MacOS + @@ -1543,6 +1567,20 @@ Text + + Name + nsIPrintSettingsMac.idl + MacOS + Text + + + + Name + nsIPrintSettingsX.idl + MacOS + Text + + @@ -1585,6 +1623,16 @@ nsIPrintSettings.idl MacOS + + Name + nsIPrintSettingsMac.idl + MacOS + + + Name + nsIPrintSettingsX.idl + MacOS + @@ -1625,6 +1673,18 @@ nsIPrintSettings.idl MacOS + + headers + Name + nsIPrintSettingsMac.idl + MacOS + + + headers + Name + nsIPrintSettingsX.idl + MacOS + headers Name diff --git a/gfx/public/MANIFEST b/gfx/public/MANIFEST index 15f19e31964..7d27ee16e53 100644 --- a/gfx/public/MANIFEST +++ b/gfx/public/MANIFEST @@ -27,4 +27,6 @@ nsIDrawingSurface.h nsRepeater.h nsThemeConstants.h nsITheme.h +nsPDECommon.h +nsWatchTask.h diff --git a/gfx/public/Makefile.in b/gfx/public/Makefile.in index e82005aadf5..195ec91ed93 100644 --- a/gfx/public/Makefile.in +++ b/gfx/public/Makefile.in @@ -60,7 +60,10 @@ EXPORTS = \ $(NULL) ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT))) -EXPORTS += nsIPrintingContext.h +EXPORTS += \ + nsIPrintingContext.h \ + nsPDECommon.h \ + $(NULL) endif include $(topsrcdir)/config/rules.mk diff --git a/gfx/public/nsDeviceContext.h b/gfx/public/nsDeviceContext.h index 895fc4aebfa..b1b02fd0ee2 100644 --- a/gfx/public/nsDeviceContext.h +++ b/gfx/public/nsDeviceContext.h @@ -90,6 +90,7 @@ public: NS_IMETHOD Init(nsNativeWidget aWidget); + NS_IMETHOD CreateRenderingContext(nsIView *aView, nsIRenderingContext *&aContext); NS_IMETHOD CreateRenderingContext(nsIWidget *aWidget, nsIRenderingContext *&aContext); NS_IMETHOD CreateRenderingContext(nsIRenderingContext *&aContext){return NS_ERROR_NOT_IMPLEMENTED;} @@ -131,6 +132,8 @@ public: NS_IMETHOD GetPaletteInfo(nsPaletteInfo& aPaletteInfo); + NS_IMETHOD PrepareDocument(PRUnichar * aTitle, + PRUnichar* aPrintToFileName) { return NS_OK; } NS_IMETHOD AbortDocument(void) { return NS_OK; } #ifdef NS_PRINT_PREVIEW diff --git a/gfx/public/nsIDeviceContext.h b/gfx/public/nsIDeviceContext.h index e53f5a61932..483f7c70308 100644 --- a/gfx/public/nsIDeviceContext.h +++ b/gfx/public/nsIDeviceContext.h @@ -138,6 +138,12 @@ typedef void * nsNativeDeviceContext; /* Cannot Print or Print Preview XUL Documents */ #define NS_ERROR_GFX_PRINTER_NO_XUL \ NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+27) +/* The toolkit no longer supports the Print Dialog (for embedders) */ +#define NS_ERROR_GFX_NO_PRINTDIALOG_IN_TOOLKIT \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+28) +/* The was wasn't any Print Prompt service registered (this shouldn't happen) */ +#define NS_ERROR_GFX_NO_PRINTROMPTSERVICE \ + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+29) /** @@ -462,6 +468,17 @@ public: NS_IMETHOD GetDeviceContextFor(nsIDeviceContextSpec *aDevice, nsIDeviceContext *&aContext) = 0; + /** + * This is enables the DeviceContext to anything it needs to do for Printing + * before Reflow and BeginDocument is where work can be done after reflow. + * @param aTitle - itle of Document + * @param aPrintToFileName - name of file to print to, if NULL then don't print to file + * + * @return error status + */ + NS_IMETHOD PrepareDocument(PRUnichar * aTitle, + PRUnichar* aPrintToFileName) = 0; + //XXX need to work out re-entrancy issues for these APIs... MMP /** * Inform the output device that output of a document is beginning @@ -469,9 +486,18 @@ public: * EndDocument(). * XXX needs to take parameters so that feedback can be given to the * app regarding pagination progress and aborting print operations? + * + * @param aTitle - itle of Document + * @param aPrintToFileName - name of file to print to, if NULL then don't print to file + * @param aStartPage - starting page number (must be greater than zero) + * @param aEndPage - ending page number (must be less than or equal to number of pages) + * * @return error status */ - NS_IMETHOD BeginDocument(PRUnichar * aTitle) = 0; + NS_IMETHOD BeginDocument(PRUnichar * aTitle, + PRUnichar* aPrintToFileName, + PRInt32 aStartPage, + PRInt32 aEndPage) = 0; /** * Inform the output device that output of a document is ending. diff --git a/gfx/public/nsIDeviceContextSpecFactory.h b/gfx/public/nsIDeviceContextSpecFactory.h index 30b914745de..e9011f2687a 100644 --- a/gfx/public/nsIDeviceContextSpecFactory.h +++ b/gfx/public/nsIDeviceContextSpecFactory.h @@ -64,24 +64,17 @@ public: * means getting information about a printer. A previously * returned device context spec can be passed in and used as * a starting point for getting a new spec (or simply returning - * the old spec again). Additionally, if it is desirable to - * get the device context spec without user intervention, any - * dialog boxes can be supressed by passing in PR_TRUE for the - * aQuiet parameter. + * the old spec again). * @param aWidget.. this is a widget a dialog can be hosted in * @param aNewSpec out parameter for device context spec returned. the * aOldSpec may be returned if the object is recyclable. - * @param aQuiet if PR_TRUE, prevent the need for user intervention - * in obtaining device context spec. if nsnull is passed in for - * the aOldSpec, this will typically result in getting a device - * context spec for the default output device (i.e. default - * printer). + * @param aIsPrintPreview if PR_TRUE, creating Spec for PrintPreview * @return error status */ NS_IMETHOD CreateDeviceContextSpec(nsIWidget *aWidget, nsIPrintSettings* aPrintSettings, nsIDeviceContextSpec *&aNewSpec, - PRBool aQuiet) = 0; + PRBool aIsPrintPreview) = 0; }; #endif diff --git a/gfx/public/nsIPrintingContext.h b/gfx/public/nsIPrintingContext.h index 7620a50c372..71ea28484c5 100644 --- a/gfx/public/nsIPrintingContext.h +++ b/gfx/public/nsIPrintingContext.h @@ -54,14 +54,10 @@ public: NS_DEFINE_STATIC_IID_ACCESSOR(NS_IPRINTING_CONTEXT_IID) /** * Initialize the printing context for use. - * @param aQuiet if PR_TRUE, prevent the need for user intervention - * in obtaining device context spec. if nsnull is passed in for - * the aOldSpec, this will typically result in getting a device - * context spec for the default output device (i.e. default - * printer). + * @param aIsPrintPreview TRUE if doing print preview, FALSE if normal printing. * @return error status */ - NS_IMETHOD Init(nsIPrintSettings* aPS, PRBool aQuiet) = 0; + NS_IMETHOD Init(nsIPrintSettings* aPS, PRBool aIsPrintPreview) = 0; /** * This will tell if the printmanager is currently open @@ -78,7 +74,8 @@ public: */ NS_IMETHOD ClosePrintManager() = 0; - NS_IMETHOD BeginDocument() = 0; + NS_IMETHOD BeginDocument(PRInt32 aStartPage, + PRInt32 aEndPage) = 0; NS_IMETHOD EndDocument() = 0; diff --git a/gfx/public/nsPDECommon.h b/gfx/public/nsPDECommon.h new file mode 100644 index 00000000000..d5ba4906b8d --- /dev/null +++ b/gfx/public/nsPDECommon.h @@ -0,0 +1,70 @@ +/* -*- 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 mPrintFramesSeperatly; + 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 \ No newline at end of file diff --git a/gfx/public/nsWatchTask.h b/gfx/public/nsWatchTask.h new file mode 100644 index 00000000000..4877c098659 --- /dev/null +++ b/gfx/public/nsWatchTask.h @@ -0,0 +1,107 @@ +/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */ +/* ***** 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 WatchTask_h__ +#define WatchTask_h__ + + +#ifndef XP_MACOSX +#include +#endif +#include +#include "prtypes.h" +#include "nscore.h" + + +// +// class nsWatchTask +// +// A nice little class that installs/removes a VBL to set the cursor to +// the watch if we're away from the event loop for a while. Will also +// animate the watch cursor. +// + +class nsWatchTask +{ +public: + nsWatchTask ( ) ; + ~nsWatchTask ( ) ; + + // Registers the VBL task and does other various init tasks to begin + // watching for time away from the event loop. It is ok to call other + // methods on this object w/out calling Start(). + NS_GFX void Start ( ) ; + + // call from the main event loop + NS_GFX void EventLoopReached ( ) ; + + // turn off when we know we're going into an area where it's ok + // that WNE is not called (eg, the menu code) + void Suspend ( ) { mSuspended = PR_TRUE; }; + void Resume ( ) { mSuspended = PR_FALSE; }; + + static NS_GFX nsWatchTask& GetTask ( ) ; + +private: + + enum { + kRepeatInterval = 10, // check every 1/6 of a second if we should show watch (10/60) + kTicksToShowWatch = 45, // show watch if haven't seen WNE for 3/4 second (45/60) + kStepsInAnimation = 12 + }; + + // the VBL task + static pascal void DoWatchTask(nsWatchTask* theTaskPtr) ; + +#if !TARGET_CARBON + VBLTask mTask; // this must be first!! +#endif + long mChecksum; // 'mozz' to validate we have real data at interrupt time (not needed?) + void* mSelf; // so we can get back to |this| from the static routine + long mTicks; // last time the event loop was hit + Cursor mWatchCursor; // the watch cursor + PRPackedBool mBusy; // are we currently spinning the cursor? + PRPackedBool mSuspended; // set if we've temporarily suspended operation + PRPackedBool mInstallSucceeded; // did we succeed in installing the task? (used in dtor) + short mAnimation; // stage of animation + +}; + + +#endif diff --git a/gfx/src/beos/Makefile.in b/gfx/src/beos/Makefile.in index ac268d70e28..dc00cbed21e 100644 --- a/gfx/src/beos/Makefile.in +++ b/gfx/src/beos/Makefile.in @@ -55,8 +55,6 @@ REQUIRES = xpcom \ view \ intl \ uconv \ - dom \ - windowwatcher \ unicharutil \ $(NULL) diff --git a/gfx/src/beos/nsDeviceContextBeOS.cpp b/gfx/src/beos/nsDeviceContextBeOS.cpp index b4a520eed3c..0f82f61226c 100644 --- a/gfx/src/beos/nsDeviceContextBeOS.cpp +++ b/gfx/src/beos/nsDeviceContextBeOS.cpp @@ -381,7 +381,7 @@ NS_IMETHODIMP nsDeviceContextBeOS::GetDeviceContextFor(nsIDeviceContextSpec *aDe #endif /* USE_POSTSCRIPT */ } -NS_IMETHODIMP nsDeviceContextBeOS::BeginDocument(PRUnichar * aTitle) +NS_IMETHODIMP nsDeviceContextBeOS::BeginDocument(PRUnichar * aTitle, PRUnichar* aPrintToFileName, PRInt32 aStartPage, PRInt32 aEndPage) { return NS_OK; } diff --git a/gfx/src/beos/nsDeviceContextBeOS.h b/gfx/src/beos/nsDeviceContextBeOS.h index 8145603479f..c6ee60523db 100644 --- a/gfx/src/beos/nsDeviceContextBeOS.h +++ b/gfx/src/beos/nsDeviceContextBeOS.h @@ -81,7 +81,7 @@ public: NS_IMETHOD GetDeviceContextFor(nsIDeviceContextSpec *aDevice, nsIDeviceContext *&aContext); - NS_IMETHOD BeginDocument(PRUnichar * aTitle); + NS_IMETHOD BeginDocument(PRUnichar * aTitle, PRUnichar* aPrintToFileName, PRInt32 aStartPage, PRInt32 aEndPage); NS_IMETHOD EndDocument(void); NS_IMETHOD BeginPage(void); diff --git a/gfx/src/beos/nsDeviceContextSpecB.cpp b/gfx/src/beos/nsDeviceContextSpecB.cpp index 20aecc7b405..57e5f4c9f65 100644 --- a/gfx/src/beos/nsDeviceContextSpecB.cpp +++ b/gfx/src/beos/nsDeviceContextSpecB.cpp @@ -42,19 +42,6 @@ #include "nsIPref.h" #include "prenv.h" /* for PR_GetEnv */ -#include "nsIDOMWindow.h" -#include "nsIServiceManager.h" -#include "nsIDialogParamBlock.h" -#include "nsISupportsPrimitives.h" -#include "nsIWindowWatcher.h" -#include "nsIDOMWindowInternal.h" - -#include "nsReadableUtils.h" -#include "nsISupportsArray.h" - -//#include "prmem.h" -//#include "plstr.h" - //---------------------------------------------------------------------------------- // The printer data is shared between the PrinterEnumerator and the nsDeviceContextSpecG // The PrinterEnumerator creates the printer info @@ -153,73 +140,12 @@ NS_IMETHODIMP nsDeviceContextSpecBeOS :: QueryInterface(REFNSIID aIID, void** aI NS_IMPL_ADDREF(nsDeviceContextSpecBeOS) NS_IMPL_RELEASE(nsDeviceContextSpecBeOS) - -/** ------------------------------------------------------- - */ -static nsresult DisplayXPDialog(nsIPrintSettings* aPS, - const char* aChromeURL, - PRBool& aClickedOK) -{ - NS_ASSERTION(aPS, "Must have a print settings!"); - - aClickedOK = PR_FALSE; - nsresult rv = NS_ERROR_FAILURE; - - // create a nsISupportsArray of the parameters - // being passed to the window - nsCOMPtr array; - NS_NewISupportsArray(getter_AddRefs(array)); - if (!array) return NS_ERROR_FAILURE; - - nsCOMPtr ps = aPS; - nsCOMPtr psSupports(do_QueryInterface(ps)); - NS_ASSERTION(psSupports, "PrintSettings must be a supports"); - array->AppendElement(psSupports); - - nsCOMPtr ioParamBlock(do_CreateInstance("@mozilla.org/embedcomp/dialogparam;1")); - if (ioParamBlock) { - ioParamBlock->SetInt(0, 0); - nsCOMPtr blkSupps(do_QueryInterface(ioParamBlock)); - NS_ASSERTION(blkSupps, "IOBlk must be a supports"); - - array->AppendElement(blkSupps); - nsCOMPtr arguments(do_QueryInterface(array)); - NS_ASSERTION(array, "array must be a supports"); - - nsCOMPtr wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1")); - if (wwatch) { - nsCOMPtr active; - wwatch->GetActiveWindow(getter_AddRefs(active)); - nsCOMPtr parent = do_QueryInterface(active); - - nsCOMPtr newWindow; - rv = wwatch->OpenWindow(parent, aChromeURL, - "_blank", "chrome,modal,centerscreen", array, - getter_AddRefs(newWindow)); - } - } - - if (NS_SUCCEEDED(rv)) { - PRInt32 buttonPressed = 0; - ioParamBlock->GetInt(0, &buttonPressed); - if (buttonPressed == 1) { - aClickedOK = PR_TRUE; - } else { - rv = NS_ERROR_ABORT; - } - } else { - rv = NS_ERROR_ABORT; - } - return rv; -} - - /** ------------------------------------------------------- * Initialize the nsDeviceContextSpecBeOS * @update dc 2/15/98 * @update syd 3/2/99 */ -NS_IMETHODIMP nsDeviceContextSpecBeOS::Init(nsIPrintSettings* aPS, PRBool aQuiet) +NS_IMETHODIMP nsDeviceContextSpecBeOS::Init(nsIPrintSettings* aPS) { nsresult rv = NS_ERROR_FAILURE; NS_ASSERTION(nsnull != aPS, "No print settings."); @@ -260,99 +186,88 @@ NS_IMETHODIMP nsDeviceContextSpecBeOS::Init(nsIPrintSettings* aPS, PRBool aQuiet return rv; } - if (!aQuiet ) { - rv = DisplayXPDialog(aPS, - "chrome://global/content/printdialog.xul", canPrint); - } - else { - canPrint = PR_TRUE; - } GlobalPrinters::GetInstance()->FreeGlobalPrinters(); - if (canPrint) { - if (aPS != nsnull) { - aPS->GetPrinterName(&printer); - aPS->GetPrintReversed(&reversed); - aPS->GetPrintInColor(&color); - aPS->GetPaperSize(&paper_size); - aPS->GetOrientation(&orientation); - aPS->GetPrintCommand(&command); - aPS->GetPrintRange(&printRange); - aPS->GetToFileName(&printfile); - aPS->GetPrintToFile(&tofile); - aPS->GetStartPageRange(&fromPage); - aPS->GetEndPageRange(&toPage); - aPS->GetNumCopies(&copies); - aPS->GetMarginTop(&dtop); - aPS->GetMarginLeft(&dleft); - aPS->GetMarginBottom(&dbottom); - aPS->GetMarginRight(&dright); + if (aPS != nsnull) { + aPS->GetPrinterName(&printer); + aPS->GetPrintReversed(&reversed); + aPS->GetPrintInColor(&color); + aPS->GetPaperSize(&paper_size); + aPS->GetOrientation(&orientation); + aPS->GetPrintCommand(&command); + aPS->GetPrintRange(&printRange); + aPS->GetToFileName(&printfile); + aPS->GetPrintToFile(&tofile); + aPS->GetStartPageRange(&fromPage); + aPS->GetEndPageRange(&toPage); + aPS->GetNumCopies(&copies); + aPS->GetMarginTop(&dtop); + aPS->GetMarginLeft(&dleft); + aPS->GetMarginBottom(&dbottom); + aPS->GetMarginRight(&dright); - if (command != nsnull && printfile != nsnull) { - // ToDo: Use LocalEncoding instead of UTF-8 (see bug 73446) - strcpy(mPrData.command, NS_ConvertUCS2toUTF8(command).get()); - strcpy(mPrData.path, NS_ConvertUCS2toUTF8(printfile).get()); - } - if (printer != nsnull) - strcpy(mPrData.printer, NS_ConvertUCS2toUTF8(printer).get()); + if (command != nsnull && printfile != nsnull) { + // ToDo: Use LocalEncoding instead of UTF-8 (see bug 73446) + strcpy(mPrData.command, NS_ConvertUCS2toUTF8(command).get()); + strcpy(mPrData.path, NS_ConvertUCS2toUTF8(printfile).get()); + } + if (printer != nsnull) + strcpy(mPrData.printer, NS_ConvertUCS2toUTF8(printer).get()); #ifdef DEBUG_rods - printf("margins: %5.2f,%5.2f,%5.2f,%5.2f\n", dtop, dleft, dbottom, dright); - printf("printRange %d\n", printRange); - printf("fromPage %d\n", fromPage); - printf("toPage %d\n", toPage); + printf("margins: %5.2f,%5.2f,%5.2f,%5.2f\n", dtop, dleft, dbottom, dright); + printf("printRange %d\n", printRange); + printf("fromPage %d\n", fromPage); + printf("toPage %d\n", toPage); #endif /* DEBUG_rods */ - } else { + } else { #ifdef VMS - // Note to whoever puts the "lpr" into the prefs file. Please contact me - // as I need to make the default be "print" instead of "lpr" for OpenVMS. - strcpy(mPrData.command, "print"); + // Note to whoever puts the "lpr" into the prefs file. Please contact me + // as I need to make the default be "print" instead of "lpr" for OpenVMS. + strcpy(mPrData.command, "print"); #else - strcpy(mPrData.command, "lpr ${MOZ_PRINTER_NAME:+'-P'}${MOZ_PRINTER_NAME}"); + strcpy(mPrData.command, "lpr ${MOZ_PRINTER_NAME:+'-P'}${MOZ_PRINTER_NAME}"); #endif /* VMS */ - } + } - mPrData.top = dtop; - mPrData.bottom = dbottom; - mPrData.left = dleft; - mPrData.right = dright; - mPrData.fpf = !reversed; - mPrData.grayscale = !color; - mPrData.size = paper_size; - mPrData.orientation = orientation; - mPrData.toPrinter = !tofile; - mPrData.copies = copies; + mPrData.top = dtop; + mPrData.bottom = dbottom; + mPrData.left = dleft; + mPrData.right = dright; + mPrData.fpf = !reversed; + mPrData.grayscale = !color; + mPrData.size = paper_size; + mPrData.orientation = orientation; + mPrData.toPrinter = !tofile; + mPrData.copies = copies; - // PWD, HOME, or fail - - if (!printfile) { - if ( ( path = PR_GetEnv( "PWD" ) ) == (char *) nsnull ) - if ( ( path = PR_GetEnv( "HOME" ) ) == (char *) nsnull ) - strcpy(mPrData.path, "mozilla.ps"); - - if ( path != (char *) nsnull ) - sprintf(mPrData.path, "%s/mozilla.ps", path); - else - return NS_ERROR_FAILURE; - } - + // PWD, HOME, or fail + + if (!printfile) { + if ( ( path = PR_GetEnv( "PWD" ) ) == (char *) nsnull ) + if ( ( path = PR_GetEnv( "HOME" ) ) == (char *) nsnull ) + strcpy(mPrData.path, "mozilla.ps"); + + if ( path != (char *) nsnull ) + sprintf(mPrData.path, "%s/mozilla.ps", path); + else + return NS_ERROR_FAILURE; + } + #ifdef NOT_IMPLEMENTED_YET - if (mGlobalNumPrinters) { - for(int i = 0; (i < mGlobalNumPrinters) && !mQueue; i++) { - if (!(mGlobalPrinterList->StringAt(i)->CompareWithConversion(mPrData.printer, TRUE, -1))) - mQueue = PrnDlg.SetPrinterQueue(i); - } - } + if (mGlobalNumPrinters) { + for(int i = 0; (i < mGlobalNumPrinters) && !mQueue; i++) { + if (!(mGlobalPrinterList->StringAt(i)->CompareWithConversion(mPrData.printer, TRUE, -1))) + mQueue = PrnDlg.SetPrinterQueue(i); + } + } #endif /* NOT_IMPLEMENTED_YET */ - - if (command != nsnull) { - nsMemory::Free(command); - } - if (printfile != nsnull) { - nsMemory::Free(printfile); - } - - return NS_OK; + + if (command != nsnull) { + nsMemory::Free(command); + } + if (printfile != nsnull) { + nsMemory::Free(printfile); } return rv; @@ -564,19 +479,7 @@ NS_IMETHODIMP nsPrinterEnumeratorBeOS::InitPrintSettingsFromPrinter(const PRUnic NS_IMETHODIMP nsPrinterEnumeratorBeOS::DisplayPropertiesDlg(const PRUnichar *aPrinter, nsIPrintSettings *aPrintSettings) { - /* fixme: We simply ignore the |aPrinter| argument here - * We should get the supported printer attributes from the printer and - * populate the print job options dialog with these data instead of using - * the "default set" here. - * However, this requires changes on all platforms and is another big chunk - * of patches ... ;-( - */ - - PRBool pressedOK; - return DisplayXPDialog(aPrintSettings, - "chrome://global/content/printjoboptions.xul", - pressedOK); - + return NS_OK; } //---------------------------------------------------------------------- diff --git a/gfx/src/beos/nsDeviceContextSpecB.h b/gfx/src/beos/nsDeviceContextSpecB.h index 779feeb3b92..31fddef43fc 100644 --- a/gfx/src/beos/nsDeviceContextSpecB.h +++ b/gfx/src/beos/nsDeviceContextSpecB.h @@ -68,14 +68,10 @@ public: /** * Initialize the nsDeviceContextSpecBeOS for use. This will allocate a printrecord for use * @update dc 2/16/98 - * @param aQuiet if PR_TRUE, prevent the need for user intervention - * in obtaining device context spec. if nsnull is passed in for - * the aOldSpec, this will typically result in getting a device - * context spec for the default output device (i.e. default - * printer). + * @param aIsPrintPreview if PR_TRUE, creating Spec for PrintPreview * @return error status */ - NS_IMETHOD Init(nsIPrintSettings* aPS, PRBool aQuiet); + NS_IMETHOD Init(nsIPrintSettings* aPS); /** diff --git a/gfx/src/beos/nsDeviceContextSpecFactoryB.cpp b/gfx/src/beos/nsDeviceContextSpecFactoryB.cpp index 57d518e9eed..6d5d1a2f429 100644 --- a/gfx/src/beos/nsDeviceContextSpecFactoryB.cpp +++ b/gfx/src/beos/nsDeviceContextSpecFactoryB.cpp @@ -79,15 +79,15 @@ NS_IMETHODIMP nsDeviceContextSpecFactoryBeOS :: Init(void) */ NS_IMETHODIMP nsDeviceContextSpecFactoryBeOS :: CreateDeviceContextSpec(nsIWidget *aWidget, nsIPrintSettings* aPrintSettings, - nsIDeviceContextSpec *&aNewSpec, - PRBool aQuiet) + nsIDeviceContextSpec *&aNewSpec, + PRBool aIsPrintPreview) { nsresult rv; static NS_DEFINE_CID(kDeviceContextSpecCID, NS_DEVICE_CONTEXT_SPEC_CID); nsCOMPtr devSpec = do_CreateInstance(kDeviceContextSpecCID, &rv); if (NS_SUCCEEDED(rv)) { - rv = ((nsDeviceContextSpecBeOS *)devSpec.get())->Init(aPrintSettings, aQuiet); + rv = ((nsDeviceContextSpecBeOS *)devSpec.get())->Init(aPrintSettings); if (NS_SUCCEEDED(rv)) { aNewSpec = devSpec; diff --git a/gfx/src/beos/nsDeviceContextSpecFactoryB.h b/gfx/src/beos/nsDeviceContextSpecFactoryB.h index 1ee077f3558..40dbccf18c8 100644 --- a/gfx/src/beos/nsDeviceContextSpecFactoryB.h +++ b/gfx/src/beos/nsDeviceContextSpecFactoryB.h @@ -53,7 +53,7 @@ public: NS_IMETHOD CreateDeviceContextSpec(nsIWidget *aWidget, nsIPrintSettings* aPrintSettings, nsIDeviceContextSpec *&aNewSpec, - PRBool aQuiet); + PRBool aIsPrintPreview); protected: virtual ~nsDeviceContextSpecFactoryBeOS(); diff --git a/gfx/src/gtk/Makefile.in b/gfx/src/gtk/Makefile.in index 242c2a825bd..249ced4cd56 100644 --- a/gfx/src/gtk/Makefile.in +++ b/gfx/src/gtk/Makefile.in @@ -37,15 +37,13 @@ REQUIRES = xpcom \ widget \ view \ util \ - dom \ pref \ uconv \ unicharutil \ - windowwatcher \ locale \ + necko \ content \ layout \ - necko \ $(NULL) # Sun's Complex Text Layout support diff --git a/gfx/src/gtk/nsDeviceContextGTK.cpp b/gfx/src/gtk/nsDeviceContextGTK.cpp index 215d9c1ffd0..9d42725d91c 100644 --- a/gfx/src/gtk/nsDeviceContextGTK.cpp +++ b/gfx/src/gtk/nsDeviceContextGTK.cpp @@ -562,7 +562,7 @@ NS_IMETHODIMP nsDeviceContextGTK::GetDeviceContextFor(nsIDeviceContextSpec *aDev return NS_ERROR_UNEXPECTED; } -NS_IMETHODIMP nsDeviceContextGTK::BeginDocument(PRUnichar * aTitle) +NS_IMETHODIMP nsDeviceContextGTK::BeginDocument(PRUnichar * aTitle, PRUnichar* aPrintToFileName, PRInt32 aStartPage, PRInt32 aEndPage) { return NS_OK; } diff --git a/gfx/src/gtk/nsDeviceContextGTK.h b/gfx/src/gtk/nsDeviceContextGTK.h index da29abd23e6..e08ef99d466 100644 --- a/gfx/src/gtk/nsDeviceContextGTK.h +++ b/gfx/src/gtk/nsDeviceContextGTK.h @@ -84,7 +84,7 @@ public: NS_IMETHOD GetDeviceContextFor(nsIDeviceContextSpec *aDevice, nsIDeviceContext *&aContext); - NS_IMETHOD BeginDocument(PRUnichar * aTitle); + NS_IMETHOD BeginDocument(PRUnichar * aTitle, PRUnichar* aPrintToFileName, PRInt32 aStartPage, PRInt32 aEndPage); NS_IMETHOD EndDocument(void); NS_IMETHOD AbortDocument(void); diff --git a/gfx/src/gtk/nsDeviceContextSpecFactoryG.cpp b/gfx/src/gtk/nsDeviceContextSpecFactoryG.cpp index cd368a99018..55dd0a7fa1b 100644 --- a/gfx/src/gtk/nsDeviceContextSpecFactoryG.cpp +++ b/gfx/src/gtk/nsDeviceContextSpecFactoryG.cpp @@ -77,14 +77,14 @@ NS_IMETHODIMP nsDeviceContextSpecFactoryGTK :: Init(void) NS_IMETHODIMP nsDeviceContextSpecFactoryGTK :: CreateDeviceContextSpec(nsIWidget *aWidget, nsIPrintSettings* aPrintSettings, nsIDeviceContextSpec *&aNewSpec, - PRBool aQuiet) + PRBool aIsPrintPreview) { nsresult rv; static NS_DEFINE_CID(kDeviceContextSpecCID, NS_DEVICE_CONTEXT_SPEC_CID); nsCOMPtr devSpec = do_CreateInstance(kDeviceContextSpecCID, &rv); if (NS_SUCCEEDED(rv)) { - rv = ((nsDeviceContextSpecGTK *)devSpec.get())->Init(aPrintSettings, aQuiet); + rv = ((nsDeviceContextSpecGTK *)devSpec.get())->Init(aPrintSettings); if (NS_SUCCEEDED(rv)) { aNewSpec = devSpec; diff --git a/gfx/src/gtk/nsDeviceContextSpecFactoryG.h b/gfx/src/gtk/nsDeviceContextSpecFactoryG.h index 63262db4b78..0cd0169b860 100644 --- a/gfx/src/gtk/nsDeviceContextSpecFactoryG.h +++ b/gfx/src/gtk/nsDeviceContextSpecFactoryG.h @@ -53,7 +53,7 @@ public: NS_IMETHOD CreateDeviceContextSpec(nsIWidget *aWidget, nsIPrintSettings* aPrintSettings, nsIDeviceContextSpec *&aNewSpec, - PRBool aQuiet); + PRBool aIsPrintPreview); protected: virtual ~nsDeviceContextSpecFactoryGTK(); diff --git a/gfx/src/gtk/nsDeviceContextSpecG.cpp b/gfx/src/gtk/nsDeviceContextSpecG.cpp index 603ef369227..2802e987898 100644 --- a/gfx/src/gtk/nsDeviceContextSpecG.cpp +++ b/gfx/src/gtk/nsDeviceContextSpecG.cpp @@ -51,16 +51,9 @@ #include "nsIPref.h" #include "prenv.h" /* for PR_GetEnv */ -#include "nsIDOMWindowInternal.h" -#include "nsIServiceManager.h" -#include "nsIDialogParamBlock.h" -#include "nsISupportsPrimitives.h" -#include "nsIWindowWatcher.h" - -#include "nsReadableUtils.h" -#include "nsISupportsArray.h" - #include "nsPrintfCString.h" +#include "nsReadableUtils.h" +#include "nsIServiceManager.h" #ifdef USE_XPRINT #include "xprintutil.h" @@ -254,66 +247,6 @@ NS_IMPL_ISUPPORTS1(nsDeviceContextSpecGTK, #error "This should not happen" #endif -/** ------------------------------------------------------- - */ -static nsresult DisplayXPDialog(nsIPrintSettings* aPS, - const char* aChromeURL, - PRBool& aClickedOK) -{ - DO_PR_DEBUG_LOG(("nsDeviceContextSpecGTK::DisplayXPDialog()\n")); - NS_ASSERTION(aPS, "Must have a print settings!"); - - aClickedOK = PR_FALSE; - nsresult rv = NS_ERROR_FAILURE; - - // create a nsISupportsArray of the parameters - // being passed to the window - nsCOMPtr array; - NS_NewISupportsArray(getter_AddRefs(array)); - if (!array) return NS_ERROR_FAILURE; - - nsCOMPtr ps = aPS; - nsCOMPtr psSupports(do_QueryInterface(ps)); - NS_ASSERTION(psSupports, "PrintSettings must be a supports"); - array->AppendElement(psSupports); - - nsCOMPtr ioParamBlock(do_CreateInstance("@mozilla.org/embedcomp/dialogparam;1")); - if (ioParamBlock) { - ioParamBlock->SetInt(0, 0); - nsCOMPtr blkSupps(do_QueryInterface(ioParamBlock)); - NS_ASSERTION(blkSupps, "IOBlk must be a supports"); - - array->AppendElement(blkSupps); - nsCOMPtr arguments(do_QueryInterface(array)); - NS_ASSERTION(array, "array must be a supports"); - - nsCOMPtr wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1")); - if (wwatch) { - nsCOMPtr active; - wwatch->GetActiveWindow(getter_AddRefs(active)); - nsCOMPtr parent = do_QueryInterface(active); - - nsCOMPtr newWindow; - rv = wwatch->OpenWindow(parent, aChromeURL, - "_blank", "chrome,modal,centerscreen", array, - getter_AddRefs(newWindow)); - } - } - - if (NS_SUCCEEDED(rv)) { - PRInt32 buttonPressed = 0; - ioParamBlock->GetInt(0, &buttonPressed); - if (buttonPressed == 1) { - aClickedOK = PR_TRUE; - } else { - rv = NS_ERROR_ABORT; - } - } else { - rv = NS_ERROR_ABORT; - } - return rv; -} - /** ------------------------------------------------------- * Initialize the nsDeviceContextSpecGTK * @update dc 2/15/98 @@ -323,19 +256,19 @@ static nsresult DisplayXPDialog(nsIPrintSettings* aPS, * toolkits including: * - GTK+-toolkit: * file: mozilla/gfx/src/gtk/nsDeviceContextSpecG.cpp - * function: NS_IMETHODIMP nsDeviceContextSpecGTK::Init(PRBool aQuiet) + * function: NS_IMETHODIMP nsDeviceContextSpecGTK::Init() * - GTK-toolkit: * file: mozilla/gfx/src/xlib/nsDeviceContextSpecGTK.cpp - * function: NS_IMETHODIMP nsDeviceContextSpecGTK::Init(PRBool aQuiet) + * function: NS_IMETHODIMP nsDeviceContextSpecGTK::Init() * - Qt-toolkit: * file: mozilla/gfx/src/qt/nsDeviceContextSpecQT.cpp - * function: NS_IMETHODIMP nsDeviceContextSpecQT::Init(PRBool aQuiet) + * function: NS_IMETHODIMP nsDeviceContextSpecQT::Init() * * ** Please update the other toolkits when changing this function. */ -NS_IMETHODIMP nsDeviceContextSpecGTK::Init(nsIPrintSettings *aPS, PRBool aQuiet) +NS_IMETHODIMP nsDeviceContextSpecGTK::Init(nsIPrintSettings *aPS) { - DO_PR_DEBUG_LOG(("nsDeviceContextSpecGTK::Init(aPS=%p. qQuiet=%d)\n", aPS, (int)aQuiet)); + DO_PR_DEBUG_LOG(("nsDeviceContextSpecGTK::Init(aPS=%p)\n", aPS); nsresult rv = NS_ERROR_FAILURE; mPrintSettings = aPS; @@ -350,88 +283,76 @@ NS_IMETHODIMP nsDeviceContextSpecGTK::Init(nsIPrintSettings *aPS, PRBool aQuiet) } } - PRBool canPrint = PR_FALSE; - rv = GlobalPrinters::GetInstance()->InitializeGlobalPrinters(); if (NS_FAILED(rv)) { return rv; } - if (!aQuiet) { - rv = DisplayXPDialog(mPrintSettings, - "chrome://global/content/printdialog.xul", canPrint); - } else { - rv = NS_OK; - canPrint = PR_TRUE; - } - GlobalPrinters::GetInstance()->FreeGlobalPrinters(); - if (NS_SUCCEEDED(rv) && canPrint) { - if (aPS) { - PRBool reversed = PR_FALSE; - PRBool color = PR_FALSE; - PRBool tofile = PR_FALSE; - PRInt16 printRange = nsIPrintSettings::kRangeAllPages; - PRInt32 orientation = NS_PORTRAIT; - PRInt32 fromPage = 1; - PRInt32 toPage = 1; - PRUnichar *command = nsnull; - PRInt32 copies = 1; - PRUnichar *printer = nsnull; - PRUnichar *papername = nsnull; - PRUnichar *printfile = nsnull; - double dleft = 0.5; - double dright = 0.5; - double dtop = 0.5; - double dbottom = 0.5; + if (aPS) { + PRBool reversed = PR_FALSE; + PRBool color = PR_FALSE; + PRBool tofile = PR_FALSE; + PRInt16 printRange = nsIPrintSettings::kRangeAllPages; + PRInt32 orientation = NS_PORTRAIT; + PRInt32 fromPage = 1; + PRInt32 toPage = 1; + PRUnichar *command = nsnull; + PRInt32 copies = 1; + PRUnichar *printer = nsnull; + PRUnichar *papername = nsnull; + PRUnichar *printfile = nsnull; + double dleft = 0.5; + double dright = 0.5; + double dtop = 0.5; + double dbottom = 0.5; - aPS->GetPrinterName(&printer); - aPS->GetPrintReversed(&reversed); - aPS->GetPrintInColor(&color); - aPS->GetPaperName(&papername); - aPS->GetOrientation(&orientation); - aPS->GetPrintCommand(&command); - aPS->GetPrintRange(&printRange); - aPS->GetToFileName(&printfile); - aPS->GetPrintToFile(&tofile); - aPS->GetStartPageRange(&fromPage); - aPS->GetEndPageRange(&toPage); - aPS->GetNumCopies(&copies); - aPS->GetMarginTop(&dtop); - aPS->GetMarginLeft(&dleft); - aPS->GetMarginBottom(&dbottom); - aPS->GetMarginRight(&dright); + aPS->GetPrinterName(&printer); + aPS->GetPrintReversed(&reversed); + aPS->GetPrintInColor(&color); + aPS->GetPaperName(&papername); + aPS->GetOrientation(&orientation); + aPS->GetPrintCommand(&command); + aPS->GetPrintRange(&printRange); + aPS->GetToFileName(&printfile); + aPS->GetPrintToFile(&tofile); + aPS->GetStartPageRange(&fromPage); + aPS->GetEndPageRange(&toPage); + aPS->GetNumCopies(&copies); + aPS->GetMarginTop(&dtop); + aPS->GetMarginLeft(&dleft); + aPS->GetMarginBottom(&dbottom); + aPS->GetMarginRight(&dright); - if (printfile) - strcpy(mPath, NS_ConvertUCS2toUTF8(printfile).get()); - if (command) - strcpy(mCommand, NS_ConvertUCS2toUTF8(command).get()); - if (printer) - strcpy(mPrinter, NS_ConvertUCS2toUTF8(printer).get()); - if (papername) - strcpy(mPaperName, NS_ConvertUCS2toUTF8(papername).get()); + if (printfile) + strcpy(mPath, NS_ConvertUCS2toUTF8(printfile).get()); + if (command) + strcpy(mCommand, NS_ConvertUCS2toUTF8(command).get()); + if (printer) + strcpy(mPrinter, NS_ConvertUCS2toUTF8(printer).get()); + if (papername) + strcpy(mPaperName, NS_ConvertUCS2toUTF8(papername).get()); - DO_PR_DEBUG_LOG(("margins: %5.2f,%5.2f,%5.2f,%5.2f\n", dtop, dleft, dbottom, dright)); - DO_PR_DEBUG_LOG(("printRange %d\n", printRange)); - DO_PR_DEBUG_LOG(("fromPage %d\n", fromPage)); - DO_PR_DEBUG_LOG(("toPage %d\n", toPage)); - DO_PR_DEBUG_LOG(("tofile %d\n", tofile)); - DO_PR_DEBUG_LOG(("printfile '%s'\n", printfile? NS_ConvertUCS2toUTF8(printfile).get():"")); - DO_PR_DEBUG_LOG(("command '%s'\n", command? NS_ConvertUCS2toUTF8(command).get():"")); - DO_PR_DEBUG_LOG(("printer '%s'\n", printer? NS_ConvertUCS2toUTF8(printer).get():"")); - DO_PR_DEBUG_LOG(("papername '%s'\n", papername? NS_ConvertUCS2toUTF8(papername).get():"")); + DO_PR_DEBUG_LOG(("margins: %5.2f,%5.2f,%5.2f,%5.2f\n", dtop, dleft, dbottom, dright)); + DO_PR_DEBUG_LOG(("printRange %d\n", printRange)); + DO_PR_DEBUG_LOG(("fromPage %d\n", fromPage)); + DO_PR_DEBUG_LOG(("toPage %d\n", toPage)); + DO_PR_DEBUG_LOG(("tofile %d\n", tofile)); + DO_PR_DEBUG_LOG(("printfile '%s'\n", printfile? NS_ConvertUCS2toUTF8(printfile).get():"")); + DO_PR_DEBUG_LOG(("command '%s'\n", command? NS_ConvertUCS2toUTF8(command).get():"")); + DO_PR_DEBUG_LOG(("printer '%s'\n", printer? NS_ConvertUCS2toUTF8(printer).get():"")); + DO_PR_DEBUG_LOG(("papername '%s'\n", papername? NS_ConvertUCS2toUTF8(papername).get():"")); - mTop = dtop; - mBottom = dbottom; - mLeft = dleft; - mRight = dright; - mFpf = !reversed; - mGrayscale = !color; - mOrientation = orientation; - mToPrinter = !tofile; - mCopies = copies; - } + mTop = dtop; + mBottom = dbottom; + mLeft = dleft; + mRight = dright; + mFpf = !reversed; + mGrayscale = !color; + mOrientation = orientation; + mToPrinter = !tofile; + mCopies = copies; } return rv; @@ -993,19 +914,7 @@ NS_IMETHODIMP nsPrinterEnumeratorGTK::InitPrintSettingsFromPrinter(const PRUnich NS_IMETHODIMP nsPrinterEnumeratorGTK::DisplayPropertiesDlg(const PRUnichar *aPrinter, nsIPrintSettings *aPrintSettings) { - /* fixme: We simply ignore the |aPrinter| argument here - * We should get the supported printer attributes from the printer and - * populate the print job options dialog with these data instead of using - * the "default set" here. - * However, this requires changes on all platforms and is another big chunk - * of patches ... ;-( - */ - - PRBool pressedOK; - return DisplayXPDialog(aPrintSettings, - "chrome://global/content/printjoboptions.xul", - pressedOK); - + return NS_OK; } //---------------------------------------------------------------------- diff --git a/gfx/src/gtk/nsDeviceContextSpecG.h b/gfx/src/gtk/nsDeviceContextSpecG.h index 8044d537cea..03f13dd47d8 100644 --- a/gfx/src/gtk/nsDeviceContextSpecG.h +++ b/gfx/src/gtk/nsDeviceContextSpecG.h @@ -74,7 +74,7 @@ public: NS_DECL_ISUPPORTS - NS_IMETHOD Init(nsIPrintSettings* aPS, PRBool aQuiet); + NS_IMETHOD Init(nsIPrintSettings* aPS); NS_IMETHOD ClosePrintManager(); NS_IMETHOD GetToPrinter(PRBool &aToPrinter); diff --git a/gfx/src/mac/Makefile.in b/gfx/src/mac/Makefile.in index 5dc6a3b223f..c26bdf30235 100644 --- a/gfx/src/mac/Makefile.in +++ b/gfx/src/mac/Makefile.in @@ -35,7 +35,6 @@ REQUIRES = xpcom \ widget \ view \ util \ - dom \ pref \ js \ uconv \ @@ -43,7 +42,6 @@ REQUIRES = xpcom \ unicharutil \ gfx2 \ mozcomps \ - windowwatcher \ content \ layout \ locale \ @@ -68,6 +66,7 @@ CPPSRCS = \ nsScreenMac.cpp \ nsScreenManagerMac.cpp \ nsPrintOptionsX.cpp \ + nsPrintSettingsX.cpp \ nsFontUtils.cpp \ nsNativeThemeMac.cpp \ $(NULL) diff --git a/gfx/src/mac/nsDeviceContextMac.cpp b/gfx/src/mac/nsDeviceContextMac.cpp index a66b16de254..5f5d5baacb4 100644 --- a/gfx/src/mac/nsDeviceContextMac.cpp +++ b/gfx/src/mac/nsDeviceContextMac.cpp @@ -707,7 +707,10 @@ NS_IMETHODIMP nsDeviceContextMac::GetDeviceContextFor(nsIDeviceContextSpec *aDev * See documentation in nsIDeviceContext.h * @update 12/9/98 dwc */ -NS_IMETHODIMP nsDeviceContextMac::BeginDocument(PRUnichar * aTitle) +NS_IMETHODIMP nsDeviceContextMac::BeginDocument(PRUnichar * aTitle, + PRUnichar* aPrintToFileName, + PRInt32 aStartPage, + PRInt32 aEndPage) { #if !TARGET_CARBON GrafPtr thePort; @@ -724,7 +727,7 @@ GrafPtr thePort; nsresult rv = NS_ERROR_FAILURE; nsCOMPtr printingContext = do_QueryInterface(mSpec); if (printingContext) - rv = printingContext->BeginDocument(); + rv = printingContext->BeginDocument(aStartPage, aEndPage); return rv; #endif } diff --git a/gfx/src/mac/nsDeviceContextMac.h b/gfx/src/mac/nsDeviceContextMac.h index 956295bad29..d17383df5c0 100644 --- a/gfx/src/mac/nsDeviceContextMac.h +++ b/gfx/src/mac/nsDeviceContextMac.h @@ -79,7 +79,10 @@ public: NS_IMETHOD GetDeviceContextFor(nsIDeviceContextSpec *aDevice, nsIDeviceContext *&aContext); - NS_IMETHOD BeginDocument(PRUnichar * aTitle); + NS_IMETHOD BeginDocument(PRUnichar * aTitle, + PRUnichar* aPrintToFileName, + PRInt32 aStartPage, + PRInt32 aEndPage); NS_IMETHOD EndDocument(void); NS_IMETHOD AbortDocument(void); diff --git a/gfx/src/mac/nsDeviceContextSpecFactoryM.cpp b/gfx/src/mac/nsDeviceContextSpecFactoryM.cpp index f7ad26dec43..3b7c464a743 100644 --- a/gfx/src/mac/nsDeviceContextSpecFactoryM.cpp +++ b/gfx/src/mac/nsDeviceContextSpecFactoryM.cpp @@ -82,7 +82,7 @@ NS_IMETHODIMP nsDeviceContextSpecFactoryMac :: Init(void) NS_IMETHODIMP nsDeviceContextSpecFactoryMac :: CreateDeviceContextSpec(nsIWidget *aWidget, nsIPrintSettings* aPrintSettings, nsIDeviceContextSpec *&aNewSpec, - PRBool aQuiet) + PRBool aIsPrintPreview) { nsresult rv; @@ -91,7 +91,7 @@ NS_IMETHODIMP nsDeviceContextSpecFactoryMac :: CreateDeviceContextSpec(nsIWidget if (NS_SUCCEEDED(rv)) { nsCOMPtr printingContext = do_QueryInterface(devSpec,&rv); if (NS_SUCCEEDED(rv)) { - rv = printingContext->Init(aPrintSettings,aQuiet); + rv = printingContext->Init(aPrintSettings,aIsPrintPreview); if (NS_SUCCEEDED(rv)) { aNewSpec = devSpec; NS_ADDREF(aNewSpec); diff --git a/gfx/src/mac/nsDeviceContextSpecFactoryM.h b/gfx/src/mac/nsDeviceContextSpecFactoryM.h index dc4049c723a..d6fd690d2b6 100644 --- a/gfx/src/mac/nsDeviceContextSpecFactoryM.h +++ b/gfx/src/mac/nsDeviceContextSpecFactoryM.h @@ -53,7 +53,7 @@ public: NS_IMETHOD CreateDeviceContextSpec(nsIWidget *aWidget, nsIPrintSettings* aPrintSettings, nsIDeviceContextSpec *&aNewSpec, - PRBool aQuiet); + PRBool aIsPrintPreview); protected: ~nsDeviceContextSpecFactoryMac(); diff --git a/gfx/src/mac/nsDeviceContextSpecMac.cpp b/gfx/src/mac/nsDeviceContextSpecMac.cpp index 6c053458179..13605e79587 100644 --- a/gfx/src/mac/nsDeviceContextSpecMac.cpp +++ b/gfx/src/mac/nsDeviceContextSpecMac.cpp @@ -37,59 +37,10 @@ * ***** END LICENSE BLOCK ***** */ #include "nsDeviceContextSpecMac.h" -#include "prmem.h" -#include "plstr.h" -#include "nsWatchTask.h" #include "nsIServiceManager.h" #include "nsIPrintOptions.h" -#include "nsGfxCIID.h" +#include "nsIPrintSettingsMac.h" -#include "nsGfxUtils.h" - -#if !TARGET_CARBON -#include "nsMacResources.h" -#include -#include -#endif - -#if !TARGET_CARBON - -enum { - ePrintSelectionCheckboxID = 1, - ePrintFrameAsIsCheckboxID, - ePrintSelectedFrameCheckboxID, - ePrintAllFramesCheckboxID, - eDrawFrameID -}; - - - -// items to support the additional items for the dialog -#define DITL_ADDITIONS 128 - -static pascal TPPrDlg MyJobDlgInit(THPrint); // Our extention to PrJobInit -static TPPrDlg gPrtJobDialog; // pointer to job dialog -static long prFirstItem; // our first item in the extended dialog -static PItemUPP prPItemProc; // store the old item handler here -static PRBool gPrintSelection; -static PItemUPP gPrtJobDialogItemProc; -static UserItemUPP gDrawListUPP = nsnull; -static nsIPrintSettings *gPrintSettings=nsnull; - - -typedef struct dialog_item_struct { - Handle handle; // handle or procedure pointer for this item */ - Rect bounds; // display rectangle for this item */ - char type; // item type - 1 */ - char data[1]; // length byte of data */ -} DialogItem, *DialogItemPtr, **DialogItemHandle; - -typedef struct append_item_list_struct { - short max_index; // number of items - 1 - DialogItem items[1]; // first item in the array -} ItemList, *ItemListPtr, **ItemListHandle; - -#endif /** ------------------------------------------------------- * Construct the nsDeviceContextSpecMac @@ -100,7 +51,6 @@ nsDeviceContextSpecMac::nsDeviceContextSpecMac() , mPrintManagerOpen(PR_FALSE) { NS_INIT_REFCNT(); - gPrintSettings = nsnull; } /** ------------------------------------------------------- @@ -115,321 +65,36 @@ nsDeviceContextSpecMac::~nsDeviceContextSpecMac() ::DisposeHandle((Handle)mPrtRec); mPrtRec = nsnull; } - } NS_IMPL_ISUPPORTS2(nsDeviceContextSpecMac, nsIDeviceContextSpec, nsIPrintingContext) -#if !TARGET_CARBON - -/** ------------------------------------------------------- - * this is a drawing procedure for the user item.. this draws a box around the frameset radio buttons - * @update dc 12/02/98 - */ -static pascal void MyBBoxDraw(WindowPtr theWindow, short aItemNo) -{ - short itemType; - Rect itemBox; - Handle itemH; - - ::GetDialogItem((DialogPtr)gPrtJobDialog, prFirstItem + eDrawFrameID-1, &itemType, &itemH, &itemBox); - - // use appearance if possible - if ((long)DrawThemeSecondaryGroup != kUnresolvedCFragSymbolAddress) - ::DrawThemeSecondaryGroup(&itemBox, kThemeStateActive); - else - ::FrameRect(&itemBox); -} - - -/** ------------------------------------------------------- - * this is the dialog hook, takes care of setting the dialog items - * @update dc 12/02/98 - */ -static pascal void MyJobItems(DialogPtr aDialog, short aItemNo) -{ -short myItem, firstItem, i, itemType; -short value; -Rect itemBox; -Handle itemH; - - firstItem = prFirstItem; - - myItem = aItemNo-firstItem+1; - if (myItem>0) { - switch (myItem) { - case ePrintSelectionCheckboxID: - ::GetDialogItem(aDialog, firstItem, &itemType, &itemH, &itemBox); - gPrintSelection = !gPrintSelection; - ::SetControlValue((ControlHandle)itemH, gPrintSelection); - break; - - case ePrintFrameAsIsCheckboxID: - case ePrintSelectedFrameCheckboxID: - case ePrintAllFramesCheckboxID: - for (i=ePrintFrameAsIsCheckboxID; i<=ePrintAllFramesCheckboxID; i++){ - ::GetDialogItem(aDialog, firstItem+i-1, &itemType, &itemH, &itemBox); - ::SetControlValue((ControlHandle)itemH, i==myItem); - } - break; - - default: - break; - } - } else { - // chain to standard Item handler - CallPItemProc(prPItemProc, aDialog, aItemNo); - - if (((TPPrDlg)aDialog)->fDone) - { - //nsCOMPtr printOptionsService = do_GetService("@mozilla.org/gfx/printoptions;1"); - // cleanup and set the print options to what we want - if (gPrintSettings) - { - // print selection - ::GetDialogItem(aDialog, firstItem+ePrintSelectionCheckboxID-1, &itemType, &itemH, &itemBox); - value = ::GetControlValue((ControlHandle)itemH); - if (1==value){ - gPrintSettings->SetPrintRange(nsIPrintSettings::kRangeSelection); - } else { - gPrintSettings->SetPrintRange(nsIPrintSettings::kRangeAllPages); - } - - // print frames as is - ::GetDialogItem(aDialog, firstItem+ePrintFrameAsIsCheckboxID-1, &itemType, &itemH, &itemBox); - value = ::GetControlValue((ControlHandle)itemH); - if (1==value){ - gPrintSettings->SetPrintFrameType(nsIPrintSettings::kFramesAsIs); - } - - // selected frame - ::GetDialogItem(aDialog, firstItem+ePrintSelectedFrameCheckboxID-1, &itemType, &itemH, &itemBox); - value = ::GetControlValue((ControlHandle)itemH); - if (1==value){ - gPrintSettings->SetPrintFrameType(nsIPrintSettings::kSelectedFrame); - } - - // print all frames - ::GetDialogItem(aDialog, firstItem+ePrintAllFramesCheckboxID-1, &itemType, &itemH, &itemBox); - value = ::GetControlValue((ControlHandle)itemH); - if (1==value){ - gPrintSettings->SetPrintFrameType(nsIPrintSettings::kEachFrameSep); - } - } - } - } -} - -/** ------------------------------------------------------- - * Append DITL items to the dialog - * @update dc 05/04/2001 - */ -static PRInt32 AppendToDialog(TPPrDlg aDialog, PRInt32 aDITLID) -{ -nsresult theResult = NS_ERROR_FAILURE; -short firstItem; -ItemListHandle myAppendDITLH; -ItemListHandle dlg_Item_List; - - dlg_Item_List = (ItemListHandle)((DialogPeek)aDialog)->items; - firstItem = (**dlg_Item_List).max_index+2; - - theResult = nsMacResources::OpenLocalResourceFile(); - if (theResult == NS_OK) { - myAppendDITLH = (ItemListHandle)::GetResource('DITL', aDITLID); - if (nsnull == myAppendDITLH) { - // some sort of error - theResult = NS_ERROR_FAILURE; - } else { - ::AppendDITL((DialogPtr)aDialog, (Handle)myAppendDITLH, appendDITLBottom); - ::ReleaseResource((Handle) myAppendDITLH); - } - theResult = nsMacResources::CloseLocalResourceFile(); - } - - return firstItem; -} - - -/** ------------------------------------------------------- - * Initialize the print dialogs additional items - * @update dc 05/04/2001 - */ -static pascal TPPrDlg MyJobDlgInit(THPrint aHPrint) -{ - PRInt32 i; - short itemType; - Handle itemH; - Rect itemBox; - PRBool isOn; - PRInt16 howToEnableFrameUI = nsIPrintSettings::kFrameEnableNone; - - prFirstItem = AppendToDialog(gPrtJobDialog, DITL_ADDITIONS); - - //nsCOMPtr printOptionsService = do_GetService("@mozilla.org/gfx/printoptions;1"); - - if (gPrintSettings) { - gPrintSettings->GetPrintOptions(nsIPrintSettings::kEnableSelectionRB, &isOn); - gPrintSettings->GetHowToEnableFrameUI(&howToEnableFrameUI); - } - - ::GetDialogItem((DialogPtr) gPrtJobDialog, prFirstItem+ePrintSelectionCheckboxID-1, &itemType, &itemH, &itemBox); - if ( isOn ) { - ::HiliteControl((ControlHandle)itemH, 0); - } else { - ::HiliteControl((ControlHandle)itemH, 255); - } - - gPrintSelection = PR_FALSE; - ::SetControlValue((ControlHandle) itemH, gPrintSelection); - - if (howToEnableFrameUI == nsIPrintSettings::kFrameEnableAll) { - for (i = ePrintFrameAsIsCheckboxID; i <= ePrintAllFramesCheckboxID; i++){ - ::GetDialogItem((DialogPtr) gPrtJobDialog, prFirstItem+i-1, &itemType, &itemH, &itemBox); - ::SetControlValue((ControlHandle) itemH, (i==4)); - ::HiliteControl((ControlHandle)itemH, 0); - } - } - else if (howToEnableFrameUI == nsIPrintSettings::kFrameEnableAsIsAndEach) { - for (i = ePrintFrameAsIsCheckboxID; i <= ePrintAllFramesCheckboxID; i++){ - ::GetDialogItem((DialogPtr) gPrtJobDialog, prFirstItem+i-1, &itemType, &itemH, &itemBox); - ::SetControlValue((ControlHandle) itemH, (i==4)); - if ( i == 3){ - ::HiliteControl((ControlHandle)itemH, 255); - } - } - } - else { - for (i = ePrintFrameAsIsCheckboxID; i <= ePrintAllFramesCheckboxID; i++){ - ::GetDialogItem((DialogPtr) gPrtJobDialog, prFirstItem+i-1, &itemType, &itemH, &itemBox); - ::SetControlValue((ControlHandle) itemH, FALSE); - ::HiliteControl((ControlHandle)itemH, 255); - } - } - - // attach our handler - prPItemProc = gPrtJobDialog->pItemProc; - gPrtJobDialog->pItemProc = gPrtJobDialogItemProc = NewPItemUPP(MyJobItems); - - - // attach a draw routine - gDrawListUPP = NewUserItemProc(MyBBoxDraw); - ::GetDialogItem((DialogPtr)gPrtJobDialog, prFirstItem+eDrawFrameID-1, &itemType, &itemH, &itemBox); - ::SetDialogItem((DialogPtr)gPrtJobDialog, prFirstItem+eDrawFrameID-1, itemType, (Handle)gDrawListUPP, &itemBox); - - return gPrtJobDialog; -} - -#endif - - /** ------------------------------------------------------- * Initialize the nsDeviceContextSpecMac * @update dc 05/04/2001 */ -NS_IMETHODIMP nsDeviceContextSpecMac::Init(nsIPrintSettings* aPS, PRBool aQuiet) +NS_IMETHODIMP nsDeviceContextSpecMac::Init(nsIPrintSettings* aPS, PRBool aIsPrintPreview) { - gPrintSettings = aPS; - -#if !TARGET_CARBON - - if (aQuiet) - { - // If aQuiet is true, then we're being called through - // the print preview path, so don't put up the print dialog. - return NS_ERROR_ABORT; + nsCOMPtr printSettingsMac(do_QueryInterface(aPS)); + if (!printSettingsMac) + return NS_ERROR_NO_INTERFACE; + + // open the printing manager if not print preview + if (!aIsPrintPreview) { + ::PrOpen(); + if (::PrError() != noErr) + return NS_ERROR_FAILURE; + mPrintManagerOpen = PR_TRUE; } - THPrint hPrintRec; // handle to print record - GrafPtr oldport; - PDlgInitUPP theInitProcPtr; - - ::GetPort(&oldport); - - nsresult rv; - nsCOMPtr printOptionsService = do_GetService("@mozilla.org/gfx/printoptions;1", &rv); - if (NS_FAILED(rv)) return rv; - - // open the printing manager - ::PrOpen(); - if (::PrError() != noErr) - return NS_ERROR_FAILURE; - - mPrintManagerOpen = PR_TRUE; - - // Allocate a print record - hPrintRec = (THPrint)::NewHandleClear(sizeof(TPrint)); - if (!hPrintRec) return NS_ERROR_OUT_OF_MEMORY; - - StHandleOwner printRecOwner((Handle)hPrintRec); - - // see if we have a print record - void* printRecordData = nsnull; - rv = printOptionsService->GetNativeData(nsIPrintOptions::kNativeDataPrintRecord, &printRecordData); - if (NS_SUCCEEDED(rv) && printRecordData) - { - ::BlockMoveData(printRecordData, *hPrintRec, sizeof(TPrint)); - } - else - { - // fill in default values - ::PrintDefault(hPrintRec); - } - - if (printRecordData) - { - nsMemory::Free(printRecordData); - printRecordData = nsnull; - } - + nsresult rv = printSettingsMac->GetTHPrint(&mPrtRec); + // make sure the print record is valid - ::PrValidate(hPrintRec); + ::PrValidate(mPrtRec); if (::PrError() != noErr) return NS_ERROR_FAILURE; - - // get pointer to invisible job dialog box - gPrtJobDialog = ::PrJobInit(hPrintRec); - if (::PrError() != noErr) - return NS_ERROR_FAILURE; - // create a UUP for the dialog init procedure - theInitProcPtr = NewPDlgInitProc(MyJobDlgInit); - if (!theInitProcPtr) - return NS_ERROR_FAILURE; - - // standard print dialog, if true print - nsWatchTask::GetTask().Suspend(); - ::InitCursor(); - - // put up the print dialog - if (::PrDlgMain(hPrintRec, theInitProcPtr)) - { - // have the print record - rv = NS_OK; - printRecOwner.ClearHandle(false); - mPrtRec = hPrintRec; - } - else - { - // don't print - ::SetPort(oldport); - rv = NS_ERROR_ABORT; - } - - // clean up our dialog routines - DisposePItemUPP(gPrtJobDialogItemProc); - gPrtJobDialogItemProc = nsnull; - - DisposePItemUPP(theInitProcPtr); - DisposePItemUPP(gDrawListUPP); - gDrawListUPP = nsnull; - - nsWatchTask::GetTask().Resume(); - return rv; - -#endif /* TARGET_CARBON */ - - return NS_ERROR_FAILURE; + return NS_OK; } /** ------------------------------------------------------- @@ -438,18 +103,14 @@ NS_IMETHODIMP nsDeviceContextSpecMac::Init(nsIPrintSettings* aPS, PRBool aQuiet) */ NS_IMETHODIMP nsDeviceContextSpecMac::ClosePrintManager() { - PRBool isPMOpen; - PrintManagerOpen(&isPMOpen); - if (isPMOpen) { -#if !TARGET_CARBON + if (mPrintManagerOpen) ::PrClose(); -#endif - } return NS_OK; } -NS_IMETHODIMP nsDeviceContextSpecMac::BeginDocument() +NS_IMETHODIMP nsDeviceContextSpecMac::BeginDocument(PRInt32 aStartPage, + PRInt32 aEndPage) { nsresult rv = NS_OK; return rv; diff --git a/gfx/src/mac/nsDeviceContextSpecMac.h b/gfx/src/mac/nsDeviceContextSpecMac.h index 27a194cf024..5dfc4c28978 100644 --- a/gfx/src/mac/nsDeviceContextSpecMac.h +++ b/gfx/src/mac/nsDeviceContextSpecMac.h @@ -58,14 +58,10 @@ public: /** * Initialize the nsDeviceContextSpecMac for use. This will allocate a printrecord for use * @update dc 12/02/98 - * @param aQuiet if PR_TRUE, prevent the need for user intervention - * in obtaining device context spec. if nsnull is passed in for - * the aOldSpec, this will typically result in getting a device - * context spec for the default output device (i.e. default - * printer). + * @param aIsPrintPreview TRUE if doing print preview, FALSE if normal printing. * @return error status */ - NS_IMETHOD Init(nsIPrintSettings* aPS, PRBool aQuiet); + NS_IMETHOD Init(nsIPrintSettings* aPS, PRBool aIsPrintPreview); /** @@ -83,7 +79,8 @@ public: */ NS_IMETHOD ClosePrintManager(); - NS_IMETHOD BeginDocument(); + NS_IMETHOD BeginDocument(PRInt32 aStartPage, + PRInt32 aEndPage); NS_IMETHOD EndDocument(); diff --git a/gfx/src/mac/nsDeviceContextSpecX.cpp b/gfx/src/mac/nsDeviceContextSpecX.cpp index 8ed4b04f1b1..92afcb0239e 100644 --- a/gfx/src/mac/nsDeviceContextSpecX.cpp +++ b/gfx/src/mac/nsDeviceContextSpecX.cpp @@ -22,6 +22,7 @@ * Contributor(s): * Patrick C. Beard * Simon Fraser + * Conrad Carlen * * * Alternatively, the contents of this file may be used under the terms of @@ -46,18 +47,7 @@ #include "nsIServiceManager.h" #include "nsIPrintOptions.h" - - -#include "CoreServices.h" -#include "nsFileSpec.h" -#include "nsPDECommon.h" -#include "nsAppDirectoryServiceDefs.h" -#include "nsDirectoryServiceDefs.h" -#include "nsDirectoryService.h" - -static Boolean LoadPrinterPlugin(); - -static Boolean gPlugInNotLoaded = true; +#include "nsIPrintSettingsX.h" /** ------------------------------------------------------- * Construct the nsDeviceContextSpecX @@ -88,130 +78,29 @@ NS_IMPL_ISUPPORTS2(nsDeviceContextSpecX, nsIDeviceContextSpec, nsIPrintingContex * Initialize the nsDeviceContextSpecMac * @update dc 12/02/98 */ -NS_IMETHODIMP nsDeviceContextSpecX::Init(nsIPrintSettings* aPS, PRBool aQuiet) +NS_IMETHODIMP nsDeviceContextSpecX::Init(nsIPrintSettings* aPS, PRBool aIsPrintPreview) { nsresult rv; OSStatus status; - - nsCOMPtr printOptionsService = do_GetService("@mozilla.org/gfx/printoptions;1", &rv); - if (NS_FAILED(rv)) return rv; - - // are we doing a printpreview.. then don't start setting up for the printing - PRBool doingPrintPreview; - - aPS->GetIsPrintPreview(&doingPrintPreview); - - // Because page setup can get called at any time, we can't use the session APIs here. - if(!doingPrintPreview) { - status = ::PMBegin(); - if (status != noErr) return NS_ERROR_FAILURE; - } - - mBeganPrinting = PR_TRUE; - PMPageFormat optionsPageFormat = kPMNoPageFormat; - rv = printOptionsService->GetNativeData(nsIPrintOptions::kNativeDataPrintRecord, (void **)&optionsPageFormat); - if (NS_FAILED(rv)) return rv; - - status = ::PMNewPageFormat(&mPageFormat); - if (status != noErr) return NS_ERROR_FAILURE; - - if (optionsPageFormat != kPMNoPageFormat) - { - status = ::PMCopyPageFormat(optionsPageFormat, mPageFormat); - ::PMDisposePageFormat(optionsPageFormat); - } - else - status = ::PMDefaultPageFormat(mPageFormat); - - if (status != noErr) return NS_ERROR_FAILURE; - - Boolean validated; - ::PMValidatePageFormat(mPageFormat, &validated); - - status = ::PMNewPrintSettings(&mPrintSettings); - if (status != noErr) return NS_ERROR_FAILURE; - - status = ::PMDefaultPrintSettings(mPrintSettings); - if (status != noErr) return NS_ERROR_FAILURE; - - if (! aQuiet) { - Boolean plugInExtended,accepted=false; - PRBool isOn; - PRInt16 howToEnableFrameUI = nsIPrintSettings::kFrameEnableNone; - nsPrintExtensions printData = {false,false,false,false,false,false,false,false}; - - ::InitCursor(); - - // set the values for the plugin here - aPS->GetPrintOptions(nsIPrintSettings::kEnableSelectionRB, &isOn); - printData.mHaveSelection = (Boolean) isOn; - - aPS->GetHowToEnableFrameUI(&howToEnableFrameUI); - if (howToEnableFrameUI == nsIPrintSettings::kFrameEnableAll) { - printData.mHaveFrames = true; - printData.mHaveFrameSelected = true; - } - - if (howToEnableFrameUI == nsIPrintSettings::kFrameEnableAsIsAndEach) { - printData.mHaveFrames = true; - printData.mHaveFrameSelected = false; - } - - aPS->GetShrinkToFit(&isOn); - printData.mShrinkToFit = isOn; - - if( gPlugInNotLoaded ) { - plugInExtended = LoadPrinterPlugin(); - } - - status = PMSetPrintSettingsExtendedData(mPrintSettings,kPDE_Creator,sizeof(printData),&printData); - - status = ::PMPrintDialog(mPrintSettings, mPageFormat, &accepted); - - if (! accepted) - return NS_ERROR_ABORT; - + if (!aIsPrintPreview) { + status = ::PMBegin(); if (status != noErr) return NS_ERROR_FAILURE; - - - // get the data from the plugin - if(status == noErr){ - UInt32 bytesNeeded; - - status = PMGetPrintSettingsExtendedData(mPrintSettings, kPDE_Creator, &bytesNeeded, NULL); - - if(status == noErr && bytesNeeded == sizeof(printData) ){ - status = PMGetPrintSettingsExtendedData(mPrintSettings, kPDE_Creator,&bytesNeeded, &printData); - - // set the correct data fields - if( printData.mPrintSelection){ - aPS->SetPrintRange(nsIPrintSettings::kRangeSelection); - } else { - aPS->SetPrintRange(nsIPrintSettings::kRangeAllPages); - } - - if(printData.mPrintFrameAsIs){ - aPS->SetPrintFrameType(nsIPrintSettings::kFramesAsIs); - } - - if(printData.mPrintSelectedFrame){ - aPS->SetPrintFrameType(nsIPrintSettings::kSelectedFrame); - } - - if(printData.mPrintFramesSeperatly){ - aPS->SetPrintFrameType(nsIPrintSettings::kEachFrameSep); - } - - if(printData.mShrinkToFit){ - aPS->SetShrinkToFit(PR_TRUE); - } else { - aPS->SetShrinkToFit(PR_FALSE); - } - } - } + mBeganPrinting = PR_TRUE; } + + nsCOMPtr printSettingsX(do_QueryInterface(aPS)); + if (!printSettingsX) + return NS_ERROR_NO_INTERFACE; + + rv = printSettingsX->GetPMPageFormat(&mPageFormat); + if (NS_FAILED(rv)) + return rv; + rv = printSettingsX->GetPMPrintSettings(&mPrintSettings); + if (NS_FAILED(rv)) + return rv; + return NS_OK; } @@ -239,9 +128,17 @@ NS_IMETHODIMP nsDeviceContextSpecX::ClosePrintManager() return NS_OK; } -NS_IMETHODIMP nsDeviceContextSpecX::BeginDocument() +NS_IMETHODIMP nsDeviceContextSpecX::BeginDocument(PRInt32 aStartPage, + PRInt32 aEndPage) { - OSStatus status = ::PMBeginDocument(mPrintSettings, mPageFormat, &mPrintingContext); + OSStatus status; + + status = ::PMSetFirstPage(mPrintSettings, aStartPage, false); + NS_ASSERTION(status == noErr, "PMSetFirstPage failed"); + status = ::PMSetLastPage(mPrintSettings, aEndPage, false); + NS_ASSERTION(status == noErr, "PMSetLastPage failed"); + + status = ::PMBeginDocument(mPrintSettings, mPageFormat, &mPrintingContext); if (status != noErr) return NS_ERROR_ABORT; return NS_OK; @@ -303,6 +200,8 @@ NS_IMETHODIMP nsDeviceContextSpecX::GetPageRect(double* aTop, double* aLeft, dou *aBottom = pageRect.bottom, *aRight = pageRect.right; return NS_OK; } +<<<<<<< nsDeviceContextSpecX.cpp +======= @@ -355,3 +254,4 @@ FSSpec spec; return result; } +>>>>>>> 1.19 diff --git a/gfx/src/mac/nsDeviceContextSpecX.h b/gfx/src/mac/nsDeviceContextSpecX.h index 762596b22b2..3d63bcfff22 100644 --- a/gfx/src/mac/nsDeviceContextSpecX.h +++ b/gfx/src/mac/nsDeviceContextSpecX.h @@ -60,14 +60,10 @@ public: /** * Initialize the nsDeviceContextSpecMac for use. This will allocate a printrecord for use * @update dc 12/02/98 - * @param aQuiet if PR_TRUE, prevent the need for user intervention - * in obtaining device context spec. if nsnull is passed in for - * the aOldSpec, this will typically result in getting a device - * context spec for the default output device (i.e. default - * printer). + * @param aIsPrintPreview TRUE if doing print preview, FALSE if normal printing. * @return error status */ - NS_IMETHOD Init(nsIPrintSettings* aPS, PRBool aQuiet); + NS_IMETHOD Init(nsIPrintSettings* aPS, PRBool aIsPrintPreview); /** * This will tell if the printmanager is currently open @@ -84,7 +80,8 @@ public: */ NS_IMETHOD ClosePrintManager(); - NS_IMETHOD BeginDocument(); + NS_IMETHOD BeginDocument(PRInt32 aStartPage, + PRInt32 aEndPage); NS_IMETHOD EndDocument(); diff --git a/gfx/src/mac/nsPrintOptionsMac.cpp b/gfx/src/mac/nsPrintOptionsMac.cpp index 617f9bbe2d3..cfc07e5cc16 100644 --- a/gfx/src/mac/nsPrintOptionsMac.cpp +++ b/gfx/src/mac/nsPrintOptionsMac.cpp @@ -36,42 +36,17 @@ * * ***** END LICENSE BLOCK ***** */ -#include "nsCOMPtr.h" -#include "nsIPref.h" -#include "nsIServiceManager.h" - -#include "nsWatchTask.h" #include "nsPrintOptionsMac.h" -#include "nsGfxUtils.h" - -#include "plbase64.h" -#include "prmem.h" +#include "nsPrintSettingsMac.h" #define MAC_OS_PAGE_SETUP_PREFNAME "print.macos.pagesetup" /** --------------------------------------------------- - * See documentation in nsPrintOptionsWin.h + * See documentation in nsPrintOptionsMac.h * @update 6/21/00 dwc */ nsPrintOptionsMac::nsPrintOptionsMac() { - // create the print style and print record - mPrintRecord = (THPrint)::NewHandleClear(sizeof(TPrint)); - if (mPrintRecord) - { - nsresult rv = ReadPageSetupFromPrefs(); - ::PrOpen(); - if (::PrError() == noErr) - { - if (NS_FAILED(rv)) - ::PrintDefault(mPrintRecord); - else - ::PrValidate(mPrintRecord); - - ::PrClose(); - } - } - } /** --------------------------------------------------- @@ -80,10 +55,23 @@ nsPrintOptionsMac::nsPrintOptionsMac() */ nsPrintOptionsMac::~nsPrintOptionsMac() { - // get rid of the print record - if (mPrintRecord) { - ::DisposeHandle((Handle)mPrintRecord); - } +} + +/** --------------------------------------------------- + * See documentation in nsPrintOptionsImpl.h + */ +/* nsIPrintSettings CreatePrintSettings (); */ +NS_IMETHODIMP nsPrintOptionsMac::CreatePrintSettings(nsIPrintSettings **_retval) +{ + nsresult rv; + nsPrintSettingsMac* printSettings = new nsPrintSettingsMac(); // does not initially ref count + if (!printSettings) + return NS_ERROR_OUT_OF_MEMORY; + rv = printSettings->Init(); + if (NS_FAILED(rv)) + return rv; + + return printSettings->QueryInterface(NS_GET_IID(nsIPrintSettings), (void**)_retval); // ref counts } /** --------------------------------------------------- @@ -93,121 +81,51 @@ nsPrintOptionsMac::~nsPrintOptionsMac() NS_IMETHODIMP nsPrintOptionsMac::ShowPrintSetupDialog(nsIPrintSettings *aThePrintSettings) { - - if (!mPrintRecord) return NS_ERROR_NOT_INITIALIZED; - - // it doesn't really matter if this fails - nsresult rv = ReadPageSetupFromPrefs(); - NS_ASSERTION(NS_SUCCEEDED(rv), "Failed to write page setup to prefs"); - - // open the printing manager - ::PrOpen(); - if(::PrError() != noErr) - return NS_ERROR_FAILURE; - - ::PrValidate(mPrintRecord); - NS_ASSERTION(::PrError() == noErr, "Printing error"); - - nsWatchTask::GetTask().Suspend(); - ::InitCursor(); - Boolean dialogOK = ::PrStlDialog(mPrintRecord); // open up and process the style record - nsWatchTask::GetTask().Resume(); - - OSErr err = ::PrError(); - - ::PrClose(); - - // it doesn't really matter if this fails - rv = WritePageSetupToPrefs(); - NS_ASSERTION(NS_SUCCEEDED(rv), "Failed to save page setup to prefs"); - - if (err != noErr) - return NS_ERROR_FAILURE; - - return NS_OK; + return NS_ERROR_NOT_IMPLEMENTED; } /* [noscript] voidPtr GetNativeData (in short aDataType); */ NS_IMETHODIMP nsPrintOptionsMac::GetNativeData(PRInt16 aDataType, void * *_retval) { - nsresult rv = NS_OK; - NS_ENSURE_ARG_POINTER(_retval); *_retval = nsnull; - switch (aDataType) - { - case kNativeDataPrintRecord: - if (mPrintRecord) - { - void* printRecord = nsMemory::Alloc(sizeof(TPrint)); - if (!printRecord) { - rv = NS_ERROR_OUT_OF_MEMORY; - break; - } - - ::BlockMoveData(*mPrintRecord, printRecord, sizeof(TPrint)); - *_retval = printRecord; - } - break; - - default: - rv = NS_ERROR_FAILURE; - break; - } - - return rv; + return NS_ERROR_NOT_IMPLEMENTED; } #pragma mark - nsresult -nsPrintOptionsMac::ReadPageSetupFromPrefs() +nsPrintOptionsMac::ReadPrefs(nsIPrintSettings* aPS, const nsString& aPrefName, PRUint32 aFlags) { nsresult rv; - nsCOMPtr prefs = do_GetService(NS_PREF_CONTRACTID, &rv); - if (NS_FAILED(rv)) - return rv; - - nsXPIDLCString encodedData; - rv = prefs->GetCharPref(MAC_OS_PAGE_SETUP_PREFNAME, getter_Copies(encodedData)); - if (NS_FAILED(rv)) - return rv; - - // decode the base64 - PRInt32 encodedDataLen = nsCRT::strlen(encodedData.get()); - char* decodedData = ::PL_Base64Decode(encodedData.get(), encodedDataLen, nsnull); - if (!decodedData) - return NS_ERROR_FAILURE; - - if (((encodedDataLen * 3) / 4) >= sizeof(TPrint)) - ::BlockMoveData(decodedData, *mPrintRecord, sizeof(TPrint)); - else - rv = NS_ERROR_FAILURE; // the data was too small - - PR_Free(decodedData); - return rv; + + rv = nsPrintOptions::ReadPrefs(aPS, aPrefName, aFlags); + NS_ASSERTION(NS_SUCCEEDED(rv), "nsPrintOptions::ReadPrefs() failed"); + + nsCOMPtr printSettingsMac(do_QueryInterface(aPS)); + if (!printSettingsMac) + return NS_ERROR_NO_INTERFACE; + rv = printSettingsMac->ReadPageSetupFromPrefs(); + NS_ASSERTION(NS_SUCCEEDED(rv), "nsIPrintSettingsMac::ReadPageFormatFromPrefs() failed"); + + return NS_OK; } nsresult -nsPrintOptionsMac::WritePageSetupToPrefs() +nsPrintOptionsMac::WritePrefs(nsIPrintSettings* aPS, const nsString& aPrefName, PRUint32 aFlags) { - if (!mPrintRecord) - return NS_ERROR_NOT_INITIALIZED; - nsresult rv; - nsCOMPtr prefs = do_GetService(NS_PREF_CONTRACTID, &rv); - if (NS_FAILED(rv)) - return rv; - - StHandleLocker locker((Handle)mPrintRecord); - - nsXPIDLCString encodedData; - encodedData.Adopt(::PL_Base64Encode((char *)*mPrintRecord, sizeof(TPrint), nsnull)); - if (!encodedData.get()) - return NS_ERROR_OUT_OF_MEMORY; - - return prefs->SetCharPref(MAC_OS_PAGE_SETUP_PREFNAME, encodedData); + + rv = nsPrintOptions::WritePrefs(aPS, aPrefName, aFlags); + NS_ASSERTION(NS_SUCCEEDED(rv), "nsPrintOptions::WritePrefs() failed"); + + nsCOMPtr printSettingsMac(do_QueryInterface(aPS)); + if (!printSettingsMac) + return NS_ERROR_NO_INTERFACE; + rv = printSettingsMac->WritePageSetupToPrefs(); + NS_ASSERTION(NS_SUCCEEDED(rv), "nsIPrintSettingsX::WritePageFormatToPrefs() failed"); + + return NS_OK; } - diff --git a/gfx/src/mac/nsPrintOptionsMac.h b/gfx/src/mac/nsPrintOptionsMac.h index 278db17c529..7b3a4e373f1 100644 --- a/gfx/src/mac/nsPrintOptionsMac.h +++ b/gfx/src/mac/nsPrintOptionsMac.h @@ -39,19 +39,13 @@ public: virtual ~nsPrintOptionsMac(); NS_IMETHOD ShowPrintSetupDialog(nsIPrintSettings *aThePrintSettings); + NS_IMETHOD GetNativeData(PRInt16 aDataType, void * *_retval); + NS_IMETHOD CreatePrintSettings(nsIPrintSettings **_retval); protected: - - nsresult ReadPageSetupFromPrefs(); - nsresult WritePageSetupToPrefs(); - - THPrint GetPrintRecord(void) { return mPrintRecord; } - -protected: - - THPrint mPrintRecord; - + nsresult ReadPrefs(nsIPrintSettings* aPS, const nsString& aPrefName, PRUint32 aFlags); + nsresult WritePrefs(nsIPrintSettings* aPS, const nsString& aPrefName, PRUint32 aFlags); }; #endif /* TARGET_CARBON */ diff --git a/gfx/src/mac/nsPrintOptionsX.cpp b/gfx/src/mac/nsPrintOptionsX.cpp index 098253c5ca9..2dbfd672846 100644 --- a/gfx/src/mac/nsPrintOptionsX.cpp +++ b/gfx/src/mac/nsPrintOptionsX.cpp @@ -43,6 +43,7 @@ #include "nsIServiceManager.h" #include "nsWatchTask.h" #include "nsPrintOptionsX.h" +#include "nsPrintSettingsX.h" #include "nsIPref.h" #include "nsGfxUtils.h" @@ -50,37 +51,32 @@ #include "prmem.h" -#define MAC_OS_X_PAGE_SETUP_PREFNAME "print.macosx.pagesetup" - /** --------------------------------------------------- */ nsPrintOptionsX::nsPrintOptionsX() -: mPageFormat(kPMNoPageFormat) { - OSStatus status = ::PMNewPageFormat(&mPageFormat); - NS_ASSERTION(status == noErr, "Error creating print settings"); - - status = ::PMBegin(); - NS_ASSERTION(status == noErr, "Error from PMBegin()"); - - nsresult rv = ReadPageSetupFromPrefs(); - if (NS_FAILED(rv)) - ::PMDefaultPageFormat(mPageFormat); - else - { - Boolean valid; - ::PMValidatePageFormat(mPageFormat, &valid); - } - - ::PMEnd(); } /** --------------------------------------------------- */ nsPrintOptionsX::~nsPrintOptionsX() { - if (mPageFormat) - ::PMDisposePageFormat(mPageFormat); +} + +/** --------------------------------------------------- + * See documentation in nsPrintOptionsImpl.h + */ +/* nsIPrintSettings CreatePrintSettings (); */ +NS_IMETHODIMP nsPrintOptionsX::CreatePrintSettings(nsIPrintSettings **_retval) +{ + nsresult rv; + nsPrintSettingsX* printSettings = new nsPrintSettingsX; // does not initially ref count + if (!printSettings) + return NS_ERROR_OUT_OF_MEMORY; + rv = printSettings->Init(); + if (NS_FAILED(rv)) + return rv; + return printSettings->QueryInterface(NS_GET_IID(nsIPrintSettings), (void**)_retval); // ref counts } /** --------------------------------------------------- @@ -88,144 +84,51 @@ nsPrintOptionsX::~nsPrintOptionsX() NS_IMETHODIMP nsPrintOptionsX::ShowPrintSetupDialog(nsIPrintSettings *aThePrintSettings) { - - // it doesn't really matter if this fails - nsresult rv = ReadPageSetupFromPrefs(); - NS_ASSERTION(NS_SUCCEEDED(rv), "Failed to write page setup to prefs"); - - NS_ASSERTION(mPageFormat != kPMNoPageFormat, "No page format"); - if (mPageFormat == kPMNoPageFormat) - return NS_ERROR_NOT_INITIALIZED; - - OSStatus status = ::PMBegin(); - if (status != noErr) return NS_ERROR_FAILURE; - - Boolean validated; - ::PMValidatePageFormat(mPageFormat, &validated); - - ::InitCursor(); - - Boolean accepted = false; - status = ::PMPageSetupDialog(mPageFormat, &accepted); - - ::PMEnd(); - - // it doesn't really matter if this fails - rv = WritePageSetupToPrefs(); - NS_ASSERTION(NS_SUCCEEDED(rv), "Failed to save page setup to prefs"); - - if (status != noErr) - return NS_ERROR_FAILURE; - - if (!accepted) - return NS_ERROR_ABORT; - - return NS_OK; + return NS_ERROR_NOT_IMPLEMENTED; } /* [noscript] voidPtr GetNativeData (in short aDataType); */ NS_IMETHODIMP nsPrintOptionsX::GetNativeData(PRInt16 aDataType, void * *_retval) { - nsresult rv = NS_OK; - NS_ENSURE_ARG_POINTER(_retval); *_retval = nsnull; - - switch (aDataType) - { - case kNativeDataPrintRecord: - { - // we need to clone and pass out - PMPageFormat pageFormat = kPMNoPageFormat; - OSStatus status = ::PMNewPageFormat(&pageFormat); - if (status != noErr) return NS_ERROR_FAILURE; - - status = ::PMCopyPageFormat(mPageFormat, pageFormat); - if (status != noErr) { - ::PMDisposePageFormat(pageFormat); - return NS_ERROR_FAILURE; - } - - *_retval = pageFormat; - } - break; - - default: - rv = NS_ERROR_FAILURE; - break; - } - return rv; + return NS_ERROR_NOT_IMPLEMENTED; } - #pragma mark - nsresult -nsPrintOptionsX::ReadPageSetupFromPrefs() +nsPrintOptionsX::ReadPrefs(nsIPrintSettings* aPS, const nsString& aPrefName, PRUint32 aFlags) { nsresult rv; - nsCOMPtr prefs = do_GetService(NS_PREF_CONTRACTID, &rv); - if (NS_FAILED(rv)) - return rv; - - nsXPIDLCString encodedData; - rv = prefs->GetCharPref(MAC_OS_X_PAGE_SETUP_PREFNAME, getter_Copies(encodedData)); - if (NS_FAILED(rv)) - return rv; - - // decode the base64 - PRInt32 encodedDataLen = nsCRT::strlen(encodedData.get()); - char* decodedData = ::PL_Base64Decode(encodedData.get(), encodedDataLen, nsnull); - if (!decodedData) - return NS_ERROR_FAILURE; - - Handle decodedDataHandle = nsnull; - OSErr err = ::PtrToHand(decodedData, &decodedDataHandle, (encodedDataLen * 3) / 4); - PR_Free(decodedData); - if (err != noErr) - return NS_ERROR_OUT_OF_MEMORY; - - StHandleOwner handleOwner(decodedDataHandle); - - PMPageFormat newPageFormat = kPMNoPageFormat; - OSStatus status = ::PMUnflattenPageFormat(decodedDataHandle, &newPageFormat); - if (status != noErr) - return NS_ERROR_FAILURE; - - status = ::PMCopyPageFormat(newPageFormat, mPageFormat); - ::PMDisposePageFormat(newPageFormat); - newPageFormat = kPMNoPageFormat; - - return (status == noErr) ? NS_OK : NS_ERROR_FAILURE; + + rv = nsPrintOptions::ReadPrefs(aPS, aPrefName, aFlags); + NS_ASSERTION(NS_SUCCEEDED(rv), "nsPrintOptions::ReadPrefs() failed"); + + nsCOMPtr printSettingsX(do_QueryInterface(aPS)); + if (!printSettingsX) + return NS_ERROR_NO_INTERFACE; + rv = printSettingsX->ReadPageFormatFromPrefs(); + NS_ASSERTION(NS_SUCCEEDED(rv), "nsIPrintSettingsX::ReadPageFormatFromPrefs() failed"); + + return NS_OK; } nsresult -nsPrintOptionsX::WritePageSetupToPrefs() +nsPrintOptionsX::WritePrefs(nsIPrintSettings* aPS, const nsString& aPrefName, PRUint32 aFlags) { - if (mPageFormat == kPMNoPageFormat) - return NS_ERROR_NOT_INITIALIZED; - nsresult rv; - nsCOMPtr prefs = do_GetService(NS_PREF_CONTRACTID, &rv); - if (NS_FAILED(rv)) - return rv; - - Handle pageFormatHandle = nsnull; - OSStatus err = ::PMFlattenPageFormat(mPageFormat, &pageFormatHandle); - if (err != noErr) - return NS_ERROR_FAILURE; - - StHandleOwner handleOwner(pageFormatHandle); - StHandleLocker handleLocker(pageFormatHandle); - nsXPIDLCString encodedData; - encodedData.Adopt(::PL_Base64Encode(*pageFormatHandle, ::GetHandleSize(pageFormatHandle), nsnull)); - if (!encodedData.get()) - return NS_ERROR_OUT_OF_MEMORY; - - return prefs->SetCharPref(MAC_OS_X_PAGE_SETUP_PREFNAME, encodedData); + rv = nsPrintOptions::WritePrefs(aPS, aPrefName, aFlags); + NS_ASSERTION(NS_SUCCEEDED(rv), "nsPrintOptions::WritePrefs() failed"); + + nsCOMPtr printSettingsX(do_QueryInterface(aPS)); + if (!printSettingsX) + return NS_ERROR_NO_INTERFACE; + rv = printSettingsX->WritePageFormatToPrefs(); + NS_ASSERTION(NS_SUCCEEDED(rv), "nsIPrintSettingsX::WritePageFormatToPrefs() failed"); + + return NS_OK; } - - diff --git a/gfx/src/mac/nsPrintOptionsX.h b/gfx/src/mac/nsPrintOptionsX.h index c28cb548cb6..aadce21db60 100644 --- a/gfx/src/mac/nsPrintOptionsX.h +++ b/gfx/src/mac/nsPrintOptionsX.h @@ -39,10 +39,7 @@ #ifndef nsPrintOptionsX_h__ #define nsPrintOptionsX_h__ -#include - -#include "nsPrintOptionsImpl.h" - +#include "nsPrintOptionsImpl.h" //***************************************************************************** @@ -59,15 +56,12 @@ public: NS_IMETHOD GetNativeData(PRInt16 aDataType, void * *_retval); + NS_IMETHOD CreatePrintSettings(nsIPrintSettings **_retval); + protected: - nsresult ReadPageSetupFromPrefs(); - nsresult WritePageSetupToPrefs(); - -protected: - - PMPageFormat mPageFormat; // persist this between runs - + nsresult ReadPrefs(nsIPrintSettings* aPS, const nsString& aPrefName, PRUint32 aFlags); + nsresult WritePrefs(nsIPrintSettings* aPS, const nsString& aPrefName, PRUint32 aFlags); }; diff --git a/gfx/src/mac/nsPrintSettingsMac.cpp b/gfx/src/mac/nsPrintSettingsMac.cpp new file mode 100644 index 00000000000..e69de29bb2d diff --git a/gfx/src/mac/nsPrintSettingsMac.h b/gfx/src/mac/nsPrintSettingsMac.h new file mode 100644 index 00000000000..e69de29bb2d diff --git a/gfx/src/mac/nsPrintSettingsX.cpp b/gfx/src/mac/nsPrintSettingsX.cpp new file mode 100644 index 00000000000..e69de29bb2d diff --git a/gfx/src/mac/nsPrintSettingsX.h b/gfx/src/mac/nsPrintSettingsX.h new file mode 100644 index 00000000000..e69de29bb2d diff --git a/gfx/src/nsPrintOptionsImpl.cpp b/gfx/src/nsPrintOptionsImpl.cpp index 9de0b0e18bb..4c17349b9c3 100644 --- a/gfx/src/nsPrintOptionsImpl.cpp +++ b/gfx/src/nsPrintOptionsImpl.cpp @@ -112,9 +112,7 @@ nsFont* nsPrintOptions::sDefaultFont = nsnull; * See documentation in nsPrintOptionsImpl.h * @update 6/21/00 dwc */ -nsPrintOptions::nsPrintOptions() : - mIsCancelled(PR_FALSE), - mPrintToFile(PR_FALSE) +nsPrintOptions::nsPrintOptions() { NS_INIT_ISUPPORTS(); @@ -899,79 +897,6 @@ NS_IMETHODIMP nsPrintOptions::DisplayJobProperties( const PRUnichar *aPrinter, n return NS_OK; } -/* attribute long isCancelled; */ -NS_IMETHODIMP nsPrintOptions::GetIsCancelled(PRBool *aIsCancelled) -{ - NS_ENSURE_ARG_POINTER(aIsCancelled); - *aIsCancelled = mIsCancelled; - return NS_OK; -} -NS_IMETHODIMP nsPrintOptions::SetIsCancelled(PRBool aIsCancelled) -{ - mIsCancelled = aIsCancelled; - return NS_OK; -} - -/* attribute boolean printToFile; */ -NS_IMETHODIMP nsPrintOptions::GetPrintToFile(PRBool *aPrintToFile) -{ - //NS_ENSURE_ARG_POINTER(aPrintToFile); - *aPrintToFile = mPrintToFile; - return NS_OK; -} -NS_IMETHODIMP nsPrintOptions::SetPrintToFile(PRBool aPrintToFile) -{ - mPrintToFile = aPrintToFile; - return NS_OK; -} - -/* attribute wstring toFileName; */ -NS_IMETHODIMP nsPrintOptions::GetToFileName(PRUnichar * *aToFileName) -{ - //NS_ENSURE_ARG_POINTER(aToFileName); - *aToFileName = ToNewUnicode(mToFileName); - return NS_OK; -} -NS_IMETHODIMP nsPrintOptions::SetToFileName(const PRUnichar * aToFileName) -{ - mToFileName = aToFileName; - return NS_OK; -} - -/* attribute wstring docTitle; */ -NS_IMETHODIMP nsPrintOptions::GetTitle(PRUnichar * *aTitle) -{ - NS_ENSURE_ARG_POINTER(aTitle); - *aTitle = ToNewUnicode(mTitle); - return NS_OK; -} -NS_IMETHODIMP nsPrintOptions::SetTitle(const PRUnichar * aTitle) -{ - if (aTitle) { - mTitle = aTitle; - } else { - mTitle.SetLength(0); - } - return NS_OK; -} - -/* attribute wstring docURL; */ -NS_IMETHODIMP nsPrintOptions::GetDocURL(PRUnichar * *aDocURL) -{ - NS_ENSURE_ARG_POINTER(aDocURL); - *aDocURL = ToNewUnicode(mURL); - return NS_OK; -} -NS_IMETHODIMP nsPrintOptions::SetDocURL(const PRUnichar * aDocURL) -{ - if (aDocURL) { - mURL = aDocURL; - } else { - mURL.SetLength(0); - } - return NS_OK; -} - /* [noscript] voidPtr GetNativeData (in short aDataType); */ NS_IMETHODIMP nsPrintOptions::GetNativeData(PRInt16 aDataType, void * *_retval) { diff --git a/gfx/src/nsPrintOptionsImpl.h b/gfx/src/nsPrintOptionsImpl.h index d4aad962170..627ea1477bc 100644 --- a/gfx/src/nsPrintOptionsImpl.h +++ b/gfx/src/nsPrintOptionsImpl.h @@ -54,18 +54,12 @@ protected: nsresult ReadPrefDouble(nsIPref * aPref, const char * aPrefId, double& aVal); nsresult WritePrefDouble(nsIPref * aPref, const char * aPrefId, double aVal); - nsresult ReadPrefs(nsIPrintSettings* aPS, const nsString& aPrefName, PRUint32 aFlags); - nsresult WritePrefs(nsIPrintSettings* aPS, const nsString& aPrefName, PRUint32 aFlags); + virtual nsresult ReadPrefs(nsIPrintSettings* aPS, const nsString& aPrefName, PRUint32 aFlags); + virtual nsresult WritePrefs(nsIPrintSettings* aPS, const nsString& aPrefName, PRUint32 aFlags); const char* GetPrefName(const char * aPrefName, const nsString& aPrinterName); // Members - PRBool mIsCancelled; - nsString mTitle; - nsString mURL; - PRBool mPrintToFile; - nsString mToFileName; - nsCOMPtr mGlobalPrintSettings; nsCString mPrefName; diff --git a/gfx/src/nsPrintSettingsImpl.cpp b/gfx/src/nsPrintSettingsImpl.cpp index 8c367c15945..978c4773732 100644 --- a/gfx/src/nsPrintSettingsImpl.cpp +++ b/gfx/src/nsPrintSettingsImpl.cpp @@ -91,6 +91,46 @@ nsPrintSettings::nsPrintSettings() : } +/** --------------------------------------------------- + * See documentation in nsPrintSettingsImpl.h + * @update 6/21/00 dwc + */ +nsPrintSettings::nsPrintSettings(const nsPrintSettings* aPS) : + mPrintOptions(aPS->mPrintOptions), + mPrintRange(aPS->mPrintRange), + mStartPageNum(aPS->mStartPageNum), + mEndPageNum(aPS->mEndPageNum), + mScaling(aPS->mScaling), + mPrintBGColors(aPS->mPrintBGColors), + mPrintBGImages(aPS->mPrintBGImages), + mPrintFrameTypeUsage(aPS->mPrintFrameTypeUsage), + mPrintFrameType(aPS->mPrintFrameType), + mHowToEnableFrameUI(aPS->mHowToEnableFrameUI), + mIsCancelled(aPS->mIsCancelled), + mPrintSilent(aPS->mPrintSilent), + mPrintPreview(aPS->mPrintPreview), + mShrinkToFit(aPS->mShrinkToFit), + mPrintPageDelay(aPS->mPrintPageDelay), + mPaperData(aPS->mPaperData), + mPaperSizeType(aPS->mPaperSizeType), + mPaperWidth(aPS->mPaperWidth), + mPaperHeight(aPS->mPaperHeight), + mPaperSizeUnit(aPS->mPaperSizeUnit), + mPrintReversed(aPS->mPrintReversed), + mPrintInColor(aPS->mPrintInColor), + mOrientation(aPS->mOrientation), + mNumCopies(aPS->mNumCopies), + mPrintToFile(aPS->mPrintToFile), + mMargin(aPS->mMargin) +{ + NS_INIT_ISUPPORTS(); + + for (PRInt32 i=0;i<3;i++) { + mHeaderStrs[i] = aPS->mHeaderStrs[i]; + mFooterStrs[i] = aPS->mFooterStrs[i]; + } +} + /** --------------------------------------------------- * See documentation in nsPrintSettingsImpl.h * @update 6/21/00 dwc @@ -769,3 +809,16 @@ nsPrintSettings::GetPageSizeInTwips(PRInt32 *aWidth, PRInt32 *aHeight) return NS_OK; } +nsresult +nsPrintSettings::CloneObj(nsIPrintSettings **_retval) +{ + nsPrintSettings* printSettings = new nsPrintSettings(this); + return printSettings->QueryInterface(NS_GET_IID(nsIPrintSettings), (void**)_retval); // ref counts +} + +/* nsIPrintSettings clone (); */ +NS_IMETHODIMP +nsPrintSettings::Clone(nsIPrintSettings **_retval) +{ + return CloneObj(_retval); +} diff --git a/gfx/src/nsPrintSettingsImpl.h b/gfx/src/nsPrintSettingsImpl.h index 2f7e9412fbf..637cf6ff647 100644 --- a/gfx/src/nsPrintSettingsImpl.h +++ b/gfx/src/nsPrintSettingsImpl.h @@ -37,9 +37,12 @@ public: NS_DECL_NSIPRINTSETTINGS nsPrintSettings(); + nsPrintSettings(const nsPrintSettings* aPS); virtual ~nsPrintSettings(); protected: + virtual nsresult CloneObj(nsIPrintSettings **_retval); + typedef enum { eHeader, eFooter diff --git a/gfx/src/os2/Makefile.in b/gfx/src/os2/Makefile.in index 460574d5fa9..96a42f948d1 100644 --- a/gfx/src/os2/Makefile.in +++ b/gfx/src/os2/Makefile.in @@ -37,10 +37,8 @@ REQUIRES = xpcom \ widget \ view \ util \ - dom \ pref \ uconv \ - windowwatcher \ locale \ unicharutil \ $(NULL) diff --git a/gfx/src/os2/nsDeviceContextOS2.cpp b/gfx/src/os2/nsDeviceContextOS2.cpp index 144c57ec16c..9f1972cdb4d 100644 --- a/gfx/src/os2/nsDeviceContextOS2.cpp +++ b/gfx/src/os2/nsDeviceContextOS2.cpp @@ -892,7 +892,7 @@ nsresult nsDeviceContextOS2::CreateFontAliasTable() } // Printing ------------------------------------------------------------------ -nsresult nsDeviceContextOS2::BeginDocument(PRUnichar * aTitle) +nsresult nsDeviceContextOS2::PrepareDocument(PRUnichar * aTitle, PRUnichar* aPrintToFileName) { nsresult rv = NS_OK; @@ -923,6 +923,12 @@ nsresult nsDeviceContextOS2::BeginDocument(PRUnichar * aTitle) return rv; } +nsresult nsDeviceContextOS2::BeginDocument(PRUnichar * aTitle, PRUnichar* aPrintToFileName, PRInt32 aStartPage, PRInt32 aEndPage) +{ + // Everything is done in PrepareDocument + return NS_OK; +} + nsresult nsDeviceContextOS2::EndDocument() { if (NULL != mPrintDC) diff --git a/gfx/src/os2/nsDeviceContextOS2.h b/gfx/src/os2/nsDeviceContextOS2.h index f290f7f75a1..26003007ef2 100644 --- a/gfx/src/os2/nsDeviceContextOS2.h +++ b/gfx/src/os2/nsDeviceContextOS2.h @@ -88,7 +88,9 @@ public: NS_IMETHOD GetDeviceContextFor(nsIDeviceContextSpec *aDevice, nsIDeviceContext *&aContext); - NS_IMETHOD BeginDocument(PRUnichar * aTitle); + NS_IMETHOD PrepareDocument(PRUnichar * aTitle, + PRUnichar* aPrintToFileName); + NS_IMETHOD BeginDocument(PRUnichar * aTitle, PRUnichar* aPrintToFileName, PRInt32 aStartPage, PRInt32 aEndPage); NS_IMETHOD EndDocument(void); NS_IMETHOD AbortDocument(void); diff --git a/gfx/src/os2/nsDeviceContextSpecFactoryO.cpp b/gfx/src/os2/nsDeviceContextSpecFactoryO.cpp index db814f455c3..3cea565bb1f 100644 --- a/gfx/src/os2/nsDeviceContextSpecFactoryO.cpp +++ b/gfx/src/os2/nsDeviceContextSpecFactoryO.cpp @@ -63,14 +63,14 @@ NS_IMETHODIMP nsDeviceContextSpecFactoryOS2 :: Init(void) NS_IMETHODIMP nsDeviceContextSpecFactoryOS2 :: CreateDeviceContextSpec(nsIWidget *aWidget, nsIPrintSettings* aPrintSettings, nsIDeviceContextSpec *&aNewSpec, - PRBool aQuiet) + PRBool aIsPrintPreview) { nsresult rv; static NS_DEFINE_CID(kDeviceContextSpecCID, NS_DEVICE_CONTEXT_SPEC_CID); nsCOMPtr devSpec = do_CreateInstance(kDeviceContextSpecCID, &rv); if (NS_SUCCEEDED(rv)) { - rv = ((nsDeviceContextSpecOS2 *)devSpec.get())->Init(aPrintSettings, aQuiet); + rv = ((nsDeviceContextSpecOS2 *)devSpec.get())->Init(aPrintSettings, aIsPrintPreview); if (NS_SUCCEEDED(rv)) { aNewSpec = devSpec; NS_ADDREF(aNewSpec); diff --git a/gfx/src/os2/nsDeviceContextSpecFactoryO.h b/gfx/src/os2/nsDeviceContextSpecFactoryO.h index 6362f83d3d4..564f8a040a5 100644 --- a/gfx/src/os2/nsDeviceContextSpecFactoryO.h +++ b/gfx/src/os2/nsDeviceContextSpecFactoryO.h @@ -54,7 +54,7 @@ public: NS_IMETHOD CreateDeviceContextSpec(nsIWidget *aWidget, nsIPrintSettings* aPrintSettings, nsIDeviceContextSpec *&aNewSpec, - PRBool aQuiet); + PRBool aIsPrintPreview); protected: ~nsDeviceContextSpecFactoryOS2(); diff --git a/gfx/src/os2/nsDeviceContextSpecOS2.cpp b/gfx/src/os2/nsDeviceContextSpecOS2.cpp index 875ecddfdf7..c16317588d7 100644 --- a/gfx/src/os2/nsDeviceContextSpecOS2.cpp +++ b/gfx/src/os2/nsDeviceContextSpecOS2.cpp @@ -28,12 +28,7 @@ #include "nsIPref.h" #include "prenv.h" /* for PR_GetEnv */ -#include "nsIDOMWindow.h" #include "nsIServiceManager.h" -#include "nsIDialogParamBlock.h" -#include "nsISupportsPrimitives.h" -#include "nsIWindowWatcher.h" -#include "nsIDOMWindowInternal.h" #include "nsUnicharUtils.h" PRINTDLG nsDeviceContextSpecOS2::PrnDlg; @@ -259,17 +254,17 @@ NS_IMPL_RELEASE(nsDeviceContextSpecOS2) * toolkits including: * - GTK+-toolkit: * file: mozilla/gfx/src/gtk/nsDeviceContextSpecG.cpp - * function: NS_IMETHODIMP nsDeviceContextSpecGTK::Init(PRBool aQuiet) + * function: NS_IMETHODIMP nsDeviceContextSpecGTK::Init(PRBool aPrintPreview) * - Xlib-toolkit: * file: mozilla/gfx/src/xlib/nsDeviceContextSpecXlib.cpp - * function: NS_IMETHODIMP nsDeviceContextSpecXlib::Init(PRBool aQuiet) + * function: NS_IMETHODIMP nsDeviceContextSpecXlib::Init(PRBool aPrintPreview) * - Qt-toolkit: * file: mozilla/gfx/src/qt/nsDeviceContextSpecQT.cpp - * function: NS_IMETHODIMP nsDeviceContextSpecQT::Init(PRBool aQuiet) + * function: NS_IMETHODIMP nsDeviceContextSpecQT::Init(PRBool aPrintPreview) * * ** Please update the other toolkits when changing this function. */ -NS_IMETHODIMP nsDeviceContextSpecOS2::Init(nsIPrintSettings* aPS, PRBool aQuiet) +NS_IMETHODIMP nsDeviceContextSpecOS2::Init(nsIPrintSettings* aPS, PRBool aPrintPreview) { nsresult rv = NS_ERROR_FAILURE; @@ -286,65 +281,46 @@ NS_IMETHODIMP nsDeviceContextSpecOS2::Init(nsIPrintSettings* aPS, PRBool aQuiet) } } - PRBool canPrint = PR_FALSE; + char *path; + PRBool tofile = PR_FALSE; + PRInt16 printRange = nsIPrintSettings::kRangeAllPages; + PRInt32 fromPage = 1; + PRInt32 toPage = 1; + PRInt32 copies = 1; + PRUnichar *printer = nsnull; + PRUnichar *printfile = nsnull; rv = GlobalPrinters::GetInstance()->InitializeGlobalPrinters(); if (NS_FAILED(rv)) { return rv; } - if ( !aQuiet ) { - rv = NS_ERROR_FAILURE; - // create a nsISupportsArray of the parameters - // being passed to the window - nsCOMPtr array; - NS_NewISupportsArray(getter_AddRefs(array)); - if (!array) return NS_ERROR_FAILURE; + if (mPrintSettings) { + mPrintSettings->GetPrinterName(&printer); + mPrintSettings->GetPrintRange(&printRange); + mPrintSettings->GetToFileName(&printfile); + mPrintSettings->GetPrintToFile(&tofile); + mPrintSettings->GetStartPageRange(&fromPage); + mPrintSettings->GetEndPageRange(&toPage); + mPrintSettings->GetNumCopies(&copies); - nsCOMPtr ps = aPS; - nsCOMPtr psSupports(do_QueryInterface(ps)); - NS_ASSERTION(psSupports, "PrintSettings must be a supports"); - array->AppendElement(psSupports); - - nsCOMPtr ioParamBlock(do_CreateInstance("@mozilla.org/embedcomp/dialogparam;1")); - if (ioParamBlock) { - ioParamBlock->SetInt(0, 0); - nsCOMPtr blkSupps(do_QueryInterface(ioParamBlock)); - NS_ASSERTION(blkSupps, "IOBlk must be a supports"); - - array->AppendElement(blkSupps); - nsCOMPtr arguments(do_QueryInterface(array)); - NS_ASSERTION(array, "array must be a supports"); - - nsCOMPtr wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1")); - if (wwatch) { - nsCOMPtr active; - wwatch->GetActiveWindow(getter_AddRefs(active)); - nsCOMPtr parent = do_QueryInterface(active); - - nsCOMPtr newWindow; - rv = wwatch->OpenWindow(parent, "chrome://global/content/printdialog.xul", - "_blank", "chrome,modal,centerscreen", array, - getter_AddRefs(newWindow)); - } + if ((copies == 0) || (copies > 999)) { + GlobalPrinters::GetInstance()->FreeGlobalPrinters(); + return NS_ERROR_FAILURE; } - if (NS_SUCCEEDED(rv)) { - PRInt32 buttonPressed = 0; - ioParamBlock->GetInt(0, &buttonPressed); - if (buttonPressed == 1) - canPrint = PR_TRUE; - else - { - GlobalPrinters::GetInstance()->FreeGlobalPrinters(); - return NS_ERROR_ABORT; - } - } else - return NS_ERROR_ABORT; - } else { - canPrint = PR_TRUE; + if (printfile != nsnull) { + // ToDo: Use LocalEncoding instead of UTF-8 (see bug 73446) + strcpy(mPrData.path, NS_ConvertUCS2toUTF8(printfile).get()); + } + if (printer != nsnull) + strcpy(mPrData.printer, NS_ConvertUCS2toUTF8(printer).get()); } +<<<<<<< nsDeviceContextSpecOS2.cpp + mPrData.toPrinter = !tofile; + mPrData.copies = copies; +======= if (canPrint) { if (aPS) { PRBool tofile = PR_FALSE; @@ -377,7 +353,13 @@ NS_IMETHODIMP nsDeviceContextSpecOS2::Init(nsIPrintSettings* aPS, PRBool aQuiet) mPrData.toPrinter = !tofile; mPrData.copies = copies; +>>>>>>> 1.12 +<<<<<<< nsDeviceContextSpecOS2.cpp + rv = GlobalPrinters::GetInstance()->InitializeGlobalPrinters(); + if (NS_FAILED(rv)) + return rv; +======= rv = GlobalPrinters::GetInstance()->InitializeGlobalPrinters(); if (NS_FAILED(rv)) return rv; @@ -392,7 +374,25 @@ NS_IMETHODIMP nsDeviceContextSpecOS2::Init(nsIPrintSettings* aPS, PRBool aQuiet) } } } +>>>>>>> 1.12 +<<<<<<< nsDeviceContextSpecOS2.cpp + const nsAFlatString& printerUCS2 = NS_ConvertUTF8toUCS2(mPrData.printer); + int numPrinters = GlobalPrinters::GetInstance()->GetNumPrinters(); + if (numPrinters) { + for(int i = 0; (i < numPrinters) && !mQueue; i++) { + if ((GlobalPrinters::GetInstance()->GetStringAt(i)->Equals(printerUCS2, nsCaseInsensitiveStringComparator()))) + mQueue = PrnDlg.SetPrinterQueue(i); + } + } + + if (printfile != nsnull) + nsMemory::Free(printfile); + + if (printer != nsnull) + nsMemory::Free(printer); + +======= if (printfile != nsnull) nsMemory::Free(printfile); @@ -400,6 +400,7 @@ NS_IMETHODIMP nsDeviceContextSpecOS2::Init(nsIPrintSettings* aPS, PRBool aQuiet) nsMemory::Free(printer); } } +>>>>>>> 1.12 GlobalPrinters::GetInstance()->FreeGlobalPrinters(); return rv; diff --git a/gfx/src/os2/nsDeviceContextSpecOS2.h b/gfx/src/os2/nsDeviceContextSpecOS2.h index 0df0cb3ebd5..2bac515911d 100644 --- a/gfx/src/os2/nsDeviceContextSpecOS2.h +++ b/gfx/src/os2/nsDeviceContextSpecOS2.h @@ -132,14 +132,10 @@ public: /** * Initialize the nsDeviceContextSpecMac for use. This will allocate a printrecord for use * @update dc 2/16/98 - * @param aQuiet if PR_TRUE, prevent the need for user intervention - * in obtaining device context spec. if nsnull is passed in for - * the aOldSpec, this will typically result in getting a device - * context spec for the default output device (i.e. default - * printer). + * @param aIsPrintPreview if PR_TRUE, creating Spec for PrintPreview * @return error status */ - NS_IMETHOD Init(nsIPrintSettings* aPS, PRBool aQuiet); + NS_IMETHOD Init(nsIPrintSettings* aPS, PRBool aIsPrintPreview); NS_IMETHOD ClosePrintManager(); diff --git a/gfx/src/photon/Makefile.in b/gfx/src/photon/Makefile.in index a27afef5c91..c99652a54f1 100644 --- a/gfx/src/photon/Makefile.in +++ b/gfx/src/photon/Makefile.in @@ -36,11 +36,9 @@ REQUIRES = xpcom \ widget \ view \ util \ - dom \ pref \ uconv \ unicharutil \ - windowwatcher \ locale \ intl \ $(NULL) diff --git a/gfx/src/photon/nsDeviceContextPh.cpp b/gfx/src/photon/nsDeviceContextPh.cpp index bb412ab5935..772c2baf992 100644 --- a/gfx/src/photon/nsDeviceContextPh.cpp +++ b/gfx/src/photon/nsDeviceContextPh.cpp @@ -451,7 +451,7 @@ int nsDeviceContextPh::prefChanged( const char *aPref, void *aClosure ) { return 0; } -NS_IMETHODIMP nsDeviceContextPh :: BeginDocument( PRUnichar *t ) { +NS_IMETHODIMP nsDeviceContextPh :: BeginDocument( PRUnichar *t, PRUnichar* aPrintToFileName, PRInt32 aStartPage, PRInt32 aEndPage ) { PpPrintContext_t *pc = ((nsDeviceContextSpecPh *)mSpec)->GetPrintContext(); PpStartJob(pc); mIsPrinting = 1; diff --git a/gfx/src/photon/nsDeviceContextPh.h b/gfx/src/photon/nsDeviceContextPh.h index f975571e822..4aff3e07e11 100644 --- a/gfx/src/photon/nsDeviceContextPh.h +++ b/gfx/src/photon/nsDeviceContextPh.h @@ -84,7 +84,7 @@ public: NS_IMETHOD GetDeviceContextFor(nsIDeviceContextSpec *aDevice, nsIDeviceContext *&aContext); - NS_IMETHOD BeginDocument(PRUnichar *t); + NS_IMETHOD BeginDocument(PRUnichar *t, PRUnichar* aPrintToFileName, PRInt32 aStartPage, PRInt32 aEndPage); NS_IMETHOD EndDocument(void); NS_IMETHOD AbortDocument(void); diff --git a/gfx/src/photon/nsDeviceContextSpecFactoryP.cpp b/gfx/src/photon/nsDeviceContextSpecFactoryP.cpp index 3a982405f4b..8a1a1679c70 100644 --- a/gfx/src/photon/nsDeviceContextSpecFactoryP.cpp +++ b/gfx/src/photon/nsDeviceContextSpecFactoryP.cpp @@ -72,7 +72,7 @@ NS_IMETHODIMP nsDeviceContextSpecFactoryPh :: Init(void) NS_IMETHODIMP nsDeviceContextSpecFactoryPh :: CreateDeviceContextSpec(nsIWidget *aWidget, nsIPrintSettings* aPrintSettings, nsIDeviceContextSpec *&aNewSpec, - PRBool aQuiet) + PRBool aIsPrintPreview) { NS_ENSURE_ARG_POINTER(aWidget); PpPrintContext_t *pc = NULL; @@ -90,8 +90,6 @@ NS_IMETHODIMP nsDeviceContextSpecFactoryPh :: CreateDeviceContextSpec(nsIWidget { PRInt32 range = 0; - aQuiet = 1; /* for the embedding stuff, the PrintSelection dialog is displayed by the client */ - /* check for the page range if we are called by an embedded app, the pc is there */ aPrintSettings->GetEndPageRange(&range); if (range) pc = (PpPrintContext_t *) range; @@ -102,7 +100,7 @@ NS_IMETHODIMP nsDeviceContextSpecFactoryPh :: CreateDeviceContextSpec(nsIWidget { specPh->SetPrintContext(pc); } - rv = specPh->Init(aWidget, aPrintSettings, aQuiet); + rv = specPh->Init(aWidget, aPrintSettings, PR_TRUE); if (NS_SUCCEEDED(rv)) { aNewSpec = devSpec; } else { diff --git a/gfx/src/photon/nsDeviceContextSpecFactoryP.h b/gfx/src/photon/nsDeviceContextSpecFactoryP.h index a9da1380633..0e384868bde 100644 --- a/gfx/src/photon/nsDeviceContextSpecFactoryP.h +++ b/gfx/src/photon/nsDeviceContextSpecFactoryP.h @@ -53,7 +53,7 @@ public: NS_IMETHOD CreateDeviceContextSpec( nsIWidget *aWidget, nsIPrintSettings* aPrintSettings, nsIDeviceContextSpec *&aNewSpec, - PRBool aQuiet); + PRBool aIsPrintPreview); protected: virtual ~nsDeviceContextSpecFactoryPh(); diff --git a/gfx/src/photon/nsDeviceContextSpecPh.cpp b/gfx/src/photon/nsDeviceContextSpecPh.cpp index d135728f840..8ede7990f83 100644 --- a/gfx/src/photon/nsDeviceContextSpecPh.cpp +++ b/gfx/src/photon/nsDeviceContextSpecPh.cpp @@ -42,23 +42,11 @@ #include "plstr.h" #include "nsPhGfxLog.h" -#include "nsGfxCIID.h" -#include "nsIPrintOptions.h" -#include "nsIDOMWindow.h" -#include "nsIDialogParamBlock.h" -#include "nsISupportsPrimitives.h" -#include "nsIWindowWatcher.h" -#include "nsIDOMWindowInternal.h" -#include "nsVoidArray.h" -#include "nsSupportsArray.h" - #include "nsString.h" #include "nsIServiceManager.h" #include "nsReadableUtils.h" #include "nsIPref.h" -static NS_DEFINE_CID( kPrintOptionsCID, NS_PRINTOPTIONS_CID ); - nsDeviceContextSpecPh :: nsDeviceContextSpecPh() { NS_INIT_REFCNT(); diff --git a/gfx/src/ps/nsDeviceContextPS.cpp b/gfx/src/ps/nsDeviceContextPS.cpp index c2b18e0ad28..fd38e3d0988 100644 --- a/gfx/src/ps/nsDeviceContextPS.cpp +++ b/gfx/src/ps/nsDeviceContextPS.cpp @@ -340,7 +340,7 @@ NS_IMETHODIMP nsDeviceContextPS::GetDeviceContextFor(nsIDeviceContextSpec *aDevi * See documentation in nsIDeviceContext.h * @update 12/21/98 dwc */ -NS_IMETHODIMP nsDeviceContextPS::BeginDocument(PRUnichar * aTitle) +NS_IMETHODIMP nsDeviceContextPS::BeginDocument(PRUnichar * aTitle, PRUnichar* aPrintToFileName, PRInt32 aStartPage, PRInt32 aEndPage) { PR_LOG(nsDeviceContextPSLM, PR_LOG_DEBUG, ("nsDeviceContextPS::BeginDocument()\n")); diff --git a/gfx/src/ps/nsDeviceContextPS.h b/gfx/src/ps/nsDeviceContextPS.h index df5d9111242..774bb9c0acc 100644 --- a/gfx/src/ps/nsDeviceContextPS.h +++ b/gfx/src/ps/nsDeviceContextPS.h @@ -89,7 +89,7 @@ public: NS_IMETHOD GetDeviceContextFor(nsIDeviceContextSpec *aDevice,nsIDeviceContext *&aContext); NS_IMETHOD GetSystemFont(nsSystemFontID anID, nsFont *aFont) const; - NS_IMETHOD BeginDocument(PRUnichar * aTitle); + NS_IMETHOD BeginDocument(PRUnichar * aTitle, PRUnichar* aPrintToFileName, PRInt32 aStartPage, PRInt32 aEndPage); NS_IMETHOD EndDocument(void); NS_IMETHOD AbortDocument(void); NS_IMETHOD BeginPage(void); diff --git a/gfx/src/qt/Makefile.in b/gfx/src/qt/Makefile.in index 4915f1f51d3..adea2e2c116 100644 --- a/gfx/src/qt/Makefile.in +++ b/gfx/src/qt/Makefile.in @@ -37,12 +37,9 @@ REQUIRES = xpcom \ gfx2 \ uconv \ pref \ - dom \ util \ js \ - appshell \ mozcomps \ - windowwatcher \ unicharutil \ intl \ locale \ diff --git a/gfx/src/windows/Makefile.in b/gfx/src/windows/Makefile.in index 76cb89f0346..b515114b7e4 100644 --- a/gfx/src/windows/Makefile.in +++ b/gfx/src/windows/Makefile.in @@ -42,8 +42,6 @@ REQUIRES = xpcom \ unicharutil \ locale \ necko \ - dom \ - windowwatcher \ content \ layout \ $(NULL) diff --git a/gfx/src/windows/makefile.win b/gfx/src/windows/makefile.win index bb8191d5ba5..9f49538eece 100644 --- a/gfx/src/windows/makefile.win +++ b/gfx/src/windows/makefile.win @@ -35,8 +35,6 @@ REQUIRES = xpcom \ unicharutil \ locale \ necko \ - dom \ - windowwatcher \ content \ layout \ layout_xul \ diff --git a/gfx/src/windows/nsDeviceContextSpecFactoryW.cpp b/gfx/src/windows/nsDeviceContextSpecFactoryW.cpp index 55e22626a06..437c7b4c973 100644 --- a/gfx/src/windows/nsDeviceContextSpecFactoryW.cpp +++ b/gfx/src/windows/nsDeviceContextSpecFactoryW.cpp @@ -66,7 +66,7 @@ NS_IMETHODIMP nsDeviceContextSpecFactoryWin :: Init(void) NS_IMETHODIMP nsDeviceContextSpecFactoryWin :: CreateDeviceContextSpec(nsIWidget *aWidget, nsIPrintSettings* aPrintSettings, nsIDeviceContextSpec *&aNewSpec, - PRBool aQuiet) + PRBool aIsPrintPreview) { NS_ENSURE_ARG_POINTER(aWidget); @@ -77,7 +77,7 @@ NS_IMETHODIMP nsDeviceContextSpecFactoryWin :: CreateDeviceContextSpec(nsIWidget if (nsnull != devspec){ nsDeviceContextSpecWin* specWin = NS_STATIC_CAST(nsDeviceContextSpecWin*, devspec); - rv = specWin->Init(aWidget, aPrintSettings, aQuiet); + rv = specWin->Init(aWidget, aPrintSettings, aIsPrintPreview); if (NS_SUCCEEDED(rv)) { aNewSpec = devspec; } else { diff --git a/gfx/src/windows/nsDeviceContextSpecFactoryW.h b/gfx/src/windows/nsDeviceContextSpecFactoryW.h index 99e9352121e..0341ac5af5e 100644 --- a/gfx/src/windows/nsDeviceContextSpecFactoryW.h +++ b/gfx/src/windows/nsDeviceContextSpecFactoryW.h @@ -55,7 +55,7 @@ public: NS_IMETHOD CreateDeviceContextSpec(nsIWidget *aWidget, nsIPrintSettings* aPrintSettings, nsIDeviceContextSpec *&aNewSpec, - PRBool aQuiet); + PRBool aIsPrintPreview); protected: ~nsDeviceContextSpecFactoryWin(); diff --git a/gfx/src/windows/nsDeviceContextSpecWin.cpp b/gfx/src/windows/nsDeviceContextSpecWin.cpp index 348991ed9a1..10023c302af 100644 --- a/gfx/src/windows/nsDeviceContextSpecWin.cpp +++ b/gfx/src/windows/nsDeviceContextSpecWin.cpp @@ -41,73 +41,39 @@ #define WINVER 0x0500 #endif +//#include +//#include +#include + #include "nsDeviceContextSpecWin.h" #include "prmem.h" -#include "plstr.h" +//#include "plstr.h" #include +#include +//#include "prenv.h" /* for PR_GetEnv */ #include -#include -#include - -#include "nsIDOMWindow.h" -#include "nsIServiceManager.h" -#include "nsIDialogParamBlock.h" -#include "nsISupportsPrimitives.h" -#include "nsIWindowWatcher.h" -#include "nsIDOMWindowInternal.h" #include "nsVoidArray.h" -#include "nsSupportsArray.h" +#include "nsIPrintSettingsWin.h" #include "nsString.h" #include "nsIServiceManager.h" #include "nsReadableUtils.h" #include "nsGfxCIID.h" static NS_DEFINE_CID(kPrintOptionsCID, NS_PRINTOPTIONS_CID); -#include "nsIPromptService.h" + +// File Picker +#include "nsILocalFile.h" +#include "nsIFile.h" +#include "nsIFilePicker.h" +#include "nsIStringBundle.h" +#define NS_ERROR_GFX_PRINTER_BUNDLE_URL "chrome://communicator/locale/printing.properties" #include "nsIPref.h" -#include "prenv.h" /* for PR_GetEnv */ - -#include -#include - -// For Localization -#include "nsIStringBundle.h" -#include "nsDeviceContext.h" -#include "nsDeviceContextWin.h" - -// This is for extending the dialog -#include - -static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID); - -// For PrintDlgEx -// needed because there are unicode/ansi versions of this routine -// and we need to make sure we get the correct one. -#ifdef UNICODE -#define GetPrintDlgExQuoted "PrintDlgExW" -#else -#define GetPrintDlgExQuoted "PrintDlgExA" -#endif - -// Default labels for the radio buttons -const char* kAsLaidOutOnScreenStr = "As &laid out on the screen"; -const char* kTheSelectedFrameStr = "The selected &frame"; -const char* kEachFrameSeparately = "&Each frame separately"; - //----------------------------------------------- // Global Data //----------------------------------------------- -// Identifies which new radio btn was cliked on -static UINT gFrameSelectedRadioBtn = 0; - -// Indicates whether the native print dialog was successfully extended -static PRPackedBool gDialogWasExtended = PR_FALSE; - -#define PRINTDLG_PROPERTIES "chrome://global/locale/printdialog.properties" - static HWND gParentWnd = NULL; //---------------------------------------------------------------------------------- @@ -200,8 +166,7 @@ const NativePaperSizes kPaperSizes[] = { const PRInt32 kNumPaperSizes = 41; //---------------------------------------------------------------------------------- -nsDeviceContextSpecWin::nsDeviceContextSpecWin() : - mUseExtendedPrintDlg(NULL) +nsDeviceContextSpecWin::nsDeviceContextSpecWin() { NS_INIT_REFCNT(); @@ -211,12 +176,6 @@ nsDeviceContextSpecWin::nsDeviceContextSpecWin() : mGlobalDevMode = NULL; mIsDEVMODEGlobalHandle = PR_FALSE; -#ifdef MOZ_REQUIRE_CURRENT_SDK - HMODULE lib = GetModuleHandle("comdlg32.dll"); - if ( lib ) { - mUseExtendedPrintDlg = GetProcAddress(lib, GetPrintDlgExQuoted); - } -#endif } @@ -235,6 +194,334 @@ nsDeviceContextSpecWin::~nsDeviceContextSpecWin() } +//------------------------------------------------------------------ +// helper +static PRUnichar * GetDefaultPrinterNameFromGlobalPrinters() +{ + PRUnichar * printerName; + LPTSTR lpPrtName; + GlobalPrinters::GetInstance()->GetDefaultPrinterName(lpPrtName); + nsString str; +#ifdef UNICODE + str.AppendWithConversion((PRUnichar *)lpPrtName); +#else + str.AssignWithConversion((char*)lpPrtName); +#endif + printerName = ToNewUnicode(str); + free(lpPrtName); + return printerName; +} + +//---------------------------------------------------------------- +static nsresult +EnumerateNativePrinters(DWORD aWhichPrinters, LPTSTR aPrinterName, PRBool& aIsFound, PRBool& aIsFile) +{ + DWORD dwSizeNeeded; + DWORD dwNumItems; + LPPRINTER_INFO_2 lpInfo = NULL; + + // Get buffer size + ::EnumPrinters ( aWhichPrinters, NULL, 2, NULL, 0, &dwSizeNeeded, &dwNumItems ); + + // allocate memory + lpInfo = (LPPRINTER_INFO_2)HeapAlloc ( GetProcessHeap (), HEAP_ZERO_MEMORY, dwSizeNeeded ); + if ( lpInfo == NULL ) { + return NS_ERROR_OUT_OF_MEMORY; + } + + if (::EnumPrinters ( PRINTER_ENUM_LOCAL, NULL, 2, (LPBYTE)lpInfo, dwSizeNeeded, &dwSizeNeeded, &dwNumItems) == 0 ) { + return NS_OK; + } + + + for (DWORD i = 0; i < dwNumItems; i++ ) { + if (_tcscmp(lpInfo[i].pPrinterName, aPrinterName)) { + aIsFound = PR_TRUE; + aIsFile = _tcscmp(lpInfo[i].pPortName, _T("FILE:")) == 0; + break; + } + } + + HeapFree(GetProcessHeap (), 0, lpInfo); + return NS_OK; +} + +//---------------------------------------------------------------- +static nsresult +CheckForPrintToFile(LPTSTR aPrinterName, PRBool& aIsFile) +{ + PRBool isFound = PR_FALSE; + aIsFile = PR_FALSE; + nsresult rv = EnumerateNativePrinters(PRINTER_ENUM_LOCAL, aPrinterName, isFound, aIsFile); + if (isFound || NS_FAILED(rv)) return rv; + + rv = EnumerateNativePrinters(PRINTER_ENUM_NETWORK, aPrinterName, isFound, aIsFile); + if (isFound || NS_FAILED(rv)) return rv; + + rv = EnumerateNativePrinters(PRINTER_ENUM_SHARED, aPrinterName, isFound, aIsFile); + if (isFound || NS_FAILED(rv)) return rv; + + rv = EnumerateNativePrinters(PRINTER_ENUM_REMOTE, aPrinterName, isFound, aIsFile); + if (isFound || NS_FAILED(rv)) return rv; + + return NS_OK; +} + +static nsresult +GetFileNameForPrintSettings(nsIPrintSettings* aPS) +{ + // for testing +#ifdef DEBUG_rods + return NS_OK; +#endif + + nsresult rv; + + nsCOMPtr filePicker = do_CreateInstance("@mozilla.org/filepicker;1", &rv); + NS_ENSURE_SUCCESS(rv, rv); + + nsCOMPtr bundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv); + NS_ENSURE_SUCCESS(rv, rv); + nsCOMPtr bundle; + rv = bundleService->CreateBundle(NS_ERROR_GFX_PRINTER_BUNDLE_URL, getter_AddRefs(bundle)); + NS_ENSURE_SUCCESS(rv, rv); + + nsXPIDLString title; + rv = bundle->GetStringFromName(NS_LITERAL_STRING("PrintToFile").get(), getter_Copies(title)); + NS_ENSURE_SUCCESS(rv, rv); + + rv = filePicker->Init(nsnull, title.get(), nsIFilePicker::modeSave); + NS_ENSURE_SUCCESS(rv, rv); + + rv = filePicker->AppendFilters(nsIFilePicker::filterAll); + NS_ENSURE_SUCCESS(rv, rv); + + PRUnichar* fileName; + aPS->GetToFileName(&fileName); + + if (fileName) { + if (*fileName) { + nsCAutoString leafName; + nsCOMPtr file(do_CreateInstance("@mozilla.org/file/local;1")); + if (file) { + rv = file->InitWithPath(NS_ConvertUCS2toUTF8(fileName)); + if (NS_SUCCEEDED(rv)) { + file->GetLeafName(leafName); + filePicker->SetDisplayDirectory(file); + } + } + if (!leafName.IsEmpty()) { + NS_ConvertUTF8toUCS2 unicodeFileName(leafName); + rv = filePicker->SetDefaultString(unicodeFileName.get()); + } + NS_ENSURE_SUCCESS(rv, rv); + } + nsMemory::Free(fileName); + } + + PRInt16 dialogResult; + filePicker->Show(&dialogResult); + + if (dialogResult == nsIFilePicker::returnCancel) { + return NS_ERROR_ABORT; + } + + nsCOMPtr localFile; + rv = filePicker->GetFile(getter_AddRefs(localFile)); + NS_ENSURE_SUCCESS(rv, rv); + + if (dialogResult == nsIFilePicker::returnReplace) { + // be extra safe and only delete when the file is really a file + PRBool isFile; + rv = localFile->IsFile(&isFile); + if (NS_SUCCEEDED(rv) && isFile) { + rv = localFile->Remove(PR_FALSE /* recursive delete */); + NS_ENSURE_SUCCESS(rv, rv); + } + } + + nsCAutoString cPath; + rv = localFile->GetPath(cPath); + NS_ENSURE_SUCCESS(rv,rv); + + if (cPath.IsEmpty()) { + rv = NS_ERROR_ABORT; + } + + NS_ConvertUTF8toUCS2 unicodePath(cPath); + if (NS_SUCCEEDED(rv)) aPS->SetToFileName(unicodePath.get()); + + return rv; +} + +//---------------------------------------------------------------------------------- +static nsresult +CheckForPrintToFile(nsIPrintSettings* aPS, LPTSTR aPrinterName, PRUnichar* aUPrinterName) +{ + nsresult rv = NS_OK; + + if (!aPrinterName && !aUPrinterName) return rv; + + PRBool toFile; +#ifdef UNICODE + CheckForPrintToFile(aPrinterName?aPrinterName:aUPrinterName, toFile); +#else + if (aPrinterName) { + CheckForPrintToFile(aPrinterName, toFile); + } else { + CheckForPrintToFile((char*)NS_ConvertUCS2toUTF8(aUPrinterName).get(), toFile); + } +#endif + aPS->SetPrintToFile(toFile); + if (toFile) { + rv = GetFileNameForPrintSettings(aPS); + } + return rv; +} + +//---------------------------------------------------------------------------------- +NS_IMETHODIMP nsDeviceContextSpecWin::Init(nsIWidget* aWidget, + nsIPrintSettings* aPrintSettings, + PRBool aIsPrintPreview) +{ + mPrintSettings = aPrintSettings; + + gParentWnd = (HWND)aWidget->GetNativeData(NS_NATIVE_WINDOW); + + nsresult rv = NS_ERROR_FAILURE; + if (aPrintSettings) { + nsCOMPtr psWin(do_QueryInterface(aPrintSettings)); + if (psWin) { + char* deviceName; + char* driverName; + psWin->GetDeviceName(&deviceName); // creates new memory (makes a copy) + psWin->GetDriverName(&driverName); // creates new memory (makes a copy) + + LPDEVMODE devMode; + psWin->GetDevMode(&devMode); // creates new memory (makes a copy) + + if (deviceName && driverName && devMode) { + // Scaling is special, it is one of the few + // devMode items that we control in layout + if (devMode->dmFields & DM_SCALE) { + double scale = double(devMode->dmScale) / 100.0f; + if (scale != 1.0) { + aPrintSettings->SetScaling(scale); + devMode->dmScale = 100; + } + } + + SetDeviceName(deviceName); + SetDriverName(driverName); + SetDevMode(devMode); + + if (!aIsPrintPreview) { + rv = CheckForPrintToFile(mPrintSettings, deviceName, nsnull); + NS_ENSURE_SUCCESS(rv, rv); + } + + // clean up + nsCRT::free(deviceName); + nsCRT::free(driverName); + + return NS_OK; + } else { + if (deviceName) nsCRT::free(deviceName); + if (driverName) nsCRT::free(driverName); + if (devMode) free(devMode); + } + } + } + + LPDEVMODE pDevMode = NULL; + HGLOBAL hDevNames = NULL; + + // Get the Print Name to be used + PRUnichar * printerName; + mPrintSettings->GetPrinterName(&printerName); + + // If there is no name then use the default printer + if (!printerName || (printerName && !*printerName)) { + printerName = GetDefaultPrinterNameFromGlobalPrinters(); + } + + NS_ASSERTION(printerName, "We have to have a printer name"); + if (!printerName || !*printerName) return NS_ERROR_FAILURE; + + if (!aIsPrintPreview) { + CheckForPrintToFile(mPrintSettings, nsnull, printerName); + } + + return GetDataFromPrinter(printerName, mPrintSettings); +} + +//---------------------------------------------------------- +// Helper Function - Free and reallocate the string +static void CleanAndCopyString(char*& aStr, char* aNewStr) +{ + if (aStr != nsnull) { + if (aNewStr != nsnull && strlen(aStr) > strlen(aNewStr)) { // reuse it if we can + PL_strcpy(aStr, aNewStr); + return; + } else { + PR_Free(aStr); + aStr = nsnull; + } + } + + if (nsnull != aNewStr) { + aStr = (char *)PR_Malloc(PL_strlen(aNewStr) + 1); + PL_strcpy(aStr, aNewStr); + } +} + +//---------------------------------------------------------------------------------- +void nsDeviceContextSpecWin::SetDeviceName(char* aDeviceName) +{ + CleanAndCopyString(mDeviceName, aDeviceName); +} + +//---------------------------------------------------------------------------------- +void nsDeviceContextSpecWin::SetDriverName(char* aDriverName) +{ + CleanAndCopyString(mDriverName, aDriverName); +} + +//---------------------------------------------------------------------------------- +void nsDeviceContextSpecWin::SetGlobalDevMode(HGLOBAL aHGlobal) +{ + if (mGlobalDevMode) { + ::GlobalFree(mGlobalDevMode); + mGlobalDevMode = NULL; + } + mGlobalDevMode = aHGlobal; + mIsDEVMODEGlobalHandle = PR_TRUE; +} + +//---------------------------------------------------------------------------------- +void nsDeviceContextSpecWin::SetDevMode(LPDEVMODE aDevMode) +{ + if (mDevMode) free(mDevMode); + + mDevMode = aDevMode; + mIsDEVMODEGlobalHandle = PR_FALSE; +} + +//------------------------------------------------------------------ +void +nsDeviceContextSpecWin::GetDevMode(LPDEVMODE &aDevMode) +{ + if (mIsDEVMODEGlobalHandle) { + if (mGlobalDevMode) { + aDevMode = (DEVMODE *)::GlobalLock(mGlobalDevMode); + } else { + aDevMode = NULL; + } + } else { + aDevMode = mDevMode; + } +} + //---------------------------------------------------------------------------------- // Map an incoming size to a Windows Native enum in the DevMode static void @@ -326,1216 +613,6 @@ SetupDevModeFromSettings(LPDEVMODE aDevMode, nsIPrintSettings* aPrintSettings) } -//---------------------------------------------------------------------------------- -// Helper Function - Free and reallocate the string -nsresult -nsDeviceContextSpecWin::SetPrintSettingsFromDevMode(nsIPrintSettings* aPrintSettings, - LPDEVMODE aDevMode) -{ - if (aPrintSettings == nsnull) { - return NS_ERROR_FAILURE; - } - BOOL doingNumCopies = aDevMode->dmFields & DM_COPIES; - BOOL doingOrientation = aDevMode->dmFields & DM_ORIENTATION; - BOOL doingPaperSize = aDevMode->dmFields & DM_PAPERSIZE; - BOOL doingPaperLength = aDevMode->dmFields & DM_PAPERLENGTH; - BOOL doingPaperWidth = aDevMode->dmFields & DM_PAPERWIDTH; - - if (doingOrientation) { - PRInt32 orientation = aDevMode->dmOrientation == DMORIENT_PORTRAIT? - nsIPrintSettings::kPortraitOrientation:nsIPrintSettings::kLandscapeOrientation; - aPrintSettings->SetOrientation(orientation); - } - - // Setup Number of Copies - if (doingNumCopies) { - aPrintSettings->SetNumCopies(PRInt32(aDevMode->dmCopies)); - } - - if (aDevMode->dmFields & DM_SCALE) { - double scale = double(aDevMode->dmScale) / 100.0f; - if (scale != 1.0) { - aPrintSettings->SetScaling(scale); - aDevMode->dmScale = 100; - // To turn this on you must change where the mPrt->mShrinkToFit is being set in the DocumentViewer - //aPrintSettings->SetShrinkToFit(PR_FALSE); - } - } - - if (doingPaperSize) { - aPrintSettings->SetPaperSizeType(nsIPrintSettings::kPaperSizeNativeData); - aPrintSettings->SetPaperData(aDevMode->dmPaperSize); - - } else if (doingPaperLength && doingPaperWidth) { - PRBool found = PR_FALSE; - for (PRInt32 i=0;idmPaperSize) { - aPrintSettings->SetPaperSizeType(nsIPrintSettings::kPaperSizeDefined); - aPrintSettings->SetPaperWidth(kPaperSizes[i].mWidth); - aPrintSettings->SetPaperHeight(kPaperSizes[i].mHeight); - aPrintSettings->SetPaperSizeUnit(kPaperSizes[i].mIsInches?nsIPrintSettings::kPaperSizeInches:nsIPrintSettings::kPaperSizeInches); - found = PR_TRUE; - break; - } - } - if (!found) { - return NS_ERROR_FAILURE; - } - } else { - return NS_ERROR_FAILURE; - } - return NS_OK; -} - -//---------------------------------------------------------------------------------- -NS_IMETHODIMP nsDeviceContextSpecWin::Init(nsIWidget* aWidget, - nsIPrintSettings* aPrintSettings, - PRBool aQuiet) -{ - mPrintSettings = aPrintSettings; - - gParentWnd = (HWND)aWidget->GetNativeData(NS_NATIVE_WINDOW); - - PRBool doNativeDialog = PR_FALSE; - nsresult rv = NS_ERROR_FAILURE; - nsCOMPtr pPrefs = do_GetService(NS_PREF_CONTRACTID, &rv); - if (NS_SUCCEEDED(rv)) { - pPrefs->GetBoolPref("print.use_native_print_dialog", &doNativeDialog); - } - - if (doNativeDialog || aQuiet) { -#ifdef MOZ_REQUIRE_CURRENT_SDK - if (mUseExtendedPrintDlg) { - rv = ShowNativePrintDialogEx(aWidget, aQuiet); - } else { - rv = ShowNativePrintDialog(aWidget, aQuiet); - } -#else - rv = ShowNativePrintDialog(aWidget, aQuiet); -#endif - } else { - rv = ShowXPPrintDialog(aQuiet); - } - - return rv; -} - -//---------------------------------------------------------- -// Helper Function - Free and reallocate the string -static void CleanAndCopyString(char*& aStr, char* aNewStr) -{ - if (aStr != nsnull) { - if (aNewStr != nsnull && strlen(aStr) > strlen(aNewStr)) { // reuse it if we can - PL_strcpy(aStr, aNewStr); - return; - } else { - PR_Free(aStr); - aStr = nsnull; - } - } - - if (nsnull != aNewStr) { - aStr = (char *)PR_Malloc(PL_strlen(aNewStr) + 1); - PL_strcpy(aStr, aNewStr); - } -} - -//---------------------------------------------------------------------------------- -void nsDeviceContextSpecWin::SetDeviceName(char* aDeviceName) -{ - CleanAndCopyString(mDeviceName, aDeviceName); -} - -//---------------------------------------------------------------------------------- -void nsDeviceContextSpecWin::SetDriverName(char* aDriverName) -{ - CleanAndCopyString(mDriverName, aDriverName); -} - -//---------------------------------------------------------------------------------- -void nsDeviceContextSpecWin::SetGlobalDevMode(HGLOBAL aHGlobal) -{ - if (mGlobalDevMode) { - ::GlobalFree(mGlobalDevMode); - mGlobalDevMode = NULL; - } - mGlobalDevMode = aHGlobal; - mIsDEVMODEGlobalHandle = PR_TRUE; -} - -//---------------------------------------------------------------------------------- -void nsDeviceContextSpecWin::SetDevMode(LPDEVMODE aDevMode) -{ - if (mDevMode) free(mDevMode); - - mDevMode = aDevMode; - mIsDEVMODEGlobalHandle = PR_FALSE; -} - -//---------------------------------------------------------------------------------- -// Return localized bundle for resource strings -static nsresult -GetLocalizedBundle(const char * aPropFileName, nsIStringBundle** aStrBundle) -{ - NS_ENSURE_ARG_POINTER(aPropFileName); - NS_ENSURE_ARG_POINTER(aStrBundle); - - nsresult rv; - nsCOMPtr bundle; - - - // Create bundle - nsCOMPtr stringService = - do_GetService(kStringBundleServiceCID, &rv); - if (NS_SUCCEEDED(rv) && stringService) { - rv = stringService->CreateBundle(aPropFileName, aStrBundle); - } - - return rv; -} - -//-------------------------------------------------------- -// Return localized string -static nsresult -GetLocalizedString(nsIStringBundle* aStrBundle, const char* aKey, nsString& oVal) -{ - NS_ENSURE_ARG_POINTER(aStrBundle); - NS_ENSURE_ARG_POINTER(aKey); - - // Determine default label from string bundle - nsXPIDLString valUni; - nsAutoString key; - key.AssignWithConversion(aKey); - nsresult rv = aStrBundle->GetStringFromName(key.get(), getter_Copies(valUni)); - if (NS_SUCCEEDED(rv) && valUni) { - oVal.Assign(valUni); - } else { - oVal.Truncate(); - } - return rv; -} - -//-------------------------------------------------------- -// Set a multi-byte string in the control -static void SetTextOnWnd(HWND aControl, const nsString& aStr) -{ - char* pStr = nsDeviceContextWin::GetACPString(aStr); - if (pStr) { - ::SetWindowText(aControl, pStr); - delete [] pStr; - } -} - -//-------------------------------------------------------- -// Will get the control and localized string by "key" -static void SetText(HWND aParent, - UINT aId, - nsIStringBundle* aStrBundle, - const char* aKey) -{ - HWND wnd = GetDlgItem (aParent, aId); - if (!wnd) { - return; - } - nsAutoString str; - nsresult rv = GetLocalizedString(aStrBundle, aKey, str); - if (NS_SUCCEEDED(rv)) { - SetTextOnWnd(wnd, str); - } -} - -//-------------------------------------------------------- -static void SetRadio(HWND aParent, - UINT aId, - PRBool aIsSet, - PRBool isEnabled = PR_TRUE) -{ - HWND wnd = ::GetDlgItem (aParent, aId); - if (!wnd) { - return; - } - if (!isEnabled) { - ::EnableWindow(wnd, FALSE); - return; - } - ::EnableWindow(wnd, TRUE); - ::SendMessage(wnd, BM_SETCHECK, (WPARAM)aIsSet, (LPARAM)0); -} - -//-------------------------------------------------------- -static void SetRadioOfGroup(HWND aDlg, int aRadId) -{ - int radioIds[] = {rad4, rad5, rad6}; - int numRads = 3; - - for (int i=0;i strBundle; - if (NS_SUCCEEDED(GetLocalizedBundle(PRINTDLG_PROPERTIES, getter_AddRefs(strBundle)))) { - PRInt32 i = 0; - while (gAllPropKeys[i].mKeyStr != NULL) { - SetText(hdlg, gAllPropKeys[i].mKeyId, strBundle, gAllPropKeys[i].mKeyStr); - i++; - } - } - - // Set up radio buttons - if (aHowToEnableFrameUI == nsIPrintSettings::kFrameEnableAll) { - SetRadio(hdlg, rad4, PR_FALSE); - SetRadio(hdlg, rad5, PR_TRUE); - SetRadio(hdlg, rad6, PR_FALSE); - // set default so user doesn't have to actually press on it - gFrameSelectedRadioBtn = rad5; - - } else if (aHowToEnableFrameUI == nsIPrintSettings::kFrameEnableAsIsAndEach) { - SetRadio(hdlg, rad4, PR_FALSE); - SetRadio(hdlg, rad5, PR_FALSE, PR_FALSE); - SetRadio(hdlg, rad6, PR_TRUE); - // set default so user doesn't have to actually press on it - gFrameSelectedRadioBtn = rad6; - - - } else { // nsIPrintSettings::kFrameEnableNone - // we are using this function to disabe the group box - SetRadio(hdlg, grp3, PR_FALSE, PR_FALSE); - // now disable radiobuttons - SetRadio(hdlg, rad4, PR_FALSE, PR_FALSE); - SetRadio(hdlg, rad5, PR_FALSE, PR_FALSE); - SetRadio(hdlg, rad6, PR_FALSE, PR_FALSE); - } - -} - - -//-------------------------------------------------------- -// Special Hook Procedure for handling the print dialog messages -UINT CALLBACK PrintHookProc(HWND hdlg, UINT uiMsg, WPARAM wParam, LPARAM lParam) -{ - - if (uiMsg == WM_COMMAND) { - UINT id = LOWORD(wParam); - if (id == rad4 || id == rad5 || id == rad6) { - gFrameSelectedRadioBtn = id; - SetRadioOfGroup(hdlg, id); - } - - } else if (uiMsg == WM_INITDIALOG) { - PRINTDLG * printDlg = (PRINTDLG *)lParam; - if (printDlg == NULL) return 0L; - - PRInt16 howToEnableFrameUI = (PRInt16)printDlg->lCustData; - - HINSTANCE hInst = (HINSTANCE)::GetWindowLong(hdlg, GWL_HINSTANCE); - if (hInst == NULL) return 0L; - - // Start by getting the local rects of several of the controls - // so we can calculate where the new controls are - HWND wnd = ::GetDlgItem(hdlg, grp1); - if (wnd == NULL) return 0L; - RECT dlgRect; - GetLocalRect(wnd, dlgRect, hdlg); - - wnd = ::GetDlgItem(hdlg, rad1); // this is the top control "All" - if (wnd == NULL) return 0L; - RECT rad1Rect; - GetLocalRect(wnd, rad1Rect, hdlg); - - wnd = ::GetDlgItem(hdlg, rad2); // this is the bottom control "Selection" - if (wnd == NULL) return 0L; - RECT rad2Rect; - GetLocalRect(wnd, rad2Rect, hdlg); - - wnd = ::GetDlgItem(hdlg, rad3); // this is the middle control "Pages" - if (wnd == NULL) return 0L; - RECT rad3Rect; - GetLocalRect(wnd, rad3Rect, hdlg); - - HWND okWnd = ::GetDlgItem(hdlg, IDOK); - if (okWnd == NULL) return 0L; - RECT okRect; - GetLocalRect(okWnd, okRect, hdlg); - - wnd = ::GetDlgItem(hdlg, grp4); // this is the "Print range" groupbox - if (wnd == NULL) return 0L; - RECT prtRect; - GetLocalRect(wnd, prtRect, hdlg); - - - // calculate various different "gaps" for layout purposes - - int rbGap = rad3Rect.top - rad1Rect.bottom; // gap between radiobtns - int grpBotGap = dlgRect.bottom - rad2Rect.bottom; // gap from bottom rb to bottom of grpbox - int grpGap = dlgRect.top - prtRect.bottom ; // gap between group boxes - int top = dlgRect.bottom + grpGap; - int radHgt = rad1Rect.bottom - rad1Rect.top + 1; // top of new group box - int y = top+(rad1Rect.top-dlgRect.top); // starting pos of first radio - int rbWidth = dlgRect.right - rad1Rect.left - 5; // measure from rb left to the edge of the groupbox - // (5 is arbitrary) - nsRect rect; - - // Create and position the radio buttons - // - // If any one control cannot be created then - // hide the others and bail out - // - rect.SetRect(rad1Rect.left, y, rbWidth,radHgt); - HWND rad4Wnd = CreateRadioBtn(hInst, hdlg, rad4, kAsLaidOutOnScreenStr, rect); - if (rad4Wnd == NULL) return 0L; - y += radHgt + rbGap; - - rect.SetRect(rad1Rect.left, y, rbWidth, radHgt); - HWND rad5Wnd = CreateRadioBtn(hInst, hdlg, rad5, kTheSelectedFrameStr, rect); - if (rad5Wnd == NULL) { - Show(rad4Wnd, FALSE); // hide - return 0L; - } - y += radHgt + rbGap; - - rect.SetRect(rad1Rect.left, y, rbWidth, radHgt); - HWND rad6Wnd = CreateRadioBtn(hInst, hdlg, rad6, kEachFrameSeparately, rect); - if (rad6Wnd == NULL) { - Show(rad4Wnd, FALSE); // hide - Show(rad5Wnd, FALSE); // hide - return 0L; - } - y += radHgt + grpBotGap; - - // Create and position the group box - rect.SetRect (dlgRect.left, top, dlgRect.right-dlgRect.left+1, y-top+1); - HWND grpBoxWnd = CreateGroupBox(hInst, hdlg, grp3, NS_LITERAL_STRING("Print Frame"), rect); - if (grpBoxWnd == NULL) { - Show(rad4Wnd, FALSE); // hide - Show(rad5Wnd, FALSE); // hide - Show(rad6Wnd, FALSE); // hide - return 0L; - } - - // Here we figure out the old height of the dlg - // then figure it's gap from the old grpbx to the bottom - // then size the dlg - RECT pr, cr; - ::GetWindowRect(hdlg, &pr); - ::GetClientRect(hdlg, &cr); - - int dlgHgt = (cr.bottom - cr.top) + 1; - int bottomGap = dlgHgt - okRect.bottom; - pr.bottom += (dlgRect.bottom-dlgRect.top) + grpGap + 1 - (dlgHgt-dlgRect.bottom) + bottomGap; - - ::SetWindowPos(hdlg, NULL, pr.left, pr.top, pr.right-pr.left+1, pr.bottom-pr.top+1, - SWP_NOMOVE|SWP_NOREDRAW|SWP_NOZORDER); - - // figure out the new height of the dialog - ::GetClientRect(hdlg, &cr); - dlgHgt = (cr.bottom - cr.top) + 1; - - // Reposition the OK and Cancel btns - int okHgt = okRect.bottom - okRect.top + 1; - ::SetWindowPos(okWnd, NULL, okRect.left, dlgHgt-bottomGap-okHgt, 0, 0, - SWP_NOSIZE|SWP_NOREDRAW|SWP_NOZORDER); - - HWND cancelWnd = ::GetDlgItem(hdlg, IDCANCEL); - if (cancelWnd == NULL) return 0L; - - RECT cancelRect; - GetLocalRect(cancelWnd, cancelRect, hdlg); - int cancelHgt = cancelRect.bottom - cancelRect.top + 1; - ::SetWindowPos(cancelWnd, NULL, cancelRect.left, dlgHgt-bottomGap-cancelHgt, 0, 0, - SWP_NOSIZE|SWP_NOREDRAW|SWP_NOZORDER); - - // localize and initialize the groupbox and radiobuttons - InitializeExtendedDialog(hdlg, howToEnableFrameUI); - - // Looks like we were able to extend the dialog - gDialogWasExtended = PR_TRUE; - } - return 0L; -} - -//---------------------------------------------------------------------------------- -// Returns a Global Moveable Memory Handle to a DevMode -// from the Printer byt the name of aPrintName -static HGLOBAL CreateGlobalDevModeAndInit(LPTSTR aPrintName, nsIPrintSettings* aPS) -{ - HGLOBAL hGlobalDevMode = NULL; - - nsresult rv = NS_ERROR_FAILURE; - HANDLE hPrinter = NULL; - BOOL status = ::OpenPrinter(aPrintName, &hPrinter, NULL); - if (status) { - - LPDEVMODE pNewDevMode; - DWORD dwNeeded, dwRet; - - // Allocate a buffer of the correct size. - dwNeeded = ::DocumentProperties(gParentWnd, hPrinter, aPrintName, NULL, NULL, 0); - - pNewDevMode = (LPDEVMODE)malloc(dwNeeded); - if (!pNewDevMode) return NULL; - - hGlobalDevMode = (HGLOBAL)::GlobalAlloc(GHND, dwNeeded); - if (!hGlobalDevMode) { - free(pNewDevMode); - } - - dwRet = ::DocumentProperties(gParentWnd, hPrinter, aPrintName, pNewDevMode, NULL, DM_OUT_BUFFER); - - if (dwRet != IDOK) { - free(pNewDevMode); - ::GlobalFree(hGlobalDevMode); - ::ClosePrinter(hPrinter); - return NULL; - } - - // Lock memory and copy contents from DEVMODE (current printer) - // to Global Memory DEVMODE - LPDEVMODE devMode = (DEVMODE *)::GlobalLock(hGlobalDevMode); - if (devMode) { - memcpy(devMode, pNewDevMode, dwNeeded); - // Initialize values from the PrintSettings - SetupDevModeFromSettings(devMode, aPS); - ::GlobalUnlock(hGlobalDevMode); - } else { - ::GlobalFree(hGlobalDevMode); - hGlobalDevMode = NULL; - } - - free(pNewDevMode); - - ::ClosePrinter(hPrinter); - - } else { - return NULL; - } - - return hGlobalDevMode; -} - -//------------------------------------------------------------------ -// helper -static PRUnichar * GetDefaultPrinterNameFromGlobalPrinters() -{ - PRUnichar * printerName; - LPTSTR lpPrtName; - GlobalPrinters::GetInstance()->GetDefaultPrinterName(lpPrtName); - nsString str; -#ifdef UNICODE - str.AppendWithConversion((PRUnichar *)lpPrtName); -#else - str.AssignWithConversion((char*)lpPrtName); -#endif - printerName = ToNewUnicode(str); - free(lpPrtName); - return printerName; -} - - -//------------------------------------------------------------------ -void -nsDeviceContextSpecWin::GetDevMode(LPDEVMODE &aDevMode) -{ - if (mIsDEVMODEGlobalHandle) { - if (mGlobalDevMode) { - aDevMode = (DEVMODE *)::GlobalLock(mGlobalDevMode); - } else { - aDevMode = NULL; - } - } else { - aDevMode = mDevMode; - } -} - -//------------------------------------------------------------------ -// Displays the native Print Dialog -nsresult -nsDeviceContextSpecWin::ShowNativePrintDialog(nsIWidget *aWidget, PRBool aQuiet) -{ - NS_ENSURE_ARG_POINTER(aWidget); - nsresult rv = NS_ERROR_FAILURE; - gDialogWasExtended = PR_FALSE; - - HGLOBAL hGlobalDevMode = NULL; - HGLOBAL hDevNames = NULL; - - // Get the Print Name to be used - PRUnichar * printerName; - mPrintSettings->GetPrinterName(&printerName); - - // If there is no name then use the default printer - if (!printerName || (printerName && !*printerName)) { - printerName = GetDefaultPrinterNameFromGlobalPrinters(); - } - - NS_ASSERTION(printerName, "We have to have a printer name"); - if (!printerName) return NS_ERROR_FAILURE; - - if (!aQuiet) { - // Now create a DEVNAMES struct so the the dialog is initialized correctly. - PRUint32 len = nsCRT::strlen(printerName); - PRUint32 len2 = len+sizeof(DEVNAMES); - hDevNames = (HGLOBAL)::GlobalAlloc(GHND, len+sizeof(DEVNAMES)+1); - DEVNAMES* pDevNames = (DEVNAMES*)::GlobalLock(hDevNames); - pDevNames->wDriverOffset = sizeof(DEVNAMES); - pDevNames->wDeviceOffset = sizeof(DEVNAMES); - pDevNames->wOutputOffset = sizeof(DEVNAMES)+len+1; - pDevNames->wDefault = 0; - char* device = &(((char*)pDevNames)[pDevNames->wDeviceOffset]); - strcpy(device, (char*)NS_ConvertUCS2toUTF8(printerName).get()); - ::GlobalUnlock(hDevNames); - - // Create a Moveable Memory Object that holds a new DevMode - // from the Printer Name - // The PRINTDLG.hDevMode requires that it be a moveable memory object - // NOTE: We only need to free hGlobalDevMode when the dialog is cancelled - // When the user prints, it comes back in the printdlg struct and - // is used and cleaned up later -#ifdef UNICODE - hGlobalDevMode = CreateGlobalDevModeAndInit(printerName, mPrintSettings); -#else - hGlobalDevMode = CreateGlobalDevModeAndInit((char*)NS_ConvertUCS2toUTF8(printerName).get(), mPrintSettings); -#endif - } else { - // For aQuiet create a LPDEVMODE from the printer name - // set it into the mDeviceMode - // then transfer the appropriate PrintSettnigs to it. - return GetDataFromPrinter(printerName, mPrintSettings); - } - - // Prepare to Display the Print Dialog - PRINTDLG prntdlg; - memset(&prntdlg, 0, sizeof(PRINTDLG)); - - prntdlg.lStructSize = sizeof(prntdlg); - prntdlg.hwndOwner = (HWND)aWidget->GetNativeData(NS_NATIVE_WINDOW); - prntdlg.hDevMode = hGlobalDevMode; - prntdlg.hDevNames = hDevNames; - prntdlg.hDC = NULL; - prntdlg.Flags = PD_ALLPAGES | PD_RETURNIC | PD_HIDEPRINTTOFILE | PD_USEDEVMODECOPIESANDCOLLATE; - - // if there is a current selection then enable the "Selection" radio button - PRInt16 howToEnableFrameUI = nsIPrintSettings::kFrameEnableNone; - if (mPrintSettings != nsnull) { - PRBool isOn; - mPrintSettings->GetPrintOptions(nsIPrintSettings::kEnableSelectionRB, &isOn); - if (!isOn) { - prntdlg.Flags |= PD_NOSELECTION; - } - mPrintSettings->GetHowToEnableFrameUI(&howToEnableFrameUI); - } - - // Determine whether we have a completely native dialog - // or whether we cshould extend it - // true - do only the native - // false - extend the dialog - PRPackedBool doExtend = PR_FALSE; - nsCOMPtr strBundle; - if (NS_SUCCEEDED(GetLocalizedBundle(PRINTDLG_PROPERTIES, getter_AddRefs(strBundle)))) { - nsAutoString doExtendStr; - if (NS_SUCCEEDED(GetLocalizedString(strBundle, "extend", doExtendStr))) { - doExtend = doExtendStr.Equals(NS_LITERAL_STRING("true")); - } - } - - prntdlg.nFromPage = 0xFFFF; - prntdlg.nToPage = 0xFFFF; - prntdlg.nMinPage = 1; - prntdlg.nMaxPage = 0xFFFF; - prntdlg.nCopies = 1; - prntdlg.lpfnSetupHook = NULL; - prntdlg.lpSetupTemplateName = NULL; - prntdlg.hPrintTemplate = NULL; - prntdlg.hSetupTemplate = NULL; - - prntdlg.hInstance = NULL; - prntdlg.lpPrintTemplateName = NULL; - - if (!doExtend) { - prntdlg.lCustData = NULL; - prntdlg.lpfnPrintHook = NULL; - } else { - // Set up print dialog "hook" procedure for extending the dialog - prntdlg.lCustData = (DWORD)howToEnableFrameUI; - prntdlg.lpfnPrintHook = (LPPRINTHOOKPROC)PrintHookProc; - prntdlg.Flags |= PD_ENABLEPRINTHOOK; - } - - BOOL result = ::PrintDlg(&prntdlg); - - if (TRUE == result) { - if (mPrintSettings && prntdlg.hDevMode != NULL) { - // Transfer the settings from the native data to the PrintSettings - LPDEVMODE devMode = (LPDEVMODE)::GlobalLock(prntdlg.hDevMode); - SetPrintSettingsFromDevMode(mPrintSettings, devMode); - ::GlobalUnlock(prntdlg.hDevMode); - } - DEVNAMES *devnames = (DEVNAMES *)::GlobalLock(prntdlg.hDevNames); - if ( NULL != devnames ) { - - char* device = &(((char *)devnames)[devnames->wDeviceOffset]); - char* driver = &(((char *)devnames)[devnames->wDriverOffset]); - - // Setup local Data members - SetDeviceName(device); - SetDriverName(driver); - -#if defined(DEBUG_rods) || defined(DEBUG_dcone) - printf("printer: driver %s, device %s flags: %d\n", driver, device, prntdlg.Flags); -#endif - // fill the print options with the info from the dialog - if (mPrintSettings != nsnull) { - nsString printerName; - printerName.AssignWithConversion(device); - - mPrintSettings->SetPrinterName(printerName.get()); - - if (prntdlg.Flags & PD_SELECTION) { - mPrintSettings->SetPrintRange(nsIPrintSettings::kRangeSelection); - - } else if (prntdlg.Flags & PD_PAGENUMS) { - mPrintSettings->SetPrintRange(nsIPrintSettings::kRangeSpecifiedPageRange); - mPrintSettings->SetStartPageRange(prntdlg.nFromPage); - mPrintSettings->SetEndPageRange( prntdlg.nToPage); - - } else { // (prntdlg.Flags & PD_ALLPAGES) - mPrintSettings->SetPrintRange(nsIPrintSettings::kRangeAllPages); - } - - if (howToEnableFrameUI != nsIPrintSettings::kFrameEnableNone) { - // make sure the dialog got extended - if (gDialogWasExtended) { - // check to see about the frame radio buttons - switch (gFrameSelectedRadioBtn) { - case rad4: - mPrintSettings->SetPrintFrameType(nsIPrintSettings::kFramesAsIs); - break; - case rad5: - mPrintSettings->SetPrintFrameType(nsIPrintSettings::kSelectedFrame); - break; - case rad6: - mPrintSettings->SetPrintFrameType(nsIPrintSettings::kEachFrameSep); - break; - } // switch - } else { - // if it didn't get extended then have it default to printing - // each frame separately - mPrintSettings->SetPrintFrameType(nsIPrintSettings::kEachFrameSep); - } - } else { - mPrintSettings->SetPrintFrameType(nsIPrintSettings::kNoFrames); - } - } - ::GlobalUnlock(prntdlg.hDevNames); - -#if defined(DEBUG_rods) || defined(DEBUG_dcone) - PRBool printSelection = prntdlg.Flags & PD_SELECTION; - PRBool printAllPages = prntdlg.Flags & PD_ALLPAGES; - PRBool printNumPages = prntdlg.Flags & PD_PAGENUMS; - PRInt32 fromPageNum = 0; - PRInt32 toPageNum = 0; - - if (printNumPages) { - fromPageNum = prntdlg.nFromPage; - toPageNum = prntdlg.nToPage; - } - if (printSelection) { - printf("Printing the selection\n"); - - } else if (printAllPages) { - printf("Printing all the pages\n"); - - } else { - printf("Printing from page no. %d to %d\n", fromPageNum, toPageNum); - } -#endif - - SetGlobalDevMode(prntdlg.hDevMode); - - // Set into DevMode Paper Size and Orientation here - // remove comment if you want to override the values from - // the native setup with those specified in the Page Setup - // mainly Paper Size, Orientation - if (aQuiet) { - SetupPaperInfoFromSettings(); - } - - } - } else { - ::GlobalFree(hGlobalDevMode); - return NS_ERROR_ABORT; - } - - return NS_OK; -} - - -#ifdef MOZ_REQUIRE_CURRENT_SDK -//------------------------------------------------------------------ -// Callback for Property Sheet -BOOL APIENTRY PropSheetCallBack(HWND hdlg, UINT uiMsg, UINT wParam, LONG lParam) -{ - if (uiMsg == WM_COMMAND) { - UINT id = LOWORD(wParam); - if (id == rad4 || id == rad5 || id == rad6) { - gFrameSelectedRadioBtn = id; - SetRadioOfGroup(hdlg, id); - } - - } else if (uiMsg == WM_INITDIALOG) { - // Create the groupbox and Radiobuttons on the "Options" Property Sheet - - // We temporarily borrowed the global value for initialization - // now clear it before the dialog appears - PRInt16 howToEnableFrameUI = gFrameSelectedRadioBtn; - gFrameSelectedRadioBtn = 0; - - HINSTANCE hInst = (HINSTANCE)::GetWindowLong(hdlg, GWL_HINSTANCE); - if (hInst == NULL) return 0L; - - // Get default font for the dialog & then its font metrics - // we need the text height to determine the height of the radio buttons - TEXTMETRIC metrics; - HFONT hFont = (HFONT)::SendMessage(hdlg, WM_GETFONT, (WPARAM)0, (LPARAM)0); - HDC localDC = ::GetDC(hdlg); - ::SelectObject(localDC, (HGDIOBJ)hFont); - ::GetTextMetrics(localDC, &metrics); - ::ReleaseDC(hdlg, localDC); - - // calculate various different "gaps" for layout purposes - RECT dlgr; - ::GetWindowRect(hdlg, &dlgr); - - int horzGap = 5; // generic horz gap - int vertGap = 5; // generic vert gap - int rbGap = metrics.tmHeight / 2; // gap between radiobtns - int top = vertGap*2; // start at the top - int radHgt = metrics.tmHeight; // top of new group box - int y = top; // starting pos of first radio - int x = horzGap*2; - int rbWidth = dlgr.right - dlgr.left - (5*horzGap); - int grpWidth = dlgr.right - dlgr.left - (2*horzGap); - - nsRect rect; - - // Create and position the radio buttons - // - // If any one control cannot be created then - // hide the others and bail out - // - x += horzGap*2; - y += vertGap + metrics.tmHeight; - rect.SetRect(x, y, rbWidth,radHgt); - HWND rad4Wnd = CreateRadioBtn(hInst, hdlg, rad4, kAsLaidOutOnScreenStr, rect); - if (rad4Wnd == NULL) return 0L; - y += radHgt + rbGap; - - rect.SetRect(x, y, rbWidth, radHgt); - HWND rad5Wnd = CreateRadioBtn(hInst, hdlg, rad5, kTheSelectedFrameStr, rect); - if (rad5Wnd == NULL) { - Show(rad4Wnd, FALSE); // hide - return 0L; - } - y += radHgt + rbGap; - - rect.SetRect(x, y, rbWidth, radHgt); - HWND rad6Wnd = CreateRadioBtn(hInst, hdlg, rad6, kEachFrameSeparately, rect); - if (rad6Wnd == NULL) { - Show(rad4Wnd, FALSE); // hide - Show(rad5Wnd, FALSE); // hide - return 0L; - } - y += radHgt + (vertGap*2); - - x -= horzGap*2; - // Create and position the group box - rect.SetRect (x, top, grpWidth, y-top+1); - HWND grpBoxWnd = CreateGroupBox(hInst, hdlg, grp3, NS_LITERAL_STRING("Print Frame"), rect); - if (grpBoxWnd == NULL) { - Show(rad4Wnd, FALSE); // hide - Show(rad5Wnd, FALSE); // hide - Show(rad6Wnd, FALSE); // hide - return 0L; - } - - // localize and initialize the groupbox and radiobuttons - InitializeExtendedDialog(hdlg, howToEnableFrameUI); - - // Looks like we were able to extend the dialog - gDialogWasExtended = PR_TRUE; - } - return 0L; -} - -//------------------------------------------------------------------ -// Creates the "Options" Property Sheet -static HPROPSHEETPAGE ExtendPrintDialog(HWND aHWnd, char* aTitle) -{ - // The resource "OPTPROPSHEET" comes out of the widget/build/widget.rc file - HINSTANCE hInst = (HINSTANCE)::GetWindowLong(aHWnd, GWL_HINSTANCE); - PROPSHEETPAGE psp; - memset(&psp, 0, sizeof(PROPSHEETPAGE)); - psp.dwSize = sizeof(PROPSHEETPAGE); - psp.dwFlags = PSP_USETITLE | PSP_PREMATURE; - psp.hInstance = hInst; - psp.pszTemplate = "OPTPROPSHEET"; - psp.pfnDlgProc = PropSheetCallBack; - psp.pszTitle = aTitle?aTitle:"Options"; - - HPROPSHEETPAGE newPropSheet = ::CreatePropertySheetPage(&psp); - return newPropSheet; - -} - -//------------------------------------------------------------------ -// Displays the native Print Dialog -nsresult -nsDeviceContextSpecWin::ShowNativePrintDialogEx(nsIWidget *aWidget, PRBool aQuiet) -{ - NS_ENSURE_ARG_POINTER(aWidget); - - nsresult rv = NS_ERROR_FAILURE; - gDialogWasExtended = PR_FALSE; - - // Create a Moveable Memory Object that holds a new DevMode - // from the Printer Name - // The PRINTDLG.hDevMode requires that it be a moveable memory object - // NOTE: We only need to free hGlobalDevMode when the dialog is cancelled - // When the user prints, it comes back in the printdlg struct and - // is used and cleaned up later - PRUnichar * printerName; - mPrintSettings->GetPrinterName(&printerName); - HGLOBAL hGlobalDevMode = NULL; - if (printerName) { -#ifdef UNICODE - hGlobalDevMode = CreateGlobalDevModeAndInit(printerName, mPrintSettings); -#else - hGlobalDevMode = CreateGlobalDevModeAndInit((char*)NS_ConvertUCS2toUTF8(printerName).get(), mPrintSettings); -#endif - } - - // Prepare to Display the Print Dialog - PRINTDLGEX prntdlg; - memset(&prntdlg, 0, sizeof(PRINTDLGEX)); - - prntdlg.lStructSize = sizeof(prntdlg); - prntdlg.hwndOwner = (HWND)aWidget->GetNativeData(NS_NATIVE_WINDOW); - prntdlg.hDevMode = hGlobalDevMode; - prntdlg.Flags = PD_ALLPAGES | PD_RETURNDC | PD_HIDEPRINTTOFILE | PD_USEDEVMODECOPIESANDCOLLATE | - PD_NOCURRENTPAGE; - prntdlg.nStartPage = START_PAGE_GENERAL; - - // if there is a current selection then enable the "Selection" radio button - PRInt16 howToEnableFrameUI = nsIPrintSettings::kFrameEnableNone; - if (mPrintSettings != nsnull) { - PRBool isOn; - mPrintSettings->GetPrintOptions(nsIPrintSettings::kEnableSelectionRB, &isOn); - if (!isOn) { - prntdlg.Flags |= PD_NOSELECTION; - } - mPrintSettings->GetHowToEnableFrameUI(&howToEnableFrameUI); - } - - // Determine whether we have a completely native dialog - // or whether we cshould extend it - // true - do only the native - // false - extend the dialog - PRPackedBool doExtend = PR_FALSE; - nsCOMPtr strBundle; - if (NS_SUCCEEDED(GetLocalizedBundle(PRINTDLG_PROPERTIES, getter_AddRefs(strBundle)))) { - nsAutoString doExtendStr; - if (NS_SUCCEEDED(GetLocalizedString(strBundle, "extend", doExtendStr))) { - doExtend = doExtendStr.EqualsIgnoreCase("true"); - } - } - - // At the moment we can only support one page range - // from all the documentation I can find, it appears that this - // will get cleanup automatically when the struct goes away - const int kNumPageRanges = 1; - LPPRINTPAGERANGE pPageRanges = (LPPRINTPAGERANGE) GlobalAlloc(GPTR, kNumPageRanges * sizeof(PRINTPAGERANGE)); - if (!pPageRanges) - return E_OUTOFMEMORY; - - prntdlg.nPageRanges = 0; - prntdlg.nMaxPageRanges = kNumPageRanges; - prntdlg.lpPageRanges = pPageRanges; - prntdlg.nMinPage = 1; - prntdlg.nMaxPage = 0xFFFF; - prntdlg.nCopies = 1; - - if (doExtend && !aQuiet) { - // lLcalize the Property Sheet (Tab) title - char* pTitle = NULL; - nsString optionsStr; - if (NS_SUCCEEDED(GetLocalizedString(strBundle, "options", optionsStr))) { - pTitle = nsDeviceContextWin::GetACPString(optionsStr); - } - - // Temporarily borrow this variable for setting up the radiobuttons - // if we don't use this, we will need to define a new global var - gFrameSelectedRadioBtn = howToEnableFrameUI; - HPROPSHEETPAGE psp[1]; - psp[0] = ExtendPrintDialog((HWND)aWidget->GetNativeData(NS_NATIVE_WINDOW), pTitle); - prntdlg.nPropertyPages = 1; - prntdlg.lphPropertyPages = psp; - } - - if (PR_TRUE == aQuiet){ - prntdlg.Flags = PD_ALLPAGES | PD_RETURNDEFAULT | PD_RETURNIC | PD_USEDEVMODECOPIESANDCOLLATE; - } - - HRESULT result = ::PrintDlgEx(&prntdlg); - - if (S_OK == result && - (prntdlg.dwResultAction == PD_RESULT_PRINT || - (prntdlg.dwResultAction == PD_RESULT_CANCEL && aQuiet))) { - if (mPrintSettings && prntdlg.hDevMode != NULL) { - // when it is quite use the printsettings passed - if (!aQuiet) { - LPDEVMODE devMode = (LPDEVMODE)::GlobalLock(prntdlg.hDevMode); - SetPrintSettingsFromDevMode(mPrintSettings, devMode); - ::GlobalUnlock(prntdlg.hDevMode); - } - } - DEVNAMES *devnames = (DEVNAMES *)::GlobalLock(prntdlg.hDevNames); - if ( NULL != devnames ) { - - char* device = &(((char *)devnames)[devnames->wDeviceOffset]); - char* driver = &(((char *)devnames)[devnames->wDriverOffset]); - - // Setup local Data members - SetDeviceName(device); - SetDriverName(driver); - -#if defined(DEBUG_rods) || defined(DEBUG_dcone) - printf("printer: driver %s, device %s flags: %d\n", driver, device, prntdlg.Flags); -#endif - ::GlobalUnlock(prntdlg.hDevNames); - - // fill the print options with the info from the dialog - if (mPrintSettings != nsnull) { - - if (prntdlg.Flags & PD_SELECTION) { - mPrintSettings->SetPrintRange(nsIPrintSettings::kRangeSelection); - - } else if (prntdlg.Flags & PD_PAGENUMS) { - mPrintSettings->SetPrintRange(nsIPrintSettings::kRangeSpecifiedPageRange); - mPrintSettings->SetStartPageRange(pPageRanges->nFromPage); - mPrintSettings->SetEndPageRange(pPageRanges->nToPage); - - } else { // (prntdlg.Flags & PD_ALLPAGES) - mPrintSettings->SetPrintRange(nsIPrintSettings::kRangeAllPages); - } - - if (howToEnableFrameUI != nsIPrintSettings::kFrameEnableNone) { - // make sure the dialog got extended - if (gDialogWasExtended) { - // check to see about the frame radio buttons - switch (gFrameSelectedRadioBtn) { - case rad4: - mPrintSettings->SetPrintFrameType(nsIPrintSettings::kFramesAsIs); - break; - case rad5: - mPrintSettings->SetPrintFrameType(nsIPrintSettings::kSelectedFrame); - break; - case rad6: - mPrintSettings->SetPrintFrameType(nsIPrintSettings::kEachFrameSep); - break; - } // switch - } else { - // if it didn't get extended then have it default to printing - // each frame separately - mPrintSettings->SetPrintFrameType(nsIPrintSettings::kEachFrameSep); - } - } else { - mPrintSettings->SetPrintFrameType(nsIPrintSettings::kNoFrames); - } - } - - -#if defined(DEBUG_rods) || defined(DEBUG_dcone) - PRBool printSelection = prntdlg.Flags & PD_SELECTION; - PRBool printAllPages = prntdlg.Flags & PD_ALLPAGES; - PRBool printNumPages = prntdlg.Flags & PD_PAGENUMS; - PRInt32 fromPageNum = 0; - PRInt32 toPageNum = 0; - - if (printNumPages) { - fromPageNum = pPageRanges->nFromPage; - toPageNum = pPageRanges->nToPage; - } - if (printSelection) { - printf("Printing the selection\n"); - - } else if (printAllPages) { - printf("Printing all the pages\n"); - - } else { - printf("Printing from page no. %d to %d\n", fromPageNum, toPageNum); - } -#endif - - SetGlobalDevMode(prntdlg.hDevMode); - - // Set into DevMode Paper Size and Orientation here - // remove comment if you want to override the values from - // the native setup with those specified in the Page Setup - // mainly Paper Size, Orientation - if (aQuiet) { - SetupPaperInfoFromSettings(); - } - - } - } else { - if (hGlobalDevMode) ::GlobalFree(hGlobalDevMode); - return NS_ERROR_ABORT; - } - - ::GlobalFree(pPageRanges); - - return NS_OK; -} -#endif // MOZ_REQUIRE_CURRENT_SDK - //---------------------------------------------------------------------------------- // Setup the object's data member with the selected printer's data nsresult @@ -1616,92 +693,64 @@ nsDeviceContextSpecWin::SetupPaperInfoFromSettings() } //---------------------------------------------------------------------------------- +// Helper Function - Free and reallocate the string nsresult -nsDeviceContextSpecWin::ShowXPPrintDialog(PRBool aQuiet) +nsDeviceContextSpecWin::SetPrintSettingsFromDevMode(nsIPrintSettings* aPrintSettings, + LPDEVMODE aDevMode) { - nsresult rv = NS_ERROR_FAILURE; + if (aPrintSettings == nsnull) { + return NS_ERROR_FAILURE; + } + BOOL doingNumCopies = aDevMode->dmFields & DM_COPIES; + BOOL doingOrientation = aDevMode->dmFields & DM_ORIENTATION; + BOOL doingPaperSize = aDevMode->dmFields & DM_PAPERSIZE; + BOOL doingPaperLength = aDevMode->dmFields & DM_PAPERLENGTH; + BOOL doingPaperWidth = aDevMode->dmFields & DM_PAPERWIDTH; - NS_ASSERTION(mPrintSettings, "Can't have a null PrintSettings!"); - - // if there is a current selection then enable the "Selection" radio button - PRBool isOn; - mPrintSettings->GetPrintOptions(nsIPrintSettings::kEnableSelectionRB, &isOn); - nsCOMPtr pPrefs = do_GetService(NS_PREF_CONTRACTID, &rv); - if (NS_SUCCEEDED(rv)) { - (void) pPrefs->SetBoolPref("print.selection_radio_enabled", isOn); + if (doingOrientation) { + PRInt32 orientation = aDevMode->dmOrientation == DMORIENT_PORTRAIT? + nsIPrintSettings::kPortraitOrientation:nsIPrintSettings::kLandscapeOrientation; + aPrintSettings->SetOrientation(orientation); } - PRBool canPrint = PR_FALSE; - if (!aQuiet ) { - rv = NS_ERROR_FAILURE; + // Setup Number of Copies + if (doingNumCopies) { + aPrintSettings->SetNumCopies(PRInt32(aDevMode->dmCopies)); + } - // create a nsISupportsArray of the parameters - // being passed to the window - nsCOMPtr array; - NS_NewISupportsArray(getter_AddRefs(array)); - if (!array) return NS_ERROR_FAILURE; + if (aDevMode->dmFields & DM_SCALE) { + double scale = double(aDevMode->dmScale) / 100.0f; + if (scale != 1.0) { + aPrintSettings->SetScaling(scale); + aDevMode->dmScale = 100; + // To turn this on you must change where the mPrt->mShrinkToFit is being set in the DocumentViewer + //aPrintSettings->SetShrinkToFit(PR_FALSE); + } + } - nsCOMPtr psSupports(do_QueryInterface(mPrintSettings)); - NS_ASSERTION(psSupports, "PrintSettings must be a supports"); - array->AppendElement(psSupports); + if (doingPaperSize) { + aPrintSettings->SetPaperSizeType(nsIPrintSettings::kPaperSizeNativeData); + aPrintSettings->SetPaperData(aDevMode->dmPaperSize); - nsCOMPtr ioParamBlock(do_CreateInstance("@mozilla.org/embedcomp/dialogparam;1")); - if (ioParamBlock) { - ioParamBlock->SetInt(0, 0); - nsCOMPtr blkSupps(do_QueryInterface(ioParamBlock)); - NS_ASSERTION(blkSupps, "IOBlk must be a supports"); - - array->AppendElement(blkSupps); - nsCOMPtr arguments(do_QueryInterface(array)); - NS_ASSERTION(array, "array must be a supports"); - - nsCOMPtr wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1")); - if (wwatch) { - nsCOMPtr active; - wwatch->GetActiveWindow(getter_AddRefs(active)); - nsCOMPtr parent = do_QueryInterface(active); - - nsCOMPtr newWindow; - rv = wwatch->OpenWindow(parent, "chrome://global/content/printdialog.xul", - "_blank", "chrome,modal,centerscreen", array, - getter_AddRefs(newWindow)); + } else if (doingPaperLength && doingPaperWidth) { + PRBool found = PR_FALSE; + for (PRInt32 i=0;idmPaperSize) { + aPrintSettings->SetPaperSizeType(nsIPrintSettings::kPaperSizeDefined); + aPrintSettings->SetPaperWidth(kPaperSizes[i].mWidth); + aPrintSettings->SetPaperHeight(kPaperSizes[i].mHeight); + aPrintSettings->SetPaperSizeUnit(kPaperSizes[i].mIsInches?nsIPrintSettings::kPaperSizeInches:nsIPrintSettings::kPaperSizeInches); + found = PR_TRUE; + break; } } - - if (NS_SUCCEEDED(rv)) { - PRInt32 buttonPressed = 0; - ioParamBlock->GetInt(0, &buttonPressed); - if (buttonPressed == 1) { - canPrint = PR_TRUE; - } else { - rv = NS_ERROR_ABORT; - } + if (!found) { + return NS_ERROR_FAILURE; } } else { - canPrint = PR_TRUE; + return NS_ERROR_FAILURE; } - - if (canPrint) { - if (mPrintSettings != nsnull) { - PRUnichar *printerName = nsnull; - mPrintSettings->GetPrinterName(&printerName); - - if (printerName != nsnull) { - // Gets DEVMODE, Device and Driver Names - rv = GetDataFromPrinter(printerName, mPrintSettings); - - nsMemory::Free(printerName); - } else { - rv = NS_ERROR_OUT_OF_MEMORY; - } - } - return NS_OK; - } - - // Free them, we won't need them for a while - GlobalPrinters::GetInstance()->FreeGlobalPrinters(); - - return rv; + return NS_OK; } //*********************************************************** diff --git a/gfx/src/windows/nsDeviceContextSpecWin.h b/gfx/src/windows/nsDeviceContextSpecWin.h index 91254c7a731..af22b266e65 100644 --- a/gfx/src/windows/nsDeviceContextSpecWin.h +++ b/gfx/src/windows/nsDeviceContextSpecWin.h @@ -51,7 +51,7 @@ public: NS_DECL_ISUPPORTS - NS_IMETHOD Init(nsIWidget* aWidget, nsIPrintSettings* aPS, PRBool aQuiet); + NS_IMETHOD Init(nsIWidget* aWidget, nsIPrintSettings* aPS, PRBool aIsPrintPreview); void GetDriverName(char *&aDriverName) const { aDriverName = mDriverName; } void GetDeviceName(char *&aDeviceName) const { aDeviceName = mDeviceName; } @@ -70,12 +70,6 @@ public: LPDEVMODE aDevMode); protected: - nsresult ShowXPPrintDialog(PRBool aQuiet); - nsresult ShowNativePrintDialog(nsIWidget* aWidget, PRBool aQuiet); - -#ifdef MOZ_REQUIRE_CURRENT_SDK - nsresult ShowNativePrintDialogEx(nsIWidget* aWidget, PRBool aQuiet); -#endif void SetDeviceName(char* aDeviceName); void SetDriverName(char* aDriverName); @@ -93,9 +87,6 @@ protected: PRBool mIsDEVMODEGlobalHandle; nsCOMPtr mPrintSettings; - - // For PrintDlgEx - FARPROC mUseExtendedPrintDlg; }; diff --git a/gfx/src/windows/nsDeviceContextWin.cpp b/gfx/src/windows/nsDeviceContextWin.cpp index 14d7ae71255..3a5d584f161 100644 --- a/gfx/src/windows/nsDeviceContextWin.cpp +++ b/gfx/src/windows/nsDeviceContextWin.cpp @@ -47,10 +47,7 @@ #include "nsGfxCIID.h" #include "nsReadableutils.h" -// Print Options -#include "nsIPrintOptions.h" #include "nsString.h" -static NS_DEFINE_CID(kPrintOptionsCID, NS_PRINTOPTIONS_CID); #define DOC_TITLE_LENGTH 64 @@ -755,7 +752,7 @@ static void DisplayLastError() #endif -NS_IMETHODIMP nsDeviceContextWin :: BeginDocument(PRUnichar * aTitle) +NS_IMETHODIMP nsDeviceContextWin :: BeginDocument(PRUnichar * aTitle, PRUnichar* aPrintToFileName, PRInt32 aStartPage, PRInt32 aEndPage) { nsresult rv = NS_ERROR_GFX_PRINTER_STARTDOC; @@ -771,21 +768,9 @@ NS_IMETHODIMP nsDeviceContextWin :: BeginDocument(PRUnichar * aTitle) char *title = GetACPString(titleStr); char* docName = nsnull; - nsCOMPtr printService = do_GetService(kPrintOptionsCID, &rv); - if (printService) { - PRBool printToFile = PR_FALSE; - printService->GetPrintToFile(&printToFile); - if (printToFile) { - PRUnichar* uStr; - printService->GetToFileName(&uStr); - if (uStr != nsnull) { - nsAutoString str(uStr); - if (str.Length() > 0) { - docName = ToNewCString(str); - } - nsMemory::Free(uStr); - } - } + nsAutoString str(aPrintToFileName); + if (str.Length() > 0) { + docName = ToNewCString(str); } docinfo.cbSize = sizeof(docinfo); docinfo.lpszDocName = title != nsnull?title:"Mozilla Document"; diff --git a/gfx/src/windows/nsDeviceContextWin.h b/gfx/src/windows/nsDeviceContextWin.h index 90895b4c119..db4c33c9d6f 100644 --- a/gfx/src/windows/nsDeviceContextWin.h +++ b/gfx/src/windows/nsDeviceContextWin.h @@ -84,7 +84,7 @@ public: NS_IMETHOD GetDeviceContextFor(nsIDeviceContextSpec *aDevice, nsIDeviceContext *&aContext); - NS_IMETHOD BeginDocument(PRUnichar * aTitle); + NS_IMETHOD BeginDocument(PRUnichar * aTitle, PRUnichar* aPrintToFileName, PRInt32 aStartPage, PRInt32 aEndPage); NS_IMETHOD EndDocument(void); NS_IMETHOD AbortDocument(void); diff --git a/gfx/src/windows/nsPrintSettingsWin.cpp b/gfx/src/windows/nsPrintSettingsWin.cpp index 9b0eb4d65c1..734ea54d732 100644 --- a/gfx/src/windows/nsPrintSettingsWin.cpp +++ b/gfx/src/windows/nsPrintSettingsWin.cpp @@ -55,6 +55,26 @@ nsPrintSettingsWin::nsPrintSettingsWin() : } +/** --------------------------------------------------- + * See documentation in nsPrintSettingsWin.h + * @update + */ +nsPrintSettingsWin::nsPrintSettingsWin(const nsPrintSettingsWin* aPS) : + nsPrintSettings(aPS), + mDeviceName(nsnull), + mDriverName(nsnull), + mDevMode(nsnull) +{ + if (aPS->mDeviceName) mDeviceName = nsCRT::strdup(aPS->mDeviceName); + if (aPS->mDriverName) mDriverName = nsCRT::strdup(aPS->mDriverName); + + if (aPS->mDevMode) { + size_t size = sizeof(*aPS->mDevMode); + mDevMode = (LPDEVMODE)malloc(size); + memcpy(mDevMode, aPS->mDevMode, size); + } +} + /** --------------------------------------------------- * See documentation in nsPrintSettingsWin.h * @update @@ -126,3 +146,11 @@ NS_IMETHODIMP nsPrintSettingsWin::SetDevMode(DEVMODE * aDevMode) } return NS_OK; } + +/* nsIPrintSettings clone (); */ +nsresult +nsPrintSettingsWin::CloneObj(nsIPrintSettings **_retval) +{ + nsPrintSettingsWin* printSettings = new nsPrintSettingsWin(this); + return printSettings->QueryInterface(NS_GET_IID(nsIPrintSettings), (void**)_retval); // ref counts +} diff --git a/gfx/src/windows/nsPrintSettingsWin.h b/gfx/src/windows/nsPrintSettingsWin.h index b4f29485f1b..150e70c9be9 100644 --- a/gfx/src/windows/nsPrintSettingsWin.h +++ b/gfx/src/windows/nsPrintSettingsWin.h @@ -32,15 +32,21 @@ //*** nsPrintSettingsWin //***************************************************************************** class nsPrintSettingsWin : public nsPrintSettings, - public nsIPrintSettingsWin + public nsIPrintSettingsWin { public: NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSIPRINTSETTINGSWIN nsPrintSettingsWin(); + nsPrintSettingsWin(const nsPrintSettingsWin* aPS); virtual ~nsPrintSettingsWin(); + /** + * Makes a new copy + */ + virtual nsresult CloneObj(nsIPrintSettings **_retval); + protected: char* mDeviceName; char* mDriverName; diff --git a/gfx/src/xlib/Makefile.in b/gfx/src/xlib/Makefile.in index 8e88bfdb015..f6522f694a7 100644 --- a/gfx/src/xlib/Makefile.in +++ b/gfx/src/xlib/Makefile.in @@ -38,10 +38,6 @@ REQUIRES = xpcom \ string \ xlibrgb \ widget \ - dom \ - layout \ - content \ - appshell \ js \ necko \ pref \ @@ -53,7 +49,6 @@ REQUIRES = xpcom \ gfx2 \ imglib2 \ mozcomps \ - windowwatcher \ intl \ $(NULL) diff --git a/gfx/src/xlib/nsDeviceContextSpecFactoryX.cpp b/gfx/src/xlib/nsDeviceContextSpecFactoryX.cpp index 0108332c461..384929b940a 100644 --- a/gfx/src/xlib/nsDeviceContextSpecFactoryX.cpp +++ b/gfx/src/xlib/nsDeviceContextSpecFactoryX.cpp @@ -62,14 +62,14 @@ NS_IMETHODIMP nsDeviceContextSpecFactoryXlib::Init(void) NS_IMETHODIMP nsDeviceContextSpecFactoryXlib::CreateDeviceContextSpec(nsIWidget *aWidget, nsIPrintSettings* aPrintSettings, nsIDeviceContextSpec *&aNewSpec, - PRBool aQuiet) + PRBool aIsPrintPreview) { nsresult rv; static NS_DEFINE_CID(kDeviceContextSpecCID, NS_DEVICE_CONTEXT_SPEC_CID); nsCOMPtr devSpec = do_CreateInstance(kDeviceContextSpecCID, &rv); if (NS_SUCCEEDED(rv)) { - rv = ((nsDeviceContextSpecXlib *)devSpec.get())->Init(aPrintSettings, aQuiet); + rv = ((nsDeviceContextSpecXlib *)devSpec.get())->Init(aPrintSettings); if (NS_SUCCEEDED(rv)) { aNewSpec = devSpec; diff --git a/gfx/src/xlib/nsDeviceContextSpecFactoryX.h b/gfx/src/xlib/nsDeviceContextSpecFactoryX.h index 7441831e940..d99c78680ed 100644 --- a/gfx/src/xlib/nsDeviceContextSpecFactoryX.h +++ b/gfx/src/xlib/nsDeviceContextSpecFactoryX.h @@ -54,7 +54,7 @@ public: NS_IMETHOD CreateDeviceContextSpec(nsIWidget *aWidget, nsIPrintSettings* aPrintSettings, nsIDeviceContextSpec *&aNewSpec, - PRBool aQuiet); + PRBool aIsPrintPreview); protected: virtual ~nsDeviceContextSpecFactoryXlib(); diff --git a/gfx/src/xlib/nsDeviceContextSpecXlib.cpp b/gfx/src/xlib/nsDeviceContextSpecXlib.cpp index 454187b50e5..ac5fd901fba 100644 --- a/gfx/src/xlib/nsDeviceContextSpecXlib.cpp +++ b/gfx/src/xlib/nsDeviceContextSpecXlib.cpp @@ -51,16 +51,9 @@ #include "nsIPref.h" #include "prenv.h" /* for PR_GetEnv */ -#include "nsIDOMWindowInternal.h" -#include "nsIServiceManager.h" -#include "nsIDialogParamBlock.h" -#include "nsISupportsPrimitives.h" -#include "nsIWindowWatcher.h" - -#include "nsReadableUtils.h" -#include "nsISupportsArray.h" - #include "nsPrintfCString.h" +#include "nsReadableUtils.h" +#include "nsIServiceManager.h" #ifdef USE_XPRINT #include "xprintutil.h" @@ -254,66 +247,6 @@ NS_IMPL_ISUPPORTS1(nsDeviceContextSpecXlib, #error "This should not happen" #endif -/** ------------------------------------------------------- - */ -static nsresult DisplayXPDialog(nsIPrintSettings* aPS, - const char* aChromeURL, - PRBool& aClickedOK) -{ - DO_PR_DEBUG_LOG(("nsDeviceContextSpecXlib::DisplayXPDialog()\n")); - NS_ASSERTION(aPS, "Must have a print settings!"); - - aClickedOK = PR_FALSE; - nsresult rv = NS_ERROR_FAILURE; - - // create a nsISupportsArray of the parameters - // being passed to the window - nsCOMPtr array; - NS_NewISupportsArray(getter_AddRefs(array)); - if (!array) return NS_ERROR_FAILURE; - - nsCOMPtr ps = aPS; - nsCOMPtr psSupports(do_QueryInterface(ps)); - NS_ASSERTION(psSupports, "PrintSettings must be a supports"); - array->AppendElement(psSupports); - - nsCOMPtr ioParamBlock(do_CreateInstance("@mozilla.org/embedcomp/dialogparam;1")); - if (ioParamBlock) { - ioParamBlock->SetInt(0, 0); - nsCOMPtr blkSupps(do_QueryInterface(ioParamBlock)); - NS_ASSERTION(blkSupps, "IOBlk must be a supports"); - - array->AppendElement(blkSupps); - nsCOMPtr arguments(do_QueryInterface(array)); - NS_ASSERTION(array, "array must be a supports"); - - nsCOMPtr wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1")); - if (wwatch) { - nsCOMPtr active; - wwatch->GetActiveWindow(getter_AddRefs(active)); - nsCOMPtr parent = do_QueryInterface(active); - - nsCOMPtr newWindow; - rv = wwatch->OpenWindow(parent, aChromeURL, - "_blank", "chrome,modal,centerscreen", array, - getter_AddRefs(newWindow)); - } - } - - if (NS_SUCCEEDED(rv)) { - PRInt32 buttonPressed = 0; - ioParamBlock->GetInt(0, &buttonPressed); - if (buttonPressed == 1) { - aClickedOK = PR_TRUE; - } else { - rv = NS_ERROR_ABORT; - } - } else { - rv = NS_ERROR_ABORT; - } - return rv; -} - /** ------------------------------------------------------- * Initialize the nsDeviceContextSpecXlib * @update dc 2/15/98 @@ -323,19 +256,19 @@ static nsresult DisplayXPDialog(nsIPrintSettings* aPS, * toolkits including: * - GTK+-toolkit: * file: mozilla/gfx/src/gtk/nsDeviceContextSpecG.cpp - * function: NS_IMETHODIMP nsDeviceContextSpecGTK::Init(PRBool aQuiet) + * function: NS_IMETHODIMP nsDeviceContextSpecGTK::Init() * - Xlib-toolkit: * file: mozilla/gfx/src/xlib/nsDeviceContextSpecXlib.cpp - * function: NS_IMETHODIMP nsDeviceContextSpecXlib::Init(PRBool aQuiet) + * function: NS_IMETHODIMP nsDeviceContextSpecXlib::Init() * - Qt-toolkit: * file: mozilla/gfx/src/qt/nsDeviceContextSpecQT.cpp - * function: NS_IMETHODIMP nsDeviceContextSpecQT::Init(PRBool aQuiet) + * function: NS_IMETHODIMP nsDeviceContextSpecQT::Init() * * ** Please update the other toolkits when changing this function. */ -NS_IMETHODIMP nsDeviceContextSpecXlib::Init(nsIPrintSettings *aPS, PRBool aQuiet) +NS_IMETHODIMP nsDeviceContextSpecXlib::Init(nsIPrintSettings *aPS) { - DO_PR_DEBUG_LOG(("nsDeviceContextSpecXlib::Init(aPS=%p. qQuiet=%d)\n", aPS, (int)aQuiet)); + DO_PR_DEBUG_LOG(("nsDeviceContextSpecXlib::Init(aPS=%p\n", aPS)); nsresult rv = NS_ERROR_FAILURE; mPrintSettings = aPS; @@ -350,88 +283,76 @@ NS_IMETHODIMP nsDeviceContextSpecXlib::Init(nsIPrintSettings *aPS, PRBool aQuiet } } - PRBool canPrint = PR_FALSE; - rv = GlobalPrinters::GetInstance()->InitializeGlobalPrinters(); if (NS_FAILED(rv)) { return rv; } - if (!aQuiet) { - rv = DisplayXPDialog(mPrintSettings, - "chrome://global/content/printdialog.xul", canPrint); - } else { - rv = NS_OK; - canPrint = PR_TRUE; - } - GlobalPrinters::GetInstance()->FreeGlobalPrinters(); - if (NS_SUCCEEDED(rv) && canPrint) { - if (aPS) { - PRBool reversed = PR_FALSE; - PRBool color = PR_FALSE; - PRBool tofile = PR_FALSE; - PRInt16 printRange = nsIPrintSettings::kRangeAllPages; - PRInt32 orientation = NS_PORTRAIT; - PRInt32 fromPage = 1; - PRInt32 toPage = 1; - PRUnichar *command = nsnull; - PRInt32 copies = 1; - PRUnichar *printer = nsnull; - PRUnichar *papername = nsnull; - PRUnichar *printfile = nsnull; - double dleft = 0.5; - double dright = 0.5; - double dtop = 0.5; - double dbottom = 0.5; + if (aPS) { + PRBool reversed = PR_FALSE; + PRBool color = PR_FALSE; + PRBool tofile = PR_FALSE; + PRInt16 printRange = nsIPrintSettings::kRangeAllPages; + PRInt32 orientation = NS_PORTRAIT; + PRInt32 fromPage = 1; + PRInt32 toPage = 1; + PRUnichar *command = nsnull; + PRInt32 copies = 1; + PRUnichar *printer = nsnull; + PRUnichar *papername = nsnull; + PRUnichar *printfile = nsnull; + double dleft = 0.5; + double dright = 0.5; + double dtop = 0.5; + double dbottom = 0.5; - aPS->GetPrinterName(&printer); - aPS->GetPrintReversed(&reversed); - aPS->GetPrintInColor(&color); - aPS->GetPaperName(&papername); - aPS->GetOrientation(&orientation); - aPS->GetPrintCommand(&command); - aPS->GetPrintRange(&printRange); - aPS->GetToFileName(&printfile); - aPS->GetPrintToFile(&tofile); - aPS->GetStartPageRange(&fromPage); - aPS->GetEndPageRange(&toPage); - aPS->GetNumCopies(&copies); - aPS->GetMarginTop(&dtop); - aPS->GetMarginLeft(&dleft); - aPS->GetMarginBottom(&dbottom); - aPS->GetMarginRight(&dright); + aPS->GetPrinterName(&printer); + aPS->GetPrintReversed(&reversed); + aPS->GetPrintInColor(&color); + aPS->GetPaperName(&papername); + aPS->GetOrientation(&orientation); + aPS->GetPrintCommand(&command); + aPS->GetPrintRange(&printRange); + aPS->GetToFileName(&printfile); + aPS->GetPrintToFile(&tofile); + aPS->GetStartPageRange(&fromPage); + aPS->GetEndPageRange(&toPage); + aPS->GetNumCopies(&copies); + aPS->GetMarginTop(&dtop); + aPS->GetMarginLeft(&dleft); + aPS->GetMarginBottom(&dbottom); + aPS->GetMarginRight(&dright); - if (printfile) - strcpy(mPath, NS_ConvertUCS2toUTF8(printfile).get()); - if (command) - strcpy(mCommand, NS_ConvertUCS2toUTF8(command).get()); - if (printer) - strcpy(mPrinter, NS_ConvertUCS2toUTF8(printer).get()); - if (papername) - strcpy(mPaperName, NS_ConvertUCS2toUTF8(papername).get()); + if (printfile) + strcpy(mPath, NS_ConvertUCS2toUTF8(printfile).get()); + if (command) + strcpy(mCommand, NS_ConvertUCS2toUTF8(command).get()); + if (printer) + strcpy(mPrinter, NS_ConvertUCS2toUTF8(printer).get()); + if (papername) + strcpy(mPaperName, NS_ConvertUCS2toUTF8(papername).get()); - DO_PR_DEBUG_LOG(("margins: %5.2f,%5.2f,%5.2f,%5.2f\n", dtop, dleft, dbottom, dright)); - DO_PR_DEBUG_LOG(("printRange %d\n", printRange)); - DO_PR_DEBUG_LOG(("fromPage %d\n", fromPage)); - DO_PR_DEBUG_LOG(("toPage %d\n", toPage)); - DO_PR_DEBUG_LOG(("tofile %d\n", tofile)); - DO_PR_DEBUG_LOG(("printfile '%s'\n", printfile? NS_ConvertUCS2toUTF8(printfile).get():"")); - DO_PR_DEBUG_LOG(("command '%s'\n", command? NS_ConvertUCS2toUTF8(command).get():"")); - DO_PR_DEBUG_LOG(("printer '%s'\n", printer? NS_ConvertUCS2toUTF8(printer).get():"")); - DO_PR_DEBUG_LOG(("papername '%s'\n", papername? NS_ConvertUCS2toUTF8(papername).get():"")); + DO_PR_DEBUG_LOG(("margins: %5.2f,%5.2f,%5.2f,%5.2f\n", dtop, dleft, dbottom, dright)); + DO_PR_DEBUG_LOG(("printRange %d\n", printRange)); + DO_PR_DEBUG_LOG(("fromPage %d\n", fromPage)); + DO_PR_DEBUG_LOG(("toPage %d\n", toPage)); + DO_PR_DEBUG_LOG(("tofile %d\n", tofile)); + DO_PR_DEBUG_LOG(("printfile '%s'\n", printfile? NS_ConvertUCS2toUTF8(printfile).get():"")); + DO_PR_DEBUG_LOG(("command '%s'\n", command? NS_ConvertUCS2toUTF8(command).get():"")); + DO_PR_DEBUG_LOG(("printer '%s'\n", printer? NS_ConvertUCS2toUTF8(printer).get():"")); + DO_PR_DEBUG_LOG(("papername '%s'\n", papername? NS_ConvertUCS2toUTF8(papername).get():"")); - mTop = dtop; - mBottom = dbottom; - mLeft = dleft; - mRight = dright; - mFpf = !reversed; - mGrayscale = !color; - mOrientation = orientation; - mToPrinter = !tofile; - mCopies = copies; - } + mTop = dtop; + mBottom = dbottom; + mLeft = dleft; + mRight = dright; + mFpf = !reversed; + mGrayscale = !color; + mOrientation = orientation; + mToPrinter = !tofile; + mCopies = copies; } return rv; @@ -993,19 +914,7 @@ NS_IMETHODIMP nsPrinterEnumeratorXlib::InitPrintSettingsFromPrinter(const PRUnic NS_IMETHODIMP nsPrinterEnumeratorXlib::DisplayPropertiesDlg(const PRUnichar *aPrinter, nsIPrintSettings *aPrintSettings) { - /* fixme: We simply ignore the |aPrinter| argument here - * We should get the supported printer attributes from the printer and - * populate the print job options dialog with these data instead of using - * the "default set" here. - * However, this requires changes on all platforms and is another big chunk - * of patches ... ;-( - */ - - PRBool pressedOK; - return DisplayXPDialog(aPrintSettings, - "chrome://global/content/printjoboptions.xul", - pressedOK); - + return NS_OK; } //---------------------------------------------------------------------- diff --git a/gfx/src/xlib/nsDeviceContextSpecXlib.h b/gfx/src/xlib/nsDeviceContextSpecXlib.h index eb135d979fc..f65ca943541 100644 --- a/gfx/src/xlib/nsDeviceContextSpecXlib.h +++ b/gfx/src/xlib/nsDeviceContextSpecXlib.h @@ -74,7 +74,7 @@ public: NS_DECL_ISUPPORTS - NS_IMETHOD Init(nsIPrintSettings* aPS, PRBool aQuiet); + NS_IMETHOD Init(nsIPrintSettings* aPS); NS_IMETHOD ClosePrintManager(); NS_IMETHOD GetToPrinter(PRBool &aToPrinter); diff --git a/gfx/src/xlib/nsDeviceContextXlib.cpp b/gfx/src/xlib/nsDeviceContextXlib.cpp index c8e839c9204..b19ac5570cd 100644 --- a/gfx/src/xlib/nsDeviceContextXlib.cpp +++ b/gfx/src/xlib/nsDeviceContextXlib.cpp @@ -460,7 +460,7 @@ NS_IMETHODIMP nsDeviceContextXlib::GetDeviceContextFor(nsIDeviceContextSpec *aDe return NS_ERROR_UNEXPECTED; } -NS_IMETHODIMP nsDeviceContextXlib::BeginDocument(PRUnichar * aTitle) +NS_IMETHODIMP nsDeviceContextXlib::BeginDocument(PRUnichar * aTitle, PRUnichar* aPrintToFileName, PRInt32 aStartPage, PRInt32 aEndPage) { PR_LOG(DeviceContextXlibLM, PR_LOG_DEBUG, ("nsDeviceContextXlib::BeginDocument()\n")); return NS_OK; diff --git a/gfx/src/xlib/nsDeviceContextXlib.h b/gfx/src/xlib/nsDeviceContextXlib.h index 7d90f547cdf..53c35b69793 100644 --- a/gfx/src/xlib/nsDeviceContextXlib.h +++ b/gfx/src/xlib/nsDeviceContextXlib.h @@ -73,7 +73,7 @@ public: NS_IMETHOD GetDeviceContextFor(nsIDeviceContextSpec *aDevice, nsIDeviceContext *&aContext); - NS_IMETHOD BeginDocument(PRUnichar * aTitle); + NS_IMETHOD BeginDocument(PRUnichar * aTitle, PRUnichar* aPrintToFileName, PRInt32 aStartPage, PRInt32 aEndPage); NS_IMETHOD EndDocument(void); NS_IMETHOD AbortDocument(void); diff --git a/gfx/src/xprint/nsDeviceContextXP.cpp b/gfx/src/xprint/nsDeviceContextXP.cpp index 16b113c4dc2..24fa48a71ce 100644 --- a/gfx/src/xprint/nsDeviceContextXP.cpp +++ b/gfx/src/xprint/nsDeviceContextXP.cpp @@ -303,7 +303,7 @@ NS_IMETHODIMP nsDeviceContextXp::GetDeviceContextFor(nsIDeviceContextSpec *aDevi /** --------------------------------------------------- * See documentation in nsIDeviceContext.h */ -NS_IMETHODIMP nsDeviceContextXp::BeginDocument(PRUnichar * aTitle) +NS_IMETHODIMP nsDeviceContextXp::BeginDocument(PRUnichar * aTitle, PRUnichar* aPrintToFileName, PRInt32 aStartPage, PRInt32 aEndPage) { PR_LOG(nsDeviceContextXpLM, PR_LOG_DEBUG, ("nsDeviceContextXp::BeginDocument()\n")); nsresult rv = NS_OK; diff --git a/gfx/src/xprint/nsDeviceContextXP.h b/gfx/src/xprint/nsDeviceContextXP.h index 53113cd1350..5374ed4d4de 100644 --- a/gfx/src/xprint/nsDeviceContextXP.h +++ b/gfx/src/xprint/nsDeviceContextXP.h @@ -80,7 +80,7 @@ public: NS_IMETHOD GetDeviceContextFor(nsIDeviceContextSpec *aDevice,nsIDeviceContext *&aContext); NS_IMETHOD GetSystemFont(nsSystemFontID anID, nsFont *aFont) const; - NS_IMETHOD BeginDocument(PRUnichar * aTitle); + NS_IMETHOD BeginDocument(PRUnichar * aTitle, PRUnichar* aPrintToFileName, PRInt32 aStartPage, PRInt32 aEndPage); NS_IMETHOD EndDocument(void); NS_IMETHOD AbortDocument(void); NS_IMETHOD BeginPage(void); diff --git a/gfx/src/xprint/nsXPrintContext.cpp b/gfx/src/xprint/nsXPrintContext.cpp index 239aeed8f69..5629004e699 100644 --- a/gfx/src/xprint/nsXPrintContext.cpp +++ b/gfx/src/xprint/nsXPrintContext.cpp @@ -685,7 +685,7 @@ nsXPrintContext::SetResolution( void ) } NS_IMETHODIMP -nsXPrintContext::BeginDocument( PRUnichar *aTitle ) +nsXPrintContext::BeginDocument( PRUnichar * aTitle, PRUnichar* aPrintToFileName, PRInt32 aStartPage, PRInt32 aEndPage ) { PR_LOG(nsXPrintContextLM, PR_LOG_DEBUG, ("nsXPrintContext::BeginDocument(aTitle='%s')\n", ((aTitle)?(NS_ConvertUCS2toUTF8(aTitle).get()):("")))); diff --git a/gfx/src/xprint/nsXPrintContext.h b/gfx/src/xprint/nsXPrintContext.h index b46be4472fa..035fe5979ea 100644 --- a/gfx/src/xprint/nsXPrintContext.h +++ b/gfx/src/xprint/nsXPrintContext.h @@ -73,7 +73,7 @@ public: NS_IMETHOD Init(nsDeviceContextXp *dc, nsIDeviceContextSpecXp *aSpec); NS_IMETHOD BeginPage(); NS_IMETHOD EndPage(); - NS_IMETHOD BeginDocument(PRUnichar *aTitle); + NS_IMETHOD BeginDocument(PRUnichar * aTitle, PRUnichar* aPrintToFileName, PRInt32 aStartPage, PRInt32 aEndPage); NS_IMETHOD EndDocument(); NS_IMETHOD AbortDocument(); diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index 28388738845..c834da20ed6 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -161,6 +161,10 @@ static NS_DEFINE_IID(kPrinterEnumeratorCID, NS_PRINTER_ENUMERATOR_CID); #include "nsIWindowWatcher.h" #include "nsIStringBundle.h" +// Printing Prompts +#include "nsIPrintingPromptService.h" +const char* kPrintingPromptService = "@mozilla.org/embedcomp/printingprompt-service;1"; + #define NS_ERROR_GFX_PRINTER_BUNDLE_URL "chrome://global/locale/printing.properties" // FrameSet @@ -215,12 +219,12 @@ static const char * gPrintRangeStr[] = {"kRangeAllPages", "kRangeSpecified static PRUint32 gDumpFileNameCnt = 0; static PRUint32 gDumpLOFileNameCnt = 0; -#define PRINT_DEBUG_MSG1(_msg1) fprintf(mPrt->mDebugFD, (_msg1)); -#define PRINT_DEBUG_MSG2(_msg1, _msg2) fprintf(mPrt->mDebugFD, (_msg1), (_msg2)); -#define PRINT_DEBUG_MSG3(_msg1, _msg2, _msg3) fprintf(mPrt->mDebugFD, (_msg1), (_msg2), (_msg3)); -#define PRINT_DEBUG_MSG4(_msg1, _msg2, _msg3, _msg4) fprintf(mPrt->mDebugFD, (_msg1), (_msg2), (_msg3), (_msg4)); -#define PRINT_DEBUG_MSG5(_msg1, _msg2, _msg3, _msg4, _msg5) fprintf(mPrt->mDebugFD, (_msg1), (_msg2), (_msg3), (_msg4), (_msg5)); -#define PRINT_DEBUG_FLUSH fflush(mPrt->mDebugFD); +#define PRINT_DEBUG_MSG1(_msg1) if (mPrt && mPrt->mDebugFD) fprintf(mPrt->mDebugFD, (_msg1)); +#define PRINT_DEBUG_MSG2(_msg1, _msg2) if (mPrt && mPrt->mDebugFD) fprintf(mPrt->mDebugFD, (_msg1), (_msg2)); +#define PRINT_DEBUG_MSG3(_msg1, _msg2, _msg3) if (mPrt && mPrt->mDebugFD) fprintf(mPrt->mDebugFD, (_msg1), (_msg2), (_msg3)); +#define PRINT_DEBUG_MSG4(_msg1, _msg2, _msg3, _msg4) if (mPrt && mPrt->mDebugFD) fprintf(mPrt->mDebugFD, (_msg1), (_msg2), (_msg3), (_msg4)); +#define PRINT_DEBUG_MSG5(_msg1, _msg2, _msg3, _msg4, _msg5) if (mPrt && mPrt->mDebugFD) fprintf(mPrt->mDebugFD, (_msg1), (_msg2), (_msg3), (_msg4), (_msg5)); +#define PRINT_DEBUG_FLUSH if (mPrt && mPrt->mDebugFD) fflush(mPrt->mDebugFD); #else //-------------- #define PRT_YESNO(_p) #define PRINT_DEBUG_MSG1(_msg) @@ -398,7 +402,9 @@ private: class PrintData { public: - PrintData(); + typedef enum ePrintDataType {eIsPrinting, eIsPrintPreview }; + + PrintData(ePrintDataType aType); ~PrintData(); // non-virtual // Listener Helper Methods @@ -410,6 +416,7 @@ public: PRBool aDoStartStop = PR_FALSE, PRInt32 aFlag = 0); + ePrintDataType mType; // the type of data this is (Printing or Print Preview) nsCOMPtr mPrintDC; nsIView *mPrintView; FILE *mDebugFilePtr; // a file where information can go to when printing @@ -466,6 +473,7 @@ public: #endif private: + PrintData() {} PrintData& operator=(const PrintData& aOther); // not implemented }; @@ -711,7 +719,6 @@ protected: nsIPageSequenceFrame* mPageSeqFrame; - PRBool mIsPrinting; PrintData* mPrt; nsPagePrintTimer* mPagePrintTimer; @@ -878,8 +885,8 @@ static nsresult NS_NewUpdateTimer(nsPagePrintTimer **aResult) //--------------------------------------------------- //-- PrintData Class Impl //--------------------------------------------------- -PrintData::PrintData() : - mPrintView(nsnull), mDebugFilePtr(nsnull), mPrintObject(nsnull), mSelectedPO(nsnull), +PrintData::PrintData(ePrintDataType aType) : + mType(aType), mPrintView(nsnull), mDebugFilePtr(nsnull), mPrintObject(nsnull), mSelectedPO(nsnull), mShowProgressDialog(PR_TRUE), mPrintDocList(nsnull), mIsIFrameSelected(PR_FALSE), mIsParentAFrameSet(PR_FALSE), mPrintingAsIsSubDoc(PR_FALSE), mOnStartSent(PR_FALSE), mIsAborted(PR_FALSE), mPreparingForPrint(PR_FALSE), mDocWasToBeDestroyed(PR_FALSE), @@ -940,13 +947,15 @@ PrintData::~PrintData() mPrintSettings->GetIsCancelled(&isCancelled); nsresult rv = NS_OK; - if (!isCancelled && !mIsAborted) { - rv = mPrintDC->EndDocument(); - } else { - rv = mPrintDC->AbortDocument(); - } - if (NS_FAILED(rv)) { - DocumentViewerImpl::ShowPrintErrorDialog(rv); + if (mType == eIsPrinting) { + if (!isCancelled && !mIsAborted) { + rv = mPrintDC->EndDocument(); + } else { + rv = mPrintDC->AbortDocument(); + } + if (NS_FAILED(rv)) { + DocumentViewerImpl::ShowPrintErrorDialog(rv); + } } } @@ -1103,7 +1112,6 @@ void DocumentViewerImpl::PrepareToStartLoad() mStopped = PR_FALSE; mLoaded = PR_FALSE; mPrt = nsnull; - mIsPrinting = PR_FALSE; #ifdef NS_PRINT_PREVIEW mIsDoingPrintPreview = PR_FALSE; @@ -4312,7 +4320,7 @@ DocumentViewerImpl::FindXMostFrameInList(nsIPresContext* aPresContext, xMost = 0; } -#ifdef DEBUG_PRINTING // keep this here but leave it turned off +#ifdef DEBUG_PRINTING_X // keep this here but leave it turned off nsAutoString tmp; nsIFrameDebug* frameDebug; if (NS_SUCCEEDED(CallQueryInterface(child, &frameDebug))) { @@ -4323,7 +4331,7 @@ DocumentViewerImpl::FindXMostFrameInList(nsIPresContext* aPresContext, if (xMost > aMaxWidth) { aMaxWidth = xMost; -#ifdef DEBUG_PRINTING // keep this here but leave it turned off +#ifdef DEBUG_PRINTING_X // keep this here but leave it turned off printf("%p - %d %s ", child, aMaxWidth, NS_LossyConvertUCS2toASCII(tmp).get()); if (aList == nsLayoutAtoms::overflowList) printf(" nsLayoutAtoms::overflowList\n"); if (aList == nsLayoutAtoms::floaterList) printf(" nsLayoutAtoms::floaterList\n"); @@ -4453,7 +4461,7 @@ DocumentViewerImpl::SetupToPrintContent(nsIWebShell* aParent, } // Only Shrink if we are smaller - if (mPrt->mShrinkRatio < 1.0f) { + if (mPrt->mShrinkRatio < 0.998f) { // Clamp Shrink to Fit to 50% mPrt->mShrinkRatio = PR_MAX(mPrt->mShrinkRatio, 0.5f); @@ -4471,6 +4479,30 @@ DocumentViewerImpl::SetupToPrintContent(nsIWebShell* aParent, return NS_ERROR_FAILURE; } } +#ifdef DEBUG_rods + { + float calcRatio; + if (mPrt->mPrintDocList->Count() > 1 && mPrt->mPrintObject->mFrameType == eFrameSet) { + PrintObject* xMostPO = FindXMostPO(); + NS_ASSERTION(xMostPO, "There must always be an XMost PO!"); + if (xMostPO) { + // The margin is included in the PO's mRect so we need to subtract it + nsMargin margin(0,0,0,0); + mPrt->mPrintSettings->GetMarginInTwips(margin); + nsRect rect = xMostPO->mRect; + rect.x -= margin.left; + // Calc the shrinkage based on the entire content area + calcRatio = float(rect.XMost()) / float(rect.x + xMostPO->mXMost); + } + } else { + // Single document so use the Shrink as calculated for the PO + calcRatio = mPrt->mPrintObject->mShrinkRatio; + } + printf("**************************************************************************\n"); + printf("STF Ratio is: %8.5f Effective Ratio: %8.5f Diff: %8.5f\n", mPrt->mShrinkRatio, calcRatio, mPrt->mShrinkRatio-calcRatio); + printf("**************************************************************************\n"); + } +#endif } DUMP_DOC_LIST("\nAfter Reflow------------------------------------------"); @@ -4510,12 +4542,54 @@ DocumentViewerImpl::SetupToPrintContent(nsIWebShell* aParent, mPrt->mPrintDocDW = aCurrentFocusedDOMWin; + PRUnichar* fileName = nsnull; + // check to see if we are printing to a file + PRBool isPrintToFile = PR_FALSE; + mPrt->mPrintSettings->GetPrintToFile(&isPrintToFile); + if (isPrintToFile) { + // On some platforms The BeginDocument needs to know the name of the file + // and it uses the PrintService to get it, so we need to set it into the PrintService here + mPrt->mPrintSettings->GetToFileName(&fileName); + } + + PRUnichar * docTitleStr; + PRUnichar * docURLStr; + GetDisplayTitleAndURL(mPrt->mPrintObject, mPrt->mPrintSettings, mPrt->mBrandName, &docTitleStr, &docURLStr, eDocTitleDefURLDoc); + + PRInt32 startPage = 1; + PRInt32 endPage = mPrt->mNumPrintablePages; + + PRInt16 printRangeType = nsIPrintSettings::kRangeAllPages; + mPrt->mPrintSettings->GetPrintRange(&printRangeType); + if (printRangeType == nsIPrintSettings::kRangeSpecifiedPageRange) { + mPrt->mPrintSettings->GetStartPageRange(&startPage); + mPrt->mPrintSettings->GetEndPageRange(&endPage); + if (endPage > mPrt->mNumPrintablePages) { + endPage = mPrt->mNumPrintablePages; + } + } + + nsresult rv = NS_OK; + // BeginDocument may pass back a FAILURE code + // i.e. On Windows, if you are printing to a file and hit "Cancel" + // to the "File Name" dialog, this comes back as an error + // Don't start printing when regression test are executed + if (!mPrt->mDebugFilePtr && mIsDoingPrinting) { + rv = mPrt->mPrintDC->BeginDocument(docTitleStr, fileName, startPage, endPage); + } + + PRINT_DEBUG_MSG1("****************** Begin Document ************************\n"); + + if (docTitleStr) nsMemory::Free(docTitleStr); + if (docURLStr) nsMemory::Free(docURLStr); + + NS_ENSURE_SUCCESS(rv, rv); + // This will print the webshell document // when it completes asynchronously in the DonePrintingPages method // it will check to see if there are more webshells to be printed and // then PrintDocContent will be called again. - nsresult rv = NS_OK; if (mIsDoingPrinting) { PrintDocContent(mPrt->mPrintObject, rv); // ignore return value } @@ -4688,23 +4762,11 @@ DocumentViewerImpl::DoPrint(PrintObject * aPO, PRBool aDoSyncPrinting, PRBool& a #endif if (mPrt->mPrintSettings) { + PRUnichar * docTitleStr = nsnull; + PRUnichar * docURLStr = nsnull; + if (!skipSetTitle) { - PRUnichar * docTitleStr; - PRUnichar * docURLStr; - GetDisplayTitleAndURL(aPO, mPrt->mPrintSettings, mPrt->mBrandName, - &docTitleStr, &docURLStr, eDocTitleDefBlank); - - // Set them down into the PrintOptions so - // they can used by the DeviceContext - if (docTitleStr) { - mPrt->mPrintOptions->SetTitle(docTitleStr); - nsMemory::Free(docTitleStr); - } - - if (docURLStr) { - mPrt->mPrintOptions->SetDocURL(docURLStr); - nsMemory::Free(docURLStr); - } + GetDisplayTitleAndURL(aPO, mPrt->mPrintSettings, mPrt->mBrandName, &docTitleStr, &docURLStr, eDocTitleDefBlank); } if (nsIPrintSettings::kRangeSelection == printRangeType) { @@ -4794,7 +4856,7 @@ DocumentViewerImpl::DoPrint(PrintObject * aPO, PRBool aDoSyncPrinting, PRBool& a rootFrame->SetRect(poPresContext, r); mPageSeqFrame = pageSequence; - mPageSeqFrame->StartPrint(poPresContext, mPrt->mPrintSettings); + mPageSeqFrame->StartPrint(poPresContext, mPrt->mPrintSettings, docTitleStr, docURLStr); if (!aDoSyncPrinting) { // Get the delay time in between the printing of each page @@ -5493,25 +5555,26 @@ DocumentViewerImpl::IsThereAnIFrameSelected(nsIWebShell* aWebShell, { aIsParentFrameSet = IsParentAFrameSet(aWebShell); PRBool iFrameIsSelected = PR_FALSE; -#if 1 - PrintObject* po = FindPrintObjectByDOMWin(mPrt->mPrintObject, aDOMWin); - iFrameIsSelected = po && po->mFrameType == eIFrame; -#else - // First, check to see if we are a frameset - if (!aIsParentFrameSet) { - // Check to see if there is a currenlt focused frame - // if so, it means the selected frame is either the main webshell - // or an IFRAME - if (aDOMWin != nsnull) { - // Get the main webshell's DOMWin to see if it matches - // the frame that is selected - nsCOMPtr domWin = getter_AddRefs(GetDOMWinForWebShell(aWebShell)); - if (aDOMWin != nsnull && domWin != aDOMWin) { - iFrameIsSelected = PR_TRUE; // we have a selected IFRAME + if (mPrt && mPrt->mPrintObject) { + PrintObject* po = FindPrintObjectByDOMWin(mPrt->mPrintObject, aDOMWin); + iFrameIsSelected = po && po->mFrameType == eIFrame; + } else { + // First, check to see if we are a frameset + if (!aIsParentFrameSet) { + // Check to see if there is a currenlt focused frame + // if so, it means the selected frame is either the main webshell + // or an IFRAME + if (aDOMWin != nsnull) { + // Get the main webshell's DOMWin to see if it matches + // the frame that is selected + nsCOMPtr domWin = getter_AddRefs(GetDOMWinForWebShell(aWebShell)); + if (aDOMWin != nsnull && domWin != aDOMWin) { + iFrameIsSelected = PR_TRUE; // we have a selected IFRAME + } } } } -#endif + return iFrameIsSelected; } @@ -6326,7 +6389,7 @@ DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings) mPrtPreview = nsnull; } - mPrt = new PrintData(); + mPrt = new PrintData(PrintData::eIsPrintPreview); if (!mPrt) { mIsCreatingPrintPreview = PR_FALSE; return NS_ERROR_OUT_OF_MEMORY; @@ -6468,8 +6531,6 @@ DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings) } #endif - PRBool doSilent = PR_TRUE; - nscoord width = NS_INCHES_TO_TWIPS(8.5); nscoord height = NS_INCHES_TO_TWIPS(11.0); @@ -6478,7 +6539,7 @@ DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings) if (factory) { nsCOMPtr devspec; nsCOMPtr dx; - nsresult rv = factory->CreateDeviceContextSpec(mWindow, aPrintSettings, *getter_AddRefs(devspec), doSilent); + nsresult rv = factory->CreateDeviceContextSpec(mWindow, aPrintSettings, *getter_AddRefs(devspec), PR_TRUE); if (NS_SUCCEEDED(rv)) { rv = mDeviceContext->GetDeviceContextFor(devspec, *getter_AddRefs(ppDC)); if (NS_SUCCEEDED(rv)) { @@ -6496,9 +6557,7 @@ DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings) } } - if (doSilent) { - mPrt->mPrintSettings->SetPrintFrameType(nsIPrintSettings::kFramesAsIs); - } + mPrt->mPrintSettings->SetPrintFrameType(nsIPrintSettings::kFramesAsIs); // override any UI that wants to PrintPreview any selection PRInt16 printRangeType = nsIPrintSettings::kRangeAllPages; @@ -6603,28 +6662,20 @@ DocumentViewerImpl::SetDocAndURLIntoProgress(PrintObject* aPO, docURLStr = ToNewUnicode(newURLStr); } - mPrt->mPrintProgressParams->SetDocTitle((const PRUnichar*) docTitleStr); - mPrt->mPrintProgressParams->SetDocURL((const PRUnichar*) docURLStr); + aParams->SetDocTitle((const PRUnichar*) docTitleStr); + aParams->SetDocURL((const PRUnichar*) docURLStr); if (docTitleStr != nsnull) nsMemory::Free(docTitleStr); if (docURLStr != nsnull) nsMemory::Free(docURLStr); } +//---------------------------------------------------------------------- +// Set up to use the "pluggable" Print Progress Dialog void DocumentViewerImpl::DoPrintProgress(PRBool aIsForPrinting) { - nsPrintProgress* prtProgress = new nsPrintProgress(); - nsresult rv = prtProgress->QueryInterface(NS_GET_IID(nsIPrintProgress), (void**)getter_AddRefs(mPrt->mPrintProgress)); - if (NS_FAILED(rv)) return; - - - rv = prtProgress->QueryInterface(NS_GET_IID(nsIWebProgressListener), (void**)getter_AddRefs(mPrt->mPrintProgressListener)); - if (NS_FAILED(rv)) return; - // add to listener list - mPrt->mPrintProgressListeners.AppendElement((void*)mPrt->mPrintProgressListener); - nsIWebProgressListener* wpl = NS_STATIC_CAST(nsIWebProgressListener*, mPrt->mPrintProgressListener.get()); - NS_ASSERTION(wpl, "nsIWebProgressListener is NULL!"); - NS_ADDREF(wpl); + // Assume we can't do progress and then see if we can + mPrt->mShowProgressDialog = PR_FALSE; nsCOMPtr prefs (do_GetService(NS_PREF_CONTRACTID)); if (prefs) { @@ -6638,20 +6689,27 @@ DocumentViewerImpl::DoPrintProgress(PRBool aIsForPrinting) mPrt->mPrintSettings->GetShowPrintProgress(&mPrt->mShowProgressDialog); } - if (mPrt->mShowProgressDialog) { - nsPrintProgressParams* prtProgressParams = new nsPrintProgressParams(); - nsCOMPtr params; - rv = prtProgressParams->QueryInterface(NS_GET_IID(nsIPrintProgressParams), (void**)getter_AddRefs(mPrt->mPrintProgressParams)); - if (NS_SUCCEEDED(rv) && mPrt->mPrintProgressParams) { - SetDocAndURLIntoProgress(mPrt->mPrintObject, mPrt->mPrintProgressParams); + // Now open the service to get the progress dialog + nsCOMPtr printPromptService(do_GetService(kPrintingPromptService)); + if (printPromptService) { + nsCOMPtr scriptGlobalObject; + mDocument->GetScriptGlobalObject(getter_AddRefs(scriptGlobalObject)); + if (!scriptGlobalObject) return; + nsCOMPtr domWin = do_QueryInterface(scriptGlobalObject); + if (!domWin) return; - nsCOMPtr wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1")); - if (wwatch) { - nsCOMPtr active; - wwatch->GetActiveWindow(getter_AddRefs(active)); + // If we don't get a service, that's ok, then just don't show progress + PRBool notifyOnOpen; + nsresult rv = printPromptService->ShowProgress(domWin, this, mPrt->mPrintSettings, nsnull, getter_AddRefs(mPrt->mPrintProgressListener), getter_AddRefs(mPrt->mPrintProgressParams), ¬ifyOnOpen); + if (NS_SUCCEEDED(rv)) { + mPrt->mShowProgressDialog = mPrt->mPrintProgressListener != nsnull && mPrt->mPrintProgressParams != nsnull; - nsCOMPtr parent(do_QueryInterface(active)); - mPrt->mPrintProgress->OpenProgressDialog(parent, "chrome://global/content/printProgress.xul", mPrt->mPrintProgressParams); + if (mPrt->mShowProgressDialog) { + mPrt->mPrintProgressListeners.AppendElement((void*)mPrt->mPrintProgressListener); + nsIWebProgressListener* wpl = NS_STATIC_CAST(nsIWebProgressListener*, mPrt->mPrintProgressListener.get()); + NS_ASSERTION(wpl, "nsIWebProgressListener is NULL!"); + NS_ADDREF(wpl); + SetDocAndURLIntoProgress(mPrt->mPrintObject, mPrt->mPrintProgressParams); } } } @@ -6749,9 +6807,9 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings, ShowPrintErrorDialog(rv); return rv; } - - mPrt = new PrintData(); - if (mPrt == nsnull) { + + mPrt = new PrintData(PrintData::eIsPrinting); + if (!mPrt) { return NS_ERROR_OUT_OF_MEMORY; } @@ -6888,14 +6946,65 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings, mPrt->mDebugFilePtr = mDebugFile; #endif - // we have to turn off printpreview mode for now.. because this is a real request to print. - if (mIsDoingPrintPreview) { - aPrintSettings->SetIsPrintPreview(PR_FALSE); - } + // we have to turn off printpreview mode for now.. because this is a real request to print. + if (mIsDoingPrintPreview) { + aPrintSettings->SetIsPrintPreview(PR_FALSE); + } PRBool printSilently; mPrt->mPrintSettings->GetPrintSilent(&printSilently); - rv = factory->CreateDeviceContextSpec(mWindow, mPrt->mPrintSettings, *getter_AddRefs(devspec), printSilently); + + // Ask dialog to be Print Shown via the Plugable Printing Dialog Service + // This service is for the Print Dialog and the Print Progress Dialog + // If printing silently or you can't get the service continue on + if (!printSilently) { + nsCOMPtr printPromptService(do_GetService(kPrintingPromptService)); + if (printPromptService) { + nsCOMPtr scriptGlobalObject; + mDocument->GetScriptGlobalObject(getter_AddRefs(scriptGlobalObject)); + if (!scriptGlobalObject) return nsnull; + nsCOMPtr domWin = do_QueryInterface(scriptGlobalObject); + if (!domWin) return nsnull; + + // Platforms not implementing a given dialog for the service may + // return NS_ERROR_NOT_IMPLEMENTED or an error code. + // + // NS_ERROR_NOT_IMPLEMENTED indicates they want default behavior + // Any other error code means we must bail out + // + rv = printPromptService->ShowPrintDialog(domWin, this, aPrintSettings); + if (rv == NS_ERROR_NOT_IMPLEMENTED) { + // This means the Dialog service was there, + // but they choose not to implement this dialog and + // are looking for default behavior from the toolkit + rv = NS_OK; + + } else if (NS_SUCCEEDED(rv)) { + // since we got the dialog and it worked then make sure we + // are telling GFX we want to print silent + printSilently = PR_TRUE; + } + } else { + rv = NS_ERROR_GFX_NO_PRINTROMPTSERVICE; + } + } + + if (NS_FAILED(rv)) { + if (rv != NS_ERROR_ABORT) { + ShowPrintErrorDialog(rv); + } + delete mPrt; + mPrt = nsnull; + return rv; + } + + // we have to turn off printpreview mode for now.. because this is a real request to print. + if ( mIsDoingPrintPreview == PR_TRUE) { + aPrintSettings->SetIsPrintPreview(PR_FALSE); + } + + // Create DeviceSpec for Printing + rv = factory->CreateDeviceContextSpec(mWindow, mPrt->mPrintSettings, *getter_AddRefs(devspec), PR_FALSE); // If the page was intended to be destroyed while we were in the print dialog // then we need to clean up and abort the printing. @@ -7019,70 +7128,42 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings, } } - if (mPrt->mPrintOptions) { - // check to see if we are printing to a file - PRBool isPrintToFile = PR_FALSE; - mPrt->mPrintSettings->GetPrintToFile(&isPrintToFile); - if (isPrintToFile) { - // On some platforms The BeginDocument needs to know the name of the file + // Get the Needed info for Calling PrepareDocument + PRUnichar* fileName = nsnull; + // check to see if we are printing to a file + PRBool isPrintToFile = PR_FALSE; + mPrt->mPrintSettings->GetPrintToFile(&isPrintToFile); + if (isPrintToFile) { + // On some platforms The PrepareDocument needs to know the name of the file // and it uses the PrintService to get it, so we need to set it into the PrintService here - PRUnichar* fileName; - mPrt->mPrintSettings->GetToFileName(&fileName); - if (fileName != nsnull) { - mPrt->mPrintOptions->SetPrintToFile(PR_TRUE); - mPrt->mPrintOptions->SetToFileName(fileName); - nsMemory::Free(fileName); - } - } else { - mPrt->mPrintOptions->SetPrintToFile(PR_FALSE); - mPrt->mPrintOptions->SetToFileName(nsnull); - } + mPrt->mPrintSettings->GetToFileName(&fileName); } PRUnichar * docTitleStr; PRUnichar * docURLStr; - GetDisplayTitleAndURL(mPrt->mPrintObject, mPrt->mPrintSettings, - mPrt->mBrandName, &docTitleStr, &docURLStr, - eDocTitleDefURLDoc); - // BeginDocument may pass back a FAILURE code - // i.e. On Windows, if you are printing to a file and hit "Cancel" - // to the "File Name" dialog, this comes back as an error - // Don't start printing when regression test are executed - rv = mPrt->mDebugFilePtr ? NS_OK: mPrt->mPrintDC->BeginDocument(docTitleStr); - PRINT_DEBUG_MSG1("****************** Begin Document ************************\n"); + GetDisplayTitleAndURL(mPrt->mPrintObject, mPrt->mPrintSettings, mPrt->mBrandName, &docTitleStr, &docURLStr, eDocTitleDefURLDoc); + + rv = mPrt->mPrintDC->PrepareDocument(docTitleStr, fileName); if (docTitleStr) nsMemory::Free(docTitleStr); if (docURLStr) nsMemory::Free(docURLStr); + NS_ENSURE_SUCCESS(rv, rv); - if (NS_SUCCEEDED(rv)) { + DoPrintProgress(PR_TRUE); - DoPrintProgress(PR_TRUE); - - // Print listener setup... - if (mPrt != nsnull) { - mPrt->OnStartPrinting(); - } - - // - // The mIsPrinting flag is set when the ImageGroup observer is - // notified that images must be loaded as a result of the - // InitialReflow... - // - if(!mIsPrinting || mPrt->mDebugFilePtr) { - rv = DocumentReadyForPrinting(); - PRINT_DEBUG_MSG1("PRINT JOB ENDING, OBSERVER WAS NOT CALLED\n"); - } else { - // use the observer mechanism to finish the printing - PRINT_DEBUG_MSG1("PRINTING OBSERVER STARTED\n"); - } + // Print listener setup... + if (mPrt != nsnull) { + mPrt->OnStartPrinting(); } + + rv = DocumentReadyForPrinting(); + PRINT_DEBUG_MSG1("PRINT JOB ENDING, OBSERVER WAS NOT CALLED\n"); } } } } else { mPrt->mPrintSettings->SetIsCancelled(PR_TRUE); - mPrt->mPrintOptions->SetIsCancelled(PR_TRUE); } // Set that we are once again in print preview @@ -7174,6 +7255,8 @@ DocumentViewerImpl::ShowPrintErrorDialog(nsresult aPrintError, PRBool aIsPrintin NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_XPRINT_BROKEN_XPRT) NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_DOC_IS_BUSY_PP) NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_DOC_WAS_DESTORYED) + NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_NO_PRINTDIALOG_IN_TOOLKIT) + NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_NO_PRINTROMPTSERVICE) NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_NO_XUL) // Temporary code for Bug 136185 default: @@ -8298,12 +8381,10 @@ DocumentViewerImpl::GetCurrentPrintSettings(nsIPrintSettings * *aCurrentPrintSet NS_IMETHODIMP DocumentViewerImpl::Cancel() { - nsresult rv; - nsCOMPtr printService = do_GetService(kPrintOptionsCID, &rv); - if (NS_SUCCEEDED(rv) && printService) { - return printService->SetIsCancelled(PR_TRUE); + if (mPrt && mPrt->mPrintSettings) { + return mPrt->mPrintSettings->SetIsCancelled(PR_TRUE); } - return NS_OK; + return NS_ERROR_FAILURE; } /* void initPrintSettingsFromPrefs (in nsIPrintSettings aPrintSettings, in boolean aUsePrinterNamePrefix, in unsigned long aFlags); */ diff --git a/layout/printing/nsIPrintProgress.idl b/layout/printing/nsIPrintProgress.idl index a97dc12c041..d4b4374084a 100644 --- a/layout/printing/nsIPrintProgress.idl +++ b/layout/printing/nsIPrintProgress.idl @@ -42,6 +42,7 @@ #include "nsIWebProgressListener.idl" interface nsIDOMWindowInternal; +interface nsIObserver; [scriptable, uuid(7E46BC35-FB7D-4b45-AB35-82FD61015380)] interface nsIPrintProgress: nsIWebProgressListener { @@ -49,7 +50,11 @@ interface nsIPrintProgress: nsIWebProgressListener { /* Open the progress dialog you can specify parameters through an xpcom object */ - void openProgressDialog(in nsIDOMWindowInternal parent, in string dialogURL, in nsISupports parameters); + void openProgressDialog(in nsIDOMWindowInternal parent, + in string dialogURL, + in nsISupports parameters, + in nsIObserver openDialogObserver, + out boolean notifyOnOpen); /* Close the progress dialog */ void closeProgressDialog(in boolean forceClose); diff --git a/layout/printing/nsPrintPreviewListener.h b/layout/printing/nsPrintPreviewListener.h index 9efa2808bd0..be3709badce 100644 --- a/layout/printing/nsPrintPreviewListener.h +++ b/layout/printing/nsPrintPreviewListener.h @@ -62,7 +62,7 @@ public: // nsIDOMContextMenuListener NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; } - NS_IMETHOD ContextMenu (nsIDOMEvent* aEvent) { printf("preventing ContextMenu\n"); aEvent->PreventDefault(); return NS_OK; } + NS_IMETHOD ContextMenu (nsIDOMEvent* aEvent) { aEvent->PreventDefault(); return NS_OK; } // nsIDOMKeyListener NS_IMETHOD KeyDown(nsIDOMEvent* aKeyEvent); diff --git a/lib/mac/NSStartup/MANIFEST b/lib/mac/NSStartup/MANIFEST new file mode 100644 index 00000000000..e69de29bb2d diff --git a/lib/mac/NSStartup/NSStartup.xml b/lib/mac/NSStartup/NSStartup.xml index 0be7e8147fb..e69de29bb2d 100644 --- a/lib/mac/NSStartup/NSStartup.xml +++ b/lib/mac/NSStartup/NSStartup.xml @@ -1,3511 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -]> - - - - - NSAppStartup.o - - - - UserSourceTrees - - - AlwaysSearchUserPathsfalse - InterpretDOSAndUnixPathsfalse - RequireFrameworkStyleIncludesfalse - UserSearchPaths - - SearchPath - Path: - PathFormatMacOS - PathRootProject - - Recursivetrue - FrameworkPathfalse - HostFlagsAll - - - SearchPath - Path::::dist:gc: - PathFormatMacOS - PathRootProject - - Recursivetrue - FrameworkPathfalse - HostFlagsAll - - - SearchPath - Path::::dist:mac: - PathFormatMacOS - PathRootProject - - Recursivetrue - FrameworkPathfalse - HostFlagsAll - - - SystemSearchPaths - - SearchPath - Path: - PathFormatMacOS - PathRootCodeWarrior - - Recursivetrue - FrameworkPathfalse - HostFlagsAll - - - - - MWRuntimeSettings_WorkingDirectory - MWRuntimeSettings_CommandLine - MWRuntimeSettings_HostApplication - Path - PathFormatGeneric - PathRootAbsolute - - MWRuntimeSettings_EnvVars - - - LinkerMacOS PPC Linker - PreLinker - PostLinker - TargetnameNSAppStartup.o - OutputDirectory - Path::::dist:mac:lib: - PathFormatMacOS - PathRootProject - - SaveEntriesUsingRelativePathsfalse - - - FileMappings - - FileTypeAPPL - FileExtension - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - FileTypeAppl - FileExtension - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - FileTypeMMLB - FileExtension - CompilerLib Import PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeMPLF - FileExtension - CompilerLib Import PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeMWCD - FileExtension - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - FileTypeRSRC - FileExtension - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.bh - CompilerBalloon Help - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.c - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.c++ - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.cc - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.cp - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.cpp - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.dylan - Compilermindy - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.exp - Compiler - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.h - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMaketrue - - - FileTypeTEXT - FileExtension.p - CompilerMW Pascal PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.pas - CompilerMW Pascal PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.pch - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompiletrue - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.pch++ - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompiletrue - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.ppu - CompilerMW Pascal PPC - EditLanguage - Precompiletrue - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.r - CompilerRez - EditLanguageRez - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.s - CompilerPPCAsm - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeXCOF - FileExtension - CompilerXCOFF Import PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypedocu - FileExtension - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - FileTypersrc - FileExtension - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - FileTypeshlb - FileExtension - CompilerPEF Import PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypestub - FileExtension - CompilerPEF Import PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileExtension.doc - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFilefalse - IgnoredByMaketrue - - - FileExtension.o - CompilerXCOFF Import PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileExtension.ppob - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - FileExtension.rsrc - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - - - CacheModDatestrue - ActivateBrowsertrue - DumpBrowserInfofalse - CacheSubprojectstrue - UseThirdPartyDebuggerfalse - DebuggerAppPath - Path - PathFormatGeneric - PathRootAbsolute - - DebuggerCmdLineArgs - DebuggerWorkingDir - Path - PathFormatGeneric - PathRootAbsolute - - - - LogSystemMessagestrue - AutoTargetDLLsfalse - StopAtWatchpointstrue - PauseWhileRunningfalse - PauseInterval5 - PauseUIFlags0 - AltExePath - Path - PathFormatGeneric - PathRootAbsolute - - StopAtTempBPOnLaunchtrue - CacheSymbolicstrue - TempBPFunctionNamemain - TempBPType0 - - - Enabledfalse - ConnectionName - DownloadPath - LaunchRemoteAppfalse - RemoteAppPath - - - OtherExecutables - - - CustomColor1 - Red0 - Green32767 - Blue0 - - CustomColor2 - Red0 - Green32767 - Blue0 - - CustomColor3 - Red0 - Green32767 - Blue0 - - CustomColor4 - Red0 - Green32767 - Blue0 - - - - MWFrontEnd_C_cplusplus0 - MWFrontEnd_C_checkprotos0 - MWFrontEnd_C_arm0 - MWFrontEnd_C_trigraphs0 - MWFrontEnd_C_onlystdkeywords0 - MWFrontEnd_C_enumsalwaysint0 - MWFrontEnd_C_mpwpointerstyle0 - MWFrontEnd_C_prefixnameNSStartupConfig.h - MWFrontEnd_C_ansistrict0 - MWFrontEnd_C_mpwcnewline0 - MWFrontEnd_C_wchar_type1 - MWFrontEnd_C_enableexceptions1 - MWFrontEnd_C_dontreusestrings0 - MWFrontEnd_C_poolstrings0 - MWFrontEnd_C_dontinline0 - MWFrontEnd_C_useRTTI1 - MWFrontEnd_C_multibyteaware0 - MWFrontEnd_C_unsignedchars0 - MWFrontEnd_C_autoinline0 - MWFrontEnd_C_booltruefalse1 - MWFrontEnd_C_direct_to_som0 - MWFrontEnd_C_som_env_check0 - MWFrontEnd_C_alwaysinline0 - MWFrontEnd_C_inlinelevel0 - MWFrontEnd_C_ecplusplus0 - MWFrontEnd_C_objective_c0 - MWFrontEnd_C_defer_codegen0 - - - MWWarning_C_warn_illpragma0 - MWWarning_C_warn_emptydecl0 - MWWarning_C_warn_possunwant0 - MWWarning_C_warn_unusedvar0 - MWWarning_C_warn_unusedarg0 - MWWarning_C_warn_extracomma0 - MWWarning_C_pedantic0 - MWWarning_C_warningerrors0 - MWWarning_C_warn_hidevirtual0 - MWWarning_C_warn_implicitconv0 - MWWarning_C_warn_notinlined0 - MWWarning_C_warn_structclass0 - - - MWFTP_Post_hostName - MWFTP_Post_username - MWFTP_Post_password0 - MWFTP_Post_remoteDir - MWFTP_Post_ftp_PathVersion1 - MWFTP_Post_ftp_PathType0 - MWFTP_Post_ftp_PathFormat0 - MWFTP_Post_ftp_tree - MWFTP_Post_uploadDir - MWFTP_Post_ftp_port21 - MWFTP_Post_SendBin1 - MWFTP_Post_ShouldLog1 - - - MWCommandLine_Java_clsName - MWCommandLine_Java_args - - - MWVJavaDebugging_Protocol1 - MWVJavaDebugging_JDKVersion1 - MWVJavaDebugging_TimeOut15 - MWVJavaDebugging_SupportSlowDevicesfalse - - - MWJava_Language_optimizefalse - MWJava_Language_warnDeprecatedfalse - MWJava_Language_emitMapfalse - MWJava_Language_strictFileNamesfalse - MWJava_Language_strictFileHierarchyfalse - MWJava_Language_1_1_Compatiblefalse - MWJava_Language_emitHeaders0 - MWJava_Language_headerTypeJNINativeHeaders - MWJava_Language_packageFilter - MWJava_Language_genCommentstrue - MWJava_Language_genHeadersfalse - - - MWJava_MRJAppBuilder_outFileMRJApplication - MWJava_MRJAppBuilder_mergefalse - MWJava_MRJAppBuilder_quitMenutrue - MWJava_MRJAppBuilder_growfalse - MWJava_MRJAppBuilder_stdoutTypeConsole - MWJava_MRJAppBuilder_stderrTypeConsole - MWJava_MRJAppBuilder_stdinTypeConsole - MWJava_MRJAppBuilder_appIconPVersion0 - MWJava_MRJAppBuilder_appIconPType0 - MWJava_MRJAppBuilder_appIconPFormat0 - MWJava_MRJAppBuilder_appIconPTree - MWJava_MRJAppBuilder_appIconFile - MWJava_MRJAppBuilder_splashScreenPVersion0 - MWJava_MRJAppBuilder_splashScreenPType0 - MWJava_MRJAppBuilder_splashScreenPFormat0 - MWJava_MRJAppBuilder_splashScreenPTree - MWJava_MRJAppBuilder_splashScreenPICTFile - MWJava_MRJAppBuilder_aboutName - MWJava_MRJAppBuilder_stdoutPVersion0 - MWJava_MRJAppBuilder_stdoutPType0 - MWJava_MRJAppBuilder_stdoutPFormat0 - MWJava_MRJAppBuilder_stdoutPTree - MWJava_MRJAppBuilder_stdoutFile - MWJava_MRJAppBuilder_stdoutAppendfalse - MWJava_MRJAppBuilder_stderrPType0 - MWJava_MRJAppBuilder_stderrPFormat0 - MWJava_MRJAppBuilder_stderrPTree - MWJava_MRJAppBuilder_stderrFile - MWJava_MRJAppBuilder_stderrAppendfalse - MWJava_MRJAppBuilder_stdinPType0 - MWJava_MRJAppBuilder_stdinPFormat0 - MWJava_MRJAppBuilder_stdinPTree - MWJava_MRJAppBuilder_stdinFile - - - MWJava_Output_outputtypeJarFile - MWJava_Output_outfileJavaClasses.jar - MWJava_Output_ftype1514754080 - MWJava_Output_fcreator1297570384 - MWJava_Output_compress0 - MWJava_Output_genManifest0 - MWJava_Output_trunctypeFront - MWJava_Output_deleteClasses0 - MWJava_Output_consoleApp1 - - - MWJava_Proj_projtypeApplet - MWJava_Proj_mainClassName - MWJava_Proj_HTMLAppCreator1145457748 - MWJava_Proj_HTMLAppNameMetrowerks Java - MWJava_Proj_PathVersion1 - MWJava_Proj_PathType0 - MWJava_Proj_PathFormat0 - MWJava_Proj_tree - MWJava_Proj_HTMLAppWin32NameInternet Explorer - MWJava_Proj_compress0 - MWJava_Proj_useVM1 - MWJava_Proj_vmarguments - MWJava_Proj_vmName - MWJava_Proj_simPropFile - - - MWJavaDoc_Proj_Version1 - MWJavaDoc_Proj_Depricated1 - MWJavaDoc_Proj_Author1 - MWJavaDoc_Proj_Index1 - MWJavaDoc_Proj_Tree1 - MWJavaDoc_Proj_SunResolveToSame0 - MWJavaDoc_Proj_Shortnames1 - MWJavaDoc_Proj_Folder0 - MWJavaDoc_Proj_GenerateAPILinks0 - MWJavaDoc_Proj_scopePublic - MWJavaDoc_Proj_fcreator1297303877 - MWJavaDoc_Proj_encodingName - MWJavaDoc_Proj_decodingName - MWJavaDoc_Proj_javaPackagePathhttp://java.sun.com/products/jdk/1.1/docs/api/ - - - MWMerge_MacOS_projectTypeApplication - MWMerge_MacOS_outputNameMerge Out - MWMerge_MacOS_outputCreator???? - MWMerge_MacOS_outputTypeAPPL - MWMerge_MacOS_suppressWarning0 - MWMerge_MacOS_copyFragments1 - MWMerge_MacOS_copyResources1 - MWMerge_MacOS_flattenResource0 - MWMerge_MacOS_flatFileNamea.rsrc - MWMerge_MacOS_flatFileOutputPath - Path: - PathFormatMacOS - PathRootProject - - MWMerge_MacOS_skipResources - DLGX - ckid - Proj - WSPC - - - - FileLockedfalse - ResourcesMapIsReadOnlyfalse - PrinterDriverIsMultiFinderCompatiblefalse - Invisiblefalse - HasBundlefalse - NameLockedfalse - Stationeryfalse - HasCustomIconfalse - Sharedfalse - HasBeenInitedfalse - Label0 - Comments - - - MWMacOSPackager_UsePackager0 - MWMacOSPackager_FolderToPackage - Path: - PathFormatMacOS - PathRootProject - - MWMacOSPackager_CreateClassicAlias0 - MWMacOSPackager_ClassicAliasMethodUseTargetOutput - MWMacOSPackager_ClassicAliasPath - Path: - PathFormatMacOS - PathRootProject - - MWMacOSPackager_CreatePkgInfo0 - MWMacOSPackager_PkgCreatorType???? - MWMacOSPackager_PkgFileTypeAPPL - - - MWCodeGen_PPC_structalignmentMC68K - MWCodeGen_PPC_tracebacktablesNone - MWCodeGen_PPC_processorGeneric - MWCodeGen_PPC_readonlystrings0 - MWCodeGen_PPC_tocdata1 - MWCodeGen_PPC_profiler0 - MWCodeGen_PPC_fpcontract1 - MWCodeGen_PPC_schedule0 - MWCodeGen_PPC_peephole1 - MWCodeGen_PPC_processorspecific0 - MWCodeGen_PPC_altivec0 - MWCodeGen_PPC_vectortocdata0 - MWCodeGen_PPC_vrsave0 - - - MWCodeGen_MachO_structalignmentPPC - MWCodeGen_MachO_tracebacktablesNone - MWCodeGen_MachO_processorGeneric - MWCodeGen_MachO_readonlystrings0 - MWCodeGen_MachO_profiler0 - MWCodeGen_MachO_fpcontract1 - MWCodeGen_MachO_schedule0 - MWCodeGen_MachO_peephole1 - MWCodeGen_MachO_processorspecific0 - MWCodeGen_MachO_altivec0 - MWCodeGen_MachO_vrsave1 - MWCodeGen_MachO_common0 - MWCodeGen_MachO_implicit_templates1 - - - MWDisassembler_PPC_showcode1 - MWDisassembler_PPC_extended1 - MWDisassembler_PPC_mix0 - MWDisassembler_PPC_nohex0 - MWDisassembler_PPC_showdata1 - MWDisassembler_PPC_showexceptions1 - MWDisassembler_PPC_showsym0 - MWDisassembler_PPC_shownames1 - - - GlobalOptimizer_PPC_optimizationlevelLevel0 - GlobalOptimizer_PPC_optforSpeed - - - MWLinker_PPC_linksym1 - MWLinker_PPC_symfullpath1 - MWLinker_PPC_linkmap0 - MWLinker_PPC_nolinkwarnings0 - MWLinker_PPC_dontdeadstripinitcode0 - MWLinker_PPC_permitmultdefs0 - MWLinker_PPC_linkmodeFast - MWLinker_PPC_initname - MWLinker_PPC_mainname__start - MWLinker_PPC_termname - - - MWLinker_MachO_exportsNone - MWLinker_MachO_mainnamestart - MWLinker_MachO_currentversion0 - MWLinker_MachO_compatibleversion0 - MWLinker_MachO_symfullpath0 - MWLinker_MachO_supresswarnings0 - MWLinker_MachO_multisymerror1 - MWLinker_MachO_prebind1 - MWLinker_MachO_deadstrip1 - MWLinker_MachO_objectivecsemantics1 - MWLinker_MachO_whichfileloaded0 - MWLinker_MachO_whyfileloaded0 - MWLinker_MachO_readonlyrelocsErrors - MWLinker_MachO_undefinedsymbolsErrors - MWLinker_MachO_twolevelnamespace1 - MWLinker_MachO_stripdebugsymbols0 - - - MWProject_MachO_typeBundle - MWProject_MachO_outfilea.out - MWProject_MachO_filecreator???? - MWProject_MachO_filetypeMAPL - MWProject_MachO_stacksize64 - MWProject_MachO_stackaddress0 - MWProject_MachO_flatrsrc0 - MWProject_MachO_flatrsrcfilenamea.rsrc - MWProject_MachO_flatrsrcoutputdir - Path: - PathFormatMacOS - PathRootProject - - MWProject_MachO_installpath./ - - - MWPEF_exportsNone - MWPEF_libfolder0 - MWPEF_sortcodeNone - MWPEF_expandbss0 - MWPEF_sharedata0 - MWPEF_olddefversion0 - MWPEF_oldimpversion0 - MWPEF_currentversion0 - MWPEF_fragmentname - MWPEF_collapsereloads0 - - - MWProject_PPC_typeLibrary - MWProject_PPC_outfileNSAppStartup.o - MWProject_PPC_filecreator???? - MWProject_PPC_filetype???? - MWProject_PPC_size0 - MWProject_PPC_minsize0 - MWProject_PPC_stacksize0 - MWProject_PPC_flags0 - MWProject_PPC_symfilename - MWProject_PPC_rsrcname - MWProject_PPC_rsrcheaderNative - MWProject_PPC_rsrctype???? - MWProject_PPC_rsrcid0 - MWProject_PPC_rsrcflags0 - MWProject_PPC_rsrcstore0 - MWProject_PPC_rsrcmerge0 - MWProject_PPC_flatrsrc0 - MWProject_PPC_flatrsrcoutputdir - Path: - PathFormatMacOS - PathRootProject - - MWProject_PPC_flatrsrcfilename - - - MWAssembler_PPC_auxheader0 - MWAssembler_PPC_symmodeMac - MWAssembler_PPC_dialectPPC - MWAssembler_PPC_prefixfile - MWAssembler_PPC_typecheck0 - MWAssembler_PPC_warnings0 - MWAssembler_PPC_casesensitive0 - - - MWRez_Language_maxwidth80 - MWRez_Language_scriptRoman - MWRez_Language_alignmentAlign1 - MWRez_Language_filtermodeFilterSkip - MWRez_Language_suppresswarnings0 - MWRez_Language_escapecontrolchars1 - MWRez_Language_prefixname - MWRez_Language_filteredtypes'CODE' 'DATA' 'PICT' - - - MWWinRC_prefixname - - - MWCodeGen_X86_processorGeneric - MWCodeGen_X86_alignmentbytes8 - MWCodeGen_X86_exceptionsZeroOverhead - MWCodeGen_X86_extinst_mmx0 - MWCodeGen_X86_extinst_3dnow0 - MWCodeGen_X86_use_mmx_3dnow_convention0 - MWCodeGen_X86_machinecodelisting0 - MWCodeGen_X86_intrinsics0 - MWCodeGen_X86_syminfo0 - MWCodeGen_X86_codeviewinfo1 - MWCodeGen_X86_extinst_cmov_fcomi0 - MWCodeGen_X86_extinst_sse0 - - - PDisasmX86_showHeaderstrue - PDisasmX86_showSymTabtrue - PDisasmX86_showCodetrue - PDisasmX86_showSourcefalse - PDisasmX86_showHextrue - PDisasmX86_showRelocationtrue - PDisasmX86_showCommentsfalse - PDisasmX86_showDebugfalse - PDisasmX86_showExceptionsfalse - PDisasmX86_showDatatrue - PDisasmX86_showRawfalse - PDisasmX86_verbosefalse - - - MWDebugger_X86_Exceptions - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - GlobalOptimizer_X86_optimizationlevelLevel0 - GlobalOptimizer_X86_optforSpeed - - - MWLinker_X86_entrypointusageDefault - MWLinker_X86_entrypoint - MWLinker_X86_subsystemWinGUI - MWLinker_X86_subsysmajorid4 - MWLinker_X86_subsysminorid0 - MWLinker_X86_usrmajorid0 - MWLinker_X86_usrminorid0 - MWLinker_X86_commandfile - MWLinker_X86_generatemap0 - MWLinker_X86_linksym0 - MWLinker_X86_linkCV1 - - - MWProject_X86_typeApplication - MWProject_X86_outfilenoname.exe - MWProject_X86_baseaddress4194304 - MWProject_X86_maxstacksize1024 - MWProject_X86_minstacksize4 - MWProject_X86_size1024 - MWProject_X86_minsize4 - MWProject_X86_importlib - xpidl Settings - 0001000101000000000000000000000000000000000000000000000000000000 - 0000000000000000 - - - - - Name - MSL_AppRuntime_PPC.Lib - MacOS - Library - - - - Name - NSStartup.c - MacOS - Text - Debug - - - - - Name - MSL_AppRuntime_PPC.Lib - MacOS - - - Name - NSStartup.c - MacOS - - - - - NSComponentStartup.o - - - - UserSourceTrees - - - AlwaysSearchUserPathsfalse - InterpretDOSAndUnixPathsfalse - RequireFrameworkStyleIncludesfalse - UserSearchPaths - - SearchPath - Path: - PathFormatMacOS - PathRootProject - - Recursivetrue - FrameworkPathfalse - HostFlagsAll - - - SearchPath - Path::::dist:gc: - PathFormatMacOS - PathRootProject - - Recursivetrue - FrameworkPathfalse - HostFlagsAll - - - SearchPath - Path::::dist:mac: - PathFormatMacOS - PathRootProject - - Recursivetrue - FrameworkPathfalse - HostFlagsAll - - - SystemSearchPaths - - SearchPath - Path: - PathFormatMacOS - PathRootCodeWarrior - - Recursivetrue - FrameworkPathfalse - HostFlagsAll - - - - - MWRuntimeSettings_WorkingDirectory - MWRuntimeSettings_CommandLine - MWRuntimeSettings_HostApplication - Path - PathFormatGeneric - PathRootAbsolute - - MWRuntimeSettings_EnvVars - - - LinkerMacOS PPC Linker - PreLinker - PostLinker - TargetnameNSComponentStartup.o - OutputDirectory - Path::::dist:mac:lib: - PathFormatMacOS - PathRootProject - - SaveEntriesUsingRelativePathsfalse - - - FileMappings - - FileTypeAPPL - FileExtension - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - FileTypeAppl - FileExtension - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - FileTypeMMLB - FileExtension - CompilerLib Import PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeMPLF - FileExtension - CompilerLib Import PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeMWCD - FileExtension - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - FileTypeRSRC - FileExtension - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.bh - CompilerBalloon Help - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.c - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.c++ - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.cc - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.cp - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.cpp - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.dylan - Compilermindy - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.exp - Compiler - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.h - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMaketrue - - - FileTypeTEXT - FileExtension.p - CompilerMW Pascal PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.pas - CompilerMW Pascal PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.pch - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompiletrue - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.pch++ - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompiletrue - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.ppu - CompilerMW Pascal PPC - EditLanguage - Precompiletrue - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.r - CompilerRez - EditLanguageRez - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.s - CompilerPPCAsm - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeXCOF - FileExtension - CompilerXCOFF Import PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypedocu - FileExtension - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - FileTypersrc - FileExtension - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - FileTypeshlb - FileExtension - CompilerPEF Import PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypestub - FileExtension - CompilerPEF Import PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileExtension.doc - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFilefalse - IgnoredByMaketrue - - - FileExtension.o - CompilerXCOFF Import PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileExtension.ppob - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - FileExtension.rsrc - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - - - CacheModDatestrue - ActivateBrowsertrue - DumpBrowserInfofalse - CacheSubprojectstrue - UseThirdPartyDebuggerfalse - DebuggerAppPath - Path - PathFormatGeneric - PathRootAbsolute - - DebuggerCmdLineArgs - DebuggerWorkingDir - Path - PathFormatGeneric - PathRootAbsolute - - - - LogSystemMessagestrue - AutoTargetDLLsfalse - StopAtWatchpointstrue - PauseWhileRunningfalse - PauseInterval5 - PauseUIFlags0 - AltExePath - Path - PathFormatGeneric - PathRootAbsolute - - StopAtTempBPOnLaunchtrue - CacheSymbolicstrue - TempBPFunctionNamemain - TempBPType0 - - - Enabledfalse - ConnectionName - DownloadPath - LaunchRemoteAppfalse - RemoteAppPath - - - OtherExecutables - - - CustomColor1 - Red0 - Green32767 - Blue0 - - CustomColor2 - Red0 - Green32767 - Blue0 - - CustomColor3 - Red0 - Green32767 - Blue0 - - CustomColor4 - Red0 - Green32767 - Blue0 - - - - MWFrontEnd_C_cplusplus0 - MWFrontEnd_C_checkprotos0 - MWFrontEnd_C_arm0 - MWFrontEnd_C_trigraphs0 - MWFrontEnd_C_onlystdkeywords0 - MWFrontEnd_C_enumsalwaysint0 - MWFrontEnd_C_mpwpointerstyle0 - MWFrontEnd_C_prefixnameNSStartupConfig.h - MWFrontEnd_C_ansistrict0 - MWFrontEnd_C_mpwcnewline0 - MWFrontEnd_C_wchar_type1 - MWFrontEnd_C_enableexceptions1 - MWFrontEnd_C_dontreusestrings0 - MWFrontEnd_C_poolstrings0 - MWFrontEnd_C_dontinline0 - MWFrontEnd_C_useRTTI1 - MWFrontEnd_C_multibyteaware0 - MWFrontEnd_C_unsignedchars0 - MWFrontEnd_C_autoinline0 - MWFrontEnd_C_booltruefalse1 - MWFrontEnd_C_direct_to_som0 - MWFrontEnd_C_som_env_check0 - MWFrontEnd_C_alwaysinline0 - MWFrontEnd_C_inlinelevel0 - MWFrontEnd_C_ecplusplus0 - MWFrontEnd_C_objective_c0 - MWFrontEnd_C_defer_codegen0 - - - MWWarning_C_warn_illpragma0 - MWWarning_C_warn_emptydecl0 - MWWarning_C_warn_possunwant0 - MWWarning_C_warn_unusedvar0 - MWWarning_C_warn_unusedarg0 - MWWarning_C_warn_extracomma0 - MWWarning_C_pedantic0 - MWWarning_C_warningerrors0 - MWWarning_C_warn_hidevirtual0 - MWWarning_C_warn_implicitconv0 - MWWarning_C_warn_notinlined0 - MWWarning_C_warn_structclass0 - - - MWFTP_Post_hostName - MWFTP_Post_username - MWFTP_Post_password0 - MWFTP_Post_remoteDir - MWFTP_Post_ftp_PathVersion1 - MWFTP_Post_ftp_PathType0 - MWFTP_Post_ftp_PathFormat0 - MWFTP_Post_ftp_tree - MWFTP_Post_uploadDir - MWFTP_Post_ftp_port21 - MWFTP_Post_SendBin1 - MWFTP_Post_ShouldLog1 - - - MWCommandLine_Java_clsName - MWCommandLine_Java_args - - - MWVJavaDebugging_Protocol1 - MWVJavaDebugging_JDKVersion1 - MWVJavaDebugging_TimeOut15 - MWVJavaDebugging_SupportSlowDevicesfalse - - - MWJava_Language_optimizefalse - MWJava_Language_warnDeprecatedfalse - MWJava_Language_emitMapfalse - MWJava_Language_strictFileNamesfalse - MWJava_Language_strictFileHierarchyfalse - MWJava_Language_1_1_Compatiblefalse - MWJava_Language_emitHeaders0 - MWJava_Language_headerTypeJNINativeHeaders - MWJava_Language_packageFilter - MWJava_Language_genCommentstrue - MWJava_Language_genHeadersfalse - - - MWJava_MRJAppBuilder_outFileMRJApplication - MWJava_MRJAppBuilder_mergefalse - MWJava_MRJAppBuilder_quitMenutrue - MWJava_MRJAppBuilder_growfalse - MWJava_MRJAppBuilder_stdoutTypeConsole - MWJava_MRJAppBuilder_stderrTypeConsole - MWJava_MRJAppBuilder_stdinTypeConsole - MWJava_MRJAppBuilder_appIconPVersion0 - MWJava_MRJAppBuilder_appIconPType0 - MWJava_MRJAppBuilder_appIconPFormat0 - MWJava_MRJAppBuilder_appIconPTree - MWJava_MRJAppBuilder_appIconFile - MWJava_MRJAppBuilder_splashScreenPVersion0 - MWJava_MRJAppBuilder_splashScreenPType0 - MWJava_MRJAppBuilder_splashScreenPFormat0 - MWJava_MRJAppBuilder_splashScreenPTree - MWJava_MRJAppBuilder_splashScreenPICTFile - MWJava_MRJAppBuilder_aboutName - MWJava_MRJAppBuilder_stdoutPVersion0 - MWJava_MRJAppBuilder_stdoutPType0 - MWJava_MRJAppBuilder_stdoutPFormat0 - MWJava_MRJAppBuilder_stdoutPTree - MWJava_MRJAppBuilder_stdoutFile - MWJava_MRJAppBuilder_stdoutAppendfalse - MWJava_MRJAppBuilder_stderrPType0 - MWJava_MRJAppBuilder_stderrPFormat0 - MWJava_MRJAppBuilder_stderrPTree - MWJava_MRJAppBuilder_stderrFile - MWJava_MRJAppBuilder_stderrAppendfalse - MWJava_MRJAppBuilder_stdinPType0 - MWJava_MRJAppBuilder_stdinPFormat0 - MWJava_MRJAppBuilder_stdinPTree - MWJava_MRJAppBuilder_stdinFile - - - MWJava_Output_outputtypeJarFile - MWJava_Output_outfileJavaClasses.jar - MWJava_Output_ftype1514754080 - MWJava_Output_fcreator1297570384 - MWJava_Output_compress0 - MWJava_Output_genManifest0 - MWJava_Output_trunctypeFront - MWJava_Output_deleteClasses0 - MWJava_Output_consoleApp1 - - - MWJava_Proj_projtypeApplet - MWJava_Proj_mainClassName - MWJava_Proj_HTMLAppCreator1145457748 - MWJava_Proj_HTMLAppNameMetrowerks Java - MWJava_Proj_PathVersion1 - MWJava_Proj_PathType0 - MWJava_Proj_PathFormat0 - MWJava_Proj_tree - MWJava_Proj_HTMLAppWin32NameInternet Explorer - MWJava_Proj_compress0 - MWJava_Proj_useVM1 - MWJava_Proj_vmarguments - MWJava_Proj_vmName - MWJava_Proj_simPropFile - - - MWJavaDoc_Proj_Version1 - MWJavaDoc_Proj_Depricated1 - MWJavaDoc_Proj_Author1 - MWJavaDoc_Proj_Index1 - MWJavaDoc_Proj_Tree1 - MWJavaDoc_Proj_SunResolveToSame0 - MWJavaDoc_Proj_Shortnames1 - MWJavaDoc_Proj_Folder0 - MWJavaDoc_Proj_GenerateAPILinks0 - MWJavaDoc_Proj_scopePublic - MWJavaDoc_Proj_fcreator1297303877 - MWJavaDoc_Proj_encodingName - MWJavaDoc_Proj_decodingName - MWJavaDoc_Proj_javaPackagePathhttp://java.sun.com/products/jdk/1.1/docs/api/ - - - MWMerge_MacOS_projectTypeApplication - MWMerge_MacOS_outputNameMerge Out - MWMerge_MacOS_outputCreator???? - MWMerge_MacOS_outputTypeAPPL - MWMerge_MacOS_suppressWarning0 - MWMerge_MacOS_copyFragments1 - MWMerge_MacOS_copyResources1 - MWMerge_MacOS_flattenResource0 - MWMerge_MacOS_flatFileNamea.rsrc - MWMerge_MacOS_flatFileOutputPath - Path: - PathFormatMacOS - PathRootProject - - MWMerge_MacOS_skipResources - DLGX - ckid - Proj - WSPC - - - - FileLockedfalse - ResourcesMapIsReadOnlyfalse - PrinterDriverIsMultiFinderCompatiblefalse - Invisiblefalse - HasBundlefalse - NameLockedfalse - Stationeryfalse - HasCustomIconfalse - Sharedfalse - HasBeenInitedfalse - Label0 - Comments - - - MWMacOSPackager_UsePackager0 - MWMacOSPackager_FolderToPackage - Path: - PathFormatMacOS - PathRootProject - - MWMacOSPackager_CreateClassicAlias0 - MWMacOSPackager_ClassicAliasMethodUseTargetOutput - MWMacOSPackager_ClassicAliasPath - Path: - PathFormatMacOS - PathRootProject - - MWMacOSPackager_CreatePkgInfo0 - MWMacOSPackager_PkgCreatorType???? - MWMacOSPackager_PkgFileTypeAPPL - - - MWCodeGen_PPC_structalignmentMC68K - MWCodeGen_PPC_tracebacktablesNone - MWCodeGen_PPC_processorGeneric - MWCodeGen_PPC_readonlystrings0 - MWCodeGen_PPC_tocdata1 - MWCodeGen_PPC_profiler0 - MWCodeGen_PPC_fpcontract1 - MWCodeGen_PPC_schedule0 - MWCodeGen_PPC_peephole1 - MWCodeGen_PPC_processorspecific0 - MWCodeGen_PPC_altivec0 - MWCodeGen_PPC_vectortocdata0 - MWCodeGen_PPC_vrsave0 - - - MWCodeGen_MachO_structalignmentPPC - MWCodeGen_MachO_tracebacktablesNone - MWCodeGen_MachO_processorGeneric - MWCodeGen_MachO_readonlystrings0 - MWCodeGen_MachO_profiler0 - MWCodeGen_MachO_fpcontract1 - MWCodeGen_MachO_schedule0 - MWCodeGen_MachO_peephole1 - MWCodeGen_MachO_processorspecific0 - MWCodeGen_MachO_altivec0 - MWCodeGen_MachO_vrsave1 - MWCodeGen_MachO_common0 - MWCodeGen_MachO_implicit_templates1 - - - MWDisassembler_PPC_showcode1 - MWDisassembler_PPC_extended1 - MWDisassembler_PPC_mix0 - MWDisassembler_PPC_nohex0 - MWDisassembler_PPC_showdata1 - MWDisassembler_PPC_showexceptions1 - MWDisassembler_PPC_showsym0 - MWDisassembler_PPC_shownames1 - - - GlobalOptimizer_PPC_optimizationlevelLevel0 - GlobalOptimizer_PPC_optforSpeed - - - MWLinker_PPC_linksym1 - MWLinker_PPC_symfullpath1 - MWLinker_PPC_linkmap0 - MWLinker_PPC_nolinkwarnings0 - MWLinker_PPC_dontdeadstripinitcode0 - MWLinker_PPC_permitmultdefs0 - MWLinker_PPC_linkmodeFast - MWLinker_PPC_initname - MWLinker_PPC_mainname__start - MWLinker_PPC_termname - - - MWLinker_MachO_exportsNone - MWLinker_MachO_mainnamestart - MWLinker_MachO_currentversion0 - MWLinker_MachO_compatibleversion0 - MWLinker_MachO_symfullpath0 - MWLinker_MachO_supresswarnings0 - MWLinker_MachO_multisymerror1 - MWLinker_MachO_prebind1 - MWLinker_MachO_deadstrip1 - MWLinker_MachO_objectivecsemantics1 - MWLinker_MachO_whichfileloaded0 - MWLinker_MachO_whyfileloaded0 - MWLinker_MachO_readonlyrelocsErrors - MWLinker_MachO_undefinedsymbolsErrors - MWLinker_MachO_twolevelnamespace1 - MWLinker_MachO_stripdebugsymbols0 - - - MWProject_MachO_typeBundle - MWProject_MachO_outfilea.out - MWProject_MachO_filecreator???? - MWProject_MachO_filetypeMAPL - MWProject_MachO_stacksize64 - MWProject_MachO_stackaddress0 - MWProject_MachO_flatrsrc0 - MWProject_MachO_flatrsrcfilenamea.rsrc - MWProject_MachO_flatrsrcoutputdir - Path: - PathFormatMacOS - PathRootProject - - MWProject_MachO_installpath./ - - - MWPEF_exportsNone - MWPEF_libfolder0 - MWPEF_sortcodeNone - MWPEF_expandbss0 - MWPEF_sharedata0 - MWPEF_olddefversion0 - MWPEF_oldimpversion0 - MWPEF_currentversion0 - MWPEF_fragmentname - MWPEF_collapsereloads0 - - - MWProject_PPC_typeLibrary - MWProject_PPC_outfileNSComponentStartup.o - MWProject_PPC_filecreator???? - MWProject_PPC_filetype???? - MWProject_PPC_size0 - MWProject_PPC_minsize0 - MWProject_PPC_stacksize0 - MWProject_PPC_flags0 - MWProject_PPC_symfilename - MWProject_PPC_rsrcname - MWProject_PPC_rsrcheaderNative - MWProject_PPC_rsrctype???? - MWProject_PPC_rsrcid0 - MWProject_PPC_rsrcflags0 - MWProject_PPC_rsrcstore0 - MWProject_PPC_rsrcmerge0 - MWProject_PPC_flatrsrc0 - MWProject_PPC_flatrsrcoutputdir - Path: - PathFormatMacOS - PathRootProject - - MWProject_PPC_flatrsrcfilename - - - MWAssembler_PPC_auxheader0 - MWAssembler_PPC_symmodeMac - MWAssembler_PPC_dialectPPC - MWAssembler_PPC_prefixfile - MWAssembler_PPC_typecheck0 - MWAssembler_PPC_warnings0 - MWAssembler_PPC_casesensitive0 - - - MWRez_Language_maxwidth80 - MWRez_Language_scriptRoman - MWRez_Language_alignmentAlign1 - MWRez_Language_filtermodeFilterSkip - MWRez_Language_suppresswarnings0 - MWRez_Language_escapecontrolchars1 - MWRez_Language_prefixname - MWRez_Language_filteredtypes'CODE' 'DATA' 'PICT' - - - MWWinRC_prefixname - - - MWCodeGen_X86_processorGeneric - MWCodeGen_X86_alignmentbytes8 - MWCodeGen_X86_exceptionsZeroOverhead - MWCodeGen_X86_extinst_mmx0 - MWCodeGen_X86_extinst_3dnow0 - MWCodeGen_X86_use_mmx_3dnow_convention0 - MWCodeGen_X86_machinecodelisting0 - MWCodeGen_X86_intrinsics0 - MWCodeGen_X86_syminfo0 - MWCodeGen_X86_codeviewinfo1 - MWCodeGen_X86_extinst_cmov_fcomi0 - MWCodeGen_X86_extinst_sse0 - - - PDisasmX86_showHeaderstrue - PDisasmX86_showSymTabtrue - PDisasmX86_showCodetrue - PDisasmX86_showSourcefalse - PDisasmX86_showHextrue - PDisasmX86_showRelocationtrue - PDisasmX86_showCommentsfalse - PDisasmX86_showDebugfalse - PDisasmX86_showExceptionsfalse - PDisasmX86_showDatatrue - PDisasmX86_showRawfalse - PDisasmX86_verbosefalse - - - MWDebugger_X86_Exceptions - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - GlobalOptimizer_X86_optimizationlevelLevel0 - GlobalOptimizer_X86_optforSpeed - - - MWLinker_X86_entrypointusageDefault - MWLinker_X86_entrypoint - MWLinker_X86_subsystemWinGUI - MWLinker_X86_subsysmajorid4 - MWLinker_X86_subsysminorid0 - MWLinker_X86_usrmajorid0 - MWLinker_X86_usrminorid0 - MWLinker_X86_commandfile - MWLinker_X86_generatemap0 - MWLinker_X86_linksym0 - MWLinker_X86_linkCV1 - - - MWProject_X86_typeApplication - MWProject_X86_outfilenoname.exe - MWProject_X86_baseaddress4194304 - MWProject_X86_maxstacksize1024 - MWProject_X86_minstacksize4 - MWProject_X86_size1024 - MWProject_X86_minsize4 - MWProject_X86_importlib - xpidl Settings - 0001000101000000000000000000000000000000000000000000000000000000 - 0000000000000000 - - - - - Name - NSStartup.c - MacOS - Text - Debug - - - Name - MSL_DropInRuntime_PPC.Lib - MacOS - Library - - - - - - Name - MSL_DropInRuntime_PPC.Lib - MacOS - - - Name - NSStartup.c - MacOS - - - - - NSLibraryStartup.o - - - - UserSourceTrees - - - AlwaysSearchUserPathsfalse - InterpretDOSAndUnixPathsfalse - RequireFrameworkStyleIncludesfalse - UserSearchPaths - - SearchPath - Path: - PathFormatMacOS - PathRootProject - - Recursivetrue - FrameworkPathfalse - HostFlagsAll - - - SearchPath - Path::::dist:gc: - PathFormatMacOS - PathRootProject - - Recursivetrue - FrameworkPathfalse - HostFlagsAll - - - SearchPath - Path::::dist:mac: - PathFormatMacOS - PathRootProject - - Recursivetrue - FrameworkPathfalse - HostFlagsAll - - - SystemSearchPaths - - SearchPath - Path: - PathFormatMacOS - PathRootCodeWarrior - - Recursivetrue - FrameworkPathfalse - HostFlagsAll - - - - - MWRuntimeSettings_WorkingDirectory - MWRuntimeSettings_CommandLine - MWRuntimeSettings_HostApplication - Path - PathFormatGeneric - PathRootAbsolute - - MWRuntimeSettings_EnvVars - - - LinkerMacOS PPC Linker - PreLinker - PostLinker - TargetnameNSLibraryStartup.o - OutputDirectory - Path::::dist:mac:lib: - PathFormatMacOS - PathRootProject - - SaveEntriesUsingRelativePathsfalse - - - FileMappings - - FileTypeAPPL - FileExtension - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - FileTypeAppl - FileExtension - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - FileTypeMMLB - FileExtension - CompilerLib Import PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeMPLF - FileExtension - CompilerLib Import PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeMWCD - FileExtension - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - FileTypeRSRC - FileExtension - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.bh - CompilerBalloon Help - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.c - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.c++ - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.cc - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.cp - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.cpp - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.dylan - Compilermindy - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.exp - Compiler - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.h - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMaketrue - - - FileTypeTEXT - FileExtension.p - CompilerMW Pascal PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.pas - CompilerMW Pascal PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.pch - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompiletrue - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.pch++ - CompilerMW C/C++ PPC - EditLanguageC/C++ - Precompiletrue - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.ppu - CompilerMW Pascal PPC - EditLanguage - Precompiletrue - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.r - CompilerRez - EditLanguageRez - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.s - CompilerPPCAsm - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeXCOF - FileExtension - CompilerXCOFF Import PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypedocu - FileExtension - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - FileTypersrc - FileExtension - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - FileTypeshlb - FileExtension - CompilerPEF Import PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypestub - FileExtension - CompilerPEF Import PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileExtension.doc - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFilefalse - IgnoredByMaketrue - - - FileExtension.o - CompilerXCOFF Import PPC - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileExtension.ppob - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - FileExtension.rsrc - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFiletrue - IgnoredByMakefalse - - - - - CacheModDatestrue - ActivateBrowsertrue - DumpBrowserInfofalse - CacheSubprojectstrue - UseThirdPartyDebuggerfalse - DebuggerAppPath - Path - PathFormatGeneric - PathRootAbsolute - - DebuggerCmdLineArgs - DebuggerWorkingDir - Path - PathFormatGeneric - PathRootAbsolute - - - - LogSystemMessagestrue - AutoTargetDLLsfalse - StopAtWatchpointstrue - PauseWhileRunningfalse - PauseInterval5 - PauseUIFlags0 - AltExePath - Path - PathFormatGeneric - PathRootAbsolute - - StopAtTempBPOnLaunchtrue - CacheSymbolicstrue - TempBPFunctionNamemain - TempBPType0 - - - Enabledfalse - ConnectionName - DownloadPath - LaunchRemoteAppfalse - RemoteAppPath - - - OtherExecutables - - - CustomColor1 - Red0 - Green32767 - Blue0 - - CustomColor2 - Red0 - Green32767 - Blue0 - - CustomColor3 - Red0 - Green32767 - Blue0 - - CustomColor4 - Red0 - Green32767 - Blue0 - - - - MWFrontEnd_C_cplusplus0 - MWFrontEnd_C_checkprotos0 - MWFrontEnd_C_arm0 - MWFrontEnd_C_trigraphs0 - MWFrontEnd_C_onlystdkeywords0 - MWFrontEnd_C_enumsalwaysint0 - MWFrontEnd_C_mpwpointerstyle0 - MWFrontEnd_C_prefixnameNSStartupConfig.h - MWFrontEnd_C_ansistrict0 - MWFrontEnd_C_mpwcnewline0 - MWFrontEnd_C_wchar_type1 - MWFrontEnd_C_enableexceptions1 - MWFrontEnd_C_dontreusestrings0 - MWFrontEnd_C_poolstrings0 - MWFrontEnd_C_dontinline0 - MWFrontEnd_C_useRTTI1 - MWFrontEnd_C_multibyteaware0 - MWFrontEnd_C_unsignedchars0 - MWFrontEnd_C_autoinline0 - MWFrontEnd_C_booltruefalse1 - MWFrontEnd_C_direct_to_som0 - MWFrontEnd_C_som_env_check0 - MWFrontEnd_C_alwaysinline0 - MWFrontEnd_C_inlinelevel0 - MWFrontEnd_C_ecplusplus0 - MWFrontEnd_C_objective_c0 - MWFrontEnd_C_defer_codegen0 - - - MWWarning_C_warn_illpragma0 - MWWarning_C_warn_emptydecl0 - MWWarning_C_warn_possunwant0 - MWWarning_C_warn_unusedvar0 - MWWarning_C_warn_unusedarg0 - MWWarning_C_warn_extracomma0 - MWWarning_C_pedantic0 - MWWarning_C_warningerrors0 - MWWarning_C_warn_hidevirtual0 - MWWarning_C_warn_implicitconv0 - MWWarning_C_warn_notinlined0 - MWWarning_C_warn_structclass0 - - - MWFTP_Post_hostName - MWFTP_Post_username - MWFTP_Post_password0 - MWFTP_Post_remoteDir - MWFTP_Post_ftp_PathVersion1 - MWFTP_Post_ftp_PathType0 - MWFTP_Post_ftp_PathFormat0 - MWFTP_Post_ftp_tree - MWFTP_Post_uploadDir - MWFTP_Post_ftp_port21 - MWFTP_Post_SendBin1 - MWFTP_Post_ShouldLog1 - - - MWCommandLine_Java_clsName - MWCommandLine_Java_args - - - MWVJavaDebugging_Protocol1 - MWVJavaDebugging_JDKVersion1 - MWVJavaDebugging_TimeOut15 - MWVJavaDebugging_SupportSlowDevicesfalse - - - MWJava_Language_optimizefalse - MWJava_Language_warnDeprecatedfalse - MWJava_Language_emitMapfalse - MWJava_Language_strictFileNamesfalse - MWJava_Language_strictFileHierarchyfalse - MWJava_Language_1_1_Compatiblefalse - MWJava_Language_emitHeaders0 - MWJava_Language_headerTypeJNINativeHeaders - MWJava_Language_packageFilter - MWJava_Language_genCommentstrue - MWJava_Language_genHeadersfalse - - - MWJava_MRJAppBuilder_outFileMRJApplication - MWJava_MRJAppBuilder_mergefalse - MWJava_MRJAppBuilder_quitMenutrue - MWJava_MRJAppBuilder_growfalse - MWJava_MRJAppBuilder_stdoutTypeConsole - MWJava_MRJAppBuilder_stderrTypeConsole - MWJava_MRJAppBuilder_stdinTypeConsole - MWJava_MRJAppBuilder_appIconPVersion0 - MWJava_MRJAppBuilder_appIconPType0 - MWJava_MRJAppBuilder_appIconPFormat0 - MWJava_MRJAppBuilder_appIconPTree - MWJava_MRJAppBuilder_appIconFile - MWJava_MRJAppBuilder_splashScreenPVersion0 - MWJava_MRJAppBuilder_splashScreenPType0 - MWJava_MRJAppBuilder_splashScreenPFormat0 - MWJava_MRJAppBuilder_splashScreenPTree - MWJava_MRJAppBuilder_splashScreenPICTFile - MWJava_MRJAppBuilder_aboutName - MWJava_MRJAppBuilder_stdoutPVersion0 - MWJava_MRJAppBuilder_stdoutPType0 - MWJava_MRJAppBuilder_stdoutPFormat0 - MWJava_MRJAppBuilder_stdoutPTree - MWJava_MRJAppBuilder_stdoutFile - MWJava_MRJAppBuilder_stdoutAppendfalse - MWJava_MRJAppBuilder_stderrPType0 - MWJava_MRJAppBuilder_stderrPFormat0 - MWJava_MRJAppBuilder_stderrPTree - MWJava_MRJAppBuilder_stderrFile - MWJava_MRJAppBuilder_stderrAppendfalse - MWJava_MRJAppBuilder_stdinPType0 - MWJava_MRJAppBuilder_stdinPFormat0 - MWJava_MRJAppBuilder_stdinPTree - MWJava_MRJAppBuilder_stdinFile - - - MWJava_Output_outputtypeJarFile - MWJava_Output_outfileJavaClasses.jar - MWJava_Output_ftype1514754080 - MWJava_Output_fcreator1297570384 - MWJava_Output_compress0 - MWJava_Output_genManifest0 - MWJava_Output_trunctypeFront - MWJava_Output_deleteClasses0 - MWJava_Output_consoleApp1 - - - MWJava_Proj_projtypeApplet - MWJava_Proj_mainClassName - MWJava_Proj_HTMLAppCreator1145457748 - MWJava_Proj_HTMLAppNameMetrowerks Java - MWJava_Proj_PathVersion1 - MWJava_Proj_PathType0 - MWJava_Proj_PathFormat0 - MWJava_Proj_tree - MWJava_Proj_HTMLAppWin32NameInternet Explorer - MWJava_Proj_compress0 - MWJava_Proj_useVM1 - MWJava_Proj_vmarguments - MWJava_Proj_vmName - MWJava_Proj_simPropFile - - - MWJavaDoc_Proj_Version1 - MWJavaDoc_Proj_Depricated1 - MWJavaDoc_Proj_Author1 - MWJavaDoc_Proj_Index1 - MWJavaDoc_Proj_Tree1 - MWJavaDoc_Proj_SunResolveToSame0 - MWJavaDoc_Proj_Shortnames1 - MWJavaDoc_Proj_Folder0 - MWJavaDoc_Proj_GenerateAPILinks0 - MWJavaDoc_Proj_scopePublic - MWJavaDoc_Proj_fcreator1297303877 - MWJavaDoc_Proj_encodingName - MWJavaDoc_Proj_decodingName - MWJavaDoc_Proj_javaPackagePathhttp://java.sun.com/products/jdk/1.1/docs/api/ - - - MWMerge_MacOS_projectTypeApplication - MWMerge_MacOS_outputNameMerge Out - MWMerge_MacOS_outputCreator???? - MWMerge_MacOS_outputTypeAPPL - MWMerge_MacOS_suppressWarning0 - MWMerge_MacOS_copyFragments1 - MWMerge_MacOS_copyResources1 - MWMerge_MacOS_flattenResource0 - MWMerge_MacOS_flatFileNamea.rsrc - MWMerge_MacOS_flatFileOutputPath - Path: - PathFormatMacOS - PathRootProject - - MWMerge_MacOS_skipResources - DLGX - ckid - Proj - WSPC - - - - FileLockedfalse - ResourcesMapIsReadOnlyfalse - PrinterDriverIsMultiFinderCompatiblefalse - Invisiblefalse - HasBundlefalse - NameLockedfalse - Stationeryfalse - HasCustomIconfalse - Sharedfalse - HasBeenInitedfalse - Label0 - Comments - - - MWMacOSPackager_UsePackager0 - MWMacOSPackager_FolderToPackage - Path: - PathFormatMacOS - PathRootProject - - MWMacOSPackager_CreateClassicAlias0 - MWMacOSPackager_ClassicAliasMethodUseTargetOutput - MWMacOSPackager_ClassicAliasPath - Path: - PathFormatMacOS - PathRootProject - - MWMacOSPackager_CreatePkgInfo0 - MWMacOSPackager_PkgCreatorType???? - MWMacOSPackager_PkgFileTypeAPPL - - - MWCodeGen_PPC_structalignmentMC68K - MWCodeGen_PPC_tracebacktablesNone - MWCodeGen_PPC_processorGeneric - MWCodeGen_PPC_readonlystrings0 - MWCodeGen_PPC_tocdata1 - MWCodeGen_PPC_profiler0 - MWCodeGen_PPC_fpcontract1 - MWCodeGen_PPC_schedule0 - MWCodeGen_PPC_peephole1 - MWCodeGen_PPC_processorspecific0 - MWCodeGen_PPC_altivec0 - MWCodeGen_PPC_vectortocdata0 - MWCodeGen_PPC_vrsave0 - - - MWCodeGen_MachO_structalignmentPPC - MWCodeGen_MachO_tracebacktablesNone - MWCodeGen_MachO_processorGeneric - MWCodeGen_MachO_readonlystrings0 - MWCodeGen_MachO_profiler0 - MWCodeGen_MachO_fpcontract1 - MWCodeGen_MachO_schedule0 - MWCodeGen_MachO_peephole1 - MWCodeGen_MachO_processorspecific0 - MWCodeGen_MachO_altivec0 - MWCodeGen_MachO_vrsave1 - MWCodeGen_MachO_common0 - MWCodeGen_MachO_implicit_templates1 - - - MWDisassembler_PPC_showcode1 - MWDisassembler_PPC_extended1 - MWDisassembler_PPC_mix0 - MWDisassembler_PPC_nohex0 - MWDisassembler_PPC_showdata1 - MWDisassembler_PPC_showexceptions1 - MWDisassembler_PPC_showsym0 - MWDisassembler_PPC_shownames1 - - - GlobalOptimizer_PPC_optimizationlevelLevel0 - GlobalOptimizer_PPC_optforSpeed - - - MWLinker_PPC_linksym1 - MWLinker_PPC_symfullpath1 - MWLinker_PPC_linkmap0 - MWLinker_PPC_nolinkwarnings0 - MWLinker_PPC_dontdeadstripinitcode0 - MWLinker_PPC_permitmultdefs0 - MWLinker_PPC_linkmodeFast - MWLinker_PPC_initname - MWLinker_PPC_mainname__start - MWLinker_PPC_termname - - - MWLinker_MachO_exportsNone - MWLinker_MachO_mainnamestart - MWLinker_MachO_currentversion0 - MWLinker_MachO_compatibleversion0 - MWLinker_MachO_symfullpath0 - MWLinker_MachO_supresswarnings0 - MWLinker_MachO_multisymerror1 - MWLinker_MachO_prebind1 - MWLinker_MachO_deadstrip1 - MWLinker_MachO_objectivecsemantics1 - MWLinker_MachO_whichfileloaded0 - MWLinker_MachO_whyfileloaded0 - MWLinker_MachO_readonlyrelocsErrors - MWLinker_MachO_undefinedsymbolsErrors - MWLinker_MachO_twolevelnamespace1 - MWLinker_MachO_stripdebugsymbols0 - - - MWProject_MachO_typeBundle - MWProject_MachO_outfilea.out - MWProject_MachO_filecreator???? - MWProject_MachO_filetypeMAPL - MWProject_MachO_stacksize64 - MWProject_MachO_stackaddress0 - MWProject_MachO_flatrsrc0 - MWProject_MachO_flatrsrcfilenamea.rsrc - MWProject_MachO_flatrsrcoutputdir - Path: - PathFormatMacOS - PathRootProject - - MWProject_MachO_installpath./ - - - MWPEF_exportsNone - MWPEF_libfolder0 - MWPEF_sortcodeNone - MWPEF_expandbss0 - MWPEF_sharedata0 - MWPEF_olddefversion0 - MWPEF_oldimpversion0 - MWPEF_currentversion0 - MWPEF_fragmentname - MWPEF_collapsereloads0 - - - MWProject_PPC_typeLibrary - MWProject_PPC_outfileNSLibraryStartup.o - MWProject_PPC_filecreator???? - MWProject_PPC_filetype???? - MWProject_PPC_size0 - MWProject_PPC_minsize0 - MWProject_PPC_stacksize0 - MWProject_PPC_flags0 - MWProject_PPC_symfilename - MWProject_PPC_rsrcname - MWProject_PPC_rsrcheaderNative - MWProject_PPC_rsrctype???? - MWProject_PPC_rsrcid0 - MWProject_PPC_rsrcflags0 - MWProject_PPC_rsrcstore0 - MWProject_PPC_rsrcmerge0 - MWProject_PPC_flatrsrc0 - MWProject_PPC_flatrsrcoutputdir - Path: - PathFormatMacOS - PathRootProject - - MWProject_PPC_flatrsrcfilename - - - MWAssembler_PPC_auxheader0 - MWAssembler_PPC_symmodeMac - MWAssembler_PPC_dialectPPC - MWAssembler_PPC_prefixfile - MWAssembler_PPC_typecheck0 - MWAssembler_PPC_warnings0 - MWAssembler_PPC_casesensitive0 - - - MWRez_Language_maxwidth80 - MWRez_Language_scriptRoman - MWRez_Language_alignmentAlign1 - MWRez_Language_filtermodeFilterSkip - MWRez_Language_suppresswarnings0 - MWRez_Language_escapecontrolchars1 - MWRez_Language_prefixname - MWRez_Language_filteredtypes'CODE' 'DATA' 'PICT' - - - MWWinRC_prefixname - - - MWCodeGen_X86_processorGeneric - MWCodeGen_X86_alignmentbytes8 - MWCodeGen_X86_exceptionsZeroOverhead - MWCodeGen_X86_extinst_mmx0 - MWCodeGen_X86_extinst_3dnow0 - MWCodeGen_X86_use_mmx_3dnow_convention0 - MWCodeGen_X86_machinecodelisting0 - MWCodeGen_X86_intrinsics0 - MWCodeGen_X86_syminfo0 - MWCodeGen_X86_codeviewinfo1 - MWCodeGen_X86_extinst_cmov_fcomi0 - MWCodeGen_X86_extinst_sse0 - - - PDisasmX86_showHeaderstrue - PDisasmX86_showSymTabtrue - PDisasmX86_showCodetrue - PDisasmX86_showSourcefalse - PDisasmX86_showHextrue - PDisasmX86_showRelocationtrue - PDisasmX86_showCommentsfalse - PDisasmX86_showDebugfalse - PDisasmX86_showExceptionsfalse - PDisasmX86_showDatatrue - PDisasmX86_showRawfalse - PDisasmX86_verbosefalse - - - MWDebugger_X86_Exceptions - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - GlobalOptimizer_X86_optimizationlevelLevel0 - GlobalOptimizer_X86_optforSpeed - - - MWLinker_X86_entrypointusageDefault - MWLinker_X86_entrypoint - MWLinker_X86_subsystemWinGUI - MWLinker_X86_subsysmajorid4 - MWLinker_X86_subsysminorid0 - MWLinker_X86_usrmajorid0 - MWLinker_X86_usrminorid0 - MWLinker_X86_commandfile - MWLinker_X86_generatemap0 - MWLinker_X86_linksym0 - MWLinker_X86_linkCV1 - - - MWProject_X86_typeApplication - MWProject_X86_outfilenoname.exe - MWProject_X86_baseaddress4194304 - MWProject_X86_maxstacksize1024 - MWProject_X86_minstacksize4 - MWProject_X86_size1024 - MWProject_X86_minsize4 - MWProject_X86_importlib - xpidl Settings - 0001000101000000000000000000000000000000000000000000000000000000 - 0000000000000000 - - - - - Name - NSStartup.c - MacOS - Text - Debug - - - Name - MSL_ShLibRuntime_PPC.Lib - MacOS - Library - - - - - - Name - MSL_ShLibRuntime_PPC.Lib - MacOS - - - Name - NSStartup.c - MacOS - - - - - NSStartup.all - - - - UserSourceTrees - - - AlwaysSearchUserPathsfalse - InterpretDOSAndUnixPathsfalse - RequireFrameworkStyleIncludesfalse - UserSearchPaths - - SearchPath - Path: - PathFormatMacOS - PathRootProject - - Recursivetrue - FrameworkPathfalse - HostFlagsAll - - - SystemSearchPaths - - SearchPath - Path: - PathFormatMacOS - PathRootCodeWarrior - - Recursivetrue - FrameworkPathfalse - HostFlagsAll - - - - - MWRuntimeSettings_WorkingDirectory - MWRuntimeSettings_CommandLine - MWRuntimeSettings_HostApplication - Path - PathFormatGeneric - PathRootAbsolute - - MWRuntimeSettings_EnvVars - - - LinkerNone - PreLinker - PostLinker - TargetnameNSStartup.all - OutputDirectory - Path: - PathFormatMacOS - PathRootProject - - SaveEntriesUsingRelativePathsfalse - - - FileMappings - - FileTypeMMPr - FileExtension - Compiler - EditLanguage - Precompilefalse - Launchabletrue - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.c - CompilerRunTSScript - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - FileTypeTEXT - FileExtension.idl - Compilerxpidl - EditLanguage - Precompilefalse - Launchablefalse - ResourceFilefalse - IgnoredByMakefalse - - - - - CacheModDatestrue - ActivateBrowsertrue - DumpBrowserInfofalse - CacheSubprojectstrue - UseThirdPartyDebuggerfalse - DebuggerAppPath - Path - PathFormatGeneric - PathRootAbsolute - - DebuggerCmdLineArgs - DebuggerWorkingDir - Path - PathFormatGeneric - PathRootAbsolute - - - - LogSystemMessagestrue - AutoTargetDLLsfalse - StopAtWatchpointstrue - PauseWhileRunningfalse - PauseInterval5 - PauseUIFlags0 - AltExePath - Path - PathFormatGeneric - PathRootAbsolute - - StopAtTempBPOnLaunchtrue - CacheSymbolicstrue - TempBPFunctionNamemain - TempBPType0 - - - Enabledfalse - ConnectionName - DownloadPath - LaunchRemoteAppfalse - RemoteAppPath - - - OtherExecutables - - - CustomColor1 - Red0 - Green32767 - Blue0 - - CustomColor2 - Red0 - Green32767 - Blue0 - - CustomColor3 - Red0 - Green32767 - Blue0 - - CustomColor4 - Red0 - Green32767 - Blue0 - - - - MWFrontEnd_C_cplusplus0 - MWFrontEnd_C_checkprotos0 - MWFrontEnd_C_arm0 - MWFrontEnd_C_trigraphs0 - MWFrontEnd_C_onlystdkeywords0 - MWFrontEnd_C_enumsalwaysint0 - MWFrontEnd_C_mpwpointerstyle0 - MWFrontEnd_C_prefixname - MWFrontEnd_C_ansistrict0 - MWFrontEnd_C_mpwcnewline0 - MWFrontEnd_C_wchar_type1 - MWFrontEnd_C_enableexceptions1 - MWFrontEnd_C_dontreusestrings0 - MWFrontEnd_C_poolstrings0 - MWFrontEnd_C_dontinline0 - MWFrontEnd_C_useRTTI1 - MWFrontEnd_C_multibyteaware0 - MWFrontEnd_C_unsignedchars0 - MWFrontEnd_C_autoinline0 - MWFrontEnd_C_booltruefalse1 - MWFrontEnd_C_direct_to_som0 - MWFrontEnd_C_som_env_check0 - MWFrontEnd_C_alwaysinline0 - MWFrontEnd_C_inlinelevel0 - MWFrontEnd_C_ecplusplus0 - MWFrontEnd_C_objective_c0 - MWFrontEnd_C_defer_codegen0 - - - MWWarning_C_warn_illpragma0 - MWWarning_C_warn_emptydecl0 - MWWarning_C_warn_possunwant0 - MWWarning_C_warn_unusedvar0 - MWWarning_C_warn_unusedarg0 - MWWarning_C_warn_extracomma0 - MWWarning_C_pedantic0 - MWWarning_C_warningerrors0 - MWWarning_C_warn_hidevirtual0 - MWWarning_C_warn_implicitconv0 - MWWarning_C_warn_notinlined0 - MWWarning_C_warn_structclass0 - - - MWFTP_Post_hostName - MWFTP_Post_username - MWFTP_Post_password0 - MWFTP_Post_remoteDir - MWFTP_Post_ftp_PathVersion1 - MWFTP_Post_ftp_PathType0 - MWFTP_Post_ftp_PathFormat0 - MWFTP_Post_ftp_tree - MWFTP_Post_uploadDir - MWFTP_Post_ftp_port21 - MWFTP_Post_SendBin1 - MWFTP_Post_ShouldLog1 - - - MWCommandLine_Java_clsName - MWCommandLine_Java_args - - - MWVJavaDebugging_Protocol1 - MWVJavaDebugging_JDKVersion1 - MWVJavaDebugging_TimeOut15 - MWVJavaDebugging_SupportSlowDevicesfalse - - - MWJava_Language_optimizefalse - MWJava_Language_warnDeprecatedfalse - MWJava_Language_emitMapfalse - MWJava_Language_strictFileNamesfalse - MWJava_Language_strictFileHierarchyfalse - MWJava_Language_1_1_Compatiblefalse - MWJava_Language_emitHeaders0 - MWJava_Language_headerTypeJNINativeHeaders - MWJava_Language_packageFilter - MWJava_Language_genCommentstrue - MWJava_Language_genHeadersfalse - - - MWJava_MRJAppBuilder_outFileMRJApplication - MWJava_MRJAppBuilder_mergefalse - MWJava_MRJAppBuilder_quitMenutrue - MWJava_MRJAppBuilder_growfalse - MWJava_MRJAppBuilder_stdoutTypeConsole - MWJava_MRJAppBuilder_stderrTypeConsole - MWJava_MRJAppBuilder_stdinTypeConsole - MWJava_MRJAppBuilder_appIconPVersion0 - MWJava_MRJAppBuilder_appIconPType0 - MWJava_MRJAppBuilder_appIconPFormat0 - MWJava_MRJAppBuilder_appIconPTree - MWJava_MRJAppBuilder_appIconFile - MWJava_MRJAppBuilder_splashScreenPVersion0 - MWJava_MRJAppBuilder_splashScreenPType0 - MWJava_MRJAppBuilder_splashScreenPFormat0 - MWJava_MRJAppBuilder_splashScreenPTree - MWJava_MRJAppBuilder_splashScreenPICTFile - MWJava_MRJAppBuilder_aboutName - MWJava_MRJAppBuilder_stdoutPVersion0 - MWJava_MRJAppBuilder_stdoutPType0 - MWJava_MRJAppBuilder_stdoutPFormat0 - MWJava_MRJAppBuilder_stdoutPTree - MWJava_MRJAppBuilder_stdoutFile - MWJava_MRJAppBuilder_stdoutAppendfalse - MWJava_MRJAppBuilder_stderrPType0 - MWJava_MRJAppBuilder_stderrPFormat0 - MWJava_MRJAppBuilder_stderrPTree - MWJava_MRJAppBuilder_stderrFile - MWJava_MRJAppBuilder_stderrAppendfalse - MWJava_MRJAppBuilder_stdinPType0 - MWJava_MRJAppBuilder_stdinPFormat0 - MWJava_MRJAppBuilder_stdinPTree - MWJava_MRJAppBuilder_stdinFile - - - MWJava_Output_outputtypeJarFile - MWJava_Output_outfileJavaClasses.jar - MWJava_Output_ftype1514754080 - MWJava_Output_fcreator1297570384 - MWJava_Output_compress0 - MWJava_Output_genManifest0 - MWJava_Output_trunctypeFront - MWJava_Output_deleteClasses0 - MWJava_Output_consoleApp1 - - - MWJava_Proj_projtypeApplet - MWJava_Proj_mainClassName - MWJava_Proj_HTMLAppCreator1145457748 - MWJava_Proj_HTMLAppNameMetrowerks Java - MWJava_Proj_PathVersion1 - MWJava_Proj_PathType0 - MWJava_Proj_PathFormat0 - MWJava_Proj_tree - MWJava_Proj_HTMLAppWin32NameInternet Explorer - MWJava_Proj_compress0 - MWJava_Proj_useVM1 - MWJava_Proj_vmarguments - MWJava_Proj_vmName - MWJava_Proj_simPropFile - - - MWJavaDoc_Proj_Version1 - MWJavaDoc_Proj_Depricated1 - MWJavaDoc_Proj_Author1 - MWJavaDoc_Proj_Index1 - MWJavaDoc_Proj_Tree1 - MWJavaDoc_Proj_SunResolveToSame0 - MWJavaDoc_Proj_Shortnames1 - MWJavaDoc_Proj_Folder0 - MWJavaDoc_Proj_GenerateAPILinks0 - MWJavaDoc_Proj_scopePublic - MWJavaDoc_Proj_fcreator1297303877 - MWJavaDoc_Proj_encodingName - MWJavaDoc_Proj_decodingName - MWJavaDoc_Proj_javaPackagePathhttp://java.sun.com/products/jdk/1.1/docs/api/ - - - MWMerge_MacOS_projectTypeApplication - MWMerge_MacOS_outputNameMerge Out - MWMerge_MacOS_outputCreator???? - MWMerge_MacOS_outputTypeAPPL - MWMerge_MacOS_suppressWarning0 - MWMerge_MacOS_copyFragments1 - MWMerge_MacOS_copyResources1 - MWMerge_MacOS_flattenResource0 - MWMerge_MacOS_flatFileNamea.rsrc - MWMerge_MacOS_flatFileOutputPath - Path: - PathFormatMacOS - PathRootProject - - MWMerge_MacOS_skipResources - DLGX - ckid - Proj - WSPC - - - - FileLockedfalse - ResourcesMapIsReadOnlyfalse - PrinterDriverIsMultiFinderCompatiblefalse - Invisiblefalse - HasBundlefalse - NameLockedfalse - Stationeryfalse - HasCustomIconfalse - Sharedfalse - HasBeenInitedfalse - Label0 - Comments - - - MWMacOSPackager_UsePackager0 - MWMacOSPackager_FolderToPackage - Path: - PathFormatMacOS - PathRootProject - - MWMacOSPackager_CreateClassicAlias0 - MWMacOSPackager_ClassicAliasMethodUseTargetOutput - MWMacOSPackager_ClassicAliasPath - Path: - PathFormatMacOS - PathRootProject - - MWMacOSPackager_CreatePkgInfo0 - MWMacOSPackager_PkgCreatorType???? - MWMacOSPackager_PkgFileTypeAPPL - - - MWCodeGen_PPC_structalignmentMC68K - MWCodeGen_PPC_tracebacktablesNone - MWCodeGen_PPC_processorGeneric - MWCodeGen_PPC_readonlystrings0 - MWCodeGen_PPC_tocdata1 - MWCodeGen_PPC_profiler0 - MWCodeGen_PPC_fpcontract1 - MWCodeGen_PPC_schedule0 - MWCodeGen_PPC_peephole1 - MWCodeGen_PPC_processorspecific0 - MWCodeGen_PPC_altivec0 - MWCodeGen_PPC_vectortocdata0 - MWCodeGen_PPC_vrsave0 - - - MWCodeGen_MachO_structalignmentPPC - MWCodeGen_MachO_tracebacktablesNone - MWCodeGen_MachO_processorGeneric - MWCodeGen_MachO_readonlystrings0 - MWCodeGen_MachO_profiler0 - MWCodeGen_MachO_fpcontract1 - MWCodeGen_MachO_schedule0 - MWCodeGen_MachO_peephole1 - MWCodeGen_MachO_processorspecific0 - MWCodeGen_MachO_altivec0 - MWCodeGen_MachO_vrsave1 - MWCodeGen_MachO_common0 - MWCodeGen_MachO_implicit_templates1 - - - MWDisassembler_PPC_showcode1 - MWDisassembler_PPC_extended1 - MWDisassembler_PPC_mix0 - MWDisassembler_PPC_nohex0 - MWDisassembler_PPC_showdata1 - MWDisassembler_PPC_showexceptions1 - MWDisassembler_PPC_showsym0 - MWDisassembler_PPC_shownames1 - - - GlobalOptimizer_PPC_optimizationlevelLevel0 - GlobalOptimizer_PPC_optforSpeed - - - MWLinker_PPC_linksym1 - MWLinker_PPC_symfullpath1 - MWLinker_PPC_linkmap0 - MWLinker_PPC_nolinkwarnings0 - MWLinker_PPC_dontdeadstripinitcode0 - MWLinker_PPC_permitmultdefs0 - MWLinker_PPC_linkmodeFast - MWLinker_PPC_initname - MWLinker_PPC_mainname__start - MWLinker_PPC_termname - - - MWLinker_MachO_exportsNone - MWLinker_MachO_mainname - MWLinker_MachO_currentversion0 - MWLinker_MachO_compatibleversion0 - MWLinker_MachO_symfullpath0 - MWLinker_MachO_supresswarnings0 - MWLinker_MachO_multisymerror0 - MWLinker_MachO_prebind1 - MWLinker_MachO_deadstrip1 - MWLinker_MachO_objectivecsemantics0 - MWLinker_MachO_whichfileloaded0 - MWLinker_MachO_whyfileloaded0 - MWLinker_MachO_readonlyrelocsErrors - MWLinker_MachO_undefinedsymbolsErrors - MWLinker_MachO_twolevelnamespace1 - MWLinker_MachO_stripdebugsymbols0 - - - MWProject_MachO_typeExecutable - MWProject_MachO_outfilea.exe - MWProject_MachO_filecreator???? - MWProject_MachO_filetypeMEXE - MWProject_MachO_stacksize64 - MWProject_MachO_stackaddress0 - MWProject_MachO_flatrsrc1 - MWProject_MachO_flatrsrcfilenamea.rsrc - MWProject_MachO_flatrsrcoutputdir - Path: - PathFormatMacOS - PathRootProject - - MWProject_MachO_installpath./ - - - MWPEF_exportsNone - MWPEF_libfolder0 - MWPEF_sortcodeNone - MWPEF_expandbss0 - MWPEF_sharedata0 - MWPEF_olddefversion0 - MWPEF_oldimpversion0 - MWPEF_currentversion0 - MWPEF_fragmentname - MWPEF_collapsereloads0 - - - MWProject_PPC_typeApplication - MWProject_PPC_outfilea.out - MWProject_PPC_filecreator???? - MWProject_PPC_filetypeAPPL - MWProject_PPC_size384 - MWProject_PPC_minsize384 - MWProject_PPC_stacksize64 - MWProject_PPC_flags22720 - MWProject_PPC_symfilename - MWProject_PPC_rsrcname - MWProject_PPC_rsrcheaderNative - MWProject_PPC_rsrctype???? - MWProject_PPC_rsrcid0 - MWProject_PPC_rsrcflags0 - MWProject_PPC_rsrcstore0 - MWProject_PPC_rsrcmerge0 - MWProject_PPC_flatrsrc0 - MWProject_PPC_flatrsrcoutputdir - Path: - PathFormatMacOS - PathRootProject - - MWProject_PPC_flatrsrcfilename - - - MWAssembler_PPC_auxheader0 - MWAssembler_PPC_symmodeMac - MWAssembler_PPC_dialectPPC - MWAssembler_PPC_prefixfile - MWAssembler_PPC_typecheck0 - MWAssembler_PPC_warnings0 - MWAssembler_PPC_casesensitive0 - - - MWRez_Language_maxwidth80 - MWRez_Language_scriptRoman - MWRez_Language_alignmentAlign1 - MWRez_Language_filtermodeFilterSkip - MWRez_Language_suppresswarnings0 - MWRez_Language_escapecontrolchars1 - MWRez_Language_prefixname - MWRez_Language_filteredtypes'CODE' 'DATA' 'PICT' - - - MWWinRC_prefixname - - - MWCodeGen_X86_processorGeneric - MWCodeGen_X86_alignmentbytes8 - MWCodeGen_X86_exceptionsZeroOverhead - MWCodeGen_X86_extinst_mmx0 - MWCodeGen_X86_extinst_3dnow0 - MWCodeGen_X86_use_mmx_3dnow_convention0 - MWCodeGen_X86_machinecodelisting0 - MWCodeGen_X86_intrinsics0 - MWCodeGen_X86_syminfo0 - MWCodeGen_X86_codeviewinfo1 - MWCodeGen_X86_extinst_cmov_fcomi0 - MWCodeGen_X86_extinst_sse0 - - - PDisasmX86_showHeaderstrue - PDisasmX86_showSymTabtrue - PDisasmX86_showCodetrue - PDisasmX86_showSourcefalse - PDisasmX86_showHextrue - PDisasmX86_showRelocationtrue - PDisasmX86_showCommentsfalse - PDisasmX86_showDebugfalse - PDisasmX86_showExceptionsfalse - PDisasmX86_showDatatrue - PDisasmX86_showRawfalse - PDisasmX86_verbosefalse - - - MWDebugger_X86_Exceptions - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - GlobalOptimizer_X86_optimizationlevelLevel0 - GlobalOptimizer_X86_optforSpeed - - - MWLinker_X86_entrypointusageDefault - MWLinker_X86_entrypoint - MWLinker_X86_subsystemWinGUI - MWLinker_X86_subsysmajorid4 - MWLinker_X86_subsysminorid0 - MWLinker_X86_usrmajorid0 - MWLinker_X86_usrminorid0 - MWLinker_X86_commandfile - MWLinker_X86_generatemap0 - MWLinker_X86_linksym0 - MWLinker_X86_linkCV1 - - - MWProject_X86_typeApplication - MWProject_X86_outfilenoname.exe - MWProject_X86_baseaddress4194304 - MWProject_X86_maxstacksize1024 - MWProject_X86_minstacksize4 - MWProject_X86_size1024 - MWProject_X86_minsize4 - MWProject_X86_importlib - xpidl Settings - 0001000101000000000000000000000000000000000000000000000000000000 - 0000000000000000 - - - - - - - - - NSAppStartup.o - - - NSComponentStartup.o - - - NSLibraryStartup.o - - - - - - - NSAppStartup.o - NSComponentStartup.o - NSLibraryStartup.o - NSStartup.all - - - - - NSAppStartup.o - Name - MSL_AppRuntime_PPC.Lib - MacOS - - - NSComponentStartup.o - Name - MSL_DropInRuntime_PPC.Lib - MacOS - - - NSLibraryStartup.o - Name - MSL_ShLibRuntime_PPC.Lib - MacOS - - - NSAppStartup.o - Name - NSStartup.c - MacOS - - - - diff --git a/lib/mac/NSStartup/nsComponentResContext.cpp b/lib/mac/NSStartup/nsComponentResContext.cpp new file mode 100644 index 00000000000..e69de29bb2d diff --git a/lib/mac/NSStartup/nsComponentResContext.h b/lib/mac/NSStartup/nsComponentResContext.h new file mode 100644 index 00000000000..e69de29bb2d