diff --git a/src/Config/Config.cpp b/src/Config/Config.cpp index d9d9f4c35..6fd6a5aaa 100644 --- a/src/Config/Config.cpp +++ b/src/Config/Config.cpp @@ -1522,7 +1522,11 @@ void LoadSettings() StringCchCopyW(Defaults.ToolbarButtons, COUNTOF(Defaults.ToolbarButtons), (Globals.iCfgVersionRead < CFG_VER_0002) ? TBBUTTON_DEFAULT_IDS_V1 : TBBUTTON_DEFAULT_IDS_V2); IniSectionGetString(IniSecSettings, L"ToolbarButtons", Defaults.ToolbarButtons, Settings.ToolbarButtons, COUNTOF(Settings.ToolbarButtons)); - GET_BOOL_VALUE_FROM_INISECTION(ShowMenubar, false); // DarkMode switch +#ifdef D_NP3_WIN10_DARK_MODE + GET_BOOL_VALUE_FROM_INISECTION(ShowMenubar, !Settings.WinThemeDarkMode); +#else + GET_BOOL_VALUE_FROM_INISECTION(ShowMenubar, true); // DarkMode switch +#endif GET_BOOL_VALUE_FROM_INISECTION(ShowToolbar, true); GET_BOOL_VALUE_FROM_INISECTION(ShowStatusbar, true); @@ -2036,13 +2040,13 @@ static bool _SaveSettings(bool bForceSaveSettings) Style_ToIniSection(Globals.bIniFileFromScratch, true); // Scintilla Styles } - if (Globals.idxLightModeTheme == 0) { + if (Globals.idxLightModeTheme <= 1) { IniSectionDelete(IniSecStyles, L"ThemeFileName", false); } else { IniSectionSetString(IniSecStyles, L"ThemeFileName", Globals.LightThemeName); } - if (Globals.idxDarkModeTheme == 0) { + if (Globals.idxDarkModeTheme <= 1) { IniSectionDelete(IniSecStyles, L"DarkThemeFileName", false); } else { IniSectionSetString(IniSecStyles, L"DarkThemeFileName", Globals.DarkThemeName); diff --git a/src/Notepad3.c b/src/Notepad3.c index 933dad742..694538712 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -1382,9 +1382,6 @@ HWND InitInstance(const HINSTANCE hInstance, LPCWSTR pszCmdLine, int nCmdShow) SetWindowTransparentMode(Globals.hwndMain, true, Settings2.OpacityLevel); } - // hide bright menu strip on DarkMode (if no usr override) - Settings.ShowMenubar = Settings.ShowMenubar || !UseDarkMode(); - SetMenu(Globals.hwndMain, Globals.hMainMenu); SetMenu(Globals.hwndMain, (Settings.ShowMenubar ? Globals.hMainMenu : NULL)); DrawMenuBar(Globals.hwndMain); @@ -5921,8 +5918,14 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) unsigned const iCurTheme = GetModeThemeIndex(); Settings.WinThemeDarkMode = !Settings.WinThemeDarkMode; + + // hide/show bright menu strip on switching + if (Settings.ShowMenubar == Defaults.ShowMenubar) { + Settings.ShowMenubar = !Settings.WinThemeDarkMode; + } + Defaults.ShowMenubar = !Settings.WinThemeDarkMode; // (!) need for saving + SetDarkMode(Settings.WinThemeDarkMode); - Settings.ShowMenubar = !UseDarkMode(); // hide/show bright menu strip on switching Style_DynamicThemesMenuCmd(GetModeThemeIndex() + IDM_THEMES_DEFAULT, iCurTheme); diff --git a/src/Styles.c b/src/Styles.c index ab2510cc7..888897ec6 100644 --- a/src/Styles.c +++ b/src/Styles.c @@ -1139,8 +1139,8 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew) // -------------------------------------------------------------------------- - Style_SetMargin(hwnd, pCurrentStandard->Styles[STY_MARGIN].iStyle, - pCurrentStandard->Styles[STY_MARGIN].szValue); // margin (line number, bookmarks, folding) style + // margin (line number, bookmarks, folding) style + Style_SetMargin(hwnd, pCurrentStandard->Styles[STY_MARGIN].szValue); int iValue; COLORREF dColor; @@ -1432,8 +1432,8 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew) if (s_pLexCurrent == &lexANSI) { // special ANSI-Art style - Style_SetMargin(hwnd, s_pLexCurrent->Styles[STY_MARGIN].iStyle, - s_pLexCurrent->Styles[STY_MARGIN].szValue); // margin (line number, bookmarks, folding) style + // margin (line number, bookmarks, folding) style + Style_SetMargin(hwnd, s_pLexCurrent->Styles[STY_MARGIN].szValue); if (Settings2.UseOldStyleBraceMatching) { Style_SetStyles(hwnd, pCurrentStandard->Styles[STY_BRACE_OK].iStyle, @@ -1813,20 +1813,22 @@ void Style_SetBookmark(HWND hwnd, bool bShowMargin) // // Style_SetMargin() // -void Style_SetMargin(HWND hwnd, int iStyle, LPCWSTR lpszStyle) +void Style_SetMargin(HWND hwnd, LPCWSTR lpszStyle) // iStyle = STYLE_LINENUMBER { - if (iStyle == STYLE_LINENUMBER) { - Style_SetStyles(hwnd, STYLE_LINENUMBER, lpszStyle, false); // line numbers - SciCall_SetMarginSensitiveN(MARGIN_SCI_LINENUM, false); // allow selection drag + COLORREF clrBack = UseDarkMode() ? Settings2.DarkModeBkgColor : GetSysColor(COLOR_3DFACE); + + Style_SetStyles(hwnd, STYLE_LINENUMBER, lpszStyle, false); // line numbers + if (!Style_StrGetColor(lpszStyle, BACKGROUND_LAYER, &clrBack, false)) { + clrBack = UseDarkMode() ? (clrBack + RGB(0x10, 0x10, 0x10)) : GetSysColor(COLOR_3DFACE); } + SciCall_StyleSetBack(STYLE_LINENUMBER, clrBack); + SciCall_SetMarginBackN(MARGIN_SCI_LINENUM, clrBack); + SciCall_SetMarginSensitiveN(MARGIN_SCI_LINENUM, false); // allow selection drag + //~SciCall_SetMarginBackN(MARGIN_SCI_LINENUM, clrBack); COLORREF clrFore = SciCall_StyleGetFore(STYLE_LINENUMBER); Style_StrGetColor(lpszStyle, FOREGROUND_LAYER, &clrFore, true); - COLORREF clrBack = SciCall_StyleGetBack(STYLE_LINENUMBER); - Style_StrGetColor(lpszStyle, BACKGROUND_LAYER, &clrBack, true); - //~SciCall_SetMarginBackN(MARGIN_SCI_LINENUM, clrBack); - // CallTips SciCall_CallTipSetFore(clrFore); SciCall_CallTipSetBack(clrBack); @@ -4093,18 +4095,26 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd, UINT umsg, WPARAM wPar static bool bIsStyleSelected = false; static bool bWarnedNoIniFile = false; static WCHAR* Style_StylesBackup[NUMLEXERS * AVG_NUM_OF_STYLES_PER_LEXER]; + static WCHAR title[128] = { L'\0' }; - static WCHAR tchTmpBuffer[max(BUFSIZE_STYLE_VALUE, BUFZIZE_STYLE_EXTENTIONS)] = {L'\0'}; + static WCHAR tchTmpBuffer[max(BUFSIZE_STYLE_VALUE, BUFZIZE_STYLE_EXTENTIONS)] = {L'\0'}; switch (umsg) { case WM_INITDIALOG: { SetWindowLongPtr(hwnd, DWLP_USER, (LONG_PTR)lParam); - SetDialogIconNP3(hwnd); + SetDialogIconNP3(hwnd); InitWindowCommon(hwnd, true); + WCHAR buf[80] = { L'\0' }; + GetWindowText(hwnd, buf, COUNTOF(buf)); + unsigned const iTheme = GetModeThemeIndex(); + const WCHAR *const strThemeName = (iTheme <= 1) ? L"Standard" : Theme_Files[iTheme].szName; + StringCchPrintf(title, COUNTOF(title), L"%s - %s", buf, strThemeName); + SetWindowText(hwnd, title); + #ifdef D_NP3_WIN10_DARK_MODE if (UseDarkMode()) { SetExplorerTheme(GetDlgItem(hwnd, IDOK)); @@ -4230,6 +4240,7 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd, UINT umsg, WPARAM wPar } hFontTitle = CreateFontIndirectW(&lf); SendDlgItemMessageW(hwnd, IDC_TITLE, WM_SETFONT, (WPARAM)hFontTitle, true); + SendDlgItemMessageW(hwnd, IDC_TITLE, WM_SETTEXT, 0, (LPARAM)title); } } return TRUE; @@ -4261,6 +4272,7 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd, UINT umsg, WPARAM wPar } hFontTitle = CreateFontIndirectW(&lf); SendDlgItemMessageW(hwnd, IDC_TITLE, WM_SETFONT, (WPARAM)hFontTitle, true); + SendDlgItemMessageW(hwnd, IDC_TITLE, WM_SETTEXT, 0, (LPARAM)title); } MakeBitmapButton(hwnd, IDC_PREVSTYLE, IDB_PREV, -1, -1); diff --git a/src/Styles.h b/src/Styles.h index c655a0850..9f09c264b 100644 --- a/src/Styles.h +++ b/src/Styles.h @@ -54,7 +54,7 @@ void Style_SetReadonly(HWND hwnd, bool); void Style_HighlightCurrentLine(HWND hwnd, int); void Style_SetFolding(HWND hwnd, bool bShowMargin); void Style_SetBookmark(HWND hwnd, bool bShowMargin); -void Style_SetMargin(HWND hwnd, int iStyle, LPCWSTR lpszStyle); +void Style_SetMargin(HWND hwnd, LPCWSTR lpszStyle); bool Style_SetLexerFromFile(HWND hwnd,LPCWSTR lpszFile); bool Style_MaybeBinaryFile(HWND hwnd, LPCWSTR lpszFile); void Style_SetLexerFromName(HWND hwnd,LPCWSTR lpszFile,LPCWSTR lpszName);