[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
This commit is contained in:
donho 2007-12-11 23:16:36 +00:00
parent c7188766c8
commit 6ab3326870
3 changed files with 11 additions and 0 deletions

View File

@ -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());

View File

@ -92,6 +92,7 @@ struct Position
int _startPos;
int _endPos;
int _xOffset;
int _selMode;
};
struct sessionFileInfo : public Position {

View File

@ -838,6 +838,7 @@ void ScintillaEditView::saveCurrentPos()
buf._pos._startPos = static_cast<int>(execute(SCI_GETSELECTIONSTART));
buf._pos._endPos = static_cast<int>(execute(SCI_GETSELECTIONEND));
buf._pos._xOffset = static_cast<int>(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);