Added NetService to SetupRegistry & made some other changes

This commit is contained in:
rods%netscape.com 1998-09-29 01:34:50 +00:00
Родитель 39d90cccaa
Коммит 03a0b96635
3 изменённых файлов: 66 добавлений и 44 удалений

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

@ -3329,14 +3329,14 @@ void CreateBrowserMenus(nsIMenuBar * aMenuBar)
nsIMenu * commMenu = CreateMenu(aMenuBar, "Communicator", 'C');
nsIMenu * helpMenu = CreateMenu(aMenuBar, "Help", 'H');
/*nsIMenu * debugMenu = CreateMenu(aMenuBar, "Debug", 'D');
nsIMenu * debugMenu = CreateMenu(aMenuBar, "Debug", 'D');
i = 0;
while (debugMenus[i].title != nsnull) {
CreateMenuItem(debugMenu, debugMenus[i].title, debugMenus[i].command);
i++;
}
nsIMenu * toolsMenu = CreateMenu(aMenuBar, "Tools", 'T');
/*nsIMenu * toolsMenu = CreateMenu(aMenuBar, "Tools", 'T');
CreateMenuItem(toolsMenu, "Java Script Console", JS_CONSOLE);
CreateMenuItem(toolsMenu, "Editor Mode", EDITOR_MODE);*/
@ -3347,13 +3347,7 @@ void CreateBrowserMenus(nsIMenuBar * aMenuBar)
nsresult
nsBrowserWindow::CreateMenuBar(PRInt32 aWidth)
{
/*HMENU menu = ::LoadMenu(gInstance, "Viewer");
HWND hwnd = (HWND)mWindow->GetNativeData(NS_NATIVE_WIDGET);
::SetMenu(hwnd, menu);
*/
/* nsIMenuBar * menuBar;
nsIMenuBar * menuBar;
nsresult rv = nsRepository::CreateInstance(kMenuBarCID,
nsnull,
kIMenuBarIID,
@ -3366,15 +3360,12 @@ nsBrowserWindow::CreateMenuBar(PRInt32 aWidth)
widget->Create((nsIWidget *)nsnull, rect, nsnull, nsnull, mAppShell, nsnull, nsnull);
CreateBrowserMenus(menuBar);
HMENU menu = (HMENU)widget->GetNativeData(NS_NATIVE_WIDGET);
HWND hwnd = (HWND)mWindow->GetNativeData(NS_NATIVE_WIDGET);
::SetMenu(hwnd, menu);
mWindow->SetMenuBar(menuBar);
NS_RELEASE(widget);
}
}
*/
return NS_OK;
}

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

