@ -34,6 +34,14 @@ const int BORDERWIDTH_SMALLEST = 0;
const int BORDERWIDTH_LARGEST = 30 ;
const int BORDERWIDTH_INTERVAL = 1 ;
const int PADDING_SMALLEST = 0 ;
const int PADDING_LARGEST = 30 ;
const int PADDING_INTERVAL = 1 ;
const int DISTRACTIONFREE_SMALLEST = 3 ;
const int DISTRACTIONFREE_LARGEST = 9 ;
const int DISTRACTIONFREE_INTERVAL = 1 ;
// This int encoding array is built from "EncodingUnit encodings[]" (see EncodingMapper.cpp)
// And NewDocumentSubDlg will use "int encoding array" to get more info from "EncodingUnit encodings[]"
static int encodings [ ] = {
@ -814,14 +822,32 @@ INT_PTR CALLBACK MarginsBorderEdgeSubDlg::run_dlgProc(UINT message, WPARAM wPara
switch ( message )
{
case WM_INITDIALOG :
{
{
const ScintillaViewParams & svp = nppParam . getSVP ( ) ;
: : SendMessage ( : : GetDlgItem ( _hSelf , IDC_BORDERWIDTH_SLIDER ) , TBM_SETRANGEMIN , TRUE , BORDERWIDTH_SMALLEST ) ;
: : SendMessage ( : : GetDlgItem ( _hSelf , IDC_BORDERWIDTH_SLIDER ) , TBM_SETRANGEMAX , TRUE , BORDERWIDTH_LARGEST ) ;
: : SendMessage ( : : GetDlgItem ( _hSelf , IDC_BORDERWIDTH_SLIDER ) , TBM_SETPAGESIZE , 0 , BORDERWIDTH_INTERVAL ) ;
const ScintillaViewParams & svp = nppParam . getSVP ( ) ;
: : SendMessage ( : : GetDlgItem ( _hSelf , IDC_BORDERWIDTH_SLIDER ) , TBM_SETPOS , TRUE , svp . _borderWidth ) ;
: : SetDlgItemInt ( _hSelf , IDC_BORDERWIDTHVAL_STATIC , svp . _borderWidth , FALSE ) ;
: : SendMessage ( : : GetDlgItem ( _hSelf , IDC_PADDINGLEFT_SLIDER ) , TBM_SETRANGEMIN , TRUE , PADDING_SMALLEST ) ;
: : SendMessage ( : : GetDlgItem ( _hSelf , IDC_PADDINGLEFT_SLIDER ) , TBM_SETRANGEMAX , TRUE , PADDING_LARGEST ) ;
: : SendMessage ( : : GetDlgItem ( _hSelf , IDC_PADDINGLEFT_SLIDER ) , TBM_SETPAGESIZE , 0 , PADDING_INTERVAL ) ;
: : SendMessage ( : : GetDlgItem ( _hSelf , IDC_PADDINGLEFT_SLIDER ) , TBM_SETPOS , TRUE , svp . _paddingLeft ) ;
: : SetDlgItemInt ( _hSelf , IDC_PADDINGLEFTVAL_STATIC , svp . _paddingLeft , FALSE ) ;
: : SendMessage ( : : GetDlgItem ( _hSelf , IDC_PADDINGRIGHT_SLIDER ) , TBM_SETRANGEMIN , TRUE , PADDING_SMALLEST ) ;
: : SendMessage ( : : GetDlgItem ( _hSelf , IDC_PADDINGRIGHT_SLIDER ) , TBM_SETRANGEMAX , TRUE , PADDING_LARGEST ) ;
: : SendMessage ( : : GetDlgItem ( _hSelf , IDC_PADDINGRIGHT_SLIDER ) , TBM_SETPAGESIZE , 0 , PADDING_INTERVAL ) ;
: : SendMessage ( : : GetDlgItem ( _hSelf , IDC_PADDINGRIGHT_SLIDER ) , TBM_SETPOS , TRUE , svp . _paddingRight ) ;
: : SetDlgItemInt ( _hSelf , IDC_PADDINGRIGHTVAL_STATIC , svp . _paddingRight , FALSE ) ;
: : SendMessage ( : : GetDlgItem ( _hSelf , IDC_DISTRACTIONFREE_SLIDER ) , TBM_SETRANGEMIN , TRUE , DISTRACTIONFREE_SMALLEST ) ;
: : SendMessage ( : : GetDlgItem ( _hSelf , IDC_DISTRACTIONFREE_SLIDER ) , TBM_SETRANGEMAX , TRUE , DISTRACTIONFREE_LARGEST ) ;
: : SendMessage ( : : GetDlgItem ( _hSelf , IDC_DISTRACTIONFREE_SLIDER ) , TBM_SETPAGESIZE , 0 , DISTRACTIONFREE_INTERVAL ) ;
: : SendMessage ( : : GetDlgItem ( _hSelf , IDC_DISTRACTIONFREE_SLIDER ) , TBM_SETPOS , TRUE , svp . _distractionFreeDivPart ) ;
: : SetDlgItemInt ( _hSelf , IDC_DISTRACTIONFREEVAL_STATIC , svp . _distractionFreeDivPart , FALSE ) ;
initScintParam ( ) ;
ETDTProc enableDlgTheme = ( ETDTProc ) nppParam . getEnableThemeDlgTexture ( ) ;
@ -832,15 +858,37 @@ INT_PTR CALLBACK MarginsBorderEdgeSubDlg::run_dlgProc(UINT message, WPARAM wPara
case WM_HSCROLL :
{
ScintillaViewParams & svp = ( ScintillaViewParams & ) nppParam . getSVP ( ) ;
HWND hBorderWidthSlider = : : GetDlgItem ( _hSelf , IDC_BORDERWIDTH_SLIDER ) ;
HWND hPaddingLeftSlider = : : GetDlgItem ( _hSelf , IDC_PADDINGLEFT_SLIDER ) ;
HWND hPaddingRightSlider = : : GetDlgItem ( _hSelf , IDC_PADDINGRIGHT_SLIDER ) ;
HWND hDistractionFreeSlider = : : GetDlgItem ( _hSelf , IDC_DISTRACTIONFREE_SLIDER ) ;
if ( reinterpret_cast < HWND > ( lParam ) = = hBorderWidthSlider )
{
auto borderWidth = : : SendMessage ( hBorderWidthSlider , TBM_GETPOS , 0 , 0 ) ;
ScintillaViewParams & svp = ( ScintillaViewParams & ) nppParam . getSVP ( ) ;
svp . _borderWidth = static_cast < int > ( borderWidth ) ;
: : SetDlgItemInt ( _hSelf , IDC_BORDERWIDTHVAL_STATIC , static_cast < UINT > ( borderWidth ) , FALSE ) ;
: : SendMessage ( : : GetParent ( _hParent ) , WM_SIZE , 0 , 0 ) ;
}
else if ( reinterpret_cast < HWND > ( lParam ) = = hPaddingLeftSlider )
{
svp . _paddingLeft = static_cast < unsigned char > ( : : SendMessage ( hPaddingLeftSlider , TBM_GETPOS , 0 , 0 ) ) ;
: : SetDlgItemInt ( _hSelf , IDC_PADDINGLEFTVAL_STATIC , static_cast < UINT > ( svp . _paddingLeft ) , FALSE ) ;
: : SendMessage ( : : GetParent ( _hParent ) , NPPM_INTERNAL_UPDATETEXTZONEPADDING , 0 , 0 ) ;
}
else if ( reinterpret_cast < HWND > ( lParam ) = = hPaddingRightSlider )
{
svp . _paddingRight = static_cast < unsigned char > ( : : SendMessage ( hPaddingRightSlider , TBM_GETPOS , 0 , 0 ) ) ;
: : SetDlgItemInt ( _hSelf , IDC_PADDINGRIGHTVAL_STATIC , static_cast < UINT > ( svp . _paddingRight ) , FALSE ) ;
: : SendMessage ( : : GetParent ( _hParent ) , NPPM_INTERNAL_UPDATETEXTZONEPADDING , 0 , 0 ) ;
}
else if ( reinterpret_cast < HWND > ( lParam ) = = hDistractionFreeSlider )
{
svp . _distractionFreeDivPart = static_cast < unsigned char > ( : : SendMessage ( hDistractionFreeSlider , TBM_GETPOS , 0 , 0 ) ) ;
: : SetDlgItemInt ( _hSelf , IDC_DISTRACTIONFREEVAL_STATIC , static_cast < UINT > ( svp . _distractionFreeDivPart ) , FALSE ) ;
: : SendMessage ( : : GetParent ( _hParent ) , NPPM_INTERNAL_UPDATETEXTZONEPADDING , 0 , 0 ) ;
}
return 0 ; //return zero when handled
}