* refactor: remove mMaxScrollWidth variable from qsynedit/CodeFolding.cpp
* add: editor font options form
This commit is contained in:
parent
a0d142f6df
commit
229148c309
|
@ -32,6 +32,7 @@ SOURCES += \
|
||||||
settingsdialog/compilersetdirectorieswidget.cpp \
|
settingsdialog/compilersetdirectorieswidget.cpp \
|
||||||
settingsdialog/compilersetoptionwidget.cpp \
|
settingsdialog/compilersetoptionwidget.cpp \
|
||||||
settings.cpp \
|
settings.cpp \
|
||||||
|
settingsdialog/editorfontwidget.cpp \
|
||||||
settingsdialog/editorgeneralwidget.cpp \
|
settingsdialog/editorgeneralwidget.cpp \
|
||||||
settingsdialog/settingsdialog.cpp \
|
settingsdialog/settingsdialog.cpp \
|
||||||
settingsdialog/settingswidget.cpp \
|
settingsdialog/settingswidget.cpp \
|
||||||
|
@ -64,6 +65,7 @@ HEADERS += \
|
||||||
settingsdialog/compilersetdirectorieswidget.h \
|
settingsdialog/compilersetdirectorieswidget.h \
|
||||||
settingsdialog/compilersetoptionwidget.h \
|
settingsdialog/compilersetoptionwidget.h \
|
||||||
settings.h \
|
settings.h \
|
||||||
|
settingsdialog/editorfontwidget.h \
|
||||||
settingsdialog/editorgeneralwidget.h \
|
settingsdialog/editorgeneralwidget.h \
|
||||||
settingsdialog/settingsdialog.h \
|
settingsdialog/settingsdialog.h \
|
||||||
settingsdialog/settingswidget.h \
|
settingsdialog/settingswidget.h \
|
||||||
|
@ -77,6 +79,7 @@ FORMS += \
|
||||||
mainwindow.ui \
|
mainwindow.ui \
|
||||||
settingsdialog/compilersetdirectorieswidget.ui \
|
settingsdialog/compilersetdirectorieswidget.ui \
|
||||||
settingsdialog/compilersetoptionwidget.ui \
|
settingsdialog/compilersetoptionwidget.ui \
|
||||||
|
settingsdialog/editorfontwidget.ui \
|
||||||
settingsdialog/editorgeneralwidget.ui \
|
settingsdialog/editorgeneralwidget.ui \
|
||||||
settingsdialog/settingsdialog.ui
|
settingsdialog/settingsdialog.ui
|
||||||
|
|
||||||
|
|
|
@ -267,10 +267,14 @@ void Editor::applySettings()
|
||||||
options.setFlag(eoEnhanceHomeKey,pSettings->editor().enhanceHomeKey());
|
options.setFlag(eoEnhanceHomeKey,pSettings->editor().enhanceHomeKey());
|
||||||
options.setFlag(eoEnhanceEndKey,pSettings->editor().enhanceEndKey());
|
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);
|
setOptions(options);
|
||||||
|
|
||||||
setTabWidth(pSettings->editor().tabWidth());
|
setTabWidth(pSettings->editor().tabWidth());
|
||||||
|
|
||||||
setInsertCaret(pSettings->editor().caretForInsert());
|
setInsertCaret(pSettings->editor().caretForInsert());
|
||||||
setOverwriteCaret(pSettings->editor().caretForOverwrite());
|
setOverwriteCaret(pSettings->editor().caretForOverwrite());
|
||||||
setCaretColor(pSettings->editor().caretColor());
|
setCaretColor(pSettings->editor().caretColor());
|
||||||
|
|
|
@ -75,7 +75,7 @@ void SynEditFoldRanges::clear()
|
||||||
mRanges.clear();
|
mRanges.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynEditFoldRanges::count()
|
int SynEditFoldRanges::count() const
|
||||||
{
|
{
|
||||||
return mRanges.size();
|
return mRanges.size();
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ void SynEditFoldRanges::add(PSynEditFoldRange foldRange)
|
||||||
mRanges.push_back(foldRange);
|
mRanges.push_back(foldRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
PSynEditFoldRange SynEditFoldRanges::operator[](int index)
|
PSynEditFoldRange SynEditFoldRanges::operator[](int index) const
|
||||||
{
|
{
|
||||||
return mRanges[index];
|
return mRanges[index];
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ private:
|
||||||
public:
|
public:
|
||||||
PSynEditFoldRange range(int index);
|
PSynEditFoldRange range(int index);
|
||||||
void clear();
|
void clear();
|
||||||
int count();
|
int count() const;
|
||||||
SynEditFoldRanges();
|
SynEditFoldRanges();
|
||||||
PSynEditFoldRange addByParts(PSynEditFoldRange aParent, PSynEditFoldRanges aAllFold,
|
PSynEditFoldRange addByParts(PSynEditFoldRange aParent, PSynEditFoldRanges aAllFold,
|
||||||
int aFromLine, PSynEditFoldRegion aFoldRegion, int aToLine);
|
int aFromLine, PSynEditFoldRegion aFoldRegion, int aToLine);
|
||||||
|
@ -56,7 +56,7 @@ public:
|
||||||
void insert(int index, PSynEditFoldRange range);
|
void insert(int index, PSynEditFoldRange range);
|
||||||
int remove(int index);
|
int remove(int index);
|
||||||
void add(PSynEditFoldRange foldRange);
|
void add(PSynEditFoldRange foldRange);
|
||||||
PSynEditFoldRange operator[](int index);
|
PSynEditFoldRange operator[](int index) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
// A single fold
|
// A single fold
|
||||||
|
|
|
@ -75,7 +75,6 @@ SynEdit::SynEdit(QWidget *parent) : QAbstractScrollArea(parent)
|
||||||
this->setCursor(Qt::CursorShape::IBeamCursor);
|
this->setCursor(Qt::CursorShape::IBeamCursor);
|
||||||
//TabStop := True;
|
//TabStop := True;
|
||||||
mInserting = true;
|
mInserting = true;
|
||||||
mMaxScrollWidth = 1024;
|
|
||||||
mScrollBars = SynScrollStyle::ssBoth;
|
mScrollBars = SynScrollStyle::ssBoth;
|
||||||
mExtraLineSpacing = 0;
|
mExtraLineSpacing = 0;
|
||||||
qDebug()<<"init SynEdit: 6";
|
qDebug()<<"init SynEdit: 6";
|
||||||
|
@ -150,7 +149,7 @@ SynEdit::SynEdit(QWidget *parent) : QAbstractScrollArea(parent)
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynEdit::displayLineCount()
|
int SynEdit::displayLineCount() const
|
||||||
{
|
{
|
||||||
if (mLines->empty()) {
|
if (mLines->empty()) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -158,22 +157,22 @@ int SynEdit::displayLineCount()
|
||||||
return lineToRow(mLines->count());
|
return lineToRow(mLines->count());
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplayCoord SynEdit::displayXY()
|
DisplayCoord SynEdit::displayXY() const
|
||||||
{
|
{
|
||||||
return bufferToDisplayPos(caretXY());
|
return bufferToDisplayPos(caretXY());
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynEdit::displayX()
|
int SynEdit::displayX() const
|
||||||
{
|
{
|
||||||
return displayXY().Column;
|
return displayXY().Column;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynEdit::displayY()
|
int SynEdit::displayY() const
|
||||||
{
|
{
|
||||||
return displayXY().Row;
|
return displayXY().Row;
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferCoord SynEdit::caretXY()
|
BufferCoord SynEdit::caretXY() const
|
||||||
{
|
{
|
||||||
BufferCoord result;
|
BufferCoord result;
|
||||||
result.Char = caretX();
|
result.Char = caretX();
|
||||||
|
@ -181,12 +180,12 @@ BufferCoord SynEdit::caretXY()
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynEdit::caretX()
|
int SynEdit::caretX() const
|
||||||
{
|
{
|
||||||
return mCaretX;
|
return mCaretX;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynEdit::caretY()
|
int SynEdit::caretY() const
|
||||||
{
|
{
|
||||||
return mCaretY;
|
return mCaretY;
|
||||||
}
|
}
|
||||||
|
@ -213,7 +212,7 @@ void SynEdit::setCaretXYEx(bool CallEnsureCursorPos, BufferCoord value)
|
||||||
|
|
||||||
if (vTriggerPaint)
|
if (vTriggerPaint)
|
||||||
doOnPaintTransient(SynTransientType::ttBefore);
|
doOnPaintTransient(SynTransientType::ttBefore);
|
||||||
int nMaxX = mMaxScrollWidth + 1;
|
int nMaxX;
|
||||||
if (value.Line > mLines->count())
|
if (value.Line > mLines->count())
|
||||||
value.Line = mLines->count();
|
value.Line = mLines->count();
|
||||||
if (value.Line < 1) {
|
if (value.Line < 1) {
|
||||||
|
@ -223,13 +222,14 @@ void SynEdit::setCaretXYEx(bool CallEnsureCursorPos, BufferCoord value)
|
||||||
nMaxX = 1;
|
nMaxX = 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!mOptions.testFlag(SynEditorOption::eoScrollPastEol))
|
|
||||||
nMaxX = mLines->getString(value.Line-1).length()+1;
|
nMaxX = mLines->getString(value.Line-1).length()+1;
|
||||||
}
|
}
|
||||||
if ((value.Char > nMaxX) && (! (mOptions.testFlag(SynEditorOption::eoScrollPastEol)) ) )
|
value.Char = std::min(value.Char,nMaxX);
|
||||||
value.Char = nMaxX;
|
value.Char = std::max(value.Char,1);
|
||||||
if (value.Char < 1)
|
// if ((value.Char > nMaxX) && (! (mOptions.testFlag(SynEditorOption::eoScrollPastEol)) ) )
|
||||||
value.Char = 1;
|
// value.Char = nMaxX;
|
||||||
|
// if (value.Char < 1)
|
||||||
|
// value.Char = 1;
|
||||||
if ((value.Char != mCaretX) || (value.Line != mCaretY)) {
|
if ((value.Char != mCaretX) || (value.Line != mCaretY)) {
|
||||||
incPaintLock();
|
incPaintLock();
|
||||||
auto action = finally([this]{
|
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)
|
bool SynEdit::GetHighlighterAttriAtRowCol(const BufferCoord &XY, QString &Token, PSynHighlighterAttribute &Attri)
|
||||||
{
|
{
|
||||||
SynHighlighterTokenType TmpType;
|
SynHighlighterTokenType TmpType;
|
||||||
|
@ -434,7 +442,7 @@ void SynEdit::invalidateGutterLines(int FirstLine, int LastLine)
|
||||||
* @param aY
|
* @param aY
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
DisplayCoord SynEdit::pixelsToNearestRowColumn(int aX, int aY)
|
DisplayCoord SynEdit::pixelsToNearestRowColumn(int aX, int aY) const
|
||||||
{
|
{
|
||||||
// Result is in display coordinates
|
// Result is in display coordinates
|
||||||
float f;
|
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 {
|
return {
|
||||||
.Column = std::max(1, mLeftChar + ((aX - mGutterWidth - 2) / mCharWidth)),
|
.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;
|
QPoint result;
|
||||||
result.setX((coord.Column - 1) * mCharWidth + textOffset());
|
result.setX((coord.Column - 1) * mCharWidth + textOffset());
|
||||||
|
@ -473,7 +481,7 @@ QPoint SynEdit::RowColumnToPixels(const DisplayCoord &coord)
|
||||||
* @param p
|
* @param p
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
DisplayCoord SynEdit::bufferToDisplayPos(const BufferCoord &p)
|
DisplayCoord SynEdit::bufferToDisplayPos(const BufferCoord &p) const
|
||||||
{
|
{
|
||||||
DisplayCoord result {p.Char,p.Line};
|
DisplayCoord result {p.Char,p.Line};
|
||||||
// Account for tabs and charColumns
|
// Account for tabs and charColumns
|
||||||
|
@ -490,7 +498,7 @@ DisplayCoord SynEdit::bufferToDisplayPos(const BufferCoord &p)
|
||||||
* @param p
|
* @param p
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
BufferCoord SynEdit::displayToBufferPos(const DisplayCoord &p)
|
BufferCoord SynEdit::displayToBufferPos(const DisplayCoord &p) const
|
||||||
{
|
{
|
||||||
BufferCoord Result{p.Column,p.Row};
|
BufferCoord Result{p.Column,p.Row};
|
||||||
// Account for code folding
|
// Account for code folding
|
||||||
|
@ -503,7 +511,7 @@ BufferCoord SynEdit::displayToBufferPos(const DisplayCoord &p)
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynEdit::leftSpaces(const QString &line)
|
int SynEdit::leftSpaces(const QString &line) const
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
if (mOptions.testFlag(eoAutoIndent)) {
|
if (mOptions.testFlag(eoAutoIndent)) {
|
||||||
|
@ -520,7 +528,7 @@ int SynEdit::leftSpaces(const QString &line)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SynEdit::GetLeftSpacing(int charCount, bool wantTabs)
|
QString SynEdit::GetLeftSpacing(int charCount, bool wantTabs) const
|
||||||
{
|
{
|
||||||
if (wantTabs && !mOptions.testFlag(eoTabsToSpaces)) {
|
if (wantTabs && !mOptions.testFlag(eoTabsToSpaces)) {
|
||||||
return QString(charCount / mTabWidth,'\t') + QString(charCount % mTabWidth,' ');
|
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));
|
Q_ASSERT( (aLine <= mLines->count()) && (aLine >= 1));
|
||||||
if (aLine <= mLines->count()) {
|
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 x = 0;
|
||||||
int len = std::min(aChar-1,s.length());
|
int len = std::min(aChar-1,s.length());
|
||||||
|
@ -551,7 +559,7 @@ int SynEdit::charToColumn(const QString &s, int aChar)
|
||||||
return x+1;
|
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));
|
Q_ASSERT( (aLine <= mLines->count()) && (aLine >= 1));
|
||||||
if (aLine <= mLines->count()) {
|
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 columns = colsBefore;
|
||||||
int charCols;
|
int charCols;
|
||||||
|
@ -588,7 +596,7 @@ int SynEdit::stringColumns(const QString &line, int colsBefore)
|
||||||
return columns-colsBefore;
|
return columns-colsBefore;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynEdit::getLineIndent(const QString &line)
|
int SynEdit::getLineIndent(const QString &line) const
|
||||||
{
|
{
|
||||||
int indents = 0;
|
int indents = 0;
|
||||||
for (QChar ch:line) {
|
for (QChar ch:line) {
|
||||||
|
@ -606,7 +614,7 @@ int SynEdit::getLineIndent(const QString &line)
|
||||||
return indents;
|
return indents;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynEdit::rowToLine(int aRow)
|
int SynEdit::rowToLine(int aRow) const
|
||||||
{
|
{
|
||||||
if (mUseCodeFolding)
|
if (mUseCodeFolding)
|
||||||
return foldRowToLine(aRow);
|
return foldRowToLine(aRow);
|
||||||
|
@ -615,12 +623,12 @@ int SynEdit::rowToLine(int aRow)
|
||||||
//return displayToBufferPos({1, aRow}).Line;
|
//return displayToBufferPos({1, aRow}).Line;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynEdit::lineToRow(int aLine)
|
int SynEdit::lineToRow(int aLine) const
|
||||||
{
|
{
|
||||||
return bufferToDisplayPos({1, aLine}).Row;
|
return bufferToDisplayPos({1, aLine}).Row;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynEdit::foldRowToLine(int Row)
|
int SynEdit::foldRowToLine(int Row) const
|
||||||
{
|
{
|
||||||
int result = Row;
|
int result = Row;
|
||||||
for (int i=0;i<mAllFoldRanges.count();i++) {
|
for (int i=0;i<mAllFoldRanges.count();i++) {
|
||||||
|
@ -632,7 +640,7 @@ int SynEdit::foldRowToLine(int Row)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynEdit::foldLineToRow(int Line)
|
int SynEdit::foldLineToRow(int Line) const
|
||||||
{
|
{
|
||||||
int result = Line;
|
int result = Line;
|
||||||
for (int i=mAllFoldRanges.count()-1;i>=0;i--) {
|
for (int i=mAllFoldRanges.count()-1;i>=0;i--) {
|
||||||
|
@ -762,7 +770,7 @@ void SynEdit::unlockPainter()
|
||||||
mPainterLock--;
|
mPainterLock--;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SynEdit::selAvail()
|
bool SynEdit::selAvail() const
|
||||||
{
|
{
|
||||||
return (mBlockBegin.Char != mBlockEnd.Char) ||
|
return (mBlockBegin.Char != mBlockEnd.Char) ||
|
||||||
((mBlockBegin.Line != mBlockEnd.Line) && (mActiveSelectionMode != SynSelectionMode::smColumn));
|
((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 == ' ')
|
if (ch == ' ')
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -853,7 +861,7 @@ int SynEdit::charColumns(QChar ch)
|
||||||
return std::ceil((int)(fontMetrics().horizontalAdvance(ch)) / (double)mCharWidth);
|
return std::ceil((int)(fontMetrics().horizontalAdvance(ch)) / (double)mCharWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
double SynEdit::dpiFactor()
|
double SynEdit::dpiFactor() const
|
||||||
{
|
{
|
||||||
return fontMetrics().fontDpi() / 96.0;
|
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 ptBegin = blockBegin();
|
||||||
BufferCoord ptEnd = blockEnd();
|
BufferCoord ptEnd = blockEnd();
|
||||||
|
@ -1037,11 +1045,12 @@ void SynEdit::SetSelWord()
|
||||||
|
|
||||||
void SynEdit::SetWordBlock(BufferCoord Value)
|
void SynEdit::SetWordBlock(BufferCoord Value)
|
||||||
{
|
{
|
||||||
if (mOptions.testFlag(eoScrollPastEol))
|
// if (mOptions.testFlag(eoScrollPastEol))
|
||||||
Value.Char = MinMax(Value.Char, 1, mMaxScrollWidth + 1);
|
// Value.Char =
|
||||||
else
|
// else
|
||||||
Value.Char = std::max(Value.Char, 1);
|
// Value.Char = std::max(Value.Char, 1);
|
||||||
Value.Line = MinMax(Value.Line, 1, mLines->count());
|
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
|
QString TempString = mLines->getString(Value.Line - 1); //needed for CaretX = LineLength +1
|
||||||
if (Value.Char > TempString.length()) {
|
if (Value.Char > TempString.length()) {
|
||||||
internalSetCaretXY(BufferCoord{TempString.length()+1, Value.Line});
|
internalSetCaretXY(BufferCoord{TempString.length()+1, Value.Line});
|
||||||
|
@ -2198,10 +2207,7 @@ void SynEdit::updateScrollbars()
|
||||||
setVerticalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAlwaysOn);
|
setVerticalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAlwaysOn);
|
||||||
}
|
}
|
||||||
if (mScrollBars == SynScrollStyle::ssBoth || mScrollBars == SynScrollStyle::ssHorizontal) {
|
if (mScrollBars == SynScrollStyle::ssBoth || mScrollBars == SynScrollStyle::ssHorizontal) {
|
||||||
if (mOptions.testFlag(eoScrollPastEol))
|
nMaxScroll = maxScrollWidth();
|
||||||
nMaxScroll = mLines->lengthOfLongestLine();
|
|
||||||
else
|
|
||||||
nMaxScroll = std::max(mLines->lengthOfLongestLine()-mCharsInWindow+1, 1);
|
|
||||||
if (nMaxScroll <= MAX_SCROLL) {
|
if (nMaxScroll <= MAX_SCROLL) {
|
||||||
nMin = 1;
|
nMin = 1;
|
||||||
nMax = nMaxScroll;
|
nMax = nMaxScroll;
|
||||||
|
@ -2222,11 +2228,7 @@ void SynEdit::updateScrollbars()
|
||||||
setHorizontalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAlwaysOn);
|
setHorizontalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAlwaysOn);
|
||||||
|
|
||||||
if (mScrollBars == SynScrollStyle::ssBoth || mScrollBars == SynScrollStyle::ssVertical) {
|
if (mScrollBars == SynScrollStyle::ssBoth || mScrollBars == SynScrollStyle::ssVertical) {
|
||||||
if (mOptions.testFlag(eoScrollPastEof))
|
nMaxScroll = maxScrollHeight();
|
||||||
nMaxScroll = std::max(displayLineCount(),1);
|
|
||||||
else
|
|
||||||
nMaxScroll = std::max(displayLineCount()-mLinesInWindow+1, 1);
|
|
||||||
|
|
||||||
if (nMaxScroll <= MAX_SCROLL) {
|
if (nMaxScroll <= MAX_SCROLL) {
|
||||||
nMin = 1;
|
nMin = 1;
|
||||||
nMax = std::max(1, nMaxScroll);
|
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;
|
return mGutterWidth + 2 - (mLeftChar-1)*mCharWidth;
|
||||||
}
|
}
|
||||||
|
@ -2810,9 +2812,9 @@ void SynEdit::sizeOrFontChanged(bool bFont)
|
||||||
} else
|
} else
|
||||||
updateScrollbars();
|
updateScrollbars();
|
||||||
mStateFlags.setFlag(SynStateFlag::sfScrollbarChanged,false);
|
mStateFlags.setFlag(SynStateFlag::sfScrollbarChanged,false);
|
||||||
if (!mOptions.testFlag(SynEditorOption::eoScrollPastEol))
|
//if (!mOptions.testFlag(SynEditorOption::eoScrollPastEol))
|
||||||
setLeftChar(mLeftChar);
|
setLeftChar(mLeftChar);
|
||||||
if (!mOptions.testFlag(SynEditorOption::eoScrollPastEof))
|
//if (!mOptions.testFlag(SynEditorOption::eoScrollPastEof))
|
||||||
setTopLine(mTopLine);
|
setTopLine(mTopLine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2895,9 +2897,9 @@ void SynEdit::setOptions(const SynEditorOptions &Value)
|
||||||
{
|
{
|
||||||
if (Value != mOptions) {
|
if (Value != mOptions) {
|
||||||
bool bSetDrag = mOptions.testFlag(eoDropFiles) != Value.testFlag(eoDropFiles);
|
bool bSetDrag = mOptions.testFlag(eoDropFiles) != Value.testFlag(eoDropFiles);
|
||||||
if (!mOptions.testFlag(eoScrollPastEol))
|
//if (!mOptions.testFlag(eoScrollPastEol))
|
||||||
setLeftChar(mLeftChar);
|
setLeftChar(mLeftChar);
|
||||||
if (!mOptions.testFlag(eoScrollPastEof))
|
//if (!mOptions.testFlag(eoScrollPastEof))
|
||||||
setTopLine(mTopLine);
|
setTopLine(mTopLine);
|
||||||
|
|
||||||
bool bUpdateAll = Value.testFlag(eoShowSpecialChars) != mOptions.testFlag(eoShowSpecialChars);
|
bool bUpdateAll = Value.testFlag(eoShowSpecialChars) != mOptions.testFlag(eoShowSpecialChars);
|
||||||
|
@ -3572,7 +3574,8 @@ void SynEdit::MoveCaretHorz(int DX, bool isSelection)
|
||||||
QString s = lineText();
|
QString s = lineText();
|
||||||
int nLineLen = s.length();
|
int nLineLen = s.length();
|
||||||
// only moving or selecting one char can change the line
|
// 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)) {
|
if (bChangeY && (DX == -1) && (ptO.Char == 1) && (ptO.Line > 1)) {
|
||||||
// end of previous line
|
// end of previous line
|
||||||
ptDst.Line--;
|
ptDst.Line--;
|
||||||
|
@ -4824,19 +4827,12 @@ bool SynEdit::viewportEvent(QEvent * event)
|
||||||
return QAbstractScrollArea::viewportEvent(event);
|
return QAbstractScrollArea::viewportEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynEdit::maxScrollWidth() const
|
int SynEdit::maxScrollHeight() const
|
||||||
{
|
{
|
||||||
return mMaxScrollWidth;
|
if (mOptions.testFlag(eoScrollPastEof))
|
||||||
}
|
return std::max(displayLineCount(),1);
|
||||||
|
else
|
||||||
void SynEdit::setMaxScrollWidth(int Value)
|
return std::max(displayLineCount()-mLinesInWindow+1, 1);
|
||||||
{
|
|
||||||
Value = MinMax(Value, 1, INT_MAX - 1);
|
|
||||||
if (mMaxScrollWidth != Value) {
|
|
||||||
mMaxScrollWidth = Value;
|
|
||||||
if (mOptions.testFlag(SynEditorOption::eoScrollPastEol))
|
|
||||||
updateScrollbars();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SynEdit::modified() const
|
bool SynEdit::modified() const
|
||||||
|
@ -4903,7 +4899,7 @@ void SynEdit::linesChanged()
|
||||||
|
|
||||||
if (mGutter.showLineNumbers() && (mGutter.autoSize()))
|
if (mGutter.showLineNumbers() && (mGutter.autoSize()))
|
||||||
mGutter.autoSizeDigitCount(mLines->count());
|
mGutter.autoSizeDigitCount(mLines->count());
|
||||||
if (!mOptions.testFlag(SynEditorOption::eoScrollPastEof))
|
//if (!mOptions.testFlag(SynEditorOption::eoScrollPastEof))
|
||||||
setTopLine(mTopLine);
|
setTopLine(mTopLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5010,11 +5006,8 @@ void SynEdit::setBlockEnd(BufferCoord Value)
|
||||||
{
|
{
|
||||||
setActiveSelectionMode(mSelectionMode);
|
setActiveSelectionMode(mSelectionMode);
|
||||||
if (!mOptions.testFlag(eoNoSelection)) {
|
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.Line = MinMax(Value.Line, 1, mLines->count());
|
||||||
|
Value.Char = MinMax(Value.Char, 1, mLines->lengthOfLongestLine()+1);
|
||||||
if (mActiveSelectionMode == SynSelectionMode::smNormal) {
|
if (mActiveSelectionMode == SynSelectionMode::smNormal) {
|
||||||
if (Value.Line >= 1 && Value.Line <= mLines->count())
|
if (Value.Line >= 1 && Value.Line <= mLines->count())
|
||||||
Value.Char = std::min(Value.Char, mLines->getString(Value.Line - 1).length() + 1);
|
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;
|
int nInval1, nInval2;
|
||||||
bool SelChanged;
|
bool SelChanged;
|
||||||
setActiveSelectionMode(mSelectionMode);
|
setActiveSelectionMode(mSelectionMode);
|
||||||
if (mOptions.testFlag(SynEditorOption::eoScrollPastEol))
|
value.Char = MinMax(value.Char, 1, mLines->lengthOfLongestLine()+1);
|
||||||
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.Line = MinMax(value.Line, 1, mLines->count());
|
||||||
if (mActiveSelectionMode == SynSelectionMode::smNormal) {
|
if (mActiveSelectionMode == SynSelectionMode::smNormal) {
|
||||||
if (value.Line >= 1 && value.Line <= mLines->count())
|
if (value.Line >= 1 && value.Line <= mLines->count())
|
||||||
|
@ -5143,14 +5133,9 @@ int SynEdit::leftChar() const
|
||||||
|
|
||||||
void SynEdit::setLeftChar(int Value)
|
void SynEdit::setLeftChar(int Value)
|
||||||
{
|
{
|
||||||
int MaxVal;
|
//int MaxVal;
|
||||||
//QRect iTextArea;
|
//QRect iTextArea;
|
||||||
MaxVal = mLines->lengthOfLongestLine();
|
Value = std::min(Value,maxScrollWidth());
|
||||||
if (mOptions.testFlag(SynEditorOption::eoScrollPastEol)) {
|
|
||||||
Value = std::min(Value,MaxVal);
|
|
||||||
} else {
|
|
||||||
Value = std::min(Value,MaxVal-mCharsInWindow+1);
|
|
||||||
}
|
|
||||||
if (Value != mLeftChar) {
|
if (Value != mLeftChar) {
|
||||||
horizontalScrollBar()->setValue(Value);
|
horizontalScrollBar()->setValue(Value);
|
||||||
setStatusChanged(SynStatusChange::scLeftChar);
|
setStatusChanged(SynStatusChange::scLeftChar);
|
||||||
|
@ -5169,10 +5154,11 @@ int SynEdit::topLine() const
|
||||||
|
|
||||||
void SynEdit::setTopLine(int Value)
|
void SynEdit::setTopLine(int Value)
|
||||||
{
|
{
|
||||||
if (mOptions.testFlag(SynEditorOption::eoScrollPastEof))
|
Value = std::min(Value,maxScrollHeight());
|
||||||
Value = std::min(Value, displayLineCount());
|
// if (mOptions.testFlag(SynEditorOption::eoScrollPastEof))
|
||||||
else
|
// Value = std::min(Value, displayLineCount());
|
||||||
Value = std::min(Value, displayLineCount() - mLinesInWindow + 1);
|
// else
|
||||||
|
// Value = std::min(Value, displayLineCount() - mLinesInWindow + 1);
|
||||||
Value = std::max(Value, 1);
|
Value = std::max(Value, 1);
|
||||||
if (Value != mTopLine) {
|
if (Value != mTopLine) {
|
||||||
verticalScrollBar()->setValue(Value);
|
verticalScrollBar()->setValue(Value);
|
||||||
|
|
|
@ -66,33 +66,33 @@ enum SynEditorOption {
|
||||||
eoAltSetsColumnMode = 0x00000001, //Holding down the Alt Key will put the selection mode into columnar format
|
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
|
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 }
|
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
|
//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
|
//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
|
// 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
|
// 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
|
// 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
|
// 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
|
// eoNoCaret = 0x00000800, //Makes it so the caret is never visible
|
||||||
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
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_FLAGS(SynEditorOptions, SynEditorOption)
|
Q_DECLARE_FLAGS(SynEditorOptions, SynEditorOption)
|
||||||
|
@ -146,38 +146,38 @@ public:
|
||||||
* Returns how many rows are there in the editor
|
* Returns how many rows are there in the editor
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int displayLineCount();
|
int displayLineCount() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief displayX
|
* @brief displayX
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
DisplayCoord displayXY();
|
DisplayCoord displayXY() const;
|
||||||
int displayX();
|
int displayX() const;
|
||||||
int displayY();
|
int displayY() const;
|
||||||
BufferCoord caretXY();
|
BufferCoord caretXY() const;
|
||||||
int caretX();
|
int caretX() const;
|
||||||
int caretY();
|
int caretY() const;
|
||||||
|
|
||||||
void invalidateGutter();
|
void invalidateGutter();
|
||||||
void invalidateGutterLine(int aLine);
|
void invalidateGutterLine(int aLine);
|
||||||
void invalidateGutterLines(int FirstLine, int LastLine);
|
void invalidateGutterLines(int FirstLine, int LastLine);
|
||||||
DisplayCoord pixelsToNearestRowColumn(int aX, int aY);
|
DisplayCoord pixelsToNearestRowColumn(int aX, int aY) const;
|
||||||
DisplayCoord pixelsToRowColumn(int aX, int aY);
|
DisplayCoord pixelsToRowColumn(int aX, int aY) const;
|
||||||
QPoint RowColumnToPixels(const DisplayCoord& coord);
|
QPoint RowColumnToPixels(const DisplayCoord& coord) const;
|
||||||
DisplayCoord bufferToDisplayPos(const BufferCoord& p);
|
DisplayCoord bufferToDisplayPos(const BufferCoord& p) const;
|
||||||
BufferCoord displayToBufferPos(const DisplayCoord& p);
|
BufferCoord displayToBufferPos(const DisplayCoord& p) const;
|
||||||
int leftSpaces(const QString& line);
|
int leftSpaces(const QString& line) const;
|
||||||
QString GetLeftSpacing(int charCount,bool wantTabs);
|
QString GetLeftSpacing(int charCount,bool wantTabs) const;
|
||||||
int charToColumn(int aLine, int aChar);
|
int charToColumn(int aLine, int aChar) const;
|
||||||
int charToColumn(const QString& s, int aChar);
|
int charToColumn(const QString& s, int aChar) const;
|
||||||
int columnToChar(int aLine, int aColumn);
|
int columnToChar(int aLine, int aColumn) const;
|
||||||
int stringColumns(const QString& line, int colsBefore);
|
int stringColumns(const QString& line, int colsBefore) const;
|
||||||
int getLineIndent(const QString& line);
|
int getLineIndent(const QString& line) const;
|
||||||
int rowToLine(int aRow);
|
int rowToLine(int aRow) const;
|
||||||
int lineToRow(int aLine);
|
int lineToRow(int aLine) const;
|
||||||
int foldRowToLine(int Row);
|
int foldRowToLine(int Row) const;
|
||||||
int foldLineToRow(int Line);
|
int foldLineToRow(int Line) const;
|
||||||
void setDefaultKeystrokes();
|
void setDefaultKeystrokes();
|
||||||
void invalidateLine(int Line);
|
void invalidateLine(int Line);
|
||||||
void invalidateLines(int FirstLine, int LastLine);
|
void invalidateLines(int FirstLine, int LastLine);
|
||||||
|
@ -186,11 +186,11 @@ public:
|
||||||
void invalidate();
|
void invalidate();
|
||||||
void lockPainter();
|
void lockPainter();
|
||||||
void unlockPainter();
|
void unlockPainter();
|
||||||
bool selAvail();
|
bool selAvail() const;
|
||||||
|
|
||||||
int charColumns(QChar ch);
|
int charColumns(QChar ch) const;
|
||||||
double dpiFactor();
|
double dpiFactor() const;
|
||||||
bool IsPointInSelection(const BufferCoord& Value);
|
bool IsPointInSelection(const BufferCoord& Value) const;
|
||||||
BufferCoord NextWordPos();
|
BufferCoord NextWordPos();
|
||||||
BufferCoord NextWordPosEx(const BufferCoord& XY);
|
BufferCoord NextWordPosEx(const BufferCoord& XY);
|
||||||
BufferCoord WordStart();
|
BufferCoord WordStart();
|
||||||
|
@ -209,6 +209,9 @@ public:
|
||||||
void setCaretXYEx(bool CallEnsureCursorPos, BufferCoord value);
|
void setCaretXYEx(bool CallEnsureCursorPos, BufferCoord value);
|
||||||
void setCaretXYCentered(bool ForceToMiddle, const BufferCoord& value);
|
void setCaretXYCentered(bool ForceToMiddle, const BufferCoord& value);
|
||||||
|
|
||||||
|
int maxScrollWidth() const;
|
||||||
|
int maxScrollHeight() const;
|
||||||
|
|
||||||
bool GetHighlighterAttriAtRowCol(const BufferCoord& XY, QString& Token,
|
bool GetHighlighterAttriAtRowCol(const BufferCoord& XY, QString& Token,
|
||||||
PSynHighlighterAttribute& Attri);
|
PSynHighlighterAttribute& Attri);
|
||||||
bool GetHighlighterAttriAtRowCol(const BufferCoord& XY, QString& Token,
|
bool GetHighlighterAttriAtRowCol(const BufferCoord& XY, QString& Token,
|
||||||
|
@ -217,6 +220,7 @@ public:
|
||||||
bool GetHighlighterAttriAtRowColEx(const BufferCoord& XY, QString& Token,
|
bool GetHighlighterAttriAtRowColEx(const BufferCoord& XY, QString& Token,
|
||||||
SynHighlighterTokenType& TokenType, SynTokenKind &TokenKind, int &Start,
|
SynHighlighterTokenType& TokenType, SynTokenKind &TokenKind, int &Start,
|
||||||
PSynHighlighterAttribute& Attri);
|
PSynHighlighterAttribute& Attri);
|
||||||
|
|
||||||
//Commands
|
//Commands
|
||||||
void cutToClipboard() { CommandProcessor(SynEditorCommand::ecCut);}
|
void cutToClipboard() { CommandProcessor(SynEditorCommand::ecCut);}
|
||||||
void copyToClipboard() { CommandProcessor(SynEditorCommand::ecCopy);}
|
void copyToClipboard() { CommandProcessor(SynEditorCommand::ecCopy);}
|
||||||
|
@ -255,9 +259,6 @@ public:
|
||||||
bool modified() const;
|
bool modified() const;
|
||||||
void setModified(bool Value);
|
void setModified(bool Value);
|
||||||
|
|
||||||
int maxScrollWidth() const;
|
|
||||||
void setMaxScrollWidth(int Value);
|
|
||||||
|
|
||||||
int tabWidth() const;
|
int tabWidth() const;
|
||||||
|
|
||||||
PSynHighlighter highlighter() const;
|
PSynHighlighter highlighter() const;
|
||||||
|
@ -388,7 +389,7 @@ private:
|
||||||
PSynEditFoldRange checkFoldRange(SynEditFoldRanges* FoldRangeToCheck,int Line, bool WantCollapsed, bool AcceptFromLine, bool AcceptToLine);
|
PSynEditFoldRange checkFoldRange(SynEditFoldRanges* FoldRangeToCheck,int Line, bool WantCollapsed, bool AcceptFromLine, bool AcceptToLine);
|
||||||
PSynEditFoldRange foldEndAtLine(int Line);
|
PSynEditFoldRange foldEndAtLine(int Line);
|
||||||
void paintCaret(QPainter& painter, const QRect rcClip);
|
void paintCaret(QPainter& painter, const QRect rcClip);
|
||||||
int textOffset();
|
int textOffset() const;
|
||||||
SynEditorCommand TranslateKeyCode(int key, Qt::KeyboardModifiers modifiers);
|
SynEditorCommand TranslateKeyCode(int key, Qt::KeyboardModifiers modifiers);
|
||||||
/**
|
/**
|
||||||
* Move the caret to right DX columns
|
* Move the caret to right DX columns
|
||||||
|
@ -505,7 +506,6 @@ private:
|
||||||
PSynEditUndoList mOrigRedoList;
|
PSynEditUndoList mOrigRedoList;
|
||||||
int mLinesInWindow;
|
int mLinesInWindow;
|
||||||
int mLeftChar;
|
int mLeftChar;
|
||||||
int mMaxScrollWidth;
|
|
||||||
int mPaintLock; // lock counter for internal calculations
|
int mPaintLock; // lock counter for internal calculations
|
||||||
bool mReadOnly;
|
bool mReadOnly;
|
||||||
int mRightEdge;
|
int mRightEdge;
|
||||||
|
|
|
@ -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',
|
'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
|
||||||
's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
|
's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
|
||||||
|
|
||||||
|
|
||||||
Settings* pSettings;
|
Settings* pSettings;
|
||||||
|
|
||||||
Settings::Settings(const QString &filename):
|
Settings::Settings(const QString &filename):
|
||||||
|
@ -190,16 +189,66 @@ void Settings::Editor::setCaretColor(const QColor &caretColor)
|
||||||
mCaretColor = caretColor;
|
mCaretColor = caretColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Settings::Editor::Editor::keepCaretX() const
|
bool Settings::Editor::keepCaretX() const
|
||||||
{
|
{
|
||||||
return mKeepCaretX;
|
return mKeepCaretX;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::Editor::Editor::setKeepCaretX(bool keepCaretX)
|
void Settings::Editor::setKeepCaretX(bool keepCaretX)
|
||||||
{
|
{
|
||||||
mKeepCaretX = 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()
|
void Settings::Editor::doSave()
|
||||||
{
|
{
|
||||||
saveValue("default_encoding",mDefaultEncoding);
|
saveValue("default_encoding",mDefaultEncoding);
|
||||||
|
@ -217,6 +266,13 @@ void Settings::Editor::doSave()
|
||||||
saveValue("caret_for_insert",static_cast<int>(mCaretForInsert));
|
saveValue("caret_for_insert",static_cast<int>(mCaretForInsert));
|
||||||
saveValue("caret_for_overwrite",static_cast<int>(mCaretForOverwrite));
|
saveValue("caret_for_overwrite",static_cast<int>(mCaretForOverwrite));
|
||||||
saveValue("caret_color",mCaretColor);
|
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()
|
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)));
|
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)));
|
mCaretForOverwrite = static_cast<SynEditCaretType>( intValue("caret_for_overwrite",static_cast<int>(SynEditCaretType::ctBlock)));
|
||||||
mCaretColor = colorValue("caret_color",QColorConstants::Svg::black);
|
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
|
SynEditCaretType Settings::Editor::caretForOverwrite() const
|
||||||
|
|
|
@ -118,6 +118,21 @@ public:
|
||||||
bool keepCaretX() const;
|
bool keepCaretX() const;
|
||||||
void setKeepCaretX(bool keepCaretX);
|
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:
|
private:
|
||||||
QByteArray mDefaultEncoding;
|
QByteArray mDefaultEncoding;
|
||||||
// indents
|
// indents
|
||||||
|
@ -134,6 +149,12 @@ public:
|
||||||
SynEditCaretType mCaretForInsert;
|
SynEditCaretType mCaretForInsert;
|
||||||
SynEditCaretType mCaretForOverwrite;
|
SynEditCaretType mCaretForOverwrite;
|
||||||
QColor mCaretColor;
|
QColor mCaretColor;
|
||||||
|
//scroll
|
||||||
|
bool mAutoHideScrollbar;
|
||||||
|
bool mScrollPastEof;
|
||||||
|
bool mScrollPastEol;
|
||||||
|
bool mScrollByOneLess;
|
||||||
|
bool mHalfPageScroll;
|
||||||
|
|
||||||
// _Base interface
|
// _Base interface
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -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()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
|
@ -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
|
|
@ -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>
|
|
@ -51,6 +51,12 @@ void EditorGeneralWidget::doLoad()
|
||||||
setCaretTypeIndex(ui->cbCaretForInsert,pSettings->editor().caretForInsert());
|
setCaretTypeIndex(ui->cbCaretForInsert,pSettings->editor().caretForInsert());
|
||||||
setCaretTypeIndex(ui->cbCaretForOverwrite,pSettings->editor().caretForOverwrite());
|
setCaretTypeIndex(ui->cbCaretForOverwrite,pSettings->editor().caretForOverwrite());
|
||||||
ui->colorCaret->setColor(pSettings->editor().caretColor());
|
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()
|
void EditorGeneralWidget::doSave()
|
||||||
|
@ -69,6 +75,12 @@ void EditorGeneralWidget::doSave()
|
||||||
pSettings->editor().setCaretForInsert(getCaretTypeIndex(ui->cbCaretForInsert));
|
pSettings->editor().setCaretForInsert(getCaretTypeIndex(ui->cbCaretForInsert));
|
||||||
pSettings->editor().setCaretForOverwrite(getCaretTypeIndex(ui->cbCaretForOverwrite));
|
pSettings->editor().setCaretForOverwrite(getCaretTypeIndex(ui->cbCaretForOverwrite));
|
||||||
pSettings->editor().setCaretColor(ui->colorCaret->color());
|
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();
|
pSettings->editor().save();
|
||||||
pMainWindow->updateEditorSettings();
|
pMainWindow->updateEditorSettings();
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>721</width>
|
<width>721</width>
|
||||||
<height>636</height>
|
<height>691</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -165,7 +165,24 @@
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>7</number>
|
<number>7</number>
|
||||||
</property>
|
</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">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
|
@ -178,7 +195,14 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</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">
|
<widget class="ColorEdit" name="colorCaret">
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::StyledPanel</enum>
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
@ -188,47 +212,9 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="1" column="1">
|
||||||
<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">
|
|
||||||
<widget class="QComboBox" name="cbCaretForOverwrite"/>
|
<widget class="QComboBox" name="cbCaretForOverwrite"/>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -240,6 +226,43 @@
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Scroll</string>
|
<string>Scroll</string>
|
||||||
</property>
|
</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>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "settingswidget.h"
|
#include "settingswidget.h"
|
||||||
#include "compilersetoptionwidget.h"
|
#include "compilersetoptionwidget.h"
|
||||||
#include "editorgeneralwidget.h"
|
#include "editorgeneralwidget.h"
|
||||||
|
#include "editorfontwidget.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
@ -25,6 +26,10 @@ SettingsDialog::SettingsDialog(QWidget *parent) :
|
||||||
pEditorGeneralWidget = new EditorGeneralWidget(tr("General"),tr("Editor"));
|
pEditorGeneralWidget = new EditorGeneralWidget(tr("General"),tr("Editor"));
|
||||||
pEditorGeneralWidget->init();
|
pEditorGeneralWidget->init();
|
||||||
addWidget(pEditorGeneralWidget);
|
addWidget(pEditorGeneralWidget);
|
||||||
|
|
||||||
|
pEditorFontWidget = new EditorFontWidget(tr("Font"),tr("Editor"));
|
||||||
|
pEditorFontWidget->init();
|
||||||
|
addWidget(pEditorFontWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsDialog::~SettingsDialog()
|
SettingsDialog::~SettingsDialog()
|
||||||
|
|
|
@ -12,6 +12,7 @@ class SettingsDialog;
|
||||||
|
|
||||||
class CompilerSetOptionWidget;
|
class CompilerSetOptionWidget;
|
||||||
class EditorGeneralWidget;
|
class EditorGeneralWidget;
|
||||||
|
class EditorFontWidget;
|
||||||
class PCompilerSet;
|
class PCompilerSet;
|
||||||
class SettingsWidget;
|
class SettingsWidget;
|
||||||
class SettingsDialog : public QDialog
|
class SettingsDialog : public QDialog
|
||||||
|
@ -44,6 +45,7 @@ private:
|
||||||
|
|
||||||
CompilerSetOptionWidget* pCompilerSetOptionWidget;
|
CompilerSetOptionWidget* pCompilerSetOptionWidget;
|
||||||
EditorGeneralWidget* pEditorGeneralWidget;
|
EditorGeneralWidget* pEditorGeneralWidget;
|
||||||
|
EditorFontWidget* pEditorFontWidget;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SETTINGSDIALOG_H
|
#endif // SETTINGSDIALOG_H
|
||||||
|
|
Loading…
Reference in New Issue