本文整理汇总了C++中GraphicView类的典型用法代码示例。如果您正苦于以下问题:C++ GraphicView类的具体用法?C++ GraphicView怎么用?C++ GraphicView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GraphicView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RecurPopupInclude
Control* NarrowTool::CreateViewEntry (Selection* s, Editor* ed) {
Control* ctrl = nil;
Iterator i;
if (s->Number() >= 1) {
H_PopupMenu* popup = new H_PopupMenu;
ctrl = popup;
s->First(i);
GraphicComp* kid = s->GetView(i)->GetGraphicComp();
RecurPopupInclude(ed, popup, kid);
popup->LockPosition();
for (;!s->Done(i); s->Next(i)) {
GraphicView* gv = s->GetView(i);
GraphicComp* parent = gv->GetGraphicComp();
if (parent->IsA(SCENE_COMP) || parent->IsA(IGRAPHIC_COMPS)){
GraphicComp* mykid = nil;
Iterator j(i);
s->Next(j);
if (!s->Done(j)) {
mykid = (GraphicComp*) s->GetView(j)->GetGraphicComp();
}
NavigateCmd* cmd = new NavigateCmd(ed, false, parent, mykid);
popup->Include(new CommandItem(GetName(parent), Center, cmd));
}
}
}
return ctrl;
}
示例2: CreateManipulator
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;
}
示例3: GetSelection
void Viewer::Update () {
Selection* s = GetSelection();
GraphicView* view = GetGraphicView();
Component* viewComp = view->GetGraphicComp();
Component* edComp = _editor->GetComponent();
if (viewComp != edComp) {
ComponentView* newView = edComp->Create(ViewCategory());
if (newView->IsA(GRAPHIC_VIEW)) {
edComp->Attach(newView);
newView->Update();
SetGraphicView((GraphicView*) newView);
} else {
delete newView;
}
} else {
s->Hide(this);
_viewerView->Update();
GraphicBlock::UpdatePerspective();
_damage->Repair();
s->Show(this);
}
}
示例4: Localize
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;
}
示例5: CreateLinkCompManip
Manipulator* LinkView::CreateLinkCompManip (
Viewer* v, Event& e, Transformer* rel, Tool* tool
) {
GraphicView* views = v->GetGraphicView();
Selection* s = v->GetSelection();
RubberGroup* rg = new RubberGroup(nil, nil);
float x, y, tx, ty;
Coord cx = 0, rad = PIN_RAD, dum1 = 0, dum2 = 0;
ConnectorView* target = views->ConnectorIntersecting(
e.x-SLOP, e.y-SLOP, e.x+SLOP, e.y+SLOP
);
s->Clear();
if (target != nil) {
target->GetConnector()->GetCenter(x, y);
rel->Transform(x, y, tx, ty);
e.x = Math::round(tx);
e.y = Math::round(ty);
}
if (rel != nil) {
rel->Transform(cx, dum1);
rel->Transform(rad, dum2);
rad = abs(rad - cx);
}
rg->Append(
new RubberLine(nil, nil, e.x, e.y, e.x, e.y),
new FixedPin(nil, nil, e.x, e.y, rad),
new SlidingPin(nil, nil, e.x, e.y, rad, e.x, e.y)
);
return new ConnectManip(v, rg, rel, tool);
}
示例6: GetViewer
boolean ConnectManip::Manipulating (Event& e) {
GraphicView* views = GetViewer()->GetGraphicView();
Rubberband* r = GetRubberband();
float cx, cy;
if (r == nil) {
return false;
}
if (e.eventType == MotionEvent) {
_target = views->ConnectorIntersecting(
e.x-SLOP, e.y-SLOP, e.x+SLOP, e.y+SLOP
);
if (_target == nil) {
r->Track(e.x, e.y);
} else {
_target->GetGraphic()->GetCenter(cx, cy);
r->Track(Math::round(cx), Math::round(cy));
}
} else if (e.eventType == UpEvent) {
r->Erase();
return false;
}
return true;
}
示例7: ComputeViewPath
Manipulator* ExamineTool::CreateManipulator (
Viewer* v, Event& e, Transformer* t
){
GraphicView* views = v->GetGraphicView();
Selection* s = v->GetSelection();
_selPath = new Selection;
Manipulator* m = nil;
s->Clear();
ComputeViewPath(e, views, _selPath);
_shift = e.shift_is_down();
if (!_selPath->IsEmpty()) {
Iterator i;
_selPath->First(i);
GraphicView* gv = _selPath->GetView(i);
s->Append(gv);
s->Update();
_selPath->Last(i);
gv = _selPath->GetView(i);
m = gv->CreateManipulator(v, e, t, this);
}
delete _selPath;
return m;
}
示例8: CreateManipulator
Manipulator* TabTool::CreateManipulator (
Viewer* v, Event& e, Transformer* rel
) {
Iterator i;
Selection* s = v->GetSelection();
s->First(i);
GraphicView* gv = s->GetView(i);
return gv->CreateManipulator(v, e, rel, this);
}
示例9: GetView
void Selection::Hide (Viewer* viewer) {
Iterator i;
for (First(i); !Done(i); Next(i)) {
GraphicView* view = GetView(i);
if (viewer == nil || view->GetViewer() == viewer) {
view->EraseHandles();
}
}
}
示例10: SelectViewsOf
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);
}
}
示例11: First
void Selection::Clear (Viewer* viewer) {
Iterator i;
First(i);
while (!Done(i)) {
GraphicView* view = GetView(i);
if (viewer == nil || view->GetViewer() == viewer) {
view->EraseHandles();
}
Remove(i);
}
}
示例12: Localize
void SelectTool::Localize (Selection* s, Viewer* v) {
Iterator i;
for (s->First(i); !s->Done(i);) {
GraphicView* view = s->GetView(i);
if (view->GetViewer() != v) {
s->Remove(i);
view->EraseHandles();
} else {
s->Next(i);
}
}
}
示例13: SelectClipboard
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();
}
示例14: InterpretManipulator
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;
}
示例15: Exclusive
void Selection::Exclusive (Selection* s) {
Iterator i;
GraphicView* gv;
for (s->First(i); !s->Done(i); s->Next(i)) {
gv = GetView(i);
if (Includes(gv)) {
Remove(gv);
gv->EraseHandles();
} else {
Append(gv);
}
}
Update();
}