clean up qsynedit
This commit is contained in:
parent
a6f334f837
commit
2ff9dee9c0
|
@ -251,26 +251,6 @@ void SynEditKeyStrokes::resetDefaults()
|
|||
|
||||
// add(SynEditorCommand::ecUndo, Qt::Key_Z, Qt::ControlModifier);
|
||||
// add(SynEditorCommand::ecRedo, Qt::Key_Z, Qt::ControlModifier|Qt::ShiftModifier);
|
||||
// add(SynEditorCommand::ecGotoMarker0, Qt::Key_0, Qt::ControlModifier);
|
||||
// add(SynEditorCommand::ecGotoMarker1, Qt::Key_1, Qt::ControlModifier);
|
||||
// add(SynEditorCommand::ecGotoMarker2, Qt::Key_2, Qt::ControlModifier);
|
||||
// add(SynEditorCommand::ecGotoMarker3, Qt::Key_3, Qt::ControlModifier);
|
||||
// add(SynEditorCommand::ecGotoMarker4, Qt::Key_4, Qt::ControlModifier);
|
||||
// add(SynEditorCommand::ecGotoMarker5, Qt::Key_5, Qt::ControlModifier);
|
||||
// add(SynEditorCommand::ecGotoMarker6, Qt::Key_6, Qt::ControlModifier);
|
||||
// add(SynEditorCommand::ecGotoMarker7, Qt::Key_7, Qt::ControlModifier);
|
||||
// add(SynEditorCommand::ecGotoMarker8, Qt::Key_8, Qt::ControlModifier);
|
||||
// add(SynEditorCommand::ecGotoMarker9, Qt::Key_9, Qt::ControlModifier);
|
||||
// add(SynEditorCommand::ecSetMarker0, Qt::Key_0, Qt::ControlModifier | Qt::ShiftModifier);
|
||||
// add(SynEditorCommand::ecSetMarker1, Qt::Key_1, Qt::ControlModifier | Qt::ShiftModifier);
|
||||
// add(SynEditorCommand::ecSetMarker2, Qt::Key_2, Qt::ControlModifier | Qt::ShiftModifier);
|
||||
// add(SynEditorCommand::ecSetMarker3, Qt::Key_3, Qt::ControlModifier | Qt::ShiftModifier);
|
||||
// add(SynEditorCommand::ecSetMarker4, Qt::Key_4, Qt::ControlModifier | Qt::ShiftModifier);
|
||||
// add(SynEditorCommand::ecSetMarker5, Qt::Key_5, Qt::ControlModifier | Qt::ShiftModifier);
|
||||
// add(SynEditorCommand::ecSetMarker6, Qt::Key_6, Qt::ControlModifier | Qt::ShiftModifier);
|
||||
// add(SynEditorCommand::ecSetMarker7, Qt::Key_7, Qt::ControlModifier | Qt::ShiftModifier);
|
||||
// add(SynEditorCommand::ecSetMarker8, Qt::Key_8, Qt::ControlModifier | Qt::ShiftModifier);
|
||||
// add(SynEditorCommand::ecSetMarker9, Qt::Key_9, Qt::ControlModifier | Qt::ShiftModifier);
|
||||
// add(SynEditorCommand::ecNormalSelect, Qt::Key_N, Qt::ControlModifier | Qt::ShiftModifier);
|
||||
// add(SynEditorCommand::ecColumnSelect, Qt::Key_C, Qt::ControlModifier | Qt::ShiftModifier);
|
||||
// add(SynEditorCommand::ecLineSelect, Qt::Key_L, Qt::ControlModifier | Qt::ShiftModifier);
|
||||
|
|
|
@ -107,30 +107,6 @@ enum class SynEditorCommand {
|
|||
|
||||
ecMatchBracket = 250, // Go to matching bracket
|
||||
|
||||
ecGotoMarker0 = 301, // Goto marker
|
||||
ecGotoMarker1 = 302, // Goto marker
|
||||
ecGotoMarker2 = 303, // Goto marker
|
||||
ecGotoMarker3 = 304, // Goto marker
|
||||
ecGotoMarker4 = 305, // Goto marker
|
||||
ecGotoMarker5 = 306, // Goto marker
|
||||
ecGotoMarker6 = 307, // Goto marker
|
||||
ecGotoMarker7 = 308, // Goto marker
|
||||
ecGotoMarker8 = 309, // Goto marker
|
||||
ecGotoMarker9 = 310, // Goto marker
|
||||
ecSetMarker0 = 351, // Set marker, Data = PPoint - X, Y Pos
|
||||
ecSetMarker1 = 352, // Set marker, Data = PPoint - X, Y Pos
|
||||
ecSetMarker2 = 353, // Set marker, Data = PPoint - X, Y Pos
|
||||
ecSetMarker3 = 354, // Set marker, Data = PPoint - X, Y Pos
|
||||
ecSetMarker4 = 355, // Set marker, Data = PPoint - X, Y Pos
|
||||
ecSetMarker5 = 356, // Set marker, Data = PPoint - X, Y Pos
|
||||
ecSetMarker6 = 357, // Set marker, Data = PPoint - X, Y Pos
|
||||
ecSetMarker7 = 358, // Set marker, Data = PPoint - X, Y Pos
|
||||
ecSetMarker8 = 359, // Set marker, Data = PPoint - X, Y Pos
|
||||
ecSetMarker9 = 360, // Set marker, Data = PPoint - X, Y Pos
|
||||
|
||||
ecGotFocus = 480,
|
||||
ecLostFocus = 481,
|
||||
|
||||
ecContextHelp = 490, // Help on Word, Data = Word
|
||||
|
||||
ecDeleteLastChar = 501, // Delete last char (i.e. backspace key)
|
||||
|
@ -176,24 +152,22 @@ enum class SynEditorCommand {
|
|||
ecZoomOut = 631, //Increase Font Size
|
||||
ecZoomIn = 632, //Decrease Font Size
|
||||
|
||||
ecAutoCompletion = 650,
|
||||
ecLineBreakAtBegin = 651, //add a line break at the begin of the line
|
||||
ecLineBreakAtEnd = 652,
|
||||
ecInsertLineAtBegin = 653,
|
||||
ecInsertLineAtEnd = 654,
|
||||
|
||||
//### Code Folding ###
|
||||
ecCollapse = 700,
|
||||
ecUncollapse = 701,
|
||||
ecCollapseLevel = 702,
|
||||
ecUncollapseLevel = 703,
|
||||
ecCollapseAll = 704,
|
||||
ecUncollapseAll = 705,
|
||||
//### End Code Folding ###
|
||||
|
||||
ecUserFirst = 1001, // Start of user-defined commands
|
||||
|
||||
|
||||
|
||||
//### Code Folding ###
|
||||
ecCollapse = ecUserFirst + 100,
|
||||
ecUncollapse = ecUserFirst + 101,
|
||||
ecCollapseLevel = ecUserFirst + 102,
|
||||
ecUncollapseLevel = ecUserFirst + 103,
|
||||
ecCollapseAll = ecUserFirst + 104,
|
||||
ecUncollapseAll = ecUserFirst + 105,
|
||||
//### End Code Folding ###
|
||||
};
|
||||
|
||||
class SynKeyError: public BaseError {
|
||||
|
|
|
@ -333,177 +333,3 @@ void SynGutter::setBorderColor(const QColor &value)
|
|||
setChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SynEditMark::SynEditMark(QObject * /*parent*/)
|
||||
{
|
||||
mBookmarkNum = -1;
|
||||
}
|
||||
|
||||
int SynEditMark::Char() const
|
||||
{
|
||||
return mChar;
|
||||
}
|
||||
|
||||
void SynEditMark::setChar(int value)
|
||||
{
|
||||
if (value != mChar) {
|
||||
mChar = value;
|
||||
}
|
||||
}
|
||||
|
||||
int SynEditMark::image() const
|
||||
{
|
||||
return mImage;
|
||||
}
|
||||
|
||||
void SynEditMark::setImage(int image)
|
||||
{
|
||||
if (mImage != image) {
|
||||
mImage = image;
|
||||
if (mVisible)
|
||||
emit changed();
|
||||
}
|
||||
}
|
||||
|
||||
bool SynEditMark::visible() const
|
||||
{
|
||||
return mVisible;
|
||||
}
|
||||
|
||||
void SynEditMark::setVisible(bool visible)
|
||||
{
|
||||
if (mVisible!=visible) {
|
||||
mVisible = visible;
|
||||
emit changed();
|
||||
}
|
||||
}
|
||||
|
||||
int SynEditMark::bookmarkNum() const
|
||||
{
|
||||
return mBookmarkNum;
|
||||
}
|
||||
|
||||
void SynEditMark::setBookmarkNum(int bookmarkNum)
|
||||
{
|
||||
mBookmarkNum = bookmarkNum;
|
||||
}
|
||||
|
||||
bool SynEditMark::internalImage() const
|
||||
{
|
||||
return mInternalImage;
|
||||
}
|
||||
|
||||
void SynEditMark::setInternalImage(bool internalImage)
|
||||
{
|
||||
if (mInternalImage!=internalImage) {
|
||||
mInternalImage = internalImage;
|
||||
if (mVisible)
|
||||
emit changed();
|
||||
}
|
||||
}
|
||||
|
||||
bool SynEditMark::isBookmark() const
|
||||
{
|
||||
return (mBookmarkNum>=0);
|
||||
}
|
||||
|
||||
int SynEditMark::line() const
|
||||
{
|
||||
return mLine;
|
||||
}
|
||||
|
||||
void SynEditMark::setLine(int line)
|
||||
{
|
||||
if (mLine!=line) {
|
||||
if (mVisible && mLine>0)
|
||||
emit changed();
|
||||
mLine = line;
|
||||
if (mVisible && mLine>0)
|
||||
emit changed();
|
||||
}
|
||||
}
|
||||
|
||||
SynBookMarkOpt::SynBookMarkOpt(QObject */*parent*/)
|
||||
{
|
||||
mDrawBookmarksFirst = true;
|
||||
mEnableKeys = true;
|
||||
mGlyphsVisible = true;
|
||||
mLeftMargin = 2;
|
||||
mXOffset = 12;
|
||||
}
|
||||
|
||||
PSynIconList SynBookMarkOpt::bookmarkImages() const
|
||||
{
|
||||
return mBookmarkImages;
|
||||
}
|
||||
|
||||
void SynBookMarkOpt::setBookmarkImages(const PSynIconList &images)
|
||||
{
|
||||
if (mBookmarkImages != images) {
|
||||
mBookmarkImages = images;
|
||||
emit changed();
|
||||
}
|
||||
}
|
||||
|
||||
bool SynBookMarkOpt::drawBookmarksFirst() const
|
||||
{
|
||||
return mDrawBookmarksFirst;
|
||||
}
|
||||
|
||||
void SynBookMarkOpt::setDrawBookmarksFirst(bool drawBookmarksFirst)
|
||||
{
|
||||
if (mDrawBookmarksFirst != drawBookmarksFirst) {
|
||||
mDrawBookmarksFirst = drawBookmarksFirst;
|
||||
emit changed();
|
||||
}
|
||||
}
|
||||
|
||||
bool SynBookMarkOpt::enableKeys() const
|
||||
{
|
||||
return mEnableKeys;
|
||||
}
|
||||
|
||||
void SynBookMarkOpt::setEnableKeys(bool enableKeys)
|
||||
{
|
||||
mEnableKeys = enableKeys;
|
||||
}
|
||||
|
||||
bool SynBookMarkOpt::glyphsVisible() const
|
||||
{
|
||||
return mGlyphsVisible;
|
||||
}
|
||||
|
||||
void SynBookMarkOpt::setGlyphsVisible(bool glyphsVisible)
|
||||
{
|
||||
if (mGlyphsVisible!=glyphsVisible) {
|
||||
mGlyphsVisible = glyphsVisible;
|
||||
emit changed();
|
||||
}
|
||||
}
|
||||
|
||||
int SynBookMarkOpt::leftMargin() const
|
||||
{
|
||||
return mLeftMargin;
|
||||
}
|
||||
|
||||
void SynBookMarkOpt::setLeftMargin(int leftMargin)
|
||||
{
|
||||
if (leftMargin!=mLeftMargin) {
|
||||
mLeftMargin = leftMargin;
|
||||
emit changed();
|
||||
}
|
||||
}
|
||||
|
||||
int SynBookMarkOpt::xOffset() const
|
||||
{
|
||||
return mXOffset;
|
||||
}
|
||||
|
||||
void SynBookMarkOpt::setXOffset(int xOffset)
|
||||
{
|
||||
if (mXOffset!=xOffset) {
|
||||
mXOffset = xOffset;
|
||||
emit changed();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,80 +124,4 @@ private:
|
|||
|
||||
using PSynGutter = std::shared_ptr<SynGutter>;
|
||||
|
||||
class SynEditMark : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SynEditMark(QObject* parent = nullptr);
|
||||
int Char() const;
|
||||
void setChar(int value);
|
||||
|
||||
int image() const;
|
||||
void setImage(int image);
|
||||
|
||||
bool visible() const;
|
||||
void setVisible(bool visible);
|
||||
|
||||
int bookmarkNum() const;
|
||||
void setBookmarkNum(int bookmarkNum);
|
||||
|
||||
bool internalImage() const;
|
||||
void setInternalImage(bool internalImage);
|
||||
|
||||
bool isBookmark() const ;
|
||||
|
||||
int line() const;
|
||||
void setLine(int line);
|
||||
|
||||
signals:
|
||||
void changed();
|
||||
protected:
|
||||
int mLine;
|
||||
int mChar;
|
||||
int mImage;
|
||||
bool mVisible;
|
||||
bool mInternalImage;
|
||||
int mBookmarkNum;
|
||||
|
||||
};
|
||||
|
||||
using PSynEditMark = std::shared_ptr<SynEditMark>;
|
||||
|
||||
using SynEditMarkList = QList<SynEditMark>;
|
||||
|
||||
using PSynEditMarkList = std::shared_ptr<SynEditMarkList>;
|
||||
|
||||
class SynBookMarkOpt: public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SynBookMarkOpt(QObject* parent=nullptr);
|
||||
PSynIconList bookmarkImages() const;
|
||||
void setBookmarkImages(const PSynIconList &images);
|
||||
|
||||
bool drawBookmarksFirst() const;
|
||||
void setDrawBookmarksFirst(bool drawBookmarksFirst);
|
||||
|
||||
bool enableKeys() const;
|
||||
void setEnableKeys(bool enableKeys);
|
||||
|
||||
bool glyphsVisible() const;
|
||||
void setGlyphsVisible(bool glyphsVisible);
|
||||
|
||||
int leftMargin() const;
|
||||
void setLeftMargin(int leftMargin);
|
||||
|
||||
int xOffset() const;
|
||||
void setXOffset(int xOffset);
|
||||
|
||||
signals:
|
||||
void changed();
|
||||
private:
|
||||
PSynIconList mBookmarkImages;
|
||||
bool mDrawBookmarksFirst;
|
||||
bool mEnableKeys;
|
||||
bool mGlyphsVisible;
|
||||
int mLeftMargin;
|
||||
int mXOffset;
|
||||
};
|
||||
|
||||
using PSynBookMarkOpt = std::shared_ptr<SynBookMarkOpt>;
|
||||
#endif // MISCCLASSES_H
|
||||
|
|
|
@ -91,7 +91,6 @@ SynEdit::SynEdit(QWidget *parent) : QAbstractScrollArea(parent),
|
|||
mSelectedBackground = palette().color(QPalette::Highlight);
|
||||
mSelectedForeground = palette().color(QPalette::HighlightedText);
|
||||
|
||||
mBookMarkOpt.connect(&mBookMarkOpt, &SynBookMarkOpt::changed, this, &SynEdit::onBookMarkOptionsChanged);
|
||||
// fRightEdge has to be set before FontChanged is called for the first time
|
||||
mRightEdge = 80;
|
||||
|
||||
|
@ -2399,7 +2398,6 @@ void SynEdit::doMoveSelDown()
|
|||
void SynEdit::clearAll()
|
||||
{
|
||||
mDocument->clear();
|
||||
mMarkList.clear();
|
||||
mUndoList->clear();
|
||||
mRedoList->clear();
|
||||
setModified(false);
|
||||
|
|
|
@ -138,7 +138,6 @@ enum class SynScrollBarKind {
|
|||
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 )>;
|
||||
|
@ -689,9 +688,7 @@ private:
|
|||
QColor mActiveLineColor;
|
||||
PSynEditUndoList mUndoList;
|
||||
PSynEditUndoList mRedoList;
|
||||
SynEditMarkList mBookMarks;
|
||||
QPoint mMouseDownPos;
|
||||
SynBookMarkOpt mBookMarkOpt;
|
||||
bool mHideSelection;
|
||||
int mMouseWheelAccumulator;
|
||||
SynEditCaretType mOverwriteCaret;
|
||||
|
@ -700,7 +697,6 @@ private:
|
|||
SynEditKeyStrokes mKeyStrokes;
|
||||
bool mModified;
|
||||
QDateTime mLastModifyTime;
|
||||
SynEditMarkList mMarkList;
|
||||
int mExtraLineSpacing;
|
||||
SynSelectionMode mSelectionMode;
|
||||
SynSelectionMode mActiveSelectionMode; //mode of the active selection
|
||||
|
@ -729,12 +725,10 @@ private:
|
|||
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;
|
||||
|
||||
|
|
|
@ -1093,8 +1093,3 @@ void SynEditTextPainter::PaintLines()
|
|||
bCurrentLine = false;
|
||||
}
|
||||
}
|
||||
|
||||
void SynEditTextPainter::drawMark(PSynEditMark , int &, int )
|
||||
{
|
||||
//todo
|
||||
}
|
||||
|
|
|
@ -60,7 +60,6 @@ private:
|
|||
void PaintFoldAttributes();
|
||||
void GetBraceColorAttr(int level, PSynHighlighterAttribute &attr);
|
||||
void PaintLines();
|
||||
void drawMark(PSynEditMark aMark,int& aGutterOff, int aMarkRow);
|
||||
|
||||
private:
|
||||
SynEdit* edit;
|
||||
|
|
|
@ -52,10 +52,6 @@ Q_DECLARE_FLAGS(SynFontStyles,SynFontStyle)
|
|||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(SynFontStyles)
|
||||
|
||||
using PSynIcon = std::shared_ptr<QIcon>;
|
||||
using SynIconList = QList<PSynIcon>;
|
||||
using PSynIconList = std::shared_ptr<SynIconList>;
|
||||
|
||||
enum class SynEditingAreaType {
|
||||
eatRectangleBorder,
|
||||
eatWaveUnderLine,
|
||||
|
|
Loading…
Reference in New Issue