ui: Added shortcuts for navigating to next and previous reference in code view

* Added new class QtCodeNavigator between QtCodeView and QtCodeFileList that handles active ids and navigation
* Pass all files as initially collapsed to code view and decide in QtCodeNavigator which ones show content
* Rewrote requesting of active snippet display to top down approach
* Display other locations focused when active location changes
* Show corresponding edges when navigating references
This commit is contained in:
Eberhard Graether
2016-08-09 13:29:14 +02:00
parent 210c5b1245
commit d0a063a3b6
32 changed files with 1037 additions and 599 deletions
+5 -9
View File
@@ -14,8 +14,7 @@ class QDragMoveEvent;
class QPaintEvent;
class QResizeEvent;
class QSize;
class QtCodeFile;
class QtCodeSnippet;
class QtCodeNavigator;
class QtHighlighter;
class QWidget;
class TokenLocation;
@@ -61,8 +60,8 @@ public:
uint startLineNumber,
const std::string& code,
std::shared_ptr<TokenLocationFile> locationFile,
QtCodeFile* file,
QtCodeSnippet* parent
QtCodeNavigator* navigator,
QWidget* parent = nullptr
);
virtual ~QtCodeArea();
@@ -72,7 +71,6 @@ public:
uint getEndLineNumber() const;
std::shared_ptr<TokenLocationFile> getTokenLocationFile() const;
QtCodeFile* getFile() const;
void lineNumberAreaPaintEvent(QPaintEvent* event);
int lineNumberDigits() const;
@@ -81,11 +79,9 @@ public:
void updateContent();
bool isActive() const;
void setIsActiveFile(bool isActiveFile);
uint getFirstActiveLineNumber() const;
uint getLineNumberForLocationId(Id locationId) const;
QRectF getLineRectForLineNumber(uint lineNumber) const;
std::string getCode() const;
@@ -166,7 +162,7 @@ private:
static std::vector<AnnotationColor> s_annotationColors;
QtCodeFile* m_fileWidget;
QtCodeNavigator* m_navigator;
QWidget* m_lineNumberArea;
QtHighlighter* m_highlighter;