Skip to content

Commit

Permalink
TabBG tweaks, cosmetics
Browse files Browse the repository at this point in the history
  • Loading branch information
ozone10 committed Jun 14, 2020
1 parent 69b3eeb commit 7fd40f9
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 10 deletions.
16 changes: 12 additions & 4 deletions Plugin/PluginDefinition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ const wchar_t sectionName[] = L"DarkNpp";

bool enableDark = false;

bool enableTabBkgnd = true;

const int menuItemEnableDark = 0;

constexpr COLORREF darkColor = 0x333333;
Expand Down Expand Up @@ -51,6 +53,8 @@ void LoadSettings()
::PathAppend(iniFilePath, TEXT("\\DarkNpp.ini"));

enableDark = ::GetPrivateProfileInt(sectionName, L"useDark", 1, iniFilePath) != 0;

enableTabBkgnd = ::GetPrivateProfileInt(sectionName, L"enableTabBG", 1, iniFilePath) != 0;
}

void SavePluginParams()
Expand All @@ -71,14 +75,14 @@ void About()
{
::MessageBox(
NULL,
L"This is Dark Theme Notepad++ test.\n"
L"This is Dark Mode Notepad++ test.\n"
L"Plugin is using undocumented WINAPI.\n"
L"@2020 by oZone",
L"About",
MB_OK);
}

inline bool IsAtLeastWin10Build(DWORD buildNumber)
bool IsAtLeastWin10Build(DWORD buildNumber)
{
if (!IsWindows10OrGreater())
{
Expand Down Expand Up @@ -228,7 +232,7 @@ BOOL CALLBACK ScrollBarChildProc(HWND hWnd, LPARAM /*lparam*/)
return TRUE;
}

BOOL CALLBACK TabBKChildProc(HWND hWnd, LPARAM /*lparam*/) // Tab background
BOOL CALLBACK TabBkgndChildProc(HWND hWnd, LPARAM /*lparam*/) // Tab background
{
WCHAR className[64] = { 0 };
if (GetClassName(hWnd, className, _countof(className)) > 0)
Expand All @@ -250,5 +254,9 @@ void SetDarkNpp()
SetTooltips(nppData._nppHandle, enableDark);

EnumChildWindows(nppData._nppHandle, &ScrollBarChildProc, NULL);
EnumChildWindows(nppData._nppHandle, &TabBKChildProc, NULL);

if (enableTabBkgnd)
{
EnumChildWindows(nppData._nppHandle, &TabBkgndChildProc, NULL);
}
}
4 changes: 2 additions & 2 deletions Plugin/PluginDefinition.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ void SavePluginParams();
void DarkCheckTag();
void About();

inline bool IsAtLeastWin10Build(DWORD buildNumber);
bool IsAtLeastWin10Build(DWORD buildNumber);

void SetMode(HMODULE hUxtheme, bool useDark);
void SetTheme(HWND hWnd, bool useDark);
void SetTitleBar(HWND hWnd, bool useDark);
void SetTooltips(HWND hWnd, bool useDark);
BOOL CALLBACK ScrollBarChildProc(HWND hWnd, LPARAM lparam);
BOOL CALLBACK TabBKChildProc(HWND hWnd, LPARAM lparam);
BOOL CALLBACK TabBkgndChildProc(HWND hWnd, LPARAM lparam);

void SetDarkNpp();
2 changes: 1 addition & 1 deletion Plugin/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#define VER_PLUGIN_NAME_STR "DarkNpp"
#define VER_PLUGIN_MAJOR 0
#define VER_PLUGIN_MINOR 3
#define VER_PLUGIN_REVISION 0
#define VER_PLUGIN_REVISION 1
#define VER_PLUGIN_BUILD 0
#define VER_PLUGIN_AUTHOR_STR "oZone"
#define VER_PLUGIN_YEAR 2020
33 changes: 30 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,40 @@
[![Total downloads](https://img.shields.io/github/downloads/ozone10/Npp-DarkNpp/total.svg)](https://github.com/ozone10/Npp-DarkNpp/releases)
[![Licence](https://img.shields.io/github/license/ozone10/Npp-DarkNpp?color=9cf)](https://www.gnu.org/licenses/gpl-3.0.en.html)

[Notepad++](https://github.com/notepad-plus-plus/notepad-plus-plus) plugin that allows to use partially dark theme on Notepad++.
Currently support: main title bar, some tooltips, some scroll bars and context menus.
[Notepad++](https://github.com/notepad-plus-plus/notepad-plus-plus) plugin that allows to use partially dark mode (theme) on Notepad++.
Currently support: main title bar, some tooltips, some scroll bars, main tab background and context menus.

This is for testing purposes only.
This is mainly for testing purposes.

* * *

<p align="center">
<img src="https://i.imgur.com/sJm0Kke.png">
</p>

* * *

## Options

- **useDark** - Option to choose mode.

- Value **0** - use light mode.
- Value **1** - use dark mode, default value.

- **enableTabBG** - This is 'secret' setting, you can change it only via editing config file.
This setting affect main tab background.

- Value **0** - disable tab background.
- Value **1** - enable tab background, default value.

* * *

## Configs

- **Default:** Dark mode

```ini
[DarkNpp]
useDark=1
enableTabBG=1
```

0 comments on commit 7fd40f9

Please sign in to comment.