mirror of
https://github.com/epasveer/seer.git
synced 2026-08-29 08:34:42 +08:00
WIP - Adding enable minimap to editor config page.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user