0028643: Coding rules - eliminate GCC compiler warnings -Wmisleading-indentation
[occt.git] / src / XSDRAW / XSDRAW.cxx
old mode 100755 (executable)
new mode 100644 (file)
index f7a04e6..8c8ef6b
@@ -1,50 +1,49 @@
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
 //
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
+// This file is part of Open CASCADE Technology software library.
 //
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
 //
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-#include <XSDRAW.ixx>
-#include <Dico_DictionaryOfInteger.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TColStd_HSequenceOfAsciiString.hxx>
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#include <DBRep.hxx>
+#include <Draw_Appli.hxx>
 #include <IFSelect_Functions.hxx>
 #include <IFSelect_SessionPilot.hxx>
-#include <SWDRAW.hxx>
-//#include <XSDRAW_Shape.hxx>
-#include <XSDRAW_Vars.hxx>
-#include <XSControl_Functions.hxx>
-#include <XSControl_FuncShape.hxx>
-#include <Draw_Appli.hxx>
-#include <XSControl.hxx>
-#include <XSControl_TransferWriter.hxx>
-
+#include <Interface_InterfaceModel.hxx>
+#include <Interface_Macros.hxx>
+#include <Interface_Protocol.hxx>
+#include <Message.hxx>
+#include <Standard_Transient.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <TColStd_HSequenceOfAsciiString.hxx>
 #include <TopoDS_Shape.hxx>
+#include <Transfer_FinderProcess.hxx>
+#include <Transfer_TransientProcess.hxx>
 #include <TransferBRep.hxx>
-#include <DBRep.hxx>
+#include <XSControl.hxx>
+#include <XSControl_Controller.hxx>
+#include <XSControl_FuncShape.hxx>
+#include <XSControl_Functions.hxx>
+#include <XSControl_TransferReader.hxx>
+#include <XSControl_TransferWriter.hxx>
+#include <XSControl_WorkSession.hxx>
+#include <XSDRAW.hxx>
+#include <XSDRAW_Vars.hxx>
 
-#include <Interface_Macros.hxx>
 #include <stdio.h>
-
-#include <Message.hxx>
-#include <Message_Messenger.hxx>
-
+//#include <XSDRAW_Shape.hxx>
 static int deja = 0, dejald = 0;
 //unused variable 
 //static int okxset = 0;
 
-static Handle(Dico_DictionaryOfInteger)       theolds;
+static NCollection_DataMap<TCollection_AsciiString, Standard_Integer> theolds;
 static Handle(TColStd_HSequenceOfAsciiString) thenews;
 
 static Handle(IFSelect_SessionPilot)    thepilot;  // detient Session, Model
@@ -64,7 +63,6 @@ static Standard_Integer XSTEPDRAWRUN (Draw_Interpretor& , Standard_Integer argc,
     void  XSDRAW::ChangeCommand
   (const Standard_CString oldname, const Standard_CString newname)
 {
-  if (theolds.IsNull()) theolds = new Dico_DictionaryOfInteger;
   Standard_Integer num = 0;
   if (newname[0] != '\0') {
     if (thenews.IsNull()) thenews = new TColStd_HSequenceOfAsciiString();
@@ -72,7 +70,7 @@ static Standard_Integer XSTEPDRAWRUN (Draw_Interpretor& , Standard_Integer argc,
     thenews->Append(newstr);
     num = thenews->Length();
   }
-  theolds->SetItem (oldname,num);
+  theolds.Bind(oldname,num);
 }
 
     void  XSDRAW::RemoveCommand
@@ -99,16 +97,19 @@ static Standard_Integer XSTEPDRAWRUN (Draw_Interpretor& , Standard_Integer argc,
 
 void XSDRAW::LoadDraw (Draw_Interpretor& theCommands)
 {
-  if (dejald) return;  dejald = 1;
-//  XSDRAW_Shape::InitCommands (theCommands);
-//  Pour tout faire d un coup : BRepTest & cie, SWDRAW & cie :
-  SWDRAW::Init (theCommands);
+  if (dejald)
+  {
+    return;
+  }
+  dejald = 1;
+//  Pour tout faire d un coup : BRepTest & cie:
   LoadSession();
 
   //skl: we make remove commands "x" and "exit" in order to this commands are
   //     performed not in IFSelect_SessionPilot but in standard Tcl interpretor
   XSDRAW::RemoveCommand("x");
   XSDRAW::RemoveCommand("exit");
+
 //  if (!getenv("WBHOSTTOP")) XSDRAW::RemoveCommand("xsnew");
   Handle(TColStd_HSequenceOfAsciiString) list =
     IFSelect_Activator::Commands(0);
@@ -119,11 +120,11 @@ void XSDRAW::LoadDraw (Draw_Interpretor& theCommands)
     Standard_Integer nact, num = -1;
     char help[200];
     com = list->Value(i);
-    if (!theolds.IsNull())
-      if (theolds->HasItem(com.ToCString())) num = theolds->Item(com.ToCString());
+    if (!theolds.IsEmpty())
+      theolds.Find(com, num);
     if (num == 0) continue;
     if (!IFSelect_Activator::Select(com.ToCString(),nact,act))
-      sprintf (help,"type :  xhelp %s for help",com.ToCString());
+      Sprintf (help,"type :  xhelp %s for help",com.ToCString());
     else if (!act.IsNull()) strcpy(help,act->Help(nact));
     if (num < 0) theCommands.Add (com.ToCString(),help,XSTEPDRAWRUN,act->Group());
     else theCommands.Add (thenews->Value(num).ToCString(),help,XSTEPDRAWRUN,act->Group());
@@ -134,11 +135,8 @@ void XSDRAW::LoadDraw (Draw_Interpretor& theCommands)
     (const Standard_CString command, const Standard_CString varname)
 {
   char mess[100];
-  sprintf (mess,command,varname);
-#ifdef DEB
-  IFSelect_ReturnStatus stat = 
-#endif
-    thepilot->Execute (mess);
+  Sprintf (mess,command,varname);
+  thepilot->Execute (mess);
   return 1;  // stat ?
 }
 
@@ -161,11 +159,9 @@ void XSDRAW::LoadDraw (Draw_Interpretor& theCommands)
       {  return Session()->NormAdaptor();  }
 
     Standard_Boolean  XSDRAW::SetNorm
-  (const Standard_CString norm, const Standard_CString profile)
+  (const Standard_CString norm)
 {
-  Standard_Boolean stat = Session()->SelectNorm (norm,profile);
-  if (stat) IFSelect_Activator::SetCurrentAlias (Session()->SelectedNorm(Standard_True));
-  return stat;
+  return Session()->SelectNorm (norm);
 }
 
     Handle(Interface_Protocol)   XSDRAW::Protocol ()
@@ -265,7 +261,7 @@ void XSDRAW::LoadDraw (Draw_Interpretor& theCommands)
 
 //  FONCTION POUR LE DEBUG
 
-Standard_Integer XSDRAW_WHAT (const Handle_Standard_Transient& ent)
+Standard_Integer XSDRAW_WHAT (const Handle(Standard_Transient)& ent)
 {
   if (ent.IsNull()) { cout<<"(Null Handle)"<<endl; return 0; }
   Handle(Interface_InterfaceModel) model = XSDRAW::Model();