Make struct VisibleGUIConf conform to coding standard

pull/9754/head
Don HO 4 years ago
parent 62d07f7f7c
commit 92038c1653

@ -5191,7 +5191,7 @@ bool Notepad_plus::goToNextIndicator(int indicID2Search, bool isWrap) const
void Notepad_plus::fullScreenToggle()
{
if (!_beforeSpecialView.isFullScreen) //toggle fullscreen on
if (!_beforeSpecialView._isFullScreen) //toggle fullscreen on
{
_beforeSpecialView._winPlace.length = sizeof(_beforeSpecialView._winPlace);
::GetWindowPlacement(_pPublicInterface->getHSelf(), &_beforeSpecialView._winPlace);
@ -5220,15 +5220,15 @@ void Notepad_plus::fullScreenToggle()
//Setup GUI
int bs = buttonStatus_fullscreen;
if (_beforeSpecialView.isPostIt)
if (_beforeSpecialView._isPostIt)
{
bs |= buttonStatus_postit;
}
else
{
//only change the GUI if not already done by postit
_beforeSpecialView.isMenuShown = ::SendMessage(_pPublicInterface->getHSelf(), NPPM_ISMENUHIDDEN, 0, 0) != TRUE;
if (_beforeSpecialView.isMenuShown)
_beforeSpecialView._isMenuShown = ::SendMessage(_pPublicInterface->getHSelf(), NPPM_ISMENUHIDDEN, 0, 0) != TRUE;
if (_beforeSpecialView._isMenuShown)
::SendMessage(_pPublicInterface->getHSelf(), NPPM_HIDEMENU, 0, TRUE);
//Hide rebar
@ -5241,13 +5241,13 @@ void Notepad_plus::fullScreenToggle()
::ShowWindow(_pPublicInterface->getHSelf(), SW_HIDE);
//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);
if (!_beforeSpecialView.preStyle)
_beforeSpecialView._preStyle = ::SetWindowLongPtr(_pPublicInterface->getHSelf(), GWL_STYLE, WS_POPUP);
if (!_beforeSpecialView._preStyle)
{
//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);
//Setup GUI
if (!_beforeSpecialView.isPostIt)
if (!_beforeSpecialView._isPostIt)
{
//only change the GUI if postit isnt active
if (_beforeSpecialView.isMenuShown)
if (_beforeSpecialView._isMenuShown)
::SendMessage(_pPublicInterface->getHSelf(), NPPM_HIDEMENU, 0, FALSE);
//Show rebar
@ -5293,9 +5293,9 @@ void Notepad_plus::fullScreenToggle()
}
//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
::SetWindowPos(_pPublicInterface->getHSelf(), HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_DRAWFRAME|SWP_FRAMECHANGED);
::ShowWindow(_pPublicInterface->getHSelf(), SW_SHOW);
@ -5318,9 +5318,9 @@ void Notepad_plus::fullScreenToggle()
}
}
//::SetForegroundWindow(_pPublicInterface->getHSelf());
_beforeSpecialView.isFullScreen = !_beforeSpecialView.isFullScreen;
_beforeSpecialView._isFullScreen = !_beforeSpecialView._isFullScreen;
::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0);
if (_beforeSpecialView.isPostIt)
if (_beforeSpecialView._isPostIt)
{
// show restore button on the right position
RECT rect;
@ -5339,32 +5339,32 @@ void Notepad_plus::fullScreenToggle()
void Notepad_plus::postItToggle()
{
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());
// get current status before switch to postIt
//check these always
{
_beforeSpecialView.isAlwaysOnTop = ::GetMenuState(_mainMenuHandle, IDM_VIEW_ALWAYSONTOP, MF_BYCOMMAND) == MF_CHECKED;
_beforeSpecialView.isTabbarShown = ::SendMessage(_pPublicInterface->getHSelf(), NPPM_ISTABBARHIDDEN, 0, 0) != TRUE;
_beforeSpecialView.isStatusbarShown = nppGUI._statusBarShow;
_beforeSpecialView._isAlwaysOnTop = ::GetMenuState(_mainMenuHandle, IDM_VIEW_ALWAYSONTOP, MF_BYCOMMAND) == MF_CHECKED;
_beforeSpecialView._isTabbarShown = ::SendMessage(_pPublicInterface->getHSelf(), NPPM_ISTABBARHIDDEN, 0, 0) != TRUE;
_beforeSpecialView._isStatusbarShown = nppGUI._statusBarShow;
if (nppGUI._statusBarShow)
::SendMessage(_pPublicInterface->getHSelf(), NPPM_HIDESTATUSBAR, 0, TRUE);
if (_beforeSpecialView.isTabbarShown)
if (_beforeSpecialView._isTabbarShown)
::SendMessage(_pPublicInterface->getHSelf(), NPPM_HIDETABBAR, 0, TRUE);
if (!_beforeSpecialView.isAlwaysOnTop)
if (!_beforeSpecialView._isAlwaysOnTop)
::SendMessage(_pPublicInterface->getHSelf(), WM_COMMAND, IDM_VIEW_ALWAYSONTOP, 0);
}
//Only check these if not fullscreen
int bs = buttonStatus_postit;
if (_beforeSpecialView.isFullScreen)
if (_beforeSpecialView._isFullScreen)
{
bs |= buttonStatus_fullscreen;
}
else
{
_beforeSpecialView.isMenuShown = ::SendMessage(_pPublicInterface->getHSelf(), NPPM_ISMENUHIDDEN, 0, 0) != TRUE;
if (_beforeSpecialView.isMenuShown)
_beforeSpecialView._isMenuShown = ::SendMessage(_pPublicInterface->getHSelf(), NPPM_ISMENUHIDDEN, 0, 0) != TRUE;
if (_beforeSpecialView._isMenuShown)
::SendMessage(_pPublicInterface->getHSelf(), NPPM_HIDEMENU, 0, TRUE);
//Hide rebar
@ -5376,15 +5376,15 @@ void Notepad_plus::postItToggle()
// PostIt!
//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
::ShowWindow(_pPublicInterface->getHSelf(), SW_HIDE);
_beforeSpecialView.preStyle = ::SetWindowLongPtr( _pPublicInterface->getHSelf(), GWL_STYLE, WS_POPUP );
if (!_beforeSpecialView.preStyle)
_beforeSpecialView._preStyle = ::SetWindowLongPtr( _pPublicInterface->getHSelf(), GWL_STYLE, WS_POPUP );
if (!_beforeSpecialView._preStyle)
{
//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
::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);
//Setup GUI
if (!_beforeSpecialView.isFullScreen)
if (!_beforeSpecialView._isFullScreen)
{
//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);
//Show rebar
@ -5424,19 +5424,19 @@ void Notepad_plus::postItToggle()
_rebarBottom.display(true);
}
//Do this GUI config always
if (_beforeSpecialView.isStatusbarShown)
if (_beforeSpecialView._isStatusbarShown)
::SendMessage(_pPublicInterface->getHSelf(), NPPM_HIDESTATUSBAR, 0, FALSE);
if (_beforeSpecialView.isTabbarShown)
if (_beforeSpecialView._isTabbarShown)
::SendMessage(_pPublicInterface->getHSelf(), NPPM_HIDETABBAR, 0, FALSE);
if (!_beforeSpecialView.isAlwaysOnTop)
if (!_beforeSpecialView._isAlwaysOnTop)
::SendMessage(_pPublicInterface->getHSelf(), WM_COMMAND, IDM_VIEW_ALWAYSONTOP, 0);
//restore window style if not fullscreen
if (!_beforeSpecialView.isFullScreen)
if (!_beforeSpecialView._isFullScreen)
{
//dwStyle |= (WS_CAPTION | WS_SIZEBOX);
::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
::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);
}

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

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

Loading…
Cancel
Save