Change to convert Widget and Gfx into component DLLs on Mac, bug 94434. r=pchen, sr=beard/darin

This commit is contained in:
sfraser%netscape.com 2001-11-10 01:05:03 +00:00
Родитель a0ce027b7e
Коммит f4da98e824
49 изменённых файлов: 628 добавлений и 842 удалений

Просмотреть файл

@ -1583,7 +1583,12 @@ sub BuildLayoutProjects()
BuildProject(":mozilla:expat:macbuild:expat.mcp", "expat$D.o");
BuildOneProject(":mozilla:htmlparser:macbuild:htmlparser.mcp", "htmlparser$D.$S", 1, $main::ALIAS_SYM_FILES, 1);
BuildOneProjectWithOutput(":mozilla:gfx:macbuild:gfx.mcp", "gfx$C$D.$S", "gfx$D.$S", 1, $main::ALIAS_SYM_FILES, 0);
BuildOneProject(":mozilla:gfx:macbuild:gfx.mcp", "gfx$D.shlb", 1, $main::ALIAS_SYM_FILES, 0);
my($dbg) = $main::DEBUG ? "Dbg" : "";
BuildOneProjectWithOutput(":mozilla:gfx:macbuild:gfxComponent.mcp", "gfxComponent$C$dbg.$S", "gfxComponent$D.$S", 1, $main::ALIAS_SYM_FILES, 1);
BuildOneProject(":mozilla:dom:macbuild:dom.mcp", "dom$D.$S", 1, $main::ALIAS_SYM_FILES, 1);
BuildOneProject(":mozilla:modules:plugin:base:macbuild:plugin.mcp", "plugin$D.$S", 1, $main::ALIAS_SYM_FILES, 1);
@ -1610,9 +1615,9 @@ sub BuildLayoutProjects()
}
BuildOneProject(":mozilla:layout:macbuild:layout.mcp", "layout$D.$S", 1, $main::ALIAS_SYM_FILES, 1);
BuildOneProject(":mozilla:view:macbuild:view.mcp", "view$D.$S", 1, $main::ALIAS_SYM_FILES, 1);
BuildOneProjectWithOutput(":mozilla:widget:macbuild:widget.mcp", "widget$C$D.$S", "widget$D.$S", 1, $main::ALIAS_SYM_FILES, 0);
BuildOneProject(":mozilla:widget:macbuild:WidgetSupport.mcp", "WidgetSupport$D.shlb", 1, $main::ALIAS_SYM_FILES, 0);
BuildOneProjectWithOutput(":mozilla:widget:macbuild:widget.mcp", "widget$C$D.$S", "widget$D.$S", 1, $main::ALIAS_SYM_FILES, 1);
BuildOneProject(":mozilla:docshell:macbuild:docshell.mcp", "docshell$D.$S", 1, $main::ALIAS_SYM_FILES, 1);
BuildOneProject(":mozilla:webshell:embed:mac:RaptorShell.mcp", "RaptorShell$D.$S", 1, $main::ALIAS_SYM_FILES, 0);
BuildOneProject(":mozilla:rdf:macbuild:rdf.mcp", "RDFLibrary$D.$S", 1, $main::ALIAS_SYM_FILES, 1);

Двоичные данные
embedding/browser/powerplant/PPBrowser.mcp

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1,26 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* 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):
*/
#if TARGET_CARBON
// we can't use the carbon printing session APIs
#define PM_USE_SESSION_APIS 0
#endif

Просмотреть файл

@ -20,6 +20,5 @@
* Contributor(s):
*/
#define GFX_STATIC 1
#include "MacPrefix_debug.h"
#include "MacPrefix_debug.h"
#include "GFXComponentConfig.h"

Просмотреть файл

@ -20,6 +20,5 @@
* Contributor(s):
*/
#define GFX_STATIC 1
#include "MacPrefix.h"
#include "MacSharedPrefix.h"
#include "GFXComponentConfig.h"

Просмотреть файл

@ -21,8 +21,3 @@
*/
#define _IMPL_NS_GFX 1
#if TARGET_CARBON
// we can't use the carbon printing session APIs
#define PM_USE_SESSION_APIS 0
#endif

Просмотреть файл

@ -20,5 +20,5 @@
* Contributor(s):
*/
#include "MacSharedPrefix.h"
#include "GFXConfig.h"
#include "MacPrefix.h"

Просмотреть файл

@ -20,5 +20,6 @@
* Contributor(s):
*/
#include "MacPrefix_debug.h"
#include "GFXConfig.h"
#include "MacPrefix_debug.h"

Двоичные данные
gfx/macbuild/gfx.mcp

Двоичный файл не отображается.

