From: davila <> Date: Wed, 30 May 2012 17:18:01 +0000 (+0000) Subject: no message X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=a1bf4dc5c3153e37ab104d505bf72cf210a0df28;p=bbtkGEditor.git no message --- diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBoxModel.cxx b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBoxModel.cxx index 1c03431..c7b2c0c 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBoxModel.cxx +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBoxModel.cxx @@ -199,6 +199,32 @@ namespace bbtk } } + void GBoxModel::addColons(std::string &text) + { + std::string character("&&2P&&"); + size_t pos; + pos = text.find(character); + while(pos != std::string::npos) + { + //We replace the character "&&2P&&" with ":" for all the string + text.replace(pos, character.length(),":"); + pos = text.find(character, pos); + } + } + + void GBoxModel::removeColons(std::string &text) + { + std::string character(":"); + size_t pos; + pos = text.find(character); + while(pos != std::string::npos) + { + //We replace the character ":" with "&&2P&&" for all the string + text.replace(pos, character.length(),"&&2P&&"); + pos = text.find(character, pos); + } + } + //========================================================================= diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBoxModel.h b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBoxModel.h index 8c05ad7..5b6d898 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBoxModel.h +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBoxModel.h @@ -96,6 +96,10 @@ namespace bbtk // Updates the position and finally the view of inputs and outputs void updatePorts(); + + void addColons(std::string &text); + void removeColons(std::string &text); + private: //Private Attributes diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxBlackBoxEditionDialog.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxBlackBoxEditionDialog.cxx index 850b9ed..646ee5b 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxBlackBoxEditionDialog.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxBlackBoxEditionDialog.cxx @@ -114,7 +114,10 @@ namespace bbtk if(port->getValue()!="") { - txtValue->SetValue(crea::std2wx(port->getValue())); + std::string text = port->getValue(); + if(text.length()>0) + addDoubleQuotes(text); + txtValue->SetValue(crea::std2wx(text)); } if(port->isConnected()) @@ -228,6 +231,34 @@ printf("EED wxBlackBoxEditionDialog::onClickClose\n"); //========================================================================= + //========================================================================= + + void wxBlackBoxEditionDialog::addDoubleQuotes(std::string &text) + { + + //We add the double quotes at the beginning + if(text[0] != '"' ) + text = "\"" + text; + + //We add the double quotes at the end + if(text[text.length()-1] != '"') + text+= "\""; + + } + + + //========================================================================= + void wxBlackBoxEditionDialog::removeDoubleQuotes(std::string &text) + { + if(text[0]== '"' ) + text.replace(0, 1,""); + if(text[text.length()-1] == '"') + text.replace(text.length()-1, 1,""); + + } + + + } // EO namespace bbtk // EOF diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxBlackBoxEditionDialog.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxBlackBoxEditionDialog.h index 9abd697..c6a6b11 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxBlackBoxEditionDialog.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxBlackBoxEditionDialog.h @@ -90,6 +90,10 @@ namespace bbtk wxTextCtrl* _boxName; GBlackBoxModel *_model; + + + void addDoubleQuotes(std::string &text); + void removeDoubleQuotes(std::string &text); protected: