clean up
This commit is contained in:
parent
5a60d4a855
commit
5e10d0b4db
|
@ -55,7 +55,6 @@ QSynEdit::QSynEdit(QWidget *parent) : QAbstractScrollArea(parent),
|
||||||
mLastKeyModifiers = Qt::NoModifier;
|
mLastKeyModifiers = Qt::NoModifier;
|
||||||
mModified = false;
|
mModified = false;
|
||||||
mPaintLock = 0;
|
mPaintLock = 0;
|
||||||
mPainting = false;
|
|
||||||
mFontDummy = QFont("monospace",14);
|
mFontDummy = QFont("monospace",14);
|
||||||
mFontDummy.setStyleStrategy(QFont::PreferAntialias);
|
mFontDummy.setStyleStrategy(QFont::PreferAntialias);
|
||||||
mDocument = std::make_shared<Document>(mFontDummy, this);
|
mDocument = std::make_shared<Document>(mFontDummy, this);
|
||||||
|
@ -593,12 +592,7 @@ bool QSynEdit::pointToLine(const QPoint &point, int &line)
|
||||||
|
|
||||||
void QSynEdit::invalidateGutter()
|
void QSynEdit::invalidateGutter()
|
||||||
{
|
{
|
||||||
if (mPaintLock>0) {
|
invalidateGutterLines(-1, -1);
|
||||||
mStateFlags.setFlag(StateFlag::sfGutterRedrawNeeded);
|
|
||||||
} else {
|
|
||||||
mStateFlags.setFlag(StateFlag::sfGutterRedrawNeeded, false);
|
|
||||||
invalidateGutterLines(-1, -1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QSynEdit::invalidateGutterLine(int aLine)
|
void QSynEdit::invalidateGutterLine(int aLine)
|
||||||
|
@ -979,25 +973,12 @@ void QSynEdit::invalidateSelection()
|
||||||
|
|
||||||
void QSynEdit::invalidateRect(const QRect &rect)
|
void QSynEdit::invalidateRect(const QRect &rect)
|
||||||
{
|
{
|
||||||
if (mPaintLock>0) {
|
viewport()->update(rect);
|
||||||
mStateFlags.setFlag(StateFlag::sfRedrawNeeded);
|
|
||||||
mInvalidateRect = mInvalidateRect.united(rect);
|
|
||||||
} else {
|
|
||||||
// if (rect != calculateCaretRect())
|
|
||||||
// qDebug()<<"invalid rect"<<QDateTime::currentDateTime();
|
|
||||||
viewport()->update(rect);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QSynEdit::invalidate()
|
void QSynEdit::invalidate()
|
||||||
{
|
{
|
||||||
if (mPaintLock>0) {
|
viewport()->update();
|
||||||
mStateFlags.setFlag(StateFlag::sfRedrawNeeded);
|
|
||||||
mInvalidateRect = clientRect();
|
|
||||||
} else {
|
|
||||||
// qDebug()<<"invalidate"<<QDateTime::currentDateTime();
|
|
||||||
viewport()->update();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QSynEdit::selAvail() const
|
bool QSynEdit::selAvail() const
|
||||||
|
@ -2864,23 +2845,12 @@ void QSynEdit::doPasteFromClipboard()
|
||||||
|
|
||||||
void QSynEdit::incPaintLock()
|
void QSynEdit::incPaintLock()
|
||||||
{
|
{
|
||||||
if (mPaintLock == 0) {
|
|
||||||
mInvalidateRect={0,0,0,0};
|
|
||||||
}
|
|
||||||
mPaintLock ++ ;
|
mPaintLock ++ ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QSynEdit::decPaintLock()
|
void QSynEdit::decPaintLock()
|
||||||
{
|
{
|
||||||
Q_ASSERT(mPaintLock > 0);
|
Q_ASSERT(mPaintLock > 0);
|
||||||
if (mPaintLock == 1 ) {
|
|
||||||
if (mStatusChanges!=0)
|
|
||||||
doOnStatusChange(mStatusChanges);
|
|
||||||
if (mStateFlags.testFlag(StateFlag::sfCaretChanged))
|
|
||||||
updateCaret();
|
|
||||||
if (mStateFlags.testFlag(StateFlag::sfGutterRedrawNeeded))
|
|
||||||
invalidateGutter();
|
|
||||||
}
|
|
||||||
mPaintLock--;
|
mPaintLock--;
|
||||||
if (mPaintLock == 0 ) {
|
if (mPaintLock == 0 ) {
|
||||||
if (mStateFlags.testFlag(StateFlag::sfHScrollbarChanged)) {
|
if (mStateFlags.testFlag(StateFlag::sfHScrollbarChanged)) {
|
||||||
|
@ -2889,11 +2859,10 @@ void QSynEdit::decPaintLock()
|
||||||
if (mStateFlags.testFlag(StateFlag::sfVScrollbarChanged)) {
|
if (mStateFlags.testFlag(StateFlag::sfVScrollbarChanged)) {
|
||||||
updateVScrollbar();
|
updateVScrollbar();
|
||||||
}
|
}
|
||||||
if (mStateFlags.testFlag(StateFlag::sfRedrawNeeded)) {
|
if (mStateFlags.testFlag(StateFlag::sfCaretChanged))
|
||||||
invalidateRect(mInvalidateRect);
|
updateCaret();
|
||||||
mStateFlags.setFlag(StateFlag::sfRedrawNeeded, false);
|
if (mStatusChanges!=0)
|
||||||
mInvalidateRect = {0,0,0,0};
|
doOnStatusChange(mStatusChanges);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5894,7 +5863,7 @@ void QSynEdit::paintEvent(QPaintEvent *event)
|
||||||
cacheRC.setHeight(rcClip.height()*dpr);
|
cacheRC.setHeight(rcClip.height()*dpr);
|
||||||
painter.drawImage(rcCaret,*mContentImage,cacheRC);
|
painter.drawImage(rcCaret,*mContentImage,cacheRC);
|
||||||
} else {
|
} else {
|
||||||
//qDebug()<<"paint event:"<<rcClip;
|
//qDebug()<<"paint event:"<<QDateTime::currentDateTime()<<rcClip;
|
||||||
QRect rcDraw;
|
QRect rcDraw;
|
||||||
int nL1, nL2, nX1, nX2;
|
int nL1, nL2, nX1, nX2;
|
||||||
// Compute the invalid area in lines / columns.
|
// Compute the invalid area in lines / columns.
|
||||||
|
@ -6522,7 +6491,6 @@ void QSynEdit::onLinesCleared()
|
||||||
foldOnListCleared();
|
foldOnListCleared();
|
||||||
clearUndo();
|
clearUndo();
|
||||||
// invalidate the *whole* client area
|
// invalidate the *whole* client area
|
||||||
mInvalidateRect={0,0,0,0};
|
|
||||||
invalidate();
|
invalidate();
|
||||||
// set caret and selected block to start of text
|
// set caret and selected block to start of text
|
||||||
setCaretXY({1,1});
|
setCaretXY({1,1});
|
||||||
|
|
|
@ -68,9 +68,7 @@ enum class StateFlag {
|
||||||
sfIgnoreNextChar = 0x0010,
|
sfIgnoreNextChar = 0x0010,
|
||||||
sfCaretVisible = 0x0020,
|
sfCaretVisible = 0x0020,
|
||||||
sfDblClicked = 0x0040,
|
sfDblClicked = 0x0040,
|
||||||
sfWaitForDragging = 0x0080,
|
sfWaitForDragging = 0x0080
|
||||||
sfRedrawNeeded = 0x0100,
|
|
||||||
sfGutterRedrawNeeded = 0x0200,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_FLAGS(StateFlags,StateFlag)
|
Q_DECLARE_FLAGS(StateFlags,StateFlag)
|
||||||
|
@ -724,7 +722,6 @@ private:
|
||||||
bool mWantReturns;
|
bool mWantReturns;
|
||||||
bool mWantTabs;
|
bool mWantTabs;
|
||||||
Gutter mGutter;
|
Gutter mGutter;
|
||||||
QRect mInvalidateRect;
|
|
||||||
StateFlags mStateFlags;
|
StateFlags mStateFlags;
|
||||||
EditorOptions mOptions;
|
EditorOptions mOptions;
|
||||||
StatusChanges mStatusChanges;
|
StatusChanges mStatusChanges;
|
||||||
|
|
Loading…
Reference in New Issue