This repository has been archived by the owner on May 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
69 changed files
with
25,288 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 14 | ||
VisualStudioVersion = 14.0.25420.1 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "gMKVExtractGUI", "gMKVExtractGUI\gMKVExtractGUI.csproj", "{20EBEFF3-C838-4239-A236-EC055BF51398}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "gMKVToolNix", "gMKVToolNix\gMKVToolNix.csproj", "{82FC8FA8-50C0-44FA-8801-80050C0ED89F}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Debug|x86 = Debug|x86 | ||
Release|Any CPU = Release|Any CPU | ||
Release|x86 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{20EBEFF3-C838-4239-A236-EC055BF51398}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{20EBEFF3-C838-4239-A236-EC055BF51398}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{20EBEFF3-C838-4239-A236-EC055BF51398}.Debug|x86.ActiveCfg = Debug|x86 | ||
{20EBEFF3-C838-4239-A236-EC055BF51398}.Debug|x86.Build.0 = Debug|x86 | ||
{20EBEFF3-C838-4239-A236-EC055BF51398}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{20EBEFF3-C838-4239-A236-EC055BF51398}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{20EBEFF3-C838-4239-A236-EC055BF51398}.Release|x86.ActiveCfg = Release|x86 | ||
{20EBEFF3-C838-4239-A236-EC055BF51398}.Release|x86.Build.0 = Release|x86 | ||
{82FC8FA8-50C0-44FA-8801-80050C0ED89F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{82FC8FA8-50C0-44FA-8801-80050C0ED89F}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{82FC8FA8-50C0-44FA-8801-80050C0ED89F}.Debug|x86.ActiveCfg = Debug|x86 | ||
{82FC8FA8-50C0-44FA-8801-80050C0ED89F}.Debug|x86.Build.0 = Debug|x86 | ||
{82FC8FA8-50C0-44FA-8801-80050C0ED89F}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{82FC8FA8-50C0-44FA-8801-80050C0ED89F}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{82FC8FA8-50C0-44FA-8801-80050C0ED89F}.Release|x86.ActiveCfg = Release|x86 | ||
{82FC8FA8-50C0-44FA-8801-80050C0ED89F}.Release|x86.Build.0 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Runtime.InteropServices; | ||
using System.Text; | ||
using System.Windows.Forms; | ||
|
||
namespace gMKVToolNix.Controls | ||
{ | ||
public static class ControlExtensions | ||
{ | ||
[DllImport("user32.dll")] | ||
public static extern int SendMessage(IntPtr hWnd, Int32 wMsg, bool wParam, Int32 lParam); | ||
|
||
private const int WM_SETREDRAW = 11; | ||
|
||
/// <summary> | ||
/// Suspends ALL drawing for the specified control | ||
/// </summary> | ||
/// <param name="parent"></param> | ||
public static void SuspendDrawing(this Control parent) | ||
{ | ||
SendMessage(parent.Handle, WM_SETREDRAW, false, 0); | ||
} | ||
|
||
/// <summary> | ||
/// Resumes ALL drawing for the specified control | ||
/// </summary> | ||
/// <param name="parent"></param> | ||
public static void ResumeDrawing(this Control parent) | ||
{ | ||
SendMessage(parent.Handle, WM_SETREDRAW, true, 0); | ||
parent.Invalidate(true); | ||
} | ||
|
||
private static Boolean GetDesignMode(this Control control) | ||
{ | ||
BindingFlags bindFlags = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Static; | ||
PropertyInfo prop = control.GetType().GetProperty("DesignMode", bindFlags); | ||
return (Boolean)prop.GetValue(control, null); | ||
} | ||
|
||
/// <summary> | ||
/// Returns true if the control is currently in design mode, false otherwise | ||
/// </summary> | ||
/// <param name="control"></param> | ||
/// <returns></returns> | ||
public static Boolean IsInDesignMode(this Control control) | ||
{ | ||
Control parent = control.Parent; | ||
while (parent != null) | ||
{ | ||
if (parent.GetDesignMode()) | ||
{ | ||
return true; | ||
} | ||
parent = parent.Parent; | ||
} | ||
return control.GetDesignMode(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Windows.Forms; | ||
|
||
namespace gMKVToolNix.Controls | ||
{ | ||
public static class ExceptionExtensions | ||
{ | ||
/// <summary> | ||
/// Displays a messagebox containing the message of the exception and aldo writes the exception stacktrace to the Debug console | ||
/// </summary> | ||
/// <param name="ex"></param> | ||
public static void ShowException(this Exception ex) | ||
{ | ||
Debug.WriteLine(ex); | ||
MessageBox.Show(String.Format("An exception has occured!{0}{0}{1}", Environment.NewLine, ex.Message), "An exception has occured!", MessageBoxButtons.OK, MessageBoxIcon.Error); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.Drawing; | ||
using System.Runtime.InteropServices; | ||
using System.Text; | ||
using System.Windows.Forms; | ||
|
||
namespace gMKVToolNix | ||
{ | ||
|
||
public class gCheckedListBox: System.Windows.Forms.CheckedListBox | ||
{ | ||
public gCheckedListBox() | ||
: base() | ||
{ | ||
this.DoubleBuffered = true; | ||
//SetStyle(ControlStyles.AllPaintingInWmPaint, true); | ||
SetStyle(ControlStyles.OptimizedDoubleBuffer, true); | ||
//SetStyle(ControlStyles.Opaque, true); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Drawing; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Windows.Forms; | ||
|
||
namespace gMKVToolNix.Controls | ||
{ | ||
public class gComboBox : ComboBox | ||
{ | ||
protected ContextMenuStrip _ContextMenu = new ContextMenuStrip(); | ||
protected ToolStripMenuItem _ClearMenu = new ToolStripMenuItem("Clear"); | ||
protected ToolStripMenuItem _CopyMenu = new ToolStripMenuItem("Copy"); | ||
protected ToolTip _ToolTip = new ToolTip(); | ||
|
||
[Browsable(true)] | ||
public ToolTip ToolTip | ||
{ | ||
get | ||
{ | ||
return _ToolTip; | ||
} | ||
} | ||
|
||
public gComboBox() | ||
{ | ||
SetStyle(ControlStyles.OptimizedDoubleBuffer, true); | ||
this.DoubleBuffered = true; | ||
|
||
InitializeComponent(); | ||
|
||
SetUpContextMenu(); | ||
} | ||
|
||
protected void SetUpContextMenu() | ||
{ | ||
// Set the ContextMenu Items | ||
_ContextMenu.Items.Clear(); | ||
_ContextMenu.Items.Add(_CopyMenu); | ||
_ContextMenu.Items.Add(_ClearMenu); | ||
|
||
// Add the EventHandlers | ||
_CopyMenu.Click += (object sender, EventArgs e) => | ||
{ | ||
try | ||
{ | ||
if (this.SelectedIndex > -1 && !String.IsNullOrWhiteSpace(this.Text)) | ||
{ | ||
Clipboard.SetText(this.Text); | ||
} | ||
} | ||
catch (Exception ex) | ||
{ | ||
ex.ShowException(); | ||
} | ||
}; | ||
|
||
_ClearMenu.Click += (object sender, EventArgs e) => | ||
{ | ||
try | ||
{ | ||
this.SelectedIndex = -1; | ||
} | ||
catch (Exception ex) | ||
{ | ||
ex.ShowException(); | ||
} | ||
}; | ||
|
||
// Set the ContextMenu to this control | ||
this.ContextMenuStrip = _ContextMenu; | ||
} | ||
|
||
protected void InitializeComponent() | ||
{ | ||
this.SuspendLayout(); | ||
// | ||
// gComboBox | ||
// | ||
this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(161))); | ||
this.Size = new System.Drawing.Size(121, 21); | ||
this.ResumeLayout(false); | ||
} | ||
|
||
protected void AutosizeDropDownWidth() | ||
{ | ||
float longestItem = 0f; | ||
|
||
// Find the longest text from the items list, in order to define the width | ||
using (Graphics g = Graphics.FromHwnd(this.Handle)) | ||
{ | ||
foreach (var item in Items) | ||
{ | ||
float itemWidth = g.MeasureString(GetItemText(item), Font).Width; | ||
if (itemWidth > longestItem) | ||
{ | ||
longestItem = itemWidth; | ||
} | ||
} | ||
} | ||
|
||
// If there is a ScrollBar, then increase the width by the VerticalScrollBarWidth | ||
if (Items.Count > MaxDropDownItems) | ||
{ | ||
longestItem += SystemInformation.VerticalScrollBarWidth; | ||
} | ||
|
||
// Change the width of the items list, byt never make it smaller than the width of the control | ||
DropDownWidth = Convert.ToInt32(Math.Max(Math.Ceiling(longestItem), Width)); | ||
} | ||
|
||
protected override void OnDropDown(EventArgs e) | ||
{ | ||
base.OnDropDown(e); | ||
|
||
try | ||
{ | ||
AutosizeDropDownWidth(); | ||
} | ||
catch (Exception ex) | ||
{ | ||
ex.ShowException(); | ||
} | ||
} | ||
|
||
protected override void OnTextChanged(EventArgs e) | ||
{ | ||
base.OnTextChanged(e); | ||
|
||
_ToolTip.SetToolTip(this, this.Text ?? ""); | ||
} | ||
} | ||
} |
Oops, something went wrong.