Browse Source

【注释】表格注释代码调整

wanjun 10 months ago
parent
commit
5933410145

+ 106 - 127
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/Table/KMTableAnnotation.swift

@@ -48,11 +48,12 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
         textView!.delegate = nil
     }
     
-    func displayRect(forBounds bounds: NSRect, lineWidth: CGFloat) -> NSRect {
-        return bounds.insetBy(dx: -32, dy: -32)
+    override func displayRectForBounds(_ bounds: NSRect, lineWidth: CGFloat) -> NSRect {
+        let insetBounds = bounds.insetBy(dx: -32, dy: -32)
+        return insetBounds
     }
     
-    func resizeHandle(for point: NSPoint, scaleFactor: CGFloat) -> KMRectEdges {
+    override func resizeHandleForPoint(_ point: NSPoint, scaleFactor: CGFloat) -> CRectEdges {
         let dx = bounds.origin.x
         let dy = bounds.origin.y
         let dw = bounds.size.width
@@ -77,73 +78,65 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
                                height: 16.0 + 2 * offset)
         
         if leftDown.contains(point) {
-            return [KMRectEdges.minXEdgeMask, KMRectEdges.minYEdgeMask]
+            return [CRectEdges.minXEdgeMask, CRectEdges.minYEdgeMask]
         } else if rightDown.contains(point) {
-            return [KMRectEdges.maxXEdgeMask, KMRectEdges.minYEdgeMask]
+            return [CRectEdges.maxXEdgeMask, CRectEdges.minYEdgeMask]
         } else if rightUp.contains(point) {
-            return [KMRectEdges.maxXEdgeMask, KMRectEdges.maxYEdgeMask]
+            return [CRectEdges.maxXEdgeMask, CRectEdges.maxYEdgeMask]
         } else if leftUp.contains(point) {
-            return [KMRectEdges.minXEdgeMask, KMRectEdges.maxYEdgeMask]
+            return [CRectEdges.minXEdgeMask, CRectEdges.maxYEdgeMask]
         } else {
-            return KMRectEdges.onEdgeMask
+            return CRectEdges(rawValue: 0)
         }
     }
 
     override func drawSelectionHighlightForView(_ pdfView: CPDFListView, inContext context: CGContext, isHover: Bool) {
-//        if context != nil {
+        if context != nil {
             NSGraphicsContext.current = NSGraphicsContext(cgContext: context, flipped: false)
-//        }
+        }
         
         let drawRect = self.drawRect
         let abounds = self.bounds
-        let pathRect = NSRectFromCGRect(CGRect(x: drawRect.origin.x + abounds.origin.x,
-                                               y: drawRect.origin.y + abounds.origin.y,
-                                               width: drawRect.size.width, height: drawRect.size.height))
-        
-        let path = NSBezierPath(rect: pathRect)
+        let path = NSBezierPath(rect: NSRect(x: drawRect.origin.x + abounds.origin.x,
+                                             y: drawRect.origin.y + abounds.origin.y,
+                                             width: drawRect.size.width, height: drawRect.size.height))
         NSColor(deviceRed: 0.0/255.0, green: 136.0/255.0, blue: 255.0/255.0, alpha: 1).set()
-        
         path.lineWidth = 2.0
         path.stroke()
-        self.draw()
+        draw()
     }
     
     func draw() {
         let images = ["table_ic_move", "table_ic_add_lie", "table_ic_add_hang", "table_ic_size"]
-        guard let context = NSGraphicsContext.current?.cgContext else {
-            return
-        }
         
-        for (index, imageName) in images.enumerated() {
-            guard let stampImage = NSImage(named: imageName) else {
-                continue
-            }
-            
-            var rect: NSRect
-            
-            switch index {
-            case 0:
-                rect = NSRect(x: bounds.origin.x - stampImage.size.width / 2.0,
-                              y: bounds.origin.y + bounds.size.height - 3,
-                              width: stampImage.size.width / 2.0, height: stampImage.size.height / 2.0)
-            case 1:
-                rect = NSRect(x: bounds.origin.x + bounds.size.width + 2,
-                              y: bounds.origin.y + bounds.size.height - stampImage.size.height / 2.0 + 3,
-                              width: stampImage.size.width / 2.0, height: stampImage.size.height / 2.0)
-            case 2:
-                rect = NSRect(x: bounds.origin.x - 3,
-                              y: bounds.origin.y - stampImage.size.height / 2.0 - 3,
-                              width: stampImage.size.width / 2.0, height: stampImage.size.height / 2.0)
-            case 3:
-                rect = NSRect(x: bounds.origin.x + bounds.size.width - stampImage.size.width / 4,
-                              y: bounds.origin.y - stampImage.size.height / 4.0,
-                              width: stampImage.size.width / 2.0, height: stampImage.size.height / 2.0)
-            default:
-                continue
-            }
-            
-            context.draw(stampImage.cgImage(forProposedRect: nil, context: nil, hints: nil)!,
-                         in: rect)
+        let image1 = NSImage(named: images[0])
+        var rect1 = CGRect(x: self.bounds.origin.x - image1!.size.width/2.0,
+                           y: self.bounds.origin.y + self.bounds.size.height - 3,
+                           width: image1!.size.width/2.0, height: image1!.size.height/2.0)
+        
+        let image2 = NSImage(named: images[1])
+        var rect2 = CGRect(x: self.bounds.origin.x + self.bounds.size.width + 2,
+                           y: self.bounds.origin.y + self.bounds.size.height - image2!.size.height/2.0 + 3,
+                           width: image2!.size.width/2.0, height: image2!.size.height/2.0)
+        
+        let image3 = NSImage(named: images[2])
+        var rect3 = CGRect(x: self.bounds.origin.x - 3,
+                           y: self.bounds.origin.y - image3!.size.height/2.0 - 3,
+                           width: image3!.size.width/2.0, height: image3!.size.height/2.0)
+        
+        let image4 = NSImage(named: images[3])
+        var rect4 = CGRect(x: self.bounds.origin.x + self.bounds.size.width - image4!.size.width/4,
+                           y: self.bounds.origin.y - image4!.size.height/4.0,
+                           width: image4!.size.width/2.0, height: image4!.size.height/2.0)
+        
+        let rects = [rect1, rect2, rect3, rect4]
+        
+        for i in 0..<images.count {
+            let cocoaContext = NSGraphicsContext.current
+            let context = cocoaContext?.cgContext
+            let stampImage = NSImage(named: images[i])
+            context?.draw((stampImage?.cgImage(forProposedRect: nil, context: nil, hints: nil))!,
+                          in: rects[i])
         }
     }
         
@@ -201,21 +194,17 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
     func getCellBounds(row: Int, column: Int) -> NSRect {
         let crossLines = self.crossLines
         let verticalLines = self.verticalLines
-
-        guard row < crossLines.count - 1, column < verticalLines.count - 1 else {
-            return NSZeroRect
-        }
-
         let crossRect1 = crossLines[crossLines.count - row - 1].bounds
         let crossRect2 = crossLines[crossLines.count - row - 2].bounds
+        guard column < verticalLines.count - 1 else {
+            return NSZeroRect
+        }
         let verticalRect1 = verticalLines[column].bounds
         let verticalRect2 = verticalLines[column + 1].bounds
-
         let rect = NSRectFromCGRect(CGRect(x: verticalRect1.origin.x,
-                                           y: crossRect2.origin.y,
-                                           width: verticalRect2.origin.x - verticalRect1.origin.x,
-                                           height: crossRect1.origin.y - crossRect2.origin.y))
-
+                                            y: crossRect2.origin.y,
+                                            width: verticalRect2.origin.x - verticalRect1.origin.x,
+                                            height: crossRect1.origin.y - crossRect2.origin.y))
         return rect
     }
 
