55 void copyVars(
const std::vector<VariablePtr>&);
56 void reportDrawTime(
double)
override;
57 void mouseDownCommon(
float x,
float y);
58 bool redraw(
int x0,
int y0,
int width,
int height)
override;
59 void mouseMoveOnItem(
float x,
float y);
62 bool m_redrawRequested=
false;
68 typedef std::chrono::time_point<std::chrono::high_resolution_clock>
Timestamp;
71 Exclude<Timestamp> timestamp{Timestamp::clock::now()};
82 (*this)->group=parent;
87 parent=model->group.lock();
93 GroupPtr::operator=(model);
96 void zoom(
double x,
double y,
double z) {
97 if (fabs(x-(*this)->x())>1e-5 || fabs(y-(*this)->y())>1e-5)
112 bool rotatingItem=
false;
115 rotateOrigin=
Point(x,y);
135 return {model->x(), model->y()};
138 void zoom(
double x,
double y,
double z)
override {
143 double zoomFactor()
const override {
return model->zoomFactor();}
148 ecolab::cairo::SurfacePtr&
surface() {
return ecolab::CairoSurface::surface;}
151 void mouseDown(
float x,
float y)
override;
152 void controlMouseDown(
float x,
float y)
override;
153 void mouseUp(
float x,
float y)
override;
154 void mouseMove(
float x,
float y)
override;
156 void displayDelayedTooltip(
float x,
float y);
159 std::shared_ptr<Port> closestInPort(
float x,
float y)
const;
164 int ravelsSelected()
const;
169 moveOffsX=moveOffsY=0;
177 ItemPtr itemAt(
float x,
float y);
178 bool getItemAt(
float x,
float y)
override {
return (item=itemAt(x,y)).get();}
179 bool getWireAt(
float x,
float y)
override;
181 double defaultRotation=0;
185 itemFocus->rotation(defaultRotation);
189 setItemFocus(model->addItem(
VariablePtr(type,name)));
190 itemFocus->rotation(defaultRotation);
193 setItemFocus(model->addItem(
new Item));
194 itemFocus->detailedText(text);
208 void groupSelection();
212 void lockRavelsInSelection();
213 void unlockRavelsInSelection();
220 void delHandle(
float x,
float y);
222 void removeItemFromItsGroup();
225 void selectAllVariables();
227 void renameAllInstances(
const std::string& newName);
229 void renameItem(
const std::string& newName);
241 void openGroupInCanvas(
const ItemPtr& item);
245 if (
auto g=dynamic_cast<GodleyIcon*>(item.get()))
246 copyVars(g->flowVars());
250 if (
auto g=dynamic_cast<GodleyIcon*>(item.get()))
251 copyVars(g->stockVars());
255 void zoomToDisplay();
259 bool selectVar(
float x,
float y);
265 bool findVariableDefinition();
275 bool redrawUpdateRegion();
279 double zoom=1, left=0, top=0, width=1000, height=1000;
283 void renderToPNGCropped(
const std::string& filename,
const ZoomCrop&);
292 void requestRedraw() {m_redrawRequested=
true;
if (surface().
get()) surface()->requestRedraw();}
296 if (
auto p=item->plotWidgetCast())
297 defaultPlotOptions=*p;
300 void applyDefaultPlotOptions();
302 void setItemFromItemFocus();
308 template <>
struct is_smart_ptr<
minsky::Canvas::Model>:
public true_type {};
void addGroup()
item or wire obtained by get*At() calls
represents items that have been selected
void zoom(double x, double y, double z) override
void rotateItem(float x, float y)
Model & operator=(const GroupPtr &model)
PlotOptions defaultPlotOptions
options to apply to a new plot widget
std::vector< float > position() const override
current centre coordinates
WirePtr wire
item or wire obtained by get*At() calls
Canvas(const GroupPtr &m)
void addNote(const std::string &text)
item or wire obtained by get*At() calls
void addVariable(const std::string &name, VariableType::Type type)
item or wire obtained by get*At() calls
represents rectangular region of a lasso operation
int handleSelected
selected handle for handle moves, -ve = invalid
void setItemFocus(const ItemPtr &x)
sets itemFocus, and resets mouse offset for placement
std::shared_ptr< Item > ItemPtr
ClickType::Type clickType
std::shared_ptr< Wire > WirePtr
void addPlot()
item or wire obtained by get*At() calls
Exclude< shared_ptr< Port > > fromPort
from port when creating a new wire
bool redrawRequested() const
flag indicating that a redraw is requested, but not yet redrawn
void copyAllStockVars()
copy all stockVars of a GodleyIcon in item
void addSheet()
item or wire obtained by get*At() calls
Exclude< Point > rotateOrigin
starting mouse position when rotating
void copyAllFlowVars()
copy all flowVars of a GodleyIcon in item
ItemPtr itemIndicator
for drawing error indicator on the canvas
void addLock()
item or wire obtained by get*At() calls
bool hasScrollBars() const override
item or wire obtained by get*At() calls
void zoom(double x, double y, double z)
ecolab::cairo::SurfacePtr & surface()
static OperationBase * create(Type type)
factory method.
#define CLASSDESC_ACCESS(type)
void applyPlotOptions(PlotWidget &plot) const
bool getItemAt(float x, float y) override
item or wire obtained by get*At() calls
boost::geometry::model::d2::point_xy< float > Point
void addOperation(OperationType::Type op)
item or wire obtained by get*At() calls
void addGodley()
item or wire obtained by get*At() calls
void requestRedraw()
request a redraw on the screen
void addSwitch()
item or wire obtained by get*At() calls
NoAssign & operator=(const U &x)
ItemPtr itemFocus
item selected by clicking
void moveTo(float x, float y) override
move this so that (x,y) is centred
std::shared_ptr< Group > GroupPtr
double termY
terminal of wire when extending
std::chrono::time_point< std::chrono::high_resolution_clock > Timestamp
void zoom(float &val, float origin, float factor)
base zooming transformation
void setDefaultPlotOptions()
item or wire obtained by get*At() calls
NoAssign & operator=(const NoAssign &)
WirePtr wireFocus
wire that mouse is hovering over
void addRavel()
item or wire obtained by get*At() calls
double zoomFactor() const override
ItemPtr item
item or wire obtained by get*At() calls