зеркало из https://github.com/mozilla/gecko-dev.git
Is the lock cleared now?
This commit is contained in:
Родитель
14a52d978f
Коммит
433d341564
|
@ -107,7 +107,7 @@ namespace Silverstone.Manticore.OpenDialog
|
|||
this.AcceptButton = this.openButton;
|
||||
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
|
||||
this.CancelButton = this.cancelButton;
|
||||
this.ClientSize = new System.Drawing.Size(546, 96);
|
||||
this.ClientSize = new System.Drawing.Size(550, 98);
|
||||
this.ControlBox = false;
|
||||
this.Controls.AddRange(new System.Windows.Forms.Control[] {
|
||||
this.cancelButton,
|
||||
|
@ -118,7 +118,6 @@ namespace Silverstone.Manticore.OpenDialog
|
|||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "OpenDialog";
|
||||
this.Opacity = 0.9;
|
||||
this.ShowInTaskbar = false;
|
||||
this.Text = "Open Location";
|
||||
this.Load += new System.EventHandler(this.OpenDialog_Load);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<toolbox id="mainToolbox"
|
||||
xmlns="http://www.silverstone.net.nz/2001/manticore/uidl">
|
||||
|
@ -8,6 +8,8 @@
|
|||
<toolbarbutton label="Forward" command="view-go-forward"/>
|
||||
<toolbarbutton label="Stop" command="view-stop"/>
|
||||
<toolbarbutton label="Reload" command="view-reload"/>
|
||||
<toolbarseparator/>
|
||||
<toolbarbutton label="Home" command="view-go-home"/>
|
||||
</toolbar>
|
||||
</toolstrip>
|
||||
</toolbox>
|
||||
|
|
|
@ -53,6 +53,7 @@ namespace Silverstone.Manticore.BrowserWindow
|
|||
|
||||
private BrowserMenuBuilder mMenuBuilder;
|
||||
private BrowserToolbarBuilder mToolbarBuilder;
|
||||
private BrowserCommandHandler mCommandHandler;
|
||||
|
||||
protected internal WebBrowser webBrowser;
|
||||
|
||||
|
@ -85,22 +86,15 @@ namespace Silverstone.Manticore.BrowserWindow
|
|||
|
||||
this.Text = "Manticore"; // XXX localize
|
||||
|
||||
mMenuBuilder = new BrowserMenuBuilder("browser\\browser-menu.xml", this);
|
||||
mCommandHandler = new BrowserCommandHandler(this);
|
||||
|
||||
mMenuBuilder = new BrowserMenuBuilder("browser\\browser-menu.xml", mCommandHandler);
|
||||
mMenuBuilder.Build();
|
||||
this.Menu = mMenuBuilder.mainMenu;
|
||||
Console.WriteLine("foopy");
|
||||
|
||||
mToolbarBuilder = new BrowserToolbarBuilder("browser\\browser-toolbar.xml", this);
|
||||
// mToolbarBuilder.Build();
|
||||
// this.Controls.Add(mToolbarBuilder.mToolbar);
|
||||
// mToolbarBuilder.mToolbar.Dock = DockStyle.Fill;
|
||||
|
||||
// Show the resize handle
|
||||
this.SizeGripStyle = SizeGripStyle.Auto;
|
||||
|
||||
webBrowser = new WebBrowser();
|
||||
this.Controls.Add(webBrowser);
|
||||
|
||||
// Set up the Status Bar
|
||||
statusBar = new StatusBar();
|
||||
|
||||
|
@ -115,10 +109,17 @@ namespace Silverstone.Manticore.BrowserWindow
|
|||
statusPanel.Text = "Document Done";
|
||||
statusPanel.AutoSize = StatusBarPanelAutoSize.Spring;
|
||||
|
||||
|
||||
statusBar.Panels.AddRange(new StatusBarPanel[] {docStatePanel, statusPanel, progressPanel, zonePanel});
|
||||
statusBar.ShowPanels = true;
|
||||
|
||||
webBrowser = new WebBrowser();
|
||||
this.Controls.Add(webBrowser);
|
||||
|
||||
this.Controls.Add(statusBar);
|
||||
|
||||
mToolbarBuilder = new BrowserToolbarBuilder("browser\\browser-toolbar.xml", mCommandHandler, this);
|
||||
mToolbarBuilder.Build();
|
||||
}
|
||||
|
||||
private void LayoutStartup()
|
||||
|
@ -144,53 +145,76 @@ namespace Silverstone.Manticore.BrowserWindow
|
|||
}
|
||||
}
|
||||
|
||||
public class BrowserCommandHandler
|
||||
{
|
||||
private BrowserWindow mBrowserWindow;
|
||||
|
||||
public BrowserCommandHandler(BrowserWindow window)
|
||||
{
|
||||
mBrowserWindow = window;
|
||||
}
|
||||
|
||||
public void DoCommand(String s) {
|
||||
switch (s)
|
||||
{
|
||||
case "file-new-window":
|
||||
mBrowserWindow.OpenNewBrowser();
|
||||
break;
|
||||
case "file-open":
|
||||
mBrowserWindow.Open();
|
||||
break;
|
||||
case "view-go-back":
|
||||
mBrowserWindow.webBrowser.GoBack();
|
||||
break;
|
||||
case "view-go-forward":
|
||||
mBrowserWindow.webBrowser.GoForward();
|
||||
break;
|
||||
case "view-go-home":
|
||||
mBrowserWindow.webBrowser.GoHome();
|
||||
break;
|
||||
case "view-layout-gecko":
|
||||
mBrowserWindow.webBrowser.SwitchLayoutEngine("gecko");
|
||||
break;
|
||||
case "view-layout-ie":
|
||||
mBrowserWindow.webBrowser.SwitchLayoutEngine("trident");
|
||||
break;
|
||||
case "help-about":
|
||||
AboutDialog dlg = new AboutDialog(mBrowserWindow);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class BrowserMenuBuilder : MenuBuilder
|
||||
{
|
||||
private BrowserWindow browserWindow;
|
||||
private BrowserCommandHandler mCommandHandler;
|
||||
|
||||
public BrowserMenuBuilder(String file, BrowserWindow window) : base(file)
|
||||
public BrowserMenuBuilder(String file, BrowserCommandHandler handler) : base(file)
|
||||
{
|
||||
browserWindow = window;
|
||||
mCommandHandler = handler;
|
||||
}
|
||||
|
||||
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 "view-go-home":
|
||||
browserWindow.webBrowser.GoHome();
|
||||
break;
|
||||
case "view-layout-gecko":
|
||||
browserWindow.webBrowser.SwitchLayoutEngine("gecko");
|
||||
break;
|
||||
case "view-layout-ie":
|
||||
browserWindow.webBrowser.SwitchLayoutEngine("trident");
|
||||
break;
|
||||
case "help-about":
|
||||
AboutDialog dlg = new AboutDialog(browserWindow);
|
||||
break;
|
||||
}
|
||||
CommandMenuItem item = sender as CommandMenuItem;
|
||||
mCommandHandler.DoCommand(item.Command);
|
||||
}
|
||||
}
|
||||
|
||||
public class BrowserToolbarBuilder : ToolbarBuilder
|
||||
{
|
||||
private BrowserWindow mBrowserWindow;
|
||||
private BrowserCommandHandler mCommandHandler;
|
||||
|
||||
public BrowserToolbarBuilder(String file, BrowserWindow window) : base(file)
|
||||
public BrowserToolbarBuilder(String file, BrowserCommandHandler handler,
|
||||
BrowserWindow window) : base(file, window)
|
||||
{
|
||||
mBrowserWindow = window;
|
||||
mCommandHandler = handler;
|
||||
}
|
||||
|
||||
public override void OnCommand(Object sender, EventArgs e)
|
||||
public override void OnCommand(Object sender, ToolBarButtonClickEventArgs e)
|
||||
{
|
||||
CommandButtonItem item = e.Button as CommandButtonItem;
|
||||
mCommandHandler.DoCommand(item.Command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace Silverstone.Manticore.LayoutAbstraction
|
|||
public WebBrowser()
|
||||
{
|
||||
this.Dock = DockStyle.Fill;
|
||||
}
|
||||
}
|
||||
|
||||
public void RealizeLayoutEngine()
|
||||
{
|
||||
|
@ -125,6 +125,24 @@ namespace Silverstone.Manticore.LayoutAbstraction
|
|||
trident.Navigate(url, ref o, ref o, ref o, ref o);
|
||||
}
|
||||
|
||||
public void GoBack()
|
||||
{
|
||||
RealizeLayoutEngine();
|
||||
if (gecko != null)
|
||||
gecko.GoBack();
|
||||
else if (trident != null)
|
||||
trident.GoBack();
|
||||
}
|
||||
|
||||
public void GoForward()
|
||||
{
|
||||
RealizeLayoutEngine();
|
||||
if (gecko != null)
|
||||
gecko.GoForward();
|
||||
else if (trident != null)
|
||||
trident.GoForward();
|
||||
}
|
||||
|
||||
public void GoHome()
|
||||
{
|
||||
// XXX - need to implement "Home" preference
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace Silverstone.Manticore.Toolkit.Menus
|
|||
using System.IO;
|
||||
using System.Xml;
|
||||
|
||||
public class MenuBuilder
|
||||
public abstract class MenuBuilder
|
||||
{
|
||||
protected internal String menuDefinitionFile;
|
||||
|
||||
|
@ -119,19 +119,16 @@ namespace Silverstone.Manticore.Toolkit.Menus
|
|||
}
|
||||
}
|
||||
|
||||
public virtual void OnCommand(Object sender, EventArgs e)
|
||||
{
|
||||
// Implement in derived classes
|
||||
}
|
||||
public abstract void OnCommand(Object sender, EventArgs e);
|
||||
}
|
||||
|
||||
public class CommandMenuItem : MenuItem
|
||||
{
|
||||
private string command;
|
||||
private string mCommand;
|
||||
public string Command
|
||||
{
|
||||
get {
|
||||
return command;
|
||||
return mCommand;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -139,7 +136,7 @@ namespace Silverstone.Manticore.Toolkit.Menus
|
|||
EventHandler handler,
|
||||
String cmd) : base(label, handler)
|
||||
{
|
||||
command = cmd;
|
||||
mCommand = cmd;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,28 +44,18 @@ namespace Silverstone.Manticore.Toolkit.Toolbars
|
|||
using System.IO;
|
||||
using System.Xml;
|
||||
|
||||
/*
|
||||
// We want to replace use of Coolbar with our own widget, just
|
||||
// not right now.
|
||||
using stdole;
|
||||
using AxComCtl3;
|
||||
using MSDATASRC;
|
||||
using StdFormat;
|
||||
using VBRUN;
|
||||
//using ComCtl3;
|
||||
*/
|
||||
|
||||
public class ToolbarBuilder
|
||||
public abstract class ToolbarBuilder
|
||||
{
|
||||
private String mToolbarFile;
|
||||
private Form mForm;
|
||||
private ToolBar mCurrentToolbar;
|
||||
|
||||
//public AxCoolBar mToolbar;
|
||||
public Hashtable mItems;
|
||||
|
||||
public ToolbarBuilder(String file)
|
||||
{
|
||||
|
||||
public ToolbarBuilder(String file, Form form)
|
||||
{
|
||||
mToolbarFile = file;
|
||||
// mToolbar = new AxCoolBar();
|
||||
mForm = form;
|
||||
mItems = new Hashtable();
|
||||
}
|
||||
|
||||
|
@ -76,60 +66,84 @@ namespace Silverstone.Manticore.Toolkit.Toolbars
|
|||
reader.WhitespaceHandling = WhitespaceHandling.None;
|
||||
reader.MoveToContent();
|
||||
|
||||
// NameTable nt = new NameTable();
|
||||
// XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt);
|
||||
// XmlParserContext ctxt = new XmlParserContext(null, nsmgr, null, XmlSpace.None);
|
||||
// XmlTextReader reader = new XmlTextReader(inner, XmlNodeType.Element, ctxt);
|
||||
|
||||
int bandIndex = 0;
|
||||
Boolean needNewRow = true;
|
||||
while (reader.Read()) {
|
||||
if (reader.NodeType == XmlNodeType.Element) {
|
||||
switch (reader.LocalName) {
|
||||
case "toolstrip":
|
||||
// The next <toolbar/> we encounter should be created on a new row.
|
||||
needNewRow = true;
|
||||
break;
|
||||
case "toolbar":
|
||||
//
|
||||
String[] tbvalues = new String[4] {"", "", "", ""};
|
||||
String[] tbnames = new String[4] {"id", "label", "description", "visible"};
|
||||
for (Byte i = 0; i < tbnames.Length; ++i) {
|
||||
if (reader.MoveToAttribute(tbnames[i]) &&
|
||||
reader.ReadAttributeValue())
|
||||
tbvalues[i] = reader.Value; // XXX need to handle entities
|
||||
reader.MoveToElement();
|
||||
}
|
||||
switch (reader.LocalName)
|
||||
{
|
||||
case "toolstrip":
|
||||
// The next <toolbar/> we encounter should be created on a new row.
|
||||
break;
|
||||
case "toolbar":
|
||||
//
|
||||
String[] tbvalues = new String[4] {"", "", "", ""};
|
||||
String[] tbnames = new String[4] {"id", "label", "description", "visible"};
|
||||
for (Byte i = 0; i < tbnames.Length; ++i)
|
||||
{
|
||||
if (reader.MoveToAttribute(tbnames[i]) &&
|
||||
reader.ReadAttributeValue())
|
||||
tbvalues[i] = reader.Value; // XXX need to handle entities
|
||||
reader.MoveToElement();
|
||||
}
|
||||
|
||||
String key = tbvalues[0];
|
||||
String label = tbvalues[1];
|
||||
String visible = tbvalues[3];
|
||||
// mToolbar.Bands.Add(bandIndex++, key, label, null, needNewRow, null, visible != "false");
|
||||
needNewRow = false;
|
||||
break;
|
||||
case "toolbarbutton":
|
||||
String key = tbvalues[0];
|
||||
String label = tbvalues[1];
|
||||
String visible = tbvalues[3];
|
||||
|
||||
// Create and add a new toolbar.
|
||||
mCurrentToolbar = new ToolBar();
|
||||
mCurrentToolbar.Dock = DockStyle.Top;
|
||||
mCurrentToolbar.Appearance = ToolBarAppearance.Flat;
|
||||
mForm.Controls.Add(mCurrentToolbar);
|
||||
|
||||
String[] tbbvalues = new String[2] {"", ""};
|
||||
String[] tbbnames = new String[2] {"label", "command"};
|
||||
for (Byte i = 0; i < tbbnames.Length; ++i) {
|
||||
if (reader.MoveToAttribute(tbbnames[i]) &&
|
||||
reader.ReadAttributeValue())
|
||||
tbbvalues[i] = reader.Value; // XXX need to handle entities
|
||||
reader.MoveToElement();
|
||||
}
|
||||
Console.WriteLine(tbbvalues[0]);
|
||||
break;
|
||||
}
|
||||
mCurrentToolbar.ButtonClick += new ToolBarButtonClickEventHandler(this.OnCommand);
|
||||
break;
|
||||
case "toolbarseparator":
|
||||
{
|
||||
ToolBarButton button = new ToolBarButton();
|
||||
button.Style = ToolBarButtonStyle.Separator;
|
||||
mCurrentToolbar.Buttons.Add(button);
|
||||
break;
|
||||
}
|
||||
case "toolbarbutton":
|
||||
{
|
||||
String[] tbbvalues = new String[2] {"", ""};
|
||||
String[] tbbnames = new String[2] {"label", "command"};
|
||||
for (Byte i = 0; i < tbbnames.Length; ++i)
|
||||
{
|
||||
if (reader.MoveToAttribute(tbbnames[i]) &&
|
||||
reader.ReadAttributeValue())
|
||||
tbbvalues[i] = reader.Value; // XXX need to handle entities
|
||||
reader.MoveToElement();
|
||||
}
|
||||
|
||||
ToolBarButton button = new CommandButtonItem(tbbvalues[1]);
|
||||
button.Text = tbbvalues[0];
|
||||
mCurrentToolbar.Buttons.Add(button);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void OnCommand(Object sender, EventArgs e)
|
||||
{
|
||||
// Implement in derived classes
|
||||
public abstract void OnCommand(Object sender, ToolBarButtonClickEventArgs e);
|
||||
}
|
||||
|
||||
public class CommandButtonItem : ToolBarButton
|
||||
{
|
||||
private string mCommand;
|
||||
public string Command
|
||||
{
|
||||
get
|
||||
{
|
||||
return mCommand;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public CommandButtonItem(String cmd) : base()
|
||||
{
|
||||
mCommand = cmd;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче