[NEW_FEATURE] (Author: Andreas Jonsson) Make backslash as an escape character optional in SQL.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1230 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2014-04-30 22:04:43 +00:00
parent 85a6d2c054
commit 73603b2357
6 changed files with 24 additions and 3 deletions

View File

@ -4102,6 +4102,12 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
{ {
_nppGUI._fileSwitcherWithoutExtColumn = true; _nppGUI._fileSwitcherWithoutExtColumn = true;
} }
optName = element->Attribute(TEXT("backSlashIsEscapeCharacterForSql"));
if (optName && !lstrcmp(optName, TEXT("yes")))
{
_nppGUI._backSlashIsEscapeCharacterForSql = true;
}
} }
} }
} }
@ -4841,6 +4847,9 @@ bool NppParameters::writeGUIParams()
const TCHAR * pStr = _nppGUI._fileSwitcherWithoutExtColumn?TEXT("yes"):TEXT("no"); const TCHAR * pStr = _nppGUI._fileSwitcherWithoutExtColumn?TEXT("yes"):TEXT("no");
element->SetAttribute(TEXT("fileSwitcherWithoutExtColumn"), pStr); element->SetAttribute(TEXT("fileSwitcherWithoutExtColumn"), pStr);
pStr = _nppGUI._backSlashIsEscapeCharacterForSql?TEXT("yes"):TEXT("no");
element->SetAttribute(TEXT("backSlashIsEscapeCharacterForSql"), pStr);
} }
else if (!lstrcmp(nm, TEXT("sessionExt"))) else if (!lstrcmp(nm, TEXT("sessionExt")))
{ {
@ -5151,6 +5160,7 @@ bool NppParameters::writeGUIParams()
GUIConfigElement->SetAttribute(TEXT("name"), TEXT("MISC")); GUIConfigElement->SetAttribute(TEXT("name"), TEXT("MISC"));
GUIConfigElement->SetAttribute(TEXT("fileSwitcherWithoutExtColumn"), _nppGUI._fileSwitcherWithoutExtColumn?TEXT("yes"):TEXT("no")); GUIConfigElement->SetAttribute(TEXT("fileSwitcherWithoutExtColumn"), _nppGUI._fileSwitcherWithoutExtColumn?TEXT("yes"):TEXT("no"));
GUIConfigElement->SetAttribute(TEXT("backSlashIsEscapeCharacterForSql"), _nppGUI._backSlashIsEscapeCharacterForSql?TEXT("yes"):TEXT("no"));
} }
insertDockingParamNode(GUIRoot); insertDockingParamNode(GUIRoot);
return true; return true;

View File

