| 60 | //----------------------------------------------------------------------------- |
| 61 | |
| 62 | void VTimeLineControl::onMouseDown( const GuiEvent &pEvent ) |
| 63 | { |
| 64 | Parent::onMouseDown( pEvent ); |
| 65 | |
| 66 | if ( !mIsController || !mController || mController->isPlaying() ) |
| 67 | { |
| 68 | return; |
| 69 | } |
| 70 | |
| 71 | if ( !isMouseLocked() ) |
| 72 | { |
| 73 | GuiCanvas *canvas = getRoot(); |
| 74 | if ( canvas->getMouseLockedControl() ) |
| 75 | { |
| 76 | GuiEvent event; |
| 77 | canvas->getMouseLockedControl()->onMouseLeave( event ); |
| 78 | canvas->mouseUnlock( canvas->getMouseLockedControl() ); |
| 79 | } |
| 80 | |
| 81 | // Lock. |
| 82 | mouseLock(); |
| 83 | } |
| 84 | |
| 85 | // Calculate Time. |
| 86 | const Point2I hitPoint = globalToLocalCoord( pEvent.mousePoint ); |
| 87 | const S32 time = mClamp( toTime( hitPoint.x ), 0, mController->getDuration() ); |
| 88 | |
| 89 | // Selection? |
| 90 | if ( pEvent.modifier & SI_SHIFT ) |
| 91 | { |
| 92 | if ( !mSelection.Active ) |
| 93 | { |
| 94 | // Selection Active. |
| 95 | mSelection.Active = true; |
| 96 | mSelection.StartTime = mController->getTime(); |
| 97 | mSelection.EndTime = time; |
| 98 | } |
| 99 | else |
| 100 | { |
| 101 | // Update Selection. |
| 102 | mSelection.EndTime = time; |
| 103 | } |
| 104 | |
| 105 | // Callback. |
| 106 | Con::executef( this, "onSelectionUpdate" ); |
| 107 | } |
| 108 | else |
| 109 | { |
| 110 | if ( mSelection.Active ) |
| 111 | { |
| 112 | // Selection Invalid. |
| 113 | mSelection.Active = false; |
| 114 | |
| 115 | // Callback. |
| 116 | Con::executef( this, "onSelectionUpdate" ); |
| 117 | } |
| 118 | } |
| 119 |
nothing calls this directly
no test coverage detected