void CEC_FinalConc::BuildDataDefn(DataDefnBlk & DDB) { Strng T; T.Set("Final Conc %s", m_Spc.m_Name()); DDB.Text (T()); DDEF_Flags VFlags=DDB.GetVisibility(); DDB.String("ExtentType", "", DC_, "", xid_RCTExtentType, &Eq, SetOnChange|isParm, DDBExtentTypes); DDB.SetVisibility(VFlags); if (m_Spc.m_ReactTerm>=0 || m_Spc.m_ProdTerm>=0) { CCnvIndex dc; pchar pCnvTxt; SDB.AddSpCnv(DC_Conc, SDB[m_Spc.m_SpcId].SymOrTag(), "g/L", dc, pCnvTxt); Strng S,C("Rct"),R("Reqd"); if (Valid(m_dRqdTemp)) S.Set("@%.2f", K2C(m_dRqdTemp)); else S="@FinalT"; C+=S; R+=S; m_ddRqdConc.BuildDataDefn(DDB, "Conc_Rqd", "", dc, pCnvTxt, xid_RCTExtent, &Eq, C(), R()); DDB.Double("Conc_MeasTemp", "", DC_T, "C", xid_RCTFinalConcT, &Eq, isResult|noFile|noSnap|InitHidden); DDB.Double("Conc_EOStep", "Conc_Act", DC_, "", &m_dKEOStep, &Eq, isResult); DDB.TagComment(S()); DDB.Double("Conc_Final", "", DC_, "", &m_dKFinal, &Eq, isResult|NAN_OK); DDB.TagComment(S()); DDB.Double("ExtentError", "", DC_Frac, "%", xid_ExtentError, &Eq, isResult|noFile|noSnap|NAN_OK); } };
void CCopyTagBlkDlg::BldTreeSelList(HTREEITEM h, char* TagPrefix, int& Cnt, CSVector& List) { CString s; int i; while (h) { BOOL b = m_CopyTree.GetItemSelected(h); if (b) { //rAccNdData d = AW.Data[LOWORD(dw)]; //s = d.sFullTag(); s = m_CopyTree.GetItemText(h); i = s.Find(" ("); if (i>=0) s = s.Left(i); List[Cnt].Set("%s%s", TagPrefix, (const char*)s); Cnt++; } if (m_CopyTree.ItemHasChildren(h)) { if (!b) { s = m_CopyTree.GetItemText(h); i = s.Find(" ("); if (i>=0) s = s.Left(i); } Strng ss; ss.Set("%s%s.", TagPrefix, (const char*)s); BldTreeSelList(m_CopyTree.GetChildItem(h), ss(), Cnt, List); } h = m_CopyTree.GetNextSiblingItem(h); } }
void CEC_FracExt::SetUp() { flag OK=m_Spc.SetUp(RB, Eq); //if (RB.m_RctBase->Nd()) { if (m_bDoRate && RB.Nd()->SolveDirectMethod()) { CReactionBlock::Error(&RB, 'B', -1, "Extent:Fraction with 'Rate' not allowed in Direct (no surge) solver mode"); } else if (m_bDoRate && !RB.UsingStateSemantics()) { CReactionBlock::Error(&RB, 'B', -1, "'Rate' only allowed in surge unit"); } else if (!m_bDoRate && RB.Nd()->NetDynamicMethod() && RB.UsingStateSemantics()) { CReactionBlock::Error(&RB, 'B', -1, "Extent:Fraction requires 'Rate' term in surge unit in dynamic mode"); } } if (OK) { if (m_Spc.m_ReactTerm<0) { Strng S; S.Set("Fraction specie %s not a Reactant", m_Spc.m_Name()); CReactionBlock::Error(&RB, 'B', -1, S()); } CEqnSpRef RSpc(m_Spc.m_Name()); OK=RSpc.SetUp(RB, Eq); // Set Extent Reqd Eq.SetExtent(RSpc.m_SpcId, m_dRqdExtentLcl); } };
void CCopyBlock::BuildBlockTagsList(char* ModelClass, char* BlockName, BOOL FromDatalib, CSVector& List) { int Cnt = 0; List.SetSize(16); Strng Section; Section.Set("%s(%s)", BlockName, ModelClass); char Buff[16384]; CProfINIFile PF(FromDatalib ? CfgFiles() : PrjFiles(), (char*)CopyBlkFileName); CheckCopyBlockVer(PF); DWORD dw = PF.RdSection(Section(), Buff, sizeof(Buff)); ASSERT(dw<sizeof(Buff)-2); //section too large!!! char* p = Buff; while (p[0]) { int len = strlen(p); char* Nextp = p; Nextp += (len + 1); char* pp = strchr(p, '='); if (pp) { if (Cnt>=List.GetSize()) List.SetSize(List.GetSize()+8); pp[0] = 0; char* pValue = &pp[1]; char* ppp = strchr(p, '.'); if (ppp) List[Cnt].Set("x%s (%s)", ppp, pValue); else List[Cnt].Set("%s (%s)", p, pValue); Cnt++; } p = Nextp; } List.SetSize(Cnt); }
void CEC_FracExt::BuildDataDefn(DataDefnBlk & DDB) { Strng T; T.Set("Fractional Extent %s", m_Spc.m_Name()); if (m_bStablize) T += " (Stabilised)"; DDB.Text (T()); DDEF_Flags VFlags=DDB.GetVisibility(); DDB.String("ExtentType", "", DC_, "", xid_RCTExtentType, &Eq, SetOnChange|isParm, DDBExtentTypes); DDB.SetVisibility(VFlags); if (m_iXSpcId>=0) { DDB.String("ExtentSpc", "", DC_, "", &m_sExtentSpc, &Eq, 0|InitHidden|noFileAtAll); CCnvIndex dc; pchar pCnvTxt; SDB.AddSpCnv(DC_Frac, SDB[m_iXSpcId].SymOrTag(), "%", dc, pCnvTxt); m_ddExtentRqd.BuildDataDefn(DDB, "Extent", "", dc, pCnvTxt, xid_RCTExtent, &Eq, "Rct", "Reqd"); DDB.Double("ExtentAchieved", "", DC_Frac, "%", &m_dKEOStep, &Eq, isResult); if (!DynamicRate()) DDB.Double("ExtentError", "", DC_Frac, "%", xid_ExtentError, &Eq, isResult|noFile|noSnap|InitHidden|NAN_OK); else { if (m_bDoRate) { m_ddFracRate.BuildDataDefn(DDB, "Rate", "", DC_FracRate, "%/s", xid_RCTFracRate, &Eq, "Rct", "Reqd"); } } } }
void DocRoot::SetPathName(LPCTSTR pszPathName, BOOL bAddToMRU/* = TRUE*/) { Strng T; T.FnExt((pchar)pszPathName); CDocument::SetPathName(pszPathName, (_stricmp(T() ? T():"", ".spj")==0)); CExploreScd::RefreshIt(true); }
void MRngChkCntxt::AddRngChkMsg(LPCSTR Name, TaggedObject * pSrc, LPCSTR Msg) { MRngChkItem * pItem = FindItem(Name, pSrc->FullObjTag()); bool IsNew = pItem->m_Iter != gs_RngChecks.m_Iter; if (IsNew) { pItem->m_iCnv = 0; pItem->m_IsMsg = true; pItem->m_LTMin = false; pItem->m_GTMax = false; pItem->m_Iter = gs_RngChecks.m_Iter; pItem->m_sMsg = Msg; if (m_Iter!=gs_RngChecks.m_Iter) { if (m_pObject) { m_pObject->ClrCI(1); for (int i=0; i<m_ValidCount; i++) m_pObject->ClrCI(FirstRngChkCI+i); } m_ValidCount = 1; } else m_ValidCount++; m_Iter=gs_RngChecks.m_Iter; if (m_pObject) { if (sm_iCndRngChks>=CRC_Basic) { m_pObject->SetCI(1); if (sm_iCndRngChks>=CRC_All) { if (IsNew && m_ValidCount<=MaxRngChksPerNode) { pItem->FormatDisplay(0); Strng S; S.Set("Wr\t %s", pItem->m_sDisplay); m_pObject->SetCI(FirstRngChkCI+m_ValidCount-1, "%s", S); } } } } dbgpln("MRngChkMngr::AddRngChkMsg() %4i %08x %-30s %-20s %-20s %s", m_Iter, this, pItem->m_Key.m_sCntxt, pItem->m_Key.m_sName, Name, Msg); } };
void CCopyBlock::RemoveBlock(char* ModelClass, char* BlockName) { Strng s; s.Set("%s(%s)", BlockName, ModelClass); char Buff[16]; for (int i=0; i<2; i++) { CProfINIFile PF(i==0 ? CfgFiles() : PrjFiles(), (char*)CopyBlkFileName); if (CheckCopyBlockVer(PF, true) && PF.RdSection(s(), Buff, sizeof(Buff))>0) { Buff[0] = 0; Buff[1] = 0; PF.WrSection(s(), Buff); } } }
void C2DPoly::Load(FxdEdtInfo &EI, Strng & Str) { if (CurrentBlk(EI)) { switch (EI.FieldId) { case Id_Order: Str.Set("%i", Order); break; } } LoadParmsBlk(EI, Str); }
void CEC_MLFinalFrac::BuildDataDefn(DataDefnBlk & DDB) { Strng T; T.Set("Final Mole %sFraction %s", m_AsTotal?"":"Phase ", m_Spc.m_Name()); DDB.Text (T()); DDEF_Flags VFlags=DDB.GetVisibility(); DDB.String("ExtentType", "", DC_, "", xid_RCTExtentType, &Eq, SetOnChange|isParm, DDBExtentTypes); DDB.SetVisibility(VFlags); if (m_Spc.m_ReactTerm>=0 || m_Spc.m_ProdTerm>=0) { CCnvIndex dc; pchar pCnvTxt; SDB.AddSpCnv(DC_Frac, SDB[m_Spc.m_SpcId].SymOrTag(), "%", dc, pCnvTxt); m_ddRqdFrac.BuildDataDefn(DDB, "Frac_Rqd", "", dc, pCnvTxt, xid_RCTExtent, &Eq, "Rct", "Reqd"); DDB.Double("Frac_EOStep", "Frac_Act", dc, pCnvTxt, &m_dKEOStep, &Eq, isResult); DDB.Double("Frac_Final", "", dc, pCnvTxt, &m_dKFinal, &Eq, isResult|NAN_OK); DDB.Double("ExtentError", "", DC_Frac, "%", xid_ExtentError, &Eq, isResult|noFile|noSnap|NAN_OK); } };
void CCopyBlock::MoveBlockLocation(char* ModelClass, char* BlockName, BOOL ToDatalib) { Strng s; s.Set("%s(%s)", BlockName, ModelClass); char Buff1[16]; CProfINIFile SrcPF(ToDatalib ? CfgFiles() : PrjFiles(), (char*)CopyBlkFileName); if (!CheckCopyBlockVer(SrcPF, true)) return; if (SrcPF.RdSection(s(), Buff1, sizeof(Buff1))>0) { char Buff[16384]; DWORD dw = SrcPF.RdSection(s(), Buff, sizeof(Buff)); ASSERT(dw<sizeof(Buff)-2); //section too large!!! CProfINIFile DstPF(ToDatalib ? PrjFiles() : CfgFiles(), (char*)CopyBlkFileName); if (!CheckCopyBlockVer(DstPF, true)) return; DstPF.WrSection(s(), Buff); Buff1[0] = 0; Buff1[1] = 0; SrcPF.WrSection(s(), Buff1); } }
bool CTokenFileInfo::OpenFile(Strng FnFull) { gs_EncryptNDemos.CheckForDemo(NULL); Strng encFnFull; encFnFull = FnFull; encFnFull.Append(".x"); File[iFileIndex] = fopen(encFnFull(), "rt"); if (File[iFileIndex] == NULL) { // Encrypted file nonexistent. m_Buffer[iFileIndex] = NULL; File[iFileIndex] = fopen(FnFull(), "rt"); if (File[iFileIndex] == NULL) return False; } else { // Encrypted file found. gs_EncryptNDemos.encryptedPGM = true; DecryptToBuffer(encFnFull); } return true; }
flag CEqnSpRef::SetUp(CReactionBlock & RB, CR_Eqn & Eq) { flag OK=1; if (m_Name.Length()>0) { m_SpcId=SDB.Find(m_Name()); if (m_SpcId<0) { CReactionBlock::Error(&RB, 'B', 3, m_Name()); OK=0; } m_ProdTerm=Eq.SpecieProductIndex(m_Name); m_ReactTerm=Eq.SpecieReactantIndex(m_Name); if (m_ProdTerm<0 && m_ReactTerm<0) { Strng S; S.Set("%s not in this Reaction", m_Name()); CReactionBlock::Error(&RB, 'B', -1, S()); OK=0; } return True; } return False; };
long C2DPoly::Parse(FxdEdtInfo &EI, Strng & Str) { if (CurrentBlk(EI)) { bObjModified=1; switch (EI.FieldId) { case Id_Order: { int OldOrder = Order; SetOrder(Str.SafeAtoL()); if (Order!=OldOrder) View().DoRebuild(); break; } } } ParseParmsBlk(EI, Str, bObjModified); return 1; }
int CGrfDoc::DeleteTags(bool WithPrompts) { Strng_List MyTags; GetTagList(MyTags); int nTags=MyTags.Length(); int nTagsMultPgs=0; if (nTags>0) { CMap<LPTSTR, LPTSTR, Strng*, Strng*> MyTagMap; MyTagMap.InitHashTable(FindNextPrimeNumber(MyTags.Length())); for (Strng *pTag=MyTags.First(); pTag; pTag=MyTags.Next()) { pTag->SetIndex(0); MyTagMap.SetAt(pTag->Str(), pTag); } for (int iTmpl=iGraphTemplate; iTmpl<=iVisioTemplate; iTmpl++) { if (ScdApp()->TemplateExists(iTmpl)) { POSITION Pos = ScdApp()->Template(iTmpl).GetFirstDocPosition(); while (Pos) { CGrfDoc* pOtherDoc = (CGrfDoc*)(ScdApp()->Template(iTmpl).GetNextDoc(Pos)); if (pOtherDoc!=this) { Strng *pTag; Strng_List OtherTags; int NGrfTags = pOtherDoc->GetTagList(OtherTags); for (Strng *pOtherTag=OtherTags.First(); pOtherTag; pOtherTag=OtherTags.Next()) if (MyTagMap.Lookup(pOtherTag->Str(), pTag)) pTag->SetIndex(pTag->Index()+1); } } } } for (Strng *pTag=MyTags.First(); pTag; pTag=MyTags.Next()) { if (pTag->Index()>0) nTagsMultPgs++; } int Ret=IDYES; if (WithPrompts) { CString S; if (nTagsMultPgs) S.Format("Do you want Delete %i Units (%i Units have Multiple References)", nTags-nTagsMultPgs, nTagsMultPgs); else S.Format("Do you want Delete %i Units", nTags); Ret=AfxMessageBox(S, MB_ICONQUESTION|MB_YESNOCANCEL); } if (Ret==IDCANCEL) return -1; if (Ret==IDYES) { Strng_List DelTags; int nMdlDeletes=0; int nDeletesFailedCnt=0; for (Strng *pTag=MyTags.First(); pTag; pTag=MyTags.Next()) { if (pTag->Index()==0) { DelTags.Append(pTag->Str()); } } int RetCode = gs_Exec.DeleteTags(DelTags); for (Strng *pTag=DelTags.First(); pTag; pTag=MyTags.Next()) { if (pTag->Index()!=EODT_DONE) { //dbgpln("Mdl Not Deleted %s", pTag->Str()); LogError(pTag->Str(), 0, "Model not deleted"); nDeletesFailedCnt++; } else { //dbgpln("Mdl Deleted %s", pTag->Str()); nMdlDeletes++; } } if (nDeletesFailedCnt) { CString S; S.Format("%i Units Failed to Delete", nDeletesFailedCnt); AfxMessageBox(S, MB_ICONEXCLAMATION|MB_OK); } } } return nTags; };
flag GrfComCmdBlk::TestSymbolNameUnique(Strng &Sym, CUniqueTagRulesBlk & TRB/*pchar pHdr, char SepChar*/, Strng &UniqueSym) { UniqueSym.Set("%s%c?",TRB.BaseTag(),TRB.SepChar()); return False; };
void CActuator::BuildDataDefn(DataDefnBlk & DDB) { DDB.BeginStruct(this, "CActuator", NULL, DDB_NoPage); DDB.Text(""); DDB.CheckBoxBtn("On", "", DC_, "", &bOn, this, isParmStopped, DDBYesNo); DDB.CheckBoxBtn("ShowCnv", "", DC_, "", &bWithCnvComment,this, isParmStopped, DDBYesNo); DDB.Visibility(); DDB.Long("", "Ac_Cnt", DC_, "", idmCount, this, isParmStopped/*|AffectsStruct*/); DDB.Text(""); if (m_DataBlk.GetSize()>0) { DDB.Button("Check_tags", "", DC_, "", idmCheckBtn, this, isParmStopped); DDB.Text(""); DDB.String("State", "", DC_, "", &m_StateLine[0], this, noSnap|noFile); DDB.Text("Error:"); DDB.String("Msg_1", "", DC_, "", &m_StateLine[1], this, noSnap|noFile); DDB.String("Msg_2", "", DC_, "", &m_StateLine[2], this, noSnap|noFile); DDB.Text(""); } DDB.Text("----------------------------------------"); static DDBValueLst DDBFail[]={ {Fail_None, "None" }, {Fail_Hold, "Hold" }, {Fail_Hold|Fail_Noise, "Hold,Noise" }, {Fail_MinVal, "MinVal" }, {Fail_MaxVal, "MaxVal" }, {Fail_LoVal, "LoVal" }, {Fail_HiVal, "HiVal" }, {Fail_MinVal|Fail_Ramp, "MinVal,Ramp" }, {Fail_MaxVal|Fail_Ramp, "MaxVal,Ramp" }, {Fail_LoVal|Fail_Ramp, "LoVal,Ramp" }, {Fail_HiVal|Fail_Ramp, "HiVal,Ramp" }, {Fail_MinVal|Fail_Noise, "MinVal,Noise" }, {Fail_MaxVal|Fail_Noise, "MaxVal,Noise" }, {Fail_LoVal|Fail_Noise, "LoVal,Noise" }, {Fail_HiVal|Fail_Noise, "HiVal,Noise" }, {Fail_MinVal|Fail_Ramp|Fail_Noise, "MinVal,Ramp,Noise"}, {Fail_MaxVal|Fail_Ramp|Fail_Noise, "MaxVal,Ramp,Noise"}, {Fail_LoVal|Fail_Ramp|Fail_Noise, "LoVal,Ramp,Noise" }, {Fail_HiVal|Fail_Ramp|Fail_Noise, "HiVal,Ramp,Noise" }, {0}}; static DDBValueLst DDBXForms[]={ {XF_None, "None" }, {XF_Linear, "Linear" }, //{XF_Sqr, "Sqr" }, //{XF_Sqrt, "Sqrt" }, {0}}; static DDBValueLst DDBFilters[]={ {Flt_None, "None" }, {Flt_FirstOrder, "FirstOrder" }, {0}}; static DDBValueLst DDBRawXLates[]={ {XL_None, "None" }, {XL_AtoD, "AtoD" }, {XL_Linear, "Linear" }, //{XL_PulseEncode "PulseWidth" }, {0}}; char Buff[128]; Strng Tag; if (DDB.BeginArray(this, "Cfg", "Ac_Cfg", m_DataBlk.GetSize())) { for (int i=0; i<m_DataBlk.GetSize(); i++) { if (1)// i>0 && (i % 2)==1) { sprintf(Buff, "%d", i); DDB.Page(Buff, DDB_OptPage); } DDB.BeginElement(this, i); CActuatorBlk * T = m_DataBlk[i]; Strng CnvTxt; if (bWithCnvComment && XRefsValid() && T->m_bValid) GetValidCnvTxt(T->m_OutputVar, CnvTxt); DDB.String("ID", "", DC_, "", idmCfgTags+(i*NoOfCfgTags)+1, this, isParmStopped|isTag); DDB.String("OutputTag", "", DC_, "", idmCfgTags+(i*NoOfCfgTags)+2, this, isParmStopped|isTag); //DDB.Double("RequiredValue", "ReqdVal", DC_, "", &T->m_dReqdValue, this, isResult|noFileAtAll); DDB.Double("RequiredValue", "Rqd", DC_, "", &T->m_dReqdValue, this, isResult|noFileAtAll); if (CnvTxt.Len()) DDB.TagComment(CnvTxt()); // DDB.Byte ("Transform", "", DC_, "", &T->m_Xform.m_iType, this, isParm|SetOnChange, DDBXForms); // DDB.Visibility(NSHM_All, T->m_Xform.m_iType); // DDB.Float ("Xf.Factor", "", DC_, "", &T->m_Xform.m_dFactor, this, isParm); // DDB.Float ("Xf.Bias", "", DC_, "", &T->m_Xform.m_dBias, this, isParm); // // DDB.Visibility(); // // DDB.Byte ("Filter", "", DC_, "", &T->m_Flt.m_iType, this, isParm|SetOnChange, DDBFilters); // DDB.Visibility(NSHM_All, T->m_Flt.m_iType == Flt_FirstOrder); // DDB.Float ("Flt.TimeConst", "Flt.Tau", DC_Time, "s", &T->m_Flt.m_dTau, this, isParm); // DDB.Double("Flt.PrevValue", "", DC_, "", &T->m_Flt.m_dPrevValue, this, InitHidden); // DDB.Visibility(); // // DDB.Byte ("Fail.Mode", "", DC_, "", &T->m_Fail.m_iType, this, isParm|SetOnChange, DDBFail); // DDB.Float ("Fail.LoValue", "", DC_, "", &T->m_Fail.m_dLoValue, this, isParm); // DDB.Float ("Fail.HiValue", "", DC_, "", &T->m_Fail.m_dHiValue, this, isParm); // DDB.Float ("Fail.NoiseStdDev", "", DC_, "%", &T->m_Fail.m_dNoiseStdDevFrac, this, isParm); // DDB.Float ("Fail.SlewTime", "", DC_Time, "s", &T->m_Fail.m_dSlewTime, this, isParm); // // // DDB.Float ("MinValue", "MinV", DC_, "", &T->m_dMinValue, this, isParm); // DDB.Float ("MaxValue", "MaxV", DC_, "", &T->m_dMaxValue, this, isParm); // DDB.Double("Value", "", DC_, "", &T->m_dValue, this, isResult); // // DDB.Float ("LoLimit", "LL", DC_, "", &T->m_dLoLimit, this, isParm); // DDB.Float ("HiLimit", "HL", DC_, "", &T->m_dHiLimit, this, isParm); // flag ff=0; DDB.CheckBox ("LoInvert", "", DC_, "", &T->m_bLoInvert, this, isParm|SetOnChange); DDB.CheckBox ("HiInvert", "", DC_, "", &T->m_bHiInvert, this, isParm|SetOnChange); DDB.Bool ("", "Lo", DC_, "", &T->m_bLo, this, isResult); DDB.Bool ("", "Hi", DC_, "", &T->m_bHi, this, isResult); // DDB.Byte ("RawTransform", "", DC_, "", &T->m_RawXform.m_iType, this, isParm|SetOnChange, DDBRawXLates); // DDB.Visibility(NSHM_All, T->m_RawXform.m_iType>=XL_AtoD); // DDB.Float ("Raw.MinValue", "", DC_, "", &T->m_RawXform.m_dMinValue, this, isParm); // DDB.Float ("Raw.MaxValue", "", DC_, "", &T->m_RawXform.m_dMaxValue, this, isParm); // DDB.Visibility(); // //DDB.Double ("OutputValue", "Output", DC_, "", &T->m_dOutputValue, this, isResult); DDB.Double ("OutputValue", "Out", DC_, "", &T->m_dOutputValue, this, isResult); DDB.String ("PLCAddess", "", DC_, "", &T->m_sPLCAddress, this, isParmStopped|InitHidden); DDB.Long ("Priority", "", DC_, "", idmCfgTags+(i*NoOfCfgTags)+4, this, isParmStopped|InitHidden); DDB.Text("----------------------------------------"); } } DDB.EndArray(); DDB.EndStruct(); }
long CSlotConnPrf::Parse(LPCSTR File) { if (!FileExists((LPTSTR)File)) return 1; //m_sTag.FnName((LPTSTR)File); m_bYReversed=false; long RetCode=0; Strng Ext; Ext.FnExt((LPTSTR)File); if (Ext.XStrICmp(".txt")==0 || Ext.XStrICmp(".csv")==0) { FILE *h=fopen(File, "rt"); if (h) { char Buff[4096]; CSVColArray c; int Quote; int nFlds = 0; Buff[0]=0; while (strlen(Buff)==0 && fgets(Buff, sizeof(Buff), h)) XStrLTrim(Buff, " \t\n"); nFlds = ParseCSVTokens(Buff, c, Quote); if (nFlds>0) { if (_stricmp(Buff, "ABS")==0) m_Mode=eABS; else if (_stricmp(Buff, "SCL")==0) m_Mode=eSCL; else if (_stricmp(Buff, "SCL%")==0) m_Mode=eSCLPERC; else if (_stricmp(Buff, "CONTRONIC")==0) m_Mode=eCONTRONIC; else { return 4; goto Leave; } if (m_Mode==eCONTRONIC) { while (fgets(Buff, sizeof(Buff), h)) { int nFlds = ParseTokenList(Buff, c, "=:"); if (nFlds>=3) { CSlotConnPrfPt Pt; Pt.X=(float)SafeAtoF(c[1]); Pt.Y=(float)SafeAtoF(c[2]); m_Points.Add(Pt); } else if (m_Points.GetSize()>0) break; } } else { while (fgets(Buff, sizeof(Buff), h)) { int nFlds = ParseCSVTokens(Buff, c, Quote); if (nFlds>=2) { CSlotConnPrfPt Pt; Pt.X=(float)SafeAtoF(c[0]); Pt.Y=(float)SafeAtoF(c[1]); m_Points.Add(Pt); } else if (m_Points.GetSize()>0) break; } } if (m_Points.GetSize()<2) { RetCode=5; goto Leave; } m_bYReversed=m_Points[0].Y> m_Points[m_Points.GetUpperBound()].Y; fclose(h); } else RetCode=4; } else RetCode=2; Leave: if (h) fclose(h); return RetCode; } else return 3; };
int CModelListHelper::BuildList(LPCTSTR SectName, char* pGroup, CComboBox* pCB, CTreeCtrl *pTree, CProfINIFile *pPF) { LPCTSTR InitialSelect = pPF?pPF->RdStr(SectName, "$LastInsert", (char*)DefaultLastUnit):"?"; if (!InitialSelect) InitialSelect =""; DWORD LicCat = gs_License.LicCatagories(); Strng Desc; RequestModelInfoRec MInfo; HTREEITEM hSelected=NULL, hFirst=NULL; CString Sect(SectName); Sect+=".Tree"; int nValidModels = 0; int nModels = 0; while (gs_pPrj->RequestModelInfoByGroupIndex(pGroup, nModels, MInfo)) { const bool ModelGroupOK = ((LicCat & TOC_MDL_MASK & MInfo.Category)!=0); const bool SolveModeOK = ((LicCat & TOC_SOLVE_MASK & MInfo.Category)!=0); if (MInfo.IsSelectable && ModelGroupOK && SolveModeOK) { char* pSlctText = MInfo.ShortDesc() ? MInfo.ShortDesc() : MInfo.Class(); if (pCB) pCB->AddString(pSlctText); Desc.Set("%s:%s", pSlctText, (MInfo.Desc() ? MInfo.Desc() : "No Description Available")); m_ModelDescLst.Append(Desc()); m_ModelBaseTagLst.Append(MInfo.TagInitialID()); m_ModelClassLst.Append(MInfo.Class()); m_ModelDrwGroupLst.Append(MInfo.DrwGroup()); if (0) { // temporary code to Restructure FlwSymbols for (int Pass=0; Pass<4; Pass++) { Strng Path; Path.Set("%s%s.*.%s", Pass<2?BaseGrfSymbolFiles():GrfSymbolFiles(), MInfo.TagInitialID(), Pass%2==0?"DXF":"BMP"); WIN32_FIND_DATA fd; HANDLE H = FindFirstFile(Path(), &fd); bool AllDone = (H==INVALID_HANDLE_VALUE); while (!AllDone) { Strng Folder, Src, Dst; Folder.Set("%s%s", BaseGrfSymbolFiles(), MInfo.DrwGroup()); Src.Set("%s%s", BaseGrfSymbolFiles(), fd.cFileName); Dst.Set("%s%s\\%s", BaseGrfSymbolFiles(), MInfo.DrwGroup(), &fd.cFileName[MInfo.TagInitialID.Length()+1]); dbgpln("MOVE %-60s >> %s", Src(), Dst()); Strng E; if (FnCreatePath(Folder(), E)) { Move_FileEx(Src(), Dst(), MOVEFILE_REPLACE_EXISTING|MOVEFILE_WRITE_THROUGH); } AllDone = !FindNextFile(H, &fd); } FindClose(H); } } if (pTree) { HTREEITEM hParent = TVI_ROOT, hItem; char Buff[2048]; char *pS=Buff, *pE; strcpy(Buff, pSlctText); while ((pE=strchr(pS, ':'))!=NULL) { *pE=0; XStrTrim(pS, " "); for (hItem=pTree->GetNextItem(hParent, TVGN_CHILD); hItem!=NULL; hItem=pTree->GetNextItem(hItem, TVGN_NEXT)) { CString S=pTree->GetItemText(hItem); if (S.CompareNoCase(pS)==0) break; } if (hItem==NULL) { XStrTrim(pS, " "); hItem=pTree->InsertItem(pS, 0, 0, hParent); pTree->SortChildren(hParent); pTree->SetItemData(hItem, 0xFFFF); pTree->SetItemImage(hItem, 0, 1); } hParent=hItem; pS=pE+1; } XStrTrim(pS, " "); hItem=pTree->InsertItem(pS, 0, 0, hParent); if (_stricmp(MInfo.Class(), InitialSelect)==0) hSelected=hItem; if (hFirst==NULL) hFirst=hItem; pTree->SetItemData(hItem, nValidModels); pTree->SortChildren(hParent); pTree->SetItemImage(hItem, 2, 3); if (pPF) { // Restore State of Tree HTREEITEM hParent = TVI_ROOT, hItem; CString Txt[10]; long iDepth=0; hItem=pTree->GetNextItem(TVI_ROOT, TVGN_CHILD); while (hItem && iDepth>=0) { UINT State=pTree->GetItemState(hItem, TVIS_EXPANDED ); if (1) { CString S; for (int i=0; i<iDepth; i++) S+=Txt[i]; S+=pTree->GetItemText(hItem); UINT State=(UINT)pPF->RdInt(Sect, S, 0); if (State&TVIS_EXPANDED) { pTree->Expand(hItem, TVE_EXPAND); //?????????? } } HTREEITEM h=pTree->GetNextItem(hItem, TVGN_CHILD); if (h) { Txt[iDepth]=pTree->GetItemText(hItem); Txt[iDepth]+=":"; iDepth++; hItem=h; } else { h=pTree->GetNextItem(hItem, TVGN_NEXT); if (h) { hItem=h; } else { // Go One up & One along hItem=pTree->GetNextItem(hItem, TVGN_PARENT); if (hItem) hItem=pTree->GetNextItem(hItem, TVGN_NEXT); iDepth--; } } } } } nValidModels++; } nModels++; } if (pTree) { if (!hSelected) hSelected=hFirst; pTree->Select(hSelected, TVGN_CARET); //pTree->SelectSetFirstVisible(hSelected); } return nValidModels; }
void CDynToolBar::SaveState(char* pFilename) { CProfINIFile PF(pFilename); Strng Section; //Section.Set("ToolBar%s_%d", gs_License.IsRunTime() ? "_rt" : "", iWindowID); Section.Set("ToolBar_%d", iWindowID); DWORD BarStyle = GetBarStyle(); DWORD Style = GetStyle(); CRect Rect; CWnd* pWnd = GetParent(); if (BarStyle & CBRS_FLOATING) { if (pWnd && pWnd->GetParent()) { pWnd->GetParent()->GetWindowRect(&Rect); if (PrjFileVerNo()>=25) { CRect MRect; AfxGetMainWnd()->GetWindowRect(MRect); Rect.OffsetRect(-MRect.left, -MRect.top); } PF.WrInt(Section(), "Left", Rect.left); PF.WrInt(Section(), "Top", Rect.top); } } else { if (pWnd) { //pWnd->GetWindowRect(&Rect); GetWindowRect(&Rect); if (PrjFileVerNo()>=25) { CRect MRect; AfxGetMainWnd()->GetWindowRect(MRect); Rect.OffsetRect(-MRect.left, -MRect.top); } //pWnd->ScreenToClient(&Rect); PF.WrInt(Section(), "Left", Rect.left); PF.WrInt(Section(), "Top", Rect.top); } } PF.WrStr(Section(), "Title", (char*)(const char*)sTitle); PF.WrLong(Section(), "BarStyle", BarStyle); flag Visible = ((Style & WS_VISIBLE) != 0); PF.WrInt(Section(), "Visible", Visible); if (bCanConfigure) { CToolBarCtrl& bc = GetToolBarCtrl(); const int Cnt = bc.GetButtonCount(); PF.WrInt(Section(), "ButtonIDCount", Cnt); Strng Item; TBBUTTON Btn; for (int i=0; i<Cnt; i++) { Item.Set("ID_%d", i); if (bc.GetButton(i, &Btn)) PF.WrInt(Section(), Item(), Btn.idCommand); else PF.WrInt(Section(), Item(), ID_SEPARATOR); } } }
int CCopyBlock::CopyTagBlocks() { CWaitCursor Wait; // ASSERT(eSrc!=CB_List); //this src type not allowed // ASSERT(eDst!=CB_Tag); //this dst type not allowed ASSERT(pEO); CProfINIFile SrcPF(bSrcDatalib ? CfgFiles() : PrjFiles(), (char*)CopyBlkFileName); CheckCopyBlockVer(SrcPF); CProfINIFile DstPF(bDstDatalib ? CfgFiles() : PrjFiles(), (char*)CopyBlkFileName); if (!CheckCopyBlockVer(DstPF, true)) return 0; int Cnt = 0; //gs_pTheSFELib->FE_SetHoldGlobalLinks(true); //gs_Exec.SetHoldValidateData(true, true, true); gs_Exec.BeginBulkChange(); Strng Section; if (eSrc==CB_SelectedTag) Section = TempBlockName; else Section.Set("%s(%s)", sSrc(), sModelClass()); char Buff[16384]; DWORD dw = SrcPF.RdSection(Section(), Buff, sizeof(Buff)); ASSERT(dw<sizeof(Buff)-2); //section too large!!! if (eDst==CB_Block) { Strng DstSection; DstSection.Set("%s(%s)", sDst(), sModelClass()); DstPF.WrSection(DstSection(), Buff); } else { Strng_List sStrList; CXM_Route Route; CXM_ObjectData ObjData; char* p = Buff; while (p[0]) { int len = strlen(p); char* Nextp = p; Nextp += (len + 1); char* pp = strchr(p, '='); if (pp) { pp[0] = 0; char* pValue = &pp[1]; char* ppp = strchr(p, '.'); Strng PartTag; PartTag = (ppp==NULL ? p : ppp); for (int i=0; i<TagList.GetSize(); i++) { Strng WrkTag(TagList[i]()); WrkTag += PartTag; //CXM_ObjectTag ObjTag(WrkTag(), 0); //need to use TABOpt_AllInfoOnce because of tags that contain a strList! CXM_ObjectTag ObjTag(WrkTag(), TABOpt_AllInfoOnce);//0);//TABOpt_Exists);//TABOpt_Parms);//TABOpt_ValCnvsOnce); Route.Clear(); if (pEO->XReadTaggedItem(ObjTag, ObjData, Route)) { CPkDataItem * pItem = ObjData.FirstItem(); byte cType = pItem->Type(); PkDataUnion DU; if (IsStrng(cType)) DU.SetTypeString(cType, pValue); else if (IsFloatData(cType)) DU.SetTypeDouble(cType, SafeAtoF(pValue)); else if (IsIntData(cType) && pItem->Contains(PDI_StrList)) { pItem->GetStrList(sStrList); pStrng pS = sStrList.Find(pValue); //const int Indx = (pS==NULL ? 0 : sStrList.Index(pS)); const int Indx = (pS==NULL ? 0 : pS->Index()); DU.SetTypeLong(cType, Indx); } else DU.SetTypeLong(cType, SafeAtoL(pValue)); CXM_ObjectData OD(0, 0, WrkTag(), 0, DU); if (pEO->XWriteTaggedItem(OD, Route)==TOData_NotFound) LogWarning(WrkTag(), 0, "Write tag failed"); else Cnt++; //if (pEO->XWriteTaggedItem(OD, Route)!=TOData_OK) // LogWarning(WrkTag(), 0, "Write tag failed (possibly invalid data)"); } else LogWarning(WrkTag(), 0, "Unable to read tag"); } } p = Nextp; } } //TaggedObject::SetHoldValidateData(false); //gs_Exec.SetHoldValidateData(false, true, true); //gs_pTheSFELib->FE_SetHoldGlobalLinks(false); gs_Exec.EndBulkChange(); //TaggedObject::SetXWritesBusy(false); return Cnt; }
void CDynToolBar::LoadState(char* pFilename) { CProfINIFile PF(pFilename); CMDIFrameWnd* pM = pTBMngr->pMainFrame; Strng Section; Section.Set("ToolBar_%d", iWindowID); Strng NewTitle = PF.RdStr(Section(), "Title", (char*)(const char*)sTitle); if (NewTitle.Length()!=sTitle.GetLength() || strcmp(NewTitle(), (const char*)sTitle)!=0) { SetWindowText(NewTitle()); sTitle = NewTitle(); } DWORD BarStyle = GetBarStyle(); DWORD Style = GetStyle(); BarStyle = PF.RdLong(Section(), "BarStyle", BarStyle); BarStyle &= CBRS_ALL; //CNM Prevent an ASSERT SetBarStyle(BarStyle); if (bCanConfigure) { CToolBarCtrl& bc = GetToolBarCtrl(); int Cnt = bc.GetButtonCount(); Cnt = PF.RdInt(Section(), "ButtonIDCount", Cnt); BOOL Chngd = (Cnt!=bc.GetButtonCount()); UINT* NewIDs = new UINT[Cnt]; Strng Item; for (int i=0; i<Cnt; i++) { Item.Set("ID_%d", i); int Cmd = (i<(int)iLen ? BtnIDs[i] : ID_SEPARATOR); Cmd = PF.RdInt(Section(), Item(), Cmd); NewIDs[i] = (UINT)Cmd; Chngd = (Chngd || (NewIDs[i]!=BtnIDs[i])); } if (Chngd) ChangeButtons(NewIDs, Cnt); delete []NewIDs; } flag Visible = ((Style & WS_VISIBLE) != 0); Visible = PF.RdInt(Section(), "Visible", Visible); pM->ShowControlBar(this, Visible, FALSE); pM->RecalcLayout(); //get MFC to adjust the dimensions of all docked ToolBars so that GetWindowRect will be accurate CRect Rect; CWnd* pWnd = GetParent(); if (BarStyle & CBRS_FLOATING) { if (pWnd && pWnd->GetParent()) { if (PrjFileVerNo()>=25) { CRect MRect; AfxGetMainWnd()->GetWindowRect(MRect); Rect.OffsetRect(-MRect.left, -MRect.top); int L=PF.RdInt(Section(), "Left", Rect.left); int T=PF.RdInt(Section(), "Top", Rect.top); Rect.OffsetRect(L-Rect.left, T-Rect.top); Rect.OffsetRect(+MRect.left, +MRect.top); } else { pWnd->GetParent()->GetWindowRect(&Rect); Location.x = PF.RdInt(Section(), "Left", Rect.left); Location.y = PF.RdInt(Section(), "Top", Rect.top); } pM->FloatControlBar(this, Location); } } else { GetWindowRect(&Rect); if (PrjFileVerNo()>=25) { CRect MRect; AfxGetMainWnd()->GetWindowRect(MRect); Rect.OffsetRect(-MRect.left, -MRect.top); int L=PF.RdInt(Section(), "Left", Rect.left); int T=PF.RdInt(Section(), "Top", Rect.top); Rect.OffsetRect(L-Rect.left, T-Rect.top); Rect.OffsetRect(+MRect.left, +MRect.top); } else { //Rect.left = PF.RdInt(Section(), "Left", Rect.left); //Rect.top = PF.RdInt(Section(), "Top", Rect.top); int L=PF.RdInt(Section(), "Left", Rect.left); int T=PF.RdInt(Section(), "Top", Rect.top); Rect.right += L-Rect.left; Rect.bottom += T-Rect.top; Rect.left += L-Rect.left; Rect.top += T-Rect.top; } //Rect.top = PF.RdInt(Section(), "Top", Rect.top); UINT n = 0; if (BarStyle & CBRS_ALIGN_TOP) { Rect.top -= 1; Rect.bottom -= 1; n = AFX_IDW_DOCKBAR_TOP; } if (n==0 && BarStyle & CBRS_ALIGN_BOTTOM) { Rect.top += 1; Rect.bottom += 1; n = AFX_IDW_DOCKBAR_BOTTOM; } if (n==0 && BarStyle & CBRS_ALIGN_LEFT) { Rect.left -= 1; Rect.right -= 1; n = AFX_IDW_DOCKBAR_LEFT; } if (n==0 && BarStyle & CBRS_ALIGN_RIGHT) { Rect.left += 1; Rect.right += 1; n = AFX_IDW_DOCKBAR_RIGHT; } pM->DockControlBar(this, n, &Rect); } pM->RecalcLayout(); }
BOOL CDynToolBar::GetButtonInfo(WPARAM wParam, LPARAM lParam, LRESULT* pLResult) { // This notification message has to be handled correctly if // all operations in the custom dialogbox has to function correctly // We have to supply information for the button specified by pTBN->tbButton // // This notification is sent in the following cases // // After TBN_BEGINADJUST the control sends these notifications until // * pLResult is TRUE. We have to supply valid values when this value is // set to TRUE. Here the control is collecting information for all // the buttons that have to be displayed in the dialog box // // The control sends this notification to get information about // a button if the user is trying to add it to the toolbar or // rearranging the buttons on the toolbar from within the dialog TBNOTIFY* pTBN = (TBNOTIFY*)lParam; UINT StrID; if (bButtonsOnce) { if (pTBN->iItem >= (int)(pTheBitmap->iLen)) *pLResult = FALSE; else { StrID = pTheBitmap->BtnIDs[pTBN->iItem]; pTBN->tbButton = pTheBitmap->Btns[pTBN->iItem]; *pLResult = TRUE; } } else { if (pTBN->iItem >= (int)iLen) *pLResult = FALSE; else { StrID = BtnIDs[pTBN->iItem]; pTBN->tbButton = Btns[pTBN->iItem]; *pLResult = TRUE; } } if (*pLResult == TRUE) { CString Txt; Txt.LoadString(StrID); Strng s; if (Txt.Find('\n')>=0) { s = (const char*)Txt.Mid(Txt.Find('\n')+1, 256); Txt = Txt.Left(Txt.Find('\n')); if (s.Length()>0) s += " : "; } s += (const char*)Txt; if (s.Length()>0) { _tcsncpy(pTBN->pszText, s(), pTBN->cchText - 1); pTBN->pszText[pTBN->cchText - 1] = '\0'; } else pTBN->pszText[0] = '\0'; } return TRUE; }
void CChangeTag::OnOK() { if (m_ReadOnly) CDialog::OnOK(); //gs_pAccWnd->CloseAccessData(False, False, True); //gs_pAccWnd->CloseWnd(); UpdateData(TRUE); Strng OldTag(m_OldTag.GetBuffer(0)); OldTag.Trim(" \t\n\r\v\f"); Strng NewTag(m_NewTag.GetBuffer(0)); if (OldTag.XStrICmp(NewTag)!=0) { CWaitCursor Wait; BOOL ok = TRUE; if (TaggedObject::ValidateTagChanged(NewTag)) { Strng s; s.Set("New tag '%s' is illegal and has been altered to '%s'\nContinue?", (const char*)m_NewTag, NewTag()); ok = (AfxMessageBox(s(), MB_YESNO|MB_ICONQUESTION)==IDYES); if (ok) LogNote("ChangeTag", 0, "New tag '%s' altered to '%s'", (const char*)m_NewTag, NewTag()); } if (ok && !gs_pPrj->AllGrfLoaded()) { Strng s; s.Set("All the graphics pages have not been loaded!\nTag '%s' may not be changed in the graphics window.\nContinue?", OldTag()); ok = (AfxMessageBox(s(), MB_YESNO|MB_ICONEXCLAMATION|MB_DEFBUTTON2)==IDYES); } if (ok) { pStatusBar->SetMsg("Attempting to change tag %s to %s", OldTag(), NewTag()); int Err = gs_Exec.ChangeTag(OldTag(), NewTag()); Strng Txt; switch (Err) { case EOCT_NOTFOUND: Txt.Set("Tag %s not found", OldTag()); break; case EOCT_DUPLICATE: Txt.Set("Duplicate Tag %s", NewTag()); break; case EOCT_FAILED: Txt.Set("FAILURE %s", OldTag()); break; case EOCT_NULLTAG: Txt.Set("Valid (not blank) tags must be specified"); break; case EOCT_INVALIDTAG: Txt.Set("Valid (all characters must be legal) tags must be specified"); break; case EOCT_BADTAGLEN: Txt.Set("New tag length is too long"); break; case EOCT_NOTDIFFER: Txt.Set("Tags should differ"); break; case EOCT_NOTALLOWED: Txt.Set("Tag %s not allowed to be changed", OldTag()); break; case EOCT_DRVNOTALLOWED: Txt.Set("Tag %s is referenced by a driver and cannot be changed while solving", OldTag()); break; case EOCT_ARCNOTALLOWED: Txt.Set("Tag %s is referenced by the acrhiver and cannot be changed while solving", OldTag()); break; case EOCT_DONE: CExploreScd::RefreshIt(true); gs_AccessWnds.CloseAccessData(-1, False, False, True); gs_AccessWnds.CloseWnd(-1); for (int a=0; a<NAccessWnds; a++) { if (!fCallAccess && gs_AccessWnds.CurTag(a) && strlen(gs_AccessWnds.CurTag(a))>0 && _stricmp(gs_AccessWnds.CurTag(a), OldTag())==0) { fCallAccess = 1; break; } } if (fCallAccess) { char* pTxt = new char[NewTag.Len()+1]; strcpy(pTxt, NewTag()); ScdMainWnd()->PostMessage(WMU_TAGACTION, SUB_TAG_ACCESS, (LPARAM)pTxt); } CDialog::OnOK(); break; } if (Txt.Len()>0) { m_OldTag = OldTag(); m_NewTag = NewTag(); MessageBox(Txt(), "Change Tag", MB_OK); UpdateData(FALSE); } else pStatusBar->SetMsg("Changed tag %s to %s", OldTag(), NewTag()); } } else CDialog::OnOK(); }
flag CCopyTagBlkDlg::BuildTree() { m_CopyTree.DeleteAllItems(); #if 1 if (sTag.Len()>0) { TV_INSERTSTRUCT Ins; Ins.hParent = TVI_ROOT; Ins.hInsertAfter = TVI_LAST;//TVI_SORT; Ins.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE; Ins.item.state = 0; Ins.item.stateMask = 0; Ins.item.hItem = NULL; Ins.item.pszText = NULL; Ins.item.cchTextMax = 0; Ins.item.iImage = 0; Ins.item.iSelectedImage = 0; Ins.item.cChildren = 0; Ins.item.lParam = 0; CTagTree TT; TT.Build(sTag()); TT.PopulateTree(m_CopyTree, Ins, isParm, 0);//, ButtonFld); } #else int iLvl=0; const int MaxItems = 256; HTREEITEM hItem[MaxItems], hRoot=NULL; for (iLvl=0; iLvl<MaxItems; iLvl++) hItem[iLvl]=NULL; Strng Txt; int PrvLvl=0; for (int di = 0; (di < AW.NData); di++ ) { rAccNdData d = AW.Data[di]; // dbgpln("Fld %3i Typ:%-16s S:%i E:%i Lvl:%3i :%s", // di, tt_TypeString(d.iType), d.iStrtFld, d.iEndFld, d.iLvl, d.sSymOrTag()); ASSERT(d.iLvl<MaxItems); for (int i=PrvLvl+1; i<=d.iLvl; i++) hItem[i] = NULL; if (!IsLayout(d.iType) && !IsStructEnd(d.iType) && (!IsData(d.iType)/* || (d.fIsParam && !bBlocksOnly)*/)) { TV_INSERTSTRUCT Ins; Ins.hParent = TVI_ROOT; Ins.hInsertAfter = TVI_LAST; Ins.item.mask = TVIF_TEXT|TVIF_PARAM; Ins.item.state = 0; Ins.item.stateMask = 0; if (IsData(d.iType)) Txt.Set("%s (%s)", d.sSymOrTag(), d.sValue()); else Txt = d.sSymOrTag(); Ins.item.hItem = NULL; Ins.item.pszText = Txt(); Ins.item.cchTextMax = 0; Ins.item.iImage = 0; Ins.item.iSelectedImage = 0; Ins.item.cChildren = 0; Ins.item.lParam = MAKELPARAM((WORD)di, (WORD)0); if (d.iLvl>0) { int i = d.iLvl-1; while (i>0 && hItem[i]==NULL) i--; Ins.hParent = hItem[i]; hItem[d.iLvl] = m_CopyTree.InsertItem(&Ins); } else { hItem[d.iLvl] = m_CopyTree.InsertItem(&Ins); hRoot = hItem[d.iLvl]; } } PrvLvl = d.iLvl; } #endif if (m_CopyTree.GetRootItem()) m_CopyTree.Expand(m_CopyTree.GetRootItem(), TVM_EXPAND); return m_CopyTree.GetCount()>0; }
BOOL CTokenFileInfo::CheckForInclude() { if (bUseIncludes && (pParser->sTokenLine[0]==sIncludeChars[0])) { CString FileName = pParser->sTokenLine; if (pParser->sTokenLine.Find((const char*)sIncludeChars)==0) { FileName = FileName.Mid(sIncludeChars.GetLength(), 1024); FileName = FileName.Right(FileName.GetLength() - FileName.SpanIncluding(" \t").GetLength()); while (FileName.GetLength()>0 && (FileName[FileName.GetLength()-1]==' ' || FileName[FileName.GetLength()-1]=='\t')) FileName = FileName.Left(FileName.GetLength()-1); BOOL Failed = TRUE; DWORD ErrNo = 1;//file not specified if (FileName.GetLength()>0) { if (FileName[0]=='\'' || FileName[0]=='"') FileName = FileName.Right(FileName.GetLength() - 1); int len = FileName.GetLength(); if (len>0) { if (FileName[len-1]=='\'' || FileName[len-1] == '"') FileName = FileName.Left(len-1); len = FileName.GetLength(); if (len>0) { iFileIndex++; if (iFileIndex<TP_MaxIncludeFiles) { Strng Fn, FnFull; Fn.FnDrivePath((char*)(const char*)FileName); if (Fn()==NULL) {// No Path Use Previous Fn.FnDrivePath((char*)(const char*)FileNames[iFileIndex-1]); Fn+=(char*)(const char*)FileName; // FileName=Fn(); } else Fn=(char*)(const char*)FileName; // CNM if ((Fn[0]=='~') || (Fn[0]=='.')) // relative filename ? { // yes - prepend current folder (defined by previously openned file - NOT O/S Strng T; T.FnDrivePath((LPTSTR)(LPCTSTR)AllFileNames[iIncFileCnt-1]); T+=Fn; Fn=T; } FnFull.FnSearchExpand(Fn(), bFnPlaces); Fn.FnContract(); FileName=Fn(); FileNames[iFileIndex] = Fn(); pParser->wLineNo--; FileLineNo[iFileIndex] = 0; Failed = !OpenFile(FnFull); //File[iFileIndex] = fopen(FnFull(), "rt"); FnModifyTime(FnFull(), FileTimes[iFileIndex]); if (iIncFileCnt<TP_MaxTtlIncludeFiles) { AllFileNames[iIncFileCnt]=Fn(); AllFileTimes[iIncFileCnt]=FileTimes[iFileIndex]; iIncFileCnt++; } if (Failed) ErrNo = 2;//cannot open file } else ErrNo = 3;//too many nested includes } } } if (Failed && pParser->pFailFn) { (*(pParser->pFailFn))((char*)(const char*)FileName, ErrNo, pParser->pFailExtraPtr); } return TRUE; } } return FALSE; }
void OleDocRoot::SetPathName(LPCTSTR pszPathName, BOOL bAddToMRU/* = TRUE*/) { Strng T; T.FnExt((pchar)pszPathName); COleLinkingDoc::SetPathName(pszPathName, (_stricmp(T(), ".spj")==0)); }
flag CrushBlk::DataXchg(DataChangeBlk & DCB) { switch (DCB.lHandle) { case xidMethod: if (DCB.rB) { iMethod=*DCB.rB; switch (iMethod) { case CM_PartCrv_Overall: case CM_PartCrv_Individ: { int N0=DischParts.NCurves(); if (iMethod==CM_PartCrv_Overall) DischParts.SetNCurves(1); else DischParts.SetNCurves(Max(1, SD_Defn.NPriIds(0))); for (int c=Max(N0,1); c<DischParts.NCurves(); c++) DischParts.Curve(c) = DischParts.Curve(c-1); for (c=0; c<DischParts.NCurves(); c++) { DischParts.SetEditable(c, true); DischParts.SetAutoCorrect(c, true); } break; //assumes one sieve-size/distribution only } case CM_SelBreak: break; case CM_JK: break; case CM_TestData_Overall: case CM_TestData_Individ: { if (iMethod==CM_TestData_Overall) { DataParts.SetNCurves(2); Extents.SetNCurves(1); } else { DataParts.SetNCurves(Max(2, SD_Defn.NPriIds(0)*2)); Extents.SetNCurves(Max(1, SD_Defn.NPriIds(0))); } Strng Nm; for (int c=0; c<DataParts.NCurves()/2; c++) { Nm.Set("Frac_In%d", c); DataParts.SetTitle((c*2), Nm()); Nm.Set("Frac_Out%d", c); DataParts.SetTitle((c*2)+1, Nm()); /*Nm.Set("Cum_In%d", c); DataParts.SetTitle(DataParts.NCurves()+(c*2), Nm()); Nm.Set("Cum_Out%d", c); DataParts.SetTitle(DataParts.NCurves()+(c*2)+1, Nm());*/ } for (c=0; c<DataParts.NCurves(); c++) { DataParts.SetEditable(c, true); DataParts.SetAutoCorrect(c, true); } for (c=0; c<Extents.NCurves(); c++) Extents.SetEditable(c, bEnterExtents); break; //assumes one sieve-size/distribution only } } } DCB.B=iMethod; return 1; case xidEnterExtents: if (DCB.rB) { bEnterExtents=*DCB.rB; for (int c=0; c<Extents.NCurves(); c++) Extents.SetEditable(c, bEnterExtents); } DCB.B=bEnterExtents; return 1; } return 0; }