Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for Custom System Color Overrides #2376

Merged
merged 86 commits into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
2040433
WIP
sdottaka Jul 5, 2024
c33054e
Merge branch 'master' into syscolor-hook
sdottaka Jul 8, 2024
25c5899
WIP
sdottaka Jul 8, 2024
559db13
WIP
sdottaka Jul 8, 2024
30a13ba
WIP
sdottaka Jul 10, 2024
125f8fb
Merge branch 'master' into syscolor-hook
sdottaka Jul 10, 2024
a4efe71
WIP
sdottaka Jul 12, 2024
24a80df
WIP
sdottaka Jul 12, 2024
e9214e6
Merge branch 'master' into syscolor-hook
sdottaka Jul 13, 2024
94affca
Merge remote-tracking branch 'origin/master' into syscolor-hook
sdottaka Jul 28, 2024
287c48f
WIP
sdottaka Aug 1, 2024
875134b
Merge remote-tracking branch 'origin/master' into commandbar
sdottaka Aug 4, 2024
ac34f6b
WIP
sdottaka Aug 4, 2024
e842643
WIP
sdottaka Aug 5, 2024
281ed2f
Merge branch 'commandbar' into syscolor-hook
sdottaka Aug 6, 2024
29882ee
Merge branch 'master' into syscolor-hook
sdottaka Aug 6, 2024
d07f58d
WIP
sdottaka Aug 10, 2024
67fc535
WIP
sdottaka Aug 13, 2024
9b05201
Merge remote-tracking branch 'origin/master' into commandbar
sdottaka Aug 13, 2024
b965560
Merge branch 'commandbar' into syscolor-hook
sdottaka Aug 13, 2024
c4b9f48
WIP
sdottaka Aug 13, 2024
5f69d87
WIP
sdottaka Aug 13, 2024
a406814
WIP
sdottaka Aug 13, 2024
e8071cc
WIP
sdottaka Aug 14, 2024
63dc5cf
Merge branch 'commandbar' into syscolor-hook
sdottaka Aug 14, 2024
940dcbf
WIP
sdottaka Aug 14, 2024
9d37e04
WIP
sdottaka Aug 14, 2024
0feacb1
Merge branch 'commandbar' into syscolor-hook
sdottaka Aug 14, 2024
fefe7e9
WIP
sdottaka Aug 14, 2024
7fff29c
WIPMerge remote-tracking branch 'origin/syscolor-hook' into darkmode
sdottaka Aug 14, 2024
6c4c6e6
Merge branch 'commandbar' into syscolor-hook
sdottaka Aug 14, 2024
638e671
Merge branch 'master' into syscolor-hook
sdottaka Aug 15, 2024
e6e3e2d
WIP
sdottaka Aug 17, 2024
7e2f5ff
WIP
sdottaka Aug 22, 2024
00d9c2b
WIP
sdottaka Aug 23, 2024
d0bf09a
WIP
sdottaka Aug 25, 2024
5ed5f4c
Merge branch 'master' into custom-titlebar
sdottaka Aug 28, 2024
10daec4
Merge branch 'master' into custom-titlebar
sdottaka Aug 31, 2024
4bee9e2
WIP
sdottaka Sep 1, 2024
8b3cd59
WIP
sdottaka Sep 1, 2024
6110e8f
WIP
sdottaka Sep 7, 2024
8875d62
Merge branch 'master' into custom-titlebar
sdottaka Sep 8, 2024
e867c0d
crystaledit/editlib/parses/*: refactor
sdottaka Sep 8, 2024
c82b15f
Merge branch 'master' into custom-titlebar
sdottaka Sep 8, 2024
e83cc07
Merge branch 'master' into syscolor-hook
sdottaka Sep 8, 2024
a4b4150
WIP
sdottaka Sep 10, 2024
7496b33
WIP
sdottaka Sep 16, 2024
573af39
WIP
sdottaka Sep 17, 2024
a371119
Merge branch 'master' into custom-titlebar
sdottaka Sep 17, 2024
d4eb296
WIP
sdottaka Sep 18, 2024
0a4f3dc
Merge branch 'master' into custom-titlebar
sdottaka Sep 18, 2024
1f0c334
Merge branch 'master' into custom-titlebar
sdottaka Sep 18, 2024
3387acb
WIP
sdottaka Sep 19, 2024
862541a
Merge branch 'master' into custom-titlebar
sdottaka Sep 19, 2024
6617b92
WIP
sdottaka Sep 21, 2024
2b9a605
WIP
sdottaka Sep 21, 2024
e1be4c8
WIP
sdottaka Sep 22, 2024
e129685
WIP
sdottaka Sep 23, 2024
760bef2
WIP
sdottaka Sep 24, 2024
e485afd
WIP
sdottaka Sep 24, 2024
38656ce
Merge branch 'custom-titlebar' into syscolor-hook
sdottaka Sep 24, 2024
369e9bd
Merge branch 'master' into syscolor-hook
sdottaka Sep 29, 2024
9ccee92
Merge branch 'master' into syscolor-hook
sdottaka Oct 7, 2024
9cfeff3
Merge branch 'master' into syscolor-hook
sdottaka Oct 13, 2024
7b01005
Merge branch 'master' into syscolor-hook
sdottaka Oct 13, 2024
37de2ab
WIP
sdottaka Oct 13, 2024
2db41af
Merge branch 'master' into syscolor-hook
sdottaka Oct 13, 2024
f4cc735
WIP
sdottaka Oct 13, 2024
7366978
WIP
sdottaka Oct 13, 2024
2ecec8a
Merge branch 'master' into syscolor-hook
sdottaka Oct 13, 2024
5bfe5f8
WIP
sdottaka Oct 13, 2024
33ff420
WIP
sdottaka Oct 15, 2024
d2bc5a9
WIP
sdottaka Oct 15, 2024
ce96df3
WIP
sdottaka Oct 15, 2024
5ed7d61
WIP
sdottaka Oct 16, 2024
36f77b2
WIP
sdottaka Oct 17, 2024
956537b
WIP
sdottaka Oct 17, 2024
05fc4d2
WIP
sdottaka Oct 17, 2024
6114188
WIP
sdottaka Oct 18, 2024
9b17e85
WIP
sdottaka Oct 18, 2024
a50fc4c
WIP
sdottaka Oct 18, 2024
4981501
WIP
sdottaka Oct 19, 2024
d8aa466
Merge branch 'master' into syscolor-hook
sdottaka Oct 19, 2024
9ba2d24
WIP
sdottaka Oct 19, 2024
c2fa14b
Merge branch 'master' into syscolor-hook
sdottaka Oct 20, 2024
05ea7c0
WIP
sdottaka Oct 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ColorSchemes/Default.ini
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,5 @@ Settings/UseDirCompareColors=1
Settings/WordDifferenceColor=11395825
Settings/WordDifferenceDeletedColor=8563455
Settings/WordDifferenceTextColor=0
Settings/SysColorHookEnabled=0
Settings/SysColorHookColors=
22 changes: 21 additions & 1 deletion ColorSchemes/Midnight.ini
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ Settings/MovedBlockTextColor=0xffffffff
Settings/SNPColor=0x40210a
Settings/SNPDeletedColor=0x251305
Settings/SNPTextColor=0xffffffff
Settings/SelectedDifferenceColor=0x2b2233
Settings/SelectedDifferenceColor=0x2b2255
Settings/SelectedDifferenceDeletedColor=0x1b1223
Settings/SelectedDifferenceTextColor=0xffffffff
Settings/SelectedMovedBlockColor=0x423607
Expand All @@ -157,3 +157,23 @@ Settings/UseDirCompareColors=1
Settings/WordDifferenceColor=0x25653d
Settings/WordDifferenceDeletedColor=0xde000d
Settings/WordDifferenceTextColor=0xffffffff
Settings/SysColorHookEnabled=1
; System Colors
;2 0x005555 COLOR_ACTIVECAPTION
;3 0x003322 COLOR_INACTIVECAPTION
;5 0x111111 COLOR_WINDOW
;8 0xe0e2e0 COLOR_WINDOWTEXT
;9 0xe0e0e3 COLOR_CAPTIONTEXT
;12 0x1e1e1e COLOR_APPWORKSPACE
;13 0x007acc COLOR_HIGHLIGHT
;14 0xf1f1f1 COLOR_HIGHLIGHTTEXT
;15 0x222222 COLOR_3DFACE
;16 0x161616 COLOR_3DSHADOW
;17 0x555555 COLOR_GRAYTEXT
;18 0xe4e0e0 COLOR_BTNTEXT
;19 0xe0e5e0 COLOR_INACTIVECAPTIONTEXT
;20 0x333333 COLOR_3DHIGHLIGHT
;21 0x1e1e1e COLOR_3DDKSHADOW
;27 0x2a2a2a COLOR_GRADIENTACTIVECAPTION
;28 0x333333 COLOR_GRADIENTINACTIVECAPTION
Settings/SysColorHookColors=2:0x00005555,3:0x00003322,5:0x001e1e1e,8:0x00e2e0e0,9:0x00e3e0e0,12:0x001e1e1e,13:0x00007acc,14:0x00f1f1f1,15:0x00222222,16:0x00161616,17:0x00555555,18:0x00e4e0e0,19:0x00e5e0e0,20:0x00333333,21:0x001e1e1e,27:0x002a2a2a,28:0x00333333
2 changes: 2 additions & 0 deletions ColorSchemes/Modern.ini
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,5 @@ Settings/UseDirCompareColors=1
Settings/WordDifferenceColor=11206570
Settings/WordDifferenceDeletedColor=10544800
Settings/WordDifferenceTextColor=-1
Settings/SysColorHookEnabled=0
Settings/SysColorHookColors=
22 changes: 21 additions & 1 deletion ColorSchemes/Solarized Dark.ini
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ Settings/MovedBlockTextColor=0xffffffff
Settings/SNPColor=0x40210a
Settings/SNPDeletedColor=0x251305
Settings/SNPTextColor=0xffffffff
Settings/SelectedDifferenceColor=0x2b2233
Settings/SelectedDifferenceColor=0x2b2255
Settings/SelectedDifferenceDeletedColor=0x1b1223
Settings/SelectedDifferenceTextColor=0xffffffff
Settings/SelectedMovedBlockColor=0x423607
Expand All @@ -157,3 +157,23 @@ Settings/UseDirCompareColors=1
Settings/WordDifferenceColor=0x25653d
Settings/WordDifferenceDeletedColor=0x416036
Settings/WordDifferenceTextColor=0xffffffff
Settings/SysColorHookEnabled=1
; System Colors
;2 0x005555 COLOR_ACTIVECAPTION
;3 0x003322 COLOR_INACTIVECAPTION
;5 0x111111 COLOR_WINDOW
;8 0xe0e2e0 COLOR_WINDOWTEXT
;9 0xe0e0e3 COLOR_CAPTIONTEXT
;12 0x1e1e1e COLOR_APPWORKSPACE
;13 0x007acc COLOR_HIGHLIGHT
;14 0xf1f1f1 COLOR_HIGHLIGHTTEXT
;15 0x222222 COLOR_3DFACE
;16 0x161616 COLOR_3DSHADOW
;17 0x555555 COLOR_GRAYTEXT
;18 0xe4e0e0 COLOR_BTNTEXT
;19 0xe0e5e0 COLOR_INACTIVECAPTIONTEXT
;20 0x333333 COLOR_3DHIGHLIGHT
;21 0x1e1e1e COLOR_3DDKSHADOW
;27 0x2a2a2a COLOR_GRADIENTACTIVECAPTION
;28 0x333333 COLOR_GRADIENTINACTIVECAPTION
Settings/SysColorHookColors=2:0x00005555,3:0x00003322,5:0x001e1e1e,8:0x00e2e0e0,9:0x00e3e0e0,12:0x001e1e1e,13:0x00007acc,14:0x00f1f1f1,15:0x00222222,16:0x00161616,17:0x00555555,18:0x00e4e0e0,19:0x00e5e0e0,20:0x00333333,21:0x001e1e1e,27:0x002a2a2a,28:0x00333333
2 changes: 2 additions & 0 deletions ColorSchemes/Solarized Light.ini
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,5 @@ Settings/UseDirCompareColors=1
Settings/WordDifferenceColor=0xaaffaa
Settings/WordDifferenceDeletedColor=0xa0e6a0
Settings/WordDifferenceTextColor=0xffffffff
Settings/SysColorHookEnabled=0
Settings/SysColorHookColors=
116 changes: 116 additions & 0 deletions Src/Common/IatHook.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
/* This file is a modified version of IatHook.h from the win32-darkmode project
* (https://github.com/ysc3839/win32-darkmode)
* Original file: https://github.com/ysc3839/win32-darkmode/blob/master/win32-darkmode/IatHook.h
*/
// This file contains code from
// https://github.com/stevemk14ebr/PolyHook_2_0/blob/master/sources/IatHook.cpp
// which is licensed under the MIT License.
// See PolyHook_2_0-LICENSE for more information.

