]> Creatis software - bbtk.git/commitdiff
*** empty log message ***
authorguigues <guigues>
Wed, 19 Mar 2008 08:03:57 +0000 (08:03 +0000)
committerguigues <guigues>
Wed, 19 Mar 2008 08:03:57 +0000 (08:03 +0000)
15 files changed:
kernel/CMakeLists.txt
kernel/data/CMakeLists.txt [new file with mode: 0644]
kernel/data/icons/BlueBlackBox.png [new file with mode: 0644]
kernel/data/icons/CMakeLists.txt [new file with mode: 0644]
kernel/data/icons/EinsteinBrainSphere.png [new file with mode: 0644]
kernel/data/icons/GarabedBashur1.png [moved from kernel/install/gnome/bbi-icon2.png with 100% similarity]
kernel/data/icons/GreenBlackBox.png [new file with mode: 0644]
kernel/data/icons/RedBlackBox.png [new file with mode: 0644]
kernel/install/gnome/CMakeLists.txt
kernel/install/gnome/bbed.desktop.in [new file with mode: 0644]
kernel/install/gnome/bbi-icon.png [deleted file]
kernel/install/gnome/bbi.desktop.in
kernel/install/gnome/bbtk-install-gnome.sh.in
kernel/src/bbtkWxEditor.cxx
kernel/src/bbtkWxEditor.h

index 8f7eb3286c37d075e138117cbd3e14c72f4d3780..6c90131fd54ece36a8db030f0bdade73e41b4724 100644 (file)
@@ -26,3 +26,7 @@ SUBDIRS(cmake)
 # System-specific installation tools
 SUBDIRS(install)
 #-----------------------------------------------------------------------------
+
+#-----------------------------------------------------------------------------
+SUBDIRS(data)
+#-----------------------------------------------------------------------------
diff --git a/kernel/data/CMakeLists.txt b/kernel/data/CMakeLists.txt
new file mode 100644 (file)
index 0000000..4ec4a58
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS(icons)
diff --git a/kernel/data/icons/BlueBlackBox.png b/kernel/data/icons/BlueBlackBox.png
new file mode 100644 (file)
index 0000000..9762c2d
Binary files /dev/null and b/kernel/data/icons/BlueBlackBox.png differ
diff --git a/kernel/data/icons/CMakeLists.txt b/kernel/data/icons/CMakeLists.txt
new file mode 100644 (file)
index 0000000..26a4309
--- /dev/null
@@ -0,0 +1,7 @@
+
+FILE(GLOB IMAGES "*.png")
+
+INSTALL(
+  FILES ${IMAGES}
+  DESTINATION ${BBTK_DATA_INSTALL_PATH}/kernel/icons
+)
diff --git a/kernel/data/icons/EinsteinBrainSphere.png b/kernel/data/icons/EinsteinBrainSphere.png
new file mode 100644 (file)
index 0000000..8df1442
Binary files /dev/null and b/kernel/data/icons/EinsteinBrainSphere.png differ
diff --git a/kernel/data/icons/GreenBlackBox.png b/kernel/data/icons/GreenBlackBox.png
new file mode 100644 (file)
index 0000000..d9b25c5
Binary files /dev/null and b/kernel/data/icons/GreenBlackBox.png differ
diff --git a/kernel/data/icons/RedBlackBox.png b/kernel/data/icons/RedBlackBox.png
new file mode 100644 (file)
index 0000000..6f6a4c3
Binary files /dev/null and b/kernel/data/icons/RedBlackBox.png differ
index 9fd823260f6280fdd2b24ba94a5f71580eee3165..8be0bb95998624e4b8e7a69d48c5a87de31038c0 100644 (file)
@@ -8,7 +8,7 @@ CONFIGURE_FILE(
 )
 
 INSTALL(
-  FILES bbi.desktop.in bbi-icon.png bbi-icon2.png bbs.xml
+  FILES bbi.desktop.in bbed.desktop.in bbs.xml
   DESTINATION ${BBTK_DATA_INSTALL_PATH}/install-gnome
 )
 INSTALL(
diff --git a/kernel/install/gnome/bbed.desktop.in b/kernel/install/gnome/bbed.desktop.in
new file mode 100644 (file)
index 0000000..40f1ce9
--- /dev/null
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Version=1.0
+Encoding=UTF-8
+Name=bbed
+MimeType=text/bbs;
+Exec=BBED %f
+Type=Application
+Terminal=false
+NoDisplay=false
+GenericName[en_US]="The Black Box Editor (bbed)"
+Icon=HOME/.local/share/applications/BlueBlackBox.png
diff --git a/kernel/install/gnome/bbi-icon.png b/kernel/install/gnome/bbi-icon.png
deleted file mode 100644 (file)
index f83315e..0000000
Binary files a/kernel/install/gnome/bbi-icon.png and /dev/null differ
index f06ffaa75c23f55291336d2330f58c6ba9247db4..f37d01189df9beef5b80300e8b9e4df061e5f9be 100644 (file)
@@ -8,4 +8,4 @@ Type=Application
 Terminal=false
 NoDisplay=false
 GenericName[en_US]="The Black Box Interpreter (bbi)"
-Icon=HOME/.local/share/applications/bbi-icon2.png
+Icon=HOME/.local/share/applications/GreenBlackBox.png
index 6e09bc9974f462b88c42b55f3aead343357a8e36..1e280d169981e9ff8a8b3473b4031e633299c201 100755 (executable)
@@ -2,10 +2,13 @@
 echo "***** Installing bbi on gnome desktop *****"
 
 BBI=$(which bbi)
-echo "* bbi path = ${BBI}"
+BBED=$(which bbed)
+echo "* bbi  path = ${BBI}"
+echo "* bbed path = ${BBED}"
 
 TMP=$(which $0|rev)
 TMP2=$(echo ${TMP#*/}|rev)
+ICONSPATH=${TMP2}/../@BBTK_DATA_REL_PATH@/kernel/icons
 DATAPATH=${TMP2}/@bbtk_install_gnome_DATA_REL_PATH@
 
 # The desktop launcher & its icon
@@ -17,9 +20,17 @@ rm bbtk_install_gnome_tmp
 
 ln -s ${HOME}/.local/share/applications/bbi.desktop ${HOME}/Desktop/bbi.desktop
 
-echo "* Copying bbi icons in ${HOME}/.local/share/applications/"
-cp ${DATAPATH}/bbi-icon.png ${HOME}/.local/share/applications/
-cp ${DATAPATH}/bbi-icon2.png ${HOME}/.local/share/applications/
+# The desktop launcher & its icon
+echo "* Creating bbed launcher on desktop (${HOME}/.local/share/applications/bbed.desktop)"
+sed s,HOME,${HOME},g ${DATAPATH}/bbed.desktop.in > bbtk_install_gnome_tmp
+sed s,BBED,${BBED},g bbtk_install_gnome_tmp > bbtk_install_gnome_tmp2
+mv bbtk_install_gnome_tmp2 ${HOME}/.local/share/applications/bbed.desktop
+rm bbtk_install_gnome_tmp
+
+ln -s ${HOME}/.local/share/applications/bbed.desktop ${HOME}/Desktop/bbed.desktop
+
+echo "* Copying icons in ${HOME}/.local/share/applications/"
+cp ${ICONSPATH}/*.png ${HOME}/.local/share/applications/
 
 # add the type 'text/bbs' to mime database
 echo "* Adding mime-type 'text/bbs' to mime database (${HOME}/.local/share/mime/packages/bbs.xml)"
index ce668461816c736901f81848458ffdedb47cb6af..264f159af8b01daac26dd237e71c83cf25facf4b 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkWxEditor.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/03/18 15:31:51 $
-  Version:   $Revision: 1.3 $
+  Date:      $Date: 2008/03/19 08:03:59 $
+  Version:   $Revision: 1.4 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -90,12 +90,13 @@ namespace bbtk
   
   void WxTextCtrlGettingKeyEvents::OnKeyUp(wxKeyEvent& event)
   {
+    mWxEditor->OnKeyUp(event);
     event.Skip();
   }
   
   void WxTextCtrlGettingKeyEvents::OnKeyDown(wxKeyEvent& event)
   {
-    mWxEditor->OnKeyPress(event);
+    mWxEditor->OnKeyDown(event);
     event.Skip();
   }
   //================================================================
@@ -176,8 +177,6 @@ namespace bbtk
    //   sizer->AddGrowableCol(0);
    //   sizer->Add(mwxInputText,1,wxGROW);
 
-   mwxInputText->SetFocus();
-
    mwxOutputText = 
       new WxTextCtrlGettingKeyEvents(mwxSplit,
                      ID_OutputText,
@@ -224,22 +223,23 @@ namespace bbtk
    btnsCtrlPanel->SetSizer(btnsSizer);
    sizer->Add ( btnsCtrlPanel, 0, wxLEFT | wxRIGHT | wxBOTTOM  //| wxGROW
                , 10 );
-
+   
    // Redirection of std::cout and std::cerr to mwxOutputText and printf
-    mRedirect_cout = 
-      new WxStreamRedirector(std::cout,mwxOutputText,*wxBLACK,true);
-    mRedirect_cerr = 
-      new WxStreamRedirector(std::cerr,mwxOutputText,*wxGREEN,true); 
-
-   SetSizer(sizer);
+   mRedirect_cout = 
+     new WxStreamRedirector(std::cout,mwxOutputText,*wxBLACK,true);
+   mRedirect_cerr = 
+     new WxStreamRedirector(std::cerr,mwxOutputText,*wxGREEN,true); 
    
+   UpdatePosition();
+   mwxInputText->SetFocus();
+   
+   SetSizer(sizer);
    SetAutoLayout(true);
    Layout();
   }
   //================================================================
-
- //================================================================
+  
 //================================================================
   WxEditor::~WxEditor()
   {
     delete mInterpreter;
@@ -250,7 +250,11 @@ namespace bbtk
 
 
   //================================================================  
-  void WxEditor::OnButtonOpen(wxCommandEvent& event) { Open(); } 
+  void WxEditor::OnButtonOpen(wxCommandEvent& event) 
+  { 
+    Open(); 
+    mwxInputText->SetFocus();
+  } 
   void WxEditor::Open()
   {
     std::cout << "-------------- OPEN ---------------"<<std::endl;
@@ -281,11 +285,16 @@ namespace bbtk
   {
     mwxInputText->LoadFile(std2wx(filename));
     mwxInputText->SetModified(false);
+    UpdatePosition();
   }
   //================================================================  
 
   //================================================================  
-  void WxEditor::OnButtonSave(wxCommandEvent& event) { Save(); } 
+  void WxEditor::OnButtonSave(wxCommandEvent& event) 
+  { 
+    Save(); 
+    mwxInputText->SetFocus();
+  } 
   void WxEditor::Save()
   {
     std::cout << "-------------- SAVE ---------------"<<std::endl;
@@ -308,7 +317,11 @@ namespace bbtk
   //================================================================  
 
   //================================================================  
-  void WxEditor::OnButtonQuit(wxCommandEvent& event) { Quit(); } 
+  void WxEditor::OnButtonQuit(wxCommandEvent& event) 
+  { 
+    Quit(); 
+    mwxInputText->SetFocus();
+  } 
   void WxEditor::Quit()
   {
     std::cout << "-------------- QUIT ---------------"<<std::endl;
@@ -318,7 +331,11 @@ namespace bbtk
 
 
   //================================================================  
-  void WxEditor::OnButtonRun(wxCommandEvent& event) { Run(); }
+  void WxEditor::OnButtonRun(wxCommandEvent& event) 
+  { 
+    Run(); 
+    mwxInputText->SetFocus();
+  }
   void WxEditor::Run()
   {
     std::cout << "-------------- RUN ---------------"<<std::endl;
@@ -364,32 +381,57 @@ namespace bbtk
   //================================================================
 
   //================================================================  
-  void WxEditor::OnButtonNew(wxCommandEvent& event) { New(); }
+  void WxEditor::OnButtonNew(wxCommandEvent& event) 
+  { 
+    New(); 
+    mwxInputText->SetFocus();
+  }
   void WxEditor::New()
   {
     std::cout << "-------------- NEW ---------------" << std::endl;
     AskSave();
     mwxInputText->Clear();
+    UpdatePosition();
   }
   //================================================================
 
   //================================================================
-  void WxEditor::OnKeyPress(wxKeyEvent& event)
+  void WxEditor::UpdatePosition()
   {
-    long line, column, pos = mwxInputText->GetInsertionPoint();
-     mwxInputText->PositionToXY(pos, &column, &line);
 
+    long line, column, pos;
+    pos = mwxInputText->GetInsertionPoint();
+    mwxInputText->PositionToXY(pos, &column, &line);
+    
+    
      //                wxLogMessage(_T("Current position: %ld\nCurrent line, column: (%ld, %ld)\nNumber of lines: %ld\nCurrent line length: %ld\nTotal text length: %u (%ld)"),
 
   
      char mess[200];
-     sprintf(mess,"%ld:%ld / %ld:%ld (%ld char)",
-            line,column,
+     sprintf(mess,"%ld:%ld/%ld:%ld",
+            line+1,column+1,
             (long)mwxInputText->GetNumberOfLines(),
-            (long)mwxInputText->GetLineLength(line),
-            (long)mwxInputText->GetValue().length());
+            (long)mwxInputText->GetLineLength(line)+1);
+     //             pos+1,
+     //             (long)mwxInputText->GetValue().length())+1;
 
      mwxPosition->SetLabel(wxString(mess));
+     mwxPosition->Show();
+    
+  }
+  //================================================================
+  //================================================================
+  void WxEditor::OnKeyUp(wxKeyEvent& event)
+  {
+    //  std::cout << "U" << std::endl;
+    UpdatePosition();
+  }
+  //================================================================
+
+  //================================================================
+  void WxEditor::OnKeyDown(wxKeyEvent& event)
+  {
+    //    std::cout << "D" << std::endl;
     // std::cout << "Key="<<event.GetKeyCode()<<std::endl;
     if ( event.ControlDown() )
       {
index fb5551a2e0d9d59d80a43494cfdf5047ae92c059..4505af376636cfdeb45a3279ea0e6888451f7914 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkWxEditor.h,v $
   Language:  C++
-  Date:      $Date: 2008/03/18 15:31:51 $
-  Version:   $Revision: 1.3 $
+  Date:      $Date: 2008/03/19 08:03:59 $
+  Version:   $Revision: 1.4 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -55,7 +55,8 @@ namespace bbtk
     WxEditor( wxWindow *parent );
     ~WxEditor();
 
-    void OnKeyPress(wxKeyEvent& event);
+    void OnKeyDown(wxKeyEvent& event);
+    void OnKeyUp(wxKeyEvent& event);
 
     void OnButtonNew(wxCommandEvent& event);
     void OnButtonOpen(wxCommandEvent& event);
@@ -72,7 +73,8 @@ namespace bbtk
     void Quit();
 
     void HighlightSyntax();
-    
+    void UpdatePosition();
+
   private:
     Interpreter* mInterpreter;
     wxSplitterWindow* mwxSplit;