|
From: <ho...@us...> - 2025-07-11 14:43:36
|
Revision: 15640
http://sourceforge.net/p/skim-app/code/15640
Author: hofman
Date: 2025-07-11 14:43:33 +0000 (Fri, 11 Jul 2025)
Log Message:
-----------
resize text note editor or end editing from pdfvieww
Modified Paths:
--------------
trunk/SKPDFView.m
trunk/SKTextNoteEditor.h
trunk/SKTextNoteEditor.m
Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m 2025-07-11 14:28:15 UTC (rev 15639)
+++ trunk/SKPDFView.m 2025-07-11 14:43:33 UTC (rev 15640)
@@ -413,7 +413,12 @@
- (void)layoutDocumentView {
[super layoutDocumentView];
[self resetPDFToolTipRects];
- [editor updateLayout];
+ if (editor) {
+ if ([self isPageAtIndexDisplayed:[currentAnnotation pageIndex]])
+ [editor updateFrame];
+ else
+ [self commitEditing];
+ }
}
#pragma mark Drawing
@@ -2790,19 +2795,18 @@
}
- (void)discardEditing {
- [editor discardEditing];
+ [editor endEditingWithCommit:NO];
}
- (BOOL)commitEditing {
- BOOL success = YES;
if (editor) {
NSUndoManager *undoManager = [self undoManager];
NSInteger level = [undoManager groupingLevel];
- success = [editor commitEditing];
+ [editor endEditingWithCommit:YES];
if ([undoManager groupingLevel] > level)
wantsNewUndoGroup = YES;
}
- return success;
+ return YES;
}
- (void)beginNewUndoGroupIfNeeded {
@@ -3143,10 +3147,14 @@
PDFAnnotation *annotation = [userInfo objectForKey:SKPDFDocumentAnnotationKey];
[self updatedAnnotation:annotation];
- if ([annotation isNote])
+ if ([annotation isNote]) {
[self resetPDFToolTipRects];
- if ([self isEditingAnnotation:annotation])
- [editor updateLayout];
+ } else if ([self isEditingAnnotation:annotation]) {
+ if ([self isPageAtIndexDisplayed:[annotation pageIndex]])
+ [editor updateFrame];
+ else
+ [self commitEditing];
+ }
}
- (void)registerForDocumentNotifications {
@@ -3184,7 +3192,7 @@
- (void)handleScaleChangedNotification:(NSNotification *)notification {
[self resetPDFToolTipRects];
[self updatePacer];
- [editor updateLayout];
+ [editor updateFrame];
}
- (void)handleUpdateTrackingAreasNotification:(NSNotification *)notification {
Modified: trunk/SKTextNoteEditor.h
===================================================================
--- trunk/SKTextNoteEditor.h 2025-07-11 14:28:15 UTC (rev 15639)
+++ trunk/SKTextNoteEditor.h 2025-07-11 14:43:33 UTC (rev 15640)
@@ -53,11 +53,9 @@
@property (nonatomic, nullable, weak, readonly) NSString *currentString;
- (void)startEditingWithEvent:(nullable NSEvent *)event;
-- (void)updateLayout;
+- (void)endEditingWithCommit:(BOOL)commit;
+- (void)updateFrame;
-- (void)discardEditing;
-- (BOOL)commitEditing;
-
@end
@interface PDFView (SKTextNoteEditor)
Modified: trunk/SKTextNoteEditor.m
===================================================================
--- trunk/SKTextNoteEditor.m 2025-07-11 14:28:15 UTC (rev 15639)
+++ trunk/SKTextNoteEditor.m 2025-07-11 14:43:33 UTC (rev 15640)
@@ -196,22 +196,6 @@
}
}
-- (void)updateLayout {
- if ([pdfView isPageAtIndexDisplayed:[annotation pageIndex]])
- [self updateFrame];
- else
- [self endEditingWithCommit:YES];
-}
-
-- (void)discardEditing {
- [self endEditingWithCommit:NO];
-}
-
-- (BOOL)commitEditing {
- [self endEditingWithCommit:YES];
- return YES;
-}
-
- (BOOL)textView:(NSTextView *)aTextView doCommandBySelector:(SEL)command {
if (command == @selector(insertTab:)) {
[self endEditingWithCommit:YES];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|