Exemplo n.º 1
0
MStatus marqueeContext::doPress( MEvent & event )
//
// Begin marquee drawing (using OpenGL)
// Get the start position of the marquee 
//
{

		// Figure out which modifier keys were pressed, and set up the
	// listAdjustment parameter to reflect what to do with the selected points.
	if (event.isModifierShift() || event.isModifierControl() ) {
		if ( event.isModifierShift() ) {
			if ( event.isModifierControl() ) {
				// both shift and control pressed, merge new selections
				listAdjustment = MGlobal::kAddToList;
			} else {
				// shift only, xor new selections with previous ones
				listAdjustment = MGlobal::kXORWithList;
			}
		} else if ( event.isModifierControl() ) {
			// control only, remove new selections from the previous list
			listAdjustment = MGlobal::kRemoveFromList; 
		}
	} else {
		listAdjustment = MGlobal::kReplaceList;
	}

	// Extract the event information
	//
	event.getPosition( start_x, start_y );

	// Enable OpenGL drawing on viewport
	view = M3dView::active3dView();
	view.beginGL();

#ifdef USE_SOFTWARE_OVERLAYS
	p_last_x = start_x;
	p_last_y = start_y;

	fsDrawn = false;
#else
	// If HW overlays supported then initialize the overlay plane for drawing.
	view.beginOverlayDrawing();
#endif

	return MS::kSuccess;		
}