Browse Source
- some minor bug fixes git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@3015 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
12 changed files with 607 additions and 556 deletions
@ -1,129 +1,217 @@
@@ -1,129 +1,217 @@
|
||||
<Components version="1.0"> |
||||
<System.Windows.Forms.UserControl> |
||||
<Name value="HexEditOptions" /> |
||||
<ClientSize value="{Width=348, Height=210}" /> |
||||
<ClientSize value="{Width=334, Height=339}" /> |
||||
<Controls> |
||||
<System.Windows.Forms.Button> |
||||
<Name value="btnSelectFont" /> |
||||
<Location value="128, 90" /> |
||||
<Text value="Select font ..." /> |
||||
<UseVisualStyleBackColor value="True" /> |
||||
<Size value="93, 26" /> |
||||
<TabIndex value="13" /> |
||||
</System.Windows.Forms.Button> |
||||
<System.Windows.Forms.GroupBox> |
||||
<Name value="groupBox2" /> |
||||
<Location value="3, 122" /> |
||||
<Text value="Preview" /> |
||||
<Size value="340, 82" /> |
||||
<TabIndex value="12" /> |
||||
<Name value="groupBox4" /> |
||||
<Location value="3, 192" /> |
||||
<Text value="General" /> |
||||
<Size value="325, 140" /> |
||||
<TabIndex value="22" /> |
||||
<Controls> |
||||
<System.Windows.Forms.TextBox> |
||||
<Name value="txtExtensions" /> |
||||
<TabIndex value="7" /> |
||||
<Location value="9, 115" /> |
||||
<Text value=".exe;.dll" /> |
||||
<Size value="298, 20" /> |
||||
<Lines> |
||||
<System.String value=".exe;.dll" /> |
||||
</Lines> |
||||
</System.Windows.Forms.TextBox> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="lblOffsetPreview" /> |
||||
<Location value="3, 16" /> |
||||
<Text value="Offset" /> |
||||
<TextAlign value="MiddleCenter" /> |
||||
<Size value="334, 31" /> |
||||
<ForeColor value="Color [ControlText]" /> |
||||
<Dock value="Top" /> |
||||
<TabIndex value="2" /> |
||||
<Name value="label5" /> |
||||
<Location value="9, 96" /> |
||||
<Text value="Extensions to open with hex editor: (separated with ';')" /> |
||||
<Size value="305, 23" /> |
||||
<TabIndex value="6" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.NumericUpDown> |
||||
<Name value="nUDBytesPerLine" /> |
||||
<TabIndex value="5" /> |
||||
<Location value="184, 69" /> |
||||
<Size value="120, 20" /> |
||||
<Controls> |
||||
<System.Windows.Forms.UpDownBase_x002B_UpDownButtons> |
||||
<Name value="" /> |
||||
<TabStop value="False" /> |
||||
<TabIndex value="0" /> |
||||
<Size value="16, 16" /> |
||||
<Location value="100, 0" /> |
||||
</System.Windows.Forms.UpDownBase_x002B_UpDownButtons> |
||||
<System.Windows.Forms.UpDownBase_x002B_UpDownEdit> |
||||
<Name value="" /> |
||||
<TabIndex value="1" /> |
||||
<Size value="96, 12" /> |
||||
<Location value="2, 2" /> |
||||
<BorderStyle value="None" /> |
||||
<Text value="0" /> |
||||
<Lines> |
||||
<System.String value="0" /> |
||||
</Lines> |
||||
</System.Windows.Forms.UpDownBase_x002B_UpDownEdit> |
||||
</Controls> |
||||
</System.Windows.Forms.NumericUpDown> |
||||
<System.Windows.Forms.DomainUpDown> |
||||
<Name value="dUDViewModes" /> |
||||
<TabIndex value="4" /> |
||||
<Location value="184, 47" /> |
||||
<Size value="120, 20" /> |
||||
<Controls> |
||||
<System.Windows.Forms.UpDownBase_x002B_UpDownButtons> |
||||
<Name value="" /> |
||||
<TabStop value="False" /> |
||||
<TabIndex value="0" /> |
||||
<Size value="16, 16" /> |
||||
<Location value="100, 0" /> |
||||
</System.Windows.Forms.UpDownBase_x002B_UpDownButtons> |
||||
<System.Windows.Forms.UpDownBase_x002B_UpDownEdit> |
||||
<Name value="" /> |
||||
<TabIndex value="1" /> |
||||
<Size value="96, 12" /> |
||||
<Location value="2, 2" /> |
||||
<BorderStyle value="None" /> |
||||
</System.Windows.Forms.UpDownBase_x002B_UpDownEdit> |
||||
</Controls> |
||||
</System.Windows.Forms.DomainUpDown> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="lblDataPreview" /> |
||||
<Location value="3, 47" /> |
||||
<Text value="Data" /> |
||||
<TextAlign value="MiddleCenter" /> |
||||
<Size value="334, 32" /> |
||||
<Dock value="Bottom" /> |
||||
<Name value="label4" /> |
||||
<Location value="9, 71" /> |
||||
<Text value="Standard number of bytes per line:" /> |
||||
<Size value="190, 22" /> |
||||
<TabIndex value="3" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="label3" /> |
||||
<Location value="9, 49" /> |
||||
<Text value="Standard view-mode:" /> |
||||
<Size value="187, 21" /> |
||||
<TabIndex value="2" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="cbFitToWidth" /> |
||||
<Location value="9, 19" /> |
||||
<Text value="Always resize to fit current width." /> |
||||
<TabIndex value="0" /> |
||||
<Size value="295, 24" /> |
||||
<UseVisualStyleBackColor value="True" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
</Controls> |
||||
</System.Windows.Forms.GroupBox> |
||||
<System.Windows.Forms.GroupBox> |
||||
<Name value="groupBox1" /> |
||||
<Location value="256, 3" /> |
||||
<Text value="Textstyles" /> |
||||
<Size value="87, 81" /> |
||||
<TabIndex value="11" /> |
||||
<Name value="groupBox3" /> |
||||
<Location value="3, 3" /> |
||||
<Text value="Display" /> |
||||
<Size value="325, 183" /> |
||||
<TabIndex value="21" /> |
||||
<Controls> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="cbItalic" /> |
||||
<AutoSize value="True" /> |
||||
<Location value="6, 40" /> |
||||
<Text value="Italic" /> |
||||
<TabIndex value="5" /> |
||||
<Size value="48, 17" /> |
||||
<System.Windows.Forms.GroupBox> |
||||
<Name value="groupBox2" /> |
||||
<Location value="6, 107" /> |
||||
<Text value="Preview" /> |
||||
<Size value="310, 45" /> |
||||
<TabIndex value="26" /> |
||||
<Controls> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="lblOffsetPreview" /> |
||||
<Location value="3, 15" /> |
||||
<ForeColor value="Color [ControlText]" /> |
||||
<Text value="Offset" /> |
||||
<Size value="305, 15" /> |
||||
<TextAlign value="MiddleCenter" /> |
||||
<Dock value="Top" /> |
||||
<TabIndex value="2" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="lblDataPreview" /> |
||||
<Location value="3, 15" /> |
||||
<Text value="Data" /> |
||||
<Size value="305, 15" /> |
||||
<TextAlign value="MiddleCenter" /> |
||||
<Dock value="Bottom" /> |
||||
<TabIndex value="3" /> |
||||
</System.Windows.Forms.Label> |
||||
</Controls> |
||||
</System.Windows.Forms.GroupBox> |
||||
<System.Windows.Forms.GroupBox> |
||||
<Name value="groupBox1" /> |
||||
<Location value="230, 16" /> |
||||
<Text value="Textstyles" /> |
||||
<Size value="87, 81" /> |
||||
<TabIndex value="25" /> |
||||
<Controls> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="cbItalic" /> |
||||
<AutoSize value="True" /> |
||||
<Location value="6, 40" /> |
||||
<Text value="Italic" /> |
||||
<TabIndex value="5" /> |
||||
<Size value="48, 17" /> |
||||
<UseVisualStyleBackColor value="True" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="cbBold" /> |
||||
<AutoSize value="True" /> |
||||
<Location value="6, 19" /> |
||||
<Text value="Bold" /> |
||||
<TabIndex value="4" /> |
||||
<Size value="47, 17" /> |
||||
<UseVisualStyleBackColor value="True" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="cbUnderline" /> |
||||
<AutoSize value="True" /> |
||||
<Location value="6, 60" /> |
||||
<Text value="Underline" /> |
||||
<TabIndex value="6" /> |
||||
<Size value="71, 17" /> |
||||
<UseVisualStyleBackColor value="True" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
</Controls> |
||||
</System.Windows.Forms.GroupBox> |
||||
<System.Windows.Forms.Button> |
||||
<Name value="btnSelectFont" /> |
||||
<Location value="115, 59" /> |
||||
<Text value="Select font ..." /> |
||||
<UseVisualStyleBackColor value="True" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="cbBold" /> |
||||
<Size value="93, 26" /> |
||||
<TabIndex value="27" /> |
||||
</System.Windows.Forms.Button> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="label2" /> |
||||
<Location value="114, 16" /> |
||||
<Text value="Foreground color:" /> |
||||
<Size value="90, 13" /> |
||||
<AutoSize value="True" /> |
||||
<Location value="6, 19" /> |
||||
<Text value="Bold" /> |
||||
<TabIndex value="4" /> |
||||
<Size value="47, 17" /> |
||||
<UseVisualStyleBackColor value="True" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="cbUnderline" /> |
||||
<TabIndex value="24" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="label1" /> |
||||
<Location value="3, 16" /> |
||||
<Text value="Elements:" /> |
||||
<Size value="53, 13" /> |
||||
<AutoSize value="True" /> |
||||
<Location value="6, 60" /> |
||||
<Text value="Underline" /> |
||||
<TabIndex value="6" /> |
||||
<Size value="71, 17" /> |
||||
<UseVisualStyleBackColor value="True" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
<TabIndex value="23" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.ListBox> |
||||
<Name value="lstElements" /> |
||||
<TabIndex value="22" /> |
||||
<Location value="6, 32" /> |
||||
<Size value="102, 69" /> |
||||
<FormattingEnabled value="True" /> |
||||
</System.Windows.Forms.ListBox> |
||||
<System.Windows.Forms.ComboBox> |
||||
<Name value="cmbForeColor" /> |
||||
<TabIndex value="21" /> |
||||
<DrawMode value="OwnerDrawFixed" /> |
||||
<Location value="115, 32" /> |
||||
<Size value="109, 21" /> |
||||
<FormattingEnabled value="True" /> |
||||
<DropDownStyle value="DropDownList" /> |
||||
</System.Windows.Forms.ComboBox> |
||||
</Controls> |
||||
</System.Windows.Forms.GroupBox> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="label3" /> |
||||
<Location value="111, 47" /> |
||||
<Text value="Background color:" /> |
||||
<Size value="94, 13" /> |
||||
<AutoSize value="True" /> |
||||
<TabIndex value="10" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="label2" /> |
||||
<Location value="111, 0" /> |
||||
<Text value="Foreground color:" /> |
||||
<Size value="90, 13" /> |
||||
<AutoSize value="True" /> |
||||
<TabIndex value="9" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="label1" /> |
||||
<Location value="0, 0" /> |
||||
<Text value="Elements:" /> |
||||
<Size value="53, 13" /> |
||||
<AutoSize value="True" /> |
||||
<TabIndex value="8" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.ListBox> |
||||
<Name value="lstElements" /> |
||||
<Size value="102, 69" /> |
||||
<TabIndex value="7" /> |
||||
<FormattingEnabled value="True" /> |
||||
<Location value="3, 16" /> |
||||
</System.Windows.Forms.ListBox> |
||||
<System.Windows.Forms.ComboBox> |
||||
<Name value="cmbBackColor" /> |
||||
<Size value="138, 21" /> |
||||
<TabIndex value="1" /> |
||||
<DrawMode value="OwnerDrawFixed" /> |
||||
<FormattingEnabled value="True" /> |
||||
<DropDownStyle value="DropDownList" /> |
||||
<Location value="111, 63" /> |
||||
</System.Windows.Forms.ComboBox> |
||||
<System.Windows.Forms.ComboBox> |
||||
<Name value="cmbForeColor" /> |
||||
<Size value="137, 21" /> |
||||
<TabIndex value="0" /> |
||||
<DrawMode value="OwnerDrawFixed" /> |
||||
<FormattingEnabled value="True" /> |
||||
<DropDownStyle value="DropDownList" /> |
||||
<Location value="112, 16" /> |
||||
</System.Windows.Forms.ComboBox> |
||||
</Controls> |
||||
</System.Windows.Forms.UserControl> |
||||
</Components> |
||||
</Components> |
||||
@ -1,38 +0,0 @@
@@ -1,38 +0,0 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Siegfried Pammer" email="sie_pam@gmx.at"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Runtime.InteropServices; |
||||
|
||||
namespace HexEditor.Util |
||||
{ |
||||
/// <summary>
|
||||
/// Description of NativeMethods.
|
||||
/// </summary>
|
||||
public static class NativeMethods |
||||
{ |
||||
[DllImport("User32.dll")] |
||||
[return: MarshalAs(UnmanagedType.Bool)] |
||||
internal static extern bool CreateCaret(IntPtr hWnd, int hBitmap, int nWidth, int nHeight); |
||||
|
||||
[DllImport("User32.dll")] |
||||
[return: MarshalAs(UnmanagedType.Bool)] |
||||
internal static extern bool SetCaretPos(int x, int y); |
||||
|
||||
[DllImport("User32.dll")] |
||||
[return: MarshalAs(UnmanagedType.Bool)] |
||||
internal static extern bool DestroyCaret(); |
||||
|
||||
[DllImport("User32.dll")] |
||||
[return: MarshalAs(UnmanagedType.Bool)] |
||||
internal static extern bool ShowCaret(IntPtr hWnd); |
||||
|
||||
[DllImport("User32.dll")] |
||||
[return: MarshalAs(UnmanagedType.Bool)] |
||||
internal static extern bool HideCaret(IntPtr hWnd); |
||||
} |
||||
} |
||||
@ -0,0 +1,165 @@
@@ -0,0 +1,165 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Siegfried Pammer" email="sie_pam@gmx.at"/>
|
||||
// <version>$Revision: 2984 $</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Xml; |
||||
using System.Drawing; |
||||
|
||||
namespace HexEditor.Util |
||||
{ |
||||
/// <summary>
|
||||
/// Description of Settings.
|
||||
/// </summary>
|
||||
public class Settings |
||||
{ |
||||
Color offsetForeColor, dataForeColor; |
||||
bool offsetBold, offsetItalic, offsetUnderline, dataBold, dataItalic, dataUnderline; |
||||
Font offsetFont, dataFont; |
||||
bool fitToWidth; |
||||
int bytesPerLine; |
||||
ViewMode viewMode; |
||||
string[] fileTypes; |
||||
|
||||
public Settings() |
||||
{ |
||||
} |
||||
|
||||
public static Settings FromXML(XmlDocument document) |
||||
{ |
||||
Settings settings = new Settings(); |
||||
Font tmpFont = new Font("Courier New", 9.75f); |
||||
|
||||
foreach (XmlNode node in document.FirstChild.ChildNodes) |
||||
{ |
||||
switch (node.Attributes["Name"].Value) |
||||
{ |
||||
case "OffsetFore": |
||||
settings.offsetForeColor = CreateColor(node); |
||||
break; |
||||
case "DataFore": |
||||
settings.dataForeColor = CreateColor(node); |
||||
break; |
||||
case "OffsetStyle": |
||||
settings.offsetBold = bool.Parse(node.Attributes["Bold"].Value); |
||||
settings.offsetItalic = bool.Parse(node.Attributes["Italic"].Value); |
||||
settings.offsetUnderline = bool.Parse(node.Attributes["Underline"].Value); |
||||
break; |
||||
case "DataStyle": |
||||
settings.dataBold = bool.Parse(node.Attributes["Bold"].Value); |
||||
settings.dataItalic = bool.Parse(node.Attributes["Italic"].Value); |
||||
settings.dataUnderline = bool.Parse(node.Attributes["Underline"].Value); |
||||
break; |
||||
case "Font": |
||||
tmpFont = new Font(node.Attributes["FontName"].Value, |
||||
float.Parse(node.Attributes["FontSize"].Value)); |
||||
break; |
||||
case "TextDisplay": |
||||
settings.bytesPerLine = int.Parse(node.Attributes["BytesPerLine"].Value); |
||||
settings.viewMode = (ViewMode)ViewMode.Parse(typeof(ViewMode),node.Attributes["ViewMode"].Value); |
||||
settings.fitToWidth = bool.Parse(node.Attributes["FitToWidth"].Value); |
||||
break; |
||||
case "FileTypes": |
||||
settings.fileTypes = node.Attributes["FileTypes"].Value.Split(new char[] {';'}); |
||||
break; |
||||
} |
||||
|
||||
FontStyle offsetStyle = FontStyle.Regular; |
||||
if (settings.offsetBold) offsetStyle |= FontStyle.Bold; |
||||
if (settings.offsetItalic) offsetStyle |= FontStyle.Italic; |
||||
if (settings.offsetUnderline) offsetStyle |= FontStyle.Underline; |
||||
|
||||
settings.offsetFont = new Font(tmpFont, offsetStyle); |
||||
|
||||
FontStyle dataStyle = FontStyle.Regular; |
||||
if (settings.dataBold) dataStyle |= FontStyle.Bold; |
||||
if (settings.dataItalic) dataStyle |= FontStyle.Italic; |
||||
if (settings.dataUnderline) dataStyle |= FontStyle.Underline; |
||||
|
||||
settings.dataFont = new Font(tmpFont, dataStyle); |
||||
} |
||||
|
||||
return settings; |
||||
} |
||||
|
||||
private static Color CreateColor(XmlNode node) |
||||
{ |
||||
return Color.FromArgb(int.Parse(node.Attributes["R"].Value), |
||||
int.Parse(node.Attributes["G"].Value), |
||||
int.Parse(node.Attributes["B"].Value)); |
||||
} |
||||
|
||||
public Color OffsetForeColor { |
||||
get { return offsetForeColor; } |
||||
set { offsetForeColor = value; } |
||||
} |
||||
|
||||
public Color DataForeColor { |
||||
get { return dataForeColor; } |
||||
set { dataForeColor = value; } |
||||
} |
||||
|
||||
public bool OffsetBold { |
||||
get { return offsetBold; } |
||||
set { offsetBold = value; } |
||||
} |
||||
|
||||
public bool OffsetItalic { |
||||
get { return offsetItalic; } |
||||
set { offsetItalic = value; } |
||||
} |
||||
|
||||
public bool OffsetUnderline { |
||||
get { return offsetUnderline; } |
||||
set { offsetUnderline = value; } |
||||
} |
||||
|
||||
public bool DataBold { |
||||
get { return dataBold; } |
||||
set { dataBold = value; } |
||||
} |
||||
|
||||
public bool DataItalic { |
||||
get { return dataItalic; } |
||||
set { dataItalic = value; } |
||||
} |
||||
|
||||
public bool DataUnderline { |
||||
get { return dataUnderline; } |
||||
set { dataUnderline = value; } |
||||
} |
||||
|
||||
public Font OffsetFont { |
||||
get { return offsetFont; } |
||||
set { offsetFont = value; } |
||||
} |
||||
|
||||
public Font DataFont { |
||||
get { return dataFont; } |
||||
set { dataFont = value; } |
||||
} |
||||
|
||||
public bool FitToWidth { |
||||
get { return fitToWidth; } |
||||
set { fitToWidth = value; } |
||||
} |
||||
|
||||
public int BytesPerLine { |
||||
get { return bytesPerLine; } |
||||
set { bytesPerLine = value; } |
||||
} |
||||
|
||||
public ViewMode ViewMode { |
||||
get { return viewMode; } |
||||
set { viewMode = value; } |
||||
} |
||||
|
||||
public string[] FileTypes { |
||||
get { return fileTypes; } |
||||
set { fileTypes = value; } |
||||
} |
||||
} |
||||
} |
||||
Loading…
Reference in new issue