Changeset View
Changeset View
Standalone View
Standalone View
src/syntax/katehighlight.cpp
Show First 20 Lines • Show All 554 Lines • ▼ Show 20 Line(s) | 537 | for (const auto &format : m_formats) { | |||
---|---|---|---|---|---|
555 | } | 555 | } | ||
556 | 556 | | |||
557 | if (format.hasBackgroundColor(theme())) { | 557 | if (format.hasBackgroundColor(theme())) { | ||
558 | newAttribute->setBackground(format.backgroundColor(theme())); | 558 | newAttribute->setBackground(format.backgroundColor(theme())); | ||
559 | newAttribute->setSelectedBackground(format.selectedBackgroundColor(theme())); | 559 | newAttribute->setSelectedBackground(format.selectedBackgroundColor(theme())); | ||
560 | } | 560 | } | ||
561 | 561 | | |||
562 | /** | 562 | /** | ||
563 | * Two cases: | 563 | * Apply attributes set in the syntax definition XML files. | ||
564 | * - Valid theme: "isBold(...)", "isItalic(...)", etc. returns the combination | 564 | * This overwrites the default theme and the theme customized by the user. | ||
565 | * between the attributes set in the syntax definition files and the theme. | | |||
566 | * - Invalid/empty theme: the theme doesn't exist in KSyntaxHighlighting and is | | |||
567 | * already applied. Then it's checked if the bold, italic, underline & strikeout | | |||
568 | * attributes are specifically set in the syntax definition XML file to be applied. | | |||
569 | * | 565 | * | ||
570 | * In both cases, it's allowed to turn off the bold, italic, underline and strikeout | 566 | * It's allowed to turn off the bold, italic, underline and strikeout | ||
571 | * attributes in the XML files (see bug #143399). | 567 | * attributes in the XML files (see bug #143399). | ||
572 | */ | 568 | */ | ||
573 | if (theme().isValid() || format.hasBoldOverride()) { | 569 | if (format.hasBoldOverride()) { | ||
574 | if (format.isBold(theme())) { | 570 | if (format.isBold(theme())) { | ||
575 | newAttribute->setFontBold(true); | 571 | newAttribute->setFontBold(true); | ||
576 | } else { | 572 | } else { | ||
577 | newAttribute->setFontBold(false); | 573 | newAttribute->setFontBold(false); | ||
578 | } | 574 | } | ||
579 | } | 575 | } | ||
580 | 576 | | |||
581 | if (theme().isValid() || format.hasItalicOverride()) { | 577 | if (format.hasItalicOverride()) { | ||
582 | if (format.isItalic(theme())) { | 578 | if (format.isItalic(theme())) { | ||
583 | newAttribute->setFontItalic(true); | 579 | newAttribute->setFontItalic(true); | ||
584 | } else { | 580 | } else { | ||
585 | newAttribute->setFontItalic(false); | 581 | newAttribute->setFontItalic(false); | ||
586 | } | 582 | } | ||
587 | } | 583 | } | ||
588 | 584 | | |||
589 | if (theme().isValid() || format.hasUnderlineOverride()) { | 585 | if (format.hasUnderlineOverride()) { | ||
590 | if (format.isUnderline(theme())) { | 586 | if (format.isUnderline(theme())) { | ||
591 | newAttribute->setFontUnderline(true); | 587 | newAttribute->setFontUnderline(true); | ||
592 | } else { | 588 | } else { | ||
593 | newAttribute->setFontUnderline(false); | 589 | newAttribute->setFontUnderline(false); | ||
594 | } | 590 | } | ||
595 | } | 591 | } | ||
596 | 592 | | |||
597 | if (theme().isValid() || format.hasStrikeThroughOverride()) { | 593 | if (format.hasStrikeThroughOverride()) { | ||
598 | if (format.isStrikeThrough(theme())) { | 594 | if (format.isStrikeThrough(theme())) { | ||
599 | newAttribute->setFontStrikeOut(true); | 595 | newAttribute->setFontStrikeOut(true); | ||
600 | } else { | 596 | } else { | ||
601 | newAttribute->setFontStrikeOut(false); | 597 | newAttribute->setFontStrikeOut(false); | ||
602 | } | 598 | } | ||
603 | } | 599 | } | ||
604 | 600 | | |||
605 | newAttribute->setSkipSpellChecking(format.spellCheck()); | 601 | newAttribute->setSkipSpellChecking(format.spellCheck()); | ||
▲ Show 20 Lines • Show All 117 Lines • Show Last 20 Lines |