Finish support for building more than one toolkit at once.

This commit is contained in:
ramiro%netscape.com 1999-08-22 14:06:52 +00:00
Родитель 308bf10dca
Коммит 2e60bb6535
23 изменённых файлов: 472 добавлений и 11 удалений

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

@ -346,6 +346,11 @@ webshell/src/Makefile
webshell/tests/Makefile
webshell/tests/viewer/Makefile
webshell/tests/viewer/public/Makefile
webshell/tests/viewer/unix/Makefile
webshell/tests/viewer/unix/gtk/Makefile
webshell/tests/viewer/unix/motif/Makefile
webshell/tests/viewer/unix/qt/Makefile
webshell/tests/viewer/unix/xlib/Makefile
webshell/embed/Makefile
widget/Makefile
widget/public/Makefile

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

@ -1,3 +1,8 @@
Makefile
viewer
moc_nsQTMenu.cpp
viewer_gtk
viewer_xlib
viewer_qt
viewer_motif

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

@ -24,6 +24,10 @@ include $(DEPTH)/config/autoconf.mk
DIRS = public
ifeq (,$(filter beos os2 rhapsody photon,$(MOZ_WIDGET_TOOLKIT)))
DIRS += unix
endif
PROGRAM = viewer
RUN_VIEWER_SCRIPT = $(srcdir)/mozilla-viewer.sh
@ -75,11 +79,6 @@ EXPORT_RESOURCE_THROBBER := $(wildcard $(srcdir)/throbber/anim*.gif)
TOOLKIT_CPPSRCS_beos := nsBeOSMain.cpp
TOOLKIT_CPPSRCS_photon := nsPhMain.cpp nsPhMenu.cpp
TOOLKIT_CPPSRCS_gtk := nsGTKMain.cpp nsGTKMenu.cpp
TOOLKIT_CPPSRCS_motif := nsMotifMenu.cpp nsMotifMain.cpp
TOOLKIT_CPPSRCS_xlib := nsXlibMain.cpp
TOOLKIT_CPPSRCS_qt := nsQTMain.cpp nsQTMenu.cpp moc_nsQTMenu.cpp
ifeq ($(MOZ_WIDGET_TOOLKIT),beos)
BEOS_PROGRAM_RESOURCE = $(srcdir)/viewer-beos.rsrc
endif
@ -127,13 +126,22 @@ NETLIB_LIBS = \
$(NULL)
endif
LIBS = \
ifeq (,$(filter beos os2 rhapsody photon,$(MOZ_WIDGET_TOOLKIT)))
UNIX_VIEWER_TK_LIBS = -lviewer_$(MOZ_WIDGET_TOOLKIT)_s
endif
XP_LIBS = \
$(GECKO_LIBS) \
$(NETLIB_LIBS) \
$(IMGLIB_LIBS) \
$(BASE_LIBS) \
$(JSJ_LIB) \
$(NSPR_LIBS) \
$(NULL)
LIBS = \
$(UNIX_VIEWER_TK_LIBS) \
$(XP_LIBS) \
$(TK_LIBS) \
$(NULL)
@ -146,3 +154,68 @@ install:: $(PROGRAM) $(RUN_VIEWER_SCRIPT)
$(INSTALL) $(EXPORT_RESOURCE_THROBBER) $(DIST)/bin/res/throbber
$(INSTALL) $(srcdir)/resources/viewer.properties $(DIST)/bin/res
$(INSTALL) $(RUN_VIEWER_SCRIPT) $(DIST)/bin
##
## Dont try this at home
##
ifdef MOZ_ENABLE_GTK
GTK_LIBS = \
-lviewer_gtk_s \
$(XP_LIBS) \
$(MOZ_GTK_LDFLAGS) \
$(NULL)
$(PROGRAM)_gtk: $(PROGOBJS) $(EXTRA_DEPS) Makefile Makefile.in $(DIST)/lib/libviewer_gtk_s.a
$(CCC) -o $@ $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(GTK_LIBS) $(OS_LIBS)
install:: $(PROGRAM)_gtk
$(INSTALL) -m 555 $(PROGRAM)_gtk $(DIST)/bin
endif
ifdef MOZ_ENABLE_XLIB
XLIB_LIBS = \
-lviewer_xlib_s \
$(XP_LIBS) \
$(MOZ_XLIB_LDFLAGS) \
$(NULL)
$(PROGRAM)_xlib: $(PROGOBJS) $(EXTRA_DEPS) Makefile Makefile.in $(DIST)/lib/libviewer_xlib_s.a
$(CCC) -o $@ $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(XLIB_LIBS) $(OS_LIBS)
install:: $(PROGRAM)_xlib
$(INSTALL) -m 555 $(PROGRAM)_xlib $(DIST)/bin
endif
ifdef MOZ_ENABLE_QT
QT_LIBS = \
-lviewer_qt_s \
$(XP_LIBS) \
$(MOZ_QT_LDFLAGS) \
$(NULL)
$(PROGRAM)_qt: $(PROGOBJS) $(EXTRA_DEPS) Makefile Makefile.in $(DIST)/lib/libviewer_qt_s.a
$(CCC) -o $@ $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(QT_LIBS) $(OS_LIBS)
install:: $(PROGRAM)_qt
$(INSTALL) -m 555 $(PROGRAM)_qt $(DIST)/bin
endif
ifdef MOZ_ENABLE_MOTIF
MOTIF_LIBS = \
-lviewer_motif_s \
$(XP_LIBS) \
$(MOZ_MOTIF_LDFLAGS) \
$(NULL)
$(PROGRAM)_motif: $(PROGOBJS) $(EXTRA_DEPS) Makefile Makefile.in $(DIST)/lib/libviewer_motif_s.a
$(CCC) -o $@ $(PROGOBJS) $(LDFLAGS) $(LIBS_DIR) $(MOTIF_LIBS) $(OS_LIBS)
install:: $(PROGRAM)_motif
$(INSTALL) -m 555 $(PROGRAM)_motif $(DIST)/bin
endif

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

@ -0,0 +1 @@
Makefile

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

@ -0,0 +1,47 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
ifndef MOZ_MONOLITHIC_TOOLKIT
ifdef MOZ_ENABLE_GTK
DIRS += gtk
endif
ifdef MOZ_ENABLE_MOTIF
DIRS += motif
endif
ifdef MOZ_ENABLE_XLIB
DIRS += xlib
endif
ifdef MOZ_ENABLE_QT
DIRS += qt
endif
else
DIRS = $(MOZ_WIDGET_TOOLKIT)
endif # !MOZ_MONOLITHIC_TOOLKIT
include $(topsrcdir)/config/rules.mk

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

@ -0,0 +1 @@
Makefile

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

@ -0,0 +1,44 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH = ../../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = viewer_gtk_s
CPPSRCS = \
nsGtkMain.cpp \
nsGtkMenu.cpp \
$(NULL)
MKSHLIB =
override NO_SHARED_LIB=1
override NO_STATIC_LIB=
include $(topsrcdir)/config/rules.mk
INCLUDES += -I$(srcdir)/../..
ifndef MOZ_MONOLITHIC_TOOLKIT
CXXFLAGS += $(MOZ_GTK_CFLAGS)
else
CXXFLAGS += $(TK_CFLAGS)
endif

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

@ -20,11 +20,16 @@
#include "nsViewerApp.h"
#include "nsBrowserWindow.h"
#include "nsGTKMenu.h"
#include "nsGtkMenu.h"
#include "nsIImageManager.h"
#include <stdlib.h>
#include "plevent.h"
#include "nsIUnixToolkitService.h"
#include "nsIComponentManager.h"
static NS_DEFINE_CID(kCUnixToolkitServiceCID, NS_UNIX_TOOLKIT_SERVICE_CID);
static nsNativeViewerApp* gTheApp;
nsNativeViewerApp::nsNativeViewerApp()
@ -85,6 +90,38 @@ int main(int argc, char **argv)
NS_NewImageManager(&manager);
gTheApp = new nsNativeViewerApp();
//////////////////////////////////////////////////////////////////////
//
// Toolkit Service setup
//
// Note: This must happend before NS_SetupRegistry() is called so
// that the toolkit specific xpcom components can be registered
// as needed.
//
//////////////////////////////////////////////////////////////////////
nsIUnixToolkitService * unixToolkitService = nsnull;
nsresult rv =
nsComponentManager::CreateInstance(kCUnixToolkitServiceCID,
nsnull,
nsIUnixToolkitService::GetIID(),
(void **) &unixToolkitService);
NS_ASSERTION(NS_SUCCEEDED(rv),"Cannot obtain unix toolkit service.");
if (NS_SUCCEEDED(rv) && (nsnull != unixToolkitService))
{
// Force the toolkit into "gtk" mode
unixToolkitService->SetToolkitName("gtk");
NS_RELEASE(unixToolkitService);
}
//////////////////////////////////////////////////////////////////////
// End toolkit service setup
//////////////////////////////////////////////////////////////////////
gTheApp->Initialize(argc, argv);
gTheApp->Run();

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