#pragma once

#if (NTDDI_VERSION <= NTDDI_WINXP)

typedef struct _IMAGE_DELAYLOAD_DESCRIPTOR {
union {
DWORD AllAttributes;
struct {
DWORD RvaBased : 1;
DWORD ReservedAttributes : 31;
} DUMMYSTRUCTNAME;
} Attributes;
DWORD DllNameRVA;
DWORD ModuleHandleRVA;
DWORD ImportAddressTableRVA;
DWORD ImportNameTableRVA;
DWORD BoundImportAddressTableRVA;
DWORD UnloadInformationTableRVA;
DWORD TimeDateStamp;
} IMAGE_DELAYLOAD_DESCRIPTOR, *PIMAGE_DELAYLOAD_DESCRIPTOR;

#endif

template <typename T, typename T1, typename T2>
constexpr T RVA2VA(T1 base, T2 rva)
{
return reinterpret_cast<T>(reinterpret_cast<ULONG_PTR>(base) + rva);
}

template <typename T>
constexpr T DataDirectoryFromModuleBase(void *moduleBase, size_t entryID)
{
auto dosHdr = reinterpret_cast<PIMAGE_DOS_HEADER>(moduleBase);
auto ntHdr = RVA2VA<PIMAGE_NT_HEADERS>(moduleBase, dosHdr->e_lfanew);
auto dataDir = ntHdr->OptionalHeader.DataDirectory;
return RVA2VA<T>(moduleBase, dataDir[entryID].VirtualAddress);
}