Двоичные данные
gfx/macbuild/gfxComponent.mcp Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -43,7 +43,7 @@
class EventRecord;
class NS_NET Repeater
class NS_WIDGET Repeater
{
public:

Просмотреть файл

@ -19,105 +19,117 @@
# Contributor(s):
#
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = gfx
MODULE = gfx
EXPORTS = nsFontList.h
LIBRARY_NAME = gkgfx
LIBRARY_NAME = gkgfx
EXPORT_LIBRARY = 1
REQUIRES = xpcom \
string \
widget \
locale \
view \
pref \
gfx2 \
imglib2 \
uconv \
unicharutil \
$(NULL)
REQUIRES = xpcom \
string \
widget \
locale \
view \
pref \
gfx2 \
imglib2 \
uconv \
unicharutil \
$(NULL)
ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
DIRS =
DIRS =
else
DIRS = ps
DIRS = ps
endif
ifneq (,$(filter beos os2 mac,$(MOZ_GFX_TOOLKIT)))
DIRS += $(MOZ_GFX_TOOLKIT)
DIRS += $(MOZ_GFX_TOOLKIT)
endif
# Build xlibrgb only for X toolkits and/or Xprint
ifneq (,$(filter xlib,$(MOZ_WIDGET_TOOLKIT))$(MOZ_ENABLE_XLIB)$(MOZ_ENABLE_XPRINT))
DIRS += xlibrgb
DIRS += xlibrgb
endif
ifdef MOZ_ENABLE_GTK
DIRS += gtk
DIRS += gtk
endif
ifdef MOZ_ENABLE_GTK2
DIRS += gtk2
DIRS += gtk2
endif
ifdef MOZ_ENABLE_QT
DIRS += qt
DIRS += qt
endif
ifdef MOZ_ENABLE_XLIB
DIRS += xlib
DIRS += xlib
endif
ifdef MOZ_ENABLE_PHOTON
DIRS += photon
DIRS += photon
endif
ifdef MOZ_ENABLE_XPRINT
DIRS += xprint
DIRS += xprint
endif
CPPSRCS = \
nsBlender.cpp \
nsColor.cpp \
nsColorNames.cpp \
nsCompressedCharMap.cpp \
nsDeviceContext.cpp \
nsFont.cpp \
nsFontList.cpp \
nsRenderingContextImpl.cpp \
nsRect.cpp \
nsTransform2D.cpp \
nsScriptableRegion.cpp \
nsGraphicsImpl.cpp \
nsPrintOptionsImpl.cpp \
$(NULL)
CPPSRCS = \
nsBlender.cpp \
nsColor.cpp \
nsColorNames.cpp \
nsCompressedCharMap.cpp \
nsDeviceContext.cpp \
nsFont.cpp \
nsFontList.cpp \
nsRenderingContextImpl.cpp \
nsRect.cpp \
nsTransform2D.cpp \
nsScriptableRegion.cpp \
nsGraphicsImpl.cpp \
nsPrintOptionsImpl.cpp \
$(NULL)
ifneq (,$(filter gtk xlib os2,$(MOZ_WIDGET_TOOLKIT)))
CPPSRCS += \
nsRegion.cpp \
nsRegionImpl.cpp \
$(NULL)
CPPSRCS += \
nsRegion.cpp \
nsRegionImpl.cpp \
$(NULL)
endif
ifneq (,$(filter gtk xlib beos,$(MOZ_WIDGET_TOOLKIT)))
CPPSRCS += imgScaler.cpp
CPPSRCS += imgScaler.cpp
endif
ifeq (mac, $(MOZ_WIDGET_TOOLKIT))
CPPSRCS += \
mac/nsRegionPool.cpp \
$(NULL)
endif
SHARED_LIBRARY_LIBS = \
$(DIST)/lib/libmozutil_s.$(LIB_SUFFIX) \
$(NULL)
$(DIST)/lib/libmozutil_s.$(LIB_SUFFIX) \
$(NULL)
EXTRA_DSO_LDOPTS = \
$(MOZ_UNICHARUTIL_LIBS) \
$(MOZ_COMPONENT_LIBS) \
$(NULL)
$(MOZ_UNICHARUTIL_LIBS) \
$(MOZ_COMPONENT_LIBS) \
$(NULL)
ifeq (mac, $(MOZ_WIDGET_TOOLKIT))
EXTRA_DSO_LDOPTS += \
$(TK_LIBS) \
$(NULL)
endif
include $(topsrcdir)/config/rules.mk
DEFINES += -D_IMPL_NS_GFX
DEFINES += -D_IMPL_NS_GFX
install:: icon_0.gif icon_1.gif
$(INSTALL) -m 555 $^ $(DIST)/bin/res/gfx
$(INSTALL) -m 555 $^ $(DIST)/bin/res/gfx

Просмотреть файл

@ -15,70 +15,72 @@
# Reserved.
#
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = gfx_mac
EXPORT_LIBRARY = 1
MODULE = gfx
IS_COMPONENT = 1
MODULE_NAME = nsGfxMacModule
REQUIRES = xpcom \
string \
img \
widget \
view \
util \
dom \
pref \
js \
uconv \
necko \
unicharutil \
gfx2 \
mozcomps \
windowwatcher \
$(NULL)
LIBRARY_NAME = gfx_mac
EXPORT_LIBRARY = 1
MODULE = gfx
IS_COMPONENT = 1
MODULE_NAME = nsGfxMacModule
REQUIRES = xpcom \
string \
img \
widget \
view \
util \
dom \
pref \
js \
uconv \
necko \
unicharutil \
gfx2 \
mozcomps \
windowwatcher \
$(NULL)
CPPSRCS = \
nsATSUIUtils.cpp \
nsDeviceContextMac.cpp \
nsDeviceContextSpecFactoryM.cpp \
nsDeviceContextSpecX.cpp \
nsDrawingSurfaceMac.cpp \
nsFontMetricsMac.cpp \
nsGfxFactoryMac.cpp \
nsGraphicState.cpp \
nsImageMac.cpp \
nsRegionMac.cpp \
nsRenderingContextMac.cpp \
nsMacUnicodeFontInfo.cpp \
nsUnicodeFontMappingMac.cpp \
nsUnicodeMappingUtil.cpp \
nsUnicodeRenderingToolkit.cpp \
nsScreenMac.cpp \
nsScreenManagerMac.cpp \
nsPrintOptionsX.cpp \
$(NULL)
nsATSUIUtils.cpp \
nsDeviceContextMac.cpp \
nsDeviceContextSpecFactoryM.cpp \
nsDeviceContextSpecX.cpp \
nsDrawingSurfaceMac.cpp \
nsFontMetricsMac.cpp \
nsGfxFactoryMac.cpp \
nsGraphicState.cpp \
nsImageMac.cpp \
nsRegionMac.cpp \
nsRenderingContextMac.cpp \
nsMacUnicodeFontInfo.cpp \
nsUnicodeFontMappingMac.cpp \
nsUnicodeMappingUtil.cpp \
nsUnicodeRenderingToolkit.cpp \
nsScreenMac.cpp \
nsScreenManagerMac.cpp \
nsPrintOptionsX.cpp \
nsFontUtils.cpp \
$(NULL)
# $(DIST)/lib/libimg_s.a \
# $(DIST)/lib/libimg_s.a \
EXTRA_DSO_LDOPTS = \
$(MKSHLIB_FORCE_ALL) \
$(DIST)/lib/libmozutil_s.a \
-lgkgfx \
$(MKSHLIB_UNFORCE_ALL) \
$(TK_LIBS) \
$(MOZ_COMPONENT_LIBS) \
$(NULL)
$(MKSHLIB_FORCE_ALL) \
$(DIST)/lib/libmozutil_s.a \
-lgkgfx \
$(MKSHLIB_UNFORCE_ALL) \
$(TK_LIBS) \
$(MOZ_COMPONENT_LIBS) \
$(NULL)
include $(topsrcdir)/config/rules.mk
CXXFLAGS += $(TK_CFLAGS)
CFLAGS += $(TK_CFLAGS)
INCLUDES += $(TK_CFLAGS) -I$(srcdir)/..
CXXFLAGS += $(TK_CFLAGS)
CFLAGS += $(TK_CFLAGS)
INCLUDES += $(TK_CFLAGS) -I$(srcdir)/..

Просмотреть файл

@ -42,6 +42,8 @@
#include "nsDeviceContextMac.h"
#include "nsTransform2D.h"
#include "plhash.h"
#include "nsFontUtils.h"
#include <Gestalt.h>
#include <FixMath.h>
@ -304,7 +306,7 @@ ATSUTextLayout nsATSUIToolkit::GetTextLayout(short aFontNum, short aSize, PRBool
mContext->GetDevUnitsToAppUnits(dev2app);
// Fixed size = FloatToFixed( roundf(float(fontsize) / dev2app));
Fixed size = FloatToFixed( (float) rint(float(fontsize) / dev2app));
if( FixRound ( size ) < 9 && !nsDeviceContextMac::DisplayVerySmallFonts())
if( FixRound ( size ) < 9 && !nsFontUtils::DisplayVerySmallFonts())
size = X2Fix(9);
theTag[1] = kATSUSizeTag;

Просмотреть файл

@ -69,7 +69,6 @@
PRUint32 nsDeviceContextMac::mPixelsPerInch = 96;
PRBool nsDeviceContextMac::mDisplayVerySmallFonts = true;
PRUint32 nsDeviceContextMac::sNumberOfScreens = 0;
@ -969,25 +968,6 @@ PRUint32 nsDeviceContextMac::GetScreenResolution()
return mPixelsPerInch;
}
PRBool nsDeviceContextMac::DisplayVerySmallFonts()
{
static PRBool initialized = PR_FALSE;
if (initialized)
return mDisplayVerySmallFonts;
initialized = PR_TRUE;
nsresult rv;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
if (NS_SUCCEEDED(rv) && prefs) {
PRBool boolVal;
if (NS_SUCCEEDED(prefs->GetBoolPref("browser.display_very_small_fonts", &boolVal))) {
mDisplayVerySmallFonts = boolVal;
}
}
return mDisplayVerySmallFonts;
}
#pragma mark -
//------------------------------------------------------------------------

Просмотреть файл

@ -111,11 +111,9 @@ public:
private:
static PRUint32 mPixelsPerInch;
static PRBool mDisplayVerySmallFonts;
static PRUint32 sNumberOfScreens; // how many screens we have.
public:
static PRUint32 GetScreenResolution();
static PRBool DisplayVerySmallFonts();
};

