- fix: font styles in the color scheme settings not in effect
This commit is contained in:
parent
9e0beb8046
commit
8599190d13
1
NEWS.md
1
NEWS.md
|
@ -1,5 +1,6 @@
|
|||
Version 0.6.4
|
||||
- fix: code completion popup not show after '->' inputted
|
||||
- fix: font styles in the color scheme settings not in effect
|
||||
|
||||
Version 0.6.3
|
||||
- fix: should use c++ syntax to check ".h" files
|
||||
|
|
|
@ -96,18 +96,11 @@ void HighlighterManager::applyColorScheme(PSynHighlighter highlighter, const QSt
|
|||
attr->setBackground(item->background());
|
||||
attr->setForeground(item->foreground());
|
||||
SynFontStyles styles = SynFontStyle::fsNone;
|
||||
if (item->bold()) {
|
||||
styles.setFlag(SynFontStyle::fsBold);
|
||||
}
|
||||
if (item->italic()) {
|
||||
styles.setFlag(SynFontStyle::fsItalic);
|
||||
}
|
||||
if (item->underlined()) {
|
||||
styles.setFlag(SynFontStyle::fsUnderline);
|
||||
}
|
||||
if (item->strikeout()) {
|
||||
styles.setFlag(SynFontStyle::fsStrikeOut);
|
||||
}
|
||||
styles.setFlag(SynFontStyle::fsBold, item->bold());
|
||||
styles.setFlag(SynFontStyle::fsItalic, item->italic());
|
||||
styles.setFlag(SynFontStyle::fsUnderline, item->underlined());
|
||||
styles.setFlag(SynFontStyle::fsStrikeOut, item->strikeout());
|
||||
attr->setStyles(styles);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -845,8 +845,18 @@ void Editor::onPreparePaintHighlightToken(int line, int aChar, const QString &to
|
|||
kind = StatementKind::skVariable;
|
||||
}
|
||||
}
|
||||
foreground = mCompletionPopup->colors()->value(kind,
|
||||
highlighter()->identifierAttribute()->foreground());
|
||||
PColorSchemeItem item = pMainWindow->statementColors()->value(kind,PColorSchemeItem());
|
||||
|
||||
if (item) {
|
||||
foreground = item->foreground();
|
||||
//background = item->background();
|
||||
style.setFlag(SynFontStyle::fsBold,item->bold());
|
||||
style.setFlag(SynFontStyle::fsItalic,item->italic());
|
||||
style.setFlag(SynFontStyle::fsUnderline,item->underlined());
|
||||
style.setFlag(SynFontStyle::fsStrikeOut,item->strikeout());
|
||||
} else {
|
||||
foreground = highlighter()->identifierAttribute()->foreground();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "platform.h"
|
||||
#include "widgets/aboutdialog.h"
|
||||
#include "shortcutmanager.h"
|
||||
#include "colorscheme.h"
|
||||
|
||||
#include <QCloseEvent>
|
||||
#include <QComboBox>
|
||||
|
@ -158,7 +159,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
connect(&mFileSystemWatcher,&QFileSystemWatcher::fileChanged,
|
||||
this, &MainWindow::onFileChanged);
|
||||
|
||||
mStatementColors = std::make_shared<QHash<StatementKind, QColor> >();
|
||||
mStatementColors = std::make_shared<QHash<StatementKind, PColorSchemeItem> >();
|
||||
mCompletionPopup = std::make_shared<CodeCompletionPopup>();
|
||||
mCompletionPopup->setColors(mStatementColors);
|
||||
mHeaderCompletionPopup = std::make_shared<HeaderCompletionPopup>();
|
||||
|
@ -355,49 +356,49 @@ void MainWindow::updateEditorColorSchemes()
|
|||
PColorSchemeItem item;
|
||||
item = pColorManager->getItem(schemeName, SYNS_AttrFunction);
|
||||
if (item) {
|
||||
mStatementColors->insert(StatementKind::skFunction,item->foreground());
|
||||
mStatementColors->insert(StatementKind::skConstructor,item->foreground());
|
||||
mStatementColors->insert(StatementKind::skDestructor,item->foreground());
|
||||
mStatementColors->insert(StatementKind::skFunction,item);
|
||||
mStatementColors->insert(StatementKind::skConstructor,item);
|
||||
mStatementColors->insert(StatementKind::skDestructor,item);
|
||||
}
|
||||
item = pColorManager->getItem(schemeName, SYNS_AttrClass);
|
||||
if (item) {
|
||||
mStatementColors->insert(StatementKind::skClass,item->foreground());
|
||||
mStatementColors->insert(StatementKind::skTypedef,item->foreground());
|
||||
mStatementColors->insert(StatementKind::skAlias,item->foreground());
|
||||
mStatementColors->insert(StatementKind::skClass,item);
|
||||
mStatementColors->insert(StatementKind::skTypedef,item);
|
||||
mStatementColors->insert(StatementKind::skAlias,item);
|
||||
}
|
||||
item = pColorManager->getItem(schemeName, SYNS_AttrIdentifier);
|
||||
if (item) {
|
||||
mStatementColors->insert(StatementKind::skEnumType,item->foreground());
|
||||
mStatementColors->insert(StatementKind::skEnumClassType,item->foreground());
|
||||
mStatementColors->insert(StatementKind::skEnumType,item);
|
||||
mStatementColors->insert(StatementKind::skEnumClassType,item);
|
||||
}
|
||||
item = pColorManager->getItem(schemeName, SYNS_AttrVariable);
|
||||
if (item) {
|
||||
mStatementColors->insert(StatementKind::skVariable,item->foreground());
|
||||
mStatementColors->insert(StatementKind::skVariable,item);
|
||||
}
|
||||
item = pColorManager->getItem(schemeName, SYNS_AttrLocalVariable);
|
||||
if (item) {
|
||||
mStatementColors->insert(StatementKind::skLocalVariable,item->foreground());
|
||||
mStatementColors->insert(StatementKind::skParameter,item->foreground());
|
||||
mStatementColors->insert(StatementKind::skLocalVariable,item);
|
||||
mStatementColors->insert(StatementKind::skParameter,item);
|
||||
}
|
||||
item = pColorManager->getItem(schemeName, SYNS_AttrGlobalVariable);
|
||||
if (item) {
|
||||
mStatementColors->insert(StatementKind::skGlobalVariable,item->foreground());
|
||||
mStatementColors->insert(StatementKind::skGlobalVariable,item);
|
||||
}
|
||||
item = pColorManager->getItem(schemeName, SYNS_AttrPreprocessor);
|
||||
if (item) {
|
||||
mStatementColors->insert(StatementKind::skPreprocessor,item->foreground());
|
||||
mStatementColors->insert(StatementKind::skEnum,item->foreground());
|
||||
mStatementColors->insert(StatementKind::skPreprocessor,item);
|
||||
mStatementColors->insert(StatementKind::skEnum,item);
|
||||
mHeaderCompletionPopup->setSuggestionColor(item->foreground());
|
||||
}
|
||||
item = pColorManager->getItem(schemeName, SYNS_AttrReservedWord);
|
||||
if (item) {
|
||||
mStatementColors->insert(StatementKind::skKeyword,item->foreground());
|
||||
mStatementColors->insert(StatementKind::skUserCodeSnippet,item->foreground());
|
||||
mStatementColors->insert(StatementKind::skKeyword,item);
|
||||
mStatementColors->insert(StatementKind::skUserCodeSnippet,item);
|
||||
}
|
||||
item = pColorManager->getItem(schemeName, SYNS_AttrString);
|
||||
if (item) {
|
||||
mStatementColors->insert(StatementKind::skNamespace,item->foreground());
|
||||
mStatementColors->insert(StatementKind::skNamespaceAlias,item->foreground());
|
||||
mStatementColors->insert(StatementKind::skNamespace,item);
|
||||
mStatementColors->insert(StatementKind::skNamespaceAlias,item);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3922,7 +3923,7 @@ void MainWindow::on_actionProject_Open_In_Terminal_triggered()
|
|||
openShell(mProject->directory(),"cmd.exe");
|
||||
}
|
||||
|
||||
const std::shared_ptr<QHash<StatementKind, QColor> > &MainWindow::statementColors() const
|
||||
const std::shared_ptr<QHash<StatementKind, std::shared_ptr<ColorSchemeItem> > > &MainWindow::statementColors() const
|
||||
{
|
||||
return mStatementColors;
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ class CPUDialog;
|
|||
class QPlainTextEdit;
|
||||
class SearchDialog;
|
||||
class Project;
|
||||
class ColorSchemeItem;
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
|
@ -123,7 +124,7 @@ public:
|
|||
|
||||
std::shared_ptr<Project> project();
|
||||
|
||||
const std::shared_ptr<QHash<StatementKind, QColor> > &statementColors() const;
|
||||
const std::shared_ptr<QHash<StatementKind, std::shared_ptr<ColorSchemeItem> > > &statementColors() const;
|
||||
|
||||
PSymbolUsageManager &symbolUsageManager();
|
||||
|
||||
|
@ -423,7 +424,7 @@ private:
|
|||
PSearchResultTreeModel mSearchResultTreeModel;
|
||||
PSearchResultTreeViewDelegate mSearchViewDelegate;
|
||||
ClassBrowserModel mClassBrowserModel;
|
||||
std::shared_ptr<QHash<StatementKind, QColor>> mStatementColors;
|
||||
std::shared_ptr<QHash<StatementKind, std::shared_ptr<ColorSchemeItem> > > mStatementColors;
|
||||
PSymbolUsageManager mSymbolUsageManager;
|
||||
PCodeSnippetManager mCodeSnippetManager;
|
||||
PTodoParser mTodoParser;
|
||||
|
|
|
@ -146,8 +146,8 @@ void EditorColorSchemeWidget::setCurrentSchemeModified()
|
|||
if (scheme) {
|
||||
scheme->setCustomed(true);
|
||||
}
|
||||
if (mModifiedSchemes.contains(ui->cbScheme->currentText()))
|
||||
return;
|
||||
// if (mModifiedSchemes.contains(ui->cbScheme->currentText()))
|
||||
// return;
|
||||
mModifiedSchemes.insert(ui->cbScheme->currentText());
|
||||
ui->cbScheme->setItemData(ui->cbScheme->currentIndex(),
|
||||
mModifiedSchemeComboFont,Qt::FontRole);
|
||||
|
@ -441,3 +441,5 @@ void EditorColorSchemeWidget::on_actionDelete_Scheme_triggered()
|
|||
QMessageBox::critical(this,tr("Error"),e.reason());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <QStringList>
|
||||
|
||||
#define DEVCPP_VERSION "0.6.3"
|
||||
#define DEVCPP_VERSION "0.6.4"
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#define APP_SETTSINGS_FILENAME "redpandacpp.ini"
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <QPalette>
|
||||
#include "../mainwindow.h"
|
||||
#include "../settings.h"
|
||||
#include "../colorscheme.h"
|
||||
|
||||
ClassBrowserModel::ClassBrowserModel(QObject *parent):QAbstractItemModel(parent)
|
||||
{
|
||||
|
@ -138,7 +139,11 @@ QVariant ClassBrowserModel::data(const QModelIndex &index, int role) const
|
|||
if (statement->command.startsWith('#'))
|
||||
kind = StatementKind::skPreprocessor;
|
||||
}
|
||||
return mColors->value(kind,pMainWindow->palette().color(QPalette::Text));
|
||||
PColorSchemeItem item = mColors->value(kind,PColorSchemeItem());
|
||||
if (item) {
|
||||
return item->foreground();
|
||||
}
|
||||
return pMainWindow->palette().color(QPalette::Text);
|
||||
}
|
||||
} else if (role == Qt::DecorationRole) {
|
||||
if (node->statement) {
|
||||
|
@ -424,12 +429,12 @@ PStatement ClassBrowserModel::createDummy(PStatement statement)
|
|||
return result;
|
||||
}
|
||||
|
||||
const std::shared_ptr<QHash<StatementKind, QColor> > &ClassBrowserModel::colors() const
|
||||
const std::shared_ptr<QHash<StatementKind, std::shared_ptr<ColorSchemeItem> > > &ClassBrowserModel::colors() const
|
||||
{
|
||||
return mColors;
|
||||
}
|
||||
|
||||
void ClassBrowserModel::setColors(const std::shared_ptr<QHash<StatementKind, QColor> > &newColors)
|
||||
void ClassBrowserModel::setColors(const std::shared_ptr<QHash<StatementKind, std::shared_ptr<ColorSchemeItem> > > &newColors)
|
||||
{
|
||||
mColors = newColors;
|
||||
}
|
||||
|
|
|
@ -13,6 +13,8 @@ struct ClassBrowserNode {
|
|||
|
||||
using PClassBrowserNode = std::shared_ptr<ClassBrowserNode>;
|
||||
|
||||
class ColorSchemeItem;
|
||||
|
||||
class ClassBrowserModel : public QAbstractItemModel{
|
||||
Q_OBJECT
|
||||
// QAbstractItemModel interface
|
||||
|
@ -38,8 +40,8 @@ public:
|
|||
void endUpdate();
|
||||
|
||||
|
||||
const std::shared_ptr<QHash<StatementKind, QColor> > &colors() const;
|
||||
void setColors(const std::shared_ptr<QHash<StatementKind, QColor> > &newColors);
|
||||
const std::shared_ptr<QHash<StatementKind, std::shared_ptr<ColorSchemeItem> > > &colors() const;
|
||||
void setColors(const std::shared_ptr<QHash<StatementKind, std::shared_ptr<ColorSchemeItem> > > &newColors);
|
||||
|
||||
public slots:
|
||||
void fillStatements();
|
||||
|
@ -57,7 +59,7 @@ private:
|
|||
int mUpdateCount;
|
||||
QRecursiveMutex mMutex;
|
||||
QString mCurrentFile;
|
||||
std::shared_ptr<QHash<StatementKind, QColor>> mColors;
|
||||
std::shared_ptr<QHash<StatementKind, std::shared_ptr<ColorSchemeItem> > > mColors;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "../editor.h"
|
||||
#include "../editorlist.h"
|
||||
#include "../symbolusagemanager.h"
|
||||
#include "../colorscheme.h"
|
||||
|
||||
#include <QKeyEvent>
|
||||
#include <QVBoxLayout>
|
||||
|
@ -23,7 +24,11 @@ CodeCompletionPopup::CodeCompletionPopup(QWidget *parent) :
|
|||
} else {
|
||||
kind = statement->kind;
|
||||
}
|
||||
return mColors->value(kind,palette().color(QPalette::Text));
|
||||
PColorSchemeItem item = mColors->value(kind,PColorSchemeItem());
|
||||
if (item) {
|
||||
return item->foreground();
|
||||
}
|
||||
return palette().color(QPalette::Text);
|
||||
});
|
||||
mListView->setModel(mModel);
|
||||
setLayout(new QVBoxLayout());
|
||||
|
@ -748,7 +753,7 @@ void CodeCompletionPopup::setCodeSnippets(const QList<PCodeSnippet> &newCodeSnip
|
|||
mCodeSnippets = newCodeSnippets;
|
||||
}
|
||||
|
||||
void CodeCompletionPopup::setColors(const std::shared_ptr<QHash<StatementKind, QColor> > &newColors)
|
||||
void CodeCompletionPopup::setColors(const std::shared_ptr<QHash<StatementKind, std::shared_ptr<ColorSchemeItem> > > &newColors)
|
||||
{
|
||||
mColors = newColors;
|
||||
}
|
||||
|
@ -773,7 +778,7 @@ void CodeCompletionPopup::setCurrentStatement(const PStatement &newCurrentStatem
|
|||
mCurrentStatement = newCurrentStatement;
|
||||
}
|
||||
|
||||
const std::shared_ptr<QHash<StatementKind, QColor> >& CodeCompletionPopup::colors() const
|
||||
const std::shared_ptr<QHash<StatementKind, std::shared_ptr<ColorSchemeItem> > >& CodeCompletionPopup::colors() const
|
||||
{
|
||||
return mColors;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "parser/cppparser.h"
|
||||
#include "codecompletionlistview.h"
|
||||
|
||||
class ColorSchemeItem;
|
||||
class CodeCompletionListModel : public QAbstractListModel {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -64,8 +65,8 @@ public:
|
|||
|
||||
const PStatement ¤tStatement() const;
|
||||
void setCurrentStatement(const PStatement &newCurrentStatement);
|
||||
const std::shared_ptr<QHash<StatementKind, QColor> >& colors() const;
|
||||
void setColors(const std::shared_ptr<QHash<StatementKind, QColor> > &newColors);
|
||||
const std::shared_ptr<QHash<StatementKind, std::shared_ptr<ColorSchemeItem> > >& colors() const;
|
||||
void setColors(const std::shared_ptr<QHash<StatementKind, std::shared_ptr<ColorSchemeItem> > > &newColors);
|
||||
|
||||
private:
|
||||
void addChildren(PStatement scopeStatement, const QString& fileName,
|
||||
|
@ -86,7 +87,7 @@ private:
|
|||
QSet<QString> mAddedStatements;
|
||||
QString mPhrase;
|
||||
QRecursiveMutex mMutex;
|
||||
std::shared_ptr<QHash<StatementKind, QColor>> mColors;
|
||||
std::shared_ptr<QHash<StatementKind, std::shared_ptr<ColorSchemeItem> > > mColors;
|
||||
|
||||
PCppParser mParser;
|
||||
PStatement mCurrentStatement;
|
||||
|
|
Loading…
Reference in New Issue