* refactor: remove mMaxScrollWidth variable from qsynedit/CodeFolding.cpp

* add: editor font options form
This commit is contained in:
royqh1979@gmail.com 2021-06-08 21:41:42 +08:00
parent a0d142f6df
commit 229148c309
15 changed files with 776 additions and 202 deletions

View File

@ -32,6 +32,7 @@ SOURCES += \
settingsdialog/compilersetdirectorieswidget.cpp \
settingsdialog/compilersetoptionwidget.cpp \
settings.cpp \
settingsdialog/editorfontwidget.cpp \
settingsdialog/editorgeneralwidget.cpp \
settingsdialog/settingsdialog.cpp \
settingsdialog/settingswidget.cpp \
@ -64,6 +65,7 @@ HEADERS += \
settingsdialog/compilersetdirectorieswidget.h \
settingsdialog/compilersetoptionwidget.h \
settings.h \
settingsdialog/editorfontwidget.h \
settingsdialog/editorgeneralwidget.h \
settingsdialog/settingsdialog.h \
settingsdialog/settingswidget.h \
@ -77,6 +79,7 @@ FORMS += \
mainwindow.ui \
settingsdialog/compilersetdirectorieswidget.ui \
settingsdialog/compilersetoptionwidget.ui \
settingsdialog/editorfontwidget.ui \
settingsdialog/editorgeneralwidget.ui \
settingsdialog/settingsdialog.ui

View File

@ -267,10 +267,14 @@ void Editor::applySettings()
options.setFlag(eoEnhanceHomeKey,pSettings->editor().enhanceHomeKey());
options.setFlag(eoEnhanceEndKey,pSettings->editor().enhanceEndKey());
options.setFlag(eoHideShowScrollbars,pSettings->editor().autoHideScrollbar());
options.setFlag(eoScrollPastEol,pSettings->editor().scrollPastEol());
options.setFlag(eoScrollPastEof,pSettings->editor().scrollPastEof());
options.setFlag(eoScrollByOneLess,pSettings->editor().scrollByOneLess());
options.setFlag(eoHalfPageScroll,pSettings->editor().halfPageScroll());
setOptions(options);
setTabWidth(pSettings->editor().tabWidth());
setInsertCaret(pSettings->editor().caretForInsert());
setOverwriteCaret(pSettings->editor().caretForOverwrite());
setCaretColor(pSettings->editor().caretColor());

View File

@ -75,7 +75,7 @@ void SynEditFoldRanges::clear()
mRanges.clear();
}
int SynEditFoldRanges::count()
int SynEditFoldRanges::count() const
{
return mRanges.size();
}
@ -114,7 +114,7 @@ void SynEditFoldRanges::add(PSynEditFoldRange foldRange)
mRanges.push_back(foldRange);
}
PSynEditFoldRange SynEditFoldRanges::operator[](int index)
PSynEditFoldRange SynEditFoldRanges::operator[](int index) const
{
return mRanges[index];
}

View File

@ -48,7 +48,7 @@ private:
public:
PSynEditFoldRange range(int index);
void clear();
int count();
int count() const;
SynEditFoldRanges();
PSynEditFoldRange addByParts(PSynEditFoldRange aParent, PSynEditFoldRanges aAllFold,
int aFromLine, PSynEditFoldRegion aFoldRegion, int aToLine);
@ -56,7 +56,7 @@ public:
void insert(int index, PSynEditFoldRange range);
int remove(int index);
void add(PSynEditFoldRange foldRange);
PSynEditFoldRange operator[](int index);
PSynEditFoldRange operator[](int index) const;
};
// A single fold

View File

