Beispiel #1
0
OpState OpSnapToObjects::GetState(String_256*, OpDescriptor*)
{
	OpState OpSt;

	DocView *pDocView = DocView::GetSelected();
	if (pDocView != NULL)
		OpSt.Ticked = pDocView->GetSnapToObjectsState();
	
	return OpSt;
}
Beispiel #2
0
void OpSnapToObjects::Do(OpDescriptor*)
{
	DocView *pDocView = DocView::GetSelected();

	if (pDocView != NULL)
	{
		// Find out the new value for the magnetic snapping
		BOOL NewState = !pDocView->GetSnapToObjectsState();
		pDocView->SetSnapToObjectsState(NewState);

		// update all slider controls that show the view quality
		OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_SNAPTOOBJECTS);
		if (pOpDesc!=NULL)
		{
			// Found the opdescriptor. Now find all the gadgets associated with it
			List Gadgets;
			if (pOpDesc->BuildGadgetList(&Gadgets))
			{
				// Found some. Set the controls position according to the quality
				GadgetListItem* pGadgetItem = (GadgetListItem*) Gadgets.GetHead();

				while (pGadgetItem!=NULL)
				{
					// Set the sliders position
					pGadgetItem->pDialogOp->SetLongGadgetValue(pGadgetItem->gidGadgetID, NewState, FALSE);

					// go find the next gadget
					pGadgetItem = (GadgetListItem*) Gadgets.GetNext(pGadgetItem);
				}
		
				// Clean out the list
				Gadgets.DeleteAll();
			}
		}
	}

	End();
}