From 8f6e45ba066fe2c1cacdf93bdd73774df7f683b1 Mon Sep 17 00:00:00 2001 From: "michaelp%netscape.com" Date: Fri, 17 Jul 1998 22:58:11 +0000 Subject: [PATCH] throbber now has 14 frames and works as a button. --- webshell/tests/viewer/Makefile | 12 ----- webshell/tests/viewer/makefile.win | 22 ++++----- webshell/tests/viewer/nsViewer.cpp | 72 +++++++++++++++++++++++++++--- webshell/tests/viewer/nsViewer.h | 2 + 4 files changed, 77 insertions(+), 31 deletions(-) diff --git a/webshell/tests/viewer/Makefile b/webshell/tests/viewer/Makefile index 8ce80ba1e24a..8021300d03ce 100644 --- a/webshell/tests/viewer/Makefile +++ b/webshell/tests/viewer/Makefile @@ -160,12 +160,6 @@ install:: $(TARGETS) $(INSTALL) throbber/anims11.gif $(DIST)/bin/res/throbber $(INSTALL) throbber/anims12.gif $(DIST)/bin/res/throbber $(INSTALL) throbber/anims13.gif $(DIST)/bin/res/throbber - $(INSTALL) throbber/anims14.gif $(DIST)/bin/res/throbber - $(INSTALL) throbber/anims15.gif $(DIST)/bin/res/throbber - $(INSTALL) throbber/anims16.gif $(DIST)/bin/res/throbber - $(INSTALL) throbber/anims17.gif $(DIST)/bin/res/throbber - $(INSTALL) throbber/anims18.gif $(DIST)/bin/res/throbber - $(INSTALL) throbber/anims19.gif $(DIST)/bin/res/throbber clobber:: rm -f $(DIST)/bin/viewer.exe @@ -202,11 +196,5 @@ clobber:: rm -f $(DIST)/bin/res/throbber/anims11.gif rm -f $(DIST)/bin/res/throbber/anims12.gif rm -f $(DIST)/bin/res/throbber/anims13.gif - rm -f $(DIST)/bin/res/throbber/anims14.gif - rm -f $(DIST)/bin/res/throbber/anims15.gif - rm -f $(DIST)/bin/res/throbber/anims16.gif - rm -f $(DIST)/bin/res/throbber/anims17.gif - rm -f $(DIST)/bin/res/throbber/anims18.gif - rm -f $(DIST)/bin/res/throbber/anims19.gif diff --git a/webshell/tests/viewer/makefile.win b/webshell/tests/viewer/makefile.win index 05a252900af4..b2ab2a21a58f 100644 --- a/webshell/tests/viewer/makefile.win +++ b/webshell/tests/viewer/makefile.win @@ -39,7 +39,15 @@ OBJS = \ .\$(OBJDIR)\nsEditorMode.obj \ $(NULL) -LINCS=-I$(PUBLIC)\raptor -I$(PUBLIC)\xpcom -I$(PUBLIC)\dom -I$(PUBLIC)\js -I$(PUBLIC)\netlib -I$(PUBLIC)\pref +LINCS= \ + -I$(PUBLIC)\raptor \ + -I$(PUBLIC)\xpcom \ + -I$(PUBLIC)\dom \ + -I$(PUBLIC)\js \ + -I$(PUBLIC)\netlib \ + -I$(PUBLIC)\java \ + -I$(PUBLIC)\plugin \ + -I$(PUBLIC)\pref MYLIBS= \ $(DIST)\lib\raptorbase.lib \ @@ -103,12 +111,6 @@ install:: $(PROGRAM) $(MAKE_INSTALL) throbber\anims11.gif $(DIST)\bin\res\throbber $(MAKE_INSTALL) throbber\anims12.gif $(DIST)\bin\res\throbber $(MAKE_INSTALL) throbber\anims13.gif $(DIST)\bin\res\throbber - $(MAKE_INSTALL) throbber\anims14.gif $(DIST)\bin\res\throbber - $(MAKE_INSTALL) throbber\anims15.gif $(DIST)\bin\res\throbber - $(MAKE_INSTALL) throbber\anims16.gif $(DIST)\bin\res\throbber - $(MAKE_INSTALL) throbber\anims17.gif $(DIST)\bin\res\throbber - $(MAKE_INSTALL) throbber\anims18.gif $(DIST)\bin\res\throbber - $(MAKE_INSTALL) throbber\anims19.gif $(DIST)\bin\res\throbber clobber:: rm -f $(DIST)\bin\viewer.exe @@ -146,9 +148,3 @@ clobber:: rm -f $(DIST)\bin\res\throbber\anims11.gif rm -f $(DIST)\bin\res\throbber\anims12.gif rm -f $(DIST)\bin\res\throbber\anims13.gif - rm -f $(DIST)\bin\res\throbber\anims14.gif - rm -f $(DIST)\bin\res\throbber\anims15.gif - rm -f $(DIST)\bin\res\throbber\anims16.gif - rm -f $(DIST)\bin\res\throbber\anims17.gif - rm -f $(DIST)\bin\res\throbber\anims18.gif - rm -f $(DIST)\bin\res\throbber\anims19.gif diff --git a/webshell/tests/viewer/nsViewer.cpp b/webshell/tests/viewer/nsViewer.cpp index 7436fa0088fe..f8eb502e9117 100644 --- a/webshell/tests/viewer/nsViewer.cpp +++ b/webshell/tests/viewer/nsViewer.cpp @@ -28,6 +28,8 @@ #include #endif +//#define VIEWER_PLUGINS + #define NS_IMPL_IDS #include "nsViewer.h" #include "resources.h" // #defines ID's for menu items @@ -79,6 +81,12 @@ #include "nsIStyleSet.h" #include "nsIStyleContext.h" +#ifdef VIEWER_PLUGINS +#include "nsPluginsCID.h" +#include "nsplugin.h" +#include "nsIPluginHost.h" +#endif + // Class ID's static NS_DEFINE_IID(kCFileWidgetCID, NS_FILEWIDGET_CID); static NS_DEFINE_IID(kIFileWidgetIID, NS_IFILEWIDGET_IID); @@ -108,6 +116,10 @@ static NS_DEFINE_IID(kCScrollingViewCID, NS_SCROLLING_VIEW_CID); static NS_DEFINE_IID(kCWebWidgetCID, NS_WEBWIDGET_CID); static NS_DEFINE_IID(kCDocumentLoaderCID, NS_DOCUMENTLOADER_CID); +#ifdef VIEWER_PLUGINS +static NS_DEFINE_IID(kCPluginHostCID, NS_PLUGIN_HOST_CID); +#endif + // IID's static NS_DEFINE_IID(kIButtonIID, NS_IBUTTON_IID); static NS_DEFINE_IID(kITextWidgetIID, NS_ITEXTWIDGET_IID); @@ -115,6 +127,11 @@ static NS_DEFINE_IID(kIDocumentLoaderIID, NS_IDOCUMENTLOADER_IID); static NS_DEFINE_IID(kIScriptContextOwnerIID, NS_ISCRIPTCONTEXTOWNER_IID); static NS_DEFINE_IID(kIChildWidgetIID, NS_IWIDGET_IID); +#ifdef VIEWER_PLUGINS +static NS_DEFINE_IID(kIPluginManagerIID, NS_IPLUGINMANAGER_IID); +static NS_DEFINE_IID(kIPluginHostIID, NS_IPLUGINHOST_IID); +#endif + #define VIEWER_UI #undef INSET_WEBWIDGET @@ -129,7 +146,7 @@ static NS_DEFINE_IID(kIChildWidgetIID, NS_IWIDGET_IID); #endif #define BUTTON_HEIGHT THROBBER_HEIGHT -#define THROB_NUM 20 +#define THROB_NUM 14 #define THROBBER_AT "resource:/res/throbber/anims%02d.gif" #ifdef INSET_WEBWIDGET @@ -164,6 +181,10 @@ static PRInt32 gRepeatCount=1; // if running in an auto mode, this is the num static PRInt32 gNumSamples=9; // if running in an auto mode that uses the samples, this is the last sample to load static char gInputFileName[MAXPATHLEN]; +#ifdef VIEWER_PLUGINS +nsIPluginManager *gPluginManager = nsnull; +nsIPluginHost *gPluginHost = nsnull; +#endif // Temporary Netlib stuff... /* XXX: Don't include net.h... */ @@ -323,6 +344,13 @@ DocObserver::QueryInterface(const nsIID& aIID, AddRef(); return NS_OK; } + +#ifdef VIEWER_PLUGINS + //XXX wow, what a hack... MMP + if (nsnull != gPluginManager) + return gPluginManager->QueryInterface(aIID, aInstancePtrResult); +#endif + return NS_NOINTERFACE; } @@ -1030,6 +1058,18 @@ nsEventStatus PR_CALLBACK HandleThrobberEvent(nsGUIEvent *aEvent) break; } + + case NS_MOUSE_LEFT_BUTTON_UP: + gTheViewer->GoTo(nsString("http://www.mozilla.org")); + break; + + case NS_MOUSE_ENTER: + aEvent->widget->SetCursor(eCursor_hyperlink); + break; + + case NS_MOUSE_EXIT: + aEvent->widget->SetCursor(eCursor_standard); + break; } return nsEventStatus_eIgnore; @@ -1683,7 +1723,23 @@ nsDocLoader* nsViewer::SetupViewer(nsIWidget **aMainWindow, int argc, char **arg NSRepository::RegisterFactory(kCDocumentLoaderCID, WEB_DLL, PR_FALSE, PR_FALSE); NSRepository::RegisterFactory(kPrefCID, PREF_DLL, PR_FALSE, PR_FALSE); +#ifdef VIEWER_PLUGINS + NSRepository::RegisterFactory(kCPluginHostCID, PLUGIN_DLL, PR_FALSE, PR_FALSE); +#endif + nsresult res; + res=NSRepository::CreateInstance(kCAppShellCID, nsnull, kIAppShellIID, (void**)&gAppShell); + if (NS_OK==res) + { + gAppShell->Create(&argc, argv); + gAppShell->SetDispatchListener(this); + } + else + { + fprintf(stderr, "Couldn't create an instance of AppShell\n"); + return(nsnull); + } + res=NSRepository::CreateInstance(kPrefCID, NULL, kIPrefIID, (void **) &gPrefs); if (NS_OK==res) { @@ -1700,18 +1756,22 @@ nsDocLoader* nsViewer::SetupViewer(nsIWidget **aMainWindow, int argc, char **arg mRLWindow = mRelatedLinks->MakeRLWindowWithCallback(DumpRLValues, this); } - // Create an application shell - res=NSRepository::CreateInstance(kCAppShellCID, nsnull, kIAppShellIID, (void**)&gAppShell); +#ifdef VIEWER_PLUGINS + res=NSRepository::CreateInstance(kCPluginHostCID, nsnull, kIPluginManagerIID, (void**)&gPluginManager); if (NS_OK==res) { - gAppShell->Create(&argc, argv); - gAppShell->SetDispatchListener(this); + if (NS_OK == gPluginManager->QueryInterface(kIPluginHostIID, (void **)&gPluginHost)) + { + gPluginHost->Init(); + gPluginHost->LoadPlugins(); + } } else { - fprintf(stderr, "Couldn't create an instance of AppShell\n"); + fprintf(stderr, "Couldn't create an instance of PluginManager\n"); return(nsnull); } +#endif // Create a top level window for the WebWidget WindowData* wd = CreateTopLevel("Raptor HTML Viewer", 620, 400); diff --git a/webshell/tests/viewer/nsViewer.h b/webshell/tests/viewer/nsViewer.h index 94b5a79ab65f..4278b15745cc 100644 --- a/webshell/tests/viewer/nsViewer.h +++ b/webshell/tests/viewer/nsViewer.h @@ -41,12 +41,14 @@ class nsIScriptGlobalObject; #define GFXWIN_DLL "raptorgfxwin.dll" #define VIEW_DLL "raptorview.dll" #define WEB_DLL "raptorweb.dll" +#define PLUGIN_DLL "raptorplugin.dll" #define PREF_DLL "xppref32.dll" #else #define WIDGET_DLL "libwidgetunix.so" #define GFXWIN_DLL "libgfxunix.so" #define VIEW_DLL "libraptorview.so" #define WEB_DLL "libraptorwebwidget.so" +#define PLUGIN_DLL "raptorplugin.so" #define PREF_DLL "libpref.so" #endif