Author: mlytwyn
Date: Sun Feb 12 19:25:21 2017
New Revision: 40335

URL: http://svn.gna.org/viewcvs/gnustep?rev=40335&view=rev
Log:
Use NSInteger for window ref number

Modified:
    
libs/gui/branches/gnustep_testplant_branch/Headers/Additions/GNUstepGUI/GSDragView.h
    libs/gui/branches/gnustep_testplant_branch/Source/GSDragView.m
    libs/gui/branches/gnustep_testplant_branch/Source/GSXib5KeyedUnarchiver.m
    libs/gui/branches/gnustep_testplant_branch/Source/NSClipView.m
    libs/gui/branches/gnustep_testplant_branch/Source/NSTableView.m
    libs/gui/branches/gnustep_testplant_branch/Source/NSTextView.m
    libs/gui/branches/gnustep_testplant_branch/Source/NSWindow.m

Modified: 
libs/gui/branches/gnustep_testplant_branch/Headers/Additions/GNUstepGUI/GSDragView.h
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gui/branches/gnustep_testplant_branch/Headers/Additions/GNUstepGUI/GSDragView.h?rev=40335&r1=40334&r2=40335&view=diff
==============================================================================
--- 
libs/gui/branches/gnustep_testplant_branch/Headers/Additions/GNUstepGUI/GSDragView.h
        (original)
+++ 
libs/gui/branches/gnustep_testplant_branch/Headers/Additions/GNUstepGUI/GSDragView.h
        Sun Feb 12 19:25:21 2017
@@ -129,7 +129,7 @@
                 timestamp: (NSTimeInterval)time
                  toWindow: (NSInteger)dWindowNumber;
 - (NSWindow*) windowAcceptingDnDunder: (NSPoint)mouseLocation
-                           windowRef: (int*)mouseWindowRef;
+                           windowRef: (NSInteger*)mouseWindowRef;
 
 @end
 #endif

Modified: libs/gui/branches/gnustep_testplant_branch/Source/GSDragView.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gui/branches/gnustep_testplant_branch/Source/GSDragView.m?rev=40335&r1=40334&r2=40335&view=diff
==============================================================================
--- libs/gui/branches/gnustep_testplant_branch/Source/GSDragView.m      
(original)
+++ libs/gui/branches/gnustep_testplant_branch/Source/GSDragView.m      Sun Feb 
12 19:25:21 2017
@@ -357,7 +357,7 @@
   set, if there is a native window, but no GNUstep window at this location.
  */
 - (NSWindow*) windowAcceptingDnDunder: (NSPoint)mouseLocation
-                            windowRef: (int*)mouseWindowRef
+                            windowRef: (NSInteger*)mouseWindowRef
 {
   NSInteger win;
 
@@ -890,7 +890,7 @@
   //--- Store old values -----------------------------------------------------
   NSWindow *oldDestWindow = destWindow;
   BOOL oldDestExternal = destExternal;
-  int mouseWindowRef; 
+  NSInteger mouseWindowRef;
   BOOL changeCursor = NO;
  
   //--- Move drag image to the new position -----------------------------------

Modified: 
libs/gui/branches/gnustep_testplant_branch/Source/GSXib5KeyedUnarchiver.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gui/branches/gnustep_testplant_branch/Source/GSXib5KeyedUnarchiver.m?rev=40335&r1=40334&r2=40335&view=diff
==============================================================================
--- libs/gui/branches/gnustep_testplant_branch/Source/GSXib5KeyedUnarchiver.m   
(original)
+++ libs/gui/branches/gnustep_testplant_branch/Source/GSXib5KeyedUnarchiver.m   
Sun Feb 12 19:25:21 2017
@@ -1608,7 +1608,7 @@
   
   if (baseWritingDirection == nil)
     [paragraphStyle setBaseWritingDirection: 
NSWritingDirectionNaturalDirection];
-  else if ([@"" isEqualToString: baseWritingDirection])
+  else if ([@"leftToRight" isEqualToString: baseWritingDirection])
     [paragraphStyle setBaseWritingDirection: NSWritingDirectionLeftToRight];
   else if ([@"rightToLeft" isEqualToString: baseWritingDirection])
     [paragraphStyle setBaseWritingDirection: NSWritingDirectionRightToLeft];
@@ -2884,6 +2884,7 @@
         }
       else if ([@"NSPathSeparator" isEqualToString: key])
         {
+          // This would allow to do system dependent path separator decoding...
           object = @"/";
         }
       else if ([key hasPrefix:@"NS"])

