Fct_Point_2D_Drag

 

This function drag a point (SliceO_Point) to the position under the cursor on the specified frame.

 

 

Syntax

 

int  Fct_Point_2D_Drag(

          unsigned short flag, 

          SliceO_Window *window, 

          SliceO_Frame *frame

) ;

 

 

Parameters

 

This function does not have a parameter.

 

 

Return value

 

This function return "0" if no point is draged.

 

 

Remarks

 

 

Requirements

 

Header:

          sliceO_include.hpp

 

 

Library:

          sliceO_Structures.lib

 

 

 

Example

 

// ----------------------------------------------------------------------------

//

//          Function:          Ima_Click

//

//          Param:          wnd (HWND)                        Window that receive the click

//                    window (SliceO_Window *)    our structure for the window

//                    up_down (int)                        state of the mouse buttons

//                    x, y (short)                        mouse pos (in "Wnd" coord)

//

//          Return:          (int)                                   1 if this mouse action is used

//                                                                 0 if not used

//                                                                -1 if error

//

//          This is called each time the cursor is inside an image and the state

//          of the mouse buttons has changed.

//

// ----------------------------------------------------------------------------

extern "C" __declspec(dllexport) int          Ima_Click( HWND wnd, SliceO_Window *window, int up_down, short x, short y )

{

static          int ID = 1 ;

SliceO_Frame *Frame_Ovr = NULL ;

 

          Drag_Flag = 0 ;

 

          // --- Only valid if the point module is on ---

          if ( (! Point_On) && (! Ctrl_Query()) )

                    return( 0 ) ;

 

          // --- only valid if over a window ---

          if ( ! window )

                    return( 0 ) ;

 

          // --- we react differently according to the Window Mode ---

          switch( window->Class_A_Get() ) {

          case WINDOW_MODE_ONE :

          case WINDOW_MODE_ALL :

 

                    // --- only valid if we are over a frame ---

                    Frame_Ovr = (SliceO_Frame *) Fct_Variable_Value( "$FRAME_OVR" ) ;

                    if ( ! Frame_Ovr )

                              return( 0 ) ;

 

                    // --- we only want the key press clicks ---

                    if ( ! (up_down & KEY_PRESS ) )

                              return( 0 ) ;

 

                    // --- Left mouse click: Add or drag a point ---

                    if ( up_down & MOUSE_KEY_LEFT ) {

 

                              // --- did we catch an existing marker? ---

                              if ( Fct_Point_2D_Capture( CLASS_POINT_NORMAL, window, Frame_Ovr ) ) {

                                        Drag_Flag = 1 ;

                                        Ctrl_Update( UPDATE_USER_1 ) ;

                                        return( 1 ) ;

                              } else {

                                        // --- place a new marker ---

                                        if ( ! Fct_Point_2D_Insert( CLASS_POINT_NORMAL, window, Frame_Ovr, ID ) )

                                                  return( -1 ) ;

                                        ID++ ;

                                        Drag_Flag = 1 ;

                                        return( 1 ) ;

                              }

                    }

 

                    // --- Right Mouse click: delete a point ---

                    if ( up_down & MOUSE_KEY_RIGHT ) {

                              if ( Fct_Point_2D_Delete( CLASS_POINT_NORMAL, window, Frame_Ovr ) ) {

                                        return( 1 ) ;

                              }

 

                    }

 

                    break ;

                    ...

          }

 

          return( 0 ) ;

}

 

// ----------------------------------------------------------------------------

//

//          Function:          Ima_Motion

//

//          Param:          wnd (HWND)                        Window that receive the click

//                    window (SliceO_Window *)    our structure for the window

//                    up_down (int)                        state of the mouse buttons

//                    x, y (short)                        mouse pos (in "Wnd" coord)

//

//          Return:          (int)                                   1 if this mouse action is used

//                                                                 0 if not used

//                                                                -1 if error

//

//          This is called each time the cursor is inside an image and the cursor

//          has moved.

//

// ----------------------------------------------------------------------------

extern "C" __declspec(dllexport) int          Ima_Motion( HWND wnd, SliceO_Window *window, int up_down, short x, short y )

{

SliceO_Frame *Frame_Ovr = NULL ;

 

          // --- we are only interested if we are draging a point ---

          if ( ! Drag_Flag )

                    return( 0 ) ;

 

          // --- only valid if over a window ---

          if ( ! window ) {

                    Drag_Flag = 0 ;

                    return( 0 ) ;

          }

 

          // --- we react differently according to the Window Mode ---

          switch( window->Class_A_Get() ) {

          case WINDOW_MODE_ONE :

          case WINDOW_MODE_ALL :

 

                    // --- only valid if we are over a frame ---

                    Frame_Ovr = (SliceO_Frame *) Fct_Variable_Value( "$FRAME_OVR" ) ;

                    if ( ! Frame_Ovr )

                              return( 0 ) ;

 

                    // --- drag the marker to a new location ---

                    if( Fct_Point_2D_Drag( CLASS_POINT_NORMAL, window, Frame_Ovr ) ) {

                              Point_2D_to_3D( Point_Cur ) ;

                              return( 1 ) ;

                    }

                    break ;

 

                    ...

 

          }

 

          return( 0 ) ;

}

 

See also