mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 01:48:05 +00:00
[Manticore]
Add support for Windows XP Themes, move Description/Extension setting code based on content type into MIME utility. NOT PART OF BUILD.
This commit is contained in:
parent
eb80d84acd
commit
2e76b46dad
@ -250,6 +250,11 @@
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "core\MIMEService.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "core\preferences.cs"
|
||||
SubType = "Code"
|
||||
@ -306,6 +311,10 @@
|
||||
RelPath = "resources\manticore.psd"
|
||||
BuildAction = "None"
|
||||
/>
|
||||
<File
|
||||
RelPath = "resources\manticore.resx"
|
||||
BuildAction = "EmbeddedResource"
|
||||
/>
|
||||
<File
|
||||
RelPath = "toolkit\CommandUpdater.cs"
|
||||
SubType = "Code"
|
||||
|
@ -48,16 +48,16 @@ namespace Silverstone.Manticore.Bookmarks
|
||||
/// </summary>
|
||||
public class FileBookmark : System.Windows.Forms.Form
|
||||
{
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private Label label1;
|
||||
private Label label2;
|
||||
private Label label3;
|
||||
private BookmarksTreeView mFolderTree;
|
||||
private System.Windows.Forms.Button mOKButton;
|
||||
private System.Windows.Forms.Button mCancelButton;
|
||||
private System.Windows.Forms.Button mUseDefaultButton;
|
||||
private System.Windows.Forms.TextBox mLocationField;
|
||||
private System.Windows.Forms.Button mNewFolderButton;
|
||||
private System.Windows.Forms.TextBox mNameField;
|
||||
private Button mOKButton;
|
||||
private Button mCancelButton;
|
||||
private Button mUseDefaultButton;
|
||||
private Button mNewFolderButton;
|
||||
private TextBox mLocationField;
|
||||
private TextBox mNameField;
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
@ -73,6 +73,14 @@ namespace Silverstone.Manticore.Bookmarks
|
||||
mNameField.Text = aTitle;
|
||||
mLocationField.Text = aURL;
|
||||
|
||||
//
|
||||
// Button XP Theme support.
|
||||
//
|
||||
mOKButton.FlatStyle = FlatStyle.System;
|
||||
mCancelButton.FlatStyle = FlatStyle.System;
|
||||
mUseDefaultButton.FlatStyle = FlatStyle.System;
|
||||
mNewFolderButton.FlatStyle = FlatStyle.System;
|
||||
|
||||
//
|
||||
// folderTree
|
||||
//
|
||||
|
@ -237,6 +237,7 @@ namespace Silverstone.Manticore.Browser
|
||||
this.button2.Name = "button2";
|
||||
this.button2.TabIndex = 4;
|
||||
this.button2.Text = "Use Current";
|
||||
this.button2.FlatStyle = FlatStyle.System;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
@ -253,6 +254,7 @@ namespace Silverstone.Manticore.Browser
|
||||
this.button1.Size = new System.Drawing.Size(75, 24);
|
||||
this.button1.TabIndex = 2;
|
||||
this.button1.Text = "Browse...";
|
||||
this.button2.FlatStyle = FlatStyle.System;
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
@ -290,6 +292,7 @@ namespace Silverstone.Manticore.Browser
|
||||
this.restoreSessionSettingsButton.Name = "restoreSessionSettingsButton";
|
||||
this.restoreSessionSettingsButton.TabIndex = 3;
|
||||
this.restoreSessionSettingsButton.Text = "Settings...";
|
||||
this.restoreSessionSettingsButton.FlatStyle = FlatStyle.System;
|
||||
//
|
||||
// radioButton3
|
||||
//
|
||||
@ -298,6 +301,7 @@ namespace Silverstone.Manticore.Browser
|
||||
this.radioButton3.Size = new System.Drawing.Size(152, 16);
|
||||
this.radioButton3.TabIndex = 2;
|
||||
this.radioButton3.Text = "Restore previous session";
|
||||
this.radioButton3.FlatStyle = FlatStyle.System;
|
||||
//
|
||||
// radioButton2
|
||||
//
|
||||
@ -306,6 +310,7 @@ namespace Silverstone.Manticore.Browser
|
||||
this.radioButton2.Size = new System.Drawing.Size(112, 16);
|
||||
this.radioButton2.TabIndex = 1;
|
||||
this.radioButton2.Text = "Show blank page";
|
||||
this.radioButton2.FlatStyle = FlatStyle.System;
|
||||
//
|
||||
// radioButton1
|
||||
//
|
||||
@ -314,6 +319,7 @@ namespace Silverstone.Manticore.Browser
|
||||
this.radioButton1.Size = new System.Drawing.Size(120, 16);
|
||||
this.radioButton1.TabIndex = 0;
|
||||
this.radioButton1.Text = "Show home page";
|
||||
this.radioButton1.FlatStyle = FlatStyle.System;
|
||||
//
|
||||
// BrowserDisplayPanel
|
||||
//
|
||||
|
@ -53,7 +53,7 @@ namespace Silverstone.Manticore.Browser
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.Container components = null;
|
||||
|
||||
|
||||
public OpenDialog()
|
||||
{
|
||||
//
|
||||
@ -115,6 +115,7 @@ namespace Silverstone.Manticore.Browser
|
||||
this.cancelButton.Size = new System.Drawing.Size(72, 24);
|
||||
this.cancelButton.TabIndex = 2;
|
||||
this.cancelButton.Text = "Cancel";
|
||||
this.cancelButton.FlatStyle = FlatStyle.System;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
@ -131,6 +132,7 @@ namespace Silverstone.Manticore.Browser
|
||||
this.openButton.Size = new System.Drawing.Size(72, 24);
|
||||
this.openButton.TabIndex = 2;
|
||||
this.openButton.Text = "Open";
|
||||
this.openButton.FlatStyle = FlatStyle.System;
|
||||
//
|
||||
// OpenDialog
|
||||
//
|
||||
|
@ -240,6 +240,7 @@ namespace Silverstone.Manticore.Browser
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.TabIndex = 2;
|
||||
this.cancelButton.Text = "Cancel";
|
||||
this.cancelButton.FlatStyle = FlatStyle.System;
|
||||
//
|
||||
// treeView1
|
||||
//
|
||||
@ -257,6 +258,7 @@ namespace Silverstone.Manticore.Browser
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.TabIndex = 3;
|
||||
this.okButton.Text = "OK";
|
||||
this.okButton.FlatStyle = FlatStyle.System;
|
||||
//
|
||||
// PrefsDialog
|
||||
//
|
||||
|
@ -121,6 +121,7 @@ namespace Silverstone.Manticore.Browser
|
||||
this.checkBox3.Size = new System.Drawing.Size(136, 24);
|
||||
this.checkBox3.TabIndex = 3;
|
||||
this.checkBox3.Text = "Recent pages history";
|
||||
this.checkBox3.FlatStyle = FlatStyle.System;
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
@ -129,6 +130,7 @@ namespace Silverstone.Manticore.Browser
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.TabIndex = 5;
|
||||
this.cancelButton.Text = "Cancel";
|
||||
this.cancelButton.FlatStyle = FlatStyle.System;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
@ -146,6 +148,7 @@ namespace Silverstone.Manticore.Browser
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.TabIndex = 4;
|
||||
this.okButton.Text = "OK";
|
||||
this.okButton.FlatStyle = FlatStyle.System;
|
||||
//
|
||||
// radioButton1
|
||||
//
|
||||
@ -154,6 +157,7 @@ namespace Silverstone.Manticore.Browser
|
||||
this.radioButton1.Size = new System.Drawing.Size(144, 16);
|
||||
this.radioButton1.TabIndex = 6;
|
||||
this.radioButton1.Text = "Last page visited";
|
||||
this.radioButton1.FlatStyle = FlatStyle.System;
|
||||
//
|
||||
// radioButton2
|
||||
//
|
||||
@ -162,6 +166,7 @@ namespace Silverstone.Manticore.Browser
|
||||
this.radioButton2.Size = new System.Drawing.Size(104, 16);
|
||||
this.radioButton2.TabIndex = 7;
|
||||
this.radioButton2.Text = "Open windows";
|
||||
this.radioButton2.FlatStyle = FlatStyle.System;
|
||||
//
|
||||
// RestoreSessionSettings
|
||||
//
|
||||
|
@ -40,8 +40,6 @@ namespace Silverstone.Manticore.Browser
|
||||
using System.Windows.Forms;
|
||||
using System.Net;
|
||||
|
||||
using Microsoft.Win32;
|
||||
|
||||
using Silverstone.Manticore.Core;
|
||||
using Silverstone.Manticore.App;
|
||||
using Silverstone.Manticore.Toolkit;
|
||||
@ -193,9 +191,21 @@ namespace Silverstone.Manticore.Browser
|
||||
{
|
||||
SaveFileDialog dlg = new SaveFileDialog();
|
||||
dlg.AddExtension = true;
|
||||
dlg.DefaultExt = "html";
|
||||
dlg.FileName = "untitled";
|
||||
dlg.InitialDirectory = FileLocator.GetFolderPath(FileLocator.SpecialFolders.ssfPERSONAL); // XXX persist this.
|
||||
|
||||
// XXX I want to point out that this is a really lame hack. We need
|
||||
// a URL parser (not a URI parser, a URL parser).
|
||||
string name = mTitle.Replace("\"", "'");
|
||||
name = name.Replace("*", " ");
|
||||
name = name.Replace(":", " ");
|
||||
name = name.Replace("?", " ");
|
||||
name = name.Replace("<", "(");
|
||||
name = name.Replace(">", ")");
|
||||
name = name.Replace("\\", "-");
|
||||
name = name.Replace("/", "-");
|
||||
name = name.Replace("|", "-");
|
||||
dlg.FileName = name;
|
||||
|
||||
dlg.Title = "Save Page As...";
|
||||
dlg.ValidateNames = true;
|
||||
dlg.OverwritePrompt = true;
|
||||
@ -208,21 +218,14 @@ namespace Silverstone.Manticore.Browser
|
||||
case "text/html":
|
||||
case "text/xhtml":
|
||||
dlg.Filter = "Web Page, complete (*.htm;*.html)|*.htm*|Web Page, HTML only (*.htm;*.html)|*.htm*|Text only (*.txt)|*.txt";
|
||||
dlg.DefaultExt = "html";
|
||||
break;
|
||||
default:
|
||||
// XXX factor this into a separate MIME service.
|
||||
RegistryKey clsRoot = Registry.ClassesRoot;
|
||||
string extFromMIMEDBKey = "MIME\\Database\\Content Type\\" + contentType;
|
||||
RegistryKey extensionKey = clsRoot.OpenSubKey(extFromMIMEDBKey);
|
||||
string extension = extensionKey.GetValue("Extension") as String;
|
||||
RegistryKey handlerKey = clsRoot.OpenSubKey(extension);
|
||||
string handler = handlerKey.GetValue("") as String;
|
||||
RegistryKey descriptionKey = clsRoot.OpenSubKey(handler);
|
||||
string description = descriptionKey.GetValue("") as String;
|
||||
if (description == "")
|
||||
description = extension.ToUpper() + "file";
|
||||
string extension = MIMEService.GetExtensionForMIMEType(contentType);
|
||||
string description = MIMEService.GetDescriptionForMIMEType(contentType);
|
||||
description += " (*" + extension + ")";
|
||||
dlg.Filter = description + "|*" + extension + "|All Files (*.*)|*.*";
|
||||
dlg.DefaultExt = extension.Substring(1, extension.Length-1);
|
||||
break;
|
||||
}
|
||||
|
||||
|
48
extensions/manticore/core/MIMEService.cs
Normal file
48
extensions/manticore/core/MIMEService.cs
Normal file
@ -0,0 +1,48 @@
|
||||
|
||||
namespace Silverstone.Manticore.Core
|
||||
{
|
||||
using System;
|
||||
|
||||
using Microsoft.Win32;
|
||||
|
||||
/// <summary>
|
||||
/// Summary description for MIMEService.
|
||||
/// </summary>
|
||||
public class MIMEService
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves the extension associated with the specified content type
|
||||
/// by looking up the type in the Windows Registry.
|
||||
/// </summary>
|
||||
/// <param name="aMIMEType">content-type to retrieve extension for</param>
|
||||
/// <returns>string containing the extension (".foo") associated with the type</returns>
|
||||
public static string GetExtensionForMIMEType(string aMIMEType)
|
||||
{
|
||||
RegistryKey clsRoot = Registry.ClassesRoot;
|
||||
string extFromMIMEDBKey = "MIME\\Database\\Content Type\\" + aMIMEType;
|
||||
RegistryKey extensionKey = clsRoot.OpenSubKey(extFromMIMEDBKey);
|
||||
return extensionKey.GetValue("Extension") as String;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the pretty user-readable description of the type by
|
||||
/// looking up the type in the Windows Registry. If no data is found,
|
||||
/// the extension is capitalized and appended with "file", e.g.
|
||||
/// "ZAP file"
|
||||
/// </summary>
|
||||
/// <param name="aMIMEType">content-type to retrieve description for</param>
|
||||
/// <returns>string containing pretty user-readable description of type</returns>
|
||||
public static string GetDescriptionForMIMEType(string aMIMEType)
|
||||
{
|
||||
RegistryKey clsRoot = Registry.ClassesRoot;
|
||||
string extension = GetExtensionForMIMEType(aMIMEType);
|
||||
RegistryKey handlerKey = clsRoot.OpenSubKey(extension);
|
||||
string handler = handlerKey.GetValue("") as String;
|
||||
RegistryKey descriptionKey = clsRoot.OpenSubKey(handler);
|
||||
string description = descriptionKey.GetValue("") as String;
|
||||
if (description == "")
|
||||
description = extension.Substring(1,extension.Length-1).ToUpper() + " file";
|
||||
return description;
|
||||
}
|
||||
}
|
||||
}
|
19
extensions/manticore/manticore.exe.manifest
Normal file
19
extensions/manticore/manticore.exe.manifest
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<assemblyIdentity version="1.0.0.0"
|
||||
processorArchitecture="X86"
|
||||
name="Silverstone.Manticore"
|
||||
type="win32" />
|
||||
<description>Manticore Web Browser</description>
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="X86"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
</assembly>
|
||||
|
19
extensions/manticore/resources/manticore.exe.manifest
Normal file
19
extensions/manticore/resources/manticore.exe.manifest
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<assemblyIdentity version="1.0.0.0"
|
||||
processorArchitecture="X86"
|
||||
name="Silverstone.Manticore"
|
||||
type="win32" />
|
||||
<description>Manticore Web Browser</description>
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="X86"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*" />
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
</assembly>
|
||||
|
@ -114,7 +114,7 @@ namespace Silverstone.Manticore.Toolkit
|
||||
currToolbar.Appearance = ToolBarAppearance.Flat;
|
||||
currToolbar.ButtonClick += new ToolBarButtonClickEventHandler(this.OnCommand);
|
||||
mForm.Controls.Add(currToolbar);
|
||||
|
||||
|
||||
//mCoolBar.Bands.Add(-1, key, label, new Object(), true, currToolbar, true);
|
||||
|
||||
shouldBuildNewRow = false;
|
||||
|
Loading…
Reference in New Issue
Block a user