From: guigues Date: Thu, 14 Feb 2008 13:44:25 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: r0.6.1~210 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=cbdd914a561bf6241a5b56d66873e090db933f8b;p=bbtk.git *** empty log message *** --- diff --git a/kernel/src/bbtkFactory.cxx b/kernel/src/bbtkFactory.cxx index 138006c..5095c0e 100644 --- a/kernel/src/bbtkFactory.cxx +++ b/kernel/src/bbtkFactory.cxx @@ -4,8 +4,8 @@ Program: bbtk Module: $RCSfile: bbtkFactory.cxx,v $ Language: C++ -Date: $Date: 2008/02/14 12:15:59 $ -Version: $Revision: 1.20 $ +Date: $Date: 2008/02/14 13:44:25 $ +Version: $Revision: 1.21 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de @@ -100,155 +100,151 @@ namespace bbtk //=================================================================== -// =================================================================================== - + // =================================================================== bool Factory::DoLoadPackage(std::string libname, std::string pkgname, - std::string path, - bool verbose) + std::string path) { - + #if defined(__GNUC__) - verbose = true; - - void *handler; - handler = dlopen(libname.c_str(), - BBTK_RTLD_TIME | BBTK_RTLD_SCOPE ); - if (!handler) - { - // The following is *NOT* a debug time message : - // It's a user intended message. - // Please don't remove it. - if (verbose) { - std::cout <<"[" <[" <[" <[" <[" <GetBBTKVersion() != bbtk::GetVersion() ) - { - std::string v(pack.mPackage->GetBBTKVersion()); - UnLoadPackage(pkgname); - bbtkError(" package build with bbtk version " - << v - << " whereas application build with version " - << bbtk::GetVersion()); - } - - std::string separator = - ConfigurationFile::GetInstance().Get_file_separator (); - //BBTK_STRINGIFY_SYMBOL(BBTK_DOC_REL_PATH) - std::string docreldoc = - separator + "bbdoc" + separator + pkgname + separator + "index.html"; - std::string reldoc = - ".." + separator + ".." + docreldoc; - std::string doc = path + separator + ".." + separator - + BBTK_STRINGIFY_SYMBOL(BBTK_DOC_REL_PATH) - + docreldoc; - - pack.mPackage->SetDocURL(doc); - pack.mPackage->SetDocRelativeURL(reldoc); - + if ( pack.mPackage->GetBBTKVersion() != bbtk::GetVersion() ) + { + std::string v(pack.mPackage->GetBBTKVersion()); + UnLoadPackage(pkgname); + bbtkError("Cannot load package ["<SetDocURL(doc); + pack.mPackage->SetDocRelativeURL(reldoc); + //=================================================================== - bbtkMessage("Output",2,pack.mPackage->GetName()<<" " - <GetVersion() - <<" (bbtk " - <GetBBTKVersion()<<") " - <GetAuthor() << " Category(s) :" - <GetCategory() - <GetDescription()<GetName()<<" " + <GetVersion() + <<" (bbtk " + <GetBBTKVersion()<<") " + <GetAuthor() << " Category(s) :" + <GetCategory() + <GetDescription()<GetPackage" and "DeletePackage". /// "GetPackage" is called to get the pointer on the bbtk::Package of the library /// ("DeletePackage" is not used, its presence is just checked before loading the package). - + /// now, filename is only the last name (no longer the full name!) /// it will be searched within *all* the paths given in bbtk_config.xml + - /// verbose = true (set by "config v") displays the loading process - + void Factory::LoadPackage( const std::string& name, - bool use_configuration_file, bool verbose) + bool use_configuration_file) { // Note : in the following : // name : the user supplied name @@ -323,8 +319,8 @@ namespace bbtk return; } - // std::string path = Utilities::ExpandLibName(upath, verbose); - std::string path = Utilities::ExpandLibName(name, verbose); // keep last item, here. + // std::string path = Utilities::ExpandLibName(upath, false); + std::string path = Utilities::ExpandLibName(name,false); // keep last item, here. if (path != "") { @@ -338,12 +334,12 @@ namespace bbtk // The following is *NOT* a debug time message : // It's a user intended message. // Please don't remove it. - if (verbose) - std::cout <<" [" <LoadPackage(name,use_configuration_file, verbose); + GetGlobalFactory()->LoadPackage(name,use_configuration_file); } inline void UnLoadPackage( const std::string& name ) diff --git a/kernel/src/bbtkWxBrowser.cxx b/kernel/src/bbtkWxBrowser.cxx index b9f73ce..7087841 100644 --- a/kernel/src/bbtkWxBrowser.cxx +++ b/kernel/src/bbtkWxBrowser.cxx @@ -1,7 +1,9 @@ #ifdef _USE_WXWIDGETS_ + #include "bbtkWxBrowser.h" #include "bbtkWxBlackBox.h" +#include "bbtkWxConsole.h" #include "bbtkConfigurationFile.h" #include "bbtkUtilities.h" @@ -33,7 +35,7 @@ namespace bbtk fwd_id, home_id, reload_id, - index_id, + include_id, url_id, html_id }; @@ -44,7 +46,7 @@ namespace bbtk EVT_BUTTON(fwd_id, WxBrowser::OnForwardButton ) EVT_BUTTON(home_id, WxBrowser::OnHomeButton ) EVT_BUTTON(reload_id, WxBrowser::OnReloadButton ) - EVT_BUTTON(index_id, WxBrowser::OnMakeIndexButton ) + EVT_BUTTON(include_id, WxBrowser::OnIncludeFileButton ) EVT_TEXT_ENTER(url_id, WxBrowser::OnURLEnter ) EVT_HTML_LINK_CLICKED(html_id, WxBrowser::OnLinkClicked) END_EVENT_TABLE() @@ -87,10 +89,10 @@ namespace bbtk bsizer->Add ( mwxReloadButton, 0, wxALIGN_CENTRE | wxTOP | wxBOTTOM , 10 ); - mwxMakeIndexButton = new wxButton( panel, index_id, + mwxIncludeFileButton = new wxButton( panel, include_id, _T("*"),wxDefaultPosition, wxDefaultSize,wxBU_EXACTFIT); - bsizer->Add ( mwxMakeIndexButton, 0, wxALIGN_CENTRE | + bsizer->Add ( mwxIncludeFileButton, 0, wxALIGN_CENTRE | wxLEFT | wxTOP | wxBOTTOM , 10 ); mwxURL = new wxTextCtrl(panel,url_id,_T(""), @@ -214,16 +216,34 @@ namespace bbtk //======================================================================== //======================================================================== - void WxBrowser::OnReloadButton(wxCommandEvent& ) + void WxBrowser::OnReloadButton(wxCommandEvent& e) { - std::string s = wx2std(mwxHtmlWindow->GetOpenedPage()); - GoTo(s); + OnURLEnter(e); } //======================================================================== //======================================================================== - void WxBrowser::OnMakeIndexButton(wxCommandEvent& ) + void WxBrowser::OnIncludeFileButton(wxCommandEvent& ) { + std::string filename = wx2std(mwxURL->GetValue()); + size_t s = filename.length(); + + WxConsole* C = WxConsole::GetInstance(); + if (C != 0) + { + if ((s>3) && (filename[s-1]=='s') + && (filename[s-2]=='b') + && (filename[s-3]=='b') + && (filename[s-4]=='.')) + { + C->SetStatusText(_T("Executing ")+mwxURL->GetValue()); + C->InterpretFile(filename); + } + else + { + C->SetStatusText(_T("The current page is not a bbs file : cannot execute it")); + } + } /* std::string bbdoc = ConfigurationFile::GetInstance().Get_url(); bbdoc += "/bbdoc"; diff --git a/kernel/src/bbtkWxBrowser.h b/kernel/src/bbtkWxBrowser.h index 131b77e..26238df 100644 --- a/kernel/src/bbtkWxBrowser.h +++ b/kernel/src/bbtkWxBrowser.h @@ -47,7 +47,7 @@ namespace bbtk void OnForwardButton(wxCommandEvent& ); void OnHomeButton(wxCommandEvent& ); void OnReloadButton(wxCommandEvent& ); - void OnMakeIndexButton(wxCommandEvent& ); + void OnIncludeFileButton(wxCommandEvent& ); void OnLinkClicked(wxHtmlLinkEvent& ); void OnURLEnter( wxCommandEvent&); void UpdateURL(); @@ -62,7 +62,7 @@ namespace bbtk wxButton* mwxForwardButton; wxButton* mwxHomeButton; wxButton* mwxReloadButton; - wxButton* mwxMakeIndexButton; + wxButton* mwxIncludeFileButton; // any class wishing to process wxWidgets events must use this macro DECLARE_EVENT_TABLE() diff --git a/kernel/src/bbtkWxConsole.cxx b/kernel/src/bbtkWxConsole.cxx index d0e8622..943d52a 100644 --- a/kernel/src/bbtkWxConsole.cxx +++ b/kernel/src/bbtkWxConsole.cxx @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkWxConsole.cxx,v $ Language: C++ - Date: $Date: 2008/02/12 12:55:16 $ - Version: $Revision: 1.3 $ + Date: $Date: 2008/02/14 13:44:25 $ + 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 @@ -306,6 +306,7 @@ namespace bbtk } //================================================================ + //================================================================ void WxConsole::OnCommandEnter(wxCommandEvent& event) {