Enhance Distraction Free mode by hidding another view
This commit is contained in:
parent
55de911be5
commit
90016a8dc0
|
@ -5466,21 +5466,44 @@ void Notepad_plus::distractionFreeToggle()
|
|||
const ScintillaViewParams& svp = NppParameters::getInstance().getSVP();
|
||||
int paddingLeft = 0;
|
||||
int paddingRight = 0;
|
||||
|
||||
|
||||
// Enable or disable Distraction Free Mode
|
||||
if (_beforeSpecialView._isDistractionFree)
|
||||
if (_beforeSpecialView._isDistractionFree) // disable it
|
||||
{
|
||||
// disable it
|
||||
// restore padding
|
||||
paddingLeft = svp._paddingLeft;
|
||||
paddingRight = svp._paddingRight;
|
||||
|
||||
// restore another view if 2 views mode was on
|
||||
if (_beforeSpecialView._was2ViewModeOn)
|
||||
{
|
||||
showView(otherView());
|
||||
_beforeSpecialView._was2ViewModeOn = false;
|
||||
}
|
||||
|
||||
// hide restore button
|
||||
_restoreButton.setButtonStatus(0);
|
||||
_restoreButton.display(false);
|
||||
}
|
||||
else
|
||||
else // enable it
|
||||
{
|
||||
// enable it
|
||||
paddingLeft = paddingRight = svp.getDistractionFreePadding(_pEditView->getWidth());;
|
||||
// set padding
|
||||
paddingLeft = paddingRight = svp.getDistractionFreePadding(_pEditView->getWidth());
|
||||
|
||||
// check if 2 views mode is on
|
||||
ScintillaEditView & nonFocusedView = (otherView() == MAIN_VIEW) ? _mainEditView : _subEditView;
|
||||
if (nonFocusedView.isVisible())
|
||||
{
|
||||
hideView(otherView());
|
||||
_beforeSpecialView._was2ViewModeOn = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_beforeSpecialView._was2ViewModeOn = false;
|
||||
}
|
||||
|
||||
// set state of restore button (it's already shown by fullScreen & postIt toggling)
|
||||
_restoreButton.setButtonStatus(buttonStatus_distractionFree);
|
||||
}
|
||||
|
||||
|
|
|
@ -84,18 +84,21 @@ struct VisibleGUIConf final
|
|||
bool _isFullScreen = false;
|
||||
bool _isDistractionFree = false;
|
||||
|
||||
//Used by 3 modes
|
||||
//Used by postit & fullscreen
|
||||
bool _isMenuShown = true;
|
||||
DWORD_PTR _preStyle = (WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN);
|
||||
|
||||
//used by postit & distractionFree
|
||||
//used by postit
|
||||
bool _isTabbarShown = true;
|
||||
bool _isAlwaysOnTop = false;
|
||||
bool _isStatusbarShown = true;
|
||||
|
||||
//used by fullscreen & distractionFree
|
||||
//used by fullscreen
|
||||
WINDOWPLACEMENT _winPlace;
|
||||
|
||||
//used by distractionFree
|
||||
bool _was2ViewModeOn = false;
|
||||
|
||||
VisibleGUIConf()
|
||||
{
|
||||
memset(&_winPlace, 0x0, sizeof(_winPlace));
|
||||
|
|
Loading…
Reference in New Issue