]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkWxGUITextEditor.cxx
*** empty log message ***
[bbtk.git] / kernel / src / bbtkWxGUITextEditor.cxx
index 128f5301b4ff147d58e9de0414f42774a1cebac7..5f065ff9f4ff859f66bce3e46149ec806d233116 100644 (file)
@@ -1,20 +1,35 @@
-/*=========================================================================
-                                                                                
+/*=========================================================================                                                                               
   Program:   bbtk
   Module:    $RCSfile: bbtkWxGUITextEditor.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/07/23 11:46:11 $
-  Version:   $Revision: 1.14 $
-                                                                                
-  Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
-  l'Image). All rights reserved. See Doc/License.txt or
-  http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
-                                                                                
-     This software is distributed WITHOUT ANY WARRANTY; without even
-     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-     PURPOSE.  See the above copyright notices for more information.
-                                                                                
-=========================================================================*//**
+  Date:      $Date: 2008/10/17 08:18:15 $
+  Version:   $Revision: 1.18 $
+=========================================================================*/
+
+/* ---------------------------------------------------------------------
+
+* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
+* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
+*
+*  This software is governed by the CeCILL-B license under French law and 
+*  abiding by the rules of distribution of free software. You can  use, 
+*  modify and/ or redistribute the software under the terms of the CeCILL-B 
+*  license as circulated by CEA, CNRS and INRIA at the following URL 
+*  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
+*  or in the file LICENSE.txt.
+*
+*  As a counterpart to the access to the source code and  rights to copy,
+*  modify and redistribute granted by the license, users are provided only
+*  with a limited warranty  and the software's author,  the holder of the
+*  economic rights,  and the successive licensors  have only  limited
+*  liability. 
+*
+*  The fact that you are presently reading this means that you have had
+*  knowledge of the CeCILL-B license and that you accept its terms.
+* ------------------------------------------------------------------------ */                                                                         
+
+
+/**
  * \brief Short description in one line
  * 
  * Long description which 
@@ -107,7 +122,6 @@ namespace bbtk
   //================================================================
   
   
-
   //================================================================  
   /*  BEGIN_EVENT_TABLE(WxGUITextEditorPage, wxPanel)
     EVT_CLOSE(WxGUITextEditorPage::OnClose)
@@ -122,9 +136,13 @@ namespace bbtk
       mName(""),
       mAskFilename(true)
   {  
+
+         //      std::cout << "WxGUITextEditorPage::WxGUITextEditorPage("<<mName<<")"<<std::endl;
+
     wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
  
     mwxInputText = 
+               
       new WxTextCtrlGettingKeyEvents(this,
                                     -1, //ID_InputText,
                                     _T(""),
@@ -132,12 +150,22 @@ namespace bbtk
                                     wxDefaultSize,
                                     wxTE_MULTILINE 
                                     //    |wxTE_PROCESS_ENTER
-                                    | wxTE_PROCESS_TAB 
+                                    //| wxTE_PROCESS_TAB 
                                     //             | wxWANTS_CHARS 
-                                    |  wxTAB_TRAVERSAL
+                                   // |  wxTAB_TRAVERSAL
                                     );
     mwxInputText->SetWxGUITextEditor(mEditor);
-    
+    /*
+       new wxTextCtrl(this,-1,_T(""),
+               wxDefaultPosition,
+                                            wxDefaultSize,
+                                            wxTE_MULTILINE 
+                                            //    |wxTE_PROCESS_ENTER
+                                       //       | wxTE_PROCESS_TAB 
+                               //                  | wxWANTS_CHARS 
+                                //    |  wxTAB_TRAVERSAL
+                                    );
+                                        */
     wxFont* FixedFont = new wxFont(10,
                                    wxFONTFAMILY_MODERN,
                                    wxFONTSTYLE_NORMAL,
@@ -245,11 +273,25 @@ namespace bbtk
       mUser(user),
       mFileNameFilter("*.*")
   {
-    m_mgr.SetManagedWindow(this);
-    
-    //    wxInitAllImageHandlers();
-      
-    mwxNotebook = new wxAuiNotebook(this,  
+  //  m_mgr.SetManagedWindow(this);
+                   //    wxInitAllImageHandlers();
+     
+       //  std::cout << "WxGUITextEditor::WxGUITextEditor"<<std::endl;
+
+      wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
+
+    mwxNotebook = new wxNotebook(this,-1,
+               wxDefaultPosition, wxDefaultSize, 
+               wxNB_TOP 
+
+               
+               );
+               
+   sizer->Add(mwxNotebook,1,wxGROW);
+
+               
+               /*
+   mwxNotebook =               new wxAuiNotebook(this,  
                                    -1,
                                    wxPoint(0, 0),
                                    wxSize(500,500),
@@ -274,7 +316,7 @@ namespace bbtk
                  .Center()
                  .MinSize(wxSize(100,50))
                  );   
-
+*/
  
     /*   
     wxBitmap bmp_new(cc_new_xpm);
@@ -319,6 +361,9 @@ namespace bbtk
     mwxToolBar->AddControl(mwxPosition);
     mwxToolBar->Realize();
 
+         sizer->Add(mwxToolBar,0,wxGROW);
+
+       /*
     m_mgr.AddPane(mwxToolBar, 
                  wxAuiPaneInfo().Name(wxT("toolBar"))
                  .Caption(wxT(""))
@@ -327,20 +372,24 @@ namespace bbtk
                  .MinSize(wxSize(100,50))
                  .LeftDockable(false).RightDockable(false)
                  );   
-
-    NewPage("");
-    UpdateInfo();
+*/
+  SetSizer(sizer);
+  
     
-    m_mgr.Update();
+//    m_mgr.Update();
     SetAutoLayout(true);
     Layout();
+
+    NewPage("");
+    UpdateInfo();
+
   }
   //================================================================
   
   //================================================================
   WxGUITextEditor::~WxGUITextEditor()
   {
-    m_mgr.UnInit();
+  //  m_mgr.UnInit();
 
     //    delete mInterpreter;
   }
@@ -489,7 +538,7 @@ namespace bbtk
       } 
     mwxNotebook->DeletePage(mwxNotebook->GetSelection());
     FocusOnCurrentPage();
-    return false;
+    return true;
   }
   //================================================================  
 
@@ -614,7 +663,7 @@ namespace bbtk
   //================================================================
   void WxGUITextEditor::OnKeyUp(wxKeyEvent& event)
   {
-    //  std::cout << "U" << std::endl;
+  //    std::cout << "U" << std::endl;
     UpdateInfo();
   }
   //================================================================
@@ -622,7 +671,7 @@ namespace bbtk
   //================================================================
   void WxGUITextEditor::OnKeyDown(wxKeyEvent& event)
   {
-    //    std::cout << "D" << std::endl;
+     //   std::cout << "D" << std::endl;
     // std::cout << "Key="<<event.GetKeyCode()<<std::endl;
     if ( event.ControlDown() )
       {
@@ -668,8 +717,8 @@ namespace bbtk
     
     SetSizer(sizer);
 
-    // Creates the parent window of all bbtk windows as a child of this
-    Wx::CreateTopWindow(this);
+    // parent window of all bbtk windows will be a child of this
+    Wx::SetTopWindowParent(this);
     // Add the method OnWxSignal as a Wx::Signal observer 
     //bbtkAddWxSignalObserver(WxGUITextEditorWindow::OnWxSignal);