Author: mlytwyn
Date: Fri Jun 26 19:22:16 2015
New Revision: 38705

URL: http://svn.gna.org/viewcvs/gnustep?rev=38705&view=rev
Log:
NSAnimation, NSApplication and NSArrayController merges

Modified:
    libs/gui/branches/gnustep_testplant_branch/Source/NSAnimation.m
    libs/gui/branches/gnustep_testplant_branch/Source/NSApplication.m
    libs/gui/branches/gnustep_testplant_branch/Source/NSArrayController.m

Modified: libs/gui/branches/gnustep_testplant_branch/Source/NSAnimation.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gui/branches/gnustep_testplant_branch/Source/NSAnimation.m?rev=38705&r1=38704&r2=38705&view=diff
==============================================================================
--- libs/gui/branches/gnustep_testplant_branch/Source/NSAnimation.m     
(original)
+++ libs/gui/branches/gnustep_testplant_branch/Source/NSAnimation.m     Fri Jun 
26 19:22:16 2015
@@ -534,7 +534,7 @@
 
 - (void) removeProgressMark: (NSAnimationProgress)progress
 {
-  unsigned index;
+  NSUInteger index;
   _NSANIMATION_LOCKING_SETUP;
 
   _NSANIMATION_LOCK;
@@ -547,8 +547,8 @@
       GSIArrayRemoveItemAtIndex(_progressMarks,index);
       _isCachedProgressMarkNumbersValid = NO;
       if (_nextMark > index) _nextMark--;
-      NSDebugMLLog(@"NSAnimationMark",@"Remove mark #%d for (next:#%d)",
-                   index, progress, _nextMark);
+      NSDebugMLLog(@"NSAnimationMark",@"Remove mark #%lu (%f) for (next:#%d)",
+                   (unsigned long)index, progress, _nextMark);
     }
   else
     NSWarnMLog(@"Unexistent progress mark");
@@ -797,7 +797,7 @@
         [delegate methodForSelector: @selector (animationShouldStart:)]
         : NULL;
       NSDebugMLLog(@"NSAnimationDelegate",
-                   @"Delegation methods : %x %x %x %x %x",
+                   @"Delegation methods : %p %p %p %p %p",
                    _delegate_animationDidReachProgressMark,
                    _delegate_animationValueForProgress,
                    _delegate_animationDidEnd,

Modified: libs/gui/branches/gnustep_testplant_branch/Source/NSApplication.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gui/branches/gnustep_testplant_branch/Source/NSApplication.m?rev=38705&r1=38704&r2=38705&view=diff
==============================================================================
--- libs/gui/branches/gnustep_testplant_branch/Source/NSApplication.m   
(original)
+++ libs/gui/branches/gnustep_testplant_branch/Source/NSApplication.m   Fri Jun 
26 19:22:16 2015
@@ -1872,6 +1872,7 @@
          NSEventType   type = [_current_event type];
 
          [self sendEvent: _current_event];
+      // Testplant-MAL-2015-06-26: keeping testplant fix...
       [_session->window displayIfNeeded];
 
          // update (en/disable) the services menu's items
@@ -1970,26 +1971,31 @@
  * Put up a modal window centered relative to docWindow.  On OS X this is
  * deprecated in favor of
  * -beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo: .
- * <em>Not implemented under GNUstep.  Currently just centers window on the
- * screen.</em>
  */
 - (NSInteger) runModalForWindow: (NSWindow *)theWindow
                relativeToWindow: (NSWindow *)docWindow
 {
-  // FIXME
-  NSRect  frame = [docWindow frame];
-  NSPoint point = frame.origin;
-  NSSize  size  = [theWindow frame].size;
+  if ((docWindow != nil) && (theWindow != nil))
+    {
+      NSRect  docFrame = [docWindow frame];
+      NSPoint point    = docFrame.origin;
+      NSRect  theFrame = [theWindow frame];
+      NSSize  size     = theFrame.size;
   
-  // Calculate window position...
-  point.x += (frame.size.width - size.width) / 2;
-  point.y += (frame.size.height - size.height);
-
-  // Position window...
-  [theWindow setFrameOrigin:point];
+      // Calculate window position...
+      point.x += (docFrame.size.width - size.width) / 2;
+      // Testplant-MAL-2015-06-26: Keeping position at top...
+      point.y += (docFrame.size.height - size.height);
+
+      NSDebugLLog(@"NSWindow", @"Positioning window %@ relative to %@ at %@", 
+            NSStringFromRect(theFrame), NSStringFromRect(docFrame), 
NSStringFromPoint(point));
+
+      // Position window...
+      [theWindow setFrameOrigin:point];
+    }
+
   [theWindow orderWindow: NSWindowAbove
               relativeTo: [docWindow windowNumber]];
-  
   return [self runModalForWindow: theWindow];
 }
 

Modified: libs/gui/branches/gnustep_testplant_branch/Source/NSArrayController.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gui/branches/gnustep_testplant_branch/Source/NSArrayController.m?rev=38705&r1=38704&r2=38705&view=diff
==============================================================================
--- libs/gui/branches/gnustep_testplant_branch/Source/NSArrayController.m       
(original)
+++ libs/gui/branches/gnustep_testplant_branch/Source/NSArrayController.m       
Fri Jun 26 19:22:16 2015
@@ -48,6 +48,8 @@
   if (self == [NSArrayController class])
     {
       [self exposeBinding: NSContentArrayBinding];
+      [self setKeys: [NSArray arrayWithObjects: NSContentBinding, 
NSContentObjectBinding, nil] 
+            triggerChangeNotificationsForDependentKey: @"arrangedObjects"];
     }
 }
 
@@ -82,42 +84,76 @@
 
 - (void) addObject: (id)obj
 {
+  [self willChangeValueForKey: NSContentBinding];
   [_content addObject: obj];
   if ([self automaticallyRearrangesObjects])
     {
       [self rearrangeObjects];
     }
+  else 
+    {
+      // FIXME: Should check whether _arranged_objects is mutable
+      ASSIGN(_arranged_objects, [_arranged_objects arrayByAddingObject: obj]);
+}
+  if ([self selectsInsertedObjects])
+    {
+      [self addSelectedObjects: [NSArray arrayWithObject: obj]];
+    }
+  [self didChangeValueForKey: NSContentBinding];
 }
 
 - (void) addObjects: (NSArray*)obj
 {
+  [self willChangeValueForKey: NSContentBinding];
   [_content addObjectsFromArray: obj];
   if ([self automaticallyRearrangesObjects])
     {
       [self rearrangeObjects];
     }
+  else 
+    {
+      // FIXME: Should check whether _arranged_objects is mutable
+      ASSIGN(_arranged_objects, [_arranged_objects 
arrayByAddingObjectsFromArray: obj]);
+    }
   if ([self selectsInsertedObjects])
     {
       [self addSelectedObjects: obj];
     }
+  [self didChangeValueForKey: NSContentBinding];
 }
 
 - (void) removeObject: (id)obj
 {
+  [self willChangeValueForKey: NSContentBinding];
   [_content removeObject: obj];
+  [self removeSelectedObjects: [NSArray arrayWithObject: obj]];
   if ([self automaticallyRearrangesObjects])
     {
       [self rearrangeObjects];
     }
+  else 
+    {
+      // FIXME
+      //[_arranged_objects removeObject: obj];
+}
+  [self didChangeValueForKey: NSContentBinding];
 }
 
 - (void) removeObjects: (NSArray*)obj
 {
+  [self willChangeValueForKey: NSContentBinding];
   [_content removeObjectsInArray: obj];
+  [self removeSelectedObjects: obj];
   if ([self automaticallyRearrangesObjects])
     {
       [self rearrangeObjects];
     }
+  else 
+    {
+      // FIXME
+      //[_arranged_objects removeObjectsInArray: obj];
+}
+  [self didChangeValueForKey: NSContentBinding];
 }
 
 - (BOOL) canInsert
@@ -135,7 +171,7 @@
 {
   id new = [self newObject];
 
-  [_content addObject: new];
+  [self addObject: new];
   RELEASE(new);
 }
 
@@ -440,6 +476,7 @@
       [coder encodeBool: [self selectsInsertedObjects] forKey: 
@"NSSelectsInsertedObjects"];
       [coder encodeBool: [self clearsFilterPredicateOnInsertion] forKey:
                @"NSClearsFilterPredicateOnInsertion"];
+      [coder encodeBool: [self automaticallyRearrangesObjects] forKey: 
@"NSAutomaticallyRearrangesObjects"];
     }
   else
     {
@@ -475,6 +512,11 @@
           [self setClearsFilterPredicateOnInsertion: 
                 [coder decodeBoolForKey: 
@"NSClearsFilterPredicateOnInsertion"]];
         }
+      if ([coder containsValueForKey: @"NSAutomaticallyRearrangesObjects"])
+        {
+          [self setAutomaticallyRearrangesObjects: 
+                [coder decodeBoolForKey: @"NSAutomaticallyRearrangesObjects"]];
+        }
     }
   else
     {


_______________________________________________
Gnustep-cvs mailing list
Gnustep-cvs@gna.org
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to