Make struct VisibleGUIConf conform to coding standard

This commit is contained in:
Don HO 2021-04-07 18:02:30 +02:00
parent 62d07f7f7c
commit 92038c1653
3 changed files with 47 additions and 48 deletions

View File

@ -5191,7 +5191,7 @@ bool Notepad_plus::goToNextIndicator(int indicID2Search, bool isWrap) const
void Notepad_plus::fullScreenToggle() void Notepad_plus::fullScreenToggle()
{ {
if (!_beforeSpecialView.isFullScreen) //toggle fullscreen on if (!_beforeSpecialView._isFullScreen) //toggle fullscreen on
{ {
_beforeSpecialView._winPlace.length = sizeof(_beforeSpecialView._winPlace); _beforeSpecialView._winPlace.length = sizeof(_beforeSpecialView._winPlace);
::GetWindowPlacement(_pPublicInterface->getHSelf(), &_beforeSpecialView._winPlace); ::GetWindowPlacement(_pPublicInterface->getHSelf(), &_beforeSpecialView._winPlace);
@ -5220,15 +5220,15 @@ void Notepad_plus::fullScreenToggle()
//Setup GUI //Setup GUI
int bs = buttonStatus_fullscreen; int bs = buttonStatus_fullscreen;
if (_beforeSpecialView.isPostIt) if (_beforeSpecialView._isPostIt)
{ {
bs |= buttonStatus_postit; bs |= buttonStatus_postit;
} }
else else
{ {
//only change the GUI if not already done by postit //only change the GUI if not already done by postit
_beforeSpecialView.isMenuShown = ::SendMessage(_pPublicInterface->getHSelf(), NPPM_ISMENUHIDDEN, 0, 0) != TRUE; _beforeSpecialView._isMenuShown = ::SendMessage(_pPublicInterface->getHSelf(), NPPM_ISMENUHIDDEN, 0, 0) != TRUE;
if (_beforeSpecialView.isMenuShown) if (_beforeSpecialView._isMenuShown)
::SendMessage(_pPublicInterface->getHSelf(), NPPM_HIDEMENU, 0, TRUE); ::SendMessage(_pPublicInterface->getHSelf(), NPPM_HIDEMENU, 0, TRUE);
//Hide rebar //Hide rebar
@ -5241,13 +5241,13 @@ void Notepad_plus::fullScreenToggle()
::ShowWindow(_pPublicInterface->getHSelf(), SW_HIDE); ::ShowWindow(_pPublicInterface->getHSelf(), SW_HIDE);
//Set popup style for fullscreen window and store the old style //Set popup style for fullscreen window and store the old style
if (!_beforeSpecialView.isPostIt) if (!_beforeSpecialView._isPostIt)
{ {
_beforeSpecialView.preStyle = ::SetWindowLongPtr(_pPublicInterface->getHSelf(), GWL_STYLE, WS_POPUP); _beforeSpecialView._preStyle = ::SetWindowLongPtr(_pPublicInterface->getHSelf(), GWL_STYLE, WS_POPUP);
if (!_beforeSpecialView.preStyle) if (!_beforeSpecialView._preStyle)
{ {
//something went wrong, use default settings //something went wrong, use default settings
_beforeSpecialView.preStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN; _beforeSpecialView._preStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN;
} }
} }
@ -5281,10 +5281,10 @@ void Notepad_plus::fullScreenToggle()
_restoreButton.display(false); _restoreButton.display(false);
//Setup GUI //Setup GUI
if (!_beforeSpecialView.isPostIt) if (!_beforeSpecialView._isPostIt)
{ {
//only change the GUI if postit isnt active //only change the GUI if postit isnt active
if (_beforeSpecialView.isMenuShown) if (_beforeSpecialView._isMenuShown)
::SendMessage(_pPublicInterface->getHSelf(), NPPM_HIDEMENU, 0, FALSE); ::SendMessage(_pPublicInterface->getHSelf(), NPPM_HIDEMENU, 0, FALSE);
//Show rebar //Show rebar
@ -5293,9 +5293,9 @@ void Notepad_plus::fullScreenToggle()
} }
//Set old style if not fullscreen //Set old style if not fullscreen
if (!_beforeSpecialView.isPostIt) if (!_beforeSpecialView._isPostIt)
{ {
::SetWindowLongPtr( _pPublicInterface->getHSelf(), GWL_STYLE, _beforeSpecialView.preStyle); ::SetWindowLongPtr( _pPublicInterface->getHSelf(), GWL_STYLE, _beforeSpecialView._preStyle);
//Redraw the window and refresh windowmanager cache, dont do anything else, sizing is done later on //Redraw the window and refresh windowmanager cache, dont do anything else, sizing is done later on
::SetWindowPos(_pPublicInterface->getHSelf(), HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_DRAWFRAME|SWP_FRAMECHANGED); ::SetWindowPos(_pPublicInterface->getHSelf(), HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_DRAWFRAME|SWP_FRAMECHANGED);
::ShowWindow(_pPublicInterface->getHSelf(), SW_SHOW); ::ShowWindow(_pPublicInterface->getHSelf(), SW_SHOW);
@ -5318,9 +5318,9 @@ void Notepad_plus::fullScreenToggle()
} }
} }
//::SetForegroundWindow(_pPublicInterface->getHSelf()); //::SetForegroundWindow(_pPublicInterface->getHSelf());
_beforeSpecialView.isFullScreen = !_beforeSpecialView.isFullScreen; _beforeSpecialView._isFullScreen = !_beforeSpecialView._isFullScreen;
::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0); ::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0);
if (_beforeSpecialView.isPostIt) if (_beforeSpecialView._isPostIt)
{ {
// show restore button on the right position // show restore button on the right position
RECT rect; RECT rect;
@ -5339,32 +5339,32 @@ void Notepad_plus::fullScreenToggle()
void Notepad_plus::postItToggle() void Notepad_plus::postItToggle()
{ {
NppParameters& nppParam = NppParameters::getInstance(); NppParameters& nppParam = NppParameters::getInstance();
if (!_beforeSpecialView.isPostIt) // PostIt disabled, enable it if (!_beforeSpecialView._isPostIt) // PostIt disabled, enable it
{ {
NppGUI & nppGUI = const_cast<NppGUI &>(nppParam.getNppGUI()); NppGUI & nppGUI = const_cast<NppGUI &>(nppParam.getNppGUI());
// get current status before switch to postIt // get current status before switch to postIt
//check these always //check these always
{ {
_beforeSpecialView.isAlwaysOnTop = ::GetMenuState(_mainMenuHandle, IDM_VIEW_ALWAYSONTOP, MF_BYCOMMAND) == MF_CHECKED; _beforeSpecialView._isAlwaysOnTop = ::GetMenuState(_mainMenuHandle, IDM_VIEW_ALWAYSONTOP, MF_BYCOMMAND) == MF_CHECKED;
_beforeSpecialView.isTabbarShown = ::SendMessage(_pPublicInterface->getHSelf(), NPPM_ISTABBARHIDDEN, 0, 0) != TRUE; _beforeSpecialView._isTabbarShown = ::SendMessage(_pPublicInterface->getHSelf(), NPPM_ISTABBARHIDDEN, 0, 0) != TRUE;
_beforeSpecialView.isStatusbarShown = nppGUI._statusBarShow; _beforeSpecialView._isStatusbarShown = nppGUI._statusBarShow;
if (nppGUI._statusBarShow) if (nppGUI._statusBarShow)
::SendMessage(_pPublicInterface->getHSelf(), NPPM_HIDESTATUSBAR, 0, TRUE); ::SendMessage(_pPublicInterface->getHSelf(), NPPM_HIDESTATUSBAR, 0, TRUE);
if (_beforeSpecialView.isTabbarShown) if (_beforeSpecialView._isTabbarShown)
::SendMessage(_pPublicInterface->getHSelf(), NPPM_HIDETABBAR, 0, TRUE); ::SendMessage(_pPublicInterface->getHSelf(), NPPM_HIDETABBAR, 0, TRUE);
if (!_beforeSpecialView.isAlwaysOnTop) if (!_beforeSpecialView._isAlwaysOnTop)
::SendMessage(_pPublicInterface->getHSelf(), WM_COMMAND, IDM_VIEW_ALWAYSONTOP, 0); ::SendMessage(_pPublicInterface->getHSelf(), WM_COMMAND, IDM_VIEW_ALWAYSONTOP, 0);
} }
//Only check these if not fullscreen //Only check these if not fullscreen
int bs = buttonStatus_postit; int bs = buttonStatus_postit;
if (_beforeSpecialView.isFullScreen) if (_beforeSpecialView._isFullScreen)
{ {
bs |= buttonStatus_fullscreen; bs |= buttonStatus_fullscreen;
} }
else else
{ {
_beforeSpecialView.isMenuShown = ::SendMessage(_pPublicInterface->getHSelf(), NPPM_ISMENUHIDDEN, 0, 0) != TRUE; _beforeSpecialView._isMenuShown = ::SendMessage(_pPublicInterface->getHSelf(), NPPM_ISMENUHIDDEN, 0, 0) != TRUE;
if (_beforeSpecialView.isMenuShown) if (_beforeSpecialView._isMenuShown)
::SendMessage(_pPublicInterface->getHSelf(), NPPM_HIDEMENU, 0, TRUE); ::SendMessage(_pPublicInterface->getHSelf(), NPPM_HIDEMENU, 0, TRUE);
//Hide rebar //Hide rebar
@ -5376,15 +5376,15 @@ void Notepad_plus::postItToggle()
// PostIt! // PostIt!
//Set popup style for fullscreen window and store the old style //Set popup style for fullscreen window and store the old style
if (!_beforeSpecialView.isFullScreen) if (!_beforeSpecialView._isFullScreen)
{ {
//Hide window so windows can properly update it //Hide window so windows can properly update it
::ShowWindow(_pPublicInterface->getHSelf(), SW_HIDE); ::ShowWindow(_pPublicInterface->getHSelf(), SW_HIDE);
_beforeSpecialView.preStyle = ::SetWindowLongPtr( _pPublicInterface->getHSelf(), GWL_STYLE, WS_POPUP ); _beforeSpecialView._preStyle = ::SetWindowLongPtr( _pPublicInterface->getHSelf(), GWL_STYLE, WS_POPUP );
if (!_beforeSpecialView.preStyle) if (!_beforeSpecialView._preStyle)
{ {
//something went wrong, use default settings //something went wrong, use default settings
_beforeSpecialView.preStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN; _beforeSpecialView._preStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN;
} }
//Redraw the window and refresh windowmanager cache, dont do anything else, sizing is done later on //Redraw the window and refresh windowmanager cache, dont do anything else, sizing is done later on
::SetWindowPos(_pPublicInterface->getHSelf(), HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_DRAWFRAME|SWP_FRAMECHANGED); ::SetWindowPos(_pPublicInterface->getHSelf(), HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_DRAWFRAME|SWP_FRAMECHANGED);
@ -5413,10 +5413,10 @@ void Notepad_plus::postItToggle()
_restoreButton.display(false); _restoreButton.display(false);
//Setup GUI //Setup GUI
if (!_beforeSpecialView.isFullScreen) if (!_beforeSpecialView._isFullScreen)
{ {
//only change the these parts of GUI if not already done by fullscreen //only change the these parts of GUI if not already done by fullscreen
if (_beforeSpecialView.isMenuShown) if (_beforeSpecialView._isMenuShown)
::SendMessage(_pPublicInterface->getHSelf(), NPPM_HIDEMENU, 0, FALSE); ::SendMessage(_pPublicInterface->getHSelf(), NPPM_HIDEMENU, 0, FALSE);
//Show rebar //Show rebar
@ -5424,19 +5424,19 @@ void Notepad_plus::postItToggle()
_rebarBottom.display(true); _rebarBottom.display(true);
} }
//Do this GUI config always //Do this GUI config always
if (_beforeSpecialView.isStatusbarShown) if (_beforeSpecialView._isStatusbarShown)
::SendMessage(_pPublicInterface->getHSelf(), NPPM_HIDESTATUSBAR, 0, FALSE); ::SendMessage(_pPublicInterface->getHSelf(), NPPM_HIDESTATUSBAR, 0, FALSE);
if (_beforeSpecialView.isTabbarShown) if (_beforeSpecialView._isTabbarShown)
::SendMessage(_pPublicInterface->getHSelf(), NPPM_HIDETABBAR, 0, FALSE); ::SendMessage(_pPublicInterface->getHSelf(), NPPM_HIDETABBAR, 0, FALSE);
if (!_beforeSpecialView.isAlwaysOnTop) if (!_beforeSpecialView._isAlwaysOnTop)
::SendMessage(_pPublicInterface->getHSelf(), WM_COMMAND, IDM_VIEW_ALWAYSONTOP, 0); ::SendMessage(_pPublicInterface->getHSelf(), WM_COMMAND, IDM_VIEW_ALWAYSONTOP, 0);
//restore window style if not fullscreen //restore window style if not fullscreen
if (!_beforeSpecialView.isFullScreen) if (!_beforeSpecialView._isFullScreen)
{ {
//dwStyle |= (WS_CAPTION | WS_SIZEBOX); //dwStyle |= (WS_CAPTION | WS_SIZEBOX);
::ShowWindow(_pPublicInterface->getHSelf(), SW_HIDE); ::ShowWindow(_pPublicInterface->getHSelf(), SW_HIDE);
::SetWindowLongPtr(_pPublicInterface->getHSelf(), GWL_STYLE, _beforeSpecialView.preStyle); ::SetWindowLongPtr(_pPublicInterface->getHSelf(), GWL_STYLE, _beforeSpecialView._preStyle);
//Redraw the window and refresh windowmanager cache, dont do anything else, sizing is done later on //Redraw the window and refresh windowmanager cache, dont do anything else, sizing is done later on
::SetWindowPos(_pPublicInterface->getHSelf(), HWND_NOTOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_DRAWFRAME|SWP_FRAMECHANGED); ::SetWindowPos(_pPublicInterface->getHSelf(), HWND_NOTOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_DRAWFRAME|SWP_FRAMECHANGED);
@ -5444,7 +5444,7 @@ void Notepad_plus::postItToggle()
} }
} }
_beforeSpecialView.isPostIt = !_beforeSpecialView.isPostIt; _beforeSpecialView._isPostIt = !_beforeSpecialView._isPostIt;
::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0); ::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0);
} }

View File

@ -80,20 +80,19 @@ struct TaskListInfo;
struct VisibleGUIConf final struct VisibleGUIConf final
{ {
bool isPostIt = false; bool _isPostIt = false;
bool isFullScreen = false; bool _isFullScreen = false;
//Used by both views //Used by 2 modes
bool isMenuShown = true; bool _isMenuShown = true;
//bool isToolbarShown; //toolbar forcefully hidden by hiding rebar DWORD_PTR _preStyle = (WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN);
DWORD_PTR preStyle = (WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN);
//used by postit only //used by postit & distractionFree
bool isTabbarShown = true; bool _isTabbarShown = true;
bool isAlwaysOnTop = false; bool _isAlwaysOnTop = false;
bool isStatusbarShown = true; bool _isStatusbarShown = true;
//used by fullscreen only //used by fullscreen & distractionFree
WINDOWPLACEMENT _winPlace; WINDOWPLACEMENT _winPlace;
VisibleGUIConf() VisibleGUIConf()

View File

@ -1831,9 +1831,9 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
return FALSE; return FALSE;
} }
if (_beforeSpecialView.isFullScreen) //closing, return to windowed mode if (_beforeSpecialView._isFullScreen) //closing, return to windowed mode
fullScreenToggle(); fullScreenToggle();
if (_beforeSpecialView.isPostIt) //closing, return to windowed mode if (_beforeSpecialView._isPostIt) //closing, return to windowed mode
postItToggle(); postItToggle();
if (_configStyleDlg.isCreated() && ::IsWindowVisible(_configStyleDlg.getHSelf())) if (_configStyleDlg.isCreated() && ::IsWindowVisible(_configStyleDlg.getHSelf()))