Show history item info inside history form

This commit is contained in:
Jaex 2021-08-04 02:18:48 +03:00
parent 0894440771
commit 723535a7ec
4 changed files with 151 additions and 7 deletions

View file

@ -63,6 +63,8 @@ private void InitializeComponent()
this.tsbSettings = new System.Windows.Forms.ToolStripButton(); this.tsbSettings = new System.Windows.Forms.ToolStripButton();
this.scMain = new ShareX.HelpersLib.SplitContainerCustomSplitter(); this.scMain = new ShareX.HelpersLib.SplitContainerCustomSplitter();
this.pbThumbnail = new ShareX.HelpersLib.MyPictureBox(); this.pbThumbnail = new ShareX.HelpersLib.MyPictureBox();
this.pgHistoryItemInfo = new System.Windows.Forms.PropertyGrid();
this.scHistoryItemInfo = new ShareX.HelpersLib.SplitContainerCustomSplitter();
this.tscHistory.ContentPanel.SuspendLayout(); this.tscHistory.ContentPanel.SuspendLayout();
this.tscHistory.TopToolStripPanel.SuspendLayout(); this.tscHistory.TopToolStripPanel.SuspendLayout();
this.tscHistory.SuspendLayout(); this.tscHistory.SuspendLayout();
@ -72,6 +74,10 @@ private void InitializeComponent()
this.scMain.Panel1.SuspendLayout(); this.scMain.Panel1.SuspendLayout();
this.scMain.Panel2.SuspendLayout(); this.scMain.Panel2.SuspendLayout();
this.scMain.SuspendLayout(); this.scMain.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.scHistoryItemInfo)).BeginInit();
this.scHistoryItemInfo.Panel1.SuspendLayout();
this.scHistoryItemInfo.Panel2.SuspendLayout();
this.scHistoryItemInfo.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// tscHistory // tscHistory
@ -315,7 +321,7 @@ private void InitializeComponent()
// //
// scMain.Panel2 // scMain.Panel2
// //
this.scMain.Panel2.Controls.Add(this.pbThumbnail); this.scMain.Panel2.Controls.Add(this.scHistoryItemInfo);
this.scMain.SplitterColor = System.Drawing.Color.White; this.scMain.SplitterColor = System.Drawing.Color.White;
this.scMain.SplitterLineColor = System.Drawing.Color.FromArgb(((int)(((byte)(189)))), ((int)(((byte)(189)))), ((int)(((byte)(189))))); this.scMain.SplitterLineColor = System.Drawing.Color.FromArgb(((int)(((byte)(189)))), ((int)(((byte)(189)))), ((int)(((byte)(189)))));
// //
@ -329,6 +335,29 @@ private void InitializeComponent()
this.pbThumbnail.PictureBoxBackColor = System.Drawing.SystemColors.Control; this.pbThumbnail.PictureBoxBackColor = System.Drawing.SystemColors.Control;
this.pbThumbnail.ShowImageSizeLabel = true; this.pbThumbnail.ShowImageSizeLabel = true;
// //
// pgHistoryItemInfo
//
resources.ApplyResources(this.pgHistoryItemInfo, "pgHistoryItemInfo");
this.pgHistoryItemInfo.Name = "pgHistoryItemInfo";
this.pgHistoryItemInfo.PropertySort = System.Windows.Forms.PropertySort.NoSort;
this.pgHistoryItemInfo.ToolbarVisible = false;
//
// scHistoryItemInfo
//
resources.ApplyResources(this.scHistoryItemInfo, "scHistoryItemInfo");
this.scHistoryItemInfo.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
this.scHistoryItemInfo.Name = "scHistoryItemInfo";
//
// scHistoryItemInfo.Panel1
//
this.scHistoryItemInfo.Panel1.Controls.Add(this.pbThumbnail);
//
// scHistoryItemInfo.Panel2
//
this.scHistoryItemInfo.Panel2.Controls.Add(this.pgHistoryItemInfo);
this.scHistoryItemInfo.SplitterColor = System.Drawing.Color.White;
this.scHistoryItemInfo.SplitterLineColor = System.Drawing.Color.FromArgb(((int)(((byte)(189)))), ((int)(((byte)(189)))), ((int)(((byte)(189)))));
//
// HistoryForm // HistoryForm
// //
resources.ApplyResources(this, "$this"); resources.ApplyResources(this, "$this");
@ -354,6 +383,10 @@ private void InitializeComponent()
this.scMain.Panel2.ResumeLayout(false); this.scMain.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.scMain)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.scMain)).EndInit();
this.scMain.ResumeLayout(false); this.scMain.ResumeLayout(false);
this.scHistoryItemInfo.Panel1.ResumeLayout(false);
this.scHistoryItemInfo.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.scHistoryItemInfo)).EndInit();
this.scHistoryItemInfo.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@ -393,5 +426,7 @@ private void InitializeComponent()
private System.Windows.Forms.Button btnAdvancedSearchReset; private System.Windows.Forms.Button btnAdvancedSearchReset;
private System.Windows.Forms.ToolStripButton tsbCopyStats; private System.Windows.Forms.ToolStripButton tsbCopyStats;
private System.Windows.Forms.ToolStripSeparator tss2; private System.Windows.Forms.ToolStripSeparator tss2;
private System.Windows.Forms.PropertyGrid pgHistoryItemInfo;
private HelpersLib.SplitContainerCustomSplitter scHistoryItemInfo;
} }
} }

View file

@ -65,12 +65,14 @@ public HistoryForm(string historyPath, HistorySettings settings, Action<string>
il.Images.Add(Resources.globe); il.Images.Add(Resources.globe);
lvHistory.SmallImageList = il; lvHistory.SmallImageList = il;
him = new HistoryItemManager(uploadFile, editImage); him = new HistoryItemManager(uploadFile, editImage, ShowMoreInfo);
him.GetHistoryItems += him_GetHistoryItems; him.GetHistoryItems += him_GetHistoryItems;
lvHistory.ContextMenuStrip = him.cmsHistory; lvHistory.ContextMenuStrip = him.cmsHistory;
pbThumbnail.Reset(); pbThumbnail.Reset();
lvHistory.FillLastColumn(); lvHistory.FillLastColumn();
scHistoryItemInfo.SplitterWidth = 7; // Because of bug must be assigned here again
scHistoryItemInfo.Panel2Collapsed = true;
if (Settings.RememberSearchText) if (Settings.RememberSearchText)
{ {
@ -282,6 +284,11 @@ private void UpdateControls()
{ {
UpdatePictureBox(); UpdatePictureBox();
} }
if (!scHistoryItemInfo.Panel2Collapsed)
{
pgHistoryItemInfo.SelectedObject = historyItem;
}
} }
private void UpdatePictureBox() private void UpdatePictureBox()
@ -525,6 +532,12 @@ private void lvHistory_ItemDrag(object sender, ItemDragEventArgs e)
} }
} }
private void ShowMoreInfo(HistoryItem historyItem)
{
pgHistoryItemInfo.SelectedObject = historyItem;
scHistoryItemInfo.Panel2Collapsed = false;
}
#endregion Form events #endregion Form events
} }
} }

View file

