diff --git a/extensions/manticore/app.cs b/extensions/manticore/app.cs
new file mode 100644
index 000000000000..2aeb4bcaee00
--- /dev/null
+++ b/extensions/manticore/app.cs
@@ -0,0 +1,41 @@
+
+namespace Silverstone.Manticore.App
+{
+ using System;
+ using System.ComponentModel;
+ using System.Windows.Forms;
+ using System.Collections;
+
+ using Silverstone.Manticore.BrowserWindow;
+
+ public class ManticoreApp
+ {
+ // XXX Need to do something here more similar
+ // to what mozilla does here for parameterized
+ // window types.
+ private Queue browserWindows;
+
+ public ManticoreApp()
+ {
+ browserWindows = new Queue();
+
+ OpenNewBrowser();
+
+ Application.Run();
+ }
+
+ // Opens and displays a new browser window
+ public void OpenNewBrowser()
+ {
+ BrowserWindow window = new BrowserWindow(this);
+ browserWindows.Enqueue(window);
+ window.Show();
+ }
+
+ public static void Main(string[] args)
+ {
+ ManticoreApp app = new ManticoreApp();
+ }
+ }
+}
+
diff --git a/extensions/manticore/browser/aboutdialog.cs b/extensions/manticore/browser/aboutdialog.cs
new file mode 100644
index 000000000000..59ebf58ff90a
--- /dev/null
+++ b/extensions/manticore/browser/aboutdialog.cs
@@ -0,0 +1,59 @@
+
+namespace Silverstone.Manticore.AboutDialog
+{
+ using System;
+ using System.ComponentModel;
+ using System.Drawing;
+ using System.Windows.Forms;
+
+ public class AboutDialog : System.Windows.Forms.Form
+ {
+ private System.ComponentModel.Container components;
+
+ private Form parentWindow;
+
+ public AboutDialog(Form parent)
+ {
+ parentWindow = parent;
+
+ InitializeComponent();
+
+ // Show the about dialog modally.
+ this.ShowDialog();
+
+ }
+
+ public override void Dispose()
+ {
+ base.Dispose();
+ components.Dispose();
+ }
+
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+
+ this.Width = 253;
+ this.Height = 195;
+
+ this.Left = parentWindow.Left + ((parentWindow.Width / 2) - (this.Width / 2));
+ this.Top = parentWindow.Top + ((parentWindow.Height / 2) - (this.Height / 2));
+
+ // Borderless dialog
+ this.FormBorderStyle = FormBorderStyle.None;
+
+ this.BackgroundImage = Image.FromFile("manticore.png");
+
+ this.Text = "About Manticore"; // XXX localize
+
+ this.Click += new EventHandler(this.CloseAboutDialog);
+ }
+
+ public void CloseAboutDialog(Object sender, EventArgs e)
+ {
+ this.Close();
+ }
+ }
+}
+
+
diff --git a/extensions/manticore/browser/browser-menu.xml b/extensions/manticore/browser/browser-menu.xml
new file mode 100644
index 000000000000..b3fc77b6612e
--- /dev/null
+++ b/extensions/manticore/browser/browser-menu.xml
@@ -0,0 +1,109 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/extensions/manticore/browser/browser-toolbar.xml b/extensions/manticore/browser/browser-toolbar.xml
new file mode 100644
index 000000000000..54a0c3f38f99
--- /dev/null
+++ b/extensions/manticore/browser/browser-toolbar.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/extensions/manticore/browser/browserwindow.cs b/extensions/manticore/browser/browserwindow.cs
new file mode 100644
index 000000000000..d403c2b744f0
--- /dev/null
+++ b/extensions/manticore/browser/browserwindow.cs
@@ -0,0 +1,135 @@
+
+namespace Silverstone.Manticore.BrowserWindow
+{
+ using System;
+ using System.ComponentModel;
+ using System.Drawing;
+ using System.Windows.Forms;
+
+ using Silverstone.Manticore.App;
+ using Silverstone.Manticore.Toolkit.Menus;
+ using Silverstone.Manticore.AboutDialog;
+ using Silverstone.Manticore.OpenDialog;
+
+ using Silverstone.Manticore.LayoutAbstraction;
+
+ public class BrowserWindow : System.Windows.Forms.Form
+ {
+ private System.ComponentModel.Container components;
+
+ protected internal BrowserMenuBuilder menuBuilder;
+ protected internal WebBrowser webBrowser;
+
+ protected internal StatusBar statusBar;
+
+ protected internal ManticoreApp application;
+
+ public BrowserWindow(ManticoreApp app)
+ {
+ application = app;
+
+ // Set up UI
+ InitializeComponent();
+
+ // Perform post-window show startup tasks
+ LayoutStartup();
+ }
+
+ public override void Dispose()
+ {
+ base.Dispose();
+ components.Dispose();
+ }
+
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+
+ // XXX read these from a settings file
+ this.Width = 640;
+ this.Height = 480;
+
+ this.Text = "Manticore"; // XXX localize
+
+ menuBuilder = new BrowserMenuBuilder("browser\\browser-menu.xml", this);
+ menuBuilder.Build();
+ this.Menu = menuBuilder.mainMenu;
+
+ // Show the resize handle
+ this.SizeGripStyle = SizeGripStyle.Auto;
+
+ webBrowser = new WebBrowser();
+ this.Controls.Add(webBrowser);
+
+ // Set up the Status Bar
+ statusBar = new StatusBar();
+
+ StatusBarPanel docStatePanel = new StatusBarPanel();
+ StatusBarPanel statusPanel = new StatusBarPanel();
+ StatusBarPanel progressPanel = new StatusBarPanel();
+ StatusBarPanel zonePanel = new StatusBarPanel();
+
+ docStatePanel.Text = "X";
+ progressPanel.Text = "[||||| ]";
+ zonePanel.Text = "Internet Region";
+ statusPanel.Text = "Document Done";
+ statusPanel.AutoSize = StatusBarPanelAutoSize.Spring;
+
+ statusBar.Panels.AddRange(new StatusBarPanel[] {docStatePanel, statusPanel, progressPanel, zonePanel});
+ statusBar.ShowPanels = true;
+
+ this.Controls.Add(statusBar);
+ }
+
+ private void LayoutStartup()
+ {
+ // XXX - add a pref to control this, blank, or last page visited.
+ // Visit the homepage
+ String homepageURL = "http://www.silverstone.net.nz/";
+ webBrowser.LoadURL(homepageURL, false);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Menu Command Handlers
+ public void OpenNewBrowser()
+ {
+ application.OpenNewBrowser();
+ }
+
+ public void Open()
+ {
+ OpenDialog dlg = new OpenDialog(0);
+ if (dlg.ShowDialog() == DialogResult.OK)
+ Console.WriteLine(dlg.URL);
+ }
+ }
+
+ public class BrowserMenuBuilder : MenuBuilder
+ {
+ private BrowserWindow browserWindow;
+
+ public BrowserMenuBuilder(String file, BrowserWindow window) : base(file)
+ {
+ browserWindow = window;
+ }
+
+ public override void OnCommand(Object sender, EventArgs e)
+ {
+ CommandMenuItem menuitem = (CommandMenuItem) sender;
+ Console.WriteLine(menuitem.Command);
+ switch (menuitem.Command) {
+ case "file-new-window":
+ browserWindow.OpenNewBrowser();
+ break;
+ case "file-open":
+ browserWindow.Open();
+ break;
+ case "help-about":
+ AboutDialog dlg = new AboutDialog(browserWindow);
+ break;
+ }
+ }
+ }
+}
+
+
diff --git a/extensions/manticore/layout/layoutabstraction.cs b/extensions/manticore/layout/layoutabstraction.cs
new file mode 100644
index 000000000000..fe5477508b86
--- /dev/null
+++ b/extensions/manticore/layout/layoutabstraction.cs
@@ -0,0 +1,76 @@
+namespace Silverstone.Manticore.LayoutAbstraction
+{
+ using System;
+ using Microsoft.Win32;
+ using System.Drawing;
+ using System.ComponentModel;
+ using System.Windows.Forms;
+ using System.Runtime.InteropServices;
+
+ // Trident
+ using AxSHDocVw;
+ using MSHTML;
+
+ // Gecko
+ using AxMOZILLACONTROLLib;
+ using MOZILLACONTROLLib;
+
+ public class WebBrowser : ContainerControl
+ {
+ private IWebBrowser2 browser;
+
+ public WebBrowser()
+ {
+ InitializeComponent();
+ }
+
+ private void InitializeComponent()
+ {
+ // XXX - remember this setting in a pref
+ SwitchLayoutEngine("gecko");
+
+ this.Dock = DockStyle.Fill;
+ }
+
+ public void SwitchLayoutEngine(String id)
+ {
+ AxHost host;
+ switch (id) {
+ case "trident":
+ host = new AxWebBrowser() as AxHost;
+ break;
+ default:
+ host = new AxMozillaBrowser() as AxHost;
+ break;
+ }
+
+ host.BeginInit();
+ host.Size = new Size(600, 200);
+ host.TabIndex = 1;
+ host.Dock = DockStyle.Fill;
+ host.EndInit();
+ this.Controls.Add(host);
+
+ browser = host as IWebBrowser2;
+ }
+
+ public void LoadURL(String url, Boolean bypassCache)
+ {
+ // XXX - neither IE nor Mozilla implement all of the
+ // load flags properly. Mozilla should at least be
+ // made to support ignore-cache and ignore-history.
+ // This will require modification to the ActiveX
+ // control.
+ Object o = null;
+// browser.Navigate(url, ref o, ref o, ref o, ref o);
+ }
+
+ public void GoHome()
+ {
+ // XXX - need to implement "Home" preference
+ browser.GoHome();
+ }
+ }
+
+
+}
\ No newline at end of file
diff --git a/extensions/manticore/makefile.win b/extensions/manticore/makefile.win
new file mode 100644
index 000000000000..73ad32f65c81
--- /dev/null
+++ b/extensions/manticore/makefile.win
@@ -0,0 +1,49 @@
+DEPTH=..\..
+
+include <$(DEPTH)\config\config.mak>
+
+#--------------------------------------------------
+CLEANUP = *.exe *.pdb
+#--------------------------------------------------
+
+DEBUG=FALSE
+
+_CS_WINFORMS_IMPORTS=/R:System.DLL /R:System.Windows.Forms.DLL \
+ /R:System.Drawing.DLL
+_CS_XML_IMPORTS=/R:System.DLL /R:System.Data.DLL /R:System.XML.DLL
+_CS_LAYOUT_IMPORTS=/R:AxSHDocVw.DLL /R:MSHTML.DLL /R:AxMOZILLACONTROLLib.DLL /R:MOZILLACONTROLLib.dll
+
+_IMPORTS=$(_CS_WINFORMS_IMPORTS) $(_CS_XMLIMPORTS) $(_CS_LAYOUT_IMPORTS)
+
+_COMPILE_CMD=csc /nologo /t:exe /debug+ $(_IMPORTS)
+
+FILES = app.cs \
+ browser\browserwindow.cs \
+ toolkit\toolkit.menus.cs \
+ browser\aboutdialog.cs \
+ layout\layoutabstraction.cs \
+ browser\opendialog.cs
+
+SUBDIR = WIN32_O.OBJ
+!if defined(MOZ_DEBUG)
+SUBDIR = WIN32_D.OBJ
+!endif
+
+
+app:
+ $(_COMPILE_CMD) $(FILES)
+
+bindings:
+ aximp c:\WINNT\system32\shdocvw.dll
+ tlbimp mshtml.tlb
+ aximp $(MOZ_SRC)\mozilla\dist\$(SUBDIR)\bin\mozctl.dll
+ tlbimp $(MOZ_SRC)\mozilla\dist\$(SUBDIR)\bin\mozctl.dll
+
+# XXX fix me
+clean:
+ for %i in ( $(CLEANUP) ) do del %i
+
+#--------------------------------------------------
+
+
+
diff --git a/extensions/manticore/resources/manticore.png b/extensions/manticore/resources/manticore.png
new file mode 100644
index 000000000000..d9cbce77ec66
Binary files /dev/null and b/extensions/manticore/resources/manticore.png differ
diff --git a/extensions/manticore/resources/manticore.psd b/extensions/manticore/resources/manticore.psd
new file mode 100644
index 000000000000..d028e57c1c68
Binary files /dev/null and b/extensions/manticore/resources/manticore.psd differ
diff --git a/extensions/manticore/toolkit/toolkit.menus.cs b/extensions/manticore/toolkit/toolkit.menus.cs
new file mode 100644
index 000000000000..f434905c05f1
--- /dev/null
+++ b/extensions/manticore/toolkit/toolkit.menus.cs
@@ -0,0 +1,114 @@
+
+namespace Silverstone.Manticore.Toolkit.Menus
+{
+ using System;
+ using System.ComponentModel;
+ using System.Drawing;
+ using System.Windows.Forms;
+
+ using System.Collections;
+
+ using System.IO;
+ using System.Xml;
+
+ public class MenuBuilder
+ {
+ protected internal String menuDefinitionFile;
+
+ public MainMenu mainMenu;
+ public Hashtable items;
+
+ public MenuBuilder(String file)
+ {
+ menuDefinitionFile = file;
+ mainMenu = new MainMenu();
+ items = new Hashtable();
+ }
+
+ public void Build()
+ {
+ XmlTextReader reader;
+ reader = new XmlTextReader(menuDefinitionFile);
+
+ reader.WhitespaceHandling = WhitespaceHandling.None;
+ reader.MoveToContent();
+
+ Recurse(reader, mainMenu);
+ }
+
+ protected void Recurse(XmlTextReader reader, Menu root)
+ {
+ String inner = reader.ReadInnerXml();
+
+ NameTable nt = new NameTable();
+ XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt);
+ XmlParserContext ctxt = new XmlParserContext(null, nsmgr, null, XmlSpace.None);
+ XmlTextReader reader2 = new XmlTextReader(inner, XmlNodeType.Element, ctxt);
+
+ MenuItem menuitem;
+
+ while (reader2.Read()) {
+ if (reader2.NodeType == XmlNodeType.Element) {
+ switch (reader2.LocalName) {
+ case "menu":
+ // Menuitem. Find the name, accesskey, command and id strings
+ String[] values = new String[3] {"", "", ""};
+ String[] names = new String[3] {"label", "accesskey", "command"};
+ for (Byte i = 0; i < names.Length; ++i) {
+ if (reader2.MoveToAttribute(names[i]) &&
+ reader2.ReadAttributeValue())
+ values[i] = reader2.Value; // XXX need to handle entities
+ reader2.MoveToElement();
+ }
+
+ // Handle Accesskey
+ int idx = values[0].ToLower().IndexOf(values[1].ToLower());
+ if (idx != -1)
+ values[0] = values[0].Insert(idx, "&");
+ else
+ values[0] += " (&" + values[1].ToUpper() + ")";
+
+ // Create menu item and attach an event handler
+ menuitem = new CommandMenuItem(values[0],
+ new EventHandler(OnCommand),
+ values[2]);
+ if (values[2] != "")
+ items.Add(values[2], menuitem);
+ root.MenuItems.Add(menuitem);
+ Recurse(reader2, menuitem);
+ break;
+ case "menuseparator":
+ menuitem = new MenuItem("-");
+ root.MenuItems.Add(menuitem);
+ break;
+ }
+ }
+ }
+ }
+
+ public virtual void OnCommand(Object sender, EventArgs e)
+ {
+ // Implement in derived classes
+ }
+ }
+
+ public class CommandMenuItem : MenuItem
+ {
+ private string command;
+ public string Command
+ {
+ get {
+ return command;
+ }
+ }
+
+ public CommandMenuItem(String label,
+ EventHandler handler,
+ String cmd) : base(label, handler)
+ {
+ command = cmd;
+ }
+ }
+}
+
+
diff --git a/extensions/manticore/toolkit/toolkit.toolbars.cs b/extensions/manticore/toolkit/toolkit.toolbars.cs
new file mode 100644
index 000000000000..86520f38e31a
--- /dev/null
+++ b/extensions/manticore/toolkit/toolkit.toolbars.cs
@@ -0,0 +1,117 @@
+
+namespace Silverstone.Manticore.Toolkit.Toolbars
+{
+ using System;
+ using System.ComponentModel;
+ using System.Drawing;
+ using System.Windows.Forms;
+
+ using System.Collections;
+
+ using System.IO;
+ using System.Xml;
+
+ public class MToolbox : ContainerControl
+ {
+
+ }
+
+ public class MToolstrip : ContainerControl
+ {
+
+ }
+
+ public class MToolbar : ContainerControl
+ {
+
+ }
+
+ public class MToolbarButton : ToolbarButton
+ {
+
+ }
+
+ public class ToolbarBuilder
+ {
+ protected internal String toolbarDefinitionFile;
+
+ public MToolbox toolbox;
+ public Hashtable items;
+
+ public ToolbarBuilder(String file)
+ {
+ toolbarDefinitionFile = file;
+ toolbox = new MToolbox();
+ items = new Hashtable();
+ }
+
+ public void Build()
+ {
+ XmlTextReader reader;
+ reader = new XmlTextReader(toolbarDefinitionFile);
+
+ reader.WhitespaceHandling = WhitespaceHandling.None;
+ reader.MoveToContent();
+
+ Recurse(reader, toolbox);
+ }
+
+ protected void Recurse(XmlTextReader reader, Menu root)
+ {
+ String inner = reader.ReadInnerXml();
+
+ NameTable nt = new NameTable();
+ XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt);
+ XmlParserContext ctxt = new XmlParserContext(null, nsmgr, null, XmlSpace.None);
+ XmlTextReader reader2 = new XmlTextReader(inner, XmlNodeType.Element, ctxt);
+
+ MenuItem menuitem;
+
+ while (reader2.Read()) {
+ if (reader2.NodeType == XmlNodeType.Element) {
+ switch (reader2.LocalName) {
+ case "menu":
+ // Menuitem. Find the name, accesskey, command and id strings
+ String[] values = new String[3] {"", "", ""};
+ String[] names = new String[3] {"label", "accesskey", "command"};
+ for (Byte i = 0; i < names.Length; ++i) {
+ if (reader2.MoveToAttribute(names[i]) &&
+ reader2.ReadAttributeValue())
+ values[i] = reader2.Value; // XXX need to handle entities
+ reader2.MoveToElement();
+ }
+
+ // Handle Accesskey
+ int idx = values[0].ToLower().IndexOf(values[1].ToLower());
+ if (idx != -1)
+ values[0] = values[0].Insert(idx, "&");
+ else
+ values[0] += " (&" + values[1].ToUpper() + ")";
+
+ // Create menu item and attach an event handler
+ menuitem = new CommandMenuItem(values[0],
+ new EventHandler(OnCommand),
+ values[2]);
+ if (values[2] != "")
+ items.Add(values[2], menuitem);
+ root.MenuItems.Add(menuitem);
+ Recurse(reader2, menuitem);
+ break;
+ case "menuseparator":
+ menuitem = new MenuItem("-");
+ root.MenuItems.Add(menuitem);
+ break;
+ }
+ }
+ }
+ }
+
+ public virtual void OnCommand(Object sender, EventArgs e)
+ {
+ // Implement in derived classes
+ }
+
+
+ }
+}
+