diff --git a/gfx/src/mac/nsCarbonHelpers.h b/gfx/src/mac/nsCarbonHelpers.h index 45bf8112a2a..fb078802c72 100644 --- a/gfx/src/mac/nsCarbonHelpers.h +++ b/gfx/src/mac/nsCarbonHelpers.h @@ -64,129 +64,19 @@ enum { inline void GetWindowUpdateRegion ( WindowPtr window, RgnHandle outUpdateRgn ) { - #if TARGET_CARBON ::GetWindowRegion(window, kWindowUpdateRgn, outUpdateRgn); - #else - ::CopyRgn(((WindowRecord*)window)->updateRgn, outUpdateRgn); - #endif } inline void SetControlPopupMenuStuff ( ControlHandle control, MenuHandle menu, short aID ) { - #if TARGET_CARBON ::SetControlPopupMenuHandle ( control, menu ); ::SetControlPopupMenuID ( control, aID ); - #else - PopupPrivateData* popupData = (PopupPrivateData*)*((*control)->contrlData); - if (popupData) { - popupData->mHandle = menu; - popupData->mID = aID; - } - #endif } inline WindowRef GetTheWindowList(void) { -#if TARGET_CARBON return GetWindowList(); -#else - return LMGetWindowList(); -#endif } - -#if !TARGET_CARBON - -inline void GetPortHiliteColor(CGrafPtr port, RGBColor* color) -{ - // is this really a color grafport? - if (port->portVersion & 0xC000) - { - GrafVars** grafVars = (GrafVars**)port->grafVars; - *color = (*grafVars)->rgbHiliteColor; - } - else - { - RGBColor fakeColor = { 0x0000, 0x0000, 0x0000}; - *color = fakeColor; - } -} - -inline Boolean IsPortOffscreen(CGrafPtr port) -{ - return ((UInt16)port->portVersion == 0xC001); -} - -inline Rect* GetRegionBounds(RgnHandle region, Rect* rect) -{ - *rect = (**region).rgnBBox; - return rect; -} - -inline Boolean IsRegionComplex(RgnHandle region) -{ - return (**region).rgnSize != sizeof(MacRegion); -} - -inline void GetPortVisibleRegion(CGrafPtr port, RgnHandle visRgn) -{ - ::CopyRgn(port->visRgn, visRgn); -} - -inline void GetPortClipRegion(CGrafPtr port, RgnHandle clipRgn) -{ - ::CopyRgn(port->clipRgn, clipRgn); -} - -inline short GetPortTextFace(CGrafPtr port) -{ - return port->txFace; -} - -inline short GetPortTextFont(CGrafPtr port) -{ - return port->txFont; -} - -inline short GetPortTextSize(CGrafPtr port) -{ - return port->txSize; -} - -inline Rect* GetPortBounds(CGrafPtr port, Rect* portRect) -{ - *portRect = port->portRect; - return portRect; -} - -inline PixMapHandle GetPortPixMap(CGrafPtr port) -{ - return port->portPixMap; -} - -inline Boolean IsRegionRectangular(RgnHandle rgn) -{ - return (**rgn).rgnSize == 10; -} - -inline GrafPtr GetQDGlobalsThePort() -{ - return qd.thePort; -} - -inline const BitMap * GetPortBitMapForCopyBits(CGrafPtr port) -{ - return &((GrafPtr)port)->portBits; -} - -inline OSErr AEGetDescData (const AEDesc * theAEDesc, void * dataPtr, Size maximumSize) -{ - ::BlockMoveData(*(theAEDesc->dataHandle), dataPtr, maximumSize); - return noErr; -} - - -#endif /* !TARGET_CARBON */ - #endif /* CarbonHelpers_h__ */ diff --git a/gfx/src/mac/nsCoreGraphicsGlue.cpp b/gfx/src/mac/nsCoreGraphicsGlue.cpp deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/gfx/src/mac/nsDeviceContextMac.cpp b/gfx/src/mac/nsDeviceContextMac.cpp index 8cadd3389b7..a95699a8fb2 100644 --- a/gfx/src/mac/nsDeviceContextMac.cpp +++ b/gfx/src/mac/nsDeviceContextMac.cpp @@ -38,11 +38,7 @@ #include "nsDeviceContextMac.h" #include "nsRenderingContextMac.h" -#if TARGET_CARBON #include "nsDeviceContextSpecX.h" -#else -#include "nsDeviceContextSpecMac.h" -#endif #include "nsIPrintingContext.h" #include "nsString.h" #include "nsHashtable.h" @@ -648,11 +644,6 @@ NS_IMETHODIMP nsDeviceContextMac::GetDeviceContextFor(nsIDeviceContextSpec *aDev ::GetPort(&curPort); -#if !TARGET_CARBON - THPrint thePrintRecord = ((nsDeviceContextSpecMac*)aDevice)->mPrtRec; - pix_Inch = (**thePrintRecord).prInfo.iHRes; - macDC->mPageRect = (**thePrintRecord).prInfo.rPage; -#else nsCOMPtr printingContext = do_QueryInterface(aDevice); if (printingContext) { if (NS_FAILED(printingContext->GetPrinterResolution(&pix_Inch))) @@ -663,7 +654,7 @@ NS_IMETHODIMP nsDeviceContextMac::GetDeviceContextFor(nsIDeviceContextSpec *aDev pageRect.top = top, pageRect.left = left; pageRect.bottom = bottom, pageRect.right = right; } -#endif + ((nsDeviceContextMac*)aContext)->Init(curPort); @@ -688,23 +679,11 @@ NS_IMETHODIMP nsDeviceContextMac::BeginDocument(PRUnichar * aTitle, PRInt32 aStartPage, PRInt32 aEndPage) { -#if !TARGET_CARBON -GrafPtr thePort; - - if(((nsDeviceContextSpecMac*)(this->mSpec).get())->mPrintManagerOpen) { - ::GetPort(&mOldPort); - thePort = (GrafPtr)::PrOpenDoc(((nsDeviceContextSpecMac*)(this->mSpec).get())->mPrtRec,nsnull,nsnull); - ((nsDeviceContextSpecMac*)(this->mSpec).get())->mPrinterPort = (TPrPort*)thePort; - SetPort(thePort); - } - return NS_OK; -#else nsresult rv = NS_ERROR_FAILURE; nsCOMPtr printingContext = do_QueryInterface(mSpec); if (printingContext) rv = printingContext->BeginDocument(aStartPage, aEndPage); return rv; -#endif } @@ -714,19 +693,11 @@ GrafPtr thePort; */ NS_IMETHODIMP nsDeviceContextMac::EndDocument(void) { -#if !TARGET_CARBON - if(((nsDeviceContextSpecMac*)(this->mSpec).get())->mPrintManagerOpen){ - ::SetPort(mOldPort); - ::PrCloseDoc(((nsDeviceContextSpecMac*)(this->mSpec).get())->mPrinterPort); - } - return NS_OK; -#else nsresult rv = NS_ERROR_FAILURE; nsCOMPtr printingContext = do_QueryInterface(mSpec); if (printingContext) rv = printingContext->EndDocument(); return rv; -#endif } /** --------------------------------------------------- @@ -745,17 +716,11 @@ NS_IMETHODIMP nsDeviceContextMac::AbortDocument(void) */ NS_IMETHODIMP nsDeviceContextMac::BeginPage(void) { -#if !TARGET_CARBON - if(((nsDeviceContextSpecMac*)(this->mSpec).get())->mPrintManagerOpen) - ::PrOpenPage(((nsDeviceContextSpecMac*)(this->mSpec).get())->mPrinterPort,nsnull); - return NS_OK; -#else nsresult rv = NS_ERROR_FAILURE; nsCOMPtr printingContext = do_QueryInterface(mSpec); if (printingContext) rv = printingContext->BeginPage(); return rv; -#endif } diff --git a/gfx/src/mac/nsDeviceContextSpecFactoryM.cpp b/gfx/src/mac/nsDeviceContextSpecFactoryM.cpp index fa8196997e9..ec01cdf2b23 100644 --- a/gfx/src/mac/nsDeviceContextSpecFactoryM.cpp +++ b/gfx/src/mac/nsDeviceContextSpecFactoryM.cpp @@ -40,11 +40,8 @@ #include "nsIPrintingContext.h" #include "nsGfxCIID.h" #include "plstr.h" -#if TARGET_CARBON #include "nsDeviceContextSpecX.h" -#else -#include "nsDeviceContextSpecMac.h" -#endif + /** ------------------------------------------------------- * Constructor diff --git a/gfx/src/mac/nsDeviceContextSpecMac.cpp b/gfx/src/mac/nsDeviceContextSpecMac.cpp deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/gfx/src/mac/nsDeviceContextSpecMac.h b/gfx/src/mac/nsDeviceContextSpecMac.h deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/gfx/src/mac/nsGfxFactoryMac.cpp b/gfx/src/mac/nsGfxFactoryMac.cpp index 8d0eaca8b2d..9342e641c86 100644 --- a/gfx/src/mac/nsGfxFactoryMac.cpp +++ b/gfx/src/mac/nsGfxFactoryMac.cpp @@ -49,20 +49,13 @@ #include "nsRegionMac.h" #include "nsScriptableRegion.h" #include "nsNativeThemeMac.h" -#if TARGET_CARBON #include "nsDeviceContextSpecX.h" #include "nsPrintOptionsX.h" #include "nsPrintSessionX.h" -#else -#include "nsDeviceContextSpecMac.h" -#include "nsPrintOptionsMac.h" -#include "nsPrintSession.h" -#endif #include "nsDeviceContextSpecFactoryM.h" #include "nsScreenManagerMac.h" #include "nsBlender.h" #include "nsCOMPtr.h" -#include "nsPrintOptionsMac.h" #include "nsUnicodeMappingUtil.h" #include "gfxImageFrame.h" @@ -76,15 +69,9 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsImageMac) NS_GENERIC_FACTORY_CONSTRUCTOR(nsRegionMac) NS_GENERIC_FACTORY_CONSTRUCTOR(nsBlender) NS_GENERIC_FACTORY_CONSTRUCTOR(nsDrawingSurfaceMac) -#if TARGET_CARBON NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecX) NS_GENERIC_FACTORY_CONSTRUCTOR(nsPrintOptionsX) NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSessionX, Init) -#else -NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecMac) -NS_GENERIC_FACTORY_CONSTRUCTOR(nsPrintOptionsMac) -NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSession, Init) -#endif NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecFactoryMac) NS_GENERIC_FACTORY_CONSTRUCTOR(nsFontEnumeratorMac) NS_GENERIC_FACTORY_CONSTRUCTOR(nsFontList) @@ -139,22 +126,14 @@ static const nsModuleComponentInfo components[] = NS_DRAWING_SURFACE_CID, "@mozilla.org/gfx/drawing-surface;1", nsDrawingSurfaceMacConstructor }, -#if TARGET_CARBON { "nsDeviceContextSpec", NS_DEVICE_CONTEXT_SPEC_CID, "@mozilla.org/gfx/devicecontextspec;1", nsDeviceContextSpecXConstructor }, -#else - { "nsDeviceContextSpec", - NS_DEVICE_CONTEXT_SPEC_CID, - "@mozilla.org/gfx/devicecontextspec;1", - nsDeviceContextSpecMacConstructor }, -#endif { "nsDeviceContextSpecFactory", NS_DEVICE_CONTEXT_SPEC_FACTORY_CID, "@mozilla.org/gfx/devicecontextspecfactory;1", nsDeviceContextSpecFactoryMacConstructor }, -#if TARGET_CARBON { "PrintSettings Service", NS_PRINTSETTINGSSERVICE_CID, "@mozilla.org/gfx/printsettings-service;1", @@ -163,16 +142,6 @@ static const nsModuleComponentInfo components[] = NS_PRINTSESSION_CID, "@mozilla.org/gfx/printsession;1", nsPrintSessionXConstructor }, -#else - { "PrintSettings Service", - NS_PRINTSETTINGSSERVICE_CID, - "@mozilla.org/gfx/printsettings-service;1", - nsPrintOptionsMacConstructor }, - { "Print Session", - NS_PRINTSESSION_CID, - "@mozilla.org/gfx/printsession;1", - nsPrintSessionConstructor }, -#endif { "nsFontEnumerator", NS_FONT_ENUMERATOR_CID, "@mozilla.org/gfx/fontenumerator;1", diff --git a/gfx/src/mac/nsGfxUtils.h b/gfx/src/mac/nsGfxUtils.h index 6d72c8523c4..82cff9d5951 100644 --- a/gfx/src/mac/nsGfxUtils.h +++ b/gfx/src/mac/nsGfxUtils.h @@ -54,14 +54,7 @@ */ inline PRBool CurrentPortIsWMPort() { -#if TARGET_CARBON return PR_FALSE; -#else - GrafPtr curPort; - ::GetPort(&curPort); - - return (curPort == ::LMGetWMgrPort()); -#endif } @@ -82,20 +75,6 @@ inline PRBool ValidateDrawingState() if (CurrentPortIsWMPort() && (FrontWindow() != nil)) return false; -#if TARGET_CARBON - //if (! IsValidPort(curPort)) // rather slow - // return false; -#else - // all our ports should be onscreen or offscreen color graphics ports - // Onscreen ports have portVersion 0xC000, GWorlds have 0xC001. -#if DEBUG - if ((((UInt16)curPort->portVersion & 0xC000) != 0xC000) && !IsSIOUXWindow((GrafPtr)curPort)) - return false; -#else - if ((((UInt16)curPort->portVersion & 0xC000) != 0xC000)) - return false; -#endif -#endif // see if the device is in the device list. If not, it probably means that // it's the device for an offscreen GWorld. In that case, the current port diff --git a/gfx/src/mac/nsImageMac.cpp b/gfx/src/mac/nsImageMac.cpp index 5ce9df6b4ca..27d598cb418 100644 --- a/gfx/src/mac/nsImageMac.cpp +++ b/gfx/src/mac/nsImageMac.cpp @@ -47,7 +47,7 @@ #include "imgScaler.h" #if 0 -#if TARGET_CARBON + // useful region debugging code. static OSStatus PrintRgnRectProc(UInt16 message, RgnHandle rgn, const Rect *inRect, void *refCon) { @@ -81,7 +81,6 @@ static void PrintRegionOutline(RgnHandle inRgn) UInt32 rectCount = 0; ::QDRegionToRects(inRgn, kQDParseRegionFromTopLeft, sCountRectProc, &rectCount); } -#endif // TARGET_CARBON #endif #pragma mark - diff --git a/gfx/src/mac/nsNativeThemeMac.cpp b/gfx/src/mac/nsNativeThemeMac.cpp index 3a255d3d492..fe4db2dbd6d 100644 --- a/gfx/src/mac/nsNativeThemeMac.cpp +++ b/gfx/src/mac/nsNativeThemeMac.cpp @@ -201,7 +201,6 @@ printf("told to draw at %ld %ld w %ld h %ld\n", inBoxRect.left, inBoxRect.top, i void nsNativeThemeMac::DrawEditText ( const Rect& inBoxRect, PRBool inIsDisabled ) { -#if TARGET_CARBON Pattern whitePat; ::BackColor(whiteColor); ::BackPat(GetQDGlobalsWhite(&whitePat)); @@ -209,14 +208,12 @@ nsNativeThemeMac::DrawEditText ( const Rect& inBoxRect, PRBool inIsDisabled ) ThemeDrawState drawState = inIsDisabled ? kThemeStateDisabled : kThemeStateActive; ::DrawThemeEditTextFrame(&inBoxRect, drawState); -#endif } void nsNativeThemeMac::DrawListBox ( const Rect& inBoxRect, PRBool inIsDisabled ) { -#if TARGET_CARBON Pattern whitePat; ::BackColor(whiteColor); ::BackPat(GetQDGlobalsWhite(&whitePat)); @@ -224,7 +221,6 @@ nsNativeThemeMac::DrawListBox ( const Rect& inBoxRect, PRBool inIsDisabled ) ThemeDrawState drawState = inIsDisabled ? kThemeStateDisabled : kThemeStateActive; ::DrawThemeListBoxFrame(&inBoxRect, drawState); -#endif } @@ -488,7 +484,6 @@ nsNativeThemeMac::GetWidgetBorder(nsIDeviceContext* aContext, // XXX we should probably cache some of these metrics -#if TARGET_CARBON switch ( aWidgetType ) { case NS_THEME_BUTTON: @@ -525,7 +520,6 @@ nsNativeThemeMac::GetWidgetBorder(nsIDeviceContext* aContext, } } -#endif return NS_OK; } @@ -547,7 +541,6 @@ nsNativeThemeMac::GetMinimumWidgetSize(nsIRenderingContext* aContext, nsIFrame* aResult->SizeTo(0,0); *aIsOverridable = PR_TRUE; -#if TARGET_CARBON switch ( aWidgetType ) { case NS_THEME_BUTTON: @@ -686,7 +679,6 @@ nsNativeThemeMac::GetMinimumWidgetSize(nsIRenderingContext* aContext, nsIFrame* } } -#endif return NS_OK; } diff --git a/gfx/src/mac/nsPrintOptionsMac.cpp b/gfx/src/mac/nsPrintOptionsMac.cpp deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/gfx/src/mac/nsPrintOptionsMac.h b/gfx/src/mac/nsPrintOptionsMac.h deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/gfx/src/mac/nsPrintOptionsX.cpp b/gfx/src/mac/nsPrintOptionsX.cpp index 82fb7870f48..c5ca8492d58 100644 --- a/gfx/src/mac/nsPrintOptionsX.cpp +++ b/gfx/src/mac/nsPrintOptionsX.cpp @@ -40,7 +40,6 @@ #include "nsCOMPtr.h" #include "nsIServiceManager.h" -#include "nsWatchTask.h" #include "nsPrintOptionsX.h" #include "nsPrintSettingsX.h" diff --git a/gfx/src/mac/nsPrintSettingsMac.cpp b/gfx/src/mac/nsPrintSettingsMac.cpp deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/gfx/src/mac/nsPrintSettingsMac.h b/gfx/src/mac/nsPrintSettingsMac.h deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/gfx/src/mac/nsScreenMac.cpp b/gfx/src/mac/nsScreenMac.cpp index 91a883c6d7d..e69de29bb2d 100644 --- a/gfx/src/mac/nsScreenMac.cpp +++ b/gfx/src/mac/nsScreenMac.cpp @@ -1,137 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include "nsScreenMac.h" -#if TARGET_CARBON -#include -#else -#include -#endif - -nsScreenMac :: nsScreenMac ( GDHandle inScreen ) - : mScreen(inScreen) -{ - NS_ASSERTION ( inScreen, "Passing null device to nsScreenMac" ); - - // nothing else to do. I guess we could cache a bunch of information - // here, but we want to ask the device at runtime in case anything - // has changed. -} - - -nsScreenMac :: ~nsScreenMac() -{ - // nothing to see here. -} - - -// addref, release, QI -NS_IMPL_ISUPPORTS1(nsScreenMac, nsIScreen) - - -NS_IMETHODIMP -nsScreenMac :: GetRect(PRInt32 *outLeft, PRInt32 *outTop, PRInt32 *outWidth, PRInt32 *outHeight) -{ - *outLeft = (**mScreen).gdRect.left; - *outTop = (**mScreen).gdRect.top; - *outWidth = (**mScreen).gdRect.right - (**mScreen).gdRect.left; - *outHeight = (**mScreen).gdRect.bottom - (**mScreen).gdRect.top; - - return NS_OK; - -} // GetRect - - -NS_IMETHODIMP -nsScreenMac :: GetAvailRect(PRInt32 *outLeft, PRInt32 *outTop, PRInt32 *outWidth, PRInt32 *outHeight) -{ - Rect adjustedRect; - -#if TARGET_CARBON - ::GetAvailableWindowPositioningBounds ( mScreen, &adjustedRect ); -#else - SubtractMenuBar ( (**mScreen).gdRect, &adjustedRect ); -#endif - - *outLeft = adjustedRect.left; - *outTop = adjustedRect.top; - *outWidth = adjustedRect.right - adjustedRect.left; - *outHeight = adjustedRect.bottom - adjustedRect.top; - - return NS_OK; - -} // GetRect - - - -NS_IMETHODIMP -nsScreenMac :: GetPixelDepth(PRInt32 *aPixelDepth) -{ - *aPixelDepth = (**(**mScreen).gdPMap).pixelSize; - return NS_OK; - -} // GetPixelDepth - - -NS_IMETHODIMP -nsScreenMac :: GetColorDepth(PRInt32 *aColorDepth) -{ - *aColorDepth = (**(**mScreen).gdPMap).pixelSize; - return NS_OK; - -} // GetColorDepth - - -#if !TARGET_CARBON - -// -// SubtractMenuBar -// -// Take out the menu bar from the reported size of this screen, but only -// if it is the primary screen -// -void -nsScreenMac :: SubtractMenuBar ( const Rect & inScreenRect, Rect* outAdjustedRect ) -{ - // if the screen we're being asked about is the main screen (ie, has the menu - // bar), then subract out the menubar from the rect that we're returning. - *outAdjustedRect = inScreenRect; - if ( IsPrimaryScreen() ) - outAdjustedRect->top += ::GetMBarHeight(); -} - -#endif diff --git a/gfx/src/mac/nsScreenMac.h b/gfx/src/mac/nsScreenMac.h index 26858093611..e69de29bb2d 100644 --- a/gfx/src/mac/nsScreenMac.h +++ b/gfx/src/mac/nsScreenMac.h @@ -1,70 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef nsScreenMac_h___ -#define nsScreenMac_h___ - -#include "nsIScreen.h" - -#include - -//------------------------------------------------------------------------ - -class nsScreenMac : public nsIScreen -{ -public: - nsScreenMac ( GDHandle inScreen ); - ~nsScreenMac(); - - NS_DECL_ISUPPORTS - NS_DECL_NSISCREEN - -private: - -#if !TARGET_CARBON - // Take out the menu bar from the reported size of this screen. - void SubtractMenuBar ( const Rect & inScreenRect, Rect* outAdjustedRect ) ; -#endif - - // are we the primary screen? Needed so we can sub out the menubar if - // asked. - PRBool IsPrimaryScreen ( ) const { return (mScreen == ::GetMainDevice()); } - - GDHandle mScreen; // the device that represents this screen -}; - -#endif // nsScreenMac_h___ diff --git a/gfx/src/mac/nsUnicodeFontMappingMac.cpp b/gfx/src/mac/nsUnicodeFontMappingMac.cpp index d78a38a140e..f0fb171fedf 100644 --- a/gfx/src/mac/nsUnicodeFontMappingMac.cpp +++ b/gfx/src/mac/nsUnicodeFontMappingMac.cpp @@ -34,6 +34,7 @@ * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ + #include #include "nsDeviceContextMac.h" #include "plhash.h" @@ -45,6 +46,7 @@ #include "nsIUnicodeEncoder.h" #include "nsCompressedCharMap.h" #include "nsMacUnicodeFontInfo.h" + #define BAD_FONT_NUM -1 #define BAD_SCRIPT 0x7f diff --git a/gfx/src/mac/nsUnicodeMappingUtil.cpp b/gfx/src/mac/nsUnicodeMappingUtil.cpp index f16a5cd2053..d1eb6dd1039 100644 --- a/gfx/src/mac/nsUnicodeMappingUtil.cpp +++ b/gfx/src/mac/nsUnicodeMappingUtil.cpp @@ -43,9 +43,11 @@ #include "nsReadableUtils.h" #include "nsString.h" #include "nsCRT.h" + static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); #define BAD_FONT_NUM -1 + //-------------------------------------------------------------------------- nsUnicodeMappingUtil *nsUnicodeMappingUtil::gSingleton = nsnull; diff --git a/gfx/src/mac/nsUnicodeRenderingToolkit.cpp b/gfx/src/mac/nsUnicodeRenderingToolkit.cpp index f3ad7697348..42dcbf65622 100644 --- a/gfx/src/mac/nsUnicodeRenderingToolkit.cpp +++ b/gfx/src/mac/nsUnicodeRenderingToolkit.cpp @@ -34,6 +34,7 @@ * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ + #include "nsUnicodeRenderingToolkit.h" #include "nsUnicodeFontMappingMac.h" #include "nsUnicodeFallbackCache.h" @@ -53,10 +54,10 @@ #include - #define BAD_FONT_NUM -1 #define BAD_SCRIPT 0x7F #define STACK_TRESHOLD 1000 + static NS_DEFINE_CID(kSaveAsCharsetCID, NS_SAVEASCHARSET_CID); //#define DISABLE_TEC_FALLBACK diff --git a/gfx/src/mac/nsWatchTask.cpp b/gfx/src/mac/nsWatchTask.cpp index 9b3b93301fb..e69de29bb2d 100644 --- a/gfx/src/mac/nsWatchTask.cpp +++ b/gfx/src/mac/nsWatchTask.cpp @@ -1,170 +0,0 @@ -/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - - -#include "nsWatchTask.h" -#include -#include - - -// our global, as soon as the gfx code fragment loads, this will setup -// the VBL task automagically. -nsWatchTask gWatchTask; - - -// -// GetTask -// -// A nice little getter to avoid exposing the global variable -nsWatchTask& -nsWatchTask :: GetTask ( ) -{ - return gWatchTask; -} - - -nsWatchTask :: nsWatchTask ( ) - : mChecksum('mozz'), mSelf(this), mTicks(::TickCount()), mBusy(PR_FALSE), mSuspended(PR_FALSE), - mInstallSucceeded(PR_FALSE), mAnimation(0) -{ - -} - - -nsWatchTask :: ~nsWatchTask ( ) -{ -#if !TARGET_CARBON - if ( mInstallSucceeded ) - ::VRemove ( (QElemPtr)&mTask ); -#endif - InitCursor(); -} - - -// -// Start -// -// 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(). -// -void -nsWatchTask :: Start ( ) -{ -#if !TARGET_CARBON - // get the watch cursor and lock it high - CursHandle watch = ::GetCursor ( watchCursor ); - if ( !watch ) - return; - mWatchCursor = **watch; - - // setup the task - mTask.qType = vType; - mTask.vblAddr = NewVBLProc((VBLProcPtr)DoWatchTask); - mTask.vblCount = kRepeatInterval; - mTask.vblPhase = 0; - - // install it - mInstallSucceeded = ::VInstall((QElemPtr)&mTask) == noErr; -#endif - -} // Start - - -// -// DoWatchTask -// -// Called at vertical retrace. If we haven't been to the event loop for -// |kTicksToShowWatch| ticks, animate the cursor. -// -// Note: assumes that the VBLTask, mTask, is the first member variable, so -// that we can piggy-back off the pointer to get to the rest of our data. -// -// (Do we still need the check for LMGetCrsrBusy()? It's not in carbon...) -// -pascal void -nsWatchTask :: DoWatchTask ( nsWatchTask* inSelf ) -{ - if ( inSelf->mChecksum == 'mozz' ) { - if ( !inSelf->mSuspended ) { -#if TARGET_CARBON - PRBool busy = inSelf->mBusy; -#else - PRBool busy = inSelf->mBusy && LMGetCrsrBusy(); -#endif - if ( !busy ) { - if ( ::TickCount() - inSelf->mTicks > kTicksToShowWatch ) { - ::SetCursor ( &(inSelf->mWatchCursor) ); - inSelf->mBusy = PR_TRUE; - } - } - else - ::SetCursor ( &(inSelf->mWatchCursor) ); - - // next frame in cursor animation - ++inSelf->mAnimation; - } - -#if !TARGET_CARBON - // reset the task to fire again - inSelf->mTask.vblCount = kRepeatInterval; -#endif - } // if valid checksum - -} // DoWatchTask - - -// -// EventLoopReached -// -// Called every time we reach the event loop (or an event loop), this tickles -// our internal tick count to reset the time since our last visit to WNE and -// if we were busy, we're not any more. -// -void -nsWatchTask :: EventLoopReached ( ) -{ - // reset the cursor if we were animating it - if ( mBusy ) - ::InitCursor(); - - mBusy = PR_FALSE; - mTicks = ::TickCount(); - mAnimation = 0; - -} - diff --git a/gfx/src/mac/nsWatchTask.h b/gfx/src/mac/nsWatchTask.h index 16d80a7d77a..e69de29bb2d 100644 --- a/gfx/src/mac/nsWatchTask.h +++ b/gfx/src/mac/nsWatchTask.h @@ -1,105 +0,0 @@ -/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - - -#ifndef WatchTask_h__ -#define WatchTask_h__ - - -#ifndef XP_MACOSX -#include -#endif -#include -#include "prtypes.h" -#include "gfxCore.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