diff --git a/BrotliBuilder/BrotliBuilder.csproj b/BrotliBuilder/BrotliBuilder.csproj index ae9a067..a71f8b9 100644 --- a/BrotliBuilder/BrotliBuilder.csproj +++ b/BrotliBuilder/BrotliBuilder.csproj @@ -80,14 +80,14 @@ <Compile Include="Components\BrotliFilePanel.Designer.cs"> <DependentUpon>BrotliFilePanel.cs</DependentUpon> </Compile> - <Compile Include="Components\MarkedTextBox.cs"> + <Compile Include="Components\BrotliMarkerInfoPanel.cs"> <SubType>UserControl</SubType> </Compile> - <Compile Include="Dialogs\FormBitStreamContext.cs"> - <SubType>Form</SubType> + <Compile Include="Components\BrotliMarkerInfoPanel.Designer.cs"> + <DependentUpon>BrotliMarkerInfoPanel.cs</DependentUpon> </Compile> - <Compile Include="Dialogs\FormBitStreamContext.Designer.cs"> - <DependentUpon>FormBitStreamContext.cs</DependentUpon> + <Compile Include="Components\MarkedTextBox.cs"> + <SubType>UserControl</SubType> </Compile> <Compile Include="Dialogs\FormStaticDictionary.cs"> <SubType>Form</SubType> @@ -157,9 +157,8 @@ <DependentUpon>BrotliFilePanel.cs</DependentUpon> <SubType>Designer</SubType> </EmbeddedResource> - <EmbeddedResource Include="Dialogs\FormBitStreamContext.resx"> - <DependentUpon>FormBitStreamContext.cs</DependentUpon> - <SubType>Designer</SubType> + <EmbeddedResource Include="Components\BrotliMarkerInfoPanel.resx"> + <DependentUpon>BrotliMarkerInfoPanel.cs</DependentUpon> </EmbeddedResource> <EmbeddedResource Include="Dialogs\FormStaticDictionary.resx"> <DependentUpon>FormStaticDictionary.cs</DependentUpon> diff --git a/BrotliBuilder/Components/BrotliFilePanel.cs b/BrotliBuilder/Components/BrotliFilePanel.cs index 36b6a20..3417e4f 100644 --- a/BrotliBuilder/Components/BrotliFilePanel.cs +++ b/BrotliBuilder/Components/BrotliFilePanel.cs @@ -31,6 +31,11 @@ namespace BrotliBuilder.Components{ set => textBoxOutput.WordWrap = value; } + public event EventHandler<MarkedTextBox.MarkerUpdateEventArgs> MarkersUpdated{ + add => textBoxBitStream.MarkersUpdated += value; + remove => textBoxBitStream.MarkersUpdated -= value; + } + private readonly AsyncWorker loadWorker = new AsyncWorker(); private string labelPrefix = null; diff --git a/BrotliBuilder/Dialogs/FormBitStreamContext.Designer.cs b/BrotliBuilder/Components/BrotliMarkerInfoPanel.Designer.cs similarity index 66% rename from BrotliBuilder/Dialogs/FormBitStreamContext.Designer.cs rename to BrotliBuilder/Components/BrotliMarkerInfoPanel.Designer.cs index 287b73c..1322384 100644 --- a/BrotliBuilder/Dialogs/FormBitStreamContext.Designer.cs +++ b/BrotliBuilder/Components/BrotliMarkerInfoPanel.Designer.cs @@ -1,11 +1,11 @@ -namespace BrotliBuilder.Dialogs { - partial class FormBitStreamContext { - /// <summary> +namespace BrotliBuilder.Components { + partial class BrotliMarkerInfoPanel { + /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; - /// <summary> + /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> @@ -16,17 +16,20 @@ base.Dispose(disposing); } - #region Windows Form Designer generated code + #region Component Designer generated code - /// <summary> - /// Required method for Designer support - do not modify + /// <summary> + /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormBitStreamContext)); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BrotliMarkerInfoPanel)); this.textBoxContext = new FastColoredTextBoxNS.FastColoredTextBox(); + this.labelMarkerInfo = new System.Windows.Forms.Label(); + this.panel = new System.Windows.Forms.Panel(); ((System.ComponentModel.ISupportInitialize)(this.textBoxContext)).BeginInit(); + this.panel.SuspendLayout(); this.SuspendLayout(); // // textBoxContext @@ -52,30 +55,49 @@ this.textBoxContext.Font = new System.Drawing.Font("Consolas", 9.75F); this.textBoxContext.Hotkeys = resources.GetString("textBoxContext.Hotkeys"); this.textBoxContext.IsReplaceMode = false; - this.textBoxContext.Location = new System.Drawing.Point(12, 12); + this.textBoxContext.Location = new System.Drawing.Point(12, 20); + this.textBoxContext.Margin = new System.Windows.Forms.Padding(12, 5, 0, 8); this.textBoxContext.Name = "textBoxContext"; this.textBoxContext.Paddings = new System.Windows.Forms.Padding(0); this.textBoxContext.ReadOnly = true; this.textBoxContext.SelectionColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(255))))); this.textBoxContext.ServiceColors = ((FastColoredTextBoxNS.ServiceColors)(resources.GetObject("textBoxContext.ServiceColors"))); this.textBoxContext.ShowLineNumbers = false; - this.textBoxContext.Size = new System.Drawing.Size(280, 258); - this.textBoxContext.TabIndex = 0; + this.textBoxContext.Size = new System.Drawing.Size(588, 372); + this.textBoxContext.TabIndex = 1; this.textBoxContext.TabLength = 3; this.textBoxContext.Zoom = 100; // - // FormBitStreamContext + // labelMarkerInfo // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.labelMarkerInfo.AutoSize = true; + this.labelMarkerInfo.Location = new System.Drawing.Point(9, 2); + this.labelMarkerInfo.Margin = new System.Windows.Forms.Padding(3, 2, 3, 0); + this.labelMarkerInfo.Name = "labelMarkerInfo"; + this.labelMarkerInfo.Size = new System.Drawing.Size(61, 13); + this.labelMarkerInfo.TabIndex = 2; + this.labelMarkerInfo.Text = "Marker Info"; + // + // panel + // + this.panel.Controls.Add(this.labelMarkerInfo); + this.panel.Controls.Add(this.textBoxContext); + this.panel.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel.Location = new System.Drawing.Point(0, 0); + this.panel.Name = "panel"; + this.panel.Size = new System.Drawing.Size(600, 400); + this.panel.TabIndex = 3; + // + // BrotliMarkerInfoPanel + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(304, 282); - this.Controls.Add(this.textBoxContext); - this.Font = new System.Drawing.Font("Segoe UI", 9F); - this.MinimumSize = new System.Drawing.Size(320, 320); - this.Name = "FormBitStreamContext"; - this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; - this.Text = "Bit Stream"; + this.Controls.Add(this.panel); + this.Name = "BrotliMarkerInfoPanel"; + this.Size = new System.Drawing.Size(600, 400); ((System.ComponentModel.ISupportInitialize)(this.textBoxContext)).EndInit(); + this.panel.ResumeLayout(false); + this.panel.PerformLayout(); this.ResumeLayout(false); } @@ -83,5 +105,7 @@ #endregion private FastColoredTextBoxNS.FastColoredTextBox textBoxContext; + private System.Windows.Forms.Label labelMarkerInfo; + private System.Windows.Forms.Panel panel; } -} \ No newline at end of file +} diff --git a/BrotliBuilder/Dialogs/FormBitStreamContext.cs b/BrotliBuilder/Components/BrotliMarkerInfoPanel.cs similarity index 57% rename from BrotliBuilder/Dialogs/FormBitStreamContext.cs rename to BrotliBuilder/Components/BrotliMarkerInfoPanel.cs index 5c9ae53..36dc65e 100644 --- a/BrotliBuilder/Dialogs/FormBitStreamContext.cs +++ b/BrotliBuilder/Components/BrotliMarkerInfoPanel.cs @@ -1,53 +1,32 @@ using System.Collections.Generic; using System.Drawing; -using System.Linq; using System.Text; using System.Windows.Forms; using BrotliLib.Markers; using FastColoredTextBoxNS; -namespace BrotliBuilder.Dialogs{ - public partial class FormBitStreamContext : Form{ +namespace BrotliBuilder.Components{ + public partial class BrotliMarkerInfoPanel : UserControl{ private static readonly TextStyle StyleNormalBlack = new TextStyle(new SolidBrush(Color.Black), null, FontStyle.Regular); - private static readonly TextStyle StyleNormalGray = new TextStyle(new SolidBrush(Color.DarkGray), null, FontStyle.Regular); + private static readonly TextStyle StyleNormalGray = new TextStyle(new SolidBrush(Color.FromArgb(140, 140, 150)), null, FontStyle.Regular); private static readonly TextStyle StyleBoldBlack = new TextStyle(new SolidBrush(Color.Black), null, FontStyle.Bold); - private static readonly TextStyle StyleBoldGray = new TextStyle(new SolidBrush(Color.DarkGray), null, FontStyle.Bold); + private static readonly TextStyle StyleBoldGray = new TextStyle(new SolidBrush(Color.FromArgb(140, 140, 150)), null, FontStyle.Bold); private static readonly TextStyle[,] Styles = { { null /*default*/, StyleBoldGray }, { StyleNormalBlack, StyleBoldBlack } }; - public static FormBitStreamContext GetOrSpawn(IWin32Window owner){ - var mainForm = Application.OpenForms.OfType<FormMain>().FirstOrDefault(); - var dialogForm = Application.OpenForms.OfType<FormBitStreamContext>().FirstOrDefault(); - - if (dialogForm == null){ - dialogForm = new FormBitStreamContext(); - dialogForm.Show(owner); - } - - if (mainForm != null){ - Point loc = mainForm.Location; - loc.Offset(-dialogForm.Width, 0); - - dialogForm.Location = loc; - dialogForm.Height = mainForm.Height; - } - - return dialogForm; + public BrotliMarkerInfoPanel(){ + InitializeComponent(); + textBoxContext.DefaultStyle = StyleNormalGray; } private IList<MarkerNode> prevMarkerNodes = null; private MarkerNode prevCaretNode = null; - public FormBitStreamContext(){ - InitializeComponent(); - textBoxContext.DefaultStyle = StyleNormalGray; - } - - public void Display(IList<MarkerNode> markerNodes, HashSet<MarkerNode> highlightedNodes, MarkerNode caretNode){ + public void UpdateMarkers(IList<MarkerNode> markerSequence, HashSet<MarkerNode> highlightedNodes, MarkerNode caretNode){ if (ReferenceEquals(prevCaretNode, caretNode)){ return; } @@ -57,12 +36,12 @@ namespace BrotliBuilder.Dialogs{ textBoxContext.Selection.BeginUpdate(); textBoxContext.ClearStyle(StyleIndex.All); - if (!ReferenceEquals(prevMarkerNodes, markerNodes)){ - prevMarkerNodes = markerNodes; + if (!ReferenceEquals(prevMarkerNodes, markerSequence)){ + prevMarkerNodes = markerSequence; StringBuilder build = new StringBuilder(512); - foreach(MarkerNode node in markerNodes){ + foreach(MarkerNode node in markerSequence){ build.Append('\t', node.Depth); build.Append(node.Marker.Info); build.Append('\n'); @@ -71,8 +50,8 @@ namespace BrotliBuilder.Dialogs{ textBoxContext.Text = build.ToString(); } - for(int line = 0; line < markerNodes.Count; line++){ - MarkerNode node = markerNodes[line]; + for(int line = 0; line < markerSequence.Count; line++){ + MarkerNode node = markerSequence[line]; IMarkerInfo info = node.Marker.Info; int indexColor = highlightedNodes.Contains(node) ? 1 : 0; @@ -85,7 +64,7 @@ namespace BrotliBuilder.Dialogs{ } } - int caretLine = markerNodes.IndexOf(caretNode); + int caretLine = markerSequence.IndexOf(caretNode); textBoxContext.Navigate(caretLine); textBoxContext.Selection.EndUpdate(); diff --git a/BrotliBuilder/Dialogs/FormBitStreamContext.resx b/BrotliBuilder/Components/BrotliMarkerInfoPanel.resx similarity index 100% rename from BrotliBuilder/Dialogs/FormBitStreamContext.resx rename to BrotliBuilder/Components/BrotliMarkerInfoPanel.resx diff --git a/BrotliBuilder/Components/MarkedTextBox.cs b/BrotliBuilder/Components/MarkedTextBox.cs index dbf73e8..adab3d7 100644 --- a/BrotliBuilder/Components/MarkedTextBox.cs +++ b/BrotliBuilder/Components/MarkedTextBox.cs @@ -3,13 +3,12 @@ using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Windows.Forms; -using BrotliBuilder.Dialogs; using BrotliBuilder.Utils; using BrotliLib.Markers; using FastColoredTextBoxNS; namespace BrotliBuilder.Components{ - class MarkedTextBox : FastColoredTextBox{ + public class MarkedTextBox : FastColoredTextBox{ private static readonly TextStyle[] MainStyles = Colors.List .Select(color => Colors.Mix(SystemColors.Control, color, 0.725)) .Select(color => new TextStyle(new SolidBrush(Color.Black), new SolidBrush(color), FontStyle.Regular)) @@ -17,6 +16,20 @@ namespace BrotliBuilder.Components{ private static readonly TextStyle HighlightStyle = new TextStyle(new SolidBrush(Color.White), new SolidBrush(Color.FromArgb(48, 48, 48)), FontStyle.Regular); + public class MarkerUpdateEventArgs : EventArgs{ + public IList<MarkerNode> MarkerSequence { get; } + public HashSet<MarkerNode> HighlightedNodes { get; } + public MarkerNode CaretNode { get; } + + public MarkerUpdateEventArgs(IList<MarkerNode> markerSequence, HashSet<MarkerNode> highlightedNodes, MarkerNode caretNode){ + this.MarkerSequence = markerSequence; + this.HighlightedNodes = highlightedNodes; + this.CaretNode = caretNode; + } + } + + public event EventHandler<MarkerUpdateEventArgs> MarkersUpdated; + private readonly StyleIndex[] mainStyleIndex; private readonly StyleIndex highlightStyleIndex; @@ -114,7 +127,7 @@ namespace BrotliBuilder.Components{ updatingMarkers = false; markerCaret = newMarkerCaret; - FormBitStreamContext.GetOrSpawn(this).Display(markerSequence, new HashSet<MarkerNode>(highlightedMarkers), markerCaret); + MarkersUpdated?.Invoke(this, new MarkerUpdateEventArgs(markerSequence, new HashSet<MarkerNode>(highlightedMarkers), markerCaret)); } private void MarkedFastTextBox_SelectionChanged(object sender, EventArgs e){ diff --git a/BrotliBuilder/FormMain.Designer.cs b/BrotliBuilder/FormMain.Designer.cs index c1afa08..0c00a0e 100644 --- a/BrotliBuilder/FormMain.Designer.cs +++ b/BrotliBuilder/FormMain.Designer.cs @@ -47,18 +47,25 @@ this.statusBarPanelPadding2 = new System.Windows.Forms.StatusBarPanel(); this.statusBarPanelTimeOutput = new System.Windows.Forms.StatusBarPanel(); this.timerRegenerationDelay = new System.Windows.Forms.Timer(this.components); - this.splitContainerBottom = new System.Windows.Forms.SplitContainer(); + this.splitContainerRightBottom = new System.Windows.Forms.SplitContainer(); this.brotliFilePanelGenerated = new BrotliBuilder.Components.BrotliFilePanel(); this.brotliFilePanelOriginal = new BrotliBuilder.Components.BrotliFilePanel(); + this.splitContainerRight = new System.Windows.Forms.SplitContainer(); this.splitContainerMain = new System.Windows.Forms.SplitContainer(); + this.brotliMarkerInfoPanel = new BrotliBuilder.Components.BrotliMarkerInfoPanel(); + this.labelFileStructure = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.statusBarPanelPadding1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.statusBarPanelTimeBits)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.statusBarPanelPadding2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.statusBarPanelTimeOutput)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.splitContainerBottom)).BeginInit(); - this.splitContainerBottom.Panel1.SuspendLayout(); - this.splitContainerBottom.Panel2.SuspendLayout(); - this.splitContainerBottom.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainerRightBottom)).BeginInit(); + this.splitContainerRightBottom.Panel1.SuspendLayout(); + this.splitContainerRightBottom.Panel2.SuspendLayout(); + this.splitContainerRightBottom.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainerRight)).BeginInit(); + this.splitContainerRight.Panel1.SuspendLayout(); + this.splitContainerRight.Panel2.SuspendLayout(); + this.splitContainerRight.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainerMain)).BeginInit(); this.splitContainerMain.Panel1.SuspendLayout(); this.splitContainerMain.Panel2.SuspendLayout(); @@ -186,10 +193,11 @@ | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.flowPanelBlocks.BackColor = System.Drawing.SystemColors.Control; - this.flowPanelBlocks.Location = new System.Drawing.Point(0, 0); - this.flowPanelBlocks.Margin = new System.Windows.Forms.Padding(0); + this.flowPanelBlocks.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.flowPanelBlocks.Location = new System.Drawing.Point(14, 28); + this.flowPanelBlocks.Margin = new System.Windows.Forms.Padding(14, 6, 6, 3); this.flowPanelBlocks.Name = "flowPanelBlocks"; - this.flowPanelBlocks.Size = new System.Drawing.Size(1008, 230); + this.flowPanelBlocks.Size = new System.Drawing.Size(855, 177); this.flowPanelBlocks.TabIndex = 0; this.flowPanelBlocks.WrapContents = false; this.flowPanelBlocks.SizeChanged += new System.EventHandler(this.flowPanelBlocks_SizeChanged); @@ -197,7 +205,7 @@ // // statusBar // - this.statusBar.Location = new System.Drawing.Point(0, 639); + this.statusBar.Location = new System.Drawing.Point(0, 580); this.statusBar.Name = "statusBar"; this.statusBar.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] { this.statusBarPanelPadding1, @@ -205,7 +213,7 @@ this.statusBarPanelPadding2, this.statusBarPanelTimeOutput}); this.statusBar.ShowPanels = true; - this.statusBar.Size = new System.Drawing.Size(1008, 22); + this.statusBar.Size = new System.Drawing.Size(1264, 22); this.statusBar.SizingGrip = false; this.statusBar.TabIndex = 1; // @@ -238,29 +246,29 @@ this.timerRegenerationDelay.Interval = 300; this.timerRegenerationDelay.Tick += new System.EventHandler(this.timerRegenerationDelay_Tick); // - // splitContainerBottom + // splitContainerRightBottom // - this.splitContainerBottom.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + this.splitContainerRightBottom.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.splitContainerBottom.BackColor = System.Drawing.SystemColors.ActiveBorder; - this.splitContainerBottom.Location = new System.Drawing.Point(0, 0); - this.splitContainerBottom.Margin = new System.Windows.Forms.Padding(0, 0, 0, 3); - this.splitContainerBottom.Name = "splitContainerBottom"; + this.splitContainerRightBottom.BackColor = System.Drawing.SystemColors.ActiveBorder; + this.splitContainerRightBottom.Location = new System.Drawing.Point(0, 0); + this.splitContainerRightBottom.Margin = new System.Windows.Forms.Padding(0, 0, 0, 3); + this.splitContainerRightBottom.Name = "splitContainerRightBottom"; // - // splitContainerBottom.Panel1 + // splitContainerRightBottom.Panel1 // - this.splitContainerBottom.Panel1.BackColor = System.Drawing.SystemColors.ControlLight; - this.splitContainerBottom.Panel1.Controls.Add(this.brotliFilePanelGenerated); + this.splitContainerRightBottom.Panel1.BackColor = System.Drawing.SystemColors.ControlLight; + this.splitContainerRightBottom.Panel1.Controls.Add(this.brotliFilePanelGenerated); // - // splitContainerBottom.Panel2 + // splitContainerRightBottom.Panel2 // - this.splitContainerBottom.Panel2.BackColor = System.Drawing.SystemColors.ControlLight; - this.splitContainerBottom.Panel2.Controls.Add(this.brotliFilePanelOriginal); - this.splitContainerBottom.Size = new System.Drawing.Size(1008, 404); - this.splitContainerBottom.SplitterDistance = 503; - this.splitContainerBottom.SplitterWidth = 2; - this.splitContainerBottom.TabIndex = 0; + this.splitContainerRightBottom.Panel2.BackColor = System.Drawing.SystemColors.ControlLight; + this.splitContainerRightBottom.Panel2.Controls.Add(this.brotliFilePanelOriginal); + this.splitContainerRightBottom.Size = new System.Drawing.Size(884, 375); + this.splitContainerRightBottom.SplitterDistance = 441; + this.splitContainerRightBottom.SplitterWidth = 2; + this.splitContainerRightBottom.TabIndex = 0; // // brotliFilePanelGenerated // @@ -271,8 +279,9 @@ this.brotliFilePanelGenerated.Location = new System.Drawing.Point(0, 5); this.brotliFilePanelGenerated.Margin = new System.Windows.Forms.Padding(3, 5, 3, 3); this.brotliFilePanelGenerated.Name = "brotliFilePanelGenerated"; - this.brotliFilePanelGenerated.Size = new System.Drawing.Size(503, 399); + this.brotliFilePanelGenerated.Size = new System.Drawing.Size(440, 365); this.brotliFilePanelGenerated.TabIndex = 0; + this.brotliFilePanelGenerated.MarkersUpdated += new System.EventHandler<BrotliBuilder.Components.MarkedTextBox.MarkerUpdateEventArgs>(this.brotliFilePanel_MarkersUpdated); // // brotliFilePanelOriginal // @@ -283,37 +292,81 @@ this.brotliFilePanelOriginal.Location = new System.Drawing.Point(0, 5); this.brotliFilePanelOriginal.Margin = new System.Windows.Forms.Padding(3, 5, 3, 3); this.brotliFilePanelOriginal.Name = "brotliFilePanelOriginal"; - this.brotliFilePanelOriginal.Size = new System.Drawing.Size(503, 399); + this.brotliFilePanelOriginal.Size = new System.Drawing.Size(439, 365); this.brotliFilePanelOriginal.TabIndex = 0; + this.brotliFilePanelOriginal.MarkersUpdated += new System.EventHandler<BrotliBuilder.Components.MarkedTextBox.MarkerUpdateEventArgs>(this.brotliFilePanel_MarkersUpdated); + // + // splitContainerRight + // + this.splitContainerRight.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.splitContainerRight.Location = new System.Drawing.Point(0, 0); + this.splitContainerRight.Margin = new System.Windows.Forms.Padding(0); + this.splitContainerRight.Name = "splitContainerRight"; + this.splitContainerRight.Orientation = System.Windows.Forms.Orientation.Horizontal; + // + // splitContainerRight.Panel1 + // + this.splitContainerRight.Panel1.Controls.Add(this.labelFileStructure); + this.splitContainerRight.Panel1.Controls.Add(this.flowPanelBlocks); + this.splitContainerRight.Panel1MinSize = 200; + // + // splitContainerRight.Panel2 + // + this.splitContainerRight.Panel2.Controls.Add(this.splitContainerRightBottom); + this.splitContainerRight.Panel2MinSize = 200; + this.splitContainerRight.Size = new System.Drawing.Size(884, 580); + this.splitContainerRight.SplitterDistance = 208; + this.splitContainerRight.SplitterWidth = 2; + this.splitContainerRight.TabIndex = 0; // // splitContainerMain // this.splitContainerMain.Dock = System.Windows.Forms.DockStyle.Fill; this.splitContainerMain.Location = new System.Drawing.Point(0, 0); - this.splitContainerMain.Margin = new System.Windows.Forms.Padding(0); this.splitContainerMain.Name = "splitContainerMain"; - this.splitContainerMain.Orientation = System.Windows.Forms.Orientation.Horizontal; // // splitContainerMain.Panel1 // - this.splitContainerMain.Panel1.Controls.Add(this.flowPanelBlocks); - this.splitContainerMain.Panel1MinSize = 200; + this.splitContainerMain.Panel1.Controls.Add(this.brotliMarkerInfoPanel); + this.splitContainerMain.Panel1MinSize = 150; // // splitContainerMain.Panel2 // - this.splitContainerMain.Panel2.Controls.Add(this.splitContainerBottom); - this.splitContainerMain.Panel2MinSize = 200; - this.splitContainerMain.Size = new System.Drawing.Size(1008, 639); - this.splitContainerMain.SplitterDistance = 230; - this.splitContainerMain.SplitterWidth = 2; - this.splitContainerMain.TabIndex = 0; + this.splitContainerMain.Panel2.Controls.Add(this.splitContainerRight); + this.splitContainerMain.Panel2MinSize = 250; + this.splitContainerMain.Size = new System.Drawing.Size(1264, 580); + this.splitContainerMain.SplitterDistance = 376; + this.splitContainerMain.TabIndex = 2; + // + // brotliMarkerInfoPanel + // + this.brotliMarkerInfoPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.brotliMarkerInfoPanel.Location = new System.Drawing.Point(0, 5); + this.brotliMarkerInfoPanel.Margin = new System.Windows.Forms.Padding(3, 5, 3, 3); + this.brotliMarkerInfoPanel.Name = "brotliMarkerInfoPanel"; + this.brotliMarkerInfoPanel.Size = new System.Drawing.Size(377, 575); + this.brotliMarkerInfoPanel.TabIndex = 1; + // + // labelFileStructure + // + this.labelFileStructure.AutoSize = true; + this.labelFileStructure.Location = new System.Drawing.Point(11, 7); + this.labelFileStructure.Margin = new System.Windows.Forms.Padding(11, 7, 3, 0); + this.labelFileStructure.Name = "labelFileStructure"; + this.labelFileStructure.Size = new System.Drawing.Size(76, 15); + this.labelFileStructure.TabIndex = 1; + this.labelFileStructure.Text = "File Structure"; // // FormMain // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.SystemColors.ControlLight; - this.ClientSize = new System.Drawing.Size(1008, 661); + this.ClientSize = new System.Drawing.Size(1264, 602); this.Controls.Add(this.splitContainerMain); this.Controls.Add(this.statusBar); this.Font = new System.Drawing.Font("Segoe UI", 9F); @@ -327,10 +380,15 @@ ((System.ComponentModel.ISupportInitialize)(this.statusBarPanelTimeBits)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.statusBarPanelPadding2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.statusBarPanelTimeOutput)).EndInit(); - this.splitContainerBottom.Panel1.ResumeLayout(false); - this.splitContainerBottom.Panel2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.splitContainerBottom)).EndInit(); - this.splitContainerBottom.ResumeLayout(false); + this.splitContainerRightBottom.Panel1.ResumeLayout(false); + this.splitContainerRightBottom.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainerRightBottom)).EndInit(); + this.splitContainerRightBottom.ResumeLayout(false); + this.splitContainerRight.Panel1.ResumeLayout(false); + this.splitContainerRight.Panel1.PerformLayout(); + this.splitContainerRight.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainerRight)).EndInit(); + this.splitContainerRight.ResumeLayout(false); this.splitContainerMain.Panel1.ResumeLayout(false); this.splitContainerMain.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainerMain)).EndInit(); @@ -358,15 +416,18 @@ private System.Windows.Forms.MenuItem menuItemEncodeUncompressedMBs; private System.Windows.Forms.MenuItem menuItemView; private System.Windows.Forms.MenuItem menuItemStaticDictionary; - private System.Windows.Forms.SplitContainer splitContainerBottom; + private System.Windows.Forms.SplitContainer splitContainerRightBottom; private System.Windows.Forms.MenuItem menuItemWrapOutput; private Components.BrotliFilePanel brotliFilePanelGenerated; private Components.BrotliFilePanel brotliFilePanelOriginal; - private System.Windows.Forms.SplitContainer splitContainerMain; + private System.Windows.Forms.SplitContainer splitContainerRight; private System.Windows.Forms.MenuItem menuItemFileStructure; private System.Windows.Forms.MenuItem menuItemEncodeLiterals; private System.Windows.Forms.MenuItem menuItemTransform; private System.Windows.Forms.MenuItem menuItemTransformTestDistanceParams; private System.Windows.Forms.MenuItem menuItemTransformRebuild; + private System.Windows.Forms.SplitContainer splitContainerMain; + private Components.BrotliMarkerInfoPanel brotliMarkerInfoPanel; + private System.Windows.Forms.Label labelFileStructure; } } \ No newline at end of file diff --git a/BrotliBuilder/FormMain.cs b/BrotliBuilder/FormMain.cs index 8a544ea..4ceec27 100644 --- a/BrotliBuilder/FormMain.cs +++ b/BrotliBuilder/FormMain.cs @@ -3,6 +3,7 @@ using System.Diagnostics; using System.IO; using System.Windows.Forms; using BrotliBuilder.Blocks; +using BrotliBuilder.Components; using BrotliBuilder.Dialogs; using BrotliImpl.Encoders; using BrotliImpl.Transformers; @@ -63,14 +64,14 @@ namespace BrotliBuilder{ public FormMain(){ InitializeComponent(); - splitContainerBottom.Panel2Collapsed = true; + splitContainerRightBottom.Panel2Collapsed = true; OnNewBrotliFile(); } #region File state handling private void LoadExistingBrotliFile(byte[] bytes){ - splitContainerBottom.Panel2Collapsed = false; + splitContainerRightBottom.Panel2Collapsed = false; statusBarPanelTimeBits.Text = "Decompressing..."; statusBarPanelTimeOutput.Text = "Decompressing..."; @@ -182,6 +183,10 @@ namespace BrotliBuilder{ flowPanelBlocks.ResumeLayout(true); } + + private void brotliFilePanel_MarkersUpdated(object sender, MarkedTextBox.MarkerUpdateEventArgs e){ + brotliMarkerInfoPanel.UpdateMarkers(e.MarkerSequence, e.HighlightedNodes, e.CaretNode); + } #endregion @@ -239,7 +244,7 @@ namespace BrotliBuilder{ bool enable = !menuItemFileStructure.Checked; menuItemFileStructure.Checked = enable; - splitContainerMain.Panel1Collapsed = !enable; + splitContainerRight.Panel1Collapsed = !enable; } private void menuItemWrapOutput_Click(object sender, EventArgs e){ @@ -295,7 +300,7 @@ namespace BrotliBuilder{ return; } - splitContainerBottom.Panel2Collapsed = true; + splitContainerRightBottom.Panel2Collapsed = true; UpdateBrotliFile(() => { try{