From: Eduardo DAVILA Date: Fri, 3 Aug 2018 15:02:51 +0000 (+0200) Subject: #3203 BBTK Feature New Normal - vtk7itk4wx3-mingw64 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=4a7c20686ae0480a3c522db62ac9b01fdff030a5;p=bbtk.git #3203 BBTK Feature New Normal - vtk7itk4wx3-mingw64 --- diff --git a/kernel/src/bbtkConfigurationFile.cxx b/kernel/src/bbtkConfigurationFile.cxx index e6e7926..4c6ffe3 100644 --- a/kernel/src/bbtkConfigurationFile.cxx +++ b/kernel/src/bbtkConfigurationFile.cxx @@ -343,7 +343,6 @@ namespace bbtk // ----------------------------------------------------------------- #if defined(__GNUC__) - // ------------------ create some usefull strings ---------------- // installed bbtk_path char bbtk_path[1000]; @@ -353,6 +352,9 @@ namespace bbtk std::string str_home=Utilities::GetEnvHome(); + #if defined(WIN32) + str_home="C:"+str_home; + #endif // rootDirectory char rootDirectory[200]; @@ -387,7 +389,6 @@ namespace bbtk // ------------------------------------------------------------------ #elif defined(WIN32) - // installed bbtk_path char bbtk_path[100]; strcpy(bbtk_path, "\"c:\\Program Files\\BBTK\\bin\""); diff --git a/kernel/src/bbtkUtilities.cxx b/kernel/src/bbtkUtilities.cxx index 51724cd..def9fd9 100644 --- a/kernel/src/bbtkUtilities.cxx +++ b/kernel/src/bbtkUtilities.cxx @@ -36,6 +36,7 @@ +#include "creaSystem.h" #include "bbtkUtilities.h" #include "bbtkMessageManager.h" @@ -618,6 +619,33 @@ namespace bbtk } //========================================================================= + + + +//===================================================================================== +/* http://forums.codeguru.com/showthread.php?336106-WCHAR*-to-CHAR* +|| ::DESCRIPTION:: +|| This function will convert a WCHAR string to a CHAR string. +|| +|| Param 1 :: Pointer to a buffer that will contain the converted string. Ensure this +|| buffer is large enough; if not, buffer overrun errors will occur. +|| Param 2 :: Constant pointer to a source WCHAR string to be converted to CHAR +*/ +/* +void wtoc(const WCHAR* Source,CHAR* Dest) +{ + int i = 0; + while(Source[i] != '\0') + { + Dest[i] = (CHAR)Source[i]; + ++i; + } // while +} +*/ + + + + //========================================================================= // From http://www.fltk.org/newsgroups.php?gfltk.general+v:22083 // @@ -645,7 +673,7 @@ namespace bbtk //2018-07-06 mingw64 wchar_t pname2[512]; long result = GetModuleFileName(NULL, pname2, pathsize); - int ret = wcstombs ( pname, pname2, sizeof(pname) ); + crea::System::wtoc(pname2,pname); // long result = GetModuleFileName(NULL, pname, pathsize); if (result > 0) { @@ -757,6 +785,8 @@ namespace bbtk { char name[PATH_MAX]; int err = get_app_path(name, PATH_MAX); +printf("EED bbtk Utilities::GetExecutablePath 1%s \n",name); + if (err) { try @@ -783,7 +813,9 @@ namespace bbtk std::string Utilities::GetEnvHome() { -#if defined(__GNUC__) +#if defined(_WIN32) + std::string strHome( getenv("USERPROFILE") ); +#elif defined(__GNUC__) std::string strHome; char *envHome=getenv("HOME"); if (envHome!=NULL) @@ -792,8 +824,6 @@ std::string Utilities::GetEnvHome() } else { strHome = "/var/www/testwtdbg/docroot"; } // if -#elif defined(_WIN32) - std::string strHome( getenv("USERPROFILE") ); #endif return strHome; } diff --git a/kernel/src/bbtkWxGUIPackageBrowser2.cxx b/kernel/src/bbtkWxGUIPackageBrowser2.cxx index 21fc26d..0193bb3 100644 --- a/kernel/src/bbtkWxGUIPackageBrowser2.cxx +++ b/kernel/src/bbtkWxGUIPackageBrowser2.cxx @@ -133,7 +133,7 @@ int wxCALLBACK MyCompareFunction(long item1, long item2, long WXUNUSED(sortData) EnableContextMenu(); #endif } - + void WxGUIBlackBoxList::Insert(BlackBoxDescriptor::Pointer d) { if (GetColumnCount()!=3) @@ -170,6 +170,7 @@ int wxCALLBACK MyCompareFunction(long item1, long item2, long WXUNUSED(sortData) */ } + void WxGUIBlackBoxList::OnCacheHint(wxListEvent& event) { @@ -609,6 +610,7 @@ int wxCALLBACK MyCompareFunction(long item1, long item2, long WXUNUSED(sortData) //================================================================ WxGUIBlackBoxInfo::WxGUIBlackBoxInfo(wxWindow* parent) : +// wxPanel(parent, -1,wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE), wxPanel(parent, -1), mDescriptor() { @@ -623,9 +625,7 @@ int wxCALLBACK MyCompareFunction(long item1, long item2, long WXUNUSED(sortData) mCategory = new wxStaticText(this,-1,_T("")); sizer->Add(mCategory,0,wxGROW); - wxBoxSizer *inputs = - new wxStaticBoxSizer - ( new wxStaticBox(this, wxID_ANY, _T("Inputs")), wxVERTICAL ); + wxBoxSizer *inputs = new wxStaticBoxSizer ( new wxStaticBox(this, wxID_ANY, _T("Inputs")), wxVERTICAL ); mInputList = new wxListCtrl(this, -1, wxDefaultPosition, wxDefaultSize, @@ -635,24 +635,35 @@ int wxCALLBACK MyCompareFunction(long item1, long item2, long WXUNUSED(sortData) inputs->Add(mInputList,1,wxGROW); sizer->Add(inputs,1,wxGROW); - wxBoxSizer *outputs = - new wxStaticBoxSizer - ( new wxStaticBox(this, wxID_ANY, _T("Outputs")), wxVERTICAL ); + wxBoxSizer *outputs = new wxStaticBoxSizer ( new wxStaticBox(this, wxID_ANY, _T("Outputs")), wxVERTICAL ); mOutputList = new wxListCtrl(this, -1, wxDefaultPosition, wxDefaultSize, wxLC_REPORT //wxLC_LIST - | wxSUNKEN_BORDER); + | wxBORDER_SUNKEN); +// | wxFULL_REPAINT_ON_RESIZE | wxVSCROLL); outputs->Add(mOutputList,1,wxGROW); sizer->Add(outputs,1,wxGROW); SetSizer(sizer); +// sizer->FitInside(this); + Connect( this->GetId(), wxEVT_ERASE_BACKGROUND , (wxObjectEventFunction) (void (WxGUIBlackBoxInfo::*)(wxEvent&)) &WxGUIBlackBoxInfo::OnEraseBackGround ); + + SetAutoLayout(true); Layout(); } //================================================================ + + void WxGUIBlackBoxInfo::OnEraseBackGround( wxEvent& ) + { + mInputList->ClearBackground(); + mOutputList->ClearBackground(); + } + + //================================================================ void WxGUIBlackBoxInfo::UpdateInfo(BlackBoxDescriptor* descr) @@ -807,6 +818,17 @@ int wxCALLBACK MyCompareFunction(long item1, long item2, long WXUNUSED(sortData) id_fc3 }; + //================================================================ + void WxGUIPackageBrowser2::OnEraseBackGround( wxEvent& ) + { + mBoxList->ClearBackground(); + ClearBackground(); + Refresh(); +// Update(); + } + //================================================================ + + //================================================================ WxGUIPackageBrowser2::WxGUIPackageBrowser2( wxWindow *parent, WxGUIPackageBrowser2User* user ) @@ -824,8 +846,8 @@ int wxCALLBACK MyCompareFunction(long item1, long item2, long WXUNUSED(sortData) wxLC_REPORT //wxLC_LIST | wxSUNKEN_BORDER); mBoxList->SetUser(this); - mBoxList->SetBackgroundColour(*wxWHITE); + Connect( GetId(), wxEVT_SIZE , (wxObjectEventFunction) (void (WxGUIPackageBrowser2::*)(wxEvent&)) &WxGUIPackageBrowser2::OnEraseBackGround ); // JGRR & CM DISABLED CLOSE BUTTON m_mgr.AddPane(mBoxList, @@ -961,8 +983,9 @@ int wxCALLBACK MyCompareFunction(long item1, long item2, long WXUNUSED(sortData) Layout(); } - //================================================================ + + //================================================================ Factory::Pointer WxGUIPackageBrowser2::GetFactory() { return mFactory; @@ -1040,9 +1063,9 @@ int wxCALLBACK MyCompareFunction(long item1, long item2, long WXUNUSED(sortData) //================================================================ void WxGUIPackageBrowser2::RebuildList() { - mBoxList->Hide(); +// mBoxList->Hide(); mBoxList->ClearAll(); - + mBoxList->ClearBackground(); const Factory::PackageMapType& M = mFactory->GetPackageMap(); Factory::PackageMapType::const_iterator i; for (i=M.begin();i!=M.end();++i) diff --git a/kernel/src/bbtkWxGUIPackageBrowser2.h b/kernel/src/bbtkWxGUIPackageBrowser2.h index c0eb0a6..a4b8062 100644 --- a/kernel/src/bbtkWxGUIPackageBrowser2.h +++ b/kernel/src/bbtkWxGUIPackageBrowser2.h @@ -106,6 +106,7 @@ namespace bbtk void UpdateInfo(BlackBoxDescriptor* descr); void InsertInputOutput(wxListCtrl* l, BlackBoxInputOutputDescriptor* i); + void OnEraseBackGround( wxEvent& ); private: BlackBoxDescriptor* mDescriptor; wxStaticText* mName; @@ -168,7 +169,6 @@ namespace bbtk void OnActivated(wxListEvent& event); void OnFocused(wxListEvent& event); void OnCacheHint(wxListEvent& event); - void OnChar(wxKeyEvent& event); #if USE_CONTEXT_MENU @@ -214,6 +214,7 @@ private: bool IsVisible(BlackBoxDescriptor::Pointer d); void OnFilter(wxCommandEvent&); + void OnEraseBackGround( wxEvent& ); // User callback when a box is selected in the list void WxGUIBlackBoxListUserOnSelected( BlackBoxDescriptor* );