merged 29285:30707 from trunk
authorMike Erwin <significant.bit@gmail.com>
Sun, 25 Jul 2010 10:09:17 +0000 (10:09 +0000)
committerMike Erwin <significant.bit@gmail.com>
Sun, 25 Jul 2010 10:09:17 +0000 (10:09 +0000)
12 files changed:
1  2 
intern/ghost/GHOST_C-api.h
intern/ghost/GHOST_ISystem.h
intern/ghost/intern/GHOST_C-api.cpp
intern/ghost/intern/GHOST_System.h
intern/ghost/intern/GHOST_SystemCocoa.h
intern/ghost/intern/GHOST_SystemCocoa.mm
intern/ghost/intern/GHOST_SystemWin32.cpp
intern/ghost/intern/GHOST_SystemWin32.h
intern/ghost/intern/GHOST_SystemX11.cpp
intern/ghost/intern/GHOST_SystemX11.h
intern/ghost/intern/GHOST_WindowWin32.cpp
source/blender/editors/gpencil/gpencil_paint.c

Simple merge
Simple merge
Simple merge
Simple merge
@@@ -1604,64 -1542,68 +1608,64 @@@ GHOST_TSuccess GHOST_SystemCocoa::handl
                                                //Post event
                                                window->getCursorGrabInitPos(x_cur, y_cur);
                                                pushEvent(new GHOST_EventCursor([event timestamp]*1000, GHOST_kEventCursorMove, window, x_cur + x_accum, y_cur + y_accum));
 -                                      }
 +
                                                break;
 +                                              }
                                        default:
 -                                      {
                                                //Normal cursor operation: send mouse position in window
 -                                              NSPoint mousePos = [event locationInWindow];
                                                pushEvent(new GHOST_EventCursor([event timestamp]*1000, GHOST_kEventCursorMove, window, mousePos.x, mousePos.y));
                                                m_cursorDelta_x=0;
-                                               m_cursorDelta_y=0; //Mouse motion occured between two cursor warps, so we can reset the delta counter
+                                               m_cursorDelta_y=0; //Mouse motion occurred between two cursor warps, so we can reset the delta counter
 -                                      }
 -                                              break;
 -                              }
 -                              break;
 -                      
 +                                              warp_dx = 0;
 +                                              warp_dy = 0;
 +                              } // END cursor grab mode
 +                      break;
 +                      } // END mouse moved
 +
                case NSScrollWheel:
 -                      {
 -                              /* Send trackpad event if inside a trackpad gesture, send wheel event otherwise */
 -                              if (!m_hasMultiTouchTrackpad || !m_isGestureInProgress) {
 -                                      GHOST_TInt32 delta;
 -                                      
 -                                      double deltaF = [event deltaY];
 -                                      if (deltaF == 0.0) break; //discard trackpad delta=0 events
 -                                      
 -                                      delta = deltaF > 0.0 ? 1 : -1;
 -                                      pushEvent(new GHOST_EventWheel([event timestamp]*1000, window, delta));
 -                              }
 -                              else {
 -                                      NSPoint mousePos = [event locationInWindow];
 -                                      double dx = [event deltaX];
 -                                      double dy = -[event deltaY];
 -                                      
 -                                      const double deltaMax = 50.0;
 -                                      
 -                                      if ((dx == 0) && (dy == 0)) break;
 -                                      
 -                                      /* Quadratic acceleration */
 -                                      dx = dx*(fabs(dx)+0.5);
 -                                      if (dx<0.0) dx-=0.5; else dx+=0.5;
 -                                      if (dx< -deltaMax) dx= -deltaMax; else if (dx>deltaMax) dx=deltaMax;
 -                                      
 -                                      dy = dy*(fabs(dy)+0.5);
 -                                      if (dy<0.0) dy-=0.5; else dy+=0.5;
 -                                      if (dy< -deltaMax) dy= -deltaMax; else if (dy>deltaMax) dy=deltaMax;
 -
 -                                      pushEvent(new GHOST_EventTrackpad([event timestamp]*1000, window, GHOST_kTrackpadEventScroll, mousePos.x, mousePos.y, dx, dy));
 -                              }
 +                      /* Send trackpad event if inside a trackpad gesture, send wheel event otherwise */
 +                      if (m_hasMultiTouchTrackpad and m_isGestureInProgress) {
 +                              NSPoint mousePos = [event locationInWindow];
 +                              double dx = [event deltaX];
 +                              double dy = -[event deltaY];
 +
 +                              const double deltaMax = 50.0;
 +
 +                              if ((dx == 0) && (dy == 0)) break;
 +
 +                              /* Quadratic acceleration */
 +                              dx = dx*(fabs(dx)+0.5);
 +                              if (dx<0.0) dx-=0.5; else dx+=0.5;
 +                              if (dx< -deltaMax) dx= -deltaMax; else if (dx>deltaMax) dx=deltaMax;
 +
 +                              dy = dy*(fabs(dy)+0.5);
 +                              if (dy<0.0) dy-=0.5; else dy+=0.5;
 +                              if (dy< -deltaMax) dy= -deltaMax; else if (dy>deltaMax) dy=deltaMax;
 +
 +                              pushEvent(new GHOST_EventTrackpad([event timestamp]*1000, window, GHOST_kTrackpadEventScroll, mousePos.x, mousePos.y, dx, dy));
 +                      }
 +                      else {
 +                              GHOST_TInt32 delta;
 +
 +                              double deltaF = [event deltaY];
 +                              if (deltaF == 0.0) break; //discard trackpad delta=0 events
 +
 +                              delta = deltaF > 0.0 ? 1 : -1;
 +                              pushEvent(new GHOST_EventWheel([event timestamp]*1000, window, delta));
                        }
                        break;
 -                      
 +
                case NSEventTypeMagnify:
                        {
 -                              NSPoint mousePos = [event locationInWindow];
 -                              pushEvent(new GHOST_EventTrackpad([event timestamp]*1000, window, GHOST_kTrackpadEventMagnify, mousePos.x, mousePos.y,
 -                                                                                                [event magnification]*250.0 + 0.1, 0));
 -                      }
 +                      NSPoint mousePos = [event locationInWindow];
 +                      pushEvent(new GHOST_EventTrackpad([event timestamp]*1000, window, GHOST_kTrackpadEventMagnify, mousePos.x, mousePos.y, [event magnification]*250.0 + 0.1, 0));
                        break;
 -
 +                      }
                case NSEventTypeRotate:
                        {
 -                              NSPoint mousePos = [event locationInWindow];
 -                              pushEvent(new GHOST_EventTrackpad([event timestamp]*1000, window, GHOST_kTrackpadEventRotate, mousePos.x, mousePos.y,
 -                                                                                                -[event rotation] * 5.0, 0));
 +                      NSPoint mousePos = [event locationInWindow];
 +                      pushEvent(new GHOST_EventTrackpad([event timestamp]*1000, window, GHOST_kTrackpadEventRotate, mousePos.x, mousePos.y, -[event rotation] * 5.0, 0));
 +                      break;
                        }
                case NSEventTypeBeginGesture:
                        m_isGestureInProgress = true;
