From ca565632b09351b1db2edbed165921693aed76ca Mon Sep 17 00:00:00 2001 From: "svn%xmlterm.org" Date: Mon, 17 Jul 2000 04:11:24 +0000 Subject: [PATCH] --NOT PART OF DEFAULT BUILD-- XMLterm changes only. "make xpi" in xmlterm/scripts directory now creates an XPI file for XMLterm. Removed last vestiges of WebShell! Deleted outdated GeckoTerm files. --- extensions/xmlterm/base/mozIXMLTermShell.idl | 6 - extensions/xmlterm/base/mozXMLTermShell.cpp | 131 -------- extensions/xmlterm/base/mozXMLTermShell.h | 23 +- extensions/xmlterm/base/mozXMLTermStream.cpp | 5 +- extensions/xmlterm/geckoterm/Makefile.in | 41 +-- extensions/xmlterm/geckoterm/README | 24 -- extensions/xmlterm/geckoterm/mozGeckoTerm.cpp | 310 ------------------ .../xmlterm/geckoterm/mozISimpleContainer.h | 85 ----- .../xmlterm/geckoterm/mozSimpleContainer.cpp | 283 ---------------- .../xmlterm/geckoterm/mozSimpleContainer.h | 60 ---- .../xmlterm/geckoterm/nsSetupRegistry.cpp | 23 -- extensions/xmlterm/geckoterm/nsTimer.cpp | 198 ----------- extensions/xmlterm/scripts/Makefile.in | 14 +- extensions/xmlterm/{ui => scripts}/install.js | 0 14 files changed, 20 insertions(+), 1183 deletions(-) delete mode 100644 extensions/xmlterm/geckoterm/README delete mode 100644 extensions/xmlterm/geckoterm/mozGeckoTerm.cpp delete mode 100644 extensions/xmlterm/geckoterm/mozISimpleContainer.h delete mode 100644 extensions/xmlterm/geckoterm/mozSimpleContainer.cpp delete mode 100644 extensions/xmlterm/geckoterm/mozSimpleContainer.h delete mode 100644 extensions/xmlterm/geckoterm/nsSetupRegistry.cpp delete mode 100644 extensions/xmlterm/geckoterm/nsTimer.cpp rename extensions/xmlterm/{ui => scripts}/install.js (100%) diff --git a/extensions/xmlterm/base/mozIXMLTermShell.idl b/extensions/xmlterm/base/mozIXMLTermShell.idl index b79f6499da90..78a84a6b63f0 100644 --- a/extensions/xmlterm/base/mozIXMLTermShell.idl +++ b/extensions/xmlterm/base/mozIXMLTermShell.idl @@ -83,12 +83,6 @@ interface mozIXMLTermShell : nsISupports */ void IgnoreKeyPress(in boolean aIgnore, in wstring aCookie); - /** Opens new XMLterm window with specified args (not yet implemented) - * @param args argument string to be passed to XMLterm - * (at the moment this just contains any initial input data) - */ - nsIDOMWindow NewXMLTermWindow(in wstring args); - /** Exit browser, closing all windows (not yet implemented) */ void Exit(); diff --git a/extensions/xmlterm/base/mozXMLTermShell.cpp b/extensions/xmlterm/base/mozXMLTermShell.cpp index a2b418d57a03..7a766c56860d 100644 --- a/extensions/xmlterm/base/mozXMLTermShell.cpp +++ b/extensions/xmlterm/base/mozXMLTermShell.cpp @@ -39,15 +39,6 @@ #include "nsIPresContext.h" #include "nsIScriptGlobalObject.h" -#include "nsIWebShell.h" -#include "nsIWebShellWindow.h" - -#ifdef NEW_XMLTERM_IMP // Test C++ NewXMLTerm implementation -#include "nsIWidget.h" -#include "nsWidgetsCID.h" -#include "nsIBaseWindow.h" -#endif - #include "nsIServiceManager.h" #include "nsIAppShellService.h" @@ -67,11 +58,6 @@ static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); // Define Class IDs static NS_DEFINE_IID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID); -#ifdef NEW_XMLTERM_IMP // Test C++ NewXMLTerm implementation -static NS_DEFINE_IID(kWindowCID, NS_WINDOW_CID); -static NS_DEFINE_IID(kWebShellCID, NS_WEB_SHELL_CID); -#endif - ///////////////////////////////////////////////////////////////////////// // mozXMLTermShell factory @@ -135,9 +121,6 @@ mozXMLTermShell::QueryInterface(REFNSIID aIID,void** aInstancePtr) } else if ( aIID.Equals(NS_GET_IID(mozIXMLTermShell)) ) { *aInstancePtr = NS_STATIC_CAST(mozIXMLTermShell*,this); - } else if ( aIID.Equals(NS_GET_IID(nsIWebShellContainer)) ) { - *aInstancePtr = NS_STATIC_CAST(nsIWebShellContainer*,this); - } else { return NS_ERROR_NO_INTERFACE; } @@ -354,89 +337,6 @@ NS_IMETHODIMP mozXMLTermShell::SendText(const PRUnichar* aString, } -// Create new XMLTerm window with specified argument string -NS_IMETHODIMP -mozXMLTermShell::NewXMLTermWindow(const PRUnichar* args, - nsIDOMWindow **_retval) -{ - nsresult result; - - XMLT_LOG(mozXMLTermShell::NewXMLTermWindow,10,("\n")); - - if (!_retval) - return NS_ERROR_NULL_POINTER; - *_retval = nsnull; - - if (!mContentAreaDocShell) - return NS_ERROR_FAILURE; - - // Get top window - nsCOMPtr contentAreaWebShell( do_QueryInterface(mContentAreaDocShell) ); - - XMLT_LOG(mozXMLTermShell::NewXMLTermWindow,0,("check0, contWebShell=0x%x\n", - (int) contentAreaWebShell.get())); - - nsCOMPtr topContainer = nsnull; - result = contentAreaWebShell->GetTopLevelWindow(getter_AddRefs(topContainer)); - XMLT_LOG(mozXMLTermShell::NewXMLTermWindow,0,("check0, topContainer=0x%x\n", - (int) topContainer.get())); - - nsCOMPtr topWin( do_QueryInterface(topContainer) ); - XMLT_LOG(mozXMLTermShell::NewXMLTermWindow,0,("check0, topWin=0x%x\n", - (int) topWin.get())); - -#ifdef NEW_XMLTERM_IMP // Test C++ NewXMLTerm implementation - PRInt32 width = 760; - PRInt32 height = 400; - - XMLT_LOG(mozXMLTermShell::NewXMLTermWindow,0,("check4\n")); - - // Create the Application Shell instance... - nsIAppShellService* appShellSvc = nsnull; - result = nsServiceManager::GetService(kAppShellServiceCID, - NS_GET_IID(nsIAppShellService), - (nsISupports**)&appShellSvc); - - XMLT_LOG(mozXMLTermShell::NewXMLTermWindow,0,("check5\n")); - if (NS_FAILED(result) || !appShellSvc) - return NS_ERROR_FAILURE; - - // Create top level window - nsCOMPtr webShellWin; - nsCOMPtr uri = nsnull; - //nsCAutoString urlCString("chrome://xmlterm/content/xmlterm.html"); - //result = uri->SetSpec(urlCString.GetBuffer()); - - XMLT_LOG(mozXMLTermShell::NewXMLTermWindow,0,("check6\n")); - if (NS_FAILED(result)) - return NS_ERROR_FAILURE; - - appShellSvc->CreateTopLevelWindow((nsIWebShellWindow*) nsnull, - uri, - PR_TRUE, - PR_FALSE, - (PRUint32) 0, - width, height, - getter_AddRefs(webShellWin)); - - XMLT_LOG(mozXMLTermShell::NewXMLTermWindow,0,("check7, webShellWin=0x%x\n", - webShellWin.get())); - if (NS_FAILED(result)) - return result; - - // Return new DOM window - result = webShellWin->GetDOMWindow(_retval); - XMLT_LOG(mozXMLTermShell::NewXMLTermWindow,0,("check8, *_retval=0x%x\n", - *_retval)); - if (NS_FAILED(result) || !*_retval) - return NS_ERROR_FAILURE; - -#endif - - return NS_OK; -} - - // Exit XMLTerm window NS_IMETHODIMP mozXMLTermShell::Exit() @@ -455,34 +355,3 @@ mozXMLTermShell::Exit() } return NS_OK; } - - -NS_IMETHODIMP mozXMLTermShell::WillLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsLoadType aReason) -{ - XMLT_LOG(mozXMLTermShell::WillLoadURL,0,("\n")); - return NS_OK; -} - - -NS_IMETHODIMP mozXMLTermShell::BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL) -{ - XMLT_LOG(mozXMLTermShell::BeginLoadURL,0,("\n")); - return NS_OK; -} - - -NS_IMETHODIMP mozXMLTermShell::ProgressLoadURL(nsIWebShell* aShell, - const PRUnichar* aURL, PRInt32 aProgress, PRInt32 aProgressMax) -{ - XMLT_LOG(mozXMLTermShell::ProgressLoadURL,0,("\n")); - return NS_OK; -} - - -NS_IMETHODIMP mozXMLTermShell::EndLoadURL(nsIWebShell* aShell, - const PRUnichar* aURL, - nsresult aStatus) -{ - XMLT_LOG(mozXMLTermShell::EndLoadURL,0,("\n")); - return NS_OK; -} diff --git a/extensions/xmlterm/base/mozXMLTermShell.h b/extensions/xmlterm/base/mozXMLTermShell.h index 2b238749d2f8..4cde63f013e1 100644 --- a/extensions/xmlterm/base/mozXMLTermShell.h +++ b/extensions/xmlterm/base/mozXMLTermShell.h @@ -35,8 +35,7 @@ #include "mozIXMLTermShell.h" -class mozXMLTermShell : public mozIXMLTermShell, - public nsIWebShellContainer +class mozXMLTermShell : public mozIXMLTermShell { public: @@ -68,30 +67,10 @@ class mozXMLTermShell : public mozIXMLTermShell, NS_IMETHOD SendText(const PRUnichar* aString, const PRUnichar* aCookie); - NS_IMETHOD NewXMLTermWindow(const PRUnichar* args, - nsIDOMWindow **_retval); - NS_IMETHOD Exit(void); NS_IMETHOD Finalize(void); - // nsIWebShellContainer interface - NS_IMETHOD WillLoadURL(nsIWebShell* aShell, - const PRUnichar* aURL, - nsLoadType aReason); - - NS_IMETHOD BeginLoadURL(nsIWebShell* aShell, - const PRUnichar* aURL); - - - NS_IMETHOD ProgressLoadURL(nsIWebShell* aShell, - const PRUnichar* aURL, - PRInt32 aProgress, - PRInt32 aProgressMax); - - NS_IMETHOD EndLoadURL(nsIWebShell* aShell, - const PRUnichar* aURL, - nsresult aStatus); protected: /** object initialization flag */ diff --git a/extensions/xmlterm/base/mozXMLTermStream.cpp b/extensions/xmlterm/base/mozXMLTermStream.cpp index e43c314d5fc5..63d1fe35aabc 100644 --- a/extensions/xmlterm/base/mozXMLTermStream.cpp +++ b/extensions/xmlterm/base/mozXMLTermStream.cpp @@ -314,10 +314,7 @@ NS_IMETHODIMP mozXMLTermStream::Open(nsIDOMWindow* aDOMWindow, if (NS_FAILED(result)) return result; - nsCOMPtr webShell(do_QueryInterface(docShell)); - result = webShell->Embed(contentViewer, command, (nsISupports*) nsnull); - if (NS_FAILED(result)) - return result; + // ****NOTE**** Need to embed contentViewer in docShell result = mStreamListener->OnStartRequest(mChannel, mContext); if (NS_FAILED(result)) diff --git a/extensions/xmlterm/geckoterm/Makefile.in b/extensions/xmlterm/geckoterm/Makefile.in index b9681c9e77e2..3c99524f0d69 100644 --- a/extensions/xmlterm/geckoterm/Makefile.in +++ b/extensions/xmlterm/geckoterm/Makefile.in @@ -47,44 +47,20 @@ endif # Debug option -DEBUG = 1 +DEBUG = # Program -PROGRAM = geckoterm +PROGRAM = # Exported header files -EXPORTS = mozISimpleContainer.h +EXPORTS = # Defines -DEFINES = $(TK_CFLAGS) +DEFINES = # C++ source files -CPPSRCS = nsSetupRegistry.cpp \ - mozSimpleContainer.cpp \ - mozGeckoTerm.cpp \ -# nsTimer.cpp \ - $(NULL) +CPPSRCS = -# Libraries to be linked -GTK_GLUE = -lgtksuperwin - -XP_DIST_LIBS = \ - -lgkgfx \ - $(MOZ_JS_LIBS) \ - $(XPCOM_LIBS) \ - $(JSJ_LIB) \ - $(NULL) - -XP_NS_UNDERBAR_CRAP = \ - $(MOZ_NECKO_UTIL_LIBS) \ - $(MOZ_WIDGET_SUPPORT_LIBS) \ - $(NULL) - -XP_LIBS = \ - $(XP_NS_UNDERBAR_CRAP) \ - $(XP_DIST_LIBS) \ - $(NSPR_LIBS) \ - $(NULL) ifdef DYNAMIC_LINK # NOTE: a soft link needs to be created for libxmlterm.so in dist/bin @@ -94,13 +70,6 @@ else XMLTERM_LIBS = ../base/libxmlterm.a endif -LIBS = \ - $(GTK_GLUE) \ - $(XP_LIBS) \ - $(TK_LIBS) \ - $(XMLTERM_LIBS) \ - $(NULL) - include $(topsrcdir)/config/config.mk include ../config/xmlterm_config.mk diff --git a/extensions/xmlterm/geckoterm/README b/extensions/xmlterm/geckoterm/README deleted file mode 100644 index 03dda47848b6..000000000000 --- a/extensions/xmlterm/geckoterm/README +++ /dev/null @@ -1,24 +0,0 @@ -geckoterm --- Stand-alone version of XMLterm using Gecko - -This directory contains the files used to create the stand-alone XMLterm -executable, which runs independent of the browser. This would be the preferred -way to use XMLterm, so that it runs as a separate process and will not -crash if the browser does. - -28 Nov 1999 - -FILES -===== - -mozGeckoTerm.cpp Main program for stand-alone "xmlterm" executable - Uses GTK to create window - Uses mozIXMLTerminal to create XMLterm - Uses mozISimpleContainer for web shell container - -mozISimpleContainer.h Simple WebShell container interface -mozSimpleContainer.cpp Implementation of mozISimpleContainer - -nsSetupRegistry.cpp Just a copy of viewer's nSetupRegistry -nsTimer.cpp Implementation of timers using Gtk timer facility - --- diff --git a/extensions/xmlterm/geckoterm/mozGeckoTerm.cpp b/extensions/xmlterm/geckoterm/mozGeckoTerm.cpp deleted file mode 100644 index 4107aade398a..000000000000 --- a/extensions/xmlterm/geckoterm/mozGeckoTerm.cpp +++ /dev/null @@ -1,310 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "MPL"); you may not use this file - * except in compliance with the MPL. You may obtain a copy of - * the MPL at http://www.mozilla.org/MPL/ - * - * Software distributed under the MPL is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the MPL for the specific language governing - * rights and limitations under the MPL. - * - * The Original Code is XMLterm. - * - * The Initial Developer of the Original Code is Ramalingam Saravanan. - * Portions created by Ramalingam Saravanan are - * Copyright (C) 1999 Ramalingam Saravanan. All Rights Reserved. - * - * Contributor(s): - */ - -// mozGeckoTerm.cpp: Stand-alone implementation of XMLterm using GTK -// and the Mozilla Layout engine - -#include "stdio.h" - -#include - -#include "gtkmozarea.h" -#include "gdksuperwin.h" - -#include "nscore.h" -#include "nsCOMPtr.h" - -#include "nsRepository.h" -#include "nsIComponentManager.h" -#include "nsIServiceManager.h" -#include "nsIEventQueueService.h" -#include "nsIPref.h" - -#include "mozXMLTermUtils.h" -#include "mozISimpleContainer.h" -#include "mozIXMLTerminal.h" -#include "mozIXMLTermStream.h" - -#define XMLTERM_DLL "libxmlterm"MOZ_DLL_SUFFIX - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kIEventQueueServiceIID, NS_IEVENTQUEUESERVICE_IID); -static NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); -static NS_DEFINE_IID(kIPrefIID, NS_IPREF_IID); -static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); -static NS_DEFINE_IID(kLineTermCID, MOZLINETERM_CID); -static NS_DEFINE_IID(kXMLTermShellCID, MOZXMLTERMSHELL_CID); - -extern "C" void NS_SetupRegistry(); - -nsCOMPtr gSimpleContainer = nsnull; -nsCOMPtr gXMLTerminal = nsnull; - -/** Processes thread events */ -static void event_processor_callback(gpointer data, - gint source, - GdkInputCondition condition) -{ - nsIEventQueue *eventQueue = (nsIEventQueue*)data; - eventQueue->ProcessPendingEvents(); - //fprintf(stderr, "event_processor_callback:\n"); - return; -} - - -static void event_processor_configure(GtkWidget *window, - GdkEvent *event, - GtkWidget *termWidget) -{ - GtkAllocation *alloc = >K_WIDGET(termWidget)->allocation; - - //fprintf(stderr, "event_processor_configure:\n"); - - // Resize doc shell window - gSimpleContainer->Resize(alloc->width, alloc->height); - - if (gXMLTerminal) { - // Resize XMLTerm - gXMLTerminal->Resize(); - } - - return; -} - -/** Cleans up and exits */ -static gint event_processor_quit(gpointer data, - gint source, - GdkInputCondition condition) -{ - fprintf(stderr, "event_processor_quit:\n"); - - if (gXMLTerminal) { - // Finalize XMLTerm and release owning reference to it - gXMLTerminal->Finalize(); - gXMLTerminal = nsnull; - } - - // Delete reference to container - gSimpleContainer = nsnull; - - gtk_main_quit(); - return TRUE; -} - - -int main( int argc, char *argv[] ) -{ - GtkWidget *mainWin = NULL; - GtkWidget *mozArea = NULL; - GdkSuperWin *superWin = NULL; - - nsIEventQueue *mEventQueue = nsnull; - - nsresult result = NS_OK; - - // Set up registry - NS_SetupRegistry(); - - // Register XMLTermShell and LineTerm interfaces - result = nsComponentManager::RegisterComponentLib(kLineTermCID,NULL,NULL, - XMLTERM_DLL, PR_FALSE, PR_FALSE); - printf("mozGeckoTerm: registered LineTerm, result=0x%x\n", result); - - result = nsComponentManager::RegisterComponentLib(kXMLTermShellCID,NULL,NULL, - XMLTERM_DLL, PR_FALSE, PR_FALSE); - printf("mozGeckoTerm: registered XMLTermShell, result=0x%x\n", result); - - // Get the event queue service - NS_WITH_SERVICE(nsIEventQueueService, eventQService, - kEventQueueServiceCID, &result); - if (NS_FAILED(result)) { - NS_ASSERTION("Could not obtain event queue service", PR_FALSE); - return result; - } - - // Get the event queue for the thread. - result = eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, - &mEventQueue); - - if (!mEventQueue) { - // Create the event queue for the thread - result = eventQService->CreateThreadEventQueue(); - if (NS_FAILED(result)) { - NS_ASSERTION("Could not create the thread event queue", PR_FALSE); - return result; - } - - // Get the event queue for the thread - result = eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, &mEventQueue); - if (NS_FAILED(result)) { - NS_ASSERTION("Could not obtain the thread event queue", PR_FALSE); - return result; - } - } - - // Create pref object - nsCOMPtr mPref = nsnull; - result = nsComponentManager::CreateInstance(kPrefCID, NULL, - kIPrefIID, getter_AddRefs(mPref)); - if (NS_FAILED(result)) { - NS_ASSERTION("Failed to create nsIPref object", PR_FALSE); - return result; - } - - mPref->StartUp(); - mPref->ReadUserPrefs(); - - // Initialize GTK library - gtk_set_locale(); - - gtk_init(&argc, &argv); - - gdk_rgb_init(); - - mainWin = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_window_set_default_size( GTK_WINDOW(mainWin), 740, 484); - gtk_window_set_title(GTK_WINDOW(mainWin), "XMLterm"); - - mozArea = gtk_mozarea_new(); - gtk_container_add(GTK_CONTAINER(mainWin), mozArea); - gtk_widget_realize(mozArea); - gtk_widget_show(mozArea); - superWin = GTK_MOZAREA(mozArea)->superwin; - - gdk_window_show(superWin->bin_window); - gdk_window_show(superWin->shell_window); - - gtk_widget_show(mainWin); - - - // Configure event handler - gtk_signal_connect_after( GTK_OBJECT(mainWin), "configure_event", - GTK_SIGNAL_FUNC(event_processor_configure), - mainWin); - - // Cleanup and exit when window is deleted - gtk_signal_connect( GTK_OBJECT(mainWin), "delete_event", - GTK_SIGNAL_FUNC(event_processor_quit), - NULL); - - // Check for input in the events queue file descriptor - gdk_input_add(mEventQueue->GetEventQueueSelectFD(), - GDK_INPUT_READ, - event_processor_callback, - mEventQueue); - - // Create simple container - result = NS_NewSimpleContainer(getter_AddRefs(gSimpleContainer)); - - if (NS_FAILED(result) || !gSimpleContainer) { - return result; // Exit main program - } - - // Determine window dimensions - GtkAllocation *alloc = >K_WIDGET(mainWin)->allocation; - - // Initialize container it to hold a doc shell - result = gSimpleContainer->Init((nsNativeWidget *) superWin, - alloc->width, alloc->height, mPref); - - if (NS_FAILED(result)) { - return result; // Exit main program - } - - // Get reference to doc shell embedded in a simple container - nsCOMPtr docShell; - result = gSimpleContainer->GetDocShell(*getter_AddRefs(docShell)); - - if (NS_FAILED(result) || !docShell) { - return result; // Exit main program - } - -#if 0 - // TEMPORARY: Testing mozIXMLTermStream - nsAutoString streamData = "Stream Title" - "" - "Stream Body " - "Clik" - ""; - - nsCOMPtr stream; - result = NS_NewXMLTermStream(getter_AddRefs(stream)); - if (NS_FAILED(result)) { - fprintf(stderr, "mozGeckoTerm: Failed to create stream\n"); - return result; - } - - nsCOMPtr outerDOMWindow; - result = mozXMLTermUtils::ConvertDocShellToDOMWindow(docShell, - getter_AddRefs(outerDOMWindow)); - - if (NS_FAILED(result) || !outerDOMWindow) - return NS_ERROR_FAILURE; - - result = stream->Open(outerDOMWindow, nsnull, "chrome://dummy", "text/html", - 0); - if (NS_FAILED(result)) { - fprintf(stderr, "mozGeckoTerm: Failed to open stream\n"); - return result; - } - - result = stream->Write(streamData.GetUnicode()); - if (NS_FAILED(result)) { - fprintf(stderr, "mozGeckoTerm: Failed to write to stream\n"); - return result; - } - - result = stream->Close(); - if (NS_FAILED(result)) { - fprintf(stderr, "mozGeckoTerm: Failed to close stream\n"); - return result; - } -#else - // Load initial XMLterm document - result = gSimpleContainer->LoadURL( - "chrome://xmlterm/content/xmlterm.html"); - if (NS_FAILED(result)) - return result; -#endif - -#if 0 - // Create an XMLTERM and attach to web shell - result = NS_NewXMLTerminal(getter_AddRefs(gXMLTerminal)); - - if(!gXMLTerminal) - result = NS_ERROR_OUT_OF_MEMORY; - - if (NS_SUCCEEDED(result)) { - result = gXMLTerminal->Init(docShell, nsnull, nsnull); - } -#endif - - // Discard reference to web shell - docShell = nsnull; - - // GTK event loop - gtk_main(); - - NS_IF_RELEASE(mEventQueue); - - return 0; -} diff --git a/extensions/xmlterm/geckoterm/mozISimpleContainer.h b/extensions/xmlterm/geckoterm/mozISimpleContainer.h deleted file mode 100644 index 1ffc5a5fef11..000000000000 --- a/extensions/xmlterm/geckoterm/mozISimpleContainer.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "MPL"); you may not use this file - * except in compliance with the MPL. You may obtain a copy of - * the MPL at http://www.mozilla.org/MPL/ - * - * Software distributed under the MPL is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the MPL for the specific language governing - * rights and limitations under the MPL. - * - * The Original Code is XMLterm. - * - * The Initial Developer of the Original Code is Ramalingam Saravanan. - * Portions created by Ramalingam Saravanan are - * Copyright (C) 1999 Ramalingam Saravanan. All Rights Reserved. - * - * Contributor(s): - */ - -// mozISimpleContainer.h: a simple DocShell container interface -// for use in simple programs using the layout engine -// (unregistered interface) - -#ifndef mozISimpleContainer_h___ -#define mozISimpleContainer_h___ - -#include "nscore.h" - -#include "nsISupports.h" -#include "nsIDocShell.h" -#include "nsIPref.h" -#include "nsIPresShell.h" -#include "nsIDOMDocument.h" - -/* starting interface: mozISimpleContainer */ - -/* {0eb82bF0-43a2-11d3-8e76-006008948af5} */ -#define MOZISIMPLE_CONTAINER_IID_STR "0eb82bF0-43a2-11d3-8e76-006008948af5" -#define MOZISIMPLE_CONTAINER_IID \ - {0x0eb82bF0, 0x43a2, 0x11d3, \ - { 0x8e, 0x76, 0x00, 0x60, 0x08, 0x94, 0x8a, 0xf5 }} - -class mozISimpleContainer : public nsIDocumentLoaderObserver { - -public: - NS_DEFINE_STATIC_IID_ACCESSOR(MOZISIMPLE_CONTAINER_IID) - - // other - - /** Initializes simple container for native window widget - * @param aNativeWidget native window widget (e.g., GtkWidget) - * @param width window width (pixels) - * @param height window height (pixels) - * @param aPref preferences object - */ - NS_IMETHOD Init(nsNativeWidget aNativeWidget, - PRInt32 width, PRInt32 height, - nsIPref* aPref) = 0; - - /** Resizes container to new dimensions - * @param width new window width (pixels) - * @param height new window height (pixels) - */ - NS_IMETHOD Resize(PRInt32 aWidth, PRInt32 aHeight) = 0; - - /** Loads specified URL into container - * @param aURL URL string - */ - NS_IMETHOD LoadURL(const char* aURL) = 0; - - /** Gets web shell in container - * @param aDocShell (output) web shell object - */ - NS_IMETHOD GetDocShell(nsIDocShell*& aDocShell) = 0; -}; - -#define MOZSIMPLE_CONTAINER_CID \ -{ /* 0eb82bF1-43a2-11d3-8e76-006008948af5 */ \ - 0x0eb82bF1, 0x43a2, 0x11d3, \ -{0x8e, 0x76, 0x00, 0x60, 0x08, 0x94, 0x8a, 0xf5} } -extern nsresult -NS_NewSimpleContainer(mozISimpleContainer** aSimpleContainer); - -#endif /* mozISimpleContainer_h___ */ diff --git a/extensions/xmlterm/geckoterm/mozSimpleContainer.cpp b/extensions/xmlterm/geckoterm/mozSimpleContainer.cpp deleted file mode 100644 index 90ea5ee26db2..000000000000 --- a/extensions/xmlterm/geckoterm/mozSimpleContainer.cpp +++ /dev/null @@ -1,283 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "MPL"); you may not use this file - * except in compliance with the MPL. You may obtain a copy of - * the MPL at http://www.mozilla.org/MPL/ - * - * Software distributed under the MPL is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the MPL for the specific language governing - * rights and limitations under the MPL. - * - * The Original Code is XMLterm. - * - * The Initial Developer of the Original Code is Ramalingam Saravanan. - * Portions created by Ramalingam Saravanan are - * Copyright (C) 1999 Ramalingam Saravanan. All Rights Reserved. - * - * Contributor(s): - * Pierre Phaneuf - */ - -// mozSimpleContainer.cpp: Implements mozISimpleContainer -// which provides a DocShell container for use in simple programs -// using the layout engine - -#include "nscore.h" -#include "nsCOMPtr.h" - -#include "nsISupports.h" -#include "nsRepository.h" - -#include "nsIURI.h" -#include "nsIDocShell.h" -#include "nsIDOMDocument.h" -#include "nsIDocumentViewer.h" -#include "nsIPresContext.h" -#include "nsIPresShell.h" -#include "nsIDocument.h" - -#include "nsIWebShell.h" -#include "nsIBaseWindow.h" - -#include "mozSimpleContainer.h" - - -// Define Class IDs -static NS_DEFINE_IID(kWebShellCID, NS_WEB_SHELL_CID); - -// Define Interface IDs -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - -///////////////////////////////////////////////////////////////////////// -// mozSimpleContainer factory -///////////////////////////////////////////////////////////////////////// - -nsresult -NS_NewSimpleContainer(mozISimpleContainer** aSimpleContainer) -{ - NS_PRECONDITION(aSimpleContainer != nsnull, "null ptr"); - if (!aSimpleContainer) - return NS_ERROR_NULL_POINTER; - - *aSimpleContainer = new mozSimpleContainer(); - if (! *aSimpleContainer) - return NS_ERROR_OUT_OF_MEMORY; - - NS_ADDREF(*aSimpleContainer); - return NS_OK; -} - -///////////////////////////////////////////////////////////////////////// -// mozSimpleContainer implementation -///////////////////////////////////////////////////////////////////////// - -mozSimpleContainer::mozSimpleContainer() : - mDocShell(nsnull) -{ - NS_INIT_REFCNT(); -} - - -mozSimpleContainer::~mozSimpleContainer() -{ - mDocShell = nsnull; -} - -#define NS_IMPL_ADDREF_TRACE(_class) \ -NS_IMETHODIMP_(nsrefcnt) _class::AddRef(void) \ -{ \ - NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt"); \ - ++mRefCnt; \ - fprintf(stderr, "mozSimpleContainer:AddRef, mRefCnt=%d\n", mRefCnt); \ - return mRefCnt; \ -} - -#define NS_IMPL_RELEASE_TRACE(_class) \ -NS_IMETHODIMP_(nsrefcnt) _class::Release(void) \ -{ \ - NS_PRECONDITION(0 != mRefCnt, "dup release"); \ - --mRefCnt; \ - fprintf(stderr, "mozSimpleContainer:Release, mRefCnt=%d\n", mRefCnt); \ - if (mRefCnt == 0) { \ - NS_DELETEXPCOM(this); \ - return 0; \ - } \ - return mRefCnt; \ -} - -// Implement AddRef and Release -NS_IMPL_ADDREF(mozSimpleContainer) -NS_IMPL_RELEASE(mozSimpleContainer) - - -NS_IMETHODIMP -mozSimpleContainer::QueryInterface(REFNSIID aIID,void** aInstancePtr) -{ - if (aInstancePtr == NULL) { - return NS_ERROR_NULL_POINTER; - } - - // Always NULL result, in case of failure - *aInstancePtr = NULL; - - if ( aIID.Equals(kISupportsIID)) { - *aInstancePtr = NS_STATIC_CAST(nsISupports*, - NS_STATIC_CAST(mozISimpleContainer*,this)); - - } else if ( aIID.Equals(NS_GET_IID(mozISimpleContainer)) ) { - *aInstancePtr = NS_STATIC_CAST(mozISimpleContainer*,this); - - } else if ( aIID.Equals(NS_GET_IID(nsIDocumentLoaderObserver)) ) { - *aInstancePtr = NS_STATIC_CAST(nsIDocumentLoaderObserver*,this); - - } else { - return NS_ERROR_NO_INTERFACE; - } - - NS_ADDREF_THIS(); - - fprintf(stderr, "mozSimpleContainer::QueryInterface, mRefCnt = %d\n", mRefCnt); - - return NS_OK; -} - - -/** Initializes simple container for native window widget - * @param aNativeWidget native window widget (e.g., GtkWidget) - * @param width window width (pixels) - * @param height window height (pixels) - * @param aPref preferences object - */ -NS_IMETHODIMP mozSimpleContainer::Init(nsNativeWidget aNativeWidget, - PRInt32 width, PRInt32 height, - nsIPref* aPref) -{ - nsresult result; - - // Create doc shell and show it - result = nsComponentManager::CreateInstance(kWebShellCID, nsnull, - NS_GET_IID(nsIDocShell), - getter_AddRefs(mDocShell)); - - if (NS_FAILED(result) || !mDocShell) { - fprintf(stderr, "Failed to create create doc shell\n"); - return NS_ERROR_FAILURE; - } - - // We are the document loader observer for the doc shell - mDocShell->SetDocLoaderObserver(this); - - // Initialize web shell and show it - nsCOMPtr webShell(do_QueryInterface(mDocShell)); - webShell->Init(aNativeWidget, 0, 0, width, height); - - if (aPref) { - //mDocShell->SetPrefs(aPref); - } - - nsCOMPtr docShellWin(do_QueryInterface(mDocShell)); - docShellWin->SetVisibility(PR_TRUE); - - return NS_OK; -} - - -// nsIDocumentLoaderObserver interface - -NS_IMETHODIMP mozSimpleContainer::OnStartDocumentLoad( - nsIDocumentLoader *aLoader, - nsIURI *aURL, - const char *aCommand) -{ - return NS_OK; -} - - -NS_IMETHODIMP mozSimpleContainer::OnEndDocumentLoad(nsIDocumentLoader *loader, - nsIChannel *aChannel, - PRUint32 aStatus) -{ - fprintf(stderr, "mozSimpleContainer::OnEndDocumentLoad\n"); - - return NS_OK; -} - - -NS_IMETHODIMP mozSimpleContainer::OnStartURLLoad(nsIDocumentLoader *aLoader, - nsIChannel *channel) -{ - return NS_OK; -} - - -NS_IMETHODIMP mozSimpleContainer::OnProgressURLLoad(nsIDocumentLoader *aLoader, - nsIChannel *aChannel, - PRUint32 aProgress, - PRUint32 aProgressMax) -{ - return NS_OK; -} - - -NS_IMETHODIMP mozSimpleContainer::OnStatusURLLoad(nsIDocumentLoader *loader, - nsIChannel *channel, - nsString & aMsg) -{ - return NS_OK; -} - - -NS_IMETHODIMP mozSimpleContainer::OnEndURLLoad(nsIDocumentLoader *aLoader, - nsIChannel *aChannel, - PRUint32 aStatus) -{ - return NS_OK; -} - - -/** Resizes container to new dimensions - * @param width new window width (pixels) - * @param height new window height (pixels) - */ -NS_IMETHODIMP mozSimpleContainer::Resize(PRInt32 aWidth, PRInt32 aHeight) -{ - fprintf(stderr, "mozSimpleContainer::Resize\n"); - - if (!mDocShell) - return NS_ERROR_FAILURE; - - nsCOMPtr docShellWin(do_QueryInterface(mDocShell)); - docShellWin->SetPositionAndSize(0, 0, aWidth, aHeight, PR_FALSE); - - return NS_OK; -} - - -/** Loads specified URL into container - * @param aURL URL string - */ -NS_IMETHODIMP mozSimpleContainer::LoadURL(const char* aURL) -{ - nsresult result; - - if (!mDocShell) - return NS_ERROR_FAILURE; - - nsCOMPtr webShell(do_QueryInterface(mDocShell)); - - nsString aStr(aURL); - result = webShell->LoadURL(aStr.GetUnicode()); - return result; -} - - -/** Gets doc shell in container - * @param aDocShell (output) doc shell object - */ -NS_IMETHODIMP mozSimpleContainer::GetDocShell(nsIDocShell*& aDocShell) -{ - aDocShell = mDocShell.get(); - NS_IF_ADDREF(aDocShell); // Add ref'ed; needs to be released - return NS_OK; -} diff --git a/extensions/xmlterm/geckoterm/mozSimpleContainer.h b/extensions/xmlterm/geckoterm/mozSimpleContainer.h deleted file mode 100644 index 7934c93b07a0..000000000000 --- a/extensions/xmlterm/geckoterm/mozSimpleContainer.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "MPL"); you may not use this file - * except in compliance with the MPL. You may obtain a copy of - * the MPL at http://www.mozilla.org/MPL/ - * - * Software distributed under the MPL is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the MPL for the specific language governing - * rights and limitations under the MPL. - * - * The Original Code is XMLterm. - * - * The Initial Developer of the Original Code is Ramalingam Saravanan. - * Portions created by Ramalingam Saravanan are - * Copyright (C) 1999 Ramalingam Saravanan. All Rights Reserved. - * - * Contributor(s): - */ - -// mozSimpleContainer.h: declaration of mozSimpleContainer class -// implementing mozISimpleContainer, -// which provides a DocShell container for use in simple programs -// using the layout engine - -#include "nscore.h" -#include "nsCOMPtr.h" - -#include "mozISimpleContainer.h" - -class mozSimpleContainer : public mozISimpleContainer { - -public: - - mozSimpleContainer(); - virtual ~mozSimpleContainer(); - - // nsISupports - NS_DECL_ISUPPORTS - - // nsIDocumentLoaderObserver interface - NS_DECL_NSIDOCUMENTLOADEROBSERVER \ - - // other - NS_IMETHOD Init(nsNativeWidget aNativeWidget, - PRInt32 width, PRInt32 height, - nsIPref* aPref); - - NS_IMETHOD Resize(PRInt32 aWidth, PRInt32 aHeight); - - NS_IMETHOD LoadURL(const char* aURL); - - NS_IMETHOD GetDocShell(nsIDocShell*& aDocShell); - -protected: - - /** owning reference to doc shell created by us */ - nsCOMPtr mDocShell; - -}; diff --git a/extensions/xmlterm/geckoterm/nsSetupRegistry.cpp b/extensions/xmlterm/geckoterm/nsSetupRegistry.cpp deleted file mode 100644 index 4fa8ec2a7993..000000000000 --- a/extensions/xmlterm/geckoterm/nsSetupRegistry.cpp +++ /dev/null @@ -1,23 +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.0 (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 Communicator client 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. - */ - -// nsSetupRegistry.cpp: Just a copy of viewer's nSetupRegistry - -#include "../../../webshell/tests/viewer/nsSetupRegistry.cpp" - diff --git a/extensions/xmlterm/geckoterm/nsTimer.cpp b/extensions/xmlterm/geckoterm/nsTimer.cpp deleted file mode 100644 index 2bdb2c0a4ccd..000000000000 --- a/extensions/xmlterm/geckoterm/nsTimer.cpp +++ /dev/null @@ -1,198 +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.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. - */ -#include "nsITimer.h" -#include "nsITimerCallback.h" -#include "nsCRT.h" -#include "prlog.h" -#include -#include -#include - -static NS_DEFINE_IID(kITimerIID, NS_ITIMER_IID); - -extern "C" gint nsTimerExpired(gpointer aCallData); - -/* - * Implementation of timers using Gtk timer facility - */ -class TimerImpl : public nsITimer { -public: - -public: - TimerImpl(); - virtual ~TimerImpl(); - - virtual nsresult Init(nsTimerCallbackFunc aFunc, - void *aClosure, -// PRBool aRepeat, - PRUint32 aDelay); - - virtual nsresult Init(nsITimerCallback *aCallback, -// PRBool aRepeat, - PRUint32 aDelay); - - NS_DECL_ISUPPORTS - - virtual void Cancel(); - virtual PRUint32 GetDelay() { return mDelay; } - virtual void SetDelay(PRUint32 aDelay) { mDelay=aDelay; }; - virtual void* GetClosure() { return mClosure; } - - void FireTimeout(); - -private: - nsresult Init(PRUint32 aDelay); - - PRUint32 mDelay; - nsTimerCallbackFunc mFunc; - void *mClosure; - nsITimerCallback *mCallback; - // PRBool mRepeat; - TimerImpl *mNext; - guint mTimerId; -}; - -void TimerImpl::FireTimeout() -{ - if (mFunc != NULL) { - (*mFunc)(this, mClosure); - } - else if (mCallback != NULL) { - mCallback->Notify(this); // Fire the timer - } - -// Always repeating here - -// if (mRepeat) -// mTimerId = gtk_timeout_add(aDelay, nsTimerExpired, this); -} - - -TimerImpl::TimerImpl() -{ - // printf("TimerImple::TimerImpl called for %p\n", this); - NS_INIT_REFCNT(); - mFunc = NULL; - mCallback = NULL; - mNext = NULL; - mTimerId = 0; - mDelay = 0; - mClosure = NULL; -} - -TimerImpl::~TimerImpl() -{ - //printf("TimerImpl::~TimerImpl called for %p\n", this); - Cancel(); - NS_IF_RELEASE(mCallback); -} - -nsresult -TimerImpl::Init(nsTimerCallbackFunc aFunc, - void *aClosure, -// PRBool aRepeat, - PRUint32 aDelay) -{ - //printf("TimerImpl::Init called with func + closure for %p\n", this); - mFunc = aFunc; - mClosure = aClosure; - // mRepeat = aRepeat; - -// This is ancient debug code that is making it impossible to have timeouts -// greater than 10 seconds. -re - -// if ((aDelay > 10000) || (aDelay < 0)) { -// printf("Timer::Init() called with bogus value \"%d\"! Not enabling timer.\n", -// aDelay); -// return Init(aDelay); -// } - - mTimerId = gtk_timeout_add(aDelay, nsTimerExpired, this); - - return Init(aDelay); -} - -nsresult -TimerImpl::Init(nsITimerCallback *aCallback, -// PRBool aRepeat, - PRUint32 aDelay) -{ - //printf("TimerImpl::Init called with callback only for %p\n", this); - mCallback = aCallback; - NS_ADDREF(mCallback); - // mRepeat = aRepeat; - -// This is ancient debug code that is making it impossible to have timeouts -// greater than 10 seconds. -re - -// if ((aDelay > 10000) || (aDelay < 0)) { -// printf("Timer::Init() called with bogus value \"%d\"! Not enabling timer.\n", -// aDelay); -// return Init(aDelay); -// } - - mTimerId = gtk_timeout_add(aDelay, nsTimerExpired, this); - - return Init(aDelay); -} - -nsresult -TimerImpl::Init(PRUint32 aDelay) -{ - //printf("TimerImpl::Init called with delay %d only for %p\n", aDelay, this); - - mDelay = aDelay; - // NS_ADDREF(this); - - return NS_OK; -} - -NS_IMPL_ISUPPORTS(TimerImpl, kITimerIID) - - -void -TimerImpl::Cancel() -{ - //printf("TimerImpl::Cancel called for %p\n", this); - TimerImpl *me = this; - if (mTimerId) - gtk_timeout_remove(mTimerId); -} - -NS_GFXNONXP nsresult NS_NewTimer(nsITimer** aInstancePtrResult) -{ - NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); - if (nsnull == aInstancePtrResult) { - return NS_ERROR_NULL_POINTER; - } - - TimerImpl *timer = new TimerImpl(); - if (nsnull == timer) { - return NS_ERROR_OUT_OF_MEMORY; - } - - return timer->QueryInterface(kITimerIID, (void **) aInstancePtrResult); -} - -gint nsTimerExpired(gpointer aCallData) -{ - //printf("nsTimerExpired for %p\n", aCallData); - TimerImpl* timer = (TimerImpl *)aCallData; - timer->FireTimeout(); - return 0; -} diff --git a/extensions/xmlterm/scripts/Makefile.in b/extensions/xmlterm/scripts/Makefile.in index 076049a72506..9f844de0dd53 100644 --- a/extensions/xmlterm/scripts/Makefile.in +++ b/extensions/xmlterm/scripts/Makefile.in @@ -54,7 +54,6 @@ include $(srcdir)/../config/xmlterm_config.mk include $(topsrcdir)/config/rules.mk XMLTERM_SCRIPTS = \ - $(srcdir)/menuhack \ $(srcdir)/xmlterm \ $(srcdir)/xls \ $(srcdir)/xcat \ @@ -62,3 +61,16 @@ XMLTERM_SCRIPTS = \ install:: $(INSTALL) -m 555 $(XMLTERM_SCRIPTS) $(DIST)/bin + +xpi:: + zip $(DIST)/bin/xmlterm.xpi install.js + cd $(DIST); zip -g bin/xmlterm.xpi \ + bin/xcat \ + bin/xls \ + bin/xmlterm + cd $(DIST)/bin; zip -g xmlterm.xpi \ + components/libxmlterm.so \ + components/xmlterm.xpt \ + components/xmlterm-service.js + cd $(DIST)/bin; zip -g -r xmlterm.xpi chrome/packages/xmlterm + echo Created $(DIST)/bin/xmlterm.xpi diff --git a/extensions/xmlterm/ui/install.js b/extensions/xmlterm/scripts/install.js similarity index 100% rename from extensions/xmlterm/ui/install.js rename to extensions/xmlterm/scripts/install.js