CutBox.app

Coverage Report

Created: 2024-03-12 03:40

.../Source/App/SearchAndPreview/ClipItems/ClipItemTableRowContainerView.swift
Line
Count
Source
1
//
2
//  ClipItemTableRowContainerView.swift
3
//  CutBox
4
//
5
//  Created by Jason Milkins on 31/3/18.
6
//  Copyright © 2018-2023 ocodo. All rights reserved.
7
//
8
9
import Cocoa
10
11
class ClipItemTableRowContainerView: ItemTableRowContainerView {
12
13
    var searchView: SearchAndPreviewView?
14
15
6
    override func mouseDown(with event: NSEvent) {
16
6
        let modifiers = event
17
6
            .modifierFlags
18
6
            .intersection(.deviceIndependentFlagsMask)
19
6
20
6
        if event.clickCount == 2
21
6
            && event.type == .leftMouseDown
22
6
            && modifiers.isEmpty {
23
1
            self.searchView?
24
1
                .events
25
1
                .onNext(.closeAndPasteSelected)
26
6
        }
27
6
28
6
        if (event.clickCount == 2 && modifiers == [.control]) ||
29
6
            (event.clickCount == 2 && modifiers == [.command]) {
30
2
            self.searchView?
31
2
                .events
32
2
                .onNext(.selectJavascriptFunction)
33
6
        }
34
6
35
6
        if event.clickCount == 1
36
6
            && event.type == .leftMouseDown
37
6
            && modifiers == [.option] {
38
1
            self.searchView?
39
1
                .events
40
1
                .onNext(.toggleFavorite)
41
6
        }
42
6
43
6
        super.mouseDown(with: event)
44
6
    }
45
}