|
@@ -88,7 +88,7 @@ extension KMMainViewController {
|
|
|
let submenu = NSMenu(title: "")
|
|
|
for i in 0 ... fontSizes.count - 1 {
|
|
|
let fontSize : String = fontSizes.object(at: i) as! String
|
|
|
- let item = NSMenuItem(title:fontSize as! String, action: #selector(menuItemEditingClick_FontSize), keyEquivalent: "")
|
|
|
+ let item = NSMenuItem(title:fontSize , action: #selector(menuItemEditingClick_FontSize), keyEquivalent: "")
|
|
|
item.target = self
|
|
|
item.tag = i
|
|
|
submenu.addItem(item)
|
|
@@ -104,7 +104,7 @@ extension KMMainViewController {
|
|
|
}
|
|
|
|
|
|
func corpImageMenuItem()->NSMenuItem {
|
|
|
- var corpImageItem = NSMenuItem(title: NSLocalizedString("Confirm Crop", comment: ""), action: #selector(menuItemEditingClick_CropImage), target: self)
|
|
|
+ let corpImageItem = NSMenuItem(title: NSLocalizedString("Confirm Crop", comment: ""), action: #selector(menuItemEditingClick_CropImage), target: self)
|
|
|
return corpImageItem
|
|
|
}
|
|
|
|
|
@@ -124,17 +124,17 @@ extension KMMainViewController {
|
|
|
}
|
|
|
|
|
|
func editAddBlanMenu(menu:NSMenu){
|
|
|
- menu.insertItem(withTitle: NSLocalizedString("Add Text", comment: ""), action: #selector(addImageText), target: self, at: 0)
|
|
|
- menu.insertItem(withTitle: NSLocalizedString("Add Image", comment: ""), action: #selector(addImageText), target: self, at: 1)
|
|
|
+ _ = menu.insertItem(withTitle: NSLocalizedString("Add Text", comment: ""), action: #selector(addImageText), target: self, at: 0)
|
|
|
+ _ = menu.insertItem(withTitle: NSLocalizedString("Add Image", comment: ""), action: #selector(addImageText), target: self, at: 1)
|
|
|
}
|
|
|
|
|
|
func addText() -> NSMenuItem {
|
|
|
- var addTextItem = NSMenuItem(title: NSLocalizedString("Add Text", comment: ""), action: #selector(addImageText), target: self, tag: 0)
|
|
|
+ let addTextItem = NSMenuItem(title: NSLocalizedString("Add Text", comment: ""), action: #selector(addImageText), target: self, tag: 0)
|
|
|
return addTextItem
|
|
|
}
|
|
|
|
|
|
func addImage() -> NSMenuItem {
|
|
|
- var addImageItem = NSMenuItem(title: NSLocalizedString("Add Image", comment: ""), action: #selector(addImageText), target: self, tag: 1)
|
|
|
+ let addImageItem = NSMenuItem(title: NSLocalizedString("Add Image", comment: ""), action: #selector(addImageText), target: self, tag: 1)
|
|
|
return addImageItem
|
|
|
}
|
|
|
|
|
@@ -151,27 +151,27 @@ extension KMMainViewController {
|
|
|
func exportImageStampItem()->NSMenuItem {
|
|
|
let exportItem = NSMenuItem(title: NSLocalizedString("Export", comment: ""), action: #selector(menuItemEditingClick_ExportImage), target: self)
|
|
|
let menu = NSMenu()
|
|
|
- menu.insertItem(withTitle: NSLocalizedString("PNG", comment: ""), action:#selector(exportStampImage), target: self, tag:0, at: 0)
|
|
|
- menu.insertItem(withTitle: NSLocalizedString("PDF", comment: ""), action:#selector(exportStampImage), target: self, tag:2, at: 1)
|
|
|
+ let item1 = menu.insertItem(withTitle: NSLocalizedString("PNG", comment: ""), action:#selector(exportStampImage), target: self, tag:0, at: 0)
|
|
|
+ let item2 = menu.insertItem(withTitle: NSLocalizedString("PDF", comment: ""), action:#selector(exportStampImage), target: self, tag:2, at: 1)
|
|
|
exportItem.submenu = menu
|
|
|
return exportItem
|
|
|
}
|
|
|
|
|
|
func exportMenu() -> NSMenu {
|
|
|
let menu = NSMenu()
|
|
|
- menu.insertItem(withTitle: NSLocalizedString("PNG", comment: ""), action:#selector(exportCorpImage), target: self, tag:0, at: 0)
|
|
|
- menu.insertItem(withTitle: NSLocalizedString("JPG", comment: ""), action:#selector(exportCorpImage), target: self, tag:1, at: 1)
|
|
|
- menu.insertItem(withTitle: NSLocalizedString("PDF", comment: ""), action:#selector(exportCorpImage), target: self, tag:2, at: 2)
|
|
|
+ let item1 = menu.insertItem(withTitle: NSLocalizedString("PNG", comment: ""), action:#selector(exportCorpImage), target: self, tag:0, at: 0)
|
|
|
+ let item2 = menu.insertItem(withTitle: NSLocalizedString("JPG", comment: ""), action:#selector(exportCorpImage), target: self, tag:1, at: 1)
|
|
|
+ let item3 = menu.insertItem(withTitle: NSLocalizedString("PDF", comment: ""), action:#selector(exportCorpImage), target: self, tag:2, at: 2)
|
|
|
|
|
|
return menu
|
|
|
}
|
|
|
|
|
|
func cropMenu() -> NSMenu {
|
|
|
let menu = NSMenu()
|
|
|
- menu.insertItem(withTitle: NSLocalizedString("Crop Current Page", comment: ""), action:#selector(cropCurrentPage), target: self, at: 0)
|
|
|
- menu.insertItem(withTitle: NSLocalizedString("Crop All Pages", comment: ""), action:#selector(cropAllPage), target: self, at: 1)
|
|
|
- menu.insertItem(withTitle: NSLocalizedString("Auto Crop – Separate", comment: ""), action:#selector(autoCropAll), target: self, at: 2)
|
|
|
- menu.insertItem(withTitle: NSLocalizedString("Auto Crop – Combined", comment: ""), action:#selector(autoCropAll), target: self, at: 2)
|
|
|
+ let item1 = menu.insertItem(withTitle: NSLocalizedString("Crop Current Page", comment: ""), action:#selector(cropCurrentPage), target: self, at: 0)
|
|
|
+ let item2 = menu.insertItem(withTitle: NSLocalizedString("Crop All Pages", comment: ""), action:#selector(cropAllPage), target: self, at: 1)
|
|
|
+ let item3 = menu.insertItem(withTitle: NSLocalizedString("Auto Crop – Separate", comment: ""), action:#selector(autoCropAll), target: self, at: 2)
|
|
|
+ let item4 = menu.insertItem(withTitle: NSLocalizedString("Auto Crop – Combined", comment: ""), action:#selector(autoCropAll), target: self, at: 2)
|
|
|
return menu
|
|
|
}
|
|
|
|
|
@@ -189,29 +189,29 @@ extension KMMainViewController {
|
|
|
let stypItem = NSMenuItem(title: NSLocalizedString("Annotation", comment: ""), action: nil, target: self)
|
|
|
let stypeMenu = NSMenu()
|
|
|
if listView.currentSelection != nil && listView.currentSelection.selectionType() == .text {
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Highlight", comment: ""), action: #selector(addAnnotationForStyleMenu), target: self, tag: 0)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Underline", comment: ""), action: #selector(addAnnotationForStyleMenu), target: self, tag: 1)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Strikethrough", comment: ""), action: #selector(addAnnotationForStyleMenu), target: self, tag: 2)
|
|
|
+ let item1 = stypeMenu.addItem(withTitle: NSLocalizedString("Highlight", comment: ""), action: #selector(addAnnotationForStyleMenu), target: self, tag: 0)
|
|
|
+ let item2 = stypeMenu.addItem(withTitle: NSLocalizedString("Underline", comment: ""), action: #selector(addAnnotationForStyleMenu), target: self, tag: 1)
|
|
|
+ let item3 = stypeMenu.addItem(withTitle: NSLocalizedString("Strikethrough", comment: ""), action: #selector(addAnnotationForStyleMenu), target: self, tag: 2)
|
|
|
stypeMenu.addItem(NSMenuItem.separator())
|
|
|
}
|
|
|
// stypeMenu.addItem(withTitle: NSLocalizedString("Freehand", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 0)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Text Box", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 1)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Anchored Note", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 2)
|
|
|
+ let item4 = stypeMenu.addItem(withTitle: NSLocalizedString("Text Box", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 1)
|
|
|
+ let item5 = stypeMenu.addItem(withTitle: NSLocalizedString("Anchored Note", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 2)
|
|
|
// stypeMenu.insertItem(NSMenuItem.separator(), at: 10000)
|
|
|
stypeMenu.addItem(NSMenuItem.separator())
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Rectangle", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 3)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Circle", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 4)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Arrow", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 5)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Line", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 6)
|
|
|
+ let item6 = stypeMenu.addItem(withTitle: NSLocalizedString("Rectangle", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 3)
|
|
|
+ let item7 = stypeMenu.addItem(withTitle: NSLocalizedString("Circle", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 4)
|
|
|
+ let item8 = stypeMenu.addItem(withTitle: NSLocalizedString("Arrow", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 5)
|
|
|
+ let item9 = stypeMenu.addItem(withTitle: NSLocalizedString("Line", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 6)
|
|
|
// stypeMenu.insertItem(NSMenuItem.separator(), at: 10000)
|
|
|
if self.isReadMode {
|
|
|
|
|
|
} else {
|
|
|
stypeMenu.addItem(NSMenuItem.separator())
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Link", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 7)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Stamp", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 8)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Image", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 10)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Signature", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 9)
|
|
|
+ let item10 = stypeMenu.addItem(withTitle: NSLocalizedString("Link", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 7)
|
|
|
+ let item11 = stypeMenu.addItem(withTitle: NSLocalizedString("Stamp", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 8)
|
|
|
+ let item12 = stypeMenu.addItem(withTitle: NSLocalizedString("Image", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 10)
|
|
|
+ let item13 = stypeMenu.addItem(withTitle: NSLocalizedString("Signature", comment: ""), action: #selector(menuItemAnnotationClick_addStype), target: self, tag: 9)
|
|
|
}
|
|
|
stypItem.submenu = stypeMenu
|
|
|
if self.listView.annotationType == .ink {
|
|
@@ -241,23 +241,23 @@ extension KMMainViewController {
|
|
|
func setAnnotationToolStype() -> NSMenuItem {
|
|
|
let stypItem = NSMenuItem(title: NSLocalizedString("Tool Mode", comment: ""), action: nil, target: self)
|
|
|
let stypeMenu = NSMenu()
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Text", comment: ""), action: #selector(menuItemAnnotationClick_toolModel), target: self, tag: 0)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Scroll", comment: ""), action: #selector(menuItemAnnotationClick_toolModel), target: self, tag: 1)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Magnify", comment: ""), action: #selector(menuItemAnnotationClick_toolModel), target: self, tag: 2)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Select", comment: ""), action: #selector(menuItemAnnotationClick_toolModel), target: self, tag: 3)
|
|
|
+ let item1 = stypeMenu.addItem(withTitle: NSLocalizedString("Text", comment: ""), action: #selector(menuItemAnnotationClick_toolModel), target: self, tag: 0)
|
|
|
+ let item2 = stypeMenu.addItem(withTitle: NSLocalizedString("Scroll", comment: ""), action: #selector(menuItemAnnotationClick_toolModel), target: self, tag: 1)
|
|
|
+ let item3 = stypeMenu.addItem(withTitle: NSLocalizedString("Magnify", comment: ""), action: #selector(menuItemAnnotationClick_toolModel), target: self, tag: 2)
|
|
|
+ let item4 = stypeMenu.addItem(withTitle: NSLocalizedString("Select", comment: ""), action: #selector(menuItemAnnotationClick_toolModel), target: self, tag: 3)
|
|
|
// stypeMenu.addItem(withTitle: NSLocalizedString("Zoom to Selected Area", comment: ""), action: #selector(menuItemAnnotationClick_toolModel), target: self, tag: 4)
|
|
|
stypeMenu.insertItem(NSMenuItem.separator(), at: 4)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Highlight", comment: ""), action: #selector(changeAnnotationMode), target: self, tag: 5)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Underline", comment: ""), action: #selector(changeAnnotationMode), target: self, tag: 6)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Strikethrough", comment: ""), action: #selector(changeAnnotationMode), target: self, tag: 7)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Freehand", comment: ""), action: #selector(changeAnnotationMode), target: self, tag: 8)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Text Note", comment: ""), action: #selector(changeAnnotationMode), target: self, tag: 9)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Anchored Note", comment: ""), action: #selector(changeAnnotationMode), target: self, tag: 10)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Rectangle", comment: ""), action: #selector(changeAnnotationMode), target: self, tag: 11)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Circle", comment: ""), action: #selector(changeAnnotationMode), target: self, tag: 12)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Arrow", comment: ""), action: #selector(changeAnnotationMode), target: self, tag: 13)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Line", comment: ""), action: #selector(changeAnnotationMode), target: self, tag: 14)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Link", comment: ""), action: #selector(changeAnnotationMode), target: self, tag: 15)
|
|
|
+ let item5 = stypeMenu.addItem(withTitle: NSLocalizedString("Highlight", comment: ""), action: #selector(changeAnnotationMode), target: self, tag: 5)
|
|
|
+ let item6 = stypeMenu.addItem(withTitle: NSLocalizedString("Underline", comment: ""), action: #selector(changeAnnotationMode), target: self, tag: 6)
|
|
|
+ let item7 = stypeMenu.addItem(withTitle: NSLocalizedString("Strikethrough", comment: ""), action: #selector(changeAnnotationMode), target: self, tag: 7)
|
|
|
+ let item8 = stypeMenu.addItem(withTitle: NSLocalizedString("Freehand", comment: ""), action: #selector(changeAnnotationMode), target: self, tag: 8)
|
|
|
+ let item9 = stypeMenu.addItem(withTitle: NSLocalizedString("Text Note", comment: ""), action: #selector(changeAnnotationMode), target: self, tag: 9)
|
|
|
+ let item10 = stypeMenu.addItem(withTitle: NSLocalizedString("Anchored Note", comment: ""), action: #selector(changeAnnotationMode), target: self, tag: 10)
|
|
|
+ let item11 = stypeMenu.addItem(withTitle: NSLocalizedString("Rectangle", comment: ""), action: #selector(changeAnnotationMode), target: self, tag: 11)
|
|
|
+ let item12 = stypeMenu.addItem(withTitle: NSLocalizedString("Circle", comment: ""), action: #selector(changeAnnotationMode), target: self, tag: 12)
|
|
|
+ let item13 = stypeMenu.addItem(withTitle: NSLocalizedString("Arrow", comment: ""), action: #selector(changeAnnotationMode), target: self, tag: 13)
|
|
|
+ let item14 = stypeMenu.addItem(withTitle: NSLocalizedString("Line", comment: ""), action: #selector(changeAnnotationMode), target: self, tag: 14)
|
|
|
+ let item15 = stypeMenu.addItem(withTitle: NSLocalizedString("Link", comment: ""), action: #selector(changeAnnotationMode), target: self, tag: 15)
|
|
|
|
|
|
stypItem.submenu = stypeMenu
|
|
|
if self.toolbarController.toolbarType == .Annatiton {
|
|
@@ -341,8 +341,8 @@ extension KMMainViewController {
|
|
|
func setRotateStype() -> NSMenuItem {
|
|
|
let stypItem = NSMenuItem(title: NSLocalizedString("Rotate", comment: ""), action: nil, target: self)
|
|
|
let stypeMenu = NSMenu()
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Rotate Left", comment: ""), action: #selector(rotateLeftAction), target: self, tag: 0)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Rotate Right", comment: ""), action: #selector(rotateRightAction), target: self, tag: 1)
|
|
|
+ let item1 = stypeMenu.addItem(withTitle: NSLocalizedString("Rotate Left", comment: ""), action: #selector(rotateLeftAction), target: self, tag: 0)
|
|
|
+ let item2 = stypeMenu.addItem(withTitle: NSLocalizedString("Rotate Right", comment: ""), action: #selector(rotateRightAction), target: self, tag: 1)
|
|
|
stypItem.submenu = stypeMenu
|
|
|
if self.toolbarController.toolbarType == .Annatiton {
|
|
|
stypeMenu.item(at: 0)?.state = .on
|
|
@@ -385,8 +385,8 @@ extension KMMainViewController {
|
|
|
func setSnapshotStype() -> NSMenuItem {
|
|
|
let stypItem = NSMenuItem(title: NSLocalizedString("Snapshot", comment: ""), action: nil, target: self)
|
|
|
let stypeMenu = NSMenu()
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Auto", comment: ""), action: #selector(takeSnapshot), target: self, tag: 0)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Select Area", comment: ""), action: #selector(takeSnapshotSelectContent), target: self, tag: 1)
|
|
|
+ let item1 = stypeMenu.addItem(withTitle: NSLocalizedString("Auto", comment: ""), action: #selector(takeSnapshot), target: self, tag: 0)
|
|
|
+ let item2 = stypeMenu.addItem(withTitle: NSLocalizedString("Select Area", comment: ""), action: #selector(takeSnapshotSelectContent), target: self, tag: 1)
|
|
|
stypItem.submenu = stypeMenu
|
|
|
// if self.toolbarController.toolbarType == .Annatiton {
|
|
|
// stypeMenu.item(at: 0)?.state = .on
|
|
@@ -399,13 +399,13 @@ extension KMMainViewController {
|
|
|
func setServicesStype() -> NSMenuItem {
|
|
|
let stypItem = NSMenuItem(title: NSLocalizedString("Services", comment: ""), action: nil, target: self)
|
|
|
let stypeMenu = NSMenu()
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Add to Music as a Spoken Track", comment: ""), action: #selector(AddtoMusicasASpokenTrack), target: self, tag: 0)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Convert Text to Simplified Chinese", comment: ""), action: #selector(ConvertTextToSimplifiedChinese), target: self, tag: 1)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Convert Text to Traditional Chinese", comment: ""), action: #selector(ConvertTextToTraditionalChinese), target: self, tag: 2)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Open", comment: ""), action: #selector(OpenItemAction), target: self, tag: 3)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Search With Baidu", comment: ""), action: #selector(searchBaiduAction), target: self, tag: 4)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Show in Finder", comment: ""), action: #selector(showInFinder), target: self, tag: 4)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Show Info in Finder", comment: ""), action: #selector(showInfoInFinder), target: self, tag: 5)
|
|
|
+ let item1 = stypeMenu.addItem(withTitle: NSLocalizedString("Add to Music as a Spoken Track", comment: ""), action: #selector(AddtoMusicasASpokenTrack), target: self, tag: 0)
|
|
|
+ let item2 = stypeMenu.addItem(withTitle: NSLocalizedString("Convert Text to Simplified Chinese", comment: ""), action: #selector(ConvertTextToSimplifiedChinese), target: self, tag: 1)
|
|
|
+ let item3 = stypeMenu.addItem(withTitle: NSLocalizedString("Convert Text to Traditional Chinese", comment: ""), action: #selector(ConvertTextToTraditionalChinese), target: self, tag: 2)
|
|
|
+ let item4 = stypeMenu.addItem(withTitle: NSLocalizedString("Open", comment: ""), action: #selector(OpenItemAction), target: self, tag: 3)
|
|
|
+ let item5 = stypeMenu.addItem(withTitle: NSLocalizedString("Search With Baidu", comment: ""), action: #selector(searchBaiduAction), target: self, tag: 4)
|
|
|
+ let item6 = stypeMenu.addItem(withTitle: NSLocalizedString("Show in Finder", comment: ""), action: #selector(showInFinder), target: self, tag: 4)
|
|
|
+ let item7 = stypeMenu.addItem(withTitle: NSLocalizedString("Show Info in Finder", comment: ""), action: #selector(showInfoInFinder), target: self, tag: 5)
|
|
|
stypItem.submenu = stypeMenu
|
|
|
// if self.toolbarController.toolbarType == .Annatiton {
|
|
|
// stypeMenu.item(at: 0)?.state = .on
|
|
@@ -417,13 +417,13 @@ extension KMMainViewController {
|
|
|
func setCropStype() -> NSMenuItem {
|
|
|
let stypItem = NSMenuItem(title: NSLocalizedString("Crop", comment: ""), action: nil, target: self)
|
|
|
let stypeMenu = NSMenu()
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Crop All Pages", comment: ""), action: #selector(cropAllPageItem), target: self, tag: 0)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Crop Current Page", comment: ""), action: #selector(cropCurrentPageItem), target: self, tag: 1)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Auto Crop – Separate", comment: ""), action: #selector(autoCropAllItem), target: self, tag: 2)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Auto Crop – Combined", comment: ""), action: #selector(smartAutoCropAllItem), target: self, tag: 3)
|
|
|
+ let item1 = stypeMenu.addItem(withTitle: NSLocalizedString("Crop All Pages", comment: ""), action: #selector(cropAllPageItem), target: self, tag: 0)
|
|
|
+ let item2 = stypeMenu.addItem(withTitle: NSLocalizedString("Crop Current Page", comment: ""), action: #selector(cropCurrentPageItem), target: self, tag: 1)
|
|
|
+ let item3 = stypeMenu.addItem(withTitle: NSLocalizedString("Auto Crop – Separate", comment: ""), action: #selector(autoCropAllItem), target: self, tag: 2)
|
|
|
+ let item4 = stypeMenu.addItem(withTitle: NSLocalizedString("Auto Crop – Combined", comment: ""), action: #selector(smartAutoCropAllItem), target: self, tag: 3)
|
|
|
// if(NSIsEmptyRect(selectionRect)) {
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Select Area", comment: ""), action: #selector(selectToolModel), target: self, tag: 4)
|
|
|
- stypeMenu.addItem(withTitle: NSLocalizedString("Crop Options...", comment: ""), action: #selector(customCropModel), target: self, tag: 5)
|
|
|
+ let item5 = stypeMenu.addItem(withTitle: NSLocalizedString("Select Area", comment: ""), action: #selector(selectToolModel), target: self, tag: 4)
|
|
|
+ let item6 = stypeMenu.addItem(withTitle: NSLocalizedString("Crop Options...", comment: ""), action: #selector(customCropModel), target: self, tag: 5)
|
|
|
//
|
|
|
// }
|
|
|
|
|
@@ -448,7 +448,7 @@ extension KMMainViewController {
|
|
|
if highlightLink {
|
|
|
highlightLinkTitle = NSLocalizedString("Disable Highlight Links", comment: "")
|
|
|
}
|
|
|
- var highlightLinksItem = NSMenuItem(title: highlightLinkTitle, action: #selector(highlightLinks), target: self)
|
|
|
+ let highlightLinksItem = NSMenuItem(title: highlightLinkTitle, action: #selector(highlightLinks), target: self)
|
|
|
return highlightLinksItem
|
|
|
}
|
|
|
|
|
@@ -833,7 +833,7 @@ extension KMMainViewController {
|
|
|
}
|
|
|
|
|
|
@objc func aiTranslationAction(sender: NSMenuItem) {
|
|
|
- let content = self.listView.currentSelection.string() as? String ?? ""
|
|
|
+ let content = self.listView.currentSelection.string() ?? ""
|
|
|
let origin = self.listView.currentSelection.bounds.origin
|
|
|
|
|
|
self.aiTranslationWindow = KMAITranslationWindowController.init(windowNibName: "KMAITranslationWindowController")
|
|
@@ -862,7 +862,7 @@ extension KMMainViewController {
|
|
|
|
|
|
let currentPoint: NSPoint = self.listView.convert(point!, from: self.listView.superview)
|
|
|
let currentPage = self.listView.page(for: currentPoint, nearest: true)
|
|
|
- let pagePoint = self.listView.convert(currentPoint, to: currentPage)
|
|
|
+ var pagePoint = self.listView.convert(currentPoint, to: currentPage)
|
|
|
|
|
|
var annotation: CPDFAnnotation?
|
|
|
|
|
@@ -943,6 +943,11 @@ extension KMMainViewController {
|
|
|
case 1:
|
|
|
// self.listView.annotationType = CAnnotationType.freeText
|
|
|
let defaultSize = self.listView.defaultSize(with: .freeText, in: currentPage)
|
|
|
+ if (pagePoint.x - defaultSize.width > 0){
|
|
|
+ pagePoint.x -= defaultSize.width;
|
|
|
+ }else{
|
|
|
+ pagePoint.x = 0;
|
|
|
+ }
|
|
|
let bounds = CPDFListViewRectFromCenterAndSize(CPDFListViewIntegralPoint(pagePoint), defaultSize)
|
|
|
annotation = self.listView.addAnnotation(with: .freeText, selection: nil, page: currentPage, bounds: bounds)
|
|
|
// self.view.window?.makeFirstResponder()
|
|
@@ -959,6 +964,11 @@ extension KMMainViewController {
|
|
|
case 3:
|
|
|
// self.listView.annotationType = CAnnotationType.square
|
|
|
let defaultSize = self.listView.defaultSize(with: .square, in: currentPage)
|
|
|
+ if (pagePoint.x - defaultSize.width > 0){
|
|
|
+ pagePoint.x -= defaultSize.width;
|
|
|
+ }else{
|
|
|
+ pagePoint.x = 0;
|
|
|
+ }
|
|
|
let bounds = CPDFListViewRectFromCenterAndSize(CPDFListViewIntegralPoint(pagePoint), defaultSize)
|
|
|
annotation = self.listView.addAnnotation(with: .square, selection: nil, page: currentPage, bounds: bounds)
|
|
|
case 4:
|