PIMAGE_THUNK_DATA FindAddressByName(void *moduleBase, PIMAGE_THUNK_DATA impName, PIMAGE_THUNK_DATA impAddr, const char *funcName)
{
for (; impName->u1.Ordinal; ++impName, ++impAddr)
{
if (IMAGE_SNAP_BY_ORDINAL(impName->u1.Ordinal))
continue;

auto import = RVA2VA<PIMAGE_IMPORT_BY_NAME>(moduleBase, impName->u1.AddressOfData);
if (strcmp(reinterpret_cast<char *>(import->Name), funcName) != 0)
continue;
return impAddr;
}
return nullptr;
}

PIMAGE_THUNK_DATA FindAddressByOrdinal(void *moduleBase, PIMAGE_THUNK_DATA impName, PIMAGE_THUNK_DATA impAddr, uint16_t ordinal)
{
for (; impName->u1.Ordinal; ++impName, ++impAddr)
{
if (IMAGE_SNAP_BY_ORDINAL(impName->u1.Ordinal) && IMAGE_ORDINAL(impName->u1.Ordinal) == ordinal)
return impAddr;
}
return nullptr;
}

PIMAGE_THUNK_DATA FindIatThunkInModule(void *moduleBase, const char *dllName, const char *funcName)
{
auto imports = DataDirectoryFromModuleBase<PIMAGE_IMPORT_DESCRIPTOR>(moduleBase, IMAGE_DIRECTORY_ENTRY_IMPORT);
for (; imports->Name; ++imports)
{
if (_stricmp(RVA2VA<LPCSTR>(moduleBase, imports->Name), dllName) != 0)
continue;

auto origThunk = RVA2VA<PIMAGE_THUNK_DATA>(moduleBase, imports->OriginalFirstThunk);
auto thunk = RVA2VA<PIMAGE_THUNK_DATA>(moduleBase, imports->FirstThunk);
return FindAddressByName(moduleBase, origThunk, thunk, funcName);
}
return nullptr;
}