Modified: libs/gui/branches/gnustep_testplant_branch/Source/NSClipView.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gui/branches/gnustep_testplant_branch/Source/NSClipView.m?rev=40335&r1=40334&r2=40335&view=diff
==============================================================================
--- libs/gui/branches/gnustep_testplant_branch/Source/NSClipView.m      
(original)
+++ libs/gui/branches/gnustep_testplant_branch/Source/NSClipView.m      Sun Feb 
12 19:25:21 2017
@@ -27,8 +27,10 @@
 */
 
 #import "config.h"
+#import <Foundation/NSDebug.h>
+#import <Foundation/NSException.h>
 #import <Foundation/NSNotification.h>
-#import <Foundation/NSException.h>
+#import <Foundation/NSUserDefaults.h>
 
 #import "AppKit/NSClipView.h"
 #import "AppKit/NSCursor.h"
@@ -491,6 +493,9 @@
  */
 - (BOOL) autoscroll: (NSEvent*)theEvent
 {
+  static CGFloat ScrollingMargin = 15.0;
+  
+  CGFloat scrollingMargin;
   NSPoint new;
   NSPoint delta;
   NSRect r;
@@ -500,22 +505,27 @@
       return NO;
     }
   
-  new = [_documentView convertPoint: [theEvent locationInWindow] 
-                      fromView: nil];
+  // Use defaults value if present...
+  scrollingMargin = [[NSUserDefaults standardUserDefaults]  floatForKey: 
@"GSAutoScrollingMargin"];
+  if (scrollingMargin == 0) // otherwise use static coded default...
+    scrollingMargin = ScrollingMargin;
+  
+  new = [_documentView convertPoint: [theEvent locationInWindow]
+                           fromView: nil];
 
   r = [self documentVisibleRect];
 
-  if (new.x < NSMinX(r))
-    delta.x = new.x - NSMinX(r);
-  else if (new.x > NSMaxX(r))
-    delta.x = new.x - NSMaxX(r);
+  if ((new.x > NSMinX(r)) && (new.x < NSMinX(r)+scrollingMargin))
+    delta.x = (new.x - NSMinX(r)) - scrollingMargin;
+  else if ((new.x > NSMaxX(r)-scrollingMargin) && (new.x < NSMaxX(r)))
+    delta.x = scrollingMargin - (NSMaxX(r) - new.x);
   else
     delta.x = 0;
 
-  if (new.y < NSMinY(r))
-    delta.y = new.y - NSMinY(r);
-  else if (new.y > NSMaxY(r))
-    delta.y = new.y - NSMaxY(r);
+  if ((new.y > NSMinY(r)) && (new.y < NSMinY(r)+scrollingMargin))
+    delta.y = (new.y - NSMinY(r)) - scrollingMargin;
+  else if ((new.y > NSMaxY(r)-scrollingMargin) && (new.y < NSMaxY(r)))
+    delta.y = scrollingMargin - (NSMaxY(r) - new.y);
   else
     delta.y = 0;
 
@@ -523,6 +533,13 @@
   new.y = _bounds.origin.y + delta.y;
 
   new = [self constrainScrollPoint: new];
+//  NSWarnMLog(@"self: %@ theEventLocInWin: %@ docVisRect: %@ docPnt: %@ 
delta: %@ new: %@ equ: %ld", self,
+//             NSStringFromPoint([theEvent locationInWindow]),
+//             NSStringFromRect(r),
+//             NSStringFromPoint([_documentView convertPoint: [theEvent 
locationInWindow] fromView: nil]),
+//             NSStringFromPoint(delta),
+//             NSStringFromPoint(new),
+//             (long)(NSEqualPoints(new, _bounds.origin)));
   if (NSEqualPoints(new, _bounds.origin))
     return NO;
 