@ -75,7 +75,6 @@ SynEdit::SynEdit(QWidget *parent) : QAbstractScrollArea(parent)
this->setCursor(Qt::CursorShape::IBeamCursor);
//TabStop := True;
mInserting = true;
mMaxScrollWidth = 1024;
mScrollBars = SynScrollStyle::ssBoth;
mExtraLineSpacing = 0;
qDebug()<<"init SynEdit: 6";
@ -150,7 +149,7 @@ SynEdit::SynEdit(QWidget *parent) : QAbstractScrollArea(parent)
setMouseTracking(true);
}
int SynEdit::displayLineCount()
int SynEdit::displayLineCount() const
{
if (mLines->empty()) {
return 0;
@ -158,22 +157,22 @@ int SynEdit::displayLineCount()
return lineToRow(mLines->count());
}
DisplayCoord SynEdit::displayXY()
DisplayCoord SynEdit::displayXY() const
{
return bufferToDisplayPos(caretXY());
}
int SynEdit::displayX()
int SynEdit::displayX() const
{
return displayXY().Column;
}
int SynEdit::displayY()
int SynEdit::displayY() const
{
return displayXY().Row;
}
BufferCoord SynEdit::caretXY()
BufferCoord SynEdit::caretXY() const
{
BufferCoord result;
result.Char = caretX();
@ -181,12 +180,12 @@ BufferCoord SynEdit::caretXY()
return result;
}
int SynEdit::caretX()
int SynEdit::caretX() const
{
return mCaretX;
}
int SynEdit::caretY()
int SynEdit::caretY() const
{
return mCaretY;
}
@ -213,7 +212,7 @@ void SynEdit::setCaretXYEx(bool CallEnsureCursorPos, BufferCoord value)
if (vTriggerPaint)
doOnPaintTransient(SynTransientType::ttBefore);
int nMaxX = mMaxScrollWidth + 1;
int nMaxX;
if (value.Line > mLines->count())
value.Line = mLines->count();
if (value.Line < 1) {
@ -223,13 +222,14 @@ void SynEdit::setCaretXYEx(bool CallEnsureCursorPos, BufferCoord value)
nMaxX = 1;
}
} else {
if (!mOptions.testFlag(SynEditorOption::eoScrollPastEol))
nMaxX = mLines->getString(value.Line-1).length()+1;
}
if ((value.Char > nMaxX) && (! (mOptions.testFlag(SynEditorOption::eoScrollPastEol)) ) )
value.Char = nMaxX;
if (value.Char < 1)
value.Char = 1;
value.Char = std::min(value.Char,nMaxX);
value.Char = std::max(value.Char,1);
// if ((value.Char > nMaxX) && (! (mOptions.testFlag(SynEditorOption::eoScrollPastEol)) ) )
// value.Char = nMaxX;
// if (value.Char < 1)
// value.Char = 1;
if ((value.Char != mCaretX) || (value.Line != mCaretY)) {
incPaintLock();
auto action = finally([this]{
@ -291,6 +291,14 @@ void SynEdit::setCaretXYCentered(bool ForceToMiddle, const BufferCoord &value)
}
int SynEdit::maxScrollWidth() const
{
if (mOptions.testFlag(eoScrollPastEol))
return mLines->lengthOfLongestLine();
else
return std::max(mLines->lengthOfLongestLine()-mCharsInWindow+1, 1);
}
bool SynEdit::GetHighlighterAttriAtRowCol(const BufferCoord &XY, QString &Token, PSynHighlighterAttribute &Attri)
{
SynHighlighterTokenType TmpType;
@ -434,7 +442,7 @@ void SynEdit::invalidateGutterLines(int FirstLine, int LastLine)
* @param aY
* @return
*/
DisplayCoord SynEdit::pixelsToNearestRowColumn(int aX, int aY)
DisplayCoord SynEdit::pixelsToNearestRowColumn(int aX, int aY) const
{
// Result is in display coordinates
float f;
@ -451,7 +459,7 @@ DisplayCoord SynEdit::pixelsToNearestRowColumn(int aX, int aY)
};
}
DisplayCoord SynEdit::pixelsToRowColumn(int aX, int aY)
DisplayCoord SynEdit::pixelsToRowColumn(int aX, int aY) const
{
return {
.Column = std::max(1, mLeftChar + ((aX - mGutterWidth - 2) / mCharWidth)),
@ -459,7 +467,7 @@ DisplayCoord SynEdit::pixelsToRowColumn(int aX, int aY)
};
}
QPoint SynEdit::RowColumnToPixels(const DisplayCoord &coord)
QPoint SynEdit::RowColumnToPixels(const DisplayCoord &coord) const
{
QPoint result;
result.setX((coord.Column - 1) * mCharWidth + textOffset());
@ -473,7 +481,7 @@ QPoint SynEdit::RowColumnToPixels(const DisplayCoord &coord)
* @param p
* @return
*/
DisplayCoord SynEdit::bufferToDisplayPos(const BufferCoord &p)
DisplayCoord SynEdit::bufferToDisplayPos(const BufferCoord &p) const
{
DisplayCoord result {p.Char,p.Line};
// Account for tabs and charColumns
@ -490,7 +498,7 @@ DisplayCoord SynEdit::bufferToDisplayPos(const BufferCoord &p)
* @param p
* @return
*/
BufferCoord SynEdit::displayToBufferPos(const DisplayCoord &p)
BufferCoord SynEdit::displayToBufferPos(const DisplayCoord &p) const
{
BufferCoord Result{p.Column,p.Row};
// Account for code folding
@ -503,7 +511,7 @@ BufferCoord SynEdit::displayToBufferPos(const DisplayCoord &p)
return Result;
}
int SynEdit::leftSpaces(const QString &line)
int SynEdit::leftSpaces(const QString &line) const
{
int result = 0;
if (mOptions.testFlag(eoAutoIndent)) {
@ -520,7 +528,7 @@ int SynEdit::leftSpaces(const QString &line)
return result;
}
QString SynEdit::GetLeftSpacing(int charCount, bool wantTabs)
QString SynEdit::GetLeftSpacing(int charCount, bool wantTabs) const
{
if (wantTabs && !mOptions.testFlag(eoTabsToSpaces)) {
return QString(charCount / mTabWidth,'\t') + QString(charCount % mTabWidth,' ');
@ -529,7 +537,7 @@ QString SynEdit::GetLeftSpacing(int charCount, bool wantTabs)
}
}
int SynEdit::charToColumn(int aLine, int aChar)
int SynEdit::charToColumn(int aLine, int aChar) const
{
Q_ASSERT( (aLine <= mLines->count()) && (aLine >= 1));
if (aLine <= mLines->count()) {
@ -538,7 +546,7 @@ int SynEdit::charToColumn(int aLine, int aChar)
}
}
int SynEdit::charToColumn(const QString &s, int aChar)
int SynEdit::charToColumn(const QString &s, int aChar) const
{
int x = 0;
int len = std::min(aChar-1,s.length());
@ -551,7 +559,7 @@ int SynEdit::charToColumn(const QString &s, int aChar)
return x+1;
}
int SynEdit::columnToChar(int aLine, int aColumn)
int SynEdit::columnToChar(int aLine, int aColumn) const
{
Q_ASSERT( (aLine <= mLines->count()) && (aLine >= 1));
if (aLine <= mLines->count()) {
@ -572,7 +580,7 @@ int SynEdit::columnToChar(int aLine, int aColumn)
}
}
int SynEdit::stringColumns(const QString &line, int colsBefore)
int SynEdit::stringColumns(const QString &line, int colsBefore) const
{
int columns = colsBefore;
int charCols;
@ -588,7 +596,7 @@ int SynEdit::stringColumns(const QString &line, int colsBefore)
return columns-colsBefore;
}
int SynEdit::getLineIndent(const QString &line)
int SynEdit::getLineIndent(const QString &line) const
{
int indents = 0;
for (QChar ch:line) {
@ -606,7 +614,7 @@ int SynEdit::getLineIndent(const QString &line)
return indents;
}
int SynEdit::rowToLine(int aRow)
int SynEdit::rowToLine(int aRow) const
{
if (mUseCodeFolding)
return foldRowToLine(aRow);
@ -615,12 +623,12 @@ int SynEdit::rowToLine(int aRow)
//return displayToBufferPos({1, aRow}).Line;
}
int SynEdit::lineToRow(int aLine)
int SynEdit::lineToRow(int aLine) const
{
return bufferToDisplayPos({1, aLine}).Row;
}
int SynEdit::foldRowToLine(int Row)
int SynEdit::foldRowToLine(int Row) const
{
int result = Row;
for (int i=0;i<mAllFoldRanges.count();i++) {
@ -632,7 +640,7 @@ int SynEdit::foldRowToLine(int Row)
return result;
}
int SynEdit::foldLineToRow(int Line)
int SynEdit::foldLineToRow(int Line) const
{
int result = Line;
for (int i=mAllFoldRanges.count()-1;i>=0;i--) {
@ -762,7 +770,7 @@ void SynEdit::unlockPainter()
mPainterLock--;
}
bool SynEdit::selAvail()
bool SynEdit::selAvail() const
{
return (mBlockBegin.Char != mBlockEnd.Char) ||
((mBlockBegin.Line != mBlockEnd.Line) && (mActiveSelectionMode != SynSelectionMode::smColumn));
@ -845,7 +853,7 @@ BufferCoord SynEdit::GetPreviousLeftBracket(int x, int y)
}
}
int SynEdit::charColumns(QChar ch)
int SynEdit::charColumns(QChar ch) const
{
if (ch == ' ')
return 1;
@ -853,7 +861,7 @@ int SynEdit::charColumns(QChar ch)
return std::ceil((int)(fontMetrics().horizontalAdvance(ch)) / (double)mCharWidth);
}
double SynEdit::dpiFactor()
double SynEdit::dpiFactor() const
{
return fontMetrics().fontDpi() / 96.0;
}
@ -874,7 +882,7 @@ void SynEdit::hideCaret()
}
}
bool SynEdit::IsPointInSelection(const BufferCoord &Value)
bool SynEdit::IsPointInSelection(const BufferCoord &Value) const
{
BufferCoord ptBegin = blockBegin();
BufferCoord ptEnd = blockEnd();
@ -1037,11 +1045,12 @@ void SynEdit::SetSelWord()
void SynEdit::SetWordBlock(BufferCoord Value)
{
if (mOptions.testFlag(eoScrollPastEol))
Value.Char = MinMax(Value.Char, 1, mMaxScrollWidth + 1);
else
Value.Char = std::max(Value.Char, 1);
// if (mOptions.testFlag(eoScrollPastEol))
// Value.Char =
// else
// Value.Char = std::max(Value.Char, 1);
Value.Line = MinMax(Value.Line, 1, mLines->count());
Value.Char = std::max(Value.Char, 1);
QString TempString = mLines->getString(Value.Line - 1); //needed for CaretX = LineLength +1
if (Value.Char > TempString.length()) {
internalSetCaretXY(BufferCoord{TempString.length()+1, Value.Line});
@ -2198,10 +2207,7 @@ void SynEdit::updateScrollbars()
setVerticalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAlwaysOn);
}
if (mScrollBars == SynScrollStyle::ssBoth || mScrollBars == SynScrollStyle::ssHorizontal) {
if (mOptions.testFlag(eoScrollPastEol))
nMaxScroll = mLines->lengthOfLongestLine();
else
nMaxScroll = std::max(mLines->lengthOfLongestLine()-mCharsInWindow+1, 1);
nMaxScroll = maxScrollWidth();
if (nMaxScroll <= MAX_SCROLL) {
nMin = 1;
nMax = nMaxScroll;
@ -2222,11 +2228,7 @@ void SynEdit::updateScrollbars()
setHorizontalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAlwaysOn);
if (mScrollBars == SynScrollStyle::ssBoth || mScrollBars == SynScrollStyle::ssVertical) {
if (mOptions.testFlag(eoScrollPastEof))
nMaxScroll = std::max(displayLineCount(),1);
else
nMaxScroll = std::max(displayLineCount()-mLinesInWindow+1, 1);
nMaxScroll = maxScrollHeight();
if (nMaxScroll <= MAX_SCROLL) {
nMin = 1;
nMax = std::max(1, nMaxScroll);
@ -2767,7 +2769,7 @@ void SynEdit::paintCaret(QPainter &painter, const QRect rcClip)
}
}
int SynEdit::textOffset()
int SynEdit::textOffset() const
{
return mGutterWidth + 2 - (mLeftChar-1)*mCharWidth;
}
@ -2810,9 +2812,9 @@ void SynEdit::sizeOrFontChanged(bool bFont)
} else
updateScrollbars();
mStateFlags.setFlag(SynStateFlag::sfScrollbarChanged,false);
if (!mOptions.testFlag(SynEditorOption::eoScrollPastEol))
//if (!mOptions.testFlag(SynEditorOption::eoScrollPastEol))
setLeftChar(mLeftChar);
if (!mOptions.testFlag(SynEditorOption::eoScrollPastEof))
//if (!mOptions.testFlag(SynEditorOption::eoScrollPastEof))
setTopLine(mTopLine);
}
}
@ -2895,9 +2897,9 @@ void SynEdit::setOptions(const SynEditorOptions &Value)
{
if (Value != mOptions) {
bool bSetDrag = mOptions.testFlag(eoDropFiles) != Value.testFlag(eoDropFiles);
if (!mOptions.testFlag(eoScrollPastEol))
//if (!mOptions.testFlag(eoScrollPastEol))
setLeftChar(mLeftChar);
if (!mOptions.testFlag(eoScrollPastEof))
//if (!mOptions.testFlag(eoScrollPastEof))
setTopLine(mTopLine);
bool bUpdateAll = Value.testFlag(eoShowSpecialChars) != mOptions.testFlag(eoShowSpecialChars);
@ -3572,7 +3574,8 @@ void SynEdit::MoveCaretHorz(int DX, bool isSelection)
QString s = lineText();
int nLineLen = s.length();
// only moving or selecting one char can change the line
bool bChangeY = !mOptions.testFlag(SynEditorOption::eoScrollPastEol);
//bool bChangeY = !mOptions.testFlag(SynEditorOption::eoScrollPastEol);
bool bChangeY=true;
if (bChangeY && (DX == -1) && (ptO.Char == 1) && (ptO.Line > 1)) {
// end of previous line
ptDst.Line--;
@ -4824,19 +4827,12 @@ bool SynEdit::viewportEvent(QEvent * event)
return QAbstractScrollArea::viewportEvent(event);
}
int SynEdit::maxScrollWidth() const
int SynEdit::maxScrollHeight() const
{
return mMaxScrollWidth;
}
void SynEdit::setMaxScrollWidth(int Value)
{
Value = MinMax(Value, 1, INT_MAX - 1);
if (mMaxScrollWidth != Value) {
mMaxScrollWidth = Value;
if (mOptions.testFlag(SynEditorOption::eoScrollPastEol))
updateScrollbars();
}
if (mOptions.testFlag(eoScrollPastEof))
return std::max(displayLineCount(),1);
else
return std::max(displayLineCount()-mLinesInWindow+1, 1);
}
bool SynEdit::modified() const
@ -4903,7 +4899,7 @@ void SynEdit::linesChanged()
if (mGutter.showLineNumbers() && (mGutter.autoSize()))
mGutter.autoSizeDigitCount(mLines->count());
if (!mOptions.testFlag(SynEditorOption::eoScrollPastEof))
//if (!mOptions.testFlag(SynEditorOption::eoScrollPastEof))
setTopLine(mTopLine);
}
@ -5010,11 +5006,8 @@ void SynEdit::setBlockEnd(BufferCoord Value)
{
setActiveSelectionMode(mSelectionMode);
if (!mOptions.testFlag(eoNoSelection)) {
if (mOptions.testFlag(eoScrollPastEol))
Value.Char = MinMax(Value.Char, 1, mMaxScrollWidth + 1);
else
Value.Char = std::max(Value.Char, 1);
Value.Line = MinMax(Value.Line, 1, mLines->count());
Value.Char = MinMax(Value.Char, 1, mLines->lengthOfLongestLine()+1);
if (mActiveSelectionMode == SynSelectionMode::smNormal) {
if (Value.Line >= 1 && Value.Line <= mLines->count())
Value.Char = std::min(Value.Char, mLines->getString(Value.Line - 1).length() + 1);
@ -5102,10 +5095,7 @@ void SynEdit::setBlockBegin(BufferCoord value)
int nInval1, nInval2;
bool SelChanged;
setActiveSelectionMode(mSelectionMode);
if (mOptions.testFlag(SynEditorOption::eoScrollPastEol))
value.Char = MinMax(value.Char, 1, mMaxScrollWidth + 1);
else
value.Char = std::max(value.Char, 1);
value.Char = MinMax(value.Char, 1, mLines->lengthOfLongestLine()+1);
value.Line = MinMax(value.Line, 1, mLines->count());
if (mActiveSelectionMode == SynSelectionMode::smNormal) {
if (value.Line >= 1 && value.Line <= mLines->count())
@ -5143,14 +5133,9 @@ int SynEdit::leftChar() const
void SynEdit::setLeftChar(int Value)
{
int MaxVal;
//int MaxVal;
//QRect iTextArea;
MaxVal = mLines->lengthOfLongestLine();
if (mOptions.testFlag(SynEditorOption::eoScrollPastEol)) {
Value = std::min(Value,MaxVal);
} else {
Value = std::min(Value,MaxVal-mCharsInWindow+1);
}
Value = std::min(Value,maxScrollWidth());
if (Value != mLeftChar) {
horizontalScrollBar()->setValue(Value);
setStatusChanged(SynStatusChange::scLeftChar);
@ -5169,10 +5154,11 @@ int SynEdit::topLine() const
void SynEdit::setTopLine(int Value)
{
if (mOptions.testFlag(SynEditorOption::eoScrollPastEof))
Value = std::min(Value, displayLineCount());
else
Value = std::min(Value, displayLineCount() - mLinesInWindow + 1);
Value = std::min(Value,maxScrollHeight());
// if (mOptions.testFlag(SynEditorOption::eoScrollPastEof))
// Value = std::min(Value, displayLineCount());
// else
// Value = std::min(Value, displayLineCount() - mLinesInWindow + 1);
Value = std::max(Value, 1);
if (Value != mTopLine) {
verticalScrollBar()->setValue(Value);

View File

@ -66,33 +66,33 @@ 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 }
eoDragDropEditing = 0x00000008, //Allows you to select a block of text and drag it within the document to another location
eoDropFiles = 0x00000010, //Allows the editor accept OLE file drops
eoEnhanceHomeKey = 0x00000020, //enhances home key positioning, similar to visual studio
eoEnhanceEndKey = 0x00000040, //enhances End key positioning, similar to JDeveloper
eoGroupUndo = 0x00000080, //When undoing/redoing actions, handle all continous changes of the same kind in one call instead undoing/redoing each command separately
eoHalfPageScroll = 0x00000100, //When scrolling with page-up and page-down commands, only scroll a half page at a time
eoHideShowScrollbars =0x00000200, //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 = 0x00000400 , //When moving through lines w/o Cursor Past EOL, keeps the X position of the cursor
eoRightMouseMovesCursor= 0x00000800, //When clicking with the right mouse for a popup menu, move the cursor to that location
eoScrollByOneLess = 0x00001000, //Forces scrolling to be one less
eoScrollPastEof = 0x00002000, //Allows the cursor to go past the end of file marker
eoScrollPastEol = 0x00004000, //Allows the cursor to go past the last character into the white space at the end of a line
eoShowSpecialChars = 0x00008000, //Shows the special Characters
eoSpecialLineDefaultFg = 0x00010000, //disables the foreground text color override when using the OnSpecialLineColor event
eoTabIndent = 0x00020000, //When active <Tab> and <Shift><Tab> act as block indent, unindent when text is selected
eoTabsToSpaces = 0x00040000, //Converts a tab character to a specified number of space characters
eoShowRainbowColor = 0x00080000,
eoTrimTrailingSpaces =0x00100000, //Spaces at the end of lines will be trimmed and not saved
eoSelectWordByDblClick=0x00200000,
eoNoSelection = 0x00400000, //Disables selecting text
//eoAutoSizeMaxScrollWidth = 0x00000008, //Automatically resizes the MaxScrollWidth property when inserting text
//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
// 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
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,
eoTrimTrailingSpaces = 0x10000000, //Spaces at the end of lines will be trimmed and not saved
eoSelectWordByDblClick = 0x20000000
// eoNoCaret = 0x00000800, //Makes it so the caret is never visible
};
Q_DECLARE_FLAGS(SynEditorOptions, SynEditorOption)
@ -146,38 +146,38 @@ public:
* Returns how many rows are there in the editor
* @return
*/
int displayLineCount();
int displayLineCount() const;
/**
* @brief displayX
* @return
*/
DisplayCoord displayXY();
int displayX();
int displayY();
BufferCoord caretXY();
int caretX();
int caretY();
DisplayCoord displayXY() const;
int displayX() const;
int displayY() const;
BufferCoord caretXY() const;
int caretX() const;
int caretY() const;
void invalidateGutter();
void invalidateGutterLine(int aLine);
void invalidateGutterLines(int FirstLine, int LastLine);
DisplayCoord pixelsToNearestRowColumn(int aX, int aY);
DisplayCoord pixelsToRowColumn(int aX, int aY);
QPoint RowColumnToPixels(const DisplayCoord& coord);
DisplayCoord bufferToDisplayPos(const BufferCoord& p);
BufferCoord displayToBufferPos(const DisplayCoord& p);
int leftSpaces(const QString& line);
QString GetLeftSpacing(int charCount,bool wantTabs);
int charToColumn(int aLine, int aChar);
int charToColumn(const QString& s, int aChar);
int columnToChar(int aLine, int aColumn);
int stringColumns(const QString& line, int colsBefore);
int getLineIndent(const QString& line);
int rowToLine(int aRow);
int lineToRow(int aLine);
int foldRowToLine(int Row);
int foldLineToRow(int Line);
DisplayCoord pixelsToNearestRowColumn(int aX, int aY) const;
DisplayCoord pixelsToRowColumn(int aX, int aY) const;
QPoint RowColumnToPixels(const DisplayCoord& coord) const;
DisplayCoord bufferToDisplayPos(const BufferCoord& p) const;
BufferCoord displayToBufferPos(const DisplayCoord& p) const;
int leftSpaces(const QString& line) const;
QString GetLeftSpacing(int charCount,bool wantTabs) const;
int charToColumn(int aLine, int aChar) const;
int charToColumn(const QString& s, int aChar) const;
int columnToChar(int aLine, int aColumn) const;
int stringColumns(const QString& line, int colsBefore) const;
int getLineIndent(const QString& line) const;
int rowToLine(int aRow) const;
int lineToRow(int aLine) const;
int foldRowToLine(int Row) const;
int foldLineToRow(int Line) const;
void setDefaultKeystrokes();
void invalidateLine(int Line);
void invalidateLines(int FirstLine, int LastLine);
@ -186,11 +186,11 @@ public:
void invalidate();
void lockPainter();
void unlockPainter();
bool selAvail();
bool selAvail() const;
int charColumns(QChar ch);
double dpiFactor();
bool IsPointInSelection(const BufferCoord& Value);
int charColumns(QChar ch) const;
double dpiFactor() const;
bool IsPointInSelection(const BufferCoord& Value) const;
BufferCoord NextWordPos();
BufferCoord NextWordPosEx(const BufferCoord& XY);
BufferCoord WordStart();
@ -209,6 +209,9 @@ public:
void setCaretXYEx(bool CallEnsureCursorPos, BufferCoord value);
void setCaretXYCentered(bool ForceToMiddle, const BufferCoord& value);
int maxScrollWidth() const;
int maxScrollHeight() const;
bool GetHighlighterAttriAtRowCol(const BufferCoord& XY, QString& Token,
PSynHighlighterAttribute& Attri);
bool GetHighlighterAttriAtRowCol(const BufferCoord& XY, QString& Token,
@ -217,6 +220,7 @@ public:
bool GetHighlighterAttriAtRowColEx(const BufferCoord& XY, QString& Token,
SynHighlighterTokenType& TokenType, SynTokenKind &TokenKind, int &Start,
PSynHighlighterAttribute& Attri);
//Commands
void cutToClipboard() { CommandProcessor(SynEditorCommand::ecCut);}
void copyToClipboard() { CommandProcessor(SynEditorCommand::ecCopy);}
@ -255,9 +259,6 @@ public:
bool modified() const;
void setModified(bool Value);
int maxScrollWidth() const;
void setMaxScrollWidth(int Value);
int tabWidth() const;
PSynHighlighter highlighter() const;
@ -388,7 +389,7 @@ private:
PSynEditFoldRange checkFoldRange(SynEditFoldRanges* FoldRangeToCheck,int Line, bool WantCollapsed, bool AcceptFromLine, bool AcceptToLine);
PSynEditFoldRange foldEndAtLine(int Line);
void paintCaret(QPainter& painter, const QRect rcClip);
int textOffset();
int textOffset() const;
SynEditorCommand TranslateKeyCode(int key, Qt::KeyboardModifiers modifiers);
/**
* Move the caret to right DX columns
@ -505,7 +506,6 @@ private:
PSynEditUndoList mOrigRedoList;
int mLinesInWindow;
int mLeftChar;
int mMaxScrollWidth;
int mPaintLock; // lock counter for internal calculations
bool mReadOnly;
int mRightEdge;

View File

@ -11,7 +11,6 @@ const char ValueToChar[28] = {'0', '1', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
Settings* pSettings;
Settings::Settings(const QString &filename):
@ -190,16 +189,66 @@ void Settings::Editor::setCaretColor(const QColor &caretColor)
mCaretColor = caretColor;
}
bool Settings::Editor::Editor::keepCaretX() const
bool Settings::Editor::keepCaretX() const
{
return mKeepCaretX;
}
void Settings::Editor::Editor::setKeepCaretX(bool keepCaretX)
void Settings::Editor::setKeepCaretX(bool keepCaretX)
{
mKeepCaretX = keepCaretX;
}
bool Settings::Editor::halfPageScroll() const
{
return mHalfPageScroll;
}
void Settings::Editor::setHalfPageScroll(bool halfPageScroll)
{
mHalfPageScroll = halfPageScroll;
}
bool Settings::Editor::scrollByOneLess() const
{
return mScrollByOneLess;
}
void Settings::Editor::setScrollByOneLess(bool scrollByOneLess)
{
mScrollByOneLess = scrollByOneLess;
}
bool Settings::Editor::scrollPastEol() const
{
return mScrollPastEol;
}
void Settings::Editor::setScrollPastEol(bool scrollPastEol)
{
mScrollPastEol = scrollPastEol;
}
bool Settings::Editor::scrollPastEof() const
{
return mScrollPastEof;
}
void Settings::Editor::setScrollPastEof(bool scrollPastEof)
{
mScrollPastEof = scrollPastEof;
}
bool Settings::Editor::autoHideScrollbar() const
{
return mAutoHideScrollbar;
}
void Settings::Editor::setAutoHideScrollbar(bool autoHideScrollbar)
{
mAutoHideScrollbar = autoHideScrollbar;
}
void Settings::Editor::doSave()
{
saveValue("default_encoding",mDefaultEncoding);
@ -217,6 +266,13 @@ void Settings::Editor::doSave()
saveValue("caret_for_insert",static_cast<int>(mCaretForInsert));
saveValue("caret_for_overwrite",static_cast<int>(mCaretForOverwrite));
saveValue("caret_color",mCaretColor);
//scroll
saveValue("auto_hide_scroll_bar", mAutoHideScrollbar);
saveValue("scroll_past_eof", mScrollPastEof);
saveValue("scroll_past_eol", mScrollPastEol);
saveValue("scroll_by_one_less", mScrollByOneLess);
saveValue("half_page_scroll", mHalfPageScroll);
}
void Settings::Editor::doLoad()
@ -236,6 +292,13 @@ void Settings::Editor::doLoad()
mCaretForInsert = static_cast<SynEditCaretType>( intValue("caret_for_insert",static_cast<int>(SynEditCaretType::ctVerticalLine)));
mCaretForOverwrite = static_cast<SynEditCaretType>( intValue("caret_for_overwrite",static_cast<int>(SynEditCaretType::ctBlock)));
mCaretColor = colorValue("caret_color",QColorConstants::Svg::black);
//scroll
mAutoHideScrollbar = boolValue("auto_hide_scroll_bar", false);
mScrollPastEof = boolValue("scroll_past_eof", true);
mScrollPastEol = boolValue("scroll_past_eol", true);
mScrollByOneLess = boolValue("scroll_by_one_less", false);
mHalfPageScroll = boolValue("half_page_scroll",false);
}
SynEditCaretType Settings::Editor::caretForOverwrite() const

View File

@ -118,6 +118,21 @@ public:
bool keepCaretX() const;
void setKeepCaretX(bool keepCaretX);
bool autoHideScrollbar() const;
void setAutoHideScrollbar(bool autoHideScrollbar);
bool scrollPastEof() const;
void setScrollPastEof(bool scrollPastEof);
bool scrollPastEol() const;
void setScrollPastEol(bool scrollPastEol);
bool scrollByOneLess() const;
void setScrollByOneLess(bool scrollByOneLess);
bool halfPageScroll() const;
void setHalfPageScroll(bool halfPageScroll);
private:
QByteArray mDefaultEncoding;
// indents
@ -134,6 +149,12 @@ public:
SynEditCaretType mCaretForInsert;
SynEditCaretType mCaretForOverwrite;
QColor mCaretColor;
//scroll
bool mAutoHideScrollbar;
bool mScrollPastEof;
bool mScrollPastEol;
bool mScrollByOneLess;
bool mHalfPageScroll;
// _Base interface
protected:

View File

@ -0,0 +1,43 @@
#include "editorfontwidget.h"
#include "ui_editorfontwidget.h"
EditorFontWidget::EditorFontWidget(const QString& name, const QString& group, QWidget *parent) :
SettingsWidget(name,group,parent),
ui(new Ui::EditorFontWidget)
{
ui->setupUi(this);
}
EditorFontWidget::~EditorFontWidget()
{
delete ui;
}
void EditorFontWidget::on_chkOnlyMonospacedFonts_stateChanged(int)
{
if (ui->chkOnlyMonospacedFonts->isChecked()) {
ui->cbFont->setFontFilters(QFontComboBox::FontFilter::MonospacedFonts);
} else {
ui->cbFont->setFontFilters(QFontComboBox::FontFilter::AllFonts);
}
}
void EditorFontWidget::on_chkGutterOnlyMonospacedFonts_stateChanged(int)
{
if (ui->chkGutterOnlyMonospacedFonts->isChecked()) {
ui->cbGutterFont->setFontFilters(QFontComboBox::FontFilter::MonospacedFonts);
} else {
ui->cbGutterFont->setFontFilters(QFontComboBox::FontFilter::AllFonts);
}
}
void EditorFontWidget::doLoad()
{
}
void EditorFontWidget::doSave()
{
}

View File

@ -0,0 +1,33 @@
#ifndef EDITORFONTWIDGET_H
#define EDITORFONTWIDGET_H
#include <QWidget>
#include "settingswidget.h"
namespace Ui {
class EditorFontWidget;
}
class EditorFontWidget : public SettingsWidget
{
Q_OBJECT
public:
explicit EditorFontWidget(const QString& name, const QString& group, QWidget *parent = nullptr);
~EditorFontWidget();
private slots:
void on_chkOnlyMonospacedFonts_stateChanged(int arg1);
void on_chkGutterOnlyMonospacedFonts_stateChanged(int arg1);
private:
Ui::EditorFontWidget *ui;
// SettingsWidget interface
protected:
void doLoad() override;
void doSave() override;
};
#endif // EDITORFONTWIDGET_H

View File

@ -0,0 +1,379 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EditorFontWidget</class>
<widget class="QWidget" name="EditorFontWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>737</width>
<height>569</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QWidget" name="widget" native="true">
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>11</number>
</property>
<property name="rightMargin">
<number>11</number>
</property>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Size:</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QWidget" name="widget_3" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QSpinBox" name="spinFontSize">
<property name="minimum">
<number>2</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Font:</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QWidget" name="widget_2" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QFontComboBox" name="cbFont">
<property name="editable">
<bool>false</bool>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContentsOnFirstShow</enum>
</property>
<property name="fontFilters">
<set>QFontComboBox::AllFonts</set>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkOnlyMonospacedFonts">
<property name="text">
<string>Show only monospaced fonts</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Gutter</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QCheckBox" name="chkGutterVisible">
<property name="text">
<string>Gutter is visible</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkAutoSizeGutter">
<property name="text">
<string>Auto size the gutter</string>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="widget_4" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>base width</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinGutterBaseWidth">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>999</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="grpGutterShowLineNumbers">
<property name="title">
<string>Show Line Numbers</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QCheckBox" name="chkAddLeadingZeros">
<property name="text">
<string>Add leading zeros to line numbers</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkLineNumbersStartsZero">
<property name="text">
<string>Line numbers starts at zero</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="grpUseCustomFont">
<property name="title">
<string>Use Custom Font</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Font:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Size:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QWidget" name="widget_6" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QSpinBox" name="spinGutterFontSize">
<property name="minimum">
<number>2</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<widget class="QWidget" name="widget_5" native="true">
<layout class="QGridLayout" name="gridLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="3">
<widget class="QWidget" name="widget_7" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QFontComboBox" name="cbGutterFont">
<property name="editable">
<bool>false</bool>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContentsOnFirstShow</enum>
</property>
<property name="fontFilters">
<set>QFontComboBox::AllFonts</set>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkGutterOnlyMonospacedFonts">
<property name="text">
<string>Show only monospaced fonts</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -51,6 +51,12 @@ void EditorGeneralWidget::doLoad()
setCaretTypeIndex(ui->cbCaretForInsert,pSettings->editor().caretForInsert());
setCaretTypeIndex(ui->cbCaretForOverwrite,pSettings->editor().caretForOverwrite());
ui->colorCaret->setColor(pSettings->editor().caretColor());
//scrolls;
ui->chkAutoHideScrollBars->setChecked(pSettings->editor().autoHideScrollbar());
ui->chkScrollPastEOF->setChecked(pSettings->editor().scrollPastEof());
ui->chkScrollPastEOL->setChecked(pSettings->editor().scrollPastEol());
ui->chkScrollHalfPage->setChecked(pSettings->editor().halfPageScroll());
ui->chkScrollByOneLess->setChecked(pSettings->editor().scrollByOneLess());
}
void EditorGeneralWidget::doSave()
@ -69,6 +75,12 @@ void EditorGeneralWidget::doSave()
pSettings->editor().setCaretForInsert(getCaretTypeIndex(ui->cbCaretForInsert));
pSettings->editor().setCaretForOverwrite(getCaretTypeIndex(ui->cbCaretForOverwrite));
pSettings->editor().setCaretColor(ui->colorCaret->color());
//scrolls;
pSettings->editor().setAutoHideScrollbar(ui->chkAutoHideScrollBars->isChecked());
pSettings->editor().setScrollPastEof(ui->chkScrollPastEOF->isChecked());
pSettings->editor().setScrollPastEol(ui->chkScrollPastEOL->isChecked());
pSettings->editor().setScrollByOneLess(ui->chkScrollByOneLess->isChecked());
pSettings->editor().setHalfPageScroll(ui->chkScrollHalfPage->isChecked());
pSettings->editor().save();
pMainWindow->updateEditorSettings();

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>721</width>
<height>636</height>
<height>691</height>
</rect>
</property>
<property name="windowTitle">
@ -165,7 +165,24 @@
<property name="spacing">
<number>7</number>
</property>
<item row="2" column="2">
<item row="1" column="0">
<widget class="QLabel" name="lbCaretForOverwrite">
<property name="text">
<string>Caret for overwriting mode</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="cbCaretForInsert"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lbCaretForInsert">
<property name="text">
<string>Caret for inserting mode</string>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -178,7 +195,14 @@
</property>
</spacer>
</item>
<item row="4" column="1">
<item row="2" column="0">
<widget class="QLabel" name="lbCaretColor">
<property name="text">
<string>Caret Color</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="ColorEdit" name="colorCaret">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
@ -188,47 +212,9 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="chkCaretPastEol">
<property name="text">
<string>Caret can be positioned past end of line</string>
</property>
</widget>
</item>
<item row="3" column="1">
<item row="1" column="1">
<widget class="QComboBox" name="cbCaretForOverwrite"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lbCaretForInsert">
<property name="text">
<string>Caret for inserting mode</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="cbCaretForInsert"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="lbCaretForOverwrite">
<property name="text">
<string>Caret for overwriting mode</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="lbCaretColor">
<property name="text">
<string>Caret Color</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="chkCaretPastEof">
<property name="text">
<string>Caret can be positioned past end of file</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -240,6 +226,43 @@
<property name="title">
<string>Scroll</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QCheckBox" name="chkAutoHideScrollBars">
<property name="text">
<string>Auto hide scroll bars</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkScrollPastEOL">
<property name="text">
<string>Can scroll the last char to the left edge of the editor</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkScrollPastEOF">
<property name="text">
<string>Can scroll the last line to the top edge of the editor</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkScrollHalfPage">
<property name="text">
<string>Page Up/Down scrolls half a page</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkScrollByOneLess">
<property name="text">
<string>Forces page scroll to be one line less</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>

View File

@ -3,6 +3,7 @@
#include "settingswidget.h"
#include "compilersetoptionwidget.h"
#include "editorgeneralwidget.h"
#include "editorfontwidget.h"
#include <QDebug>
#include <QMessageBox>
@ -25,6 +26,10 @@ SettingsDialog::SettingsDialog(QWidget *parent) :
pEditorGeneralWidget = new EditorGeneralWidget(tr("General"),tr("Editor"));
pEditorGeneralWidget->init();
addWidget(pEditorGeneralWidget);
pEditorFontWidget = new EditorFontWidget(tr("Font"),tr("Editor"));
pEditorFontWidget->init();
addWidget(pEditorFontWidget);
}
SettingsDialog::~SettingsDialog()

View File

@ -12,6 +12,7 @@ class SettingsDialog;
class CompilerSetOptionWidget;
class EditorGeneralWidget;
class EditorFontWidget;
class PCompilerSet;
class SettingsWidget;
class SettingsDialog : public QDialog
@ -44,6 +45,7 @@ private:
CompilerSetOptionWidget* pCompilerSetOptionWidget;
EditorGeneralWidget* pEditorGeneralWidget;
EditorFontWidget* pEditorFontWidget;
};
#endif // SETTINGSDIALOG_H