PIMAGE_THUNK_DATA FindDelayLoadThunkInModule(void *moduleBase, const char *dllName, const char *funcName)
{
auto imports = DataDirectoryFromModuleBase<PIMAGE_DELAYLOAD_DESCRIPTOR>(moduleBase, IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT);
for (; imports->DllNameRVA; ++imports)
{
if (_stricmp(RVA2VA<LPCSTR>(moduleBase, imports->DllNameRVA), dllName) != 0)
continue;

auto impName = RVA2VA<PIMAGE_THUNK_DATA>(moduleBase, imports->ImportNameTableRVA);
auto impAddr = RVA2VA<PIMAGE_THUNK_DATA>(moduleBase, imports->ImportAddressTableRVA);
return FindAddressByName(moduleBase, impName, impAddr, funcName);
}
return nullptr;
}

PIMAGE_THUNK_DATA FindDelayLoadThunkInModule(void *moduleBase, const char *dllName, uint16_t ordinal)
{
auto imports = DataDirectoryFromModuleBase<PIMAGE_DELAYLOAD_DESCRIPTOR>(moduleBase, IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT);
for (; imports->DllNameRVA; ++imports)
{
if (_stricmp(RVA2VA<LPCSTR>(moduleBase, imports->DllNameRVA), dllName) != 0)
continue;

auto impName = RVA2VA<PIMAGE_THUNK_DATA>(moduleBase, imports->ImportNameTableRVA);
auto impAddr = RVA2VA<PIMAGE_THUNK_DATA>(moduleBase, imports->ImportAddressTableRVA);
return FindAddressByOrdinal(moduleBase, impName, impAddr, ordinal);
}
return nullptr;
}
7 changes: 6 additions & 1 deletion Src/Common/MessageBoxDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,10 @@ BOOL CMessageBoxDialog::OnInitDialog ( )
CreateCheckboxControl();
CreateButtonControls();

