Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add contextual menu for file encoding in status bar #5523

Closed
Closed
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -418,23 +418,23 @@ BOOL Notepad_plus::notify(SCNotification *notification)
if (notification->nmhdr.hwndFrom == _statusBar.getHSelf())
{
LPNMMOUSE lpnm = (LPNMMOUSE)notification;
if (lpnm->dwItemSpec == DWORD(STATUSBAR_CUR_POS))
if (lpnm->dwItemSpec == DWORD(STATUSBAR_DOC_TYPE))

This comment has been minimized.

Copy link
@chcg

chcg Apr 14, 2019

Contributor

Is there a reason why STATUSBAR_DOC_TYPE and STATUSBAR_CUR_POS are swapped?

This comment has been minimized.

Copy link
@vlakoff

vlakoff Apr 14, 2019

Author Contributor

There are 2 commits in this PR. The first commit is code reordering for readability, the second commit is the actual change.

This comment has been minimized.

Copy link
@chcg

chcg Apr 14, 2019

Contributor

Thanks for the hint: "Sort conditionals like the display order" explains it all :-)

{
bool isFirstTime = !_goToLineDlg.isCreated();
_goToLineDlg.doDialog(_nativeLangSpeaker.isRTL());
if (isFirstTime)
_nativeLangSpeaker.changeDlgLang(_goToLineDlg.getHSelf(), "GoToLine");
POINT p;
::GetCursorPos(&p);
HMENU hLangMenu = ::GetSubMenu(_mainMenuHandle, MENUINDEX_LANGUAGE);
TrackPopupMenu(hLangMenu, 0, p.x, p.y, 0, _pPublicInterface->getHSelf(), NULL);
}
else if (lpnm->dwItemSpec == DWORD(STATUSBAR_DOC_SIZE))
{
command(IDM_VIEW_SUMMARY);
}
else if (lpnm->dwItemSpec == DWORD(STATUSBAR_DOC_TYPE))
else if (lpnm->dwItemSpec == DWORD(STATUSBAR_CUR_POS))
{
POINT p;
::GetCursorPos(&p);
HMENU hLangMenu = ::GetSubMenu(_mainMenuHandle, MENUINDEX_LANGUAGE);
TrackPopupMenu(hLangMenu, 0, p.x, p.y, 0, _pPublicInterface->getHSelf(), NULL);
bool isFirstTime = !_goToLineDlg.isCreated();
_goToLineDlg.doDialog(_nativeLangSpeaker.isRTL());
if (isFirstTime)
_nativeLangSpeaker.changeDlgLang(_goToLineDlg.getHSelf(), "GoToLine");
}
else if (lpnm->dwItemSpec == DWORD(STATUSBAR_EOF_FORMAT))
{
@@ -449,6 +449,13 @@ BOOL Notepad_plus::notify(SCNotification *notification)
return TRUE;
TrackPopupMenu(hEolFormatMenu, 0, p.x, p.y, 0, _pPublicInterface->getHSelf(), NULL);
}
else if (lpnm->dwItemSpec == DWORD(STATUSBAR_UNICODE_TYPE))
{
POINT p;
::GetCursorPos(&p);
HMENU hEncodingMenu = ::GetSubMenu(_mainMenuHandle, MENUINDEX_FORMAT);
TrackPopupMenu(hEncodingMenu, 0, p.x, p.y, 0, _pPublicInterface->getHSelf(), NULL);
}
}
break;
}
@@ -489,6 +496,13 @@ BOOL Notepad_plus::notify(SCNotification *notification)
return TRUE;
TrackPopupMenu(hEolFormatMenu, 0, p.x, p.y, 0, _pPublicInterface->getHSelf(), NULL);
}
else if (lpnm->dwItemSpec == DWORD(STATUSBAR_UNICODE_TYPE))
{
POINT p;
::GetCursorPos(&p);
HMENU hEncodingMenu = ::GetSubMenu(_mainMenuHandle, MENUINDEX_FORMAT);
TrackPopupMenu(hEncodingMenu, 0, p.x, p.y, 0, _pPublicInterface->getHSelf(), NULL);
}
return TRUE;
}
else if (_pFileSwitcherPanel && notification->nmhdr.hwndFrom == _pFileSwitcherPanel->getHSelf())
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.