[NEW] Make multi-selection optional (in progress).

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@532 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2009-09-10 22:19:49 +00:00
parent 9627abcd69
commit 0800917f32
6 changed files with 42 additions and 5 deletions

View File

@ -7374,8 +7374,10 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
_mainEditView.execute(SCI_SETZOOM, svp1._zoom);
_subEditView.execute(SCI_SETZOOM, svp2._zoom);
_mainEditView.execute(SCI_SETMULTIPLESELECTION, true);
_subEditView.execute(SCI_SETMULTIPLESELECTION, true);
//_mainEditView.execute(SCI_SETMULTIPLESELECTION, true);
//_subEditView.execute(SCI_SETMULTIPLESELECTION, true);
::SendMessage(hwnd, NPPM_INTERNAL_SETMULTISELCTION, 0, 0);
_mainEditView.execute(SCI_SETADDITIONALSELECTIONTYPING, true);
_subEditView.execute(SCI_SETADDITIONALSELECTIONTYPING, true);
@ -8732,6 +8734,14 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
return TRUE;
}
case NPPM_INTERNAL_SETMULTISELCTION :
{
NppGUI & nppGUI = (NppGUI &)pNppParam->getNppGUI();
_mainEditView.execute(SCI_SETMULTIPLESELECTION, nppGUI._enableMultiSelection);
_subEditView.execute(SCI_SETMULTIPLESELECTION, nppGUI._enableMultiSelection);
return TRUE;
}
case NPPM_INTERNAL_SETCARETBLINKRATE :
{
NppGUI & nppGUI = (NppGUI &)pNppParam->getNppGUI();

View File

@ -2914,6 +2914,13 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
_nppGUI._caretBlinkRate = i;
}
else if (!lstrcmp(nm, TEXT("ScintillaGlobalSettings")))
{
val = element->Attribute(TEXT("enableMultiSelection"));
if (val && lstrcmp(val, TEXT("yes")) == 0)
_nppGUI._enableMultiSelection = true;
}
else if (!lstrcmp(nm, TEXT("AppPosition")))
{
RECT oldRect = _nppGUI._appPos;
@ -3600,6 +3607,7 @@ bool NppParameters::writeGUIParams()
bool smartHighLightExist = false;
bool tagsMatchHighLightExist = false;
bool caretExist = false;
bool ScintillaGlobalSettingsExist = false;
bool openSaveDirExist = false;
bool titleBarExist = false;
bool stylerThemeExist = false;
@ -3709,6 +3717,11 @@ bool NppParameters::writeGUIParams()
element->SetAttribute(TEXT("width"), _nppGUI._caretWidth);
element->SetAttribute(TEXT("blinkRate"), _nppGUI._caretBlinkRate);
}
else if (!lstrcmp(nm, TEXT("ScintillaGlobalSettings")))
{
ScintillaGlobalSettingsExist = true;
element->SetAttribute(TEXT("enableMultiSelection"), _nppGUI._enableMultiSelection?TEXT("yes"):TEXT("no"));
}
else if (!lstrcmp(nm, TEXT("Auto-detection")))
{
autoDetectionExist = true;
@ -4117,6 +4130,13 @@ bool NppParameters::writeGUIParams()
GUIConfigElement->SetAttribute(TEXT("blinkRate"), _nppGUI._caretBlinkRate);
}
if (!ScintillaGlobalSettingsExist)
{
TiXmlElement *GUIConfigElement = (GUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement();
GUIConfigElement->SetAttribute(TEXT("name"), TEXT("ScintillaGlobalSettings"));
GUIConfigElement->SetAttribute(TEXT("enableMultiSelection"), _nppGUI._enableMultiSelection?TEXT("yes"):TEXT("no"));
}
if (!openSaveDirExist)
{
TiXmlElement *GUIConfigElement = (GUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement();

View File

@ -655,7 +655,7 @@ struct NppGUI
_isMaximized(false), _isMinimizedToTray(false), _rememberLastSession(true), _backup(bak_none), _useDir(false), _backupDir(TEXT("")),\
_doTaskList(true), _maitainIndent(true), _openSaveDir(dir_followCurrent), _styleMRU(true), _styleURL(0),\
_autocStatus(autoc_none), _autocFromLen(1), _funcParams(false), _definedSessionExt(TEXT("")),\
_doesExistUpdater(false), _caretBlinkRate(250), _caretWidth(1), _shortTitlebar(false), _themeName(TEXT("")), _isLangMenuCompact(false) {
_doesExistUpdater(false), _caretBlinkRate(250), _caretWidth(1), _enableMultiSelection(false), _shortTitlebar(false), _themeName(TEXT("")), _isLangMenuCompact(false) {
_appPos.left = 0;
_appPos.top = 0;
_appPos.right = 700;
@ -738,6 +738,7 @@ struct NppGUI
bool _doesExistUpdater;
int _caretBlinkRate;
int _caretWidth;
bool _enableMultiSelection;
bool _shortTitlebar;

View File

@ -386,6 +386,7 @@ BOOL CALLBACK MarginsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
::SendMessage(::GetDlgItem(_hSelf, IDC_WIDTH_COMBO), CB_SETCURSEL, nppGUI._caretWidth, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_MULTISELECTION, BM_SETCHECK, nppGUI._enableMultiSelection, 0);
::SendMessage(::GetDlgItem(_hSelf, IDC_CARETBLINKRATE_SLIDER),TBM_SETRANGEMIN, TRUE, BLINKRATE_FASTEST);
::SendMessage(::GetDlgItem(_hSelf, IDC_CARETBLINKRATE_SLIDER),TBM_SETRANGEMAX, TRUE, BLINKRATE_SLOWEST);
@ -407,7 +408,6 @@ BOOL CALLBACK MarginsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
case WM_HSCROLL:
{
NppGUI & nppGUI = (NppGUI &)NppParameters::getInstance()->getNppGUI();
int blinkRate = (int)::SendMessage(::GetDlgItem(_hSelf, IDC_CARETBLINKRATE_SLIDER),TBM_GETPOS, 0, 0);
if (blinkRate == BLINKRATE_SLOWEST)
blinkRate = 0;
@ -440,7 +440,11 @@ BOOL CALLBACK MarginsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
::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);
return TRUE;
case IDC_RADIO_SIMPLE:
svp._folderStyle = FOLDER_STYLE_SIMPLE;
::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_FOLDERMAGIN_SIMPLE, iView);

View File

@ -78,6 +78,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#define IDC_CARETBLINKRATE_F_STATIC (IDD_PREFERENCE_MARGEIN_BOX + 21)
#define IDC_CARETBLINKRATE_S_STATIC (IDD_PREFERENCE_MARGEIN_BOX + 22)
#define IDC_CHECK_DOCCHANGESTATEMARGE (IDD_PREFERENCE_MARGEIN_BOX + 23)
#define IDC_CHECK_MULTISELECTION (IDD_PREFERENCE_MARGEIN_BOX + 24)
#define IDD_PREFERENCE_SETTING_BOX 6300 //(IDD_PREFERENCE_BOX + 300)
#define IDC_TABSETTING_GB_STATIC (IDD_PREFERENCE_SETTING_BOX + 1)

View File

@ -316,6 +316,7 @@
#define NPPM_INTERNAL_FOCUS_ON_FOUND_RESULTS (NOTEPADPLUS_USER_INTERNAL + 30)
#define NPPM_INTERNAL_RELOADSTYLERS (NOTEPADPLUS_USER_INTERNAL + 31)
#define NPPM_INTERNAL_DOCORDERCHANGED (NOTEPADPLUS_USER_INTERNAL + 32)
#define NPPM_INTERNAL_SETMULTISELCTION (NOTEPADPLUS_USER_INTERNAL + 33)
//wParam: 0
//lParam: document new index