const COLORREF clrWindow = GetSysColor(COLOR_WINDOW);
if ((clrWindow & 0xff) + ((clrWindow >> 8) & 0xff) + (clrWindow > 16) < 0x80 * 3)
::SetWindowTheme(::GetDlgItem(m_hWnd, IDCHECKBOX), _T(""), _T(""));

// Define the layout of the dialog.
DefineLayout();

Expand Down Expand Up @@ -813,8 +817,9 @@ HBRUSH CMessageBoxDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
if (nCtlColor == CTLCOLOR_STATIC)
{
pDC->SetBkMode(OPAQUE);
pDC->SetTextColor(pWnd->m_hWnd == ::GetDlgItem(m_hWnd, IDCHECKBOX) ?
::GetSysColor(COLOR_WINDOWTEXT) : m_clrMainInstructionFont);
pDC->SetBkColor(::GetSysColor(COLOR_WINDOW));
pDC->SetTextColor(m_clrMainInstructionFont);
return static_cast<HBRUSH>(GetSysColorBrush(COLOR_WINDOW));
}
return __super::OnCtlColor(pDC, pWnd, nCtlColor);
Expand Down
5 changes: 5 additions & 0 deletions Src/Common/PreferencesDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ CPreferencesDlg::CPreferencesDlg(COptionsMgr *regOptions, SyntaxColors *colors,
, m_pageSyntaxColors(regOptions, m_pSyntaxColors.get())
, m_pageMarkerColors(regOptions, m_pSyntaxColors.get())
, m_pageDirColors(regOptions)
, m_pageSysColors(regOptions)
, m_pageArchive(regOptions)
, m_pageCodepage(regOptions)
, m_pageEditor(regOptions)
Expand Down Expand Up @@ -119,6 +120,7 @@ BOOL CPreferencesDlg::OnInitDialog()
AddPage(&m_pageTextColors, IDS_OPTIONSPG_COLORS, IDS_OPTIONSPG_TEXTCOLORS);
AddPage(&m_pageMarkerColors, IDS_OPTIONSPG_COLORS, IDS_OPTIONSPG_MARKERCOLORS);
AddPage(&m_pageDirColors, IDS_OPTIONSPG_COLORS, IDS_OPTIONSPG_DIRCOLORS);
AddPage(&m_pageSysColors, IDS_OPTIONSPG_COLORS, IDS_OPTIONSPG_SYSCOLORS);
AddPage(&m_pageArchive, IDS_OPTIONSPG_ARCHIVE);
AddPage(&m_pageProject, IDS_OPTIONSPG_PROJECT);
AddPage(&m_pageSystem, IDS_OPTIONSPG_SYSTEM);
Expand Down Expand Up @@ -289,6 +291,7 @@ void CPreferencesDlg::ReadOptions(bool bUpdate)
m_pageSyntaxColors.ReadOptions();
m_pageMarkerColors.ReadOptions();
m_pageDirColors.ReadOptions();
m_pageSysColors.ReadOptions();
m_pageSystem.ReadOptions();
m_pageCompare.ReadOptions();
m_pageCompareFolder.ReadOptions();
Expand All @@ -315,6 +318,7 @@ void CPreferencesDlg::ReadOptions(bool bUpdate)
SafeUpdatePage(&m_pageSyntaxColors, false);
SafeUpdatePage(&m_pageMarkerColors, false);
SafeUpdatePage(&m_pageDirColors, false);
SafeUpdatePage(&m_pageSysColors, false);
SafeUpdatePage(&m_pageSystem, false);
SafeUpdatePage(&m_pageCompare, false);
SafeUpdatePage(&m_pageCompareFolder, false);
Expand Down Expand Up @@ -356,6 +360,7 @@ void CPreferencesDlg::SaveOptions()
m_pageSyntaxColors.WriteOptions();
m_pageMarkerColors.WriteOptions();
m_pageDirColors.WriteOptions();
m_pageSysColors.WriteOptions();
m_pageCodepage.WriteOptions();
m_pageArchive.WriteOptions();
m_pageProject.WriteOptions();
Expand Down
2 changes: 2 additions & 0 deletions Src/Common/PreferencesDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "PropSyntaxColors.h"
#include "PropMarkerColors.h"
#include "PropDirColors.h"
#include "PropSysColors.h"
#include "PropCodepage.h"
#include "PropArchive.h"
#include "PropProject.h"
Expand Down Expand Up @@ -80,6 +81,7 @@ class CPreferencesDlg : public CTrDialog
PropSyntaxColors m_pageSyntaxColors;
PropMarkerColors m_pageMarkerColors;
PropDirColors m_pageDirColors;
PropSysColors m_pageSysColors;
PropArchive m_pageArchive;
PropProject m_pageProject;
PropBackups m_pageBackups;
Expand Down
Loading
Loading