Minsky
|
#include <godleyIcon.h>
Classes | |
struct | MoveCellArgs |
move the contents of cell at (srcRow, srcCol) to (destRow, destCol). More... | |
Public Types | |
typedef std::vector< VariablePtr > | Variables |
Public Member Functions | |
GodleyIcon () | |
GodleyIcon (const GodleyIcon &)=default | |
~GodleyIcon () | |
bool | editorMode () const override |
indicate whether icon is in editor mode or icon mode More... | |
void | toggleEditorMode () override |
bool | buttonDisplay () const |
enable/disable drawing buttons in table on canvas display More... | |
void | toggleButtons () |
bool | variableDisplay () const |
void | toggleVariableDisplay () |
void | adjustPopupWidgets () |
void | scaleIcon (float w, float h) |
scale icon until it's height or width matches h or w depending on which is minimum More... | |
float | leftMargin () const |
left margin of bank icon with Godley icon More... | |
float | bottomMargin () const |
bottom margin of bank icon with Godley icon More... | |
void | resize (const LassoBox &) override |
resize this item on the canvas More... | |
void | removeControlledItems (GroupItems &) override |
void | setCell (int row, int col, const string &val) |
set cell(row,col) with contents val More... | |
void | deleteRow (unsigned row) |
delete row before row More... | |
void | moveCell (const GodleyIcon::MoveCellArgs &) |
std::map< string, double > | flowSignature (unsigned col) const |
flows, along with multipliers, appearing in col More... | |
const Variables & | flowVars () const |
const Variables & | stockVars () const |
std::vector< Summary > | summarise () const |
summary of variables in this godley table More... | |
void | update () |
updates the variable lists with the Godley table More... | |
GodleyIcon * | clone () const override |
ItemPtr | select (float x, float y) const override |
returns the variable if point (x,y) is within a variable icon, null otherwise, indicating that the Godley table has been selected. More... | |
ClickType::Type | clickType (float x, float y) const override |
returns the clicktype given a mouse click at x, y. More... | |
void | draw (cairo_t *cairo) const override |
draw icon to context More... | |
std::string | rowSum (int row) const |
return the A-L-E row sum for row More... | |
std::string | valueId (const std::string &x) const |
returns valueid for variable reference in table More... | |
Units | stockVarUnits (const std::string &stockName, bool check) const |
performs dimensional analysis on stock var column stockName More... | |
void | setCurrency (const std::string ¤cy) |
void | insertControlled (Selection &selection) override |
void | onMouseDown (float, float) override |
respond to mouse down events More... | |
void | onMouseUp (float, float) override |
respond to mouse up events More... | |
bool | onMouseMotion (float, float) override |
respond to mouse motion events with button pressed More... | |
bool | onMouseOver (float, float) override |
respond to mouse motion events (hover) without button pressed More... | |
void | onMouseLeave () override |
respond to mouse leave events (when mouse leaves item) More... | |
bool | onKeyPress (int, const std::string &, int) override |
respond to key press events More... | |
bool | inItem (float, float) const override |
void | destroyFrame () override |
clean up popup window structures on window close More... | |
bool | wiresAttached () const |
return true if any wires are attached to the variables More... | |
const GodleyIcon * | godleyIconCast () const override |
GodleyIcon * | godleyIconCast () override |
![]() | |
std::string | classType () const override |
ItemT * | clone () const override |
void | TCL_obj (classdesc::TCL_obj_t &t, const std::string &d) override |
void | RESTProcess (classdesc::RESTProcess_t &rp, const std::string &d) override |
dummy template definition for use with gui executable More... | |
void | RESTProcess (classdesc::RESTProcess_t &rp, const std::string &d) const override |
void | json_pack (classdesc::json_pack_t &j) const override |
ItemT ()=default | |
ItemT (const ItemT &)=default | |
ItemT (ItemT &&)=delete | |
ItemT & | operator= (const ItemT &)=default |
ItemT & | operator= (ItemT &&)=delete |
![]() | |
Item () | |
virtual std::weak_ptr< Port > | ports (std::size_t i) const |
callback to be run when item deleted from group More... | |
std::size_t | portsSize () const |
number of ports More... | |
float | portX (std::size_t i) |
float | portY (std::size_t i) |
virtual bool | contains (float xx, float yy) const |
bool | contains (const Point &p) const |
void | updateBoundingBox () override |
void | throw_error (const std::string &) const |
mark item on canvas, then throw More... | |
virtual bool | ioVar () const |
indicates this is a group I/O variable More... | |
virtual double | value () const |
current value of output port More... | |
double | rotation () const |
double | rotation (const double &r) |
std::pair< double, bool > | rotationAsRadians () const |
return the rotation as radians, and whether rotation should have additional straight angle added for text that stays upright. More... | |
float | iWidth () const |
float | iWidth (const float &w) |
float | iHeight () const |
float | iHeight (const float &h) |
virtual void | flip () |
rotate icon though 180∘ More... | |
std::string | id () const |
return an id uniquely identifying this item More... | |
virtual float | x () const |
virtual float | y () const |
virtual float | zoomFactor () const |
void | ensureBBValid () const |
float | width () const |
float | height () const |
virtual std::vector< Point > | corners () const |
float | left () const |
float | right () const |
float | top () const |
float | bottom () const |
std::string | bookmarkId () const |
Id of bookmark associated with this. More... | |
void | adjustBookmark () const override |
adjust bookmark list to reflect current configuration More... | |
float | resizeHandleSize () const |
resize handles should be at least a percentage if the icon size (#1025) More... | |
virtual bool | onResizeHandle (float x, float y) const |
virtual bool | onItem (float x, float y) const |
returns true if (x,y) is on the icon More... | |
virtual void | deleteAttachedWires () |
delete all attached wires More... | |
virtual bool | visible () const |
whether this item is visible on the canvas. More... | |
void | moveTo (float x, float y) |
virtual float | scaleFactor () const |
factor by which item has been resized More... | |
virtual float | scaleFactor (const float &sf) |
void | dummyDraw () const |
draw into a dummy cairo context, for purposes of calculating port positions More... | |
virtual void | displayTooltip (cairo_t *, const std::string &) const |
display tooltip text, eg on mouseover More... | |
virtual void | updateIcon (double t) |
update display after a step() More... | |
Item (const Item &)=default | |
Item & | operator= (const Item &)=default |
virtual | ~Item () |
void | drawPorts (cairo_t *cairo) const |
virtual void | drawResizeHandles (cairo_t *cairo) const |
virtual std::shared_ptr< Port > | closestOutPort (float x, float y) const |
returns closest output port to x,y More... | |
virtual std::shared_ptr< Port > | closestInPort (float x, float y) const |
void | RESTProcess (classdesc::RESTProcess_t &rp, const std::string &d) override |
runs the RESTProcess descriptor suitable for this type More... | |
void | RESTProcess (classdesc::RESTProcess_t &rp, const std::string &d) const override |
virtual void | displayDelayedTooltip (float x, float y) |
enable extended tooltip help message appropriate for mouse at (x,y) More... | |
virtual void | disableDelayedTooltip () |
virtual Units | units (bool check=false) const |
compute the dimensional units More... | |
Units | checkUnits () const |
perform units consistency checks More... | |
ItemPtr | itemPtrFromThis () const |
return a shared_ptr to this More... | |
![]() | |
virtual std::string const & | detailedText () const |
virtual std::string const & | detailedText (const std::string &x) |
virtual std::string const & | tooltip () const |
virtual std::string const & | tooltip (const std::string &x) |
virtual | ~NoteBase ()=default |
Public Attributes | |
GodleyTable | table |
table data. Must be declared before editor More... | |
GodleyTableEditor | editor {*this} |
rendering as a godley table More... | |
GodleyTableWindow | popup {*this} |
for rendering the popup window More... | |
std::string | currency |
![]() | |
float | m_x =0 |
float | m_y =0 |
position in canvas, or within group More... | |
float | m_sf =1 |
scale factor of item on canvas, or within group More... | |
bool | onResizeHandles =false |
set to true to indicate mouse is ovcaler resize handles More... | |
bool | onBorder =false |
true to indicate mouse hovering over border More... | |
std::string | deleteCallback |
BoundingBox | bb |
canvas bounding box. More... | |
![]() | |
bool | mouseFocus =false |
true if target of a mouseover More... | |
bool | selected =false |
true if selected for cut, copy or group operation More... | |
bool | bookmark =false |
Is this item also a bookmark? More... | |
Static Public Attributes | |
static SVGRenderer | svgRenderer |
SVG icon to display when not in editor mode. More... | |
Private Member Functions | |
CLASSDESC_ACCESS (GodleyIcon) | |
void | updateBB () |
double | titleOffs () const |
void | updateVars (Variables &vars, const vector< string > &varNames, VariableBase::Type varType) |
void | positionVariables () const |
move contained variables to correct locations within icon More... | |
float | toEditorX (float) const |
convert mouse coordinates into editor coords More... | |
float | toEditorY (float) const |
convert mouse coordinates into editor coords More... | |
Private Attributes | |
float | flowMargin =0 |
for placement of bank icon within complex More... | |
float | stockMargin =0 |
bool | m_editorMode =false |
bool | m_variableDisplay =false |
Variables | m_flowVars |
Variables | m_stockVars |
Friends | |
struct | SchemaHelper |
Additional Inherited Members | |
![]() | |
static void | drawSelected (cairo_t *cairo) |
![]() | |
static void | drawResizeHandle (cairo_t *cairo, double x, double y, double sf, double angle) |
![]() | |
double | m_width =10 |
double | m_height =10 |
ItemPortVector | m_ports |
minsky::Item::MemoisedRotator | memoisedRotator |
Definition at line 41 of file godleyIcon.h.
typedef std::vector<VariablePtr> minsky::GodleyIcon::Variables |
Definition at line 111 of file godleyIcon.h.
|
inline |
Definition at line 64 of file godleyIcon.h.
References minsky::GodleyTableEditor::adjustWidgets(), minsky::GodleyTableEditor::disableButtons(), editor, minsky::Item::iHeight(), and minsky::Item::iWidth().
Referenced by clone().
|
default |
|
inline |
Definition at line 66 of file godleyIcon.h.
|
inline |
Definition at line 85 of file godleyIcon.h.
References minsky::GodleyTableEditor::adjustWidgets(), and popup.
|
inline |
bottom margin of bank icon with Godley icon
Definition at line 93 of file godleyIcon.h.
References minsky::Item::scaleFactor(), stockMargin, variableDisplay(), and minsky::Item::zoomFactor().
bool minsky::GodleyIcon::buttonDisplay | ( | ) | const |
enable/disable drawing buttons in table on canvas display
Definition at line 161 of file godleyIcon.cc.
|
private |
|
overridevirtual |
returns the clicktype given a mouse click at x, y.
Reimplemented from minsky::Item.
Definition at line 589 of file godleyIcon.cc.
|
inlineoverridevirtual |
Reimplemented from minsky::Item.
Definition at line 121 of file godleyIcon.h.
References GodleyIcon().
void minsky::GodleyIcon::deleteRow | ( | unsigned | row | ) |
delete row before row
Definition at line 225 of file godleyIcon.cc.
References minsky::Minsky::balanceDuplicateColumns(), and pyminsky::minsky.
|
inlineoverridevirtual |
clean up popup window structures on window close
Reimplemented from minsky::Item.
Definition at line 162 of file godleyIcon.h.
References minsky::RenderNativeWindow::destroyFrame(), and popup.
|
overridevirtual |
draw icon to context
Reimplemented from minsky::Item.
Definition at line 441 of file godleyIcon.cc.
References border, and minsky::latexToPango().
|
inlineoverridevirtual |
indicate whether icon is in editor mode or icon mode
Reimplemented from minsky::Item.
Definition at line 69 of file godleyIcon.h.
References m_editorMode.
map< string, double > minsky::GodleyIcon::flowSignature | ( | unsigned | col | ) | const |
flows, along with multipliers, appearing in col
Definition at line 258 of file godleyIcon.cc.
Referenced by minsky::Minsky::balanceColumns().
|
inline |
|
inlineoverride |
Definition at line 167 of file godleyIcon.h.
|
inlineoverride |
Definition at line 168 of file godleyIcon.h.
|
overridevirtual |
Reimplemented from minsky::Item.
Definition at line 89 of file godleyIcon.cc.
References border.
|
override |
Definition at line 581 of file godleyIcon.cc.
References minsky::Selection::ensureItemInserted().
|
inline |
left margin of bank icon with Godley icon
Definition at line 91 of file godleyIcon.h.
References flowMargin, minsky::Item::scaleFactor(), variableDisplay(), and minsky::Item::zoomFactor().
void minsky::GodleyIcon::moveCell | ( | const GodleyIcon::MoveCellArgs & | args | ) |
Definition at line 238 of file godleyIcon.cc.
References minsky::GodleyIcon::MoveCellArgs::destCol, minsky::GodleyIcon::MoveCellArgs::destRow, minsky::GodleyIcon::MoveCellArgs::srcCol, and minsky::GodleyIcon::MoveCellArgs::srcRow.
|
overridevirtual |
respond to key press events
Reimplemented from minsky::Item.
Definition at line 639 of file godleyIcon.cc.
|
overridevirtual |
respond to mouse down events
Reimplemented from minsky::Item.
Definition at line 609 of file godleyIcon.cc.
|
overridevirtual |
respond to mouse leave events (when mouse leaves item)
Reimplemented from minsky::Item.
Definition at line 627 of file godleyIcon.cc.
|
overridevirtual |
respond to mouse motion events with button pressed
Reimplemented from minsky::Item.
Definition at line 615 of file godleyIcon.cc.
|
overridevirtual |
respond to mouse motion events (hover) without button pressed
Reimplemented from minsky::Item.
Definition at line 621 of file godleyIcon.cc.
|
overridevirtual |
respond to mouse up events
Reimplemented from minsky::Item.
Definition at line 612 of file godleyIcon.cc.
|
private |
move contained variables to correct locations within icon
Definition at line 389 of file godleyIcon.cc.
|
override |
Definition at line 189 of file godleyIcon.cc.
References minsky::GroupItems::removeItem().
|
overridevirtual |
resize this item on the canvas
Reimplemented from minsky::Item.
Definition at line 177 of file godleyIcon.cc.
References minsky::LassoBox::x0, minsky::LassoBox::x1, minsky::LassoBox::y0, and minsky::LassoBox::y1.
string minsky::GodleyIcon::rowSum | ( | int | row | ) | const |
return the A-L-E row sum for row
Definition at line 522 of file godleyIcon.cc.
References minsky::str(), minsky::trimWS(), and minsky::valueId().
void minsky::GodleyIcon::scaleIcon | ( | float | w, |
float | h | ||
) |
scale icon until it's height or width matches h or w depending on which is minimum
Definition at line 171 of file godleyIcon.cc.
|
overridevirtual |
returns the variable if point (x,y) is within a variable icon, null otherwise, indicating that the Godley table has been selected.
Reimplemented from minsky::Item.
Definition at line 414 of file godleyIcon.cc.
void minsky::GodleyIcon::setCell | ( | int | row, |
int | col, | ||
const string & | val | ||
) |
set cell(row,col) with contents val
Definition at line 209 of file godleyIcon.cc.
References minsky::Minsky::balanceDuplicateColumns(), minsky::Minsky::importDuplicateColumn(), and pyminsky::minsky.
|
inline |
|
inline |
Units minsky::GodleyIcon::stockVarUnits | ( | const std::string & | stockName, |
bool | check | ||
) | const |
performs dimensional analysis on stock var column stockName
check | indicates whether a consistency check is applied |
Definition at line 545 of file godleyIcon.cc.
References minsky::cminsky(), minsky::Units::str(), minsky::Simulation::timeUnit, minsky::valueId(), and minsky::Minsky::variableValues.
vector< Summary > minsky::GodleyIcon::summarise | ( | ) | const |
summary of variables in this godley table
Definition at line 271 of file godleyIcon.cc.
|
inlineprivate |
Definition at line 59 of file godleyIcon.h.
References table, minsky::GodleyTable::title, and minsky::Item::zoomFactor().
|
private |
convert mouse coordinates into editor coords
Definition at line 604 of file godleyIcon.cc.
References border.
|
private |
convert mouse coordinates into editor coords
Definition at line 606 of file godleyIcon.cc.
References border.
void minsky::GodleyIcon::toggleButtons | ( | ) |
Definition at line 162 of file godleyIcon.cc.
|
overridevirtual |
void minsky::GodleyIcon::toggleVariableDisplay | ( | ) |
Definition at line 149 of file godleyIcon.cc.
void minsky::GodleyIcon::update | ( | ) |
updates the variable lists with the Godley table
Definition at line 289 of file godleyIcon.cc.
References minsky::anonymous_namespace{godleyIcon.cc}::accumulateWidthHeight(), minsky::FlowCoef::coef, minsky::Minsky::definingVar(), f, minsky::VariableValueData::godleyOverridden, minsky::VariableValue::init(), pyminsky::minsky, minsky::FlowCoef::str(), minsky::trimWS(), minsky::valueId(), and minsky::Minsky::variableValues.
|
inlineprivate |
Definition at line 52 of file godleyIcon.h.
References minsky::Item::bb, minsky::NoteBase::selected, and minsky::BoundingBox::update().
|
private |
Definition at line 94 of file godleyIcon.cc.
References minsky::Minsky::convertVarType(), and minsky::minsky().
|
inline |
returns valueid for variable reference in table
Definition at line 142 of file godleyIcon.h.
References minsky::valueId(), and minsky::Item::x().
Referenced by minsky::Minsky::balanceColumns(), and minsky::Minsky::balanceDuplicateColumns().
|
inline |
Definition at line 76 of file godleyIcon.h.
References m_variableDisplay.
Referenced by bottomMargin(), and leftMargin().
bool minsky::GodleyIcon::wiresAttached | ( | ) | const |
return true if any wires are attached to the variables
Definition at line 428 of file godleyIcon.cc.
|
friend |
Definition at line 49 of file godleyIcon.h.
std::string minsky::GodleyIcon::currency |
Definition at line 147 of file godleyIcon.h.
Referenced by setCurrency().
GodleyTableEditor minsky::GodleyIcon::editor {*this} |
|
private |
for placement of bank icon within complex
Definition at line 45 of file godleyIcon.h.
Referenced by leftMargin().
|
private |
Definition at line 46 of file godleyIcon.h.
Referenced by editorMode().
|
private |
Definition at line 176 of file godleyIcon.h.
Referenced by flowVars(), and minsky::SchemaHelper::setStockAndFlow().
|
private |
Definition at line 176 of file godleyIcon.h.
Referenced by setCurrency(), minsky::SchemaHelper::setStockAndFlow(), and stockVars().
|
private |
Definition at line 47 of file godleyIcon.h.
Referenced by minsky::SchemaHelper::setVariableDisplay(), and variableDisplay().
GodleyTableWindow minsky::GodleyIcon::popup {*this} |
for rendering the popup window
Definition at line 84 of file godleyIcon.h.
Referenced by adjustPopupWidgets(), and destroyFrame().
|
private |
Definition at line 45 of file godleyIcon.h.
Referenced by bottomMargin().
|
static |
SVG icon to display when not in editor mode.
Definition at line 62 of file godleyIcon.h.
Referenced by minsky::Minsky::setGodleyIconResource().
GodleyTable minsky::GodleyIcon::table |
table data. Must be declared before editor
Definition at line 80 of file godleyIcon.h.
Referenced by minsky::Minsky::balanceColumns(), minsky::Minsky::balanceDuplicateColumns(), schema3::Item::Item(), MathDAG::SystemOfEquations::processGodleyTable(), minsky::SchemaHelper::setPrivates(), and titleOffs().