[ENHANCED] Make advanced scrolling optional so in the case of touchpad scrolling problem this feature can be disabled to make the compatibility.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1165 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
7df06f9925
commit
cee9582604
@ -4216,6 +4216,16 @@ void NppParameters::feedScintillaParam(TiXmlNode *node)
|
||||
_svp._currentLineHilitingShow = false;
|
||||
}
|
||||
|
||||
// Disable Advanced Scrolling
|
||||
nm = element->Attribute(TEXT("disableAdvancedScrolling"));
|
||||
if (nm)
|
||||
{
|
||||
if (!lstrcmp(nm, TEXT("yes")))
|
||||
_svp._disableAdvancedScrolling = true;
|
||||
else if (!lstrcmp(nm, TEXT("no")))
|
||||
_svp._disableAdvancedScrolling = false;
|
||||
}
|
||||
|
||||
// Current wrap symbol visibility State
|
||||
nm = element->Attribute(TEXT("wrapSymbolShow"));
|
||||
if (nm)
|
||||
@ -4409,6 +4419,7 @@ bool NppParameters::writeScintillaParams(const ScintillaViewParams & svp)
|
||||
(scintNode->ToElement())->SetAttribute(TEXT("lineWrapMethod"), pWrapMethodStr);
|
||||
|
||||
(scintNode->ToElement())->SetAttribute(TEXT("currentLineHilitingShow"), svp._currentLineHilitingShow?TEXT("show"):TEXT("hide"));
|
||||
(scintNode->ToElement())->SetAttribute(TEXT("disableAdvancedScrolling"), svp._disableAdvancedScrolling?TEXT("yes"):TEXT("no"));
|
||||
(scintNode->ToElement())->SetAttribute(TEXT("wrapSymbolShow"), svp._wrapSymbolShow?TEXT("show"):TEXT("hide"));
|
||||
(scintNode->ToElement())->SetAttribute(TEXT("Wrap"), svp._doWrap?TEXT("yes"):TEXT("no"));
|
||||
TCHAR *edgeStr = NULL;
|
||||
|
@ -808,7 +808,8 @@ struct ScintillaViewParams
|
||||
ScintillaViewParams() : _lineNumberMarginShow(true), _bookMarkMarginShow(true),_borderWidth(2),\
|
||||
_folderStyle(FOLDER_STYLE_BOX), _foldMarginShow(true), _indentGuideLineShow(true),\
|
||||
_currentLineHilitingShow(true), _wrapSymbolShow(false), _doWrap(false), _edgeNbColumn(80),\
|
||||
_zoom(0), _zoom2(0), _whiteSpaceShow(false), _eolShow(false), _lineWrapMethod(LINEWRAP_ALIGNED){};
|
||||
_zoom(0), _zoom2(0), _whiteSpaceShow(false), _eolShow(false), _lineWrapMethod(LINEWRAP_ALIGNED),\
|
||||
_disableAdvancedScrolling(false){};
|
||||
bool _lineNumberMarginShow;
|
||||
bool _bookMarkMarginShow;
|
||||
//bool _docChangeStateMarginShow;
|
||||
@ -826,6 +827,7 @@ struct ScintillaViewParams
|
||||
bool _whiteSpaceShow;
|
||||
bool _eolShow;
|
||||
int _borderWidth;
|
||||
bool _disableAdvancedScrolling;
|
||||
};
|
||||
|
||||
const int NB_LIST = 20;
|
||||
|
@ -272,6 +272,36 @@ void ScintillaEditView::init(HINSTANCE hInst, HWND hPere)
|
||||
attachDefaultDoc();
|
||||
}
|
||||
|
||||
LRESULT CALLBACK ScintillaEditView::scintillaStatic_Proc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
ScintillaEditView *pScint = (ScintillaEditView *)(::GetWindowLongPtr(hwnd, GWL_USERDATA));
|
||||
|
||||
if (Message == WM_MOUSEWHEEL || Message == WM_MOUSEHWHEEL)
|
||||
{
|
||||
POINT pt;
|
||||
POINTS pts = MAKEPOINTS(lParam);
|
||||
POINTSTOPOINT(pt, pts);
|
||||
HWND hwndOnMouse = WindowFromPoint(pt);
|
||||
|
||||
//Hack for Synaptics TouchPad Driver
|
||||
char synapticsHack[26];
|
||||
GetClassNameA(hwndOnMouse, (LPSTR)&synapticsHack, 26);
|
||||
bool isSynpnatic = std::string(synapticsHack) == "SynTrackCursorWindowClass";
|
||||
bool makeTouchPadCompetible = ((NppParameters::getInstance())->getSVP())._disableAdvancedScrolling;
|
||||
|
||||
if (isSynpnatic || makeTouchPadCompetible)
|
||||
return (pScint->scintillaNew_Proc(hwnd, Message, wParam, lParam));
|
||||
|
||||
ScintillaEditView *pScintillaOnMouse = (ScintillaEditView *)(::GetWindowLongPtr(hwndOnMouse, GWL_USERDATA));
|
||||
if (pScintillaOnMouse != pScint)
|
||||
return ::SendMessage(hwndOnMouse, Message, wParam, lParam);
|
||||
}
|
||||
if (pScint)
|
||||
return (pScint->scintillaNew_Proc(hwnd, Message, wParam, lParam));
|
||||
else
|
||||
return ::DefWindowProc(hwnd, Message, wParam, lParam);
|
||||
|
||||
}
|
||||
LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (Message)
|
||||
@ -598,7 +628,7 @@ void ScintillaEditView::setUserLexer(const TCHAR *userLangName)
|
||||
int setKeywordsCounter = 0;
|
||||
execute(SCI_SETLEXER, SCLEX_USER);
|
||||
|
||||
UserLangContainer * userLangContainer = userLangName?NppParameters::getInstance()->getULCFromName(userLangName):_userDefineDlg._pCurrentUserLang;
|
||||
UserLangContainer * userLangContainer = userLangName?_pParameter->getULCFromName(userLangName):_userDefineDlg._pCurrentUserLang;
|
||||
|
||||
if (!userLangContainer)
|
||||
return;
|
||||
@ -726,7 +756,7 @@ void ScintillaEditView::setUserLexer(const TCHAR *userLangName)
|
||||
void ScintillaEditView::setExternalLexer(LangType typeDoc)
|
||||
{
|
||||
int id = typeDoc - L_EXTERNAL;
|
||||
TCHAR * name = NppParameters::getInstance()->getELCFromIndex(id)._name;
|
||||
TCHAR * name = _pParameter->getELCFromIndex(id)._name;
|
||||
|
||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
||||
const char *pName = wmc->wchar2char(name, CP_ACP);
|
||||
@ -1142,8 +1172,7 @@ void ScintillaEditView::defineDocType(LangType typeDoc)
|
||||
}
|
||||
}
|
||||
|
||||
NppParameters *pNppParam = NppParameters::getInstance();
|
||||
ScintillaViewParams & svp = (ScintillaViewParams &)pNppParam->getSVP();
|
||||
ScintillaViewParams & svp = (ScintillaViewParams &)_pParameter->getSVP();
|
||||
if (svp._folderStyle != FOLDER_STYLE_NONE)
|
||||
showMargin(_SC_MARGE_FOLDER, isNeededFolderMarge(typeDoc));
|
||||
|
||||
@ -1332,7 +1361,7 @@ void ScintillaEditView::defineDocType(LangType typeDoc)
|
||||
|
||||
case L_TEXT :
|
||||
default :
|
||||
if (typeDoc >= L_EXTERNAL && typeDoc < NppParameters::getInstance()->L_END)
|
||||
if (typeDoc >= L_EXTERNAL && typeDoc < _pParameter->L_END)
|
||||
setExternalLexer(typeDoc);
|
||||
else
|
||||
execute(SCI_SETLEXER, (_codepage == CP_CHINESE_TRADITIONAL)?SCLEX_MAKEFILE:SCLEX_NULL);
|
||||
@ -2866,7 +2895,7 @@ void ScintillaEditView::setTabSettings(Lang *lang)
|
||||
}
|
||||
else
|
||||
{
|
||||
const NppGUI & nppgui = (NppParameters::getInstance())->getNppGUI();
|
||||
const NppGUI & nppgui = _pParameter->getNppGUI();
|
||||
execute(SCI_SETTABWIDTH, nppgui._tabSize);
|
||||
execute(SCI_SETUSETABS, !nppgui._tabReplacedBySpace);
|
||||
}
|
||||
|
@ -645,33 +645,7 @@ protected:
|
||||
|
||||
static const int _markersArray[][NB_FOLDER_STATE];
|
||||
|
||||
static LRESULT CALLBACK scintillaStatic_Proc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) {
|
||||
ScintillaEditView *pScint = (ScintillaEditView *)(::GetWindowLongPtr(hwnd, GWL_USERDATA));
|
||||
//
|
||||
if (Message == WM_MOUSEWHEEL || Message == WM_MOUSEHWHEEL)
|
||||
{
|
||||
POINT pt;
|
||||
POINTS pts = MAKEPOINTS(lParam);
|
||||
POINTSTOPOINT(pt, pts);
|
||||
HWND hwndOnMouse = WindowFromPoint(pt);
|
||||
|
||||
//Hack for Synaptics TouchPad Driver
|
||||
char synapticsHack[26];
|
||||
GetClassNameA(hwndOnMouse, (LPSTR)&synapticsHack, 26);
|
||||
if (std::string(synapticsHack) == "SynTrackCursorWindowClass")
|
||||
return (pScint->scintillaNew_Proc(hwnd, Message, wParam, lParam));
|
||||
|
||||
ScintillaEditView *pScintillaOnMouse = (ScintillaEditView *)(::GetWindowLongPtr(hwndOnMouse, GWL_USERDATA));
|
||||
if (pScintillaOnMouse != pScint)
|
||||
return ::SendMessage(hwndOnMouse, Message, wParam, lParam);
|
||||
}
|
||||
if (pScint)
|
||||
return (pScint->scintillaNew_Proc(hwnd, Message, wParam, lParam));
|
||||
else
|
||||
return ::DefWindowProc(hwnd, Message, wParam, lParam);
|
||||
//
|
||||
};
|
||||
|
||||
static LRESULT CALLBACK scintillaStatic_Proc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
|
||||
LRESULT scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
SCINTILLA_FUNC _pScintillaFunc;
|
||||
|
@ -112,6 +112,8 @@ BEGIN
|
||||
GROUPBOX "Border Width",IDC_BORDERWIDTH_STATIC,142,132,148,30,BS_CENTER
|
||||
CONTROL "",IDC_BORDERWIDTH_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,156,145,67,13
|
||||
LTEXT "0",IDC_BORDERWIDTHVAL_STATIC,225,145,12,8
|
||||
CONTROL "Disable advanced scrolling feature\r(if you have touchpad problem)",IDC_CHECK_DISABLEADVANCEDSCROLL,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,298,153,139,18
|
||||
END
|
||||
|
||||
IDD_PREFERENCE_SETTING_BOX DIALOGEX 0, 0, 455, 185
|
||||
|
@ -558,6 +558,7 @@ void MarginsDlg::initScintParam()
|
||||
::SendDlgItemMessage(_hSelf, IDC_CHECK_LINENUMBERMARGE, BM_SETCHECK, svp._lineNumberMarginShow, 0);
|
||||
::SendDlgItemMessage(_hSelf, IDC_CHECK_BOOKMARKMARGE, BM_SETCHECK, svp._bookMarkMarginShow, 0);
|
||||
::SendDlgItemMessage(_hSelf, IDC_CHECK_CURRENTLINEHILITE, BM_SETCHECK, svp._currentLineHilitingShow, 0);
|
||||
::SendDlgItemMessage(_hSelf, IDC_CHECK_DISABLEADVANCEDSCROLL, BM_SETCHECK, svp._disableAdvancedScrolling, 0);
|
||||
|
||||
bool isEnable = !(svp._edgeMode == EDGE_NONE);
|
||||
::SendDlgItemMessage(_hSelf, IDC_CHECK_SHOWVERTICALEDGE, BM_SETCHECK, isEnable, 0);
|
||||
@ -660,7 +661,12 @@ BOOL CALLBACK MarginsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam
|
||||
svp._currentLineHilitingShow = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECK_CURRENTLINEHILITE, BM_GETCHECK, 0, 0));
|
||||
::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_CURLINE_HILITING, iView);
|
||||
return TRUE;
|
||||
|
||||
|
||||
case IDC_CHECK_DISABLEADVANCEDSCROLL:
|
||||
svp._disableAdvancedScrolling = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECK_DISABLEADVANCEDSCROLL, BM_GETCHECK, 0, 0));
|
||||
//::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_CURLINE_HILITING, iView);
|
||||
return TRUE;
|
||||
|
||||
case IDC_CHECK_MULTISELECTION :
|
||||
nppGUI._enableMultiSelection = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECK_MULTISELECTION, BM_GETCHECK, 0, 0));
|
||||
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_SETMULTISELCTION, 0, 0);
|
||||
|
@ -110,6 +110,8 @@
|
||||
#define IDC_BORDERWIDTH_STATIC (IDD_PREFERENCE_MARGEIN_BOX + 31)
|
||||
#define IDC_BORDERWIDTHVAL_STATIC (IDD_PREFERENCE_MARGEIN_BOX + 32)
|
||||
#define IDC_BORDERWIDTH_SLIDER (IDD_PREFERENCE_MARGEIN_BOX + 33)
|
||||
|
||||
#define IDC_CHECK_DISABLEADVANCEDSCROLL (IDD_PREFERENCE_MARGEIN_BOX + 34)
|
||||
|
||||
#define IDD_PREFERENCE_DELIMITERSETTINGS_BOX 6250 //(IDD_PREFERENCE_BOX + 250)
|
||||
#define IDC_DELIMITERSETTINGS_GB_STATIC (IDD_PREFERENCE_DELIMITERSETTINGS_BOX + 1)
|
||||
|
Loading…
Reference in New Issue
Block a user