diff --git a/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h b/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h index eea13512..e9602afd 100644 --- a/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h +++ b/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h @@ -114,7 +114,7 @@ enum winVer{WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV //void NPPM_LOADSESSION(0, const char* file name) #define NPPM_DMMVIEWOTHERTAB (NPPMSG + 35) - //void WM_DMM_VIEWOTHERTAB(0, tTbData->hClient) + //void WM_DMM_VIEWOTHERTAB(0, tTbData->pszName) #define NPPM_RELOADFILE (NPPMSG + 36) //BOOL NPPM_RELOADFILE(BOOL withAlert, char *filePathName2Reload) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 29100c11..c604edc0 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -5912,7 +5912,8 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa TabBarPlus::setDrawTabCloseButton((tabBarStatus & TAB_CLOSEBUTTON) != 0); TabBarPlus::setDbClk2Close((tabBarStatus & TAB_DBCLK2CLOSE) != 0); TabBarPlus::setVertical((tabBarStatus & TAB_VERTICAL) != 0); - //TabBarPlus::setMultiLine((tabBarStatus & TAB_MULTILINE) != 0); + drawTabbarColoursFromStylerArray(); + //--Splitter Section--// bool isVertical = (nppGUI._splitterPos == POS_VERTICAL); @@ -7259,6 +7260,8 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa _subEditView.defineDocType(_subEditView.getCurrentDocType()); _mainEditView.performGlobalStyles(); _subEditView.performGlobalStyles(); + + drawTabbarColoursFromStylerArray(); return TRUE; } @@ -8128,3 +8131,24 @@ bool Notepad_plus::dumpFiles(ScintillaEditView * viewToRecover, const char * out return somethingsaved || !somedirty; } + +void Notepad_plus::drawTabbarColoursFromStylerArray() +{ + Style *stActText = getStyleFromName(TABBAR_ACTIVETEXT); + if (stActText && stActText->_fgColor != -1) + TabBarPlus::setColour(stActText->_fgColor, TabBarPlus::activeText); + + Style *stActfocusTop = getStyleFromName(TABBAR_ACTIVEFOCUSEDINDCATOR); + if (stActfocusTop && stActfocusTop->_fgColor != -1) + TabBarPlus::setColour(stActfocusTop->_fgColor, TabBarPlus::activeFocusedTop); + + Style *stActunfocusTop = getStyleFromName(TABBAR_ACTIVEUNFOCUSEDINDCATOR); + if (stActunfocusTop && stActunfocusTop->_fgColor != -1) + TabBarPlus::setColour(stActunfocusTop->_fgColor, TabBarPlus::activeUnfocusedTop); + + Style *stInact = getStyleFromName(TABBAR_INACTIVETEXT); + if (stInact && stInact->_fgColor != -1) + TabBarPlus::setColour(stInact->_fgColor, TabBarPlus::inactiveText); + if (stInact && stInact->_bgColor != -1) + TabBarPlus::setColour(stInact->_bgColor, TabBarPlus::inactiveBg); +} \ No newline at end of file diff --git a/PowerEditor/src/Notepad_plus.h b/PowerEditor/src/Notepad_plus.h index 6d49c791..82d6ab02 100644 --- a/PowerEditor/src/Notepad_plus.h +++ b/PowerEditor/src/Notepad_plus.h @@ -697,6 +697,19 @@ private: void markSelectedText(); void markSelectedTextInc(bool enable); + Style * getStyleFromName(const char *styleName) { + StyleArray & stylers = (NppParameters::getInstance())->getMiscStylerArray(); + + int i = stylers.getStylerIndexByName(styleName); + Style * st = NULL; + if (i != -1) + { + Style & style = stylers.getStyler(i); + st = &style; + } + return st; + }; + bool isQualifiedWord(const char *str) { for (size_t i = 0 ; i < strlen(str) ; i++) @@ -753,6 +766,7 @@ private: }; bool dumpFiles(ScintillaEditView * viewToRecover, const char * outdir, const char * fileprefix = ""); //helper func + void drawTabbarColoursFromStylerArray(); }; #endif //NOTEPAD_PLUS_H diff --git a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp index 22687565..cbfb0481 100644 --- a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp +++ b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp @@ -218,7 +218,6 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar _isDirty = false; setVisualFromStyleList(); ::SendMessage(_hParent, WM_UPDATESCINTILLAS, 0, 0); - } //else //::MessageBox(NULL, "no dirty", "", MB_OK); @@ -360,6 +359,13 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar { updateColour(C_FOREGROUND); notifyDataModified(); + int tabColourIndex; + if ((tabColourIndex = whichTabColourIndex()) != -1) + { + //::SendMessage(_hParent, WM_UPDATETABBARCOLOUR, tabColourIndex, _pFgColour->getColour()); + TabBarPlus::setColour(_pFgColour->getColour(), (TabBarPlus::tabColourIndex)tabColourIndex); + return TRUE; + } apply(); return TRUE; } @@ -367,6 +373,14 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar { updateColour(C_BACKGROUND); notifyDataModified(); + int tabColourIndex; + if ((tabColourIndex = whichTabColourIndex()) != -1) + { + tabColourIndex = (int)tabColourIndex == TabBarPlus::inactiveText? TabBarPlus::inactiveBg : tabColourIndex; + TabBarPlus::setColour(_pBgColour->getColour(), (TabBarPlus::tabColourIndex)tabColourIndex); + return TRUE; + } + apply(); return TRUE; } @@ -544,36 +558,21 @@ void WordStyleDlg::setVisualFromStyleList() COLORREF c = c = RGB(0x00, 0x00, 0xFF); char str[256]; - //strcpy(str, _originalWarning); - //if (!showWarning) - { - //if (!_originalWarning[0]) - // Get the original text for the usage afterward - //::GetWindowText(_hStyleInfoStaticText, _originalWarning, sizeof(_originalWarning)); - str[0] = '\0'; - - int i = ::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_GETCURSEL, 0, 0); - if (i == LB_ERR) - return; - ::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_GETTEXT, i, (LPARAM)str); + str[0] = '\0'; + + int i = ::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_GETCURSEL, 0, 0); + if (i == LB_ERR) + return; + ::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_GETTEXT, i, (LPARAM)str); - i = ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETCURSEL, 0, 0); - if (i == LB_ERR) - return; - char styleName[64]; - ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETTEXT, i, (LPARAM)styleName); + i = ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETCURSEL, 0, 0); + if (i == LB_ERR) + return; + char styleName[64]; + ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETTEXT, i, (LPARAM)styleName); - strcat(strcat(str, " : "), styleName); - } - /*else - { - if (!str[0]) - { - ::GetWindowText(_hStyleInfoStaticText, _originalWarning, sizeof(_originalWarning)); - strcpy(str, _originalWarning); - } - }*/ + strcat(strcat(str, " : "), styleName); // PAD for fix a display glitch strcat(str, " "); diff --git a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h index 24854198..0598e5e5 100644 --- a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h +++ b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h @@ -86,6 +86,8 @@ public : display(); }; + + void prepare2Cancel() { _styles2restored = (NppParameters::getInstance())->getLStylerArray(); _gstyles2restored = (NppParameters::getInstance())->getGlobalStylers(); @@ -154,6 +156,28 @@ private : } }; + int whichTabColourIndex() { + int i = ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETCURSEL, 0, 0); + if (i == LB_ERR) + return -1; + char styleName[128]; + ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETTEXT, i, (LPARAM)styleName); + + if (strcmp(styleName, TABBAR_ACTIVEFOCUSEDINDCATOR) == 0) + return (int)TabBarPlus::activeFocusedTop; + + if (strcmp(styleName, TABBAR_ACTIVEUNFOCUSEDINDCATOR) == 0) + return (int)TabBarPlus::activeUnfocusedTop; + + if (strcmp(styleName, TABBAR_ACTIVETEXT) == 0) + return (int)TabBarPlus::activeText; + + if (strcmp(styleName, TABBAR_INACTIVETEXT) == 0) + return (int)TabBarPlus::inactiveText; + + return -1; + }; + void updateColour(bool which); void updateFontStyleStatus(fontStyleType whitchStyle); void updateExtension(); diff --git a/PowerEditor/src/WinControls/TabBar/TabBar.cpp b/PowerEditor/src/WinControls/TabBar/TabBar.cpp index 61d82866..5fbd7e4d 100644 --- a/PowerEditor/src/WinControls/TabBar/TabBar.cpp +++ b/PowerEditor/src/WinControls/TabBar/TabBar.cpp @@ -36,6 +36,12 @@ bool TabBarPlus::_isDbClk2Close = false; bool TabBarPlus::_isCtrlVertical = false; bool TabBarPlus::_isCtrlMultiLine = false; +COLORREF TabBarPlus::_activeTextColour = ::GetSysColor(COLOR_BTNTEXT); +COLORREF TabBarPlus::_activeTopBarFocusedColour = RGB(250, 170, 60); +COLORREF TabBarPlus::_activeTopBarUnfocusedColour = RGB(250, 210, 150); +COLORREF TabBarPlus::_inactiveTextColour = grey; +COLORREF TabBarPlus::_inactiveBgColour = RGB(192, 192, 192); + HWND TabBarPlus::_hwndArray[nbCtrlMax] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; int TabBarPlus::_nbCtrl = 0; @@ -495,9 +501,9 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct) } if (::SendMessage(_hParent, NPPM_INTERNAL_ISFOCUSEDTAB, 0, (LPARAM)_hSelf)) - hBrush = ::CreateSolidBrush(RGB(250, 170, 60)); // #FAAA3C + hBrush = ::CreateSolidBrush(_activeTopBarFocusedColour); // #FAAA3C else - hBrush = ::CreateSolidBrush(RGB(250, 210, 150)); // #FAD296 + hBrush = ::CreateSolidBrush(_activeTopBarUnfocusedColour); // #FAD296 ::FillRect(hDC, &barRect, hBrush); ::DeleteObject((HGDIOBJ)hBrush); @@ -509,7 +515,7 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct) { RECT barRect = rect; - hBrush = ::CreateSolidBrush(RGB(192, 192, 192)); + hBrush = ::CreateSolidBrush(_inactiveBgColour); ::FillRect(hDC, &barRect, hBrush); ::DeleteObject((HGDIOBJ)hBrush); } @@ -636,8 +642,8 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct) // and font's that are rotated 90 degrees if (isSelected) { - COLORREF selectedColor = ::GetSysColor(COLOR_BTNTEXT); - ::SetTextColor(hDC, selectedColor); + //COLORREF selectedColor = RGB(0, 0, 255); + ::SetTextColor(hDC, _activeTextColour); if (_isVertical) { @@ -659,8 +665,7 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct) } else { - COLORREF unselectedColor = grey; - ::SetTextColor(hDC, unselectedColor); + ::SetTextColor(hDC, _inactiveTextColour); if (_isVertical) { rect.top += 2; @@ -712,7 +717,6 @@ void TabBarPlus::exchangeItemData(POINT point) //if (hitinfo.flags != TCHT_NOWHERE) if (nTab != -1) { - _isDraggingInside = true; if (nTab != _nTabDragged) diff --git a/PowerEditor/src/WinControls/TabBar/TabBar.h b/PowerEditor/src/WinControls/TabBar/TabBar.h index 417e9db0..ad70f849 100644 --- a/PowerEditor/src/WinControls/TabBar/TabBar.h +++ b/PowerEditor/src/WinControls/TabBar/TabBar.h @@ -38,6 +38,11 @@ const int nbCtrlMax = 10; #include "menuCmdID.h" #include "resource.h" +#define TABBAR_ACTIVEFOCUSEDINDCATOR "Active tab focused indicator" +#define TABBAR_ACTIVEUNFOCUSEDINDCATOR "Active tab unfocused indicator" +#define TABBAR_ACTIVETEXT "Active tab text" +#define TABBAR_INACTIVETEXT "Inactive tabs" + class TabBar : public Window { public: @@ -176,6 +181,10 @@ public : TabBarPlus() : TabBar(), _isDragging(false), _tabBarDefaultProc(NULL), _currentHoverTabItem(-1),\ _isCloseHover(false), _whichCloseClickDown(-1), _lmbdHit(false) {}; + enum tabColourIndex { + activeText, activeFocusedTop, activeUnfocusedTop, inactiveText, inactiveBg + }; + static void doDragNDrop(bool justDoIt) { _doDragNDrop = justDoIt; }; @@ -269,11 +278,31 @@ public : _isCtrlMultiLine = b; doMultiLine(); }; -/* - static void setNoTabBar(bool b) { - + + static void setColour(COLORREF colour2Set, tabColourIndex i) { + switch (i) + { + case activeText: + _activeTextColour = colour2Set; + break; + case activeFocusedTop: + _activeTopBarFocusedColour = colour2Set; + break; + case activeUnfocusedTop: + _activeTopBarUnfocusedColour = colour2Set; + break; + case inactiveText: + _inactiveTextColour = colour2Set; + break; + case inactiveBg : + _inactiveBgColour = colour2Set; + break; + default : + return; + } + doOwnerDrawTab(); }; -*/ + protected: // it's the boss to decide if we do the drag N drop static bool _doDragNDrop; @@ -309,6 +338,12 @@ protected: static bool _isCtrlVertical; static bool _isCtrlMultiLine; + static COLORREF _activeTextColour; + static COLORREF _activeTopBarFocusedColour; + static COLORREF _activeTopBarUnfocusedColour; + static COLORREF _inactiveTextColour; + static COLORREF _inactiveBgColour; + static int _nbCtrl; static HWND _hwndArray[nbCtrlMax]; diff --git a/PowerEditor/src/resource.h b/PowerEditor/src/resource.h index 180d7d21..562e9e3f 100644 --- a/PowerEditor/src/resource.h +++ b/PowerEditor/src/resource.h @@ -18,9 +18,9 @@ #ifndef RESOURCE_H #define RESOURCE_H -#define NOTEPAD_PLUS_VERSION "Notepad++ v4.9.2" -#define VERSION_VALUE "4.92\0" // should be X.Y : ie. if VERSION_DIGITALVALUE == 4, 7, 1, 0 , then X = 4, Y = 71 -#define VERSION_DIGITALVALUE 4, 9, 2, 0 +#define NOTEPAD_PLUS_VERSION "Notepad++ v5.0" +#define VERSION_VALUE "5.0\0" // should be X.Y : ie. if VERSION_DIGITALVALUE == 4, 7, 1, 0 , then X = 4, Y = 71 +#define VERSION_DIGITALVALUE 5, 0, 0, 0 #ifndef IDC_STATIC #define IDC_STATIC -1 diff --git a/PowerEditor/src/stylers.model.xml b/PowerEditor/src/stylers.model.xml index 90fae55c..3e7f12ac 100644 --- a/PowerEditor/src/stylers.model.xml +++ b/PowerEditor/src/stylers.model.xml @@ -714,5 +714,9 @@ + + + + diff --git a/PowerEditor/visual.net/notepadPlus.vcproj b/PowerEditor/visual.net/notepadPlus.vcproj index ec75f612..42df9148 100644 --- a/PowerEditor/visual.net/notepadPlus.vcproj +++ b/PowerEditor/visual.net/notepadPlus.vcproj @@ -45,6 +45,7 @@ AdditionalIncludeDirectories="..\src\WinControls\AboutDlg;..\..\scintilla\include;..\include;..\src\WinControls;..\src\WinControls\ImageListSet;..\src\WinControls\OpenSaveFileDialog;..\src\WinControls\SplitterContainer;..\src\WinControls\StaticDialog;..\src\WinControls\TabBar;..\src\WinControls\ToolBar;..\src\MISC\Process;..\src\ScitillaComponent;..\src\MISC;..\src\MISC\SysMsg;..\src\WinControls\StatusBar;..\src;..\src\WinControls\StaticDialog\RunDlg;..\src\tinyxml;..\src\WinControls\ColourPicker;..\src\Win32Explr;..\src\MISC\RegExt;..\src\WinControls\TrayIcon;..\src\WinControls\shortcut;..\src\WinControls\Grid;..\src\WinControls\ContextMenu;..\src\MISC\PluginsManager;..\src\WinControls\Preference;..\src\WinControls\WindowsDlg;..\src\WinControls\TaskList;..\src\WinControls\DockingWnd;..\src\WinControls\ToolTip;..\src\MISC\Exception" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" MinimalRebuild="true" + ExceptionHandling="2" BasicRuntimeChecks="0" RuntimeLibrary="1" UsePrecompiledHeader="0" @@ -137,6 +138,7 @@ AdditionalIncludeDirectories="..\src\WinControls\AboutDlg;..\..\scintilla\include;..\include;..\src\WinControls;..\src\WinControls\ImageListSet;..\src\WinControls\OpenSaveFileDialog;..\src\WinControls\SplitterContainer;..\src\WinControls\StaticDialog;..\src\WinControls\TabBar;..\src\WinControls\ToolBar;..\src\MISC\Process;..\src\ScitillaComponent;..\src\MISC;..\src\MISC\SysMsg;..\src\WinControls\StatusBar;..\src;..\src\WinControls\StaticDialog\RunDlg;..\src\tinyxml;..\src\WinControls\ColourPicker;..\src\Win32Explr;..\src\MISC\RegExt;..\src\WinControls\TrayIcon;..\src\WinControls\shortcut;..\src\WinControls\Grid;..\src\WinControls\ContextMenu;..\src\MISC\PluginsManager;..\src\WinControls\Preference;..\src\WinControls\WindowsDlg;..\src\WinControls\TaskList;..\src\WinControls\DockingWnd;..\src\WinControls\ToolTip;..\src\MISC\Exception" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;" StringPooling="true" + ExceptionHandling="2" RuntimeLibrary="0" EnableFunctionLevelLinking="true" UsePrecompiledHeader="0" @@ -596,10 +598,6 @@ RelativePath="..\src\MISC\RegExt\regExtDlgRc.h" > - - @@ -608,6 +606,10 @@ RelativePath="..\src\MISC\RegExt\resource.h" > + +