Explorar el Código

Merge branch 'develop_dev' into develop

* develop_dev:
  【主页】最近列表无数据状态判断
  【注释】点击页面上已添加的便签注释,点击便签面板的删除按钮无效修复
  【注释】双击注释不弹出附注
  【BOTA】注释列表 筛选clean仍然显示选中状态修复
  【文字图片编辑】添加通知,刷新注释缩图(图片)。 图片点击添加位置优化
  【文字图片编辑】注释缩图列表联动
  【注释】文本注释,选择预设字体,修改属性,显示 * 号,点击Redefine之后,* 号未消失
  【工具栏】特殊操作导致选中注释,属性面板为空
  【文字图片编辑】添加文字时不用关闭右侧侧边栏
  【文字图片编辑】选中文本框-右键,顺序应该是复制功能再是剪切功能

Conflicts:
	PDF Office/PDF Master/Class/Home/ViewController/KMHomeHistoryFileViewController.swift
wanjun hace 1 año
padre
commit
77603c208b

+ 2 - 2
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListView.m

@@ -811,7 +811,7 @@ NSNotificationName const CPDFListViewAnnotationsAttributeHasChangeNotification =
 
 - (void)removeAnnotation:(CPDFAnnotation *)annotation {
     if ([annotation isKindOfClass:[CPDFTextAnnotation class]] && self.popOver.isShown) {
-        if (annotation.contents.length <= 0) {
+//        if (annotation.contents.length <= 0) {
             CPDFAnnotation *wasAnnotation = annotation;
             CPDFPage *page = wasAnnotation.page;
             
@@ -828,7 +828,7 @@ NSNotificationName const CPDFListViewAnnotationsAttributeHasChangeNotification =
             
             if([self.pdfListViewDelegate respondsToSelector:@selector(PDFListViewRemoveAnnotations:forRemoveAnnotations:inPage:)])
                 [self.pdfListViewDelegate PDFListViewRemoveAnnotations:self forRemoveAnnotations:@[annotation] inPage:page];
-        }
+//        }
     } else {
         CPDFAnnotation *wasAnnotation = annotation;
         CPDFPage *page = wasAnnotation.page;

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/KMScreenViewController/ScreenCollectionView/View/KMAnnotationScreenColorViewItem.swift

@@ -57,7 +57,7 @@ extension KMAnnotationScreenColorViewItem {
         if (select) {
             colorButton?.state = .Sel;
         } else {
-            colorButton?.state = .None;
+            colorButton?.state = .Norm;
         }
     }
 }

+ 13 - 0
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Thumbnail/KMThumbnailViewController.swift

@@ -88,6 +88,8 @@ class KMThumbnailViewController: NSViewController {
     }
     
     func initNotification() {
+        NotificationCenter.default.addObserver(self, selector: #selector(PDFViewEditingAreaDidChangedNotification), name: NSNotification.Name.init(rawValue: "kPDFViewEditingAreaDidChanged"), object: nil)
+        
         NotificationCenter.default.addObserver(self, selector: #selector(KMPDFViewPageCountChangedNotification), name: NSNotification.Name.init(rawValue: "KMPDFViewRotatePage"), object: nil)
         
         NotificationCenter.default.addObserver(self, selector: #selector(KMPDFViewCurrentPageDidChangedNotification), name: NSNotification.Name.init(rawValue: "KMPDFViewCurrentPageDidChanged"), object: nil)
@@ -231,6 +233,17 @@ class KMThumbnailViewController: NSViewController {
         }
     }
     
+    @objc func PDFViewEditingAreaDidChangedNotification(notification: NSNotification) {
+        if notification.object is CPDFDocument {
+            let pdfdocument : CPDFDocument = notification.object as! CPDFDocument
+            if pdfdocument.isEqual(self.listView.document) {
+                var indexs: IndexSet = IndexSet()
+                indexs.insert(IndexSet.Element(self.listView.currentPageIndex))
+                self.reloadDataAtIndexs(indexs: indexs)
+            }
+        }
+    }
+    
     func pdfCurrentPageChange () {
         if self.listView.document.pageCount == 0 {
             return

+ 8 - 0
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMGeneralAnnotationViewController.m

@@ -2233,6 +2233,10 @@
     NSString *type = [KMEditPDFTextFontTypeWrapper allValues][index];
     [KMEditPDFTextManager.manager resetTextPresuppositionWithType:type];
     [self updateTextPresupposition:type needChangeListView:YES];
+    
+    //刷新样式
+    [self.textPresuppositionVC addItemsWithObjectValues:[KMEditPDFTextManager.manager updateTextPresuppositionFontNameArray]];
+    [self.textPresuppositionVC selectItemAt:index];
 }
 
 - (void)reDefineTextPresuppositionData:(BOOL)redefine {
@@ -2246,6 +2250,10 @@
     [KMEditPDFTextManager.manager reDefineTextPresuppositionWithFontName:fontName fontSize:fontSize type:type];
     
     [self updateTextPresupposition:type needChangeListView:YES];
+    
+    //刷新样式
+    [self.textPresuppositionVC addItemsWithObjectValues:[KMEditPDFTextManager.manager updateTextPresuppositionFontNameArray]];
+    [self.textPresuppositionVC selectItemAt:index];
 }
 
 - (void)updateFontNameAndStyle:(NSString *)name style:(NSString *)style needChangeListView:(BOOL)needChangeListView needSave:(BOOL)needSave {

+ 2 - 0
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift

@@ -2147,6 +2147,8 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
             }
         } else if type == .editPDF {
             self.listView.annotationType = .editTextImage
+        } else if type == .Annatiton {
+            self.rightSideViewController.subViewType = .AnnotationProperts
         }
     }
     

+ 24 - 4
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift

@@ -1328,7 +1328,9 @@ import Cocoa
                     if self.listView.isEditImage {
                         self.menuItemEditingClick_CropImage(sender: NSMenuItem())
                     } else {
-                        self.closeRightPane()
+                        if self.listView.annotationType == .addImage {
+                            self.closeRightPane()
+                        }
 //                        if self.rightSideViewController.eidtPDFImageProperty != nil {
 //                            self.rightSideViewController.eidtPDFImageProperty.reloadData()
 //                        }
@@ -1344,6 +1346,9 @@ import Cocoa
                     self.rightSideViewController.eidtPDFTextProperty.initData()
                 }
             }
+            if self.listView.annotationType != .addText {
+                NotificationCenter.default.post(name: NSNotification.Name(rawValue: "kPDFViewEditingAreaDidChanged"), object: self.listView.document)
+            }
             return
         }
         
@@ -1407,6 +1412,10 @@ import Cocoa
         
         if self.listView.isEdited() {
             self._isPDFDocumentEdited = true
+            
+            if self.listView.annotationType != .addText {
+                NotificationCenter.default.post(name: NSNotification.Name(rawValue: "kPDFViewEditingAreaDidChanged"), object: self.listView.document)
+            }
         }
     }
     
