]> Creatis software - crea.git/blobdiff - lib/creaDevManagerLib/wxCDMProjectActionsPanel.cpp
Feature #1711 CreaDevManager application implementation
[crea.git] / lib / creaDevManagerLib / wxCDMProjectActionsPanel.cpp
index ddfe262e867ed7271cd971e5045e3903be2843e8..514d247faf7c32e3728ec5b640a5a4b5f8662232 100755 (executable)
@@ -77,8 +77,10 @@ bool wxCDMProjectActionsPanel::Create(
   wxPanel::Create(parent,id,pos,size,style);
   wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
   this->SetSizer(sizer);
-
   CreateControls();
+  // this part makes the scrollbars show up
+  this->FitInside(); // ask the sizer about the needed size
+  this->SetScrollRate(5, 5);
 
   return TRUE;
 }
@@ -125,39 +127,53 @@ void wxCDMProjectActionsPanel::OnBtnConfigureBuild(wxCommandEvent& event)
 void wxCDMProjectActionsPanel::OnBtnBuildProject(wxCommandEvent& event)
 {
 #ifdef _WIN32
-       std::string* result;
-       if(!this->project->Build(result, ""))
-       {
-         wxMessageBox(crea::std2wx(result->c_str()), wxT("Project Compilation - Error!"));
-         return;
-       }
+  std::string* result;
+  if(!this->project->Build(result, ""))
+    {
+      wxMessageBox(crea::std2wx(result->c_str()), wxT("Project Compilation - Error!"));
+      return;
+    }
 #else
-  //get author from user
-  wxTextEntryDialog* buildDlg = new wxTextEntryDialog(
-      this,
-      wxT("Enter the compilation instruction:"),
-      wxT("Project Compilation- creaDevManager"),
-      crea::std2wx(this->project->GetBuildInstruction()),
-      wxTE_MULTILINE | wxOK | wxCANCEL
-  );
-
-  if (buildDlg->ShowModal() == wxID_OK)
+
+  std::string* result;
+  int isDir = wxMessageBox(crea::std2wx("Is this the path of the project compilation?:\n"+this->project->GetBuildPath()), wxT("Project Compilation - CreaDevManager"), wxYES_NO|wxCANCEL);
+  if(isDir != wxCANCEL)
     {
-      std::string buildDlgStr = crea::wx2std(buildDlg->GetValue());
-      //check name
-      if (buildDlgStr != "")
+      wxString file = crea::std2wx(this->project->GetBuildPath());
+      if(isDir == wxNO)
         {
-          std::string* result;
-          //wxProgressDialog* loadBar = new wxProgressDialog(wxT("Compiling"), wxT("Please wait while the compilation is executing..."), 100, this);
-          //loadBar->Pulse();
-          if(!this->project->Build(result, buildDlgStr))
+          file = wxDirSelector(
+              wxT("Please select the folder where your project is to be built."),
+              crea::std2wx(this->project->GetBuildPath())
+          );
+        }
+
+      if(!file.IsEmpty())
+        {
+          this->project->SetBuildPath(crea::wx2std(file), result);
+
+          wxTextEntryDialog* buildDlg = new wxTextEntryDialog(
+                this,
+                wxT("Check the compilation instruction:"),
+                wxT("Project Compilation - CreaDevManager"),
+                crea::std2wx(this->project->GetBuildInstruction()),
+                wxTE_MULTILINE | wxOK | wxCANCEL
+            );
+
+          if (buildDlg->ShowModal() == wxID_OK)
             {
-              //loadBar->Destroy();
-              wxMessageBox(crea::std2wx(result->c_str()), wxT("Project Compilation - Error!"));
-              return;
+              std::string buildDlgStr = crea::wx2std(buildDlg->GetValue());
+              //check line
+              if (buildDlgStr != "")
+                {
+                  std::string* result;
+                  if(!this->project->Build(result, buildDlgStr))
+                    {
+                      wxMessageBox(crea::std2wx(result->c_str()), wxT("Project Compilation - Error!"));
+                      return;
+                    }
+                }
             }
-          //loadBar->Destroy();
-          //wxMessageBox(crea::std2wx("The compilation was executed successfully. Please check the \"building.log\" file located in the build folder to check the compilation result."), wxT("Project Compilation"));
         }
     }
 #endif
@@ -166,20 +182,31 @@ void wxCDMProjectActionsPanel::OnBtnBuildProject(wxCommandEvent& event)
 void wxCDMProjectActionsPanel::OnBtnConnectProject(wxCommandEvent& event)
 {
   std::string* result;
-  wxString file = wxDirSelector(
-    wxT("Please select the folder containing the bbtkPackage file you want to use. Usually it is where you built your project."),
-    crea::std2wx(this->project->GetBuildPath())
-  );
-
-  if(file.IsEmpty() || !this->project->Connect(result, crea::wx2std(file)))
+  int isDir = wxMessageBox(crea::std2wx("Is this the path of the project compilation to plug?:\n"+this->project->GetBuildPath()), wxT("Plug BBTK Packages"), wxYES_NO|wxCANCEL);
+  if(isDir != wxCANCEL)
     {
-      wxMessageBox(crea::std2wx(result->c_str()), wxT("Plug Packages - Error!"));
-      return;
+      wxString file = crea::std2wx(this->project->GetBuildPath());
+      if(isDir == wxNO)
+        {
+          file = wxDirSelector(
+              wxT("Please select the folder containing the bbtkPackage file you want to use. Usually it is where you built your project."),
+              crea::std2wx(this->project->GetBuildPath())
+          );
+        }
+
+      if(!file.IsEmpty())
+        {
+          if(!this->project->Connect(result, crea::wx2std(file)))
+            {
+              wxMessageBox(crea::std2wx(result->c_str()), wxT("Plug BBTK Packages - Error!"), wxICON_ERROR);
+              return;
+            }
+          else
+            {
+              wxMessageBox(crea::std2wx("The connection was executed successfully. Please check the console to see the compilation result.\n Also, don't forget to restart the BBTK Graphical Editor (if already opened) to see the plugged packages."), wxT("Plug Package"));
+            }
+
+        }
+
     }
-#ifdef _WIN32
-  wxMessageBox(crea::std2wx("The connection was executed successfully. Please check the console to see the compilation result."), wxT("Plug Package"));
-#else
-  wxMessageBox(crea::std2wx("The connection was executed successfully. Please check the \"plugging.log\" file located in the build folder to see the compilation result."), wxT("Plug Package"));
-#endif
-  
 }