From 9f0bb0208adeab122d320b8eb25b48826284d94b Mon Sep 17 00:00:00 2001 From: "ben%netscape.com" Date: Thu, 28 Jun 2001 00:39:40 +0000 Subject: [PATCH] [MANTICORE] pref-based layout engine switching. [Not part of build] --- extensions/manticore/app.cs | 2 +- extensions/manticore/browser/browserwindow.cs | 2 +- extensions/manticore/default-prefs.xml | 7 +++++++ .../manticore/layout/layoutabstraction.cs | 17 +++++++++++++---- 4 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 extensions/manticore/default-prefs.xml diff --git a/extensions/manticore/app.cs b/extensions/manticore/app.cs index f639fddcfd6..c61b7d2613c 100644 --- a/extensions/manticore/app.cs +++ b/extensions/manticore/app.cs @@ -29,7 +29,7 @@ namespace Silverstone.Manticore.App // Initialize default and user preferences mPreferences = new Preferences(); - // mPreferences.InitializeDefaults("default-prefs.xml"); + mPreferences.InitializeDefaults("default-prefs.xml"); mPreferences.LoadPreferencesFile("user-prefs.xml"); OpenNewBrowser(); diff --git a/extensions/manticore/browser/browserwindow.cs b/extensions/manticore/browser/browserwindow.cs index 77866a06c18..964cba0e5b7 100644 --- a/extensions/manticore/browser/browserwindow.cs +++ b/extensions/manticore/browser/browserwindow.cs @@ -113,7 +113,7 @@ namespace Silverstone.Manticore.BrowserWindow statusBar.Panels.AddRange(new StatusBarPanel[] {docStatePanel, statusPanel, progressPanel, zonePanel}); statusBar.ShowPanels = true; - webBrowser = new WebBrowser(); + webBrowser = new WebBrowser(this); this.Controls.Add(webBrowser); this.Controls.Add(statusBar); diff --git a/extensions/manticore/default-prefs.xml b/extensions/manticore/default-prefs.xml new file mode 100644 index 00000000000..8a54f3a8812 --- /dev/null +++ b/extensions/manticore/default-prefs.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/extensions/manticore/layout/layoutabstraction.cs b/extensions/manticore/layout/layoutabstraction.cs index 7474b396aad..0f19afffaa0 100644 --- a/extensions/manticore/layout/layoutabstraction.cs +++ b/extensions/manticore/layout/layoutabstraction.cs @@ -49,20 +49,29 @@ namespace Silverstone.Manticore.LayoutAbstraction using AxMOZILLACONTROLLib; using MOZILLACONTROLLib; + using Silverstone.Manticore.BrowserWindow; + public class WebBrowser : ContainerControl { private AxWebBrowser trident; private AxMozillaBrowser gecko; - public WebBrowser() + private BrowserWindow mBrowserWindow; + + public WebBrowser(BrowserWindow aBrowserWindow) { + mBrowserWindow = aBrowserWindow; this.Dock = DockStyle.Fill; - } + } public void RealizeLayoutEngine() { - if (gecko == null && trident == null) - SwitchLayoutEngine("gecko"); // XXX Should be pref-based. + if (gecko == null && trident == null) { + String layoutEngine = mBrowserWindow.application.Prefs.GetStringPref("browser.layoutengine"); + if (layoutEngine == "") + layoutEngine = "gecko"; + SwitchLayoutEngine(layoutEngine); + } } public void SwitchLayoutEngine(String id)