diff --git a/NEWS.md b/NEWS.md
index f27be844..8640ba59 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,6 +1,7 @@
Version 0.7.0
- fix: Backspace still works in readonly mode
- fix: save as file dialog's operation mode is not correct
+ - enhancement: fill indents in the editor (Turned off by default)
Version 0.6.8
- enhancement: add link to cppreference in the help menu
diff --git a/RedPandaIDE/RedPandaIDE_zh_CN.qm b/RedPandaIDE/RedPandaIDE_zh_CN.qm
index 20a92073..5292606d 100644
Binary files a/RedPandaIDE/RedPandaIDE_zh_CN.qm and b/RedPandaIDE/RedPandaIDE_zh_CN.qm differ
diff --git a/RedPandaIDE/RedPandaIDE_zh_CN.ts b/RedPandaIDE/RedPandaIDE_zh_CN.ts
index 7ecf54f0..c3f7a47d 100644
--- a/RedPandaIDE/RedPandaIDE_zh_CN.ts
+++ b/RedPandaIDE/RedPandaIDE_zh_CN.ts
@@ -933,11 +933,11 @@ Are you really want to continue?
-
-
+
-
+
+
错误
@@ -947,60 +947,60 @@ Are you really want to continue?
无法写入文件"%1"
-
+
另存为
-
+
要复制的内容超过了行数限制!
-
+
要复制的内容超过了字符数限制!
-
+
要剪切的内容超过了行数限制!
-
+
要剪切的内容超过了字符数限制!
-
+
打印文档
-
-
-
+
+
+
Ctrl+单击以获取更多信息
-
-
+
+
未找到符号'%1'!
-
+
断点条件
-
+
输入当前断点的生效条件:
-
+
只读
@@ -4857,175 +4857,175 @@ Are you really want to continue?
无法载入自动链接设置
-
-
+
+
下列%1文件夹不存在:
-
-
+
+
二进制
-
+
未指定%1文件夹
-
+
C包含
-
+
C++包含
-
-
-
-
+
+
+
+
无法找到%1程序"%2"
-
+
C语言选项
-
+
支持所有ANSI标准C程序(-ansi)
-
+
不支持将asm、inline和typeof作为关键字(-fno-asm)
-
+
模仿传统C预处理器行为(-traditional-cpp)
-
+
代码生成
-
+
生成特定机器的专用指令(-march)
-
+
完整兼容特定机器,较少优化(-tune)
-
+
启用特定指令集(-mx)
-
+
优化级别(-Ox)
-
+
使用下列指针大小编译(-mx)
-
+
语言标准(-std)
-
+
性能分析
-
+
生成调试信息(-g3)
-
+
生成性能分析信息(-pg)
-
+
代码警告
-
+
忽略所有警告信息(-w)
-
+
启用常见问题警告(-Wall)
-
+
启用更多问题警告(-Wextra)
-
+
检查ISO C/C++/C++0x语法一致性(-pedantic)
-
+
只进行语法检查(不编译)(-fsyntax-only)
-
+
将警告作为错误处理(-Werror)
-
+
遇到第一个错误后立即中止编译(-Wfatal-errors)
-
+
链接器
-
+
链接Objective-C程序 (-lobjc)
-
+
不使用标准库和系统启动文件(-nostdlib)
-
+
不产生控制台窗口(-mwindows)
-
+
剥除附加信息(-s)
@@ -5034,43 +5034,43 @@ Are you really want to continue?
链接Ojbective C程序(-lobjc)
-
+
输出
-
+
在生成的汇编代码中加入注释(-fverbose-asm)
-
+
编译时使用管道而不是临时文件(-pipe)
-
+
只生成汇编代码(-S)
-
-
+
+
确认
-
+
在验证编译器设置"%1"时遇到了下列问题:
-
+
未配置编译器设置。
-
+
您需要小熊猫C++在下列位置搜索编译器吗:<br />%1<br />%2
@@ -6097,8 +6097,8 @@ Are you really want to continue?
SynEdit
-
-
+
+
高亮处理进入了死循环
@@ -6320,87 +6320,92 @@ Are you really want to continue?
缩进提示线颜色
-
+
+
+ 填充缩进区域
+
+
+
光标
-
+
按下HOME键时,光标定位在本行的第一个非空格字符处
-
+
按下End键时,光标定位在本行的最后一个非空格字符处
-
+
在上下移动光标时,记住起始时光标所在栏数
-
+
插入状态下的光标
-
+
使用文字颜色作为光标颜色
-
+
滚动条
-
+
自动隐藏滚动条
-
+
可以将每行末尾字符滚动到编辑器最左侧
-
+
可以将最后一行滚动到编辑器最上方
-
+
翻页键只滚动半页
-
+
在滚动页时少滚动一行
-
+
显示右边缘线
-
+
右边缘宽度
-
+
右边缘颜色
-
+
覆写状态下的光标
-
+
光标颜色
diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp
index d99ba82e..10c33532 100644
--- a/RedPandaIDE/editor.cpp
+++ b/RedPandaIDE/editor.cpp
@@ -3581,6 +3581,7 @@ void Editor::applySettings()
codeFolding().indentGuides = pSettings->editor().showIndentLines();
codeFolding().indentGuidesColor = pSettings->editor().indentLineColor();
+ codeFolding().fillIndents = pSettings->editor().fillIndents();
QFont f=QFont(pSettings->editor().fontName(),pSettings->editor().fontSize());
f.setStyleStrategy(QFont::PreferAntialias);
diff --git a/RedPandaIDE/qsynedit/CodeFolding.cpp b/RedPandaIDE/qsynedit/CodeFolding.cpp
index 7eb65b99..7724cb59 100644
--- a/RedPandaIDE/qsynedit/CodeFolding.cpp
+++ b/RedPandaIDE/qsynedit/CodeFolding.cpp
@@ -23,6 +23,7 @@ PSynEditFoldRegion SynEditFoldRegions::get(int index)
}
SynEditCodeFolding::SynEditCodeFolding():
+ fillIndents(false),
indentGuides(true),
showCollapsedLine(true),
collapsedLineColor(QColor("black")),
diff --git a/RedPandaIDE/qsynedit/CodeFolding.h b/RedPandaIDE/qsynedit/CodeFolding.h
index 1dbf6689..41e0004e 100644
--- a/RedPandaIDE/qsynedit/CodeFolding.h
+++ b/RedPandaIDE/qsynedit/CodeFolding.h
@@ -29,6 +29,7 @@ struct SynEditFoldRegion {
struct SynEditCodeFolding {
bool indentGuides;
+ bool fillIndents;
bool showCollapsedLine;
QColor collapsedLineColor;
QColor folderBarLinesColor;
diff --git a/RedPandaIDE/qsynedit/TextPainter.cpp b/RedPandaIDE/qsynedit/TextPainter.cpp
index 6182bdb9..522034a6 100644
--- a/RedPandaIDE/qsynedit/TextPainter.cpp
+++ b/RedPandaIDE/qsynedit/TextPainter.cpp
@@ -650,12 +650,17 @@ void SynEditTextPainter::PaintFoldAttributes()
// Paint indent guides. Use folds to determine indent value of these
// Use a separate loop so we can use a custom pen
// Paint indent guides using custom pen
- if (edit->mCodeFolding.indentGuides) {
- QPen dottedPen(Qt::PenStyle::DashLine);
- dottedPen.setColor(edit->mCodeFolding.indentGuidesColor);
-
+ if (edit->mCodeFolding.indentGuides || edit->mCodeFolding.fillIndents) {
+ QColor paintColor;
+ if (edit->mCodeFolding.indentGuidesColor.isValid()) {
+ paintColor = edit->mCodeFolding.indentGuidesColor;
+ } else {
+ paintColor = edit->palette().color(QPalette::Text);
+ }
+ QColor gradientStart = paintColor;
+ QColor gradientEnd = paintColor;
QPen oldPen = painter->pen();
- painter->setPen(dottedPen);
+
// Now loop through all the lines. The indices are valid for Lines.
for (cRow = aFirstRow; cRow<=aLastRow;cRow++) {
vLine = edit->rowToLine(cRow);
@@ -682,21 +687,43 @@ void SynEditTextPainter::PaintFoldAttributes()
//TabSteps = edit->mTabWidth;
TabSteps = 0;
indentLevel = 0;
+
while (TabSteps < LineIndent) {
X = TabSteps * edit->mCharWidth + edit->textOffset() - 2;
TabSteps+=edit->mTabWidth;
indentLevel++ ;
if (edit->mHighlighter) {
- PSynHighlighterAttribute attr = edit->mHighlighter->symbolAttribute();
- GetBraceColorAttr(indentLevel,attr);
- if (attr!=edit->mHighlighter->symbolAttribute()) {
- dottedPen.setColor(attr->foreground());
- painter->setPen(dottedPen);
+ if (edit->mCodeFolding.indentGuides) {
+ PSynHighlighterAttribute attr = edit->mHighlighter->symbolAttribute();
+ GetBraceColorAttr(indentLevel,attr);
+ paintColor = attr->foreground();
}
+ if (edit->mCodeFolding.fillIndents) {
+ PSynHighlighterAttribute attr = edit->mHighlighter->symbolAttribute();
+ GetBraceColorAttr(indentLevel,attr);
+ gradientStart=attr->foreground();
+ attr = edit->mHighlighter->symbolAttribute();
+ GetBraceColorAttr(indentLevel+1,attr);
+ gradientStart=attr->foreground();
+ }
+ }
+ if (edit->mCodeFolding.fillIndents) {
+ int X1=TabSteps * edit->mCharWidth + edit->textOffset() - 2;
+ gradientStart.setAlpha(20);
+ gradientEnd.setAlpha(10);
+ QLinearGradient gradient(X,Y,X1,Y);
+ gradient.setColorAt(0,gradientStart);
+ gradient.setColorAt(1,gradientEnd);
+ painter->fillRect(X,Y,edit->mTabWidth * edit->mCharWidth,edit->mTextHeight,gradient);
}
// Move to top of vertical line
- painter->drawLine(X,Y,X,Y+edit->mTextHeight);
+ if (edit->mCodeFolding.indentGuides) {
+ QPen dottedPen(Qt::PenStyle::DashLine);
+ dottedPen.setColor(paintColor);
+ painter->setPen(dottedPen);
+ painter->drawLine(X,Y,X,Y+edit->mTextHeight);
+ }
}
}
painter->setPen(oldPen);
@@ -920,18 +947,24 @@ void SynEditTextPainter::PaintLines()
}
// It's at least partially visible. Get the token attributes now.
attr = edit->mHighlighter->getTokenAttribute();
- if (sToken == "[") {
- GetBraceColorAttr(edit->mHighlighter->getRangeState().bracketLevel,attr);
- } else if (sToken == "]") {
- GetBraceColorAttr(edit->mHighlighter->getRangeState().bracketLevel+1,attr);
- } else if (sToken == "(") {
- GetBraceColorAttr(edit->mHighlighter->getRangeState().parenthesisLevel,attr);
- } else if (sToken == ")") {
- GetBraceColorAttr(edit->mHighlighter->getRangeState().parenthesisLevel+1,attr);
- } else if (sToken == "{") {
- GetBraceColorAttr(edit->mHighlighter->getRangeState().braceLevel,attr);
- } else if (sToken == "}") {
- GetBraceColorAttr(edit->mHighlighter->getRangeState().braceLevel+1,attr);
+ if (sToken == "["
+ || sToken == "("
+ || sToken == "{"
+ ) {
+ SynRangeState rangeState = edit->mHighlighter->getRangeState();
+ GetBraceColorAttr(rangeState.bracketLevel
+ +rangeState.braceLevel
+ +rangeState.parenthesisLevel
+ ,attr);
+ } else if (sToken == "]"
+ || sToken == ")"
+ || sToken == "}"
+ ){
+ SynRangeState rangeState = edit->mHighlighter->getRangeState();
+ GetBraceColorAttr(rangeState.bracketLevel
+ +rangeState.braceLevel
+ +rangeState.parenthesisLevel+1,
+ attr);
}
if (bCurrentLine && edit->mInputPreeditString.length()>0) {
int startPos = edit->mHighlighter->getTokenPos()+1;
diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp
index 99217cf9..406cb7af 100644
--- a/RedPandaIDE/settings.cpp
+++ b/RedPandaIDE/settings.cpp
@@ -487,6 +487,16 @@ void Settings::Editor::setShowFunctionTips(bool newShowFunctionTips)
mShowFunctionTips = newShowFunctionTips;
}
+bool Settings::Editor::fillIndents() const
+{
+ return mfillIndents;
+}
+
+void Settings::Editor::setFillIndents(bool newFillIndents)
+{
+ mfillIndents = newFillIndents;
+}
+
bool Settings::Editor::enableTooltips() const
{
return mEnableTooltips;
@@ -957,6 +967,7 @@ void Settings::Editor::doSave()
saveValue("tab_width", mTabWidth);
saveValue("show_indent_lines", mShowIndentLines);
saveValue("indent_line_color",mIndentLineColor);
+ saveValue("fill_indents",mfillIndents);
// caret
saveValue("enhance_home_key",mEnhanceHomeKey);
saveValue("enhance_end_key",mEnhanceEndKey);
@@ -1063,6 +1074,7 @@ void Settings::Editor::doLoad()
mTabWidth = intValue("tab_width",4);
mShowIndentLines = boolValue("show_indent_lines",true);
mIndentLineColor = colorValue("indent_line_color",QColorConstants::Svg::silver);
+ mfillIndents = boolValue("fill_indents", false);
// caret
mEnhanceHomeKey = boolValue("enhance_home_key", true);
mEnhanceEndKey = boolValue("enhance_end_key",true);
diff --git a/RedPandaIDE/settings.h b/RedPandaIDE/settings.h
index 2b3d89c7..f2893888 100644
--- a/RedPandaIDE/settings.h
+++ b/RedPandaIDE/settings.h
@@ -320,6 +320,9 @@ public:
bool showFunctionTips() const;
void setShowFunctionTips(bool newShowFunctionTips);
+ bool fillIndents() const;
+ void setFillIndents(bool newFillIndents);
+
private:
//General
// indents
@@ -329,6 +332,7 @@ public:
int mTabWidth;
bool mShowIndentLines;
QColor mIndentLineColor;
+ bool mfillIndents;
// caret
bool mEnhanceHomeKey;
bool mEnhanceEndKey;
diff --git a/RedPandaIDE/settingsdialog/editorgeneralwidget.cpp b/RedPandaIDE/settingsdialog/editorgeneralwidget.cpp
index 88f7831d..40e10921 100644
--- a/RedPandaIDE/settingsdialog/editorgeneralwidget.cpp
+++ b/RedPandaIDE/settingsdialog/editorgeneralwidget.cpp
@@ -44,6 +44,7 @@ void EditorGeneralWidget::doLoad()
ui->spTabWidth->setValue(pSettings->editor().tabWidth());
ui->chkShowIndentLines->setChecked(pSettings->editor().showIndentLines());
ui->colorIndentLine->setColor(pSettings->editor().indentLineColor());
+ ui->chkFillIndents->setChecked(pSettings->editor().fillIndents());
//carets
ui->chkEnhanceHome->setChecked(pSettings->editor().enhanceHomeKey());
ui->chkEnhanceEndKey->setChecked(pSettings->editor().enhanceEndKey());
@@ -73,6 +74,8 @@ void EditorGeneralWidget::doSave()
pSettings->editor().setTabWidth(ui->spTabWidth->value());
pSettings->editor().setShowIndentLines(ui->chkShowIndentLines->isChecked());
pSettings->editor().setIndentLineColor(ui->colorIndentLine->color());
+ pSettings->editor().setFillIndents(ui->chkFillIndents->isChecked());
+
//carets
pSettings->editor().setEnhanceHomeKey(ui->chkEnhanceHome->isChecked());
pSettings->editor().setEnhanceEndKey(ui->chkEnhanceEndKey->isChecked());
diff --git a/RedPandaIDE/settingsdialog/editorgeneralwidget.ui b/RedPandaIDE/settingsdialog/editorgeneralwidget.ui
index aa26d386..2edd34b8 100644
--- a/RedPandaIDE/settingsdialog/editorgeneralwidget.ui
+++ b/RedPandaIDE/settingsdialog/editorgeneralwidget.ui
@@ -120,6 +120,13 @@
+ -
+
+
+ Fill Indents
+
+
+
diff --git a/RedPandaIDE/systemconsts.h b/RedPandaIDE/systemconsts.h
index b9ffa4bd..324224fd 100644
--- a/RedPandaIDE/systemconsts.h
+++ b/RedPandaIDE/systemconsts.h
@@ -5,8 +5,8 @@
#define DEVCPP_VERSION "0.6.9"
-#ifdef Q_OS_WIN
#define APP_SETTSINGS_FILENAME "redpandacpp.ini"
+#ifdef Q_OS_WIN
#define GCC_PROGRAM "gcc.exe"
#define GPP_PROGRAM "g++.exe"
#define GDB_PROGRAM "gdb.exe"
@@ -16,8 +16,17 @@
#define GPROF_PROGRAM "gprof.exe"
#define CLEAN_PROGRAM "del /q /f"
#define CPP_PROGRAM "cpp.exe"
+#elif defined(Q_OS_LINUX)
+#define GCC_PROGRAM "gcc"
+#define GPP_PROGRAM "g++"
+#define GDB_PROGRAM "gdb"
+#define GDB32_PROGRAM "gdb32"
+#define MAKE_PROGRAM "make"
+#define GPROF_PROGRAM "gprof"
+#define CLEAN_PROGRAM "rm -rf"
+#define CPP_PROGRAM "cpp"
#else
-#error "Only support windows now!"
+#error "Only support windows and linux now!"
#endif
#define DEV_PROJECT_EXT "dev"
@@ -46,7 +55,7 @@
# define STATIC_LIB_EXT "a"
# define DYNAMIC_LIB_EXT "dll"
# define MAKEFILE_NAME "makefile.win"
-#elif Q_OS_LINUX
+#elif defined(Q_OS_LINUX)
# define PATH_SENSITIVITY Qt::CaseSensitive
# define PATH_SEPARATOR ":"
# define NULL_FILE "/dev/null"