From 6ab3326870662f13280a29dd62048bc04d3798fa Mon Sep 17 00:00:00 2001 From: donho Date: Tue, 11 Dec 2007 23:16:36 +0000 Subject: [PATCH] [NEW_FEATURE] Column selection is remembered now while switching among the files. As well this settings will be stored in the next session. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@83 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/Parameters.cpp | 5 +++++ PowerEditor/src/Parameters.h | 1 + PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 4635e5587..7eb861f9e 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -665,6 +665,8 @@ bool NppParameters::getSessionFromXmlTree(TiXmlDocument *pSessionDoc, Session *p (childNode->ToElement())->Attribute("xOffset", &position._xOffset); (childNode->ToElement())->Attribute("startPos", &position._startPos); (childNode->ToElement())->Attribute("endPos", &position._endPos); + (childNode->ToElement())->Attribute("selMode", &position._selMode); + const char *langName; langName = (childNode->ToElement())->Attribute( "lang" ); sessionFileInfo sfi( fileName, langName, position ); @@ -711,6 +713,7 @@ bool NppParameters::getSessionFromXmlTree(TiXmlDocument *pSessionDoc, Session *p (childNode->ToElement())->Attribute("xOffset", &position._xOffset); (childNode->ToElement())->Attribute("startPos", &position._startPos); (childNode->ToElement())->Attribute("endPos", &position._endPos); + (childNode->ToElement())->Attribute("selMode", &position._selMode); const char *langName; langName = (childNode->ToElement())->Attribute( "lang" ); sessionFileInfo sfi( fileName, langName, position ); @@ -1122,6 +1125,7 @@ void NppParameters::writeSession(const Session & session, const char *fileName) (fileNameNode->ToElement())->SetAttribute("xOffset", session._mainViewFiles[i]._xOffset); (fileNameNode->ToElement())->SetAttribute("startPos", session._mainViewFiles[i]._startPos); (fileNameNode->ToElement())->SetAttribute("endPos", session._mainViewFiles[i]._endPos); + (fileNameNode->ToElement())->SetAttribute("selMode", session._mainViewFiles[i]._selMode); (fileNameNode->ToElement())->SetAttribute("lang", session._mainViewFiles[i]._langName.c_str()); TiXmlText fileNameFullPath(session._mainViewFiles[i]._fileName.c_str()); @@ -1144,6 +1148,7 @@ void NppParameters::writeSession(const Session & session, const char *fileName) (fileNameNode->ToElement())->SetAttribute("xOffset", session._subViewFiles[i]._xOffset); (fileNameNode->ToElement())->SetAttribute("startPos", session._subViewFiles[i]._startPos); (fileNameNode->ToElement())->SetAttribute("endPos", session._subViewFiles[i]._endPos); + (fileNameNode->ToElement())->SetAttribute("selMode", session._subViewFiles[i]._selMode); (fileNameNode->ToElement())->SetAttribute("lang", session._subViewFiles[i]._langName.c_str()); TiXmlText fileNameFullPath(session._subViewFiles[i]._fileName.c_str()); diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index f32742f70..442b87df8 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -92,6 +92,7 @@ struct Position int _startPos; int _endPos; int _xOffset; + int _selMode; }; struct sessionFileInfo : public Position { diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index 7122ce7e3..db5f6c11a 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -838,6 +838,7 @@ void ScintillaEditView::saveCurrentPos() buf._pos._startPos = static_cast(execute(SCI_GETSELECTIONSTART)); buf._pos._endPos = static_cast(execute(SCI_GETSELECTIONEND)); buf._pos._xOffset = static_cast(execute(SCI_GETXOFFSET)); + buf._pos._selMode = execute(SCI_GETSELECTIONMODE); } void ScintillaEditView::restoreCurrentPos(const Position & prevPos) @@ -847,6 +848,10 @@ void ScintillaEditView::restoreCurrentPos(const Position & prevPos) Buffer & buf = _buffers[_currentIndex]; scroll(0, buf._pos._firstVisibleLine); + if (buf._pos._selMode == SC_SEL_RECTANGLE) + { + execute(SCI_SETSELECTIONMODE, buf._pos._selMode); + } execute(SCI_SETSELECTIONSTART, buf._pos._startPos); execute(SCI_SETSELECTIONEND, buf._pos._endPos); execute(SCI_SETXOFFSET, buf._pos._xOffset);