Changeset View
Changeset View
Standalone View
Standalone View
src/syntax/katehighlight.cpp
Show First 20 Lines • Show All 541 Lines • ▼ Show 20 Line(s) | 537 | for (const auto &format : m_formats) { | |||
---|---|---|---|---|---|
542 | 542 | | |||
543 | /** | 543 | /** | ||
544 | * create a KTextEditor attribute matching the given format | 544 | * create a KTextEditor attribute matching the given format | ||
545 | */ | 545 | */ | ||
546 | KTextEditor::Attribute::Ptr newAttribute(new KTextEditor::Attribute(nameForAttrib(array.size()), textStyleToDefaultStyle(format.textStyle()))); | 546 | KTextEditor::Attribute::Ptr newAttribute(new KTextEditor::Attribute(nameForAttrib(array.size()), textStyleToDefaultStyle(format.textStyle()))); | ||
547 | 547 | | |||
548 | /** | 548 | /** | ||
549 | * NOTE: if "theme()" returns an empty theme, only the | 549 | * NOTE: if "theme()" returns an empty theme, only the | ||
550 | * attribute styles set in the XML files will be applied here | 550 | * attribute styles set in the XML files will be applied here. | ||
551 | * FIXME: if the theme is invalid/empty, the attributes turned off in the | ||||
552 | * XML file don't work. This is so, because there the theme isn't applied by | ||||
553 | * KSyntaxHighlighting and the methods "Format::isBold(...)", "Format::isItalic(...)", | ||||
554 | * etc., return the combination between the syntax definition and the theme. | ||||
551 | */ | 555 | */ | ||
552 | if (format.hasTextColor(theme())) { | 556 | if (format.hasTextColor(theme())) { | ||
553 | newAttribute->setForeground(format.textColor(theme())); | 557 | newAttribute->setForeground(format.textColor(theme())); | ||
554 | newAttribute->setSelectedForeground(format.selectedTextColor(theme())); | 558 | newAttribute->setSelectedForeground(format.selectedTextColor(theme())); | ||
555 | } | 559 | } | ||
556 | 560 | | |||
557 | if (format.hasBackgroundColor(theme())) { | 561 | if (format.hasBackgroundColor(theme())) { | ||
558 | newAttribute->setBackground(format.backgroundColor(theme())); | 562 | newAttribute->setBackground(format.backgroundColor(theme())); | ||
559 | newAttribute->setSelectedBackground(format.selectedBackgroundColor(theme())); | 563 | newAttribute->setSelectedBackground(format.selectedBackgroundColor(theme())); | ||
560 | } | 564 | } | ||
561 | 565 | | |||
566 | if (theme().isValid()) { | ||||
562 | if (format.isBold(theme())) { | 567 | if (format.isBold(theme())) { | ||
563 | newAttribute->setFontBold(true); | 568 | newAttribute->setFontBold(true); | ||
569 | } else { | ||||
570 | newAttribute->setFontBold(false); | ||||
564 | } | 571 | } | ||
565 | 572 | | |||
566 | if (format.isItalic(theme())) { | 573 | if (format.isItalic(theme())) { | ||
567 | newAttribute->setFontItalic(true); | 574 | newAttribute->setFontItalic(true); | ||
575 | } else { | ||||
576 | newAttribute->setFontItalic(false); | ||||
568 | } | 577 | } | ||
569 | 578 | | |||
570 | if (format.isUnderline(theme())) { | 579 | if (format.isUnderline(theme())) { | ||
571 | newAttribute->setFontUnderline(true); | 580 | newAttribute->setFontUnderline(true); | ||
581 | } else { | ||||
582 | newAttribute->setFontUnderline(false); | ||||
572 | } | 583 | } | ||
573 | 584 | | |||
574 | if (format.isStrikeThrough(theme())) { | 585 | if (format.isStrikeThrough(theme())) { | ||
575 | newAttribute->setFontStrikeOut(true); | 586 | newAttribute->setFontStrikeOut(true); | ||
587 | } else { | ||||
588 | newAttribute->setFontStrikeOut(false); | ||||
589 | } | ||||
590 | } else { | ||||
591 | if (format.isBold(theme())) { | ||||
592 | newAttribute->setFontBold(true); | ||||
593 | } | ||||
594 | | ||||
595 | if (format.isItalic(theme())) { | ||||
596 | newAttribute->setFontItalic(true); | ||||
597 | } | ||||
598 | | ||||
599 | if (format.isUnderline(theme())) { | ||||
600 | newAttribute->setFontUnderline(true); | ||||
601 | } | ||||
602 | | ||||
603 | if (format.isStrikeThrough(theme())) { | ||||
604 | newAttribute->setFontStrikeOut(true); | ||||
605 | } | ||||
576 | } | 606 | } | ||
577 | 607 | | |||
578 | newAttribute->setSkipSpellChecking(format.spellCheck()); | 608 | newAttribute->setSkipSpellChecking(format.spellCheck()); | ||
579 | 609 | | |||
580 | array.append(newAttribute); | 610 | array.append(newAttribute); | ||
581 | } | 611 | } | ||
582 | return array; | 612 | return array; | ||
583 | } | 613 | } | ||
▲ Show 20 Lines • Show All 112 Lines • Show Last 20 Lines |