本文整理汇总了C++中Strng::Set方法的典型用法代码示例。如果您正苦于以下问题:C++ Strng::Set方法的具体用法?C++ Strng::Set怎么用?C++ Strng::Set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Strng
的用法示例。
在下文中一共展示了Strng::Set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BuildDataDefn
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);
}
};
示例2: SetUp
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);
}
};
示例3: BuildBlockTagsList
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);
}
示例4: BldTreeSelList
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);
}
}
示例5: switch
void C2DPoly::Load(FxdEdtInfo &EI, Strng & Str)
{
if (CurrentBlk(EI))
{
switch (EI.FieldId)
{
case Id_Order: Str.Set("%i", Order); break;
}
}
LoadParmsBlk(EI, Str);
}
示例6: AddRngChkMsg
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);
}
};
示例7: RemoveBlock
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);
}
}
}
示例8: MoveBlockLocation
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);
}
}
示例9: DataXchg
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;
}
示例10: BuildList
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);
//.........这里部分代码省略.........
示例11: CopyTagBlocks
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;
//.........这里部分代码省略.........
示例12: OnOK
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
//.........这里部分代码省略.........
示例13: BuildTree
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;
}
示例14: TestSymbolNameUnique
flag GrfComCmdBlk::TestSymbolNameUnique(Strng &Sym, CUniqueTagRulesBlk & TRB/*pchar pHdr, char SepChar*/, Strng &UniqueSym)
{
UniqueSym.Set("%s%c?",TRB.BaseTag(),TRB.SepChar());
return False;
};
示例15: LoadState
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;
}
//.........这里部分代码省略.........