- enhancement: "Line Spacing" in options / editor / font
- enhancement: "Show whitespaces" in options / editor / font
This commit is contained in:
parent
ed89690f7a
commit
892b987894
2
NEWS.md
2
NEWS.md
|
@ -20,6 +20,8 @@ Red Panda C++ Version 2.7
|
|||
- fix: Project's "static link" option is overwrited by global compiler set settings, when project options dialog is opened.
|
||||
- fix: Icon size not correct under macOS high DPI / zoom factor settings.
|
||||
- enhancement: "Icon zoom" in options / environment / appearance
|
||||
- enhancement: "Line Spacing" in options / editor / font
|
||||
- enhancement: "Show whitespaces" in options / editor / font
|
||||
|
||||
Red Panda C++ Version 2.6
|
||||
|
||||
|
|
|
@ -4705,7 +4705,10 @@ void Editor::applySettings()
|
|||
QSynedit::eoRightMouseMovesCursor | QSynedit::eoScrollByOneLess | QSynedit::eoTabIndent | QSynedit::eoHideShowScrollbars | QSynedit::eoGroupUndo
|
||||
| QSynedit::eoSelectWordByDblClick;
|
||||
|
||||
options.setFlag(QSynedit::eoShowSpecialChars, pSettings->editor().showSpecialChars());
|
||||
options.setFlag(QSynedit::eoShowLeadingSpaces, pSettings->editor().showLeadingSpaces());
|
||||
options.setFlag(QSynedit::eoShowTrailingSpaces, pSettings->editor().showTrailingSpaces());
|
||||
options.setFlag(QSynedit::eoShowInnerSpaces, pSettings->editor().showInnerSpaces());
|
||||
options.setFlag(QSynedit::eoShowLineBreaks, pSettings->editor().showLineBreaks());
|
||||
|
||||
//options
|
||||
options.setFlag(QSynedit::eoAutoIndent,pSettings->editor().autoIndent());
|
||||
|
@ -4746,6 +4749,7 @@ void Editor::applySettings()
|
|||
f2.setPixelSize(pointToPixel(pSettings->editor().fontSize()));
|
||||
f2.setStyleStrategy(QFont::PreferAntialias);
|
||||
setFontForNonAscii(f2);
|
||||
setLineSpacingFactor(pSettings->editor().lineSpacing());
|
||||
|
||||
// Set gutter properties
|
||||
gutter().setLeftOffset(pointToPixel(pSettings->editor().fontSize()) + pSettings->editor().gutterLeftOffset());
|
||||
|
|
|
@ -735,14 +735,54 @@ void Settings::Editor::setRemoveTrailingSpacesWhenSaved(bool newRemoveTrailingSp
|
|||
mRemoveTrailingSpacesWhenSaved = newRemoveTrailingSpacesWhenSaved;
|
||||
}
|
||||
|
||||
bool Settings::Editor::showSpecialChars() const
|
||||
double Settings::Editor::lineSpacing() const
|
||||
{
|
||||
return mShowSpecialChars;
|
||||
return mLineSpacing;
|
||||
}
|
||||
|
||||
void Settings::Editor::setShowSpecialChars(bool newShowSpecialChars)
|
||||
void Settings::Editor::setLineSpacing(double newLineSpacing)
|
||||
{
|
||||
mShowSpecialChars = newShowSpecialChars;
|
||||
mLineSpacing = newLineSpacing;
|
||||
}
|
||||
|
||||
bool Settings::Editor::showLeadingSpaces() const
|
||||
{
|
||||
return mShowLeadingSpaces;
|
||||
}
|
||||
|
||||
void Settings::Editor::setShowLeadingSpaces(bool newShowStartSpaces)
|
||||
{
|
||||
mShowLeadingSpaces = newShowStartSpaces;
|
||||
}
|
||||
|
||||
bool Settings::Editor::showTrailingSpaces() const
|
||||
{
|
||||
return mShowTrailingSpaces;
|
||||
}
|
||||
|
||||
void Settings::Editor::setShowTrailingSpaces(bool newShowEndSpaces)
|
||||
{
|
||||
mShowTrailingSpaces = newShowEndSpaces;
|
||||
}
|
||||
|
||||
bool Settings::Editor::showInnerSpaces() const
|
||||
{
|
||||
return mShowInnerSpaces;
|
||||
}
|
||||
|
||||
void Settings::Editor::setShowInnerSpaces(bool newShowMiddleSpaces)
|
||||
{
|
||||
mShowInnerSpaces = newShowMiddleSpaces;
|
||||
}
|
||||
|
||||
bool Settings::Editor::showLineBreaks() const
|
||||
{
|
||||
return mShowLineBreaks;
|
||||
}
|
||||
|
||||
void Settings::Editor::setShowLineBreaks(bool newShowLineBreaks)
|
||||
{
|
||||
mShowLineBreaks = newShowLineBreaks;
|
||||
}
|
||||
|
||||
bool Settings::Editor::highlightCurrentWord() const
|
||||
|
@ -1235,8 +1275,6 @@ void Settings::Editor::doSave()
|
|||
saveValue("caret_use_text_color",mCaretUseTextColor);
|
||||
saveValue("caret_color",mCaretColor);
|
||||
|
||||
saveValue("show_special_chars",mShowSpecialChars);
|
||||
|
||||
//highlight
|
||||
saveValue("highlight_matching_braces",mHighlightMathingBraces);
|
||||
saveValue("highlight_current_word",mHighlightCurrentWord);
|
||||
|
@ -1261,8 +1299,14 @@ void Settings::Editor::doSave()
|
|||
saveValue("non_ascii_font_name", mNonAsciiFontName);
|
||||
saveValue("font_size", mFontSize);
|
||||
saveValue("font_only_monospaced", mFontOnlyMonospaced);
|
||||
saveValue("line_spacing",mLineSpacing);
|
||||
saveValue("enable_ligatures_support", mEnableLigaturesSupport);
|
||||
|
||||
saveValue("show_leading_spaces", mShowLeadingSpaces);
|
||||
saveValue("show_trailing_spaces", mShowTrailingSpaces);
|
||||
saveValue("show_inner_spaces", mShowInnerSpaces);
|
||||
saveValue("show_line_breaks", mShowLineBreaks);
|
||||
|
||||
//gutter
|
||||
saveValue("gutter_visible", mGutterVisible);
|
||||
saveValue("gutter_auto_size", mGutterAutoSize);
|
||||
|
@ -1362,9 +1406,6 @@ void Settings::Editor::doLoad()
|
|||
mCaretUseTextColor = boolValue("caret_use_text_color",true);
|
||||
mCaretColor = colorValue("caret_color",Qt::yellow);
|
||||
|
||||
mShowSpecialChars = boolValue("show_special_chars",false);
|
||||
|
||||
|
||||
//highlight
|
||||
mHighlightMathingBraces = boolValue("highlight_matching_braces",true);
|
||||
mHighlightCurrentWord = boolValue("highlight_current_word",true);
|
||||
|
@ -1397,8 +1438,14 @@ void Settings::Editor::doLoad()
|
|||
#endif
|
||||
mFontSize = intValue("font_size",12);
|
||||
mFontOnlyMonospaced = boolValue("font_only_monospaced",true);
|
||||
mLineSpacing = doubleValue("line_spacing",1.0);
|
||||
mEnableLigaturesSupport = boolValue("enable_ligatures_support", false);
|
||||
|
||||
mShowLeadingSpaces = boolValue("show_leading_spaces", false);
|
||||
mShowTrailingSpaces = boolValue("show_trailing_spaces", false);
|
||||
mShowInnerSpaces = boolValue("show_inner_spaces", false);
|
||||
mShowLineBreaks = boolValue("show_line_breaks", false);
|
||||
|
||||
//gutter
|
||||
mGutterVisible = boolValue("gutter_visible",true);
|
||||
mGutterAutoSize = boolValue("gutter_auto_size",true);
|
||||
|
@ -1716,27 +1763,27 @@ QString Settings::CompilerSet::getCompileOptionValue(const QString &key)
|
|||
return mCompileOptions.value(key,QString());
|
||||
}
|
||||
|
||||
static void checkDirs(const QStringList& dirlist, QString& gooddirs, QString& baddirs) {
|
||||
gooddirs = "";
|
||||
baddirs = "";
|
||||
//static void checkDirs(const QStringList& dirlist, QString& gooddirs, QString& baddirs) {
|
||||
// gooddirs = "";
|
||||
// baddirs = "";
|
||||
|
||||
for (int i=0; i<dirlist.count();i++) {
|
||||
QDir dir(dirlist[i]);
|
||||
if (!dir.exists()) {
|
||||
if (baddirs.isEmpty()) {
|
||||
baddirs = dirlist[i];
|
||||
} else {
|
||||
baddirs += ";" + dirlist[i];
|
||||
}
|
||||
} else {
|
||||
if (gooddirs.isEmpty()) {
|
||||
gooddirs = dirlist[i];
|
||||
} else {
|
||||
gooddirs += ";" + dirlist[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// for (int i=0; i<dirlist.count();i++) {
|
||||
// QDir dir(dirlist[i]);
|
||||
// if (!dir.exists()) {
|
||||
// if (baddirs.isEmpty()) {
|
||||
// baddirs = dirlist[i];
|
||||
// } else {
|
||||
// baddirs += ";" + dirlist[i];
|
||||
// }
|
||||
// } else {
|
||||
// if (gooddirs.isEmpty()) {
|
||||
// gooddirs = dirlist[i];
|
||||
// } else {
|
||||
// gooddirs += ";" + dirlist[i];
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
//bool Settings::CompilerSet::dirsValid(QString &msg)
|
||||
|
|
|
@ -383,8 +383,20 @@ public:
|
|||
bool removeTrailingSpacesWhenSaved() const;
|
||||
void setRemoveTrailingSpacesWhenSaved(bool newRemoveTrailingSpacesWhenSaved);
|
||||
|
||||
bool showSpecialChars() const;
|
||||
void setShowSpecialChars(bool newShowSpecialChars);
|
||||
double lineSpacing() const;
|
||||
void setLineSpacing(double newLineSpacing);
|
||||
|
||||
bool showLineBreaks() const;
|
||||
void setShowLineBreaks(bool newShowLineBreaks);
|
||||
|
||||
bool showInnerSpaces() const;
|
||||
void setShowInnerSpaces(bool newShowMiddleSpaces);
|
||||
|
||||
bool showTrailingSpaces() const;
|
||||
void setShowTrailingSpaces(bool newShowEndSpaces);
|
||||
|
||||
bool showLeadingSpaces() const;
|
||||
void setShowLeadingSpaces(bool newShowStartSpaces);
|
||||
|
||||
private:
|
||||
//General
|
||||
|
@ -403,8 +415,7 @@ public:
|
|||
QSynedit::EditCaretType mCaretForOverwrite;
|
||||
bool mCaretUseTextColor;
|
||||
QColor mCaretColor;
|
||||
//
|
||||
bool mShowSpecialChars;
|
||||
|
||||
|
||||
//highlights
|
||||
bool mHighlightCurrentWord;
|
||||
|
@ -431,6 +442,12 @@ public:
|
|||
QString mNonAsciiFontName;
|
||||
int mFontSize;
|
||||
bool mFontOnlyMonospaced;
|
||||
double mLineSpacing;
|
||||
|
||||
bool mShowLeadingSpaces;
|
||||
bool mShowTrailingSpaces;
|
||||
bool mShowInnerSpaces;
|
||||
bool mShowLineBreaks;
|
||||
|
||||
//gutter
|
||||
bool mGutterVisible;
|
||||
|
|
|
@ -58,8 +58,12 @@ void EditorFontWidget::doLoad()
|
|||
ui->cbFont->setCurrentFont(QFont(pSettings->editor().fontName()));
|
||||
ui->cbNonAsciiFont->setCurrentFont(QFont(pSettings->editor().nonAsciiFontName()));
|
||||
ui->spinFontSize->setValue(pSettings->editor().fontSize());
|
||||
ui->spinLineSpacing->setValue(pSettings->editor().lineSpacing());
|
||||
ui->chkLigature->setChecked(pSettings->editor().enableLigaturesSupport());
|
||||
ui->chkShowSpecialChars->setChecked(pSettings->editor().showSpecialChars());
|
||||
ui->chkLeadingSpaces->setChecked(pSettings->editor().showLeadingSpaces());
|
||||
ui->chkInnerSpaces->setChecked(pSettings->editor().showInnerSpaces());
|
||||
ui->chkTrailingSpaces->setChecked(pSettings->editor().showTrailingSpaces());
|
||||
ui->chkLineBreaks->setChecked(pSettings->editor().showLineBreaks());
|
||||
//gutter
|
||||
ui->chkGutterVisible->setChecked(pSettings->editor().gutterVisible());
|
||||
ui->chkAutoSizeGutter->setChecked(pSettings->editor().gutterAutoSize());
|
||||
|
@ -82,8 +86,13 @@ void EditorFontWidget::doSave()
|
|||
pSettings->editor().setFontName(ui->cbFont->currentFont().family());
|
||||
pSettings->editor().setNonAsciiFontName(ui->cbNonAsciiFont->currentFont().family());
|
||||
pSettings->editor().setFontSize(ui->spinFontSize->value());
|
||||
pSettings->editor().setLineSpacing(ui->spinLineSpacing->value());
|
||||
|
||||
pSettings->editor().setEnableLigaturesSupport(ui->chkLigature->isChecked());
|
||||
pSettings->editor().setShowSpecialChars(ui->chkShowSpecialChars->isChecked());
|
||||
pSettings->editor().setShowLeadingSpaces(ui->chkLeadingSpaces->isChecked());
|
||||
pSettings->editor().setShowInnerSpaces(ui->chkInnerSpaces->isChecked());
|
||||
pSettings->editor().setShowTrailingSpaces(ui->chkTrailingSpaces->isChecked());
|
||||
pSettings->editor().setShowLineBreaks(ui->chkLineBreaks->isChecked());
|
||||
//gutter
|
||||
pSettings->editor().setGutterVisible(ui->chkGutterVisible->isChecked());
|
||||
pSettings->editor().setGutterAutoSize(ui->chkAutoSizeGutter->isChecked());
|
||||
|
|
|
@ -23,13 +23,146 @@
|
|||
<property name="rightMargin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<item row="1" column="1">
|
||||
<widget class="QWidget" name="widget_9" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<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="cbNonAsciiFont"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<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="3" column="1">
|
||||
<widget class="QWidget" name="widget_10" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<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="QDoubleSpinBox" name="spinLineSpacing">
|
||||
<property name="decimals">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>3.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>563</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Font:</string>
|
||||
<string>Size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="chkLigature">
|
||||
<property name="text">
|
||||
<string>Enable ligatures support</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Line Spacing:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<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="1">
|
||||
<widget class="QWidget" name="widget_2" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
|
@ -81,51 +214,6 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<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="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
|
@ -133,51 +221,47 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QWidget" name="widget_9" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<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="cbNonAsciiFont"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<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="4" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="chkShowSpecialChars">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Show special chars</string>
|
||||
<string>Font:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="chkLigature">
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Show whitespaces</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkLeadingSpaces">
|
||||
<property name="text">
|
||||
<string>Enable ligatures support</string>
|
||||
<string>Leading</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkInnerSpaces">
|
||||
<property name="text">
|
||||
<string>Inner</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkTrailingSpaces">
|
||||
<property name="text">
|
||||
<string>Trailing</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkLineBreaks">
|
||||
<property name="text">
|
||||
<string>Line break</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -1402,11 +1402,31 @@
|
|||
<translation>Usar fonte personalizada</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show special chars</source>
|
||||
<source>Enable ligatures support</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable ligatures support</source>
|
||||
<source>Line Spacing:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show whitespaces</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Leading</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Inner</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Trailing</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Line break</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
|
|
|
@ -1458,7 +1458,7 @@ Are you really want to continue?</oldsource>
|
|||
<translation>输入当前断点的生效条件:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../editor.cpp" line="4913"/>
|
||||
<location filename="../editor.cpp" line="4917"/>
|
||||
<source>Readonly</source>
|
||||
<translation>只读</translation>
|
||||
</message>
|
||||
|
@ -1568,7 +1568,7 @@ Are you really want to continue?</oldsource>
|
|||
<message>
|
||||
<location filename="../settingsdialog/editorclipboardwidget.ui" line="107"/>
|
||||
<source>Copy with format as</source>
|
||||
<translation>同时带格式复制为</translation>
|
||||
<translation>带格式复制为</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settingsdialog/editorclipboardwidget.ui" line="133"/>
|
||||
|
@ -1859,20 +1859,20 @@ Are you really want to continue?</oldsource>
|
|||
<translation>表单</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="125"/>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="410"/>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="110"/>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="494"/>
|
||||
<source>Size:</source>
|
||||
<translation>大小:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="29"/>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="403"/>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="227"/>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="487"/>
|
||||
<source>Font:</source>
|
||||
<translation>英文字体:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="64"/>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="498"/>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="197"/>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="582"/>
|
||||
<source>Show only monospaced fonts</source>
|
||||
<translation>只显示等宽字体</translation>
|
||||
</message>
|
||||
|
@ -1881,67 +1881,96 @@ Are you really want to continue?</oldsource>
|
|||
<translation type="vanished">启用合字显示支持(需要Fira Code等字体)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="132"/>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="220"/>
|
||||
<source>Font for non-ascii Text:</source>
|
||||
<translation>非英文字体:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="173"/>
|
||||
<source>Show special chars</source>
|
||||
<translation>显示特殊字符</translation>
|
||||
<translation type="vanished">显示特殊字符</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="180"/>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="117"/>
|
||||
<source>Enable ligatures support</source>
|
||||
<translation>启用连字(ligratures)功能</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="190"/>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="124"/>
|
||||
<source>Line Spacing:</source>
|
||||
<translation>行高:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="237"/>
|
||||
<source>Show whitespaces</source>
|
||||
<translation>显示空白字符</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="243"/>
|
||||
<source>Leading</source>
|
||||
<translation>行首</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="250"/>
|
||||
<source>Inner</source>
|
||||
<translation>中间</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="257"/>
|
||||
<source>Trailing</source>
|
||||
<translation>行尾</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="264"/>
|
||||
<source>Line break</source>
|
||||
<translation>换行符</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="274"/>
|
||||
<source>Gutter</source>
|
||||
<translation>装订线</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="211"/>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="295"/>
|
||||
<source>Gutter is visible</source>
|
||||
<translation>显示装订线区域</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="233"/>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="317"/>
|
||||
<source>Left Offset</source>
|
||||
<translation>左侧留白</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="250"/>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="334"/>
|
||||
<source>Right Offset</source>
|
||||
<translation>右侧留白</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="283"/>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="367"/>
|
||||
<source>Show Line Numbers</source>
|
||||
<translation>显示行号</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="307"/>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="391"/>
|
||||
<source>Add leading zeros to line numbers</source>
|
||||
<translation>在行号前补齐前导0</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="314"/>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="398"/>
|
||||
<source>Line numbers starts at zero</source>
|
||||
<translation>第一行从0开始编号</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="321"/>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="405"/>
|
||||
<source>Auto calculate the digit count of line number</source>
|
||||
<translation>自动计算行号位数</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="343"/>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="427"/>
|
||||
<source>Digit count</source>
|
||||
<translation>行号位数</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="379"/>
|
||||
<location filename="../settingsdialog/editorfontwidget.ui" line="463"/>
|
||||
<source>Use Custom Font</source>
|
||||
<translation>使用自定义字体</translation>
|
||||
</message>
|
||||
|
@ -8030,7 +8059,7 @@ Are you really want to continue?</oldsource>
|
|||
<translation>生成调试信息(-g3)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings.cpp" line="2909"/>
|
||||
<location filename="../settings.cpp" line="2956"/>
|
||||
<source>Would you like Red Panda C++ to search for compilers in PATH?</source>
|
||||
<translation>您同意小熊猫C++在PATH路径中寻找gcc编译器吗?</translation>
|
||||
</message>
|
||||
|
@ -8143,7 +8172,7 @@ Are you really want to continue?</oldsource>
|
|||
<translation type="vanished">只生成汇编代码(-S)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings.cpp" line="2911"/>
|
||||
<location filename="../settings.cpp" line="2958"/>
|
||||
<source>Confirm</source>
|
||||
<translation>确认</translation>
|
||||
</message>
|
||||
|
@ -8164,13 +8193,13 @@ Are you really want to continue?</oldsource>
|
|||
<translation type="vanished">如果仍然保留这些设置,可能会导致编译错误。<br /><br />请选择“是”,除非您清楚的知道选择“否”的后果,</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings.cpp" line="2901"/>
|
||||
<location filename="../settings.cpp" line="2907"/>
|
||||
<location filename="../settings.cpp" line="2948"/>
|
||||
<location filename="../settings.cpp" line="2954"/>
|
||||
<source>Compiler set not configuared.</source>
|
||||
<translation>未配置编译器设置。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings.cpp" line="2903"/>
|
||||
<location filename="../settings.cpp" line="2950"/>
|
||||
<source>Would you like Red Panda C++ to search for compilers in the following locations: <BR />'%1'<BR />'%2'? </source>
|
||||
<translation>您需要小熊猫C++在下列位置搜索编译器吗:<br />%1<br />%2</translation>
|
||||
</message>
|
||||
|
|
|
@ -1287,11 +1287,31 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show special chars</source>
|
||||
<source>Enable ligatures support</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enable ligatures support</source>
|
||||
<source>Line Spacing:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show whitespaces</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Leading</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Inner</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Trailing</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Line break</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
|
|
|
@ -105,7 +105,7 @@ SynEdit::SynEdit(QWidget *parent) : QAbstractScrollArea(parent),
|
|||
this->setCursor(Qt::CursorShape::IBeamCursor);
|
||||
//TabStop := True;
|
||||
mInserting = true;
|
||||
mExtraLineSpacing = 0;
|
||||
mLineSpacingFactor = 1.0;
|
||||
|
||||
this->setFrameShape(QFrame::Panel);
|
||||
this->setFrameShadow(QFrame::Sunken);
|
||||
|
@ -3405,7 +3405,7 @@ void SynEdit::recalcCharExtent()
|
|||
if (fm.horizontalAdvance("M")>mCharWidth)
|
||||
mCharWidth = fm.horizontalAdvance("M");
|
||||
}
|
||||
mTextHeight += mExtraLineSpacing;
|
||||
mTextHeight *= mLineSpacingFactor;
|
||||
}
|
||||
|
||||
QString SynEdit::expandAtWideGlyphs(const QString &S)
|
||||
|
@ -3968,6 +3968,19 @@ void SynEdit::onScrolled(int)
|
|||
invalidate();
|
||||
}
|
||||
|
||||
double SynEdit::lineSpacingFactor() const
|
||||
{
|
||||
return mLineSpacingFactor;
|
||||
}
|
||||
|
||||
void SynEdit::setLineSpacingFactor(double newLineSpacingFactor)
|
||||
{
|
||||
if (newLineSpacingFactor<1.0)
|
||||
newLineSpacingFactor = 1.0;
|
||||
mLineSpacingFactor = newLineSpacingFactor;
|
||||
recalcCharExtent();
|
||||
}
|
||||
|
||||
ScrollStyle SynEdit::scrollBars() const
|
||||
{
|
||||
return mScrollBars;
|
||||
|
@ -4185,6 +4198,10 @@ EditorOptions SynEdit::getOptions() const
|
|||
return mOptions;
|
||||
}
|
||||
|
||||
|
||||
static bool sameEditorOption(const EditorOptions& value1, const EditorOptions& value2, EditorOption flag) {
|
||||
return value1.testFlag(flag)==value2.testFlag(flag);
|
||||
}
|
||||
void SynEdit::setOptions(const EditorOptions &Value)
|
||||
{
|
||||
if (Value != mOptions) {
|
||||
|
@ -4195,8 +4212,11 @@ void SynEdit::setOptions(const EditorOptions &Value)
|
|||
setTopLine(mTopLine);
|
||||
|
||||
bool bUpdateAll =
|
||||
(Value.testFlag(eoShowSpecialChars) != mOptions.testFlag(eoShowSpecialChars))
|
||||
|| (Value.testFlag(eoShowRainbowColor) != mOptions.testFlag(eoShowRainbowColor));
|
||||
!sameEditorOption(Value,mOptions,eoShowLeadingSpaces)
|
||||
|| !sameEditorOption(Value,mOptions,eoShowInnerSpaces)
|
||||
|| !sameEditorOption(Value,mOptions,eoShowTrailingSpaces)
|
||||
|| !sameEditorOption(Value,mOptions,eoShowLineBreaks)
|
||||
|| !sameEditorOption(Value,mOptions,eoShowRainbowColor);
|
||||
//bool bUpdateScroll = (Options * ScrollOptions)<>(Value * ScrollOptions);
|
||||
bool bUpdateScroll = true;
|
||||
mOptions = Value;
|
||||
|
|
|
@ -89,12 +89,16 @@ enum EditorOption {
|
|||
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
|
||||
// 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,
|
||||
eoSelectWordByDblClick= 0x00100000,
|
||||
eoShowLeadingSpaces = 0x00200000,
|
||||
eoShowTrailingSpaces = 0x00400000,
|
||||
eoShowInnerSpaces= 0x00800000,
|
||||
eoShowLineBreaks = 0x01000000,
|
||||
};
|
||||
|
||||
Q_DECLARE_FLAGS(EditorOptions, EditorOption)
|
||||
|
@ -682,7 +686,7 @@ private:
|
|||
EditKeyStrokes mKeyStrokes;
|
||||
bool mModified;
|
||||
QDateTime mLastModifyTime;
|
||||
int mExtraLineSpacing;
|
||||
double mLineSpacingFactor;
|
||||
SelectionMode mSelectionMode;
|
||||
SelectionMode mActiveSelectionMode; //mode of the active selection
|
||||
bool mWantReturns;
|
||||
|
@ -776,6 +780,9 @@ protected:
|
|||
ScrollStyle scrollBars() const;
|
||||
void setScrollBars(ScrollStyle newScrollBars);
|
||||
|
||||
double lineSpacingFactor() const;
|
||||
void setLineSpacingFactor(double newLineSpacingFactor);
|
||||
|
||||
protected:
|
||||
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||
void dropEvent(QDropEvent *event) override;
|
||||
|
|
|
@ -485,8 +485,8 @@ void SynEditTextPainter::paintHighlightToken(bool bFillToEOL)
|
|||
bool bU1, bSel, bU2;
|
||||
int nX1, nX2;
|
||||
// Compute some helper variables.
|
||||
nC1 = std::max(FirstCol, TokenAccu.ColumnsBefore + 1);
|
||||
nC2 = std::min(LastCol, TokenAccu.ColumnsBefore + TokenAccu.Columns + 1);
|
||||
nC1 = std::max(FirstCol, mTokenAccu.columnsBefore + 1);
|
||||
nC2 = std::min(LastCol, mTokenAccu.columnsBefore + mTokenAccu.columns + 1);
|
||||
if (bComplexLine) {
|
||||
bU1 = (nC1 < nLineSelStart);
|
||||
bSel = (nC1 < nLineSelEnd) && (nC2 >= nLineSelStart);
|
||||
|
@ -499,10 +499,10 @@ void SynEditTextPainter::paintHighlightToken(bool bFillToEOL)
|
|||
bU2 = false; // to shut up compiler warning.
|
||||
}
|
||||
// Any token chars accumulated?
|
||||
if (TokenAccu.Columns > 0) {
|
||||
if (mTokenAccu.columns > 0) {
|
||||
// Initialize the colors and the font style.
|
||||
colBG = TokenAccu.BG;
|
||||
colFG = TokenAccu.FG;
|
||||
colBG = mTokenAccu.background;
|
||||
colFG = mTokenAccu.foreground;
|
||||
if (bSpecialLine) {
|
||||
if (colSpFG.isValid())
|
||||
colFG = colSpFG;
|
||||
|
@ -513,16 +513,16 @@ void SynEditTextPainter::paintHighlightToken(bool bFillToEOL)
|
|||
// if (bSpecialLine && edit->mOptions.testFlag(eoSpecialLineDefaultFg))
|
||||
// colFG = TokenAccu.FG;
|
||||
QFont font = edit->font();
|
||||
font.setBold(TokenAccu.Style & FontStyle::fsBold);
|
||||
font.setItalic(TokenAccu.Style & FontStyle::fsItalic);
|
||||
font.setStrikeOut(TokenAccu.Style & FontStyle::fsStrikeOut);
|
||||
font.setUnderline(TokenAccu.Style & FontStyle::fsUnderline);
|
||||
font.setBold(mTokenAccu.style & FontStyle::fsBold);
|
||||
font.setItalic(mTokenAccu.style & FontStyle::fsItalic);
|
||||
font.setStrikeOut(mTokenAccu.style & FontStyle::fsStrikeOut);
|
||||
font.setUnderline(mTokenAccu.style & FontStyle::fsUnderline);
|
||||
painter->setFont(font);
|
||||
QFont nonAsciiFont = edit->fontForNonAscii();
|
||||
nonAsciiFont.setBold(TokenAccu.Style & FontStyle::fsBold);
|
||||
nonAsciiFont.setItalic(TokenAccu.Style & FontStyle::fsItalic);
|
||||
nonAsciiFont.setStrikeOut(TokenAccu.Style & FontStyle::fsStrikeOut);
|
||||
nonAsciiFont.setUnderline(TokenAccu.Style & FontStyle::fsUnderline);
|
||||
nonAsciiFont.setBold(mTokenAccu.style & FontStyle::fsBold);
|
||||
nonAsciiFont.setItalic(mTokenAccu.style & FontStyle::fsItalic);
|
||||
nonAsciiFont.setStrikeOut(mTokenAccu.style & FontStyle::fsStrikeOut);
|
||||
nonAsciiFont.setUnderline(mTokenAccu.style & FontStyle::fsUnderline);
|
||||
|
||||
// Paint the chars
|
||||
if (bComplexToken) {
|
||||
|
@ -531,24 +531,24 @@ void SynEditTextPainter::paintHighlightToken(bool bFillToEOL)
|
|||
setDrawingColors(false);
|
||||
rcToken.setRight(columnToXValue(nLineSelStart));
|
||||
paintToken(
|
||||
TokenAccu.s,TokenAccu.Columns,TokenAccu.ColumnsBefore,nC1,nLineSelStart,false,font,nonAsciiFont, TokenAccu.showSpecialGlyphs);
|
||||
mTokenAccu.s,mTokenAccu.columns,mTokenAccu.columnsBefore,nC1,nLineSelStart,false,font,nonAsciiFont, mTokenAccu.showSpecialGlyphs);
|
||||
}
|
||||
// selected part of the token
|
||||
setDrawingColors(true);
|
||||
nC1Sel = std::max(nLineSelStart, nC1);
|
||||
nC2Sel = std::min(nLineSelEnd, nC2);
|
||||
rcToken.setRight(columnToXValue(nC2Sel));
|
||||
paintToken(TokenAccu.s, TokenAccu.Columns, TokenAccu.ColumnsBefore, nC1Sel, nC2Sel,true,font,nonAsciiFont, TokenAccu.showSpecialGlyphs);
|
||||
paintToken(mTokenAccu.s, mTokenAccu.columns, mTokenAccu.columnsBefore, nC1Sel, nC2Sel,true,font,nonAsciiFont, mTokenAccu.showSpecialGlyphs);
|
||||
// second unselected part of the token
|
||||
if (bU2) {
|
||||
setDrawingColors(false);
|
||||
rcToken.setRight(columnToXValue(nC2));
|
||||
paintToken(TokenAccu.s, TokenAccu.Columns, TokenAccu.ColumnsBefore,nLineSelEnd, nC2,false,font,nonAsciiFont, TokenAccu.showSpecialGlyphs);
|
||||
paintToken(mTokenAccu.s, mTokenAccu.columns, mTokenAccu.columnsBefore,nLineSelEnd, nC2,false,font,nonAsciiFont, mTokenAccu.showSpecialGlyphs);
|
||||
}
|
||||
} else {
|
||||
setDrawingColors(bSel);
|
||||
rcToken.setRight(columnToXValue(nC2));
|
||||
paintToken(TokenAccu.s, TokenAccu.Columns, TokenAccu.ColumnsBefore, nC1, nC2,bSel,font,nonAsciiFont, TokenAccu.showSpecialGlyphs);
|
||||
paintToken(mTokenAccu.s, mTokenAccu.columns, mTokenAccu.columnsBefore, nC1, nC2,bSel,font,nonAsciiFont, mTokenAccu.showSpecialGlyphs);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -593,21 +593,17 @@ void SynEditTextPainter::paintHighlightToken(bool bFillToEOL)
|
|||
// Store the token chars with the attributes in the TokenAccu
|
||||
// record. This will paint any chars already stored if there is
|
||||
// a (visible) change in the attributes.
|
||||
void SynEditTextPainter::addHighlightToken(const QString &Token, int columnsBefore,
|
||||
int tokenColumns, int cLine, PTokenAttribute p_Attri)
|
||||
void SynEditTextPainter::addHighlightToken(const QString &token, int columnsBefore,
|
||||
int tokenColumns, int cLine, PTokenAttribute attri, bool showGlyphs)
|
||||
{
|
||||
bool bCanAppend;
|
||||
QColor foreground, background;
|
||||
FontStyles style;
|
||||
bool isSpaces=false;
|
||||
bool showGlyphs=false;
|
||||
|
||||
if (p_Attri) {
|
||||
foreground = p_Attri->foreground();
|
||||
background = p_Attri->background();
|
||||
style = p_Attri->styles();
|
||||
isSpaces = p_Attri->tokenType() == TokenType::Space;
|
||||
showGlyphs = isSpaces && edit->mOptions.testFlag(eoShowSpecialChars);
|
||||
if (attri) {
|
||||
foreground = attri->foreground();
|
||||
background = attri->background();
|
||||
style = attri->styles();
|
||||
} else {
|
||||
foreground = colFG;
|
||||
background = colBG;
|
||||
|
@ -625,21 +621,20 @@ void SynEditTextPainter::addHighlightToken(const QString &Token, int columnsBefo
|
|||
}
|
||||
|
||||
edit->onPreparePaintHighlightToken(cLine,edit->mSyntaxer->getTokenPos()+1,
|
||||
Token,p_Attri,style,foreground,background);
|
||||
token,attri,style,foreground,background);
|
||||
|
||||
// Do we have to paint the old chars first, or can we just append?
|
||||
bCanAppend = false;
|
||||
if (TokenAccu.Columns > 0 ) {
|
||||
if (showGlyphs == TokenAccu.showSpecialGlyphs) {
|
||||
if (mTokenAccu.columns > 0 ) {
|
||||
if (showGlyphs == mTokenAccu.showSpecialGlyphs) {
|
||||
// font style must be the same or token is only spaces
|
||||
if (TokenAccu.Style == style || ( (style & FontStyle::fsUnderline) == (TokenAccu.Style & fsUnderline)
|
||||
&& isSpaces)) {
|
||||
if (mTokenAccu.style == style) {
|
||||
if (
|
||||
// background color must be the same and
|
||||
(TokenAccu.BG == background) &&
|
||||
(mTokenAccu.background == background) &&
|
||||
// foreground color must be the same or token is only spaces
|
||||
((TokenAccu.FG == foreground) || isSpaces)) {
|
||||
bCanAppend = true;
|
||||
(mTokenAccu.foreground == foreground)) {
|
||||
bCanAppend = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -649,16 +644,16 @@ void SynEditTextPainter::addHighlightToken(const QString &Token, int columnsBefo
|
|||
}
|
||||
// Don't use AppendStr because it's more expensive.
|
||||
if (bCanAppend) {
|
||||
TokenAccu.s.append(Token);
|
||||
TokenAccu.Columns+=tokenColumns;
|
||||
mTokenAccu.s.append(token);
|
||||
mTokenAccu.columns+=tokenColumns;
|
||||
} else {
|
||||
TokenAccu.Columns = tokenColumns;
|
||||
TokenAccu.s = Token;
|
||||
TokenAccu.ColumnsBefore = columnsBefore;
|
||||
TokenAccu.FG = foreground;
|
||||
TokenAccu.BG = background;
|
||||
TokenAccu.Style = style;
|
||||
TokenAccu.showSpecialGlyphs = showGlyphs;
|
||||
mTokenAccu.columns = tokenColumns;
|
||||
mTokenAccu.s = token;
|
||||
mTokenAccu.columnsBefore = columnsBefore;
|
||||
mTokenAccu.foreground = foreground;
|
||||
mTokenAccu.background = background;
|
||||
mTokenAccu.style = style;
|
||||
mTokenAccu.showSpecialGlyphs = showGlyphs;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -814,8 +809,8 @@ void SynEditTextPainter::paintLines()
|
|||
// inside the loop. Get only the starting point for this.
|
||||
rcLine = AClip;
|
||||
rcLine.setBottom((aFirstRow - edit->mTopLine) * edit->mTextHeight);
|
||||
TokenAccu.Columns = 0;
|
||||
TokenAccu.ColumnsBefore = 0;
|
||||
mTokenAccu.columns = 0;
|
||||
mTokenAccu.columnsBefore = 0;
|
||||
// Now loop through all the lines. The indices are valid for Lines.
|
||||
BufferCoord selectionBegin = edit->blockBegin();
|
||||
BufferCoord selectionEnd= edit->blockEnd();
|
||||
|
@ -908,7 +903,7 @@ void SynEditTextPainter::paintLines()
|
|||
} else {
|
||||
nTokenColumnLen = edit->mDocument->lineColumns(vLine-1);
|
||||
}
|
||||
if (edit->mOptions.testFlag(eoShowSpecialChars) && (!bLineSelected) && (!bSpecialLine) && (nTokenColumnLen < vLastChar)) {
|
||||
if (edit->mOptions.testFlag(eoShowLineBreaks) && (!bLineSelected) && (!bSpecialLine) && (nTokenColumnLen < vLastChar)) {
|
||||
sToken = sToken + LineBreakGlyph;
|
||||
nTokenColumnLen += edit->charColumns(LineBreakGlyph);
|
||||
}
|
||||
|
@ -955,7 +950,7 @@ void SynEditTextPainter::paintLines()
|
|||
// of ExtTextOut calls necessary. This depends on the selection state
|
||||
// or the line having special colors. For spaces the foreground color
|
||||
// is ignored as well.
|
||||
TokenAccu.Columns = 0;
|
||||
mTokenAccu.columns = 0;
|
||||
nTokenColumnsBefore = 0;
|
||||
// Test first whether anything of this token is visible.
|
||||
while (!edit->mSyntaxer->eol()) {
|
||||
|
@ -1014,38 +1009,40 @@ void SynEditTextPainter::paintLines()
|
|||
}
|
||||
}
|
||||
}
|
||||
bool showGlyph=false;
|
||||
if (attr && attr->tokenType() == TokenType::Space) {
|
||||
int pos = edit->mSyntaxer->getTokenPos();
|
||||
if (pos==0) {
|
||||
showGlyph = edit->mOptions.testFlag(eoShowLeadingSpaces);
|
||||
} else if (pos+sToken.length()==sLine.length()) {
|
||||
showGlyph = edit->mOptions.testFlag(eoShowTrailingSpaces);
|
||||
} else {
|
||||
showGlyph = edit->mOptions.testFlag(eoShowInnerSpaces);
|
||||
}
|
||||
}
|
||||
addHighlightToken(sToken, nTokenColumnsBefore - (vFirstChar - FirstCol),
|
||||
nTokenColumnLen, vLine,attr);
|
||||
nTokenColumnLen, vLine,attr, showGlyph);
|
||||
}
|
||||
nTokenColumnsBefore+=nTokenColumnLen;
|
||||
// Let the highlighter scan the next token.
|
||||
edit->mSyntaxer->next();
|
||||
}
|
||||
// Don't assume HL.GetTokenPos is valid after HL.GetEOL == True.
|
||||
//nTokenColumnsBefore += edit->stringColumns(sToken,nTokenColumnsBefore);
|
||||
if (edit->mSyntaxer->eol() && (nTokenColumnsBefore < vLastChar)) {
|
||||
int lineColumns = edit->mDocument->lineColumns(vLine-1);
|
||||
// Draw text that couldn't be parsed by the highlighter, if any.
|
||||
if (nTokenColumnsBefore < lineColumns) {
|
||||
if (nTokenColumnsBefore + 1 < vFirstChar)
|
||||
nTokenColumnsBefore = vFirstChar - 1;
|
||||
nTokenColumnLen = std::min(lineColumns, vLastChar) - (nTokenColumnsBefore + 1);
|
||||
if (nTokenColumnLen > 0) {
|
||||
sToken = edit->substringByColumns(sLine,nTokenColumnsBefore+1,nTokenColumnLen);
|
||||
addHighlightToken(sToken, nTokenColumnsBefore - (vFirstChar - FirstCol),
|
||||
nTokenColumnLen, vLine, PTokenAttribute());
|
||||
}
|
||||
}
|
||||
// Draw LineBreak glyph.
|
||||
if (edit->mOptions.testFlag(eoShowSpecialChars)
|
||||
// && (!bLineSelected)
|
||||
// && (!bSpecialLine)
|
||||
&& (edit->mDocument->lineColumns(vLine-1) < vLastChar)) {
|
||||
addHighlightToken(LineBreakGlyph,
|
||||
edit->mDocument->lineColumns(vLine-1) - (vFirstChar - FirstCol),
|
||||
edit->charColumns(LineBreakGlyph),vLine, edit->mSyntaxer->whitespaceAttribute());
|
||||
}
|
||||
}
|
||||
// // Don't assume HL.GetTokenPos is valid after HL.GetEOL == True.
|
||||
// //nTokenColumnsBefore += edit->stringColumns(sToken,nTokenColumnsBefore);
|
||||
// if (edit->mSyntaxer->eol() && (nTokenColumnsBefore < vLastChar)) {
|
||||
// int lineColumns = edit->mDocument->lineColumns(vLine-1);
|
||||
// // Draw text that couldn't be parsed by the highlighter, if any.
|
||||
// if (nTokenColumnsBefore < lineColumns) {
|
||||
// if (nTokenColumnsBefore + 1 < vFirstChar)
|
||||
// nTokenColumnsBefore = vFirstChar - 1;
|
||||
// nTokenColumnLen = std::min(lineColumns, vLastChar) - (nTokenColumnsBefore + 1);
|
||||
// if (nTokenColumnLen > 0) {
|
||||
// sToken = edit->substringByColumns(sLine,nTokenColumnsBefore+1,nTokenColumnLen);
|
||||
// addHighlightToken(sToken, nTokenColumnsBefore - (vFirstChar - FirstCol),
|
||||
// nTokenColumnLen, vLine, PTokenAttribute(),false);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// Paint folding
|
||||
foldRange = edit->foldStartAtLine(vLine);
|
||||
|
@ -1055,9 +1052,18 @@ void SynEditTextPainter::paintLines()
|
|||
attr = edit->mSyntaxer->symbolAttribute();
|
||||
getBraceColorAttr(edit->mSyntaxer->getState().braceLevel,attr);
|
||||
addHighlightToken(sFold,edit->mDocument->lineColumns(vLine-1) - (vFirstChar - FirstCol)
|
||||
, nFold, vLine, attr);
|
||||
, nFold, vLine, attr,false);
|
||||
} else {
|
||||
// Draw LineBreak glyph.
|
||||
if (edit->mOptions.testFlag(eoShowLineBreaks)
|
||||
&& (!bLineSelected)
|
||||
&& (!bSpecialLine)
|
||||
&& (edit->mDocument->lineColumns(vLine-1) < vLastChar)) {
|
||||
addHighlightToken(LineBreakGlyph,
|
||||
edit->mDocument->lineColumns(vLine-1) - (vFirstChar - FirstCol),
|
||||
edit->charColumns(LineBreakGlyph),vLine, edit->mSyntaxer->whitespaceAttribute(),false);
|
||||
}
|
||||
}
|
||||
|
||||
// Draw anything that's left in the TokenAccu record. Fill to the end
|
||||
// of the invalid area with the correct colors.
|
||||
paintHighlightToken(true);
|
||||
|
|
|
@ -29,12 +29,12 @@ class SynEdit;
|
|||
class SynEditTextPainter
|
||||
{
|
||||
struct SynTokenAccu {
|
||||
int Columns;
|
||||
int ColumnsBefore;
|
||||
int columns;
|
||||
int columnsBefore;
|
||||
QString s;
|
||||
QColor FG;
|
||||
QColor BG;
|
||||
FontStyles Style;
|
||||
QColor foreground;
|
||||
QColor background;
|
||||
FontStyles style;
|
||||
bool showSpecialGlyphs;
|
||||
};
|
||||
|
||||
|
@ -55,7 +55,7 @@ private:
|
|||
void paintEditAreas(const EditingAreaList& areaList);
|
||||
void paintHighlightToken(bool bFillToEOL);
|
||||
void addHighlightToken(const QString& token, int columnsBefore, int tokenColumns,
|
||||
int cLine, PTokenAttribute p_Attri);
|
||||
int cLine, PTokenAttribute p_Attri, bool showGlyphs);
|
||||
|
||||
void paintFoldAttributes();
|
||||
void getBraceColorAttr(int level, PTokenAttribute &attr);
|
||||
|
@ -84,7 +84,7 @@ private:
|
|||
|
||||
QRect AClip;
|
||||
int aFirstRow, aLastRow, FirstCol, LastCol;
|
||||
SynTokenAccu TokenAccu;
|
||||
SynTokenAccu mTokenAccu;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue