void UpdateCursorAreas() { INT32 x, y, iMapIndex; RemoveCursors(); EnsureSelectionType(); //Determine if the mouse is currently in the world. if( gViewportRegion.uiFlags & MSYS_MOUSE_IN_AREA && GetMouseXY( &sGridX, &sGridY ) ) { iMapIndex = MAPROWCOLTOPOS( sGridY, sGridX ); if( gpBuildingLayoutList ) { gSelectRegion.iLeft = gSelectRegion.iRight = sGridX; gSelectRegion.iTop = gSelectRegion.iBottom = sGridY; fValidCursor = TRUE; DrawBuildingLayout( iMapIndex ); } else switch( gusSelectionType ) { case SMALLSELECTION: gSelectRegion.iLeft = gSelectRegion.iRight = sGridX; gSelectRegion.iTop = gSelectRegion.iBottom = sGridY; fValidCursor = TRUE; break; case MEDIUMSELECTION: case LARGESELECTION: case XLARGESELECTION: //The mouse mode value reflects the size of the cursor. gSelectRegion.iTop = sGridY - gusSelectionType; gSelectRegion.iBottom = sGridY + gusSelectionType; gSelectRegion.iLeft = sGridX - gusSelectionType; gSelectRegion.iRight = sGridX + gusSelectionType; ValidateSelectionRegionBoundaries(); fValidCursor = TRUE; break; case LINESELECTION: fValidCursor = HandleAreaSelection(); ForceAreaSelectionWidth(); ValidateSelectionRegionBoundaries(); break; case AREASELECTION: fValidCursor = HandleAreaSelection(); break; } } //Draw all of the area cursors here. if( fValidCursor ) { if( iDrawMode == DRAW_MODE_ENEMY || iDrawMode == DRAW_MODE_CREATURE || iDrawMode == DRAW_MODE_REBEL || iDrawMode == DRAW_MODE_CIVILIAN || iDrawMode == DRAW_MODE_SCHEDULEACTION ) { iMapIndex = gSelectRegion.iTop * WORLD_COLS + gSelectRegion.iLeft; if( !IsLocationSittable( iMapIndex, gfRoofPlacement ) && iDrawMode != DRAW_MODE_SCHEDULEACTION || !IsLocationSittableExcludingPeople( iMapIndex, gfRoofPlacement ) && iDrawMode == DRAW_MODE_SCHEDULEACTION ) { if( sBadMarker != iMapIndex ) { RemoveBadMarker(); if( gfRoofPlacement && FlatRoofAboveGridNo( iMapIndex ) ) { AddTopmostToTail( iMapIndex + ROOF_OFFSET, BADMARKER1 ); sBadMarker = (INT16)(iMapIndex + ROOF_OFFSET ); } else { AddTopmostToTail( (iMapIndex), BADMARKER1 ); sBadMarker = (INT16)(iMapIndex); } } } else { RemoveBadMarker(); if( gfRoofPlacement && FlatRoofAboveGridNo( iMapIndex ) ) { AddTopmostToTail( iMapIndex + ROOF_OFFSET, FIRSTPOINTERS5 ); gfUsingOffset = TRUE; } else AddTopmostToTail( iMapIndex, FIRSTPOINTERS1 ); } } else for( y = gSelectRegion.iTop; y <= gSelectRegion.iBottom; y++ ) { for( x = gSelectRegion.iLeft; x <= gSelectRegion.iRight; x++ ) { iMapIndex = y * WORLD_COLS + x; AddTopmostToTail( iMapIndex, FIRSTPOINTERS1 ); } } } }
void LiveEffectsTool::SelectChange(BOOL isSelected) { // Stub out this function if the tool isn't wanted #ifndef NO_ADVANCED_TOOLS if (isSelected) { //MessageBox(NULL, "SelectChange 1", "Debug", MB_OK); // Load the cursors if (!LoadCursors()) InformError(); // Update the list of plug-ins //MessageBox(NULL, "SelectChange 2", "Debug", MB_OK); XPEHost::UpdateEditorsList(); //MessageBox(NULL, "SelectChange 3", "Debug", MB_OK); SelRange* pSelRange = GetApplication()->FindSelection(); if (pSelRange) pSelRange->MakePartialSelectionWhole(TRUE, FALSE, TRUE); ScreenChanged(FALSE); //MessageBox(NULL, "SelectChange 4", "Debug", MB_OK); // Find the blob manager ready for later BlobManager* BlobMgr = GetApplication()->GetBlobManager(); // Create and display my info bar please if (m_pInfoBarOp != NULL) { m_pInfoBarOp->Create(); m_pInfoBarOp->SetToolActiveState(TRUE); } // Make sure that Objects blobs are on if (BlobMgr != NULL) { // Decide which blobs to display BlobStyle MyBlobs; MyBlobs.Object = TRUE; // tell the blob manager BlobMgr->ToolInterest(MyBlobs); } //MessageBox(NULL, "SelectChange 5", "Debug", MB_OK); } else { // Deselection of the tool // Get rid of all the tools cursors RemoveCursors(); // Close any open XPE editing XPEHost::EndEditLiveEffect(); // Hide and destroy my info bar please if (m_pInfoBarOp != NULL) { m_pInfoBarOp->SetToolActiveState(FALSE); // Close any open dialogs related to the info bar here m_pInfoBarOp->Delete(); } // ensure that the colour picker is working // SetColourEditorProcessing(TRUE); // ensure any tool object blobs are removed. BlobManager* BlobMgr = GetApplication()->GetBlobManager(); if (BlobMgr != NULL) { BlobStyle bsRemoves; bsRemoves.ToolObject = TRUE; BlobMgr->RemoveInterest(bsRemoves); } } #endif // NO_ADVANCED_TOOLS }