ToolStatus: Add cached settings
This commit is contained in:
@@ -19,6 +19,12 @@ typedef struct _TB_GRAPH_CONTEXT
|
||||
LONG GraphDpi;
|
||||
} TB_GRAPH_CONTEXT, *PTB_GRAPH_CONTEXT;
|
||||
|
||||
ULONG CpuHistoryGraphColor1 = 0;
|
||||
ULONG CpuHistoryGraphColor2 = 0;
|
||||
ULONG PhysicalHistoryGraphColor1 = 0;
|
||||
ULONG CommitHistoryGraph1Color1 = 0;
|
||||
ULONG IoHistoryGraphColor1 = 0;
|
||||
ULONG IoHistoryGraphColor2 = 0;
|
||||
TOOLSTATUS_GRAPH_MESSAGE_CALLBACK_DECLARE(CpuHistoryGraphMessageCallback);
|
||||
TOOLSTATUS_GRAPH_MESSAGE_CALLBACK_DECLARE(PhysicalHistoryGraphMessageCallback);
|
||||
TOOLSTATUS_GRAPH_MESSAGE_CALLBACK_DECLARE(CommitHistoryGraphMessageCallback);
|
||||
@@ -690,7 +696,7 @@ TOOLSTATUS_GRAPH_MESSAGE_CALLBACK_DECLARE(CpuHistoryGraphMessageCallback)
|
||||
context->GraphDpi = PhGetWindowDpi(GraphHandle);
|
||||
|
||||
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_LINE_2;
|
||||
PhSiSetColorsGraphDrawInfo(drawInfo, PhGetIntegerSetting(L"ColorCpuKernel"), PhGetIntegerSetting(L"ColorCpuUser"), context->GraphDpi);
|
||||
PhSiSetColorsGraphDrawInfo(drawInfo, CpuHistoryGraphColor1, CpuHistoryGraphColor2, context->GraphDpi);
|
||||
|
||||
if (!(SystemStatistics.CpuKernelHistory && SystemStatistics.CpuUserHistory))
|
||||
break;
|
||||
@@ -779,7 +785,7 @@ TOOLSTATUS_GRAPH_MESSAGE_CALLBACK_DECLARE(PhysicalHistoryGraphMessageCallback)
|
||||
context->GraphDpi = PhGetWindowDpi(GraphHandle);
|
||||
|
||||
drawInfo->Flags = PH_GRAPH_USE_GRID_X;
|
||||
PhSiSetColorsGraphDrawInfo(drawInfo, PhGetIntegerSetting(L"ColorPhysical"), 0, context->GraphDpi);
|
||||
PhSiSetColorsGraphDrawInfo(drawInfo, PhysicalHistoryGraphColor1, 0, context->GraphDpi);
|
||||
|
||||
if (!SystemStatistics.PhysicalHistory)
|
||||
break;
|
||||
@@ -862,7 +868,7 @@ TOOLSTATUS_GRAPH_MESSAGE_CALLBACK_DECLARE(CommitHistoryGraphMessageCallback)
|
||||
context->GraphDpi = PhGetWindowDpi(GraphHandle);
|
||||
|
||||
drawInfo->Flags = PH_GRAPH_USE_GRID_X;
|
||||
PhSiSetColorsGraphDrawInfo(drawInfo, PhGetIntegerSetting(L"ColorPrivate"), 0, context->GraphDpi);
|
||||
PhSiSetColorsGraphDrawInfo(drawInfo, CommitHistoryGraph1Color1, 0, context->GraphDpi);
|
||||
|
||||
if (!(SystemStatistics.CommitHistory && SystemStatistics.Performance))
|
||||
break;
|
||||
@@ -941,11 +947,11 @@ TOOLSTATUS_GRAPH_MESSAGE_CALLBACK_DECLARE(IoHistoryGraphMessageCallback)
|
||||
PPH_GRAPH_GETDRAWINFO getDrawInfo = (PPH_GRAPH_GETDRAWINFO)Header;
|
||||
PPH_GRAPH_DRAW_INFO drawInfo = getDrawInfo->DrawInfo;
|
||||
|
||||
if (context->GraphDpi == 0)
|
||||
if (context->GraphDpi == 0)
|
||||
context->GraphDpi = PhGetWindowDpi(GraphHandle);
|
||||
|
||||
drawInfo->Flags = PH_GRAPH_USE_GRID_X | PH_GRAPH_USE_LINE_2;
|
||||
PhSiSetColorsGraphDrawInfo(drawInfo, PhGetIntegerSetting(L"ColorIoReadOther"), PhGetIntegerSetting(L"ColorIoWrite"), context->GraphDpi);
|
||||
PhSiSetColorsGraphDrawInfo(drawInfo, IoHistoryGraphColor1, IoHistoryGraphColor2, context->GraphDpi);
|
||||
|
||||
if (!(SystemStatistics.IoReadHistory && SystemStatistics.IoOtherHistory && SystemStatistics.IoWriteHistory))
|
||||
break;
|
||||
|
||||
@@ -38,6 +38,8 @@ BOOLEAN EnableThemeSupport = FALSE;
|
||||
BOOLEAN IsWindowSizeMove = FALSE;
|
||||
BOOLEAN IsWindowMinimized = FALSE;
|
||||
BOOLEAN IsWindowMaximized = FALSE;
|
||||
BOOLEAN IconSingleClick = FALSE;
|
||||
BOOLEAN RestoreRowAfterSearch = FALSE;
|
||||
TOOLBAR_DISPLAY_STYLE DisplayStyle = TOOLBAR_DISPLAY_STYLE_SELECTIVETEXT;
|
||||
SEARCHBOX_DISPLAY_MODE SearchBoxDisplayMode = SEARCHBOX_DISPLAY_MODE_ALWAYSSHOW;
|
||||
REBAR_DISPLAY_LOCATION RebarDisplayLocation = REBAR_DISPLAY_LOCATION_TOP;
|
||||
@@ -78,6 +80,7 @@ static PH_CALLBACK_REGISTRATION MainMenuInitializingCallbackRegistration;
|
||||
static PH_CALLBACK_REGISTRATION PluginShowOptionsCallbackRegistration;
|
||||
static PH_CALLBACK_REGISTRATION MainWindowShowingCallbackRegistration;
|
||||
static PH_CALLBACK_REGISTRATION ProcessesUpdatedCallbackRegistration;
|
||||
static PH_CALLBACK_REGISTRATION SettingsUpdatedCallbackRegistration;
|
||||
static PH_CALLBACK_REGISTRATION LayoutPaddingCallbackRegistration;
|
||||
static PH_CALLBACK_REGISTRATION TabPageCallbackRegistration;
|
||||
static PH_CALLBACK_REGISTRATION ProcessTreeNewInitializingCallbackRegistration;
|
||||
@@ -719,7 +722,7 @@ LRESULT CALLBACK MainWndSubclassProc(
|
||||
if (GET_WM_COMMAND_HWND(wParam, lParam) != SearchboxHandle)
|
||||
break;
|
||||
|
||||
if (PhGetIntegerSetting(SETTING_NAME_RESTOREROWAFTERSEARCH))
|
||||
if (RestoreRowAfterSearch)
|
||||
{
|
||||
PPH_PROCESS_ITEM processItem = PhGetSelectedProcessItem();
|
||||
|
||||
@@ -738,7 +741,7 @@ LRESULT CALLBACK MainWndSubclassProc(
|
||||
if (GET_WM_COMMAND_HWND(wParam, lParam) != SearchboxHandle)
|
||||
break;
|
||||
|
||||
if (PhGetIntegerSetting(SETTING_NAME_RESTOREROWAFTERSEARCH) && SearchboxText->Length == 0)
|
||||
if (RestoreRowAfterSearch && SearchboxText->Length == 0)
|
||||
{
|
||||
if (RestoreSearchSelectedProcessId != ULONG_MAX)
|
||||
{
|
||||
@@ -1558,7 +1561,7 @@ LRESULT CALLBACK MainWndSubclassProc(
|
||||
{
|
||||
case WM_LBUTTONDOWN:
|
||||
{
|
||||
if (PhGetIntegerSetting(L"IconSingleClick"))
|
||||
if (IconSingleClick)
|
||||
{
|
||||
if (IsWindowVisible(hWnd))
|
||||
{
|
||||
@@ -1569,7 +1572,7 @@ LRESULT CALLBACK MainWndSubclassProc(
|
||||
break;
|
||||
case WM_LBUTTONDBLCLK:
|
||||
{
|
||||
if (!PhGetIntegerSetting(L"IconSingleClick"))
|
||||
if (!IconSingleClick)
|
||||
{
|
||||
if (IsWindowVisible(hWnd))
|
||||
{
|
||||
@@ -1687,6 +1690,20 @@ VOID NTAPI MainMenuInitializingCallback(
|
||||
PhInsertEMenuItem(menuInfo->Menu, menu, insertIndex);
|
||||
}
|
||||
|
||||
VOID UpdateCachedSettings(
|
||||
VOID
|
||||
)
|
||||
{
|
||||
IconSingleClick = !!PhGetIntegerSetting(L"IconSingleClick");
|
||||
|
||||
CpuHistoryGraphColor1 = PhGetIntegerSetting(L"ColorCpuKernel");
|
||||
CpuHistoryGraphColor2 = PhGetIntegerSetting(L"ColorCpuKernel");
|
||||
PhysicalHistoryGraphColor1 = PhGetIntegerSetting(L"ColorPhysical");
|
||||
CommitHistoryGraph1Color1 = PhGetIntegerSetting(L"ColorPrivate");
|
||||
IoHistoryGraphColor1 = PhGetIntegerSetting(L"ColorIoReadOther");
|
||||
IoHistoryGraphColor2 = PhGetIntegerSetting(L"ColorIoWrite");
|
||||
}
|
||||
|
||||
VOID NTAPI LoadCallback(
|
||||
_In_opt_ PVOID Parameter,
|
||||
_In_opt_ PVOID Context
|
||||
@@ -1696,6 +1713,7 @@ VOID NTAPI LoadCallback(
|
||||
DisplayStyle = PhGetIntegerSetting(SETTING_NAME_TOOLBARDISPLAYSTYLE);
|
||||
SearchBoxDisplayMode = PhGetIntegerSetting(SETTING_NAME_SEARCHBOXDISPLAYMODE);
|
||||
TaskbarListIconType = PhGetIntegerSetting(SETTING_NAME_TASKBARDISPLAYSTYLE);
|
||||
RestoreRowAfterSearch = !!PhGetIntegerSetting(SETTING_NAME_RESTOREROWAFTERSEARCH);
|
||||
EnableThemeSupport = !!PhGetIntegerSetting(L"EnableThemeSupport");
|
||||
UpdateGraphs = !PhGetIntegerSetting(L"StartHidden");
|
||||
TabInfoHashtable = PhCreateSimpleHashtable(3);
|
||||
@@ -1705,9 +1723,19 @@ VOID NTAPI LoadCallback(
|
||||
MaxInitializationDelay = PhGetIntegerSetting(SETTING_NAME_DELAYED_INITIALIZATION_MAX);
|
||||
MaxInitializationDelay = __max(0, __min(MaxInitializationDelay, 5));
|
||||
|
||||
UpdateCachedSettings();
|
||||
|
||||
ToolbarGraphsInitialize();
|
||||
}
|
||||
|
||||
VOID NTAPI SettingsUpdatedCallback(
|
||||
_In_opt_ PVOID Parameter,
|
||||
_In_opt_ PVOID Context
|
||||
)
|
||||
{
|
||||
UpdateCachedSettings();
|
||||
}
|
||||
|
||||
VOID NTAPI MenuItemCallback(
|
||||
_In_opt_ PVOID Parameter,
|
||||
_In_opt_ PVOID Context
|
||||
@@ -1906,6 +1934,12 @@ LOGICAL DllMain(
|
||||
NULL,
|
||||
&PluginShowOptionsCallbackRegistration
|
||||
);
|
||||
PhRegisterCallback(
|
||||
PhGetGeneralCallback(GeneralCallbackSettingsUpdated),
|
||||
SettingsUpdatedCallback,
|
||||
NULL,
|
||||
&SettingsUpdatedCallbackRegistration
|
||||
);
|
||||
PhRegisterCallback(
|
||||
PhGetGeneralCallback(GeneralCallbackProcessesUpdated),
|
||||
ProcessesUpdatedCallback,
|
||||
|
||||
@@ -276,6 +276,13 @@ typedef struct _PH_TOOLBAR_GRAPH
|
||||
PH_GRAPH_STATE GraphState;
|
||||
} PH_TOOLBAR_GRAPH, *PPH_TOOLBAR_GRAPH;
|
||||
|
||||
extern ULONG CpuHistoryGraphColor1;
|
||||
extern ULONG CpuHistoryGraphColor2;
|
||||
extern ULONG PhysicalHistoryGraphColor1;
|
||||
extern ULONG CommitHistoryGraph1Color1;
|
||||
extern ULONG IoHistoryGraphColor1;
|
||||
extern ULONG IoHistoryGraphColor2;
|
||||
|
||||
VOID ToolbarGraphLoadSettings(
|
||||
VOID
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user