зеркало из https://github.com/mozilla/pjs.git
Fix bug 279510: remove all the pre-Carbon code and TARGET_CARBON #idfefs from gfx. Patch by Ludovic Hirlimann <qa-mozilla@hirlimann.net>, r=pink, sr=me
This commit is contained in:
Родитель
28a069eac4
Коммит
c142b43619
|
@ -64,129 +64,19 @@ enum {
|
||||||
|
|
||||||
inline void GetWindowUpdateRegion ( WindowPtr window, RgnHandle outUpdateRgn )
|
inline void GetWindowUpdateRegion ( WindowPtr window, RgnHandle outUpdateRgn )
|
||||||
{
|
{
|
||||||
#if TARGET_CARBON
|
|
||||||
::GetWindowRegion(window, kWindowUpdateRgn, outUpdateRgn);
|
::GetWindowRegion(window, kWindowUpdateRgn, outUpdateRgn);
|
||||||
#else
|
|
||||||
::CopyRgn(((WindowRecord*)window)->updateRgn, outUpdateRgn);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetControlPopupMenuStuff ( ControlHandle control, MenuHandle menu, short aID )
|
inline void SetControlPopupMenuStuff ( ControlHandle control, MenuHandle menu, short aID )
|
||||||
{
|
{
|
||||||
#if TARGET_CARBON
|
|
||||||
::SetControlPopupMenuHandle ( control, menu );
|
::SetControlPopupMenuHandle ( control, menu );
|
||||||
::SetControlPopupMenuID ( control, aID );
|
::SetControlPopupMenuID ( control, aID );
|
||||||
#else
|
|
||||||
PopupPrivateData* popupData = (PopupPrivateData*)*((*control)->contrlData);
|
|
||||||
if (popupData) {
|
|
||||||
popupData->mHandle = menu;
|
|
||||||
popupData->mID = aID;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline WindowRef GetTheWindowList(void)
|
inline WindowRef GetTheWindowList(void)
|
||||||
{
|
{
|
||||||
#if TARGET_CARBON
|
|
||||||
return GetWindowList();
|
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__ */
|
#endif /* CarbonHelpers_h__ */
|
||||||
|
|
|
@ -38,11 +38,7 @@
|
||||||
|
|
||||||
#include "nsDeviceContextMac.h"
|
#include "nsDeviceContextMac.h"
|
||||||
#include "nsRenderingContextMac.h"
|
#include "nsRenderingContextMac.h"
|
||||||
#if TARGET_CARBON
|
|
||||||
#include "nsDeviceContextSpecX.h"
|
#include "nsDeviceContextSpecX.h"
|
||||||
#else
|
|
||||||
#include "nsDeviceContextSpecMac.h"
|
|
||||||
#endif
|
|
||||||
#include "nsIPrintingContext.h"
|
#include "nsIPrintingContext.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsHashtable.h"
|
#include "nsHashtable.h"
|
||||||
|
@ -648,11 +644,6 @@ NS_IMETHODIMP nsDeviceContextMac::GetDeviceContextFor(nsIDeviceContextSpec *aDev
|
||||||
|
|
||||||
::GetPort(&curPort);
|
::GetPort(&curPort);
|
||||||
|
|
||||||
#if !TARGET_CARBON
|
|
||||||
THPrint thePrintRecord = ((nsDeviceContextSpecMac*)aDevice)->mPrtRec;
|
|
||||||
pix_Inch = (**thePrintRecord).prInfo.iHRes;
|
|
||||||
macDC->mPageRect = (**thePrintRecord).prInfo.rPage;
|
|
||||||
#else
|
|
||||||
nsCOMPtr<nsIPrintingContext> printingContext = do_QueryInterface(aDevice);
|
nsCOMPtr<nsIPrintingContext> printingContext = do_QueryInterface(aDevice);
|
||||||
if (printingContext) {
|
if (printingContext) {
|
||||||
if (NS_FAILED(printingContext->GetPrinterResolution(&pix_Inch)))
|
if (NS_FAILED(printingContext->GetPrinterResolution(&pix_Inch)))
|
||||||
|
@ -663,7 +654,7 @@ NS_IMETHODIMP nsDeviceContextMac::GetDeviceContextFor(nsIDeviceContextSpec *aDev
|
||||||
pageRect.top = top, pageRect.left = left;
|
pageRect.top = top, pageRect.left = left;
|
||||||
pageRect.bottom = bottom, pageRect.right = right;
|
pageRect.bottom = bottom, pageRect.right = right;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
((nsDeviceContextMac*)aContext)->Init(curPort);
|
((nsDeviceContextMac*)aContext)->Init(curPort);
|
||||||
|
|
||||||
|
@ -688,23 +679,11 @@ NS_IMETHODIMP nsDeviceContextMac::BeginDocument(PRUnichar * aTitle,
|
||||||
PRInt32 aStartPage,
|
PRInt32 aStartPage,
|
||||||
PRInt32 aEndPage)
|
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;
|
nsresult rv = NS_ERROR_FAILURE;
|
||||||
nsCOMPtr<nsIPrintingContext> printingContext = do_QueryInterface(mSpec);
|
nsCOMPtr<nsIPrintingContext> printingContext = do_QueryInterface(mSpec);
|
||||||
if (printingContext)
|
if (printingContext)
|
||||||
rv = printingContext->BeginDocument(aStartPage, aEndPage);
|
rv = printingContext->BeginDocument(aStartPage, aEndPage);
|
||||||
return rv;
|
return rv;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -714,19 +693,11 @@ GrafPtr thePort;
|
||||||
*/
|
*/
|
||||||
NS_IMETHODIMP nsDeviceContextMac::EndDocument(void)
|
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;
|
nsresult rv = NS_ERROR_FAILURE;
|
||||||
nsCOMPtr<nsIPrintingContext> printingContext = do_QueryInterface(mSpec);
|
nsCOMPtr<nsIPrintingContext> printingContext = do_QueryInterface(mSpec);
|
||||||
if (printingContext)
|
if (printingContext)
|
||||||
rv = printingContext->EndDocument();
|
rv = printingContext->EndDocument();
|
||||||
return rv;
|
return rv;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** ---------------------------------------------------
|
/** ---------------------------------------------------
|
||||||
|
@ -745,17 +716,11 @@ NS_IMETHODIMP nsDeviceContextMac::AbortDocument(void)
|
||||||
*/
|
*/
|
||||||
NS_IMETHODIMP nsDeviceContextMac::BeginPage(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;
|
nsresult rv = NS_ERROR_FAILURE;
|
||||||
nsCOMPtr<nsIPrintingContext> printingContext = do_QueryInterface(mSpec);
|
nsCOMPtr<nsIPrintingContext> printingContext = do_QueryInterface(mSpec);
|
||||||
if (printingContext)
|
if (printingContext)
|
||||||
rv = printingContext->BeginPage();
|
rv = printingContext->BeginPage();
|
||||||
return rv;
|
return rv;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -40,11 +40,8 @@
|
||||||
#include "nsIPrintingContext.h"
|
#include "nsIPrintingContext.h"
|
||||||
#include "nsGfxCIID.h"
|
#include "nsGfxCIID.h"
|
||||||
#include "plstr.h"
|
#include "plstr.h"
|
||||||
#if TARGET_CARBON
|
|
||||||
#include "nsDeviceContextSpecX.h"
|
#include "nsDeviceContextSpecX.h"
|
||||||
#else
|
|
||||||
#include "nsDeviceContextSpecMac.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** -------------------------------------------------------
|
/** -------------------------------------------------------
|
||||||
* Constructor
|
* Constructor
|
||||||
|
|
|
@ -49,20 +49,13 @@
|
||||||
#include "nsRegionMac.h"
|
#include "nsRegionMac.h"
|
||||||
#include "nsScriptableRegion.h"
|
#include "nsScriptableRegion.h"
|
||||||
#include "nsNativeThemeMac.h"
|
#include "nsNativeThemeMac.h"
|
||||||
#if TARGET_CARBON
|
|
||||||
#include "nsDeviceContextSpecX.h"
|
#include "nsDeviceContextSpecX.h"
|
||||||
#include "nsPrintOptionsX.h"
|
#include "nsPrintOptionsX.h"
|
||||||
#include "nsPrintSessionX.h"
|
#include "nsPrintSessionX.h"
|
||||||
#else
|
|
||||||
#include "nsDeviceContextSpecMac.h"
|
|
||||||
#include "nsPrintOptionsMac.h"
|
|
||||||
#include "nsPrintSession.h"
|
|
||||||
#endif
|
|
||||||
#include "nsDeviceContextSpecFactoryM.h"
|
#include "nsDeviceContextSpecFactoryM.h"
|
||||||
#include "nsScreenManagerMac.h"
|
#include "nsScreenManagerMac.h"
|
||||||
#include "nsBlender.h"
|
#include "nsBlender.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsPrintOptionsMac.h"
|
|
||||||
#include "nsUnicodeMappingUtil.h"
|
#include "nsUnicodeMappingUtil.h"
|
||||||
#include "gfxImageFrame.h"
|
#include "gfxImageFrame.h"
|
||||||
|
|
||||||
|
@ -76,15 +69,9 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsImageMac)
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsRegionMac)
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsRegionMac)
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBlender)
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBlender)
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDrawingSurfaceMac)
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDrawingSurfaceMac)
|
||||||
#if TARGET_CARBON
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecX)
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecX)
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsPrintOptionsX)
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsPrintOptionsX)
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSessionX, Init)
|
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(nsDeviceContextSpecFactoryMac)
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFontEnumeratorMac)
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFontEnumeratorMac)
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFontList)
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFontList)
|
||||||
|
@ -139,22 +126,14 @@ static const nsModuleComponentInfo components[] =
|
||||||
NS_DRAWING_SURFACE_CID,
|
NS_DRAWING_SURFACE_CID,
|
||||||
"@mozilla.org/gfx/drawing-surface;1",
|
"@mozilla.org/gfx/drawing-surface;1",
|
||||||
nsDrawingSurfaceMacConstructor },
|
nsDrawingSurfaceMacConstructor },
|
||||||
#if TARGET_CARBON
|
|
||||||
{ "nsDeviceContextSpec",
|
{ "nsDeviceContextSpec",
|
||||||
NS_DEVICE_CONTEXT_SPEC_CID,
|
NS_DEVICE_CONTEXT_SPEC_CID,
|
||||||
"@mozilla.org/gfx/devicecontextspec;1",
|
"@mozilla.org/gfx/devicecontextspec;1",
|
||||||
nsDeviceContextSpecXConstructor },
|
nsDeviceContextSpecXConstructor },
|
||||||
#else
|
|
||||||
{ "nsDeviceContextSpec",
|
|
||||||
NS_DEVICE_CONTEXT_SPEC_CID,
|
|
||||||
"@mozilla.org/gfx/devicecontextspec;1",
|
|
||||||
nsDeviceContextSpecMacConstructor },
|
|
||||||
#endif
|
|
||||||
{ "nsDeviceContextSpecFactory",
|
{ "nsDeviceContextSpecFactory",
|
||||||
NS_DEVICE_CONTEXT_SPEC_FACTORY_CID,
|
NS_DEVICE_CONTEXT_SPEC_FACTORY_CID,
|
||||||
"@mozilla.org/gfx/devicecontextspecfactory;1",
|
"@mozilla.org/gfx/devicecontextspecfactory;1",
|
||||||
nsDeviceContextSpecFactoryMacConstructor },
|
nsDeviceContextSpecFactoryMacConstructor },
|
||||||
#if TARGET_CARBON
|
|
||||||
{ "PrintSettings Service",
|
{ "PrintSettings Service",
|
||||||
NS_PRINTSETTINGSSERVICE_CID,
|
NS_PRINTSETTINGSSERVICE_CID,
|
||||||
"@mozilla.org/gfx/printsettings-service;1",
|
"@mozilla.org/gfx/printsettings-service;1",
|
||||||
|
@ -163,16 +142,6 @@ static const nsModuleComponentInfo components[] =
|
||||||
NS_PRINTSESSION_CID,
|
NS_PRINTSESSION_CID,
|
||||||
"@mozilla.org/gfx/printsession;1",
|
"@mozilla.org/gfx/printsession;1",
|
||||||
nsPrintSessionXConstructor },
|
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",
|
{ "nsFontEnumerator",
|
||||||
NS_FONT_ENUMERATOR_CID,
|
NS_FONT_ENUMERATOR_CID,
|
||||||
"@mozilla.org/gfx/fontenumerator;1",
|
"@mozilla.org/gfx/fontenumerator;1",
|
||||||
|
|
|
@ -54,14 +54,7 @@
|
||||||
*/
|
*/
|
||||||
inline PRBool CurrentPortIsWMPort()
|
inline PRBool CurrentPortIsWMPort()
|
||||||
{
|
{
|
||||||
#if TARGET_CARBON
|
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
#else
|
|
||||||
GrafPtr curPort;
|
|
||||||
::GetPort(&curPort);
|
|
||||||
|
|
||||||
return (curPort == ::LMGetWMgrPort());
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -82,20 +75,6 @@ inline PRBool ValidateDrawingState()
|
||||||
if (CurrentPortIsWMPort() && (FrontWindow() != nil))
|
if (CurrentPortIsWMPort() && (FrontWindow() != nil))
|
||||||
return false;
|
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
|
// 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
|
// it's the device for an offscreen GWorld. In that case, the current port
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
#include "imgScaler.h"
|
#include "imgScaler.h"
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
#if TARGET_CARBON
|
|
||||||
// useful region debugging code.
|
// useful region debugging code.
|
||||||
static OSStatus PrintRgnRectProc(UInt16 message, RgnHandle rgn, const Rect *inRect, void *refCon)
|
static OSStatus PrintRgnRectProc(UInt16 message, RgnHandle rgn, const Rect *inRect, void *refCon)
|
||||||
{
|
{
|
||||||
|
@ -81,7 +81,6 @@ static void PrintRegionOutline(RgnHandle inRgn)
|
||||||
UInt32 rectCount = 0;
|
UInt32 rectCount = 0;
|
||||||
::QDRegionToRects(inRgn, kQDParseRegionFromTopLeft, sCountRectProc, &rectCount);
|
::QDRegionToRects(inRgn, kQDParseRegionFromTopLeft, sCountRectProc, &rectCount);
|
||||||
}
|
}
|
||||||
#endif // TARGET_CARBON
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
|
@ -201,7 +201,6 @@ printf("told to draw at %ld %ld w %ld h %ld\n", inBoxRect.left, inBoxRect.top, i
|
||||||
void
|
void
|
||||||
nsNativeThemeMac::DrawEditText ( const Rect& inBoxRect, PRBool inIsDisabled )
|
nsNativeThemeMac::DrawEditText ( const Rect& inBoxRect, PRBool inIsDisabled )
|
||||||
{
|
{
|
||||||
#if TARGET_CARBON
|
|
||||||
Pattern whitePat;
|
Pattern whitePat;
|
||||||
::BackColor(whiteColor);
|
::BackColor(whiteColor);
|
||||||
::BackPat(GetQDGlobalsWhite(&whitePat));
|
::BackPat(GetQDGlobalsWhite(&whitePat));
|
||||||
|
@ -209,14 +208,12 @@ nsNativeThemeMac::DrawEditText ( const Rect& inBoxRect, PRBool inIsDisabled )
|
||||||
|
|
||||||
ThemeDrawState drawState = inIsDisabled ? kThemeStateDisabled : kThemeStateActive;
|
ThemeDrawState drawState = inIsDisabled ? kThemeStateDisabled : kThemeStateActive;
|
||||||
::DrawThemeEditTextFrame(&inBoxRect, drawState);
|
::DrawThemeEditTextFrame(&inBoxRect, drawState);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
nsNativeThemeMac::DrawListBox ( const Rect& inBoxRect, PRBool inIsDisabled )
|
nsNativeThemeMac::DrawListBox ( const Rect& inBoxRect, PRBool inIsDisabled )
|
||||||
{
|
{
|
||||||
#if TARGET_CARBON
|
|
||||||
Pattern whitePat;
|
Pattern whitePat;
|
||||||
::BackColor(whiteColor);
|
::BackColor(whiteColor);
|
||||||
::BackPat(GetQDGlobalsWhite(&whitePat));
|
::BackPat(GetQDGlobalsWhite(&whitePat));
|
||||||
|
@ -224,7 +221,6 @@ nsNativeThemeMac::DrawListBox ( const Rect& inBoxRect, PRBool inIsDisabled )
|
||||||
|
|
||||||
ThemeDrawState drawState = inIsDisabled ? kThemeStateDisabled : kThemeStateActive;
|
ThemeDrawState drawState = inIsDisabled ? kThemeStateDisabled : kThemeStateActive;
|
||||||
::DrawThemeListBoxFrame(&inBoxRect, drawState);
|
::DrawThemeListBoxFrame(&inBoxRect, drawState);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -488,7 +484,6 @@ nsNativeThemeMac::GetWidgetBorder(nsIDeviceContext* aContext,
|
||||||
|
|
||||||
// XXX we should probably cache some of these metrics
|
// XXX we should probably cache some of these metrics
|
||||||
|
|
||||||
#if TARGET_CARBON
|
|
||||||
switch ( aWidgetType ) {
|
switch ( aWidgetType ) {
|
||||||
|
|
||||||
case NS_THEME_BUTTON:
|
case NS_THEME_BUTTON:
|
||||||
|
@ -525,7 +520,6 @@ nsNativeThemeMac::GetWidgetBorder(nsIDeviceContext* aContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -547,7 +541,6 @@ nsNativeThemeMac::GetMinimumWidgetSize(nsIRenderingContext* aContext, nsIFrame*
|
||||||
aResult->SizeTo(0,0);
|
aResult->SizeTo(0,0);
|
||||||
*aIsOverridable = PR_TRUE;
|
*aIsOverridable = PR_TRUE;
|
||||||
|
|
||||||
#if TARGET_CARBON
|
|
||||||
switch ( aWidgetType ) {
|
switch ( aWidgetType ) {
|
||||||
|
|
||||||
case NS_THEME_BUTTON:
|
case NS_THEME_BUTTON:
|
||||||
|
@ -686,7 +679,6 @@ nsNativeThemeMac::GetMinimumWidgetSize(nsIRenderingContext* aContext, nsIFrame*
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,6 @@
|
||||||
|
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsIServiceManager.h"
|
#include "nsIServiceManager.h"
|
||||||
#include "nsWatchTask.h"
|
|
||||||
#include "nsPrintOptionsX.h"
|
#include "nsPrintOptionsX.h"
|
||||||
#include "nsPrintSettingsX.h"
|
#include "nsPrintSettingsX.h"
|
||||||
|
|
||||||
|
|
|
@ -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 <MacWindows.h>
|
|
||||||
#else
|
|
||||||
#include <Menus.h>
|
|
||||||
#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
|
|
|
@ -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 <Quickdraw.h>
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
|
|
||||||
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___
|
|
|
@ -34,6 +34,7 @@
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
#include <Script.h>
|
#include <Script.h>
|
||||||
#include "nsDeviceContextMac.h"
|
#include "nsDeviceContextMac.h"
|
||||||
#include "plhash.h"
|
#include "plhash.h"
|
||||||
|
@ -45,6 +46,7 @@
|
||||||
#include "nsIUnicodeEncoder.h"
|
#include "nsIUnicodeEncoder.h"
|
||||||
#include "nsCompressedCharMap.h"
|
#include "nsCompressedCharMap.h"
|
||||||
#include "nsMacUnicodeFontInfo.h"
|
#include "nsMacUnicodeFontInfo.h"
|
||||||
|
|
||||||
#define BAD_FONT_NUM -1
|
#define BAD_FONT_NUM -1
|
||||||
#define BAD_SCRIPT 0x7f
|
#define BAD_SCRIPT 0x7f
|
||||||
|
|
||||||
|
|
|
@ -43,9 +43,11 @@
|
||||||
#include "nsReadableUtils.h"
|
#include "nsReadableUtils.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsCRT.h"
|
#include "nsCRT.h"
|
||||||
|
|
||||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||||
|
|
||||||
#define BAD_FONT_NUM -1
|
#define BAD_FONT_NUM -1
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
nsUnicodeMappingUtil *nsUnicodeMappingUtil::gSingleton = nsnull;
|
nsUnicodeMappingUtil *nsUnicodeMappingUtil::gSingleton = nsnull;
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
#include "nsUnicodeRenderingToolkit.h"
|
#include "nsUnicodeRenderingToolkit.h"
|
||||||
#include "nsUnicodeFontMappingMac.h"
|
#include "nsUnicodeFontMappingMac.h"
|
||||||
#include "nsUnicodeFallbackCache.h"
|
#include "nsUnicodeFallbackCache.h"
|
||||||
|
@ -53,10 +54,10 @@
|
||||||
|
|
||||||
#include <FixMath.h>
|
#include <FixMath.h>
|
||||||
|
|
||||||
|
|
||||||
#define BAD_FONT_NUM -1
|
#define BAD_FONT_NUM -1
|
||||||
#define BAD_SCRIPT 0x7F
|
#define BAD_SCRIPT 0x7F
|
||||||
#define STACK_TRESHOLD 1000
|
#define STACK_TRESHOLD 1000
|
||||||
|
|
||||||
static NS_DEFINE_CID(kSaveAsCharsetCID, NS_SAVEASCHARSET_CID);
|
static NS_DEFINE_CID(kSaveAsCharsetCID, NS_SAVEASCHARSET_CID);
|
||||||
|
|
||||||
//#define DISABLE_TEC_FALLBACK
|
//#define DISABLE_TEC_FALLBACK
|
||||||
|
|
|
@ -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 <LowMem.h>
|
|
||||||
#include <Appearance.h>
|
|
||||||
|
|
||||||
|
|
||||||
// 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;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -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 <Retrace.h>
|
|
||||||
#endif
|
|
||||||
#include <Quickdraw.h>
|
|
||||||
#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
|
|
Загрузка…
Ссылка в новой задаче