Customizable doxy formats.

This commit is contained in:
Roberto Raggi
2009-02-20 12:08:34 +01:00
parent 5bf1f27e20
commit 8002b1a94c
5 changed files with 12 additions and 5 deletions

View File

@@ -740,7 +740,9 @@ void CPPEditor::setFontSettings(const TextEditor::FontSettings &fs)
<< QLatin1String(TextEditor::Constants::C_OPERATOR) << QLatin1String(TextEditor::Constants::C_OPERATOR)
<< QLatin1String(TextEditor::Constants::C_PREPROCESSOR) << QLatin1String(TextEditor::Constants::C_PREPROCESSOR)
<< QLatin1String(TextEditor::Constants::C_LABEL) << QLatin1String(TextEditor::Constants::C_LABEL)
<< QLatin1String(TextEditor::Constants::C_COMMENT); << QLatin1String(TextEditor::Constants::C_COMMENT)
<< QLatin1String(TextEditor::Constants::C_DOXYGEN_COMMENT)
<< QLatin1String(TextEditor::Constants::C_DOXYGEN_TAG);
} }
const QVector<QTextCharFormat> formats = fs.toTextCharFormats(categories); const QVector<QTextCharFormat> formats = fs.toTextCharFormats(categories);

View File

@@ -51,6 +51,8 @@ enum CppFormats {
CppPreprocessorFormat, CppPreprocessorFormat,
CppLabelFormat, CppLabelFormat,
CppCommentFormat, CppCommentFormat,
CppDoxygenCommentFormat,
CppDoxygenTagFormat,
NumCppFormats NumCppFormats
}; };

View File

@@ -329,10 +329,8 @@ void CppHighlighter::highlightDoxygenComment(const QString &text, int position,
const QChar *uc = text.unicode(); const QChar *uc = text.unicode();
const QChar *it = uc + position; const QChar *it = uc + position;
QTextCharFormat format = m_formats[CppCommentFormat]; const QTextCharFormat &format = m_formats[CppDoxygenCommentFormat];
QTextCharFormat kwFormat = format; const QTextCharFormat &kwFormat = m_formats[CppDoxygenTagFormat];
kwFormat.setFontWeight(QFont::Bold);
kwFormat.setUnderlineStyle(QTextCharFormat::SingleUnderline);
while (! it->isNull()) { while (! it->isNull()) {
if (it->unicode() == QLatin1Char('\\') || if (it->unicode() == QLatin1Char('\\') ||

View File

@@ -84,6 +84,9 @@ const char * const C_OPERATOR = "Operator";
const char * const C_PREPROCESSOR = "Preprocessor"; const char * const C_PREPROCESSOR = "Preprocessor";
const char * const C_LABEL = "Label"; const char * const C_LABEL = "Label";
const char * const C_COMMENT = "Comment"; const char * const C_COMMENT = "Comment";
const char * const C_DOXYGEN_COMMENT = "Doxygen.Comment";
const char * const C_DOXYGEN_TAG = "Doxygen.Tag";
const char * const C_DISABLED_CODE = "DisabledCode"; const char * const C_DISABLED_CODE = "DisabledCode";
const char * const C_ADDED_LINE = "AddedLine"; const char * const C_ADDED_LINE = "AddedLine";

View File

@@ -84,6 +84,8 @@ TextEditorSettings::TextEditorSettings(QObject *parent)
formatDescriptions.push_back(FormatDescription(QLatin1String(C_PREPROCESSOR), tr("Preprocessor"), Qt::darkBlue)); formatDescriptions.push_back(FormatDescription(QLatin1String(C_PREPROCESSOR), tr("Preprocessor"), Qt::darkBlue));
formatDescriptions.push_back(FormatDescription(QLatin1String(C_LABEL), tr("Label"), Qt::darkRed)); formatDescriptions.push_back(FormatDescription(QLatin1String(C_LABEL), tr("Label"), Qt::darkRed));
formatDescriptions.push_back(FormatDescription(QLatin1String(C_COMMENT), tr("Comment"), Qt::darkGreen)); formatDescriptions.push_back(FormatDescription(QLatin1String(C_COMMENT), tr("Comment"), Qt::darkGreen));
formatDescriptions.push_back(FormatDescription(QLatin1String(C_DOXYGEN_COMMENT), tr("Doxygen Comment"), Qt::darkBlue));
formatDescriptions.push_back(FormatDescription(QLatin1String(C_DOXYGEN_TAG), tr("Doxygen Tag"), Qt::blue));
formatDescriptions.push_back(FormatDescription(QLatin1String(C_DISABLED_CODE), tr("Disabled Code"), Qt::gray)); formatDescriptions.push_back(FormatDescription(QLatin1String(C_DISABLED_CODE), tr("Disabled Code"), Qt::gray));
// Diff categories // Diff categories