@@@ -1883,19 -1819,33 +1880,33 @@@ const GHOST_TUns8* GHOST_SystemCocoa::g
        paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
  
        if ([paths count] > 0)
-               basePath = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"Blender"];
-       else { //Fall back to HOME in case of issue
-               basePath = [NSHomeDirectory() stringByAppendingPathComponent:@".blender"];
+               basePath = [paths objectAtIndex:0];
+       else { 
+               [pool drain];
+               return NULL;
        }
  
-       /* Ensure path exists, creates it if needed */
-       fileManager = [NSFileManager defaultManager];
-       if (![fileManager fileExistsAtPath:basePath isDirectory:NULL]) {
-               [fileManager createDirectoryAtPath:basePath attributes:nil];
+       strcpy((char*)tempPath, [basePath cStringUsingEncoding:NSASCIIStringEncoding]);
+       
+       [pool drain];
+       return tempPath;
+ }
+ const GHOST_TUns8* GHOST_SystemCocoa::getBinaryDir() const
+ {
+       static GHOST_TUns8 tempPath[512] = "";
+       NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+       NSString *basePath;
+       
+       basePath = [[NSBundle mainBundle] bundlePath];
+       
+       if (basePath == nil) {
+               [pool drain];
+               return NULL;
        }
 -      
 +
        strcpy((char*)tempPath, [basePath cStringUsingEncoding:NSASCIIStringEncoding]);
 -      
 +
        [pool drain];
        return tempPath;
  }
  #include "GHOST_SystemWin32.h"
  #include "GHOST_EventDragnDrop.h"
  
 -#define WIN32_LEAN_AND_MEAN
 -#ifdef _WIN32_IE
 -#undef _WIN32_IE
 -#endif
 -#define _WIN32_IE 0x0501
 -#include <windows.h>
 +#include <stdio.h> // for debug [mce]
 +
+ #include <shlobj.h>
++
  // win64 doesn't define GWL_USERDATA
  #ifdef WIN32
  #ifndef GWL_USERDATA
  #include <stdio.h> // for fprintf only
  #include <cstdlib> // for exit
  
+ #ifndef PREFIX
+ #  define PREFIX "/usr/local"
+ #endif
 +// [mce] these are for communication with the plugin
  typedef struct NDOFPlatformInfo {
        Display *display;
        Window window;
Simple merge