/*
Copyright (C) 2014-2019 de4dot@gmail.com
This file is part of dnSpy
dnSpy is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
dnSpy is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with dnSpy. If not, see .
*/
using System;
using System.ComponentModel.Composition;
using dnSpy.Contracts.Hex;
using dnSpy.Contracts.Hex.Editor;
namespace dnSpy.Contracts.Settings.HexEditor {
///
/// Defines code editor options that will be shown in the UI. Use
/// to export an instance.
///
public sealed class HexEditorOptionsDefinition {
}
/// Metadata
public interface IHexEditorOptionsDefinitionMetadata {
/// See
string Name { get; }
/// See
string SubGroup { get; }
/// See
string Guid { get; }
/// See
Type Type { get; }
/// See
HexOffsetFormat HexOffsetFormat { get; }
/// See
bool ValuesLowerCaseHex { get; }
/// See
bool OffsetLowerCaseHex { get; }
/// See
int GroupSizeInBytes { get; }
/// See
bool EnableColorization { get; }
/// See
bool RemoveExtraTextLineVerticalPixels { get; }
/// See
bool ShowColumnLines { get; }
/// See
HexColumnLineKind ColumnLine0 { get; }
/// See
HexColumnLineKind ColumnLine1 { get; }
/// See
HexColumnLineKind ColumnGroupLine0 { get; }
/// See
HexColumnLineKind ColumnGroupLine1 { get; }
/// See
bool HighlightActiveColumn { get; }
/// See
bool HighlightCurrentValue { get; }
/// See
int HighlightCurrentValueDelayMilliSeconds { get; }
/// See
int EncodingCodePage { get; }
/// See
bool HighlightStructureUnderMouseCursor { get; }
/// See
bool EnableHighlightCurrentLine { get; }
/// See
bool EnableMouseWheelZoom { get; }
/// See
double ZoomLevel { get; }
/// See
bool HorizontalScrollBar { get; }
/// See
bool VerticalScrollBar { get; }
/// See
bool SelectionMargin { get; }
/// See
bool ZoomControl { get; }
/// See
bool GlyphMargin { get; }
/// See
bool ForceClearTypeIfNeeded { get; }
}
///
/// Exports a instance
///
[MetadataAttribute, AttributeUsage(AttributeTargets.Field, AllowMultiple = false)]
public sealed class ExportHexEditorOptionsDefinitionAttribute : ExportAttribute, IHexEditorOptionsDefinitionMetadata {
///
/// Constructor
///
/// Name shown in the UI
/// Sub group, eg.
/// Guid of settings
/// A type in your assembly so resource strings can be read from the resources
public ExportHexEditorOptionsDefinitionAttribute(string name, string subGroup, string guid, Type type)
: base(typeof(HexEditorOptionsDefinition)) {
Name = name ?? throw new ArgumentNullException(nameof(name));
SubGroup = subGroup ?? throw new ArgumentNullException(nameof(subGroup));
Guid = guid ?? throw new ArgumentNullException(nameof(guid));
Type = type ?? throw new ArgumentNullException(nameof(type));
HexOffsetFormat = DefaultHexEditorOptions.HexOffsetFormat;
ValuesLowerCaseHex = DefaultHexEditorOptions.ValuesLowerCaseHex;
OffsetLowerCaseHex = DefaultHexEditorOptions.OffsetLowerCaseHex;
GroupSizeInBytes = DefaultHexEditorOptions.GroupSizeInBytes;
EnableColorization = DefaultHexEditorOptions.EnableColorization;
RemoveExtraTextLineVerticalPixels = DefaultHexEditorOptions.RemoveExtraTextLineVerticalPixels;
ShowColumnLines = DefaultHexEditorOptions.ShowColumnLines;
ColumnLine0 = DefaultHexEditorOptions.ColumnLine0;
ColumnLine1 = DefaultHexEditorOptions.ColumnLine1;
ColumnGroupLine0 = DefaultHexEditorOptions.ColumnGroupLine0;
ColumnGroupLine1 = DefaultHexEditorOptions.ColumnGroupLine1;
HighlightActiveColumn = DefaultHexEditorOptions.HighlightActiveColumn;
HighlightCurrentValue = DefaultHexEditorOptions.HighlightCurrentValue;
HighlightCurrentValueDelayMilliSeconds = DefaultHexEditorOptions.HighlightCurrentValueDelayMilliSeconds;
EncodingCodePage = DefaultHexEditorOptions.EncodingCodePage;
HighlightStructureUnderMouseCursor = DefaultHexEditorOptions.HighlightStructureUnderMouseCursor;
EnableHighlightCurrentLine = DefaultHexEditorOptions.EnableHighlightCurrentLine;
EnableMouseWheelZoom = DefaultHexEditorOptions.EnableMouseWheelZoom;
ZoomLevel = DefaultHexEditorOptions.ZoomLevel;
HorizontalScrollBar = DefaultHexEditorOptions.HorizontalScrollBar;
VerticalScrollBar = DefaultHexEditorOptions.VerticalScrollBar;
SelectionMargin = DefaultHexEditorOptions.SelectionMargin;
ZoomControl = DefaultHexEditorOptions.ZoomControl;
GlyphMargin = DefaultHexEditorOptions.GlyphMargin;
ForceClearTypeIfNeeded = DefaultHexEditorOptions.ForceClearTypeIfNeeded;
}
///
/// Name shown in the UI
///
public string Name { get; }
///
/// Sub group, eg.
///
public string SubGroup { get; }
///
/// Guid of settings
///
public string Guid { get; }
///
/// Type
///
public Type Type { get; }
///
/// Offset format, default value is
///
public HexOffsetFormat HexOffsetFormat { get; set; }
///
/// Values lower case hex, default value is
///
public bool ValuesLowerCaseHex { get; set; }
///
/// Offset lower case hex, default value is
///
public bool OffsetLowerCaseHex { get; set; }
///
/// Group size in bytes, default value is
///
public int GroupSizeInBytes { get; set; }
///
/// Colorize the hex view, default value is
///
public bool EnableColorization { get; set; }
///
/// Remove extra text line vertical pixels, default value is
///
public bool RemoveExtraTextLineVerticalPixels { get; set; }
///
/// Show column lines, default value is
///
public bool ShowColumnLines { get; set; }
///
/// Line between the first two columns (eg. offset and values), default value is
///
public HexColumnLineKind ColumnLine0 { get; set; }
///
/// Line between second and third columns (eg. values and ASCII), default value is
///
public HexColumnLineKind ColumnLine1 { get; set; }
///
/// Values column line #0, default value is
///
public HexColumnLineKind ColumnGroupLine0 { get; set; }
///
/// Values column line #1, default value is
///
public HexColumnLineKind ColumnGroupLine1 { get; set; }
///
/// Highlight active column, default value is
///
public bool HighlightActiveColumn { get; set; }
///
/// Highlight current value, default value is
///
public bool HighlightCurrentValue { get; set; }
///
/// Highlight current value delay in milliseconds, default value is
///
public int HighlightCurrentValueDelayMilliSeconds { get; set; }
///
/// Encoding code page, default value is
///
public int EncodingCodePage { get; set; }
///
/// Highlight structure under mouse cursor, default value is
///
public bool HighlightStructureUnderMouseCursor { get; set; }
///
/// Highlight current line, default value is
///
public bool EnableHighlightCurrentLine { get; set; }
///
/// Enable mouse wheel zoom, default value is
///
public bool EnableMouseWheelZoom { get; set; }
///
/// Zoom level, default value is
///
public double ZoomLevel { get; set; }
///
/// Enable horizontal scrollbar, default value is
///
public bool HorizontalScrollBar { get; set; }
///
/// Enable vertical scrollbar, default value is
///
public bool VerticalScrollBar { get; set; }
///
/// Enable selection margin, default value is
///
public bool SelectionMargin { get; set; }
///
/// Enable zoom control, default value is
///
public bool ZoomControl { get; set; }
///
/// Enable glyph margin, default value is
///
public bool GlyphMargin { get; set; }
///
/// Force clear type, default value is
///
public bool ForceClearTypeIfNeeded { get; set; }
}
}