@ -714,7 +714,7 @@ struct NppGUI
_autocStatus(autoc_both), _autocFromLen(1), _funcParams(false), _definedSessionExt(TEXT("")),\ _autocStatus(autoc_both), _autocFromLen(1), _funcParams(false), _definedSessionExt(TEXT("")),\
_doesExistUpdater(false), _caretBlinkRate(250), _caretWidth(1), _enableMultiSelection(false), _shortTitlebar(false), _themeName(TEXT("")), _isLangMenuCompact(false),\ _doesExistUpdater(false), _caretBlinkRate(250), _caretWidth(1), _enableMultiSelection(false), _shortTitlebar(false), _themeName(TEXT("")), _isLangMenuCompact(false),\
_smartHiliteCaseSensitive(false), _leftmostDelimiter('('), _rightmostDelimiter(')'), _delimiterSelectionOnEntireDocument(false), _multiInstSetting(monoInst),\ _smartHiliteCaseSensitive(false), _leftmostDelimiter('('), _rightmostDelimiter(')'), _delimiterSelectionOnEntireDocument(false), _multiInstSetting(monoInst),\
_fileSwitcherWithoutExtColumn(false), _isSnapshotMode(true), _snapshotBackupTiming(7000) { _fileSwitcherWithoutExtColumn(false), _isSnapshotMode(true), _snapshotBackupTiming(7000), _backSlashIsEscapeCharacterForSql(true) {
_appPos.left = 0; _appPos.left = 0;
_appPos.top = 0; _appPos.top = 0;
_appPos.right = 700; _appPos.right = 700;
@ -765,6 +765,7 @@ struct NppGUI
bool _styleMRU; bool _styleMRU;
char _leftmostDelimiter, _rightmostDelimiter; char _leftmostDelimiter, _rightmostDelimiter;
bool _delimiterSelectionOnEntireDocument; bool _delimiterSelectionOnEntireDocument;
bool _backSlashIsEscapeCharacterForSql;
// 0 : do nothing // 0 : do nothing

View File

@ -715,6 +715,7 @@ protected:
void setSqlLexer() { void setSqlLexer() {
if(NppParameters::getInstance()->getNppGUI()._backSlashIsEscapeCharacterForSql)
execute(SCI_SETPROPERTY, (WPARAM)"sql.backslash.escapes", (LPARAM)"1"); execute(SCI_SETPROPERTY, (WPARAM)"sql.backslash.escapes", (LPARAM)"1");
setLexer(SCLEX_SQL, L_SQL, LIST_0); setLexer(SCLEX_SQL, L_SQL, LIST_0);
}; };

View File

@ -130,6 +130,7 @@ BEGIN
CONTROL "Auto-indent",IDC_CHECK_MAINTAININDENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,130,150,10 CONTROL "Auto-indent",IDC_CHECK_MAINTAININDENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,130,150,10
CONTROL "Minimize to system tray",IDC_CHECK_MIN2SYSTRAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,145,150,10 CONTROL "Minimize to system tray",IDC_CHECK_MIN2SYSTRAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,145,150,10
CONTROL "Show only filename in title bar",IDC_CHECK_SHORTTITLE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,37,160,217,10 CONTROL "Show only filename in title bar",IDC_CHECK_SHORTTITLE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,37,160,217,10
CONTROL "Backslash is escape character for SQL",IDC_CHECK_BACKSLASHISESCAPECHARACTERFORSQL, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,175,217,10
CONTROL "Enable",IDC_CHECK_CLICKABLELINK_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,15,140,10 CONTROL "Enable",IDC_CHECK_CLICKABLELINK_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,15,140,10
CONTROL "No underline",IDC_CHECK_CLICKABLELINK_NOUNDERLINE, CONTROL "No underline",IDC_CHECK_CLICKABLELINK_NOUNDERLINE,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,28,140,10 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,28,140,10

View File

@ -830,6 +830,7 @@ BOOL CALLBACK SettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
::SendDlgItemMessage(_hSelf, IDC_CHECK_MIN2SYSTRAY, BM_SETCHECK, nppGUI._isMinimizedToTray, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_MIN2SYSTRAY, BM_SETCHECK, nppGUI._isMinimizedToTray, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_DETECTENCODING, BM_SETCHECK, nppGUI._detectEncoding, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_DETECTENCODING, BM_SETCHECK, nppGUI._detectEncoding, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_AUTOUPDATE, BM_SETCHECK, nppGUI._autoUpdateOpt._doAutoUpdate, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_AUTOUPDATE, BM_SETCHECK, nppGUI._autoUpdateOpt._doAutoUpdate, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_BACKSLASHISESCAPECHARACTERFORSQL, BM_SETCHECK, nppGUI._backSlashIsEscapeCharacterForSql, 0);
::ShowWindow(::GetDlgItem(_hSelf, IDC_CHECK_AUTOUPDATE), nppGUI._doesExistUpdater?SW_SHOW:SW_HIDE); ::ShowWindow(::GetDlgItem(_hSelf, IDC_CHECK_AUTOUPDATE), nppGUI._doesExistUpdater?SW_SHOW:SW_HIDE);
@ -1049,6 +1050,12 @@ BOOL CALLBACK SettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
::SendMessage(grandParent, NPPM_INTERNAL_UPDATETITLEBAR, 0, 0); ::SendMessage(grandParent, NPPM_INTERNAL_UPDATETITLEBAR, 0, 0);
return TRUE; return TRUE;
} }
case IDC_CHECK_BACKSLASHISESCAPECHARACTERFORSQL :
{
nppGUI._backSlashIsEscapeCharacterForSql = isCheckedOrNot(IDC_CHECK_BACKSLASHISESCAPECHARACTERFORSQL);
return TRUE;
}
} }
} }
} }

View File

@ -159,6 +159,7 @@
#define IDC_CHECK_SMARTHILITECASESENSITIVE (IDD_PREFERENCE_SETTING_BOX + 32) #define IDC_CHECK_SMARTHILITECASESENSITIVE (IDD_PREFERENCE_SETTING_BOX + 32)
#define IDC_SMARTHILITING_STATIC (IDD_PREFERENCE_SETTING_BOX + 33) #define IDC_SMARTHILITING_STATIC (IDD_PREFERENCE_SETTING_BOX + 33)
#define IDC_CHECK_DETECTENCODING (IDD_PREFERENCE_SETTING_BOX + 34) #define IDC_CHECK_DETECTENCODING (IDD_PREFERENCE_SETTING_BOX + 34)
#define IDC_CHECK_BACKSLASHISESCAPECHARACTERFORSQL (IDD_PREFERENCE_SETTING_BOX + 35)
//-- FLS: xFileEditViewHistoryParameterGUI: Additional Checkbox for enabling the history for restoring the edit view per file. //-- FLS: xFileEditViewHistoryParameterGUI: Additional Checkbox for enabling the history for restoring the edit view per file.
#define IDC_PREFERENCE_OFFSET_FLS 40 #define IDC_PREFERENCE_OFFSET_FLS 40
#define IDC_CHECK_REMEMBEREDITVIEWPERFILE (IDD_PREFERENCE_SETTING_BOX + IDC_PREFERENCE_OFFSET_FLS + 1) #define IDC_CHECK_REMEMBEREDITVIEWPERFILE (IDD_PREFERENCE_SETTING_BOX + IDC_PREFERENCE_OFFSET_FLS + 1)