62 void operationIcon(
const char* imageName,
const char* opName)
const;
65 auto it=TCL_obj_properties().find(currTable);
66 if (it!=TCL_obj_properties().end())
67 if (
auto g=it->second->memberPtrCasted<
GodleyIcon>())
69 return std::set<string>();
78 TCL_obj_deregister(name);
83 TCL_obj_deregister(
"minsky.canvas.item");
93 TCL_obj_deregister(
"minsky.canvas.item");
104 TCL_obj_deregister(
"minsky.canvas.item");
118 auto itemItr=find(g->items.begin(), g->items.end(),
canvas.
item);
121 if (itemItr!=g->items.end())
124 TCL_obj_deregister(
"minsky.canvas.item");
133 TCL_obj_deregister(
"minsky.canvas.item");
143 TCL_obj_deregister(
"minsky.canvas.item");
156 TCL_obj_deregister(
"minsky.canvas.wire");
238 if (
canvas.
item && !TCL_obj_properties().count(name)) {
242 (ecolab::interp(), (name+
".delete").c_str(),
250 void setColour(std::size_t i,
const char* name);
256 if (type==
"Group" && !
canvas.
model->groups.empty())
262 if ((*i)->classType()==type)
279 if (
auto v=dynamic_cast<VariableBase*>(i->get()))
305 if (
auto gi=dynamic_pointer_cast<GodleyIcon>(
canvas.
item))
308 if (TCL_obj_properties().count(name)==0)
321 if (TCL_obj_properties().count(name)==0)
326 (ecolab::interp(), (name+
".delete").c_str(),
327 (Tcl_CmdProc*)deleteTclObject<VariableInstanceList>,
328 (ClientData)instanceList,NULL);
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()))
344 v->importFromCSV({filename}, spec->memberptr->toSchema());
350 void load(
const std::string& filename) {
371 {tclcmd()<<
"setCursor watch\n";}
373 {tclcmd()<<
"setCursor {}\n";}
376 {(tclcmd()<<
"if [llength [info command tk_messageBox]] {tk_messageBox -message \"")|m|
"\" -type ok}\n";}
385 cmd<<
"tk_messageBox -message {Allocation will use more than 50% of available memory. Do you want to proceed?} -type yesno\n";
409 #include "minskyTCL.cd"
void addGroup()
item or wire obtained by get*At() calls
template int deleteTclObject< Item >(ClientData cd, Tcl_Interp *interp, int argc, const char **argv)
void message(const std::string &m) override
display a message in a popup box on the GUI
WirePtr wire
item or wire obtained by get*At() calls
CLASSDESC_ACCESS(MinskyTCL)
bool findVariableDefinition()
populates item with the defining variable if there is one. Leave item unchanged if it is not a variab...
void loadVariableFromCSV(const std::string &specVar, const std::string &filename)
std::unique_ptr< std::ostream > eventRecord
static int numOpArgs(OperationType::Type o)
CmdData getCommandData(const std::string &command) const override
return meta information on a given command
void startRecording(const char *file)
void openModelInCanvas()
reinitialises canvas to the toplevel group
void addNote(const std::string &text)
item or wire obtained by get*At() calls
MemCheckResult
check whether to proceed or abort, given a request to allocate bytes of memory. Implemented in Minsky...
int deleteTclObject(ClientData cd, Tcl_Interp *interp, int argc, const char **argv)
void addVariable(const std::string &name, VariableType::Type type)
item or wire obtained by get*At() calls
void load(const std::string &filename)
load from a file
std::shared_ptr< Item > ItemPtr
void openGroupInCanvas(const ItemPtr &item)
reinitialises canvas to the group located in item
void addPlot()
item or wire obtained by get*At() calls
string valueId(const string &name)
construct a valueId from fully qualified name @ name should not be canonicalised
void registerRef(ItemPtr &item, const std::string &name)
register item as a TCL obj under name if it exists, otherwise deregister it
void openGroupInCanvas()
reinitialises canvas to the group located in item
bool getItemAt(float x, float y)
void addSheet()
item or wire obtained by get*At() calls
void setBusyCursor() override
set/clear busy cursor in GUI
void addVariable(const std::string &name, VariableType::Type type)
std::size_t physicalMem() const
returns amount of memory installed on system
void operationIcon(const char *imageName, const char *opName) const
fill in a Tk image with the icon for a specific operation
void addOperation(OperationType::Type op)
bool selectVar(float x, float y)
populates item with a variable if (x,y) is over a variable part
void addLock()
item or wire obtained by get*At() calls
long undo(int changes=1)
restore model to state changes ago
Creation and access to the minskyTCL_obj object, which has code to record whenever Minsky's state cha...
void setColour(std::size_t i, const char *name)
sets the colour of palette item i to Tk acceptable colour name
std::vector< ItemPtr > Items
string valueId(const string &x)
std::unique_ptr< char[]> _defaultFont
void convertVarType(const std::string &name, VariableType::Type type)
void addIntegral()
add integral to current canvas item (which must be variable convertible to an integral variable ...
bool getItemAt(float x, float y) override
item or wire obtained by get*At() calls
std::string defaultFont()
the default used by Pango
void addOperation(OperationType::Type op)
item or wire obtained by get*At() calls
bool findVariableDefinition()
std::set< string > matchingTableColumns(const std::string &currTable, GodleyAssetClass::AssetClass ac)
void addGodley()
item or wire obtained by get*At() calls
ecolab::TCL_obj_t & minskyTCL_obj()
a TCL_obj_t that provides a hook for detecting model edits
bool getWireAt(float x, float y) override
item or wire obtained by get*At() calls
static const std::string minskyVersion
return the AEGIS assigned version number
void addSwitch()
item or wire obtained by get*At() calls
void load(const std::string &filename)
load from a file
bool selectVar(float x, float y)
void retypeItem(VariableType::Type type)
std::string TCLItem()
create a TCL controlled object that is a reference to item
void clearBusyCursor() override
ItemPtr itemFocus
item selected by clicking
bool findVariable(const std::string &name)
void getValue(const std::string &valueId)
generate a TCL_obj referring to variableValues[valueId]
void addNote(const std::string &text)
std::set< string > matchingTableColumns(const GodleyIcon &currTable, GodleyAssetClass::AssetClass ac)
cmd_data * getCommandData(const string &name)
void convertVarType(const std::string &name, VariableType::Type type)
Converts variable(s) named by name into a variable of type type.
MemCheckResult checkMemAllocation(std::size_t bytes) const override
void setTCL_objAttributes()
void groupSelection()
create a group from items found in the current selection
string to_string(CONST84 char *x)
bool getWireAt(float x, float y)
void runItemDeletedCallback(const Item &item) override
run callback attached to item
void undo(TCL_args args)
restore model to state changes ago
std::string listAllInstances() const
bool findObject(const std::string &type)
find first object of given type
void addRavel()
item or wire obtained by get*At() calls
OperationType::Group classifyOp(OperationType::Type o) const
static Group classify(Type t)
std::string deleteCallback
ItemPtr item
item or wire obtained by get*At() calls