logic: Refactored Code View to process all contents in one update

* Use unified showCodeSnippets method for setting file information on CodeView
* Made async initial file and snippet expansion synced
* Add ScrollParams API to CodeView
* Regard scope size when scrolling to definition
* Only use QtThreadedLambdaFunctor in QtCodeView now
This commit is contained in:
Eberhard Graether
2017-06-05 14:23:43 +02:00
parent 893b223bbc
commit de645be37a
29 changed files with 613 additions and 613 deletions
+27 -3
View File
@@ -58,7 +58,7 @@ void QtCodeNavigateable::ensureWidgetVisibleAnimated(
}
}
void QtCodeNavigateable::ensurePercentVisibleAnimated(double percent, bool animated, bool onTop)
void QtCodeNavigateable::ensurePercentVisibleAnimated(double percentA, double percentB, bool animated, bool onTop)
{
QAbstractScrollArea* area = getScrollArea();
if (!area)
@@ -74,10 +74,34 @@ void QtCodeNavigateable::ensurePercentVisibleAnimated(double percent, bool anima
return;
}
int scrollHeight = totalHeight * percent;
int scrollHeight = totalHeight * percentA;
if (!onTop)
{
scrollHeight -= visibleHeight / 3;
if (percentB)
{
int scrollHeightB = totalHeight * percentB;
int rectHeight = scrollHeightB - scrollHeight;
if (rectHeight < visibleHeight)
{
if (rectHeight < visibleHeight / 2)
{
scrollHeight -= visibleHeight / 4;
}
else
{
scrollHeight += rectHeight / 2 - visibleHeight / 2;
}
}
else
{
scrollHeight -= 20;
}
}
else
{
scrollHeight -= visibleHeight / 4;
}
}
else
{