Revision: 5550
          http://skim-app.svn.sourceforge.net/skim-app/?rev=5550&view=rev
Author:   hofman
Date:     2009-08-14 09:35:12 +0000 (Fri, 14 Aug 2009)

Log Message:
-----------
add some more security editing ends when a document or window is removed so no 
loose editors are registered

Modified Paths:
--------------
    trunk/SKMainWindowController_UI.m
    trunk/SKPDFView.m

Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m   2009-08-13 16:18:10 UTC (rev 5549)
+++ trunk/SKMainWindowController_UI.m   2009-08-14 09:35:12 UTC (rev 5550)
@@ -1084,6 +1084,16 @@
         [[self document] objectDidEndEditing:self];
 }
 
+- (void)setDocument:(NSDocument *)document {
+    if ([self document] && document == nil) {
+        if ([self commitEditing] == NO)
+            [self discardEditing];
+        if ([pdfView isEditing] && [pdfView commitEditing] == NO)
+            [pdfView discardEditing];
+    }
+    [super setDocument:document];
+}
+
 #pragma mark NSEditor protocol
 
 - (void)discardEditing {

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2009-08-13 16:18:10 UTC (rev 5549)
+++ trunk/SKPDFView.m   2009-08-14 09:35:12 UTC (rev 5550)
@@ -1698,6 +1698,8 @@
 - (void)viewWillMoveToWindow:(NSWindow *)newWindow {
     if ([self window] && trackingRect)
         [self removeTrackingRect:trackingRect];
+    if ([self isEditing] && [self commitEditing] == NO)
+        [self discardEditing];
 }
 
 - (void)viewDidMoveToWindow {
@@ -2132,8 +2134,7 @@
 
 - (void)discardEditing {
     if (editField) {
-        if ([[self window] firstResponder] == [editField currentEditor] && 
[[self window] makeFirstResponder:self] == NO)
-            [[self window] endEditingFor:nil];
+        [editField abortEditing];
         [editField removeFromSuperview];
         [editField release];
         editField = nil;
@@ -2570,6 +2571,8 @@
 #pragma mark FullScreen navigation and autohide
 
 - (void)handleWindowWillCloseNotification:(NSNotification *)notification {
+    if ([self isEditing] && [self commitEditing] == NO)
+        [self discardEditing];
     [navWindow orderOut:self];
 }
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to