@@ -445,7 +434,7 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
             self.verticalLines.append(path2)
         }
         
-//        self.border.lineWidth = 0.8
+        self.borderWidth = 0.8
         for _ in 0..<row {
             var rowArray = [KMTableCellData]()
             for _ in 0..<column {
@@ -513,7 +502,7 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
     }
     
     func completeEditCellText() {
-        if let scrollViewSuperview = self.scrollView?.superview {
+        if (self.scrollView?.superview) != nil {
             self.setCellString(self.textView!.string, row: self.currentCell.row, column: self.currentCell.column)
             let cellBounds = self.getCellBounds(row: self.currentCell.row, column: self.currentCell.column).size
             let cell: KMTableCellData = self.rowDataList[self.currentCell.row][self.currentCell.column]
@@ -524,7 +513,7 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
             let height = textview.frame.size.height
 
             if height > cellBounds.height {
-                self.moveCrossLineOfIndex(self.rowNumber - self.currentCell.row - 1, withDistance: cellBounds.height - height)
+                self.moveCrossLine(ofIndex: self.rowNumber - self.currentCell.row - 1, withDistance: cellBounds.height - height)
                 self.afreshDrawLine()
             }
 
@@ -537,7 +526,7 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
         let manager: KMTableDataManager = KMTableDataManager()
         let dic: [String: Any] = [
             kCellList: self.rowDataList,
-            kIsAlternating: self.isAlternateColor,
+            kIsAlternating: "\(isAlternateColor)",
             kAlternatingColor: self.alternatingColor as Any
         ]
         self.contents = manager.writeFormDataToString(data: dic)
@@ -571,8 +560,8 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
     
     func headerCount() -> Int {
         var headerCount = 0
-        for i in stride(from: self.rowNumber, through: 0, by: -1) {
-            let path = self.crossLines[i] as NSBezierPath
+        for i in (0...rowNumber).reversed() {
+            let path = crossLines[i]
             if path.lineJoinStyle == .round {
                 headerCount += 1
             } else {
@@ -583,20 +572,20 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
     }
 
     func sidebarCount() -> Int {
-        var sidebarCount = 0
-        for path in self.verticalLines {
+        var siderbarCount = 0
+        for path in verticalLines {
             if path.lineJoinStyle == .round {
-                sidebarCount += 1
+                siderbarCount += 1
             } else {
                 break
             }
         }
-        return sidebarCount
+        return siderbarCount
     }
 
     func footerCount() -> Int {
         var footerCount = 0
-        for path in self.crossLines {
+        for path in crossLines {
             if path.lineJoinStyle == .bevel {
                 footerCount += 1
             } else {
@@ -608,7 +597,7 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
     
     //MARK: Style
     
-    func clear() {
+    private func clear() {
         for path in self.verticalLines {
             if path.lineJoinStyle == .round {
                 path.lineJoinStyle = .miter
@@ -756,8 +745,13 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
     }
 
     //MARK: draw
-
+    
     override func draw(with box: CPDFDisplayBox, in context: CGContext!) {
+        self.draw(with: box, with: context)
+        super.draw(with: box, in: context)
+    }
+    
+    func draw(with box: CPDFDisplayBox, with context: CGContext!) {
         NSGraphicsContext.saveGraphicsState()
         if let context = context {
             NSGraphicsContext.current = NSGraphicsContext(cgContext: context, flipped: false)
@@ -775,14 +769,14 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
                         if i % 2 == 0 {
                             let bRect = rect.insetBy(dx: w, dy: w)
                             let path = NSBezierPath(rect: bRect)
-                            self.alternatingColor!.setFill()
+                            self.alternatingColor?.set()
                             path.fill()
                         }
                     } else {
                         if i % 2 != 0 {
                             let bRect = rect.insetBy(dx: w, dy: w)
                             let path = NSBezierPath(rect: bRect)
-                            self.alternatingColor!.setFill()
+                            self.alternatingColor?.set()
                             path.fill()
                         }
                     }
@@ -792,7 +786,7 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
                 let bRect = rect.insetBy(dx: w, dy: w)
                 let path = NSBezierPath(rect: bRect)
                 if let color = self.rowDataList[i][j].backgroundColor {
-                    color.setFill()
+                    color.set()
                     path.fill()
                 }
 
@@ -847,7 +841,7 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
     
     //MARK: insert/remove
     
-    func insertColumn(at index: Int) {
+    func insertColumn(atIndexBehind index: Int) {
         guard index >= 0, columnNumber > index else {
             return
         }
@@ -918,7 +912,7 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
         }
 
         if index != 0 {
-            self.insertColumn(at: index - 1)
+            self.insertColumn(atIndexBehind: index - 1)
         } else {
             if !self.verticalLines.isEmpty {
                 let rect1 = self.verticalLines[0].bounds
@@ -1025,7 +1019,7 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
         self.writeFormDataToContents()
     }
     
-    func insertRow(atIndex index: Int, behindLineJoinStyle lineJoinStyle: NSBezierPath.LineJoinStyle) {
+    func insertRow(atIndexBehind index: Int, withLineJoinStyle lineJoinStyle: NSBezierPath.LineJoinStyle) {
         if 0 <= index && self.rowNumber > index {
             let crossLines = self.crossLines
             let rect1 = crossLines[self.rowNumber - index].bounds
@@ -1037,7 +1031,7 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
             path1.line(to: NSPoint(x: rect2.origin.x + rect2.size.width, y: rect2.origin.y + height))
 
             if self.rowNumber - index - 2 < crossLines.count {
-                self.moveCrossLineOfIndex(self.rowNumber - index - 2, withDistance: height)
+                self.moveCrossLine(ofIndex: self.rowNumber - index - 2, withDistance: height)
             } else if index + 1 == self.rowNumber {
                 // 最后一行
                 for i in 0..<self.verticalLines.count {
@@ -1076,10 +1070,10 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
         self.writeFormDataToContents()
     }
     
-    func insertRow(at index: Int, beforeLineJoinStyle lineJoinStyle: NSBezierPath.LineJoinStyle) {
+    func insertRow(atIndexBefore index: Int, withLineJoinStyle lineJoinStyle: NSBezierPath.LineJoinStyle) {
         if 0 <= index && self.rowNumber > index {
             if index != 0 {
-                self.insertRow(atIndex: index-1, behindLineJoinStyle: lineJoinStyle)
+                self.insertRow(atIndexBehind: index-1, withLineJoinStyle: lineJoinStyle)
             } else {
                 let rect1 = self.crossLines[self.rowNumber].bounds
                 let rect2 = self.crossLines[self.rowNumber-1].bounds
@@ -1132,7 +1126,6 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
         }
         if 0 <= index && self.rowNumber > index {
             let crossLines = self.crossLines
-            
             if crossLines.isEmpty {
                 return
             }
@@ -1140,10 +1133,8 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
             let rect2 = crossLines[self.rowNumber - index].bounds
             let height = rect1.origin.y - rect2.origin.y
             let path: NSBezierPath = self.crossLines[self.rowNumber - index]
-
             if index > 0 {
                 var removeLine = [NSBezierPath]()
-
                 for i in (0...(self.rowNumber - index - 1)).reversed() {
                     let oldPath: NSBezierPath = crossLines[i]
                     let newPath: NSBezierPath = NSBezierPath()
@@ -1193,7 +1184,7 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
         self.writeFormDataToContents()
     }
     
-    func removeRowBehindLine(at index: Int) {
+    func removeRow(atIndexBehindLine index: Int) {
         if self.rowNumber == 1 {
             return
         }
@@ -1207,44 +1198,32 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
             if self.rowNumber > index + 1 {
                 var removeLine = [NSBezierPath]()
 
-                for i in (0...(self.rowNumber - index - 1)).reversed() {
+                for i in (rowNumber - index)...0 {
                     let oldPath: NSBezierPath = self.crossLines[i]
-                    let newPath = NSBezierPath()
-                    newPath.move(to: NSPoint(x: oldPath.bounds.origin.x, y: oldPath.bounds.origin.y + height))
-                    newPath.line(to: NSPoint(x: oldPath.bounds.origin.x + oldPath.bounds.size.width, y: oldPath.bounds.origin.y + height))
-                    newPath.lineJoinStyle = oldPath.lineJoinStyle
-
-                    self.removeBezierPath(oldPath)
-                    removeLine.append(newPath)
-                    self.crossLines[i] = newPath
-                }
-
-                for path in removeLine {
-                    addBezierPath(path)
+                    let aff = AffineTransform(translationByX: 0.0, byY: height)
+                    oldPath.transform(using: aff)
                 }
 
-                for i in 0..<self.verticalLines.count {
-                    let oldPath: NSBezierPath = self.verticalLines[i]
-                    let newPath = NSBezierPath()
-                    newPath.move(to: NSPoint(x: oldPath.bounds.origin.x, y: oldPath.bounds.origin.y + height))
-                    newPath.line(to: NSPoint(x: oldPath.bounds.origin.x, y: oldPath.bounds.origin.y + oldPath.bounds.size.height))
-                    newPath.lineJoinStyle = oldPath.lineJoinStyle
-
-                    self.removeBezierPath(oldPath)
-                    self.addBezierPath(newPath)
-                    self.verticalLines[i] = newPath
+                for i in 0..<verticalLines.count {
+                    let oldPath = verticalLines[i]
+                    let nPath = NSBezierPath()
+                    nPath.move(to: NSPoint(x: oldPath.bounds.origin.x, y: oldPath.bounds.origin.y + height))
+                    nPath.line(to: NSPoint(x: oldPath.bounds.origin.x, y: oldPath.bounds.origin.y + oldPath.bounds.size.height))
+                    nPath.lineJoinStyle = oldPath.lineJoinStyle
+                    removeBezierPath(oldPath)
+                    addBezierPath(nPath)
+                    verticalLines[i] = nPath
                 }
-            } else if index + 1 == self.rowNumber {
-                for i in 0..<self.verticalLines.count {
-                    let path: NSBezierPath = self.verticalLines[i]
+            } else if index + 1 == rowNumber {
+                for i in 0..<verticalLines.count {
+                    let path = verticalLines[i]
                     let newPath = NSBezierPath()
-                    newPath.move(to: NSPoint(x: path.bounds.origin.x, y: path.bounds.origin.y))
-                    newPath.line(to: NSPoint(x: path.bounds.origin.x, y: path.bounds.origin.y + path.bounds.size.height - height))
+                    newPath.move(to: NSPoint(x: path.bounds.origin.x, y: path.bounds.origin.y + height))
+                    newPath.line(to: NSPoint(x: path.bounds.origin.x, y: path.bounds.origin.y + path.bounds.size.height))
                     newPath.lineJoinStyle = path.lineJoinStyle
-
-                    self.removeBezierPath(path)
-                    self.addBezierPath(newPath)
-                    self.verticalLines[i] = newPath
+                    removeBezierPath(path)
+                    addBezierPath(newPath)
+                    verticalLines[i] = newPath
                 }
             }
 
@@ -1266,7 +1245,7 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
         
         for j in 0..<self.columnNumber {
             if self.getCellBounds(row: i, column: j).size.width < MinCellWidth {
-                self.moveVerticalLineOfIndex(j + 1, withDistance: MinCellWidth - self.getCellBounds(row: i, column: j).size.width)
+                self.moveVerticalLine(ofIndex: j + 1, withDistance: MinCellWidth - self.getCellBounds(row: i, column: j).size.width)
             }
             
             let w = self.getCellBounds(row: i, column: j).size.width
@@ -1285,11 +1264,11 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
         }
         
         if self.getCellBounds(row: i, column: 0).size.height < MinCellHeight {
-            self.moveCrossLineOfIndex(self.rowNumber - i - 1, withDistance: self.getCellBounds(row: i, column: 0).size.height - MinCellHeight)
+            self.moveCrossLine(ofIndex: self.rowNumber - i - 1, withDistance: self.getCellBounds(row: i, column: 0).size.height - MinCellHeight)
         }
         
         let y = self.getCellBounds(row: i, column: 0).size.height - h
-        self.moveCrossLineOfIndex(self.rowNumber - i - 0, withDistance: y)
+        self.moveCrossLine(ofIndex: self.rowNumber - i - 0, withDistance: y)
         
         self.oldRowHeights.removeAll()
         
@@ -1298,7 +1277,7 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
         }
     }
     
-    func moveLine(from aPoint: NSPoint, to bPoint: NSPoint) {
+    func moveLine(fromPoint aPoint: NSPoint, toPoint bPoint: NSPoint) {
         var path: NSBezierPath?
         path = self.verticalLine(with: aPoint)
         
@@ -1331,7 +1310,7 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
                     }
                 }
                 
-                self.moveVerticalLineOfIndex(index, withDistance: distance)
+                self.moveVerticalLine(ofIndex: index, withDistance: distance)
                 return
             }
             
@@ -1342,7 +1321,7 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
                     let distance = bPoint.y - aPoint.y
                     self.oldRowHeights.removeAll()
                     
-                    self.moveCrossLineOfIndex(index, withDistance: distance)
+                    self.moveCrossLine(ofIndex: index, withDistance: distance)
                     
                     for i in 0..<rowNumber {
                         self.oldRowHeights.append(NSNumber(value: Float(self.getCellBounds(row: i, column: 0).size.height)))
@@ -1353,7 +1332,7 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
         }
     }
     
-    func moveVerticalLineOfIndex(_ index: Int, withDistance distance: CGFloat) {
+    func moveVerticalLine(ofIndex index: Int, withDistance distance: CGFloat) {
         if 0 <= index && self.verticalLines.count > index && distance != 0 {
             let path: NSBezierPath = self.verticalLines[index]
             if 0 < index, index < self.verticalLines.count - 1 { // Move middle vertical line
@@ -1420,12 +1399,12 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
                     newIndex = self.columnNumber - 1
                 }
                 let y = self.getCellBounds(row: i, column: newIndex).size.height - h
-                self.moveCrossLineOfIndex(self.rowNumber - i - 1, withDistance: y)
+                self.moveCrossLine(ofIndex: self.rowNumber - i - 1, withDistance: y)
             }
         }
     }
     
-    func moveCrossLineOfIndex(_ index: Int, withDistance distance: CGFloat) {
+    func moveCrossLine(ofIndex index: Int, withDistance distance: CGFloat) {
         var newDistance = distance
         if 0 <= index && self.crossLines.count > index && newDistance != 0 {
             let path: NSBezierPath = self.crossLines[index]

+ 3 - 3
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationTableViewController.swift

@@ -391,9 +391,9 @@ class KMAnnotationTableViewController: NSViewController {
             let row = table?.currentCell.row
             let column = table?.currentCell.column
             if stepper == cellWidthStepper {
-                table?.moveVerticalLineOfIndex(column!+1, withDistance: self.cellWidthStepper.doubleValue - (table?.getCellBounds(row: row!, column: column!).size.width)!)
+                table?.moveVerticalLine(ofIndex: column!+1, withDistance: self.cellWidthStepper.doubleValue - (table?.getCellBounds(row: row!, column: column!).size.width)!)
             } else {
-                table?.moveCrossLineOfIndex(table!.rowNumber - row! - 1, withDistance: (table?.getCellBounds(row: row!, column: column!).size.height)! - self.cellHeightStepper.doubleValue)
+                table?.moveCrossLine(ofIndex: table!.rowNumber - row! - 1, withDistance: (table?.getCellBounds(row: row!, column: column!).size.height)! - self.cellHeightStepper.doubleValue)
                 table?.setOldRowHeights()
             }
             table?.afreshDrawLine()
@@ -587,7 +587,7 @@ class KMAnnotationTableViewController: NSViewController {
                 }
             } else if count < 0 {
                 for _ in count..<0 {
-                    table.removeRowBehindLine(at: table.rowNumber - 1)
+                    table.removeRow(atIndexBehindLine: table.rowNumber - 1)
                 }
             }
         default: