@@ -3034,7 +3034,7 @@ INT_PTR CALLBACK MultiReplace::run_dlgProc(UINT message, WPARAM wParam, LPARAM l
3034
3034
initializeMarkerStyle ();
3035
3035
initializeCtrlMap ();
3036
3036
initializeFontStyles ();
3037
- updateThemeAndColors ();
3037
+ applyThemePalette ();
3038
3038
loadSettings ();
3039
3039
updateTwoButtonsVisibility ();
3040
3040
initializeListView ();
@@ -8800,6 +8800,7 @@ void MultiReplace::showStatusMessage(const std::wstring& messageText, MessageSta
8800
8800
}
8801
8801
}
8802
8802
8803
+ /*
8803
8804
void MultiReplace::updateThemeAndColors() {
8804
8805
// Check if Notepad++ is currently in dark mode
8805
8806
BOOL isDarkMode = (SendMessage(nppData._nppHandle, NPPM_ISDARKMODEENABLED, 0, 0) != 0);
@@ -8832,15 +8833,55 @@ void MultiReplace::updateThemeAndColors() {
8832
8833
break;
8833
8834
}
8834
8835
8835
- // This ensures column colors are also updated on theme change
8836
- initializeColumnStyles ();
8836
+ // This ensures column colors are also updated on theme change.
8837
+ if (isColumnHighlighted)
8838
+ initializeColumnStyles();
8837
8839
8838
8840
// Force the owner-drawn status control to repaint with the new colors
8839
8841
InvalidateRect(GetDlgItem(_hSelf, IDC_STATUS_MESSAGE), NULL, TRUE);
8840
8842
8841
8843
// draws the (?) Find Tooltip
8842
8844
InvalidateRect(GetDlgItem(_hSelf, IDC_FILTER_HELP), NULL, TRUE);
8843
8845
}
8846
+ */
8847
+
8848
+ void MultiReplace::applyThemePalette ()
8849
+ {
8850
+ // Check if Notepad++ is currently in dark mode
8851
+ BOOL isDarkMode = (SendMessage (nppData._nppHandle , NPPM_ISDARKMODEENABLED, 0 , 0 ) != 0 );
8852
+
8853
+ // Assign colours from the predefined palettes in the header file
8854
+ if (isDarkMode) {
8855
+ COLOR_SUCCESS = DMODE_SUCCESS;
8856
+ COLOR_ERROR = DMODE_ERROR;
8857
+ COLOR_INFO = DMODE_INFO;
8858
+ _filterHelpColor = DMODE_FILTER_HELP;
8859
+ }
8860
+ else {
8861
+ COLOR_SUCCESS = LMODE_SUCCESS;
8862
+ COLOR_ERROR = LMODE_ERROR;
8863
+ COLOR_INFO = LMODE_INFO;
8864
+ _filterHelpColor = LMODE_FILTER_HELP;
8865
+ }
8866
+
8867
+ // Update the active colour based on the last message status
8868
+ switch (_lastMessageStatus) {
8869
+ case MessageStatus::Success: _statusMessageColor = COLOR_SUCCESS; break ;
8870
+ case MessageStatus::Error: _statusMessageColor = COLOR_ERROR; break ;
8871
+ default : _statusMessageColor = COLOR_INFO; break ;
8872
+ }
8873
+
8874
+ // Repaint status control and "(?)" tooltip so they pick up the new palette
8875
+ InvalidateRect (GetDlgItem (_hSelf, IDC_STATUS_MESSAGE), NULL , TRUE );
8876
+ InvalidateRect (GetDlgItem (_hSelf, IDC_FILTER_HELP), NULL , TRUE );
8877
+ }
8878
+
8879
+ void MultiReplace::refreshColumnStylesIfNeeded ()
8880
+ {
8881
+ if (isColumnHighlighted) { // flag is managed by highlight/clear handlers
8882
+ initializeColumnStyles ();
8883
+ }
8884
+ }
8844
8885
8845
8886
std::wstring MultiReplace::getShortenedFilePath (const std::wstring& path, int maxLength, HDC hDC) {
8846
8887
bool hdcProvided = true ;
@@ -10475,7 +10516,10 @@ void MultiReplace::onThemeChanged()
10475
10516
{
10476
10517
// Update all theme-related colors (status messages and columns)
10477
10518
if (instance) {
10478
- instance->updateThemeAndColors ();
10519
+ {
10520
+ instance->applyThemePalette (); // status colours, tooltip repaint
10521
+ instance->refreshColumnStylesIfNeeded (); // guarded lexer reset
10522
+ }
10479
10523
}
10480
10524
}
10481
10525
0 commit comments