]> Creatis software - bbtk.git/blobdiff - kernel/appli/bbfy/bbfy.cpp
New widget pipeline : progressing ...
[bbtk.git] / kernel / appli / bbfy / bbfy.cpp
index bb420978b4ec88ba69b36820dfb347958d8c77d3..c22be3230c127a088389c5f7c3401acecee11f9d 100644 (file)
@@ -20,8 +20,8 @@ public:
 //==========================================================================
 
 const std::string itkImageToImageFilterString = "ITK_ImageToImageFilter";
-const std::string vtkImageAlgorithmString = "VTK_ImageAlgorithm";
-const std::string vtkPolyDataAlgorithmString = "VTK_PolyDataAlgorithm";
+const std::string vtkImageAlgorithmString     = "VTK_ImageAlgorithm";
+const std::string vtkPolyDataAlgorithmString  = "VTK_PolyDataAlgorithm";
 
 //==========================================================================
 class bbfy
@@ -277,19 +277,21 @@ void bbfy::ParseXML()
     }
 
   // UserConstructor body
-  if (BB.nChildNode("userconstructor"))
+  if (BB.nChildNode("constructor"))
     {
-      bbtk::GetTextOrClear(BB.getChildNode("userconstructor"),mUserConstructor);
+      bbtk::GetTextOrClear(BB.getChildNode("constructor"),mUserConstructor);
     }
+    
   // UserCopyConstructor body
-  if (BB.nChildNode("usercopyconstructor"))
+  if (BB.nChildNode("copyconstructor"))
     {
-      bbtk::GetTextOrClear(BB.getChildNode("usercopyconstructor"),mUserCopyConstructor);
+      bbtk::GetTextOrClear(BB.getChildNode("copyconstructor"),mUserCopyConstructor);
     }
+    
   // UserDestructor body
-  if (BB.nChildNode("userdestructor"))
+  if (BB.nChildNode("destructor"))
     {
-      bbtk::GetTextOrClear(BB.getChildNode("userdestructor"),mUserDestructor);
+      bbtk::GetTextOrClear(BB.getChildNode("destructor"),mUserDestructor);
     }
  
     // Template parameters
@@ -421,6 +423,7 @@ void bbfy::ParseXML()
      {
        bbtk::GetTextOrClear(BB.getChildNode("process"),mProcess);
      }
+     
   // CreateWidget
   // createwidget tag given ?
    if (BB.nChildNode("createwidget"))
@@ -515,7 +518,6 @@ void bbfy::CreateHeader()
   // Class declaration and parents
   mFile << "class /*BBTK_EXPORT*/ "<<mName<<"\n";
   mFile << " : \n";
-  mFile << "   public "<<mParentBlackBox;
 
   /*
   if (mBB.nChildNode("inherits"))
@@ -535,18 +537,16 @@ void bbfy::CreateHeader()
 
   if (mType == itkImageToImageFilter )
     {
-      mFile << ",\n   public " << mItkParent <<"\n";
+      mFile << "   public " << mItkParent <<",\n";
     }
   else if ( (mType == vtkImageAlgorithm) ||
            (mType == vtkPolyDataAlgorithm) )
     {
-      mFile << ",\n   public " << mVtkParent <<"\n";
-    }
-  else 
-    {
-      mFile << "\n";
+      mFile << "   public " << mVtkParent <<",\n";
     }
 
+  mFile << "   public "<<mParentBlackBox << "\n";
+
   mFile << "{\n";
 
   // Interface
@@ -589,7 +589,7 @@ void bbfy::CreateHeader()
 
   mFile << "virtual void bbUserConstructor();"<<std::endl;
   mFile << "/// User callback called in the box copy constructor"<<std::endl;
-  mFile << "virtual void bbUserCopyConstructor();"<<std::endl;
+  mFile << "virtual void bbUserCopyConstructor(bbtk::BlackBox::Pointer);"<<std::endl;
   mFile << "/// User callback called in the box destructor"<<std::endl;
   mFile << "virtual void bbUserDestructor();"<<std::endl;
   mFile << "//=================================================================="<<std::endl; 
@@ -698,7 +698,6 @@ void bbfy::CreateHeader()
        }
     }
   
-
   // Process
   if ((mType == STD)||(mProcess.size()))
     {
@@ -720,15 +719,13 @@ void bbfy::CreateHeader()
   if (mIsWidget) 
     {
        mFile << "  BBTK_CREATE_WIDGET(CreateWidget);\n" ;
-       mFile << "  void CreateWidget();\n";
+       mFile << "  void CreateWidget(wxWindow*);\n";
     }
 
 
   // EO black box declaration
   mFile << "};\n\n";
 
-
-
   // BO black box description
   if (mTemplateParam.size()==0)
     {
@@ -1042,20 +1039,21 @@ void bbfy::CreateCode()
   // CreateWidget
   if (mIsWidget)
     {
-      mFile << "void "<<mName<<"::CreateWidget()\n{\n";
+      mFile << "void "<<mName<<"::CreateWidget(wxWindow* parent)\n{\n";
       mFile << mCreateWidget << "\n";
       mFile << "}\n";
     }
-  
 
   // User constr / copy constr / destr implementation
   mFile <<"void "<<mName<<"::bbUserConstructor()"<<std::endl;
   mFile << "{"<<std::endl;
   //mFile<<"bbtkDebugMessage(\"Kernel\",9,\""<<mName<<::bbUserConstructor()"<<std::endl);"<<std::endl;
+  
   mFile << mUserConstructor << std::endl;
   mFile << "}" << std::endl;
 
-  mFile <<"void "<<mName<<"::bbUserCopyConstructor()"<<std::endl;
+  mFile <<"void "<<mName<<"::bbUserCopyConstructor(bbtk::BlackBox::Pointer)"
+       <<std::endl;
   mFile << "{"<<std::endl;
   //mFile<<"bbtkDebugMessage(\"Kernel\",9,\""<<mName<<::bbUserCopyConstructor()"<<std::endl);"<<std::endl;
   mFile << mUserCopyConstructor << std::endl;