|
...
// ----------------------------------------------------------------------------
//
// Function: Ctrl_Click
//
// Parameters: wnd (HWND) Pointer to Window's generating the signal
// up_down (int) state of the mouse buttons
// x, y (int) current cursor position
// Returns: (int) 0 if used
//
// This is called each time the cursor is inside your menu and the state
// of the mouse buttons has changed.
//
// ----------------------------------------------------------------------------
extern "C" __declspec(dllexport) int Ctrl_Click( HWND wnd, int up_down, short x, short y )
{
// --- we only use the "down" click ---
if ( ! up_down )
return( 0 ) ;
// ------------------------------------------------
// --- TAG Selection Tool ---
// ------------------------------------------------
if ( tool_tag.Click( up_down ) >= 0 ) {
unsigned short *TAG_Cur = (unsigned short *) Fct_Variable_Get( "$TAG_CUR" ) ;
if ( ! TAG_Cur )
return( 0 ) ;
if ( *TAG_Cur != tool_tag.Read() ) {
// --- we changed the current tag ---
*TAG_Cur = tool_tag.Read() ;
Fct_Update( UPDATE_CUR_TAG ) ;
}
}
// ------------------------------------------------
// ------------------------------------------------
// --- Brush Selection Tool ---
// ------------------------------------------------
if ( tool_brush.Click( up_down ) >= 0 ) {
unsigned short *Brush_Cur = (unsigned short *) Fct_Variable_Get( "$BRUSH_CUR" ) ;
if ( ! Brush_Cur )
return( 0 ) ;
if ( *Brush_Cur != tool_brush.Read() ) {
// --- we changed the current tag ---
*Brush_Cur = tool_brush.Read() ;
Fct_Update( UPDATE_CUR_BRUSH ) ;
}
}
// ------------------------------------------------
// -- save the tag_work image to the erase buffer ---
if ( but_load.Select( up_down ) ) {
but_load.Cur_Value = 1 ;
but_load.Adjust() ;
// --- make sure we have an erase buffer ---
SliceO_Frame **Frame_Cur = (SliceO_Frame **) Fct_Variable_Value( "$FRAME_CUR" ) ;
SliceO_Window *Window_Cur = (SliceO_Window *) Fct_Variable_Value( "$WINDOW_CUR" ) ;
if ( Frame_Cur && Window_Cur && Frame_Cur[Window_Cur->Id_Get()] ) {
Frame_Cur[Window_Cur->Id_Get()]->Erase_Load() ;
}
but_load.Cur_Value = 0 ;
but_load.Adjust() ;
return( 1 ) ;
}
// --- last undo ---
if ( but_undo.Select( up_down ) ) {
but_undo.Cur_Value = 1 ;
but_undo.Adjust() ;
Undo_Undo_Command() ;
but_undo.Cur_Value = 0 ;
but_undo.Adjust() ;
return( 1 ) ;
}
if ( but_erose.Select( up_down ) ) {
but_erose.Cur_Value = 1 ;
but_erose.Adjust() ;
Script_Read_Line( "morpho: erosion" ) ;
but_erose.Cur_Value = 0 ;
but_erose.Adjust() ;
return( 1 ) ;
}
if ( but_dilat.Select( up_down ) ) {
but_dilat.Cur_Value = 1 ;
but_dilat.Adjust() ;
Script_Read_Line( "morpho: dilatation" ) ;
but_dilat.Cur_Value = 0 ;
but_dilat.Adjust() ;
return( 1 ) ;
}
if ( but_open1.Select( up_down ) ) {
but_open1.Cur_Value = 1 ;
but_open1.Adjust() ;
Script_Read_Line( "morpho: open 1" ) ;
but_open1.Cur_Value = 0 ;
but_open1.Adjust() ;
return( 1 ) ;
}
if ( but_open2.Select( up_down ) ) {
but_open2.Cur_Value = 1 ;
but_open2.Adjust() ;
Script_Read_Line( "morpho: open 2" ) ;
but_open2.Cur_Value = 0 ;
but_open2.Adjust() ;
return( 1 ) ;
}
if ( but_close1.Select( up_down ) ) {
but_close1.Cur_Value = 1 ;
but_close1.Adjust() ;
Script_Read_Line( "morpho: close 1" ) ;
but_close1.Cur_Value = 0 ;
but_close1.Adjust() ;
return( 1 ) ;
}
if ( but_close2.Select( up_down ) ) {
but_close2.Cur_Value = 1 ;
but_close2.Adjust() ;
Script_Read_Line( "morpho: close 2" ) ;
but_close2.Cur_Value = 0 ;
but_close2.Adjust() ;
return( 1 ) ;
}
return( 0 ) ;
}
...
|