BOOL CTinyCadDoc::OnNewDocument() { BOOL bReturn = super::OnNewDocument(); if( bReturn ) { GetDetails().Reset(); SetPart(0); SelectObject(new CDrawEditItem(this)); UnSelect(); // Remove all objects from memory for( drawingIterator i = GetDrawingBegin(); i != GetDrawingEnd(); i++ ) { CDrawingObject* pointer = *i; delete pointer; } m_drawing.clear(); // Now delete the Redo List m_undo_level = 0; m_change_set = FALSE; FlushRedo(); m_undo_level = 0; NameDir = 1; PinDir = 1; part = 0; show_power = FALSE; } return bReturn; }
void ApiSetPart(DWORD *argv) { if ((argv[MSG_ATTR_ID] & MSG_MAP_MASK) != MSG_ATTR_ROMAP) return; if (argv[MSG_SIZE_ID] < sizeof(PART_INFO)) { argv[MSG_RES_ID] = FS_ERR_WRONG_ARGS; KUnmapProcAddr((void*)argv[MSG_ADDR_ID], argv); return; } argv[MSG_RES_ID] = SetPart(argv[3], (PART_INFO*)argv[MSG_ADDR_ID]); KUnmapProcAddr((void*)argv[MSG_ADDR_ID], argv); }
void PartKeyFrames::Load(FileNode *fileNode) { int id = -1; fileNode->Read("id", id); SetPart(puppet->GetPartByID(id)); }
void Set(Var x, Var y) { if(SymQ(x)) { OwnValues[x] = y; } else if(VecQ(x) && VecQ(y)) { size_t n = Size(x); size_t ny = Size(y); if (ny < n) { for (size_t i = 0; i < ny; ++i) Set(At(x,i),At(y,i)); for (size_t i = ny; i < n; ++i) Set(At(x,i),At(y,ny - 1)); } else { for (size_t i = 0; i < n; ++i) Set(At(x,i),At(y,i)); } } else if(ExQ(x)) { var head = Eval(Head(x)); if(SymQ(head)) { var body = Body(x); if(head == TAG(Part)) { SetPart(body, y); } else if(head == TAG(Property)) { if(SymQ(At(body,0)) && SymQ(At(body,1))) Properties[At(body,0)][At(body,1)] = y; } else if (head == TAG(Condition)) { SetConditionDownValue(body, y); } else if (head == TAG(DownValues)) { SetDownValues(At(body,0), y); } else { body = Eval(body); if(FixQ(body)) { FactValues[head][body] = y; } else { SetDownValue(head, body, y); } } } else if(ExQ(head) && SymQ(Head(head))) { var body = Body(x); SetSubValue(head, body, y); } else { // TODO: more specific exception class throw LogicError(L"no assignment performed!"); } } else { // TODO: more specific exception class throw LogicError(L"no assignment performed!"); } }