[NEW_FEATURE] Tabbar's coulours is configurable (Active tab Text, Inactive tab text, Inactive tab background, Active tab focused indicator and Active tab unfocused indicator).
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@207 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
8fed0b0937
commit
f6dafe8b08
@ -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)
|
||||
|
@ -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);
|
||||
}
|
@ -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
|
||||
|
@ -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, " ");
|
||||
|
@ -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();
|
||||
|
@ -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)
|
||||
|
@ -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];
|
||||
|
||||
|
@ -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
|
||||
|
@ -714,5 +714,9 @@
|
||||
<WidgetStyle name="Smart HighLighting" styleID="29" bgColor="00FF00" />
|
||||
<WidgetStyle name="Find Mark Style" styleID="31" bgColor="FF0000" />
|
||||
<WidgetStyle name="Incremental highlight all" styleID="28" bgColor="0080FF" />
|
||||
<WidgetStyle name="Active tab focused indicator" styleID="0" fgColor="FAAA3C" />
|
||||
<WidgetStyle name="Active tab unfocused indicator" styleID="0" fgColor="FFCAB0" />
|
||||
<WidgetStyle name="Active tab text" styleID="0" fgColor="000000" />
|
||||
<WidgetStyle name="Inactive tabs" styleID="0" fgColor="808080" bgColor="C0C0C0" />
|
||||
</GlobalStyles>
|
||||
</NotepadPlus>
|
||||
|
@ -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"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\WinControls\Preference\resource.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\resource.h"
|
||||
>
|
||||
@ -608,6 +606,10 @@
|
||||
RelativePath="..\src\MISC\RegExt\resource.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\WinControls\Preference\resource.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\WinControls\StaticDialog\RunDlg\RunDlg.h"
|
||||
>
|
||||
|
Loading…
Reference in New Issue
Block a user