@ -0,0 +1 @@
Makefile

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

@ -0,0 +1,44 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH = ../../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = viewer_motif_s
CPPSRCS = \
nsMotifMain.cpp \
nsMotifMenu.cpp \
$(NULL)
MKSHLIB =
override NO_SHARED_LIB=1
override NO_STATIC_LIB=
include $(topsrcdir)/config/rules.mk
INCLUDES += -I$(srcdir)/../..
ifndef MOZ_MONOLITHIC_TOOLKIT
CXXFLAGS += $(MOZ_MOTIF_CFLAGS)
else
CXXFLAGS += $(TK_CFLAGS)
endif

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

@ -21,6 +21,11 @@
#include "nsMotifMenu.h"
#include "nsIImageManager.h"
#include "nsIUnixToolkitService.h"
#include "nsIComponentManager.h"
static NS_DEFINE_CID(kCUnixToolkitServiceCID, NS_UNIX_TOOLKIT_SERVICE_CID);
static nsNativeViewerApp* gTheApp;
nsNativeViewerApp::nsNativeViewerApp()
@ -90,6 +95,38 @@ int main(int argc, char **argv)
NS_NewImageManager(&manager);
gTheApp = new nsNativeViewerApp();
//////////////////////////////////////////////////////////////////////
//
// Toolkit Service setup
//
// Note: This must happend before NS_SetupRegistry() is called so
// that the toolkit specific xpcom components can be registered
// as needed.
//
//////////////////////////////////////////////////////////////////////
nsIUnixToolkitService * unixToolkitService = nsnull;
nsresult rv =
nsComponentManager::CreateInstance(kCUnixToolkitServiceCID,
nsnull,
nsIUnixToolkitService::GetIID(),
(void **) &unixToolkitService);
NS_ASSERTION(NS_SUCCEEDED(rv),"Cannot obtain unix toolkit service.");
if (NS_SUCCEEDED(rv) && (nsnull != unixToolkitService))
{
// Force the toolkit into "motif" mode regardless of MOZ_TOOLKIT
unixToolkitService->SetToolkitName("motif");
NS_RELEASE(unixToolkitService);
}
//////////////////////////////////////////////////////////////////////
// End toolkit service setup
//////////////////////////////////////////////////////////////////////
gTheApp->Initialize(argc, argv);
gTheApp->Run();

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

@ -0,0 +1,2 @@
Makefile
moc_nsQtMenu.cpp

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

@ -0,0 +1,46 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH = ../../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = viewer_qt_s
CPPSRCS = \
nsQtMain.cpp \
nsQtMenu.cpp \
moc_nsQtMenu.cpp \
$(NULL)
MKSHLIB =
override NO_SHARED_LIB=1
override NO_STATIC_LIB=
include $(topsrcdir)/config/rules.mk
INCLUDES += -I$(srcdir)/../..
ifndef MOZ_MONOLITHIC_TOOLKIT
CXXFLAGS += $(MOZ_QT_CFLAGS)
else
CXXFLAGS += $(TK_CFLAGS)
endif

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

