예제 #1
0
파일: viewer.cpp 프로젝트: PNCG/neuron
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);
    }
}
예제 #2
0
void AttributeValue::dup_as_needed() {
  if (_type == AttributeValue::ArrayType) {
    AttributeValueList* avl = _v.arrayval.ptr;
    _v.arrayval.ptr = new AttributeValueList(avl);
    Resource::ref(_v.arrayval.ptr);
    Resource::unref(avl);
  } else if (_type == AttributeValue::StreamType) {
    AttributeValueList* avl = _v.streamval.listptr;
    _v.streamval.listptr = new AttributeValueList(avl);
    Resource::ref(_v.streamval.listptr);
    Resource::unref(avl);
  } 
#ifdef RESOURCE_COMPVIEW
  else if (_type == AttributeValue::ObjectType && object_compview()) {
    ComponentView* oldview = (ComponentView*)_v.objval.ptr;
    Component* subject = oldview->GetSubject();
    ComponentView* newview = oldview->Duplicate();
    newview->SetSubject(subject);
    subject->Attach(newview);
    _v.objval.ptr = newview;
    Resource::ref(newview);
    Resource::unref(oldview);
  }
#endif
}