]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkWxGUIScriptingInterface.cxx
*** empty log message ***
[bbtk.git] / kernel / src / bbtkWxGUIScriptingInterface.cxx
index da5431039ff3ca26cf629765b63525afa28396c0..669d9ac2cb0eb4bdff773e38de94ec95deb72e56 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkWxGUIScriptingInterface.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/04/24 10:11:28 $
-  Version:   $Revision: 1.7 $
+  Date:      $Date: 2008/06/26 06:50:05 $
+  Version:   $Revision: 1.12 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -57,7 +57,8 @@ namespace bbtk
       ID_Menu_Windows_Help,
       ID_Menu_Windows_Messages,
       ID_Menu_Windows_Command,
-      ID_Menu_Windows_Save
+      ID_Menu_Windows_Save,
+      ID_Menu_Windows_PackageBrowser
       //      ID_Button_Run
     };
     
@@ -89,7 +90,7 @@ namespace bbtk
     menuTools->Append( ID_Menu_CreateBlackBox, _T("Create &blackbox") );
     menuTools->Append( ID_Menu_ShowImageGraph, _T("&Show last image graph") );
     menuTools->Append( ID_Menu_CreateIndex, _T("&Generate index") );
-    
+
     wxMenu *menuWindows = new wxMenu;
     menuWindows->AppendCheckItem(ID_Menu_Windows_Files,
                                 _T("Show 'files' panel") )->Check();
@@ -99,6 +100,8 @@ namespace bbtk
                                 _T("Show 'messages' panel") )->Check();
     menuWindows->AppendCheckItem(ID_Menu_Windows_Command,
                                 _T("Show 'command' panel") )->Check();
+    menuWindows->AppendSeparator();
+    menuWindows->Append( ID_Menu_Windows_PackageBrowser, _T("Show Package &Browser") );
     
     menuWindows->AppendSeparator();
     menuWindows->Append ( ID_Menu_Windows_Save, _T("Save interface configuration"));
@@ -123,10 +126,11 @@ namespace bbtk
     //
     mWxGUITextEditor = new WxGUITextEditor(this,this);
     mWxGUITextEditor->SetFileNameFilter("*.bbs");
+       
+    mWxGUIHtmlBrowser          = new WxGUIHtmlBrowser(this,wxSize(200,0),this);
 
-    mWxGUIHtmlBrowser = new WxGUIHtmlBrowser(this,wxSize(200,0),this);
 
-    /*    
+       /*    
          wxBitmap bmp_run(cc_run_xpm);
          mwxButtonRun = new wxBitmapButton( this, ID_Button_Run,bmp_run);//_T("Run")  );
     */
@@ -137,8 +141,41 @@ namespace bbtk
    
     mWxGUICommand->SetFocus();
 
-    
+
+    mwxNotebook = new wxAuiNotebook(this,  
+                                   -1,
+                                   wxPoint(0, 0),
+                                   wxSize(500,500),
+                                   wxAUI_NB_TAB_SPLIT 
+                                   | wxAUI_NB_TAB_MOVE
+                                   | wxAUI_NB_TAB_EXTERNAL_MOVE
+                                   //| wxAUI_NB_WINDOWLIST_BUTTON
+                                   //|wxAUI_NB_SCROLL_BUTTONS
+                                   // | wxAUI_NB_CLOSE_BUTTON 
+                                   //| wxAUI_NB_CLOSE_ON_ACTIVE_TAB
+                                   //| wxAUI_NB_CLOSE_ON_ALL_TABS
+                                   | wxNO_BORDER);
+  
+
+    mwxNotebook->AddPage(mWxGUITextEditor,_T("Files"),true);
+    mwxNotebook->AddPage(mWxGUIHtmlBrowser,_T("Help"),true);
+
+    mwxNotebook->AddPage(mWxGUIOutputMessages,_T("Messages"),true);
+
+    mwxNotebook->AddPage(mWxGUICommand,_T("Command"),true);
+
+
+    m_mgr.AddPane(mwxNotebook,
+                 wxAuiPaneInfo().Name(wxT("nb"))
+                 .CaptionVisible(false)
+                 .MinimizeButton(false)
+                 .MaximizeButton(false)
+                 .Center()
+                 //              .MinSize(wxSize(100,100))
+                 );   
 
