Minsky
minsky::MinskyTCL Struct Reference

#include <minskyTCL.h>

Inheritance diagram for minsky::MinskyTCL:
Inheritance graph
Collaboration diagram for minsky::MinskyTCL:
Collaboration graph

Public Member Functions

void getValue (const std::string &valueId)
 generate a TCL_obj referring to variableValues[valueId] More...
 
void startRecording (const char *file)
 
void stopRecording ()
 
void operationIcon (const char *imageName, const char *opName) const
 fill in a Tk image with the icon for a specific operation More...
 
std::set< string > matchingTableColumns (const std::string &currTable, GodleyAssetClass::AssetClass ac)
 
void registerRef (ItemPtr &item, const std::string &name)
 register item as a TCL obj under name if it exists, otherwise deregister it More...
 
bool itemFromItemFocus ()
 
bool itemFocusFromItem ()
 
bool getItemAt (float x, float y)
 
void retypeItem (VariableType::Type type)
 
bool getItemAtFocus ()
 
bool findVariableDefinition ()
 
bool getWireAt (float x, float y)
 
void addVariable (const std::string &name, VariableType::Type type)
 
void addOperation (OperationType::Type op)
 
void addNote (const std::string &text)
 
void addPlot ()
 
void addGodley ()
 
void addGroup ()
 
void addSwitch ()
 
void addIntegral ()
 
void addRavel ()
 
void addLock ()
 
void addSheet ()
 
void createGroup ()
 
void convertVarType (const std::string &name, VariableType::Type type)
 
void groupOfItem ()
 
void resetItem ()
 
bool selectVar (float x, float y)
 
std::string TCLItem ()
 create a TCL controlled object that is a reference to item More...
 
void setColour (std::size_t i, const char *name)
 sets the colour of palette item i to Tk acceptable colour name More...
 
bool findObject (const std::string &type)
 find first object of given type More...
 
bool findVariable (const std::string &name)
 
void openGroupInCanvas ()
 reinitialises canvas to the group located in item More...
 
void openModelInCanvas ()
 reinitialises canvas to the toplevel group More...
 
std::string openGodley ()
 
std::string listAllInstances () const
 
void loadVariableFromCSV (const std::string &specVar, const std::string &filename)
 
void load (const std::string &filename)
 load from a file More...
 
void undo (TCL_args args)
 restore model to state changes ago More...
 
string valueId (const string &x)
 
void setBusyCursor () override
 set/clear busy cursor in GUI More...
 
void clearBusyCursor () override
 
void message (const std::string &m) override
 display a message in a popup box on the GUI More...
 
void runItemDeletedCallback (const Item &item) override
 run callback attached to item More...
 
MemCheckResult checkMemAllocation (std::size_t bytes) const override
 
OperationType::Group classifyOp (OperationType::Type o) const
 
 CLASSDESC_ACCESS (MinskyTCL)
 
- Public Member Functions inherited from minsky::Minsky
void addNewPublicationTab (const std::string &name)
 
void addCanvasItemToPublicationTab (size_t i)
 
bool multipleEquities () const
 
bool multipleEquities (const bool &m)
 
bool edited () const
 reflects whether the model has been changed since last save More...
 
bool reset_flag () const
 true if reset needs to be called prior to numerical integration More...
 
void markEdited ()
 indicate model has been changed since last saved More...
 
void requestReset ()
 
void requestRedraw ()
 requests a redraw of the curren active tab More...
 
bool resetIfFlagged () override
 checks whether a reset is required, and resets the simulation if so More...
 
void populateMissingDimensions ()
 fills in dimensions table with all loaded ravel axes More...
 
void populateMissingDimensionsFromVariable (const VariableValue &, bool &incompatibleMessageDisplayed)
 populate missing dimensions from a variableValue More...
 
void populateMissingDimensionsFromVariable (const VariableValue &v)
 
void renameDimension (const std::string &oldName, const std::string &newName)
 
void setGodleyIconResource (const string &s)
 
void setGroupIconResource (const string &s)
 
void setLockIconResource (const string &locked, const string &unlocked)
 
void setRavelIconResource (const string &s)
 
std::set< string > matchingTableColumns (const GodleyIcon &currTable, GodleyAssetClass::AssetClass ac)
 
void importDuplicateColumn (GodleyTable &srcTable, int srcCol)
 find any duplicate column, and use it as a source column for balanceDuplicateColumns More...
 
void balanceDuplicateColumns (const GodleyIcon &srcTable, int srcCol)
 makes all duplicated columns consistent with srcTable, srcCol More...
 
std::vector< std::string > allGodleyFlowVars () const
 
 Minsky ()
 
 ~Minsky ()
 
void clearAllMaps (bool clearHistory)
 
void clearAllMaps ()
 
void clearAllMapsTCL ()
 
VariablePtr definingVar (const std::string &valueId) const
 returns reference to variable defining (ie input wired) for valueId More...
 
void saveCanvasItemAsFile (const string &fileName) const
 
void initGodleys ()
 
void cut ()
 erase items in current selection, put copy into clipboard More...
 
void copy () const
 copy items in current selection into clipboard More...
 
void paste ()
 paste clipboard as a new group or ungrouped items on the canvas. canvas.itemFocus is set to refer to the new group or items. More...
 
bool clipboardEmpty () const
 return true if nothing available in clipboard More...
 
void saveSelectionAsFile (const string &fileName) const
 
void insertGroupFromFile (const string &file)
 
void makeVariablesConsistent ()
 
void imposeDimensions ()
 
void garbageCollect ()
 
bool cycleCheck () const
 checks for presence of illegal cycles in network. Returns true if there are some More...
 
void openLogFile (const string &)
 opens the log file, and writes out a header line describing names of all variables More...
 
void closeLogFile ()
 closes log file More...
 
bool loggingEnabled () const
 returns true if logging is in operation More...
 
void constructEquations ()
 construct the equations based on input data More...
 
void dimensionalAnalysis () const
 performs dimension analysis, throws if there is a problem More...
 
void deleteAllUnits ()
 removes units markup from all variables in model More...
 
bool checkEquationOrder () const
 consistency check of the equation order. Should return true. Outputs the operation number of the invalidly ordered operation. More...
 
double deltaT () const
 
void reset ()
 resets the variables back to their initial values More...
 
std::vector< double > step ()
 step the equations (by n steps, default 1) More...
 
void save (const std::string &filename)
 
void load (const std::string &filename)
 load from a file More...
 
void exportSchema (const std::string &filename, int schemaLevel=1)
 
void displayErrorItem (const Item &op) const
 indicate operation item has error, if visible, otherwise contining group More...
 
std::string ecolabVersion () const
 
std::string ravelVersion () const
 
std::string autoSaveFile () const
 name of an auto save file More...
 
void setAutoSaveFile (const std::string &file)
 initialises auto saving empty file to turn off autosave More...
 
void clearHistory ()
 clear history More...
 
void checkPushHistory ()
 called periodically to ensure history up to date More...
 
bool pushHistory ()
 push current model state onto history if it differs from previous More...
 
