From: guigues Date: Wed, 19 Mar 2008 08:03:57 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: r0.6.1~109 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=065ea47878c99ed66d6413a8fe1c763f17cb2a7d;p=bbtk.git *** empty log message *** --- diff --git a/kernel/CMakeLists.txt b/kernel/CMakeLists.txt index 8f7eb32..6c90131 100644 --- a/kernel/CMakeLists.txt +++ b/kernel/CMakeLists.txt @@ -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 index 0000000..4ec4a58 --- /dev/null +++ b/kernel/data/CMakeLists.txt @@ -0,0 +1 @@ +SUBDIRS(icons) diff --git a/kernel/data/icons/BlueBlackBox.png b/kernel/data/icons/BlueBlackBox.png new file mode 100644 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 index 0000000..26a4309 --- /dev/null +++ b/kernel/data/icons/CMakeLists.txt @@ -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 index 0000000..8df1442 Binary files /dev/null and b/kernel/data/icons/EinsteinBrainSphere.png differ diff --git a/kernel/install/gnome/bbi-icon2.png b/kernel/data/icons/GarabedBashur1.png similarity index 100% rename from kernel/install/gnome/bbi-icon2.png rename to kernel/data/icons/GarabedBashur1.png diff --git a/kernel/data/icons/GreenBlackBox.png b/kernel/data/icons/GreenBlackBox.png new file mode 100644 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 index 0000000..6f6a4c3 Binary files /dev/null and b/kernel/data/icons/RedBlackBox.png differ diff --git a/kernel/install/gnome/CMakeLists.txt b/kernel/install/gnome/CMakeLists.txt index 9fd8232..8be0bb9 100644 --- a/kernel/install/gnome/CMakeLists.txt +++ b/kernel/install/gnome/CMakeLists.txt @@ -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 index 0000000..40f1ce9 --- /dev/null +++ b/kernel/install/gnome/bbed.desktop.in @@ -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 index f83315e..0000000 Binary files a/kernel/install/gnome/bbi-icon.png and /dev/null differ diff --git a/kernel/install/gnome/bbi.desktop.in b/kernel/install/gnome/bbi.desktop.in index f06ffaa..f37d011 100644 --- a/kernel/install/gnome/bbi.desktop.in +++ b/kernel/install/gnome/bbi.desktop.in @@ -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 diff --git a/kernel/install/gnome/bbtk-install-gnome.sh.in b/kernel/install/gnome/bbtk-install-gnome.sh.in index 6e09bc9..1e280d1 100755 --- a/kernel/install/gnome/bbtk-install-gnome.sh.in +++ b/kernel/install/gnome/bbtk-install-gnome.sh.in @@ -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)" diff --git a/kernel/src/bbtkWxEditor.cxx b/kernel/src/bbtkWxEditor.cxx index ce66846..264f159 100644 --- a/kernel/src/bbtkWxEditor.cxx +++ b/kernel/src/bbtkWxEditor.cxx @@ -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 ---------------"<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 ---------------"<SetFocus(); + } void WxEditor::Quit() { std::cout << "-------------- QUIT ---------------"<SetFocus(); + } void WxEditor::Run() { std::cout << "-------------- RUN ---------------"<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="<