diff --git a/PowerEditor/installer/nativeLang/english.xml b/PowerEditor/installer/nativeLang/english.xml index 4917e0fef..8169b759d 100644 --- a/PowerEditor/installer/nativeLang/english.xml +++ b/PowerEditor/installer/nativeLang/english.xml @@ -790,7 +790,7 @@ - + diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 8c82c33d6..7cd68f94a 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -56,11 +56,9 @@ enum tb_stat {tb_saved, tb_unsaved, tb_ro}; #define DIR_LEFT true #define DIR_RIGHT false -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 }, -}; +int docTabIconIDs[] = { IDI_SAVED_ICON, IDI_UNSAVED_ICON, IDI_READONLY_ICON, IDI_MONITORING_ICON }; +int docTabIconIDs_alt[] = { IDI_SAVED_ALT_ICON, IDI_UNSAVED_ALT_ICON, IDI_READONLY_ALT_ICON, IDI_MONITORING_ICON }; + ToolBarButtonUnit toolBarIcons[] = { {IDM_FILE_NEW, IDI_NEW_OFF_ICON, IDI_NEW_ON_ICON, IDI_NEW_OFF_ICON, IDR_FILENEW}, @@ -236,13 +234,16 @@ LRESULT Notepad_plus::init(HWND hwnd) int tabBarStatus = nppGUI._tabStatus; _toReduceTabBar = ((tabBarStatus & TAB_REDUCE) != 0); - int iconDpiDynamicalSize = nppParam._dpiManager.scaleY(_toReduceTabBar ? 12 : 18); - - _docTabIconList.create(iconDpiDynamicalSize, _pPublicInterface->getHinst(), - docTabIconIDs[(tabBarStatus & TAB_ALTICONS) ? 1 : 0], sizeof(docTabIconIDs[0]) / sizeof(int)); + int iconDpiDynamicalSize = nppParam._dpiManager.scaleY(_toReduceTabBar ? 13 : 20); + _docTabIconList.create(iconDpiDynamicalSize, _pPublicInterface->getHinst(), docTabIconIDs, sizeof(docTabIconIDs) / sizeof(int)); + _docTabIconListAlt.create(iconDpiDynamicalSize, _pPublicInterface->getHinst(), docTabIconIDs_alt, sizeof(docTabIconIDs_alt) / sizeof(int)); - _mainDocTab.init(_pPublicInterface->getHinst(), hwnd, &_mainEditView, &_docTabIconList); - _subDocTab.init(_pPublicInterface->getHinst(), hwnd, &_subEditView, &_docTabIconList); + vector pIconListVector; + pIconListVector.push_back(&_docTabIconList); + pIconListVector.push_back(&_docTabIconListAlt); + + _mainDocTab.init(_pPublicInterface->getHinst(), hwnd, &_mainEditView, pIconListVector, (tabBarStatus & TAB_ALTICONS) ? 1 : 0); + _subDocTab.init(_pPublicInterface->getHinst(), hwnd, &_subEditView, pIconListVector, (tabBarStatus & TAB_ALTICONS) ? 1 : 0); _mainEditView.display(); diff --git a/PowerEditor/src/Notepad_plus.h b/PowerEditor/src/Notepad_plus.h index da146da07..6619dfee3 100644 --- a/PowerEditor/src/Notepad_plus.h +++ b/PowerEditor/src/Notepad_plus.h @@ -293,6 +293,7 @@ private: ToolBar _toolBar; IconList _docTabIconList; + IconList _docTabIconListAlt; StatusBar _statusBar; bool _toReduceTabBar = false; diff --git a/PowerEditor/src/Notepad_plus.rc b/PowerEditor/src/Notepad_plus.rc index ff32e0601..755bd8859 100644 --- a/PowerEditor/src/Notepad_plus.rc +++ b/PowerEditor/src/Notepad_plus.rc @@ -116,11 +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_SAVED_ALT_ICON ICON "icons/saved_alt.ico" IDI_UNSAVED_ICON ICON "icons/unsaved.ico" -IDI_UNSAVED1_ICON ICON "icons/unsaved1.ico" +IDI_UNSAVED_ALT_ICON ICON "icons/unsaved_alt.ico" IDI_READONLY_ICON ICON "icons/readonly.ico" -IDI_READONLY1_ICON ICON "icons/readonly1.ico" +IDI_READONLY_ALT_ICON ICON "icons/readonly_alt.ico" IDI_MONITORING_ICON ICON "icons/monitoring.ico" IDI_DELETE_ICON ICON "icons/delete.ico" IDI_FIND_RESULT_ICON ICON "icons/findResult.ico" diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp index 46cb3d116..6efa5a1a7 100644 --- a/PowerEditor/src/NppBigSwitch.cpp +++ b/PowerEditor/src/NppBigSwitch.cpp @@ -648,6 +648,13 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa return TRUE; } + case NPPM_INTERNAL_CHANGETABBAEICONS: + { + _mainDocTab.changeIcons(lParam); + _subDocTab.changeIcons(lParam); + return TRUE; + } + case NPPM_INTERNAL_RELOADNATIVELANG: { reloadLang(); diff --git a/PowerEditor/src/ScitillaComponent/DocTabView.h b/PowerEditor/src/ScitillaComponent/DocTabView.h index 673cc0110..b714e2e81 100644 --- a/PowerEditor/src/ScitillaComponent/DocTabView.h +++ b/PowerEditor/src/ScitillaComponent/DocTabView.h @@ -45,15 +45,32 @@ public : TabBarPlus::destroy(); }; - void init(HINSTANCE hInst, HWND parent, ScintillaEditView * pView, IconList *pIconList = NULL) - { + void init(HINSTANCE hInst, HWND parent, ScintillaEditView * pView, std::vector pIconListVector, size_t indexChoice) { TabBarPlus::init(hInst, parent); _pView = pView; - if (pIconList) - TabBar::setImageList(pIconList->getHandle()); + + if (!pIconListVector.empty()) + { + _pIconListVector = pIconListVector; + + if (indexChoice >= pIconListVector.size()) + _iconListIndexChoice = 0; + else + _iconListIndexChoice = indexChoice; + } + + if (_iconListIndexChoice != -1) + TabBar::setImageList(_pIconListVector[_iconListIndexChoice]->getHandle()); return; }; + void changeIcons(size_t choice) { + if (choice >= _pIconListVector.size()) + return; + _iconListIndexChoice = choice; + TabBar::setImageList(_pIconListVector[_iconListIndexChoice]->getHandle()); + }; + void addBuffer(BufferID buffer); void closeBuffer(BufferID buffer); void bufferUpdated(Buffer * buffer, int mask); @@ -87,4 +104,7 @@ public : private : ScintillaEditView *_pView; static bool _hideTabBarStatus; + + std::vector _pIconListVector; + int _iconListIndexChoice = -1; }; diff --git a/PowerEditor/src/WinControls/Preference/preference.rc b/PowerEditor/src/WinControls/Preference/preference.rc index fe3e27975..87ceaf29f 100644 --- a/PowerEditor/src/WinControls/Preference/preference.rc +++ b/PowerEditor/src/WinControls/Preference/preference.rc @@ -62,7 +62,7 @@ BEGIN 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,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 "Alternate icons", 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 diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index fa1976c26..64cb630ba 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -496,6 +496,8 @@ INT_PTR CALLBACK BarsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) { NppGUI& nppGUI = const_cast(nppParam.getNppGUI()); nppGUI._tabStatus ^= TAB_ALTICONS; + bool isChecked = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECK_TAB_ALTICONS, BM_GETCHECK, 0, 0)); + ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_CHANGETABBAEICONS, 0, isChecked ? 1 : 0); return TRUE; } diff --git a/PowerEditor/src/icons/readonly1.ico b/PowerEditor/src/icons/readonly_alt.ico similarity index 100% rename from PowerEditor/src/icons/readonly1.ico rename to PowerEditor/src/icons/readonly_alt.ico diff --git a/PowerEditor/src/icons/saved1.ico b/PowerEditor/src/icons/saved_alt.ico similarity index 100% rename from PowerEditor/src/icons/saved1.ico rename to PowerEditor/src/icons/saved_alt.ico diff --git a/PowerEditor/src/icons/unsaved1.ico b/PowerEditor/src/icons/unsaved_alt.ico similarity index 100% rename from PowerEditor/src/icons/unsaved1.ico rename to PowerEditor/src/icons/unsaved_alt.ico diff --git a/PowerEditor/src/resource.h b/PowerEditor/src/resource.h index f07e31ed0..4ab2e0e4b 100644 --- a/PowerEditor/src/resource.h +++ b/PowerEditor/src/resource.h @@ -121,22 +121,22 @@ #define IDI_REDO_DISABLE_ICON 411 #define IDI_DELETE_ICON 412 -#define IDI_SYNCV_OFF_ICON 413 -#define IDI_SYNCV_ON_ICON 414 -#define IDI_SYNCV_DISABLE_ICON 415 +#define IDI_SYNCV_OFF_ICON 413 +#define IDI_SYNCV_ON_ICON 414 +#define IDI_SYNCV_DISABLE_ICON 415 -#define IDI_SYNCH_OFF_ICON 416 -#define IDI_SYNCH_ON_ICON 417 -#define IDI_SYNCH_DISABLE_ICON 418 +#define IDI_SYNCH_OFF_ICON 416 +#define IDI_SYNCH_ON_ICON 417 +#define IDI_SYNCH_DISABLE_ICON 418 -#define IDI_SAVED_ICON 501 -#define IDI_UNSAVED_ICON 502 -#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_SAVED_ICON 501 +#define IDI_UNSAVED_ICON 502 +#define IDI_READONLY_ICON 503 +#define IDI_FIND_RESULT_ICON 504 +#define IDI_MONITORING_ICON 505 +#define IDI_SAVED_ALT_ICON 506 +#define IDI_UNSAVED_ALT_ICON 507 +#define IDI_READONLY_ALT_ICON 508 #define IDI_PROJECT_WORKSPACE 601 #define IDI_PROJECT_WORKSPACEDIRTY 602 @@ -422,7 +422,7 @@ #define NPPM_INTERNAL_RELOADNATIVELANG (NOTEPADPLUS_USER_INTERNAL + 25) #define NPPM_INTERNAL_PLUGINSHORTCUTMOTIFIED (NOTEPADPLUS_USER_INTERNAL + 26) #define NPPM_INTERNAL_SCINTILLAFINFERCLEARALL (NOTEPADPLUS_USER_INTERNAL + 27) - //#define NPPM_INTERNAL_ (NOTEPADPLUS_USER_INTERNAL + 28) + #define NPPM_INTERNAL_CHANGETABBAEICONS (NOTEPADPLUS_USER_INTERNAL + 28) #define NPPM_INTERNAL_SETTING_TAB_REPLCESPACE (NOTEPADPLUS_USER_INTERNAL + 29) #define NPPM_INTERNAL_SETTING_TAB_SIZE (NOTEPADPLUS_USER_INTERNAL + 30) #define NPPM_INTERNAL_RELOADSTYLERS (NOTEPADPLUS_USER_INTERNAL + 31)