logic: Fixed scrolling to line from plug-in and moved all code view scrolling into QtCodeNavigator

This commit is contained in:
Eberhard Graether
2016-08-10 16:16:32 +02:00
parent 2800c072ff
commit 6b51c7cfe4
15 changed files with 190 additions and 183 deletions
+6 -15
View File
@@ -16,7 +16,6 @@ QtCodeView::QtCodeView(ViewLayout* viewLayout)
, m_clearFunctor(std::bind(&QtCodeView::doClear, this))
, m_showCodeSnippetsFunctor(std::bind(&QtCodeView::doShowCodeSnippets, this, std::placeholders::_1, std::placeholders::_2))
, m_addCodeSnippetsFunctor(std::bind(&QtCodeView::doAddCodeSnippets, this, std::placeholders::_1, std::placeholders::_2))
, m_showCodeFileFunctor(std::bind(&QtCodeView::doShowCodeFile, this, std::placeholders::_1))
, m_setFileStateFunctor(std::bind(&QtCodeView::doSetFileState, this, std::placeholders::_1, std::placeholders::_2))
, m_doShowActiveSnippetFunctor(
std::bind(&QtCodeView::doShowActiveSnippet, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3))
@@ -72,11 +71,6 @@ void QtCodeView::addCodeSnippets(const std::vector<CodeSnippetParams>& snippets,
m_addCodeSnippetsFunctor(snippets, insert);
}
void QtCodeView::showCodeFile(const CodeSnippetParams& params)
{
m_showCodeFileFunctor(params);
}
void QtCodeView::setFileState(const FilePath filePath, FileState state)
{
m_setFileStateFunctor(filePath, state);
@@ -118,9 +112,9 @@ void QtCodeView::scrollToValue(int value)
m_scrollToValueFunctor(value);
}
void QtCodeView::scrollToLine(std::string filename, unsigned int line)
void QtCodeView::scrollToLine(const FilePath filePath, unsigned int line)
{
m_scrollToLineFunctor(filename, line);
m_scrollToLineFunctor(filePath, line);
}
void QtCodeView::doRefreshView()
@@ -173,11 +167,6 @@ void QtCodeView::doAddCodeSnippets(const std::vector<CodeSnippetParams>& snippet
m_widget->scrollToSnippetIfRequested();
}
void QtCodeView::doShowCodeFile(const CodeSnippetParams& params)
{
m_widget->addCodeSnippet(params);
}
void QtCodeView::doSetFileState(const FilePath filePath, FileState state)
{
switch (state)
@@ -192,6 +181,8 @@ void QtCodeView::doSetFileState(const FilePath filePath, FileState state)
m_widget->setFileMaximized(filePath);
break;
}
m_widget->scrollToSnippetIfRequested();
}
void QtCodeView::doShowActiveSnippet(
@@ -232,9 +223,9 @@ void QtCodeView::doScrollToValue(int value)
m_widget->scrollToValue(value);
}
void QtCodeView::doScrollToLine(std::string filename, unsigned int line)
void QtCodeView::doScrollToLine(const FilePath filePath, unsigned int line)
{
m_widget->scrollToLine(filename, line);
m_widget->scrollToLine(filePath, line);
}
void QtCodeView::setStyleSheet() const
+3 -6
View File
@@ -32,7 +32,6 @@ public:
virtual void showCodeSnippets(const std::vector<CodeSnippetParams>& snippets, const std::vector<Id>& activeTokenIds);
virtual void addCodeSnippets(const std::vector<CodeSnippetParams>& snippets, bool insert);
virtual void showCodeFile(const CodeSnippetParams& params);
virtual void setFileState(const FilePath filePath, FileState state);
@@ -47,7 +46,7 @@ public:
virtual void showContents();
virtual void scrollToValue(int value);
virtual void scrollToLine(std::string filename, unsigned int line);
virtual void scrollToLine(const FilePath filePath, unsigned int line);
private:
void doRefreshView();
@@ -55,7 +54,6 @@ private:
void doShowCodeSnippets(const std::vector<CodeSnippetParams>& snippets, const std::vector<Id>& activeTokenIds);
void doAddCodeSnippets(const std::vector<CodeSnippetParams>& snippets, bool insert);
void doShowCodeFile(const CodeSnippetParams& params);
void doSetFileState(const FilePath filePath, FileState state);
@@ -70,7 +68,7 @@ private:
void doShowContents();
void doScrollToValue(int value);
void doScrollToLine(std::string filename, unsigned int line);
void doScrollToLine(const FilePath filePath, unsigned int line);
void setStyleSheet() const;
@@ -78,7 +76,6 @@ private:
QtThreadedFunctor<> m_clearFunctor;
QtThreadedFunctor<const std::vector<CodeSnippetParams>&, const std::vector<Id>&> m_showCodeSnippetsFunctor;
QtThreadedFunctor<const std::vector<CodeSnippetParams>&, bool> m_addCodeSnippetsFunctor;
QtThreadedFunctor<const CodeSnippetParams&> m_showCodeFileFunctor;
QtThreadedFunctor<const FilePath, FileState> m_setFileStateFunctor;
QtThreadedFunctor<const std::vector<Id>&, std::shared_ptr<TokenLocationCollection>, bool> m_doShowActiveSnippetFunctor;
QtThreadedFunctor<const std::vector<Id>&> m_doShowActiveTokenIdsFunctor;
@@ -87,7 +84,7 @@ private:
QtThreadedFunctor<> m_defocusTokenIdsFunctor;
QtThreadedFunctor<> m_showContentsFunctor;
QtThreadedFunctor<int> m_scrollToValueFunctor;
QtThreadedFunctor<std::string, unsigned int> m_scrollToLineFunctor;
QtThreadedFunctor<const FilePath, unsigned int> m_scrollToLineFunctor;
QtCodeNavigator* m_widget;