Changeset 20922

Show
Ignore:
Timestamp:
11/18/07 03:14:41 (1 year ago)
Author:
patrick
Message:

Reorganized code and data in the Cocoa input window and input area handling
to be modeled after the Win32 case rather than the X11 case. The Win32 code
keeps the window state in the class where it needs to be rather than having
it all in the input area base class. As part of this, I have renamed
gadget::InputAreaCocoa::updateOriginAndSize() to be simply
gadget::InputAreaCocoa::resize().

Updated the version to 1.3.15.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • juggler/trunk/modules/gadgeteer/ChangeLog

    r20761 r20922  
    11DATE        AUTHOR      CHANGE 
    22----------- ----------- ------------------------------------------------------- 
     3Nov-18-2007 patrick     Replaced gadget::InputAreaCocoa::updateOriginAndSize() 
     4                        with gadget::InputAreaCocoa::resize(). 
     5                        NEW VERSION: 1.3.15 
    36Sep-04-2007 patrick     Use new environment variable GADGET_DATA_DIR as a way 
    47                        to look up files in GADGET_BASE_DIR/share/gadgeteer. 
  • juggler/trunk/modules/gadgeteer/VERSION

    r20761 r20922  
     11.3.15-0 @11/18/2007 09:15:00 UTC@ 
    121.3.14-0 @09/05/2007 02:50:00 UTC@ 
    231.3.13-0 @07/30/2007 02:45:00 UTC@ 
  • juggler/trunk/modules/gadgeteer/gadget/Devices/KeyboardMouseDevice/InputAreaCocoa.h

    r19844 r20922  
    166166   //@} 
    167167 
    168    void updateOriginAndSize(const float x, const float y, const float width, 
    169                             const float height); 
     168   /** 
     169    * Updates the size of this input area. 
     170    * 
     171    * @since 1.3.15 
     172    */ 
     173   void resize(const float width, const float height); 
    170174 
    171175protected: 
     
    233237   /** @name Input Area Data */ 
    234238   //@{ 
    235    float mX;            /**< Input area origin X-coordinate */ 
    236    float mY;            /**< Input area origin Y-coordinate */ 
    237239   float mWidth;        /**< Input area width */ 
    238240   float mHeight;       /**< Input area height */ 
  • juggler/trunk/modules/gadgeteer/gadget/Devices/KeyboardMouseDevice/InputAreaCocoa.mm

    r19844 r20922  
    129129                                         NSEvent* event) 
    130130{ 
    131    const NSPoint view_loc = [mMainView convertPoint:[event locationInWindow] 
    132                                            fromView:nil]; 
     131   const NSPoint view_loc = [event locationInWindow]; 
    133132   const NSPoint root_loc = [NSEvent mouseLocation]; 
    134133   gadget::EventPtr mouse_event(new gadget::MouseEvent(type, button, 
     
    143142void InputAreaCocoa::addMouseMoveEvent(NSEvent* event) 
    144143{ 
    145    const NSPoint view_loc = [mMainView convertPoint:[event locationInWindow] 
    146                                            fromView:nil]; 
     144   NSLog(@"mMainView = %@\n", mMainView); 
     145   const NSPoint view_loc = [event locationInWindow]; 
    147146   const NSPoint root_loc = [NSEvent mouseLocation]; 
    148147   gadget::EventPtr move_event(new gadget::MouseEvent(gadget::MouseMoveEvent, 
     
    210209} 
    211210 
    212 void InputAreaCocoa::updateOriginAndSize(const float x, const float y, 
    213                                          const float width, 
    214                                          const float height) 
    215 
    216    mX      = x; 
    217    mY      = y; 
     211void InputAreaCocoa::resize(const float width, const float height) 
     212
    218213   mWidth  = width; 
    219214   mHeight = height; 
  • juggler/trunk/modules/gadgeteer/gadget/Devices/KeyboardMouseDevice/InputWindowCocoa.h

    r20356 r20922  
    8787 
    8888   /** 
     89    * Updates the bounds of this window to be the given values. 
     90    * 
     91    * @post The origin and size of this window are set to the given values. 
     92    * 
     93    * @see gadget::InputAreaCocoa::resize() 
     94    * 
     95    * @since 1.3.15 
     96    */ 
     97   void updateBounds(const float x, const float y, const float width, 
     98                     const float height); 
     99 
     100   /** 
    89101    * Informs this object that the NSWindow object that we created previously 
    90102    * has been closed by an external entity and hence deallocated. By invoking 
     
    116128   unsigned int mScreen; 
    117129   bool mWindowOpen;    /**< Keeps track of NSWindow open/closed state */ 
     130 
     131   float mX;            /**< Window origin X-coordinate */ 
     132   float mY;            /**< Window origin Y-coordinate */ 
    118133}; 
    119134 
  • juggler/trunk/modules/gadgeteer/gadget/Devices/KeyboardMouseDevice/InputWindowCocoa.mm

    r20021 r20922  
    9191      // Inform our input area of the change in our bounds. 
    9292      NSRect b = [[aNotification object] frame]; 
    93       mWindow->updateOriginAndSize(b.origin.x, b.origin.y, b.size.width, 
    94                                    b.size.height); 
     93      mWindow->updateBounds(b.origin.x, b.origin.y, b.size.width, 
     94                            b.size.height); 
    9595   } 
    9696 
     
    103103      // Inform our input area of the change in our bounds. 
    104104      NSRect b = [[aNotification object] frame]; 
    105       mWindow->updateOriginAndSize(b.origin.x, b.origin.y, b.size.width, 
    106                                    b.size.height); 
     105      mWindow->updateBounds(b.origin.x, b.origin.y, b.size.width, 
     106                            b.size.height); 
    107107   } 
    108108@end 
     
    368368} 
    369369 
     370void InputWindowCocoa::updateBounds(const float x, const float y, 
     371                                    const float width, const float height) 
     372{ 
     373   mX = x; 
     374   mY = y; 
     375   resize(width, height); 
     376} 
     377 
    370378void InputWindowCocoa::setWindowOpen(const bool isOpen) 
    371379{