Add alternative icon set for tab bar

Close #8068, close #8871
This commit is contained in:
Scott Sumner 2020-09-19 08:37:53 -04:00 committed by Don HO
parent aaa93025f0
commit 79cf60f498
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E
12 changed files with 56 additions and 16 deletions

View File

@ -789,6 +789,8 @@
<Item id="6125" name="Document List Panel"/>
<Item id="6126" name="Show"/>
<Item id="6127" name="Disable extension column"/>
<Item id="6128" name="Alternate icons (need to restart Notepad++)"/>
</Global>
<Scintillas title="Editing">
<Item id="6216" name="Caret Settings"/>

View File

@ -56,7 +56,11 @@ enum tb_stat {tb_saved, tb_unsaved, tb_ro};
#define DIR_LEFT true
#define DIR_RIGHT false
int docTabIconIDs[] = {IDI_SAVED_ICON, IDI_UNSAVED_ICON, IDI_READONLY_ICON, IDI_MONITORING_ICON};
int docTabIconIDs[][4] =
{
{ IDI_SAVED_ICON, IDI_UNSAVED_ICON, IDI_READONLY_ICON, IDI_MONITORING_ICON },
{ IDI_SAVED1_ICON, IDI_UNSAVED1_ICON, IDI_READONLY1_ICON, IDI_MONITORING_ICON },
};
ToolBarButtonUnit toolBarIcons[] = {
{IDM_FILE_NEW, IDI_NEW_OFF_ICON, IDI_NEW_ON_ICON, IDI_NEW_OFF_ICON, IDR_FILENEW},
@ -230,9 +234,12 @@ LRESULT Notepad_plus::init(HWND hwnd)
const ScintillaViewParams & svp1 = nppParam.getSVP();
int tabBarStatus = nppGUI._tabStatus;
_toReduceTabBar = ((tabBarStatus & TAB_REDUCE) != 0);
int iconDpiDynamicalSize = nppParam._dpiManager.scaleY(_toReduceTabBar?13:20);
_docTabIconList.create(iconDpiDynamicalSize, _pPublicInterface->getHinst(), docTabIconIDs, sizeof(docTabIconIDs)/sizeof(int));
int iconDpiDynamicalSize = nppParam._dpiManager.scaleY(_toReduceTabBar ? 12 : 18);
_docTabIconList.create(iconDpiDynamicalSize, _pPublicInterface->getHinst(),
docTabIconIDs[(tabBarStatus & TAB_ALTICONS) ? 1 : 0], sizeof(docTabIconIDs[0]) / sizeof(int));
_mainDocTab.init(_pPublicInterface->getHinst(), hwnd, &_mainEditView, &_docTabIconList);
_subDocTab.init(_pPublicInterface->getHinst(), hwnd, &_subEditView, &_docTabIconList);
@ -753,7 +760,8 @@ bool Notepad_plus::saveGUIParams()
(TabBarPlus::isVertical() ? TAB_VERTICAL:0) | \
(TabBarPlus::isMultiLine() ? TAB_MULTILINE:0) |\
(nppGUI._tabStatus & TAB_HIDE) | \
(nppGUI._tabStatus & TAB_QUITONEMPTY);
(nppGUI._tabStatus & TAB_QUITONEMPTY) | \
(nppGUI._tabStatus & TAB_ALTICONS);
nppGUI._splitterPos = _subSplitter.isVertical()?POS_VERTICAL:POS_HORIZOTAL;
UserDefineDialog *udd = _pEditView->getUserDefineDlg();
bool b = udd->isDocked();

View File

@ -116,8 +116,11 @@ IDI_UNDO_DISABLE_ICON ICON "icons/undo_dis.ico"
IDI_REDO_DISABLE_ICON ICON "icons/redo_dis.ico"
//
IDI_SAVED_ICON ICON "icons/saved.ico"
IDI_SAVED1_ICON ICON "icons/saved1.ico"
IDI_UNSAVED_ICON ICON "icons/unsaved.ico"
IDI_UNSAVED1_ICON ICON "icons/unsaved1.ico"
IDI_READONLY_ICON ICON "icons/readonly.ico"
IDI_READONLY1_ICON ICON "icons/readonly1.ico"
IDI_MONITORING_ICON ICON "icons/monitoring.ico"
IDI_DELETE_ICON ICON "icons/delete.ico"
IDI_FIND_RESULT_ICON ICON "icons/findResult.ico"

View File

@ -4217,10 +4217,20 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
else
isFailed = true;
}
val = element->Attribute(TEXT("iconSetNumber"));
if (val)
{
if (!lstrcmp(val, TEXT("1")))
_nppGUI._tabStatus |= TAB_ALTICONS;
else if (!lstrcmp(val, TEXT("0")))
_nppGUI._tabStatus |= 0;
else
isFailed = true;
}
if (isFailed)
_nppGUI._tabStatus = oldValue;
}
else if (!lstrcmp(nm, TEXT("Auto-detection")))
{
@ -5603,7 +5613,7 @@ void NppParameters::createXmlTreeFromGUIParams()
GUIConfigElement->InsertEndChild(TiXmlText(pStr));
}
// <GUIConfig name="TabBar" dragAndDrop="yes" drawTopBar="yes" drawInactiveTab="yes" reduce="yes" closeButton="yes" doubleClick2Close="no" vertical="no" multiLine="no" hide="no" quitOnEmpty="no" />
// <GUIConfig name="TabBar" dragAndDrop="yes" drawTopBar="yes" drawInactiveTab="yes" reduce="yes" closeButton="yes" doubleClick2Close="no" vertical="no" multiLine="no" hide="no" quitOnEmpty="no" iconSetNumber="0" />
{
TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement();
GUIConfigElement->SetAttribute(TEXT("name"), TEXT("TabBar"));
@ -5637,6 +5647,9 @@ void NppParameters::createXmlTreeFromGUIParams()
pStr = (_nppGUI._tabStatus & TAB_QUITONEMPTY) ? TEXT("yes") : TEXT("no");
GUIConfigElement->SetAttribute(TEXT("quitOnEmpty"), pStr);
pStr = (_nppGUI._tabStatus & TAB_ALTICONS) ? TEXT("1") : TEXT("0");
GUIConfigElement->SetAttribute(TEXT("iconSetNumber"), pStr);
}
// <GUIConfig name="ScintillaViewsSplitter">vertical</GUIConfig>

