mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-03 20:49:27 +00:00
[Not part of build]
- more preferences dialog work - making a preferences panel class for handling of loading data from preferences and saving it again. - preferences category tree generation from XML - general tidy up. - making Quit work properly so that we can shut down cleanly.
This commit is contained in:
parent
566be413ad
commit
50334e7566
@ -59,24 +59,36 @@
|
||||
</Settings>
|
||||
<References>
|
||||
<Reference
|
||||
Name = "System"
|
||||
AssemblyName = "System"
|
||||
Name = "MSHTML"
|
||||
AssemblyName = "MSHTML"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.Data"
|
||||
AssemblyName = "System.Data"
|
||||
Name = "AxSHDocVw"
|
||||
AssemblyName = "AxSHDocVw"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.Drawing"
|
||||
AssemblyName = "System.Drawing"
|
||||
Name = "MOZILLACONTROLLib"
|
||||
AssemblyName = "MOZILLACONTROLLib"
|
||||
/>
|
||||
<Reference
|
||||
Name = "AxMOZILLACONTROLLib"
|
||||
AssemblyName = "AxMOZILLACONTROLLib"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.Windows.Forms"
|
||||
AssemblyName = "System.Windows.Forms"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.XML"
|
||||
AssemblyName = "System.Xml"
|
||||
Name = "System.Data"
|
||||
AssemblyName = "System.Data"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System"
|
||||
AssemblyName = "System"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.Drawing"
|
||||
AssemblyName = "System.Drawing"
|
||||
/>
|
||||
</References>
|
||||
</Build>
|
||||
@ -105,6 +117,16 @@
|
||||
SubType = "Form"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "browser\BrowserDisplayPanel.cs"
|
||||
SubType = "Component"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "browser\BrowserDisplayPanel.resx"
|
||||
DependentUpon = "BrowserDisplayPanel.cs"
|
||||
BuildAction = "EmbeddedResource"
|
||||
/>
|
||||
<File
|
||||
RelPath = "browser\browser-menu.xml"
|
||||
BuildAction = "Content"
|
||||
@ -133,6 +155,20 @@
|
||||
DependentUpon = "OpenLocDialog.cs"
|
||||
BuildAction = "EmbeddedResource"
|
||||
/>
|
||||
<File
|
||||
RelPath = "browser\PrefPanel.cs"
|
||||
SubType = "Component"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "browser\PrefPanel.resx"
|
||||
DependentUpon = "PrefPanel.cs"
|
||||
BuildAction = "EmbeddedResource"
|
||||
/>
|
||||
<File
|
||||
RelPath = "browser\PrefPanels.xml"
|
||||
BuildAction = "Content"
|
||||
/>
|
||||
<File
|
||||
RelPath = "browser\PrefsDialog.cs"
|
||||
SubType = "Form"
|
||||
@ -160,7 +196,7 @@
|
||||
/>
|
||||
<File
|
||||
RelPath = "layout\layoutabstraction.cs"
|
||||
SubType = "Component"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
@ -188,7 +224,7 @@
|
||||
/>
|
||||
<File
|
||||
RelPath = "toolkit\toolkit.toolbars.cs"
|
||||
SubType = "Component"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
</Include>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<VisualStudioProject>
|
||||
<CSHARP>
|
||||
<Build>
|
||||
<Settings ReferencePath = "" >
|
||||
<Settings ReferencePath = "C:\WINNT\Microsoft.NET\Framework\v1.0.2914;C:\builds\mozilla\extensions\manticore;" >
|
||||
<Config
|
||||
Name = "Debug"
|
||||
EnableASPDebugging = "false"
|
||||
|
@ -15,7 +15,7 @@ namespace Silverstone.Manticore.App
|
||||
// XXX Need to do something here more similar
|
||||
// to what mozilla does here for parameterized
|
||||
// window types.
|
||||
private Queue mBrowserWindows;
|
||||
private Hashtable mBrowserWindows;
|
||||
private Preferences mPreferences;
|
||||
private Bookmarks mBookmarks;
|
||||
|
||||
@ -33,7 +33,7 @@ namespace Silverstone.Manticore.App
|
||||
|
||||
public ManticoreApp()
|
||||
{
|
||||
mBrowserWindows = new Queue();
|
||||
mBrowserWindows = new Hashtable();
|
||||
|
||||
// Initialize default and user preferences
|
||||
mPreferences = new Preferences();
|
||||
@ -49,17 +49,31 @@ namespace Silverstone.Manticore.App
|
||||
Application.Run();
|
||||
}
|
||||
|
||||
~ManticoreApp()
|
||||
public void Quit()
|
||||
{
|
||||
// Flush preferences to disk.
|
||||
mPreferences.FlushPreferencesFile("user-prefs.xml");
|
||||
|
||||
Application.Exit();
|
||||
}
|
||||
|
||||
public void WindowClosed(BrowserWindow aWindow)
|
||||
{
|
||||
if (mBrowserWindows.ContainsKey(aWindow.GetHashCode()))
|
||||
mBrowserWindows.Remove(aWindow.GetHashCode());
|
||||
|
||||
// When window count drops to zero, quit.
|
||||
// XXX - a little hacky for now, will eventually reflect
|
||||
// all windows.
|
||||
if (mBrowserWindows.Count == 0)
|
||||
Quit();
|
||||
}
|
||||
|
||||
// Opens and displays a new browser window
|
||||
public void OpenNewBrowser()
|
||||
{
|
||||
BrowserWindow window = new BrowserWindow(this);
|
||||
mBrowserWindows.Enqueue(window);
|
||||
mBrowserWindows.Add(window.GetHashCode(), window);
|
||||
window.Show();
|
||||
}
|
||||
|
||||
|
188
extensions/manticore/browser/BrowserDisplayPanel.cs
Normal file
188
extensions/manticore/browser/BrowserDisplayPanel.cs
Normal file
@ -0,0 +1,188 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Silverstone.Manticore.Browser
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for BrowserDisplayPanel.
|
||||
/// </summary>
|
||||
public class BrowserDisplayPanel : PrefPanel
|
||||
{
|
||||
private GroupBox groupBox1;
|
||||
private Button button2;
|
||||
private Label label2;
|
||||
private Button button1;
|
||||
private TextBox textBox1;
|
||||
private Label label1;
|
||||
private GroupBox groupBox2;
|
||||
private Button restoreSessionSettingsButton;
|
||||
private RadioButton radioButton3;
|
||||
private RadioButton radioButton2;
|
||||
private RadioButton radioButton1;
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.Container components = null;
|
||||
|
||||
public BrowserDisplayPanel()
|
||||
{
|
||||
// This call is required by the Windows.Forms Form Designer.
|
||||
InitializeComponent();
|
||||
|
||||
Console.WriteLine("Done initializeing browser display panel");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
protected override void Dispose( bool disposing )
|
||||
{
|
||||
if( disposing )
|
||||
{
|
||||
if(components != null)
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
}
|
||||
base.Dispose( disposing );
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.restoreSessionSettingsButton = new System.Windows.Forms.Button();
|
||||
this.radioButton3 = new System.Windows.Forms.RadioButton();
|
||||
this.radioButton2 = new System.Windows.Forms.RadioButton();
|
||||
this.radioButton1 = new System.Windows.Forms.RadioButton();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.AddRange(new System.Windows.Forms.Control[] {
|
||||
this.button2,
|
||||
this.label2,
|
||||
this.button1,
|
||||
this.textBox1,
|
||||
this.label1});
|
||||
this.groupBox1.Location = new System.Drawing.Point(8, 112);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(312, 104);
|
||||
this.groupBox1.TabIndex = 0;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Home Page";
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Location = new System.Drawing.Point(136, 72);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.TabIndex = 4;
|
||||
this.button2.Text = "Use Current";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.Location = new System.Drawing.Point(8, 48);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(56, 16);
|
||||
this.label2.TabIndex = 3;
|
||||
this.label2.Text = "Location:";
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(221, 72);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(75, 24);
|
||||
this.button1.TabIndex = 2;
|
||||
this.button1.Text = "Browse...";
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Location = new System.Drawing.Point(64, 48);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(232, 20);
|
||||
this.textBox1.TabIndex = 1;
|
||||
this.textBox1.Text = "http://www.silverstone.net.nz/";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.Location = new System.Drawing.Point(8, 24);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(280, 16);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "Clicking the Home button takes you to this page:";
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Controls.AddRange(new System.Windows.Forms.Control[] {
|
||||
this.restoreSessionSettingsButton,
|
||||
this.radioButton3,
|
||||
this.radioButton2,
|
||||
this.radioButton1});
|
||||
this.groupBox2.Location = new System.Drawing.Point(8, 0);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(312, 104);
|
||||
this.groupBox2.TabIndex = 1;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "When Manticore starts, ";
|
||||
//
|
||||
// restoreSessionSettingsButton
|
||||
//
|
||||
this.restoreSessionSettingsButton.Location = new System.Drawing.Point(224, 72);
|
||||
this.restoreSessionSettingsButton.Name = "restoreSessionSettingsButton";
|
||||
this.restoreSessionSettingsButton.TabIndex = 3;
|
||||
this.restoreSessionSettingsButton.Text = "Settings...";
|
||||
//
|
||||
// radioButton3
|
||||
//
|
||||
this.radioButton3.Location = new System.Drawing.Point(16, 72);
|
||||
this.radioButton3.Name = "radioButton3";
|
||||
this.radioButton3.Size = new System.Drawing.Size(152, 16);
|
||||
this.radioButton3.TabIndex = 2;
|
||||
this.radioButton3.Text = "Restore previous session";
|
||||
//
|
||||
// radioButton2
|
||||
//
|
||||
this.radioButton2.Location = new System.Drawing.Point(16, 48);
|
||||
this.radioButton2.Name = "radioButton2";
|
||||
this.radioButton2.Size = new System.Drawing.Size(112, 16);
|
||||
this.radioButton2.TabIndex = 1;
|
||||
this.radioButton2.Text = "Show blank page";
|
||||
//
|
||||
// radioButton1
|
||||
//
|
||||
this.radioButton1.Location = new System.Drawing.Point(16, 24);
|
||||
this.radioButton1.Name = "radioButton1";
|
||||
this.radioButton1.Size = new System.Drawing.Size(120, 16);
|
||||
this.radioButton1.TabIndex = 0;
|
||||
this.radioButton1.Text = "Show home page";
|
||||
//
|
||||
// BrowserDisplayPanel
|
||||
//
|
||||
this.Controls.AddRange(new System.Windows.Forms.Control[] { this.groupBox1,
|
||||
this.groupBox2});
|
||||
this.Name = "BrowserDisplayPanel";
|
||||
this.Size = new System.Drawing.Size(320, 280);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
45
extensions/manticore/browser/BrowserDisplayPanel.resx
Normal file
45
extensions/manticore/browser/BrowserDisplayPanel.resx
Normal file
@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<xsd:schema id="root" targetNamespace="" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<data name="$this.Name">
|
||||
<value>BrowserDisplayPanel</value>
|
||||
</data>
|
||||
<resheader name="ResMimeType">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="Version">
|
||||
<value>1.0.0.0</value>
|
||||
</resheader>
|
||||
<resheader name="Reader">
|
||||
<value>System.Resources.ResXResourceReader</value>
|
||||
</resheader>
|
||||
<resheader name="Writer">
|
||||
<value>System.Resources.ResXResourceWriter</value>
|
||||
</resheader>
|
||||
</root>
|
@ -57,8 +57,18 @@ namespace Silverstone.Manticore.Browser
|
||||
{
|
||||
// This call is required by the Windows.Forms Form Designer.
|
||||
InitializeComponent();
|
||||
|
||||
Console.WriteLine("Pref panel startup");
|
||||
|
||||
this.VisibleChanged += new EventHandler(OnVisibleChanged);
|
||||
// All preferences panels have these properties initially.
|
||||
this.Location = new System.Drawing.Point(160, 16);
|
||||
this.Size = new System.Drawing.Size(320, 264);
|
||||
this.TabIndex = 1;
|
||||
this.Visible = false;
|
||||
|
||||
// When the preference panel is shown for the first time, we
|
||||
// need to fill its fields from preferences.
|
||||
this.VisibleChanged += new EventHandler(VisibilityChanged);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -66,8 +76,9 @@ namespace Silverstone.Manticore.Browser
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
public void OnVisibleChanged(Object sender, EventArgs e)
|
||||
public void VisibilityChanged(Object sender, EventArgs e)
|
||||
{
|
||||
Console.WriteLine("Visibility changed!");
|
||||
if (!mGenerated) {
|
||||
// The first time we display the panel, read the values
|
||||
// for UI elements from preferences and fill the controls.
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
|
||||
<panels xmlns="http://www.silverstone.net.nz/2001/manticore/uidl">
|
||||
<panels label="Web Browser">
|
||||
<panel label="Browser Display" id="browser"/>
|
||||
</panels>
|
||||
<panel label="Web Browser">
|
||||
<panel label="Browser Display" id="browser-display"/>
|
||||
</panel>
|
||||
</panels>
|
||||
|
||||
|
@ -39,7 +39,10 @@ namespace Silverstone.Manticore.Browser
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
|
||||
using Silverstone.Manticore.Toolkit;
|
||||
|
||||
/// <summary>
|
||||
@ -48,25 +51,17 @@ namespace Silverstone.Manticore.Browser
|
||||
public class PrefsDialog : ManticoreDialog
|
||||
{
|
||||
private System.Windows.Forms.TreeView treeView1;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.Button cancelButton;
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Button button2;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private System.Windows.Forms.RadioButton radioButton1;
|
||||
private System.Windows.Forms.RadioButton radioButton2;
|
||||
private System.Windows.Forms.RadioButton radioButton3;
|
||||
private System.Windows.Forms.Button restoreSessionSettingsButton;
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.Container components = null;
|
||||
|
||||
private Hashtable mNodes = null;
|
||||
private Hashtable mPanels = null;
|
||||
private PrefPanel mCurrentPanel = null;
|
||||
|
||||
public PrefsDialog(Form aOpener) : base(aOpener)
|
||||
{
|
||||
//
|
||||
@ -74,10 +69,118 @@ namespace Silverstone.Manticore.Browser
|
||||
//
|
||||
InitializeComponent();
|
||||
|
||||
mNodes = new Hashtable();
|
||||
mPanels = new Hashtable();
|
||||
|
||||
//
|
||||
// Initialize all the preference panels.
|
||||
//
|
||||
InitializePanels();
|
||||
|
||||
// Add select handler for tree view so that we can
|
||||
// switch panels.
|
||||
treeView1.AfterSelect += new TreeViewEventHandler(OnTreeSelect);
|
||||
|
||||
//
|
||||
// Initialize the category list.
|
||||
//
|
||||
InitializeCategoryList();
|
||||
|
||||
// XXX - eventually we want to remember user state. This will do
|
||||
// for now.
|
||||
treeView1.ExpandAll();
|
||||
}
|
||||
|
||||
public void OnTreeSelect(Object sender, TreeViewEventArgs e)
|
||||
{
|
||||
TreeNode selectedNode = e.Node;
|
||||
String panelID = mNodes[selectedNode.GetHashCode()] as String;
|
||||
PrefPanel newPanel = mPanels[panelID] as PrefPanel;
|
||||
if (mCurrentPanel != null)
|
||||
mCurrentPanel.Visible = false;
|
||||
if (newPanel != null) {
|
||||
Console.WriteLine("toggling visibility of panel");
|
||||
newPanel.Visible = true;
|
||||
mCurrentPanel = newPanel;
|
||||
}
|
||||
else {
|
||||
if (selectedNode.FirstNode != null) {
|
||||
TreeView treeview = sender as TreeView;
|
||||
treeview.SelectedNode = selectedNode.FirstNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create all the preferences panels.
|
||||
/// </summary>
|
||||
public void InitializePanels()
|
||||
{
|
||||
BrowserDisplayPanel bdp = new BrowserDisplayPanel();
|
||||
mPanels.Add("browser-display", bdp);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load the category list from XML and select the initial
|
||||
/// panel.
|
||||
/// </summary>
|
||||
private void InitializeCategoryList()
|
||||
{
|
||||
mNodes = new Hashtable();
|
||||
|
||||
XmlTextReader reader;
|
||||
reader = new XmlTextReader("browser\\PrefPanels.xml");
|
||||
|
||||
reader.WhitespaceHandling = WhitespaceHandling.None;
|
||||
reader.MoveToContent();
|
||||
|
||||
CatListRecurse(reader, treeView1);
|
||||
}
|
||||
|
||||
private void CatListRecurse(XmlTextReader aReader, Object aRootNode)
|
||||
{
|
||||
String inner = aReader.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);
|
||||
|
||||
TreeNode node;
|
||||
|
||||
while (reader2.Read()) {
|
||||
if (reader2.NodeType == XmlNodeType.Element) {
|
||||
switch (reader2.LocalName) {
|
||||
case "panel":
|
||||
// Tree node with children. Retrieve label and id. Label is
|
||||
// used for visual presentation, id is hashed against node
|
||||
// and is used as a key when looking for which panel to
|
||||
// load.
|
||||
String[] values = new String[2] {"", ""};
|
||||
String[] names = new String[2] {"label", "id"};
|
||||
for (int i = 0; i < names.Length; ++i) {
|
||||
if (reader2.MoveToAttribute(names[i]) &&
|
||||
reader2.ReadAttributeValue())
|
||||
values[i] = reader2.Value;
|
||||
reader2.MoveToElement();
|
||||
}
|
||||
|
||||
node = new TreeNode(values[0], 0, 0);
|
||||
if (aRootNode is TreeView) {
|
||||
TreeView rootView = aRootNode as TreeView;
|
||||
rootView.Nodes.Add(node);
|
||||
}
|
||||
else if (aRootNode is TreeNode) {
|
||||
TreeNode rootNode = aRootNode as TreeNode;
|
||||
rootNode.Nodes.Add(node);
|
||||
}
|
||||
|
||||
mNodes.Add(node.GetHashCode(), values[1]);
|
||||
CatListRecurse(reader2, node);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -102,57 +205,11 @@ namespace Silverstone.Manticore.Browser
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.radioButton3 = new System.Windows.Forms.RadioButton();
|
||||
this.restoreSessionSettingsButton = new System.Windows.Forms.Button();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.radioButton1 = new System.Windows.Forms.RadioButton();
|
||||
this.treeView1 = new System.Windows.Forms.TreeView();
|
||||
this.radioButton2 = new System.Windows.Forms.RadioButton();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.panel1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(221, 72);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(75, 24);
|
||||
this.button1.TabIndex = 2;
|
||||
this.button1.Text = "Browse...";
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Location = new System.Drawing.Point(136, 72);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.TabIndex = 4;
|
||||
this.button2.Text = "Use Current";
|
||||
//
|
||||
// radioButton3
|
||||
//
|
||||
this.radioButton3.Location = new System.Drawing.Point(16, 72);
|
||||
this.radioButton3.Name = "radioButton3";
|
||||
this.radioButton3.Size = new System.Drawing.Size(152, 16);
|
||||
this.radioButton3.TabIndex = 2;
|
||||
this.radioButton3.Text = "Restore previous session";
|
||||
//
|
||||
// restoreSessionSettingsButton
|
||||
//
|
||||
this.restoreSessionSettingsButton.Location = new System.Drawing.Point(224, 72);
|
||||
this.restoreSessionSettingsButton.Name = "restoreSessionSettingsButton";
|
||||
this.restoreSessionSettingsButton.TabIndex = 3;
|
||||
this.restoreSessionSettingsButton.Text = "Settings...";
|
||||
this.restoreSessionSettingsButton.Click += new System.EventHandler(this.restoreSessionSettingsButton_Click);
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
@ -161,14 +218,6 @@ namespace Silverstone.Manticore.Browser
|
||||
this.cancelButton.TabIndex = 2;
|
||||
this.cancelButton.Text = "Cancel";
|
||||
//
|
||||
// radioButton1
|
||||
//
|
||||
this.radioButton1.Location = new System.Drawing.Point(16, 24);
|
||||
this.radioButton1.Name = "radioButton1";
|
||||
this.radioButton1.Size = new System.Drawing.Size(120, 16);
|
||||
this.radioButton1.TabIndex = 0;
|
||||
this.radioButton1.Text = "Show home page";
|
||||
//
|
||||
// treeView1
|
||||
//
|
||||
this.treeView1.ImageIndex = -1;
|
||||
@ -178,77 +227,6 @@ namespace Silverstone.Manticore.Browser
|
||||
this.treeView1.Size = new System.Drawing.Size(136, 264);
|
||||
this.treeView1.TabIndex = 0;
|
||||
//
|
||||
// radioButton2
|
||||
//
|
||||
this.radioButton2.Location = new System.Drawing.Point(16, 48);
|
||||
this.radioButton2.Name = "radioButton2";
|
||||
this.radioButton2.Size = new System.Drawing.Size(112, 16);
|
||||
this.radioButton2.TabIndex = 1;
|
||||
this.radioButton2.Text = "Show blank page";
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.AddRange(new System.Windows.Forms.Control[] {
|
||||
this.groupBox2,
|
||||
this.groupBox1});
|
||||
this.panel1.Location = new System.Drawing.Point(160, 16);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(320, 264);
|
||||
this.panel1.TabIndex = 1;
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Controls.AddRange(new System.Windows.Forms.Control[] {
|
||||
this.restoreSessionSettingsButton,
|
||||
this.radioButton3,
|
||||
this.radioButton2,
|
||||
this.radioButton1});
|
||||
this.groupBox2.Location = new System.Drawing.Point(8, 0);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(312, 104);
|
||||
this.groupBox2.TabIndex = 1;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "When Manticore starts, ";
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.AddRange(new System.Windows.Forms.Control[] {
|
||||
this.button2,
|
||||
this.label2,
|
||||
this.button1,
|
||||
this.textBox1,
|
||||
this.label1});
|
||||
this.groupBox1.Location = new System.Drawing.Point(8, 112);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(312, 104);
|
||||
this.groupBox1.TabIndex = 0;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Home Page";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.Location = new System.Drawing.Point(8, 48);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(56, 16);
|
||||
this.label2.TabIndex = 3;
|
||||
this.label2.Text = "Location:";
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Location = new System.Drawing.Point(64, 48);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(232, 20);
|
||||
this.textBox1.TabIndex = 1;
|
||||
this.textBox1.Text = "http://www.silverstone.net.nz/";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.Location = new System.Drawing.Point(8, 24);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(280, 16);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "Clicking the Home button takes you to this page:";
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
@ -267,7 +245,6 @@ namespace Silverstone.Manticore.Browser
|
||||
this.Controls.AddRange(new System.Windows.Forms.Control[] {
|
||||
this.okButton,
|
||||
this.cancelButton,
|
||||
this.panel1,
|
||||
this.treeView1});
|
||||
this.HelpButton = true;
|
||||
this.Name = "PrefsDialog";
|
||||
@ -275,9 +252,6 @@ namespace Silverstone.Manticore.Browser
|
||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||
this.Text = "Options";
|
||||
this.Load += new System.EventHandler(this.PrefsDialog_Load);
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
@ -54,16 +54,21 @@ namespace Silverstone.Manticore.Browser
|
||||
protected internal WebBrowser webBrowser;
|
||||
|
||||
protected internal StatusBar mStatusBar;
|
||||
|
||||
protected internal ManticoreApp application;
|
||||
protected internal ManticoreApp mApplication;
|
||||
|
||||
public BrowserWindow(ManticoreApp app)
|
||||
{
|
||||
application = app;
|
||||
mApplication = app;
|
||||
|
||||
Console.WriteLine("init component");
|
||||
// Set up UI
|
||||
InitializeComponent();
|
||||
|
||||
this.Closed += new EventHandler(OnFormClosed);
|
||||
}
|
||||
|
||||
public void OnFormClosed(Object sender, EventArgs e)
|
||||
{
|
||||
mApplication.WindowClosed(this);
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
@ -123,14 +128,14 @@ namespace Silverstone.Manticore.Browser
|
||||
|
||||
private void LoadStartPage(object sender, EventArgs e)
|
||||
{
|
||||
int startMode = application.Prefs.GetIntPref("browser.homepage.mode");
|
||||
int startMode = mApplication.Prefs.GetIntPref("browser.homepage.mode");
|
||||
switch (startMode) {
|
||||
case 0:
|
||||
// Don't initialize jack
|
||||
break;
|
||||
case 1:
|
||||
// Load the homepage
|
||||
String homepageURL = application.Prefs.GetStringPref("browser.homepage");
|
||||
String homepageURL = mApplication.Prefs.GetStringPref("browser.homepage");
|
||||
webBrowser.LoadURL(homepageURL, false);
|
||||
break;
|
||||
case 2:
|
||||
@ -144,7 +149,7 @@ namespace Silverstone.Manticore.Browser
|
||||
// Menu Command Handlers
|
||||
public void OpenNewBrowser()
|
||||
{
|
||||
application.OpenNewBrowser();
|
||||
mApplication.OpenNewBrowser();
|
||||
}
|
||||
|
||||
public void Open()
|
||||
@ -153,6 +158,11 @@ namespace Silverstone.Manticore.Browser
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
webBrowser.LoadURL(dlg.URL, false);
|
||||
}
|
||||
|
||||
public void Quit()
|
||||
{
|
||||
mApplication.Quit();
|
||||
}
|
||||
}
|
||||
|
||||
public class BrowserCommandHandler
|
||||
@ -173,6 +183,9 @@ namespace Silverstone.Manticore.Browser
|
||||
case "file-open":
|
||||
mBrowserWindow.Open();
|
||||
break;
|
||||
case "file-exit":
|
||||
mBrowserWindow.Quit();
|
||||
break;
|
||||
case "view-go-back":
|
||||
mBrowserWindow.webBrowser.GoBack();
|
||||
break;
|
||||
|
@ -67,7 +67,7 @@ namespace Silverstone.Manticore.Layout
|
||||
public void RealizeLayoutEngine()
|
||||
{
|
||||
if (gecko == null && trident == null) {
|
||||
String layoutEngine = mBrowserWindow.application.Prefs.GetStringPref("browser.layoutengine");
|
||||
String layoutEngine = mBrowserWindow.mApplication.Prefs.GetStringPref("browser.layoutengine");
|
||||
if (layoutEngine == "")
|
||||
layoutEngine = "gecko";
|
||||
SwitchLayoutEngine(layoutEngine);
|
||||
@ -116,8 +116,7 @@ namespace Silverstone.Manticore.Layout
|
||||
this.Controls.Add(host);
|
||||
}
|
||||
|
||||
mBrowserWindow.application.Prefs.SetStringPref("browser.layoutengine", id);
|
||||
mBrowserWindow.application.Prefs.FlushPreferencesFile("user-prefs.xml");
|
||||
mBrowserWindow.mApplication.Prefs.SetStringPref("browser.layoutengine", id);
|
||||
|
||||
LoadURL(url, false);
|
||||
}
|
||||
|
@ -43,9 +43,8 @@ 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_XML_IMPORTS=/R:System.Data.DLL /R:System.XML.DLL
|
||||
_CS_LAYOUT_IMPORTS=/R:AxSHDocVw.DLL /R:MSHTML.DLL /R:AxMOZILLACONTROLLib.DLL /R:MOZILLACONTROLLib.dll
|
||||
_CS_CTL_IMPORTS=/R:StdFormat.dll /R:MSDATASRC.dll /R:stdole.dll /R:AxComCtl3.dll /R:ComCtl3.dll /R:VBRUN.dll
|
||||
|
||||
_IMPORTS=$(_CS_WINFORMS_IMPORTS) $(_CS_XMLIMPORTS) $(_CS_LAYOUT_IMPORTS)
|
||||
|
||||
@ -61,9 +60,11 @@ _COMPILE_CMD=csc /nologo /t:exe /out:$(_OUT_FILE) $(_DEBUG_FLAGS) $(_IMPORTS)
|
||||
FILES = app.cs \
|
||||
browser\browserwindow.cs \
|
||||
browser\aboutdialog.cs \
|
||||
browser\PrefPanel.cs \
|
||||
browser\PrefsDialog.cs \
|
||||
browser\RestoreSessionSettings.cs \
|
||||
browser\OpenLocDialog.cs \
|
||||
browser\BrowserDisplayPanel.cs \
|
||||
layout\layoutabstraction.cs \
|
||||
toolkit\toolkit.menus.cs \
|
||||
toolkit\toolkit.toolbars.cs \
|
||||
|
Loading…
x
Reference in New Issue
Block a user