OpState OpSnapToGuides::GetState(String_256* pUIDescription, OpDescriptor*) { OpState OpSt; DocView *pDocView = DocView::GetSelected(); if (pDocView != NULL) OpSt.Ticked = pDocView->GetSnapToGuidesState(); Spread* pSpread = Document::GetSelectedSpread(); if (pSpread != NULL) { // if we have a guide layer, then make the menu item available, if not, grey it // and give a reason. if (pSpread->FindFirstGuideLayer() != NULL) { OpSt.Greyed = FALSE; } else { OpSt.Greyed = TRUE; *pUIDescription = String_256 (_R(IDS_NO_GUIDES)); } } return OpSt; }
void OpSnapToGuides::Do(OpDescriptor*) { DocView *pDocView = DocView::GetSelected(); if (pDocView != NULL) pDocView->SetSnapToGuidesState(!pDocView->GetSnapToGuidesState()); End(); }