diff --git a/NEWS.md b/NEWS.md index 6d581c2a..f906468c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -13,6 +13,9 @@ Red Panda C++ Version 0.14.5 - enhancement: better processing of symbol completion - enhancement: better support of ligatures - enhancement: use the expression evaluation logic to handle "goto declaration"/"goto definition" + - enhancement: reduce startup time by about 1 second. + - enhancement: add option "mouse selection/drag scroll speed" in the options dialog's "Editor" / "general" tab. + - fix: scroll speed of mouse selection/drag is too fast Red Panda C++ Version 0.14.4 - enhancement: git - log diff --git a/RedPandaIDE/RedPandaIDE_zh_CN.ts b/RedPandaIDE/RedPandaIDE_zh_CN.ts index 8d623312..d7cf17cd 100644 --- a/RedPandaIDE/RedPandaIDE_zh_CN.ts +++ b/RedPandaIDE/RedPandaIDE_zh_CN.ts @@ -1309,45 +1309,43 @@ Are you really want to continue? 要剪切的内容超过了字符数限制! - + Print Document 打印文档 - - - + + + Ctrl+click for more info Ctrl+单击以获取更多信息 - - Symbol '%1' not found! - 未找到符号'%1'! + 未找到符号'%1'! - + astyle not found 找不到astyle程序 - + Can't find astyle in "%1". 找不到astyle程序"%1". - + Break point condition 断点条件 - + Enter the condition of the breakpoint: 输入当前断点的生效条件: - + Readonly 只读 @@ -3774,11 +3772,11 @@ Are you really want to continue? - - - - - + + + + + Issues 编译器 @@ -4201,7 +4199,7 @@ Are you really want to continue? - + New Problem Set 新建试题集 @@ -4220,14 +4218,14 @@ Are you really want to continue? - + Save Problem Set 保存试题集 - + Load Problem Set 载入试题集 @@ -4566,7 +4564,7 @@ Are you really want to continue? - + Clear all breakpoints 删除所有断点 @@ -4667,7 +4665,7 @@ Are you really want to continue? - + Rename Symbol 重命名符号 @@ -4688,13 +4686,13 @@ Are you really want to continue? - + Export As RTF 导出为RTF - + Export As HTML 导出为HTML @@ -5174,7 +5172,7 @@ Are you really want to continue? - + Problem Set %1 试题集%1 @@ -5248,15 +5246,15 @@ Are you really want to continue? - - + + Bookmark Description 书签描述 - - + + Description: 描述: @@ -5377,7 +5375,7 @@ Are you really want to continue? - + Delete 删除 @@ -5454,7 +5452,7 @@ Are you really want to continue? - + Do you want to save it? 需要保存吗? @@ -5478,141 +5476,141 @@ Are you really want to continue? - + Save Error 保存失败 - + Change Project Compiler Set 改变项目编译器配置集 - + Change the project's compiler set will lose all custom compiler set options. 改变项目的编译器配置集会导致所有的自定义编译器选项被重置。 - + Do you really want to do that? 你真的想要做那些吗? - + Do you really want to clear all breakpoints in this file? 您真的要清除该文件的所有断点吗? - + New project 新建项目 - + Close %1 and start new project? 关闭'%1'以打开新项目? - + Folder not exist 文件夹不存在 - + Folder '%1' doesn't exist. Create it now? 文件夹'%1'不存在。是否创建? - + Can't create folder 无法创建文件夹 - + Failed to create folder '%1'. 创建文件夹'%1'失败。 - + Save new project as - + Folder %1 is not empty. 文件夹%1不是空的。 - + Do you really want to delete it? 你真的要删除它吗? - + Can't Commit 无法提交 - + Git needs user info to commit. Git需要用信息进行提交。 - + Choose Working Folder 选择工作文件夹 - - + + Header Exists 头文件已存在 - - + + Header file "%1" already exists! 头文件"%1"已存在! - + Source Exists 源文件已存在! - + Source file "%1" already exists! 源文件"%1"已存在! - + Can't commit! 无法提交! - + The following files are in conflicting: 下列文件处于冲突状态,请解决后重新添加和提交: - + Commit Message 提交信息 - + Commit Message: 提交信息: - + Commit Failed 提交失败 - + Commit message shouldn't be empty! 提交信息不能为空! @@ -5621,125 +5619,125 @@ Are you really want to continue? 小熊猫Dev-C++项目文件 (*.dev) - + New project fail 新建项目失败 - + Can't assign project template 无法使用模板创建项目 - + Remove file 删除文件 - + Remove the file from disk? 同时从硬盘上删除文件? - + untitled 无标题 - + New Project File Name 新的项目文件名 - + File Name: 文件名: - + File Already Exists! 文件已存在! - + File '%1' already exists! 文件'%1'已经存在! - + Add to project 添加到项目 - + Red Panda C++ project file (*.dev) 小熊猫C++项目文件(*.dev) - + Rename Error 重命名出错 - + Symbol '%1' is defined in system header. 符号'%1'在系统头文件中定义,无法修改。 - + New Name 新名称 - - + + Replace Error 替换出错 - + Can't open file '%1' for replace! 无法打开文件'%1'进行替换! - + Contents has changed since last search! 内容和上次查找时不一致。 - + Rich Text Format Files (*.rtf) RTF格式文件 (*.rtf) - + HTML Files (*.html) HTML文件 (*.html) - + The current problem set is not empty. 当前的试题集不是空的。 - + Problem %1 试题%1 - - + + Problem Set Files (*.pbs) 试题集文件 (*.pbs) - + Load Error 载入失败 - + Problem Case %1 试题案例%1 @@ -5755,10 +5753,10 @@ Are you really want to continue? - - - - + + + + Error 错误 @@ -5810,50 +5808,50 @@ Are you really want to continue? 打开 - + Compile Failed 编译失败 - + Run Failed 运行失败 - - + + Confirm Convertion 确认转换 - - + + The editing file will be saved using %1 encoding. <br />This operation can't be reverted. <br />Are you sure to continue? 当前编辑器中的文件将会使用%1编码保存。<br />这项操作无法被撤回。<br />你确定要继续吗? - + New Watch Expression 新监视表达式 - + Enter Watch Expression (it is recommended to use 'this->' for class members): 输入监视表达式 - + Parsing file %1 of %2: "%3" (%1/%2)正在解析文件"%3" - - + + Done parsing %1 files in %2 seconds 完成%1个文件的解析,用时%2秒 - + (%1 files per second) (每秒%1个文件) @@ -6832,7 +6830,7 @@ Are you really want to continue? QApplication - + Error 错误 @@ -6902,205 +6900,205 @@ Are you really want to continue? 无法写入配置文件夹"%1" - + Can't load autolink settings 无法载入自动链接设置 - - + + The following %1 directories don't exist: 下列%1文件夹不存在: - - + + binary 二进制 - + No %1 directories have been specified. 未指定%1文件夹 - + C include C包含 - + C++ include C++包含 - - - - + + + + Cannot find the %1 "%2" 无法找到%1程序"%2" - + C Compiler C编译器 - + C++ Compiler C++编译器 - + Maker 构建程序(Make) - + Debugger 调试器 - + C options C语言选项 - + Support all ANSI standard C programs (-ansi) 支持所有ANSI标准C程序(-ansi) - + Do not recognize asm,inline or typeof as a keyword (-fno-asm) 不支持将asm、inline和typeof作为关键字(-fno-asm) - + Imitate traditional C preprocessors (-traditional-cpp) 模仿传统C预处理器行为(-traditional-cpp) - + Code Generation 代码生成 - + Optimize for the following machine (-march) 生成特定机器的专用指令(-march) - + Optimize less, while maintaining full compatibility (-tune) 完整兼容特定机器,较少优化(-tune) - + Enable use of specific instructions (-mx) 启用特定指令集(-mx) - + Optimization level (-Ox) 优化级别(-Ox) - + Compile with the following pointer size (-mx) 使用下列指针大小编译(-mx) - + Language standard (-std) 语言标准(-std) - + Profile 性能分析 - + Generate debugging information (-g3) 生成调试信息(-g3) - + Would you like Red Panda C++ to search for compilers in PATH? 您同意小熊猫C++在PATH路径中寻找gcc编译器吗? - + Generate profiling info for analysis (-pg) 生成性能分析信息(-pg) - + Warnings 代码警告 - + Inhibit all warning messages (-w) 忽略所有警告信息(-w) - + Show most warnings (-Wall) 启用常见问题警告(-Wall) - + Show some more warnings (-Wextra) 启用更多问题警告(-Wextra) - + Check ISO C/C++/C++0x conformance (-pedantic) 检查ISO C/C++/C++0x语法一致性(-pedantic) - + Only check the code for syntax errors (-fsyntax-only) 只进行语法检查(不编译)(-fsyntax-only) - + Make all warnings into errors (-Werror) 将警告作为错误处理(-Werror) - + Abort compilation on first error (-Wfatal-errors) 遇到第一个错误后立即中止编译(-Wfatal-errors) - + Linker 链接器 - + Link an Objective C program (-lobjc) 链接Objective-C程序 (-lobjc) - + Do not use standard system libraries (-nostdlib) 不使用标准库和系统启动文件(-nostdlib) - + Do not create a console window (-mwindows) 不产生控制台窗口(-mwindows) - + Strip executable (-s) 剥除附加信息(-s) @@ -7109,54 +7107,54 @@ Are you really want to continue? 链接Ojbective C程序(-lobjc) - + Output 输出 - + Put comments in generated assembly code (-fverbose-asm) 在生成的汇编代码中加入注释(-fverbose-asm) - + Use pipes instead of temporary files during compilation (-pipe) 编译时使用管道而不是临时文件(-pipe) - + Do not assemble, compile and generate the assemble code (-S) 只生成汇编代码(-S) - - + + Confirm 确认 - + The following problems were found during validation of compiler set "%1": 在验证编译器设置"%1"时遇到了下列问题: - + Would you like Red Panda C++ to remove them for you and add the default paths to the valid paths? 是否让小熊猫C++删除这些配置,并尝试重新建立配置? - + Leaving those directories will lead to problems during compilation.<br /><br />Unless you know exactly what you're doing, it is recommended that you click Yes. 如果仍然保留这些设置,可能会导致编译错误。<br /><br />请选择“是”,除非您清楚的知道选择“否”的后果, - - + + Compiler set not configuared. 未配置编译器设置。 - + Would you like Red Panda C++ to search for compilers in the following locations: <BR />'%1'<BR />'%2'? 您需要小熊猫C++在下列位置搜索编译器吗:<br />%1<br />%2 @@ -7996,7 +7994,7 @@ Are you really want to continue? 自动链接 - + @@ -8072,15 +8070,15 @@ Are you really want to continue? 杂项 - - + + Program Runner 程序运行 - + Problem Set 试题集 @@ -8329,8 +8327,8 @@ Are you really want to continue? SynEdit - - + + The highlighter seems to be in an infinite loop 高亮处理进入了死循环 @@ -8725,17 +8723,23 @@ Are you really want to continue? 鼠标滚轮卷轴速度(行) - + + Mouse Selection/Dragging Scroll Speed + Mouse Selection/Dragging Speed + 鼠标选择/拖拽卷轴速度 + + + Show right edge line 显示右边缘线 - + Right egde width 右边缘宽度 - + Right edge line color 右边缘颜色 diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index 96432248..9de1a001 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -4253,6 +4253,7 @@ void Editor::applySettings() } setMouseWheelScrollSpeed(pSettings->editor().mouseWheelScrollSpeed()); + setMouseSelectionScrollSpeed(pSettings->editor().mouseSelectionScrollSpeed()); invalidate(); } diff --git a/RedPandaIDE/main.cpp b/RedPandaIDE/main.cpp index 6814248a..b0527047 100644 --- a/RedPandaIDE/main.cpp +++ b/RedPandaIDE/main.cpp @@ -255,9 +255,9 @@ int main(int argc, char *argv[]) QString settingFilename = getSettingFilename(QString(), firstRun); bool openInSingleInstance = false; if (!settingFilename.isEmpty() && !firstRun) { - Settings settings(settingFilename); - settings.load(); - openInSingleInstance = settings.environment().openFilesInSingleInstance(); + QSettings envSetting(settingFilename,QSettings::IniFormat); + envSetting.beginGroup(SETTING_ENVIRONMENT); + openInSingleInstance = envSetting.value("open_files_in_single_instance",false).toBool(); } else if (!settingFilename.isEmpty() && firstRun) openInSingleInstance = false; if (openInSingleInstance) { @@ -281,7 +281,6 @@ int main(int argc, char *argv[]) } } } - //Translation must be loaded first QTranslator trans,transQt; bool firstRun; @@ -293,7 +292,6 @@ int main(int argc, char *argv[]) tempFile.remove(); return -1; } - { QSettings languageSetting(settingFilename,QSettings::IniFormat); languageSetting.beginGroup(SETTING_ENVIRONMENT); @@ -306,7 +304,6 @@ int main(int argc, char *argv[]) app.installTranslator(&transQt); } } - qRegisterMetaType("PCompileIssue"); qRegisterMetaType("PCompileIssue&"); qRegisterMetaType>("QVector"); @@ -342,7 +339,6 @@ int main(int argc, char *argv[]) pSettings->vcs().detectGitInPath(); } auto settings = std::unique_ptr(pSettings); - //Color scheme settings must be loaded after translation pColorManager = new ColorManager(); pIconsManager = new IconsManager(); diff --git a/RedPandaIDE/qsynedit/SynEdit.cpp b/RedPandaIDE/qsynedit/SynEdit.cpp index 86a3dd3a..f5eb870d 100644 --- a/RedPandaIDE/qsynedit/SynEdit.cpp +++ b/RedPandaIDE/qsynedit/SynEdit.cpp @@ -90,7 +90,8 @@ SynEdit::SynEdit(QWidget *parent) : QAbstractScrollArea(parent) // fRightEdge has to be set before FontChanged is called for the first time mRightEdge = 80; - mMouseWheelScrollSpeed = 1; + mMouseWheelScrollSpeed = 3; + mMouseSelectionScrollSpeed = 1; mGutter.setRightOffset(21); mGutter.connect(&mGutter, &SynGutter::changed, this, &SynEdit::onGutterChanged); @@ -1804,17 +1805,18 @@ void SynEdit::doMouseScroll(bool isDragging) C = pixelsToRowColumn(iMousePos.x(), iMousePos.y()); C.Row = minMax(C.Row, 1, displayLineCount()); if (mScrollDeltaX != 0) { - setLeftChar(leftChar() + mScrollDeltaX); + setLeftChar(leftChar() + mScrollDeltaX * mMouseSelectionScrollSpeed); X = leftChar(); if (mScrollDeltaX > 0) // scrolling right? X+=charsInWindow(); C.Column = X; } if (mScrollDeltaY != 0) { + //qDebug()< 0) // scrolling down? Y+=mLinesInWindow - 1; @@ -2489,17 +2491,15 @@ void SynEdit::computeCaret(int X, int Y) void SynEdit::computeScroll(int X, int Y, bool isDragging) { - if (!isDragging) { - Qt::MouseButtons buttons = qApp->mouseButtons(); - if (!buttons.testFlag(Qt::LeftButton)) - return; - } + Qt::MouseButtons buttons = qApp->mouseButtons(); + if (!buttons.testFlag(Qt::LeftButton)) + return; QRect iScrollBounds; // relative to the client area int dispX=2,dispY = 2; - if (isDragging) { - dispX = mCharWidth / 2 -1; - dispY = mTextHeight/ 2 -1; - } +// if (isDragging) { +// dispX = mCharWidth / 2 -1; +// dispY = mTextHeight/ 2 -1; +// } int left = mGutterWidth+frameWidth()+dispX; int top = frameWidth()+dispY; iScrollBounds = QRect(left, @@ -2529,13 +2529,13 @@ void SynEdit::computeScroll(int X, int Y, bool isDragging) mScrollDeltaY = 0; } - if (mScrollDeltaX!=0 || mScrollDeltaY!=0) { - if (isDragging) { - mScrollTimer->singleShot(100,this,&SynEdit::onDraggingScrollTimeout); - } else { - mScrollTimer->singleShot(100,this,&SynEdit::onScrollTimeout); - } +// if (mScrollDeltaX!=0 || mScrollDeltaY!=0) { + if (isDragging) { + mScrollTimer->singleShot(100,this,&SynEdit::onDraggingScrollTimeout); + } else { + mScrollTimer->singleShot(100,this,&SynEdit::onScrollTimeout); } +// } } void SynEdit::doBlockIndent() @@ -3780,6 +3780,16 @@ void SynEdit::onScrolled(int) invalidate(); } +int SynEdit::mouseSelectionScrollSpeed() const +{ + return mMouseSelectionScrollSpeed; +} + +void SynEdit::setMouseSelectionScrollSpeed(int newMouseSelectionScrollSpeed) +{ + mMouseSelectionScrollSpeed = newMouseSelectionScrollSpeed; +} + const QFont &SynEdit::fontForNonAscii() const { return mFontForNonAscii; @@ -5912,6 +5922,7 @@ void SynEdit::mousePressEvent(QMouseEvent *event) //Selection mode must be set before calling SetBlockBegin setBlockBegin(caretXY()); } + computeScroll(X,Y,false); } } } @@ -5964,7 +5975,7 @@ void SynEdit::mouseMoveEvent(QMouseEvent *event) } } else if ((buttons == Qt::LeftButton)) { // should we begin scrolling? - computeScroll(X, Y,false); + //computeScroll(X, Y,false); DisplayCoord P = pixelsToNearestRowColumn(X, Y); P.Row = minMax(P.Row, 1, displayLineCount()); if (mScrollDeltaX != 0) @@ -6076,6 +6087,8 @@ void SynEdit::dragEnterEvent(QDragEnterEvent *event) setBlockBegin(mDragSelBeginSave); setBlockEnd(mDragSelEndSave); showCaret(); + computeScroll(event->pos().x(), + event->pos().y(),true); } } @@ -6146,8 +6159,8 @@ void SynEdit::dragMoveEvent(QDragMoveEvent *event) event->setDropAction(Qt::MoveAction); } // should we begin scrolling? - computeScroll(event->pos().x(), - event->pos().y(),true); +// computeScroll(event->pos().x(), +// event->pos().y(),true); BufferCoord coord = displayToBufferPos(pixelsToNearestRowColumn(event->pos().x(), event->pos().y())); diff --git a/RedPandaIDE/qsynedit/SynEdit.h b/RedPandaIDE/qsynedit/SynEdit.h index 81352f5d..eafe37ec 100644 --- a/RedPandaIDE/qsynedit/SynEdit.h +++ b/RedPandaIDE/qsynedit/SynEdit.h @@ -723,6 +723,7 @@ private: QString mInputPreeditString; int mMouseWheelScrollSpeed; + int mMouseSelectionScrollSpeed; BufferCoord mDragCaretSave; BufferCoord mDragSelBeginSave; @@ -760,6 +761,9 @@ QVariant inputMethodQuery(Qt::InputMethodQuery property) const override; const QFont &fontForNonAscii() const; void setFontForNonAscii(const QFont &newFontForNonAscii); +int mouseSelectionScrollSpeed() const; +void setMouseSelectionScrollSpeed(int newMouseSelectionScrollSpeed); + protected: void dragEnterEvent(QDragEnterEvent *event) override; void dropEvent(QDropEvent *event) override; diff --git a/RedPandaIDE/qsynedit/TextPainter.cpp b/RedPandaIDE/qsynedit/TextPainter.cpp index 70f4e42a..415a5942 100644 --- a/RedPandaIDE/qsynedit/TextPainter.cpp +++ b/RedPandaIDE/qsynedit/TextPainter.cpp @@ -431,7 +431,6 @@ void SynEditTextPainter::PaintToken(const QString &Token, int TokenCols, int Col textToPaint+=Token[i]; } painter->drawText(nX,rcToken.bottom()-painter->fontMetrics().descent() , textToPaint); - qDebug()<chkScrollHalfPage->setChecked(pSettings->editor().halfPageScroll()); ui->chkScrollByOneLess->setChecked(pSettings->editor().scrollByOneLess()); ui->spinMouseWheelScrollSpeed->setValue(pSettings->editor().mouseWheelScrollSpeed()); + ui->spinMouseSelectionScrollSpeed->setValue(pSettings->editor().mouseSelectionScrollSpeed()); //right margin line; ui->grpRightEdge->setChecked(pSettings->editor().showRightEdgeLine()); @@ -114,6 +115,7 @@ void EditorGeneralWidget::doSave() pSettings->editor().setScrollByOneLess(ui->chkScrollByOneLess->isChecked()); pSettings->editor().setHalfPageScroll(ui->chkScrollHalfPage->isChecked()); pSettings->editor().setMouseWheelScrollSpeed(ui->spinMouseWheelScrollSpeed->value()); + pSettings->editor().setMouseSelectionScrollSpeed(ui->spinMouseSelectionScrollSpeed->value()); //right margin line; pSettings->editor().setShowRightEdgeLine(ui->grpRightEdge->isChecked()); diff --git a/RedPandaIDE/settingsdialog/editorgeneralwidget.ui b/RedPandaIDE/settingsdialog/editorgeneralwidget.ui index 760f4900..47d3a9de 100644 --- a/RedPandaIDE/settingsdialog/editorgeneralwidget.ui +++ b/RedPandaIDE/settingsdialog/editorgeneralwidget.ui @@ -340,6 +340,54 @@ + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Mouse Selection/Dragging Scroll Speed + + + + + + + 1 + + + 100 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + +