1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0023016: Elimination of dependency of Tcl OCAF Browser from Tix product

This commit is contained in:
szv
2012-03-15 10:41:15 +04:00
committed by bugmaster
parent 20637bd27c
commit f767df4e8c
6 changed files with 502 additions and 635 deletions

View File

@@ -1,7 +1,6 @@
// File: DDF_Browser.cxx
// ---------------
// Author: DAUTRY Philippe
// <fid@fox.paris1.matra-dtv.fr>
// Copyright: Matra Datavision 1997
// Version: 0.0
@@ -9,7 +8,6 @@
// 0.0 Oct 3 1997 Creation
#include <DDF_Browser.ixx>
#include <DDF_AttributeBrowser.hxx>
@@ -118,7 +116,8 @@ TCollection_AsciiString DDF_Browser::OpenRoot() const
Handle(TDataStd_Name) name;
list.AssignCat(TDF_BrowserSeparator2);
list.AssignCat("\"");
if (root.FindAttribute(TDataStd_Name::GetID(),name)) {
if (root.FindAttribute(TDataStd_Name::GetID(),name))
{
TCollection_AsciiString tmpStr(name->Get(),'?');
tmpStr.ChangeAll(' ','_');
list.AssignCat(tmpStr);
@@ -128,13 +127,7 @@ TCollection_AsciiString DDF_Browser::OpenRoot() const
if (!root.MayBeModified()) list.AssignCat("Not");
list.AssignCat("Modified");
list.AssignCat(TDF_BrowserSeparator2);
if (root.HasAttribute() || (root.HasChild())) {
list.AssignCat("1");
}
else {
list.AssignCat("0");
}
//cout<<"OpenRoot: "<<list<<endl;
list.AssignCat((root.HasAttribute() || root.HasChild())? "1" : "0");
return list;
}
@@ -154,7 +147,8 @@ TCollection_AsciiString DDF_Browser::OpenLabel(const TDF_Label& aLab) const
{
Standard_Boolean split = Standard_False;
TCollection_AsciiString entry, list;
if (aLab.HasAttribute() || aLab.AttributesModified()) {
if (aLab.HasAttribute() || aLab.AttributesModified())
{
list.AssignCat("AttributeList");
list.AssignCat(TDF_BrowserSeparator2);
if (!aLab.AttributesModified()) list.AssignCat("Not");
@@ -162,13 +156,15 @@ TCollection_AsciiString DDF_Browser::OpenLabel(const TDF_Label& aLab) const
split = Standard_True;
}
Handle(TDataStd_Name) name;
for (TDF_ChildIterator itr(aLab); itr.More(); itr.Next()) {
for (TDF_ChildIterator itr(aLab); itr.More(); itr.Next())
{
if (split) list.AssignCat(TDF_BrowserSeparator1);
TDF_Tool::Entry(itr.Value(),entry);
list.AssignCat(entry);
list.AssignCat(TDF_BrowserSeparator2);
list.AssignCat("\"");
if (itr.Value().FindAttribute(TDataStd_Name::GetID(),name)) {
if (itr.Value().FindAttribute(TDataStd_Name::GetID(),name))
{
TCollection_AsciiString tmpStr(name->Get(),'?');
tmpStr.ChangeAll(' ','_');
list.AssignCat(tmpStr);
@@ -179,14 +175,9 @@ TCollection_AsciiString DDF_Browser::OpenLabel(const TDF_Label& aLab) const
list.AssignCat("Modified");
list.AssignCat(TDF_BrowserSeparator2);
// May be open.
if (itr.Value().HasAttribute() || (itr.Value().HasChild()))
list.AssignCat("1");
else
list.AssignCat("0");
list.AssignCat((itr.Value().HasAttribute() || itr.Value().HasChild())? "1" : "0");
split = Standard_True;
}
//cout<<"OpenLabel: "<<list<<endl;
return list;
}
@@ -204,7 +195,8 @@ TCollection_AsciiString DDF_Browser::OpenAttributeList
{
TCollection_AsciiString list;
Standard_Boolean split1 = Standard_False;
for (TDF_AttributeIterator itr(aLab,Standard_False);itr.More();itr.Next()) {
for (TDF_AttributeIterator itr(aLab,Standard_False);itr.More();itr.Next())
{
if (split1) list.AssignCat(TDF_BrowserSeparator1);
const Handle(TDF_Attribute)& att = itr.Value();
const Standard_Integer index = myAttMap.Add(att);
@@ -229,11 +221,9 @@ TCollection_AsciiString DDF_Browser::OpenAttributeList
// May be open.
list.AssignCat(TDF_BrowserSeparator2);
DDF_AttributeBrowser* br = DDF_AttributeBrowser::FindBrowser(att);
if (br) list.AssignCat("1");
else list.AssignCat("0");
list.AssignCat(br? "1" : "0");
split1 = Standard_True;
}
//cout<<"OpenAttributeList: "<<list<<endl;
return list;
}
@@ -250,7 +240,6 @@ TCollection_AsciiString DDF_Browser::OpenAttribute
Handle(TDF_Attribute) att = myAttMap.FindKey(anIndex);
DDF_AttributeBrowser* br = DDF_AttributeBrowser::FindBrowser(att);
if (br) list = br->Open(att);
//cout<<"OpenAttribute: "<<list<<endl;
return list;
}
@@ -289,5 +278,3 @@ TCollection_AsciiString DDF_Browser::Information(const Standard_Integer /*anInde
TCollection_AsciiString list;
return list;
}

View File

@@ -1,7 +1,6 @@
// File: DDF_BrowserCommands.cxx
// -----------------------
// Author: DAUTRY Philippe
// <fid@fox.paris1.matra-dtv.fr>
// Copyright: Matra Datavision 1997
// Version: 0.0
@@ -38,8 +37,8 @@
//=======================================================================
static Standard_Integer DFBrowse (Draw_Interpretor& di,
Standard_Integer n,
const char** a)
Standard_Integer n,
const char** a)
{
if (n<2) return 1;
@@ -47,11 +46,10 @@ static Standard_Integer DFBrowse (Draw_Interpretor& di,
if (!DDF::GetDF (a[1], DF)) return 1;
Handle(DDF_Browser) NewDDFBrowser = new DDF_Browser(DF);
char *name = new char[50];
if (n == 3) sprintf(name,"browser_%s",a[2]);
else sprintf(name,"browser_%s",a[1]);
TCollection_AsciiString name("browser_");
name += ((n == 3)? a[2] : a[1]);
Draw::Set (name.ToCString(), NewDDFBrowser);
Draw::Set (name, NewDDFBrowser);
TCollection_AsciiString inst1("dftree ");
inst1.AssignCat(name);
di.Eval(inst1.ToCString());
@@ -67,8 +65,8 @@ static Standard_Integer DFBrowse (Draw_Interpretor& di,
//=======================================================================
static Standard_Integer DFOpenLabel (Draw_Interpretor& di,
Standard_Integer n,
const char** a)
Standard_Integer n,
const char** a)
{
if (n < 2) return 1;
@@ -78,14 +76,8 @@ static Standard_Integer DFOpenLabel (Draw_Interpretor& di,
TDF_Label lab;
if (n == 3) TDF_Tool::Label(browser->Data(),a[2],lab);
if (lab.IsNull()) {
TCollection_AsciiString list = browser->OpenRoot();
di<<list.ToCString();
}
else {
TCollection_AsciiString list = browser->OpenLabel(lab);
di<<list.ToCString();
}
TCollection_AsciiString list(lab.IsNull()? browser->OpenRoot() : browser->OpenLabel(lab));
di<<list.ToCString();
return 0;
}
@@ -98,8 +90,8 @@ static Standard_Integer DFOpenLabel (Draw_Interpretor& di,
//=======================================================================
static Standard_Integer DFOpenAttributeList(Draw_Interpretor& di,
Standard_Integer n,
const char** a)
Standard_Integer n,
const char** a)
{
if (n < 3) return 1;
@@ -109,11 +101,10 @@ static Standard_Integer DFOpenAttributeList(Draw_Interpretor& di,
TDF_Label lab;
TDF_Tool::Label(browser->Data(),a[2],lab);
if (lab.IsNull()) {
if (lab.IsNull())
return 1;
}
TCollection_AsciiString list = browser->OpenAttributeList(lab);
TCollection_AsciiString list(browser->OpenAttributeList(lab));
di << list.ToCString();
return 0;
}
@@ -128,18 +119,16 @@ static Standard_Integer DFOpenAttributeList(Draw_Interpretor& di,
//=======================================================================
static Standard_Integer DFOpenAttribute (Draw_Interpretor& di,
Standard_Integer n,
const char** a)
Standard_Integer n,
const char** a)
{
if (n < 3) return 1;
Handle(DDF_Browser) browser =
Handle(DDF_Browser)::DownCast (Draw::Get(a[1], Standard_True));
Standard_Integer index = atoi(a[2]);
const Standard_Integer index = atoi(a[2]);
TCollection_AsciiString list = browser->OpenAttribute(index);
di<<list.ToCString();
return 0;
}
@@ -148,8 +137,6 @@ static Standard_Integer DFOpenAttribute (Draw_Interpretor& di,
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//=======================================================================
//function : BrowserCommands
//purpose :
@@ -157,7 +144,6 @@ static Standard_Integer DFOpenAttribute (Draw_Interpretor& di,
void DDF::BrowserCommands (Draw_Interpretor& theCommands)
{
/*
static Standard_Boolean done = Standard_False;
if (done) return;
done = Standard_True;
@@ -189,5 +175,4 @@ void DDF::BrowserCommands (Draw_Interpretor& theCommands)
"DON'T USE THIS COMMAND RESERVED TO THE BROWSER!\nReturns information about an attribute, a df or a label: DFDisplayInfo {#} | {browsername [label]}",
__FILE__, DFDisplayInfo, g);
#endif
*/
}