# CutBox.app

## Coverage Report

#### Created: 2024-03-12 03:40

    .../Source/App/Preferences/PreferencesTabView.swift

    Line

    Count

    Source (jump to first uncovered line)

    1

    //

    2

    //  PreferencesTabViewController.swift

    3

    //  CutBox

    4

    //

    5

    //  Created by Jason Milkins on 12/5/18.

    6

    //  Copyright © 2018-2023 ocodo. All rights reserved.

    7

    //

    8

    9

    import Cocoa

    10

    import Magnet

    11

    12

    class PreferencesTabView: CutBoxBaseTabView, NSTabViewDelegate {

    13

    14

    49

        private let generalTab: PreferencesGeneralView = PreferencesGeneralView.fromNib()!

    15

    49

        private let advancedTab: PreferencesAdvancedView = PreferencesAdvancedView.fromNib()!

    16

    49

        private let themeTab: PreferencesThemeSelectionView = PreferencesThemeSelectionView.fromNib()!

    17

    49

        private let javascriptTab: PreferencesPastePipelineView = PreferencesPastePipelineView.fromNib()!

    18

    19

    49

        override func awakeFromNib() {

    20

    49

    21

    49

            self.delegate = self

    22

    49

    23

    49

            typealias TabInfo = (String, CutBoxBaseView)

    24

    49

    25

    49

            let tabViews: [TabInfo] = [

    26

    49

              ("preferences_tab_view_general".l7n, generalTab),

    27

    49

              ("preferences_tab_view_display".l7n, themeTab),

    28

    49

              ("preferences_tab_view_advanced".l7n, advancedTab),

    29

    49

              ("preferences_tab_view_javascript".l7n, javascriptTab)

    30

    49

            ]

    31

    49

    32

    196

            tabViews.forEach {

    33

    196

                let (name, view) = $0

    34

    196

                let tabViewItem = CutBoxBaseTabViewItem()

    35

    196

                tabViewItem.label = name

    36

    196

                tabViewItem.identifier = name

    37

    196

                tabViewItem.view = view

    38

    196

    39

    196

                self.addTabViewItem(tabViewItem)

    40

    196

            }

    41

    49

        }

    42

    43

    49

        func tabView(_ tabView: NSTabView, didSelect tabViewItem: NSTabViewItem?) {

    44

    49

            if javascriptTab == tabViewItem?.view {

    45

    0

                javascriptTab.focusReplCommandLine()

    46

    49

            }

    47

    49

        }

    48

    }