Hi Sander,
void ProfileInterface::DynamicMouseMove( View& v, const DPoint& p, int button, unsigned buttons, unsigned modifiers )
The signature of this function is different from ProcessingInterface::DynamicMouseMove(). Hence, you're overloading that function with a non-virtual member function of your ProfileInterface class, which the core won't call because it doesn't know anything about it.
The correct signature is:
void ProfileInterface::DynamicMouseMove( View& v, const DPoint& p, unsigned buttons, unsigned modifiers )
where there is no "int button" argument (which doesn't make sense in a mouse move event handler). When reimplementing PCL's virtual functions, you must be careful not to overload them with different function signatures; the number, order and type of parameters must be exactly the same as in the original members.
struct Flags
{
bool moving : 1; // moving the cropping rectangle
bool movingCenter : 1; // moving the center of rotation
bool rotating : 1; // rotating the cropping rectangle
bool resizing : 1; // resizing the cropping rectangle
bool resizeLeft : 1; // resizing on left edge
bool resizeTop : 1; // resizing on top edge
bool resizeRight : 1; // resizing on right edge
bool resizeBottom : 1; // resizing on bottom edge
int : 24;
Flags() { *reinterpret_cast<uint32*>( this ) = 0; }
Flags( const Flags& x )
{ *reinterpret_cast<uint32*>( this ) = *reinterpret_cast<const uint32*>( &x ); }
bool operator ==( const Flags& x ) const
{ return *reinterpret_cast<const uint32*>( this ) == *reinterpret_cast<const uint32*>( &x ); }
};
Phew!
Sorry, I usually tend to be a bit less cryptic. The above code is indeed tricky. But it has nothing to do with communication between the module and PI; it's just an internal control structure of DC.
This is a less wild version of the above code:
union Flags
{
struct
{
bool moving : 1; // moving the cropping rectangle
bool movingCenter : 1; // moving the center of rotation
bool rotating : 1; // rotating the cropping rectangle
bool resizing : 1; // resizing the cropping rectangle
bool resizeLeft : 1; // resizing on left edge
bool resizeTop : 1; // resizing on top edge
bool resizeRight : 1; // resizing on right edge
bool resizeBottom : 1; // resizing on bottom edge
int : 24;
}
bits;
uint32 allBits;
Flags() { allBits = 0; }
Flags( const Flags& x ) { allBits = x.allBits; }
bool operator ==( const Flags& x ) const { return allBits == x.allBits; }
};
which of course requires changing all instances of "flags." to "flags.bits." in DynamicCropInterface.cpp.
void DynamicCropInterface::DynamicMouseEnter( View& v )
{
if ( view == 0 || v != *view )
return;
// Force a dynamic cursor update upon subsequent mouse move event.
flags = Flags();
}
By assigning a default Flags instance to flags (which actually clears all flags) we ensure that this code:
Flags f = OperationInfo( p );
if ( f != flags )
{
flags = f;
UpdateDynamicCursor();
}
will call UpdateDynamicCursor() if necessary to keep the cursor's shape coherent with its current position. Just a graphics workflow technique that I often use. As you say, this has no repercussion to communication with PI core.