diff --git a/src/SeerConfigDialog.cpp b/src/SeerConfigDialog.cpp index 99032a2..0572762 100644 --- a/src/SeerConfigDialog.cpp +++ b/src/SeerConfigDialog.cpp @@ -315,6 +315,16 @@ bool SeerConfigDialog::editorHighlighterEnabled () const { return _editorConfigPage->highlighterEnabled(); } +void SeerConfigDialog::setEditorMinimapEnabled (bool flag) { + + _editorConfigPage->setMinimapEnabled(flag); +} + +bool SeerConfigDialog::editorMinimapEnabled () const { + + return _editorConfigPage->minimapEnabled(); +} + void SeerConfigDialog::setExternalEditorCommand (const QString& externalEditorCommand) { _editorConfigPage->setExternalEditorCommand(externalEditorCommand); diff --git a/src/SeerConfigDialog.h b/src/SeerConfigDialog.h index d1042e4..287f5d3 100644 --- a/src/SeerConfigDialog.h +++ b/src/SeerConfigDialog.h @@ -88,6 +88,9 @@ class SeerConfigDialog : public QDialog, protected Ui::SeerConfigDialogForm { void setEditorHighlighterEnabled (bool flag); bool editorHighlighterEnabled () const; + void setEditorMinimapEnabled (bool flag); + bool editorMinimapEnabled () const; + void setExternalEditorCommand (const QString& externalEditorCommand); QString externalEditorCommand () const; diff --git a/src/SeerEditorConfigPage.cpp b/src/SeerEditorConfigPage.cpp index 07bffff..3fe37c4 100644 --- a/src/SeerEditorConfigPage.cpp +++ b/src/SeerEditorConfigPage.cpp @@ -162,8 +162,6 @@ const SeerHighlighterSettings& SeerEditorConfigPage::highlighterSettings() const void SeerEditorConfigPage::setHighlighterEnabled (bool flag) { - qDebug() << flag; - highlighterEnabledCheckBox->setChecked(flag); editorWidget->sourceArea()->setHighlighterEnabled(flag); diff --git a/src/SeerEditorManagerWidget.cpp b/src/SeerEditorManagerWidget.cpp index 01834c0..6635065 100644 --- a/src/SeerEditorManagerWidget.cpp +++ b/src/SeerEditorManagerWidget.cpp @@ -32,6 +32,7 @@ SeerEditorManagerWidget::SeerEditorManagerWidget (QWidget* parent) : QWidget(par _editorFont = QFont("monospace", 10); // Default font. _editorHighlighterSettings = SeerHighlighterSettings::populate(""); // Default syntax highlighting. _editorHighlighterEnabled = true; + _editorMinimapEnabled = false; _editorKeySettings = SeerKeySettings::populate(); // Default key settings. _editorTabSize = 4; _editorExternalEditorCommand = ""; @@ -384,9 +385,36 @@ void SeerEditorManagerWidget::setEditorHighlighterEnabled (bool flag) { bool SeerEditorManagerWidget::editorHighlighterEnabled () const { + return _editorHighlighterEnabled; } +void SeerEditorManagerWidget::setEditorMinimapEnabled (bool flag) { + + _editorMinimapEnabled = flag; + + // Update current editors. + SeerEditorManagerEntries::iterator b = beginEntry(); + SeerEditorManagerEntries::iterator e = endEntry(); + + while (b != e) { + b->widget->sourceArea()->enableMiniMapArea(_editorMinimapEnabled); + b++; + } + + // Don't forget about the assembly widget. + SeerEditorWidgetAssembly* assemblyWidget = assemblyWidgetTab(); + + if (assemblyWidget) { + assemblyWidget->assemblyArea()->enableMiniMapArea(_editorMinimapEnabled); + } +} + +bool SeerEditorManagerWidget::editorMinimapEnabled () const { + + return _editorMinimapEnabled; +} + void SeerEditorManagerWidget::setEditorAlternateDirectories (const QStringList alternateDirectories) { _editorAlternateDirectories = alternateDirectories; @@ -797,7 +825,7 @@ void SeerEditorManagerWidget::handleText (const QString& text) { } }else if (text.startsWith("*running")) { - // target / program is running, should erase 'yellow' color is for the current line + // target / program is running, should erase 'yellow' color is for the current line // _lastFrameList is invoked to erase previously "colored" line for ( const auto& frame_text : _lastFrameList ) { QString fullname_text = Seer::parseFirst(frame_text, "fullname=", '"', '"', false); @@ -926,7 +954,7 @@ void SeerEditorManagerWidget::handleOpenFileWithDetails (const QString& file, co } if (firstDisplayLine > 0) { - // firstDisplayLine is always > 0 + // firstDisplayLine is always > 0 // this means the function is handling open closed files, set cursor position and first display line QPlainTextEdit* textEdit = editorWidget->sourceArea(); // Create a small helper lambda that does the actual restoration @@ -1076,6 +1104,7 @@ SeerEditorWidgetSource* SeerEditorManagerWidget::createEditorWidgetTab (const QS editorWidget->sourceArea()->setHighlighterSettings(editorHighlighterSettings()); editorWidget->sourceArea()->setHighlighterEnabled(editorHighlighterEnabled()); editorWidget->sourceArea()->setAlternateDirectories(editorAlternateDirectories()); + editorWidget->sourceArea()->enableMiniMapArea(editorMinimapEnabled()); editorWidget->setKeySettings(editorKeySettings()); // Set the tooltip for the tab. @@ -1141,6 +1170,7 @@ SeerEditorWidgetSource* SeerEditorManagerWidget::createEditorWidgetTab (const QS editorWidget->sourceArea()->setHighlighterSettings(editorHighlighterSettings()); editorWidget->sourceArea()->setHighlighterEnabled(editorHighlighterEnabled()); editorWidget->sourceArea()->setAlternateDirectories(editorAlternateDirectories()); + editorWidget->sourceArea()->enableMiniMapArea(editorMinimapEnabled()); editorWidget->setKeySettings(editorKeySettings()); // Set the tooltip for the tab. @@ -1240,6 +1270,7 @@ SeerEditorWidgetAssembly* SeerEditorManagerWidget::createAssemblyWidgetTab () { assemblyWidget->assemblyArea()->setEditorTabSize(editorTabSize()); assemblyWidget->assemblyArea()->setHighlighterSettings(editorHighlighterSettings()); assemblyWidget->assemblyArea()->setHighlighterEnabled(editorHighlighterEnabled()); + assemblyWidget->assemblyArea()->enableMiniMapArea(editorMinimapEnabled()); assemblyWidget->setShowAddressColumn(assemblyShowAddressColumn()); assemblyWidget->setShowOffsetColumn(assemblyShowOffsetColumn()); diff --git a/src/SeerEditorManagerWidget.h b/src/SeerEditorManagerWidget.h index 5d34716..e88f42e 100644 --- a/src/SeerEditorManagerWidget.h +++ b/src/SeerEditorManagerWidget.h @@ -63,6 +63,8 @@ class SeerEditorManagerWidget : public QWidget, protected Ui::SeerEditorManagerW const SeerHighlighterSettings& editorHighlighterSettings () const; void setEditorHighlighterEnabled (bool flag); bool editorHighlighterEnabled () const; + void setEditorMinimapEnabled (bool flag); + bool editorMinimapEnabled () const; void setEditorAlternateDirectories (const QStringList alternateDirectories); const QStringList& editorAlternateDirectories () const; void setEditorIgnoreDirectories (const QStringList ignoreDirectories); @@ -162,6 +164,7 @@ class SeerEditorManagerWidget : public QWidget, protected Ui::SeerEditorManagerW SeerEditorManagerEntries _entries; SeerHighlighterSettings _editorHighlighterSettings; bool _editorHighlighterEnabled; + bool _editorMinimapEnabled; QFont _editorFont; QStringList _editorAlternateDirectories; QStringList _editorIgnoreDirectories; diff --git a/src/SeerEditorWidgetAssemblyAreas.cpp b/src/SeerEditorWidgetAssemblyAreas.cpp index 3f2a09b..7bf197d 100644 --- a/src/SeerEditorWidgetAssemblyAreas.cpp +++ b/src/SeerEditorWidgetAssemblyAreas.cpp @@ -72,7 +72,7 @@ SeerEditorWidgetAssemblyArea::SeerEditorWidgetAssemblyArea(QWidget* parent) : Se enableOffsetArea(true); enableOpcodeArea(true); enableBreakPointArea(true); - enableMiniMapArea(true); + enableMiniMapArea(false); enableSourceLines(true); setConvertUppercase(false); diff --git a/src/SeerEditorWidgetSourceAreas.cpp b/src/SeerEditorWidgetSourceAreas.cpp index a8cd864..4645954 100644 --- a/src/SeerEditorWidgetSourceAreas.cpp +++ b/src/SeerEditorWidgetSourceAreas.cpp @@ -71,7 +71,7 @@ SeerEditorWidgetSourceArea::SeerEditorWidgetSourceArea(QWidget* parent) : SeerPl enableLineNumberArea(true); enableBreakPointArea(true); - enableMiniMapArea(true); + enableMiniMapArea(false); _altHeldTimer->setInterval(40); // 40 ms interval = 25Hz update rate QObject::connect(_altHeldTimer, &QTimer::timeout, this, [this]() { @@ -108,26 +108,31 @@ SeerEditorWidgetSourceArea::SeerEditorWidgetSourceArea(QWidget* parent) : SeerPl } void SeerEditorWidgetSourceArea::enableLineNumberArea (bool flag) { + _enableLineNumberArea = flag; updateMarginAreasWidth(0); } bool SeerEditorWidgetSourceArea::lineNumberAreaEnabled () const { + return _enableLineNumberArea; } void SeerEditorWidgetSourceArea::enableBreakPointArea (bool flag) { + _enableBreakPointArea = flag; updateMarginAreasWidth(0); } bool SeerEditorWidgetSourceArea::breakPointAreaEnabled () const { + return _enableBreakPointArea; } void SeerEditorWidgetSourceArea::enableMiniMapArea (bool flag) { + _enableMiniMapArea = flag; invalidateMiniMapCache(); @@ -135,6 +140,7 @@ void SeerEditorWidgetSourceArea::enableMiniMapArea (bool flag) { } bool SeerEditorWidgetSourceArea::miniMapAreaEnabled () const { + return _enableMiniMapArea; } diff --git a/src/SeerMainWindow.cpp b/src/SeerMainWindow.cpp index c2d1c39..738f840 100644 --- a/src/SeerMainWindow.cpp +++ b/src/SeerMainWindow.cpp @@ -819,7 +819,7 @@ void SeerMainWindow::handleSettingsConfiguration () { dlg.setEditorTabSize(gdbWidget->editorManager()->editorTabSize()); dlg.setEditorHighlighterSettings(gdbWidget->editorManager()->editorHighlighterSettings()); dlg.setEditorHighlighterEnabled(gdbWidget->editorManager()->editorHighlighterEnabled()); - dlg.setEditorHighlighterEnabled(gdbWidget->editorManager()->editorHighlighterEnabled()); + dlg.setEditorMinimapEnabled(gdbWidget->editorManager()->editorMinimapEnabled()); dlg.setExternalEditorCommand(gdbWidget->editorManager()->editorExternalEditorCommand()); dlg.setEditorAutoSourceReload(gdbWidget->editorManager()->editorAutoSourceReload()); dlg.setSourceAlternateDirectories(gdbWidget->sourceAlternateDirectories()); @@ -866,6 +866,7 @@ void SeerMainWindow::handleSettingsConfiguration () { gdbWidget->editorManager()->setEditorTabSize(dlg.editorTabSize()); gdbWidget->editorManager()->setEditorHighlighterSettings(dlg.editorHighlighterSettings()); gdbWidget->editorManager()->setEditorHighlighterEnabled(dlg.editorHighlighterEnabled()); + gdbWidget->editorManager()->setEditorMinimapEnabled(dlg.editorMinimapEnabled()); gdbWidget->editorManager()->setEditorExternalEditorCommand(dlg.externalEditorCommand()); gdbWidget->editorManager()->setEditorAutoSourceReload(dlg.editorAutoSourceReload()); gdbWidget->setSourceAlternateDirectories(dlg.sourceAlternateDirectories()); @@ -1772,6 +1773,7 @@ void SeerMainWindow::writeConfigSettings () { settings.setValue("tabsize", gdbWidget->editorManager()->editorTabSize()); settings.setValue("externaleditorcommand", gdbWidget->editorManager()->editorExternalEditorCommand()); settings.setValue("autosourcereload", gdbWidget->editorManager()->editorAutoSourceReload()); + settings.setValue("minimapenabled", gdbWidget->editorManager()->editorMinimapEnabled()); settings.beginGroup("highlighter"); { @@ -1874,6 +1876,7 @@ void SeerMainWindow::readConfigSettings () { gdbWidget->editorManager()->setEditorTabSize(settings.value("tabsize", 4).toInt()); gdbWidget->editorManager()->setEditorExternalEditorCommand(settings.value("externaleditorcommand").toString()); gdbWidget->editorManager()->setEditorAutoSourceReload(settings.value("autosourcereload").toBool()); + gdbWidget->editorManager()->setEditorMinimapEnabled(settings.value("minimapenabled",false).toBool()); settings.beginGroup("highlighter"); {