Manipulator* ScaleTool::CreateManipulator ( Viewer* v, Event& e, Transformer* rel ) { GraphicView* views = v->GetGraphicView(); Selection* s = v->GetSelection(), *newSel; GraphicView* gv; Manipulator* m = nil; Iterator i; newSel = views->ViewIntersecting(e.x-SLOP, e.y-SLOP, e.x+SLOP, e.y+SLOP); if (newSel->IsEmpty()) { s->Clear(); } else { newSel->First(i); gv = newSel->GetView(i); if (s->Includes(gv)) { s->Remove(gv); s->Prepend(gv); } else { s->Clear(); s->Append(gv); s->Update(); } m = gv->CreateManipulator(v, e, rel, this); } delete newSel; return m; }
Manipulator* AttributeTool::CreateManipulator ( Viewer* v, Event& e, Transformer* rel ) { Manipulator* m = nil; GraphicView* views = v->GetGraphicView(); Selection* s = v->GetSelection(), *newSel; newSel = views->ViewIntersecting(e.x-SLOP, e.y-SLOP, e.x+SLOP, e.y+SLOP); if (e.shift) { Localize(s, v); } else { s->Clear(); } if (newSel->IsEmpty()) { // do nothing } else { // else user selected object directly s->Exclusive(newSel); } delete newSel; if (s->Number() == 1) { Iterator i; s->First(i); GraphicView* view = s->GetView(i); if (view->IsA(OVERLAY_VIEW)) { ((OverlayEditor*)v->GetEditor())->MouseDocObservable()->textvalue(""); ((OverlayEditor*)v->GetEditor())->AttrEdit(((OverlayView*)view)->GetOverlayComp()); ((OverlayEditor*)v->GetEditor())->MouseDocObservable()->textvalue(OverlayKit::mouse_attr); } } return m; }
Manipulator* SelectTool::CreateManipulator ( Viewer* v, Event& e, Transformer* rel ) { Manipulator* m = nil; GraphicView* views = v->GetGraphicView(); Selection* s = v->GetSelection(), *newSel; newSel = views->ViewIntersecting(e.x-SLOP, e.y-SLOP, e.x+SLOP, e.y+SLOP); if (e.shift) { Localize(s, v); } else { s->Clear(); } if (newSel->IsEmpty()) { // select w/RubberRect if nothing hit m = new DragManip(v, new RubberRect(nil,nil, e.x,e.y,e.x,e.y), rel); } else { // else user selected object directly s->Exclusive(newSel); } delete newSel; return m; }