@ -21,10 +21,15 @@
#include "nsViewerApp.h"
#include "nsBrowserWindow.h"
#include "nsIImageManager.h"
#include "nsQTMenu.h"
#include "nsQtMenu.h"
#include <stdlib.h>
#include "plevent.h"
#include "nsIUnixToolkitService.h"
#include "nsIComponentManager.h"
static NS_DEFINE_CID(kCUnixToolkitServiceCID, NS_UNIX_TOOLKIT_SERVICE_CID);
static nsNativeViewerApp* gTheApp;
nsNativeViewerApp::nsNativeViewerApp()
@ -92,6 +97,38 @@ int main(int argc, char **argv)
NS_NewImageManager(&manager);
gTheApp = new nsNativeViewerApp();
//////////////////////////////////////////////////////////////////////
//
// Toolkit Service setup
//
// Note: This must happend before NS_SetupRegistry() is called so
// that the toolkit specific xpcom components can be registered
// as needed.
//
//////////////////////////////////////////////////////////////////////
nsIUnixToolkitService * unixToolkitService = nsnull;
nsresult rv =
nsComponentManager::CreateInstance(kCUnixToolkitServiceCID,
nsnull,
nsIUnixToolkitService::GetIID(),
(void **) &unixToolkitService);
NS_ASSERTION(NS_SUCCEEDED(rv),"Cannot obtain unix toolkit service.");
if (NS_SUCCEEDED(rv) && (nsnull != unixToolkitService))
{
// Force the toolkit into "qt" mode regardless of MOZ_TOOLKIT
unixToolkitService->SetToolkitName("qt");
NS_RELEASE(unixToolkitService);
}
//////////////////////////////////////////////////////////////////////
// End toolkit service setup
//////////////////////////////////////////////////////////////////////
gTheApp->Initialize(argc, argv);
gTheApp->Run();

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

@ -20,7 +20,7 @@
#include <qwidget.h>
#include "nsBrowserWindow.h"
#include "nsQTMenu.h"
#include "nsQtMenu.h"
#include "resources.h"
#include "nscore.h"

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

@ -0,0 +1 @@
Makefile

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

@ -0,0 +1,43 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH = ../../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = viewer_xlib_s
CPPSRCS = \
nsXlibMain.cpp \
$(NULL)
MKSHLIB =
override NO_SHARED_LIB=1
override NO_STATIC_LIB=
include $(topsrcdir)/config/rules.mk
INCLUDES += -I$(srcdir)/../..
ifndef MOZ_MONOLITHIC_TOOLKIT
CXXFLAGS += $(MOZ_XLIB_CFLAGS)
else
CXXFLAGS += $(TK_CFLAGS)
endif

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

@ -19,6 +19,11 @@
#include "nsBrowserWindow.h"
#include "nsViewerApp.h"
#include "nsIUnixToolkitService.h"
#include "nsIComponentManager.h"
static NS_DEFINE_CID(kCUnixToolkitServiceCID, NS_UNIX_TOOLKIT_SERVICE_CID);
nsNativeViewerApp::nsNativeViewerApp()
{
}
@ -27,7 +32,7 @@ nsNativeViewerApp::~nsNativeViewerApp()
{
}
int
nsNativeViewerApp::Run()
{
OpenWindow();
@ -65,6 +70,38 @@ int main (int argc, char **argv)
{
nsViewerApp *app = new nsNativeViewerApp();
NS_ADDREF(app);
//////////////////////////////////////////////////////////////////////
//
// Toolkit Service setup
//
// Note: This must happend before NS_SetupRegistry() is called so
// that the toolkit specific xpcom components can be registered
// as needed.
//
//////////////////////////////////////////////////////////////////////
nsIUnixToolkitService * unixToolkitService = nsnull;
nsresult rv =
nsComponentManager::CreateInstance(kCUnixToolkitServiceCID,
nsnull,
nsIUnixToolkitService::GetIID(),
(void **) &unixToolkitService);
NS_ASSERTION(NS_SUCCEEDED(rv),"Cannot obtain unix toolkit service.");
if (NS_SUCCEEDED(rv) && (nsnull != unixToolkitService))
{
// Force the toolkit into "xlib" mode
unixToolkitService->SetToolkitName("xlib");
NS_RELEASE(unixToolkitService);
}
//////////////////////////////////////////////////////////////////////
// End toolkit service setup
//////////////////////////////////////////////////////////////////////
app->Initialize(argc, argv);
app->Run();
NS_RELEASE(app);