bool commandHook (const std::string &command, unsigned nargs)
 Executed after each interpreter command to maintain undo/redo stack, edited flag, autosaving etc. More...
 
long undo (int changes=1)
 restore model to state changes ago More...
 
void convertVarType (const std::string &name, VariableType::Type type)
 Converts variable(s) named by name into a variable of type type. More...
 
void addIntegral ()
 add integral to current canvas item (which must be variable convertible to an integral variable More...
 
bool inputWired (const std::string &name) const
 returns true if any variable of name name has a wired input More...
 
void renderCanvasToPS (const std::string &filename)
 render canvas to a postscript file More...
 
void renderCanvasToPDF (const std::string &filename)
 render canvas to a PDF file More...
 
void renderCanvasToSVG (const std::string &filename)
 render canvas to an SVG file More...
 
void renderCanvasToPNG (const std::string &filename)
 render canvas to a PNG image file More...
 
void renderCanvasToPNG (const std::string &filename, const Canvas::ZoomCrop &z)
 Render canvas to a PNG file filename, scaling the canvas temporarily by zoom, shifts it to left, top, and crops to width, height (in ZoomCrop struct). More...
 
void renderCanvasToEMF (const std::string &filename)
 render canvas to a EMF image file (Windows only) More...
 
void renderAllPlotsAsSVG (const string &prefix) const
 render all plots More...
 
void exportAllPlotsAsCSV (const string &prefix) const
 export all plots More...
 
void setAllDEmode (bool)
 set DE mode on all godley tables More...
 
void srand (int seed)
 set std library RNG seed More...
 
void setGodleyDisplayValue (bool displayValues, GodleyTable::DisplayStyle displayStyle)
 set display value mode on all godley table editor modes More...
 
void importVensim (const std::string &)
 import a Vensim file More...
 
void redrawAllGodleyTables ()
 request all Godley table windows to redraw More...
 
virtual void progress (const std::string &title, int)
 set progress bar, out of 100, labelling the progress bar with title More...
 
virtual void bookmarkRefresh ()
 refresh the bookmark menu after changes More...
 
virtual void resetScroll ()
 reset main window scroll bars after model has been panned More...
 
virtual MemCheckResult checkMemAllocation (size_t bytes) const
 
std::size_t physicalMem () const
 returns amount of memory installed on system More...
 
vector< string > listFonts () const
 
int numOpArgs (OperationType::Type o)
 
OperationType::Group classifyOp (OperationType::Type o) const
 
void latex (const std::string &filename, bool wrapLaTeXLines)
 
void matlab (const std::string &filename)
 
string latex2pango (const std::string &x)
 
std::vector< std::string > availableOperations ()
 list of available operations More...
 
Minsky::AvailableOperationsMapping availableOperationsMapping () const
 
std::vector< std::string > variableTypes ()
 list of available variable types More...
 
std::vector< std::string > assetClasses ()
 return list of available asset classes More...
 
void autoLayout ()
 auto layout current open group and recentre More...
 
void randomLayout ()
 randomly layout current open group and recentre reinitialises canvas to the group located in item More...
 
void openGroupInCanvas ()
 
void openModelInCanvas ()
 reinitialises canvas to the toplevel group More...
 
void listAllInstances ()
 
void nameCurrentItem (const std::string &name)
 
void itemFromNamedItem (const std::string &name)
 
bool triggerCheckMemAllocationCallback () const
 trigger checkMem callback for testing purposes More...
 
char getc () const
 Used to implement a pause until return pressed for attaching debugger purposes. More...
 
void setDefinition (const std::string &valueId, const std::string &definition)
 add/replace a definition for a flow variable given by valueId More...
 
void pushFlags ()
 push and pop state of the flags More...
 
void popFlags ()
 push and pop state of the flags More...
 
std::string defaultFont ()
 the default used by Pango More...
 
std::string defaultFont (const std::string &x)
 the default used by Pango More...
 
double fontScale ()
 an extra scaling factor of Pango fonts More...
 
double fontScale (double)
 an extra scaling factor of Pango fonts More...
 
- Public Member Functions inherited from minsky::RungeKutta
virtual ~RungeKutta ()=default
 
void rkreset ()
 reset the simulation More...
 
void rkstep ()
 step the equations (by n steps, default 1) evaluate the flow equations without stepping. More...
 
void evalEquations ()
 
- Public Member Functions inherited from minsky::Minsky_multipleEquities
 Minsky_multipleEquities (const std::string &name, ecolab::TCLAccessor< Minsky, bool >::Getter g, ecolab::TCLAccessor< Minsky, bool >::Setter s)
 

Static Public Member Functions

static int numOpArgs (OperationType::Type o)
 
- Static Public Member Functions inherited from minsky::Minsky
static void saveGroupAsFile (const Group &, const string &fileName)
 
static bool ravelAvailable ()
 
static bool ravelExpired ()
 
static int daysUntilRavelExpires ()
 

Public Attributes

bool rebuildTCLcommands =false
 
std::unique_ptr< std::ostream > eventRecord
 
ecolab::Accessor< std::string > defaultFont
 
- Public Attributes inherited from minsky::Minsky
PannableTab< EquationDisplayequationDisplay
 
FontDisplay fontSampler
 
PhillipsDiagram phillipsDiagram
 
std::vector< PubTabpublicationTabs
 
VariableValues variableValues
 
Dimensions dimensions
 
Conversions conversions
 
std::map< Units, double > maxValue
 stash the maximum absolute value obtained by a dimensioned quantity More...
 
std::map< Units, double > maxFlowValue
 
SVGRenderer histogramResource
 
Exclude< std::map< std::string, std::shared_ptr< CallableFunction > > > userFunctions
 
GroupPtr model {new Group}
 
Canvas canvas {model}
 
std::set< string > logVarList
 set of variables (valueIds) to log More...
 
double lastT {0}
 previous timestep More...
 
int numBackups =1
 number of previous versions of saved files to keep save to a file More...
 
std::string fileVersion
 Minsky version file was saved under. More...
 
unsigned maxHistory {100}
 maximum no. of history states to save More...
 
int maxWaitMS =100
 maximum wait in millisecond between redrawing canvas during simulation More...
 
bool doPushHistory =true
 flag to indicate whether a TCL should be pushed onto the history stack, or logged in a recording. This is used to avoid movements being added to recordings and undo history More...
 
bool displayValues =false
 
GodleyTable::DisplayStyle displayStyle =GodleyTable::sign
 
std::shared_ptr< VariableInstanceListvariableInstanceList
 supports navigation to all instances of current variable More...
 
std::map< std::string, std::weak_ptr< Item > > namedItems
 
VariablePane variablePane
 
- Public Attributes inherited from minsky::RungeKutta
double t {0}
 time More...
 
bool running =false
 controls whether simulation is running More...
 
bool reverse =false
 reverse direction of simulation More...
 
EvalGodley evalGodley
 
- Public Attributes inherited from minsky::Simulation
double stepMin {0}
 
double stepMax {0.01}
 
int nSteps {1}
 
double epsRel {1e-2}
 
double epsAbs {1e-3}
 
int order {4}
 
bool implicit {false}
 
int simulationDelay {0}
 
std::string timeUnit
 
double tmax {INFINITY}
 
double t0 {0}
 

Private Member Functions

CmdData getCommandData (const std::string &command) const override
 return meta information on a given command More...
 

Private Attributes

std::unique_ptr< char[]> _defaultFont
 

Additional Inherited Members

- Public Types inherited from minsky::Minsky
enum  CmdData { no_command, is_const, is_setterGetter, generic }
 
enum  MemCheckResult { OK, proceed, abort }
 check whether to proceed or abort, given a request to allocate bytes of memory. Implemented in MinskyTCL More...
 
using AvailableOperationsMapping = classdesc::StringKeyMap< std::vector< OperationType::Type > >
 
- Static Public Attributes inherited from minsky::Minsky
static const std::string minskyVersion =MINSKY_VERSION
 return the AEGIS assigned version number More...
 
- Static Public Attributes inherited from minsky::ValueVector
static std::vector< double, CIVITA_ALLOCATOR< double > > stockVars
 vector of variables that are integrated via Runge-Kutta. These variables label the columns of the Godley table More...
 
static std::vector< double, CIVITA_ALLOCATOR< double > > flowVars
 variables defined as a simple function of the stock variables, also known as lhs variables. These variables appear in the body of the Godley table More...
 
- Protected Member Functions inherited from minsky::RungeKutta
void evalEquations (double result[], double, const double vars[])
 
void evalJacobian (Matrix &, double, const double vars[])
 
- Static Protected Member Functions inherited from minsky::RungeKutta
static int RKfunction (double, const double y[], double f[], void *)
 function to be integrated (internal use) More...
 
static int jacobian (double, const double y[], double *, double dfdt[], void *)
 compute jacobian (internal use) More...
 

Detailed Description

Definition at line 43 of file minskyTCL.h.

Member Function Documentation

◆ addGodley()

void minsky::MinskyTCL::addGodley ( )
inline

Definition at line 176 of file minskyTCL.h.

References minsky::Canvas::addGodley(), minsky::Minsky::canvas, minsky::Canvas::itemFocus, and registerRef().

176  {
177  canvas.addGodley();
178  registerRef(canvas.itemFocus,"minsky.canvas.itemFocus");
179  }
void registerRef(ItemPtr &item, const std::string &name)
register item as a TCL obj under name if it exists, otherwise deregister it
Definition: minskyTCL.h:73
Canvas canvas
Definition: minsky.h:256
void addGodley()
item or wire obtained by get*At() calls
Definition: canvas.h:200
ItemPtr itemFocus
item selected by clicking
Definition: canvas.h:106
Here is the call graph for this function:

◆ addGroup()

void minsky::MinskyTCL::addGroup ( )
inline

Definition at line 180 of file minskyTCL.h.

References minsky::Canvas::addGroup(), minsky::Minsky::canvas, minsky::Canvas::itemFocus, and registerRef().

180  {
181  canvas.addGroup();
182  registerRef(canvas.itemFocus,"minsky.canvas.itemFocus");
183  }
void addGroup()
item or wire obtained by get*At() calls
Definition: canvas.h:201
void registerRef(ItemPtr &item, const std::string &name)
register item as a TCL obj under name if it exists, otherwise deregister it
Definition: minskyTCL.h:73
Canvas canvas
Definition: minsky.h:256
ItemPtr itemFocus
item selected by clicking
Definition: canvas.h:106
Here is the call graph for this function:

◆ addIntegral()

void minsky::MinskyTCL::addIntegral ( )
inline

Definition at line 188 of file minskyTCL.h.

References minsky::Minsky::addIntegral(), minsky::Minsky::canvas, minsky::Canvas::item, and registerRef().

188  {
190  registerRef(canvas.item,"minsky.canvas.item");
191  }
void registerRef(ItemPtr &item, const std::string &name)
register item as a TCL obj under name if it exists, otherwise deregister it
Definition: minskyTCL.h:73
Canvas canvas
Definition: minsky.h:256
void addIntegral()
add integral to current canvas item (which must be variable convertible to an integral variable ...
Definition: minsky.cc:1527
ItemPtr item
item or wire obtained by get*At() calls
Definition: canvas.h:175
Here is the call graph for this function:

◆ addLock()

void minsky::MinskyTCL::addLock ( )
inline

Definition at line 196 of file minskyTCL.h.

References minsky::Canvas::addLock(), minsky::Minsky::canvas, minsky::Canvas::item, and registerRef().

196  {
197  canvas.addLock();
198  registerRef(canvas.item,"minsky.canvas.item");
199  }
void registerRef(ItemPtr &item, const std::string &name)
register item as a TCL obj under name if it exists, otherwise deregister it
Definition: minskyTCL.h:73
void addLock()
item or wire obtained by get*At() calls
Definition: canvas.h:204
Canvas canvas
Definition: minsky.h:256
ItemPtr item
item or wire obtained by get*At() calls
Definition: canvas.h:175
Here is the call graph for this function:

◆ addNote()

void minsky::MinskyTCL::addNote ( const std::string &  text)
inline

Definition at line 168 of file minskyTCL.h.

References minsky::Canvas::addNote(), minsky::Minsky::canvas, minsky::Canvas::itemFocus, and registerRef().

168  {
169  canvas.addNote(text);
170  registerRef(canvas.itemFocus,"minsky.canvas.itemFocus");
171  }
void addNote(const std::string &text)
item or wire obtained by get*At() calls
Definition: canvas.h:192
void registerRef(ItemPtr &item, const std::string &name)
register item as a TCL obj under name if it exists, otherwise deregister it
Definition: minskyTCL.h:73
Canvas canvas
Definition: minsky.h:256
ItemPtr itemFocus
item selected by clicking
Definition: canvas.h:106
Here is the call graph for this function:

◆ addOperation()

void minsky::MinskyTCL::addOperation ( OperationType::Type  op)
inline

Definition at line 164 of file minskyTCL.h.

References minsky::Canvas::addOperation(), minsky::Minsky::canvas, minsky::Canvas::itemFocus, minsky::op, and registerRef().

164  {
166  registerRef(canvas.itemFocus,"minsky.canvas.itemFocus");
167  }
void registerRef(ItemPtr &item, const std::string &name)
register item as a TCL obj under name if it exists, otherwise deregister it
Definition: minskyTCL.h:73
Canvas canvas
Definition: minsky.h:256
void addOperation(OperationType::Type op)
item or wire obtained by get*At() calls
Definition: canvas.h:182
ItemPtr itemFocus
item selected by clicking
Definition: canvas.h:106
Here is the call graph for this function:

◆ addPlot()

void minsky::MinskyTCL::addPlot ( )
inline

Definition at line 172 of file minskyTCL.h.

References minsky::Canvas::addPlot(), minsky::Minsky::canvas, minsky::Canvas::itemFocus, and registerRef().

172  {
173  canvas.addPlot();
174  registerRef(canvas.itemFocus,"minsky.canvas.itemFocus");
175  }
void addPlot()
item or wire obtained by get*At() calls
Definition: canvas.h:196
void registerRef(ItemPtr &item, const std::string &name)
register item as a TCL obj under name if it exists, otherwise deregister it
Definition: minskyTCL.h:73
Canvas canvas
Definition: minsky.h:256
ItemPtr itemFocus
item selected by clicking
Definition: canvas.h:106
Here is the call graph for this function:

◆ addRavel()

void minsky::MinskyTCL::addRavel ( )
inline

Definition at line 192 of file minskyTCL.h.

References minsky::Canvas::addRavel(), minsky::Minsky::canvas, minsky::Canvas::item, and registerRef().

192  {
193  canvas.addRavel();
194  registerRef(canvas.item,"minsky.canvas.item");
195  }
void registerRef(ItemPtr &item, const std::string &name)
register item as a TCL obj under name if it exists, otherwise deregister it
Definition: minskyTCL.h:73
Canvas canvas
Definition: minsky.h:256
void addRavel()
item or wire obtained by get*At() calls
Definition: canvas.h:203
ItemPtr item
item or wire obtained by get*At() calls
Definition: canvas.h:175
Here is the call graph for this function:

◆ addSheet()

void minsky::MinskyTCL::addSheet ( )
inline

Definition at line 200 of file minskyTCL.h.

References minsky::Canvas::addSheet(), minsky::Minsky::canvas, minsky::Canvas::item, and registerRef().

200  {
201  canvas.addSheet();
202  registerRef(canvas.item,"minsky.canvas.item");
203  }
void registerRef(ItemPtr &item, const std::string &name)
register item as a TCL obj under name if it exists, otherwise deregister it
Definition: minskyTCL.h:73
void addSheet()
item or wire obtained by get*At() calls
Definition: canvas.h:205
Canvas canvas
Definition: minsky.h:256
ItemPtr item
item or wire obtained by get*At() calls
Definition: canvas.h:175
Here is the call graph for this function:

◆ addSwitch()

void minsky::MinskyTCL::addSwitch ( )
inline

Definition at line 184 of file minskyTCL.h.

References minsky::Canvas::addSwitch(), minsky::Minsky::canvas, minsky::Canvas::itemFocus, and registerRef().

184  {
185  canvas.addSwitch();
186  registerRef(canvas.itemFocus,"minsky.canvas.itemFocus");
187  }
void registerRef(ItemPtr &item, const std::string &name)
register item as a TCL obj under name if it exists, otherwise deregister it
Definition: minskyTCL.h:73
Canvas canvas
Definition: minsky.h:256
void addSwitch()
item or wire obtained by get*At() calls
Definition: canvas.h:202
ItemPtr itemFocus
item selected by clicking
Definition: canvas.h:106
Here is the call graph for this function:

◆ addVariable()

void minsky::MinskyTCL::addVariable ( const std::string &  name,
VariableType::Type  type 
)
inline

Definition at line 160 of file minskyTCL.h.

References minsky::Canvas::addVariable(), minsky::Minsky::canvas, minsky::Canvas::itemFocus, and registerRef().

160  {
161  canvas.addVariable(name,type);
162  registerRef(canvas.itemFocus,"minsky.canvas.itemFocus");
163  }
void addVariable(const std::string &name, VariableType::Type type)
item or wire obtained by get*At() calls
Definition: canvas.h:187
void registerRef(ItemPtr &item, const std::string &name)
register item as a TCL obj under name if it exists, otherwise deregister it
Definition: minskyTCL.h:73
Canvas canvas
Definition: minsky.h:256
ItemPtr itemFocus
item selected by clicking
Definition: canvas.h:106
Here is the call graph for this function:

◆ checkMemAllocation()

MemCheckResult minsky::MinskyTCL::checkMemAllocation ( std::size_t  bytes) const
inlineoverride

Definition at line 381 of file minskyTCL.h.

References minsky::Minsky::abort, ecolab::mainWin, minsky::Minsky::OK, minsky::Minsky::physicalMem(), and minsky::Minsky::proceed.

381  {
382  if (ecolab::mainWin && bytes>0.2*physicalMem())
383  {
384  tclcmd cmd;
385  cmd<<"tk_messageBox -message {Allocation will use more than 50% of available memory. Do you want to proceed?} -type yesno\n";
386  return cmd.result=="yes"? proceed: abort;
387  }
388  return OK;
389  }
Tk_Window mainWin
Definition: tclmain.cc:66
std::size_t physicalMem() const
returns amount of memory installed on system
Definition: minsky.cc:1713
Here is the call graph for this function:

◆ CLASSDESC_ACCESS()

minsky::MinskyTCL::CLASSDESC_ACCESS ( MinskyTCL  )

◆ classifyOp()

OperationType::Group minsky::MinskyTCL::classifyOp ( OperationType::Type  o) const
inline

Definition at line 392 of file minskyTCL.h.

References minsky::OperationType::classify().

392 {return OperationType::classify(o);}
static Group classify(Type t)
Here is the call graph for this function:

◆ clearBusyCursor()

void minsky::MinskyTCL::clearBusyCursor ( )
inlineoverridevirtual

Reimplemented from minsky::Minsky.

Definition at line 372 of file minskyTCL.h.

Referenced by loadVariableFromCSV().

373  {tclcmd()<<"setCursor {}\n";}
Here is the caller graph for this function:

◆ convertVarType()

void minsky::MinskyTCL::convertVarType ( const std::string &  name,
VariableType::Type  type 
)
inline

Definition at line 209 of file minskyTCL.h.

References minsky::Minsky::canvas, minsky::Minsky::convertVarType(), minsky::Canvas::item, and registerRef().

209  {
210  Minsky::convertVarType(name,type);
211  registerRef(canvas.item,"minsky.canvas.item");
212  }
void registerRef(ItemPtr &item, const std::string &name)
register item as a TCL obj under name if it exists, otherwise deregister it
Definition: minskyTCL.h:73
Canvas canvas
Definition: minsky.h:256
void convertVarType(const std::string &name, VariableType::Type type)
Converts variable(s) named by name into a variable of type type.
Definition: minsky.cc:1457
ItemPtr item
item or wire obtained by get*At() calls
Definition: canvas.h:175
Here is the call graph for this function:

◆ createGroup()

void minsky::MinskyTCL::createGroup ( )
inline

Definition at line 205 of file minskyTCL.h.

References minsky::Minsky::canvas, minsky::Canvas::groupSelection(), minsky::Canvas::itemFocus, and registerRef().

205  {
207  registerRef(canvas.itemFocus,"minsky.canvas.itemFocus");
208  }
void registerRef(ItemPtr &item, const std::string &name)
register item as a TCL obj under name if it exists, otherwise deregister it
Definition: minskyTCL.h:73
Canvas canvas
Definition: minsky.h:256
ItemPtr itemFocus
item selected by clicking
Definition: canvas.h:106
void groupSelection()
create a group from items found in the current selection
Definition: canvas.cc:439
Here is the call graph for this function:

◆ findObject()

bool minsky::MinskyTCL::findObject ( const std::string &  type)
inline

find first object of given type

Definition at line 253 of file minskyTCL.h.

References minsky::Minsky::canvas, minsky::Canvas::item, minsky::GroupItems::items, minsky::Canvas::model, minsky::Minsky::model, and registerRef().

254  {
255  canvas.item.reset();
256  if (type=="Group" && !canvas.model->groups.empty())
257  canvas.item=canvas.model->groups.front();
258  else
259  model->recursiveDo
260  (&GroupItems::items, [&](const Items&, Items::const_iterator i)
261  {
262  if ((*i)->classType()==type)
263  {
264  canvas.item=*i;
265  return true;
266  }
267  return false;
268  });
269  registerRef(canvas.item,"minsky.canvas.item");
270  return canvas.item.get();
271  }
Model model
Definition: canvas.h:103
void registerRef(ItemPtr &item, const std::string &name)
register item as a TCL obj under name if it exists, otherwise deregister it
Definition: minskyTCL.h:73
std::vector< ItemPtr > Items
Definition: item.h:366
Canvas canvas
Definition: minsky.h:256
GroupPtr model
Definition: minsky.h:255
ItemPtr item
item or wire obtained by get*At() calls
Definition: canvas.h:175
Here is the call graph for this function:

◆ findVariable()

bool minsky::MinskyTCL::findVariable ( const std::string &  name)
inline

Definition at line 273 of file minskyTCL.h.

References minsky::Minsky::canvas, minsky::Canvas::item, minsky::GroupItems::items, minsky::Minsky::model, and registerRef().

274  {
275  canvas.item.reset();
276  model->recursiveDo
277  (&GroupItems::items, [&](const Items&, Items::const_iterator i)
278  {
279  if (auto v=dynamic_cast<VariableBase*>(i->get()))
280  if (v->name()==name)
281  {
282  canvas.item=*i;
283  return true;
284  }
285  return false;
286  });
287  registerRef(canvas.item,"minsky.canvas.item");
288  return canvas.item.get();
289  }
void registerRef(ItemPtr &item, const std::string &name)
register item as a TCL obj under name if it exists, otherwise deregister it
Definition: minskyTCL.h:73
std::vector< ItemPtr > Items
Definition: item.h:366
Canvas canvas
Definition: minsky.h:256
GroupPtr model
Definition: minsky.h:255
ItemPtr item
item or wire obtained by get*At() calls
Definition: canvas.h:175
Here is the call graph for this function:

◆ findVariableDefinition()

bool minsky::MinskyTCL::findVariableDefinition ( )
inline

Definition at line 139 of file minskyTCL.h.

References minsky::Minsky::canvas, minsky::Canvas::findVariableDefinition(), minsky::Canvas::item, and registerRef().

140  {
142  {
143  TCL_obj_deregister("minsky.canvas.item");
144  registerRef(canvas.item,"minsky.canvas.item");
145  return true;
146  }
147  return false;
148  }
bool findVariableDefinition()
populates item with the defining variable if there is one. Leave item unchanged if it is not a variab...
Definition: canvas.cc:768
void registerRef(ItemPtr &item, const std::string &name)
register item as a TCL obj under name if it exists, otherwise deregister it
Definition: minskyTCL.h:73
Canvas canvas
Definition: minsky.h:256
ItemPtr item
item or wire obtained by get*At() calls
Definition: canvas.h:175
Here is the call graph for this function:

◆ getCommandData()

CmdData minsky::MinskyTCL::getCommandData ( const std::string &  command) const
inlineoverrideprivatevirtual

return meta information on a given command

Reimplemented from minsky::Minsky.

Definition at line 398 of file minskyTCL.h.

References minsky::getCommandData(), minsky::Minsky::is_const, minsky::Minsky::is_setterGetter, minsky::Minsky::no_command, and minsky::RungeKutta::t.

398  {
399  auto t=minsky::getCommandData(command);
400  if (!t) return no_command;
401  if (t->is_const) return is_const;
402  if (t->is_setterGetter) return is_setterGetter;
403  return generic;
404  }
double t
time
Definition: rungeKutta.h:57
cmd_data * getCommandData(const string &name)
Definition: minskyTCL.cc:62
Here is the call graph for this function:

◆ getItemAt()

bool minsky::MinskyTCL::getItemAt ( float  x,
float  y 
)
inline

Definition at line 101 of file minskyTCL.h.

References minsky::Minsky::canvas, minsky::Canvas::getItemAt(), minsky::Canvas::item, and registerRef().

102  {
103  // deregister any old definitions, as item is polymorphic
104  TCL_obj_deregister("minsky.canvas.item");
105  canvas.getItemAt(x,y);
106  registerRef(canvas.item,"minsky.canvas.item");
107  return canvas.item.get();
108  }
void registerRef(ItemPtr &item, const std::string &name)
register item as a TCL obj under name if it exists, otherwise deregister it
Definition: minskyTCL.h:73
Canvas canvas
Definition: minsky.h:256
bool getItemAt(float x, float y) override
item or wire obtained by get*At() calls
Definition: canvas.h:178
ItemPtr item
item or wire obtained by get*At() calls
Definition: canvas.h:175
Here is the call graph for this function:

◆ getItemAtFocus()

bool minsky::MinskyTCL::getItemAtFocus ( )
inline

Definition at line 130 of file minskyTCL.h.

References minsky::Minsky::canvas, minsky::Canvas::item, minsky::Canvas::itemFocus, and registerRef().

131  {
132  // deregister any old definitions, as item is polymorphic
133  TCL_obj_deregister("minsky.canvas.item");
135  registerRef(canvas.item,"minsky.canvas.item");
136  return canvas.item.get();
137  }
void registerRef(ItemPtr &item, const std::string &name)
register item as a TCL obj under name if it exists, otherwise deregister it
Definition: minskyTCL.h:73
Canvas canvas
Definition: minsky.h:256
ItemPtr itemFocus
item selected by clicking
Definition: canvas.h:106
ItemPtr item
item or wire obtained by get*At() calls
Definition: canvas.h:175
Here is the call graph for this function:

◆ getValue()

void minsky::MinskyTCL::getValue ( const std::string &  valueId)

generate a TCL_obj referring to variableValues[valueId]

Definition at line 141 of file minskyTCL.cc.

References minsky::minskyTCL_obj(), and minsky::valueId().

142  {
143  auto value=variableValues.find(valueId);
144  if (value!=variableValues.end())
145  TCL_obj(minskyTCL_obj(),"minsky.value",value->second);
146  else
147  TCL_obj_deregister("minsky.value");
148  }
VariableValues variableValues
Definition: minsky.h:200
string valueId(const string &x)
Definition: minskyTCL.h:363
ecolab::TCL_obj_t & minskyTCL_obj()
a TCL_obj_t that provides a hook for detecting model edits
Definition: minskyTCLObj.h:70
Here is the call graph for this function:

◆ getWireAt()

bool minsky::MinskyTCL::getWireAt ( float  x,
float  y 
)
inline

Definition at line 150 of file minskyTCL.h.

References minsky::Minsky::canvas, minsky::Canvas::getWireAt(), minsky::minskyTCL_obj(), and minsky::Canvas::wire.

151  {
152  canvas.getWireAt(x,y);
153  if (canvas.wire)
154  TCL_obj(minskyTCL_obj(),"minsky.canvas.wire",*canvas.wire);
155  else
156  TCL_obj_deregister("minsky.canvas.wire");
157  return canvas.wire.get();
158  }
WirePtr wire
item or wire obtained by get*At() calls
Definition: canvas.h:176
Canvas canvas
Definition: minsky.h:256
ecolab::TCL_obj_t & minskyTCL_obj()
a TCL_obj_t that provides a hook for detecting model edits
Definition: minskyTCLObj.h:70
bool getWireAt(float x, float y) override
item or wire obtained by get*At() calls
Definition: canvas.cc:432
Here is the call graph for this function:

◆ groupOfItem()

void minsky::MinskyTCL::groupOfItem ( )
inline

Definition at line 214 of file minskyTCL.h.

References minsky::Minsky::canvas, minsky::Canvas::item, and registerRef().

214  {
215  if (canvas.item) {
216  canvas.item=canvas.item->group.lock();
217  registerRef(canvas.item,"minsky.canvas.item");
218  }
219  }
void registerRef(ItemPtr &item, const std::string &name)
register item as a TCL obj under name if it exists, otherwise deregister it
Definition: minskyTCL.h:73
Canvas canvas
Definition: minsky.h:256
ItemPtr item
item or wire obtained by get*At() calls
Definition: canvas.h:175
Here is the call graph for this function:

◆ itemFocusFromItem()

bool minsky::MinskyTCL::itemFocusFromItem ( )
inline

Definition at line 91 of file minskyTCL.h.

References minsky::Minsky::canvas, minsky::Canvas::item, minsky::Canvas::itemFocus, and registerRef().

92  {
93  TCL_obj_deregister("minsky.canvas.item");
95  canvas.item.reset();
96  registerRef(canvas.item,"minsky.canvas.item");
97  registerRef(canvas.itemFocus,"minsky.canvas.itemFocus");
98  return canvas.item.get();
99  }
void registerRef(ItemPtr &item, const std::string &name)
register item as a TCL obj under name if it exists, otherwise deregister it
Definition: minskyTCL.h:73
Canvas canvas
Definition: minsky.h:256
ItemPtr itemFocus
item selected by clicking
Definition: canvas.h:106
ItemPtr item
item or wire obtained by get*At() calls
Definition: canvas.h:175
Here is the call graph for this function:

◆ itemFromItemFocus()

bool minsky::MinskyTCL::itemFromItemFocus ( )
inline

Definition at line 81 of file minskyTCL.h.

References minsky::Minsky::canvas, minsky::Canvas::item, minsky::Canvas::itemFocus, and registerRef().

82  {
83  TCL_obj_deregister("minsky.canvas.item");
85  canvas.itemFocus.reset();
86  registerRef(canvas.item,"minsky.canvas.item");
87  registerRef(canvas.itemFocus,"minsky.canvas.itemFocus");
88  return canvas.item.get();
89  }
void registerRef(ItemPtr &item, const std::string &name)
register item as a TCL obj under name if it exists, otherwise deregister it
Definition: minskyTCL.h:73
Canvas canvas
Definition: minsky.h:256
ItemPtr itemFocus
item selected by clicking
Definition: canvas.h:106
ItemPtr item
item or wire obtained by get*At() calls
Definition: canvas.h:175
Here is the call graph for this function:

◆ listAllInstances()

std::string minsky::MinskyTCL::listAllInstances ( ) const
inline

Definition at line 317 of file minskyTCL.h.

References minsky::Minsky::canvas, minsky::Canvas::item, minsky::minskyTCL_obj(), minsky::Canvas::model, and minsky::to_string().

317  {
318  if (auto v=canvas.item->variableCast())
319  {
320  std::string name="instanceList"+to_string(std::size_t(canvas.item.get()));
321  if (TCL_obj_properties().count(name)==0)
322  {
323  auto instanceList=new VariableInstanceList(*canvas.model, v->valueId());
324  // pass ownership of object to TCL interpreter
325  Tcl_CreateCommand
326  (ecolab::interp(), (name+".delete").c_str(),
327  (Tcl_CmdProc*)deleteTclObject<VariableInstanceList>,
328  (ClientData)instanceList,NULL);
329  TCL_obj(minskyTCL_obj(),name,*instanceList);
330  }
331  return name;
332  }
333  return "";
334  }
Model model
Definition: canvas.h:103
Canvas canvas
Definition: minsky.h:256
ecolab::TCL_obj_t & minskyTCL_obj()
a TCL_obj_t that provides a hook for detecting model edits
Definition: minskyTCLObj.h:70
string to_string(CONST84 char *x)
Definition: minskyTCLObj.h:33
ItemPtr item
item or wire obtained by get*At() calls
Definition: canvas.h:175
Here is the call graph for this function:

◆ load()

void minsky::MinskyTCL::load ( const std::string &  filename)
inline

load from a file

Definition at line 350 of file minskyTCL.h.

References minsky::Minsky::load(), and rebuildTCLcommands.

350  {
351  Minsky::load(filename);
352  // load resets the model pointer, etc, so request rebuilding of
353  // TCL commands
354  rebuildTCLcommands=true;
355  }
bool rebuildTCLcommands
Definition: minskyTCL.h:45
void load(const std::string &filename)
load from a file
Definition: minsky.cc:1048
Here is the call graph for this function:

◆ loadVariableFromCSV()

void minsky::MinskyTCL::loadVariableFromCSV ( const std::string &  specVar,
const std::string &  filename 
)
inline

Definition at line 336 of file minskyTCL.h.

References minsky::Minsky::canvas, clearBusyCursor(), minsky::Canvas::item, and setBusyCursor().

337  {
338  auto i=TCL_obj_properties().find(specVar);
339  if (i!=TCL_obj_properties().end())
340  if (auto spec=dynamic_cast<member_entry<DataSpec>*>(i->second.get()))
341  if (auto v=canvas.item->variableCast())
342  {
343  setBusyCursor();
344  v->importFromCSV({filename}, spec->memberptr->toSchema());
345  clearBusyCursor();
346  }
347  }
void setBusyCursor() override
set/clear busy cursor in GUI
Definition: minskyTCL.h:370
Canvas canvas
Definition: minsky.h:256
void clearBusyCursor() override
Definition: minskyTCL.h:372
ItemPtr item
item or wire obtained by get*At() calls
Definition: canvas.h:175
Here is the call graph for this function:

◆ matchingTableColumns()

std::set<string> minsky::MinskyTCL::matchingTableColumns ( const std::string &  currTable,
GodleyAssetClass::AssetClass  ac 
)
inline

Definition at line 64 of file minskyTCL.h.

References minsky::Minsky::matchingTableColumns().

64  {
65  auto it=TCL_obj_properties().find(currTable);
66  if (it!=TCL_obj_properties().end())
67  if (auto g=it->second->memberPtrCasted<GodleyIcon>())
68  return Minsky::matchingTableColumns(*g, ac);
69  return std::set<string>();
70  }
std::set< string > matchingTableColumns(const GodleyIcon &currTable, GodleyAssetClass::AssetClass ac)
Definition: minsky.cc:567
Here is the call graph for this function:

◆ message()

void minsky::MinskyTCL::message ( const std::string &  )
inlineoverridevirtual

display a message in a popup box on the GUI

Reimplemented from minsky::Minsky.

Definition at line 375 of file minskyTCL.h.

376  {(tclcmd()<<"if [llength [info command tk_messageBox]] {tk_messageBox -message \"")|m|"\" -type ok}\n";}

◆ numOpArgs()

int minsky::MinskyTCL::numOpArgs ( OperationType::Type  o)
static

Definition at line 203 of file minskyTCL.cc.

References minsky::op.

204  {
205  const OperationPtr op(o);
206  return op->numPorts()-1;
207  }

◆ openGodley()

std::string minsky::MinskyTCL::openGodley ( )
inline

Definition at line 304 of file minskyTCL.h.

References minsky::Minsky::canvas, minsky::Canvas::item, minsky::minskyTCL_obj(), and minsky::to_string().

304  {
305  if (auto gi=dynamic_pointer_cast<GodleyIcon>(canvas.item))
306  {
307  std::string name="godleyWindow"+to_string(std::size_t(canvas.item.get()));
308  if (TCL_obj_properties().count(name)==0)
309  {
310  TCL_obj(minskyTCL_obj(),name,*gi);
311  }
312  return name;
313  }
314  return "";
315  }
Canvas canvas
Definition: minsky.h:256
ecolab::TCL_obj_t & minskyTCL_obj()
a TCL_obj_t that provides a hook for detecting model edits
Definition: minskyTCLObj.h:70
string to_string(CONST84 char *x)
Definition: minskyTCLObj.h:33
ItemPtr item
item or wire obtained by get*At() calls
Definition: canvas.h:175
Here is the call graph for this function:

◆ openGroupInCanvas()

void minsky::MinskyTCL::openGroupInCanvas ( )
inline

reinitialises canvas to the group located in item

Definition at line 292 of file minskyTCL.h.

References minsky::Minsky::canvas, minsky::Canvas::item, minsky::minskyTCL_obj(), minsky::Canvas::model, and minsky::Canvas::openGroupInCanvas().

292  {
294  TCL_obj(minskyTCL_obj(),"minsky.canvas.model", *canvas.model);
295  }
void openGroupInCanvas(const ItemPtr &item)
reinitialises canvas to the group located in item
Definition: canvas.cc:692
Model model
Definition: canvas.h:103
Canvas canvas
Definition: minsky.h:256
ecolab::TCL_obj_t & minskyTCL_obj()
a TCL_obj_t that provides a hook for detecting model edits
Definition: minskyTCLObj.h:70
ItemPtr item
item or wire obtained by get*At() calls
Definition: canvas.h:175
Here is the call graph for this function:

◆ openModelInCanvas()

void minsky::MinskyTCL::openModelInCanvas ( )
inline

reinitialises canvas to the toplevel group

Definition at line 297 of file minskyTCL.h.

References minsky::Minsky::canvas, minsky::minskyTCL_obj(), minsky::Canvas::model, minsky::Minsky::model, and minsky::Canvas::openGroupInCanvas().

297  {
299  TCL_obj(minskyTCL_obj(),"minsky.canvas.model", *canvas.model);
300  }
void openGroupInCanvas(const ItemPtr &item)
reinitialises canvas to the group located in item
Definition: canvas.cc:692
Model model
Definition: canvas.h:103
Canvas canvas
Definition: minsky.h:256
ecolab::TCL_obj_t & minskyTCL_obj()
a TCL_obj_t that provides a hook for detecting model edits
Definition: minskyTCLObj.h:70
GroupPtr model
Definition: minsky.h:255
Here is the call graph for this function:

◆ operationIcon()

void minsky::MinskyTCL::operationIcon ( const char *  imageName,
const char *  opName 
) const

fill in a Tk image with the icon for a specific operation

Parameters
TkimageName
operationName

Definition at line 189 of file minskyTCL.cc.

190  {
191  if (string(opName)=="switch")
192  IconBase<SwitchIcon>(imageName).draw();
193  else if (string(opName)=="userFunction")
194  {
195  IconBase<UserFunction> uf(imageName);
196  uf.description("f(x)");
197  uf.draw();
198  }
199  else
200  IconBase<OperationIcon>(imageName, opName).draw();
201  }

◆ registerRef()

void minsky::MinskyTCL::registerRef ( ItemPtr item,
const std::string &  name 
)
inline

register item as a TCL obj under name if it exists, otherwise deregister it

Definition at line 73 of file minskyTCL.h.

References minsky::minskyTCL_obj().

Referenced by addGodley(), addGroup(), addIntegral(), addLock(), addNote(), addOperation(), addPlot(), addRavel(), addSheet(), addSwitch(), addVariable(), convertVarType(), createGroup(), findObject(), findVariable(), findVariableDefinition(), getItemAt(), getItemAtFocus(), groupOfItem(), itemFocusFromItem(), itemFromItemFocus(), resetItem(), retypeItem(), and selectVar().

74  {
75  if (item)
76  item->TCL_obj(minskyTCL_obj(),name);
77  else
78  TCL_obj_deregister(name);
79  }
ecolab::TCL_obj_t & minskyTCL_obj()
a TCL_obj_t that provides a hook for detecting model edits
Definition: minskyTCLObj.h:70
Here is the call graph for this function:
Here is the caller graph for this function:

◆ resetItem()

void minsky::MinskyTCL::resetItem ( )
inline

Definition at line 221 of file minskyTCL.h.

References minsky::Minsky::canvas, minsky::Canvas::item, and registerRef().

221  {
222  canvas.item.reset();
223  registerRef(canvas.item,"minsky.canvas.item");
224  }
void registerRef(ItemPtr &item, const std::string &name)
register item as a TCL obj under name if it exists, otherwise deregister it
Definition: minskyTCL.h:73
Canvas canvas
Definition: minsky.h:256
ItemPtr item
item or wire obtained by get*At() calls
Definition: canvas.h:175
Here is the call graph for this function:

◆ retypeItem()

void minsky::MinskyTCL::retypeItem ( VariableType::Type  type)
inline

Definition at line 111 of file minskyTCL.h.

References minsky::Minsky::canvas, minsky::Canvas::item, and registerRef().

112  {
113  if (canvas.item)
114  if (auto g=canvas.item->group.lock())
115  {
116  // snag a reference to the actual location of this item,
117  // so we can update canvas.item later. Ticket #1135.
118  auto itemItr=find(g->items.begin(), g->items.end(), canvas.item);
119  if (auto v=canvas.item->variableCast())
120  v->retype(type);
121  if (itemItr!=g->items.end())
122  {
123  canvas.item=*itemItr;
124  TCL_obj_deregister("minsky.canvas.item");
125  registerRef(canvas.item,"minsky.canvas.item");
126  }
127  }
128  }
void registerRef(ItemPtr &item, const std::string &name)
register item as a TCL obj under name if it exists, otherwise deregister it
Definition: minskyTCL.h:73
Canvas canvas
Definition: minsky.h:256
ItemPtr item
item or wire obtained by get*At() calls
Definition: canvas.h:175
Here is the call graph for this function:

◆ runItemDeletedCallback()

void minsky::MinskyTCL::runItemDeletedCallback ( const Item )
inlineoverridevirtual

run callback attached to item

Reimplemented from minsky::Minsky.

Definition at line 378 of file minskyTCL.h.

References minsky::Item::deleteCallback.

379  {tclcmd()<<item.deleteCallback<<'\n';}

◆ selectVar()

bool minsky::MinskyTCL::selectVar ( float  x,
float  y 
)
inline

Definition at line 226 of file minskyTCL.h.

References minsky::Minsky::canvas, minsky::Canvas::item, registerRef(), and minsky::Canvas::selectVar().

226  {
227  bool r=canvas.selectVar(x,y);
228  if (r)
229  registerRef(canvas.item,"minsky.canvas.item");
230  return r;
231  }
void registerRef(ItemPtr &item, const std::string &name)
register item as a TCL obj under name if it exists, otherwise deregister it
Definition: minskyTCL.h:73
bool selectVar(float x, float y)
populates item with a variable if (x,y) is over a variable part
Definition: canvas.cc:755
Canvas canvas
Definition: minsky.h:256
ItemPtr item
item or wire obtained by get*At() calls
Definition: canvas.h:175
Here is the call graph for this function:

◆ setBusyCursor()

void minsky::MinskyTCL::setBusyCursor ( )
inlineoverridevirtual

set/clear busy cursor in GUI

Reimplemented from minsky::Minsky.

Definition at line 370 of file minskyTCL.h.

Referenced by loadVariableFromCSV().

371  {tclcmd()<<"setCursor watch\n";}
Here is the caller graph for this function:

◆ setColour()

void minsky::MinskyTCL::setColour ( std::size_t  i,
const char *  name 
)

sets the colour of palette item i to Tk acceptable colour name

Definition at line 219 of file minskyTCL.cc.

References minsky::anonymous_namespace{minskyTCL.cc}::scale().

220  {
221  if (auto p=canvas.item->plotWidgetCast())
222  if (i<p->palette.size())
223  if (auto c=Tk_GetColor(interp(),Tk_MainWindow(interp()),name))
224  {
225  auto& pi=p->palette[i];
226  pi.colour.r=scale(c->red);
227  pi.colour.g=scale(c->green);
228  pi.colour.b=scale(c->blue);
229  pi.colour.a=1;
230  }
231  else
232  throw runtime_error(string("Colour ")+name+" not understood");
233  else
234  throw runtime_error("invalid palette index");
235  else
236  throw runtime_error("Not a plot");
237  }
Canvas canvas
Definition: minsky.h:256
ItemPtr item
item or wire obtained by get*At() calls
Definition: canvas.h:175
Here is the call graph for this function:

◆ startRecording()

void minsky::MinskyTCL::startRecording ( const char *  file)
inline

Definition at line 51 of file minskyTCL.h.

References eventRecord, and minsky::Minsky::minskyVersion.

51  {
52  eventRecord.reset(new std::ofstream(file));
53  *eventRecord<<"checkRecordingVersion "<<minskyVersion<<endl;
54  }
std::unique_ptr< std::ostream > eventRecord
Definition: minskyTCL.h:50
static const std::string minskyVersion
return the AEGIS assigned version number
Definition: minsky.h:337

◆ stopRecording()

void minsky::MinskyTCL::stopRecording ( )
inline

Definition at line 55 of file minskyTCL.h.

References eventRecord.

55  {
56  eventRecord.reset();
57  }
std::unique_ptr< std::ostream > eventRecord
Definition: minskyTCL.h:50

◆ TCLItem()

std::string minsky::MinskyTCL::TCLItem ( )
inline

create a TCL controlled object that is a reference to item

Returns
a unique TCL command lead in sequence, or empty if no such object is created

Definition at line 236 of file minskyTCL.h.

References minsky::Minsky::canvas, minsky::deleteTclObject< Item >(), minsky::Canvas::item, minsky::minskyTCL_obj(), and minsky::to_string().

236  {
237  std::string name="item"+std::to_string(std::size_t(canvas.item.get()));
238  if (canvas.item && !TCL_obj_properties().count(name)) {
239  canvas.item->TCL_obj(minskyTCL_obj(),name);
240  // create a reference to manage object's lifetime
241  Tcl_CreateCommand
242  (ecolab::interp(), (name+".delete").c_str(),
243  (Tcl_CmdProc*)deleteTclObject<Item>,
244  (ClientData)(new ItemPtr(canvas.item)),NULL);
245  }
246  return canvas.item? name: "";
247  }
template int deleteTclObject< Item >(ClientData cd, Tcl_Interp *interp, int argc, const char **argv)
std::shared_ptr< Item > ItemPtr
Definition: item.h:57
Canvas canvas
Definition: minsky.h:256
ecolab::TCL_obj_t & minskyTCL_obj()
a TCL_obj_t that provides a hook for detecting model edits
Definition: minskyTCLObj.h:70
string to_string(CONST84 char *x)
Definition: minskyTCLObj.h:33
ItemPtr item
item or wire obtained by get*At() calls
Definition: canvas.h:175
Here is the call graph for this function:

◆ undo()

void minsky::MinskyTCL::undo ( TCL_args  args)
inline

restore model to state changes ago

Definition at line 358 of file minskyTCL.h.

References minsky::Minsky::undo().

358  {
359  if (args.count) Minsky::undo(args);
360  else Minsky::undo();
361  }
long undo(int changes=1)
restore model to state changes ago
Definition: minsky.cc:1401
Here is the call graph for this function:

◆ valueId()

string minsky::MinskyTCL::valueId ( const string &  x)
inline

Definition at line 363 of file minskyTCL.h.

References minsky::valueId().

363 {return minsky::valueId(x);}
string valueId(const string &name)
construct a valueId from fully qualified name @ name should not be canonicalised
Definition: valueId.cc:75
Here is the call graph for this function:

Member Data Documentation

◆ _defaultFont

std::unique_ptr<char[]> minsky::MinskyTCL::_defaultFont
private

Definition at line 396 of file minskyTCL.h.

◆ defaultFont

ecolab::Accessor<std::string> minsky::MinskyTCL::defaultFont
Initial value:
{
[this]() {return Minsky::defaultFont();},
[this](const std::string& x) {return Minsky::defaultFont(x);}
}

Definition at line 365 of file minskyTCL.h.

◆ eventRecord

std::unique_ptr<std::ostream> minsky::MinskyTCL::eventRecord

Definition at line 50 of file minskyTCL.h.

Referenced by minsky::member_entry_hook(), startRecording(), and stopRecording().

◆ rebuildTCLcommands

bool minsky::MinskyTCL::rebuildTCLcommands =false

Definition at line 45 of file minskyTCL.h.

Referenced by load(), and minsky::member_entry_hook().


The documentation for this struct was generated from the following files: