mirror of
https://github.com/Orbmu2k/nvidiaProfileInspector.git
synced 2026-01-03 20:38:09 -05:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
75e729298d | ||
|
|
5ac60d82ca | ||
|
|
b2306bb310 | ||
|
|
f4e2a2fe69 | ||
|
|
ecbc27200a | ||
|
|
06559a5512 | ||
|
|
04202e43c7 | ||
|
|
cde038f53b | ||
|
|
1980707c13 | ||
|
|
f5e4d76388 | ||
|
|
89957fcbae | ||
|
|
0cbafd18a3 | ||
|
|
590125369d | ||
|
|
5a20139f8b | ||
|
|
a6fde2f6f8 | ||
|
|
d5cae1000f |
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
@@ -16,6 +17,8 @@ namespace nspector
|
||||
|
||||
public event DropFilesNativeHandler OnDropFilesNative;
|
||||
|
||||
public event EventHandler<GroupStateChangedEventArgs> GroupStateChanged;
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wPar, IntPtr lPar);
|
||||
|
||||
@@ -85,8 +88,14 @@ namespace nspector
|
||||
if (SubItem >= order.Length)
|
||||
throw new IndexOutOfRangeException("SubItem "+SubItem+" out of range");
|
||||
|
||||
Rectangle lviBounds = Item.GetBounds(ItemBoundsPortion.Entire);
|
||||
int subItemX = lviBounds.Left;
|
||||
Rectangle lviBounds;
|
||||
try
|
||||
{
|
||||
lviBounds = Item.GetBounds(ItemBoundsPortion.Entire);
|
||||
}
|
||||
catch { return subItemRect; }
|
||||
|
||||
int subItemX = lviBounds.Left;
|
||||
|
||||
ColumnHeader col;
|
||||
int i;
|
||||
@@ -178,6 +187,12 @@ namespace nspector
|
||||
|
||||
protected override void WndProc(ref Message m)
|
||||
{
|
||||
if (m.Msg == WM_LBUTTONUP)
|
||||
{
|
||||
base.DefWndProc(ref m); // Fix for collapsible buttons
|
||||
return;
|
||||
}
|
||||
|
||||
switch (m.Msg)
|
||||
{
|
||||
case WM_PAINT:
|
||||
@@ -276,6 +291,46 @@ namespace nspector
|
||||
|
||||
base.WndProc(ref m);
|
||||
break;
|
||||
|
||||
case WM_NOTIFY:
|
||||
case WM_REFLECT_NOTIFY:
|
||||
var nmhdr = (NMHDR)Marshal.PtrToStructure(m.LParam, typeof(NMHDR));
|
||||
|
||||
// Check if this is an (undocumented) listview group notification
|
||||
// https://www.zabkat.com/blog/05Feb12-collapsible-listview.htm
|
||||
if (nmhdr.code == LVN_GROUPINFO && !_isUpdatingGroups)
|
||||
{
|
||||
// Group state has changed - get the group info
|
||||
var lvGroupInfo = (NMLVGROUP)Marshal.PtrToStructure(m.LParam, typeof(NMLVGROUP));
|
||||
|
||||
// Find the corresponding ListViewGroup
|
||||
ListViewGroup changedGroup = null;
|
||||
foreach (ListViewGroup group in this.Groups)
|
||||
{
|
||||
int? groupId = GetGroupID(group);
|
||||
if (groupId.HasValue && groupId.Value == lvGroupInfo.iGroupId)
|
||||
{
|
||||
changedGroup = group;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (changedGroup != null)
|
||||
{
|
||||
// Determine if collapsed or expanded based on state
|
||||
bool isCollapsed = (lvGroupInfo.uNewState & (int)ListViewGroupState.Collapsed) != 0;
|
||||
|
||||
// Fire the event
|
||||
GroupStateChanged?.Invoke(this, new GroupStateChangedEventArgs
|
||||
{
|
||||
Group = changedGroup,
|
||||
IsCollapsed = isCollapsed,
|
||||
NewState = (ListViewGroupState)lvGroupInfo.uNewState
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
base.WndProc(ref m);
|
||||
}
|
||||
@@ -291,5 +346,401 @@ namespace nspector
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Collapsible groups - https://www.codeproject.com/Articles/451742/Extending-Csharp-ListView-with-Collapsible-Groups
|
||||
|
||||
private bool _isUpdatingGroups = false;
|
||||
|
||||
private const int WM_NOTIFY = 0x004E;
|
||||
private const int WM_REFLECT_NOTIFY = 0x204E;
|
||||
|
||||
private const int LVN_FIRST = -100;
|
||||
private const int LVN_GROUPINFO = (LVN_FIRST - 88);
|
||||
|
||||
private const int LVM_SETGROUPINFO = (LVM_FIRST + 147); // ListView messages Setinfo on Group
|
||||
private const int WM_LBUTTONUP = 0x0202; // Windows message left button
|
||||
|
||||
private delegate void CallBackSetGroupState(ListViewGroup lstvwgrp, ListViewGroupState state);
|
||||
private delegate void CallbackSetGroupString(ListViewGroup lstvwgrp, string value);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, LVGROUP lParam);
|
||||
|
||||
private static int? GetGroupID(ListViewGroup lstvwgrp)
|
||||
{
|
||||
int? rtnval = null;
|
||||
Type GrpTp = lstvwgrp.GetType();
|
||||
if (GrpTp != null)
|
||||
{
|
||||
PropertyInfo pi = GrpTp.GetProperty("ID", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
if (pi != null)
|
||||
{
|
||||
object tmprtnval = pi.GetValue(lstvwgrp, null);
|
||||
if (tmprtnval != null)
|
||||
{
|
||||
rtnval = tmprtnval as int?;
|
||||
}
|
||||
}
|
||||
}
|
||||
return rtnval;
|
||||
}
|
||||
|
||||
private static void setGrpState(ListViewGroup lstvwgrp, ListViewGroupState state)
|
||||
{
|
||||
if (Environment.OSVersion.Version.Major < 6) //Only Vista and forward allows collaps of ListViewGroups
|
||||
return;
|
||||
if (lstvwgrp == null || lstvwgrp.ListView == null)
|
||||
return;
|
||||
if (lstvwgrp.ListView.InvokeRequired)
|
||||
lstvwgrp.ListView.Invoke(new CallBackSetGroupState(setGrpState), lstvwgrp, state);
|
||||
else
|
||||
{
|
||||
int? GrpId = GetGroupID(lstvwgrp);
|
||||
int gIndex = lstvwgrp.ListView.Groups.IndexOf(lstvwgrp);
|
||||
LVGROUP group = new LVGROUP();
|
||||
group.CbSize = Marshal.SizeOf(group);
|
||||
group.State = state;
|
||||
group.Mask = ListViewGroupMask.State;
|
||||
if (GrpId != null)
|
||||
{
|
||||
group.IGroupId = GrpId.Value;
|
||||
SendMessage(lstvwgrp.ListView.Handle, LVM_SETGROUPINFO, GrpId.Value, group);
|
||||
SendMessage(lstvwgrp.ListView.Handle, LVM_SETGROUPINFO, GrpId.Value, group);
|
||||
}
|
||||
else
|
||||
{
|
||||
group.IGroupId = gIndex;
|
||||
SendMessage(lstvwgrp.ListView.Handle, LVM_SETGROUPINFO, gIndex, group);
|
||||
SendMessage(lstvwgrp.ListView.Handle, LVM_SETGROUPINFO, gIndex, group);
|
||||
}
|
||||
lstvwgrp.ListView.Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
private static void setGrpFooter(ListViewGroup lstvwgrp, string footer)
|
||||
{
|
||||
if (Environment.OSVersion.Version.Major < 6) //Only Vista and forward allows footer on ListViewGroups
|
||||
return;
|
||||
if (lstvwgrp == null || lstvwgrp.ListView == null)
|
||||
return;
|
||||
if (lstvwgrp.ListView.InvokeRequired)
|
||||
lstvwgrp.ListView.Invoke(new CallbackSetGroupString(setGrpFooter), lstvwgrp, footer);
|
||||
else
|
||||
{
|
||||
int? GrpId = GetGroupID(lstvwgrp);
|
||||
int gIndex = lstvwgrp.ListView.Groups.IndexOf(lstvwgrp);
|
||||
LVGROUP group = new LVGROUP();
|
||||
group.CbSize = Marshal.SizeOf(group);
|
||||
group.PszFooter = footer;
|
||||
group.Mask = ListViewGroupMask.Footer;
|
||||
if (GrpId != null)
|
||||
{
|
||||
group.IGroupId = GrpId.Value;
|
||||
SendMessage(lstvwgrp.ListView.Handle, LVM_SETGROUPINFO, GrpId.Value, group);
|
||||
}
|
||||
else
|
||||
{
|
||||
group.IGroupId = gIndex;
|
||||
SendMessage(lstvwgrp.ListView.Handle, LVM_SETGROUPINFO, gIndex, group);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetGroupState(ListViewGroupState state)
|
||||
{
|
||||
_isUpdatingGroups = true;
|
||||
foreach (ListViewGroup lvg in this.Groups)
|
||||
setGrpState(lvg, state);
|
||||
_isUpdatingGroups = false;
|
||||
}
|
||||
|
||||
public void SetGroupState(ListViewGroup group, ListViewGroupState state)
|
||||
{
|
||||
_isUpdatingGroups = true;
|
||||
setGrpState(group, state);
|
||||
_isUpdatingGroups = false;
|
||||
}
|
||||
|
||||
public void SetGroupFooter(ListViewGroup lvg, string footerText)
|
||||
{
|
||||
setGrpFooter(lvg, footerText);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// LVGROUP StructureUsed to set and retrieve groups.
|
||||
/// </summary>
|
||||
/// <example>
|
||||
/// LVGROUP myLVGROUP = new LVGROUP();
|
||||
/// myLVGROUP.CbSize // is of managed type uint
|
||||
/// myLVGROUP.Mask // is of managed type uint
|
||||
/// myLVGROUP.PszHeader // is of managed type string
|
||||
/// myLVGROUP.CchHeader // is of managed type int
|
||||
/// myLVGROUP.PszFooter // is of managed type string
|
||||
/// myLVGROUP.CchFooter // is of managed type int
|
||||
/// myLVGROUP.IGroupId // is of managed type int
|
||||
/// myLVGROUP.StateMask // is of managed type uint
|
||||
/// myLVGROUP.State // is of managed type uint
|
||||
/// myLVGROUP.UAlign // is of managed type uint
|
||||
/// myLVGROUP.PszSubtitle // is of managed type IntPtr
|
||||
/// myLVGROUP.CchSubtitle // is of managed type uint
|
||||
/// myLVGROUP.PszTask // is of managed type string
|
||||
/// myLVGROUP.CchTask // is of managed type uint
|
||||
/// myLVGROUP.PszDescriptionTop // is of managed type string
|
||||
/// myLVGROUP.CchDescriptionTop // is of managed type uint
|
||||
/// myLVGROUP.PszDescriptionBottom // is of managed type string
|
||||
/// myLVGROUP.CchDescriptionBottom // is of managed type uint
|
||||
/// myLVGROUP.ITitleImage // is of managed type int
|
||||
/// myLVGROUP.IExtendedImage // is of managed type int
|
||||
/// myLVGROUP.IFirstItem // is of managed type int
|
||||
/// myLVGROUP.CItems // is of managed type IntPtr
|
||||
/// myLVGROUP.PszSubsetTitle // is of managed type IntPtr
|
||||
/// myLVGROUP.CchSubsetTitle // is of managed type IntPtr
|
||||
/// </example>
|
||||
/// <remarks>
|
||||
/// The LVGROUP structure was created by Paw Jershauge
|
||||
/// Created: Jan. 2008.
|
||||
/// The LVGROUP structure code is based on information from Microsoft's MSDN2 website.
|
||||
/// The structure is generated via an automated converter and is as is.
|
||||
/// The structure may or may not hold errors inside the code, so use at own risk.
|
||||
/// Reference url: http://msdn.microsoft.com/en-us/library/bb774769(VS.85).aspx
|
||||
/// </remarks>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode), Description("LVGROUP StructureUsed to set and retrieve groups.")]
|
||||
public struct LVGROUP
|
||||
{
|
||||
/// <summary>
|
||||
/// Size of this structure, in bytes.
|
||||
/// </summary>
|
||||
[Description("Size of this structure, in bytes.")]
|
||||
public int CbSize;
|
||||
|
||||
/// <summary>
|
||||
/// Mask that specifies which members of the structure are valid input. One or more of the following values:LVGF_NONENo other items are valid.
|
||||
/// </summary>
|
||||
[Description("Mask that specifies which members of the structure are valid input. One or more of the following values:LVGF_NONE No other items are valid.")]
|
||||
public ListViewGroupMask Mask;
|
||||
|
||||
/// <summary>
|
||||
/// Pointer to a null-terminated string that contains the header text when item information is being set. If group information is being retrieved, this member specifies the address of the buffer that receives the header text.
|
||||
/// </summary>
|
||||
[Description("Pointer to a null-terminated string that contains the header text when item information is being set. If group information is being retrieved, this member specifies the address of the buffer that receives the header text.")]
|
||||
[MarshalAs(UnmanagedType.LPWStr)]
|
||||
public string PszHeader;
|
||||
|
||||
/// <summary>
|
||||
/// Size in TCHARs of the buffer pointed to by the pszHeader member. If the structure is not receiving information about a group, this member is ignored.
|
||||
/// </summary>
|
||||
[Description("Size in TCHARs of the buffer pointed to by the pszHeader member. If the structure is not receiving information about a group, this member is ignored.")]
|
||||
public int CchHeader;
|
||||
|
||||
/// <summary>
|
||||
/// Pointer to a null-terminated string that contains the footer text when item information is being set. If group information is being retrieved, this member specifies the address of the buffer that receives the footer text.
|
||||
/// </summary>
|
||||
[Description("Pointer to a null-terminated string that contains the footer text when item information is being set. If group information is being retrieved, this member specifies the address of the buffer that receives the footer text.")]
|
||||
[MarshalAs(UnmanagedType.LPWStr)]
|
||||
public string PszFooter;
|
||||
|
||||
/// <summary>
|
||||
/// Size in TCHARs of the buffer pointed to by the pszFooter member. If the structure is not receiving information about a group, this member is ignored.
|
||||
/// </summary>
|
||||
[Description("Size in TCHARs of the buffer pointed to by the pszFooter member. If the structure is not receiving information about a group, this member is ignored.")]
|
||||
public int CchFooter;
|
||||
|
||||
/// <summary>
|
||||
/// ID of the group.
|
||||
/// </summary>
|
||||
[Description("ID of the group.")]
|
||||
public int IGroupId;
|
||||
|
||||
/// <summary>
|
||||
/// Mask used with LVM_GETGROUPINFO (Microsoft Windows XP and Windows Vista) and LVM_SETGROUPINFO (Windows Vista only) to specify which flags in the state value are being retrieved or set.
|
||||
/// </summary>
|
||||
[Description("Mask used with LVM_GETGROUPINFO (Microsoft Windows XP and Windows Vista) and LVM_SETGROUPINFO (Windows Vista only) to specify which flags in the state value are being retrieved or set.")]
|
||||
public int StateMask;
|
||||
|
||||
/// <summary>
|
||||
/// Flag that can have one of the following values:LVGS_NORMALGroups are expanded, the group name is displayed, and all items in the group are displayed.
|
||||
/// </summary>
|
||||
[Description("Flag that can have one of the following values:LVGS_NORMAL Groups are expanded, the group name is displayed, and all items in the group are displayed.")]
|
||||
public ListViewGroupState State;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates the alignment of the header or footer text for the group. It can have one or more of the following values. Use one of the header flags. Footer flags are optional. Windows XP: Footer flags are reserved.LVGA_FOOTER_CENTERReserved.
|
||||
/// </summary>
|
||||
[Description("Indicates the alignment of the header or footer text for the group. It can have one or more of the following values. Use one of the header flags. Footer flags are optional. Windows XP: Footer flags are reserved.LVGA_FOOTER_CENTERReserved.")]
|
||||
public uint UAlign;
|
||||
|
||||
/// <summary>
|
||||
/// Windows Vista. Pointer to a null-terminated string that contains the subtitle text when item information is being set. If group information is being retrieved, this member specifies the address of the buffer that receives the subtitle text. This element is drawn under the header text.
|
||||
/// </summary>
|
||||
[Description("Windows Vista. Pointer to a null-terminated string that contains the subtitle text when item information is being set. If group information is being retrieved, this member specifies the address of the buffer that receives the subtitle text. This element is drawn under the header text.")]
|
||||
public IntPtr PszSubtitle;
|
||||
|
||||
/// <summary>
|
||||
/// Windows Vista. Size, in TCHARs, of the buffer pointed to by the pszSubtitle member. If the structure is not receiving information about a group, this member is ignored.
|
||||
/// </summary>
|
||||
[Description("Windows Vista. Size, in TCHARs, of the buffer pointed to by the pszSubtitle member. If the structure is not receiving information about a group, this member is ignored.")]
|
||||
public uint CchSubtitle;
|
||||
|
||||
/// <summary>
|
||||
/// Windows Vista. Pointer to a null-terminated string that contains the text for a task link when item information is being set. If group information is being retrieved, this member specifies the address of the buffer that receives the task text. This item is drawn right-aligned opposite the header text. When clicked by the user, the task link generates an LVN_LINKCLICK notification.
|
||||
/// </summary>
|
||||
[Description("Windows Vista. Pointer to a null-terminated string that contains the text for a task link when item information is being set. If group information is being retrieved, this member specifies the address of the buffer that receives the task text. This item is drawn right-aligned opposite the header text. When clicked by the user, the task link generates an LVN_LINKCLICK notification.")]
|
||||
[MarshalAs(UnmanagedType.LPWStr)]
|
||||
public string PszTask;
|
||||
|
||||
/// <summary>
|
||||
/// Windows Vista. Size in TCHARs of the buffer pointed to by the pszTask member. If the structure is not receiving information about a group, this member is ignored.
|
||||
/// </summary>
|
||||
[Description("Windows Vista. Size in TCHARs of the buffer pointed to by the pszTask member. If the structure is not receiving information about a group, this member is ignored.")]
|
||||
public uint CchTask;
|
||||
|
||||
/// <summary>
|
||||
/// Windows Vista. Pointer to a null-terminated string that contains the top description text when item information is being set. If group information is being retrieved, this member specifies the address of the buffer that receives the top description text. This item is drawn opposite the title image when there is a title image, no extended image, and uAlign==LVGA_HEADER_CENTER.
|
||||
/// </summary>
|
||||
[Description("Windows Vista. Pointer to a null-terminated string that contains the top description text when item information is being set. If group information is being retrieved, this member specifies the address of the buffer that receives the top description text. This item is drawn opposite the title image when there is a title image, no extended image, and uAlign==LVGA_HEADER_CENTER.")]
|
||||
[MarshalAs(UnmanagedType.LPWStr)]
|
||||
public string PszDescriptionTop;
|
||||
|
||||
/// <summary>
|
||||
/// Windows Vista. Size in TCHARs of the buffer pointed to by the pszDescriptionTop member. If the structure is not receiving information about a group, this member is ignored.
|
||||
/// </summary>
|
||||
[Description("Windows Vista. Size in TCHARs of the buffer pointed to by the pszDescriptionTop member. If the structure is not receiving information about a group, this member is ignored.")]
|
||||
public uint CchDescriptionTop;
|
||||
|
||||
/// <summary>
|
||||
/// Windows Vista. Pointer to a null-terminated string that contains the bottom description text when item information is being set. If group information is being retrieved, this member specifies the address of the buffer that receives the bottom description text. This item is drawn under the top description text when there is a title image, no extended image, and uAlign==LVGA_HEADER_CENTER.
|
||||
/// </summary>
|
||||
[Description("Windows Vista. Pointer to a null-terminated string that contains the bottom description text when item information is being set. If group information is being retrieved, this member specifies the address of the buffer that receives the bottom description text. This item is drawn under the top description text when there is a title image, no extended image, and uAlign==LVGA_HEADER_CENTER.")]
|
||||
[MarshalAs(UnmanagedType.LPWStr)]
|
||||
public string PszDescriptionBottom;
|
||||
|
||||
/// <summary>
|
||||
/// Windows Vista. Size in TCHARs of the buffer pointed to by the pszDescriptionBottom member. If the structure is not receiving information about a group, this member is ignored.
|
||||
/// </summary>
|
||||
[Description("Windows Vista. Size in TCHARs of the buffer pointed to by the pszDescriptionBottom member. If the structure is not receiving information about a group, this member is ignored.")]
|
||||
public uint CchDescriptionBottom;
|
||||
|
||||
/// <summary>
|
||||
/// Windows Vista. Index of the title image in the control imagelist.
|
||||
/// </summary>
|
||||
[Description("Windows Vista. Index of the title image in the control imagelist.")]
|
||||
public int ITitleImage;
|
||||
|
||||
/// <summary>
|
||||
/// Windows Vista. Index of the extended image in the control imagelist.
|
||||
/// </summary>
|
||||
[Description("Windows Vista. Index of the extended image in the control imagelist.")]
|
||||
public int IExtendedImage;
|
||||
|
||||
/// <summary>
|
||||
/// Windows Vista. Read-only.
|
||||
/// </summary>
|
||||
[Description("Windows Vista. Read-only.")]
|
||||
public int IFirstItem;
|
||||
|
||||
/// <summary>
|
||||
/// Windows Vista. Read-only in non-owner data mode.
|
||||
/// </summary>
|
||||
[Description("Windows Vista. Read-only in non-owner data mode.")]
|
||||
public IntPtr CItems;
|
||||
|
||||
/// <summary>
|
||||
/// Windows Vista. NULL if group is not a subset. Pointer to a null-terminated string that contains the subset title text when item information is being set. If group information is being retrieved, this member specifies the address of the buffer that receives the subset title text.
|
||||
/// </summary>
|
||||
[Description("Windows Vista. NULL if group is not a subset. Pointer to a null-terminated string that contains the subset title text when item information is being set. If group information is being retrieved, this member specifies the address of the buffer that receives the subset title text.")]
|
||||
public IntPtr PszSubsetTitle;
|
||||
|
||||
/// <summary>
|
||||
/// Windows Vista. Size in TCHARs of the buffer pointed to by the pszSubsetTitle member. If the structure is not receiving information about a group, this member is ignored.
|
||||
/// </summary>
|
||||
[Description("Windows Vista. Size in TCHARs of the buffer pointed to by the pszSubsetTitle member. If the structure is not receiving information about a group, this member is ignored.")]
|
||||
public IntPtr CchSubsetTitle;
|
||||
}
|
||||
|
||||
public class GroupStateChangedEventArgs : EventArgs
|
||||
{
|
||||
public ListViewGroup Group { get; set; }
|
||||
public bool IsCollapsed { get; set; }
|
||||
public ListViewGroupState NewState { get; set; }
|
||||
}
|
||||
|
||||
public enum ListViewGroupMask
|
||||
{
|
||||
None = 0x00000,
|
||||
Header = 0x00001,
|
||||
Footer = 0x00002,
|
||||
State = 0x00004,
|
||||
Align = 0x00008,
|
||||
GroupId = 0x00010,
|
||||
SubTitle = 0x00100,
|
||||
Task = 0x00200,
|
||||
DescriptionTop = 0x00400,
|
||||
DescriptionBottom = 0x00800,
|
||||
TitleImage = 0x01000,
|
||||
ExtendedImage = 0x02000,
|
||||
Items = 0x04000,
|
||||
Subset = 0x08000,
|
||||
SubsetItems = 0x10000
|
||||
}
|
||||
|
||||
public enum ListViewGroupState
|
||||
{
|
||||
/// <summary>
|
||||
/// Groups are expanded, the group name is displayed, and all items in the group are displayed.
|
||||
/// </summary>
|
||||
Normal = 0,
|
||||
/// <summary>
|
||||
/// The group is collapsed.
|
||||
/// </summary>
|
||||
Collapsed = 1,
|
||||
/// <summary>
|
||||
/// The group is hidden.
|
||||
/// </summary>
|
||||
Hidden = 2,
|
||||
/// <summary>
|
||||
/// Version 6.00 and Windows Vista. The group does not display a header.
|
||||
/// </summary>
|
||||
NoHeader = 4,
|
||||
/// <summary>
|
||||
/// Version 6.00 and Windows Vista. The group can be collapsed.
|
||||
/// </summary>
|
||||
Collapsible = 8,
|
||||
/// <summary>
|
||||
/// Version 6.00 and Windows Vista. The group has keyboard focus.
|
||||
/// </summary>
|
||||
Focused = 16,
|
||||
/// <summary>
|
||||
/// Version 6.00 and Windows Vista. The group is selected.
|
||||
/// </summary>
|
||||
Selected = 32,
|
||||
/// <summary>
|
||||
/// Version 6.00 and Windows Vista. The group displays only a portion of its items.
|
||||
/// </summary>
|
||||
SubSeted = 64,
|
||||
/// <summary>
|
||||
/// Version 6.00 and Windows Vista. The subset link of the group has keyboard focus.
|
||||
/// </summary>
|
||||
SubSetLinkFocused = 128,
|
||||
}
|
||||
|
||||
// Required structures for the notification
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct NMHDR
|
||||
{
|
||||
public IntPtr hwndFrom;
|
||||
public UIntPtr idFrom;
|
||||
public int code;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct NMLVGROUP
|
||||
{
|
||||
public NMHDR hdr;
|
||||
public int iGroupId;
|
||||
public uint uNewState;
|
||||
public uint uOldState;
|
||||
public int state; // Current state
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
34
nspector/WatermarkTextBox.cs
Normal file
34
nspector/WatermarkTextBox.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace nspector
|
||||
{
|
||||
public class WatermarkTextBox : TextBox
|
||||
{
|
||||
private const int WM_PAINT = 0x000F;
|
||||
|
||||
private string _watermarkText;
|
||||
[Category("Appearance")]
|
||||
public string WatermarkText
|
||||
{
|
||||
get => _watermarkText;
|
||||
set { _watermarkText = value; Invalidate(); }
|
||||
}
|
||||
|
||||
protected override void WndProc(ref Message m)
|
||||
{
|
||||
base.WndProc(ref m);
|
||||
|
||||
if (m.Msg == WM_PAINT && string.IsNullOrEmpty(this.Text) && !string.IsNullOrEmpty(_watermarkText))
|
||||
{
|
||||
using (Graphics g = this.CreateGraphics())
|
||||
using (Brush brush = new SolidBrush(SystemColors.GrayText))
|
||||
{
|
||||
TextFormatFlags flags = TextFormatFlags.VerticalCenter | TextFormatFlags.Left;
|
||||
TextRenderer.DrawText(g, _watermarkText, this.Font, this.ClientRectangle, SystemColors.GrayText, flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
146
nspector/frmDrvSettings.Designer.cs
generated
146
nspector/frmDrvSettings.Designer.cs
generated
@@ -77,6 +77,7 @@
|
||||
this.chSettingValueHex = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.tbSettingDescription = new System.Windows.Forms.TextBox();
|
||||
this.pnlListview = new System.Windows.Forms.Panel();
|
||||
this.txtFilter = new nspector.WatermarkTextBox();
|
||||
this.tsMain.SuspendLayout();
|
||||
this.pnlListview.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
@@ -94,10 +95,10 @@
|
||||
//
|
||||
this.pbMain.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.pbMain.Location = new System.Drawing.Point(12, 475);
|
||||
this.pbMain.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.pbMain.Location = new System.Drawing.Point(22, 877);
|
||||
this.pbMain.Margin = new System.Windows.Forms.Padding(7);
|
||||
this.pbMain.Name = "pbMain";
|
||||
this.pbMain.Size = new System.Drawing.Size(840, 9);
|
||||
this.pbMain.Size = new System.Drawing.Size(1540, 17);
|
||||
this.pbMain.TabIndex = 19;
|
||||
//
|
||||
// tsMain
|
||||
@@ -135,10 +136,11 @@
|
||||
this.tsSep6,
|
||||
this.tsbApplyProfile});
|
||||
this.tsMain.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.HorizontalStackWithOverflow;
|
||||
this.tsMain.Location = new System.Drawing.Point(12, 4);
|
||||
this.tsMain.Location = new System.Drawing.Point(22, 7);
|
||||
this.tsMain.Name = "tsMain";
|
||||
this.tsMain.Padding = new System.Windows.Forms.Padding(0, 0, 4, 0);
|
||||
this.tsMain.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional;
|
||||
this.tsMain.Size = new System.Drawing.Size(840, 25);
|
||||
this.tsMain.Size = new System.Drawing.Size(1540, 46);
|
||||
this.tsMain.TabIndex = 24;
|
||||
this.tsMain.Text = "toolStrip1";
|
||||
//
|
||||
@@ -147,7 +149,7 @@
|
||||
this.tslProfiles.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
|
||||
this.tslProfiles.Margin = new System.Windows.Forms.Padding(0, 5, 10, 2);
|
||||
this.tslProfiles.Name = "tslProfiles";
|
||||
this.tslProfiles.Size = new System.Drawing.Size(49, 18);
|
||||
this.tslProfiles.Size = new System.Drawing.Size(86, 39);
|
||||
this.tslProfiles.Text = "Profiles:";
|
||||
//
|
||||
// cbProfiles
|
||||
@@ -159,7 +161,7 @@
|
||||
this.cbProfiles.Margin = new System.Windows.Forms.Padding(1);
|
||||
this.cbProfiles.MaxDropDownItems = 50;
|
||||
this.cbProfiles.Name = "cbProfiles";
|
||||
this.cbProfiles.Size = new System.Drawing.Size(290, 23);
|
||||
this.cbProfiles.Size = new System.Drawing.Size(528, 38);
|
||||
this.cbProfiles.SelectedIndexChanged += new System.EventHandler(this.cbProfiles_SelectedIndexChanged);
|
||||
this.cbProfiles.TextChanged += new System.EventHandler(this.cbProfiles_TextChanged);
|
||||
//
|
||||
@@ -170,7 +172,7 @@
|
||||
this.tsbModifiedProfiles.Image = global::nspector.Properties.Resources.home_sm;
|
||||
this.tsbModifiedProfiles.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tsbModifiedProfiles.Name = "tsbModifiedProfiles";
|
||||
this.tsbModifiedProfiles.Size = new System.Drawing.Size(36, 22);
|
||||
this.tsbModifiedProfiles.Size = new System.Drawing.Size(44, 40);
|
||||
this.tsbModifiedProfiles.TextImageRelation = System.Windows.Forms.TextImageRelation.Overlay;
|
||||
this.tsbModifiedProfiles.ToolTipText = "Back to global profile (Home) / User modified profiles";
|
||||
this.tsbModifiedProfiles.ButtonClick += new System.EventHandler(this.tsbModifiedProfiles_ButtonClick);
|
||||
@@ -179,7 +181,7 @@
|
||||
// toolStripSeparator1
|
||||
//
|
||||
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25);
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(6, 46);
|
||||
//
|
||||
// tsbRefreshProfile
|
||||
//
|
||||
@@ -187,7 +189,7 @@
|
||||
this.tsbRefreshProfile.Image = ((System.Drawing.Image)(resources.GetObject("tsbRefreshProfile.Image")));
|
||||
this.tsbRefreshProfile.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tsbRefreshProfile.Name = "tsbRefreshProfile";
|
||||
this.tsbRefreshProfile.Size = new System.Drawing.Size(24, 22);
|
||||
this.tsbRefreshProfile.Size = new System.Drawing.Size(40, 40);
|
||||
this.tsbRefreshProfile.Text = "Refresh current profile.";
|
||||
this.tsbRefreshProfile.Click += new System.EventHandler(this.tsbRefreshProfile_Click);
|
||||
//
|
||||
@@ -197,7 +199,7 @@
|
||||
this.tsbRestoreProfile.Image = ((System.Drawing.Image)(resources.GetObject("tsbRestoreProfile.Image")));
|
||||
this.tsbRestoreProfile.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tsbRestoreProfile.Name = "tsbRestoreProfile";
|
||||
this.tsbRestoreProfile.Size = new System.Drawing.Size(24, 22);
|
||||
this.tsbRestoreProfile.Size = new System.Drawing.Size(40, 40);
|
||||
this.tsbRestoreProfile.Text = "Restore current profile to NVIDIA defaults.";
|
||||
this.tsbRestoreProfile.Click += new System.EventHandler(this.tsbRestoreProfile_Click);
|
||||
//
|
||||
@@ -207,7 +209,7 @@
|
||||
this.tsbCreateProfile.Image = ((System.Drawing.Image)(resources.GetObject("tsbCreateProfile.Image")));
|
||||
this.tsbCreateProfile.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tsbCreateProfile.Name = "tsbCreateProfile";
|
||||
this.tsbCreateProfile.Size = new System.Drawing.Size(24, 22);
|
||||
this.tsbCreateProfile.Size = new System.Drawing.Size(40, 40);
|
||||
this.tsbCreateProfile.Text = "Create new profile";
|
||||
this.tsbCreateProfile.Click += new System.EventHandler(this.tsbCreateProfile_Click);
|
||||
//
|
||||
@@ -217,14 +219,14 @@
|
||||
this.tsbDeleteProfile.Image = global::nspector.Properties.Resources.ieframe_1_18212;
|
||||
this.tsbDeleteProfile.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tsbDeleteProfile.Name = "tsbDeleteProfile";
|
||||
this.tsbDeleteProfile.Size = new System.Drawing.Size(24, 22);
|
||||
this.tsbDeleteProfile.Size = new System.Drawing.Size(40, 40);
|
||||
this.tsbDeleteProfile.Text = "Delete current Profile";
|
||||
this.tsbDeleteProfile.Click += new System.EventHandler(this.tsbDeleteProfile_Click);
|
||||
//
|
||||
// tsSep2
|
||||
//
|
||||
this.tsSep2.Name = "tsSep2";
|
||||
this.tsSep2.Size = new System.Drawing.Size(6, 25);
|
||||
this.tsSep2.Size = new System.Drawing.Size(6, 46);
|
||||
//
|
||||
// tsbAddApplication
|
||||
//
|
||||
@@ -232,7 +234,7 @@
|
||||
this.tsbAddApplication.Image = global::nspector.Properties.Resources.window_application_add;
|
||||
this.tsbAddApplication.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tsbAddApplication.Name = "tsbAddApplication";
|
||||
this.tsbAddApplication.Size = new System.Drawing.Size(24, 22);
|
||||
this.tsbAddApplication.Size = new System.Drawing.Size(40, 40);
|
||||
this.tsbAddApplication.Text = "Add application to current profile.";
|
||||
this.tsbAddApplication.Click += new System.EventHandler(this.tsbAddApplication_Click);
|
||||
//
|
||||
@@ -242,7 +244,7 @@
|
||||
this.tssbRemoveApplication.Image = global::nspector.Properties.Resources.window_application_delete;
|
||||
this.tssbRemoveApplication.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tssbRemoveApplication.Name = "tssbRemoveApplication";
|
||||
this.tssbRemoveApplication.Size = new System.Drawing.Size(36, 22);
|
||||
this.tssbRemoveApplication.Size = new System.Drawing.Size(44, 40);
|
||||
this.tssbRemoveApplication.Text = "Remove application from current profile";
|
||||
this.tssbRemoveApplication.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.tssbRemoveApplication_DropDownItemClicked);
|
||||
this.tssbRemoveApplication.Click += new System.EventHandler(this.tssbRemoveApplication_Click);
|
||||
@@ -250,7 +252,7 @@
|
||||
// tsSep3
|
||||
//
|
||||
this.tsSep3.Name = "tsSep3";
|
||||
this.tsSep3.Size = new System.Drawing.Size(6, 25);
|
||||
this.tsSep3.Size = new System.Drawing.Size(6, 46);
|
||||
//
|
||||
// tsbExportProfiles
|
||||
//
|
||||
@@ -263,35 +265,35 @@
|
||||
this.tsbExportProfiles.Image = global::nspector.Properties.Resources.export1;
|
||||
this.tsbExportProfiles.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tsbExportProfiles.Name = "tsbExportProfiles";
|
||||
this.tsbExportProfiles.Size = new System.Drawing.Size(36, 22);
|
||||
this.tsbExportProfiles.Size = new System.Drawing.Size(44, 40);
|
||||
this.tsbExportProfiles.Text = "Export user defined profiles";
|
||||
this.tsbExportProfiles.Click += new System.EventHandler(this.tsbExportProfiles_Click);
|
||||
//
|
||||
// exportCurrentProfileOnlyToolStripMenuItem
|
||||
//
|
||||
this.exportCurrentProfileOnlyToolStripMenuItem.Name = "exportCurrentProfileOnlyToolStripMenuItem";
|
||||
this.exportCurrentProfileOnlyToolStripMenuItem.Size = new System.Drawing.Size(343, 22);
|
||||
this.exportCurrentProfileOnlyToolStripMenuItem.Size = new System.Drawing.Size(602, 40);
|
||||
this.exportCurrentProfileOnlyToolStripMenuItem.Text = "Export current profile only";
|
||||
this.exportCurrentProfileOnlyToolStripMenuItem.Click += new System.EventHandler(this.exportCurrentProfileOnlyToolStripMenuItem_Click);
|
||||
//
|
||||
// exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem
|
||||
//
|
||||
this.exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem.Name = "exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem";
|
||||
this.exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem.Size = new System.Drawing.Size(343, 22);
|
||||
this.exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem.Size = new System.Drawing.Size(602, 40);
|
||||
this.exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem.Text = "Export current profile including predefined settings";
|
||||
this.exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem.Click += new System.EventHandler(this.exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem_Click);
|
||||
//
|
||||
// exportUserdefinedProfilesToolStripMenuItem
|
||||
//
|
||||
this.exportUserdefinedProfilesToolStripMenuItem.Name = "exportUserdefinedProfilesToolStripMenuItem";
|
||||
this.exportUserdefinedProfilesToolStripMenuItem.Size = new System.Drawing.Size(343, 22);
|
||||
this.exportUserdefinedProfilesToolStripMenuItem.Size = new System.Drawing.Size(602, 40);
|
||||
this.exportUserdefinedProfilesToolStripMenuItem.Text = "Export all customized profiles";
|
||||
this.exportUserdefinedProfilesToolStripMenuItem.Click += new System.EventHandler(this.exportUserdefinedProfilesToolStripMenuItem_Click);
|
||||
//
|
||||
// exportAllProfilesNVIDIATextFormatToolStripMenuItem
|
||||
//
|
||||
this.exportAllProfilesNVIDIATextFormatToolStripMenuItem.Name = "exportAllProfilesNVIDIATextFormatToolStripMenuItem";
|
||||
this.exportAllProfilesNVIDIATextFormatToolStripMenuItem.Size = new System.Drawing.Size(343, 22);
|
||||
this.exportAllProfilesNVIDIATextFormatToolStripMenuItem.Size = new System.Drawing.Size(602, 40);
|
||||
this.exportAllProfilesNVIDIATextFormatToolStripMenuItem.Text = "Export all driver profiles (NVIDIA Text Format)";
|
||||
this.exportAllProfilesNVIDIATextFormatToolStripMenuItem.Click += new System.EventHandler(this.exportAllProfilesNVIDIATextFormatToolStripMenuItem_Click);
|
||||
//
|
||||
@@ -304,28 +306,28 @@
|
||||
this.tsbImportProfiles.Image = global::nspector.Properties.Resources.import1;
|
||||
this.tsbImportProfiles.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tsbImportProfiles.Name = "tsbImportProfiles";
|
||||
this.tsbImportProfiles.Size = new System.Drawing.Size(36, 22);
|
||||
this.tsbImportProfiles.Size = new System.Drawing.Size(44, 40);
|
||||
this.tsbImportProfiles.Text = "Import user defined profiles";
|
||||
this.tsbImportProfiles.Click += new System.EventHandler(this.tsbImportProfiles_Click);
|
||||
//
|
||||
// importProfilesToolStripMenuItem
|
||||
//
|
||||
this.importProfilesToolStripMenuItem.Name = "importProfilesToolStripMenuItem";
|
||||
this.importProfilesToolStripMenuItem.Size = new System.Drawing.Size(363, 22);
|
||||
this.importProfilesToolStripMenuItem.Size = new System.Drawing.Size(639, 40);
|
||||
this.importProfilesToolStripMenuItem.Text = "Import profile(s)";
|
||||
this.importProfilesToolStripMenuItem.Click += new System.EventHandler(this.importProfilesToolStripMenuItem_Click);
|
||||
//
|
||||
// importAllProfilesNVIDIATextFormatToolStripMenuItem
|
||||
//
|
||||
this.importAllProfilesNVIDIATextFormatToolStripMenuItem.Name = "importAllProfilesNVIDIATextFormatToolStripMenuItem";
|
||||
this.importAllProfilesNVIDIATextFormatToolStripMenuItem.Size = new System.Drawing.Size(363, 22);
|
||||
this.importAllProfilesNVIDIATextFormatToolStripMenuItem.Size = new System.Drawing.Size(639, 40);
|
||||
this.importAllProfilesNVIDIATextFormatToolStripMenuItem.Text = "Import (replace) all driver profiles (NVIDIA Text Format)";
|
||||
this.importAllProfilesNVIDIATextFormatToolStripMenuItem.Click += new System.EventHandler(this.importAllProfilesNVIDIATextFormatToolStripMenuItem_Click);
|
||||
//
|
||||
// tsSep4
|
||||
//
|
||||
this.tsSep4.Name = "tsSep4";
|
||||
this.tsSep4.Size = new System.Drawing.Size(6, 25);
|
||||
this.tsSep4.Size = new System.Drawing.Size(6, 46);
|
||||
//
|
||||
// tscbShowCustomSettingNamesOnly
|
||||
//
|
||||
@@ -334,14 +336,14 @@
|
||||
this.tscbShowCustomSettingNamesOnly.Image = global::nspector.Properties.Resources.filter_user;
|
||||
this.tscbShowCustomSettingNamesOnly.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tscbShowCustomSettingNamesOnly.Name = "tscbShowCustomSettingNamesOnly";
|
||||
this.tscbShowCustomSettingNamesOnly.Size = new System.Drawing.Size(24, 22);
|
||||
this.tscbShowCustomSettingNamesOnly.Size = new System.Drawing.Size(40, 40);
|
||||
this.tscbShowCustomSettingNamesOnly.Text = "Show the settings and values from CustomSettingNames file only.";
|
||||
this.tscbShowCustomSettingNamesOnly.CheckedChanged += new System.EventHandler(this.cbCustomSettingsOnly_CheckedChanged);
|
||||
//
|
||||
// tsSep5
|
||||
//
|
||||
this.tsSep5.Name = "tsSep5";
|
||||
this.tsSep5.Size = new System.Drawing.Size(6, 25);
|
||||
this.tsSep5.Size = new System.Drawing.Size(6, 46);
|
||||
//
|
||||
// tscbShowScannedUnknownSettings
|
||||
//
|
||||
@@ -351,7 +353,7 @@
|
||||
this.tscbShowScannedUnknownSettings.Image = global::nspector.Properties.Resources.find_set2;
|
||||
this.tscbShowScannedUnknownSettings.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tscbShowScannedUnknownSettings.Name = "tscbShowScannedUnknownSettings";
|
||||
this.tscbShowScannedUnknownSettings.Size = new System.Drawing.Size(24, 22);
|
||||
this.tscbShowScannedUnknownSettings.Size = new System.Drawing.Size(40, 40);
|
||||
this.tscbShowScannedUnknownSettings.Text = "Show unknown settings from NVIDIA predefined profiles";
|
||||
this.tscbShowScannedUnknownSettings.Click += new System.EventHandler(this.tscbShowScannedUnknownSettings_Click);
|
||||
//
|
||||
@@ -361,14 +363,14 @@
|
||||
this.tsbBitValueEditor.Image = global::nspector.Properties.Resources.text_binary;
|
||||
this.tsbBitValueEditor.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tsbBitValueEditor.Name = "tsbBitValueEditor";
|
||||
this.tsbBitValueEditor.Size = new System.Drawing.Size(24, 22);
|
||||
this.tsbBitValueEditor.Size = new System.Drawing.Size(40, 40);
|
||||
this.tsbBitValueEditor.Text = "Show bit value editor.";
|
||||
this.tsbBitValueEditor.Click += new System.EventHandler(this.tsbBitValueEditor_Click);
|
||||
//
|
||||
// tsSep6
|
||||
//
|
||||
this.tsSep6.Name = "tsSep6";
|
||||
this.tsSep6.Size = new System.Drawing.Size(6, 25);
|
||||
this.tsSep6.Size = new System.Drawing.Size(6, 46);
|
||||
//
|
||||
// tsbApplyProfile
|
||||
//
|
||||
@@ -377,7 +379,7 @@
|
||||
this.tsbApplyProfile.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.tsbApplyProfile.Name = "tsbApplyProfile";
|
||||
this.tsbApplyProfile.Overflow = System.Windows.Forms.ToolStripItemOverflow.Never;
|
||||
this.tsbApplyProfile.Size = new System.Drawing.Size(109, 22);
|
||||
this.tsbApplyProfile.Size = new System.Drawing.Size(173, 40);
|
||||
this.tsbApplyProfile.Text = "Apply changes";
|
||||
this.tsbApplyProfile.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.tsbApplyProfile.Click += new System.EventHandler(this.tsbApplyProfile_Click);
|
||||
@@ -387,10 +389,10 @@
|
||||
this.btnResetValue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnResetValue.Enabled = false;
|
||||
this.btnResetValue.Image = global::nspector.Properties.Resources.nv_btn;
|
||||
this.btnResetValue.Location = new System.Drawing.Point(732, 175);
|
||||
this.btnResetValue.Margin = new System.Windows.Forms.Padding(0, 1, 0, 0);
|
||||
this.btnResetValue.Location = new System.Drawing.Point(1342, 323);
|
||||
this.btnResetValue.Margin = new System.Windows.Forms.Padding(0, 2, 0, 0);
|
||||
this.btnResetValue.Name = "btnResetValue";
|
||||
this.btnResetValue.Size = new System.Drawing.Size(25, 19);
|
||||
this.btnResetValue.Size = new System.Drawing.Size(46, 35);
|
||||
this.btnResetValue.TabIndex = 7;
|
||||
this.btnResetValue.UseVisualStyleBackColor = true;
|
||||
this.btnResetValue.Click += new System.EventHandler(this.btnResetValue_Click);
|
||||
@@ -402,10 +404,10 @@
|
||||
this.lblApplications.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(118)))), ((int)(((byte)(185)))), ((int)(((byte)(0)))));
|
||||
this.lblApplications.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.lblApplications.ForeColor = System.Drawing.Color.White;
|
||||
this.lblApplications.Location = new System.Drawing.Point(12, 32);
|
||||
this.lblApplications.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.lblApplications.Location = new System.Drawing.Point(22, 59);
|
||||
this.lblApplications.Margin = new System.Windows.Forms.Padding(7, 0, 7, 0);
|
||||
this.lblApplications.Name = "lblApplications";
|
||||
this.lblApplications.Size = new System.Drawing.Size(840, 17);
|
||||
this.lblApplications.Size = new System.Drawing.Size(1540, 31);
|
||||
this.lblApplications.TabIndex = 25;
|
||||
this.lblApplications.Text = "fsagame.exe, bond.exe, herozero.exe";
|
||||
this.lblApplications.DoubleClick += new System.EventHandler(this.tsbAddApplication_Click);
|
||||
@@ -444,10 +446,10 @@
|
||||
//
|
||||
this.cbValues.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.cbValues.FormattingEnabled = true;
|
||||
this.cbValues.Location = new System.Drawing.Point(524, 175);
|
||||
this.cbValues.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.cbValues.Location = new System.Drawing.Point(961, 323);
|
||||
this.cbValues.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
|
||||
this.cbValues.Name = "cbValues";
|
||||
this.cbValues.Size = new System.Drawing.Size(72, 21);
|
||||
this.cbValues.Size = new System.Drawing.Size(129, 32);
|
||||
this.cbValues.TabIndex = 5;
|
||||
this.cbValues.Visible = false;
|
||||
this.cbValues.SelectedValueChanged += new System.EventHandler(this.cbValues_SelectedValueChanged);
|
||||
@@ -455,40 +457,40 @@
|
||||
//
|
||||
// lblWidth96
|
||||
//
|
||||
this.lblWidth96.Location = new System.Drawing.Point(77, 233);
|
||||
this.lblWidth96.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.lblWidth96.Location = new System.Drawing.Point(141, 430);
|
||||
this.lblWidth96.Margin = new System.Windows.Forms.Padding(7, 0, 7, 0);
|
||||
this.lblWidth96.Name = "lblWidth96";
|
||||
this.lblWidth96.Size = new System.Drawing.Size(96, 18);
|
||||
this.lblWidth96.Size = new System.Drawing.Size(176, 33);
|
||||
this.lblWidth96.TabIndex = 77;
|
||||
this.lblWidth96.Text = "96";
|
||||
this.lblWidth96.Visible = false;
|
||||
//
|
||||
// lblWidth330
|
||||
//
|
||||
this.lblWidth330.Location = new System.Drawing.Point(77, 210);
|
||||
this.lblWidth330.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.lblWidth330.Location = new System.Drawing.Point(141, 388);
|
||||
this.lblWidth330.Margin = new System.Windows.Forms.Padding(7, 0, 7, 0);
|
||||
this.lblWidth330.Name = "lblWidth330";
|
||||
this.lblWidth330.Size = new System.Drawing.Size(330, 22);
|
||||
this.lblWidth330.Size = new System.Drawing.Size(605, 41);
|
||||
this.lblWidth330.TabIndex = 78;
|
||||
this.lblWidth330.Text = "330 (Helper Labels for DPI Scaling)";
|
||||
this.lblWidth330.Visible = false;
|
||||
//
|
||||
// lblWidth16
|
||||
//
|
||||
this.lblWidth16.Location = new System.Drawing.Point(77, 269);
|
||||
this.lblWidth16.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.lblWidth16.Location = new System.Drawing.Point(141, 497);
|
||||
this.lblWidth16.Margin = new System.Windows.Forms.Padding(7, 0, 7, 0);
|
||||
this.lblWidth16.Name = "lblWidth16";
|
||||
this.lblWidth16.Size = new System.Drawing.Size(16, 18);
|
||||
this.lblWidth16.Size = new System.Drawing.Size(29, 33);
|
||||
this.lblWidth16.TabIndex = 79;
|
||||
this.lblWidth16.Text = "16";
|
||||
this.lblWidth16.Visible = false;
|
||||
//
|
||||
// lblWidth30
|
||||
//
|
||||
this.lblWidth30.Location = new System.Drawing.Point(77, 251);
|
||||
this.lblWidth30.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.lblWidth30.Location = new System.Drawing.Point(141, 463);
|
||||
this.lblWidth30.Margin = new System.Windows.Forms.Padding(7, 0, 7, 0);
|
||||
this.lblWidth30.Name = "lblWidth30";
|
||||
this.lblWidth30.Size = new System.Drawing.Size(30, 18);
|
||||
this.lblWidth30.Size = new System.Drawing.Size(55, 33);
|
||||
this.lblWidth30.TabIndex = 80;
|
||||
this.lblWidth30.Text = "30";
|
||||
this.lblWidth30.Visible = false;
|
||||
@@ -504,12 +506,12 @@
|
||||
this.lvSettings.GridLines = true;
|
||||
this.lvSettings.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
|
||||
this.lvSettings.HideSelection = false;
|
||||
this.lvSettings.Location = new System.Drawing.Point(0, 0);
|
||||
this.lvSettings.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.lvSettings.Location = new System.Drawing.Point(0, 29);
|
||||
this.lvSettings.Margin = new System.Windows.Forms.Padding(7);
|
||||
this.lvSettings.MultiSelect = false;
|
||||
this.lvSettings.Name = "lvSettings";
|
||||
this.lvSettings.ShowItemToolTips = true;
|
||||
this.lvSettings.Size = new System.Drawing.Size(840, 372);
|
||||
this.lvSettings.Size = new System.Drawing.Size(1540, 661);
|
||||
this.lvSettings.SmallImageList = this.ilListView;
|
||||
this.lvSettings.TabIndex = 2;
|
||||
this.lvSettings.UseCompatibleStateImageBehavior = false;
|
||||
@@ -538,12 +540,13 @@
|
||||
// tbSettingDescription
|
||||
//
|
||||
this.tbSettingDescription.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.tbSettingDescription.Location = new System.Drawing.Point(0, 372);
|
||||
this.tbSettingDescription.Location = new System.Drawing.Point(0, 690);
|
||||
this.tbSettingDescription.Margin = new System.Windows.Forms.Padding(6);
|
||||
this.tbSettingDescription.Multiline = true;
|
||||
this.tbSettingDescription.Name = "tbSettingDescription";
|
||||
this.tbSettingDescription.ReadOnly = true;
|
||||
this.tbSettingDescription.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.tbSettingDescription.Size = new System.Drawing.Size(840, 44);
|
||||
this.tbSettingDescription.Size = new System.Drawing.Size(1540, 78);
|
||||
this.tbSettingDescription.TabIndex = 81;
|
||||
this.tbSettingDescription.Visible = false;
|
||||
//
|
||||
@@ -553,17 +556,31 @@
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.pnlListview.Controls.Add(this.lvSettings);
|
||||
this.pnlListview.Controls.Add(this.txtFilter);
|
||||
this.pnlListview.Controls.Add(this.tbSettingDescription);
|
||||
this.pnlListview.Location = new System.Drawing.Point(12, 52);
|
||||
this.pnlListview.Location = new System.Drawing.Point(22, 96);
|
||||
this.pnlListview.Margin = new System.Windows.Forms.Padding(6);
|
||||
this.pnlListview.Name = "pnlListview";
|
||||
this.pnlListview.Size = new System.Drawing.Size(840, 416);
|
||||
this.pnlListview.Size = new System.Drawing.Size(1540, 768);
|
||||
this.pnlListview.TabIndex = 82;
|
||||
//
|
||||
// txtFilter
|
||||
//
|
||||
this.txtFilter.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.txtFilter.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.txtFilter.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.txtFilter.Location = new System.Drawing.Point(0, 0);
|
||||
this.txtFilter.Name = "txtFilter";
|
||||
this.txtFilter.Size = new System.Drawing.Size(1540, 29);
|
||||
this.txtFilter.TabIndex = 82;
|
||||
this.txtFilter.WatermarkText = "Search for setting...";
|
||||
this.txtFilter.TextChanged += new System.EventHandler(this.txtFilter_TextChanged);
|
||||
//
|
||||
// frmDrvSettings
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 22F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(864, 492);
|
||||
this.ClientSize = new System.Drawing.Size(1584, 908);
|
||||
this.Controls.Add(this.pnlListview);
|
||||
this.Controls.Add(this.lblWidth30);
|
||||
this.Controls.Add(this.lblWidth16);
|
||||
@@ -574,8 +591,8 @@
|
||||
this.Controls.Add(this.pbMain);
|
||||
this.Controls.Add(this.btnResetValue);
|
||||
this.Controls.Add(this.cbValues);
|
||||
this.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.MinimumSize = new System.Drawing.Size(879, 346);
|
||||
this.Margin = new System.Windows.Forms.Padding(7);
|
||||
this.MinimumSize = new System.Drawing.Size(1592, 585);
|
||||
this.Name = "frmDrvSettings";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "nSpector - Driver Profile Settings";
|
||||
@@ -640,5 +657,6 @@
|
||||
private System.Windows.Forms.ToolStripMenuItem exportCurrentProfileIncludingPredefinedSettingsToolStripMenuItem;
|
||||
private System.Windows.Forms.TextBox tbSettingDescription;
|
||||
private System.Windows.Forms.Panel pnlListview;
|
||||
private WatermarkTextBox txtFilter;
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using static nspector.ListViewEx;
|
||||
|
||||
namespace nspector
|
||||
{
|
||||
@@ -175,9 +176,22 @@ namespace nspector
|
||||
}
|
||||
finally
|
||||
{
|
||||
lvSettings.EndUpdate();
|
||||
((ListViewGroupSorter)lvSettings).SortGroups(true);
|
||||
|
||||
foreach (ListViewGroup group in lvSettings.Groups)
|
||||
{
|
||||
if (_groupCollapsedStates.TryGetValue(group.Header, out bool isCollapsed))
|
||||
{
|
||||
lvSettings.SetGroupState(group, isCollapsed ? ListViewGroupState.Collapsed | ListViewGroupState.Collapsible : ListViewGroupState.Normal | ListViewGroupState.Collapsible);
|
||||
}
|
||||
else
|
||||
{
|
||||
lvSettings.SetGroupState(group, ListViewGroupState.Collapsible);
|
||||
}
|
||||
}
|
||||
|
||||
lvSettings.EndUpdate();
|
||||
|
||||
GC.Collect();
|
||||
for (int i = 0; i < lvSettings.Items.Count; i++)
|
||||
{
|
||||
@@ -195,6 +209,7 @@ namespace nspector
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void RefreshProfilesCombo()
|
||||
@@ -529,6 +544,69 @@ namespace nspector
|
||||
|
||||
tscbShowCustomSettingNamesOnly.Checked = showCsnOnly;
|
||||
Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
|
||||
|
||||
lvSettings.GroupStateChanged += lvSettings_GroupStateChanged;
|
||||
|
||||
LoadGroupStates(Path.Combine(AppContext.BaseDirectory, "HiddenGroups.ini"));
|
||||
}
|
||||
|
||||
private Dictionary<string, bool> _groupCollapsedStates = new();
|
||||
|
||||
private void lvSettings_GroupStateChanged(object sender, GroupStateChangedEventArgs e)
|
||||
{
|
||||
_groupCollapsedStates[e.Group.Header] = e.IsCollapsed;
|
||||
|
||||
SaveGroupStates(Path.Combine(AppContext.BaseDirectory, "HiddenGroups.ini"));
|
||||
}
|
||||
|
||||
private bool SaveGroupStates(string filePath)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var writer = new StreamWriter(filePath))
|
||||
{
|
||||
foreach (var kvp in _groupCollapsedStates)
|
||||
{
|
||||
writer.WriteLine($"{kvp.Key}={kvp.Value}");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private bool LoadGroupStates(string filePath)
|
||||
{
|
||||
_groupCollapsedStates.Clear();
|
||||
|
||||
if (!File.Exists(filePath))
|
||||
return false;
|
||||
|
||||
try
|
||||
{
|
||||
foreach (var line in File.ReadAllLines(filePath))
|
||||
{
|
||||
int lastEqualIndex = line.LastIndexOf('=');
|
||||
if (lastEqualIndex != -1)
|
||||
{
|
||||
var key = line.Substring(0, lastEqualIndex).Trim();
|
||||
var valueStr = line.Substring(lastEqualIndex + 1).Trim();
|
||||
|
||||
if (bool.TryParse(valueStr, out bool value))
|
||||
{
|
||||
_groupCollapsedStates[key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static double ScaleFactor = 1;
|
||||
@@ -629,12 +707,16 @@ namespace nspector
|
||||
DeleteSelectedValue();
|
||||
else
|
||||
ResetSelectedValue();
|
||||
|
||||
ApplySearchFilter();
|
||||
}
|
||||
|
||||
ToolTip appPathsTooltip = new ToolTip() { InitialDelay = 250 };
|
||||
|
||||
private void ChangeCurrentProfile(string profileName)
|
||||
{
|
||||
txtFilter.Text = "";
|
||||
|
||||
if (profileName == GetBaseProfileName() || profileName == _baseProfileName)
|
||||
{
|
||||
_CurrentProfile = _baseProfileName;
|
||||
@@ -839,6 +921,8 @@ namespace nspector
|
||||
catch { }
|
||||
|
||||
StoreChangesOfProfileToDriver();
|
||||
|
||||
ApplySearchFilter();
|
||||
}
|
||||
|
||||
private void tsbBitValueEditor_Click(object sender, EventArgs e)
|
||||
@@ -1104,6 +1188,8 @@ namespace nspector
|
||||
|
||||
private async void RefreshAll()
|
||||
{
|
||||
txtFilter.Text = "";
|
||||
|
||||
RefreshProfilesCombo();
|
||||
await ScanProfilesSilentAsync(true, false);
|
||||
|
||||
@@ -1293,37 +1379,60 @@ namespace nspector
|
||||
CopyModifiedSettingsToClipBoard();
|
||||
}
|
||||
|
||||
if (e.Control && e.Alt && e.KeyCode == Keys.D)
|
||||
else if (e.Control && e.Alt && e.KeyCode == Keys.D)
|
||||
{
|
||||
EnableDevmode();
|
||||
}
|
||||
|
||||
if (Debugger.IsAttached && e.Control && e.KeyCode == Keys.T)
|
||||
else if (Debugger.IsAttached && e.Control && e.KeyCode == Keys.T)
|
||||
{
|
||||
TestStoreSettings();
|
||||
}
|
||||
|
||||
if (e.Control && e.KeyCode == Keys.F)
|
||||
else if (e.Control && e.KeyCode == Keys.F)
|
||||
{
|
||||
SearchSetting();
|
||||
txtFilter.Focus();
|
||||
}
|
||||
|
||||
if (e.KeyCode == Keys.Escape)
|
||||
else if (e.KeyCode == Keys.Escape)
|
||||
{
|
||||
RefreshCurrentProfile();
|
||||
}
|
||||
|
||||
else if (!e.Control && (e.KeyCode >= Keys.A && e.KeyCode <= Keys.Z ||
|
||||
e.KeyCode >= Keys.D0 && e.KeyCode <= Keys.D9 ||
|
||||
e.KeyCode >= Keys.NumPad0 && e.KeyCode <= Keys.NumPad9 ||
|
||||
e.KeyCode == Keys.Space || e.KeyCode == Keys.OemPeriod))
|
||||
{
|
||||
txtFilter.Visible = true;
|
||||
txtFilter.Focus();
|
||||
txtFilter.Text += e.Shift ? e.KeyCode.ToString() : e.KeyCode.ToString().ToLower();
|
||||
txtFilter.SelectionStart = txtFilter.Text.Length;
|
||||
e.SuppressKeyPress = true;
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void SearchSetting()
|
||||
private CancellationTokenSource cts;
|
||||
|
||||
private void ApplySearchFilter(CancellationTokenSource cts = null)
|
||||
{
|
||||
string inputString = "";
|
||||
if (InputBox.Show("Search Setting", "Please enter setting name:", ref inputString, new List<string>(), "", 2048) == System.Windows.Forms.DialogResult.OK)
|
||||
var lowerInput = txtFilter.Text.Trim().ToLowerInvariant();
|
||||
|
||||
if (cts != null && cts.Token.IsCancellationRequested) return;
|
||||
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
var lowerInput = inputString.Trim().ToLowerInvariant();
|
||||
RefreshCurrentProfile();
|
||||
|
||||
if (string.IsNullOrEmpty(lowerInput))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
lvSettings.BeginUpdate();
|
||||
foreach(ListViewItem itm in lvSettings.Items)
|
||||
foreach (ListViewItem itm in lvSettings.Items)
|
||||
{
|
||||
if (!itm.Text.ToLowerInvariant().Contains(lowerInput))
|
||||
{
|
||||
@@ -1331,8 +1440,54 @@ namespace nspector
|
||||
}
|
||||
}
|
||||
lvSettings.EndUpdate();
|
||||
|
||||
txtFilter.Focus(); // Setting listbox sometimes steals focus away
|
||||
}));
|
||||
}
|
||||
|
||||
private async void txtFilter_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
cts?.Cancel();
|
||||
cts = new CancellationTokenSource();
|
||||
|
||||
try
|
||||
{
|
||||
await Task.Delay(250, cts.Token); // search filter can be slow, wait for user to stop typing for ~250ms before we start refresh
|
||||
|
||||
if (cts.Token.IsCancellationRequested) return;
|
||||
|
||||
await Task.Run(() =>
|
||||
{
|
||||
ApplySearchFilter(cts);
|
||||
});
|
||||
}
|
||||
|
||||
catch (TaskCanceledException)
|
||||
{
|
||||
// Ignore cancellation
|
||||
}
|
||||
}
|
||||
|
||||
private void txtFilter_TextChangedD(object sender, EventArgs e)
|
||||
{
|
||||
RefreshCurrentProfile();
|
||||
|
||||
if (string.IsNullOrEmpty(txtFilter.Text.Trim()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var lowerInput = txtFilter.Text.Trim().ToLowerInvariant();
|
||||
lvSettings.BeginUpdate();
|
||||
foreach (ListViewItem itm in lvSettings.Items)
|
||||
{
|
||||
if (!itm.Text.ToLowerInvariant().Contains(lowerInput))
|
||||
{
|
||||
itm.Remove();
|
||||
}
|
||||
}
|
||||
lvSettings.EndUpdate();
|
||||
|
||||
txtFilter.Focus(); // Setting listbox sometimes steals focus away
|
||||
}
|
||||
|
||||
private void EnableDevmode()
|
||||
@@ -1424,7 +1579,6 @@ namespace nspector
|
||||
}
|
||||
|
||||
Clipboard.SetText(sbSettings.ToString());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,6 +204,9 @@
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="WatermarkTextBox.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="frmBitEditor.resx">
|
||||
<DependentUpon>frmBitEditor.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
|
||||
Reference in New Issue
Block a user