1bb02e0acSNicolas Bonnefon /* 2bb02e0acSNicolas Bonnefon * Copyright (C) 2009, 2010, 2011, 2012, 2013 Nicolas Bonnefon 3bb02e0acSNicolas Bonnefon * and other contributors 4bb02e0acSNicolas Bonnefon * 5bb02e0acSNicolas Bonnefon * This file is part of glogg. 6bb02e0acSNicolas Bonnefon * 7bb02e0acSNicolas Bonnefon * glogg is free software: you can redistribute it and/or modify 8bb02e0acSNicolas Bonnefon * it under the terms of the GNU General Public License as published by 9bb02e0acSNicolas Bonnefon * the Free Software Foundation, either version 3 of the License, or 10bb02e0acSNicolas Bonnefon * (at your option) any later version. 11bb02e0acSNicolas Bonnefon * 12bb02e0acSNicolas Bonnefon * glogg is distributed in the hope that it will be useful, 13bb02e0acSNicolas Bonnefon * but WITHOUT ANY WARRANTY; without even the implied warranty of 14bb02e0acSNicolas Bonnefon * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15bb02e0acSNicolas Bonnefon * GNU General Public License for more details. 16bb02e0acSNicolas Bonnefon * 17bb02e0acSNicolas Bonnefon * You should have received a copy of the GNU General Public License 18bb02e0acSNicolas Bonnefon * along with glogg. If not, see <http://www.gnu.org/licenses/>. 19bb02e0acSNicolas Bonnefon */ 20bb02e0acSNicolas Bonnefon 21bb02e0acSNicolas Bonnefon #ifndef ABSTRACTLOGVIEW_H 22bb02e0acSNicolas Bonnefon #define ABSTRACTLOGVIEW_H 23bb02e0acSNicolas Bonnefon 24bb02e0acSNicolas Bonnefon #include <QAbstractScrollArea> 25bb02e0acSNicolas Bonnefon #include <QBasicTimer> 26bb02e0acSNicolas Bonnefon 278bda3285SNicolas Bonnefon #ifdef GLOGG_PERF_MEASURE_FPS 28045703daSNicolas Bonnefon # include "perfcounter.h" 298bda3285SNicolas Bonnefon #endif 30045703daSNicolas Bonnefon 31bb02e0acSNicolas Bonnefon #include "selection.h" 32bb02e0acSNicolas Bonnefon #include "quickfind.h" 33bb02e0acSNicolas Bonnefon #include "overviewwidget.h" 34bb02e0acSNicolas Bonnefon #include "quickfindmux.h" 35*0b05c6eaSNicolas Bonnefon #include "viewtools.h" 36bb02e0acSNicolas Bonnefon 37bb02e0acSNicolas Bonnefon class QMenu; 38bb02e0acSNicolas Bonnefon class QAction; 39bb02e0acSNicolas Bonnefon class AbstractLogData; 40bb02e0acSNicolas Bonnefon 41bb02e0acSNicolas Bonnefon class LineChunk 42bb02e0acSNicolas Bonnefon { 43bb02e0acSNicolas Bonnefon public: 44bb02e0acSNicolas Bonnefon enum ChunkType { 45bb02e0acSNicolas Bonnefon Normal, 46bb02e0acSNicolas Bonnefon Highlighted, 47bb02e0acSNicolas Bonnefon Selected, 48bb02e0acSNicolas Bonnefon }; 49bb02e0acSNicolas Bonnefon 50bb02e0acSNicolas Bonnefon LineChunk( int first_col, int end_col, ChunkType type ); 51bb02e0acSNicolas Bonnefon 52bb02e0acSNicolas Bonnefon int start() const { return start_; } 53bb02e0acSNicolas Bonnefon int end() const { return end_; } 54bb02e0acSNicolas Bonnefon ChunkType type() const { return type_; } 55bb02e0acSNicolas Bonnefon 56bb02e0acSNicolas Bonnefon // Returns 'true' if the selection is part of this chunk 57bb02e0acSNicolas Bonnefon // (at least partially), if so, it should be replaced by the list returned 58bb02e0acSNicolas Bonnefon QList<LineChunk> select( int selection_start, int selection_end ) const; 59bb02e0acSNicolas Bonnefon 60bb02e0acSNicolas Bonnefon private: 61bb02e0acSNicolas Bonnefon int start_; 62bb02e0acSNicolas Bonnefon int end_; 63bb02e0acSNicolas Bonnefon ChunkType type_; 64bb02e0acSNicolas Bonnefon }; 65bb02e0acSNicolas Bonnefon 66bb02e0acSNicolas Bonnefon // Utility class for syntax colouring. 67bb02e0acSNicolas Bonnefon // It stores the chunks of line to draw 68bb02e0acSNicolas Bonnefon // each chunk having a different colour 69bb02e0acSNicolas Bonnefon class LineDrawer 70bb02e0acSNicolas Bonnefon { 71bb02e0acSNicolas Bonnefon public: 72bb02e0acSNicolas Bonnefon LineDrawer( const QColor& back_color) : 73bb02e0acSNicolas Bonnefon list(), backColor_( back_color ) { }; 74bb02e0acSNicolas Bonnefon 75bb02e0acSNicolas Bonnefon // Add a chunk of line using the given colours. 76bb02e0acSNicolas Bonnefon // Both first_col and last_col are included 77bb02e0acSNicolas Bonnefon // An empty chunk will be ignored. 78bb02e0acSNicolas Bonnefon // the first column will be set to 0 if negative 79bb02e0acSNicolas Bonnefon // The column are relative to the screen 80bb02e0acSNicolas Bonnefon void addChunk( int first_col, int last_col, QColor fore, QColor back ); 81bb02e0acSNicolas Bonnefon void addChunk( const LineChunk& chunk, QColor fore, QColor back ); 82bb02e0acSNicolas Bonnefon 83bb02e0acSNicolas Bonnefon // Draw the current line of text using the given painter, 84bb02e0acSNicolas Bonnefon // in the passed block (in pixels) 85bb02e0acSNicolas Bonnefon // The line must be cut to fit on the screen. 86bb02e0acSNicolas Bonnefon // leftExtraBackgroundPx is the an extra margin to start drawing 87bb02e0acSNicolas Bonnefon // the coloured // background, going all the way to the element 88bb02e0acSNicolas Bonnefon // left of the line looks better. 89bb02e0acSNicolas Bonnefon void draw( QPainter& painter, int xPos, int yPos, 90bb02e0acSNicolas Bonnefon int line_width, const QString& line, 91bb02e0acSNicolas Bonnefon int leftExtraBackgroundPx ); 92bb02e0acSNicolas Bonnefon 93bb02e0acSNicolas Bonnefon private: 94bb02e0acSNicolas Bonnefon class Chunk { 95bb02e0acSNicolas Bonnefon public: 96bb02e0acSNicolas Bonnefon // Create a new chunk 97bb02e0acSNicolas Bonnefon Chunk( int start, int length, QColor fore, QColor back ) 98bb02e0acSNicolas Bonnefon : start_( start ), length_( length ), 99bb02e0acSNicolas Bonnefon foreColor_ ( fore ), backColor_ ( back ) { }; 100bb02e0acSNicolas Bonnefon 101bb02e0acSNicolas Bonnefon // Accessors 102bb02e0acSNicolas Bonnefon int start() const { return start_; } 103bb02e0acSNicolas Bonnefon int length() const { return length_; } 104bb02e0acSNicolas Bonnefon const QColor& foreColor() const { return foreColor_; } 105bb02e0acSNicolas Bonnefon const QColor& backColor() const { return backColor_; } 106bb02e0acSNicolas Bonnefon 107bb02e0acSNicolas Bonnefon private: 108bb02e0acSNicolas Bonnefon int start_; 109bb02e0acSNicolas Bonnefon int length_; 110bb02e0acSNicolas Bonnefon QColor foreColor_; 111bb02e0acSNicolas Bonnefon QColor backColor_; 112bb02e0acSNicolas Bonnefon }; 113bb02e0acSNicolas Bonnefon QList<Chunk> list; 114bb02e0acSNicolas Bonnefon QColor backColor_; 115bb02e0acSNicolas Bonnefon }; 116bb02e0acSNicolas Bonnefon 117bb02e0acSNicolas Bonnefon 118bb02e0acSNicolas Bonnefon // Utility class representing a buffer for number entered on the keyboard 119bb02e0acSNicolas Bonnefon // The buffer keep at most 7 digits, and reset itself after a timeout. 120bb02e0acSNicolas Bonnefon class DigitsBuffer : public QObject 121bb02e0acSNicolas Bonnefon { 122bb02e0acSNicolas Bonnefon Q_OBJECT 123bb02e0acSNicolas Bonnefon 124bb02e0acSNicolas Bonnefon public: 125bb02e0acSNicolas Bonnefon DigitsBuffer(); 126bb02e0acSNicolas Bonnefon 127bb02e0acSNicolas Bonnefon // Reset the buffer. 128bb02e0acSNicolas Bonnefon void reset(); 129bb02e0acSNicolas Bonnefon // Add a single digit to the buffer (discarded if it's not a digit), 130bb02e0acSNicolas Bonnefon // the timeout timer is reset. 131bb02e0acSNicolas Bonnefon void add( char character ); 132bb02e0acSNicolas Bonnefon // Get the content of the buffer (0 if empty) and reset it. 133bb02e0acSNicolas Bonnefon int content(); 134bb02e0acSNicolas Bonnefon 135bb02e0acSNicolas Bonnefon protected: 136bb02e0acSNicolas Bonnefon void timerEvent( QTimerEvent* event ); 137bb02e0acSNicolas Bonnefon 138bb02e0acSNicolas Bonnefon private: 139bb02e0acSNicolas Bonnefon // Duration of the timeout in milliseconds. 140bb02e0acSNicolas Bonnefon static const int timeout_; 141bb02e0acSNicolas Bonnefon 142bb02e0acSNicolas Bonnefon QString digits_; 143bb02e0acSNicolas Bonnefon 144bb02e0acSNicolas Bonnefon QBasicTimer timer_; 145bb02e0acSNicolas Bonnefon }; 146bb02e0acSNicolas Bonnefon 147bb02e0acSNicolas Bonnefon class Overview; 148bb02e0acSNicolas Bonnefon 149bb02e0acSNicolas Bonnefon // Base class representing the log view widget. 150bb02e0acSNicolas Bonnefon // It can be either the top (full) or bottom (filtered) view. 151bb02e0acSNicolas Bonnefon class AbstractLogView : 152bb02e0acSNicolas Bonnefon public QAbstractScrollArea, public SearchableWidgetInterface 153bb02e0acSNicolas Bonnefon { 154bb02e0acSNicolas Bonnefon Q_OBJECT 155bb02e0acSNicolas Bonnefon 156bb02e0acSNicolas Bonnefon public: 157bb02e0acSNicolas Bonnefon // Constructor of the widget, the data set is passed. 158bb02e0acSNicolas Bonnefon // The caller retains ownership of the data set. 159bb02e0acSNicolas Bonnefon // The pointer to the QFP is used for colouring and QuickFind searches 160bb02e0acSNicolas Bonnefon AbstractLogView( const AbstractLogData* newLogData, 161bb02e0acSNicolas Bonnefon const QuickFindPattern* const quickFind, QWidget* parent=0 ); 162bb02e0acSNicolas Bonnefon ~AbstractLogView(); 163bb02e0acSNicolas Bonnefon 164bb02e0acSNicolas Bonnefon // Refresh the widget when the data set has changed. 165bb02e0acSNicolas Bonnefon void updateData(); 166bb02e0acSNicolas Bonnefon // Instructs the widget to update it's content geometry, 167bb02e0acSNicolas Bonnefon // used when the font is changed. 168bb02e0acSNicolas Bonnefon void updateDisplaySize(); 169bb02e0acSNicolas Bonnefon // Return the line number of the top line of the view 170bb02e0acSNicolas Bonnefon int getTopLine() const; 171bb02e0acSNicolas Bonnefon // Return the text of the current selection. 172bb02e0acSNicolas Bonnefon QString getSelection() const; 173bb02e0acSNicolas Bonnefon // Instructs the widget to select the whole text. 174bb02e0acSNicolas Bonnefon void selectAll(); 175bb02e0acSNicolas Bonnefon 176bb02e0acSNicolas Bonnefon protected: 177bb02e0acSNicolas Bonnefon void mousePressEvent( QMouseEvent* mouseEvent ); 178bb02e0acSNicolas Bonnefon void mouseMoveEvent( QMouseEvent* mouseEvent ); 179bb02e0acSNicolas Bonnefon void mouseReleaseEvent( QMouseEvent* ); 180bb02e0acSNicolas Bonnefon void mouseDoubleClickEvent( QMouseEvent* mouseEvent ); 181bb02e0acSNicolas Bonnefon void timerEvent( QTimerEvent* timerEvent ); 182bb02e0acSNicolas Bonnefon void changeEvent( QEvent* changeEvent ); 183bb02e0acSNicolas Bonnefon void paintEvent( QPaintEvent* paintEvent ); 184bb02e0acSNicolas Bonnefon void resizeEvent( QResizeEvent* resizeEvent ); 185bb02e0acSNicolas Bonnefon void scrollContentsBy( int dx, int dy ); 186bb02e0acSNicolas Bonnefon void keyPressEvent( QKeyEvent* keyEvent ); 187bb02e0acSNicolas Bonnefon void wheelEvent( QWheelEvent* wheelEvent ); 188bb02e0acSNicolas Bonnefon 189bb02e0acSNicolas Bonnefon // Must be implemented to return wether the line number is 190bb02e0acSNicolas Bonnefon // a match, a mark or just a normal line (used for coloured bullets) 191bb02e0acSNicolas Bonnefon enum LineType { Normal, Marked, Match }; 192bb02e0acSNicolas Bonnefon virtual LineType lineType( int lineNumber ) const = 0; 193bb02e0acSNicolas Bonnefon 194bb02e0acSNicolas Bonnefon // Line number to display for line at the given index 195bb02e0acSNicolas Bonnefon virtual qint64 displayLineNumber( int lineNumber ) const; 196bb02e0acSNicolas Bonnefon virtual qint64 maxDisplayLineNumber() const; 197bb02e0acSNicolas Bonnefon 198bb02e0acSNicolas Bonnefon // Get the overview associated with this view, or NULL if there is none 199bb02e0acSNicolas Bonnefon Overview* getOverview() const { return overview_; } 200bb02e0acSNicolas Bonnefon // Set the Overview and OverviewWidget 201bb02e0acSNicolas Bonnefon void setOverview( Overview* overview, OverviewWidget* overview_widget ); 202bb02e0acSNicolas Bonnefon 203bb02e0acSNicolas Bonnefon signals: 204bb02e0acSNicolas Bonnefon // Sent when a new line has been selected by the user. 205bb02e0acSNicolas Bonnefon void newSelection(int line); 206bb02e0acSNicolas Bonnefon // Sent up to the MainWindow to disable the follow mode 207bb02e0acSNicolas Bonnefon void followDisabled(); 208bb02e0acSNicolas Bonnefon // Sent when the view wants the QuickFind widget pattern to change. 209bb02e0acSNicolas Bonnefon void changeQuickFind( const QString& newPattern, 210bb02e0acSNicolas Bonnefon QuickFindMux::QFDirection newDirection ); 211bb02e0acSNicolas Bonnefon // Sent up when the current line number is updated 212bb02e0acSNicolas Bonnefon void updateLineNumber( int line ); 213bb02e0acSNicolas Bonnefon // Sent up when quickFind wants to show a message to the user. 214bb02e0acSNicolas Bonnefon void notifyQuickFind( const QFNotification& message ); 215bb02e0acSNicolas Bonnefon // Sent up when quickFind wants to clear the notification. 216bb02e0acSNicolas Bonnefon void clearQuickFindNotification(); 217bb02e0acSNicolas Bonnefon // Sent when the view ask for a line to be marked 218bb02e0acSNicolas Bonnefon // (click in the left margin). 219bb02e0acSNicolas Bonnefon void markLine( qint64 line ); 220bb02e0acSNicolas Bonnefon // Sent up when the user wants to add the selection to the search 221bb02e0acSNicolas Bonnefon void addToSearch( const QString& selection ); 222bb02e0acSNicolas Bonnefon // Sent up when the mouse is hovered over a line's margin 223bb02e0acSNicolas Bonnefon void mouseHoveredOverLine( qint64 line ); 224bb02e0acSNicolas Bonnefon // Sent up when the mouse leaves a line's margin 225bb02e0acSNicolas Bonnefon void mouseLeftHoveringZone(); 226bb02e0acSNicolas Bonnefon // Sent up for view initiated quickfind searches 227bb02e0acSNicolas Bonnefon void searchNext(); 228bb02e0acSNicolas Bonnefon void searchPrevious(); 22945ef183cSNicolas Bonnefon // Sent up when the user has moved within the view 23045ef183cSNicolas Bonnefon void activity(); 231bb02e0acSNicolas Bonnefon 232bb02e0acSNicolas Bonnefon public slots: 233bb02e0acSNicolas Bonnefon // Makes the widget select and display the passed line. 234bb02e0acSNicolas Bonnefon // Scrolling as necessary 235bb02e0acSNicolas Bonnefon void selectAndDisplayLine( int line ); 236bb02e0acSNicolas Bonnefon 237bb02e0acSNicolas Bonnefon // Use the current QFP to go and select the next match. 238bb02e0acSNicolas Bonnefon virtual void searchForward(); 239bb02e0acSNicolas Bonnefon // Use the current QFP to go and select the previous match. 240bb02e0acSNicolas Bonnefon virtual void searchBackward(); 241bb02e0acSNicolas Bonnefon 242bb02e0acSNicolas Bonnefon // Use the current QFP to go and select the next match (incremental) 243bb02e0acSNicolas Bonnefon virtual void incrementallySearchForward(); 244bb02e0acSNicolas Bonnefon // Use the current QFP to go and select the previous match (incremental) 245bb02e0acSNicolas Bonnefon virtual void incrementallySearchBackward(); 246bb02e0acSNicolas Bonnefon // Stop the current incremental search (typically when user press return) 247bb02e0acSNicolas Bonnefon virtual void incrementalSearchStop(); 248bb02e0acSNicolas Bonnefon // Abort the current incremental search (typically when user press esc) 249bb02e0acSNicolas Bonnefon virtual void incrementalSearchAbort(); 250bb02e0acSNicolas Bonnefon 251bb02e0acSNicolas Bonnefon // Signals the follow mode has been enabled. 252bb02e0acSNicolas Bonnefon void followSet( bool checked ); 253bb02e0acSNicolas Bonnefon 254bb02e0acSNicolas Bonnefon // Signal the on/off status of the overview has been changed. 255bb02e0acSNicolas Bonnefon void refreshOverview(); 256bb02e0acSNicolas Bonnefon 257bb02e0acSNicolas Bonnefon // Make the view jump to the specified line, regardless of weither it 258bb02e0acSNicolas Bonnefon // is on the screen or not. 259bb02e0acSNicolas Bonnefon // (does NOT emit followDisabled() ) 260bb02e0acSNicolas Bonnefon void jumpToLine( int line ); 261bb02e0acSNicolas Bonnefon 262bb02e0acSNicolas Bonnefon // Configure the setting of whether to show line number margin 263bb02e0acSNicolas Bonnefon void setLineNumbersVisible( bool lineNumbersVisible ); 264bb02e0acSNicolas Bonnefon 265bb02e0acSNicolas Bonnefon private slots: 266bb02e0acSNicolas Bonnefon void handlePatternUpdated(); 267bb02e0acSNicolas Bonnefon void addToSearch(); 268bb02e0acSNicolas Bonnefon void findNextSelected(); 269bb02e0acSNicolas Bonnefon void findPreviousSelected(); 270bb02e0acSNicolas Bonnefon void copy(); 271bb02e0acSNicolas Bonnefon 272bb02e0acSNicolas Bonnefon private: 273bb02e0acSNicolas Bonnefon // Constants 274bb02e0acSNicolas Bonnefon static const int OVERVIEW_WIDTH; 275*0b05c6eaSNicolas Bonnefon static const int HOOK_THRESHOLD; 276bb02e0acSNicolas Bonnefon 277bb02e0acSNicolas Bonnefon // Width of the bullet zone, including decoration 278bb02e0acSNicolas Bonnefon int bulletZoneWidthPx_; 279bb02e0acSNicolas Bonnefon 280bb02e0acSNicolas Bonnefon // Total size of all margins and decorations in pixels 281bb02e0acSNicolas Bonnefon int leftMarginPx_; 282bb02e0acSNicolas Bonnefon 283bb02e0acSNicolas Bonnefon // Number of digits to display in line numbers 284bb02e0acSNicolas Bonnefon int nbDigitsInLineNumber_; 285bb02e0acSNicolas Bonnefon 286bb02e0acSNicolas Bonnefon // Digits buffer (for numeric keyboard entry) 287bb02e0acSNicolas Bonnefon DigitsBuffer digitsBuffer_; 288bb02e0acSNicolas Bonnefon 289bb02e0acSNicolas Bonnefon // Follow mode 290bb02e0acSNicolas Bonnefon bool followMode_; 291bb02e0acSNicolas Bonnefon 292*0b05c6eaSNicolas Bonnefon // ElasticHook for follow mode 293*0b05c6eaSNicolas Bonnefon ElasticHook followElasticHook_; 294*0b05c6eaSNicolas Bonnefon 295bb02e0acSNicolas Bonnefon // Whether to show line numbers or not 296bb02e0acSNicolas Bonnefon bool lineNumbersVisible_; 297bb02e0acSNicolas Bonnefon 298bb02e0acSNicolas Bonnefon // Pointer to the CrawlerWidget's data set 299bb02e0acSNicolas Bonnefon const AbstractLogData* logData; 300bb02e0acSNicolas Bonnefon 301bb02e0acSNicolas Bonnefon // Pointer to the Overview object 302bb02e0acSNicolas Bonnefon Overview* overview_; 303bb02e0acSNicolas Bonnefon 304bb02e0acSNicolas Bonnefon // Pointer to the OverviewWidget, this class doesn't own it, 305bb02e0acSNicolas Bonnefon // but is responsible for displaying it (for purely aesthetic 306bb02e0acSNicolas Bonnefon // reasons). 307bb02e0acSNicolas Bonnefon OverviewWidget* overviewWidget_; 308bb02e0acSNicolas Bonnefon 309bb02e0acSNicolas Bonnefon bool selectionStarted_; 310bb02e0acSNicolas Bonnefon // Start of the selection (characters) 311bb02e0acSNicolas Bonnefon QPoint selectionStartPos_; 312bb02e0acSNicolas Bonnefon // Current end of the selection (characters) 313bb02e0acSNicolas Bonnefon QPoint selectionCurrentEndPos_; 314bb02e0acSNicolas Bonnefon QBasicTimer autoScrollTimer_; 315bb02e0acSNicolas Bonnefon 316bb02e0acSNicolas Bonnefon // Hovering state 317bb02e0acSNicolas Bonnefon // Last line that has been hoovered on, -1 if none 318bb02e0acSNicolas Bonnefon qint64 lastHoveredLine_; 319bb02e0acSNicolas Bonnefon 320bb02e0acSNicolas Bonnefon // Marks (left margin click) 321bb02e0acSNicolas Bonnefon bool markingClickInitiated_; 322bb02e0acSNicolas Bonnefon qint64 markingClickLine_; 323bb02e0acSNicolas Bonnefon 324bb02e0acSNicolas Bonnefon Selection selection_; 325bb02e0acSNicolas Bonnefon qint64 firstLine; 326bb02e0acSNicolas Bonnefon qint64 lastLine; 327bb02e0acSNicolas Bonnefon int firstCol; 328bb02e0acSNicolas Bonnefon 329bb02e0acSNicolas Bonnefon // Text handling 330bb02e0acSNicolas Bonnefon int charWidth_; 331bb02e0acSNicolas Bonnefon int charHeight_; 332bb02e0acSNicolas Bonnefon 333bb02e0acSNicolas Bonnefon // Popup menu 334bb02e0acSNicolas Bonnefon QMenu* popupMenu_; 335bb02e0acSNicolas Bonnefon QAction* copyAction_; 336bb02e0acSNicolas Bonnefon QAction* findNextAction_; 337bb02e0acSNicolas Bonnefon QAction* findPreviousAction_; 338bb02e0acSNicolas Bonnefon QAction* addToSearchAction_; 339bb02e0acSNicolas Bonnefon 340bb02e0acSNicolas Bonnefon // Pointer to the CrawlerWidget's QFP object 341bb02e0acSNicolas Bonnefon const QuickFindPattern* const quickFindPattern_; 342bb02e0acSNicolas Bonnefon // Our own QuickFind object 343bb02e0acSNicolas Bonnefon QuickFind quickFind_; 344bb02e0acSNicolas Bonnefon 3458bda3285SNicolas Bonnefon #ifdef GLOGG_PERF_MEASURE_FPS 346045703daSNicolas Bonnefon // Performance measurement 347045703daSNicolas Bonnefon PerfCounter perfCounter_; 3488bda3285SNicolas Bonnefon #endif 349045703daSNicolas Bonnefon 350bb02e0acSNicolas Bonnefon int getNbVisibleLines() const; 351bb02e0acSNicolas Bonnefon int getNbVisibleCols() const; 352bb02e0acSNicolas Bonnefon QPoint convertCoordToFilePos( const QPoint& pos ) const; 353bb02e0acSNicolas Bonnefon int convertCoordToLine( int yPos ) const; 354bb02e0acSNicolas Bonnefon int convertCoordToColumn( int xPos ) const; 355bb02e0acSNicolas Bonnefon void displayLine( int line ); 356bb02e0acSNicolas Bonnefon void moveSelection( int y ); 357bb02e0acSNicolas Bonnefon void jumpToStartOfLine(); 358bb02e0acSNicolas Bonnefon void jumpToEndOfLine(); 359bb02e0acSNicolas Bonnefon void jumpToRightOfScreen(); 360bb02e0acSNicolas Bonnefon void jumpToTop(); 361bb02e0acSNicolas Bonnefon void jumpToBottom(); 362bb02e0acSNicolas Bonnefon void selectWordAtPosition( const QPoint& pos ); 363bb02e0acSNicolas Bonnefon 364bb02e0acSNicolas Bonnefon void createMenu(); 365bb02e0acSNicolas Bonnefon 366bb02e0acSNicolas Bonnefon void considerMouseHovering( int x_pos, int y_pos ); 367bb02e0acSNicolas Bonnefon 368bb02e0acSNicolas Bonnefon // Search functions (for n/N) 369bb02e0acSNicolas Bonnefon void searchUsingFunction( qint64 (QuickFind::*search_function)() ); 370bb02e0acSNicolas Bonnefon 371*0b05c6eaSNicolas Bonnefon void updateScrollBars(); 372*0b05c6eaSNicolas Bonnefon 373bb02e0acSNicolas Bonnefon // Utils functions 374bb02e0acSNicolas Bonnefon bool isCharWord( char c ); 375bb02e0acSNicolas Bonnefon void updateGlobalSelection(); 376bb02e0acSNicolas Bonnefon }; 377bb02e0acSNicolas Bonnefon 378bb02e0acSNicolas Bonnefon #endif 379