@ -954,6 +954,18 @@
<data name="scMain.Panel1MinSize" type="System.Int32, mscorlib"> <data name="scMain.Panel1MinSize" type="System.Int32, mscorlib">
<value>100</value> <value>100</value>
</data> </data>
<data name="scHistoryItemInfo.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="scHistoryItemInfo.IsSplitterFixed" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="scHistoryItemInfo.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>
<data name="scHistoryItemInfo.Orientation" type="System.Windows.Forms.Orientation, System.Windows.Forms">
<value>Horizontal</value>
</data>
<data name="pbThumbnail.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms"> <data name="pbThumbnail.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value> <value>Fill</value>
</data> </data>
@ -961,7 +973,7 @@
<value>0, 0</value> <value>0, 0</value>
</data> </data>
<data name="pbThumbnail.Size" type="System.Drawing.Size, System.Drawing"> <data name="pbThumbnail.Size" type="System.Drawing.Size, System.Drawing">
<value>628, 661</value> <value>627, 475</value>
</data> </data>
<data name="pbThumbnail.TabIndex" type="System.Int32, mscorlib"> <data name="pbThumbnail.TabIndex" type="System.Int32, mscorlib">
<value>3</value> <value>3</value>
@ -973,11 +985,86 @@
<value>ShareX.HelpersLib.MyPictureBox, ShareX.HelpersLib, Version=13.5.1.0, Culture=neutral, PublicKeyToken=null</value> <value>ShareX.HelpersLib.MyPictureBox, ShareX.HelpersLib, Version=13.5.1.0, Culture=neutral, PublicKeyToken=null</value>
</data> </data>
<data name="&gt;&gt;pbThumbnail.Parent" xml:space="preserve"> <data name="&gt;&gt;pbThumbnail.Parent" xml:space="preserve">
<value>scMain.Panel2</value> <value>scHistoryItemInfo.Panel1</value>
</data> </data>
<data name="&gt;&gt;pbThumbnail.ZOrder" xml:space="preserve"> <data name="&gt;&gt;pbThumbnail.ZOrder" xml:space="preserve">
<value>0</value> <value>0</value>
</data> </data>
<data name="&gt;&gt;scHistoryItemInfo.Panel1.Name" xml:space="preserve">
<value>scHistoryItemInfo.Panel1</value>
</data>
<data name="&gt;&gt;scHistoryItemInfo.Panel1.Type" xml:space="preserve">
<value>System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;scHistoryItemInfo.Panel1.Parent" xml:space="preserve">
<value>scHistoryItemInfo</value>
</data>
<data name="&gt;&gt;scHistoryItemInfo.Panel1.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="pgHistoryItemInfo.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="pgHistoryItemInfo.HelpVisible" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="pgHistoryItemInfo.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>
<data name="pgHistoryItemInfo.Size" type="System.Drawing.Size, System.Drawing">
<value>627, 179</value>
</data>
<data name="pgHistoryItemInfo.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="&gt;&gt;pgHistoryItemInfo.Name" xml:space="preserve">
<value>pgHistoryItemInfo</value>
</data>
<data name="&gt;&gt;pgHistoryItemInfo.Type" xml:space="preserve">
<value>System.Windows.Forms.PropertyGrid, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;pgHistoryItemInfo.Parent" xml:space="preserve">
<value>scHistoryItemInfo.Panel2</value>
</data>
<data name="&gt;&gt;pgHistoryItemInfo.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="&gt;&gt;scHistoryItemInfo.Panel2.Name" xml:space="preserve">
<value>scHistoryItemInfo.Panel2</value>
</data>
<data name="&gt;&gt;scHistoryItemInfo.Panel2.Type" xml:space="preserve">
<value>System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;scHistoryItemInfo.Panel2.Parent" xml:space="preserve">
<value>scHistoryItemInfo</value>
</data>
<data name="&gt;&gt;scHistoryItemInfo.Panel2.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="scHistoryItemInfo.Size" type="System.Drawing.Size, System.Drawing">
<value>627, 661</value>
</data>
<data name="scHistoryItemInfo.SplitterDistance" type="System.Int32, mscorlib">
<value>475</value>
</data>
<data name="scHistoryItemInfo.SplitterWidth" type="System.Int32, mscorlib">
<value>7</value>
</data>
<data name="scHistoryItemInfo.TabIndex" type="System.Int32, mscorlib">
<value>5</value>
</data>
<data name="&gt;&gt;scHistoryItemInfo.Name" xml:space="preserve">
<value>scHistoryItemInfo</value>
</data>
<data name="&gt;&gt;scHistoryItemInfo.Type" xml:space="preserve">
<value>ShareX.HelpersLib.SplitContainerCustomSplitter, ShareX.HelpersLib, Version=13.5.1.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;scHistoryItemInfo.Parent" xml:space="preserve">
<value>scMain.Panel2</value>
</data>
<data name="&gt;&gt;scHistoryItemInfo.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="&gt;&gt;scMain.Panel2.Name" xml:space="preserve"> <data name="&gt;&gt;scMain.Panel2.Name" xml:space="preserve">
<value>scMain.Panel2</value> <value>scMain.Panel2</value>
</data> </data>
@ -1000,7 +1087,7 @@
<value>550</value> <value>550</value>
</data> </data>
<data name="scMain.SplitterWidth" type="System.Int32, mscorlib"> <data name="scMain.SplitterWidth" type="System.Int32, mscorlib">
<value>6</value> <value>7</value>
</data> </data>
<data name="scMain.TabIndex" type="System.Int32, mscorlib"> <data name="scMain.TabIndex" type="System.Int32, mscorlib">
<value>4</value> <value>4</value>

View file

@ -50,11 +50,13 @@ public partial class HistoryItemManager
public bool IsTextFile { get; private set; } public bool IsTextFile { get; private set; }
private Action<string> uploadFile, editImage; private Action<string> uploadFile, editImage;
private Action<HistoryItem> showMoreInfo;
public HistoryItemManager(Action<string> uploadFile, Action<string> editImage) public HistoryItemManager(Action<string> uploadFile, Action<string> editImage, Action<HistoryItem> showMoreInfo = null)
{ {
this.uploadFile = uploadFile; this.uploadFile = uploadFile;
this.editImage = editImage; this.editImage = editImage;
this.showMoreInfo = showMoreInfo;
InitializeComponent(); InitializeComponent();
} }
@ -518,7 +520,14 @@ public void EditImage()
public void ShowMoreInfo() public void ShowMoreInfo()
{ {
new HistoryItemInfoForm(HistoryItem).Show(); if (showMoreInfo != null)
{
showMoreInfo(HistoryItem);
}
else
{
new HistoryItemInfoForm(HistoryItem).Show();
}
} }
} }
} }