Просмотреть файл

@ -387,7 +387,8 @@ NS_IMETHODIMP nsDeviceContextSpecMac::Init(PRBool aQuiet)
// standard print dialog, if true print
nsWatchTask::GetTask().Suspend();
::InitCursor();
// put up the print dialog
if (::PrDlgMain(hPrintRec, theInitProcPtr))
{

Просмотреть файл

@ -116,6 +116,8 @@ NS_IMETHODIMP nsDeviceContextSpecX::Init(PRBool aQuiet)
if (! aQuiet)
{
::InitCursor();
Boolean accepted = false;
status = ::PMPrintDialog(mPrintSettings, mPageFormat, &accepted);
if (! accepted)

Просмотреть файл

@ -43,6 +43,7 @@
#include "nsUnicodeFontMappingMac.h"
#include "nsUnicodeMappingUtil.h"
#include "nsGfxUtils.h"
#include "nsFontUtils.h"
#define BAD_FONT_NUM -1
@ -79,7 +80,7 @@ NS_IMETHODIMP nsFontMetricsMac::Init(const nsFont& aFont, nsIAtom* aLangGroup, n
RealizeFont();
TextStyle theStyle;
nsFontMetricsMac::GetNativeTextStyle(*this, *mContext, theStyle);
nsFontUtils::GetNativeTextStyle(*this, *mContext, theStyle);
StTextStyleSetter styleSetter(theStyle);
@ -399,68 +400,3 @@ NS_IMETHODIMP nsFontMetricsMac :: GetFontHandle(nsFontHandle &aHandle)
return NS_OK;
}
// A utility routine to the the text style in a convenient manner.
// This is static, which is unfortunate, because it introduces link
// dependencies between libraries that should not exist.
NS_EXPORT void nsFontMetricsMac::GetNativeTextStyle(nsIFontMetrics& inMetrics,
const nsIDeviceContext& inDevContext, TextStyle &outStyle)
{
const nsFont *aFont;
inMetrics.GetFont(aFont);
nsFontHandle fontNum;
inMetrics.GetFontHandle(fontNum);
float dev2app;
inDevContext.GetDevUnitsToAppUnits(dev2app);
short textSize = float(aFont->size) / dev2app;
if (textSize < 9 && !nsDeviceContextMac::DisplayVerySmallFonts())
textSize = 9;
Style textFace = normal;
switch (aFont->style)
{
case NS_FONT_STYLE_NORMAL: break;
case NS_FONT_STYLE_ITALIC: textFace |= italic; break;
case NS_FONT_STYLE_OBLIQUE: textFace |= italic; break; //XXX
}
#if 0
switch (aFont->variant)
{
case NS_FONT_VARIANT_NORMAL: break;
case NS_FONT_VARIANT_SMALL_CAPS: break;
}
#endif
PRInt32 offset = aFont->weight % 100;
PRInt32 baseWeight = aFont->weight / 100;
NS_ASSERTION((offset < 10) || (offset > 90), "Invalid bolder or lighter value");
if (offset == 0) {
if (aFont->weight >= NS_FONT_WEIGHT_BOLD)
textFace |= bold;
} else {
if (offset < 10)
textFace |= bold;
}
if ( aFont->decorations & NS_FONT_DECORATION_UNDERLINE )
textFace |= underline;
if ( aFont->decorations & NS_FONT_DECORATION_OVERLINE )
textFace |= underline; // THIS IS WRONG, BUT HERE FOR COMPLETENESS
if ( aFont->decorations & NS_FONT_DECORATION_LINE_THROUGH )
textFace |= underline; // THIS IS WRONG, BUT HERE FOR COMPLETENESS
RGBColor black = {0};
float textZoom = 1.0;
inDevContext.GetTextZoom(textZoom);
textSize *= textZoom;
outStyle.tsFont = (short)fontNum;
outStyle.tsFace = textFace;
outStyle.tsSize = textSize;
outStyle.tsColor = black;
}

Просмотреть файл

@ -84,10 +84,6 @@ public:
NS_IMETHOD GetLangGroup(nsIAtom** aLangGroup);
NS_IMETHOD GetFontHandle(nsFontHandle& aHandle);
NS_IMETHOD GetSpaceWidth(nscoord& aSpaceCharWidth);
// fill a native TextStyle record with the font, size and style (not color)
static void GetNativeTextStyle(nsIFontMetrics& inMetrics,
const nsIDeviceContext& inDevContext, TextStyle &outStyle);
nsUnicodeFontMappingMac* GetUnicodeFontMapping();

117
gfx/src/mac/nsFontUtils.cpp Normal file
Просмотреть файл

@ -0,0 +1,117 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* 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):
*/
#include "nsIPref.h"
#include "nsIServiceManager.h"
#include "nsFont.h"
#include "nsDeviceContextMac.h"
#include "nsFontUtils.h"
PRBool nsFontUtils::sDisplayVerySmallFonts = true;
PRBool
nsFontUtils::DisplayVerySmallFonts()
{
static PRBool sInitialized = PR_FALSE;
if (sInitialized)
return sDisplayVerySmallFonts;
sInitialized = PR_TRUE;
nsresult rv;
nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv) && prefs) {
PRBool boolVal;
if (NS_SUCCEEDED(prefs->GetBoolPref("browser.display_very_small_fonts", &boolVal))) {
sDisplayVerySmallFonts = boolVal;
}
}
return sDisplayVerySmallFonts;
}
// A utility routine to the the text style in a convenient manner.
// This is static, which is unfortunate, because it introduces link
// dependencies between libraries that should not exist.
void
nsFontUtils::GetNativeTextStyle(nsIFontMetrics& inMetrics,
const nsIDeviceContext& inDevContext, TextStyle &outStyle)
{
const nsFont *aFont;
inMetrics.GetFont(aFont);
nsFontHandle fontNum;
inMetrics.GetFontHandle(fontNum);
float dev2app;
inDevContext.GetDevUnitsToAppUnits(dev2app);
short textSize = float(aFont->size) / dev2app;
if (textSize < 9 && !nsFontUtils::DisplayVerySmallFonts())
textSize = 9;
Style textFace = normal;
switch (aFont->style)
{
case NS_FONT_STYLE_NORMAL: break;
case NS_FONT_STYLE_ITALIC: textFace |= italic; break;
case NS_FONT_STYLE_OBLIQUE: textFace |= italic; break; //XXX
}
#if 0
switch (aFont->variant)
{
case NS_FONT_VARIANT_NORMAL: break;
case NS_FONT_VARIANT_SMALL_CAPS: break;
}
#endif
PRInt32 offset = aFont->weight % 100;
PRInt32 baseWeight = aFont->weight / 100;
NS_ASSERTION((offset < 10) || (offset > 90), "Invalid bolder or lighter value");
if (offset == 0) {
if (aFont->weight >= NS_FONT_WEIGHT_BOLD)
textFace |= bold;
} else {
if (offset < 10)
textFace |= bold;
}
if ( aFont->decorations & NS_FONT_DECORATION_UNDERLINE )
textFace |= underline;
if ( aFont->decorations & NS_FONT_DECORATION_OVERLINE )
textFace |= underline; // THIS IS WRONG, BUT HERE FOR COMPLETENESS
if ( aFont->decorations & NS_FONT_DECORATION_LINE_THROUGH )
textFace |= underline; // THIS IS WRONG, BUT HERE FOR COMPLETENESS
RGBColor black = {0};
outStyle.tsFont = (short)fontNum;
outStyle.tsFace = textFace;
outStyle.tsSize = textSize;
outStyle.tsColor = black;
}

