From: szy Date: Thu, 12 Apr 2012 09:54:51 +0000 (+0400) Subject: 0023085: Call of tcl DFBrowser leads to error message X-Git-Tag: V6_5_3~19 X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff_plain;h=409cc8d1dc538399c12ffe6c651ce406013afac1 0023085: Call of tcl DFBrowser leads to error message Fix the problem of bug ID 23085. Now dftree.tcl script is loaded (if found) inside the command. Compilation problem fixed (missing include), redundant comments removed, code simplified, error messages added --- diff --git a/src/DDF/DDF_BrowserCommands.cxx b/src/DDF/DDF_BrowserCommands.cxx index 157e904944..ac12a6d2b8 100755 --- a/src/DDF/DDF_BrowserCommands.cxx +++ b/src/DDF/DDF_BrowserCommands.cxx @@ -17,12 +17,6 @@ // purpose or non-infringement. Please see the License for the specific terms // and conditions governing the rights and limitations under the License. -// ----------------------- - -// Version: 0.0 -//Version Date Purpose -// 0.0 Oct 3 1997 Creation - #include #include @@ -41,6 +35,8 @@ #include #include +#include + #ifdef WNT #include #endif @@ -56,19 +52,44 @@ static Standard_Integer DFBrowse (Draw_Interpretor& di, Standard_Integer n, const char** a) { - if (n<2) return 1; + if (n<2) + { + cout << "Use: " << a[0] << " document [brower_name]" << endl; + return 1; + } Handle(TDF_Data) DF; - if (!DDF::GetDF (a[1], DF)) return 1; + if (!DDF::GetDF (a[1], DF)) + { + cout << "Error: document " << a[1] << " is not found" << endl; + return 1; + } Handle(DDF_Browser) NewDDFBrowser = new DDF_Browser(DF); TCollection_AsciiString name("browser_"); name += ((n == 3)? a[2] : a[1]); Draw::Set (name.ToCString(), NewDDFBrowser); - TCollection_AsciiString inst1("dftree "); - inst1.AssignCat(name); - di.Eval(inst1.ToCString()); + // Load Tcl Script + TCollection_AsciiString aTclScript (getenv ("CSF_DrawPluginDefaults")); + aTclScript.AssignCat ( "/dftree.tcl" ); + OSD_File aTclScriptFile (aTclScript); + if (aTclScriptFile.Exists()) { +#ifdef DEB + cout << "Load " << aTclScript << endl; +#endif + di.EvalFile( aTclScript.ToCString() ); + } + else + { + cout << "Error: Could not load script " << aTclScript << endl; + cout << "Check environment variable CSF_DrawPluginDefaults" << endl; + } + + // Call command dftree defined in dftree.tcl + TCollection_AsciiString aCommand = "dftree "; + aCommand.AssignCat(name); + di.Eval(aCommand.ToCString()); return 0; }