@ -37,6 +37,8 @@
#include "nsParserCIID.h"
#include "nsDOMCID.h"
#include "nsLayoutCID.h"
#include "nsINetService.h"
#ifdef XP_PC
#define WIDGET_DLL "raptorwidget.dll"
@ -47,6 +49,8 @@
#define PREF_DLL "xppref32.dll"
#define PARSER_DLL "raptorhtmlpars.dll"
#define DOM_DLL "jsdom.dll"
#define LAYOUT_DLL "raptorhtml.dll"
#define NETLIB_DLL "netlib.dll"
#else
#ifdef XP_MAC
#include "nsMacRepository.h"
@ -59,18 +63,18 @@
#define PREF_DLL "libpref.so"
#define PARSER_DLL "libraptorhtmlpars.so"
#define DOM_DLL "libjsdom.so"
#define LAYOUT_DLL "libraptorhtml.so"
#define NETLIB_DLL "netlib.so"
#endif
#endif
// Class ID's
static NS_DEFINE_IID(kCFileWidgetCID, NS_FILEWIDGET_CID);
static NS_DEFINE_IID(kCWindowCID, NS_WINDOW_CID);
static NS_DEFINE_IID(kCMenuBarCID, NS_MENUBAR_CID);
static NS_DEFINE_IID(kCMenuCID, NS_MENU_CID);
static NS_DEFINE_IID(kCMenuItemCID, NS_MENUITEM_CID);
static NS_DEFINE_IID(kCDialogCID, NS_DIALOG_CID);
static NS_DEFINE_IID(kCLabelCID, NS_LABEL_CID);
static NS_DEFINE_IID(kCAppShellCID, NS_APPSHELL_CID);
static NS_DEFINE_IID(kCToolkitCID, NS_TOOLKIT_CID);
static NS_DEFINE_IID(kCWindowIID, NS_WINDOW_CID);
static NS_DEFINE_IID(kCScrollbarIID, NS_VERTSCROLLBAR_CID);
static NS_DEFINE_IID(kCHScrollbarIID, NS_HORZSCROLLBAR_CID);
@ -97,6 +101,11 @@ static NS_DEFINE_IID(kCPluginHostCID, NS_PLUGIN_HOST_CID);
static NS_DEFINE_IID(kCParserCID, NS_PARSER_IID);
static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
static NS_DEFINE_IID(kCDOMScriptObjectFactory, NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
static NS_DEFINE_IID(kCDOMNativeObjectRegistry, NS_DOM_NATIVE_OBJECT_REGISTRY_CID);
static NS_DEFINE_IID(kCHTMLDocument, NS_HTMLDOCUMENT_CID);
static NS_DEFINE_IID(kCImageDocument, NS_IMAGEDOCUMENT_CID);
static NS_DEFINE_IID(kCHTMLImageElementFactory, NS_HTMLIMAGEELEMENTFACTORY_CID);
static NS_DEFINE_IID(kNetServiceCID, NS_NETSERVICE_CID);
static NS_DEFINE_IID(kCImageButtonCID, NS_IMAGEBUTTON_CID);
static NS_DEFINE_IID(kCToolbarCID, NS_TOOLBAR_CID);
@ -104,16 +113,15 @@ static NS_DEFINE_IID(kCToolbarManagerCID, NS_TOOLBARMANAGER_CID);
static NS_DEFINE_IID(kCToolbarItemHolderCID, NS_TOOLBARITEMHOLDER_CID);
static NS_DEFINE_IID(kCPopUpMenuCID, NS_POPUPMENU_CID);
static NS_DEFINE_IID(kCMenuButtonCID, NS_MENUBUTTON_CID);
static NS_DEFINE_IID(kCToolkitCID, NS_TOOLKIT_CID);
static NS_DEFINE_IID(kCMenuBarCID, NS_MENUBAR_CID);
static NS_DEFINE_IID(kCMenuCID, NS_MENU_CID);
static NS_DEFINE_IID(kCMenuItemCID, NS_MENUITEM_CID);
extern "C" void
NS_SetupRegistry()
{
nsRepository::RegisterFactory(kLookAndFeelCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCWindowIID, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCMenuBarCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCMenuCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCMenuItemCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCScrollbarIID, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCHScrollbarIID, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCDialogCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
@ -128,6 +136,7 @@ NS_SetupRegistry()
nsRepository::RegisterFactory(kCCheckButtonIID, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCChildIID, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCAppShellCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCToolkitCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCRenderingContextIID, GFXWIN_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCDeviceContextIID, GFXWIN_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCFontMetricsIID, GFXWIN_DLL, PR_FALSE, PR_FALSE);
@ -143,6 +152,11 @@ NS_SetupRegistry()
nsRepository::RegisterFactory(kCPluginHostCID, PLUGIN_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCParserCID, PARSER_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCDOMScriptObjectFactory, DOM_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCDOMNativeObjectRegistry, DOM_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCHTMLDocument, LAYOUT_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCImageDocument, LAYOUT_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCHTMLImageElementFactory, LAYOUT_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kNetServiceCID, NETLIB_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCImageButtonCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCToolbarCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
@ -150,6 +164,7 @@ NS_SetupRegistry()
nsRepository::RegisterFactory(kCToolbarItemHolderCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCPopUpMenuCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCMenuButtonCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCToolkitCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCMenuBarCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCMenuCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCMenuItemCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
}

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

@ -206,21 +206,6 @@ nsViewerApp::Initialize(int argc, char** argv)
return rv;
}
nsresult
nsViewerApp::Run()
{
return mAppShell->Run();
}
nsresult
nsViewerApp::Exit()
{
Destroy();
mAppShell->Exit();
NS_RELEASE(mAppShell);
return NS_OK;
}
static void
@ -626,9 +611,8 @@ static void* GetWidgetNativeData(nsISupports* aObject)
}
#ifdef XP_PC
#ifdef XP_PC_ROBOT
extern JSConsole *gConsole;
// XXX temporary robot code until it's made XP
extern HINSTANCE gInstance, gPrevInstance;
@ -1204,7 +1188,7 @@ nsViewerApp::CreateSiteWalker(nsBrowserWindow* aWindow)
//----------------------------------------
#ifdef XP_PC_ROBOT
#ifdef XP_PC
#include "jsconsres.h"
static NS_DEFINE_IID(kIScriptContextOwnerIID, NS_ISCRIPTCONTEXTOWNER_IID);
@ -1220,7 +1204,7 @@ static void DestroyConsole()
static void ShowConsole(nsBrowserWindow* aWindow)
{
/* HWND hWnd = (HWND)aWindow->mWindow->GetNativeData(NS_NATIVE_WIDGET);
HWND hWnd = (HWND)aWindow->mWindow->GetNativeData(NS_NATIVE_WIDGET);
if (!gConsole) {
// load the accelerator table for the console
@ -1250,14 +1234,14 @@ static void ShowConsole(nsBrowserWindow* aWindow)
else {
MessageBox(hWnd, "Unable to load JavaScript", "Viewer Error", MB_ICONSTOP);
}
}*/
}
}
#endif
NS_IMETHODIMP
nsViewerApp::CreateJSConsole(nsBrowserWindow* aWindow)
{
#ifdef XP_PC_ROBOT
#ifdef XP_PC
if (nsnull == gConsole) {
ShowConsole(aWindow);
}
@ -1282,3 +1266,35 @@ nsViewerApp::DoPrefs(nsBrowserWindow* aWindow)
#endif
return NS_OK;
}
nsresult
nsViewerApp::Run()
{
//OpenWindow();
// Process messages
/*MSG msg;
while (::GetMessage(&msg, NULL, 0, 0)) {
if (!JSConsole::sAccelTable ||
!gConsole ||
!gConsole->GetMainWindow() ||
!TranslateAccelerator(gConsole->GetMainWindow(),
JSConsole::sAccelTable, &msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return NS_OK;*/
return mAppShell->Run();
}
nsresult
nsViewerApp::Exit()
{
Destroy();
mAppShell->Exit();
NS_RELEASE(mAppShell);
return NS_OK;
}