Program: bbtk
Module: $RCSfile: bbtkBlackBoxOutputConnector.h,v $
Language: C++
- Date: $Date: 2008/12/10 09:33:18 $
- Version: $Revision: 1.7 $
+ Date: $Date: 2008/12/15 09:04:46 $
+ Version: $Revision: 1.8 $
=========================================================================*/
/* ---------------------------------------------------------------------
ConnectionVector mConnection;
/// The status of the output
IOStatus mStatus;
-
+ /// The output changed signal
BlackBox::OutputChangeSignalType mChangeSignal;
- // The change time
-// ChangeTime mChangeTime;
};
}
Program: bbtk
Module: $RCSfile: bbtkInterpreter.cxx,v $
Language: C++
- Date: $Date: 2008/12/12 12:56:28 $
- Version: $Revision: 1.80 $
+ Date: $Date: 2008/12/15 09:04:47 $
+ Version: $Revision: 1.81 $
=========================================================================*/
/* ---------------------------------------------------------------------
info.help = "Clears the currently defined complex box (deletes all its boxes and connections)";
mCommandDict[info.keyword] = info;
+ info.keyword = "break";
+ info.argmin = 0;
+ info.argmax = 0;
+ info.code = cBreak;
+ info.syntax = "break";
+ info.help = "Breaks the current execution";
+ mCommandDict[info.keyword] = info;
+
info.keyword = "newgui";
info.argmin = 2;
info.argmax = 2;
//=======================================================================
- InterpreterError::InterpreterError( const std::string& message,
+ //=======================================================================
+ InterpreterException::InterpreterException( const std::string& message,
bool in_script_file,
const std::string& script_file,
int script_line
mScriptLine(script_line)
{
}
- InterpreterError::InterpreterError( const Exception& excep,
+ //=======================================================================
+ //=======================================================================
+ InterpreterException::InterpreterException( const Exception& excep,
bool in_script_file,
const std::string& script_file,
int script_line
{
}
//=======================================================================
- void Interpreter::CatchInterpreterException( const InterpreterError& e )
+
+
+ //=======================================================================
+ void Interpreter::CatchInterpreterException( const InterpreterException& e )
{
if (mThrow)
{
- CloseAllFiles();
- throw InterpreterError(e);
+ if (e.GetErrorMessage()!="break")
+ {
+ mStatus = Interpreter_ERROR;
+ CloseAllFiles();
+ }
+ throw InterpreterException(e);
}
else
{
mess << "* FILE : \""<<e.GetScriptFile()<<"\""<<std::endl;
mess << "* LINE : "<<e.GetScriptLine()<<std::endl;
}
+ CloseAllFiles();
std::cerr << mess.str();
}
}
//=======================================================================
void Interpreter::CatchBbtkException( const bbtk::Exception& e )
{
+ mStatus = Interpreter_ERROR;
if (mThrow)
{
bool in_script = false;
file = mFileName.back();
line = mLine.back();
}
- CloseAllFiles();
- throw InterpreterError(e,in_script,file,line);
+ if (e.GetErrorMessage()!="break")
+ CloseAllFiles();
+ throw InterpreterException(e,in_script,file,line);
}
else
{
mess << "* FILE : \""<<mFileName.back()<<"\""<<std::endl;
mess << "* LINE : "<<mLine.back()<<std::endl;
}
+ CloseAllFiles();
std::cerr << mess.str();
}
}
//=======================================================================
void Interpreter::CatchStdException( const std::exception& e )
{
+ mStatus = Interpreter_ERROR;
if (mThrow)
{
bool in_script = false;
line = mLine.back();
}
CloseAllFiles();
- throw InterpreterError(e.what(),in_script,file,line);
+ throw InterpreterException(e.what(),in_script,file,line);
}
else
{
mess << "* FILE : \""<<mFileName.back()<<"\""<<std::endl;
mess << "* LINE : "<<mLine.back()<<std::endl;
}
+ CloseAllFiles();
std::cerr << mess.str();
}
}
//=======================================================================
void Interpreter::CatchUnknownException()
{
+ mStatus = Interpreter_ERROR;
if (mThrow)
{
bool in_script = false;
line = mLine.back();
}
CloseAllFiles();
- throw InterpreterError("Unknown exception caught",
+ throw InterpreterException("Unknown exception caught",
in_script,file,line);
}
else
mess << "* FILE : \""<<mFileName.back()<<"\""<<std::endl;
mess << "* LINE : "<<mLine.back()<<std::endl;
}
+ CloseAllFiles();
std::cerr << mess.str();
}
}
//=======================================================================
//=======================================================================
-
-#define CATCH_MACRO \
- catch (QuitException e) \
- { \
- status = Interpreter_QUIT; \
- if (mThrow) throw QuitException(); \
- } \
- catch (InterpreterError e) \
- { \
- status = Interpreter_ERROR; \
+
+#define CATCH_MACRO \
+ catch (InterpreterException e) \
+ { \
CatchInterpreterException(e); \
- } \
- catch (bbtk::Exception e) \
- { \
- status = Interpreter_ERROR; \
- CatchBbtkException(e); \
- } \
- catch (std::exception& e) \
- { \
- status = Interpreter_ERROR; \
- CatchStdException(e); \
- } \
- catch (...) \
- { \
- status = Interpreter_ERROR; \
- CatchUnknownException(); \
+ } \
+ catch (bbtk::Exception e) \
+ { \
+ CatchBbtkException(e); \
+ } \
+ catch (std::exception& e) \
+ { \
+ CatchStdException(e); \
+ } \
+ catch (...) \
+ { \
+ CatchUnknownException(); \
}
//=======================================================================
//=======================================================================
- /**
- *
- */
Interpreter::ExitStatus Interpreter::InterpretFile( const std::string& filename, bool source )
{
bbtkDebugMessageInc("Interpreter",9,"Interpreter::InterpretFile(\""<<filename<<"\")"<<std::endl);
bool exm = mCommandLine;
mCommandLine = false;
- ExitStatus status = Interpreter_OK;
-
try
{
+ mStatus = Interpreter_OK;
SwitchToFile(filename,source);
-
- bool insideComment = false; // for multiline comment
- while (mFile.size()>0)
- {
- while (!mFile.back()->eof()) {
- mLine.back()++;
- char buf[500];
- mFile.back()->getline(buf,500);
- std::string str(buf);
- int size=str.length();
- if ( str[ size-1 ]==13 )
- {
- str.erase(size-1,1);
- }
- try
- {
- InterpretLine(str, insideComment);
- }
- CATCH_MACRO;
-
- }//while !eof
- CloseCurrentFile();
- }//while >0
- } // try
+ mInsideComment = false;
+ InterpretCurrentStreams();
+ }
CATCH_MACRO;
- CloseAllFiles();
- bbtkDebugMessage("Interpreter",9,"EO Interpreter::InterpretFile(\""<<filename<<"\")"<<std::endl);
+ bbtkDebugMessage("Interpreter",9,
+ "EO Interpreter::InterpretFile(\""
+ <<filename<<"\")"<<std::endl);
bbtkDecTab("Interpreter",9);
mCommandLine = exm;
- return status;
+ return mStatus;
}
//=======================================================================
//=======================================================================
- /**
- *
- */
Interpreter::ExitStatus
Interpreter::InterpretBuffer( std::stringstream* buffer )
{
bool exm = mCommandLine;
mCommandLine = false;
- ExitStatus status = Interpreter_OK;
-
try
{
+ mStatus = Interpreter_OK;
SwitchToStream(buffer);
- bool insideComment = false; // for multiline comment
- while (mFile.size()>0)
+ mInsideComment = false;
+ InterpretCurrentStreams();
+ }
+ CATCH_MACRO;
+
+ // CloseAllFiles();
+ bbtkDebugMessage("Interpreter",9,"EO Interpreter::InterpretBuffer()"<<std::endl);
+ bbtkDecTab("Interpreter",9);
+
+ mCommandLine = exm;
+ return mStatus;
+ }
+ //=======================================================================
+
+ //=======================================================================
+ /// Interprets the currently open streams
+ Interpreter::ExitStatus Interpreter::InterpretCurrentStreams()
+ {
+ bbtkDebugMessageInc("Interpreter",9,
+ "Interpreter::InterpretCurrentStreams()"<<std::endl);
+
+ while (mFile.size()>0)
{
while (!mFile.back()->eof()) {
mLine.back()++;
}
try
{
- InterpretLine(str, insideComment);
+ DoInterpretLine(str);
}
CATCH_MACRO;
- }//while
+ }
CloseCurrentFile();
}
- }
- CATCH_MACRO;
-
- CloseAllFiles();
- bbtkDebugMessage("Interpreter",9,"EO Interpreter::InterpretBuffer()"<<std::endl);
- bbtkDecTab("Interpreter",9);
-
- mCommandLine = exm;
- return status;
+ return mStatus;
}
//=======================================================================
{
bbtkDebugMessageInc("Interpreter",9,"Interpreter::InterpretLine('"<<line<<"')"<<std::endl);
- ExitStatus status = Interpreter_OK;
-
try
{
- bool insideComment = false;
- InterpretLine(line, insideComment);
+ mStatus = Interpreter_OK;
+ mInsideComment = false;
+ DoInterpretLine(line );
}
CATCH_MACRO;
-
-
+
+
bbtkDebugMessage("Interpreter",9,"EO Interpreter::InterpretLine()"
<<std::endl);
bbtkDecTab("Interpreter",9);
- return status;
+ return mStatus;
}
+ //=======================================================================
//=======================================================================
- /**
- *
- */
-void Interpreter::InterpretLine( const std::string& line, bool &insideComment )
-{
- bbtkDebugMessageInc("Interpreter",9,"Interpreter::InterpretLine(\""<<line<<"\")"<<std::endl);
-
+ void Interpreter::DoInterpretLine( const std::string& line )
+ {
+ bbtkDebugMessageInc("Interpreter",9,"Interpreter::DoInterpretLine(\""<<line<<"\")"<<std::endl);
+
std::vector<std::string> words;
SplitLine(line,words);
{
bbtkDebugDecTab("Interpreter",9);
bbtkMessage("Interpreter",9,"In multiline comment"<<std::endl);
- insideComment = true;
+ mInsideComment = true;
return;
}
{
bbtkDebugDecTab("Interpreter",9);
bbtkMessage("Interpreter",9,"Out multiline comment"<<std::endl);
- if ( !insideComment ) {
+ if ( !mInsideComment ) {
bbtkDebugDecTab("Interpreter",9);
bbtkMessage("Interpreter",9,"Comment mismatch : '*/' with no matching '/*'"<<std::endl);
}
- insideComment = false;
+ mInsideComment = false;
return;
}
- if (insideComment)
+ if (mInsideComment)
{
bbtkDebugDecTab("Interpreter",9);
bbtkMessage("Interpreter",9,"Multiline Comment"<<std::endl);
int level=0;
std::string left,right,left2,right2;
std::string filename;
+
+ // message command
if (command.code==cMessage)
{
if (words.size()<3)
sscanf(words[2].c_str(),"%d",&level);
mVirtualExecuter->SetMessageLevel(words[1],level);
}
+ return;
}
else
{
bbtkMessage("echo",2,line<<std::endl);
}
+ // break and quit commands
+ if ((command.code==cBreak) || (command.code==cQuit))
+ {
+ bool in_script = false;
+ std::string file("");
+ int line = 0;
+ if (mFileName.size())
+ {
+ std::ifstream* fs = dynamic_cast<std::ifstream*>(mFile.back());
+ if (fs!=0) in_script = true;
+ file = mFileName.back();
+ line = mLine.back();
+ }
+ if (command.code==cBreak)
+ {
+ /*
+ std::cout << "BreakException("
+ <<in_script<<","
+ <<file<<","
+ <<line<<")"<<std::endl;
+ */
+ bbtkError("break");//,in_script,file,line);
+ // throw BreakException(in_script,file,line);
+ }
+ else
+ {
+ bbtkError("quit");//,in_script,file,line);
+ //throw QuitException(in_script,file,line);
+ }
+ return;
+ }
+
+ // other cammands
switch (command.code)
- {
- case cMessage :
-
- break;
+ {
case cNew :
mVirtualExecuter->Create(words[1],words[2]);
break;
case cReset :
Reset();
break;
-
- case cClear :
+
+ case cClear :
mVirtualExecuter->Clear();
break;
GetExecuter()->UnLoadPackage(words[1]);
break;
- case cQuit :
- throw QuitException();
- break;
-
case cDebug :
if (words.size()==2) Debug(words[1]);
else Debug("");
//=======================================================================
- /**
- *
- */
-void Interpreter::SplitLine ( const std::string& str, std::vector<std::string>& tokens)
+ void Interpreter::SplitLine ( const std::string& str, std::vector<std::string>& tokens)
{
bbtkDebugMessageInc("Interpreter",9,"Interpreter::SplitLine(\""<<str<<"\")"<<std::endl);
void Interpreter::Reset()
{
// Cannot close all files if the reset command is read from a file !
- // CloseAllFiles();
+ CloseAllFiles();
mFileNameHistory.clear();
this->mVirtualExecuter->Reset();
}
return;
}
+ //=======================================================================
//=======================================================================
- /**
- *
- */
void Interpreter::CloseCurrentFile()
{
bbtkDebugMessage("Interpreter",9,"Interpreter::CloseCurrentFile()"
//=======================================================================
//=======================================================================
- /**
- *
- */
void Interpreter::CloseAllFiles()
{
bbtkDebugMessage("Interpreter",9,"Interpreter::CloseAllFiles()"
//=======================================================================
- /**
- *
- */
void Interpreter::InterpretCommand( const std::vector<std::string>& words,
CommandInfoType& info )
{
mCommandLine = true;
bool again = true;
- bool insideComment = false; // for multiline comment
+ // bool insideComment = false; // for multiline comment
+ mInsideComment = false;
do
{
try
{
std::string line;
GetLineFromPrompt(line);
- InterpretLine(line, insideComment);
+ DoInterpretLine(line); //, insideComment);
}
+ /*
catch (QuitException e)
{
bbtkMessage("Interpreter",1,"Interpreter : Quit"<<std::endl);
again = false;
}
+ */
catch (bbtk::Exception e)
{
e.Print();
}
}
//==========================================================================
+
+ /*
+ //==========================================================================
+ // Adds a callback when 'break' command issued
+ void Interpreter::AddBreakObserver( BreakCallbackType c )
+ {
+ mBreakSignal.connect(c);
+ }
+ //==========================================================================
+ */
+
//==========================================================================
std::string Interpreter::GetObjectName() const
{
Program: bbtk
Module: $RCSfile: bbtkInterpreter.h,v $
Language: C++
- Date: $Date: 2008/12/12 12:11:21 $
- Version: $Revision: 1.38 $
+ Date: $Date: 2008/12/15 09:04:47 $
+ Version: $Revision: 1.39 $
=========================================================================*/
/* ---------------------------------------------------------------------
#include <fstream>
#include <deque>
+// Signal/slot mechanism for 'break' commands
+//#include <boost/signal.hpp>
+//#include <boost/bind.hpp>
+
namespace bbtk
{
//=======================================================================
- class BBTK_EXPORT InterpreterError : public Exception
+ class BBTK_EXPORT InterpreterException : public Exception
{
public:
- InterpreterError( const std::string& message,
+ InterpreterException( const std::string& message,
bool in_script_file,
const std::string& script_file,
int script_line
);
- InterpreterError( const Exception& excep,
+ InterpreterException( const Exception& excep,
bool in_script_file,
const std::string& script_file,
int script_line
);
- ~InterpreterError() throw() {}
+ ~InterpreterException() throw() {}
bool IsInScriptFile() const { return mInScriptFile; }
const std::string& GetScriptFile() const { return mScriptFile; }
};
//=======================================================================
+ /*
+ //=======================================================================
+ // The "Quit" exception
+ class BBTK_EXPORT QuitException : public InterpreterError
+ {
+ public:
+ QuitException( bool in_script_file,
+ const std::string& script_file,
+ int script_line
+ )
+ : InterpreterError("QUIT",in_script_file,script_file,script_line)
+ {}
+ ~QuitException() throw() {}
+ };
+ //=======================================================================
+ const std::string BREAK("BREAK");
+ //=======================================================================
+ // The "Break" exception
+ class BBTK_EXPORT BreakException : public InterpreterError
+ {
+ public:
+ BreakException( bool in_script_file,
+ std::string script_file,
+ int script_line
+ )
+ : InterpreterError(BREAK,in_script_file,script_file,script_line)
+ { std::cout << "BUILDING BREAK"<<std::endl; }
+ ~BreakException() throw() {}
+ };
+ //=======================================================================
+ */
//=======================================================================
class BBTK_EXPORT Interpreter : public Object
{
Interpreter_OK,
Interpreter_ERROR,
- Interpreter_QUIT
+ Interpreter_QUIT,
+ Interpreter_BREAK,
}
ExitStatus;
/// Runs the interpretation of a command
ExitStatus InterpretLine( const std::string& line );
+ /// Runs the interpretation of the currently open streams
+ ExitStatus InterpretCurrentStreams();
/// Launches a command line interpreter (with a prompt)
void CommandLineInterpreter();
/// Gets the Executer
VirtualExec::Pointer GetExecuter() const { return mVirtualExecuter; }
+ /*
+ // For 'break' commands observation
+ typedef boost::signals::trackable BreakObserverType;
+ typedef boost::signal<void ()> BreakSignalType;
+ typedef BreakSignalType::slot_function_type BreakCallbackType;
+
+ // Adds a callback when 'break' command issued
+ void AddBreakObserver( BreakCallbackType );
+ */
protected:
/// The enumeration of command codes == Command name
typedef enum
{
- cClear,
+ cBreak, // LG 12/12/08 : Stops the current script execution (if not exec frozen) - used in tutorial + debugging
+ cClear, // LG 12/12/08 : Clears the current complex black box (e.g. workspace) - used in tours
cNew,
cDelete,
cConnect,
/// Interprets a line
- void InterpretLine( const std::string& line, bool &insideComment );
+ void DoInterpretLine( const std::string& line ); //, bool &insideComment );
/// Reads a line from prompt
void GetLineFromPrompt( std::string& line );
void Debug(const std::string& arg);
+
private:
/// Constructor
std::string includeScriptName);
///
- void CatchInterpreterException( const InterpreterError& e );
+ void CatchInterpreterException( const InterpreterException& e );
void CatchBbtkException( const bbtk::Exception& e );
void CatchStdException( const std::exception& e );
void CatchUnknownException();
/// Are we in a command line context ?
bool mCommandLine;
+ /// Are we inside a commented-out zone ?
+ bool mInsideComment;
+
+ /// The current interpreter status
+ ExitStatus mStatus;
+
/// The history of commands
std::deque< char* > mHistory;
- int bufferNb;
+ int bufferNb;
bool mThrow;
- protected:
- ~Interpreter();
+ /// The break signal
+ // BreakSignalType mBreakSignal;
+
+ protected:
+ ~Interpreter();
};
// EO class Interpreter
- // The "Quit" exception
- struct QuitException : public bbtk::Exception
- {
- QuitException() : bbtk::Exception("Interpreter","","Quit") {}
- };
}
#endif
Program: bbtk
Module: $RCSfile: bbtkWxGUIScriptingInterface.cxx,v $
Language: C++
- Date: $Date: 2008/10/21 14:38:31 $
- Version: $Revision: 1.31 $
+ Date: $Date: 2008/12/15 09:04:47 $
+ Version: $Revision: 1.32 $
=========================================================================*/
/* ---------------------------------------------------------------------
mInterpreter->SetUser(this);
mInterpreter->SetCommandLine(true);
mInterpreter->SetThrow(true);
-
+ // mInterpreter->AddBreakObserver
+ //boost::bind( &WxGUIScriptingInterface::InterpreterUserOnBreak, this ));
//==============
// Menu
wxInitAllImageHandlers();
m_mgr.Update();
// LoadPerspective();
-
+ mBreaked = false;
+
wxTipWindow* tip = new wxTipWindow(this,
_T("\n Welcome to bbStudio !\n\n To run a demo or example:\n 1. click on the 'Demos' or 'Examples' link\n 2. select a demo or example\n 3. click on the '[source]' link : the source file is loaded in bbStudio\n 4. click on the 'Run' button (the arrow at the bottom right of the source file) \n"),1000);
tip->CenterOnParent();
mWxGUITextEditor->Open(filename);
}
//================================================================
-
-#define CATCH_MACRO \
- catch (QuitException e) \
+ /*
+ catch (BreakException e) \
{ \
- std::cout << "* quit exception caught"<<std::endl; \
+ std::cout << "* BREAK"<<std::endl; \
+ if (e.IsInScriptFile()) \
+ std::cout << "* FILE : '"<<e.GetScriptFile()<<"'"<<std::endl; \
+ std::cout << "* LINE : "<<e.GetScriptLine()<<std::endl; \
} \
- catch (InterpreterError e) \
+ catch (QuitException e) \
{ \
- std::cerr << "* IERROR : "<<e.GetErrorMessage()<<std::endl; \
+ std::cout << "* QUIT"<<std::endl; \
if (e.IsInScriptFile()) \
- std::cerr << "* FILE : '"<<e.GetScriptFile()<<"'"<<std::endl; \
- std::cerr << "* LINE : "<<e.GetScriptLine()<<std::endl; \
- int lev = bbtk::MessageManager::GetMessageLevel("Error"); \
- if (lev > 0) { \
- std::cerr << "* Exception thrown : "<<std::endl; \
- std::cerr << "* OBJECT : " <<e.GetObject()<<std::endl; \
- std::cerr << "* FILE : " <<e.GetSourceFile()<<std::endl; \
- } \
+ std::cout << "* FILE : '"<<e.GetScriptFile()<<"'"<<std::endl; \
+ std::cout << "* LINE : "<<e.GetScriptLine()<<std::endl; \
+ } \
+*/
+
+#define CATCH_MACRO \
+ catch (InterpreterException e) \
+ { \
+ if (e.GetErrorMessage()=="quit") \
+ { \
+ std::cerr << "* QUIT ENCOUNTERED"<<std::endl; \
+ if (e.IsInScriptFile()) \
+ std::cerr << "* FILE : '"<<e.GetScriptFile()<<"'"<<std::endl; \
+ std::cerr << "* LINE : "<<e.GetScriptLine()<<std::endl; \
+ } \
+ else if (e.GetErrorMessage()=="break") \
+ { \
+ mBreaked = true; \
+ std::cerr << "* BREAK"<<std::endl; \
+ if (e.IsInScriptFile()) \
+ std::cerr << "* FILE : '"<<e.GetScriptFile()<<"'"<<std::endl; \
+ std::cerr << "* LINE : "<<e.GetScriptLine()<<std::endl; \
+ } \
+ else \
+ { \
+ std::cerr << "* ERROR : "<<e.GetErrorMessage()<<std::endl; \
+ if (e.IsInScriptFile()) \
+ std::cerr << "* FILE : '"<<e.GetScriptFile()<<"'"<<std::endl; \
+ std::cerr << "* LINE : "<<e.GetScriptLine()<<std::endl; \
+ int lev = bbtk::MessageManager::GetMessageLevel("Error"); \
+ if (lev > 0) { \
+ std::cerr << "* Exception thrown : "<<std::endl; \
+ std::cerr << "* OBJECT : " <<e.GetObject()<<std::endl; \
+ std::cerr << "* FILE : " <<e.GetSourceFile()<<std::endl; \
+ } \
+ } \
}
//================================================================
(*buf) << mWxGUITextEditor->GetCurrentPage()->GetText();
try
{
- // std::cout << "RUN"<<std::endl;
- if (mwxMenuItemReset->IsChecked()) WxGUICommandEnter("reset");
- mInterpreter->InterpretBuffer(buf);
+ if (!mBreaked)
+ {
+ if (mwxMenuItemReset->IsChecked()) WxGUICommandEnter("reset");
+ mInterpreter->InterpretBuffer(buf);
+ }
+ else
+ {
+ mBreaked = false;
+ mInterpreter->InterpretCurrentStreams();
+ }
// std::cout << "EO RUN"<<std::endl;
}
CATCH_MACRO;
}
//================================================================
+ /*
+ //================================================================
+ void WxGUIScriptingInterface::InterpreterUserOnBreak()
+ {
+ // std::cout << "Break" << std::endl;
+
+ }
+ //================================================================
+ */
+
//================================================================
bool WxGUIScriptingInterface::WxGUIHtmlBrowserUserOnLinkClicked(const std::string& target)
{
Program: bbtk
Module: $RCSfile: bbtkWxGUIScriptingInterface.h,v $
Language: C++
- Date: $Date: 2008/10/17 08:18:15 $
- Version: $Revision: 1.14 $
+ Date: $Date: 2008/12/15 09:04:47 $
+ Version: $Revision: 1.15 $
=========================================================================*/
/* ---------------------------------------------------------------------
// Interpreter callbacks
bool InterpreterUserHasOwnHtmlPageViewer() { return true; }
void InterpreterUserViewHtmlPage(const std::string&);
+ // void InterpreterUserOnBreak();
// WxGUICommand callbacks
void WxGUICommandEnter(const std::string&);
wxMenuItem* mwxMenuItemReset;
// wxButton* mwxButtonRun;
+ bool mBreaked;
+
public:
// ----------------------
new LayoutSplit mainSplit
- set mainSplit.Proportion 50
+ set mainSplit.Proportion 60
set mainSplit.WinHeight 1000
set mainSplit.WinWidth 1400
set mainSplit.WinTitle "Processing / Viewing example (demoFiltering1.bbs) "
new Slider sliceSlider
set sliceSlider.Title "Slice"
+ set sliceSlider.ReactiveOnTrack true
connect sliceSlider.Widget sliderLayout.Widget1
new Slider lowerThresholdSlider
set lowerThresholdSlider.Title "LowerThreshold"
- set lowerThresholdSlider.Max 50
- set lowerThresholdSlider.In 20
+ set lowerThresholdSlider.Max 200
+ set lowerThresholdSlider.In 10
set lowerThresholdSlider.ChangeResolution 1
connect lowerThresholdSlider.Widget sliderLayout.Widget2
new Slider upperThresholdSlider
set upperThresholdSlider.Title "UpperThreshold"
set upperThresholdSlider.Max 500
- set upperThresholdSlider.In 500
+ set upperThresholdSlider.In 150
set upperThresholdSlider.ChangeResolution 1
connect upperThresholdSlider.Widget sliderLayout.Widget3
new Slider smoothSlider
set smoothSlider.Title "Smooth"
set smoothSlider.Max 10
- set smoothSlider.In 1
+ set smoothSlider.In 3
set smoothSlider.ChangeResolution 1
connect smoothSlider.Widget sliderLayout.Widget4
new LayoutLine buttonLayout
- set buttonLayout.Orientation V
+ set buttonLayout.Orientation H
connect buttonLayout.Widget toolLayout.Widget2
+ new ColourSelectorButton colourThreshold
+ set colourThreshold.In "1 0 0"
+ connect colourThreshold.Widget buttonLayout.Widget1
+
new ColourSelectorButton colourSmooth
set colourSmooth.In "1 1 0"
- connect colourSmooth.Widget buttonLayout.Widget1
+ connect colourSmooth.Widget buttonLayout.Widget2
- new ColourSelectorButton colourThreshold
- set colourThreshold.In "1 0 0"
- connect colourThreshold.Widget buttonLayout.Widget2
-
+
+/*
new CommandButton refresh
set refresh.Label "Refresh (to be used once at start time)"
connect refresh.Widget buttonLayout.Widget3
-
+*/
new LayoutLine layout2D
set layout2D.Orientation H
connect layout2D.Widget splitUp.Widget2
set lowerOpacitySlider.Title "Opacity"
set lowerOpacitySlider.Min 1
set lowerOpacitySlider.Max 100
- set lowerOpacitySlider.In 20
+ set lowerOpacitySlider.In 50
set lowerOpacitySlider.Orientation V
connect lowerOpacitySlider.Widget vSliderLayout.Widget1
connect smooth.Out viewer2DImageSmooth.In
connect sliceSlider.Out viewer2DImageSmooth.Slice
+
+// Planes
+new ImagePlanes planes
+ connect reader.Out planes.In
+ connect planes.PlaneX viewer3DSurfaceSmooth.Obs1
+ connect planes.PlaneY viewer3DSurfaceSmooth.Obs2
+ connect planes.PlaneZ viewer3DSurfaceSmooth.Obs3
// Surfaces 3D
new MultipleInputs multInForImageOriginal
connect sliceSlider.BoxChange multInForImageOriginal.In1
- connect refresh.BoxChange multInForImageOriginal.In2
-
+# connect refresh.BoxChange multInForImageOriginal.In2
+
+
new MultipleInputs multInForImageSegmented
connect lowerThresholdSlider.BoxChange multInForImageSegmented.In1
connect upperThresholdSlider.BoxChange multInForImageSegmented.In2
- connect refresh.BoxChange multInForImageSegmented.In3
+# connect refresh.BoxChange multInForImageSegmented.In3
+ connect sliceSlider.BoxChange multInForImageSegmented.In4
new MultipleInputs multInForImageSmooth
connect lowerThresholdSlider.BoxChange multInForImageSmooth.In1
connect upperThresholdSlider.BoxChange multInForImageSmooth.In2
connect smoothSlider.BoxChange multInForImageSmooth.In3
- connect lowerOpacitySlider.BoxChange multInForImageSmooth.In4
- connect refresh.BoxChange multInForImageSmooth.In5
+# connect refresh.BoxChange multInForImageSmooth.In4
+ connect sliceSlider.BoxChange multInForImageSmooth.In5
new MultipleInputs multInForSurfaceThreshold
- connect refresh.BoxChange multInForSurfaceThreshold.In1
+# connect refresh.BoxChange multInForSurfaceThreshold.In1
connect colourThreshold.BoxChange multInForSurfaceThreshold.In2
+ connect lowerThresholdSlider.BoxChange multInForSurfaceThreshold.In3
+ connect upperThresholdSlider.BoxChange multInForSurfaceThreshold.In4
new MultipleInputs multInForSurfaceSmooth
- connect refresh.BoxChange multInForSurfaceSmooth.In1
+# connect refresh.BoxChange multInForSurfaceSmooth.In1
+ connect lowerOpacitySlider.BoxChange multInForSurfaceSmooth.In1
connect colourSmooth.BoxChange multInForSurfaceSmooth.In2
+ connect lowerThresholdSlider.BoxChange multInForSurfaceSmooth.In3
+ connect upperThresholdSlider.BoxChange multInForSurfaceSmooth.In4
+ connect smoothSlider.BoxChange multInForSurfaceSmooth.In5
connect multInForImageOriginal.BoxChange viewer2DImageOriginal.BoxExecute
connect multInForImageSegmented.BoxChange viewer2DImageSegmented.BoxExecute
--- /dev/null
+description "A tour of wxvtk boxes"
+author "laurent.guigues@creatis.insa-lyon.fr"
+category "demo"
+
+# put all include before or will be within echo 2 and generate many messages...
+include wxvtk
+include vtk
+include std
+
+# To avoid getting textual help
+message Help 0
+
+#==================================================================
+print " "
+print "====================================="
+print "A simple 2D viewer"
+print "====================================="
+help Viewer2D
+message echo 2
+
+new LoadHola image
+new Viewer2D viewer
+connect image.Out viewer.In
+set viewer.Slice 20
+set viewer.WinDialog true
+exec viewer
+
+message echo 0
+clear
+print " "
+print "====================================="
+print "A simple 2D slicer"
+print "====================================="
+help SimpleSlicer
+message echo 2
+
+new LoadHola image
+new SimpleSlicer viewer
+connect image.Out viewer.In
+set viewer.WinDialog true
+exec viewer
+
+message echo 0
+clear
+print " "
+print "====================================="
+print "A double 2D slicer"
+print "====================================="
+help DoubleSlicer
+message echo 2
+
+new LoadHola image
+new DoubleSlicer viewer
+connect image.Out viewer.In1
+connect image.Out viewer.In2
+set viewer.WinDialog true
+exec viewer
+
+
+message echo 0
+clear
+print " "
+print "====================================="
+print " END OF TOUR"
+print "====================================="