Просмотреть файл

@ -20,12 +20,27 @@
* Contributor(s):
*/
#define MAC_SHARED 1
#define _IMPL_NS_WIDGET 1
#ifndef nsFontUtils_h_
#define nsFontUtils_h_
#include "WidgetDebug.prefix"
#include <TextEdit.h>
#if !TARGET_CARBON
#define USE_MENUSELECT 1
#endif
#include "nsIFontMetrics.h"
#include "nsIDeviceContext.h"
class NS_GFX nsFontUtils
{
public:
static void GetNativeTextStyle(nsIFontMetrics& inMetrics, const nsIDeviceContext& inDevContext, TextStyle &outStyle);
static PRBool DisplayVerySmallFonts();
protected:
static PRBool sDisplayVerySmallFonts;
};
#endif // nsFontUtils_h_

Просмотреть файл

@ -61,11 +61,8 @@
#include "nsCOMPtr.h"
#include "nsPrintOptionsMac.h"
#ifdef XP_MACOSX
#include "nsIGenericFactory.h"
// XXX Implement the GFX module using NS_GENERIC_FACTORY_CONSTRUCTOR / NS_IMPL_NSGETMODULE
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFontMetricsMac)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextMac)
@ -74,8 +71,13 @@ 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)
#else
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecMac)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsPrintOptionsMac)
#endif
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecFactoryMac)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFontEnumeratorMac)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFontList)
@ -116,6 +118,10 @@ static nsModuleComponentInfo components[] =
NS_REGION_CID,
"@mozilla.org/gfx/unscriptable-region;1",
nsRegionMacConstructor },
{ "nsScriptableRegion",
NS_SCRIPTABLE_REGION_CID,
"@mozilla.org/gfx/region;1",
nsScriptableRegionConstructor },
{ "nsBlender",
NS_BLENDER_CID,
"@mozilla.org/gfx/blender;1",
@ -124,22 +130,32 @@ static 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 },
{ "nsScriptableRegion",
NS_SCRIPTABLE_REGION_CID,
"@mozilla.org/gfx/region;1",
nsScriptableRegionConstructor },
#if TARGET_CARBON
{ "nsPrintOptions",
NS_PRINTOPTIONS_CID,
"@mozilla.org/gfx/printoptions;1",
nsPrintOptionsXConstructor },
#else
{ "Print Options",
NS_PRINTOPTIONS_CID,
"@mozilla.org/gfx/printoptions;1",
nsPrintOptionsMacConstructor },
#endif
{ "nsFontEnumerator",
NS_FONT_ENUMERATOR_CID,
"@mozilla.org/gfx/fontenumerator;1",
@ -156,158 +172,4 @@ static nsModuleComponentInfo components[] =
NS_IMPL_NSGETMODULE(nsGfxModule, components)
#else
static NS_DEFINE_IID(kCFontMetrics, NS_FONT_METRICS_CID);
static NS_DEFINE_IID(kCFontEnumerator, NS_FONT_ENUMERATOR_CID);
static NS_DEFINE_IID(kCFontList, NS_FONTLIST_CID);
static NS_DEFINE_IID(kCRenderingContext, NS_RENDERING_CONTEXT_CID);
static NS_DEFINE_IID(kCImage, NS_IMAGE_CID);
static NS_DEFINE_IID(kCDeviceContext, NS_DEVICE_CONTEXT_CID);
static NS_DEFINE_IID(kCRegion, NS_REGION_CID);
static NS_DEFINE_IID(kCScriptableRegion, NS_SCRIPTABLE_REGION_CID);
static NS_DEFINE_IID(kCDeviceContextSpec, NS_DEVICE_CONTEXT_SPEC_CID);
static NS_DEFINE_IID(kCDeviceContextSpecFactory, NS_DEVICE_CONTEXT_SPEC_FACTORY_CID);
static NS_DEFINE_IID(kCBlender, NS_BLENDER_CID);
static NS_DEFINE_IID(kCScreenManager, NS_SCREENMANAGER_CID);
static NS_DEFINE_IID(kCPrintOptions, NS_PRINTOPTIONS_CID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
class nsGfxFactoryMac : public nsIFactory {
public:
// nsISupports methods
NS_DECL_ISUPPORTS
// nsIFactory methods
NS_IMETHOD CreateInstance(nsISupports *aOuter,
const nsIID &aIID,
void **aResult);
NS_IMETHOD LockFactory(PRBool aLock);
nsGfxFactoryMac(const nsCID &aClass);
~nsGfxFactoryMac();
private:
nsCID mClassID;
};
nsGfxFactoryMac::nsGfxFactoryMac(const nsCID &aClass)
{
NS_INIT_ISUPPORTS();
mClassID = aClass;
}
nsGfxFactoryMac::~nsGfxFactoryMac()
{
}
NS_IMPL_ISUPPORTS1(nsGfxFactoryMac, nsIFactory)
nsresult nsGfxFactoryMac::CreateInstance(nsISupports *aOuter,
const nsIID &aIID,
void **aResult)
{
if (aResult == NULL) {
return NS_ERROR_NULL_POINTER;
}
*aResult = NULL;
nsCOMPtr<nsISupports> inst;
if (mClassID.Equals(kCFontMetrics)) {
NS_NEWXPCOM(inst, nsFontMetricsMac);
}
else if (mClassID.Equals(kCDeviceContext)) {
NS_NEWXPCOM(inst, nsDeviceContextMac);
}
else if (mClassID.Equals(kCRenderingContext)) {
NS_NEWXPCOM(inst, nsRenderingContextMac);
}
else if (mClassID.Equals(kCImage)) {
inst = NS_STATIC_CAST(nsIImage*, new nsImageMac());
}
else if (mClassID.Equals(kCRegion)) {
NS_NEWXPCOM(inst, nsRegionMac);
}
else if (mClassID.Equals(kCBlender)) {
NS_NEWXPCOM(inst, nsBlender);
}
else if (mClassID.Equals(kCScriptableRegion)) {
nsCOMPtr<nsIRegion> rgn;
NS_NEWXPCOM(rgn, nsRegionMac);
if (rgn != nsnull) {
nsCOMPtr<nsIScriptableRegion> scriptableRgn = new nsScriptableRegion(rgn);
inst = scriptableRgn;
}
}
else if (mClassID.Equals(kCDeviceContextSpec)) {
nsCOMPtr<nsIDeviceContextSpec> dcSpec;
#if TARGET_CARBON
NS_NEWXPCOM(dcSpec, nsDeviceContextSpecX);
#else
NS_NEWXPCOM(dcSpec, nsDeviceContextSpecMac);
#endif
inst = dcSpec;
}
else if (mClassID.Equals(kCPrintOptions)) {
#if TARGET_CARBON
NS_NEWXPCOM(inst, nsPrintOptionsX);
#else
NS_NEWXPCOM(inst, nsPrintOptionsMac);
#endif
}
else if (mClassID.Equals(kCDeviceContextSpecFactory)) {
NS_NEWXPCOM(inst, nsDeviceContextSpecFactoryMac);
}
else if (mClassID.Equals(kCFontEnumerator)) {
nsFontEnumeratorMac* fe;
NS_NEWXPCOM(fe, nsFontEnumeratorMac);
inst = (nsISupports *)fe;
}
else if (mClassID.Equals(kCFontList)) {
nsFontList* fl;
NS_NEWXPCOM(fl, nsFontList);
inst = (nsISupports *)fl;
}
else if (mClassID.Equals(kCScreenManager)) {
NS_NEWXPCOM(inst, nsScreenManagerMac);
}
if (inst == NULL) {
return NS_ERROR_OUT_OF_MEMORY;
}
return inst->QueryInterface(aIID, aResult);
}
nsresult nsGfxFactoryMac::LockFactory(PRBool aLock)
{
// Not implemented in simplest case.
return NS_OK;
}
// return the proper factory to the caller
extern "C" NS_GFX nsresult NSGetFactory(nsISupports* servMgr,
const nsCID &aClass,
const char *aClassName,
const char *aContractID,
nsIFactory **aFactory)
{
if (nsnull == aFactory) {
return NS_ERROR_NULL_POINTER;
}
nsCOMPtr<nsIFactory> factory = new nsGfxFactoryMac(aClass);
if (nsnull == factory) {
return NS_ERROR_OUT_OF_MEMORY;
}
return factory->QueryInterface(kIFactoryIID, (void**)aFactory);
}
#endif

Просмотреть файл

@ -41,6 +41,7 @@
#include "nsRegionMac.h"
#include "nsIFontMetrics.h"
#include "nsCarbonHelpers.h"
#include "nsRegionPool.h"
nsGraphicStatePool sGraphicStatePool;

Просмотреть файл

@ -104,6 +104,7 @@ nsPrintOptionsMac::ShowNativeDialog(void)
NS_ASSERTION(::PrError() == noErr, "Printing error");
nsWatchTask::GetTask().Suspend();
::InitCursor();
Boolean dialogOK = ::PrStlDialog(mPrintRecord); // open up and process the style record
nsWatchTask::GetTask().Resume();

Просмотреть файл

@ -98,6 +98,8 @@ nsPrintOptionsX::ShowNativeDialog(void)
Boolean validated;
::PMValidatePageFormat(mPageFormat, &validated);
::InitCursor();
Boolean accepted = false;
status = ::PMPageSetupDialog(mPageFormat, &accepted);

Просмотреть файл

@ -40,91 +40,7 @@
#include "prmem.h"
#include "nsCarbonHelpers.h"
NS_EXPORT nsNativeRegionPool sNativeRegionPool;
//------------------------------------------------------------------------
nsNativeRegionPool::nsNativeRegionPool()
{
mRegionSlots = nsnull;
mEmptySlots = nsnull;
}
//------------------------------------------------------------------------
nsNativeRegionPool::~nsNativeRegionPool()
{
// Release all of the regions.
if (mRegionSlots != nsnull) {
nsRegionSlot* slot = mRegionSlots;
while (slot != nsnull) {
::DisposeRgn(slot->mRegion);
nsRegionSlot* next = slot->mNext;
delete slot;
slot = next;
}
}
// Release all empty slots.
if (mEmptySlots != nsnull) {
nsRegionSlot* slot = mEmptySlots;
while (slot != nsnull) {
nsRegionSlot* next = slot->mNext;
delete slot;
slot = next;
}
}
}
//------------------------------------------------------------------------
RgnHandle nsNativeRegionPool::GetNewRegion()
{
nsRegionSlot* slot = mRegionSlots;
if (slot != nsnull) {
RgnHandle region = slot->mRegion;
// remove this slot from the free list.
mRegionSlots = slot->mNext;
// transfer this slot to the empty slot list for reuse.
slot->mRegion = nsnull;
slot->mNext = mEmptySlots;
mEmptySlots = slot;
// initialize the region.
::SetEmptyRgn(region);
return region;
}
// return a fresh new region. a slot will be created to hold it
// if and when the region is released.
return (::NewRgn());
}
//------------------------------------------------------------------------
void nsNativeRegionPool::ReleaseRegion(RgnHandle aRgnHandle)
{
nsRegionSlot* slot = mEmptySlots;
if (slot != nsnull)
mEmptySlots = slot->mNext;
else
slot = new nsRegionSlot;
if (slot != nsnull) {
// put this region on the region list.
slot->mRegion = aRgnHandle;
slot->mNext = mRegionSlots;
mRegionSlots = slot;
} else {
// couldn't allocate a slot, toss the region.
::DisposeRgn(aRgnHandle);
}
}
#pragma mark -
#include "nsRegionPool.h"
//---------------------------------------------------------------------

Просмотреть файл

@ -40,58 +40,7 @@
#define nsRegionMac_h___
#include "nsIRegion.h"
#include <quickdraw.h>
//------------------------------------------------------------------------
class NS_EXPORT nsNativeRegionPool
{
public:
nsNativeRegionPool();
~nsNativeRegionPool();
RgnHandle GetNewRegion();
void ReleaseRegion(RgnHandle aRgnHandle);
private:
struct nsRegionSlot {
RgnHandle mRegion;
nsRegionSlot* mNext;
};
nsRegionSlot* mRegionSlots;
nsRegionSlot* mEmptySlots;
};
//------------------------------------------------------------------------
extern nsNativeRegionPool sNativeRegionPool;
//------------------------------------------------------------------------
class StRegionFromPool
{
public:
StRegionFromPool()
{
mRegionH = sNativeRegionPool.GetNewRegion();
}
~StRegionFromPool()
{
if ( mRegionH )
sNativeRegionPool.ReleaseRegion(mRegionH);
}
operator RgnHandle() const
{
return mRegionH;
}
private:
RgnHandle mRegionH;
};
#include <QuickDraw.h>
//------------------------------------------------------------------------

Просмотреть файл

@ -0,0 +1,124 @@
/* -*- 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 ***** */
#include "nsRegionPool.h"
NS_EXPORT nsNativeRegionPool sNativeRegionPool;
//------------------------------------------------------------------------
nsNativeRegionPool::nsNativeRegionPool()
{
mRegionSlots = nsnull;
mEmptySlots = nsnull;
}
//------------------------------------------------------------------------
nsNativeRegionPool::~nsNativeRegionPool()
{
// Release all of the regions.
if (mRegionSlots != nsnull) {
nsRegionSlot* slot = mRegionSlots;
while (slot != nsnull) {
::DisposeRgn(slot->mRegion);
nsRegionSlot* next = slot->mNext;
delete slot;
slot = next;
}
}
// Release all empty slots.
if (mEmptySlots != nsnull) {
nsRegionSlot* slot = mEmptySlots;
while (slot != nsnull) {
nsRegionSlot* next = slot->mNext;
delete slot;
slot = next;
}
}
}
//------------------------------------------------------------------------
RgnHandle nsNativeRegionPool::GetNewRegion()
{
nsRegionSlot* slot = mRegionSlots;
if (slot != nsnull) {
RgnHandle region = slot->mRegion;
// remove this slot from the free list.
mRegionSlots = slot->mNext;
// transfer this slot to the empty slot list for reuse.
slot->mRegion = nsnull;
slot->mNext = mEmptySlots;
mEmptySlots = slot;
// initialize the region.
::SetEmptyRgn(region);
return region;
}
// return a fresh new region. a slot will be created to hold it
// if and when the region is released.
return (::NewRgn());
}
//------------------------------------------------------------------------
void nsNativeRegionPool::ReleaseRegion(RgnHandle aRgnHandle)
{
nsRegionSlot* slot = mEmptySlots;
if (slot != nsnull)
mEmptySlots = slot->mNext;
else
slot = new nsRegionSlot;
if (slot != nsnull) {
// put this region on the region list.
slot->mRegion = aRgnHandle;
slot->mNext = mRegionSlots;
mRegionSlots = slot;
} else {
// couldn't allocate a slot, toss the region.
::DisposeRgn(aRgnHandle);
}
}

Просмотреть файл

@ -0,0 +1,96 @@
/* -*- 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 nsRegionPool_h___
#define nsRegionPool_h___
#include "nscore.h"
#include <QuickDraw.h>
class NS_EXPORT nsNativeRegionPool
{
public:
nsNativeRegionPool();
~nsNativeRegionPool();
RgnHandle GetNewRegion();
void ReleaseRegion(RgnHandle aRgnHandle);
private:
struct nsRegionSlot {
RgnHandle mRegion;
nsRegionSlot* mNext;
};
nsRegionSlot* mRegionSlots;
nsRegionSlot* mEmptySlots;
};
//------------------------------------------------------------------------
extern nsNativeRegionPool sNativeRegionPool;
//------------------------------------------------------------------------
class StRegionFromPool
{
public:
StRegionFromPool()
{
mRegionH = sNativeRegionPool.GetNewRegion();
}
~StRegionFromPool()
{
if ( mRegionH )
sNativeRegionPool.ReleaseRegion(mRegionH);
}
operator RgnHandle() const
{
return mRegionH;
}
private:
RgnHandle mRegionH;
};
#endif // nsRegionPool_h___

Просмотреть файл

@ -58,10 +58,14 @@
#include <FixMath.h>
#include <Gestalt.h>
#include <Quickdraw.h>
#include <QuickDraw.h>
#include "nsRegionPool.h"
#include "nsFontUtils.h"
#include "nsCarbonHelpers.h"
#define STACK_TREASHOLD 1000
#define STACK_THRESHOLD 1000
//------------------------------------------------------------------------
@ -272,7 +276,7 @@ NS_IMETHODIMP nsRenderingContextMac::SetPortTextState()
return NS_ERROR_NULL_POINTER;
TextStyle theStyle;
nsFontMetricsMac::GetNativeTextStyle(*mGS->mFontMetrics, *mContext, theStyle);
nsFontUtils::GetNativeTextStyle(*mGS->mFontMetrics, *mContext, theStyle);
::TextFont(theStyle.tsFont);
::TextSize(theStyle.tsSize);
@ -1336,8 +1340,8 @@ NS_IMETHODIMP nsRenderingContextMac::DrawString(const char *aString, PRUint32 aL
::DrawText(aString,0,aLength);
else
{
int buffer[STACK_TREASHOLD];
int* spacing = (aLength <= STACK_TREASHOLD ? buffer : new int[aLength]);
int buffer[STACK_THRESHOLD];
int* spacing = (aLength <= STACK_THRESHOLD ? buffer : new int[aLength]);
if (spacing)
{
mGS->mTMatrix.ScaleXCoords(aSpacing, aLength, spacing);

Двоичные данные
webshell/tests/viewer/mac/viewer.mcp

Двоичный файл не отображается.

Просмотреть файл

@ -1,13 +1,11 @@
//
// Widget.Prefix
//
// Global prefix file for the Widget project.
//
#include "MacPrefix.h"
#include <Quickdraw.h>
#include <Events.h>
#include <MacWindows.h>
#define USE_TLS_FOR_TOOLKIT 1
#if !TARGET_CARBON
#define USE_MENUSELECT 1
#endif

Просмотреть файл

@ -20,11 +20,10 @@
* Contributor(s):
*/
#define MAC_SHARED 1
#define _IMPL_NS_WIDGET 1
#include "Widget.prefix"
#include "WidgetComponentConfig.h"
#include "MacPrefix_debug.h"
#if !TARGET_CARBON
#define USE_MENUSELECT 1
#endif

Просмотреть файл

@ -20,6 +20,6 @@
* Contributor(s):
*/
#define MAC_STATIC 1
#include "WidgetComponentConfig.h"
#include "MacPrefix.h"
#include "WidgetDebug.prefix"

Просмотреть файл

@ -1,25 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* 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):
*/
#define MAC_STATIC 1
#include "Widget.prefix"

Двоичные данные
widget/macbuild/WidgetSupport.mcp Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1,8 @@
//
// Widget.Prefix
//
// Global prefix file for the Widget project.
//
#include "WidgetSupportConfig.h"
#include "MacPrefix.h"

Просмотреть файл

@ -0,0 +1,3 @@
#define _IMPL_NS_WIDGET 1

Просмотреть файл

@ -4,10 +4,5 @@
// Global prefix file for the debug Widget project.
//
#include "WidgetSupportConfig.h"
#include "MacPrefix_debug.h"
#include <Quickdraw.h>
#include <Events.h>
#include <MacWindows.h>
#define USE_TLS_FOR_TOOLKIT 1

Двоичные данные
widget/macbuild/widget.mcp

Двоичный файл не отображается.

Просмотреть файл

@ -38,6 +38,7 @@
#include "nsChildWindow.h"
#include "nsCOMPtr.h"
#include "nsRegionMac.h"
#include "nsRegionPool.h"
//-------------------------------------------------------------------------
//

Просмотреть файл

@ -38,6 +38,7 @@
#include "nsIFontMetrics.h"
#include "nsIDeviceContext.h"
#include "nsFont.h"
#include "nsFontUtils.h"
#include "nsToolkit.h"
#include "nsMacControl.h"
@ -382,7 +383,7 @@ void nsMacControl::SetupMacControlFont()
TextStyle theStyle;
#if !TARGET_CARBON
nsFontMetricsMac::GetNativeTextStyle(*mFontMetrics, *mContext, theStyle);
nsFontUtils::GetNativeTextStyle(*mFontMetrics, *mContext, theStyle);
#endif
// if needed, impose a min size of 9pt on the control font
if (theStyle.tsSize < 9)
@ -510,7 +511,7 @@ void nsMacControl::NSStringSetControlTitle(ControlHandle theControl, nsString ti
// determine the script of the font that the control is supposed to be drawn in
//
#if !TARGET_CARBON
nsFontMetricsMac::GetNativeTextStyle(*mFontMetrics, *mContext, theStyle);
nsFontUtils::GetNativeTextStyle(*mFontMetrics, *mContext, theStyle);
#endif
fontScript = ::FontToScript(theStyle.tsFont);
@ -592,7 +593,7 @@ void nsMacControl::SetupMacControlFontForScript(short theScript)
NS_PRECONDITION(mFontMetrics != nsnull, "No font metrics in SetupMacControlFont");
NS_PRECONDITION(mContext != nsnull, "No context metrics in SetupMacControlFont");
#if !TARGET_CARBON
nsFontMetricsMac::GetNativeTextStyle(*mFontMetrics, *mContext, theStyle);
nsFontUtils::GetNativeTextStyle(*mFontMetrics, *mContext, theStyle);
#endif
//

Просмотреть файл

@ -46,7 +46,7 @@
// Return PR_TRUE if the event was handled
//
//-------------------------------------------------------------------------
NS_EXPORT PRBool nsMacMessageSink::DispatchOSEvent(
PRBool nsMacMessageSink::DispatchOSEvent(
EventRecord &anEvent,
WindowPtr aWindow)
{
@ -70,7 +70,7 @@ NS_EXPORT PRBool nsMacMessageSink::DispatchOSEvent(
// DispatchMenuCommand
//
//-------------------------------------------------------------------------
NS_EXPORT PRBool nsMacMessageSink::DispatchMenuCommand(
PRBool nsMacMessageSink::DispatchMenuCommand(
EventRecord &anEvent,
long menuResult,
WindowPtr aWindow)
@ -96,7 +96,7 @@ NS_EXPORT PRBool nsMacMessageSink::DispatchMenuCommand(
// GetNSWindowFromWindow
//
//-------------------------------------------------------------------------
NS_EXPORT nsMacWindow *nsMacMessageSink::GetNSWindowFromMacWindow(WindowPtr inWindow)
nsMacWindow *nsMacMessageSink::GetNSWindowFromMacWindow(WindowPtr inWindow)
{
if (!inWindow) return nsnull;
@ -122,7 +122,7 @@ NS_EXPORT nsMacWindow *nsMacMessageSink::GetNSWindowFromMacWindow(WindowPtr inWi
// IsRaptorWindow
//
//-------------------------------------------------------------------------
NS_EXPORT PRBool nsMacMessageSink::IsRaptorWindow(WindowPtr inWindow)
PRBool nsMacMessageSink::IsRaptorWindow(WindowPtr inWindow)
{
if (!inWindow) return PR_FALSE;
return (GetRaptorWindowList()[inWindow] != nsnull);

Просмотреть файл

@ -39,6 +39,7 @@
#define nsMacMessageSink_h__
#include "prtypes.h"
#include "nscore.h"
#include <map>
@ -66,7 +67,7 @@ to a nsMacWindow *.
================================================*/
// Macintosh Message Sink Class
class nsMacMessageSink
class NS_WIDGET nsMacMessageSink
{
private:

Просмотреть файл

@ -120,4 +120,19 @@ private:
static ControlActionUPP sControlActionProc; // we only need one of these
};
class nsHorizScrollbar : public nsScrollbar
{
public:
nsHorizScrollbar() : nsScrollbar(PR_FALSE) {}
};
class nsVertScrollbar : public nsScrollbar
{
public:
nsVertScrollbar() : nsScrollbar(PR_TRUE) {}
};
#endif // nsScrollbar_

Просмотреть файл

@ -88,8 +88,6 @@
#include "nsBidiKeyboard.h"
#endif
#ifdef XP_MACOSX
#include "nsIGenericFactory.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsTimerImpl)
@ -97,7 +95,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacWindow)
NS_GENERIC_FACTORY_CONSTRUCTOR(ChildWindow)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsButton)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFilePicker)
//NS_GENERIC_FACTORY_CONSTRUCTOR(nsFileWidget)
#if USE_NATIVE_VERSION
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCheckButton)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsComboBox)
@ -105,7 +102,9 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsRadioButton)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsListBox)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsTextAreaWidget)
#endif
NS_GENERIC_FACTORY_CONSTRUCTOR(nsTextWidget)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHorizScrollbar)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsVertScrollbar)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsTextWidget) // used by Viewer?
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAppShell)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsToolkit)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsLookAndFeel)
@ -114,32 +113,15 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsMenuBar)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMenu)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMenuItem)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSound)
//NS_GENERIC_FACTORY_CONSTRUCTOR(nsFileSpecWithUIImpl)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboard)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardHelper)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragService)
#ifdef IBMBIDI
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBidiKeyboard)
#endif
#define NS_GENERIC_SCROLLBAR_CONSTRUCTOR(type, isVertical) \
static NS_IMETHODIMP \
type ## ScrollbarConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult) \
{ \
if (aOuter) return NS_ERROR_NO_AGGREGATION; \
if (!aResult) return NS_ERROR_NULL_POINTER; \
*aResult = NULL; \
nsCOMPtr<nsIScrollbar> scrollbar = new nsScrollbar(isVertical); \
if (!scrollbar) return NS_ERROR_OUT_OF_MEMORY; \
return scrollbar->QueryInterface(aIID, aResult); \
}
NS_GENERIC_SCROLLBAR_CONSTRUCTOR(Vertical, PR_TRUE)
NS_GENERIC_SCROLLBAR_CONSTRUCTOR(Horizontal, PR_FALSE)
static nsModuleComponentInfo components[] =
{
{ "Timer",
@ -156,7 +138,7 @@ static nsModuleComponentInfo components[] =
nsMacWindowConstructor },
{ "Child nsWindow",
NS_CHILD_CID,
"@mozilla.org/widgets/childwindow/mac;1",
"@mozilla.org/widgets/child_window/mac;1",
ChildWindowConstructor },
{ "Button",
NS_BUTTON_CID,
@ -169,14 +151,14 @@ static nsModuleComponentInfo components[] =
{ "Horiz Scrollbar",
NS_HORZSCROLLBAR_CID,
"@mozilla.org/widgets/horizscroll/mac;1",
HorizontalScrollbarConstructor },
nsHorizScrollbarConstructor },
{ "Vert Scrollbar",
NS_VERTSCROLLBAR_CID,
"@mozilla.org/widgets/vertscroll/mac;1",
VerticalScrollbarConstructor },
nsVertScrollbarConstructor },
{ "Text Field",
NS_TEXTFIELD_CID,
"@mozilla.org/widgets/textfield/mac;1",
"@mozilla.org/widgets/textwidget/mac;1",
nsTextWidgetConstructor },
{ "AppShell",
NS_APPSHELL_CID,
@ -231,7 +213,7 @@ static nsModuleComponentInfo components[] =
"@mozilla.org/widget/dragservice;1",
nsDragServiceConstructor },
#ifdef IBMBIDI
{ "Gtk Bidi Keyboard",
{ "Gtk Bidi Keyboard",
NS_BIDIKEYBOARD_CID,
"@mozilla.org/widget/bidikeyboard;1",
nsBidiKeyboardConstructor },
@ -240,237 +222,3 @@ static nsModuleComponentInfo components[] =
NS_IMPL_NSGETMODULE(nsWidgetModule, components)
#else
// NOTE the following does not match MAC_STATIC actually used below in this file!
#define MACSTATIC
static NS_DEFINE_CID(kCWindow, NS_WINDOW_CID);
static NS_DEFINE_IID(kCTimer, NS_TIMER_CID);
static NS_DEFINE_CID(kCPopUp, NS_POPUP_CID);
static NS_DEFINE_CID(kCChild, NS_CHILD_CID);
static NS_DEFINE_CID(kCButton, NS_BUTTON_CID);
static NS_DEFINE_CID(kCCheckButton, NS_CHECKBUTTON_CID);
static NS_DEFINE_CID(kCFilePicker, NS_FILEPICKER_CID);
static NS_DEFINE_CID(kCHorzScrollbar, NS_HORZSCROLLBAR_CID);
static NS_DEFINE_CID(kCVertScrollbar, NS_VERTSCROLLBAR_CID);
static NS_DEFINE_CID(kCTextField, NS_TEXTFIELD_CID);
static NS_DEFINE_CID(kCAppShell, NS_APPSHELL_CID);
static NS_DEFINE_CID(kCToolkit, NS_TOOLKIT_CID);
static NS_DEFINE_CID(kCLookAndFeel, NS_LOOKANDFEEL_CID);
static NS_DEFINE_CID(kCLabel, NS_LABEL_CID);
static NS_DEFINE_CID(kCMenuBar, NS_MENUBAR_CID);
static NS_DEFINE_CID(kCMenu, NS_MENU_CID);
static NS_DEFINE_CID(kCMenuItem, NS_MENUITEM_CID);
static NS_DEFINE_CID(kCPopUpMenu, NS_POPUPMENU_CID);
// Drag and Drop/Clipboard
static NS_DEFINE_CID(kCDataFlavor, NS_DATAFLAVOR_CID);
static NS_DEFINE_CID(kCClipboard, NS_CLIPBOARD_CID);
static NS_DEFINE_CID(kCClipboardHelper, NS_CLIPBOARDHELPER_CID);
static NS_DEFINE_CID(kCTransferable, NS_TRANSFERABLE_CID);
static NS_DEFINE_CID(kCHTMLFormatConverter, NS_HTMLFORMATCONVERTER_CID);
static NS_DEFINE_CID(kCDragService, NS_DRAGSERVICE_CID);
// Sound services (just Beep for now)
static NS_DEFINE_CID(kCSound, NS_SOUND_CID);
#ifdef IBMBIDI
static NS_DEFINE_CID(kCBidiKeyboard, NS_BIDIKEYBOARD_CID);
#endif
//-------------------------------------------------------------------------
//
//-------------------------------------------------------------------------
class nsWidgetFactory : public nsIFactory
{
public:
NS_DECL_ISUPPORTS
// nsIFactory methods
NS_IMETHOD CreateInstance(nsISupports *aOuter,
const nsIID &aIID,
void **aResult);
NS_IMETHOD LockFactory(PRBool aLock);
nsWidgetFactory(const nsCID &aClass);
virtual ~nsWidgetFactory();
private:
nsCID mClassID;
};
//-------------------------------------------------------------------------
//
//-------------------------------------------------------------------------
nsWidgetFactory::nsWidgetFactory(const nsCID &aClass)
{
NS_INIT_REFCNT();
mClassID = aClass;
}
//-------------------------------------------------------------------------
//
//-------------------------------------------------------------------------
nsWidgetFactory::~nsWidgetFactory()
{
}
//-------------------------------------------------------------------------
//
//-------------------------------------------------------------------------
NS_IMPL_ISUPPORTS1(nsWidgetFactory, nsIFactory)
//-------------------------------------------------------------------------
//
// ***IMPORTANT***
// On all platforms, we are assuming in places that the implementation of |nsIWidget|
// is really |nsWindow| and then calling methods specific to nsWindow to finish the job.
// This is by design and the assumption is safe because an nsIWidget can only be created through
// our Widget factory where all our widgets, including the XP widgets, inherit from nsWindow.
// A similar warning is in nsWindow.cpp.
//-------------------------------------------------------------------------
nsresult nsWidgetFactory::CreateInstance(nsISupports *aOuter,
const nsIID &aIID,
void **aResult)
{
if (aResult == NULL) {
return NS_ERROR_NULL_POINTER;
}
*aResult = NULL;
if (nsnull != aOuter) {
return NS_ERROR_NO_AGGREGATION;
}
nsISupports *inst = nsnull;
if (mClassID.Equals(kCTimer)) {
inst = (nsISupports*)new nsTimerImpl();
}
else if (mClassID.Equals(kCWindow)) {
inst = (nsISupports*)(nsBaseWidget*)new nsMacWindow();
}
else if (mClassID.Equals(kCPopUp)) {
inst = (nsISupports*)(nsBaseWidget*)new nsMacWindow();
}
else if (mClassID.Equals(kCChild)) {
inst = (nsISupports*)(nsBaseWidget*)new ChildWindow();
}
else if (mClassID.Equals(kCButton)) {
inst = (nsISupports*)(nsBaseWidget*)(nsWindow*)new nsButton();
}
else if (mClassID.Equals(kCFilePicker)) {
inst = (nsISupports*)(nsBaseFilePicker*)new nsFilePicker();
}
#if USE_NATIVE_VERSION
else if (mClassID.Equals(kCCheckButton)) {
inst = (nsISupports*)(nsBaseWidget*)(nsWindow*)new nsCheckButton();
}
#endif
else if (mClassID.Equals(kCHorzScrollbar)) {
inst = (nsISupports*)(nsBaseWidget*)(nsWindow*)new nsScrollbar(PR_FALSE);
}
else if (mClassID.Equals(kCVertScrollbar)) {
inst = (nsISupports*)(nsBaseWidget*)(nsWindow*)new nsScrollbar(PR_TRUE);
}
else if (mClassID.Equals(kCTextField)) {
inst = (nsISupports*)(nsBaseWidget*)(nsWindow*)new nsTextWidget();
}
else if (mClassID.Equals(kCAppShell)) {
inst = (nsISupports*)new nsAppShell();
}
else if (mClassID.Equals(kCToolkit)) {
inst = (nsISupports*)new nsToolkit();
}
else if (mClassID.Equals(kCLookAndFeel)) {
inst = (nsISupports*)new nsLookAndFeel();
}
else if (mClassID.Equals(kCLabel)) {
inst = (nsISupports*)(nsBaseWidget*)(nsWindow*)new nsLabel();
}
else if (mClassID.Equals(kCMenuBar)) {
inst = (nsISupports*)(nsIMenuBar*) new nsMenuBar();
}
else if (mClassID.Equals(kCMenu)) {
inst = (nsISupports*)(nsIMenu*) new nsMenu();
}
else if (mClassID.Equals(kCMenuItem)) {
inst = (nsISupports*)(nsIMenuItem*) new nsMenuItem();
}
else if (mClassID.Equals(kCPopUpMenu)) {
// inst = (nsISupports*)new nsPopUpMenu();
NS_NOTYETIMPLEMENTED("nsPopUpMenu");
}
else if (mClassID.Equals(kCSound)) {
inst = (nsISupports*)(nsISound*) new nsSound();
}
else if (mClassID.Equals(kCTransferable))
inst = (nsISupports*)new nsTransferable();
else if (mClassID.Equals(kCHTMLFormatConverter))
inst = (nsISupports*)new nsHTMLFormatConverter();
else if (mClassID.Equals(kCClipboard))
inst = (nsISupports*)new nsClipboard();
else if (mClassID.Equals(kCClipboardHelper))
inst = (nsISupports*)new nsClipboardHelper();
else if (mClassID.Equals(kCDragService))
inst = (nsISupports*)NS_STATIC_CAST(nsIDragService*, new nsDragService());
#ifdef IBMBIDI
else if (mClassID.Equals(kCBidiKeyboard))
inst = (nsISupports*)(nsIBidiKeyboard*) new nsBidiKeyboard();
#endif // IBMBIDI
if (inst == NULL) {
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(inst);
nsresult res = inst->QueryInterface(aIID, aResult);
NS_RELEASE(inst);
return res;
}
//-------------------------------------------------------------------------
//
//-------------------------------------------------------------------------
nsresult nsWidgetFactory::LockFactory(PRBool aLock)
{
// Not implemented in simplest case.
return NS_OK;
}
//-------------------------------------------------------------------------
//
//-------------------------------------------------------------------------
// return the proper factory to the caller
#if defined(XP_MAC) && defined(MAC_STATIC)
extern "C" NS_WIDGET nsresult
NSGetFactory_WIDGET_DLL(nsISupports* serviceMgr,
const nsCID &aClass,
const char *aClassName,
const char *aContractID,
nsIFactory **aFactory)
#else
extern "C" NS_WIDGET nsresult
NSGetFactory(nsISupports* serviceMgr,
const nsCID &aClass,
const char *aClassName,
const char *aContractID,
nsIFactory **aFactory)
#endif
{
if (nsnull == aFactory) {
return NS_ERROR_NULL_POINTER;
}
*aFactory = new nsWidgetFactory(aClass);
if (nsnull == aFactory) {
return NS_ERROR_OUT_OF_MEMORY;
}
return (*aFactory)->QueryInterface(NS_GET_IID(nsIFactory), (void**)aFactory);
}
#endif

Просмотреть файл

@ -66,6 +66,7 @@
#include "nsCarbonHelpers.h"
#include "nsGfxUtils.h"
#include "nsRegionPool.h"
#if PINK_PROFILING
#include "profilerutils.h"

Двоичные данные
xpfe/bootstrap/macbuild/apprunner.mcp

Двоичный файл не отображается.