View File

@ -63,6 +63,7 @@ const int TAB_VERTICAL = 64; //0000 0100 0000
const int TAB_MULTILINE = 128; //0000 1000 0000
const int TAB_HIDE = 256; //0001 0000 0000
const int TAB_QUITONEMPTY = 512; //0010 0000 0000
const int TAB_ALTICONS = 1024; //0100 0000 0000
enum class EolType: std::uint8_t

View File

@ -60,14 +60,15 @@ BEGIN
GROUPBOX "Tab Bar",IDC_TABBAR_GB_STATIC,223,6,176,156,BS_CENTER
CONTROL "Hide",IDC_CHECK_TAB_HIDE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,15,108,10
CONTROL "Multi-line",IDC_CHECK_TAB_MULTILINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,29,134,10
CONTROL "Vertical",IDC_CHECK_TAB_VERTICAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,43,134,10
CONTROL "Reduce",IDC_CHECK_REDUCE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,58,108,10
CONTROL "Lock (no drag and drop)",IDC_CHECK_LOCK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,72,134,10
CONTROL "Darken inactive tabs",IDC_CHECK_DRAWINACTIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,87,134,10
CONTROL "Draw a coloured bar on active tab",IDC_CHECK_ORANGE, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,229,102,137,10
CONTROL "Show close button on each tab",IDC_CHECK_ENABLETABCLOSE, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,229,117,133,10
CONTROL "Vertical",IDC_CHECK_TAB_VERTICAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,41,134,10
CONTROL "Reduce",IDC_CHECK_REDUCE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,54,108,10
CONTROL "Alternate icons (need to restart Notepad++)", IDC_CHECK_TAB_ALTICONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,67,164,10
CONTROL "Lock (no drag and drop)",IDC_CHECK_LOCK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,80,134,10
CONTROL "Darken inactive tabs",IDC_CHECK_DRAWINACTIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,93,134,10
CONTROL "Draw a coloured bar on active tab",IDC_CHECK_ORANGE, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,229,106,137,10
CONTROL "Show close button on each tab",IDC_CHECK_ENABLETABCLOSE, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,229,119,133,10
CONTROL "Double click to close document",IDC_CHECK_DBCLICK2CLOSE, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,229,132,133,10
CONTROL "Exit on close the last tab",IDC_CHECK_TAB_LAST_EXIT, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,229,147,165,10
CONTROL "Exit on close the last tab",IDC_CHECK_TAB_LAST_EXIT, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,229,145,165,10
CONTROL "Show status bar",IDC_CHECK_SHOWSTATUSBAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,57,169,130,10
CONTROL "Hide menu bar (use Alt or F10 key to toggle)",IDC_CHECK_HIDEMENUBAR, "Button", BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,223,169,218,10
END

View File

@ -391,6 +391,7 @@ INT_PTR CALLBACK BarsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
::SendDlgItemMessage(_hSelf, IDC_CHECK_TAB_VERTICAL, BM_SETCHECK, tabBarStatus & TAB_VERTICAL, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_TAB_MULTILINE, BM_SETCHECK, tabBarStatus & TAB_MULTILINE, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_TAB_LAST_EXIT, BM_SETCHECK, tabBarStatus & TAB_QUITONEMPTY, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_TAB_ALTICONS, BM_SETCHECK, tabBarStatus & TAB_ALTICONS, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_TAB_HIDE, BM_SETCHECK, tabBarStatus & TAB_HIDE, 0);
::SendMessage(_hSelf, WM_COMMAND, IDC_CHECK_TAB_HIDE, 0);
@ -470,6 +471,7 @@ INT_PTR CALLBACK BarsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_ENABLETABCLOSE), !toBeHidden);
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_DBCLICK2CLOSE), !toBeHidden);
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_TAB_LAST_EXIT), !toBeHidden);
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_TAB_ALTICONS), !toBeHidden);
::SendMessage(::GetParent(_hParent), NPPM_HIDETABBAR, 0, toBeHidden);
return TRUE;
@ -490,6 +492,12 @@ INT_PTR CALLBACK BarsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
}
return TRUE;
case IDC_CHECK_TAB_ALTICONS:
{
NppGUI& nppGUI = const_cast<NppGUI&>(nppParam.getNppGUI());
nppGUI._tabStatus ^= TAB_ALTICONS;
return TRUE;
}
case IDC_CHECK_REDUCE :
::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_REDUCETABBAR, 0);

View File

@ -62,6 +62,7 @@
#define IDC_DOCSWITCH_GB_STATIC (IDD_PREFERENCE_BAR_BOX + 25)
#define IDC_CHECK_DOCSWITCH (IDD_PREFERENCE_BAR_BOX + 26)
#define IDC_CHECK_DOCSWITCH_NOEXTCOLUMN (IDD_PREFERENCE_BAR_BOX + 27)
#define IDC_CHECK_TAB_ALTICONS (IDD_PREFERENCE_BAR_BOX + 28)
#define IDD_PREFERENCE_MULTIINSTANCE_BOX 6150 //(IDD_PREFERENCE_BOX + 150)
#define IDC_MULTIINST_GB_STATIC (IDD_PREFERENCE_MULTIINSTANCE_BOX + 1)

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -134,6 +134,9 @@
#define IDI_READONLY_ICON 503
#define IDI_FIND_RESULT_ICON 504
#define IDI_MONITORING_ICON 505
#define IDI_SAVED1_ICON 506
#define IDI_UNSAVED1_ICON 507
#define IDI_READONLY1_ICON 508
#define IDI_PROJECT_WORKSPACE 601
#define IDI_PROJECT_WORKSPACEDIRTY 602