- 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.
This commit is contained in:
Roy Qu 2023-02-18 16:20:07 +08:00
parent da16abf4b1
commit 57c4c5bc98
4 changed files with 40 additions and 14 deletions

View File

@ -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 Red Panda C++ Version 2.12
- fix: Can't correctly load project's custom compile options, if it contains more than one line contents. - fix: Can't correctly load project's custom compile options, if it contains more than one line contents.

View File

@ -10,7 +10,7 @@ isEmpty(APP_NAME) {
} }
isEmpty(APP_VERSION) { isEmpty(APP_VERSION) {
APP_VERSION = 2.12 APP_VERSION = 2.13
} }
macos: { macos: {

View File

@ -1777,7 +1777,14 @@ void Editor::onStatusChanged(QSynedit::StatusChanges changes)
void Editor::onGutterClicked(Qt::MouseButton button, int , int , int line) void Editor::onGutterClicked(Qt::MouseButton button, int , int , int line)
{ {
if (button == Qt::LeftButton) { 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; mGutterClickedLine = line;
} }
@ -1984,7 +1991,7 @@ void Editor::onTooltipTimer()
void Editor::onEndParsing() void Editor::onEndParsing()
{ {
qDebug()<<"yes";
mIdentCache.clear(); mIdentCache.clear();
invalidate(); invalidate();
} }

View File

@ -4788,6 +4788,13 @@ void MainWindow::onEditorContextMenu(const QPoint& pos)
Editor * editor = mEditorList->getEditor(); Editor * editor = mEditorList->getEditor();
if (!editor) if (!editor)
return; 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); QMenu menu(this);
QSynedit::BufferCoord p; QSynedit::BufferCoord p;
mEditorContextMenuPos = pos; mEditorContextMenuPos = pos;
@ -4800,15 +4807,18 @@ void MainWindow::onEditorContextMenu(const QPoint& pos)
menu.addSeparator(); menu.addSeparator();
} }
//mouse on editing area //mouse on editing area
menu.addAction(ui->actionDebug); if (canDebug) {
if (editor->parser() && editor->parser()->enabled()) { menu.addAction(ui->actionRun);
menu.addAction(ui->actionDebug);
menu.addSeparator(); menu.addSeparator();
}
if (editor->parser() && editor->parser()->enabled()) {
menu.addAction(ui->actionGoto_Declaration); menu.addAction(ui->actionGoto_Declaration);
menu.addAction(ui->actionGoto_Definition); menu.addAction(ui->actionGoto_Definition);
menu.addAction(ui->actionFind_references); menu.addAction(ui->actionFind_references);
menu.addSeparator();
} }
menu.addSeparator();
menu.addAction(ui->actionOpen_Containing_Folder); menu.addAction(ui->actionOpen_Containing_Folder);
menu.addAction(ui->actionOpen_Terminal); menu.addAction(ui->actionOpen_Terminal);
menu.addAction(ui->actionLocate_in_Files_View); menu.addAction(ui->actionLocate_in_Files_View);
@ -4821,10 +4831,12 @@ void MainWindow::onEditorContextMenu(const QPoint& pos)
menu.addAction(ui->actionPaste); menu.addAction(ui->actionPaste);
menu.addAction(ui->actionSelectAll); menu.addAction(ui->actionSelectAll);
menu.addSeparator(); menu.addSeparator();
menu.addAction(ui->actionAdd_Watch); if (canDebug) {
menu.addAction(ui->actionToggle_Breakpoint); menu.addAction(ui->actionAdd_Watch);
menu.addAction(ui->actionClear_all_breakpoints); menu.addAction(ui->actionToggle_Breakpoint);
menu.addSeparator(); menu.addAction(ui->actionClear_all_breakpoints);
menu.addSeparator();
}
menu.addAction(ui->actionAdd_bookmark); menu.addAction(ui->actionAdd_bookmark);
menu.addAction(ui->actionRemove_Bookmark); menu.addAction(ui->actionRemove_Bookmark);
menu.addAction(ui->actionModify_Bookmark_Description); menu.addAction(ui->actionModify_Bookmark_Description);
@ -4837,10 +4849,12 @@ void MainWindow::onEditorContextMenu(const QPoint& pos)
if (!editor->getLineOfMouse(line)) if (!editor->getLineOfMouse(line))
line=-1; line=-1;
menu.addAction(ui->actionToggle_Breakpoint); if (canDebug) {
menu.addAction(ui->actionBreakpoint_property); menu.addAction(ui->actionToggle_Breakpoint);
menu.addAction(ui->actionClear_all_breakpoints); menu.addAction(ui->actionBreakpoint_property);
menu.addSeparator(); menu.addAction(ui->actionClear_all_breakpoints);
menu.addSeparator();
}
menu.addAction(ui->actionAdd_bookmark); menu.addAction(ui->actionAdd_bookmark);
menu.addAction(ui->actionRemove_Bookmark); menu.addAction(ui->actionRemove_Bookmark);
menu.addAction(ui->actionModify_Bookmark_Description); menu.addAction(ui->actionModify_Bookmark_Description);