Esempio n. 1
0
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);
    }
}
void THISCLASS::ConfigurationReadXMLElement(wxXmlNode* node, ErrorList *xmlerr) {
	if (! node) {
		return;
	}

	// Get the type attribute
	wxString type;
	wxXmlProperty *prop = node->GetProperties();
	while (prop) {
		if (prop->GetName() == wxT("type")) {
			type = prop->GetValue();
		}
		prop = prop->GetNext();
	}
	if (type.Len() == 0) {
		xmlerr->Add(wxT("A component was ignored because it does not have a 'type' attribute."), 0);
		return;
	}

	// Search for the component
	Component *component = mSwisTrackCore->GetComponentByName(type);
	if (! component) {
		xmlerr->Add(wxT("The component '") + type + wxT("' was ignored because there is no component with this name."), 0);
		return;
	}

	// Add it to the list
	Component *newcomponent = component->Create();
	mSwisTrackCore->mDeployedComponents.push_back(newcomponent);
	ComponentEditor ce(newcomponent);
	ce.ConfigurationReadXML(node, xmlerr);
}