static void DetachComponentViews (Editor* ed) { int i = 0; Viewer* viewer; Component* comp = ed->GetComponent(); if (comp != nil) { while ((viewer = ed->GetViewer(i++)) != nil) { GraphicView* gv = viewer->GetGraphicView(); comp->Detach(gv); } } }
void OverlaysComp::SelectViewsOf (OverlayComp* comp, Editor* ed) { Selection* s = ed->GetSelection(); s->Clear(); Viewer* viewer; for (int i = 0; (viewer = ed->GetViewer(i)) != nil; ++i) { GraphicView* views = viewer->GetGraphicView(); GraphicView* view = views->GetGraphicView(comp); if (view != nil) s->Append(view); } }
Command* SelectTool::InterpretManipulator (Manipulator* m) { DragManip* dm = (DragManip*) m; Viewer* viewer = dm->GetViewer(); GraphicView* views = viewer->GetGraphicView(); Selection* s = viewer->GetSelection(); RubberRect* rr = (RubberRect*) dm->GetRubberband(); Selection* newSel; Coord l, b, r, t; rr->GetCurrent(l, b, r, t); newSel = views->ViewsWithin(l, b, r, t); s->Exclusive(newSel); delete newSel; return nil; }
void OverlaysComp::SelectClipboard (Clipboard* cb, Editor* ed) { Selection* s = ed->GetSelection(); s->Clear(); Viewer* viewer; Iterator i; for (int j = 0; (viewer = ed->GetViewer(j)) != nil; ++j) { for (cb->First(i); !cb->Done(i); cb->Next(i)) { GraphicView* views = viewer->GetGraphicView(); GraphicView* view = views->GetGraphicView(cb->GetComp(i)); if (view != nil) s->Append(view); } } ((OverlaySelection*)s)->Reserve(); }
Command* LinkView::InterpLinkCompManip (Manipulator* m) { Viewer* v = m->GetViewer(); Editor* ed = v->GetEditor(); GraphicView* views = v->GetGraphicView(); BrushVar* brVar = (BrushVar*) ed->GetState("BrushVar"); ConnectManip* cm = (ConnectManip*) m; Transformer* rel = cm->GetTransformer(); RubberGroup* rg = (RubberGroup*) cm->GetRubberband(); RubberLine* rl = (RubberLine*) rg->First(); Coord x0, y0, x1, y1; Connector* c1, *c2; ConnectorView* target1, *target2; MacroCmd* macro = new MacroCmd(ed); rl->GetCurrent(x0, y0, x1, y1); if (rel != nil) { rel = new Transformer(rel); rel->Invert(); } Graphic* pg = GetGraphicComp()->GetGraphic(); Line* line = new Line(x0, y0, x1, y1, pg); if (brVar != nil) line->SetBrush(brVar->GetBrush()); line->SetTransformer(rel); Unref(rel); LinkComp* linkComp = NewSubject(line); linkComp->GetConnectors(c1, c2); macro->Append(new PasteCmd(ed, new Clipboard(linkComp))); target1 = views->ConnectorIntersecting(x0-SLOP, y0-SLOP, x0+SLOP, y0+SLOP); target2 = views->ConnectorIntersecting(x1-SLOP, y1-SLOP, x1+SLOP, y1+SLOP); if (target1 != nil) { macro->Append(new ConnectCmd(ed, c1, target1->GetConnector())); } if (target2 != nil) { macro->Append(new ConnectCmd(ed, c2, target2->GetConnector())); } return macro; }