Changeset View
Changeset View
Standalone View
Standalone View
src/utils/kateconfig.cpp
Show First 20 Lines • Show All 91 Lines • ▼ Show 20 Line(s) | 216 | { | |||
---|---|---|---|---|---|
226 | /** | 226 | /** | ||
227 | * key known, dispatch to normal setValue() function with enum | 227 | * key known, dispatch to normal setValue() function with enum | ||
228 | */ | 228 | */ | ||
229 | return setValue(it.value()->enumKey, value); | 229 | return setValue(it.value()->enumKey, value); | ||
230 | } | 230 | } | ||
231 | 231 | | |||
232 | //END | 232 | //END | ||
233 | 233 | | |||
234 | //BEGIN KateDocumentConfig | 234 | //BEGIN HelperFunctions | ||
235 | KateGlobalConfig *KateGlobalConfig::s_global = nullptr; | 235 | KateGlobalConfig *KateGlobalConfig::s_global = nullptr; | ||
236 | KateDocumentConfig *KateDocumentConfig::s_global = nullptr; | 236 | KateDocumentConfig *KateDocumentConfig::s_global = nullptr; | ||
237 | KateViewConfig *KateViewConfig::s_global = nullptr; | 237 | KateViewConfig *KateViewConfig::s_global = nullptr; | ||
238 | KateRendererConfig *KateRendererConfig::s_global = nullptr; | 238 | KateRendererConfig *KateRendererConfig::s_global = nullptr; | ||
239 | 239 | | |||
240 | /** | 240 | /** | ||
241 | * validate if an encoding is ok | 241 | * validate if an encoding is ok | ||
242 | * @param name encoding name | 242 | * @param name encoding name | ||
243 | * @return encoding ok? | 243 | * @return encoding ok? | ||
244 | */ | 244 | */ | ||
245 | static bool isEncodingOk(const QString &name) | 245 | static bool isEncodingOk(const QString &name) | ||
246 | { | 246 | { | ||
247 | bool found = false; | 247 | bool found = false; | ||
248 | auto codec = KCharsets::charsets()->codecForName(name, found); | 248 | auto codec = KCharsets::charsets()->codecForName(name, found); | ||
249 | return found && codec; | 249 | return found && codec; | ||
250 | } | 250 | } | ||
251 | 251 | | |||
252 | static bool inBounds(const int min, const QVariant &value, const int max) | ||||
253 | { | ||||
254 | const int val = value.toInt(); | ||||
255 | return (val >= min) && (val <= max); | ||||
256 | } | ||||
257 | //END | ||||
258 | | ||||
259 | //BEGIN KateGlobalConfig | ||||
252 | KateGlobalConfig::KateGlobalConfig() | 260 | KateGlobalConfig::KateGlobalConfig() | ||
253 | { | 261 | { | ||
254 | /** | 262 | /** | ||
255 | * register this as our global instance | 263 | * register this as our global instance | ||
256 | */ | 264 | */ | ||
257 | Q_ASSERT(isGlobal()); | 265 | Q_ASSERT(isGlobal()); | ||
258 | s_global = this; | 266 | s_global = this; | ||
259 | 267 | | |||
▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Line(s) | 326 | if (encoding.isEmpty()) { | |||
319 | return QTextCodec::codecForName("ISO 8859-15"); | 327 | return QTextCodec::codecForName("ISO 8859-15"); | ||
320 | } | 328 | } | ||
321 | 329 | | |||
322 | /** | 330 | /** | ||
323 | * use configured encoding | 331 | * use configured encoding | ||
324 | */ | 332 | */ | ||
325 | return KCharsets::charsets()->codecForName(encoding); | 333 | return KCharsets::charsets()->codecForName(encoding); | ||
326 | } | 334 | } | ||
335 | //END | ||||
327 | 336 | | |||
337 | //BEGIN KateDocumentConfig | ||||
328 | KateDocumentConfig::KateDocumentConfig() | 338 | KateDocumentConfig::KateDocumentConfig() | ||
329 | { | 339 | { | ||
330 | /** | 340 | /** | ||
331 | * register this as our global instance | 341 | * register this as our global instance | ||
332 | */ | 342 | */ | ||
333 | Q_ASSERT(isGlobal()); | 343 | Q_ASSERT(isGlobal()); | ||
334 | s_global = this; | 344 | s_global = this; | ||
335 | 345 | | |||
▲ Show 20 Lines • Show All 152 Lines • ▼ Show 20 Line(s) | 491 | switch(eol()) { | |||
488 | default: | 498 | default: | ||
489 | return QStringLiteral("\n"); | 499 | return QStringLiteral("\n"); | ||
490 | } | 500 | } | ||
491 | } | 501 | } | ||
492 | //END | 502 | //END | ||
493 | 503 | | |||
494 | //BEGIN KateViewConfig | 504 | //BEGIN KateViewConfig | ||
495 | KateViewConfig::KateViewConfig() | 505 | KateViewConfig::KateViewConfig() | ||
496 | : m_dynWordWrapSet(false), | 506 | : | ||
497 | m_dynWrapAtStaticMarkerSet(false), | | |||
498 | m_dynWordWrapIndicatorsSet(false), | | |||
499 | m_dynWordWrapAlignIndentSet(false), | | |||
500 | m_lineNumbersSet(false), | | |||
501 | m_scrollBarMarksSet(false), | | |||
502 | m_scrollBarPreviewSet(false), | | |||
503 | m_scrollBarMiniMapSet(false), | 507 | m_scrollBarMiniMapSet(false), | ||
504 | m_scrollBarMiniMapAllSet(false), | 508 | m_scrollBarMiniMapAllSet(false), | ||
505 | m_scrollBarMiniMapWidthSet(false), | 509 | m_scrollBarMiniMapWidthSet(false), | ||
506 | m_showScrollbarsSet(false), | 510 | m_showScrollbarsSet(false), | ||
507 | m_iconBarSet(false), | 511 | m_iconBarSet(false), | ||
508 | m_foldingBarSet(false), | 512 | m_foldingBarSet(false), | ||
509 | m_foldingPreviewSet(false), | 513 | m_foldingPreviewSet(false), | ||
510 | m_lineModificationSet(false), | 514 | m_lineModificationSet(false), | ||
511 | m_bookmarkSortSet(false), | 515 | m_bookmarkSortSet(false), | ||
512 | m_autoCenterLinesSet(false), | 516 | m_autoCenterLinesSet(false), | ||
513 | m_searchFlagsSet(false), | | |||
514 | m_defaultMarkTypeSet(false), | 517 | m_defaultMarkTypeSet(false), | ||
515 | m_persistentSelectionSet(false), | 518 | m_persistentSelectionSet(false), | ||
516 | m_inputModeSet(false), | 519 | m_inputModeSet(false), | ||
517 | m_viInputModeStealKeysSet(false), | 520 | m_viInputModeStealKeysSet(false), | ||
518 | m_viRelativeLineNumbersSet(false), | 521 | m_viRelativeLineNumbersSet(false), | ||
519 | m_automaticCompletionInvocationSet(false), | 522 | m_automaticCompletionInvocationSet(false), | ||
520 | m_wordCompletionSet(false), | 523 | m_wordCompletionSet(false), | ||
521 | m_keywordCompletionSet(false), | 524 | m_keywordCompletionSet(false), | ||
522 | m_wordCompletionMinimalWordLengthSet(false), | 525 | m_wordCompletionMinimalWordLengthSet(false), | ||
523 | m_smartCopyCutSet(false), | 526 | m_smartCopyCutSet(false), | ||
524 | m_mousePasteAtCursorPositionSet(false), | 527 | m_mousePasteAtCursorPositionSet(false), | ||
525 | m_scrollPastEndSet(false), | 528 | m_scrollPastEndSet(false), | ||
526 | m_allowMarkMenu(true), | 529 | m_allowMarkMenu(true), | ||
527 | m_wordCompletionRemoveTailSet(false), | 530 | m_wordCompletionRemoveTailSet(false), | ||
528 | m_foldFirstLineSet(false), | 531 | m_foldFirstLineSet(false), | ||
529 | m_showWordCountSet(false), | | |||
530 | m_showLineCountSet(false), | 532 | m_showLineCountSet(false), | ||
531 | m_autoBracketsSet(false), | 533 | m_autoBracketsSet(false) | ||
532 | m_backspaceRemoveComposedSet(false) | | |||
533 | | ||||
534 | { | 534 | { | ||
535 | s_global = this; | 535 | s_global = this; | ||
536 | 536 | | |||
537 | // Init all known config entries | 537 | // Init all known config entries | ||
538 | // NOTE: Ensure to keep the same order as listed in enum ConfigEntryTypes or it will later assert! | 538 | // NOTE: Ensure to keep the same order as listed in enum ConfigEntryTypes or it will later assert! | ||
539 | // addConfigEntry(ConfigEntry(<EnumKey>, <ConfigKey>, <CommandName>, <DefaultValue>, [<ValidatorFunction>])) | 539 | // addConfigEntry(ConfigEntry(<EnumKey>, <ConfigKey>, <CommandName>, <DefaultValue>, [<ValidatorFunction>])) | ||
540 | // addConfigEntry(ConfigEntry(, "", QString(), QString())); | ||||
541 | // addConfigEntry(ConfigEntry(, "", QStringLiteral(""), true)); | ||||
542 | // addConfigEntry(ConfigEntry(, "", QString(), true)); | ||||
543 | addConfigEntry(ConfigEntry(BackspaceRemoveComposedCharacters, "Backspace Remove Composed Characters", QString(), false)); | ||||
540 | addConfigEntry(ConfigEntry(CharsToEncloseSelection, "Chars To Enclose Selection", QString(), QString())); | 544 | addConfigEntry(ConfigEntry(CharsToEncloseSelection, "Chars To Enclose Selection", QString(), QString())); | ||
545 | addConfigEntry(ConfigEntry(DynWordWrapAlignIndent, "Dynamic Word Wrap Align Indent", QString(), 80, [](const QVariant &value) { return inBounds(1, value, 100); })); | ||||
546 | addConfigEntry(ConfigEntry(DynWordWrapIndicators, "Dynamic Word Wrap Indicators", QString(), 1, [](const QVariant &value) { return inBounds(1, value, 3); })); | ||||
547 | addConfigEntry(ConfigEntry(DynWrapAtStaticMarker, "Dynamic Word Wrap At Static Marker", QString(), false)); | ||||
548 | addConfigEntry(ConfigEntry(DynamicWordWrap, "Dynamic Word Wrap", QStringLiteral("dynamic-word-wrap"), true)); | ||||
549 | addConfigEntry(ConfigEntry(MaxHistorySize, "Maximum Search History Size", QString(), 100, [](const QVariant &value) { return inBounds(0, value, 999); })); | ||||
550 | addConfigEntry(ConfigEntry(SearchFlags, "Search/Replace Flags", QString(), IncFromCursor | PowerMatchCase | PowerModePlainText)); | ||||
551 | addConfigEntry(ConfigEntry(ShowLineNumbers, "Line Numbers", QStringLiteral("line-numbers"), false)); | ||||
552 | addConfigEntry(ConfigEntry(ShowScrollBarMarks, "Scroll Bar Marks", QString(), false)); | ||||
553 | addConfigEntry(ConfigEntry(ShowScrollBarPreview, "Scroll Bar Preview", QStringLiteral("scrollbar-preview"), true)); | ||||
554 | addConfigEntry(ConfigEntry(ShowWordCount, "Show Word Count", QString(), false)); | ||||
541 | 555 | | |||
542 | // init with defaults from config or really hardcoded ones | 556 | // init with defaults from config or really hardcoded ones | ||
543 | KConfigGroup config(KTextEditor::EditorPrivate::config(), "KTextEditor View"); | 557 | KConfigGroup config(KTextEditor::EditorPrivate::config(), "KTextEditor View"); | ||
544 | readConfig(config); | 558 | readConfig(config); | ||
545 | } | 559 | } | ||
546 | 560 | | |||
547 | KateViewConfig::KateViewConfig(KTextEditor::ViewPrivate *view) | 561 | KateViewConfig::KateViewConfig(KTextEditor::ViewPrivate *view) | ||
548 | : KateConfig(s_global), | 562 | : KateConfig(s_global), | ||
549 | m_searchFlags(PowerModePlainText), | | |||
550 | m_maxHistorySize(100), | | |||
551 | m_showWordCount(false), | | |||
552 | m_dynWordWrapSet(false), | | |||
553 | m_dynWrapAtStaticMarkerSet(false), | | |||
554 | m_dynWordWrapIndicatorsSet(false), | | |||
555 | m_dynWordWrapAlignIndentSet(false), | | |||
556 | m_lineNumbersSet(false), | | |||
557 | m_scrollBarMarksSet(false), | | |||
558 | m_scrollBarPreviewSet(false), | | |||
559 | m_scrollBarMiniMapSet(false), | 563 | m_scrollBarMiniMapSet(false), | ||
560 | m_scrollBarMiniMapAllSet(false), | 564 | m_scrollBarMiniMapAllSet(false), | ||
561 | m_scrollBarMiniMapWidthSet(false), | 565 | m_scrollBarMiniMapWidthSet(false), | ||
562 | m_showScrollbarsSet(false), | 566 | m_showScrollbarsSet(false), | ||
563 | m_iconBarSet(false), | 567 | m_iconBarSet(false), | ||
564 | m_foldingBarSet(false), | 568 | m_foldingBarSet(false), | ||
565 | m_foldingPreviewSet(false), | 569 | m_foldingPreviewSet(false), | ||
566 | m_lineModificationSet(false), | 570 | m_lineModificationSet(false), | ||
567 | m_bookmarkSortSet(false), | 571 | m_bookmarkSortSet(false), | ||
568 | m_autoCenterLinesSet(false), | 572 | m_autoCenterLinesSet(false), | ||
569 | m_searchFlagsSet(false), | | |||
570 | m_defaultMarkTypeSet(false), | 573 | m_defaultMarkTypeSet(false), | ||
571 | m_persistentSelectionSet(false), | 574 | m_persistentSelectionSet(false), | ||
572 | m_inputModeSet(false), | 575 | m_inputModeSet(false), | ||
573 | m_viInputModeStealKeysSet(false), | 576 | m_viInputModeStealKeysSet(false), | ||
574 | m_viRelativeLineNumbersSet(false), | 577 | m_viRelativeLineNumbersSet(false), | ||
575 | m_automaticCompletionInvocationSet(false), | 578 | m_automaticCompletionInvocationSet(false), | ||
576 | m_wordCompletionSet(false), | 579 | m_wordCompletionSet(false), | ||
577 | m_keywordCompletionSet(false), | 580 | m_keywordCompletionSet(false), | ||
578 | m_wordCompletionMinimalWordLengthSet(false), | 581 | m_wordCompletionMinimalWordLengthSet(false), | ||
579 | m_smartCopyCutSet(false), | 582 | m_smartCopyCutSet(false), | ||
580 | m_mousePasteAtCursorPositionSet(false), | 583 | m_mousePasteAtCursorPositionSet(false), | ||
581 | m_scrollPastEndSet(false), | 584 | m_scrollPastEndSet(false), | ||
582 | m_allowMarkMenu(true), | 585 | m_allowMarkMenu(true), | ||
583 | m_wordCompletionRemoveTailSet(false), | 586 | m_wordCompletionRemoveTailSet(false), | ||
584 | m_foldFirstLineSet(false), | 587 | m_foldFirstLineSet(false), | ||
585 | m_showWordCountSet(false), | | |||
586 | m_showLineCountSet(false), | 588 | m_showLineCountSet(false), | ||
587 | m_autoBracketsSet(false), | 589 | m_autoBracketsSet(false), | ||
588 | m_backspaceRemoveComposedSet(false), | | |||
589 | m_view(view) | 590 | m_view(view) | ||
590 | { | 591 | { | ||
591 | } | 592 | } | ||
592 | 593 | | |||
593 | KateViewConfig::~KateViewConfig() | 594 | KateViewConfig::~KateViewConfig() | ||
594 | { | 595 | { | ||
595 | } | 596 | } | ||
596 | 597 | | |||
597 | namespace | 598 | namespace | ||
598 | { | 599 | { | ||
599 | const char KEY_SEARCH_REPLACE_FLAGS[] = "Search/Replace Flags"; | | |||
600 | const char KEY_DYN_WORD_WRAP[] = "Dynamic Word Wrap"; | | |||
601 | const char KEY_DYN_WORD_WRAP_AT_STATIC_MARKER[] = "Dynamic Word Wrap At Static Marker"; | | |||
602 | const char KEY_DYN_WORD_WRAP_INDICATORS[] = "Dynamic Word Wrap Indicators"; | | |||
603 | const char KEY_DYN_WORD_WRAP_ALIGN_INDENT[] = "Dynamic Word Wrap Align Indent"; | | |||
604 | const char KEY_LINE_NUMBERS[] = "Line Numbers"; | | |||
605 | const char KEY_SCROLL_BAR_MARKS[] = "Scroll Bar Marks"; | | |||
606 | const char KEY_SCROLL_BAR_PREVIEW[] = "Scroll Bar Preview"; | | |||
607 | const char KEY_SCROLL_BAR_MINI_MAP[] = "Scroll Bar MiniMap"; | 600 | const char KEY_SCROLL_BAR_MINI_MAP[] = "Scroll Bar MiniMap"; | ||
608 | const char KEY_SCROLL_BAR_MINI_MAP_ALL[] = "Scroll Bar Mini Map All"; | 601 | const char KEY_SCROLL_BAR_MINI_MAP_ALL[] = "Scroll Bar Mini Map All"; | ||
609 | const char KEY_SCROLL_BAR_MINI_MAP_WIDTH[] = "Scroll Bar Mini Map Width"; | 602 | const char KEY_SCROLL_BAR_MINI_MAP_WIDTH[] = "Scroll Bar Mini Map Width"; | ||
610 | const char KEY_SHOW_SCROLLBARS[] = "Show Scrollbars"; | 603 | const char KEY_SHOW_SCROLLBARS[] = "Show Scrollbars"; | ||
611 | const char KEY_ICON_BAR[] = "Icon Bar"; | 604 | const char KEY_ICON_BAR[] = "Icon Bar"; | ||
612 | const char KEY_FOLDING_BAR[] = "Folding Bar"; | 605 | const char KEY_FOLDING_BAR[] = "Folding Bar"; | ||
613 | const char KEY_FOLDING_PREVIEW[] = "Folding Preview"; | 606 | const char KEY_FOLDING_PREVIEW[] = "Folding Preview"; | ||
614 | const char KEY_LINE_MODIFICATION[] = "Line Modification"; | 607 | const char KEY_LINE_MODIFICATION[] = "Line Modification"; | ||
615 | const char KEY_BOOKMARK_SORT[] = "Bookmark Menu Sorting"; | 608 | const char KEY_BOOKMARK_SORT[] = "Bookmark Menu Sorting"; | ||
616 | const char KEY_AUTO_CENTER_LINES[] = "Auto Center Lines"; | 609 | const char KEY_AUTO_CENTER_LINES[] = "Auto Center Lines"; | ||
617 | const char KEY_MAX_HISTORY_SIZE[] = "Maximum Search History Size"; | | |||
618 | const char KEY_DEFAULT_MARK_TYPE[] = "Default Mark Type"; | 610 | const char KEY_DEFAULT_MARK_TYPE[] = "Default Mark Type"; | ||
619 | const char KEY_ALLOW_MARK_MENU[] = "Allow Mark Menu"; | 611 | const char KEY_ALLOW_MARK_MENU[] = "Allow Mark Menu"; | ||
620 | const char KEY_PERSISTENT_SELECTION[] = "Persistent Selection"; | 612 | const char KEY_PERSISTENT_SELECTION[] = "Persistent Selection"; | ||
621 | const char KEY_INPUT_MODE[] = "Input Mode"; | 613 | const char KEY_INPUT_MODE[] = "Input Mode"; | ||
622 | const char KEY_VI_INPUT_MODE_STEAL_KEYS[] = "Vi Input Mode Steal Keys"; | 614 | const char KEY_VI_INPUT_MODE_STEAL_KEYS[] = "Vi Input Mode Steal Keys"; | ||
623 | const char KEY_VI_RELATIVE_LINE_NUMBERS[] = "Vi Relative Line Numbers"; | 615 | const char KEY_VI_RELATIVE_LINE_NUMBERS[] = "Vi Relative Line Numbers"; | ||
624 | const char KEY_AUTOMATIC_COMPLETION_INVOCATION[] = "Auto Completion"; | 616 | const char KEY_AUTOMATIC_COMPLETION_INVOCATION[] = "Auto Completion"; | ||
625 | const char KEY_WORD_COMPLETION[] = "Word Completion"; | 617 | const char KEY_WORD_COMPLETION[] = "Word Completion"; | ||
626 | const char KEY_KEYWORD_COMPLETION[] = "Keyword Completion"; | 618 | const char KEY_KEYWORD_COMPLETION[] = "Keyword Completion"; | ||
627 | const char KEY_WORD_COMPLETION_MINIMAL_WORD_LENGTH[] = "Word Completion Minimal Word Length"; | 619 | const char KEY_WORD_COMPLETION_MINIMAL_WORD_LENGTH[] = "Word Completion Minimal Word Length"; | ||
628 | const char KEY_WORD_COMPLETION_REMOVE_TAIL[] = "Word Completion Remove Tail"; | 620 | const char KEY_WORD_COMPLETION_REMOVE_TAIL[] = "Word Completion Remove Tail"; | ||
629 | const char KEY_SMART_COPY_CUT[] = "Smart Copy Cut"; | 621 | const char KEY_SMART_COPY_CUT[] = "Smart Copy Cut"; | ||
630 | const char KEY_MOUSE_PASTE_AT_CURSOR_POSITION[] = "Mouse Paste At Cursor Position"; | 622 | const char KEY_MOUSE_PASTE_AT_CURSOR_POSITION[] = "Mouse Paste At Cursor Position"; | ||
631 | const char KEY_SCROLL_PAST_END[] = "Scroll Past End"; | 623 | const char KEY_SCROLL_PAST_END[] = "Scroll Past End"; | ||
632 | const char KEY_FOLD_FIRST_LINE[] = "Fold First Line"; | 624 | const char KEY_FOLD_FIRST_LINE[] = "Fold First Line"; | ||
633 | const char KEY_SHOW_LINE_COUNT[] = "Show Line Count"; | 625 | const char KEY_SHOW_LINE_COUNT[] = "Show Line Count"; | ||
634 | const char KEY_SHOW_WORD_COUNT[] = "Show Word Count"; | | |||
635 | const char KEY_AUTO_BRACKETS[] = "Auto Brackets"; | 626 | const char KEY_AUTO_BRACKETS[] = "Auto Brackets"; | ||
636 | const char KEY_BACKSPACE_REMOVE_COMPOSED[] = "Backspace Remove Composed Characters"; | | |||
637 | } | 627 | } | ||
638 | 628 | | |||
639 | void KateViewConfig::readConfig(const KConfigGroup &config) | 629 | void KateViewConfig::readConfig(const KConfigGroup &config) | ||
640 | { | 630 | { | ||
641 | configStart(); | 631 | configStart(); | ||
642 | 632 | | |||
643 | // read generic entries | 633 | // read generic entries | ||
644 | readConfigEntries(config); | 634 | readConfigEntries(config); | ||
645 | 635 | | |||
646 | // default on | 636 | // default on | ||
647 | setDynWordWrap(config.readEntry(KEY_DYN_WORD_WRAP, true)); | | |||
648 | setDynWrapAtStaticMarker(config.readEntry(KEY_DYN_WORD_WRAP_AT_STATIC_MARKER, false)); | | |||
649 | setDynWordWrapIndicators(config.readEntry(KEY_DYN_WORD_WRAP_INDICATORS, 1)); | | |||
650 | setDynWordWrapAlignIndent(config.readEntry(KEY_DYN_WORD_WRAP_ALIGN_INDENT, 80)); | | |||
651 | | ||||
652 | setLineNumbers(config.readEntry(KEY_LINE_NUMBERS, false)); | | |||
653 | | ||||
654 | setScrollBarMarks(config.readEntry(KEY_SCROLL_BAR_MARKS, false)); | | |||
655 | | ||||
656 | setScrollBarPreview(config.readEntry(KEY_SCROLL_BAR_PREVIEW, true)); | | |||
657 | | ||||
658 | setScrollBarMiniMap(config.readEntry(KEY_SCROLL_BAR_MINI_MAP, true)); | 637 | setScrollBarMiniMap(config.readEntry(KEY_SCROLL_BAR_MINI_MAP, true)); | ||
659 | 638 | | |||
660 | setScrollBarMiniMapAll(config.readEntry(KEY_SCROLL_BAR_MINI_MAP_ALL, false)); | 639 | setScrollBarMiniMapAll(config.readEntry(KEY_SCROLL_BAR_MINI_MAP_ALL, false)); | ||
661 | 640 | | |||
662 | setScrollBarMiniMapWidth(config.readEntry(KEY_SCROLL_BAR_MINI_MAP_WIDTH, 60)); | 641 | setScrollBarMiniMapWidth(config.readEntry(KEY_SCROLL_BAR_MINI_MAP_WIDTH, 60)); | ||
663 | 642 | | |||
664 | setShowScrollbars(config.readEntry(KEY_SHOW_SCROLLBARS, static_cast<int>(AlwaysOn))); | 643 | setShowScrollbars(config.readEntry(KEY_SHOW_SCROLLBARS, static_cast<int>(AlwaysOn))); | ||
665 | 644 | | |||
666 | setIconBar(config.readEntry(KEY_ICON_BAR, false)); | 645 | setIconBar(config.readEntry(KEY_ICON_BAR, false)); | ||
667 | 646 | | |||
668 | setFoldingBar(config.readEntry(KEY_FOLDING_BAR, true)); | 647 | setFoldingBar(config.readEntry(KEY_FOLDING_BAR, true)); | ||
669 | 648 | | |||
670 | setFoldingPreview(config.readEntry(KEY_FOLDING_PREVIEW, true)); | 649 | setFoldingPreview(config.readEntry(KEY_FOLDING_PREVIEW, true)); | ||
671 | 650 | | |||
672 | setLineModification(config.readEntry(KEY_LINE_MODIFICATION, false)); | 651 | setLineModification(config.readEntry(KEY_LINE_MODIFICATION, false)); | ||
673 | 652 | | |||
674 | setBookmarkSort(config.readEntry(KEY_BOOKMARK_SORT, 0)); | 653 | setBookmarkSort(config.readEntry(KEY_BOOKMARK_SORT, 0)); | ||
675 | 654 | | |||
676 | setAutoCenterLines(config.readEntry(KEY_AUTO_CENTER_LINES, 0)); | 655 | setAutoCenterLines(config.readEntry(KEY_AUTO_CENTER_LINES, 0)); | ||
677 | 656 | | |||
678 | setSearchFlags(config.readEntry(KEY_SEARCH_REPLACE_FLAGS, | | |||
679 | IncFromCursor | PowerMatchCase | PowerModePlainText)); | | |||
680 | | ||||
681 | m_maxHistorySize = config.readEntry(KEY_MAX_HISTORY_SIZE, 100); | | |||
682 | | ||||
683 | setDefaultMarkType(config.readEntry(KEY_DEFAULT_MARK_TYPE, int(KTextEditor::MarkInterface::markType01))); | 657 | setDefaultMarkType(config.readEntry(KEY_DEFAULT_MARK_TYPE, int(KTextEditor::MarkInterface::markType01))); | ||
684 | setAllowMarkMenu(config.readEntry(KEY_ALLOW_MARK_MENU, true)); | 658 | setAllowMarkMenu(config.readEntry(KEY_ALLOW_MARK_MENU, true)); | ||
685 | 659 | | |||
686 | setPersistentSelection(config.readEntry(KEY_PERSISTENT_SELECTION, false)); | 660 | setPersistentSelection(config.readEntry(KEY_PERSISTENT_SELECTION, false)); | ||
687 | 661 | | |||
688 | setInputModeRaw(config.readEntry(KEY_INPUT_MODE, 0)); | 662 | setInputModeRaw(config.readEntry(KEY_INPUT_MODE, 0)); | ||
689 | setViInputModeStealKeys(config.readEntry(KEY_VI_INPUT_MODE_STEAL_KEYS, false)); | 663 | setViInputModeStealKeys(config.readEntry(KEY_VI_INPUT_MODE_STEAL_KEYS, false)); | ||
690 | setViRelativeLineNumbers(config.readEntry(KEY_VI_RELATIVE_LINE_NUMBERS, false)); | 664 | setViRelativeLineNumbers(config.readEntry(KEY_VI_RELATIVE_LINE_NUMBERS, false)); | ||
691 | 665 | | |||
692 | setAutomaticCompletionInvocation(config.readEntry(KEY_AUTOMATIC_COMPLETION_INVOCATION, true)); | 666 | setAutomaticCompletionInvocation(config.readEntry(KEY_AUTOMATIC_COMPLETION_INVOCATION, true)); | ||
693 | setWordCompletion(config.readEntry(KEY_WORD_COMPLETION, true)); | 667 | setWordCompletion(config.readEntry(KEY_WORD_COMPLETION, true)); | ||
694 | setKeywordCompletion(config.readEntry(KEY_KEYWORD_COMPLETION, true)); | 668 | setKeywordCompletion(config.readEntry(KEY_KEYWORD_COMPLETION, true)); | ||
695 | setWordCompletionMinimalWordLength(config.readEntry(KEY_WORD_COMPLETION_MINIMAL_WORD_LENGTH, 3)); | 669 | setWordCompletionMinimalWordLength(config.readEntry(KEY_WORD_COMPLETION_MINIMAL_WORD_LENGTH, 3)); | ||
696 | setWordCompletionRemoveTail(config.readEntry(KEY_WORD_COMPLETION_REMOVE_TAIL, true)); | 670 | setWordCompletionRemoveTail(config.readEntry(KEY_WORD_COMPLETION_REMOVE_TAIL, true)); | ||
697 | setSmartCopyCut(config.readEntry(KEY_SMART_COPY_CUT, false)); | 671 | setSmartCopyCut(config.readEntry(KEY_SMART_COPY_CUT, false)); | ||
698 | setMousePasteAtCursorPosition(config.readEntry(KEY_MOUSE_PASTE_AT_CURSOR_POSITION, false)); | 672 | setMousePasteAtCursorPosition(config.readEntry(KEY_MOUSE_PASTE_AT_CURSOR_POSITION, false)); | ||
699 | setScrollPastEnd(config.readEntry(KEY_SCROLL_PAST_END, false)); | 673 | setScrollPastEnd(config.readEntry(KEY_SCROLL_PAST_END, false)); | ||
700 | setFoldFirstLine(config.readEntry(KEY_FOLD_FIRST_LINE, false)); | 674 | setFoldFirstLine(config.readEntry(KEY_FOLD_FIRST_LINE, false)); | ||
701 | setShowLineCount(config.readEntry(KEY_SHOW_LINE_COUNT, false)); | 675 | setShowLineCount(config.readEntry(KEY_SHOW_LINE_COUNT, false)); | ||
702 | setShowWordCount(config.readEntry(KEY_SHOW_WORD_COUNT, false)); | | |||
703 | setAutoBrackets(config.readEntry(KEY_AUTO_BRACKETS, false)); | 676 | setAutoBrackets(config.readEntry(KEY_AUTO_BRACKETS, false)); | ||
704 | 677 | | |||
705 | setBackspaceRemoveComposed(config.readEntry(KEY_BACKSPACE_REMOVE_COMPOSED, false)); | | |||
706 | | ||||
707 | configEnd(); | 678 | configEnd(); | ||
708 | } | 679 | } | ||
709 | 680 | | |||
710 | void KateViewConfig::writeConfig(KConfigGroup &config) | 681 | void KateViewConfig::writeConfig(KConfigGroup &config) | ||
711 | { | 682 | { | ||
712 | // write generic entries | 683 | // write generic entries | ||
713 | writeConfigEntries(config); | 684 | writeConfigEntries(config); | ||
714 | 685 | | |||
715 | config.writeEntry(KEY_DYN_WORD_WRAP, dynWordWrap()); | | |||
716 | config.writeEntry(KEY_DYN_WORD_WRAP_AT_STATIC_MARKER, dynWrapAtStaticMarker()); | | |||
717 | config.writeEntry(KEY_DYN_WORD_WRAP_INDICATORS, dynWordWrapIndicators()); | | |||
718 | config.writeEntry(KEY_DYN_WORD_WRAP_ALIGN_INDENT, dynWordWrapAlignIndent()); | | |||
719 | | ||||
720 | config.writeEntry(KEY_LINE_NUMBERS, lineNumbers()); | | |||
721 | | ||||
722 | config.writeEntry(KEY_SCROLL_BAR_MARKS, scrollBarMarks()); | | |||
723 | | ||||
724 | config.writeEntry(KEY_SCROLL_BAR_PREVIEW, scrollBarPreview()); | | |||
725 | | ||||
726 | config.writeEntry(KEY_SCROLL_BAR_MINI_MAP, scrollBarMiniMap()); | 686 | config.writeEntry(KEY_SCROLL_BAR_MINI_MAP, scrollBarMiniMap()); | ||
727 | 687 | | |||
728 | config.writeEntry(KEY_SCROLL_BAR_MINI_MAP_ALL, scrollBarMiniMapAll()); | 688 | config.writeEntry(KEY_SCROLL_BAR_MINI_MAP_ALL, scrollBarMiniMapAll()); | ||
729 | 689 | | |||
730 | config.writeEntry(KEY_SCROLL_BAR_MINI_MAP_WIDTH, scrollBarMiniMapWidth()); | 690 | config.writeEntry(KEY_SCROLL_BAR_MINI_MAP_WIDTH, scrollBarMiniMapWidth()); | ||
731 | 691 | | |||
732 | config.writeEntry(KEY_SHOW_SCROLLBARS, showScrollbars()); | 692 | config.writeEntry(KEY_SHOW_SCROLLBARS, showScrollbars()); | ||
733 | 693 | | |||
734 | config.writeEntry(KEY_ICON_BAR, iconBar()); | 694 | config.writeEntry(KEY_ICON_BAR, iconBar()); | ||
735 | 695 | | |||
736 | config.writeEntry(KEY_FOLDING_BAR, foldingBar()); | 696 | config.writeEntry(KEY_FOLDING_BAR, foldingBar()); | ||
737 | 697 | | |||
738 | config.writeEntry(KEY_FOLDING_PREVIEW, foldingPreview()); | 698 | config.writeEntry(KEY_FOLDING_PREVIEW, foldingPreview()); | ||
739 | 699 | | |||
740 | config.writeEntry(KEY_LINE_MODIFICATION, lineModification()); | 700 | config.writeEntry(KEY_LINE_MODIFICATION, lineModification()); | ||
741 | 701 | | |||
742 | config.writeEntry(KEY_BOOKMARK_SORT, bookmarkSort()); | 702 | config.writeEntry(KEY_BOOKMARK_SORT, bookmarkSort()); | ||
743 | 703 | | |||
744 | config.writeEntry(KEY_AUTO_CENTER_LINES, autoCenterLines()); | 704 | config.writeEntry(KEY_AUTO_CENTER_LINES, autoCenterLines()); | ||
745 | 705 | | |||
746 | config.writeEntry(KEY_SEARCH_REPLACE_FLAGS, int(searchFlags())); | | |||
747 | | ||||
748 | config.writeEntry(KEY_MAX_HISTORY_SIZE, m_maxHistorySize); | | |||
749 | | ||||
750 | config.writeEntry(KEY_DEFAULT_MARK_TYPE, defaultMarkType()); | 706 | config.writeEntry(KEY_DEFAULT_MARK_TYPE, defaultMarkType()); | ||
751 | 707 | | |||
752 | config.writeEntry(KEY_ALLOW_MARK_MENU, allowMarkMenu()); | 708 | config.writeEntry(KEY_ALLOW_MARK_MENU, allowMarkMenu()); | ||
753 | 709 | | |||
754 | config.writeEntry(KEY_PERSISTENT_SELECTION, persistentSelection()); | 710 | config.writeEntry(KEY_PERSISTENT_SELECTION, persistentSelection()); | ||
755 | 711 | | |||
756 | config.writeEntry(KEY_AUTOMATIC_COMPLETION_INVOCATION, automaticCompletionInvocation()); | 712 | config.writeEntry(KEY_AUTOMATIC_COMPLETION_INVOCATION, automaticCompletionInvocation()); | ||
757 | config.writeEntry(KEY_WORD_COMPLETION, wordCompletion()); | 713 | config.writeEntry(KEY_WORD_COMPLETION, wordCompletion()); | ||
758 | config.writeEntry(KEY_KEYWORD_COMPLETION, keywordCompletion()); | 714 | config.writeEntry(KEY_KEYWORD_COMPLETION, keywordCompletion()); | ||
759 | config.writeEntry(KEY_WORD_COMPLETION_MINIMAL_WORD_LENGTH, wordCompletionMinimalWordLength()); | 715 | config.writeEntry(KEY_WORD_COMPLETION_MINIMAL_WORD_LENGTH, wordCompletionMinimalWordLength()); | ||
760 | config.writeEntry(KEY_WORD_COMPLETION_REMOVE_TAIL, wordCompletionRemoveTail()); | 716 | config.writeEntry(KEY_WORD_COMPLETION_REMOVE_TAIL, wordCompletionRemoveTail()); | ||
761 | 717 | | |||
762 | config.writeEntry(KEY_SMART_COPY_CUT, smartCopyCut()); | 718 | config.writeEntry(KEY_SMART_COPY_CUT, smartCopyCut()); | ||
763 | config.writeEntry(KEY_MOUSE_PASTE_AT_CURSOR_POSITION, mousePasteAtCursorPosition()); | 719 | config.writeEntry(KEY_MOUSE_PASTE_AT_CURSOR_POSITION, mousePasteAtCursorPosition()); | ||
764 | config.writeEntry(KEY_SCROLL_PAST_END, scrollPastEnd()); | 720 | config.writeEntry(KEY_SCROLL_PAST_END, scrollPastEnd()); | ||
765 | config.writeEntry(KEY_FOLD_FIRST_LINE, foldFirstLine()); | 721 | config.writeEntry(KEY_FOLD_FIRST_LINE, foldFirstLine()); | ||
766 | 722 | | |||
767 | config.writeEntry(KEY_INPUT_MODE, static_cast<int>(inputMode())); | 723 | config.writeEntry(KEY_INPUT_MODE, static_cast<int>(inputMode())); | ||
768 | config.writeEntry(KEY_VI_INPUT_MODE_STEAL_KEYS, viInputModeStealKeys()); | 724 | config.writeEntry(KEY_VI_INPUT_MODE_STEAL_KEYS, viInputModeStealKeys()); | ||
769 | config.writeEntry(KEY_VI_RELATIVE_LINE_NUMBERS, viRelativeLineNumbers()); | 725 | config.writeEntry(KEY_VI_RELATIVE_LINE_NUMBERS, viRelativeLineNumbers()); | ||
770 | 726 | | |||
771 | config.writeEntry(KEY_SHOW_LINE_COUNT, showLineCount()); | 727 | config.writeEntry(KEY_SHOW_LINE_COUNT, showLineCount()); | ||
772 | config.writeEntry(KEY_SHOW_WORD_COUNT, showWordCount()); | | |||
773 | config.writeEntry(KEY_AUTO_BRACKETS, autoBrackets()); | 728 | config.writeEntry(KEY_AUTO_BRACKETS, autoBrackets()); | ||
774 | | ||||
775 | config.writeEntry(KEY_BACKSPACE_REMOVE_COMPOSED, backspaceRemoveComposed()); | | |||
776 | } | 729 | } | ||
777 | 730 | | |||
778 | void KateViewConfig::updateConfig() | 731 | void KateViewConfig::updateConfig() | ||
779 | { | 732 | { | ||
780 | if (m_view) { | 733 | if (m_view) { | ||
781 | m_view->updateConfig(); | 734 | m_view->updateConfig(); | ||
782 | return; | 735 | return; | ||
783 | } | 736 | } | ||
784 | 737 | | |||
785 | if (isGlobal()) { | 738 | if (isGlobal()) { | ||
786 | foreach (KTextEditor::ViewPrivate* view, KTextEditor::EditorPrivate::self()->views()) { | 739 | foreach (KTextEditor::ViewPrivate* view, KTextEditor::EditorPrivate::self()->views()) { | ||
787 | view->updateConfig(); | 740 | view->updateConfig(); | ||
788 | } | 741 | } | ||
789 | 742 | | |||
790 | // write config | 743 | // write config | ||
791 | KConfigGroup cg(KTextEditor::EditorPrivate::config(), "KTextEditor View"); | 744 | KConfigGroup cg(KTextEditor::EditorPrivate::config(), "KTextEditor View"); | ||
792 | writeConfig(cg); | 745 | writeConfig(cg); | ||
793 | KTextEditor::EditorPrivate::config()->sync(); | 746 | KTextEditor::EditorPrivate::config()->sync(); | ||
794 | } | 747 | } | ||
795 | } | 748 | } | ||
796 | 749 | | |||
797 | bool KateViewConfig::dynWordWrap() const | | |||
798 | { | | |||
799 | if (m_dynWordWrapSet || isGlobal()) { | | |||
800 | return m_dynWordWrap; | | |||
801 | } | | |||
802 | | ||||
803 | return s_global->dynWordWrap(); | | |||
804 | } | | |||
805 | | ||||
806 | void KateViewConfig::setDynWordWrap(bool wrap) | | |||
807 | { | | |||
808 | if (m_dynWordWrapSet && m_dynWordWrap == wrap) { | | |||
809 | return; | | |||
810 | } | | |||
811 | | ||||
812 | configStart(); | | |||
813 | | ||||
814 | m_dynWordWrapSet = true; | | |||
815 | m_dynWordWrap = wrap; | | |||
816 | | ||||
817 | configEnd(); | | |||
818 | } | | |||
819 | | ||||
820 | bool KateViewConfig::dynWrapAtStaticMarker() const | | |||
821 | { | | |||
822 | if (m_dynWrapAtStaticMarkerSet || isGlobal()) { | | |||
823 | return m_dynWrapAtStaticMarker; | | |||
824 | } | | |||
825 | | ||||
826 | return s_global->dynWrapAtStaticMarker(); | | |||
827 | } | | |||
828 | | ||||
829 | void KateViewConfig::setDynWrapAtStaticMarker(bool on) | | |||
830 | { | | |||
831 | if (m_dynWrapAtStaticMarkerSet && m_dynWrapAtStaticMarker == on) { | | |||
832 | return; | | |||
833 | } | | |||
834 | | ||||
835 | configStart(); | | |||
836 | | ||||
837 | m_dynWrapAtStaticMarkerSet = true; | | |||
838 | m_dynWrapAtStaticMarker = on; | | |||
839 | | ||||
840 | configEnd(); | | |||
841 | } | | |||
842 | | ||||
843 | int KateViewConfig::dynWordWrapIndicators() const | | |||
844 | { | | |||
845 | if (m_dynWordWrapIndicatorsSet || isGlobal()) { | | |||
846 | return m_dynWordWrapIndicators; | | |||
847 | } | | |||
848 | | ||||
849 | return s_global->dynWordWrapIndicators(); | | |||
850 | } | | |||
851 | | ||||
852 | void KateViewConfig::setDynWordWrapIndicators(int mode) | | |||
853 | { | | |||
854 | if (m_dynWordWrapIndicatorsSet && m_dynWordWrapIndicators == mode) { | | |||
855 | return; | | |||
856 | } | | |||
857 | | ||||
858 | configStart(); | | |||
859 | | ||||
860 | m_dynWordWrapIndicatorsSet = true; | | |||
861 | m_dynWordWrapIndicators = qBound(0, mode, 80); | | |||
862 | | ||||
863 | configEnd(); | | |||
864 | } | | |||
865 | | ||||
866 | int KateViewConfig::dynWordWrapAlignIndent() const | | |||
867 | { | | |||
868 | if (m_dynWordWrapAlignIndentSet || isGlobal()) { | | |||
869 | return m_dynWordWrapAlignIndent; | | |||
870 | } | | |||
871 | | ||||
872 | return s_global->dynWordWrapAlignIndent(); | | |||
873 | } | | |||
874 | | ||||
875 | void KateViewConfig::setDynWordWrapAlignIndent(int indent) | | |||
876 | { | | |||
877 | if (m_dynWordWrapAlignIndentSet && m_dynWordWrapAlignIndent == indent) { | | |||
878 | return; | | |||
879 | } | | |||
880 | | ||||
881 | configStart(); | | |||
882 | | ||||
883 | m_dynWordWrapAlignIndentSet = true; | | |||
884 | m_dynWordWrapAlignIndent = indent; | | |||
885 | | ||||
886 | configEnd(); | | |||
887 | } | | |||
888 | | ||||
889 | bool KateViewConfig::lineNumbers() const | | |||
890 | { | | |||
891 | if (m_lineNumbersSet || isGlobal()) { | | |||
892 | return m_lineNumbers; | | |||
893 | } | | |||
894 | | ||||
895 | return s_global->lineNumbers(); | | |||
896 | } | | |||
897 | | ||||
898 | void KateViewConfig::setLineNumbers(bool on) | | |||
899 | { | | |||
900 | if (m_lineNumbersSet && m_lineNumbers == on) { | | |||
901 | return; | | |||
902 | } | | |||
903 | | ||||
904 | configStart(); | | |||
905 | | ||||
906 | m_lineNumbersSet = true; | | |||
907 | m_lineNumbers = on; | | |||
908 | | ||||
909 | configEnd(); | | |||
910 | } | | |||
911 | | ||||
912 | bool KateViewConfig::scrollBarMarks() const | | |||
913 | { | | |||
914 | if (m_scrollBarMarksSet || isGlobal()) { | | |||
915 | return m_scrollBarMarks; | | |||
916 | } | | |||
917 | | ||||
918 | return s_global->scrollBarMarks(); | | |||
919 | } | | |||
920 | | ||||
921 | void KateViewConfig::setScrollBarMarks(bool on) | | |||
922 | { | | |||
923 | if (m_scrollBarMarksSet && m_scrollBarMarks == on) { | | |||
924 | return; | | |||
925 | } | | |||
926 | | ||||
927 | configStart(); | | |||
928 | | ||||
929 | m_scrollBarMarksSet = true; | | |||
930 | m_scrollBarMarks = on; | | |||
931 | | ||||
932 | configEnd(); | | |||
933 | } | | |||
934 | | ||||
935 | bool KateViewConfig::scrollBarPreview() const | | |||
936 | { | | |||
937 | if (m_scrollBarPreviewSet || isGlobal()) { | | |||
938 | return m_scrollBarPreview; | | |||
939 | } | | |||
940 | | ||||
941 | return s_global->scrollBarPreview(); | | |||
942 | } | | |||
943 | | ||||
944 | void KateViewConfig::setScrollBarPreview(bool on) | | |||
945 | { | | |||
946 | if (m_scrollBarPreviewSet && m_scrollBarPreview == on) { | | |||
947 | return; | | |||
948 | } | | |||
949 | | ||||
950 | configStart(); | | |||
951 | | ||||
952 | m_scrollBarPreviewSet = true; | | |||
953 | m_scrollBarPreview = on; | | |||
954 | | ||||
955 | configEnd(); | | |||
956 | } | | |||
957 | | ||||
958 | bool KateViewConfig::scrollBarMiniMap() const | 750 | bool KateViewConfig::scrollBarMiniMap() const | ||
959 | { | 751 | { | ||
960 | if (m_scrollBarMiniMapSet || isGlobal()) { | 752 | if (m_scrollBarMiniMapSet || isGlobal()) { | ||
961 | return m_scrollBarMiniMap; | 753 | return m_scrollBarMiniMap; | ||
962 | } | 754 | } | ||
963 | 755 | | |||
964 | return s_global->scrollBarMiniMap(); | 756 | return s_global->scrollBarMiniMap(); | ||
965 | } | 757 | } | ||
▲ Show 20 Lines • Show All 182 Lines • ▼ Show 20 Line(s) | 990 | { | |||
1207 | configStart(); | 999 | configStart(); | ||
1208 | 1000 | | |||
1209 | m_autoCenterLinesSet = true; | 1001 | m_autoCenterLinesSet = true; | ||
1210 | m_autoCenterLines = lines; | 1002 | m_autoCenterLines = lines; | ||
1211 | 1003 | | |||
1212 | configEnd(); | 1004 | configEnd(); | ||
1213 | } | 1005 | } | ||
1214 | 1006 | | |||
1215 | long KateViewConfig::searchFlags() const | | |||
1216 | { | | |||
1217 | if (m_searchFlagsSet || isGlobal()) { | | |||
1218 | return m_searchFlags; | | |||
1219 | } | | |||
1220 | | ||||
1221 | return s_global->searchFlags(); | | |||
1222 | } | | |||
1223 | | ||||
1224 | void KateViewConfig::setSearchFlags(long flags) | | |||
1225 | { | | |||
1226 | if (m_searchFlagsSet && m_searchFlags == flags) { | | |||
1227 | return; | | |||
1228 | } | | |||
1229 | | ||||
1230 | configStart(); | | |||
1231 | | ||||
1232 | m_searchFlagsSet = true; | | |||
1233 | m_searchFlags = flags; | | |||
1234 | | ||||
1235 | configEnd(); | | |||
1236 | } | | |||
1237 | | ||||
1238 | int KateViewConfig::maxHistorySize() const | | |||
1239 | { | | |||
1240 | return m_maxHistorySize; | | |||
1241 | } | | |||
1242 | | ||||
1243 | uint KateViewConfig::defaultMarkType() const | 1007 | uint KateViewConfig::defaultMarkType() const | ||
1244 | { | 1008 | { | ||
1245 | if (m_defaultMarkTypeSet || isGlobal()) { | 1009 | if (m_defaultMarkTypeSet || isGlobal()) { | ||
1246 | return m_defaultMarkType; | 1010 | return m_defaultMarkType; | ||
1247 | } | 1011 | } | ||
1248 | 1012 | | |||
1249 | return s_global->defaultMarkType(); | 1013 | return s_global->defaultMarkType(); | ||
1250 | } | 1014 | } | ||
▲ Show 20 Lines • Show All 182 Lines • ▼ Show 20 Line(s) | 1315 | { | |||
1556 | configStart(); | 1320 | configStart(); | ||
1557 | 1321 | | |||
1558 | m_foldFirstLineSet = true; | 1322 | m_foldFirstLineSet = true; | ||
1559 | m_foldFirstLine = on; | 1323 | m_foldFirstLine = on; | ||
1560 | 1324 | | |||
1561 | configEnd(); | 1325 | configEnd(); | ||
1562 | } | 1326 | } | ||
1563 | 1327 | | |||
1564 | bool KateViewConfig::showWordCount() const | | |||
1565 | { | | |||
1566 | if (m_showWordCountSet || isGlobal()) { | | |||
1567 | return m_showWordCount; | | |||
1568 | } | | |||
1569 | | ||||
1570 | return s_global->showWordCount(); | | |||
1571 | } | | |||
1572 | | ||||
1573 | void KateViewConfig::setShowWordCount(bool on) | | |||
1574 | { | | |||
1575 | if (m_showWordCountSet && m_showWordCount == on) { | | |||
1576 | return; | | |||
1577 | } | | |||
1578 | | ||||
1579 | configStart(); | | |||
1580 | m_showWordCountSet = true; | | |||
1581 | m_showWordCount = on; | | |||
1582 | configEnd(); | | |||
1583 | } | | |||
1584 | | ||||
1585 | bool KateViewConfig::showLineCount() const | 1328 | bool KateViewConfig::showLineCount() const | ||
1586 | { | 1329 | { | ||
1587 | if (m_showLineCountSet || isGlobal()) { | 1330 | if (m_showLineCountSet || isGlobal()) { | ||
1588 | return m_showLineCount; | 1331 | return m_showLineCount; | ||
1589 | } | 1332 | } | ||
1590 | 1333 | | |||
1591 | return s_global->showLineCount(); | 1334 | return s_global->showLineCount(); | ||
1592 | } | 1335 | } | ||
1593 | 1336 | | |||
1594 | void KateViewConfig::setShowLineCount(bool on) | 1337 | void KateViewConfig::setShowLineCount(bool on) | ||
1595 | { | 1338 | { | ||
1596 | if (m_showLineCountSet && m_showLineCount == on) { | 1339 | if (m_showLineCountSet && m_showLineCount == on) { | ||
1597 | return; | 1340 | return; | ||
1598 | } | 1341 | } | ||
1599 | 1342 | | |||
1600 | configStart(); | 1343 | configStart(); | ||
1601 | m_showLineCountSet = true; | 1344 | m_showLineCountSet = true; | ||
1602 | m_showLineCount = on; | 1345 | m_showLineCount = on; | ||
1603 | configEnd(); | 1346 | configEnd(); | ||
1604 | } | 1347 | } | ||
1605 | 1348 | | |||
1606 | bool KateViewConfig::backspaceRemoveComposed() const | | |||
1607 | { | | |||
1608 | if (m_backspaceRemoveComposedSet || isGlobal()) { | | |||
1609 | return m_backspaceRemoveComposed; | | |||
1610 | } | | |||
1611 | | ||||
1612 | return s_global->backspaceRemoveComposed(); | | |||
1613 | } | | |||
1614 | | ||||
1615 | void KateViewConfig::setBackspaceRemoveComposed(bool on) | | |||
1616 | { | | |||
1617 | if (m_backspaceRemoveComposedSet && m_backspaceRemoveComposed == on) { | | |||
1618 | return; | | |||
1619 | } | | |||
1620 | | ||||
1621 | configStart(); | | |||
1622 | | ||||
1623 | m_backspaceRemoveComposedSet = true; | | |||
1624 | m_backspaceRemoveComposed = on; | | |||
1625 | | ||||
1626 | configEnd(); | | |||
1627 | } | | |||
1628 | | ||||
1629 | //END | 1349 | //END | ||
1630 | 1350 | | |||
1631 | //BEGIN KateRendererConfig | 1351 | //BEGIN KateRendererConfig | ||
1632 | KateRendererConfig::KateRendererConfig() | 1352 | KateRendererConfig::KateRendererConfig() | ||
1633 | : m_fontMetrics(QFont()), | 1353 | : m_fontMetrics(QFont()), | ||
1634 | m_lineMarkerColor(KTextEditor::MarkInterface::reservedMarkersCount()), | 1354 | m_lineMarkerColor(KTextEditor::MarkInterface::reservedMarkersCount()), | ||
1635 | 1355 | | |||
1636 | m_schemaSet(false), | 1356 | m_schemaSet(false), | ||
▲ Show 20 Lines • Show All 91 Lines • Show Last 20 Lines |