diff --git a/PowerEditor/installer/themes/DarkModeDefault.xml b/PowerEditor/installer/themes/DarkModeDefault.xml index 39e0b107a..827133f9f 100644 --- a/PowerEditor/installer/themes/DarkModeDefault.xml +++ b/PowerEditor/installer/themes/DarkModeDefault.xml @@ -1400,5 +1400,6 @@ License: GPL2 + diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 94d20d72e..1cb276f16 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -367,6 +367,9 @@ LRESULT Notepad_plus::init(HWND hwnd) TabBarPlus::setVertical((tabBarStatus & TAB_VERTICAL) != 0); drawTabbarColoursFromStylerArray(); + // Document Map + drawDocumentMapColoursFromStylerArray(); + //--Splitter Section--// bool isVertical = (nppGUI._splitterPos == POS_VERTICAL); @@ -5798,6 +5801,15 @@ void Notepad_plus::drawTabbarColoursFromStylerArray() TabBarPlus::setColour(stInact->_bgColor, TabBarPlus::inactiveBg); } +void Notepad_plus::drawDocumentMapColoursFromStylerArray() +{ + Style* docMap = getStyleFromName(VIEWZONE_DOCUMENTMAP); + if (docMap && docMap->_fgColor != -1) + ViewZoneDlg::setColour(docMap->_fgColor, ViewZoneDlg::ViewZoneColorIndex::focus); + if (docMap && docMap->_bgColor != -1) + ViewZoneDlg::setColour(docMap->_bgColor, ViewZoneDlg::ViewZoneColorIndex::frost); +} + void Notepad_plus::prepareBufferChangedDialog(Buffer * buffer) { // immediately show window if it was minimized before diff --git a/PowerEditor/src/Notepad_plus.h b/PowerEditor/src/Notepad_plus.h index c428719a7..b13c162d2 100644 --- a/PowerEditor/src/Notepad_plus.h +++ b/PowerEditor/src/Notepad_plus.h @@ -592,6 +592,7 @@ private: Style * getStyleFromName(const TCHAR *styleName); bool dumpFiles(const TCHAR * outdir, const TCHAR * fileprefix = TEXT("")); //helper func void drawTabbarColoursFromStylerArray(); + void drawDocumentMapColoursFromStylerArray(); std::vector loadCommandlineParams(const TCHAR * commandLine, const CmdLineParams * pCmdParams) { const CmdLineParamsDTO dto = CmdLineParamsDTO::FromCmdLineParams(*pCmdParams); diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp index 528ff0e69..4ba7d1d93 100644 --- a/PowerEditor/src/NppBigSwitch.cpp +++ b/PowerEditor/src/NppBigSwitch.cpp @@ -1793,6 +1793,8 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa drawTabbarColoursFromStylerArray(); + drawDocumentMapColoursFromStylerArray(); + // Update default fg/bg colors in Parameters for both internal/plugins docking dialog StyleArray & globalStyles = (NppParameters::getInstance()).getGlobalStylers(); int i = globalStyles.getStylerIndexByID(STYLE_DEFAULT); diff --git a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp index 392da9250..8e2bef3f6 100644 --- a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp +++ b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp @@ -18,6 +18,7 @@ #include #include "WordStyleDlg.h" #include "ScintillaEditView.h" +#include "documentMap.h" using namespace std; @@ -476,6 +477,10 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l { TabBarPlus::setColour(_pFgColour->getColour(), (TabBarPlus::tabColourIndex)tabColourIndex); } + else if (isDocumentMapStyle()) + { + ViewZoneDlg::setColour(_pFgColour->getColour(), ViewZoneDlg::ViewZoneColorIndex::focus); + } apply(); return TRUE; } @@ -489,6 +494,10 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l tabColourIndex = (tabColourIndex == TabBarPlus::inactiveText ? TabBarPlus::inactiveBg : tabColourIndex); TabBarPlus::setColour(_pBgColour->getColour(), (TabBarPlus::tabColourIndex)tabColourIndex); } + else if (isDocumentMapStyle()) + { + ViewZoneDlg::setColour(_pBgColour->getColour(), ViewZoneDlg::ViewZoneColorIndex::frost); + } apply(); return TRUE; } @@ -581,6 +590,23 @@ int WordStyleDlg::whichTabColourIndex() return -1; } +bool WordStyleDlg::isDocumentMapStyle() +{ + const auto i = ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETCURSEL, 0, 0); + if (i == LB_ERR) + return false; + + constexpr size_t styleNameLen = 128; + TCHAR styleName[styleNameLen + 1] = { 0 }; + const auto lbTextLen = ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETTEXTLEN, i, 0); + if (lbTextLen > styleNameLen) + return false; + + ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETTEXT, i, reinterpret_cast(styleName)); + + return (lstrcmp(styleName, VIEWZONE_DOCUMENTMAP) == 0); +} + void WordStyleDlg::updateColour(bool which) { Style & style = getCurrentStyler(); diff --git a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h index 4f718c8eb..625c0e236 100644 --- a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h +++ b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h @@ -164,6 +164,7 @@ private : }; int whichTabColourIndex(); + bool isDocumentMapStyle(); void move2CtrlRight(int ctrlID, HWND handle2Move, int handle2MoveWidth, int handle2MoveHeight); void updateColour(bool which); void updateFontStyleStatus(fontStyleType whitchStyle); diff --git a/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp b/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp index 27167c74c..c1633c487 100644 --- a/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp +++ b/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp @@ -345,7 +345,9 @@ INT_PTR CALLBACK DocumentMap::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP _pMapView->showMargin(1, false); _pMapView->showMargin(2, false); _pMapView->showMargin(3, false); - + + NppDarkMode::setBorder(_hwndScintilla); + return TRUE; } @@ -442,14 +444,36 @@ INT_PTR CALLBACK DocumentMap::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP return DockingDlgInterface::run_dlgProc(message, wParam, lParam); } +COLORREF ViewZoneDlg::_focus = RGB(0xFF, 0x80, 0x00); +COLORREF ViewZoneDlg::_frost = RGB(0xFF, 0xFF, 0xFF); + +void ViewZoneDlg::setColour(COLORREF colour2Set, ViewZoneColorIndex i) +{ + switch (i) + { + case ViewZoneColorIndex::focus: + { + _focus = colour2Set; + break; + } + + case ViewZoneColorIndex::frost: + { + _frost = colour2Set; + break; + } + + default: + return; + } +} + void ViewZoneDlg::drawPreviewZone(DRAWITEMSTRUCT *pdis) { RECT rc = pdis->rcItem; - - const COLORREF orange = RGB(0xFF, 0x80, 0x00); - const COLORREF white = RGB(0xFF, 0xFF, 0xFF); - HBRUSH hbrushFg = CreateSolidBrush(orange); - HBRUSH hbrushBg = CreateSolidBrush(white); + + HBRUSH hbrushFg = CreateSolidBrush(ViewZoneDlg::_focus); + HBRUSH hbrushBg = CreateSolidBrush(ViewZoneDlg::_frost); FillRect(pdis->hDC, &rc, hbrushBg); rc.top = _higherY; diff --git a/PowerEditor/src/WinControls/DocumentMap/documentMap.h b/PowerEditor/src/WinControls/DocumentMap/documentMap.h index fc87ffc43..0aa233fbb 100644 --- a/PowerEditor/src/WinControls/DocumentMap/documentMap.h +++ b/PowerEditor/src/WinControls/DocumentMap/documentMap.h @@ -26,6 +26,8 @@ #define DOCUMENTMAP_MOUSECLICKED (WM_USER + 2) #define DOCUMENTMAP_MOUSEWHEEL (WM_USER + 3) +const TCHAR VIEWZONE_DOCUMENTMAP[64] = TEXT("Document map"); + class ScintillaEditView; class Buffer; struct MapPosition; @@ -44,6 +46,11 @@ class ViewZoneDlg : public StaticDialog public : ViewZoneDlg() : StaticDialog(), _viewZoneCanvas(NULL), _canvasDefaultProc(nullptr), _higherY(0), _lowerY(0) {} + enum class ViewZoneColorIndex { + focus, + frost + }; + void doDialog(); virtual void destroy() {}; @@ -63,12 +70,17 @@ public : return (_lowerY - _higherY)/2 + _higherY; }; + static void setColour(COLORREF colour2Set, ViewZoneColorIndex i); + protected : virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); static LRESULT CALLBACK canvasStaticProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK canvas_runProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); + static COLORREF _focus; + static COLORREF _frost; + void drawPreviewZone(DRAWITEMSTRUCT *pdis); private : diff --git a/PowerEditor/src/stylers.model.xml b/PowerEditor/src/stylers.model.xml index aad249fac..ed3d4d7e7 100644 --- a/PowerEditor/src/stylers.model.xml +++ b/PowerEditor/src/stylers.model.xml @@ -1420,5 +1420,6 @@ + diff --git a/scintilla/include/SciLexer.h b/scintilla/include/SciLexer.h index eae6413b3..78c98f645 100644 --- a/scintilla/include/SciLexer.h +++ b/scintilla/include/SciLexer.h @@ -229,7 +229,7 @@ #define SCE_USER_STYLE_IDENTIFIER 24 #define SCE_USER_STYLE_TOTAL_STYLES SCE_USER_STYLE_IDENTIFIER #define SCE_USER_STYLE_MAPPER_TOTAL 17 -#define SCE_STYLE_ARRAY_SIZE 30 // must cover sizes of NppParameters::_lexerStyler and NppParameters::_widgetStyle +#define SCE_STYLE_ARRAY_SIZE 38 // must cover sizes of NppParameters::_lexerStyler #define SCE_USER_MASK_NESTING_NONE 0 #define SCE_USER_MASK_NESTING_DELIMITER1 0x1