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
//=========================================================================
/// Connects the input <name> 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(\""
//=========================================================================
/// Connects the output <name> 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(\""<<name<<"\","
//=========================================================================
/// Disconnects the input <name> 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,
//=========================================================================
/// Disconnects the output <name> 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(\""<<name
{
if (i->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
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);
}
ovalue.push_back(bbGetOutputAsString(o->first));
if (ovalue.back().size()>valuelmax) valuelmax = ovalue.back().size();
std::vector<std::string> ss;
- const std::vector<Connection::WeakPointer>& con
+ const std::vector<Connection*>& con
= o->second->GetConnectionVector();
- std::vector<Connection::WeakPointer>::const_iterator c;
+ std::vector<Connection*>::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);
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
struct Void { Void(int = 0) {} };
class Factory;
+ class Connection;
class BBTK_EXPORT BlackBox : public Object
{
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
/// 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(); }
/// Sets the data of the output called <name>
virtual void bbSetOutput( const std::string &name, Data data) = 0;
- /// Connects the input <name> to the connection c
- virtual void bbConnectInput( const std::string& name,
- Connection::Pointer c);
- /// Connects the output <name> to the connection c
- virtual void bbConnectOutput( const std::string& name,
- Connection::Pointer c);
- /// Disconnects the input <name> from the connection c
- virtual void bbDisconnectInput( const std::string& name,
- Connection::Pointer c);
- /// Disconnects the output <name> from the connection c
- virtual void bbDisconnectOutput( const std::string& name,
- Connection::Pointer c);
/// Returns the input connectors map
InputConnectorMapType& bbGetInputConnectorMap()
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 <name> to the connection c
+ virtual void bbConnectInput( const std::string& name,
+ Connection* c);
+ /// Connects the output <name> to the connection c
+ virtual void bbConnectOutput( const std::string& name,
+ Connection* c);
+ /// Disconnects the input <name> from the connection c
+ virtual void bbDisconnectInput( const std::string& name,
+ Connection* c);
+ /// Disconnects the output <name> from the connection c
+ virtual void bbDisconnectOutput( const std::string& name,
+ Connection* c);
+
/// @name Pipeline processing methods
/// - 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;
//==================================================================
/// which means execute in response to an input change
virtual bool bbCanReact() const;
-
+ protected:
static void bbGlobalAddToExecutionList( BlackBox::Pointer b );
static void bbGlobalProcessExecutionList();
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
namespace bbtk
{
BlackBoxInputConnector::BlackBoxInputConnector(BlackBox::Pointer b)
- : mBox(b), mConnection(), mStatus(MODIFIED)
+ : mBox(b), mConnection(0), mStatus(MODIFIED)
{
bbtkDebugMessage("Kernel",9,"BlackBoxInputConnector::BlackBoxInputConnector()"<<std::endl);
}
bbtkDebugDecTab("Kernel",9);
}
- void BlackBoxInputConnector::SetConnection(Connection::Pointer c)
+ void BlackBoxInputConnector::SetConnection(Connection* c)
{
bbtkDebugMessage("Kernel",9,"BlackBoxInputConnector::SetConnection("<<c<<")"<<std::endl);
mConnection = c;
}
- void BlackBoxInputConnector::UnsetConnection(Connection::Pointer c)
+ void BlackBoxInputConnector::UnsetConnection(Connection* c)
{
bbtkDebugMessage("Kernel",9,"BlackBoxInputConnector::UnsetConnection("
<<c<<")"<<std::endl);
- mConnection.reset();
+ mConnection = 0; //.reset();
}
IOStatus BlackBoxInputConnector::BackwardUpdate()
bbtkDebugMessageInc("Process",4,"BlackBoxInputConnector::BackwardUpdate()"
<<std::endl);
- if (mConnection.lock())
+ if (mConnection) //.lock())
{
- IOStatus s = mConnection.lock()->BackwardUpdate();
+ IOStatus s = mConnection->BackwardUpdate();
mStatus = s;
}
else
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
/// 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; }
///
///
BlackBoxWeakPointer mBox;
/// The connection plugged into the input
- Connection::WeakPointer mConnection;
+ Connection* mConnection;
/// The status of the input (UPTODATE | MODIFIED)
IOStatus mStatus;
};
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
bbtkDebugMessage("Kernel",9,
"==> BlackBoxOutputConnector::~BlackBoxOutputConnector()"
<<std::endl);
+ /*
ConnectionVector::iterator i;
for (i=mConnection.begin();
i!=mConnection.end();
++i)
(*i) = Connection::WeakPointer();
+ */
+ mConnection.clear();
bbtkDebugMessage("Kernel",9,
"<== BlackBoxOutputConnector::~BlackBoxOutputConnector()"
<<std::endl);
}
///
- void BlackBoxOutputConnector::SetConnection(Connection::Pointer c)
+ void BlackBoxOutputConnector::SetConnection(Connection* c)
{
bbtkDebugMessage("Kernel",9,"BlackBoxOutputConnector::SetConnection("
<<c<<")"<<std::endl);
///
- void BlackBoxOutputConnector::UnsetConnection(Connection::Pointer c)
+ void BlackBoxOutputConnector::UnsetConnection(Connection* c)
{
bbtkDebugMessageInc("Kernel",9,"BlackBoxOutputConnector::UnsetConnection("
<<c<<")"<<std::endl);
// c->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())
{
ConnectionVector::iterator i;
for (i=mConnection.begin();i!=mConnection.end();++i)
{
- (*i).lock()->SetModifiedStatus();
+ (*i)->SetModifiedStatus();
}
bbtkDebugDecTab("Process",5);
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
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<Connection::WeakPointer> ConnectionVector;
+ typedef std::vector<Connection*> ConnectionVector;
const ConnectionVector& GetConnectionVector() const { return mConnection; }
private:
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
" -> Releasing boxes"<<std::endl);
mBlackBoxMap.clear();
- /*
// Clear();
this->bbDesallocateConnectors();
- if (mLockedDescriptor)
- {
- bbtkMessage("object",3," --> Releasing descriptor"<<std::endl);
- mLockedDescriptor.reset();
- if (!mDescriptor.expired()) BlackBoxDescriptor::Release(mDescriptor);
- }
- */
+
bbtkDebugMessage("object",3,
"<== ComplexBlackBox::~ComplexBlackBox() ["
<<bbGetName()<<"]"<<std::endl);
"ComplexBlackBox::bbAllocateConnectors() ["
<<bbGetFullName()<<"]"
<<std::endl);
- /*
+
// Input connectors
const BlackBoxDescriptor::InputDescriptorMapType& imap
= bbGetDescriptor()->GetInputDescriptorMap();
->bbGetInputConnectorMap()[ d->GetInput() ];
bbGetInputConnectorMap()[i->second->GetName()] = c;
-//new BlackBoxInputConnector();
}
// Output connectors
->bbGetOutputConnectorMap()[ d->GetOutput() ];
bbGetOutputConnectorMap()[o->second->GetName()] = c;
- //new BlackBoxOutputConnector();
}
-
-*/
-
+
bbtkDebugDecTab("Kernel",8);
}
//=========================================================================
// 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);
}
bbtkInternalError("ComplexBlackBox::bbBackwardUpdate called with caller=0");
}
+ /*
std::cout << "CBB BUP : "<<caller->GetBlackBoxFrom()->bbGetFullName()
<<"."<<caller->GetBlackBoxFromOutput()<<"----"
<<caller->GetOriginalBlackBoxFrom()->bbGetFullName()
<<"."<<caller->GetOriginalBlackBoxFromOutput()<<std::endl;
-
+ */
//=========================================================================
/// Connects the input <name> 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(\""
//=========================================================================
/// Connects the output <name> 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(\""
{
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
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
bool setModified = true);
/// Connects the input <name> 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 <name> 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 );
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
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(\""
<<GetFullName()<<"]"<<std::endl);
if (mAdaptor) mAdaptor.reset();
- mOriginalFrom.reset();
- mOriginalTo.reset();
if (mFrom!=0)
{
- mFrom->bbDisconnectOutput(mOutput,
- GetThisPointer<Connection>());
+ mFrom->bbDisconnectOutput(mOutput,this);
+ // GetThisPointer<Connection>());
+ mFrom.reset();
}
else
{
}
if (mTo!=0)
{
- mTo->bbDisconnectInput(mInput,
- GetThisPointer<Connection>());
+ mTo->bbDisconnectInput(mInput,this);// GetThisPointer<Connection>());
+ mTo.reset();
}
else
{
bbtkInternalError("Connection::~Connection() : invalid final box pointer");
}
- mFrom.reset();
- mTo.reset();
+
bbtkDebugMessage("object",2,
"<== Connection::~Connection() ["
bbtkMessage("debug",2," - From : Output '"<<mOutput
<<"' is in OutputConnectorMap"<<std::endl);
- std::vector< Connection::WeakPointer >::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<Connection>()) break;
+ if ((*j)==this) break;
}
- /*
+ */
j = find(i->second->GetConnectionVector().begin(),
i->second->GetConnectionVector().end(),
- GetThisPointer<Connection>());
- */
+ this);
+
if (j==i->second->GetConnectionVector().end())
{
bbtkError("** Checking Connection "<<(void*)this
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
mMessageLevel[key] = 0;
mMessageHelp[key] = "Data related messages";
if (mMaxMessageLength<key.length()) mMaxMessageLength = key.length();
- key = "Wx";
+ key = "wx";
mMessageLevel[key] = 0;
mMessageHelp[key] = "Widgets related messages";
if (mMaxMessageLength<key.length()) mMaxMessageLength = key.length();
void Wx::ResetCursor()
{
if (!GetTopWindow()) return;
- bbtkDebugMessage("Wx",9,"wx::ResetCursor()"<<std::endl);
+ bbtkDebugMessage("wx",9,"wx::ResetCursor()"<<std::endl);
while (wxIsBusy()) ::wxEndBusyCursor();
}
void Wx::BeginBusyCursor()
{
if (!GetTopWindow()) return;
- bbtkDebugMessage("Wx",9,"wx::BeginBusyCursor()"<<std::endl);
+ bbtkDebugMessage("wx",9,"wx::BeginBusyCursor()"<<std::endl);
::wxBeginBusyCursor();
}
void Wx::EndBusyCursor()
{
if (!GetTopWindow()) return;
- bbtkDebugMessage("Wx",9,"wx::EndBusyCursor()"<<std::endl);
+ bbtkDebugMessage("wx",9,"wx::EndBusyCursor()"<<std::endl);
::wxEndBusyCursor();
}
Program: bbtk
Module: $RCSfile: bbtkWxBlackBox.cxx,v $
Language: C++
- Date: $Date: 2008/04/21 12:43:05 $
- 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
WxBlackBoxWindow::WxBlackBoxWindow(WxBlackBox::Pointer box)
: mBox(box), mShown(false)
{
- bbtkDebugMessage("Wx",9,"WxBlackBoxWindow::WxBlackBoxWindow("<<
- mBox->bbGetFullName()<<")"<<std::endl);
- mBox->bbSetWindow(this);
+ bbtkDebugMessage("wx",9,"WxBlackBoxWindow::WxBlackBoxWindow("<<
+ mBox.lock()->bbGetFullName()<<")"<<std::endl);
+ mBox.lock()->bbSetWindow(this);
Wx::IncNbWindowsAlive();
- bbtkDebugMessage("Wx",5," -> Number of windows alive = "
+ bbtkDebugMessage("wx",5," -> Number of windows alive = "
<<Wx::GetNbWindowsAlive()<<std::endl);
}
//=========================================================================
//=========================================================================
WxBlackBoxWindow::~WxBlackBoxWindow()
{
- bbtkDebugMessage("Wx",9,"WxBlackBoxWindow::~WxBlackBoxWindow() ["<<
- mBox->bbGetFullName()<<"]"<<std::endl);
+ bbtkDebugMessage("wx",9,"WxBlackBoxWindow::~WxBlackBoxWindow() "
+ <<this<<std::endl);
bbHide();
- mBox->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 = "
<<Wx::GetNbWindowsAlive()<<std::endl);
-
-
}
//=========================================================================
void WxBlackBoxWindow::bbShow()
{
if (bbIsShown()) return;
- bbtkDebugMessage("Wx",9,"WxBlackBoxWindow::bbShow() ["<<
- mBox->bbGetFullName()<<"]"<<std::endl);
+ bbtkDebugMessage("wx",9,"WxBlackBoxWindow::bbShow()"<<std::endl);
Wx::IncNbWindowsShown();
mShown = true;
- bbtkDebugMessage("Wx",5," -> Number of windows shown = "
+ bbtkDebugMessage("wx",5," -> Number of windows shown = "
<<Wx::GetNbWindowsShown()<<std::endl);
}
//=========================================================================
void WxBlackBoxWindow::bbHide()
{
if (!bbIsShown()) return;
- bbtkDebugMessage("Wx",9,"WxBlackBoxWindow::bbHide() ["<<
- mBox->bbGetFullName()<<"]"<<std::endl);
+ bbtkDebugMessage("wx",9,"WxBlackBoxWindow::bbHide()"<<std::endl);
Wx::DecNbWindowsShown();
mShown = false;
- bbtkDebugMessage("Wx",5," -> Number of windows shown = "
+ bbtkDebugMessage("wx",5," -> Number of windows shown = "
<<Wx::GetNbWindowsShown()<<std::endl);
}
//=========================================================================
wxCAPTION
)
{
- bbtkDebugMessage("Wx",9,"WxBlackBoxDialog::WxBlackBoxDialog("<<
+ bbtkDebugMessage("wx",9,"WxBlackBoxDialog::WxBlackBoxDialog("<<
bbGetBlackBox()->bbGetFullName()<<","<<parent<<","
<<title<<",size)"<<std::endl);
// Insert the widget into the window
//=========================================================================
void WxBlackBoxDialog::bbShow()
{
- bbtkDebugMessage("Wx",5,"WxBlackBoxDialog::bbShow() ["
+ bbtkDebugMessage("wx",5,"WxBlackBoxDialog::bbShow() ["
<<bbGetBlackBox()->bbGetFullName()<<"]"<<std::endl);
WxBlackBoxWindow::bbShow();
SetReturnCode( wxDialog::ShowModal() );
//=========================================================================
void WxBlackBoxDialog::bbHide()
{
- bbtkDebugMessage("Wx",9,"WxBlackBoxDialog::bbHide() ["<<
- bbGetBlackBox()->bbGetFullName()<<"]"<<std::endl);
+ bbtkDebugMessage("wx",9,"WxBlackBoxDialog::bbHide()"<<std::endl);
WxBlackBoxWindow::bbHide();
Hide();
}
wxCAPTION
)
{
- bbtkDebugMessage("Wx",9,"WxBlackBoxFrame::WxBlackBoxFrame("<<
+ bbtkDebugMessage("wx",9,"WxBlackBoxFrame::WxBlackBoxFrame("<<
bbGetBlackBox()->bbGetFullName()<<","<<parent<<","
<<title<<",size)"<<std::endl);
// Insert the widget into the window
//=========================================================================
void WxBlackBoxFrame::bbShow()
{
- bbtkDebugMessage("Wx",5,"WxBlackBoxFrame::bbShow("
+ bbtkDebugMessage("wx",5,"WxBlackBoxFrame::bbShow("
<<bbGetBlackBox()->bbGetFullName()<<")"<<std::endl);
WxBlackBoxWindow::bbShow();
wxFrame::Show();
// to synchronize wxvtkRenderWindowInteractor objects
// (force wx objects creation **NOW**)
wxFrame::Update();
- bbGetBlackBox()->bbUserOnShow();
+ if (bbGetBlackBox()) bbGetBlackBox()->bbUserOnShow();
// wxFrame::SetFocus();
}
//=========================================================================
//=========================================================================
void WxBlackBoxFrame::bbHide()
{
- bbtkDebugMessage("Wx",9,"WxBlackBoxFrame::bbHide() ["<<
- bbGetBlackBox()->bbGetFullName()<<"]"<<std::endl);
+ bbtkDebugMessage("wx",9,"WxBlackBoxFrame::bbHide()"<<std::endl);
WxBlackBoxWindow::bbHide();
wxFrame::Hide();
- bbGetBlackBox()->bbUserOnHide();
- }
- //=========================================================================
-
-
-
- //=========================================================================
- // WxBlackBoxDialogWrapper
- //=========================================================================
- /*
- //=========================================================================
- WxBlackBoxDialogWrapper::WxBlackBoxDialogWrapper(WxBlackBox* box,
- wxDialog *wrapped)
- : WxBlackBoxWindow(box),
- mWrapped(wrapped)
- {
- bbtkDebugMessage("Wx",9,
- "WxBlackBoxDialogWrapper::WxBlackBoxDialogWrapper("
- <<bbGetBlackBox()->bbGetFullName()<<","<<wrapped
- <<")"<<std::endl);
- }
- //=========================================================================
-
- //=========================================================================
- WxBlackBoxDialogWrapper::~WxBlackBoxDialogWrapper()
- {
- }
- //=========================================================================
-
- //=========================================================================
- void WxBlackBoxDialogWrapper::bbShow()
- {
- bbtkDebugMessage("Wx",5,"WxBlackBoxDialogWrapper::bbShow("
- <<bbGetBlackBox()->bbGetFullName()<<")"<<std::endl);
- WxBlackBoxWindow::bbShow();
- int i = mWrapped->ShowModal();
- // For Windows :
- mWrapped->SetReturnCode( i );
- }
- //=========================================================================
-
- //=========================================================================
- void WxBlackBoxDialogWrapper::bbHide()
- {
- bbtkDebugMessage("Wx",9,"WxBlackBoxDialogWrapper::bbHide() ["<<
- bbGetBlackBox()->bbGetFullName()<<"]"<<std::endl);
- WxBlackBoxWindow::bbHide();
- mWrapped->Hide();
+ if (bbGetBlackBox()) bbGetBlackBox()->bbUserOnHide();
}
//=========================================================================
- */
-
- /*
- //=========================================================================
- // WxBlackBoxWidget
- //=========================================================================
-
- //=========================================================================
- WxBlackBoxWidget::WxBlackBoxWidget( WxBlackBox* box)
- : mBox(box)
- {
- bbtkDebugMessage("Wx",9,"WxBlackBoxWidget::WxBlackBoxWidget("<<box->bbGetFullName()<<")"<<std::endl);
- mBox->bbSetWidget(this);
- }
- //=========================================================================
-
- //=========================================================================
- WxBlackBoxWidget::~WxBlackBoxWidget()
- {
- bbtkDebugMessage("Wx",9,"WxBlackBoxWidget::~WxBlackBoxWidget("<<mBox->bbGetFullName()<<")"<<std::endl);
- mBox->bbSetWidget(0);
- //bbtkDebugMessage("Wx",9,"EO WxBlackBoxWidget::~WxBlackBoxWidget("<<mBox->bbGetFullName()<<")"<<std::endl);
- }
- //=========================================================================
- */
:
mBox(box),
mWindow(widget)
- // mDead(false)
{
- bbtkDebugMessage("Wx",9,"WxBlackBoxWidgetEventHandler::WxBlackBoxWidgetEventHandler("<<mBox->bbGetFullName()<<")"<<std::endl);
+ bbtkDebugMessage("wx",9,"WxBlackBoxWidgetEventHandler::WxBlackBoxWidgetEventHandler("<<mBox.lock()->bbGetFullName()<<")"<<std::endl);
- mBox->bbSetWidgetEventHandler(this);
+ mBox.lock()->bbSetWidgetEventHandler(this);
Connect ( mWindow->GetId(),
wxEVT_DESTROY,
//=========================================================================
WxBlackBoxWidgetEventHandler::~WxBlackBoxWidgetEventHandler()
{
- bbtkDebugMessage("Wx",9,
- "WxBlackBoxWidgetEventHandler::~WxBlackBoxWidgetEventHandler("
- <<mBox->bbGetFullName()<<")"<<std::endl);
- mBox->bbSetWidgetEventHandler(0);
+ if (mBox.expired()) return;
+ bbtkDebugMessage("wx",9,
+ "WxBlackBoxWidgetEventHandler::~WxBlackBoxWidgetEventHandler() ["
+ <<mBox.lock()->bbGetFullName()<<"]"<<std::endl);
+ mBox.lock()->bbSetWidgetEventHandler(0);
}
//=========================================================================
//=========================================================================
void WxBlackBoxWidgetEventHandler::OnWindowDestroy(wxWindowDestroyEvent&)
{
- bbtkDebugMessage("Wx",9,"WxBlackBoxWidgetEventHandler::OnWindowDestroy() ["
- <<mBox->bbGetFullName()<<"]"<<std::endl);
- mBox->bbSetOutputWidget(0);
- mBox->bbSetModifiedStatus();
- //mDead = true;
- //delete this;
+ if (mBox.expired()) return;
+ bbtkDebugMessage("wx",9,"WxBlackBoxWidgetEventHandler::OnWindowDestroy() ["
+ <<mBox.lock()->bbGetFullName()<<"]"<<std::endl);
+ mBox.lock()->bbSetOutputWidget(0);
+ mBox.lock()->bbSetModifiedStatus();
}
//=========================================================================
- /*
- //=========================================================================
- wxWindow* WxParentToChildData::GetWindowInWhichToInsert( const BlackBox* b)
- const
- {
- bbtkDebugMessageInc("Kernel",9,"WxParentToChildData::GetWindowInWhichToInsert("<<b->bbGetFullName()<<")"<<std::endl);
-
- BlackBox::InputConnectorMapType::const_iterator i = b->bbGetInputConnectorMap().find("WinParent");
- if (i==b->bbGetInputConnectorMap().end())
- {
- bbtkError("WxParentToChildData::GetWindowInWhichToInsert : the box "
- <<b->bbGetFullName()
- <<" does not have any 'Parent' input ?!?");
- }
- Connection* c = i->second->GetConnection();
- if (!c)
- {
- bbtkDebugMessage("Kernel",9,
- "-> The input 'Parent' of the box "
- <<b->bbGetFullName()
- <<" is not connected."<<std::endl);
- return 0;
- }
-
- std::map< Connection*, wxWindow *>::const_iterator j
- = mConnectionToWindowMap.find(c);
-
- if (j==mConnectionToWindowMap.end())
- {
- bbtkError("WxParentToChildData::GetWindowInWhichToInsert("
- <<b->bbGetFullName()
- <<") no window provided by parent ?!?");
- }
-
- bbtkDebugDecTab("Kernel",9);
- return j->second;
- }
- //=========================================================================
- */
-
//=========================================================================
// WxBlackBox
//=========================================================================
//=========================================================================
void WxBlackBox::bbUserDestructor()
{
- bbtkDebugMessage("Kernel",9,"WxBlackBox::bbUserDestructor()"<<std::endl);
+ bbtkDebugMessage("wx",9,"==> WxBlackBox::bbUserDestructor() ["<<bbGetFullName()<<"]"<<std::endl);
if (bbGetWindow()) {
delete bbGetWindow();
- // bbSetWindow(0);
+ bbSetWindow(0);
}
- bbtkDebugMessage("Kernel",9,"EO WxBlackBox::bbUserDestructor()"<<std::endl);
+ bbtkDebugMessage("wx",9,"<== WxBlackBox::bbUserDestructor() ["<<bbGetFullName()<<"]"<<std::endl);
}
//=========================================================================
{
if (bbGetOutputWidget() && bbGetOutputWidget()->IsDead())
{
- bbtkDebugMessage("Wx",9,"WxBlackBox::bbGetWidget() ["<<
+ bbtkDebugMessage("wx",9,"WxBlackBox::bbGetWidget() ["<<
bbGetFullName()<<"] : Widget is dead : deleting it"
<<std::endl);
delete bbGetOutputWidget();
"-> Output 'Widget' connected : transfering execution to parent"
<<std::endl);
- i->second->GetConnectionVector().front().lock()
+ i->second->GetConnectionVector().front() //.lock()
->GetBlackBoxTo()->bbExecute(force);
}
else
{
bbSetUpdateTransferedToParent(true);
- i->second->GetConnectionVector().front().lock()
+ i->second->GetConnectionVector().front() //.lock()
->GetBlackBoxTo()->bbExecute(false);
}
}
if ( i->second->GetConnectionVector().size() != 0 )
{
return boost::static_pointer_cast<WxBlackBox>
- (i->second->GetConnectionVector().front().lock()->GetBlackBoxTo())
- ->bbGetContainingWindow();
+ (i->second->GetConnectionVector().front() //.lock()
+ ->GetBlackBoxTo())->bbGetContainingWindow();
}
return 0;
}
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
void bbSetUpdateTransferedToParent(bool b)
{ bbmUpdateTransferedToParent = b; }
-
};
//=================================================================
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;
};
//==================================================================
//bool IsDead() { return mDead; }
private:
- WxBlackBox::Pointer mBox;
+ WxBlackBox::WeakPointer mBox;
wxWindow* mWindow;
//bool mDead;
};
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
mInterpreter = bbtk::Interpreter::New();
mInterpreter->SetUser(this);
mInterpreter->SetCommandLine(true);
+ mInterpreter->SetThrow(false);
//==============
// Menu
wxInitAllImageHandlers();
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
//========================================================================
bool WxGUIHtmlBrowser::GoTo(std::string& file)
{
- // std::cout << "goto"<<std::endl;
-
bool r = mwxHtmlWindow->LoadPage(std2wx(file));
UpdateURL();
return r;
//========================================================================
void WxGUIHtmlBrowser::OnBackButton(wxCommandEvent& )
{
- // std::cout << "back"<<std::endl;
mwxHtmlWindow->HistoryBack();
UpdateURL();
}
//========================================================================
void WxGUIHtmlBrowser::OnForwardButton(wxCommandEvent& )
{
- // std::cout << "forward"<<std::endl;
mwxHtmlWindow->HistoryForward();
UpdateURL();
}
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
commandStr = "gedit ";
#endif
commandStr = commandStr + configFile;
- std::cout << "system: " << commandStr << std::endl;
+ // std::cout << "system: " << commandStr << std::endl;
system ( commandStr.c_str() );
}
//================================================================
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() );
}
//================================================================
bool WxGUIScriptingInterface::WxGUIHtmlBrowserUserOnLinkClicked(const std::string& target)
{
- std::cout << "OnLink"<<std::endl;
size_t s = target.length();
if ((s>3) && (target[s-1]=='s')
&& (target[s-2]=='b')
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
//================================================================
void WxGUITextEditorPage::Load(const std::string& filename)
{
- std::cout << "-------------- LOAD ---------------"<<std::endl;
- std::cout << "'" << filename << "'"<<std::endl;
+ // std::cout << "-------------- LOAD ---------------"<<std::endl;
+ // std::cout << "'" << filename << "'"<<std::endl;
//std::string oldFilename = mFilename;
mName = filename;
mAskFilename = false;
//================================================================
void WxGUITextEditorPage::Save(const std::string& filter)
{
- std::cout << "-------------- SAVE ---------------"<<std::endl;
+ // std::cout << "-------------- SAVE ---------------"<<std::endl;
if (mAskFilename)
{
wxFileDialog* fd = new wxFileDialog(this,_T("Save file"),_T(""),
}
else
{
- std::cout << "-------------- CANCELLED ---------------"
- <<std::endl;
+ // std::cout << "-------------- CANCELLED ---------------"
+ // <<std::endl;
return;
}
}
- std::cout << "file [" << mName << "]" <<std::endl;
+ // std::cout << "file [" << mName << "]" <<std::endl;
mwxInputText->SaveFile(std2wx(mName));
mwxInputText->SetModified(false);
}
mUser(user),
mFileNameFilter("*.*")
{
- std::cout << "WxGUITextEditor::WxGUITextEditor"<<std::endl;
+ // std::cout << "WxGUITextEditor::WxGUITextEditor"<<std::endl;
// mInterpreter = new bbtk::Interpreter();
//mInterpreter->SetWxGUITextEditor(this);
// mInterpreter->SetCommandLine(true);
}
void WxGUITextEditor::Open()
{
- std::cout << "-------------- OPEN ---------------"<<std::endl;
+ // std::cout << "-------------- OPEN ---------------"<<std::endl;
wxFileDialog* fd = new wxFileDialog(this,_T("Open file"),_T(""),
_T(""),std2wx(mFileNameFilter),
}
else
{
- std::cout << "-------------- CANCELLED ---------------"<<std::endl;
+ // std::cout << "-------------- CANCELLED ---------------"<<std::endl;
}
}
//================================================================
//================================================================
bool WxGUITextEditor::CloseCurrentPage()
{
- std::cout << "-------------- CLOSE ---------------"<<std::endl;
+ // std::cout << "-------------- CLOSE ---------------"<<std::endl;
if (mwxNotebook->GetPageCount()==0) return true;
if (GetCurrentPage()->IsModified())
{
//================================================================
void WxGUITextEditor::OnPageClose(wxAuiNotebookEvent& evt)
{
- std::cout << "-------------- CLOSE ---------------"<<std::endl;
+ // std::cout << "-------------- CLOSE ---------------"<<std::endl;
if (!CloseCurrentPage()) evt.Veto();
/*
}
void WxGUITextEditor::New()
{
- std::cout << "-------------- NEW ---------------" << std::endl;
+ /// std::cout << "-------------- NEW ---------------" << std::endl;
NewPage("");
UpdateInfo();
}