From 57c4c5bc986100c213e81de4d9566144342d9157 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Sat, 18 Feb 2023 16:20:07 +0800 Subject: [PATCH] - fix: Only C/C++/GAS files can set breakpoints. - Enhancement: Don't show breakpoints/watch related menuitems in context menu for non-C/C++/GAS files. --- NEWS.md | 5 +++++ RedPandaIDE/RedPandaIDE.pro | 2 +- RedPandaIDE/editor.cpp | 11 +++++++++-- RedPandaIDE/mainwindow.cpp | 36 +++++++++++++++++++++++++----------- 4 files changed, 40 insertions(+), 14 deletions(-) diff --git a/NEWS.md b/NEWS.md index 99349a22..fd3949db 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,8 @@ +Red Panda C++ Version 2.13 + + - fix: Only C/C++/GAS files can set breakpoints. + - Enhancement: Don't show breakpoints/watch related menuitems in context menu for non-C/C++/GAS files. + Red Panda C++ Version 2.12 - fix: Can't correctly load project's custom compile options, if it contains more than one line contents. diff --git a/RedPandaIDE/RedPandaIDE.pro b/RedPandaIDE/RedPandaIDE.pro index 91be6768..64b2d605 100644 --- a/RedPandaIDE/RedPandaIDE.pro +++ b/RedPandaIDE/RedPandaIDE.pro @@ -10,7 +10,7 @@ isEmpty(APP_NAME) { } isEmpty(APP_VERSION) { - APP_VERSION = 2.12 + APP_VERSION = 2.13 } macos: { diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index d7dacc2e..1423346f 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -1777,7 +1777,14 @@ void Editor::onStatusChanged(QSynedit::StatusChanges changes) void Editor::onGutterClicked(Qt::MouseButton button, int , int , int line) { if (button == Qt::LeftButton) { - toggleBreakpoint(line); + FileType fileType=getFileType(mFilename); + if (fileType==FileType::CSource + || fileType==FileType::CHeader + || fileType==FileType::CppSource + || fileType==FileType::CppHeader + || fileType==FileType::GAS + ) + toggleBreakpoint(line); } mGutterClickedLine = line; } @@ -1984,7 +1991,7 @@ void Editor::onTooltipTimer() void Editor::onEndParsing() { - qDebug()<<"yes"; + mIdentCache.clear(); invalidate(); } diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 5a0da853..be45b0c3 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -4788,6 +4788,13 @@ void MainWindow::onEditorContextMenu(const QPoint& pos) Editor * editor = mEditorList->getEditor(); if (!editor) return; + FileType fileType=getFileType(editor->filename()); + bool canDebug = (fileType==FileType::CSource + || fileType==FileType::CHeader + || fileType==FileType::CppSource + || fileType==FileType::CppHeader + || fileType==FileType::GAS + ); QMenu menu(this); QSynedit::BufferCoord p; mEditorContextMenuPos = pos; @@ -4800,15 +4807,18 @@ void MainWindow::onEditorContextMenu(const QPoint& pos) menu.addSeparator(); } //mouse on editing area - menu.addAction(ui->actionDebug); - if (editor->parser() && editor->parser()->enabled()) { + if (canDebug) { + menu.addAction(ui->actionRun); + menu.addAction(ui->actionDebug); menu.addSeparator(); + } + if (editor->parser() && editor->parser()->enabled()) { menu.addAction(ui->actionGoto_Declaration); menu.addAction(ui->actionGoto_Definition); menu.addAction(ui->actionFind_references); + menu.addSeparator(); } - menu.addSeparator(); menu.addAction(ui->actionOpen_Containing_Folder); menu.addAction(ui->actionOpen_Terminal); menu.addAction(ui->actionLocate_in_Files_View); @@ -4821,10 +4831,12 @@ void MainWindow::onEditorContextMenu(const QPoint& pos) menu.addAction(ui->actionPaste); menu.addAction(ui->actionSelectAll); menu.addSeparator(); - menu.addAction(ui->actionAdd_Watch); - menu.addAction(ui->actionToggle_Breakpoint); - menu.addAction(ui->actionClear_all_breakpoints); - menu.addSeparator(); + if (canDebug) { + menu.addAction(ui->actionAdd_Watch); + menu.addAction(ui->actionToggle_Breakpoint); + menu.addAction(ui->actionClear_all_breakpoints); + menu.addSeparator(); + } menu.addAction(ui->actionAdd_bookmark); menu.addAction(ui->actionRemove_Bookmark); menu.addAction(ui->actionModify_Bookmark_Description); @@ -4837,10 +4849,12 @@ void MainWindow::onEditorContextMenu(const QPoint& pos) if (!editor->getLineOfMouse(line)) line=-1; - menu.addAction(ui->actionToggle_Breakpoint); - menu.addAction(ui->actionBreakpoint_property); - menu.addAction(ui->actionClear_all_breakpoints); - menu.addSeparator(); + if (canDebug) { + menu.addAction(ui->actionToggle_Breakpoint); + menu.addAction(ui->actionBreakpoint_property); + menu.addAction(ui->actionClear_all_breakpoints); + menu.addSeparator(); + } menu.addAction(ui->actionAdd_bookmark); menu.addAction(ui->actionRemove_Bookmark); menu.addAction(ui->actionModify_Bookmark_Description);