]> Creatis software - crea.git/blobdiff - lib/creaDevManagerLib/wxCDMMainFrame.cpp
Feature #1711
[crea.git] / lib / creaDevManagerLib / wxCDMMainFrame.cpp
index d8ffea1e4f50b10728a563145b306e437f4bd434..5538fa7052148011c283fce66a2d3924c78f86d2 100755 (executable)
 #include "creaDevManagerIds.h"
 #include "wxCDMMainDescriptionPanel.h"
 #include "wxCDMProjectDescriptionPanel.h"
+#include "wxCDMAppliDescriptionPanel.h"
+#include "wxCDMApplicationDescriptionPanel.h"
+#include "wxCDMLibDescriptionPanel.h"
+#include "wxCDMLibraryDescriptionPanel.h"
+#include "wxCDMPackageDescriptionPanel.h"
+#include "wxCDMBlackBoxDescriptionPanel.h"
+
 #include "wxCDMProjectActionsPanel.h"
 #include "wxCDMNewProjectDialog.h"
 
@@ -587,9 +594,234 @@ void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event)
   std::cout << "Tree Selection: " << element->GetName() << std::endl;
 
   //TODO get element type
-  //TODO create element description
-  //TODO delete old view
-  //TODO set new view
+  //project
+  modelCDMProject* elementProject = dynamic_cast<modelCDMProject*>(element);
+  if(elementProject != NULL)
+    {
+
+      //create element description
+      wxCDMProjectDescriptionPanel* description = new wxCDMProjectDescriptionPanel(
+          this,
+          elementProject,
+          ID_WINDOW_PROPERTIES,
+          wxT("Description Panel"),
+          wxDefaultPosition,
+          wxSize(300, 400),
+          0
+      );
+      //delete old view
+      if(this->panel_Properties!= NULL)
+        {
+          this->panel_Properties->Hide();
+          this->panel_Properties->Destroy();
+          auiManager.DetachPane(this->panel_Properties);
+        }
+      //set new view
+      this->panel_Properties = description;
+      auiManager.AddPane(panel_Properties, wxCENTER, wxT("Properties"));
+      auiManager.Update();
+      event.Skip();
+      return;
+    }
+  //appli
+  modelCDMAppli* elementAppli = dynamic_cast<modelCDMAppli*>(element);
+  if(elementAppli != NULL)
+    {
+      //create element description
+      wxCDMAppliDescriptionPanel* description = new wxCDMAppliDescriptionPanel(
+          this,
+          elementAppli,
+          ID_WINDOW_PROPERTIES,
+          wxT("Description Panel"),
+          wxDefaultPosition,
+          wxSize(300, 400),
+          0
+      );
+      //delete old view
+      if(this->panel_Properties!= NULL)
+        {
+          this->panel_Properties->Hide();
+          this->panel_Properties->Destroy();
+          auiManager.DetachPane(this->panel_Properties);
+        }
+      //set new view
+      this->panel_Properties = description;
+      auiManager.AddPane(panel_Properties, wxCENTER, wxT("Properties"));
+      auiManager.Update();
+      event.Skip();
+      return;
+    }
+  //application
+  modelCDMApplication* elementApplication = dynamic_cast<modelCDMApplication*>(element);
+  if(elementApplication != NULL)
+    {
+      //create element description
+      wxCDMApplicationDescriptionPanel* description = new wxCDMApplicationDescriptionPanel(
+          this,
+          elementApplication,
+          ID_WINDOW_PROPERTIES,
+          wxT("Description Panel"),
+          wxDefaultPosition,
+          wxSize(300, 400),
+          0
+      );
+      //delete old view
+      if(this->panel_Properties!= NULL)
+        {
+          this->panel_Properties->Hide();
+          this->panel_Properties->Destroy();
+          auiManager.DetachPane(this->panel_Properties);
+
+        }
+      //set new view
+      this->panel_Properties = description;
+      auiManager.AddPane(panel_Properties, wxCENTER, wxT("Properties"));
+      auiManager.Update();
+      event.Skip();
+      return;
+    }
+  //lib
+  modelCDMLib* elementLib = dynamic_cast<modelCDMLib*>(element);
+  if(elementLib != NULL)
+    {
+      //create element description
+      wxCDMLibDescriptionPanel* description = new wxCDMLibDescriptionPanel(
+          this,
+          elementLib,
+          ID_WINDOW_PROPERTIES,
+          wxT("Description Panel"),
+          wxDefaultPosition,
+          wxSize(300, 400),
+          0
+      );
+      //delete old view
+      if(this->panel_Properties!= NULL)
+        {
+          this->panel_Properties->Hide();
+          this->panel_Properties->Destroy();
+          auiManager.DetachPane(this->panel_Properties);
+
+        }
+      //set new view
+      this->panel_Properties = description;
+      auiManager.AddPane(panel_Properties, wxCENTER, wxT("Properties"));
+      auiManager.Update();
+      event.Skip();
+      return;
+    }
+  //library
+  modelCDMLibrary* elementLibrary = dynamic_cast<modelCDMLibrary*>(element);
+  if(elementLibrary != NULL)
+    {
+      //create element description
+      wxCDMLibraryDescriptionPanel* description = new wxCDMLibraryDescriptionPanel(
+          this,
+          elementLibrary,
+          ID_WINDOW_PROPERTIES,
+          wxT("Description Panel"),
+          wxDefaultPosition,
+          wxSize(300, 400),
+          0
+      );
+      //delete old view
+      if(this->panel_Properties!= NULL)
+        {
+          this->panel_Properties->Hide();
+          this->panel_Properties->Destroy();
+          auiManager.DetachPane(this->panel_Properties);
+
+        }
+      //set new view
+      this->panel_Properties = description;
+      auiManager.AddPane(panel_Properties, wxCENTER, wxT("Properties"));
+      auiManager.Update();
+      event.Skip();
+      return;
+    }
+  //package
+  modelCDMPackage* elementPackage = dynamic_cast<modelCDMPackage*>(element);
+  if(elementPackage != NULL)
+    {
+      //create element description
+      wxCDMPackageDescriptionPanel* description = new wxCDMPackageDescriptionPanel(
+          this,
+          elementPackage,
+          ID_WINDOW_PROPERTIES,
+          wxT("Description Panel"),
+          wxDefaultPosition,
+          wxSize(300, 400),
+          0
+      );
+      //delete old view
+      if(this->panel_Properties!= NULL)
+        {
+          this->panel_Properties->Hide();
+          this->panel_Properties->Destroy();
+          auiManager.DetachPane(this->panel_Properties);
+
+        }
+      //set new view
+      this->panel_Properties = description;
+      auiManager.AddPane(panel_Properties, wxCENTER, wxT("Properties"));
+      auiManager.Update();
+      event.Skip();
+      return;
+    }
+  //black box
+  modelCDMBlackBox* elementBlackBox = dynamic_cast<modelCDMBlackBox*>(element);
+  if(elementBlackBox != NULL)
+    {
+      //create element description
+      wxCDMBlackBoxDescriptionPanel* description = new wxCDMBlackBoxDescriptionPanel(
+          this,
+          elementBlackBox,
+          ID_WINDOW_PROPERTIES,
+          wxT("Description Panel"),
+          wxDefaultPosition,
+          wxSize(300, 400),
+          0
+      );
+      //delete old view
+      if(this->panel_Properties!= NULL)
+        {
+          this->panel_Properties->Hide();
+          this->panel_Properties->Destroy();
+          auiManager.DetachPane(this->panel_Properties);
+
+        }
+      //set new view
+      this->panel_Properties = description;
+      auiManager.AddPane(panel_Properties, wxCENTER, wxT("Properties"));
+      auiManager.Update();
+      event.Skip();
+      return;
+    }
+  //TODO: CMakeLists
+  //TODO: folder
+  //TODO: file
+  //TODO: main
+  //create element description
+  wxCDMMainDescriptionPanel* description = new wxCDMMainDescriptionPanel(
+      this,
+      ID_WINDOW_PROPERTIES,
+      wxT("Description Panel"),
+      wxDefaultPosition,
+      wxSize(300, 400),
+      0
+  );
+  //delete old view
+  if(this->panel_Properties!= NULL)
+    {
+      this->panel_Properties->Hide();
+      this->panel_Properties->Destroy();
+      auiManager.DetachPane(this->panel_Properties);
+
+    }
+  //set new view
+  this->panel_Properties = description;
+  auiManager.AddPane(panel_Properties, wxCENTER, wxT("Properties"));
+  auiManager.Update();
   event.Skip();
+  return;
 
 }