@@ -1435,7 +1444,7 @@ import Cocoa
                         var previewSize = rect.size
                         var isChangeSize = false
                         if previewSize.width == 0 && previewSize.height == 0 {
-                            previewSize = CGSize(width: 500, height: 500)
+                            previewSize = CGSize(width: 400, height: 400)
                             isChangeSize = true
                         }
                         
@@ -1470,9 +1479,11 @@ import Cocoa
                                                height: imageRect.height * pageScale)
                         }
                         
-                        if imageRect.origin.x < 0 ||
-                            imageRect.origin.y < 0 {
+                        if imageRect.origin.x < 0 {
                             imageRect.origin.x = 5
+                        }
+                        
+                        if imageRect.origin.y < 0 {
                             imageRect.origin.y = 5
                         }
                         
@@ -1489,6 +1500,9 @@ import Cocoa
                         DispatchQueue.main.async {
                             self.listView.createImagePath(filePath, rect: imageRect, page: pdfView.currentPage())
                             self.isPDFTextImageEdited = true
+                            self.asyncSaveDocument { params in
+                                
+                            }
                         }
                     }
                 }
@@ -1531,6 +1545,10 @@ import Cocoa
         if self.rightSideViewController != nil && self.rightSideViewController.subViewType == .EditPDFAddText && self.listView.annotationType == .addText {
             self.rightSideViewController.eidtPDFTextProperty.refreshSelectAreaProperty(needDefaultData: true)
         }
+        
+        self.asyncSaveDocument { params in
+            
+        }
     }
     
     func pdfListViewKeyDownIsContinue(_ pdfListView: CPDFListView!, theEvent: NSEvent!) -> Bool {
@@ -1733,6 +1751,8 @@ import Cocoa
                     tMenuItems?.append(self.replaceImageArea())
                     tMenuItems?.append(self.exportImageArea())
                 }
+            } else {
+                tMenuItems?.swapAt(0, 1)
             }
         } else if areas.count == 0 {
             tMenuItems?.append(NSMenuItem.separator())