WIP - Adding enable minimap to editor config page.

This commit is contained in:
Ernie Pasveer
2026-07-26 18:52:54 -05:00
parent bc38413202
commit 25307b4e44
4 changed files with 50 additions and 7 deletions
+24 -3
View File
@@ -25,7 +25,8 @@ SeerEditorConfigPage::SeerEditorConfigPage(QWidget* parent) : QWidget(parent) {
QObject::connect(fontSizeComboBox, &QComboBox::currentTextChanged, this, &SeerEditorConfigPage::handleFontSizeChanged);
QObject::connect(fontNameComboBox, &QFontComboBox::currentFontChanged, this, &SeerEditorConfigPage::handleFontChanged);
QObject::connect(fontDialogButton, &QToolButton::clicked, this, &SeerEditorConfigPage::handleFontDialog);
QObject::connect(highlighterEnabledCheckBox, &QToolButton::clicked, this, &SeerEditorConfigPage::handleEnabledChanged);
QObject::connect(highlighterEnabledCheckBox, &QToolButton::clicked, this, &SeerEditorConfigPage::handleHighlighterEnabledChanged);
QObject::connect(minimapEnabledCheckBox, &QToolButton::clicked, this, &SeerEditorConfigPage::handleMinimapEnabledChanged);
QObject::connect(cppSuffixesLineEdit, &QHistoryLineEdit::lostFocus, this, &SeerEditorConfigPage::handleHighlighterChanged);
QObject::connect(rustSuffixesLineEdit, &QHistoryLineEdit::lostFocus, this, &SeerEditorConfigPage::handleHighlighterChanged);
QObject::connect(odinSuffixesLineEdit, &QHistoryLineEdit::lostFocus, this, &SeerEditorConfigPage::handleHighlighterChanged);
@@ -161,6 +162,8 @@ const SeerHighlighterSettings& SeerEditorConfigPage::highlighterSettings() const
void SeerEditorConfigPage::setHighlighterEnabled (bool flag) {
qDebug() << flag;
highlighterEnabledCheckBox->setChecked(flag);
editorWidget->sourceArea()->setHighlighterEnabled(flag);
@@ -171,6 +174,18 @@ bool SeerEditorConfigPage::highlighterEnabled () const {
return editorWidget->sourceArea()->highlighterEnabled();
}
void SeerEditorConfigPage::setMinimapEnabled (bool flag) {
minimapEnabledCheckBox->setChecked(flag);
editorWidget->sourceArea()->enableMiniMapArea(flag);
}
bool SeerEditorConfigPage::minimapEnabled () const {
return editorWidget->sourceArea()->miniMapAreaEnabled();
}
void SeerEditorConfigPage::setExternalEditorCommand (const QString& externalEditorCommand) {
externalEditorCommandLineEdit->setText(externalEditorCommand);
@@ -197,6 +212,7 @@ void SeerEditorConfigPage::reset () {
setEditorTabSize(4);
setHighlighterSettings(SeerHighlighterSettings::populate(""));
setHighlighterEnabled(true);
setMinimapEnabled(false);
setExternalEditorCommand("");
setAutoSourceReload(false);
}
@@ -324,11 +340,16 @@ void SeerEditorConfigPage::handleHighlighterChanged () {
setHighlighterSettings(languageSettings);
}
void SeerEditorConfigPage::handleEnabledChanged () {
void SeerEditorConfigPage::handleHighlighterEnabledChanged () {
setHighlighterEnabled(highlighterEnabledCheckBox->isChecked());
}
void SeerEditorConfigPage::handleMinimapEnabledChanged () {
setMinimapEnabled(minimapEnabledCheckBox->isChecked());
}
void SeerEditorConfigPage::handleApplyTheme () {
setHighlighterSettings(SeerHighlighterSettings::populate(themeComboBox->currentText()));
@@ -395,7 +416,7 @@ void SeerEditorConfigPage::handleLanguageTabChanged (int index) {
"end Main;",
"sample.adb");
}
editorWidget->sourceArea()->setCurrentLine(0);
}
+5 -1
View File
@@ -30,6 +30,9 @@ class SeerEditorConfigPage : public QWidget, public Ui::SeerEditorConfigPage {
void setHighlighterEnabled (bool flag);
bool highlighterEnabled () const;
void setMinimapEnabled (bool flag);
bool minimapEnabled () const;
void setExternalEditorCommand (const QString& externalEditorCommand);
QString externalEditorCommand () const;
@@ -44,7 +47,8 @@ class SeerEditorConfigPage : public QWidget, public Ui::SeerEditorConfigPage {
void handleFontChanged (const QFont& font);
void handleFontDialog ();
void handleHighlighterChanged ();
void handleEnabledChanged ();
void handleHighlighterEnabledChanged ();
void handleMinimapEnabledChanged ();
void handleApplyTheme ();
void handleLanguageTabChanged (int index);
+11 -1
View File
@@ -130,7 +130,17 @@
<string>Enable or disable highlighting for supported languages' files.</string>
</property>
<property name="text">
<string>Syntax highlighting.</string>
<string>Syntax highlighting</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="minimapEnabledCheckBox">
<property name="toolTip">
<string>Enable or disable the minimap for source and assembly editors.</string>
</property>
<property name="text">
<string>Minimap</string>
</property>
</widget>
</item>
+10 -2
View File
@@ -743,7 +743,9 @@ void SeerEditorWidgetSourceArea::openText (const QString& text, const QString& f
_file = file;
SeerSourceHighlighter* highlighter = SeerSourceHighlighter::getSourceHighlighter(_file, _sourceHighlighterSettings);
if (highlighter) {
_sourceHighlighter = highlighter;
if (highlighterEnabled()) {
_sourceHighlighter->setDocument(document());
}else{
@@ -2070,8 +2072,15 @@ void SeerEditorWidgetSourceArea::handleHighlighterSettingsChanged () {
setPalette(p);
// Update the syntax highlighter.
_sourceHighlighter = SeerSourceHighlighter::getSourceHighlighter(_file, _sourceHighlighterSettings);
if (_sourceHighlighter) {
delete _sourceHighlighter; _sourceHighlighter = 0;
}
SeerSourceHighlighter* highlighter = SeerSourceHighlighter::getSourceHighlighter(_file, _sourceHighlighterSettings);
if (highlighter) {
_sourceHighlighter = highlighter;
if (highlighterEnabled()) {
_sourceHighlighter->setDocument(document());
@@ -2085,7 +2094,6 @@ void SeerEditorWidgetSourceArea::handleHighlighterSettingsChanged () {
// Note. The margins are automatically updated by their own paint events.
// The new highlighter settings will be used.
invalidateMiniMapCache();
}