]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkWxGUIScriptingInterface.cxx
*** empty log message ***
[bbtk.git] / kernel / src / bbtkWxGUIScriptingInterface.cxx
index 895410e940cf630a76c004f7f1a98f049650fd73..d176ba3d31a2b1eb8adf37ddffdc7169c903362a 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkWxGUIScriptingInterface.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/09/10 07:25:23 $
-  Version:   $Revision: 1.16 $
+  Date:      $Date: 2008/09/10 09:25:19 $
+  Version:   $Revision: 1.17 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -65,8 +65,9 @@ namespace bbtk
     
   
   //================================================================
-  WxGUIScriptingInterface::WxGUIScriptingInterface( wxWindow *parent, wxString title, wxSize size)
-    : wxFrame((wxFrame *)parent, -1, title, wxDefaultPosition, size)
+  WxGUIScriptingInterface::WxGUIScriptingInterface( wxWindow *parent )
+    : wxFrame((wxFrame *)parent, -1, _T("bbStudio"), 
+             wxDefaultPosition, wxSize(1200,800) )
   {    
     //    m_mgr = new wxAuiManager(this);
     m_mgr.SetManagedWindow(this);
@@ -81,13 +82,13 @@ namespace bbtk
     wxInitAllImageHandlers();
     
     wxMenu *menuFile = new wxMenu;
+    menuFile->Append( ID_Menu_EditConfig, _T("Open bbtk &Config file") );
     menuFile->Append( ID_Menu_Quit, _T("&Quit") );
     
     wxMenu *menuAbout = new wxMenu;
     menuAbout->Append( ID_Menu_About, _T("&About...") );
 
     wxMenu *menuTools = new wxMenu;
-    menuTools->Append( ID_Menu_EditConfig, _T("&Edit bbtk config") );
     menuTools->Append( ID_Menu_CreatePackage, _T("Create &package") );
     menuTools->Append( ID_Menu_CreateBlackBox, _T("Create &black box") );
     menuTools->Append( ID_Menu_ShowImageGraph, _T("&Show last image graph") );
@@ -122,10 +123,13 @@ namespace bbtk
     
     SetMenuBar( menuBar );
     
+    //=== 
+    // Status bar
     CreateStatusBar();
     SetStatusText( _T("Welcome to bbStudio !") );
     
-    //
+    //===
+    // Panes (Files, Messages, Help, Command)
     mWxGUITextEditor = new WxGUITextEditor(this,this);
     mWxGUITextEditor->SetFileNameFilter("*.bbs");
        
@@ -179,7 +183,7 @@ namespace bbtk
                  .Caption(wxT("Files"))
                  .MinimizeButton(true)
                  .MaximizeButton(true)
-                 .Left()
+                 .Center()
                  .MinSize(wxSize(100,100))
                  );   
   
@@ -189,7 +193,8 @@ namespace bbtk
                  .MinimizeButton(true)
                  .MaximizeButton(true)
                  .Right()
-                 .MinSize(wxSize(200,100))
+                 .Layer(2)
+                 .MinSize(wxSize(400,100))
                  );
 
     m_mgr.AddPane(mWxGUIOutputMessages,
@@ -206,7 +211,7 @@ namespace bbtk
                  .MinimizeButton(true)
                  .MaximizeButton(true)
                  .Bottom()
-                 .Position(1)
+                 .Layer(1)
                  .MinSize(wxSize(100,100))
                  );     
 #endif
@@ -216,9 +221,11 @@ namespace bbtk
     // Add the method OnWxSignal as a Wx::Signal observer 
     //bbtkAddWxSignalObserver(WxGUIPackageBrowser2Window::OnWxSignal);
 
-//.PaneBorder(false)); 
+    //.PaneBorder(false)); 
+    // Load the interface appearance saved on last closing
     LoadPerspective();
 
+    // Done in LoadPerspective
     //    m_mgr.Update();
        
     SetAutoLayout(true);
@@ -336,16 +343,9 @@ namespace bbtk
   //================================================================
   void WxGUIScriptingInterface::OnMenuEditConfig(wxCommandEvent& WXUNUSED(event))
   {
-       std::string commandStr;
-    std::string configFile = ConfigurationFile::GetInstance().Get_config_xml_full_path();
-#ifdef WIN32
-       commandStr = "notepad.exe ";
-#else
-       commandStr = "gedit ";
-#endif 
-       commandStr = commandStr + configFile;
-       //      std::cout << "system: " << commandStr << std::endl;
-       system ( commandStr.c_str() );
+    std::string configFile = 
+      ConfigurationFile::GetInstance().Get_config_xml_full_path();
+    Open(configFile);
   }
   //================================================================
 
@@ -433,8 +433,11 @@ namespace bbtk
 
     Interpreter::Pointer I = Interpreter::New();    
 
+    I->InterpretLine( "config");
+    I->InterpretLine( "message echo 2");
     I->InterpretLine( "exec freeze");
     I->InterpretLine( "include *");
+    I->InterpretLine( "help packages");
     I->InterpretLine( "index "+doc_path+"/bbdoc/index-alpha.html Initials");
     I->InterpretLine( "index "+doc_path+"/bbdoc/index-package.html Packages");
     I->InterpretLine( "index "+doc_path+"/bbdoc/index-category.html Categories");
@@ -585,7 +588,8 @@ namespace bbtk
   void WxGUIScriptingInterface::OnPaneClose(wxAuiManagerEvent& evt)
   {
     std::cout  << "Closing panel '"<<evt.pane->name<<"'"<<std::endl;
-    
+    // TO DO : Uncheck 
+    //    OnMenuWindowsCheck( wxCommandEvent& event, wxWindow* w);
   }
   //================================================================