]> Creatis software - bbtkGEditor.git/blobdiff - lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx
*** empty log message ***
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsWxGUIEditorGraphic / bbtkwxGUIEditorGraphicBBS.cxx
index 8d8c5774f5e74919c41593bcaecc8b19f479750a..0f87071f6fdadb24053f960ae8a0102ab488d2b9 100644 (file)
@@ -90,29 +90,19 @@ namespace bbtk
                //Adds a tool btn to the toolbar
                _toolbar->AddTool(wxID_NEW,_T("New"),bmp_new, wxNullBitmap, wxITEM_NORMAL,_T("New tab"), _T("Create a new panel tab"));
 
-
-               ////////////////////
-               // TEMP to avoid drag and drop
-                       
-               _toolbar->AddTool(15,_T("New Box"),bmp_new, wxNullBitmap, wxITEM_NORMAL,_T("New Box"), _T("Create a new Box"));
-
-
-               //
-               ////////////////////
-
                _toolbar->SetMargins( 2, 2 );
                _toolbar->Realize();
                SetToolBar(_toolbar);
 
                // connect command event handlers
                Connect(wxID_NEW,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnToolLeftClick));
-               Connect(15,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnToolLeftClick));
 
        }
        //=========================================================================
        void wxGUIEditorGraphicBBS::initHelpHTMLBrowser()
        {
-               
+               //TO FIX THE PATH OF BBTK BIN  IN ORDER TO USE REGENERATE EXECUTABLES
+               //RegenerateAll();
                _helpHtmlBrowser = new WxGUIHtmlBrowser(this,wxSize(200,0));
                _frameAUIMgr->AddPane(_helpHtmlBrowser,wxAuiPaneInfo().Right().MinSize(200,200));       
        }
@@ -156,6 +146,104 @@ namespace bbtk
                _frameAUIMgr->AddPane(_pkgBrowser,wxAuiPaneInfo().Left().MinSize(200,200).CloseButton(false));          
        }
 
+       //================================================================
+
+       void wxGUIEditorGraphicBBS::DoRegeneratePackageDoc( const std::string& pack )
+       {
+               std::string mess("Regenerating doc for package '");
+               if (pack!="-a"){
+                       mess += pack + "'";
+               }
+               else
+               {
+                       mess = "Regenerating doc for all packages";
+               }
+               
+               mess += " ... please wait";             
+
+               SetStatusText( std2wx(mess) );
+
+               //BBTK_BUSY_CURSOR;
+
+               std::string command;
+               #if defined(WIN32)
+                       command = "\"";
+               #endif
+                       command += ConfigurationFile::GetInstance().Get_bin_path();
+                       command += ConfigurationFile::GetInstance().Get_file_separator();
+                       command += "bbRegeneratePackageDoc";
+               #if defined(WIN32)
+                       command += "\"";
+               #endif
+
+               command += " " + pack + " -q";
+           bbtkMessage("debug",1,"Executing system command '"<<command<<"'"<<std::endl);
+
+               if ( ! system ( command.c_str() ) )
+               {
+                       SetStatusText( _T("Done !"));
+                       /*
+                       wxMessageBox(_T("Done !"),_T("Regenerate package '")
+                                        +std2wx(pack)+_T("' doc"),
+                                        wxOK | wxICON_INFORMATION);
+                       */
+               }
+               else 
+               {
+                       SetStatusText( _T("Done !"));
+                       wxString err(_T("An error occured while running '"));
+                       err +=  bbtk::std2wx(command) + _T("'");
+                       wxMessageBox(err,_T("Regenerate package doc"),wxOK | wxICON_ERROR);      
+           }
+       }
+
+       //================================================================
+       void wxGUIEditorGraphicBBS::DoRegenerateBoxesLists()
+       {
+               SetStatusText( _T("Regenerating boxes lists ... please wait") );
+               //BBTK_BUSY_CURSOR ;
+
+               std::string command;
+               #if defined(WIN32)
+                       command = "\"";
+               #endif
+                       command += ConfigurationFile::GetInstance().Get_bin_path();
+                       command += ConfigurationFile::GetInstance().Get_file_separator();
+                       command += "bbRegenerateBoxesLists";
+
+               #if defined(WIN32)
+                       command += "\"";
+               #endif
+                       command += " -q";
+
+               bbtkMessage("debug",1,"Executing system command '"<<command<<"'"<<std::endl);
+
+               if ( ! system ( command.c_str() ) )
+               {
+                       SetStatusText( _T("Done !"));
+                       /*
+                       wxMessageBox(_T("Done !"),_T("Regenerate boxes lists"),
+                                        wxOK | wxICON_INFORMATION);
+                       */
+               }
+               else 
+               {
+                       SetStatusText( _T("Done !"));
+                       wxString err(_T("An error occured while running '"));
+                       err +=  bbtk::std2wx(command) + _T("'");
+                       wxMessageBox(err,_T("Regenerate boxes lists"),wxOK | wxICON_ERROR);      
+               }
+       }
+       
+  //================================================================
+       void wxGUIEditorGraphicBBS::RegenerateAll()
+       {
+               DoRegeneratePackageDoc("-a");   
+               DoRegenerateBoxesLists();
+       }
+
+  //================================================================
+
        /*****************************************************
        /* HANDLERS 
        /*****************************************************/
@@ -167,10 +255,7 @@ namespace bbtk
                case wxID_NEW :
                        std::cout<<"RaC New"<<std::endl;
                        _tabsMgr->addNewTab();
-                       break;
-               case 15 :
-                       BlackBoxDescriptor* desc = _pkgBrowser->GetActualSelected();
-                       
+                       break;                  
                }
        }