From 174ea6d71477e40679f4fd71952e3f2a03416098 Mon Sep 17 00:00:00 2001 From: guigues Date: Thu, 24 Apr 2008 10:11:27 +0000 Subject: [PATCH] *** empty log message *** --- kernel/cmake/BBTKAddDefinitions.cmake | 2 - kernel/cmake/BBTKDefineOptions.cmake | 5 +- kernel/cmake/BBTKFindLibraries.cmake | 15 ++ kernel/src/CMakeLists.txt | 10 + kernel/src/bbtkAny.h | 106 +--------- kernel/src/bbtkAtomicBlackBox.cxx | 19 +- kernel/src/bbtkAtomicBlackBoxGetSetFunctor.h | 10 +- kernel/src/bbtkAtomicBlackBoxMacros.h | 12 +- kernel/src/bbtkBlackBox.cxx | 36 ++-- kernel/src/bbtkBlackBoxInputConnector.cxx | 10 +- kernel/src/bbtkBlackBoxOutputConnector.cxx | 5 +- kernel/src/bbtkComplexBlackBox.cxx | 20 +- kernel/src/bbtkConnection.cxx | 35 ++-- kernel/src/bbtkMessageManager.cxx | 6 +- kernel/src/bbtkWx.cxx | 206 +++++++++++++------ kernel/src/bbtkWx.h | 41 +++- kernel/src/bbtkWxBlackBox.cxx | 64 +++--- kernel/src/bbtkWxBlackBox.h | 8 +- kernel/src/bbtkWxGUIConsole.cxx | 36 +++- kernel/src/bbtkWxGUIConsole.h | 14 +- kernel/src/bbtkWxGUIPackageBrowser.cxx | 16 +- kernel/src/bbtkWxGUIPackageBrowser2.cxx | 15 +- kernel/src/bbtkWxGUIScriptingInterface.cxx | 12 +- kernel/src/bbtkWxGUITextEditor.cxx | 12 +- 24 files changed, 359 insertions(+), 356 deletions(-) diff --git a/kernel/cmake/BBTKAddDefinitions.cmake b/kernel/cmake/BBTKAddDefinitions.cmake index 6568de7..9831d47 100644 --- a/kernel/cmake/BBTKAddDefinitions.cmake +++ b/kernel/cmake/BBTKAddDefinitions.cmake @@ -21,6 +21,4 @@ ENDIF (BBTK_COMPILE_WARNING_MESSAGES) IF (BBTK_COMPILE_ERROR_MESSAGES) ADD_DEF( BBTK_COMPILE_ERROR_MESSAGES ) ENDIF (BBTK_COMPILE_ERROR_MESSAGES) - -ADD_DEF(_USE_BOOST__) #----------------------------------------------------------------------------- diff --git a/kernel/cmake/BBTKDefineOptions.cmake b/kernel/cmake/BBTKDefineOptions.cmake index 69531a0..e604473 100644 --- a/kernel/cmake/BBTKDefineOptions.cmake +++ b/kernel/cmake/BBTKDefineOptions.cmake @@ -53,9 +53,6 @@ ENDIF(BUILD_BBTK_DOC) #----------------------------------------------------------------------------- # BOOST C++ -OPTION(BBTK_USE_BOOST "Use the boost C++ library" ON) -IF(BBTK_USE_BOOST) -ADD_DEF( _USE_BOOST_ ) -ENDIF(BBTK_USE_BOOST) +OPTION(BBTK_USE_INTERNAL_BOOST "Use the internal boost C++ library" OFF) #----------------------------------------------------------------------------- diff --git a/kernel/cmake/BBTKFindLibraries.cmake b/kernel/cmake/BBTKFindLibraries.cmake index 6294b25..9ed48fd 100644 --- a/kernel/cmake/BBTKFindLibraries.cmake +++ b/kernel/cmake/BBTKFindLibraries.cmake @@ -157,3 +157,18 @@ IF(USE_TTH) MARK_AS_ADVANCED(LATEX_tth_CONVERTER) ENDIF(USE_TTH) #----------------------------------------------------------------------------- + + +#----------------------------------------------------------------------------- +# TO DO : FIND BOOST +SET(USE_BOOST TRUE) +IF(USE_BOOST) + FIND_PACKAGE(Boost REQUIRED) + MESSAGE(STATUS "Looking for boost C++ library... - found in ${Boost_INCLUDE_DIRS}") + INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) + LINK_DIRECTORIES( ${Boost_LIBRARY_DIRS} ) + SET(BBTK_BOOST_LIBRARIES + boost_signals + ) +ENDIF(USE_BOOST) +#----------------------------------------------------------------------------- diff --git a/kernel/src/CMakeLists.txt b/kernel/src/CMakeLists.txt index d8114d4..8987f72 100644 --- a/kernel/src/CMakeLists.txt +++ b/kernel/src/CMakeLists.txt @@ -91,6 +91,16 @@ IF(BBTK_USE_WXWIDGETS) ENDIF(BBTK_USE_WXWIDGETS) #----------------------------------------------------------------------------- +#----------------------------------------------------------------------------- +# BOOST +IF(BBTK_USE_BOOST) + SET(BBTK_LINK_LIBRARIES + ${BBTK_LINK_LIBRARIES} + ${BBTK_BOOST_LIBRARIES} + ) +ENDIF(BBTK_USE_BOOST) +#----------------------------------------------------------------------------- + #----------------------------------------------------------------------------- # On unix systems, need to link against dl for dynamic librairies open/close IF(UNIX) diff --git a/kernel/src/bbtkAny.h b/kernel/src/bbtkAny.h index d5ae85f..3c8b534 100644 --- a/kernel/src/bbtkAny.h +++ b/kernel/src/bbtkAny.h @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkAny.h,v $ Language: C++ - Date: $Date: 2008/02/20 16:05:38 $ - Version: $Revision: 1.2 $ + Date: $Date: 2008/04/24 10:11:27 $ + Version: $Revision: 1.3 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See doc/license.txt or @@ -38,9 +38,7 @@ #include "bbtkMessageManager.h" #include "bbtkException.h" -#ifdef _USE_BOOST_ #include -#endif namespace bbtk { @@ -451,105 +449,5 @@ namespace bbtk -/* - -// TRY TO INCLUDE BOOST DIRECTLY : OK WORKS ! -#include -#include - -#include "boost/config.hpp" -#include -#include -#include -#include - - -namespace bbtk -{ - - - class bad_any_cast : public std::bad_cast - { - public: - virtual const char * what() const throw() - { - return "boost::bad_any_cast: " - "failed conversion using boost::any_cast"; - } - }; - - typedef any anything; - - template - ValueType * any_cast(anything * operand) - { - return operand && operand->type() == typeid(ValueType) - ? &static_cast *>(operand->content)->held - : 0; - } - - template - const ValueType * any_cast(const anything * operand) - { - return any_cast(const_cast(operand)); - } - - template - ValueType any_cast(const anything & operand) - { - typedef BOOST_DEDUCED_TYPENAME boost::remove_reference::type nonref; - -#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - // If 'nonref' is still reference type, it means the user has not - // specialized 'remove_reference'. - - // Please use BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION macro - // to generate specialization of remove_reference for your class - // See type traits library documentation for details - BOOST_STATIC_ASSERT(!boost::is_reference::value); -#endif - - const nonref * result = any_cast(&operand); - if(!result) - boost::throw_exception(bad_any_cast()); - return *result; - } - - template - ValueType any_cast(anything & operand) - { - typedef BOOST_DEDUCED_TYPENAME boost::remove_reference::type nonref; - -#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - // The comment in the above version of 'any_cast' explains when this - // assert is fired and what to do. - BOOST_STATIC_ASSERT(!is_reference::value); -#endif - - nonref * result = any_cast(&operand); - if(!result) - boost::throw_exception(bad_any_cast()); - return *result; - } - - // Note: The "unsafe" versions of any_cast are not part of the - // public interface and may be removed at any time. They are - // required where we know what type is stored in the any and can't - // use typeid() comparison, e.g., when our types may travel across - // different shared libraries. - template - inline ValueType * unsafe_any_cast(anything * operand) - { - return &static_cast *>(operand->content)->held; - } - - template - inline const ValueType * unsafe_any_cast(const anything * operand) - { - return unsafe_any_cast(const_cast(operand)); - } -} -*/ // EO TRY TO INCLUDE BOOST - #endif diff --git a/kernel/src/bbtkAtomicBlackBox.cxx b/kernel/src/bbtkAtomicBlackBox.cxx index 99fe6d2..1dba6df 100644 --- a/kernel/src/bbtkAtomicBlackBox.cxx +++ b/kernel/src/bbtkAtomicBlackBox.cxx @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkAtomicBlackBox.cxx,v $ Language: C++ - Date: $Date: 2008/04/21 12:43:05 $ - Version: $Revision: 1.5 $ + Date: $Date: 2008/04/24 10:11:27 $ + Version: $Revision: 1.6 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -76,14 +76,14 @@ namespace bbtk /// Main processing method of the box. IOStatus AtomicBlackBox::bbBackwardUpdate( Connection::Pointer caller ) { - bbtkDebugMessageInc("Process",1, + bbtkDebugMessageInc("process",3, "=> AtomicBlackBox::bbBackwardUpdate(" <<(caller?caller->GetFullName():"0")<<") [" <::value; -#else - return false; -#endif + return boost::is_pointer::value; } private: diff --git a/kernel/src/bbtkAtomicBlackBoxMacros.h b/kernel/src/bbtkAtomicBlackBoxMacros.h index 7ff6640..df08807 100644 --- a/kernel/src/bbtkAtomicBlackBoxMacros.h +++ b/kernel/src/bbtkAtomicBlackBoxMacros.h @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkAtomicBlackBoxMacros.h,v $ Language: C++ - Date: $Date: 2008/04/18 12:59:15 $ - Version: $Revision: 1.5 $ + Date: $Date: 2008/04/24 10:11:27 $ + Version: $Revision: 1.6 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -76,11 +76,11 @@ public: \ inline void bbUserProcess() \ { \ - bbtkDebugMessageInc("Process",1,"=> "< Processing ["< BlackBox::bbExecute() [" < FreezeExecution global flag is 'true' : abort execution"< BlackBox::bbUserDelete() [" <bbSignalOutputModification(false); /* - bbtkDebugMessageDec("Process",5, + bbtkDebugMessageDec("process",5, "<= BlackBox::bbSetModifiedStatus("< BlackBox::bbSignalOutputModification() [" < BlackBox::bbSignalOutputModification(" <& output, bool reaction) { - bbtkDebugMessageInc("Process",5, + bbtkDebugMessageInc("process",5, "=> BlackBox::bbSignalOutputModification(vector of outputs) [" < BlackBox::bbUpdateInputs() [" < BlackBox::bbGlobalProcessExecutionList()" < Executing "<<(*i)->bbGetFullName()<bbExecute(true); } bbmgExecutionList.clear(); - bbtkDebugMessageDec("Process",1, + bbtkDebugMessageDec("process",3, "<= BlackBox::bbGlobalProcessExecutionList()" < BlackBoxInputConnector::BackwardUpdate()" + <SetModifiedStatus(); } - // bbtkDebugDecTab("Process",5); } diff --git a/kernel/src/bbtkComplexBlackBox.cxx b/kernel/src/bbtkComplexBlackBox.cxx index 8a6c65b..3a9c3c0 100644 --- a/kernel/src/bbtkComplexBlackBox.cxx +++ b/kernel/src/bbtkComplexBlackBox.cxx @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkComplexBlackBox.cxx,v $ Language: C++ -Date: $Date: 2008/04/23 14:49:27 $ -Version: $Revision: 1.16 $ +Date: $Date: 2008/04/24 10:11:28 $ +Version: $Revision: 1.17 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -231,8 +231,8 @@ namespace bbtk /// Executes the box so that its outputs are up-to-date on exit void ComplexBlackBox::bbExecute(bool force) { - bbtkDebugMessageInc("Process",1, - "ComplexBlackBox::bbExecute() [" + bbtkDebugMessageInc("process",2, + "=> ComplexBlackBox::bbExecute() [" < Executing '"<<*i<<"'"< Executing '"<<*i<<"'"<bbExecute(force); } } @@ -261,8 +261,6 @@ namespace bbtk Wx::EndBusyCursor(); - - bbtkDebugDecTab("Process",1); } //================================================================== @@ -302,8 +300,8 @@ namespace bbtk //================================================================== IOStatus ComplexBlackBox::bbBackwardUpdate(Connection::Pointer caller) { - bbtkDebugMessageInc("Process",1, - "ComplexBlackBox::bbBackwardUpdate(" + bbtkDebugMessageInc("process",3, + "==> ComplexBlackBox::bbBackwardUpdate(" <<(caller?caller->GetFullName():"0")<<") [" <GetTarget() ); // Calls BackwardUpdate on it - bbtkDebugMessageInc("Process",2,"Internal box connected to output : "<GetTarget()<GetTarget()<GetFullName()<<"' does not point to a valid output of the complex box !"); } - bbtkDebugDecTab("Process",1); return s; diff --git a/kernel/src/bbtkConnection.cxx b/kernel/src/bbtkConnection.cxx index 09c30c5..69f847d 100644 --- a/kernel/src/bbtkConnection.cxx +++ b/kernel/src/bbtkConnection.cxx @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkConnection.cxx,v $ Language: C++ - Date: $Date: 2008/04/23 14:49:27 $ - Version: $Revision: 1.11 $ + Date: $Date: 2008/04/24 10:11:28 $ + Version: $Revision: 1.12 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See doc/license.txt or @@ -199,9 +199,9 @@ Connection::Connection(BlackBox::Pointer from, const std::string& output, /// Backward Update IOStatus Connection::BackwardUpdate() { - bbtkDebugMessageInc("Process",2, - "Connection::BackwardUpdate() [" - < Connection::BackwardUpdate() [" + <bbBackwardUpdate(GetThisPointer()); @@ -210,8 +210,9 @@ Connection::Connection(BlackBox::Pointer from, const std::string& output, if (mAdaptor && (s==MODIFIED)) mAdaptor->bbSetModifiedStatus(); - bbtkDebugDecTab("Process",2); - + bbtkDebugMessage("process",5, + "<=== Connection::BackwardUpdate() [" + <bbForwardUpdate(this); - bbtkDebugDecTab("Process",2); + bbtkDebugDecTab("process",2); } //================================================================== */ @@ -240,7 +241,7 @@ Connection::Connection(BlackBox::Pointer from, const std::string& output, /// doing necessary conversions (adaptation or pointer cast) void Connection::TransferData() { - bbtkDebugMessageInc("Process",3, + bbtkDebugMessageInc("data",3, "Connection::TransferData() [" <() <<" which contains a <" <bbGetOutput(mOutput).type()) <<">"<bbGetInputType(mInput)) <<">"<bbGetOutput(mOutput) .contains( mTo->bbGetInputType(mInput) ) ) { - bbtkDebugMessage("Data",3, + bbtkDebugMessage("data",3, " -> Equal types : transfer ok"<bbSetInput( mInput, mFrom->bbGetOutput(mOutput), @@ -297,7 +295,7 @@ Connection::Connection(BlackBox::Pointer from, const std::string& output, } if (adaptor) { - bbtkDebugMessage("Data",3," -> Adaptor found : using it" + bbtkDebugMessage("data",3," -> Adaptor found : using it" <bbSetInput("In",mFrom->bbGetOutput(mOutput),false); adaptor->bbExecute(); @@ -311,7 +309,7 @@ Connection::Connection(BlackBox::Pointer from, const std::string& output, (mTo->bbGetDescriptor()->GetInputDescriptor(mInput) ->IsPointerType()) ) { - bbtkDebugMessage("Data",3, + bbtkDebugMessage("data",3, " -> No adaptor found but source and target types are both pointers : trying up or down cast"<bbSetInput(mInput, mFrom->bbGetOutput(mOutput),false); } - bbtkDebugDecTab("Process",3); } //================================================================== diff --git a/kernel/src/bbtkMessageManager.cxx b/kernel/src/bbtkMessageManager.cxx index fa55724..3141293 100644 --- a/kernel/src/bbtkMessageManager.cxx +++ b/kernel/src/bbtkMessageManager.cxx @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkMessageManager.cxx,v $ Language: C++ - Date: $Date: 2008/04/23 14:49:27 $ - Version: $Revision: 1.10 $ + Date: $Date: 2008/04/24 10:11:28 $ + Version: $Revision: 1.11 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -41,7 +41,7 @@ namespace bbtk mMessageLevel[key] = 0; mMessageHelp[key] = "Messages generated by the core classes of the lib"; if (mMaxMessageLength +//#include namespace bbtk { -//EED static wxWindow* mgTopWindow = 0; static int mgNbWindowsAlive = 0; static int mgNbWindowsShown = 0; + static bool mgAutoDestroyTopWindow = true; - void Wx::CreateInvisibleTopWindow(wxWindow* parent) + // BBTKWXSIG + static Wx::Signal_type mgWxSignal; + // \BBTKWXSIG + + + //========================================================================= + void Wx::CreateTopWindow(wxWindow* parent, bool autodestroy) { - wxWindow* top = new wxFrame(parent, - -1,_T("TOP (YOU SHOULD NOT SEE ME !!)")); + wxWindow* top = + new wxFrame(parent, + -1, + _T("TOP BBTK FRAME (YOU SHOULD NOT SEE ME !!)")); top->Hide(); Wx::SetTopWindow(top); + mgAutoDestroyTopWindow = autodestroy; } - - void Wx::ResetCursor() + //========================================================================= + + //========================================================================= + wxWindow* Wx::GetTopWindow() + { + if (mgTopWindow==0) Wx::CreateTopWindow(0); + return mgTopWindow; + } + //========================================================================= + + //========================================================================= + bool Wx::TopWindowExists() { - if (!GetTopWindow()) return; - bbtkDebugMessage("wx",9,"wx::ResetCursor()"< Destructing top window"<Close(); + mgTopWindow = 0; } - */ + // BBTKWXSIG + mgWxSignal(); + // \BBTKWXSIG + } + //========================================================================= + + //========================================================================= + void Wx::IncNbWindowsShown() + { + mgNbWindowsShown++; + bbtkDebugMessage("wx",2,"* Number of windows shown = "<IsShown())) + bbtkDebugMessage("wx",2,"* Number of windows shown = "<Close(); + bbtkDebugMessage("wx",2," --> Destructing top window"<Close(); + mgTopWindow = 0; } + // BBTKWXSIG + mgWxSignal(); + // \BBTKWXSIG } //========================================================================= + //========================================================================= -/*EED - // Static members - wxWindow* Wx::mgTopWindow = 0; - int Wx::mgNbWindowsAlive = 0; - int Wx::mgNbWindowsShown = 0; -*/ + int Wx::GetNbWindowsAlive() + { + return mgNbWindowsAlive; + } + //========================================================================= + + //========================================================================= + bool Wx::IsSomeWindowAlive() + { + return (mgNbWindowsAlive>0); + } + //========================================================================= + + + //========================================================================= + int Wx::GetNbWindowsShown() + { + return mgNbWindowsShown; + } + //========================================================================= + + //========================================================================= + bool Wx::IsSomeWindowShown() + { + return (mgNbWindowsShown>0); + } + //========================================================================= + + //========================================================================= + void Wx::ResetCursor() + { + if (!TopWindowExists()) return; + bbtkDebugMessage("wx",9,"Wx::ResetCursor()"<0); - } - - void Wx::IncNbWindowsShown() - { - mgNbWindowsShown++; - } - - int Wx::GetNbWindowsShown() - { - return mgNbWindowsShown; - } - - bool Wx::IsSomeWindowShown() - { - return (mgNbWindowsShown>0); - } - } #endif diff --git a/kernel/src/bbtkWx.h b/kernel/src/bbtkWx.h index 2969edb..30c86f8 100644 --- a/kernel/src/bbtkWx.h +++ b/kernel/src/bbtkWx.h @@ -31,24 +31,43 @@ #include "bbtkSystem.h" +// SIGNAL/SLOT MECHANISM +// FOR bbtk WINDOWS CREATION/DESTRUCTION OBSERVATION +// BBTKWXSIG +#include +#include +// \BBTKWXSIG + namespace bbtk { //================================================================== /// Global wx handlers (cursor...) +// BBTKWXSIG +#define bbtkAddWxSignalObserver(METHOD) \ + Wx::AddSignalObserver(boost::bind(&METHOD, this)) +// \BBTKWXSIG + struct BBTK_EXPORT Wx { public: + // BBTKWXSIG + typedef boost::signals::trackable SignalObserver; + typedef boost::signal Signal_type; + typedef Signal_type::slot_function_type Slot_function_type; + // \BBTKWXSIG + static void ResetCursor(); static void BeginBusyCursor(); static void EndBusyCursor(); - static int mBeginBusyCallsCount; - static void CreateInvisibleTopWindow(wxWindow* parent=0); - /// Returns the global parent of all bbtk windows + static void CreateTopWindow(wxWindow* parent=0, bool autodestroy=true); + /// Returns the creation time parent of all bbtk windows + /// (window can be reparented after creation) static wxWindow* GetTopWindow(); - /// Sets the global parent of all bbtk windows - static void SetTopWindow(wxWindow*); + static bool TopWindowExists(); + + static void AutoDestroyTopWindow(bool); static void IncNbWindowsAlive(); static void DecNbWindowsAlive(); @@ -59,13 +78,13 @@ namespace bbtk static void DecNbWindowsShown(); static int GetNbWindowsShown(); static bool IsSomeWindowShown(); - -/*EED + + // BBTKWXSIG + static void AddSignalObserver(Slot_function_type); + // \BBTKWXSIG private: - static wxWindow* mgTopWindow; - static int mgNbWindowsAlive; - static int mgNbWindowsShown; -*/ + /// Sets the creation time parent of all bbtk windows + static void SetTopWindow(wxWindow*); }; // struct Wx //================================================================== diff --git a/kernel/src/bbtkWxBlackBox.cxx b/kernel/src/bbtkWxBlackBox.cxx index e4a8410..a66ecc6 100644 --- a/kernel/src/bbtkWxBlackBox.cxx +++ b/kernel/src/bbtkWxBlackBox.cxx @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkWxBlackBox.cxx,v $ Language: C++ - Date: $Date: 2008/04/23 14:49:28 $ - Version: $Revision: 1.15 $ + Date: $Date: 2008/04/24 10:11:28 $ + Version: $Revision: 1.16 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -55,8 +55,6 @@ namespace bbtk mBox.lock()->bbGetFullName()<<")"<bbSetWindow(this); Wx::IncNbWindowsAlive(); - bbtkDebugMessage("wx",5," -> Number of windows alive = " - <bbSetWindow(0); } - else - { - } - bbtkDebugMessage("wx",5," -> Number of windows alive = " - < Number of windows shown = " - < Number of windows shown = " - < WxBlackBox::bbExecute() [" <second->GetConnectionVector().size() != 0 ) { - bbtkDebugMessage("Process",2, + bbtkDebugMessage("process",3, "-> Output 'Widget' connected : transfering execution to parent" < WxBlackBox::bbBackwardUpdate(" <<(caller?caller->GetFullName():"0")<<") [" <GetFullName():"0")<<") [" < Output 'Widget' connected to '" <bbGetFullName()<<"' - caller->to = '" <GetBlackBoxTo()->bbGetFullName() @@ -460,7 +449,7 @@ namespace bbtk } else { - bbtkDebugMessage("Process",2, + bbtkDebugMessage("process",3, "-> Output 'Widget' connected to '" <bbGetFullName()<<"'" <GetBlackBoxTo() != to))&& (!bbGetUpdateTransferedToParent())) { - bbtkDebugMessage("Process",2, + bbtkDebugMessage("process",3, " ... Transfering update order to parent" < WxBlackBox::bbShowWindow() [" + bbtkDebugMessageInc("wx",1,"=> WxBlackBox::bbShowWindow() [" < No widget event handler : creating one" <(), @@ -543,7 +532,7 @@ namespace bbtk else if ( ! bbGetWidgetEventHandler()->IsHandlerOf ( bbGetOutputWidget() ) ) { - bbtkDebugMessage("Process",3, + bbtkDebugMessage("wx",3, "-> Obsolete widget event handler : re-creating one" <GetConnectionVector().size() != 0 ) { - bbtkDebugMessage("Process",2, + bbtkDebugMessage("wx",2, "-> Output 'Widget' connected : nothing to do" < Window already exists" < Widget exists : creating the window" <(), @@ -599,7 +587,7 @@ namespace bbtk // Input WinDialog set to false : creating a Frame else { - bbtkDebugMessage("Process",2, + bbtkDebugMessage("process",2, " Input WinDialog set to false : creating a Frame" <(), @@ -625,13 +613,13 @@ namespace bbtk } else { - bbtkDebugMessage("Process",2,"-> Already shown : nothing to do"< Already shown : nothing to do"< WxBlackBox::bbHideWindow() [" + bbtkDebugMessageInc("wx",1,"=> WxBlackBox::bbHideWindow() [" <bbHide(); - bbtkDebugMessageDec("Process",1,"<= WxBlackBox::bbHideWindow() [" + bbtkDebugMessageDec("wx",1,"<= WxBlackBox::bbHideWindow() [" < "< Creating widget for [" \ <Add (mWxGUICommand, 0, wxALL | wxGROW, 5); - // Creates and sets the parent window of all bbtk windows - /* - wxWindow* top = new wxPanel(this,-1);//,_T("top")); - top->Hide(); - Wx::SetTopWindow(top); - */ - Wx::CreateInvisibleTopWindow(this); + // Creates the parent window of all bbtk windows as a child of this + Wx::CreateTopWindow(this,true); + // Add the method OnWxSignal as a Wx::Signal observer + bbtkAddWxSignalObserver(WxGUIConsole::OnWxSignal); + // Layout //EED SetSizer(sizer); @@ -181,6 +179,16 @@ namespace bbtk } //================================================================ + //================================================================ + void WxGUIConsole::OnWxSignal() + { + if ((!Wx::TopWindowExists())&&(!IsShown())) + { + bbtkDebugMessage("wx",2," --> bbtk top window destroyed and WxGUIConsole not shown => destructing"<Hide(); - - Wx::SetTopWindow(top); - + + // Creates the parent window of all bbtk windows as a child of this + Wx::CreateTopWindow(this); + // bbtkAddWxObserver(WxGUIConsole::OnWxSignal); + + SetAutoLayout(true); Layout(); } diff --git a/kernel/src/bbtkWxGUIPackageBrowser2.cxx b/kernel/src/bbtkWxGUIPackageBrowser2.cxx index b6c2730..16edeb4 100644 --- a/kernel/src/bbtkWxGUIPackageBrowser2.cxx +++ b/kernel/src/bbtkWxGUIPackageBrowser2.cxx @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkWxGUIPackageBrowser2.cxx,v $ Language: C++ -Date: $Date: 2008/04/23 09:31:23 $ -Version: $Revision: 1.6 $ +Date: $Date: 2008/04/24 10:11:28 $ +Version: $Revision: 1.7 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -1137,12 +1137,11 @@ namespace bbtk SetSizer(sizer); - // Creates and sets the parent window of all bbtk windows - wxWindow* top = new wxPanel(this,-1); - top->Hide(); - - Wx::SetTopWindow(top); - + // Creates the parent window of all bbtk windows as a child of this + Wx::CreateTopWindow(this); + // Add the method OnWxSignal as a Wx::Signal observer + //bbtkAddWxSignalObserver(WxGUIPackageBrowser2Window::OnWxSignal); + SetAutoLayout(true); Layout(); } diff --git a/kernel/src/bbtkWxGUIScriptingInterface.cxx b/kernel/src/bbtkWxGUIScriptingInterface.cxx index fb9c681..da54310 100644 --- a/kernel/src/bbtkWxGUIScriptingInterface.cxx +++ b/kernel/src/bbtkWxGUIScriptingInterface.cxx @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkWxGUIScriptingInterface.cxx,v $ Language: C++ - Date: $Date: 2008/04/22 14:30:25 $ - Version: $Revision: 1.6 $ + Date: $Date: 2008/04/24 10:11:28 $ + Version: $Revision: 1.7 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -137,10 +137,6 @@ namespace bbtk mWxGUICommand->SetFocus(); - // Creates and sets the parent window of all bbtk windows - wxWindow* top = new wxPanel(this,-1);//,_T("top")); - top->Hide(); - Wx::SetTopWindow(top); // @@ -180,6 +176,10 @@ namespace bbtk // m_mgr.AddPane(mwxButtonRun, // wxAuiPaneInfo().Name(wxT("button_run_content"))); + // Creates the parent window of all bbtk windows as a child of this + Wx::CreateTopWindow(this); + // Add the method OnWxSignal as a Wx::Signal observer + //bbtkAddWxSignalObserver(WxGUIPackageBrowser2Window::OnWxSignal); //.PaneBorder(false)); m_mgr.Update(); diff --git a/kernel/src/bbtkWxGUITextEditor.cxx b/kernel/src/bbtkWxGUITextEditor.cxx index 2d309d5..4f3d99e 100644 --- a/kernel/src/bbtkWxGUITextEditor.cxx +++ b/kernel/src/bbtkWxGUITextEditor.cxx @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkWxGUITextEditor.cxx,v $ Language: C++ - Date: $Date: 2008/04/22 14:30:25 $ - Version: $Revision: 1.9 $ + Date: $Date: 2008/04/24 10:11:28 $ + Version: $Revision: 1.10 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -661,11 +661,11 @@ namespace bbtk SetSizer(sizer); - // Creates and sets the parent window of all bbtk windows - wxWindow* top = new wxPanel(this,-1); - top->Hide(); + // Creates the parent window of all bbtk windows as a child of this + Wx::CreateTopWindow(this); + // Add the method OnWxSignal as a Wx::Signal observer + //bbtkAddWxSignalObserver(WxGUITextEditorWindow::OnWxSignal); - Wx::SetTopWindow(top); SetAutoLayout(true); Layout(); -- 2.45.1