Make alternate icons of Tab bar changing dynamically
This commit is contained in:
parent
79cf60f498
commit
285172e36b
|
@ -790,7 +790,7 @@
|
|||
<Item id="6126" name="Show"/>
|
||||
<Item id="6127" name="Disable extension column"/>
|
||||
|
||||
<Item id="6128" name="Alternate icons (need to restart Notepad++)"/>
|
||||
<Item id="6128" name="Alternate icons"/>
|
||||
</Global>
|
||||
<Scintillas title="Editing">
|
||||
<Item id="6216" name="Caret Settings"/>
|
||||
|
|
|
@ -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<IconList *> 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();
|
||||
|
||||
|
|
|
@ -293,6 +293,7 @@ private:
|
|||
|
||||
ToolBar _toolBar;
|
||||
IconList _docTabIconList;
|
||||
IconList _docTabIconListAlt;
|
||||
|
||||
StatusBar _statusBar;
|
||||
bool _toReduceTabBar = false;
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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<IconList *> 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<IconList *> _pIconListVector;
|
||||
int _iconListIndexChoice = -1;
|
||||
};
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -496,6 +496,8 @@ INT_PTR CALLBACK BarsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
|
|||
{
|
||||
NppGUI& nppGUI = const_cast<NppGUI&>(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;
|
||||
}
|
||||
|
||||
|
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue