From 7e138ea359544a44ccb5d1508d01e0cf6f658282 Mon Sep 17 00:00:00 2001 From: "mkaply%us.ibm.com" Date: Tue, 4 Apr 2000 00:07:04 +0000 Subject: [PATCH] # 33860 r= mkaply@us.ibm.com OS/2 bringup --- gfx/src/os2/nsDeviceContextOS2.h | 60 ++++++++++++++++------- gfx/src/os2/nsDeviceContextSpecFactoryO.h | 12 ++++- gfx/src/os2/nsDeviceContextSpecOS2.h | 1 - gfx/src/os2/nsDrawingSurfaceOS2.h | 17 +++++-- gfx/src/os2/nsFontMetricsOS2.h | 18 +++++-- widget/timer/src/os2/nsTimerOS2.cpp | 21 ++++++-- xpcom/io/nsFileSpecOS2.cpp | 13 ++++- 7 files changed, 108 insertions(+), 34 deletions(-) diff --git a/gfx/src/os2/nsDeviceContextOS2.h b/gfx/src/os2/nsDeviceContextOS2.h index c8c8735e01fc..fa4713ef8ea4 100644 --- a/gfx/src/os2/nsDeviceContextOS2.h +++ b/gfx/src/os2/nsDeviceContextOS2.h @@ -16,7 +16,16 @@ * Copyright (C) 1999 John Fairhurst. All Rights Reserved. * * Contributor(s): + * This Original Code has been modified by IBM Corporation. + * Modifications made by IBM described herein are + * Copyright (c) International Business Machines + * Corporation, 2000 * + * Modifications to Mozilla code or documentation + * identified per MPL Section 3.3 + * + * Date Modified by Description of modification + * 03/28/2000 IBM Corp. Changes to make os2.h file similar to windows.h file */ #ifndef _nsDeviceContextOS2_h @@ -35,38 +44,52 @@ class nsDrawingSurfaceOS2; class nsDeviceContextOS2 : public DeviceContextImpl { - public: +public: nsDeviceContextOS2(); NS_IMETHOD Init( nsNativeWidget aWidget); - // what a bizarre method. These floats are app units. - NS_IMETHOD GetScrollBarDimensions( float &aWidth, float &aHeight) const; + NS_IMETHOD CreateRenderingContext( nsIRenderingContext *&aContext); + NS_IMETHOD SupportsNativeWidgets( PRBool &aSupportsWidgets); + + NS_IMETHOD GetCanonicalPixelScale( float &aScale) const; + + NS_IMETHOD GetScrollBarDimensions( float &aWidth, float &aHeight) const; NS_IMETHOD GetSystemAttribute( nsSystemAttrID anID, SystemAttrStruct *aInfo) const; // get a low level drawing surface for rendering. the rendering context // that is passed in is used to create the drawing surface if there isn't // already one in the device context. the drawing surface is then cached // in the device context for re-use. - NS_IMETHOD GetDrawingSurface( nsIRenderingContext &aContext, - nsDrawingSurface &aSurface); + NS_IMETHOD GetDrawingSurface( nsIRenderingContext &aContext, nsDrawingSurface &aSurface); + NS_IMETHOD CheckFontExistence( const nsString &aFontName); + NS_IMETHOD GetDepth( PRUint32 &aDepth); + NS_IMETHOD GetILColorSpace( IL_ColorSpace*& aColorSpace); + NS_IMETHOD GetPaletteInfo( nsPaletteInfo &); + NS_IMETHOD ConvertPixel( nscolor aColor, PRUint32 & aPixel); + NS_IMETHOD GetDeviceSurfaceDimensions( PRInt32 &aWidth, PRInt32 &aHeight); + NS_IMETHOD GetClientRect(nsRect &aRect); - NS_IMETHOD SupportsNativeWidgets( PRBool &aSupportsWidgets); - NS_IMETHOD GetCanonicalPixelScale( float &aScale) const; - NS_IMETHOD GetDeviceContextFor( nsIDeviceContextSpec *aDevice, - nsIDeviceContext *&aContext); - NS_IMETHOD CreateRenderingContext( nsIRenderingContext *&aContext); - NS_IMETHOD BeginDocument(); - NS_IMETHOD EndDocument(); - NS_IMETHOD BeginPage(); - NS_IMETHOD EndPage(); + + NS_IMETHOD GetDeviceContextFor( nsIDeviceContextSpec *aDevice, + nsIDeviceContext *&aContext); + + NS_IMETHOD BeginDocument(void); + NS_IMETHOD EndDocument(void); + + NS_IMETHOD BeginPage(void); + NS_IMETHOD EndPage(void); + + // XXXX Copped from GTK version to remove warning about hidden virtual; nothing in Windows + NS_IMETHOD CreateRenderingContext(nsIView *aView, nsIRenderingContext *&aContext) {return (DeviceContextImpl::CreateRenderingContext(aView,aContext));} + NS_IMETHOD CreateRenderingContext(nsIWidget *aWidget, nsIRenderingContext *&aContext) {return (DeviceContextImpl::CreateRenderingContext(aWidget,aContext));} // OS2 specific methods public: @@ -76,9 +99,8 @@ class nsDeviceContextOS2 : public DeviceContextImpl // Release when done. nsresult GetPalette( nsIPaletteOS2 *&apalette); // Init from a HDC for printing purposes - nsresult Init( nsNativeDeviceContext aContext, - nsIDeviceContext *aOrigContext); - void CommonInit( HDC aDC); + void CommonInit(HDC aDC); + nsresult Init( nsNativeDeviceContext aContext, nsIDeviceContext *aOrigContext); // Needed by the fontmetrics - can't rely on having a widget. HPS GetRepresentativePS() const; @@ -92,8 +114,8 @@ class nsDeviceContextOS2 : public DeviceContextImpl nsDrawingSurfaceOS2 *mSurface; PRUint32 mDepth; // bit depth of device nsPaletteInfo mPaletteInfo; - nsIPaletteOS2 *mPalette; float mPixelScale; + nsIPaletteOS2 *mPalette; PRInt32 mWidth; PRInt32 mHeight; HDC mDC; // PrintDC. Owned by libprint. @@ -107,4 +129,4 @@ class nsDeviceContextOS2 : public DeviceContextImpl } mPrintState; }; -#endif +#endif /* nsDeviceContextOS2_h__ */ diff --git a/gfx/src/os2/nsDeviceContextSpecFactoryO.h b/gfx/src/os2/nsDeviceContextSpecFactoryO.h index 6648ca6d3f1a..66e8a7f7736b 100644 --- a/gfx/src/os2/nsDeviceContextSpecFactoryO.h +++ b/gfx/src/os2/nsDeviceContextSpecFactoryO.h @@ -16,7 +16,16 @@ * Copyright (C) 1999 John Fairhurst. All Rights Reserved. * * Contributor(s): + * This Original Code has been modified by IBM Corporation. + * Modifications made by IBM described herein are + * Copyright (c) International Business Machines + * Corporation, 2000 * + * Modifications to Mozilla code or documentation + * identified per MPL Section 3.3 + * + * Date Modified by Description of modification + * 03/28/2000 IBM Corp. Changes to make os2.h file similar to windows.h file */ // This class is part of the strange printing `architecture'. @@ -38,10 +47,11 @@ class nsDeviceContextSpecFactoryOS2 : public nsIDeviceContextSpecFactory NS_DECL_ISUPPORTS - NS_IMETHOD Init(); + NS_IMETHOD Init(void); NS_IMETHOD CreateDeviceContextSpec( nsIDeviceContextSpec *aOldSpec, nsIDeviceContextSpec *&aNewSpec, PRBool aQuiet); + protected: virtual ~nsDeviceContextSpecFactoryOS2() {} }; diff --git a/gfx/src/os2/nsDeviceContextSpecOS2.h b/gfx/src/os2/nsDeviceContextSpecOS2.h index 1f3e4b926299..53f58a853d71 100644 --- a/gfx/src/os2/nsDeviceContextSpecOS2.h +++ b/gfx/src/os2/nsDeviceContextSpecOS2.h @@ -16,7 +16,6 @@ * Copyright (C) 1999 John Fairhurst. All Rights Reserved. * * Contributor(s): - * */ #ifndef _nsDeviceContextSpecOS2_h diff --git a/gfx/src/os2/nsDrawingSurfaceOS2.h b/gfx/src/os2/nsDrawingSurfaceOS2.h index 7941914dd3a2..4d5855832dd0 100644 --- a/gfx/src/os2/nsDrawingSurfaceOS2.h +++ b/gfx/src/os2/nsDrawingSurfaceOS2.h @@ -16,7 +16,16 @@ * Copyright (C) 1999 John Fairhurst. All Rights Reserved. * * Contributor(s): + * This Original Code has been modified by IBM Corporation. + * Modifications made by IBM described herein are + * Copyright (c) International Business Machines + * Corporation, 2000 * + * Modifications to Mozilla code or documentation + * identified per MPL Section 3.3 + * + * Date Modified by Description of modification + * 03/28/2000 IBM Corp. Changes to make os2.h file similar to windows.h file */ #ifndef _nsDrawingSurfaceOS2_h @@ -48,10 +57,6 @@ class nsDrawingSurfaceOS2 : public nsIDrawingSurface long mTopID; // highest used lcid nsIPaletteOS2 *mPalette; // palette - protected: - void DeselectPalette(); - void DisposeFonts(); // MUST be called before disposing of PS - public: nsDrawingSurfaceOS2(); virtual ~nsDrawingSurfaceOS2(); @@ -70,6 +75,10 @@ class nsDrawingSurfaceOS2 : public nsIDrawingSurface NS_IMETHOD GetBitmap( HBITMAP &aBitmap); // yuck (for blender, may go) NS_IMETHOD RequiresInvertedMask( PRBool *aBool); // double yuck (images) + + protected: + void DeselectPalette(); + void DisposeFonts(); // MUST be called before disposing of PS }; // Offscreen surface. Others depend on this. diff --git a/gfx/src/os2/nsFontMetricsOS2.h b/gfx/src/os2/nsFontMetricsOS2.h index 5f17ffe36066..cd0b17391975 100644 --- a/gfx/src/os2/nsFontMetricsOS2.h +++ b/gfx/src/os2/nsFontMetricsOS2.h @@ -15,8 +15,16 @@ * . Portions created by John Fairhurst are * Copyright (C) 1999 John Fairhurst. All Rights Reserved. * - * Contributor(s): + * This Original Code has been modified by IBM Corporation. + * Modifications made by IBM described herein are + * Copyright (c) International Business Machines + * Corporation, 2000 * + * Modifications to Mozilla code or documentation + * identified per MPL Section 3.3 + * + * Date Modified by Description of modification + * 03/28/2000 IBM Corp. Changes to make os2.h file similar to windows.h file */ #ifndef _nsFontMetricsOS2_h @@ -60,13 +68,14 @@ class nsFontMetricsOS2 : public nsIFontMetrics NS_IMETHOD GetSubscriptOffset( nscoord &aResult); NS_IMETHOD GetStrikeout( nscoord &aOffset, nscoord &aSize); NS_IMETHOD GetUnderline( nscoord &aOffset, nscoord &aSize); + NS_IMETHOD GetHeight( nscoord &aHeight); NS_IMETHOD GetLeading( nscoord &aLeading); NS_IMETHOD GetMaxAscent( nscoord &aAscent); NS_IMETHOD GetMaxDescent( nscoord &aDescent); NS_IMETHOD GetMaxAdvance( nscoord &aAdvance); - NS_IMETHOD GetFont( const nsFont *&aFont); +// NS_IMETHOD GetLangGroup(nsIAtom** aLangGroup); NS_IMETHOD GetFontHandle( nsFontHandle &aHandle); // NS_IMETHOD GetLangGroup(nsIAtom** aLangGroup); @@ -78,8 +87,6 @@ class nsFontMetricsOS2 : public nsIFontMetrics nsresult RealizeFont(); nsFont *mFont; - - nscoord mXHeight; nscoord mSuperscriptYOffset; nscoord mSubscriptYOffset; nscoord mStrikeoutPosition; @@ -91,9 +98,10 @@ class nsFontMetricsOS2 : public nsIFontMetrics nscoord mMaxAscent; nscoord mMaxDescent; nscoord mMaxAdvance; + nscoord mSpaceWidth; + nscoord mXHeight; PRUint32 mDevMaxAscent; - nscoord mSpaceWidth; nsFontHandleOS2 *mFontHandle; nsDeviceContextOS2 *mContext; // sigh.. broken broken broken XP interfaces... diff --git a/widget/timer/src/os2/nsTimerOS2.cpp b/widget/timer/src/os2/nsTimerOS2.cpp index 5df680d5e1cc..e9f00bbe3bab 100644 --- a/widget/timer/src/os2/nsTimerOS2.cpp +++ b/widget/timer/src/os2/nsTimerOS2.cpp @@ -16,7 +16,20 @@ * Copyright (C) 1999 John Fairhurst. All Rights Reserved. * * Contributor(s): - * Pierre Phaneuf + * Pierre Phaneuf + * + * This Original Code has been modified by IBM Corporation. + * Modifications made by IBM described herein are + * Copyright (c) International Business Machines + * Corporation, 2000 + * + * Modifications to Mozilla code or documentation + * identified per MPL Section 3.3 + * + * Date Modified by Description of modification + * 03/31/2000 IBM Corp. Get rid of mBusy message and call default WndProc. Message is + * put out while wizards (i.e. Mail) is active. + * */ #define INCL_DOS @@ -233,8 +246,10 @@ MRESULT nsTimerManager::HandleMsg( ULONG msg, MPARAM mp1, MPARAM mp2) ProcessTimeouts( 0); mBusy = FALSE; } - else - printf( "mBusy == TRUE but want to fire Timer!\n"); + else { + // printf( "mBusy == TRUE but want to fire Timer!\n"); + mRC = WinDefWindowProc( mHWNDTimer, msg, mp1, mp2); // handle the message + } } else mRC = WinDefWindowProc( mHWNDTimer, msg, mp1, mp2); diff --git a/xpcom/io/nsFileSpecOS2.cpp b/xpcom/io/nsFileSpecOS2.cpp index 9fc17959ddab..f46dedc8f6fb 100644 --- a/xpcom/io/nsFileSpecOS2.cpp +++ b/xpcom/io/nsFileSpecOS2.cpp @@ -19,6 +19,17 @@ * 00/01/06: general review and update against Win/Unix versions; * replaced nsFileSpec::Execute implementation with system() call * which properly launches OS/2 PM|VIO, WinOS2 and DOS programs + * + * This Original Code has been modified by IBM Corporation. + * Modifications made by IBM described herein are + * Copyright (c) International Business Machines + * Corporation, 2000 + * + * Modifications to Mozilla code or documentation + * identified per MPL Section 3.3 + * + * Date Modified by Description of modification + * 03/23/2000 IBM Corp. Fixed bug where 2 char or less profile names treated as drive letters. */ // This file is #include-d by nsFileSpec.cpp and contains OS/2 specific @@ -79,7 +90,7 @@ void nsFileSpecHelpers::UnixToNative( nsSimpleCharString &ioPath) ioPath[1] = ':'; // yucky specialcase for drive roots: "H:" is not valid, has to be "H:\" - if( ioPath[2] == '\0') + if(( ioPath[2] == '\0') && (ioPath[1] == ':') && (ioPath[0] != '\0')) { char dl = ioPath[0]; ioPath = " :\\";