Changeset View
Changeset View
Standalone View
Standalone View
src/syntax/katehighlight.cpp
Show First 20 Lines • Show All 69 Lines • ▼ Show 20 Line(s) | |||||
70 | 70 | | |||
71 | } | 71 | } | ||
72 | //END | 72 | //END | ||
73 | 73 | | |||
74 | //BEGIN KateHighlighting | 74 | //BEGIN KateHighlighting | ||
75 | KateHighlighting::KateHighlighting(const KSyntaxHighlighting::Definition &def) | 75 | KateHighlighting::KateHighlighting(const KSyntaxHighlighting::Definition &def) | ||
76 | { | 76 | { | ||
77 | /** | 77 | /** | ||
78 | * get name and section, always works | 78 | * get name and section, always works | ||
mwolff: return QStringLiteral, otherwise you allocate on every function call (also below) | |||||
79 | */ | 79 | */ | ||
80 | iName = def.name(); | 80 | iName = def.name(); | ||
81 | iSection = def.translatedSection(); | 81 | iSection = def.translatedSection(); | ||
82 | 82 | | |||
83 | /** | 83 | /** | ||
84 | * get all included definitions, e.g. PHP for HTML highlighting | 84 | * get all included definitions, e.g. PHP for HTML highlighting | ||
85 | */ | 85 | */ | ||
86 | auto definitions = def.includedDefinitions(); | 86 | auto definitions = def.includedDefinitions(); | ||
▲ Show 20 Lines • Show All 421 Lines • ▼ Show 20 Line(s) | |||||
508 | QVector<KTextEditor::Attribute::Ptr> KateHighlighting::attributesForDefinition() | 508 | QVector<KTextEditor::Attribute::Ptr> KateHighlighting::attributesForDefinition() | ||
509 | { | 509 | { | ||
510 | /** | 510 | /** | ||
511 | * create list of all known things | 511 | * create list of all known things | ||
512 | */ | 512 | */ | ||
513 | QVector<KTextEditor::Attribute::Ptr> array; | 513 | QVector<KTextEditor::Attribute::Ptr> array; | ||
514 | for (const auto &format : m_formats) { | 514 | for (const auto &format : m_formats) { | ||
515 | /** | 515 | /** | ||
516 | * FIXME: atm we just set some theme here for later color generation | 516 | * atm we just set the current chosen theme here for later color generation | ||
517 | */ | 517 | */ | ||
518 | setTheme(KateHlManager::self()->repository().defaultTheme(KSyntaxHighlighting::Repository::LightTheme)); | 518 | setTheme(KateHlManager::self()->repository().theme(KateRendererConfig::global()->schema())); | ||
519 | 519 | | |||
520 | /** | 520 | /** | ||
521 | * create a KTextEditor attribute matching the given format | 521 | * create a KTextEditor attribute matching the given format | ||
522 | */ | 522 | */ | ||
523 | KTextEditor::Attribute::Ptr newAttribute(new KTextEditor::Attribute(nameForAttrib(array.size()), textStyleToDefaultStyle(format.textStyle()))); | 523 | KTextEditor::Attribute::Ptr newAttribute(new KTextEditor::Attribute(nameForAttrib(array.size()), textStyleToDefaultStyle(format.textStyle()))); | ||
524 | 524 | | |||
525 | if (format.hasTextColor(theme())) { | 525 | if (format.hasTextColor(theme())) { | ||
526 | newAttribute->setForeground(format.textColor(theme())); | 526 | newAttribute->setForeground(format.textColor(theme())); | ||
▲ Show 20 Lines • Show All 142 Lines • Show Last 20 Lines |
return QStringLiteral, otherwise you allocate on every function call (also below)