From: guigues Date: Tue, 22 Apr 2008 14:30:25 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: r0.6.1~65 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=5934ccb7ca0fabdbe6c1907b2aea3696e19a0251;p=bbtk.git *** empty log message *** --- diff --git a/kernel/src/bbtkBlackBox.cxx b/kernel/src/bbtkBlackBox.cxx index ae56fd4..1f59e6b 100644 --- a/kernel/src/bbtkBlackBox.cxx +++ b/kernel/src/bbtkBlackBox.cxx @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkBlackBox.cxx,v $ Language: C++ -Date: $Date: 2008/04/22 08:29:09 $ -Version: $Revision: 1.13 $ +Date: $Date: 2008/04/22 14:30:25 $ +Version: $Revision: 1.14 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See doc/license.txt or @@ -602,7 +602,7 @@ namespace bbtk //========================================================================= /// Connects the input to the connection c - void BlackBox::bbConnectInput( const std::string& name, Connection::Pointer c) + void BlackBox::bbConnectInput( const std::string& name, Connection* c) { bbtkDebugMessage("connection",2, "==> BlackBox::bbConnectInput(\"" @@ -631,7 +631,7 @@ namespace bbtk //========================================================================= /// Connects the output to the connection c - void BlackBox::bbConnectOutput( const std::string& name, Connection::Pointer c) + void BlackBox::bbConnectOutput( const std::string& name, Connection* c) { bbtkDebugMessage("connection",2, "==> BlackBox::bbConnectOutput(\""< from the connection c - void BlackBox::bbDisconnectInput( const std::string& name, Connection::Pointer c) + void BlackBox::bbDisconnectInput( const std::string& name, Connection* c) { bbtkDebugMessage("connection",2, @@ -691,7 +691,7 @@ namespace bbtk //========================================================================= /// Disconnects the output from the connection c - void BlackBox::bbDisconnectOutput( const std::string& name, Connection::Pointer c) + void BlackBox::bbDisconnectOutput( const std::string& name, Connection* c) { bbtkDebugMessage("connection",2, "==> BlackBox::bbDisconnectOutput(\""<second) { - Connection::Pointer con = i->second->GetConnection(); + Connection* con = i->second->GetConnection(); if (con!=NULL){ - BlackBox::Pointer a=con->GetBlackBoxFrom(); - BlackBox::Pointer b=con->GetBlackBoxTo(); + BlackBox::Pointer a=con->GetOriginalBlackBoxFrom(); + BlackBox::Pointer b=con->GetOriginalBlackBoxTo(); fprintf(ff," "); a->bbWriteDotInputOutputName(ff,false,detail,level); if (detail==1) { - fprintf(ff,":%s",con->GetBlackBoxFromOutput().c_str()); + fprintf(ff,":%s",con->GetOriginalBlackBoxFromOutput().c_str()); } fprintf(ff,"->"); b->bbWriteDotInputOutputName(ff,true,detail,level); if (detail==1) { - fprintf(ff,":%s",con->GetBlackBoxToInput().c_str()); + fprintf(ff,":%s",con->GetOriginalBlackBoxToInput().c_str()); } fprintf(ff,"%s\n",";"); } // if con @@ -1012,11 +1012,11 @@ namespace bbtk ivalue.push_back(bbGetInputAsString(i->first)); if (ivalue.back().size()>valuelmax) valuelmax = ivalue.back().size(); std::string s(""); - Connection::Pointer con = i->second->GetConnection(); + Connection* con = i->second->GetConnection(); if (con!=0){ - s = con->GetBlackBoxFrom()->bbGetName(); + s = con->GetOriginalBlackBoxFrom()->bbGetName(); s += "."; - s += con->GetBlackBoxFromOutput(); + s += con->GetOriginalBlackBoxFromOutput(); } // if con iconn.push_back(s); } @@ -1031,15 +1031,15 @@ namespace bbtk ovalue.push_back(bbGetOutputAsString(o->first)); if (ovalue.back().size()>valuelmax) valuelmax = ovalue.back().size(); std::vector ss; - const std::vector& con + const std::vector& con = o->second->GetConnectionVector(); - std::vector::const_iterator c; + std::vector::const_iterator c; for (c=con.begin();c!=con.end();++c) { std::string s; - s = (*c).lock()->GetBlackBoxTo()->bbGetName(); + s = (*c)->GetOriginalBlackBoxTo()->bbGetName(); s += "."; - s += (*c).lock()->GetBlackBoxToInput(); + s += (*c)->GetOriginalBlackBoxToInput(); ss.push_back(s); } // if con oconn.push_back(ss); diff --git a/kernel/src/bbtkBlackBox.h b/kernel/src/bbtkBlackBox.h index d5f0671..48509a1 100644 --- a/kernel/src/bbtkBlackBox.h +++ b/kernel/src/bbtkBlackBox.h @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkBlackBox.h,v $ Language: C++ - Date: $Date: 2008/04/21 12:43:05 $ - Version: $Revision: 1.7 $ + Date: $Date: 2008/04/22 14:30:25 $ + Version: $Revision: 1.8 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See doc/license.txt or @@ -43,6 +43,7 @@ namespace bbtk struct Void { Void(int = 0) {} }; class Factory; + class Connection; class BBTK_EXPORT BlackBox : public Object { @@ -66,7 +67,6 @@ namespace bbtk virtual BlackBox::Pointer bbClone(const std::string& name) = 0; /// User overloadable destruction method of a black box - /// UNUSED FOR THE MOMENT virtual void bbUserDelete(); /// Returns the Name of the Type of the BlackBox @@ -83,8 +83,6 @@ namespace bbtk /// Returns the name with the name of the parent prepended if any virtual std::string bbGetNameWithParent() const; - /// Sets the parent of the BlackBox - void bbSetParent(BlackBox::Pointer p) { bbmParent = p; } /// Returns the parent of the BlackBox, i.e the BlackBox that contains it (0 if none) BlackBox::Pointer bbGetParent() const { return bbmParent.lock(); } @@ -146,18 +144,6 @@ bool reaction = true); /// Sets the data of the output called virtual void bbSetOutput( const std::string &name, Data data) = 0; - /// Connects the input to the connection c - virtual void bbConnectInput( const std::string& name, - Connection::Pointer c); - /// Connects the output to the connection c - virtual void bbConnectOutput( const std::string& name, - Connection::Pointer c); - /// Disconnects the input from the connection c - virtual void bbDisconnectInput( const std::string& name, - Connection::Pointer c); - /// Disconnects the output from the connection c - virtual void bbDisconnectOutput( const std::string& name, - Connection::Pointer c); /// Returns the input connectors map InputConnectorMapType& bbGetInputConnectorMap() @@ -267,6 +253,27 @@ bool reaction = true); void bbSetStatus( IOStatus t) { bbmStatus = t; } //================================================================== + private: + friend class Connection; + friend class ComplexBlackBox; + + /// Sets the parent of the BlackBox + void bbSetParent(BlackBox::Pointer p) { bbmParent = p; } + + + /// Connects the input to the connection c + virtual void bbConnectInput( const std::string& name, + Connection* c); + /// Connects the output to the connection c + virtual void bbConnectOutput( const std::string& name, + Connection* c); + /// Disconnects the input from the connection c + virtual void bbDisconnectInput( const std::string& name, + Connection* c); + /// Disconnects the output from the connection c + virtual void bbDisconnectOutput( const std::string& name, + Connection* c); + /// @name Pipeline processing methods @@ -291,7 +298,7 @@ bool reaction = true); /// - calls bbProcess which is the user callback which does the actual processing /// - calls bbUpdateChildren /// - calls bbShowWidget which shows the widget associated to the box (if any) - public: + protected: virtual IOStatus bbBackwardUpdate(Connection::Pointer caller) = 0; //================================================================== @@ -348,7 +355,7 @@ bool reaction = true); /// which means execute in response to an input change virtual bool bbCanReact() const; - + protected: static void bbGlobalAddToExecutionList( BlackBox::Pointer b ); static void bbGlobalProcessExecutionList(); diff --git a/kernel/src/bbtkBlackBoxInputConnector.cxx b/kernel/src/bbtkBlackBoxInputConnector.cxx index 1bbde73..46dfec6 100644 --- a/kernel/src/bbtkBlackBoxInputConnector.cxx +++ b/kernel/src/bbtkBlackBoxInputConnector.cxx @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkBlackBoxInputConnector.cxx,v $ Language: C++ - Date: $Date: 2008/04/18 12:59:15 $ - Version: $Revision: 1.3 $ + Date: $Date: 2008/04/22 14:30: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 @@ -27,7 +27,7 @@ namespace bbtk { BlackBoxInputConnector::BlackBoxInputConnector(BlackBox::Pointer b) - : mBox(b), mConnection(), mStatus(MODIFIED) + : mBox(b), mConnection(0), mStatus(MODIFIED) { bbtkDebugMessage("Kernel",9,"BlackBoxInputConnector::BlackBoxInputConnector()"<BackwardUpdate(); + IOStatus s = mConnection->BackwardUpdate(); mStatus = s; } else diff --git a/kernel/src/bbtkBlackBoxInputConnector.h b/kernel/src/bbtkBlackBoxInputConnector.h index 788fb4a..c897313 100644 --- a/kernel/src/bbtkBlackBoxInputConnector.h +++ b/kernel/src/bbtkBlackBoxInputConnector.h @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkBlackBoxInputConnector.h,v $ Language: C++ - Date: $Date: 2008/04/18 12:59:15 $ - Version: $Revision: 1.2 $ + Date: $Date: 2008/04/22 14:30:25 $ + 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 @@ -46,17 +46,17 @@ namespace bbtk /// Dtor ~BlackBoxInputConnector(); /// Sets a connection - void SetConnection(Connection::Pointer c); + void SetConnection(Connection* c); /// Unsets the connection /// The parameter is USELESS today but would be useful if we allow multiple connections on inputs - void UnsetConnection(Connection::Pointer c); + void UnsetConnection(Connection* c); IOStatus BackwardUpdate(); /// Returns the connection plugged into this input (const) - Connection::Pointer GetConnection() const { return mConnection.lock(); } + Connection* GetConnection() const { return mConnection; } /// Returns true iff a connection is connected to it - bool IsConnected() const { return (mConnection.lock() != 0); } + bool IsConnected() const { return (mConnection != 0); } /// Returns the status of the input (UPTODATE | MODIFIED) const IOStatus& GetStatus() const { return mStatus; } /// @@ -65,7 +65,7 @@ namespace bbtk /// BlackBoxWeakPointer mBox; /// The connection plugged into the input - Connection::WeakPointer mConnection; + Connection* mConnection; /// The status of the input (UPTODATE | MODIFIED) IOStatus mStatus; }; diff --git a/kernel/src/bbtkBlackBoxOutputConnector.cxx b/kernel/src/bbtkBlackBoxOutputConnector.cxx index af6bf5f..35dd024 100644 --- a/kernel/src/bbtkBlackBoxOutputConnector.cxx +++ b/kernel/src/bbtkBlackBoxOutputConnector.cxx @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkBlackBoxOutputConnector.cxx,v $ Language: C++ - Date: $Date: 2008/04/18 12:59:15 $ - Version: $Revision: 1.4 $ + Date: $Date: 2008/04/22 14:30:25 $ + Version: $Revision: 1.5 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -40,18 +40,21 @@ namespace bbtk bbtkDebugMessage("Kernel",9, "==> BlackBoxOutputConnector::~BlackBoxOutputConnector()" <Check(); //Connection::WeakPointer w(c); ConnectionVector::iterator i; - // = find(mConnection.begin(),mConnection.end(),c); + // = find(mConnection.begin(),mConnection.end(),c); for (i=mConnection.begin(); i!=mConnection.end(); ++i) { - if (i->lock()==c) break; + if (*i==c) break; } if (i==mConnection.end()) { @@ -100,7 +103,7 @@ namespace bbtk ConnectionVector::iterator i; for (i=mConnection.begin();i!=mConnection.end();++i) { - (*i).lock()->SetModifiedStatus(); + (*i)->SetModifiedStatus(); } bbtkDebugDecTab("Process",5); diff --git a/kernel/src/bbtkBlackBoxOutputConnector.h b/kernel/src/bbtkBlackBoxOutputConnector.h index 1ec2c36..52b4823 100644 --- a/kernel/src/bbtkBlackBoxOutputConnector.h +++ b/kernel/src/bbtkBlackBoxOutputConnector.h @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkBlackBoxOutputConnector.h,v $ Language: C++ - Date: $Date: 2008/04/18 12:59:15 $ - Version: $Revision: 1.2 $ + Date: $Date: 2008/04/22 14:30:25 $ + 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 @@ -42,11 +42,11 @@ namespace bbtk BlackBoxOutputConnector(); ~BlackBoxOutputConnector(); - void SetConnection(Connection::Pointer c); - void UnsetConnection(Connection::Pointer c); + void SetConnection(Connection* c); + void UnsetConnection(Connection* c); //IOStatus Update(); void SetModifiedStatus(); - typedef std::vector ConnectionVector; + typedef std::vector ConnectionVector; const ConnectionVector& GetConnectionVector() const { return mConnection; } private: diff --git a/kernel/src/bbtkComplexBlackBox.cxx b/kernel/src/bbtkComplexBlackBox.cxx index f4bc7dd..d15a45c 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/22 08:29:09 $ -Version: $Revision: 1.14 $ +Date: $Date: 2008/04/22 14:30:25 $ +Version: $Revision: 1.15 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -132,16 +132,9 @@ namespace bbtk " -> Releasing boxes"<bbDesallocateConnectors(); - if (mLockedDescriptor) - { - bbtkMessage("object",3," --> Releasing descriptor"<GetInputDescriptorMap(); @@ -175,7 +168,6 @@ namespace bbtk ->bbGetInputConnectorMap()[ d->GetInput() ]; bbGetInputConnectorMap()[i->second->GetName()] = c; -//new BlackBoxInputConnector(); } // Output connectors @@ -195,11 +187,8 @@ namespace bbtk ->bbGetOutputConnectorMap()[ d->GetOutput() ]; bbGetOutputConnectorMap()[o->second->GetName()] = c; - //new BlackBoxOutputConnector(); } - -*/ - + bbtkDebugDecTab("Kernel",8); } //========================================================================= @@ -217,11 +206,9 @@ namespace bbtk // but by the internal boxes. Hence **DO NOT** desallocate ! // just clear the maps to avoid that // BlackBox::bbDesallocateConnectors delete the connectors - - /* - bbGetInputConnectorMap().clear(); + bbGetInputConnectorMap().clear(); bbGetOutputConnectorMap().clear(); - */ + bbtkDebugDecTab("Kernel",8); } @@ -324,11 +311,12 @@ namespace bbtk bbtkInternalError("ComplexBlackBox::bbBackwardUpdate called with caller=0"); } + /* std::cout << "CBB BUP : "<GetBlackBoxFrom()->bbGetFullName() <<"."<GetBlackBoxFromOutput()<<"----" <GetOriginalBlackBoxFrom()->bbGetFullName() <<"."<GetOriginalBlackBoxFromOutput()< to the connection c - void ComplexBlackBox::bbConnectInput( const std::string& name, Connection::Pointer c) + void ComplexBlackBox::bbConnectInput( const std::string& name, Connection* c) { bbtkDebugMessage("connection",2, "==> ComplexBlackBox::bbConnectInput(\"" @@ -512,7 +500,7 @@ namespace bbtk //========================================================================= /// Connects the output to the connection c - void ComplexBlackBox::bbConnectOutput( const std::string& name, Connection::Pointer c) + void ComplexBlackBox::bbConnectOutput( const std::string& name, Connection* c) { bbtkDebugMessage("connection",2, "==> ComplexBlackBox::bbConnectOutput(\"" @@ -1042,21 +1030,21 @@ namespace bbtk { if (ii->second) { - Connection::Pointer con = ii->second->GetConnection(); + Connection* con = ii->second->GetConnection(); if (con!=NULL){ - BlackBox::Pointer a=con->GetBlackBoxFrom(); - BlackBox::Pointer b=con->GetBlackBoxTo(); + BlackBox::Pointer a=con->GetOriginalBlackBoxFrom(); + BlackBox::Pointer b=con->GetOriginalBlackBoxTo(); fprintf(ff," "); a->bbWriteDotInputOutputName(ff,false,detail,level); if (detail==1) { - fprintf(ff,":%s",con->GetBlackBoxFromOutput().c_str()); + fprintf(ff,":%s",con->GetOriginalBlackBoxFromOutput().c_str()); } fprintf(ff,"->"); b->bbWriteDotInputOutputName(ff,true,detail,level); if (detail==1) { - fprintf(ff,":%s",con->GetBlackBoxToInput().c_str()); + fprintf(ff,":%s",con->GetOriginalBlackBoxToInput().c_str()); } fprintf(ff,"%s\n",";"); } // if con diff --git a/kernel/src/bbtkComplexBlackBox.h b/kernel/src/bbtkComplexBlackBox.h index 3a5d8fb..7be6b04 100644 --- a/kernel/src/bbtkComplexBlackBox.h +++ b/kernel/src/bbtkComplexBlackBox.h @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkComplexBlackBox.h,v $ Language: C++ - Date: $Date: 2008/04/18 12:59:15 $ - Version: $Revision: 1.3 $ + Date: $Date: 2008/04/22 14:30: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 @@ -78,11 +78,9 @@ namespace bbtk bool setModified = true); /// Connects the input to the connection c - virtual void bbConnectInput( const std::string& name, - Connection::Pointer c); + virtual void bbConnectInput( const std::string& name, Connection* c); /// Connects the output to the connection c - virtual void bbConnectOutput( const std::string& name, - Connection::Pointer c); + virtual void bbConnectOutput( const std::string& name, Connection* c); BlackBox::Pointer bbGetBlackBox( const std::string& name ); diff --git a/kernel/src/bbtkConnection.cxx b/kernel/src/bbtkConnection.cxx index 507c6f0..5f26be0 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/22 08:29:09 $ - Version: $Revision: 1.9 $ + Date: $Date: 2008/04/22 14:30:25 $ + 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 @@ -142,9 +142,9 @@ Connection::Connection(BlackBox::Pointer from, const std::string& output, mOutput = mOriginalOutput = output; // Lock this pointer !!! - Pointer p = MakePointer(this,true); - from->bbConnectOutput(output,p); - to->bbConnectInput(input,p); + //Pointer p = MakePointer(this,true); + from->bbConnectOutput(output,this); + to->bbConnectInput(input,this); bbtkDebugMessage("connection",1,"<== Connection::Connection(\"" @@ -168,12 +168,11 @@ Connection::Connection(BlackBox::Pointer from, const std::string& output, <bbDisconnectOutput(mOutput, - GetThisPointer()); + mFrom->bbDisconnectOutput(mOutput,this); + // GetThisPointer()); + mFrom.reset(); } else { @@ -181,15 +180,14 @@ Connection::Connection(BlackBox::Pointer from, const std::string& output, } if (mTo!=0) { - mTo->bbDisconnectInput(mInput, - GetThisPointer()); + mTo->bbDisconnectInput(mInput,this);// GetThisPointer()); + mTo.reset(); } else { bbtkInternalError("Connection::~Connection() : invalid final box pointer"); } - mFrom.reset(); - mTo.reset(); + bbtkDebugMessage("object",2, "<== Connection::~Connection() [" @@ -422,18 +420,19 @@ Connection::Connection(BlackBox::Pointer from, const std::string& output, bbtkMessage("debug",2," - From : Output '"<::const_iterator j; + std::vector< Connection* >::const_iterator j; + /* for (j = i->second->GetConnectionVector().begin(); j != i->second->GetConnectionVector().end(); ++j) { - if ((*j).lock()==GetThisPointer()) break; + if ((*j)==this) break; } - /* + */ j = find(i->second->GetConnectionVector().begin(), i->second->GetConnectionVector().end(), - GetThisPointer()); - */ + this); + if (j==i->second->GetConnectionVector().end()) { bbtkError("** Checking Connection "<<(void*)this diff --git a/kernel/src/bbtkMessageManager.cxx b/kernel/src/bbtkMessageManager.cxx index c3c07f3..31c486b 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/22 08:29:09 $ - Version: $Revision: 1.7 $ + Date: $Date: 2008/04/22 14:30:25 $ + Version: $Revision: 1.8 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -65,7 +65,7 @@ namespace bbtk mMessageLevel[key] = 0; mMessageHelp[key] = "Data related messages"; if (mMaxMessageLengthbbGetFullName()<<")"<bbSetWindow(this); + bbtkDebugMessage("wx",9,"WxBlackBoxWindow::WxBlackBoxWindow("<< + mBox.lock()->bbGetFullName()<<")"<bbSetWindow(this); Wx::IncNbWindowsAlive(); - bbtkDebugMessage("Wx",5," -> Number of windows alive = " + bbtkDebugMessage("wx",5," -> Number of windows alive = " <bbGetFullName()<<"]"<bbSetWindow(0); Wx::DecNbWindowsAlive(); - bbtkDebugMessage("Wx",5," -> Number of windows alive = " + if (!mBox.expired()) + { + mBox.lock()->bbSetWindow(0); + } + else + { + } + bbtkDebugMessage("wx",5," -> Number of windows alive = " <bbGetFullName()<<"]"< Number of windows shown = " + bbtkDebugMessage("wx",5," -> Number of windows shown = " <bbGetFullName()<<"]"< Number of windows shown = " + bbtkDebugMessage("wx",5," -> Number of windows shown = " <bbGetFullName()<<","<bbGetFullName()<<"]"<bbGetFullName()<<"]"<bbGetFullName()<<","<bbGetFullName()<<")"<bbUserOnShow(); + if (bbGetBlackBox()) bbGetBlackBox()->bbUserOnShow(); // wxFrame::SetFocus(); } //========================================================================= @@ -236,86 +237,13 @@ namespace bbtk //========================================================================= void WxBlackBoxFrame::bbHide() { - bbtkDebugMessage("Wx",9,"WxBlackBoxFrame::bbHide() ["<< - bbGetBlackBox()->bbGetFullName()<<"]"<bbUserOnHide(); - } - //========================================================================= - - - - //========================================================================= - // WxBlackBoxDialogWrapper - //========================================================================= - /* - //========================================================================= - WxBlackBoxDialogWrapper::WxBlackBoxDialogWrapper(WxBlackBox* box, - wxDialog *wrapped) - : WxBlackBoxWindow(box), - mWrapped(wrapped) - { - bbtkDebugMessage("Wx",9, - "WxBlackBoxDialogWrapper::WxBlackBoxDialogWrapper(" - <bbGetFullName()<<","<bbGetFullName()<<")"<ShowModal(); - // For Windows : - mWrapped->SetReturnCode( i ); - } - //========================================================================= - - //========================================================================= - void WxBlackBoxDialogWrapper::bbHide() - { - bbtkDebugMessage("Wx",9,"WxBlackBoxDialogWrapper::bbHide() ["<< - bbGetBlackBox()->bbGetFullName()<<"]"<Hide(); + if (bbGetBlackBox()) bbGetBlackBox()->bbUserOnHide(); } //========================================================================= - */ - - /* - //========================================================================= - // WxBlackBoxWidget - //========================================================================= - - //========================================================================= - WxBlackBoxWidget::WxBlackBoxWidget( WxBlackBox* box) - : mBox(box) - { - bbtkDebugMessage("Wx",9,"WxBlackBoxWidget::WxBlackBoxWidget("<bbGetFullName()<<")"<bbSetWidget(this); - } - //========================================================================= - - //========================================================================= - WxBlackBoxWidget::~WxBlackBoxWidget() - { - bbtkDebugMessage("Wx",9,"WxBlackBoxWidget::~WxBlackBoxWidget("<bbGetFullName()<<")"<bbSetWidget(0); - //bbtkDebugMessage("Wx",9,"EO WxBlackBoxWidget::~WxBlackBoxWidget("<bbGetFullName()<<")"<bbGetFullName()<<")"<bbGetFullName()<<")"<bbSetWidgetEventHandler(this); + mBox.lock()->bbSetWidgetEventHandler(this); Connect ( mWindow->GetId(), wxEVT_DESTROY, @@ -350,22 +277,22 @@ namespace bbtk //========================================================================= WxBlackBoxWidgetEventHandler::~WxBlackBoxWidgetEventHandler() { - bbtkDebugMessage("Wx",9, - "WxBlackBoxWidgetEventHandler::~WxBlackBoxWidgetEventHandler(" - <bbGetFullName()<<")"<bbSetWidgetEventHandler(0); + if (mBox.expired()) return; + bbtkDebugMessage("wx",9, + "WxBlackBoxWidgetEventHandler::~WxBlackBoxWidgetEventHandler() [" + <bbGetFullName()<<"]"<bbSetWidgetEventHandler(0); } //========================================================================= //========================================================================= void WxBlackBoxWidgetEventHandler::OnWindowDestroy(wxWindowDestroyEvent&) { - bbtkDebugMessage("Wx",9,"WxBlackBoxWidgetEventHandler::OnWindowDestroy() [" - <bbGetFullName()<<"]"<bbSetOutputWidget(0); - mBox->bbSetModifiedStatus(); - //mDead = true; - //delete this; + if (mBox.expired()) return; + bbtkDebugMessage("wx",9,"WxBlackBoxWidgetEventHandler::OnWindowDestroy() [" + <bbGetFullName()<<"]"<bbSetOutputWidget(0); + mBox.lock()->bbSetModifiedStatus(); } //========================================================================= @@ -375,46 +302,6 @@ namespace bbtk - /* - //========================================================================= - wxWindow* WxParentToChildData::GetWindowInWhichToInsert( const BlackBox* b) - const - { - bbtkDebugMessageInc("Kernel",9,"WxParentToChildData::GetWindowInWhichToInsert("<bbGetFullName()<<")"<bbGetInputConnectorMap().find("WinParent"); - if (i==b->bbGetInputConnectorMap().end()) - { - bbtkError("WxParentToChildData::GetWindowInWhichToInsert : the box " - <bbGetFullName() - <<" does not have any 'Parent' input ?!?"); - } - Connection* c = i->second->GetConnection(); - if (!c) - { - bbtkDebugMessage("Kernel",9, - "-> The input 'Parent' of the box " - <bbGetFullName() - <<" is not connected."<::const_iterator j - = mConnectionToWindowMap.find(c); - - if (j==mConnectionToWindowMap.end()) - { - bbtkError("WxParentToChildData::GetWindowInWhichToInsert(" - <bbGetFullName() - <<") no window provided by parent ?!?"); - } - - bbtkDebugDecTab("Kernel",9); - return j->second; - } - //========================================================================= - */ - //========================================================================= // WxBlackBox //========================================================================= @@ -447,12 +334,12 @@ namespace bbtk //========================================================================= void WxBlackBox::bbUserDestructor() { - bbtkDebugMessage("Kernel",9,"WxBlackBox::bbUserDestructor()"< WxBlackBox::bbUserDestructor() ["<IsDead()) { - bbtkDebugMessage("Wx",9,"WxBlackBox::bbGetWidget() ["<< + bbtkDebugMessage("wx",9,"WxBlackBox::bbGetWidget() ["<< bbGetFullName()<<"] : Widget is dead : deleting it" < Output 'Widget' connected : transfering execution to parent" <second->GetConnectionVector().front().lock() + i->second->GetConnectionVector().front() //.lock() ->GetBlackBoxTo()->bbExecute(force); } @@ -567,7 +454,7 @@ namespace bbtk else { bbSetUpdateTransferedToParent(true); - i->second->GetConnectionVector().front().lock() + i->second->GetConnectionVector().front() //.lock() ->GetBlackBoxTo()->bbExecute(false); } } @@ -734,8 +621,8 @@ namespace bbtk if ( i->second->GetConnectionVector().size() != 0 ) { return boost::static_pointer_cast - (i->second->GetConnectionVector().front().lock()->GetBlackBoxTo()) - ->bbGetContainingWindow(); + (i->second->GetConnectionVector().front() //.lock() + ->GetBlackBoxTo())->bbGetContainingWindow(); } return 0; } diff --git a/kernel/src/bbtkWxBlackBox.h b/kernel/src/bbtkWxBlackBox.h index 6196323..9b22db3 100644 --- a/kernel/src/bbtkWxBlackBox.h +++ b/kernel/src/bbtkWxBlackBox.h @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkWxBlackBox.h,v $ Language: C++ - Date: $Date: 2008/04/21 12:43:05 $ - Version: $Revision: 1.12 $ + Date: $Date: 2008/04/22 14:30:25 $ + Version: $Revision: 1.13 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -193,7 +193,6 @@ namespace bbtk void bbSetUpdateTransferedToParent(bool b) { bbmUpdateTransferedToParent = b; } - }; //================================================================= @@ -252,11 +251,11 @@ namespace bbtk virtual void bbShow(); virtual void bbHide(); bool bbIsShown() { return mShown; } - virtual WxBlackBox::Pointer bbGetBlackBox() { return mBox; } + virtual WxBlackBox::Pointer bbGetBlackBox() { return mBox.lock(); } virtual wxDialog* bbGetDialog() { return 0; } virtual wxFrame* bbGetFrame() { return 0; } private: - WxBlackBox::Pointer mBox; + WxBlackBox::WeakPointer mBox; bool mShown; }; //================================================================== @@ -310,7 +309,7 @@ namespace bbtk //bool IsDead() { return mDead; } private: - WxBlackBox::Pointer mBox; + WxBlackBox::WeakPointer mBox; wxWindow* mWindow; //bool mDead; }; diff --git a/kernel/src/bbtkWxGUIConsole.cxx b/kernel/src/bbtkWxGUIConsole.cxx index a4d4299..3659fa9 100644 --- a/kernel/src/bbtkWxGUIConsole.cxx +++ b/kernel/src/bbtkWxGUIConsole.cxx @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkWxGUIConsole.cxx,v $ Language: C++ - Date: $Date: 2008/04/18 12:59:16 $ - Version: $Revision: 1.6 $ + Date: $Date: 2008/04/22 14:30:25 $ + 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 @@ -67,6 +67,7 @@ namespace bbtk mInterpreter = bbtk::Interpreter::New(); mInterpreter->SetUser(this); mInterpreter->SetCommandLine(true); + mInterpreter->SetThrow(false); //============== // Menu wxInitAllImageHandlers(); diff --git a/kernel/src/bbtkWxGUIHtmlBrowser.cxx b/kernel/src/bbtkWxGUIHtmlBrowser.cxx index 8fd20ab..6e47475 100644 --- a/kernel/src/bbtkWxGUIHtmlBrowser.cxx +++ b/kernel/src/bbtkWxGUIHtmlBrowser.cxx @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkWxGUIHtmlBrowser.cxx,v $ Language: C++ - Date: $Date: 2008/03/25 06:22:53 $ - Version: $Revision: 1.4 $ + Date: $Date: 2008/04/22 14:30:25 $ + Version: $Revision: 1.5 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -180,8 +180,6 @@ namespace bbtk //======================================================================== bool WxGUIHtmlBrowser::GoTo(std::string& file) { - // std::cout << "goto"<LoadPage(std2wx(file)); UpdateURL(); return r; @@ -191,7 +189,6 @@ namespace bbtk //======================================================================== void WxGUIHtmlBrowser::OnBackButton(wxCommandEvent& ) { - // std::cout << "back"<HistoryBack(); UpdateURL(); } @@ -200,7 +197,6 @@ namespace bbtk //======================================================================== void WxGUIHtmlBrowser::OnForwardButton(wxCommandEvent& ) { - // std::cout << "forward"<HistoryForward(); UpdateURL(); } diff --git a/kernel/src/bbtkWxGUIScriptingInterface.cxx b/kernel/src/bbtkWxGUIScriptingInterface.cxx index b7745ad..fb9c681 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/18 12:59:16 $ - Version: $Revision: 1.5 $ + Date: $Date: 2008/04/22 14:30:25 $ + 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 @@ -295,7 +295,7 @@ namespace bbtk commandStr = "gedit "; #endif commandStr = commandStr + configFile; - std::cout << "system: " << commandStr << std::endl; + // std::cout << "system: " << commandStr << std::endl; system ( commandStr.c_str() ); } //================================================================ @@ -337,7 +337,7 @@ namespace bbtk std::string strappli="gnome-open "; #endif std::string strcommand = strappli +default_temp_dir+"/temp_dir/workspace_workspacePrototype.png"; - std::cout << "system: " << strcommand << std::endl; + // std::cout << "system: " << strcommand << std::endl; system ( strcommand.c_str() ); } @@ -383,7 +383,6 @@ namespace bbtk //================================================================ bool WxGUIScriptingInterface::WxGUIHtmlBrowserUserOnLinkClicked(const std::string& target) { - std::cout << "OnLink"<3) && (target[s-1]=='s') && (target[s-2]=='b') diff --git a/kernel/src/bbtkWxGUITextEditor.cxx b/kernel/src/bbtkWxGUITextEditor.cxx index b489c32..2d309d5 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/04 08:04:05 $ - Version: $Revision: 1.8 $ + Date: $Date: 2008/04/22 14:30:25 $ + Version: $Revision: 1.9 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -171,8 +171,8 @@ namespace bbtk //================================================================ void WxGUITextEditorPage::Load(const std::string& filename) { - std::cout << "-------------- LOAD ---------------"<SaveFile(std2wx(mName)); mwxInputText->SetModified(false); } @@ -216,7 +216,7 @@ namespace bbtk mUser(user), mFileNameFilter("*.*") { - std::cout << "WxGUITextEditor::WxGUITextEditor"<SetWxGUITextEditor(this); // mInterpreter->SetCommandLine(true); @@ -360,7 +360,7 @@ namespace bbtk } void WxGUITextEditor::Open() { - std::cout << "-------------- OPEN ---------------"<GetPageCount()==0) return true; if (GetCurrentPage()->IsModified()) { @@ -468,7 +468,7 @@ namespace bbtk //================================================================ void WxGUITextEditor::OnPageClose(wxAuiNotebookEvent& evt) { - std::cout << "-------------- CLOSE ---------------"<