2021-05-14 23:56:43 +08:00
# ifndef SYNEDIT_H
# define SYNEDIT_H
# include <QAbstractScrollArea>
# include <QCursor>
# include <QDateTime>
# include <QFrame>
# include <QStringList>
# include <QTimer>
# include <QWidget>
# include "MiscClasses.h"
# include "CodeFolding.h"
# include "Types.h"
# include "TextBuffer.h"
# include "KeyStrokes.h"
enum class SynFontSmoothMethod {
None , AntiAlias , ClearType
} ;
enum class SynScrollHintFormat {
shfTopLineOnly , shfTopToBottom
} ;
enum class SynScrollStyle {
ssNone , ssHorizontal , ssVertical , ssBoth
} ;
enum class SynEditCaretType {
ctVerticalLine , ctHorizontalLine , ctHalfBlock , ctBlock
} ;
enum class SynStatusChange {
scNone = 0 ,
scAll = 0x0001 ,
scCaretX = 0x0002 ,
scCaretY = 0x0004 ,
scLeftChar = 0x0008 ,
scTopLine = 0x0010 ,
scInsertMode = 0x0020 ,
scModified = 0x0040 ,
scSelection = 0x0080 ,
scReadOnly = 0x0100 ,
scOpenFile = 0x0200
} ;
Q_DECLARE_FLAGS ( SynStatusChanges , SynStatusChange )
Q_DECLARE_OPERATORS_FOR_FLAGS ( SynStatusChanges )
enum class SynStateFlag {
sfCaretChanged = 0x0001 ,
sfScrollbarChanged = 0x0002 ,
sfLinesChanging = 0x0004 ,
sfIgnoreNextChar = 0x0008 ,
sfCaretVisible = 0x0010 ,
sfDblClicked = 0x0020 ,
sfWaitForDragging = 0x0040
} ;
Q_DECLARE_FLAGS ( SynStateFlags , SynStateFlag )
Q_DECLARE_OPERATORS_FOR_FLAGS ( SynStateFlags )
enum SynEditorOption {
eoAltSetsColumnMode = 0x00000001 , //Holding down the Alt Key will put the selection mode into columnar format
eoAutoIndent = 0x00000002 , //Will indent the caret on new lines with the same amount of leading white space as the preceding line
eoAddIndent = 0x00000004 , //Will add one tab width of indent when typing { and :, and remove the same amount when typing }
2021-05-24 21:48:03 +08:00
//eoAutoSizeMaxScrollWidth = 0x00000008, //Automatically resizes the MaxScrollWidth property when inserting text
2021-05-14 23:56:43 +08:00
//eoDisableScrollArrows = 0x00000010 , //Disables the scroll bar arrow buttons when you can't scroll in that direction any more
eoDragDropEditing = 0x00000020 , //Allows you to select a block of text and drag it within the document to another location
eoDropFiles = 0x00000040 , //Allows the editor accept OLE file drops
eoEnhanceHomeKey = 0x00000080 , //enhances home key positioning, similar to visual studio
eoEnhanceEndKey = 0x00000100 , //enhances End key positioning, similar to JDeveloper
eoGroupUndo = 0x00000200 , //When undoing/redoing actions, handle all continous changes of the same kind in one call instead undoing/redoing each command separately
eoHalfPageScroll = 0x00000400 , //When scrolling with page-up and page-down commands, only scroll a half page at a time
eoHideShowScrollbars = 0x00000800 , //if enabled, then the scrollbars will only show when necessary. If you have ScrollPastEOL, then it the horizontal bar will always be there (it uses MaxLength instead)
eoKeepCaretX = 0x00001000 , //When moving through lines w/o Cursor Past EOL, keeps the X position of the cursor
eoNoCaret = 0x00002000 , //Makes it so the caret is never visible
eoNoSelection = 0x00004000 , //Disables selecting text
eoRightMouseMovesCursor = 0x00008000 , //When clicking with the right mouse for a popup menu, move the cursor to that location
eoScrollByOneLess = 0x00010000 , //Forces scrolling to be one less
eoScrollHintFollows = 0x00020000 , //The scroll hint follows the mouse when scrolling vertically
eoScrollPastEof = 0x00040000 , //Allows the cursor to go past the end of file marker
eoScrollPastEol = 0x00080000 , //Allows the cursor to go past the last character into the white space at the end of a line
eoShowScrollHint = 0x00100000 , //Shows a hint of the visible line numbers when scrolling vertically
eoShowSpecialChars = 0x00200000 , //Shows the special Characters
2021-06-03 20:26:36 +08:00
// eoSmartTabDelete = 0x00400000, //similar to Smart Tabs, but when you delete characters
// eoSmartTabs = 0x00800000, //When tabbing, the cursor will go to the next non-white space character of the previous line
2021-05-14 23:56:43 +08:00
eoSpecialLineDefaultFg = 0x01000000 , //disables the foreground text color override when using the OnSpecialLineColor event
eoTabIndent = 0x02000000 , //When active <Tab> and <Shift><Tab> act as block indent, unindent when text is selected
eoTabsToSpaces = 0x04000000 , //Converts a tab character to a specified number of space characters
eoShowRainbowColor = 0x08000000 ,
2021-05-29 21:35:46 +08:00
eoTrimTrailingSpaces = 0x10000000 , //Spaces at the end of lines will be trimmed and not saved
eoSelectWordByDblClick = 0x20000000
2021-05-14 23:56:43 +08:00
} ;
Q_DECLARE_FLAGS ( SynEditorOptions , SynEditorOption )
Q_DECLARE_OPERATORS_FOR_FLAGS ( SynEditorOptions )
enum class SynReplaceAction {
raCancel , raSkip , raReplace , raReplaceAll
} ;
enum class SynTransientType {
ttBefore , ttAfter
} ;
enum class SynScrollBarKind {
sbHorizontal , sbVertical
} ;
/*
using SynPaintTransientProc = std : : function < void ( const QPaintDevice & paintDevice ,
SynTransientType transientType ) > ;
*/
using SynPlaceMarkProc = std : : function < void ( PSynEditMark & Mark ) > ;
using SynProcessCommandProc = std : : function < void ( SynEditorCommand & command , QChar & AChar , void * data ) > ;
using SynMouseCursorProc = std : : function < void ( const BufferCoord & aLineCharPos , QCursor & aCursor ) > ;
using SynPaintProc = std : : function < void ( const QPaintDevice & paintDevice ) > ;
using SynPreparePaintHighlightTokenProc = std : : function < void ( int row ,
int column , const QString & token , PSynHighlighterAttribute attr ,
SynFontStyles & style , QColor & foreground , QColor & background ) > ;
using SynReplaceTextProc = std : : function < void ( const QString & ASearch , const QString & AReplace ,
int Line , int Column , int wordLen , SynReplaceAction & action ) > ;
2021-05-21 23:33:53 +08:00
//using SynSpecialLineColorsProc = std::function<void(int Line,
// bool& Special, QColor& foreground, QColor& backgroundColor)>;
//using SynEditingAreasProc = std::function<void(int Line, SynEditingAreaList& areaList,
// QColor& borderColor,SynEditingAreaType& areaType)>;
//using SynGutterGetTextProc = std::function<void(int aLine, QString& aText)>;
//using SynTGutterPaintProc = std::function<void(int aLine, int X, int Y)>;
2021-05-14 23:56:43 +08:00
class SynEdit ;
using PSynEdit = std : : shared_ptr < SynEdit > ;
class SynEdit : public QAbstractScrollArea
{
Q_OBJECT
public :
explicit SynEdit ( QWidget * parent = nullptr ) ;
2021-05-24 00:41:00 +08:00
/**
2021-05-27 20:33:25 +08:00
* Returns how many rows are there in the editor
2021-05-24 00:41:00 +08:00
* @ return
*/
2021-05-14 23:56:43 +08:00
int displayLineCount ( ) ;
2021-05-27 20:33:25 +08:00
/**
* @ brief displayX
* @ return
*/
2021-05-14 23:56:43 +08:00
DisplayCoord displayXY ( ) ;
int displayX ( ) ;
int displayY ( ) ;
BufferCoord caretXY ( ) ;
int caretX ( ) ;
int caretY ( ) ;
void invalidateGutter ( ) ;
void invalidateGutterLine ( int aLine ) ;
void invalidateGutterLines ( int FirstLine , int LastLine ) ;
DisplayCoord pixelsToNearestRowColumn ( int aX , int aY ) ;
DisplayCoord pixelsToRowColumn ( int aX , int aY ) ;
2021-05-24 00:41:00 +08:00
QPoint RowColumnToPixels ( const DisplayCoord & coord ) ;
2021-05-14 23:56:43 +08:00
DisplayCoord bufferToDisplayPos ( const BufferCoord & p ) ;
BufferCoord displayToBufferPos ( const DisplayCoord & p ) ;
2021-05-29 21:35:46 +08:00
int leftSpaces ( const QString & line ) ;
2021-06-03 20:26:36 +08:00
QString GetLeftSpacing ( int charCount , bool wantTabs ) ;
2021-05-18 15:49:58 +08:00
int charToColumn ( int aLine , int aChar ) ;
2021-06-03 20:26:36 +08:00
int charToColumn ( const QString & s , int aChar ) ;
2021-05-29 21:35:46 +08:00
int columnToChar ( int aLine , int aColumn ) ;
2021-05-21 23:33:53 +08:00
int stringColumns ( const QString & line , int colsBefore ) ;
int getLineIndent ( const QString & line ) ;
2021-05-14 23:56:43 +08:00
int rowToLine ( int aRow ) ;
int lineToRow ( int aLine ) ;
int foldRowToLine ( int Row ) ;
int foldLineToRow ( int Line ) ;
void setDefaultKeystrokes ( ) ;
void invalidateLine ( int Line ) ;
void invalidateLines ( int FirstLine , int LastLine ) ;
void invalidateSelection ( ) ;
void invalidateRect ( const QRect & rect ) ;
void invalidate ( ) ;
void lockPainter ( ) ;
void unlockPainter ( ) ;
bool selAvail ( ) ;
2021-06-03 20:26:36 +08:00
2021-05-16 20:36:00 +08:00
int charColumns ( QChar ch ) ;
double dpiFactor ( ) ;
2021-05-27 23:45:22 +08:00
bool IsPointInSelection ( const BufferCoord & Value ) ;
2021-05-29 21:35:46 +08:00
BufferCoord NextWordPos ( ) ;
BufferCoord NextWordPosEx ( const BufferCoord & XY ) ;
BufferCoord WordStart ( ) ;
BufferCoord WordStartEx ( const BufferCoord & XY ) ;
BufferCoord WordEnd ( ) ;
BufferCoord WordEndEx ( const BufferCoord & XY ) ;
BufferCoord PrevWordPos ( ) ;
BufferCoord PrevWordPosEx ( const BufferCoord & XY ) ;
2021-06-03 20:26:36 +08:00
void CommandProcessor ( SynEditorCommand Command , QChar AChar = QChar ( ) , void * pData = nullptr ) ;
//Caret
void showCaret ( ) ;
void hideCaret ( ) ;
void setCaretX ( int value ) ;
void setCaretY ( int value ) ;
void setCaretXY ( const BufferCoord & value ) ;
void setCaretXYEx ( bool CallEnsureCursorPos , BufferCoord value ) ;
void setCaretXYCentered ( bool ForceToMiddle , const BufferCoord & value ) ;
2021-05-29 21:35:46 +08:00
2021-06-03 20:26:36 +08:00
bool GetHighlighterAttriAtRowCol ( const BufferCoord & XY , QString & Token ,
PSynHighlighterAttribute & Attri ) ;
bool GetHighlighterAttriAtRowCol ( const BufferCoord & XY , QString & Token ,
bool & tokenFinished , SynHighlighterTokenType & TokenType ,
PSynHighlighterAttribute & Attri ) ;
bool GetHighlighterAttriAtRowColEx ( const BufferCoord & XY , QString & Token ,
SynHighlighterTokenType & TokenType , SynTokenKind & TokenKind , int & Start ,
PSynHighlighterAttribute & Attri ) ;
//Commands
2021-05-29 21:35:46 +08:00
void SelectAll ( ) ;
2021-06-03 20:26:36 +08:00
2021-05-14 23:56:43 +08:00
2021-05-27 20:33:25 +08:00
// setter && getters
2021-05-14 23:56:43 +08:00
int topLine ( ) const ;
void setTopLine ( int value ) ;
int linesInWindow ( ) const ;
int leftChar ( ) const ;
void setLeftChar ( int Value ) ;
BufferCoord blockBegin ( ) const ;
BufferCoord blockEnd ( ) const ;
SynSelectionMode activeSelectionMode ( ) const ;
void setActiveSelectionMode ( const SynSelectionMode & Value ) ;
int charsInWindow ( ) const ;
int charWidth ( ) const ;
int gutterWidth ( ) const ;
void setGutterWidth ( int value ) ;
bool modified ( ) const ;
void setModified ( bool Value ) ;
int maxScrollWidth ( ) const ;
void setMaxScrollWidth ( int Value ) ;
2021-05-18 15:49:58 +08:00
int tabWidth ( ) const ;
2021-05-27 20:33:25 +08:00
PSynHighlighter highlighter ( ) const ;
void setHighlighter ( const PSynHighlighter & highlighter ) ;
bool useCodeFolding ( ) const ;
void setUseCodeFolding ( bool value ) ;
QString lineText ( ) ;
void setLineText ( const QString s ) ;
2021-05-24 00:41:00 +08:00
PSynEditStringList lines ( ) const ;
bool empty ( ) ;
2021-05-27 23:45:22 +08:00
SynSelectionMode selectionMode ( ) const ;
void setSelectionMode ( SynSelectionMode value ) ;
2021-05-29 21:35:46 +08:00
QString selText ( ) ;
QString lineBreak ( ) ;
2021-05-14 23:56:43 +08:00
signals :
void Changed ( ) ;
void ChainUndoAdded ( ) ;
void ChainRedoAdded ( ) ;
void ChainLinesChanging ( ) ;
void ChainLinesChanged ( ) ;
void ChainListCleared ( ) ;
void ChainListDeleted ( int Index , int Count ) ;
void ChainListInserted ( int Index , int Count ) ;
void ChainListPutted ( int Index , int Count ) ;
void FilesDropped ( int X , int Y , const QStringList & AFiles ) ;
void GutterClicked ( Qt : : MouseButton button , int x , int y , int line , PSynEditMark mark ) ;
void ImeInputed ( const QString & s ) ;
void contextHelp ( const QString & word ) ;
void scrolled ( SynScrollBarKind ScrollBar ) ;
void statusChanged ( SynStatusChanges changes ) ;
2021-05-18 15:49:58 +08:00
void fontChanged ( ) ;
void tabSizeChanged ( ) ;
2021-05-27 20:33:25 +08:00
protected :
2021-05-21 23:33:53 +08:00
protected :
2021-05-24 00:41:00 +08:00
virtual bool onGetSpecialLineColors ( int Line ,
2021-05-21 23:33:53 +08:00
QColor & foreground , QColor & backgroundColor ) ;
2021-05-24 00:41:00 +08:00
virtual void onGetEditingAreas ( int Line , SynEditingAreaList & areaList ) ;
2021-05-21 23:33:53 +08:00
virtual void onGutterGetText ( int aLine , QString & aText ) ;
2021-05-24 00:41:00 +08:00
virtual void onGutterPaint ( QPainter & painter , int aLine , int X , int Y ) ;
virtual void onPaint ( QPainter & painter ) ;
2021-05-27 20:33:25 +08:00
virtual void onProcessCommand ( SynEditorCommand Command , QChar AChar , void * pData ) ;
virtual void onCommandProcessed ( SynEditorCommand Command , QChar AChar , void * pData ) ;
virtual void ExecuteCommand ( SynEditorCommand Command , QChar AChar , void * pData ) ;
2021-05-24 00:41:00 +08:00
2021-05-14 23:56:43 +08:00
private :
void clearAreaList ( SynEditingAreaList areaList ) ;
void computeCaret ( int X , int Y ) ;
void computeScroll ( int X , int Y ) ;
void incPaintLock ( ) ;
void decPaintLock ( ) ;
bool mouseCapture ( ) ;
int clientWidth ( ) ;
int clientHeight ( ) ;
int clientTop ( ) ;
int clientLeft ( ) ;
QRect clientRect ( ) ;
void synFontChanged ( ) ;
void doOnPaintTransient ( SynTransientType TransientType ) ;
void updateLastCaretX ( ) ;
void ensureCursorPosVisible ( ) ;
void ensureCursorPosVisibleEx ( bool ForceToMiddle ) ;
void scrollWindow ( int dx , int dy ) ;
void setInternalDisplayXY ( const DisplayCoord & aPos ) ;
void internalSetCaretXY ( const BufferCoord & Value ) ;
2021-05-29 21:35:46 +08:00
void internalSetCaretX ( int Value ) ;
void internalSetCaretY ( int Value ) ;
2021-05-14 23:56:43 +08:00
void setStatusChanged ( SynStatusChanges changes ) ;
void doOnStatusChange ( SynStatusChanges changes ) ;
void insertBlock ( const BufferCoord & BB , const BufferCoord & BE , const QString & ChangeStr ,
bool AddToUndoList ) ;
void updateScrollbars ( ) ;
void updateCaret ( ) ;
void recalcCharExtent ( ) ;
QString expandAtWideGlyphs ( const QString & S ) ;
void updateModifiedStatus ( ) ;
int scanFrom ( int Index ) ;
2021-05-26 00:04:20 +08:00
int scanRanges ( ) ;
2021-05-14 23:56:43 +08:00
void uncollapse ( PSynEditFoldRange FoldRange ) ;
void foldOnListInserted ( int Line , int Count ) ;
void foldOnListDeleted ( int Line , int Count ) ;
void foldOnListCleared ( ) ;
void rescan ( ) ; // rescan for folds
void rescanForFoldRanges ( ) ;
void scanForFoldRanges ( PSynEditFoldRanges TopFoldRanges ) ;
int lineHasChar ( int Line , int startChar , QChar character , const QString & highlighterAttrName ) ;
2021-05-27 01:05:49 +08:00
void findSubFoldRange ( PSynEditFoldRanges TopFoldRanges , int FoldIndex , PSynEditFoldRanges & parentFoldRanges , PSynEditFoldRange Parent ) ;
2021-05-14 23:56:43 +08:00
PSynEditFoldRange collapsedFoldStartAtLine ( int Line ) ;
void doOnPaintTransientEx ( SynTransientType TransientType , bool Lock ) ;
void initializeCaret ( ) ;
2021-05-21 23:33:53 +08:00
PSynEditFoldRange foldStartAtLine ( int Line ) ;
QString substringByColumns ( const QString & s , int startColumn , int & colLen ) ;
PSynEditFoldRange foldAroundLine ( int Line ) ;
PSynEditFoldRange foldAroundLineEx ( int Line , bool WantCollapsed , bool AcceptFromLine , bool AcceptToLine ) ;
2021-05-24 00:41:00 +08:00
PSynEditFoldRange checkFoldRange ( SynEditFoldRanges * FoldRangeToCheck , int Line , bool WantCollapsed , bool AcceptFromLine , bool AcceptToLine ) ;
PSynEditFoldRange foldEndAtLine ( int Line ) ;
void paintCaret ( QPainter & painter , const QRect rcClip ) ;
2021-05-24 21:48:03 +08:00
int textOffset ( ) ;
2021-05-27 20:33:25 +08:00
SynEditorCommand TranslateKeyCode ( int key , Qt : : KeyboardModifiers modifiers ) ;
/**
* Move the caret to right DX columns
* @ param DX
* @ param SelectionCommand
*/
void MoveCaretHorz ( int DX , bool isSelection ) ;
2021-05-27 21:39:18 +08:00
void MoveCaretVert ( int DY , bool isSelection ) ;
2021-05-27 20:33:25 +08:00
void MoveCaretAndSelection ( const BufferCoord & ptBefore , const BufferCoord & ptAfter ,
bool isSelection ) ;
void MoveCaretToLineStart ( bool isSelection ) ;
void MoveCaretToLineEnd ( bool isSelection ) ;
2021-05-29 21:35:46 +08:00
void SetSelectedTextEmpty ( ) ;
void SetSelTextPrimitive ( const QString & aValue ) ;
void SetSelTextPrimitiveEx ( SynSelectionMode PasteMode ,
const QString & Value , bool AddToUndoList ) ;
2021-06-03 20:26:36 +08:00
void setSelText ( const QString & Value ) ;
2021-05-29 21:35:46 +08:00
void DoLinesDeleted ( int FirstLine , int Count ) ;
2021-06-03 20:26:36 +08:00
void DoLinesInserted ( int FirstLine , int Count ) ;
2021-05-29 21:35:46 +08:00
void ProperSetLine ( int ALine , const QString & ALineText ) ;
void DeleteSelection ( const BufferCoord & BB , const BufferCoord & BE ) ;
2021-06-03 20:26:36 +08:00
void InsertText ( const QString & Value , SynSelectionMode PasteMode , bool AddToUndoList ) ;
int InsertTextByNormalMode ( const QString & Value ) ;
int InsertTextByColumnMode ( const QString & Value , bool AddToUndoList ) ;
int InsertTextByLineMode ( const QString & Value ) ;
void DeleteFromTo ( const BufferCoord & start , const BufferCoord & end ) ;
void SetSelWord ( ) ;
void SetWordBlock ( BufferCoord Value ) ;
void setCaretAndSelection ( const BufferCoord & ptCaret ,
const BufferCoord & ptBefore ,
const BufferCoord & ptAfter ) ;
void clearUndo ( ) ;
BufferCoord GetPreviousLeftBracket ( int x , int y ) ;
//Commands
void DeleteLastChar ( ) ;
void DeleteCurrentChar ( ) ;
void DeleteWord ( ) ;
void DeleteToEOL ( ) ;
void DeleteLastWord ( ) ;
void DeleteFromBOL ( ) ;
void DeleteLine ( ) ;
void DuplicateLine ( ) ;
void MoveSelUp ( ) ;
void MoveSelDown ( ) ;
void ClearAll ( ) ;
void InsertLine ( bool moveCaret ) ;
void DoTabKey ( ) ;
void DoShiftTabKey ( ) ;
void doBlockIndent ( ) ;
void doBlockUnindent ( ) ;
void DoAddChar ( QChar AChar ) ;
bool CanDoBlockIndent ( ) ;
private :
void setBlockBegin ( BufferCoord value ) ;
void setBlockEnd ( BufferCoord Value ) ;
void setSelLength ( int Value ) ;
2021-05-14 23:56:43 +08:00
private slots :
void bookMarkOptionsChanged ( ) ;
void gutterChanged ( ) ;
void linesChanged ( ) ;
void linesChanging ( ) ;
void linesCleared ( ) ;
void linesDeleted ( int index , int count ) ;
void linesInserted ( int index , int count ) ;
void linesPutted ( int index , int count ) ;
void redoAdded ( ) ;
void scrollTimerHandler ( ) ;
void undoAdded ( ) ;
void sizeOrFontChanged ( bool bFont ) ;
void doChange ( ) ;
2021-05-24 21:48:03 +08:00
void doScrolled ( int value ) ;
2021-05-14 23:56:43 +08:00
private :
2021-05-24 00:41:00 +08:00
std : : shared_ptr < QImage > mContentImage ;
2021-05-14 23:56:43 +08:00
SynEditFoldRanges mAllFoldRanges ;
SynEditCodeFolding mCodeFolding ;
bool mUseCodeFolding ;
bool mAlwaysShowCaret ;
BufferCoord mBlockBegin ;
BufferCoord mBlockEnd ;
int mCaretX ;
2021-06-03 23:18:51 +08:00
int mLastCaretColumn ;
2021-05-14 23:56:43 +08:00
int mCaretY ;
int mCharsInWindow ;
int mCharWidth ;
QFont mFontDummy ;
SynFontSmoothMethod mFontSmoothing ;
bool mMouseMoved ;
/* IME input */
int mImeCount ;
bool mMBCSStepAside ;
/* end of IME input */
bool mInserting ;
bool mPainting ;
PSynEditStringList mLines ;
PSynEditStringList mOrigLines ;
PSynEditUndoList mOrigUndoList ;
PSynEditUndoList mOrigRedoList ;
int mLinesInWindow ;
int mLeftChar ;
int mMaxScrollWidth ;
int mPaintLock ; // lock counter for internal calculations
bool mReadOnly ;
int mRightEdge ;
QColor mRightEdgeColor ;
QColor mScrollHintColor ;
SynScrollHintFormat mScrollHintFormat ;
SynScrollStyle mScrollBars ;
int mTextHeight ;
int mTopLine ;
PSynHighlighter mHighlighter ;
QColor mSelectedForeground ;
QColor mSelectedBackground ;
2021-05-24 18:11:07 +08:00
QColor mCaretColor ;
2021-05-14 23:56:43 +08:00
QColor mActiveLineColor ;
PSynEditUndoList mUndoList ;
PSynEditUndoList mRedoList ;
SynEditMarkList mBookMarks ;
2021-05-29 21:35:46 +08:00
QPoint mMouseDownPos ;
2021-05-14 23:56:43 +08:00
SynBookMarkOpt mBookMarkOpt ;
bool mHideSelection ;
int mMouseWheelAccumulator ;
SynEditCaretType mOverwriteCaret ;
SynEditCaretType mInsertCaret ;
QPoint mCaretOffset ;
SynEditKeyStrokes mKeyStrokes ;
bool mModified ;
QDateTime mLastModifyTime ;
SynEditMarkList mMarkList ;
int mExtraLineSpacing ;
SynSelectionMode mSelectionMode ;
SynSelectionMode mActiveSelectionMode ; //mode of the active selection
bool mWantReturns ;
bool mWantTabs ;
SynGutter mGutter ;
int mTabWidth ;
QRect mInvalidateRect ;
SynStateFlags mStateFlags ;
SynEditorOptions mOptions ;
SynStatusChanges mStatusChanges ;
int mLastKey ;
Qt : : KeyboardModifiers mLastKeyModifiers ;
//fSearchEngine: TSynEditSearchCustom;
//fHookedCommandHandlers: TList;
//fKbdHandler: TSynEditKbdHandler;
// fFocusList: TList;
// fPlugins: TList;
QTimer * mScrollTimer ;
int mScrollDeltaX ;
int mScrollDeltaY ;
PSynEdit fChainedEditor ;
int mPaintTransientLock ;
bool mIsScrolling ;
int mPainterLock ; // lock counter to prevent repaint while painting
bool mUndoing ;
// event handlers
SynPlaceMarkProc mOnClearMark ;
SynProcessCommandProc mOnCommandProcessed ;
SynMouseCursorProc mOnMouseCursor ;
SynPaintProc mOnPaint ;
SynPreparePaintHighlightTokenProc mOnPaintHighlightToken ;
SynPlaceMarkProc mOnPlaceMark ;
SynProcessCommandProc mOnProcessingCommand ;
SynProcessCommandProc mOnProcessingUserCommand ;
SynReplaceTextProc mOnReplaceText ;
2021-05-21 23:33:53 +08:00
// SynSpecialLineColorsProc mOnSpecialLineColors;
// SynEditingAreasProc mOnEditingAreas;
// SynGutterGetTextProc mOnGutterGetText;
// SynTGutterPaintProc mOnGutterPaint;
2021-05-14 23:56:43 +08:00
int mGutterWidth ;
//caret blink related
int m_blinkTimerId ;
2021-05-24 18:11:07 +08:00
int m_blinkStatus ;
2021-05-14 23:56:43 +08:00
friend class SynEditTextPainter ;
2021-05-24 00:41:00 +08:00
// QWidget interface
protected :
2021-05-27 20:33:25 +08:00
void paintEvent ( QPaintEvent * event ) override ;
2021-05-24 00:41:00 +08:00
void resizeEvent ( QResizeEvent * event ) override ;
void timerEvent ( QTimerEvent * event ) override ;
bool event ( QEvent * event ) override ;
2021-05-24 21:48:03 +08:00
void focusInEvent ( QFocusEvent * event ) override ;
void focusOutEvent ( QFocusEvent * event ) override ;
2021-05-27 20:33:25 +08:00
void keyPressEvent ( QKeyEvent * event ) override ;
2021-05-27 23:45:22 +08:00
void mousePressEvent ( QMouseEvent * event ) override ;
2021-05-29 21:35:46 +08:00
void mouseReleaseEvent ( QMouseEvent * event ) override ;
void mouseMoveEvent ( QMouseEvent * event ) override ;
void mouseDoubleClickEvent ( QMouseEvent * event ) override ;
2021-05-14 23:56:43 +08:00
} ;
# endif // SYNEDIT_H