+  /*
     //
     m_mgr.AddPane(mWxGUITextEditor,
                  wxAuiPaneInfo().Name(wxT("editor_content"))
@@ -147,15 +184,17 @@ namespace bbtk
                  .MaximizeButton(true)
                  .Center()
                  .MinSize(wxSize(100,100))
-                 );     
+                 );   
+  
     m_mgr.AddPane(mWxGUIHtmlBrowser,
                  wxAuiPaneInfo().Name(wxT("browser_content"))
                  .Caption(wxT("Help"))
                  .MinimizeButton(true)
                  .MaximizeButton(true)
                  .Right()
-                 .MinSize(wxSize(100,100))
+                 .MinSize(wxSize(200,100))
                  );
+
     m_mgr.AddPane(mWxGUIOutputMessages,
                  wxAuiPaneInfo().Name(wxT("messages_content"))
                  .Caption(wxT("Messages"))
@@ -173,6 +212,7 @@ namespace bbtk
                  .Position(1)
                  .MinSize(wxSize(100,100))
                  );     
+    */
     //    m_mgr.AddPane(mwxButtonRun,
     //           wxAuiPaneInfo().Name(wxT("button_run_content")));     
 
@@ -186,6 +226,8 @@ namespace bbtk
        
     SetAutoLayout(true);
     Layout();
+    mwxNotebook->SetSelection(1);
+    mWxGUIHtmlBrowser->GoHome();
 //    Refresh();
 //    m_mgr.Update();
   }
@@ -206,6 +248,10 @@ namespace bbtk
   //================================================================
   
 #define CATCH_MACRO                                                    \
+  catch (QuitException e)                                              \
+    {                                                                  \
+      std::cout << "* quit exception caught"<<std::endl;               \
+    }                                                                  \
   catch (InterpreterError e)                                           \
     {                                                                  \
       std::cerr << "* IERROR : "<<e.GetMessage()<<std::endl;           \
@@ -256,10 +302,13 @@ namespace bbtk
     (*buf) << mWxGUITextEditor->GetCurrentPage()->GetText();
     try 
       {
+       std::cout << "RUN"<<std::endl;
        if (mwxMenuItemReset->IsChecked()) WxGUICommandEnter("reset");
        mInterpreter->InterpretBuffer(buf);
+       std::cout << "EO RUN"<<std::endl;
       }
-    CATCH_MACRO
+    CATCH_MACRO;
+    std::cout << "EO RUN 3"<<std::endl;
   }
   //================================================================  
 
@@ -300,12 +349,23 @@ namespace bbtk
   }
   //================================================================
 
+  //================================================================
+  void WxGUIScriptingInterface::OnMenuWindowsPackageBrowser(wxCommandEvent& WXUNUSED(event))
+  {
+        wxBusyCursor wait;
+     WxGUIPackageBrowser2 *browser = new WxGUIPackageBrowser2(this);
+     browser->IncludeAll();
+        mwxNotebook->AddPage(browser,_T("Package Browser"),true);
+  }
+  //================================================================
+
+
 
   //================================================================
   void WxGUIScriptingInterface::OnMenuCreatePackage(wxCommandEvent& WXUNUSED(event))
   {
 
-    std::string command("toolsbbtk/appli/CreatePackage");
+    std::string command("toolsbbtk/appli/GUICreatePackage");
     bbtkMessage("Debug",1,"Executing : '"<<command<<"'"<<std::endl);
     
     Interpreter::Pointer I = Interpreter::New();    
@@ -318,7 +378,7 @@ namespace bbtk
   //================================================================
   void WxGUIScriptingInterface::OnMenuCreateBlackBox(wxCommandEvent& WXUNUSED(event))
   {
-    std::string command("toolsbbtk/appli/CreateBlackBox");
+    std::string command("toolsbbtk/appli/GUICreateBlackBox");
     bbtkMessage("Debug",1,"Executing : '"<<command<<"'"<<std::endl);
     
     Interpreter::Pointer I = Interpreter::New();    
@@ -390,6 +450,8 @@ namespace bbtk
        && (target[s-4]=='.'))
       {
        mWxGUITextEditor->Open(target);
+       mwxNotebook->SetSelection(0);
+       mWxGUITextEditor->SetFocus();
        return false;
       }
     return true;
@@ -469,6 +531,7 @@ namespace bbtk
     EVT_MENU(ID_Menu_Windows_Help, WxGUIScriptingInterface::OnMenuWindowsHelp)
     EVT_MENU(ID_Menu_Windows_Messages, WxGUIScriptingInterface::OnMenuWindowsMessages)
     EVT_MENU(ID_Menu_Windows_Command, WxGUIScriptingInterface::OnMenuWindowsCommand)
+    EVT_MENU(ID_Menu_Windows_PackageBrowser, WxGUIScriptingInterface::OnMenuWindowsPackageBrowser)
     EVT_AUI_PANE_CLOSE(WxGUIScriptingInterface::OnPaneClose)
   //    EVT_BUTTON(ID_Button_Run, WxGUIScriptingInterface::OnButtonRun )
     END_EVENT_TABLE()