void CEditorParam::CreateFromString(CString src, CApplication* pApp, int type, CString reserved, bool exporting) { m_type = type; m_reserved = reserved; /////////////////// // Object types /////////////////// CObjTypeMap& typemap = pApp->object_types; int unused; // Tokenise the expression with editormode CExpression tokeniser; tokeniser.pCallerType = pApp->FindObjTypeFromNumber(oid); tokeniser.oidCaller = oid; tokeniser.ParseUserString(src, &unused, !exporting); ttokens = tokeniser.toks; ProcessEdittimeExpressionInformation(ttokens, pApp, oid); /* // Davo's version tokens.clear(); // We need to create CString copy; copy = src; char* f = copy.LockBuffer(); char* c = f; char* tmp = c; CString name; CString tok; bool quote = false; while((char)(*c)) // c has not reached null { name = ""; // test if we are reading a name if( *c == '"') quote = 1 - quote; while(CharPartOfName(*c) && !quote) // post incr c { name += (char)(*c); c++; } if(name != "") { long number; bool found = false; POSITION pos = typemap.GetStartPosition(); CObjType* obj; bool IsFamily = false; while(pos) { typemap.GetNextAssoc(pos, number, obj); if(obj->m_name == name) { found = true; break; } } for(list<CFamily>::iterator i = pApp->m_Families.begin(); i != pApp->m_Families.end(); i++) { CString l = i->m_Name; CString r = name; l.MakeLower(); r.MakeLower(); if(l == r) { found = true; IsFamily = true; break; } } if(found) // we have found an object name { //save last token if(tok != "") { CEditorParamToken token; token.tok = tok; token.type = PTOK_STRING; token.trans = true; tokens.push_back(token); } // now record the object name if(IsFamily) // family { CEditorParamToken token; token.tok = name; token.type = PTOK_FAMILYNAME; token.trans = true; tokens.push_back(token); } else // object { CEditorParamToken token; token.tok.Format("%d", number); token.type = PTOK_OBJECTNAME; token.trans = true; tokens.push_back(token); } //Clear tokens name = ""; tok = ""; } tok += name; } tok += (char)(*c); //next letter unless we have already reached it if((char)(*c)) c++; } //save last token if(tok != "") { CEditorParamToken token; token.tok = tok; token.type = PTOK_STRING; token.trans = true; tokens.push_back(token); } copy.ReleaseBuffer(); */ }