ui: Improved scrolling and layouting in QtCodeView and colored locations of active TokenId differently

This commit is contained in:
Eberhard Graether
2014-07-04 15:33:51 +02:00
parent 610aa2eb09
commit a70a9009cc
15 changed files with 142 additions and 33 deletions
@@ -29,6 +29,7 @@ void CodeController::setActiveTokenId(Id id)
collection.forEachTokenLocation([&] (TokenLocation* tokenLocation) -> void {
if (tokenLocation->isStartTokenLocation())
{
CodeView::CodeSnippetParams params;
const std::string filePath = tokenLocation->getFilePath();
std::shared_ptr<TextAccess> textAccess = TextAccess::createFromFile(filePath);
@@ -37,14 +38,17 @@ void CodeController::setActiveTokenId(Id id)
textAccess->getLineCount(), tokenLocation->getEndTokenLocation()->getLineNumber() + lineRadius
);
std::string text;
for (std::string line: textAccess->getLines(firstLineNumber, lastLineNumber))
{
text += line;
params.code += line;
}
TokenLocationFile tokenLocationFile = m_locationAccess->getTokenLocationsForLinesInFile(filePath, firstLineNumber, lastLineNumber);
getView()->addCodeSnippet(text, tokenLocationFile, firstLineNumber);
params.startLineNumber = firstLineNumber;
params.locationFile =
m_locationAccess->getTokenLocationsForLinesInFile(filePath, firstLineNumber, lastLineNumber);
params.activeTokenId = id;
getView()->addCodeSnippet(params);
}
});
}