Minsky
|
represents items that have been selected More...
#include <selection.h>
Public Member Functions | |
void | clear () |
void | toggleItemMembership (const ItemPtr &item) |
add item to selection if not present, or removes it if present groups handled as well More... | |
void | ensureItemInserted (const ItemPtr &item) |
check if item already present, and if not, inserts item delegates to ensureGroupInserted if passed a group More... | |
void | ensureGroupInserted (const GroupPtr &item) |
check if group already present, and if not, inserts it More... | |
void | insertItem (const ItemPtr &item) |
void | insertGroup (const GroupPtr &g) |
bool | contains (const ItemPtr &item) const |
return if item is contained in selection More... | |
virtual bool | contains (float xx, float yy) const |
bool | contains (const Point &p) const |
![]() | |
std::string | name () const override |
double | operator() (const std::vector< double > &p) override |
evaluate function on arbitrary number of arguments (exprtk support) More... | |
std::string | formula () const |
algebraic formula representing value of first output argument of this group More... | |
std::string | arguments () const |
argument declaration, to be appended to name() for function declaration More... | |
Group () | |
bool | nocycles () const override |
tests that groups are arranged heirarchically without any recurrence More... | |
GroupPtr | copy () const |
Make a copy of this as a sibling group (owned by parent). Attempting to copying minsky.model is a null operation. More... | |
GroupPtr | copyUnowned () const |
make a copy of this, that is not owned by any group More... | |
Group * | clone () const override |
ItemPtr | addItem (const std::shared_ptr< Item > &it, bool inSchema=false) override |
void | makeSubroutine () |
Make all variables not present in outerscope local to this group. More... | |
void | draw (cairo_t *) const override |
draw this item into a cairo context More... | |
void | drawEdgeVariables (cairo_t *) const |
draw representations of edge variables around group icon More... | |
void | draw1edge (const std::vector< VariablePtr > &vars, cairo_t *cairo, float x) const |
draw the variables of one of the edges More... | |
void | drawIORegion (cairo_t *) const |
draw notches in the I/O region to indicate dockability of variables there More... | |
void | moveContents (Group &source) |
move all items from source to this More... | |
IORegion::type | inIORegion (float x, float y) const |
void | checkAddIORegion (const ItemPtr &x) |
check if item is a variable and located in an I/O region, and add it if it is More... | |
void | addInputVar () |
void | addOutputVar () |
void | deleteItem (const Item &) |
remove item from group, and also all attached wires. More... | |
void | deleteAttachedWires () override |
delete all attached wires More... | |
void | resizeOnContents () |
adjust position and size of icon to just cover contents More... | |
void | resize (const LassoBox &x) override |
resize this item on the canvas More... | |
ClickType::Type | clickType (float x, float y) const override |
returns the clicktype given a mouse click at x, y. More... | |
bool | higher (const Group &) const |
returns true if this is higher in the heirarchy than the argument this->higher(*this) is false More... | |
unsigned | level () const |
return level in the heirarchy More... | |
const Group & | globalGroup () const |
top level group More... | |
Group & | globalGroup () |
bool | uniqueItems (std::set< void *> &idset) const |
returns true if items appear uniquely within the heirarchy. Note the map structure does not guarantee that an item doesn't appear within another group More... | |
bool | uniqueItems () const |
bool | displayContents () const |
returns whether contents should be displayed. Top level group always displayed More... | |
bool | displayContentsChanged () const |
true if displayContents status changed on this or any contained group last zoom More... | |
void | margins (float &left, float &right) const |
margin sizes to allow space for edge variables. More... | |
std::vector< float > | marginsV () const |
for debugging purposes More... | |
float | computeDisplayZoom () |
void | computeRelZoom () |
float | localZoom () const |
void | setZoom (float factor) |
sets the zoom factor to factor. Recursively set the zoomfactor on contained objects to the computed localzoom More... | |
void | zoom (float xOrigin, float yOrigin, float factor) |
float | edgeScale () const |
scale used to render io variables. Smoothly interpolates between the scale at which internal items are displayed, and the outside zoom factor More... | |
ecolab::array< double > | cBounds () const |
for TCL debugging More... | |
float | rotFactor () const |
scaling factor to allow a rotated icon to fit on the bitmap More... | |
ItemPtr | select (float x, float y) const override |
returns the variable if point (x,y) is within a I/O variable icon, null otherwise, indicating that the Group has been selected. More... | |
void | splitBoundaryCrossingWires () |
splits any wires that cross group boundaries More... | |
void | normaliseGroupRefs (const std::shared_ptr< Group > &self) |
fix up subgroup pointers self is a shared pointer ref to this More... | |
void | flipContents () |
rotate all conatined items by 180 degrees More... | |
std::vector< std::string > | accessibleVars () const |
return a list of existing variables a variable in this group could be connected to More... | |
std::vector< std::string > | bookmarkList () |
returns list of bookmark names for populating menu More... | |
void | addBookmarkXY (float dx, float dy, const std::string &name) |
void | addBookmark (const std::string &name) |
void | deleteBookmark (std::size_t i) |
void | gotoBookmark_b (const Bookmark &b) |
void | gotoBookmark (std::size_t i) |
std::string | defaultExtension () const |
return default extension for this group - .mky if no ravels in group, .rvl otherwise More... | |
void | autoLayout () |
automatically lay out items in this group using a graph layout algorithm More... | |
void | randomLayout () |
randomly lay out items in this group More... | |
std::vector< Summary > | summariseGodleys () const |
produce a summary of godley table variables More... | |
void | renameAllInstances (const std::string &valueId, const std::string &newName) |
rename all instances of a variable matching valueId to newName More... | |
ItemPtr | addItem (Item *it, bool inSchema=false) |
add item, ownership is passed More... | |
virtual ItemPtr | addItem (const std::shared_ptr< Item > &, bool inSchema=false) |
![]() | |
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 | inItem (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 | onMouseDown (float x, float y) |
respond to mouse down events More... | |
virtual void | onMouseUp (float x, float y) |
respond to mouse up events More... | |
virtual bool | onMouseMotion (float x, float y) |
respond to mouse motion events with button pressed More... | |
virtual bool | onMouseOver (float x, float y) |
respond to mouse motion events (hover) without button pressed More... | |
virtual void | onMouseLeave () |
respond to mouse leave events (when mouse leaves item) More... | |
virtual bool | onKeyPress (int keySym, const std::string &utf8, int state) |
respond to key press events 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 bool | editorMode () const |
some items have an editor mode attribute More... | |
virtual void | toggleEditorMode () |
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 void | destroyFrame () |
destroy any popup windows associated with 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 |
![]() | |
GroupItems () | |
virtual | ~GroupItems () |
GroupItems (const GroupItems &x) | |
GroupItems & | operator= (const GroupItems &) |
void | clear () |
bool | empty () const |
template<class M , class C > | |
const M::value_type | findAny (M GroupItems::*map, C c) const |
search for the first item in the heirarchy of map for which c is true. M::value_type must evaluate in a boolean environment to false if not valid C is of signature bool(M::value_type) More... | |
template<class R , class M , class C , class X > | |
std::vector< R > | findAll (C c, M(GroupItems::*m), X xfm) const |
finds all items/wires matching criterion c. Found items are transformed by xfm More... | |
WirePtr | removeWire (const Wire &) |
GroupPtr | removeGroup (const Group &) |
ItemPtr | findItem (const Item &it) const |
finds item within this group or subgroups. Returns null if not found More... | |
GroupPtr | findGroup (const Group &it) const |
finds group within this group or subgroups. Returns null if not found More... | |
WirePtr | findWire (const Wire &it) const |
finds wire within this group or subgroups. Returns null if not found More... | |
template<class C > | |
std::vector< ItemPtr > | findItems (C c) const |
returns list of items matching criterion c More... | |
template<class C > | |
std::vector< WirePtr > | findWires (C c) const |
returns list of wires matching criterion c More... | |
template<class C > | |
std::vector< GroupPtr > | findGroups (C c) const |
returns list of groups matching criterion c More... | |
ItemPtr | addItem (Item *it, bool inSchema=false) |
add item, ownership is passed More... | |
ItemPtr | removeItem (const Item &) |
GroupPtr | addGroup (const std::shared_ptr< Group > &) |
GroupPtr | addGroup (Group *g) |
WirePtr | addWire (const Item &from, const Item &to, unsigned toPortIdx) |
add a wire from item from, to item to, connecting to the toIdx port of to More... | |
WirePtr | addWire (const std::shared_ptr< Wire > &) |
WirePtr | addWire (Wire *w) |
WirePtr | addWire (const std::weak_ptr< Port > &from, const std::weak_ptr< Port > &to) |
std::size_t | numItems () const |
total number of items in this and child groups More... | |
std::size_t | numWires () const |
total number of wires in this and child groups More... | |
std::size_t | numGroups () const |
total number of groups in this and child groups More... | |
void | removeDisplayPlot () |
remove the display plot More... | |
template<class M , class O > | |
bool | recursiveDo (M GroupItems::*map, O op) const |
Perform action heirarchically on elements of map map. If op returns true, the operation terminates. returns true if operation terminates early, false if every element processed. O has signature bool(M, M::const_iterator) More... | |
template<class M , class O > | |
bool | recursiveDo (M GroupItems::*map, O op) |
O has signature bool(M&, M::iterator) More... | |
Additional Inherited Members | |
![]() | |
static void | drawSelected (cairo_t *cairo) |
![]() | |
static void | adjustWiresGroup (Wire &w) |
adjust wire's group to be the least common ancestor of its ports More... | |
![]() | |
std::string | title |
float | displayZoom {1} |
computes the zoom at which to show contents, given current contentBounds and width More... | |
float | relZoom {1} |
relative zoom contents of this group are displayed at More... | |
![]() | |
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... | |
![]() | |
Items | items |
Groups | groups |
Wires | wires |
std::set< Bookmark > | bookmarks |
std::vector< VariablePtr > | inVariables |
std::vector< VariablePtr > | outVariables |
std::vector< VariablePtr > | createdIOvariables |
classdesc::Exclude< std::weak_ptr< Group > > | self |
weak ref to this More... | |
classdesc::Exclude< std::shared_ptr< PlotWidget > > | displayPlot |
plot widget used for group icon More... | |
![]() | |
static SVGRenderer | svgRenderer |
![]() | |
const Group * | minimalEnclosingGroup (float x0, float y0, float x1, float y1, const Item *ignore=nullptr) const |
returns the smallest group whose icon completely encloses the rectangle given by the argument. If no candidate group found, returns nullptr. Weak reference returned, no ownership. More... | |
Group * | minimalEnclosingGroup (float x0, float y0, float x1, float y1, const Item *ignore=nullptr) |
float | contentBounds (double &x0, double &y0, double &x1, double &y1) const |
return bounding box coordinates for all variables, operators etc in this group. Returns the zoom scale (aka local zoom) of the contained items, or 1 if the group is empty. More... | |
![]() | |
WirePtr | addWire (const Item &from, const Item &to, unsigned toPortIdx, const std::vector< float > &coords) |
add a wire from item from, to item to, connecting to the toIdx port of to, with coordinates More... | |
WirePtr | addWire (const std::weak_ptr< Port > &from, const std::weak_ptr< Port > &to, const std::vector< float > &coords) |
void | renameVar (const GroupPtr &origGroup, VariableBase &v) |
rename variable so that it maintains most general scope possible More... | |
CLASSDESC_ACCESS (GroupItems) | |
![]() | |
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 |
represents items that have been selected
Definition at line 32 of file selection.h.
void minsky::Selection::clear | ( | ) |
Definition at line 30 of file selection.cc.
Referenced by minsky::VariableInstanceList::gotoInstance().
bool minsky::Selection::contains | ( | const ItemPtr & | item | ) | const |
|
inline |
Definition at line 196 of file item.h.
|
inline |
Definition at line 200 of file item.h.
void minsky::Selection::ensureGroupInserted | ( | const GroupPtr & | item | ) |
void minsky::Selection::ensureItemInserted | ( | const ItemPtr & | item | ) |
check if item already present, and if not, inserts item delegates to ensureGroupInserted if passed a group
Definition at line 60 of file selection.cc.
Referenced by minsky::VariableInstanceList::gotoInstance(), minsky::IntOp::insertControlled(), minsky::VariableBase::insertControlled(), and minsky::GodleyIcon::insertControlled().
|
inline |
void minsky::Selection::insertItem | ( | const ItemPtr & | item | ) |
Definition at line 81 of file selection.cc.
void minsky::Selection::toggleItemMembership | ( | const ItemPtr & | item | ) |
add item to selection if not present, or removes it if present groups handled as well
Definition at line 37 of file selection.cc.