Modified: libs/gui/branches/gnustep_testplant_branch/Source/NSTableView.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gui/branches/gnustep_testplant_branch/Source/NSTableView.m?rev=40335&r1=40334&r2=40335&view=diff
==============================================================================
--- libs/gui/branches/gnustep_testplant_branch/Source/NSTableView.m     
(original)
+++ libs/gui/branches/gnustep_testplant_branch/Source/NSTableView.m     Sun Feb 
12 19:25:21 2017
@@ -3661,6 +3661,45 @@
       return([cell hitTestForEvent:event inRect:cellFrame ofView:self]);
     }
   return(NSCellHitNone);
+}
+
+- (void)mouseEntered:(NSEvent *)event
+{
+  NSWarnMLog(@"self: %@ event: %@", self, event);
+  [super mouseEntered: event];
+}
+
+- (void)mouseMoved:(NSEvent *)event
+{
+  NSWarnMLog(@"self: %@ event: %@", self, event);
+  [super mouseMoved: event];
+}
+
+#if 0
+- (void)mouseDragged:(NSEvent *)event
+{
+//  NSWarnMLog(@"self: %@ event: %@", self, event);
+  NSPoint locInWin = [event locationInWindow];
+  NSPoint locInView = [self convertPoint: locInWin toView: nil];
+  NSRect  bounds = [self bounds];
+  NSRect  frameTop = NSMakeRect(0, 0, bounds.size.width, 10);
+  NSRect  frameBot = NSMakeRect(0, NSMaxY(bounds), bounds.size.width, 
NSMaxY(bounds)-10);
+//  NSWarnMLog(@"locInWin: %@ locInView: %@ bounds: %@ frameTop: %@ frameBot: 
%@",
+//             NSStringFromPoint(locInWin),
+//             NSStringFromPoint(locInView),
+//             NSStringFromRect(bounds),
+//             NSStringFromRect(frameTop),
+//             NSStringFromRect(frameBot));
+  //if (NSPointInRect(locInView, frameTop) || NSPointInRect(locInView, 
frameBot))
+    [self autoscroll: event];
+  [super mouseDragged: event];
+}
+#endif
+
+- (void)mouseExited:(NSEvent *)event
+{
+  NSWarnMLog(@"self: %@ event: %@", self, event);
+  [super mouseExited: event];
 }
 
 - (void) mouseDown: (NSEvent *)theEvent
@@ -3917,6 +3956,10 @@
               
             case NSLeftMouseDown:
             case NSLeftMouseDragged:
+              NSWarnMLog(@"NSLeftMouseDown | NSLeftMouseDragged: 
dragOperationPossible: %ld mouseWin: %@ initLoc: %@",
+                         (long)dragOperationPossible,
+                         NSStringFromPoint(mouseLocationWin),
+                         NSStringFromPoint(initialLocation));
               if (fabs(mouseLocationWin.x - initialLocation.x) > 1
                   || fabs(mouseLocationWin.y - initialLocation.y) > 1)
               {
@@ -3938,6 +3981,7 @@
                 {
                   if ([self _startDragOperationWithEvent: theEvent 
clickedRow:_clickedRow])
                   {
+                    NSWarnMLog(@"_startDragOperationWithEvent");
                     RELEASE(oldSelectedRows);
                     IF_NO_GC(DESTROY(arp));
                     return;
@@ -3954,6 +3998,7 @@
                 // mouse dragged within table
                 if (startedPeriodicEvents == YES)
                 {
+                  NSWarnMLog(@"stopPeriodicEvents");
                   [NSEvent stopPeriodicEvents];
                   startedPeriodicEvents = NO;
                 }
@@ -4001,9 +4046,9 @@
               else
               {
                 // Mouse dragged out of the table
-                 NSTimeInterval period = computePeriod(mouseLocationWin, 
-                                             minYVisible,
-                                             maxYVisible);
+                NSTimeInterval period = computePeriod(mouseLocationWin,
+                                                      minYVisible,
+                                                      maxYVisible);
                 
                 if (startedPeriodicEvents == YES)
                 {
@@ -4016,6 +4061,7 @@
                 }
                 /* Start periodic events */
                 oldPeriod = period;
+                NSWarnMLog(@"startPeriodicEvents: %f", oldPeriod);
                 [NSEvent startPeriodicEventsAfterDelay: 0
                                             withPeriod: oldPeriod];
                 startedPeriodicEvents = YES;
@@ -4026,6 +4072,7 @@
               }
               break;
             case NSPeriodic:
+              NSWarnMLog(@"NSPeriodic");
               if (mouseBelowView == YES)
               {
                 if (currentRow == -1 && oldRow != -1)
@@ -6496,6 +6543,7 @@
 
 - (NSDragOperation) draggingEntered: (id <NSDraggingInfo>) sender
 {
+  NSWarnMLog(@"self: %@ sender: %@", self, sender);
   currentDropRow = -1;
   currentDropOperation = -1;
   oldDropRow = -1;
@@ -6507,6 +6555,7 @@
 
 - (void) draggingExited: (id <NSDraggingInfo>) sender
 {
+  NSWarnMLog(@"self: %@ sender: %@", self, sender);
   [self setNeedsDisplayInRect: oldDraggingRect];
   [self displayIfNeeded];
 }
@@ -6646,6 +6695,7 @@
   NSDragOperation dragOperation = [sender draggingSourceOperationMask];
   BOOL isSameDropTargetThanBefore = (lastQuarterPosition == quarterPosition
     && currentDragOperation == dragOperation);
+  NSWarnMLog(@"self: %@ sender: %@", self, sender);
 
   [self _scrollRowAtPointToVisible: p];
 

Modified: libs/gui/branches/gnustep_testplant_branch/Source/NSTextView.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gui/branches/gnustep_testplant_branch/Source/NSTextView.m?rev=40335&r1=40334&r2=40335&view=diff
==============================================================================
--- libs/gui/branches/gnustep_testplant_branch/Source/NSTextView.m      
(original)
+++ libs/gui/branches/gnustep_testplant_branch/Source/NSTextView.m      Sun Feb 
12 19:25:21 2017
@@ -5784,6 +5784,7 @@
                                                    inMode: 
NSEventTrackingRunLoopMode
                                                   dequeue: YES];
           }
+        NSWarnMLog(@"currentEvent: %@", currentEvent);
         if (currentEvent && [currentEvent type] == NSLeftMouseUp)
           break;
         

Modified: libs/gui/branches/gnustep_testplant_branch/Source/NSWindow.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gui/branches/gnustep_testplant_branch/Source/NSWindow.m?rev=40335&r1=40334&r2=40335&view=diff
==============================================================================
--- libs/gui/branches/gnustep_testplant_branch/Source/NSWindow.m        
(original)
+++ libs/gui/branches/gnustep_testplant_branch/Source/NSWindow.m        Sun Feb 
12 19:25:21 2017
@@ -80,6 +80,7 @@
 #import "AppKit/NSWindowController.h"
 #import "AppKit/PSOperators.h"
 
+#import "GNUstepGUI/GSDragView.h"
 #import "GNUstepGUI/GSTheme.h"
 #import "GNUstepGUI/GSTrackingRect.h"
 #import "GNUstepGUI/GSDisplayServer.h"
@@ -105,6 +106,7 @@
 static id<GSWindowDecorator> windowDecorator = nil;
 
 
+NSView *GSDragViewForEvent(NSView *wv, NSEvent *theEvent, id<NSDraggingInfo> 
dragInfo);
 BOOL GSViewAcceptsDrag(NSView *v, id<NSDraggingInfo> dragInfo);
 
 @interface NSObject (DragInfoBackend)
@@ -3869,14 +3871,14 @@
                     }
                 }
               /* Activate the app *after* making the receiver key, as app
-                 activation tries to make the previous key window key.
-                However, don't activate the app after a single click into
-                the app icon or a miniwindow. This allows dragging app
-                icons and miniwindows without unnecessarily switching
-                applications (cf. Sect. 4 of the OpenStep UI Guidelines).
-             */
+               activation tries to make the previous key window key.
+               However, don't activate the app after a single click into
+               the app icon or a miniwindow. This allows dragging app
+               icons and miniwindows without unnecessarily switching
+               applications (cf. Sect. 4 of the OpenStep UI Guidelines).
+               */
               if ((_styleMask & (NSIconWindowMask | NSMiniWindowMask)) == 0
-                 && [NSApp isActive] == NO)
+                  && [NSApp isActive] == NO)
                 {
                   v = nil;
                   [NSApp activateIgnoringOtherApps: YES];
@@ -3928,10 +3930,10 @@
                     [self mouseDown: theEvent];
                 }
             }
-         else
-           {
-              NSDebugLLog(@"NSEvent", @"Discard (window closed) %@", theEvent);
-           }
+          else
+            {
+                    NSDebugLLog(@"NSEvent", @"Discard (window closed) %@", 
theEvent);
+            }
           _lastPoint = [theEvent locationInWindow];
           break;
         }
@@ -3947,7 +3949,7 @@
 
       case NSOtherMouseDown:
           v = [_wv hitTest: [theEvent locationInWindow]];
-         ASSIGN(_lastOtherMouseDownView, v);
+          ASSIGN(_lastOtherMouseDownView, v);
           [v otherMouseDown: theEvent];
           _lastPoint = [theEvent locationInWindow];
           break;
@@ -3963,7 +3965,7 @@
 
       case NSRightMouseDown:
         v = [_wv hitTest: [theEvent locationInWindow]];
-       ASSIGN(_lastRightMouseDownView, v);
+        ASSIGN(_lastRightMouseDownView, v);
         [v rightMouseDown: theEvent];
         _lastPoint = [theEvent locationInWindow];
         break;
@@ -3984,11 +3986,28 @@
         switch (type)
           {
             case NSLeftMouseDragged:
+              v = GSDragViewForEvent(_wv, theEvent, [GSServerForWindow(self) 
dragInfo]);
+#if 0
+              NSWarnMLog(@"NSLeftMouseDragged %p - v: %@ 
_lastLeftMouseDownView: %@ eventLoc: %@", self,
+                         v, _lastLeftMouseDownView, 
NSStringFromPoint([theEvent locationInWindow]));
+#endif
               // Testplant-MAL-2015-07-08: keeping testplant branch code...
+#if 0
+              if ([[GSDragView sharedDragView] isDragging] && v)
+                {
+                  _lastLeftMouseDownView = v;
+                  [v mouseDragged: theEvent];
+                }
+              else
+#endif
               if (_lastLeftMouseDownView)
-                [_lastLeftMouseDownView mouseDragged: theEvent];
+                {
+                  [_lastLeftMouseDownView mouseDragged: theEvent];
+                }
               else
-                [self mouseDragged: theEvent];
+                {
+                  [self mouseDragged: theEvent];
+                }
               break;
             case NSOtherMouseDragged:
               [_lastOtherMouseDownView otherMouseDragged: theEvent];
@@ -4341,19 +4360,12 @@
               BOOL        isEntry;
 
               dragInfo = [GSServerForWindow(self) dragInfo];
-              v = [_wv hitTest: [theEvent locationInWindow]];
-              
-              while (v != nil)
-                {
-                  if (v->_rFlags.has_draginfo != 0
-                      && GSViewAcceptsDrag(v, dragInfo))
-                    break;
-                  v = [v superview];
-                }
+              v = GSDragViewForEvent(_wv, theEvent, dragInfo);
               if (v == nil)
-                {
-                  v = _wv;
-                }
+              {
+                v = _wv;
+              }
+
               if (_lastDragView == v)
                 {
                   isEntry = NO;
@@ -4391,7 +4403,15 @@
                 {
                   action = NSDragOperationNone;
                 }
-
+              
+#if 1
+              // Support for autoscrolling...
+              if ([theEvent subtype] == GSAppKitDraggingUpdate)
+              {
+                [v autoscroll: theEvent];
+              }
+#endif
+              
               e = [NSEvent otherEventWithType: NSAppKitDefined
                            location: [theEvent locationInWindow]
                            modifierFlags: 0
@@ -5932,6 +5952,21 @@
 
 @end
 
+NSView *GSDragViewForEvent(NSView *wv, NSEvent *theEvent, id<NSDraggingInfo> 
dragInfo)
+{
+  NSView *v = [wv hitTest: [theEvent locationInWindow]];
+
+  while (v != nil)
+  {
+    if (v->_rFlags.has_draginfo != 0
+        && GSViewAcceptsDrag(v, dragInfo))
+      break;
+    v = [v superview];
+  }
+  
+  return v;
+}
+
 BOOL GSViewAcceptsDrag(NSView *v, id<NSDraggingInfo> dragInfo)
 {
   NSPasteboard *pb = [dragInfo draggingPasteboard];


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to